unframer 2.0.0 → 2.0.1

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.
package/src/framer.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- // https :https://app.framerstatic.com/chunk-73TYJ7YB.js
2
+ // https :https://app.framerstatic.com/chunk-O7E5UDPD.js
3
3
  import { createContext, } from 'react';
4
4
  import { createContext as createContext2, } from 'react';
5
5
  import { createContext as createContext3, } from 'react';
@@ -19,6 +19,7 @@ import { createElement as createElement2, Fragment, useMemo as useMemo4, } from
19
19
  import { useMemo as useMemo2, } from 'react';
20
20
  import { useMemo as useMemo3, } from 'react';
21
21
  import React__default, { useContext as useContext6, } from 'react';
22
+ import React__default2 from 'react';
22
23
  import { useCallback as useCallback2, useState, } from 'react';
23
24
  import { useRef as useRef3, } from 'react';
24
25
  import { useEffect as useEffect4, } from 'react';
@@ -1937,7 +1938,7 @@ var MotionValue = class {
1937
1938
  * @internal
1938
1939
  */
1939
1940
  constructor(init, options = {},) {
1940
- this.version = '11.0.11-sync.2';
1941
+ this.version = '11.0.11-sync.5';
1941
1942
  this.canTrackVelocity = false;
1942
1943
  this.events = {};
1943
1944
  this.updateAndNotify = (v, render = true,) => {
@@ -3386,8 +3387,8 @@ function updateMotionValuesFromProps(element, next, prev,) {
3386
3387
  }
3387
3388
  if (false) {
3388
3389
  warnOnce(
3389
- nextValue.version === '11.0.11-sync.2',
3390
- `Attempting to mix Framer Motion versions ${nextValue.version} with 11.0.11-sync.2 may not work as expected.`,
3390
+ nextValue.version === '11.0.11-sync.5',
3391
+ `Attempting to mix Framer Motion versions ${nextValue.version} with 11.0.11-sync.5 may not work as expected.`,
3391
3392
  );
3392
3393
  }
3393
3394
  } else if (isMotionValue(prevValue,)) {
@@ -3418,6 +3419,12 @@ function updateMotionValuesFromProps(element, next, prev,) {
3418
3419
  }
3419
3420
  var featureNames = Object.keys(featureDefinitions,);
3420
3421
  var numFeatures = featureNames.length;
3422
+ function getClosestProjectingNode(visualElement,) {
3423
+ if (!visualElement) {
3424
+ return void 0;
3425
+ }
3426
+ return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent,);
3427
+ }
3421
3428
  var propEventHandlers = [
3422
3429
  'AnimationStart',
3423
3430
  'AnimationComplete',
@@ -3575,7 +3582,7 @@ var VisualElement = class {
3575
3582
  }
3576
3583
  }
3577
3584
  if ((this.type === 'html' || this.type === 'svg') && !this.projection && ProjectionNodeConstructor) {
3578
- this.projection = new ProjectionNodeConstructor(this.latestValues, this.parent && this.parent.projection,);
3585
+ this.projection = new ProjectionNodeConstructor(this.latestValues, getClosestProjectingNode(this.parent,),);
3579
3586
  const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot, } = renderedProps;
3580
3587
  this.projection.setOptions({
3581
3588
  layoutId,
@@ -5648,7 +5655,10 @@ function buildProjectionTransform(delta, treeScale, latestTransform,) {
5648
5655
  transform2 += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
5649
5656
  }
5650
5657
  if (latestTransform) {
5651
- const { rotate, rotateX, rotateY, skewX, skewY, } = latestTransform;
5658
+ const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY, } = latestTransform;
5659
+ if (transformPerspective) {
5660
+ transform2 = `perspective(${transformPerspective}px) ${transform2}`;
5661
+ }
5652
5662
  if (rotate) {
5653
5663
  transform2 += `rotate(${rotate}deg) `;
5654
5664
  }
@@ -7145,7 +7155,10 @@ var SVGVisualElement = class extends DOMVisualElement {
7145
7155
  var createDomVisualElement = (Component23, options,) => {
7146
7156
  return isSVGComponent(Component23,)
7147
7157
  ? new SVGVisualElement(options, { enableHardwareAcceleration: false, },)
7148
- : new HTMLVisualElement(options, { enableHardwareAcceleration: true, },);
7158
+ : new HTMLVisualElement(options, {
7159
+ enableHardwareAcceleration: true,
7160
+ allowProjection: Component23 !== React__default2.Fragment,
7161
+ },);
7149
7162
  };
7150
7163
  var layout = {
7151
7164
  layout: {
@@ -9076,7 +9089,7 @@ var cancelSync = stepsOrder.reduce((acc, key7,) => {
9076
9089
  return acc;
9077
9090
  }, {},);
9078
9091
 
9079
- // https :https://app.framerstatic.com/framer.Q2DHSUSM.js
9092
+ // https :https://app.framerstatic.com/framer.L736M3IJ.js
9080
9093
  import { Component as Component2, } from 'react';
9081
9094
  import React12 from 'react';
9082
9095
  import { jsx as _jsx5, } from 'react/jsx-runtime';
@@ -9275,8 +9288,13 @@ import { jsx as jsx54, jsxs as jsxs18, } from 'react/jsx-runtime';
9275
9288
  import { jsx as jsx55, } from 'react/jsx-runtime';
9276
9289
  import { jsx as jsx56, } from 'react/jsx-runtime';
9277
9290
  import { jsx as jsx57, } from 'react/jsx-runtime';
9291
+ import { jsx as jsx58, } from 'react/jsx-runtime';
9292
+ import { useRef as useRef18, } from 'react';
9293
+ import { jsx as jsx59, } from 'react/jsx-runtime';
9294
+ import { useRef as useRef19, } from 'react';
9295
+ import { jsx as jsx60, } from 'react/jsx-runtime';
9278
9296
  import React85 from 'react';
9279
- import { jsx as jsx58, jsxs as jsxs19, } from 'react/jsx-runtime';
9297
+ import { jsx as jsx61, jsxs as jsxs19, } from 'react/jsx-runtime';
9280
9298
  import {
9281
9299
  Children as Children32,
9282
9300
  cloneElement as cloneElement32,
@@ -9284,12 +9302,12 @@ import {
9284
9302
  isValidElement as isValidElement32,
9285
9303
  useContext as useContext162,
9286
9304
  useInsertionEffect as useInsertionEffect42,
9287
- useRef as useRef19,
9305
+ useRef as useRef21,
9288
9306
  } from 'react';
9289
9307
  import * as React86 from 'react';
9290
- import { useRef as useRef18, } from 'react';
9291
- import { jsx as jsx59, } from 'react/jsx-runtime';
9292
- import { jsx as jsx60, } from 'react/jsx-runtime';
9308
+ import { useRef as useRef20, } from 'react';
9309
+ import { jsx as jsx62, } from 'react/jsx-runtime';
9310
+ import { jsx as jsx63, } from 'react/jsx-runtime';
9293
9311
  import { useEffect as useEffect142, useState as useState22, } from 'react';
9294
9312
  var require_hsluv = __commonJS({
9295
9313
  '../../../node_modules/hsluv/hsluv.js'(exports, module,) {
@@ -12139,6 +12157,9 @@ function Point(x, y,) {
12139
12157
  Point2.angle = (a, b,) => {
12140
12158
  return Math.atan2(b.y - a.y, b.x - a.x,) * 180 / Math.PI - 90;
12141
12159
  };
12160
+ Point2.angleFromX = (a, b,) => {
12161
+ return Math.atan2(b.y - a.y, b.x - a.x,) * 180 / Math.PI;
12162
+ };
12142
12163
  Point2.isEqual = (a, b,) => {
12143
12164
  return a.x === b.x && a.y === b.y;
12144
12165
  };
@@ -12168,24 +12189,6 @@ function Point(x, y,) {
12168
12189
  };
12169
12190
  }
12170
12191
  Point2.center = center;
12171
- function insidePoints(point2, points,) {
12172
- var _a, _b, _c, _d;
12173
- const x = point2.x;
12174
- const y = point2.y;
12175
- let isInside = false;
12176
- for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
12177
- const xi = ((_a = points[i]) == null ? void 0 : _a.x) ?? 0;
12178
- const yi = ((_b = points[i]) == null ? void 0 : _b.y) ?? 0;
12179
- const xj = ((_c = points[j]) == null ? void 0 : _c.x) ?? 0;
12180
- const yj = ((_d = points[j]) == null ? void 0 : _d.y) ?? 0;
12181
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
12182
- if (intersect) {
12183
- isInside = !isInside;
12184
- }
12185
- }
12186
- return isInside;
12187
- }
12188
- Point2.insidePoints = insidePoints;
12189
12192
  })(Point || (Point = {}),);
12190
12193
  var BezierDefaults = {
12191
12194
  curve: 'ease',
@@ -14908,15 +14911,18 @@ var ErrorBoundary2 = class extends Component3 {
14908
14911
  __publicField(this, 'state', {},);
14909
14912
  }
14910
14913
  componentDidCatch(error, info,) {
14911
- let stack = info.componentStack.split('\n',).filter((line,) => line.length !== 0);
14914
+ var _a;
14915
+ let stack = (_a = info.componentStack) == null ? void 0 : _a.split('\n',).filter((line,) => line.length !== 0);
14912
14916
  let currentIndex = 0;
14913
- for (const line of stack) {
14914
- if (line.startsWith(` in ${this.constructor.name}`,)) {
14915
- break;
14917
+ if (stack) {
14918
+ for (const line of stack) {
14919
+ if (line.startsWith(` in ${this.constructor.name}`,)) {
14920
+ break;
14921
+ }
14922
+ currentIndex++;
14916
14923
  }
14917
- currentIndex++;
14924
+ stack = stack.slice(0, currentIndex,);
14918
14925
  }
14919
- stack = stack.slice(0, currentIndex,);
14920
14926
  this.setState({
14921
14927
  lastError: {
14922
14928
  error,
@@ -15325,13 +15331,18 @@ var Rect;
15325
15331
  };
15326
15332
  };
15327
15333
  Rect2.boundingRectFromPoints = (ps,) => {
15328
- const xValues = ps.map((point2,) => point2.x);
15329
- const yValues = ps.map((point2,) => point2.y);
15330
- const x = Math.min(...xValues,);
15331
- const y = Math.min(...yValues,);
15332
- const width = Math.max(...xValues,) - x;
15333
- const height = Math.max(...yValues,) - y;
15334
- return { x, y, width, height, };
15334
+ let minX2 = Infinity;
15335
+ let maxX2 = -Infinity;
15336
+ let minY2 = Infinity;
15337
+ let maxY2 = -Infinity;
15338
+ for (let i = 0; i < ps.length; i++) {
15339
+ const point2 = ps[i];
15340
+ minX2 = Math.min(minX2, point2.x,);
15341
+ maxX2 = Math.max(maxX2, point2.x,);
15342
+ minY2 = Math.min(minY2, point2.y,);
15343
+ maxY2 = Math.max(maxY2, point2.y,);
15344
+ }
15345
+ return { x: minX2, y: minY2, width: maxX2 - minX2, height: maxY2 - minY2, };
15335
15346
  };
15336
15347
  Rect2.fromPoints = (ps,) => {
15337
15348
  const [tl, tr, _, bl,] = ps;
@@ -16153,6 +16164,8 @@ var ControlType = /* @__PURE__ */ ((ControlType2,) => {
16153
16164
  ControlType2['CustomCursor'] = 'customcursor';
16154
16165
  ControlType2['Border'] = 'border';
16155
16166
  ControlType2['Cursor'] = 'cursor';
16167
+ ControlType2['Padding'] = 'padding';
16168
+ ControlType2['BorderRadius'] = 'borderradius';
16156
16169
  return ControlType2;
16157
16170
  })(ControlType || {},);
16158
16171
  var isFlexboxGapSupportedCached;
@@ -17099,6 +17112,8 @@ function getControlDefaultValue(control,) {
17099
17112
  case 'date':
17100
17113
  case 'link':
17101
17114
  case 'boxshadow':
17115
+ case 'padding':
17116
+ case 'borderradius':
17102
17117
  return isString22(control.defaultValue,) ? control.defaultValue : void 0;
17103
17118
  case 'boolean':
17104
17119
  return isBoolean(control.defaultValue,) ? control.defaultValue : void 0;
@@ -20044,7 +20059,7 @@ function setTranslateZHack(style, enabled,) {
20044
20059
  if (!useTranslateZHack || !onCanvas) {
20045
20060
  return;
20046
20061
  }
20047
- const transform2 = style.transform || '';
20062
+ const transform2 = isString22(style.transform,) ? style.transform || '' : '';
20048
20063
  if (enabled) {
20049
20064
  const hasTranslateZ = transform2.includes(translateZ,);
20050
20065
  if (!hasTranslateZ) {
@@ -27682,7 +27697,7 @@ function getTransition(value,) {
27682
27697
  }
27683
27698
  return value == null ? void 0 : value.transition;
27684
27699
  }
27685
- async function runEffectAnimation(target, effect, shouldReduceMotion, ref, appearId,) {
27700
+ async function runEffectAnimation(target, effect, shouldReduceMotion, ref, appearId, instant,) {
27686
27701
  const transition = getTransition(target,);
27687
27702
  return Promise.all(
27688
27703
  effectValuesKeys.map((key7,) => {
@@ -27709,14 +27724,17 @@ async function runEffectAnimation(target, effect, shouldReduceMotion, ref, appea
27709
27724
  elapsed: safeWindow.HandoffAppearAnimations(appearId, key7, motionValue2, frame,),
27710
27725
  }
27711
27726
  : void 0;
27712
- const opts = {
27713
- ...transition,
27714
- velocity: 0,
27715
- elapsed: 0,
27716
- ...handoff,
27717
- onComplete: () => resolve(),
27718
- };
27719
- animate(motionValue2, value, opts,);
27727
+ if (instant) {
27728
+ motionValue2.set(value,);
27729
+ } else {
27730
+ animate(motionValue2, value, {
27731
+ ...transition,
27732
+ velocity: 0,
27733
+ elapsed: 0,
27734
+ ...handoff,
27735
+ onComplete: () => resolve(),
27736
+ },);
27737
+ }
27720
27738
  },);
27721
27739
  },),
27722
27740
  );
@@ -27726,16 +27744,6 @@ var presenceOptionsKeys = /* @__PURE__ */ new Set([
27726
27744
  'presenceAnimate',
27727
27745
  'presenceExit',
27728
27746
  ],);
27729
- function getVisualElementBase(visualElement, style,) {
27730
- const ctx = visualElement.getVariantContext();
27731
- const base = { ...style, };
27732
- if (Array.isArray(ctx == null ? void 0 : ctx.animate,)) {
27733
- for (const variant of ctx.animate) {
27734
- Object.assign(base, visualElement.getVariant(variant,),);
27735
- }
27736
- }
27737
- return base;
27738
- }
27739
27747
  function usePresenceAnimation(
27740
27748
  {
27741
27749
  initial: motionInitial,
@@ -27754,6 +27762,9 @@ function usePresenceAnimation(
27754
27762
  const animateConfig = presenceAnimate ?? motionAnimate;
27755
27763
  const exit = presenceExit ?? motionExit;
27756
27764
  const hasMounted = useRef122(false,);
27765
+ const lastAnimate = useRef122(animateConfig,);
27766
+ const [isPresent2, safeToRemove,] = usePresence();
27767
+ const lastPresence = useRef122(false,);
27757
27768
  const effect = useConstant2(() => {
27758
27769
  var _a;
27759
27770
  const base = initial ?? style;
@@ -27770,43 +27781,51 @@ function usePresenceAnimation(
27770
27781
  }
27771
27782
  return { values: makeFXValues(defaults,), };
27772
27783
  },);
27773
- const [isPresent2, safeToRemove,] = usePresence();
27774
- const shouldReduceMotion = useReducedMotionConfig();
27775
27784
  useLayoutEffect22(() => {
27776
- hasMounted.current = true;
27777
- if (!enabled) {
27778
- safeToRemove == null ? void 0 : safeToRemove();
27779
- return;
27780
- }
27781
- if (isPresent2) {
27782
- if (initial && animateConfig) {
27783
- runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId,);
27784
- }
27785
- } else {
27786
- if (exit) {
27787
- runEffectAnimation(exit, effect, shouldReduceMotion, ref,).then(() => safeToRemove());
27788
- } else {
27789
- safeToRemove();
27790
- }
27791
- }
27792
- }, [isPresent2,],);
27793
- useLayoutEffect22(() => {
27794
- if (!hasMounted.current) {
27785
+ if (hasMounted.current && animateConfig) {
27795
27786
  return;
27796
27787
  }
27797
27788
  const visualElement = visualElementStore.get(ref.current,);
27798
27789
  if (!visualElement) {
27799
27790
  return;
27800
27791
  }
27801
- const base = isObject2(animateConfig,) ? animateConfig : getVisualElementBase(visualElement, style,);
27792
+ hasMounted.current = true;
27802
27793
  for (const key7 in effect.values) {
27803
27794
  if (!isFXValuesKey(key7,)) {
27804
27795
  continue;
27805
27796
  }
27806
- const value = base == null ? void 0 : base[key7];
27797
+ const value = style == null ? void 0 : style[key7];
27807
27798
  visualElement.setBaseTarget(key7, isNumber2(value,) ? value : defaultFXValues[key7],);
27808
27799
  }
27809
- }, [JSON.stringify(animateConfig,),],);
27800
+ }, [animateConfig,],);
27801
+ const shouldReduceMotion = useReducedMotionConfig();
27802
+ useLayoutEffect22(() => {
27803
+ if (!enabled) {
27804
+ safeToRemove == null ? void 0 : safeToRemove();
27805
+ return;
27806
+ }
27807
+ if (isPresent2 !== lastPresence.current) {
27808
+ lastPresence.current = isPresent2;
27809
+ if (isPresent2) {
27810
+ if (initial && animateConfig) {
27811
+ runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId,);
27812
+ }
27813
+ } else {
27814
+ if (exit) {
27815
+ runEffectAnimation(exit, effect, shouldReduceMotion, ref, appearId,).then(() => safeToRemove());
27816
+ } else {
27817
+ safeToRemove();
27818
+ }
27819
+ }
27820
+ } else {
27821
+ const hasAnimateChanged = !isEqual(animateConfig, lastAnimate.current,);
27822
+ if (!hasAnimateChanged || !animateConfig) {
27823
+ return;
27824
+ }
27825
+ lastAnimate.current = animateConfig;
27826
+ runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId, true,);
27827
+ }
27828
+ },);
27810
27829
  return effect;
27811
27830
  }
27812
27831
  function calcOffsetTop(element, container,) {
@@ -28909,6 +28928,181 @@ function useCustomCursors(webPageCursors,) {
28909
28928
  registerCursors(cursors,);
28910
28929
  }, [cursors, registerCursors,],);
28911
28930
  }
28931
+ function degreesToRadians(degrees2,) {
28932
+ return degrees2 * (Math.PI / 180);
28933
+ }
28934
+ var Line = /* @__PURE__ */ (() => {
28935
+ function Line2(a, b,) {
28936
+ return { a, b, };
28937
+ }
28938
+ Line2.offset = (line, offset,) => {
28939
+ const angle = Point.angleFromX(line.a, line.b,);
28940
+ const rad = degreesToRadians(angle,);
28941
+ const x = offset * Math.sin(rad,);
28942
+ const y = offset * Math.cos(rad,);
28943
+ return Line2(
28944
+ { x: line.a.x + x, y: line.a.y - y, },
28945
+ {
28946
+ x: line.b.x + x,
28947
+ y: line.b.y - y,
28948
+ },
28949
+ );
28950
+ };
28951
+ Line2.intersection = (lineA, lineB,) => {
28952
+ const x1 = lineA.a.x;
28953
+ const y1 = lineA.a.y;
28954
+ const x2 = lineA.b.x;
28955
+ const y2 = lineA.b.y;
28956
+ const x3 = lineB.a.x;
28957
+ const y3 = lineB.a.y;
28958
+ const x4 = lineB.b.x;
28959
+ const y4 = lineB.b.y;
28960
+ const d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
28961
+ if (d === 0) {
28962
+ return null;
28963
+ }
28964
+ const xi = ((x3 - x4) * (x1 * y2 - y1 * x2) - (x1 - x2) * (x3 * y4 - y3 * x4)) / d;
28965
+ const yi = ((y3 - y4) * (x1 * y2 - y1 * x2) - (y1 - y2) * (x3 * y4 - y3 * x4)) / d;
28966
+ return { x: xi, y: yi, };
28967
+ };
28968
+ Line2.intersectionAngle = (lineA, lineB,) => {
28969
+ const deltaAX = lineA.b.x - lineA.a.x;
28970
+ const deltaAY = lineA.b.y - lineA.a.y;
28971
+ const deltaBX = lineB.b.x - lineB.a.x;
28972
+ const deltaBY = lineB.b.y - lineB.a.y;
28973
+ const angle = Math.atan2(deltaAX * deltaBY - deltaAY * deltaBX, deltaAX * deltaBX + deltaAY * deltaBY,);
28974
+ return angle * (180 / Math.PI);
28975
+ };
28976
+ Line2.isOrthogonal = (line,) => {
28977
+ return line.a.x === line.b.x || line.a.y === line.b.y;
28978
+ };
28979
+ Line2.perpendicular = (line, pointOnLine,) => {
28980
+ const deltaX = line.a.x - line.b.x;
28981
+ const deltaY = line.a.y - line.b.y;
28982
+ const pointB = Point(pointOnLine.x - deltaY, pointOnLine.y + deltaX,);
28983
+ return Line2(pointB, pointOnLine,);
28984
+ };
28985
+ Line2.projectPoint = (line, point2,) => {
28986
+ const perp = Line2.perpendicular(line, point2,);
28987
+ return Line2.intersection(line, perp,);
28988
+ };
28989
+ Line2.pointAtPercentDistance = (line, distance2,) => {
28990
+ const hypotenuse = Line2.distance(line,);
28991
+ const r = distance2 * hypotenuse / hypotenuse;
28992
+ return {
28993
+ x: r * line.b.x + (1 - r) * line.a.x,
28994
+ y: r * line.b.y + (1 - r) * line.a.y,
28995
+ };
28996
+ };
28997
+ Line2.distance = (line,) => {
28998
+ return Point.distance(line.a, line.b,);
28999
+ };
29000
+ return Line2;
29001
+ })();
29002
+ var Polygon = {
29003
+ /**
29004
+ * Determine if the vertices are ordered clockwise or counter-clockwise. This works for simple
29005
+ * (non-self-intersecting) convex polygons. If the polygon is collapsed into a line (signedArea = 0), we consider it
29006
+ * clockwise for it works with how Framer draws the polygons.
29007
+ * See: https://paulbourke.net/geometry/polygonmesh/
29008
+ * @internal */
29009
+ isClockwise: (points,) => {
29010
+ return Polygon.signedArea(points,) <= 0;
29011
+ },
29012
+ /**
29013
+ * Calculate the signed area to determine if the vertices go clockwise or counter clockwise. We flip all the y
29014
+ * values because the y axis in our canvas coordinate is fipped.
29015
+ * See: https://mathworld.wolfram.com/PolygonArea.html
29016
+ * @internal */
29017
+ signedArea: (points,) => {
29018
+ let sum = 0;
29019
+ const len = points.length;
29020
+ for (let i = 0; i < len; i++) {
29021
+ const pointA = points[i];
29022
+ const pointB = points[(i + 1) % len];
29023
+ if (!pointA || !pointB) {
29024
+ continue;
29025
+ }
29026
+ sum += pointA.x * -pointB.y - pointB.x * -pointA.y;
29027
+ }
29028
+ return 1 / 2 * sum;
29029
+ },
29030
+ /**
29031
+ * Determine if some Point lies inside the polygon formed by other Points.
29032
+ * The other points must be provided in a clockwise/counter clockwise order.
29033
+ *
29034
+ * Ray-casting algorithm based on
29035
+ * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
29036
+ *
29037
+ * @internal */
29038
+ containsPoint: (polygonPoints2, point2,) => {
29039
+ var _a, _b, _c, _d;
29040
+ const x = point2.x;
29041
+ const y = point2.y;
29042
+ let isInside = false;
29043
+ for (let i = 0, j = polygonPoints2.length - 1; i < polygonPoints2.length; j = i++) {
29044
+ const xi = ((_a = polygonPoints2[i]) == null ? void 0 : _a.x) ?? 0;
29045
+ const yi = ((_b = polygonPoints2[i]) == null ? void 0 : _b.y) ?? 0;
29046
+ const xj = ((_c = polygonPoints2[j]) == null ? void 0 : _c.x) ?? 0;
29047
+ const yj = ((_d = polygonPoints2[j]) == null ? void 0 : _d.y) ?? 0;
29048
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
29049
+ if (intersect) {
29050
+ isInside = !isInside;
29051
+ }
29052
+ }
29053
+ return isInside;
29054
+ },
29055
+ /** @internal */
29056
+ intersect: (pointsA, pointsB,) => {
29057
+ if (pointsA.length < 1 || pointsB.length < 1) {
29058
+ return false;
29059
+ }
29060
+ const boundingRectA = Rect.boundingRectFromPoints(pointsA,);
29061
+ const boundingRectB = Rect.boundingRectFromPoints(pointsB,);
29062
+ if (!Rect.intersects(boundingRectA, boundingRectB,)) {
29063
+ return false;
29064
+ }
29065
+ const edgesA = [];
29066
+ const pointsALength = pointsA.length;
29067
+ pointsA.forEach((point2, index,) => {
29068
+ const nextPoint = pointsA[(index + 1) % pointsALength];
29069
+ if (!nextPoint) {
29070
+ return;
29071
+ }
29072
+ edgesA.push(Line(point2, nextPoint,),);
29073
+ },);
29074
+ const edgesB = [];
29075
+ const pointsBLength = pointsB.length;
29076
+ pointsB.forEach((point2, index,) => {
29077
+ const nextPoint = pointsB[(index + 1) % pointsBLength];
29078
+ if (!nextPoint) {
29079
+ return;
29080
+ }
29081
+ edgesB.push(Line(point2, nextPoint,),);
29082
+ },);
29083
+ for (const edgeA of edgesA) {
29084
+ for (const edgeB of edgesB) {
29085
+ const intersection2 = segmentsIntersect(edgeA, edgeB,);
29086
+ if (intersection2) {
29087
+ return true;
29088
+ }
29089
+ }
29090
+ }
29091
+ if (Polygon.containsPoint(pointsB, pointsA[0],)) {
29092
+ return true;
29093
+ }
29094
+ if (Polygon.containsPoint(pointsA, pointsB[0],)) {
29095
+ return true;
29096
+ }
29097
+ return false;
29098
+ },
29099
+ };
29100
+ function segmentsIntersect(segmentA, segmentB,) {
29101
+ const { a, b, } = segmentA;
29102
+ const { a: c, b: d, } = segmentB;
29103
+ return Polygon.isClockwise([a, c, d,],) !== Polygon.isClockwise([b, c, d,],) &&
29104
+ Polygon.isClockwise([a, b, c,],) !== Polygon.isClockwise([a, b, d,],);
29105
+ }
28912
29106
  function invertPlacement(placement,) {
28913
29107
  switch (placement) {
28914
29108
  case 'top':
@@ -29020,7 +29214,7 @@ function getSafePlacementFloatingPositionRect(
29020
29214
  ];
29021
29215
  }
29022
29216
  function preferredPoint(a, b, points,) {
29023
- if (Point.insidePoints(a, [b, ...points,],)) {
29217
+ if (Polygon.containsPoint([b, ...points,], a,)) {
29024
29218
  return b;
29025
29219
  }
29026
29220
  return a;
@@ -33264,6 +33458,10 @@ function useQueryData(query,) {
33264
33458
  result = useExecuteSelect(result, query.select,);
33265
33459
  return result;
33266
33460
  }
33461
+ function useQueryCount(query,) {
33462
+ const collection = useQueryData(query,);
33463
+ return collection.length;
33464
+ }
33267
33465
  function evaluateExpression(expression, context,) {
33268
33466
  switch (expression.type) {
33269
33467
  case 'Identifier':
@@ -33872,15 +34070,18 @@ var DeprecatedComponentContainer = /* @__PURE__ */ (() => {
33872
34070
  },);
33873
34071
  }
33874
34072
  componentDidCatch(error, info,) {
33875
- let stack = info.componentStack.split('\n',).filter((line,) => line.length !== 0);
34073
+ var _a2;
34074
+ let stack = (_a2 = info.componentStack) == null ? void 0 : _a2.split('\n',).filter((line,) => line.length !== 0);
33876
34075
  let currentIndex = 0;
33877
- for (const line of stack) {
33878
- if (line.startsWith(` in ${this.constructor.name}`,)) {
33879
- break;
34076
+ if (stack) {
34077
+ for (const line of stack) {
34078
+ if (line.startsWith(` in ${this.constructor.name}`,)) {
34079
+ break;
34080
+ }
34081
+ currentIndex++;
33880
34082
  }
33881
- currentIndex++;
34083
+ stack = stack.slice(0, currentIndex,);
33882
34084
  }
33883
- stack = stack.slice(0, currentIndex,);
33884
34085
  this.setState({
33885
34086
  lastError: {
33886
34087
  children: this.props.children,
@@ -34043,61 +34244,6 @@ function isPageOrScroll(identifier,) {
34043
34244
  }
34044
34245
  return false;
34045
34246
  }
34046
- var Line = /* @__PURE__ */ (() => {
34047
- function Line2(a, b,) {
34048
- return { a, b, };
34049
- }
34050
- Line2.intersection = (lineA, lineB,) => {
34051
- const x1 = lineA.a.x;
34052
- const y1 = lineA.a.y;
34053
- const x2 = lineA.b.x;
34054
- const y2 = lineA.b.y;
34055
- const x3 = lineB.a.x;
34056
- const y3 = lineB.a.y;
34057
- const x4 = lineB.b.x;
34058
- const y4 = lineB.b.y;
34059
- const d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
34060
- if (d === 0) {
34061
- return null;
34062
- }
34063
- const xi = ((x3 - x4) * (x1 * y2 - y1 * x2) - (x1 - x2) * (x3 * y4 - y3 * x4)) / d;
34064
- const yi = ((y3 - y4) * (x1 * y2 - y1 * x2) - (y1 - y2) * (x3 * y4 - y3 * x4)) / d;
34065
- return { x: xi, y: yi, };
34066
- };
34067
- Line2.intersectionAngle = (lineA, lineB,) => {
34068
- const deltaAX = lineA.b.x - lineA.a.x;
34069
- const deltaAY = lineA.b.y - lineA.a.y;
34070
- const deltaBX = lineB.b.x - lineB.a.x;
34071
- const deltaBY = lineB.b.y - lineB.a.y;
34072
- const angle = Math.atan2(deltaAX * deltaBY - deltaAY * deltaBX, deltaAX * deltaBX + deltaAY * deltaBY,);
34073
- return angle * (180 / Math.PI);
34074
- };
34075
- Line2.isOrthogonal = (line,) => {
34076
- return line.a.x === line.b.x || line.a.y === line.b.y;
34077
- };
34078
- Line2.perpendicular = (line, pointOnLine,) => {
34079
- const deltaX = line.a.x - line.b.x;
34080
- const deltaY = line.a.y - line.b.y;
34081
- const pointB = Point(pointOnLine.x - deltaY, pointOnLine.y + deltaX,);
34082
- return Line2(pointB, pointOnLine,);
34083
- };
34084
- Line2.projectPoint = (line, point2,) => {
34085
- const perp = Line2.perpendicular(line, point2,);
34086
- return Line2.intersection(line, perp,);
34087
- };
34088
- Line2.pointAtPercentDistance = (line, distance2,) => {
34089
- const hypotenuse = Line2.distance(line,);
34090
- const r = distance2 * hypotenuse / hypotenuse;
34091
- return {
34092
- x: r * line.b.x + (1 - r) * line.a.x,
34093
- y: r * line.b.y + (1 - r) * line.a.y,
34094
- };
34095
- };
34096
- Line2.distance = (line,) => {
34097
- return Point.distance(line.a, line.b,);
34098
- };
34099
- return Line2;
34100
- })();
34101
34247
  function linearGradientLine(angle,) {
34102
34248
  var _a, _b;
34103
34249
  const rad = angle * Math.PI / 180;
@@ -37512,6 +37658,75 @@ function CustomProperties({
37512
37658
  },) {
37513
37659
  return /* @__PURE__ */ jsx57('div', { style: customProperties, children, },);
37514
37660
  }
37661
+ var FormContainer = (props,) => {
37662
+ return /* @__PURE__ */ jsx58(FrameWithMotion, { ...props, as: 'form', },);
37663
+ };
37664
+ var FormButton = (props,) => {
37665
+ const { __fromCanvasComponent, style: baseStyle2, } = props;
37666
+ const layoutId = useLayoutId2(props,);
37667
+ const ref = useRef18(null,);
37668
+ const style = mergeWithDefaultStyle(baseStyle2 ?? {},);
37669
+ const dataProps = {
37670
+ 'data-layoutid': layoutId,
37671
+ };
37672
+ const isDisabled = Boolean(__fromCanvasComponent,);
37673
+ useMeasureLayout(props, ref,);
37674
+ return /* @__PURE__ */ jsx59(
37675
+ motion.input,
37676
+ {
37677
+ type: props.type,
37678
+ disabled: isDisabled,
37679
+ ...dataProps,
37680
+ layoutId,
37681
+ ref,
37682
+ style: { ...baseStyle2, ...style, },
37683
+ value: props.value ?? 'Submit',
37684
+ },
37685
+ );
37686
+ };
37687
+ function mergeWithDefaultStyle(style,) {
37688
+ return {
37689
+ display: 'block',
37690
+ padding: '12px',
37691
+ width: '100%',
37692
+ background: '#222',
37693
+ color: '#fff',
37694
+ borderRadius: '10px',
37695
+ border: '1px solid rgba(0,0,0,0.05)',
37696
+ ...style,
37697
+ };
37698
+ }
37699
+ var FormPlainTextInput = (props,) => {
37700
+ const { __fromCanvasComponent, } = props;
37701
+ const layoutId = useLayoutId2(props,);
37702
+ const ref = useRef19(null,);
37703
+ const dataProps = {
37704
+ 'data-layoutid': layoutId,
37705
+ };
37706
+ const isDisabled = Boolean(__fromCanvasComponent,);
37707
+ useMeasureLayout(props, ref,);
37708
+ const baseStyle2 = {
37709
+ padding: '12px',
37710
+ width: '100%',
37711
+ background: '#f5f5f5',
37712
+ borderRadius: '10px',
37713
+ border: '1px solid rgba(0,0,0,0.05)',
37714
+ };
37715
+ return /* @__PURE__ */ jsx60(
37716
+ motion.input,
37717
+ {
37718
+ disabled: isDisabled,
37719
+ ...dataProps,
37720
+ layoutId,
37721
+ ref,
37722
+ style: {
37723
+ ...baseStyle2,
37724
+ ...props.style,
37725
+ },
37726
+ placeholder: props.placeholder,
37727
+ },
37728
+ );
37729
+ };
37515
37730
  var Image2 = /* @__PURE__ */ React85.forwardRef(function Image3(props, ref,) {
37516
37731
  const { background, children, alt, ...rest } = props;
37517
37732
  const style = { ...rest.style, };
@@ -37524,7 +37739,7 @@ var Image2 = /* @__PURE__ */ React85.forwardRef(function Image3(props, ref,) {
37524
37739
  style,
37525
37740
  ref,
37526
37741
  children: [
37527
- background && /* @__PURE__ */ jsx58(BackgroundImageComponent, { image: background, alt, },),
37742
+ background && /* @__PURE__ */ jsx61(BackgroundImageComponent, { image: background, alt, },),
37528
37743
  children,
37529
37744
  ],
37530
37745
  },);
@@ -37701,7 +37916,7 @@ var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(
37701
37916
  } = props;
37702
37917
  const parentSize = useParentSize();
37703
37918
  const layoutId = useLayoutId2(props,);
37704
- const fallbackLayoutRef = useRef18(null,);
37919
+ const fallbackLayoutRef = useRef20(null,);
37705
37920
  const layoutRef = forwardedRef ?? fallbackLayoutRef;
37706
37921
  const { navigate, getRoute, } = useRouter();
37707
37922
  const currentRoute = useCurrentRoute();
@@ -37813,7 +38028,7 @@ var DeprecatedRichText = /* @__PURE__ */ React86.forwardRef(
37813
38028
  forceLayerBackingWithCSSProperties(style,);
37814
38029
  }
37815
38030
  Object.assign(style, props.style,);
37816
- return /* @__PURE__ */ jsx59(
38031
+ return /* @__PURE__ */ jsx62(
37817
38032
  motion.div,
37818
38033
  {
37819
38034
  id: id3,
@@ -37842,7 +38057,7 @@ function convertVerticalAlignment2(verticalAlignment,) {
37842
38057
  }
37843
38058
  }
37844
38059
  function useLoadFonts(fonts, fromCanvasComponent, containerRef,) {
37845
- const prevFontsRef = useRef18([],);
38060
+ const prevFontsRef = useRef20([],);
37846
38061
  if (!isShallowEqualArray(prevFontsRef.current, fonts,)) {
37847
38062
  prevFontsRef.current = fonts;
37848
38063
  fontStore.loadFonts(fonts,).then(({ newlyLoadedFontCount, },) => {
@@ -37857,11 +38072,11 @@ function useLoadFonts(fonts, fromCanvasComponent, containerRef,) {
37857
38072
  }
37858
38073
  var FitText = /* @__PURE__ */ forwardRef52(
37859
38074
  ({ viewBoxScale, viewBox, children, ...props }, ref,) => {
37860
- return /* @__PURE__ */ jsx60(motion.svg, {
38075
+ return /* @__PURE__ */ jsx63(motion.svg, {
37861
38076
  ref,
37862
38077
  ...props,
37863
38078
  viewBox,
37864
- children: /* @__PURE__ */ jsx60(
38079
+ children: /* @__PURE__ */ jsx63(
37865
38080
  motion.foreignObject,
37866
38081
  {
37867
38082
  width: '100%',
@@ -37918,7 +38133,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
37918
38133
  const isOnCanvas = useIsOnFramerCanvas();
37919
38134
  const inCodeComponent = useContext162(ComponentContainerContext,);
37920
38135
  const layoutId = useLayoutId2(props,);
37921
- const fallbackRef = useRef19(null,);
38136
+ const fallbackRef = useRef21(null,);
37922
38137
  const containerRef = ref ?? fallbackRef;
37923
38138
  useMeasureLayout(props, containerRef,);
37924
38139
  useLoadFonts(fonts, __fromCanvasComponent, containerRef,);
@@ -37944,8 +38159,9 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
37944
38159
  const template = hasTransformTemplate ? props.transformTemplate ?? transformTemplate(center,) : void 0;
37945
38160
  if (!withExternalLayout) {
37946
38161
  if (frame2 && restrictedRenderTarget && !isAutoSized2) {
37947
- const rotate = Animatable.getNumber(rotation,).toFixed(4,);
37948
- containerStyle.transform = `translate(${frame2.x}px, ${frame2.y}px) rotate(${rotate}deg)`;
38162
+ containerStyle.x = frame2.x;
38163
+ containerStyle.y = frame2.y;
38164
+ containerStyle.rotate = Animatable.getNumber(rotation,);
37949
38165
  containerStyle.width = frame2.width;
37950
38166
  containerStyle.minWidth = frame2.width;
37951
38167
  containerStyle.height = frame2.height;
@@ -37984,7 +38200,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
37984
38200
  const Component15 = htmlElementAsMotionComponent(props.as,);
37985
38201
  if (isString22(props.viewBox,)) {
37986
38202
  if (props.as !== void 0) {
37987
- return /* @__PURE__ */ jsx60(
38203
+ return /* @__PURE__ */ jsx63(
37988
38204
  Component15,
37989
38205
  {
37990
38206
  ...rest,
@@ -37994,7 +38210,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
37994
38210
  transformTemplate: template,
37995
38211
  'data-framer-name': name,
37996
38212
  'data-framer-component-type': 'RichTextContainer',
37997
- children: /* @__PURE__ */ jsx60(
38213
+ children: /* @__PURE__ */ jsx63(
37998
38214
  FitText,
37999
38215
  {
38000
38216
  viewBox,
@@ -38006,7 +38222,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
38006
38222
  },
38007
38223
  );
38008
38224
  } else {
38009
- return /* @__PURE__ */ jsx60(
38225
+ return /* @__PURE__ */ jsx63(
38010
38226
  FitText,
38011
38227
  {
38012
38228
  ...rest,
@@ -38023,7 +38239,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef52(
38023
38239
  );
38024
38240
  }
38025
38241
  }
38026
- return /* @__PURE__ */ jsx60(
38242
+ return /* @__PURE__ */ jsx63(
38027
38243
  Component15,
38028
38244
  {
38029
38245
  ...rest,
@@ -38071,7 +38287,7 @@ var RichText = /* @__PURE__ */ forwardRef52(
38071
38287
  // We need to use the original prop name.
38072
38288
  [isString22(html,) ? 'html' : 'htmlFromDesign']: content,
38073
38289
  };
38074
- return /* @__PURE__ */ jsx60(DeprecatedRichText, { ...props, ...contentProp, ref, },);
38290
+ return /* @__PURE__ */ jsx63(DeprecatedRichText, { ...props, ...contentProp, ref, },);
38075
38291
  }
38076
38292
  if (!props.stylesPresetsClassNames && isString22(props.stylesPresetsClassName,)) {
38077
38293
  const [h1, h2, h3, p, a,] = props.stylesPresetsClassName.split(' ',);
@@ -38081,7 +38297,7 @@ var RichText = /* @__PURE__ */ forwardRef52(
38081
38297
  props.stylesPresetsClassNames = { h1, h2, h3, p, a, };
38082
38298
  }
38083
38299
  }
38084
- return /* @__PURE__ */ jsx60(RichTextContainer, { ...props, ref, children: isValidElement32(content,) ? content : void 0, },);
38300
+ return /* @__PURE__ */ jsx63(RichTextContainer, { ...props, ref, children: isValidElement32(content,) ? content : void 0, },);
38085
38301
  },
38086
38302
  );
38087
38303
  var key6 = 'calculatedPaths';
@@ -38504,8 +38720,8 @@ var package_default = {
38504
38720
  '@types/google.fonts': '1.0.3',
38505
38721
  '@types/hsluv': 'https://github.com/framer/typed_hsluv#bump',
38506
38722
  '@types/node': '^18.17.15',
38507
- '@types/react': '^18.0.26',
38508
- '@types/react-dom': '^18.0.10',
38723
+ '@types/react': '^18.2.67',
38724
+ '@types/react-dom': '^18.2.22',
38509
38725
  '@types/yargs': '^17.0.19',
38510
38726
  '@typescript-eslint/eslint-plugin': '^6.16.0',
38511
38727
  '@typescript-eslint/parser': '^6.16.0',
@@ -38521,7 +38737,7 @@ var package_default = {
38521
38737
  yargs: '^17.6.2',
38522
38738
  },
38523
38739
  peerDependencies: {
38524
- 'framer-motion': '11.0.7',
38740
+ 'framer-motion': '11.0.11-sync.4',
38525
38741
  react: '^18.2.0',
38526
38742
  'react-dom': '^18.2.0',
38527
38743
  },
@@ -38639,6 +38855,7 @@ export {
38639
38855
  DataObserverContext,
38640
38856
  debounce,
38641
38857
  defaultDeviceProps,
38858
+ degreesToRadians,
38642
38859
  delay,
38643
38860
  DeprecatedComponentContainer,
38644
38861
  DeprecatedFrameWithEvents,
@@ -38671,6 +38888,9 @@ export {
38671
38888
  FontSourceNames,
38672
38889
  fontStore,
38673
38890
  forceLayerBackingWithCSSProperties,
38891
+ FormButton,
38892
+ FormContainer,
38893
+ FormPlainTextInput,
38674
38894
  fraction,
38675
38895
  Frame,
38676
38896
  frame,
@@ -38778,6 +38998,7 @@ export {
38778
38998
  PathVariablesContext,
38779
38999
  pipe,
38780
39000
  Point,
39001
+ Polygon,
38781
39002
  PresenceContext,
38782
39003
  print,
38783
39004
  progress,
@@ -38885,6 +39106,7 @@ export {
38885
39106
  usePresence,
38886
39107
  usePrototypeNavigate,
38887
39108
  useProvidedWindow,
39109
+ useQueryCount,
38888
39110
  useQueryData,
38889
39111
  useReducedMotion,
38890
39112
  useReducedMotionConfig,