Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
function useUniqueId(idProp) {
[14500] Fix | Delete
var instanceId = Object(external_wp_compose_["useInstanceId"])(InputBase);
[14501] Fix | Delete
var id = "input-base-control-".concat(instanceId);
[14502] Fix | Delete
return idProp || id;
[14503] Fix | Delete
}
[14504] Fix | Delete
[14505] Fix | Delete
function InputBase(_ref, ref) {
[14506] Fix | Delete
var __unstableInputWidth = _ref.__unstableInputWidth,
[14507] Fix | Delete
children = _ref.children,
[14508] Fix | Delete
className = _ref.className,
[14509] Fix | Delete
_ref$disabled = _ref.disabled,
[14510] Fix | Delete
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
[14511] Fix | Delete
_ref$hideLabelFromVis = _ref.hideLabelFromVision,
[14512] Fix | Delete
hideLabelFromVision = _ref$hideLabelFromVis === void 0 ? false : _ref$hideLabelFromVis,
[14513] Fix | Delete
labelPosition = _ref.labelPosition,
[14514] Fix | Delete
idProp = _ref.id,
[14515] Fix | Delete
_ref$isFocused = _ref.isFocused,
[14516] Fix | Delete
isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
[14517] Fix | Delete
label = _ref.label,
[14518] Fix | Delete
prefix = _ref.prefix,
[14519] Fix | Delete
_ref$size = _ref.size,
[14520] Fix | Delete
size = _ref$size === void 0 ? 'default' : _ref$size,
[14521] Fix | Delete
suffix = _ref.suffix,
[14522] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["__unstableInputWidth", "children", "className", "disabled", "hideLabelFromVision", "labelPosition", "id", "isFocused", "label", "prefix", "size", "suffix"]);
[14523] Fix | Delete
[14524] Fix | Delete
var id = useUniqueId(idProp);
[14525] Fix | Delete
return Object(external_wp_element_["createElement"])(input_control_styles_Root, Object(esm_extends["a" /* default */])({}, props, {
[14526] Fix | Delete
className: className,
[14527] Fix | Delete
isFocused: isFocused,
[14528] Fix | Delete
labelPosition: labelPosition,
[14529] Fix | Delete
ref: ref
[14530] Fix | Delete
}), Object(external_wp_element_["createElement"])(LabelWrapper, null, Object(external_wp_element_["createElement"])(label_Label, {
[14531] Fix | Delete
className: "components-input-control__label",
[14532] Fix | Delete
hideLabelFromVision: hideLabelFromVision,
[14533] Fix | Delete
labelPosition: labelPosition,
[14534] Fix | Delete
htmlFor: id,
[14535] Fix | Delete
size: size
[14536] Fix | Delete
}, label)), Object(external_wp_element_["createElement"])(Container, {
[14537] Fix | Delete
__unstableInputWidth: __unstableInputWidth,
[14538] Fix | Delete
className: "components-input-control__container",
[14539] Fix | Delete
disabled: disabled,
[14540] Fix | Delete
isFocused: isFocused,
[14541] Fix | Delete
labelPosition: labelPosition
[14542] Fix | Delete
}, prefix && Object(external_wp_element_["createElement"])(Prefix, {
[14543] Fix | Delete
className: "components-input-control__prefix"
[14544] Fix | Delete
}, prefix), children, suffix && Object(external_wp_element_["createElement"])(Suffix, {
[14545] Fix | Delete
className: "components-input-control__suffix"
[14546] Fix | Delete
}, suffix), Object(external_wp_element_["createElement"])(backdrop, {
[14547] Fix | Delete
"aria-hidden": "true",
[14548] Fix | Delete
disabled: disabled,
[14549] Fix | Delete
isFocused: isFocused,
[14550] Fix | Delete
label: label,
[14551] Fix | Delete
size: size
[14552] Fix | Delete
})));
[14553] Fix | Delete
}
[14554] Fix | Delete
/* harmony default export */ var input_base = (Object(external_wp_element_["forwardRef"])(InputBase));
[14555] Fix | Delete
[14556] Fix | Delete
// CONCATENATED MODULE: ./node_modules/react-use-gesture/dist/reactusegesture.esm.js
[14557] Fix | Delete
[14558] Fix | Delete
[14559] Fix | Delete
// vector add
[14560] Fix | Delete
function addV(v1, v2) {
[14561] Fix | Delete
return v1.map(function (v, i) {
[14562] Fix | Delete
return v + v2[i];
[14563] Fix | Delete
});
[14564] Fix | Delete
} // vector substract
[14565] Fix | Delete
[14566] Fix | Delete
function subV(v1, v2) {
[14567] Fix | Delete
return v1.map(function (v, i) {
[14568] Fix | Delete
return v - v2[i];
[14569] Fix | Delete
});
[14570] Fix | Delete
}
[14571] Fix | Delete
/**
[14572] Fix | Delete
* Calculates distance
[14573] Fix | Delete
* @param movement the difference between current and initial vectors
[14574] Fix | Delete
* @returns distance
[14575] Fix | Delete
*/
[14576] Fix | Delete
[14577] Fix | Delete
function calculateDistance(movement) {
[14578] Fix | Delete
return Math.hypot.apply(Math, movement);
[14579] Fix | Delete
}
[14580] Fix | Delete
function calculateAllGeometry(movement, delta) {
[14581] Fix | Delete
if (delta === void 0) {
[14582] Fix | Delete
delta = movement;
[14583] Fix | Delete
}
[14584] Fix | Delete
[14585] Fix | Delete
var dl = calculateDistance(delta);
[14586] Fix | Delete
var alpha = dl === 0 ? 0 : 1 / dl;
[14587] Fix | Delete
var direction = delta.map(function (v) {
[14588] Fix | Delete
return alpha * v;
[14589] Fix | Delete
});
[14590] Fix | Delete
var distance = calculateDistance(movement);
[14591] Fix | Delete
return {
[14592] Fix | Delete
distance: distance,
[14593] Fix | Delete
direction: direction
[14594] Fix | Delete
};
[14595] Fix | Delete
}
[14596] Fix | Delete
/**
[14597] Fix | Delete
* Calculates all kinematics
[14598] Fix | Delete
* @template T the expected vector type
[14599] Fix | Delete
* @param movement the difference between current and initial vectors
[14600] Fix | Delete
* @param delta the difference between current and previous vectors
[14601] Fix | Delete
* @param delta_t the time difference between current and previous timestamps
[14602] Fix | Delete
* @returns all kinematics
[14603] Fix | Delete
*/
[14604] Fix | Delete
[14605] Fix | Delete
function calculateAllKinematics(movement, delta, dt) {
[14606] Fix | Delete
var dl = calculateDistance(delta);
[14607] Fix | Delete
var alpha = dl === 0 ? 0 : 1 / dl;
[14608] Fix | Delete
var beta = dt === 0 ? 0 : 1 / dt;
[14609] Fix | Delete
var velocity = beta * dl;
[14610] Fix | Delete
var velocities = delta.map(function (v) {
[14611] Fix | Delete
return beta * v;
[14612] Fix | Delete
});
[14613] Fix | Delete
var direction = delta.map(function (v) {
[14614] Fix | Delete
return alpha * v;
[14615] Fix | Delete
});
[14616] Fix | Delete
var distance = calculateDistance(movement);
[14617] Fix | Delete
return {
[14618] Fix | Delete
velocities: velocities,
[14619] Fix | Delete
velocity: velocity,
[14620] Fix | Delete
distance: distance,
[14621] Fix | Delete
direction: direction
[14622] Fix | Delete
};
[14623] Fix | Delete
}
[14624] Fix | Delete
/**
[14625] Fix | Delete
* Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.
[14626] Fix | Delete
* This polyfill function is suggested by Mozilla:
[14627] Fix | Delete
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill
[14628] Fix | Delete
* @param x target number
[14629] Fix | Delete
*/
[14630] Fix | Delete
[14631] Fix | Delete
function sign(x) {
[14632] Fix | Delete
if (Math.sign) return Math.sign(x);
[14633] Fix | Delete
return Number(x > 0) - Number(x < 0) || +x;
[14634] Fix | Delete
}
[14635] Fix | Delete
[14636] Fix | Delete
function minMax(value, min, max) {
[14637] Fix | Delete
return Math.max(min, Math.min(value, max));
[14638] Fix | Delete
} // Based on @aholachek ;)
[14639] Fix | Delete
// https://twitter.com/chpwn/status/285540192096497664
[14640] Fix | Delete
// iOS constant = 0.55
[14641] Fix | Delete
// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5
[14642] Fix | Delete
[14643] Fix | Delete
[14644] Fix | Delete
function rubberband2(distance, constant) {
[14645] Fix | Delete
// default constant from the article is 0.7
[14646] Fix | Delete
return Math.pow(distance, constant * 5);
[14647] Fix | Delete
}
[14648] Fix | Delete
[14649] Fix | Delete
function rubberband(distance, dimension, constant) {
[14650] Fix | Delete
if (dimension === 0 || Math.abs(dimension) === Infinity) return rubberband2(distance, constant);
[14651] Fix | Delete
return distance * dimension * constant / (dimension + constant * distance);
[14652] Fix | Delete
}
[14653] Fix | Delete
[14654] Fix | Delete
function rubberbandIfOutOfBounds(position, min, max, constant) {
[14655] Fix | Delete
if (constant === void 0) {
[14656] Fix | Delete
constant = 0.15;
[14657] Fix | Delete
}
[14658] Fix | Delete
[14659] Fix | Delete
if (constant === 0) return minMax(position, min, max);
[14660] Fix | Delete
if (position < min) return -rubberband(min - position, max - min, constant) + min;
[14661] Fix | Delete
if (position > max) return +rubberband(position - max, max - min, constant) + max;
[14662] Fix | Delete
return position;
[14663] Fix | Delete
}
[14664] Fix | Delete
[14665] Fix | Delete
function _defineProperties(target, props) {
[14666] Fix | Delete
for (var i = 0; i < props.length; i++) {
[14667] Fix | Delete
var descriptor = props[i];
[14668] Fix | Delete
descriptor.enumerable = descriptor.enumerable || false;
[14669] Fix | Delete
descriptor.configurable = true;
[14670] Fix | Delete
if ("value" in descriptor) descriptor.writable = true;
[14671] Fix | Delete
Object.defineProperty(target, descriptor.key, descriptor);
[14672] Fix | Delete
}
[14673] Fix | Delete
}
[14674] Fix | Delete
[14675] Fix | Delete
function _createClass(Constructor, protoProps, staticProps) {
[14676] Fix | Delete
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
[14677] Fix | Delete
if (staticProps) _defineProperties(Constructor, staticProps);
[14678] Fix | Delete
return Constructor;
[14679] Fix | Delete
}
[14680] Fix | Delete
[14681] Fix | Delete
function _extends() {
[14682] Fix | Delete
_extends = Object.assign || function (target) {
[14683] Fix | Delete
for (var i = 1; i < arguments.length; i++) {
[14684] Fix | Delete
var source = arguments[i];
[14685] Fix | Delete
[14686] Fix | Delete
for (var key in source) {
[14687] Fix | Delete
if (Object.prototype.hasOwnProperty.call(source, key)) {
[14688] Fix | Delete
target[key] = source[key];
[14689] Fix | Delete
}
[14690] Fix | Delete
}
[14691] Fix | Delete
}
[14692] Fix | Delete
[14693] Fix | Delete
return target;
[14694] Fix | Delete
};
[14695] Fix | Delete
[14696] Fix | Delete
return _extends.apply(this, arguments);
[14697] Fix | Delete
}
[14698] Fix | Delete
[14699] Fix | Delete
function _inheritsLoose(subClass, superClass) {
[14700] Fix | Delete
subClass.prototype = Object.create(superClass.prototype);
[14701] Fix | Delete
subClass.prototype.constructor = subClass;
[14702] Fix | Delete
subClass.__proto__ = superClass;
[14703] Fix | Delete
}
[14704] Fix | Delete
[14705] Fix | Delete
function _objectWithoutPropertiesLoose(source, excluded) {
[14706] Fix | Delete
if (source == null) return {};
[14707] Fix | Delete
var target = {};
[14708] Fix | Delete
var sourceKeys = Object.keys(source);
[14709] Fix | Delete
var key, i;
[14710] Fix | Delete
[14711] Fix | Delete
for (i = 0; i < sourceKeys.length; i++) {
[14712] Fix | Delete
key = sourceKeys[i];
[14713] Fix | Delete
if (excluded.indexOf(key) >= 0) continue;
[14714] Fix | Delete
target[key] = source[key];
[14715] Fix | Delete
}
[14716] Fix | Delete
[14717] Fix | Delete
return target;
[14718] Fix | Delete
}
[14719] Fix | Delete
[14720] Fix | Delete
function _assertThisInitialized(self) {
[14721] Fix | Delete
if (self === void 0) {
[14722] Fix | Delete
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
[14723] Fix | Delete
}
[14724] Fix | Delete
[14725] Fix | Delete
return self;
[14726] Fix | Delete
}
[14727] Fix | Delete
[14728] Fix | Delete
function _unsupportedIterableToArray(o, minLen) {
[14729] Fix | Delete
if (!o) return;
[14730] Fix | Delete
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
[14731] Fix | Delete
var n = Object.prototype.toString.call(o).slice(8, -1);
[14732] Fix | Delete
if (n === "Object" && o.constructor) n = o.constructor.name;
[14733] Fix | Delete
if (n === "Map" || n === "Set") return Array.from(o);
[14734] Fix | Delete
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
[14735] Fix | Delete
}
[14736] Fix | Delete
[14737] Fix | Delete
function _arrayLikeToArray(arr, len) {
[14738] Fix | Delete
if (len == null || len > arr.length) len = arr.length;
[14739] Fix | Delete
[14740] Fix | Delete
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
[14741] Fix | Delete
[14742] Fix | Delete
return arr2;
[14743] Fix | Delete
}
[14744] Fix | Delete
[14745] Fix | Delete
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
[14746] Fix | Delete
var it;
[14747] Fix | Delete
[14748] Fix | Delete
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
[14749] Fix | Delete
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
[14750] Fix | Delete
if (it) o = it;
[14751] Fix | Delete
var i = 0;
[14752] Fix | Delete
return function () {
[14753] Fix | Delete
if (i >= o.length) return {
[14754] Fix | Delete
done: true
[14755] Fix | Delete
};
[14756] Fix | Delete
return {
[14757] Fix | Delete
done: false,
[14758] Fix | Delete
value: o[i++]
[14759] Fix | Delete
};
[14760] Fix | Delete
};
[14761] Fix | Delete
}
[14762] Fix | Delete
[14763] Fix | Delete
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
[14764] Fix | Delete
}
[14765] Fix | Delete
[14766] Fix | Delete
it = o[Symbol.iterator]();
[14767] Fix | Delete
return it.next.bind(it);
[14768] Fix | Delete
}
[14769] Fix | Delete
[14770] Fix | Delete
function noop() {}
[14771] Fix | Delete
/**
[14772] Fix | Delete
* TODO Beware that only optimized cases are covered in tests =)
[14773] Fix | Delete
* TODO Need to cover general case as well
[14774] Fix | Delete
*
[14775] Fix | Delete
* @param fns
[14776] Fix | Delete
*/
[14777] Fix | Delete
[14778] Fix | Delete
function chainFns() {
[14779] Fix | Delete
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
[14780] Fix | Delete
fns[_key] = arguments[_key];
[14781] Fix | Delete
}
[14782] Fix | Delete
[14783] Fix | Delete
if (fns.length === 0) return noop;
[14784] Fix | Delete
if (fns.length === 1) return fns[0];
[14785] Fix | Delete
return function () {
[14786] Fix | Delete
var result;
[14787] Fix | Delete
[14788] Fix | Delete
for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
[14789] Fix | Delete
var fn = _step.value;
[14790] Fix | Delete
result = fn.apply(this, arguments) || result;
[14791] Fix | Delete
}
[14792] Fix | Delete
[14793] Fix | Delete
return result;
[14794] Fix | Delete
};
[14795] Fix | Delete
}
[14796] Fix | Delete
/**
[14797] Fix | Delete
* Expects a simple value or 2D vector (an array with 2 elements) and
[14798] Fix | Delete
* always returns 2D vector. If simple value is passed, returns a
[14799] Fix | Delete
* vector with this value as both coordinates.
[14800] Fix | Delete
*
[14801] Fix | Delete
* @param value
[14802] Fix | Delete
*/
[14803] Fix | Delete
[14804] Fix | Delete
function ensureVector(value, fallback) {
[14805] Fix | Delete
if (value === undefined) {
[14806] Fix | Delete
if (fallback === undefined) {
[14807] Fix | Delete
throw new Error('Must define fallback value if undefined is expected');
[14808] Fix | Delete
}
[14809] Fix | Delete
[14810] Fix | Delete
value = fallback;
[14811] Fix | Delete
}
[14812] Fix | Delete
[14813] Fix | Delete
if (Array.isArray(value)) return value;
[14814] Fix | Delete
return [value, value];
[14815] Fix | Delete
}
[14816] Fix | Delete
/**
[14817] Fix | Delete
* Helper for defining a default value
[14818] Fix | Delete
*
[14819] Fix | Delete
* @param value
[14820] Fix | Delete
* @param fallback
[14821] Fix | Delete
*/
[14822] Fix | Delete
[14823] Fix | Delete
function assignDefault(value, fallback) {
[14824] Fix | Delete
return Object.assign({}, fallback, value || {});
[14825] Fix | Delete
}
[14826] Fix | Delete
/**
[14827] Fix | Delete
* Resolves getters (functions) by calling them
[14828] Fix | Delete
* If simple value is given it just passes through
[14829] Fix | Delete
*
[14830] Fix | Delete
* @param v
[14831] Fix | Delete
*/
[14832] Fix | Delete
[14833] Fix | Delete
function valueFn(v) {
[14834] Fix | Delete
if (typeof v === 'function') {
[14835] Fix | Delete
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
[14836] Fix | Delete
args[_key2 - 1] = arguments[_key2];
[14837] Fix | Delete
}
[14838] Fix | Delete
[14839] Fix | Delete
// @ts-ignore
[14840] Fix | Delete
return v.apply(void 0, args);
[14841] Fix | Delete
} else {
[14842] Fix | Delete
return v;
[14843] Fix | Delete
}
[14844] Fix | Delete
}
[14845] Fix | Delete
[14846] Fix | Delete
function resolveWith(config, resolvers) {
[14847] Fix | Delete
if (config === void 0) {
[14848] Fix | Delete
config = {};
[14849] Fix | Delete
}
[14850] Fix | Delete
[14851] Fix | Delete
var result = {};
[14852] Fix | Delete
[14853] Fix | Delete
for (var _i = 0, _Object$entries = Object.entries(resolvers); _i < _Object$entries.length; _i++) {
[14854] Fix | Delete
var _Object$entries$_i = _Object$entries[_i],
[14855] Fix | Delete
key = _Object$entries$_i[0],
[14856] Fix | Delete
resolver = _Object$entries$_i[1];
[14857] Fix | Delete
[14858] Fix | Delete
switch (typeof resolver) {
[14859] Fix | Delete
case 'function':
[14860] Fix | Delete
result[key] = resolver.call(result, config[key], key, config);
[14861] Fix | Delete
break;
[14862] Fix | Delete
[14863] Fix | Delete
case 'object':
[14864] Fix | Delete
result[key] = resolveWith(config[key], resolver);
[14865] Fix | Delete
break;
[14866] Fix | Delete
[14867] Fix | Delete
case 'boolean':
[14868] Fix | Delete
if (resolver) result[key] = config[key];
[14869] Fix | Delete
break;
[14870] Fix | Delete
}
[14871] Fix | Delete
}
[14872] Fix | Delete
[14873] Fix | Delete
return result;
[14874] Fix | Delete
}
[14875] Fix | Delete
[14876] Fix | Delete
/**
[14877] Fix | Delete
* Whether the browser supports GestureEvent (ie Safari)
[14878] Fix | Delete
* @returns true if the browser supports gesture event
[14879] Fix | Delete
*/
[14880] Fix | Delete
function supportsGestureEvents() {
[14881] Fix | Delete
try {
[14882] Fix | Delete
// TODO [TS] possibly find GestureEvent definitions?
[14883] Fix | Delete
// @ts-ignore: no type definitions for webkit GestureEvents
[14884] Fix | Delete
return 'constructor' in GestureEvent;
[14885] Fix | Delete
} catch (e) {
[14886] Fix | Delete
return false;
[14887] Fix | Delete
}
[14888] Fix | Delete
}
[14889] Fix | Delete
function supportsTouchEvents() {
[14890] Fix | Delete
return typeof window !== 'undefined' && 'ontouchstart' in window;
[14891] Fix | Delete
}
[14892] Fix | Delete
function supportsPointerEvents() {
[14893] Fix | Delete
return typeof window !== 'undefined' && 'onpointerdown' in window;
[14894] Fix | Delete
}
[14895] Fix | Delete
[14896] Fix | Delete
function getEventTouches(event) {
[14897] Fix | Delete
if ('pointerId' in event) return null;
[14898] Fix | Delete
return event.type === 'touchend' ? event.changedTouches : event.targetTouches;
[14899] Fix | Delete
}
[14900] Fix | Delete
[14901] Fix | Delete
function getTouchIds(event) {
[14902] Fix | Delete
return Array.from(getEventTouches(event)).map(function (t) {
[14903] Fix | Delete
return t.identifier;
[14904] Fix | Delete
});
[14905] Fix | Delete
}
[14906] Fix | Delete
function getGenericEventData(event) {
[14907] Fix | Delete
var buttons = 'buttons' in event ? event.buttons : 0;
[14908] Fix | Delete
var shiftKey = event.shiftKey,
[14909] Fix | Delete
altKey = event.altKey,
[14910] Fix | Delete
metaKey = event.metaKey,
[14911] Fix | Delete
ctrlKey = event.ctrlKey; // TODO check if this might create some overrides?
[14912] Fix | Delete
[14913] Fix | Delete
return {
[14914] Fix | Delete
buttons: buttons,
[14915] Fix | Delete
shiftKey: shiftKey,
[14916] Fix | Delete
altKey: altKey,
[14917] Fix | Delete
metaKey: metaKey,
[14918] Fix | Delete
ctrlKey: ctrlKey
[14919] Fix | Delete
};
[14920] Fix | Delete
}
[14921] Fix | Delete
[14922] Fix | Delete
var identity = function identity(xy) {
[14923] Fix | Delete
return xy;
[14924] Fix | Delete
};
[14925] Fix | Delete
/**
[14926] Fix | Delete
* Gets pointer event values.
[14927] Fix | Delete
* @param event
[14928] Fix | Delete
* @returns pointer event values
[14929] Fix | Delete
*/
[14930] Fix | Delete
[14931] Fix | Delete
[14932] Fix | Delete
function getPointerEventValues(event, transform) {
[14933] Fix | Delete
if (transform === void 0) {
[14934] Fix | Delete
transform = identity;
[14935] Fix | Delete
}
[14936] Fix | Delete
[14937] Fix | Delete
var touchEvents = getEventTouches(event);
[14938] Fix | Delete
[14939] Fix | Delete
var _ref = touchEvents ? touchEvents[0] : event,
[14940] Fix | Delete
clientX = _ref.clientX,
[14941] Fix | Delete
clientY = _ref.clientY;
[14942] Fix | Delete
[14943] Fix | Delete
return transform([clientX, clientY]);
[14944] Fix | Delete
}
[14945] Fix | Delete
/**
[14946] Fix | Delete
* Gets two touches event data
[14947] Fix | Delete
* @param event
[14948] Fix | Delete
* @returns two touches event data
[14949] Fix | Delete
*/
[14950] Fix | Delete
[14951] Fix | Delete
function getTwoTouchesEventValues(event, pointerIds, transform) {
[14952] Fix | Delete
if (transform === void 0) {
[14953] Fix | Delete
transform = identity;
[14954] Fix | Delete
}
[14955] Fix | Delete
[14956] Fix | Delete
var _Array$from$filter = Array.from(event.touches).filter(function (t) {
[14957] Fix | Delete
return pointerIds.includes(t.identifier);
[14958] Fix | Delete
}),
[14959] Fix | Delete
A = _Array$from$filter[0],
[14960] Fix | Delete
B = _Array$from$filter[1];
[14961] Fix | Delete
[14962] Fix | Delete
if (!A || !B) throw Error("The event doesn't have two pointers matching the pointerIds");
[14963] Fix | Delete
var dx = B.clientX - A.clientX;
[14964] Fix | Delete
var dy = B.clientY - A.clientY;
[14965] Fix | Delete
var cx = (B.clientX + A.clientX) / 2;
[14966] Fix | Delete
var cy = (B.clientY + A.clientY) / 2; // const e: any = 'nativeEvent' in event ? event.nativeEvent : event
[14967] Fix | Delete
[14968] Fix | Delete
var distance = Math.hypot(dx, dy); // FIXME rotation has inconsistant values so we're not using it atm
[14969] Fix | Delete
// const angle = (e.rotation as number) ?? -(Math.atan2(dx, dy) * 180) / Math.PI
[14970] Fix | Delete
[14971] Fix | Delete
var angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
[14972] Fix | Delete
var values = transform([distance, angle]);
[14973] Fix | Delete
var origin = transform([cx, cy]);
[14974] Fix | Delete
return {
[14975] Fix | Delete
values: values,
[14976] Fix | Delete
origin: origin
[14977] Fix | Delete
};
[14978] Fix | Delete
}
[14979] Fix | Delete
/**
[14980] Fix | Delete
* Gets scroll event values
[14981] Fix | Delete
* @param event
[14982] Fix | Delete
* @returns scroll event values
[14983] Fix | Delete
*/
[14984] Fix | Delete
[14985] Fix | Delete
function getScrollEventValues(event, transform) {
[14986] Fix | Delete
if (transform === void 0) {
[14987] Fix | Delete
transform = identity;
[14988] Fix | Delete
}
[14989] Fix | Delete
[14990] Fix | Delete
// If the currentTarget is the window then we return the scrollX/Y position.
[14991] Fix | Delete
// If not (ie the currentTarget is a DOM element), then we return scrollLeft/Top
[14992] Fix | Delete
var _event$currentTarget = event.currentTarget,
[14993] Fix | Delete
scrollX = _event$currentTarget.scrollX,
[14994] Fix | Delete
scrollY = _event$currentTarget.scrollY,
[14995] Fix | Delete
scrollLeft = _event$currentTarget.scrollLeft,
[14996] Fix | Delete
scrollTop = _event$currentTarget.scrollTop;
[14997] Fix | Delete
return transform([scrollX || scrollLeft || 0, scrollY || scrollTop || 0]);
[14998] Fix | Delete
} // wheel delta defaults from https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
[14999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function