@swipefindercom/finder-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,20 +30,7 @@ function usePresence(subscribe = true) {
30
30
  const isBrowser = typeof window !== "undefined";
31
31
  const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
32
32
  const noop = /* @__NO_SIDE_EFFECTS__ */ (any) => any;
33
- let warning = noop;
34
33
  let invariant = noop;
35
- if (process.env.NODE_ENV !== "production") {
36
- warning = (check, message) => {
37
- if (!check && typeof console !== "undefined") {
38
- console.warn(message);
39
- }
40
- };
41
- invariant = (check, message) => {
42
- if (!check) {
43
- throw new Error(message);
44
- }
45
- };
46
- }
47
34
  const MotionGlobalConfig = {
48
35
  useManualTiming: false
49
36
  };
@@ -163,16 +150,16 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
163
150
  };
164
151
  const schedule = stepsOrder.reduce((acc, key) => {
165
152
  const step = steps[key];
166
- acc[key] = (process2, keepAlive = false, immediate = false) => {
153
+ acc[key] = (process, keepAlive = false, immediate = false) => {
167
154
  if (!runNextFrame)
168
155
  wake();
169
- return step.schedule(process2, keepAlive, immediate);
156
+ return step.schedule(process, keepAlive, immediate);
170
157
  };
171
158
  return acc;
172
159
  }, {});
173
- const cancel = (process2) => {
160
+ const cancel = (process) => {
174
161
  for (let i = 0; i < stepsOrder.length; i++) {
175
- steps[stepsOrder[i]].cancel(process2);
162
+ steps[stepsOrder[i]].cancel(process);
176
163
  }
177
164
  };
178
165
  return { schedule, cancel, state, steps };
@@ -270,22 +257,12 @@ function filterProps(props, isDom, forwardMotionProps) {
270
257
  }
271
258
  return filteredProps;
272
259
  }
273
- const warned = /* @__PURE__ */ new Set();
274
- function warnOnce(condition, message, element) {
275
- if (condition || warned.has(message))
276
- return;
277
- console.warn(message);
278
- warned.add(message);
279
- }
280
260
  function createDOMMotionComponentProxy(componentFactory) {
281
261
  if (typeof Proxy === "undefined") {
282
262
  return componentFactory;
283
263
  }
284
264
  const componentCache = /* @__PURE__ */ new Map();
285
265
  const deprecatedFactoryFunction = (...args) => {
286
- if (process.env.NODE_ENV !== "production") {
287
- warnOnce(false, "motion() is deprecated. Use motion.create() instead.");
288
- }
289
266
  return componentFactory(...args);
290
267
  };
291
268
  return new Proxy(deprecatedFactoryFunction, {
@@ -480,7 +457,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
480
457
  const context = useCreateMotionContext(props);
481
458
  const visualState = useVisualState(props, isStatic);
482
459
  if (!isStatic && isBrowser) {
483
- useStrictMode(configAndProps, preloadedFeatures);
460
+ useStrictMode();
484
461
  const layoutProjection = getProjectionFunctionality(configAndProps);
485
462
  MeasureLayout2 = layoutProjection.MeasureLayout;
486
463
  context.visualElement = useVisualElement(Component2, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
@@ -497,11 +474,7 @@ function useLayoutId({ layoutId }) {
497
474
  return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId;
498
475
  }
499
476
  function useStrictMode(configAndProps, preloadedFeatures) {
500
- const isStrict = useContext(LazyContext).strict;
501
- if (process.env.NODE_ENV !== "production" && preloadedFeatures && isStrict) {
502
- const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
503
- configAndProps.ignoreStrict ? warning(false, strictMessage) : invariant(false, strictMessage);
504
- }
477
+ useContext(LazyContext).strict;
505
478
  }
506
479
  function getProjectionFunctionality(props) {
507
480
  const { drag: drag2, layout: layout2 } = featureDefinitions;
@@ -1331,9 +1304,6 @@ class MotionValue {
1331
1304
  * @deprecated
1332
1305
  */
1333
1306
  onChange(subscription) {
1334
- if (process.env.NODE_ENV !== "production") {
1335
- warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
1336
- }
1337
1307
  return this.on("change", subscription);
1338
1308
  }
1339
1309
  on(eventName, callback) {
@@ -2150,9 +2120,7 @@ function parseCSSVariable(current) {
2150
2120
  const [, token1, token2, fallback] = match;
2151
2121
  return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback];
2152
2122
  }
2153
- const maxDepth = 4;
2154
2123
  function getVariableValue(current, element, depth = 1) {
2155
- invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`);
2156
2124
  const [token, fallback] = parseCSSVariable(current);
2157
2125
  if (!token)
2158
2126
  return;
@@ -2291,7 +2259,6 @@ function canAnimate(keyframes2, name, type, velocity) {
2291
2259
  const targetKeyframe = keyframes2[keyframes2.length - 1];
2292
2260
  const isOriginAnimatable = isAnimatable(originKeyframe, name);
2293
2261
  const isTargetAnimatable = isAnimatable(targetKeyframe, name);
2294
- warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
2295
2262
  if (!isOriginAnimatable || !isTargetAnimatable) {
2296
2263
  return false;
2297
2264
  }
@@ -2457,7 +2424,6 @@ const colorTypes = [hex, rgba, hsla];
2457
2424
  const getColorType = (v) => colorTypes.find((type) => type.test(v));
2458
2425
  function asRGBA(color2) {
2459
2426
  const type = getColorType(color2);
2460
- warning(Boolean(type), `'${color2}' is not an animatable color. Use the equivalent color code instead.`);
2461
2427
  if (!Boolean(type))
2462
2428
  return false;
2463
2429
  let model = type.parse(color2);
@@ -2556,7 +2522,6 @@ const mixComplex = (origin, target) => {
2556
2522
  }
2557
2523
  return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
2558
2524
  } else {
2559
- warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
2560
2525
  return mixImmediate(origin, target);
2561
2526
  }
2562
2527
  };
@@ -2605,7 +2570,6 @@ const safeMin = 1e-3;
2605
2570
  function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
2606
2571
  let envelope;
2607
2572
  let derivative;
2608
- warning(duration <= /* @__PURE__ */ secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
2609
2573
  let dampingRatio = 1 - bounce;
2610
2574
  dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
2611
2575
  duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration));
@@ -2854,11 +2818,10 @@ const easingLookup = {
2854
2818
  };
2855
2819
  const easingDefinitionToFunction = (definition) => {
2856
2820
  if (isBezierDefinition(definition)) {
2857
- invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
2821
+ invariant(definition.length === 4);
2858
2822
  const [x1, y1, x2, y2] = definition;
2859
2823
  return cubicBezier(x1, y1, x2, y2);
2860
2824
  } else if (typeof definition === "string") {
2861
- invariant(easingLookup[definition] !== void 0, `Invalid easing type '${definition}'`);
2862
2825
  return easingLookup[definition];
2863
2826
  }
2864
2827
  return definition;
@@ -2879,7 +2842,7 @@ function createMixers(output, ease2, customMixer) {
2879
2842
  }
2880
2843
  function interpolate(input, output, { clamp: isClamp = true, ease: ease2, mixer } = {}) {
2881
2844
  const inputLength = input.length;
2882
- invariant(inputLength === output.length, "Both input and output ranges must be the same length");
2845
+ invariant(inputLength === output.length);
2883
2846
  if (inputLength === 1)
2884
2847
  return () => output[0];
2885
2848
  if (inputLength === 2 && output[0] === output[1])
@@ -3005,9 +2968,6 @@ class MainThreadAnimation extends BaseAnimation {
3005
2968
  let mapPercentToKeyframes;
3006
2969
  let mirroredGenerator;
3007
2970
  if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
3008
- if (process.env.NODE_ENV !== "production") {
3009
- invariant(keyframes$1.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`);
3010
- }
3011
2971
  mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
3012
2972
  keyframes$1 = [0, 100];
3013
2973
  }
@@ -4551,7 +4511,6 @@ class VisualElementDragControls {
4551
4511
  if (!constraints || !isRefObject(constraints))
4552
4512
  return false;
4553
4513
  const constraintsElement = constraints.current;
4554
- invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
4555
4514
  const { projection } = this.visualElement;
4556
4515
  if (!projection || !projection.layout)
4557
4516
  return false;
@@ -6672,9 +6631,6 @@ function updateMotionValuesFromProps(element, next, prev) {
6672
6631
  const prevValue = prev[key];
6673
6632
  if (isMotionValue(nextValue)) {
6674
6633
  element.addValue(key, nextValue);
6675
- if (process.env.NODE_ENV === "development") {
6676
- warnOnce(nextValue.version === "11.18.2", `Attempting to mix Motion versions ${nextValue.version} with 11.18.2 may not work as expected.`);
6677
- }
6678
6634
  } else if (isMotionValue(prevValue)) {
6679
6635
  element.addValue(key, motionValue(nextValue, { owner: element }));
6680
6636
  } else if (prevValue !== nextValue) {
@@ -6786,9 +6742,6 @@ class VisualElement {
6786
6742
  initPrefersReducedMotion();
6787
6743
  }
6788
6744
  this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current;
6789
- if (process.env.NODE_ENV !== "production") {
6790
- warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.");
6791
- }
6792
6745
  if (this.parent)
6793
6746
  this.parent.children.add(this);
6794
6747
  this.update(this.props, this.presenceContext);
@@ -7240,7 +7193,6 @@ function setValues(visualElement, definition) {
7240
7193
  }
7241
7194
  }
7242
7195
  function animationControls() {
7243
- let hasMounted = false;
7244
7196
  const subscribers = /* @__PURE__ */ new Set();
7245
7197
  const controls = {
7246
7198
  subscribe(visualElement) {
@@ -7248,7 +7200,6 @@ function animationControls() {
7248
7200
  return () => void subscribers.delete(visualElement);
7249
7201
  },
7250
7202
  start(definition, transitionOverride) {
7251
- invariant(hasMounted, "controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.");
7252
7203
  const animations2 = [];
7253
7204
  subscribers.forEach((visualElement) => {
7254
7205
  animations2.push(animateVisualElement(visualElement, definition, {
@@ -7258,7 +7209,6 @@ function animationControls() {
7258
7209
  return Promise.all(animations2);
7259
7210
  },
7260
7211
  set(definition) {
7261
- invariant(hasMounted, "controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook.");
7262
7212
  return subscribers.forEach((visualElement) => {
7263
7213
  setValues(visualElement, definition);
7264
7214
  });
@@ -7269,9 +7219,7 @@ function animationControls() {
7269
7219
  });
7270
7220
  },
7271
7221
  mount() {
7272
- hasMounted = true;
7273
7222
  return () => {
7274
- hasMounted = false;
7275
7223
  controls.stop();
7276
7224
  };
7277
7225
  }
@@ -7361,7 +7309,6 @@ function compareByTime(a, b) {
7361
7309
  }
7362
7310
  }
7363
7311
  const defaultSegmentEasing = "easeInOut";
7364
- const MAX_REPEAT = 20;
7365
7312
  function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...sequenceTransition } = {}, scope, generators2) {
7366
7313
  const defaultDuration = defaultTransition.duration || 0.3;
7367
7314
  const animationDefinitions = /* @__PURE__ */ new Map();
@@ -7415,7 +7362,6 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
7415
7362
  remainder > 0 && fillOffset(times, remainder);
7416
7363
  valueKeyframesAsList.length === 1 && valueKeyframesAsList.unshift(null);
7417
7364
  if (repeat) {
7418
- invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
7419
7365
  duration = calculateRepeatDuration(duration, repeat);
7420
7366
  const originalKeyframes = [...valueKeyframesAsList];
7421
7367
  const originalTimes = [...times];
@@ -7595,7 +7541,6 @@ function animateSubject(subject, keyframes2, options, scope) {
7595
7541
  } else {
7596
7542
  const subjects = resolveSubjects(subject, keyframes2, scope);
7597
7543
  const numSubjects = subjects.length;
7598
- invariant(Boolean(numSubjects), "No valid elements provided.");
7599
7544
  for (let i = 0; i < numSubjects; i++) {
7600
7545
  const thisSubject = subjects[i];
7601
7546
  const createVisualElement = thisSubject instanceof Element ? createDOMVisualElement : createObjectVisualElement;