@vkzstudio/muza-ui 1.0.7 → 1.0.9

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.
Files changed (185) hide show
  1. package/dist/components/Button/Button.js +19 -19
  2. package/dist/components/Button/ButtonLoader.d.ts +7 -0
  3. package/dist/components/Button/ButtonLoader.d.ts.map +1 -0
  4. package/dist/components/Button/ButtonLoader.js +40 -0
  5. package/dist/components/Chip/Chip.d.ts +43 -0
  6. package/dist/components/Chip/Chip.d.ts.map +1 -0
  7. package/dist/components/Chip/Chip.js +98 -0
  8. package/dist/components/Chip/Chip.stories.d.ts +9 -0
  9. package/dist/components/Chip/Chip.stories.d.ts.map +1 -0
  10. package/dist/components/Chip/index.d.ts +2 -0
  11. package/dist/components/Chip/index.d.ts.map +1 -0
  12. package/dist/components/DataTable/DataTable.d.ts +10 -4
  13. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  14. package/dist/components/DataTable/DataTable.js +77 -49
  15. package/dist/components/DataTable/DataTable.stories.d.ts +4 -0
  16. package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
  17. package/dist/components/DataTable/index.d.ts +1 -1
  18. package/dist/components/DataTable/index.d.ts.map +1 -1
  19. package/dist/components/Icons/CustomIcons.js +1 -1
  20. package/dist/components/Reorderable/Reorderable.d.ts +100 -0
  21. package/dist/components/Reorderable/Reorderable.d.ts.map +1 -0
  22. package/dist/components/Reorderable/Reorderable.js +197 -0
  23. package/dist/components/Reorderable/Reorderable.stories.d.ts +14 -0
  24. package/dist/components/Reorderable/Reorderable.stories.d.ts.map +1 -0
  25. package/dist/components/Reorderable/index.d.ts +2 -0
  26. package/dist/components/Reorderable/index.d.ts.map +1 -0
  27. package/dist/components/ReorderableTable/ReorderableTable.d.ts +40 -0
  28. package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -0
  29. package/dist/components/ReorderableTable/ReorderableTable.js +175 -0
  30. package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts +18 -0
  31. package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -0
  32. package/dist/components/ReorderableTable/index.d.ts +2 -0
  33. package/dist/components/ReorderableTable/index.d.ts.map +1 -0
  34. package/dist/components/SwipeButton/SwipeButton.js +7 -7
  35. package/dist/components/index.d.ts +3 -0
  36. package/dist/components/index.d.ts.map +1 -1
  37. package/dist/index.js +196 -183
  38. package/dist/muza-ui.css +1 -1
  39. package/dist/node_modules/framer-motion/dist/es/animation/animate/resolve-subjects.js +4 -4
  40. package/dist/node_modules/framer-motion/dist/es/animation/animate/subject.js +24 -24
  41. package/dist/node_modules/framer-motion/dist/es/animation/sequence/create.js +61 -56
  42. package/dist/node_modules/framer-motion/dist/es/animation/utils/create-visual-element.js +8 -8
  43. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +32 -30
  44. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +22 -22
  45. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +34 -32
  46. package/dist/node_modules/framer-motion/dist/es/components/Reorder/Group.js +46 -0
  47. package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +34 -0
  48. package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/auto-scroll.js +64 -0
  49. package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/check-reorder.js +17 -0
  50. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +2 -2
  51. package/dist/node_modules/framer-motion/dist/es/context/ReorderContext.js +5 -0
  52. package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +3 -3
  53. package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +100 -89
  54. package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +11 -7
  55. package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +4 -4
  56. package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +2 -2
  57. package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +1 -1
  58. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +106 -59
  59. package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +6 -6
  60. package/dist/node_modules/framer-motion/dist/es/gestures/press.js +1 -1
  61. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +1 -1
  62. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +5 -5
  63. package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +18 -6
  64. package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +1 -1
  65. package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +27 -42
  66. package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +4 -4
  67. package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +10 -7
  68. package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +4 -4
  69. package/dist/node_modules/framer-motion/dist/es/motion/index.js +49 -49
  70. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +18 -13
  71. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +41 -40
  72. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +13 -13
  73. package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +6 -6
  74. package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +12 -12
  75. package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +3 -3
  76. package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +7 -7
  77. package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +5 -5
  78. package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +1 -1
  79. package/dist/node_modules/framer-motion/dist/es/value/use-transform.js +26 -18
  80. package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +33 -30
  81. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +17 -17
  82. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +20 -19
  83. package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.js +10 -0
  84. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/motion-value.js +13 -13
  85. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-target.js +11 -11
  86. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +24 -20
  87. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/default-transitions.js +1 -1
  88. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +7 -3
  89. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +1 -1
  90. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/animation/mix-values.js +2 -2
  91. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-apply.js +4 -4
  92. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-calc.js +1 -1
  93. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-remove.js +6 -6
  94. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/DocumentProjectionNode.js +7 -4
  95. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/create-projection-node.js +149 -149
  96. package/dist/node_modules/motion-dom/dist/es/projection/shared/stack.js +60 -0
  97. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-border-radius.js +1 -1
  98. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-box-shadow.js +2 -2
  99. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +21 -0
  100. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/VisualElement.js +58 -50
  101. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/dom/DOMVisualElement.js +7 -6
  102. package/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +6 -0
  103. package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +38 -0
  104. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +29 -0
  105. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +37 -0
  106. package/dist/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +14 -0
  107. package/dist/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +40 -0
  108. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +32 -0
  109. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/path.js +15 -0
  110. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +15 -0
  111. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/animation-state.js +31 -31
  112. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-controlling-variants.js +1 -1
  113. package/dist/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +9 -0
  114. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/motion-values.js +6 -6
  115. package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +15 -0
  116. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/setters.js +4 -4
  117. package/dist/node_modules/{framer-motion → motion-dom}/dist/es/utils/delay.js +2 -2
  118. package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +8 -6
  119. package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +62 -42
  120. package/dist/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +7 -0
  121. package/dist/node_modules/motion-dom/dist/es/value/will-change/is.js +7 -0
  122. package/dist/node_modules/motion-utils/dist/es/array.js +15 -6
  123. package/dist/node_modules/motion-utils/dist/es/errors.js +10 -9
  124. package/dist/translations/locales/cs.d.ts.map +1 -1
  125. package/dist/translations/locales/cs.js +4 -0
  126. package/dist/translations/locales/en.d.ts.map +1 -1
  127. package/dist/translations/locales/en.js +4 -0
  128. package/dist/translations/locales/sk.d.ts.map +1 -1
  129. package/dist/translations/locales/sk.js +4 -0
  130. package/dist/translations/types.d.ts +8 -0
  131. package/dist/translations/types.d.ts.map +1 -1
  132. package/package.json +2 -2
  133. package/dist/node_modules/framer-motion/dist/es/animation/animate/single-value.js +0 -10
  134. package/dist/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +0 -8
  135. package/dist/node_modules/framer-motion/dist/es/projection/shared/stack.js +0 -58
  136. package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +0 -10
  137. package/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +0 -4
  138. package/dist/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +0 -38
  139. package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +0 -29
  140. package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +0 -31
  141. package/dist/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +0 -12
  142. package/dist/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +0 -40
  143. package/dist/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +0 -23
  144. package/dist/node_modules/framer-motion/dist/es/render/svg/utils/path.js +0 -18
  145. package/dist/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +0 -15
  146. package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +0 -13
  147. package/dist/node_modules/framer-motion/dist/es/value/use-will-change/is.js +0 -7
  148. package/dist/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +0 -7
  149. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-variant.js +0 -0
  150. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element.js +0 -0
  151. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/data-id.js +0 -0
  152. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/get-appear-id.js +0 -0
  153. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/calc-child-stagger.js +0 -0
  154. /package/dist/node_modules/{framer-motion/dist/es/animation/animators/waapi → motion-dom/dist/es/animation}/utils/get-final-keyframe.js +0 -0
  155. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/is-transition-defined.js +0 -0
  156. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/events/add-dom-event.js +0 -0
  157. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/conversion.js +0 -0
  158. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/copy.js +0 -0
  159. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/models.js +0 -0
  160. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/utils.js +0 -0
  161. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/HTMLProjectionNode.js +0 -0
  162. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/state.js +0 -0
  163. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/transform.js +0 -0
  164. /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/compare-by-depth.js +0 -0
  165. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/each-axis.js +0 -0
  166. /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/flat-tree.js +0 -0
  167. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/has-transform.js +0 -0
  168. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/measure.js +0 -0
  169. /package/dist/node_modules/{framer-motion/dist/es/motion/features → motion-dom/dist/es/render}/Feature.js +0 -0
  170. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/html/utils/render.js +0 -0
  171. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/object/ObjectVisualElement.js +0 -0
  172. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/store.js +0 -0
  173. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/camel-case-attrs.js +0 -0
  174. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/is-svg-tag.js +0 -0
  175. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/render.js +0 -0
  176. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/get-variant-context.js +0 -0
  177. /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-animation-controls.js +0 -0
  178. /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-keyframes-target.js +0 -0
  179. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-variant-label.js +0 -0
  180. /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/reduced-motion/state.js +0 -0
  181. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-dynamic-variants.js +0 -0
  182. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-variants.js +0 -0
  183. /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/shallow-compare.js +0 -0
  184. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/variant-props.js +0 -0
  185. /package/dist/node_modules/{framer-motion/dist/es/value/use-will-change → motion-dom/dist/es/value/will-change}/add-will-change.js +0 -0
@@ -0,0 +1,64 @@
1
+ const g = /* @__PURE__ */ new Set(["auto", "scroll"]), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
2
+ let i = null;
3
+ function p() {
4
+ if (i) {
5
+ const o = f(i, "y");
6
+ o && (d.delete(o), u.delete(o));
7
+ const l = f(i, "x");
8
+ l && l !== o && (d.delete(l), u.delete(l)), i = null;
9
+ }
10
+ }
11
+ function m(o, l) {
12
+ const t = getComputedStyle(o), n = l === "x" ? t.overflowX : t.overflowY;
13
+ return g.has(n);
14
+ }
15
+ function f(o, l) {
16
+ let t = o == null ? void 0 : o.parentElement;
17
+ for (; t; ) {
18
+ if (m(t, l))
19
+ return t;
20
+ t = t.parentElement;
21
+ }
22
+ return null;
23
+ }
24
+ function w(o, l, t) {
25
+ const n = l.getBoundingClientRect(), e = t === "x" ? n.left : n.top, a = t === "x" ? n.right : n.bottom, c = o - e, r = a - o;
26
+ if (c < 50) {
27
+ const s = 1 - c / 50;
28
+ return { amount: -25 * s * s, edge: "start" };
29
+ } else if (r < 50) {
30
+ const s = 1 - r / 50;
31
+ return { amount: 25 * s * s, edge: "end" };
32
+ }
33
+ return { amount: 0, edge: null };
34
+ }
35
+ function A(o, l, t, n) {
36
+ if (!o)
37
+ return;
38
+ i = o;
39
+ const e = f(o, t);
40
+ if (!e)
41
+ return;
42
+ const a = l - (t === "x" ? window.scrollX : window.scrollY), { amount: c, edge: r } = w(a, e, t);
43
+ if (r === null) {
44
+ d.delete(e), u.delete(e);
45
+ return;
46
+ }
47
+ if (d.get(e) !== r) {
48
+ if (!(r === "start" && n < 0 || r === "end" && n > 0))
49
+ return;
50
+ d.set(e, r);
51
+ const h = t === "x" ? e.scrollWidth - e.clientWidth : e.scrollHeight - e.clientHeight;
52
+ u.set(e, h);
53
+ }
54
+ if (c > 0) {
55
+ const S = u.get(e);
56
+ if ((t === "x" ? e.scrollLeft : e.scrollTop) >= S)
57
+ return;
58
+ }
59
+ t === "x" ? e.scrollLeft += c : e.scrollTop += c;
60
+ }
61
+ export {
62
+ A as autoScrollIfNeeded,
63
+ p as resetAutoScrollState
64
+ };
@@ -0,0 +1,17 @@
1
+ import { mixNumber as s } from "../../../../../../motion-dom/dist/es/utils/mix/number.js";
2
+ import { moveItem as r } from "../../../../../../motion-utils/dist/es/array.js";
3
+ function p(t, f, m, i) {
4
+ if (!i)
5
+ return t;
6
+ const n = t.findIndex((a) => a.value === f);
7
+ if (n === -1)
8
+ return t;
9
+ const e = i > 0 ? 1 : -1, u = t[n + e];
10
+ if (!u)
11
+ return t;
12
+ const x = t[n], o = u.layout, c = s(o.min, o.max, 0.5);
13
+ return e === 1 && x.layout.max + m > c || e === -1 && x.layout.min + m < c ? r(t, n, n + e) : t;
14
+ }
15
+ export {
16
+ p as checkReorder
17
+ };
@@ -1,5 +1,5 @@
1
- import { isControllingVariants as r } from "../../render/utils/is-controlling-variants.js";
2
- import { isVariantLabel as e } from "../../render/utils/is-variant-label.js";
1
+ import { isControllingVariants as r } from "../../../../../motion-dom/dist/es/render/utils/is-controlling-variants.js";
2
+ import { isVariantLabel as e } from "../../../../../motion-dom/dist/es/render/utils/is-variant-label.js";
3
3
  function o(i, a) {
4
4
  if (r(i)) {
5
5
  const { initial: n, animate: t } = i;
@@ -0,0 +1,5 @@
1
+ import { createContext as t } from "react";
2
+ const o = t(null);
3
+ export {
4
+ o as ReorderContext
5
+ };
@@ -1,7 +1,7 @@
1
- import { addDomEvent as d } from "./add-dom-event.js";
2
- import { addPointerInfo as e } from "./event-info.js";
1
+ import { addPointerInfo as d } from "./event-info.js";
2
+ import { addDomEvent as e } from "../../../../motion-dom/dist/es/events/add-dom-event.js";
3
3
  function f(o, r, t, n) {
4
- return d(o, r, e(t), n);
4
+ return e(o, r, d(t), n);
5
5
  }
6
6
  export {
7
7
  f as addPointerEvent
@@ -1,79 +1,81 @@
1
- import { animateMotionValue as M } from "../../animation/interfaces/motion-value.js";
2
- import { addDomEvent as S } from "../../events/add-dom-event.js";
3
- import { addPointerEvent as B } from "../../events/add-pointer-event.js";
4
- import { extractEventInfo as k } from "../../events/event-info.js";
5
- import { convertBoxToBoundingBox as j, convertBoundingBoxToBox as T } from "../../projection/geometry/conversion.js";
6
- import { calcLength as w } from "../../projection/geometry/delta-calc.js";
7
- import { createBox as b } from "../../projection/geometry/models.js";
8
- import { eachAxis as h } from "../../projection/utils/each-axis.js";
9
- import { measurePageBox as I } from "../../projection/utils/measure.js";
10
- import { getContextWindow as R } from "../../utils/get-context-window.js";
1
+ import { addPointerEvent as M } from "../../events/add-pointer-event.js";
2
+ import { extractEventInfo as S } from "../../events/event-info.js";
3
+ import { getContextWindow as k } from "../../utils/get-context-window.js";
11
4
  import { isRefObject as D } from "../../utils/is-ref-object.js";
12
- import { addValueToWillChange as x } from "../../value/use-will-change/add-will-change.js";
13
- import { PanSession as W } from "../pan/PanSession.js";
14
- import { applyConstraints as O, calcRelativeConstraints as U, resolveDragElastic as z, calcViewportConstraints as _, defaultElastic as F, rebaseAxisConstraints as K, calcOrigin as N } from "./utils/constraints.js";
5
+ import { PanSession as B } from "../pan/PanSession.js";
6
+ import { applyConstraints as j, calcRelativeConstraints as b, resolveDragElastic as T, calcViewportConstraints as w, defaultElastic as I, rebaseAxisConstraints as R, calcOrigin as W } from "./utils/constraints.js";
7
+ import { createBox as O } from "../../../../../motion-dom/dist/es/projection/geometry/models.js";
8
+ import { eachAxis as h } from "../../../../../motion-dom/dist/es/projection/utils/each-axis.js";
15
9
  import { frame as y } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
16
- import { invariant as $ } from "../../../../../motion-utils/dist/es/errors.js";
17
- import { setDragLock as q } from "../../../../../motion-dom/dist/es/gestures/drag/state/set-active.js";
18
- import { percent as G } from "../../../../../motion-dom/dist/es/value/types/numbers/units.js";
10
+ import { invariant as K } from "../../../../../motion-utils/dist/es/errors.js";
11
+ import { measurePageBox as U } from "../../../../../motion-dom/dist/es/projection/utils/measure.js";
12
+ import { convertBoxToBoundingBox as z, convertBoundingBoxToBox as _ } from "../../../../../motion-dom/dist/es/projection/geometry/conversion.js";
13
+ import { addValueToWillChange as x } from "../../../../../motion-dom/dist/es/value/will-change/add-will-change.js";
14
+ import { animateMotionValue as F } from "../../../../../motion-dom/dist/es/animation/interfaces/motion-value.js";
15
+ import { addDomEvent as N } from "../../../../../motion-dom/dist/es/events/add-dom-event.js";
16
+ import { setDragLock as $ } from "../../../../../motion-dom/dist/es/gestures/drag/state/set-active.js";
17
+ import { percent as q } from "../../../../../motion-dom/dist/es/value/types/numbers/units.js";
18
+ import { calcLength as G } from "../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
19
19
  import { mixNumber as L } from "../../../../../motion-dom/dist/es/utils/mix/number.js";
20
- const H = /* @__PURE__ */ new WeakMap();
21
- class dt {
20
+ import { isElementKeyboardAccessible as H } from "../../../../../motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js";
21
+ const J = /* @__PURE__ */ new WeakMap();
22
+ class Et {
22
23
  constructor(t) {
23
- this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = b(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
24
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = O(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
24
25
  }
25
26
  start(t, { snapToCursor: s = !1, distanceThreshold: n } = {}) {
26
27
  const { presenceContext: i } = this.visualElement;
27
28
  if (i && i.isPresent === !1)
28
29
  return;
29
- const r = (a) => {
30
- const { dragSnapToOrigin: l } = this.getProps();
31
- l ? this.pauseAnimation() : this.stopAnimation(), s && this.snapToCursor(k(a).point);
32
- }, e = (a, l) => {
30
+ const r = (o) => {
31
+ s ? (this.stopAnimation(), this.snapToCursor(S(o).point)) : this.pauseAnimation();
32
+ }, e = (o, c) => {
33
+ this.stopAnimation();
33
34
  const { drag: f, dragPropagation: d, onDragStart: v } = this.getProps();
34
- if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = q(f), !this.openDragLock))
35
+ if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = $(f), !this.openDragLock))
35
36
  return;
36
- this.latestPointerEvent = a, this.latestPanInfo = l, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), h((m) => {
37
- let P = this.getAxisMotionValue(m).get() || 0;
38
- if (G.test(P)) {
37
+ this.latestPointerEvent = o, this.latestPanInfo = c, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), h((g) => {
38
+ let P = this.getAxisMotionValue(g).get() || 0;
39
+ if (q.test(P)) {
39
40
  const { projection: C } = this.visualElement;
40
41
  if (C && C.layout) {
41
- const V = C.layout.layoutBox[m];
42
- V && (P = w(V) * (parseFloat(P) / 100));
42
+ const V = C.layout.layoutBox[g];
43
+ V && (P = G(V) * (parseFloat(P) / 100));
43
44
  }
44
45
  }
45
- this.originPoint[m] = P;
46
- }), v && y.postRender(() => v(a, l)), x(this.visualElement, "transform");
46
+ this.originPoint[g] = P;
47
+ }), v && y.postRender(() => v(o, c)), x(this.visualElement, "transform");
47
48
  const { animationState: E } = this.visualElement;
48
49
  E && E.setActive("whileDrag", !0);
49
- }, o = (a, l) => {
50
- this.latestPointerEvent = a, this.latestPanInfo = l;
50
+ }, a = (o, c) => {
51
+ this.latestPointerEvent = o, this.latestPanInfo = c;
51
52
  const { dragPropagation: f, dragDirectionLock: d, onDirectionLock: v, onDrag: E } = this.getProps();
52
53
  if (!f && !this.openDragLock)
53
54
  return;
54
- const { offset: m } = l;
55
+ const { offset: g } = c;
55
56
  if (d && this.currentDirection === null) {
56
- this.currentDirection = J(m), this.currentDirection !== null && v && v(this.currentDirection);
57
+ this.currentDirection = Q(g), this.currentDirection !== null && v && v(this.currentDirection);
57
58
  return;
58
59
  }
59
- this.updateAxis("x", l.point, m), this.updateAxis("y", l.point, m), this.visualElement.render(), E && E(a, l);
60
- }, c = (a, l) => {
61
- this.latestPointerEvent = a, this.latestPanInfo = l, this.stop(a, l), this.latestPointerEvent = null, this.latestPanInfo = null;
62
- }, g = () => h((a) => {
63
- var l;
64
- return this.getAnimationState(a) === "paused" && ((l = this.getAxisMotionValue(a).animation) == null ? void 0 : l.play());
60
+ this.updateAxis("x", c.point, g), this.updateAxis("y", c.point, g), this.visualElement.render(), E && E(o, c);
61
+ }, l = (o, c) => {
62
+ this.latestPointerEvent = o, this.latestPanInfo = c, this.stop(o, c), this.latestPointerEvent = null, this.latestPanInfo = null;
63
+ }, m = () => h((o) => {
64
+ var c;
65
+ return this.getAnimationState(o) === "paused" && ((c = this.getAxisMotionValue(o).animation) == null ? void 0 : c.play());
65
66
  }), { dragSnapToOrigin: u } = this.getProps();
66
- this.panSession = new W(t, {
67
+ this.panSession = new B(t, {
67
68
  onSessionStart: r,
68
69
  onStart: e,
69
- onMove: o,
70
- onSessionEnd: c,
71
- resumeAnimation: g
70
+ onMove: a,
71
+ onSessionEnd: l,
72
+ resumeAnimation: m
72
73
  }, {
73
74
  transformPagePoint: this.visualElement.getTransformPagePoint(),
74
75
  dragSnapToOrigin: u,
75
76
  distanceThreshold: n,
76
- contextWindow: R(this.visualElement)
77
+ contextWindow: k(this.visualElement),
78
+ element: this.visualElement.current
77
79
  });
78
80
  }
79
81
  /**
@@ -85,8 +87,8 @@ class dt {
85
87
  return;
86
88
  const { velocity: e } = i;
87
89
  this.startAnimation(e);
88
- const { onDragEnd: o } = this.getProps();
89
- o && y.postRender(() => o(n, i));
90
+ const { onDragEnd: a } = this.getProps();
91
+ a && y.postRender(() => a(n, i));
90
92
  }
91
93
  /**
92
94
  * @internal
@@ -94,23 +96,32 @@ class dt {
94
96
  cancel() {
95
97
  this.isDragging = !1;
96
98
  const { projection: t, animationState: s } = this.visualElement;
97
- t && (t.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
99
+ t && (t.isAnimationBlocked = !1), this.endPanSession();
98
100
  const { dragPropagation: n } = this.getProps();
99
101
  !n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), s && s.setActive("whileDrag", !1);
100
102
  }
103
+ /**
104
+ * Clean up the pan session without modifying other drag state.
105
+ * This is used during unmount to ensure event listeners are removed
106
+ * without affecting projection animations or drag locks.
107
+ * @internal
108
+ */
109
+ endPanSession() {
110
+ this.panSession && this.panSession.end(), this.panSession = void 0;
111
+ }
101
112
  updateAxis(t, s, n) {
102
113
  const { drag: i } = this.getProps();
103
114
  if (!n || !A(t, i, this.currentDirection))
104
115
  return;
105
116
  const r = this.getAxisMotionValue(t);
106
117
  let e = this.originPoint[t] + n[t];
107
- this.constraints && this.constraints[t] && (e = O(e, this.constraints[t], this.elastic[t])), r.set(e);
118
+ this.constraints && this.constraints[t] && (e = j(e, this.constraints[t], this.elastic[t])), r.set(e);
108
119
  }
109
120
  resolveConstraints() {
110
121
  var r;
111
122
  const { dragConstraints: t, dragElastic: s } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (r = this.visualElement.projection) == null ? void 0 : r.layout, i = this.constraints;
112
- t && D(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && n ? this.constraints = U(n.layoutBox, t) : this.constraints = !1, this.elastic = z(s), i !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && h((e) => {
113
- this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = K(n.layoutBox[e], this.constraints[e]));
123
+ t && D(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && n ? this.constraints = b(n.layoutBox, t) : this.constraints = !1, this.elastic = T(s), i !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && h((e) => {
124
+ this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = R(n.layoutBox[e], this.constraints[e]));
114
125
  });
115
126
  }
116
127
  resolveRefConstraints() {
@@ -118,42 +129,42 @@ class dt {
118
129
  if (!t || !D(t))
119
130
  return !1;
120
131
  const n = t.current;
121
- $(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
132
+ K(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
122
133
  const { projection: i } = this.visualElement;
123
134
  if (!i || !i.layout)
124
135
  return !1;
125
- const r = I(n, i.root, this.visualElement.getTransformPagePoint());
126
- let e = _(i.layout.layoutBox, r);
136
+ const r = U(n, i.root, this.visualElement.getTransformPagePoint());
137
+ let e = w(i.layout.layoutBox, r);
127
138
  if (s) {
128
- const o = s(j(e));
129
- this.hasMutatedConstraints = !!o, o && (e = T(o));
139
+ const a = s(z(e));
140
+ this.hasMutatedConstraints = !!a, a && (e = _(a));
130
141
  }
131
142
  return e;
132
143
  }
133
144
  startAnimation(t) {
134
- const { drag: s, dragMomentum: n, dragElastic: i, dragTransition: r, dragSnapToOrigin: e, onDragTransitionEnd: o } = this.getProps(), c = this.constraints || {}, g = h((u) => {
145
+ const { drag: s, dragMomentum: n, dragElastic: i, dragTransition: r, dragSnapToOrigin: e, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, m = h((u) => {
135
146
  if (!A(u, s, this.currentDirection))
136
147
  return;
137
- let a = c && c[u] || {};
138
- e && (a = { min: 0, max: 0 });
139
- const l = i ? 200 : 1e6, f = i ? 40 : 1e7, d = {
148
+ let o = l && l[u] || {};
149
+ e && (o = { min: 0, max: 0 });
150
+ const c = i ? 200 : 1e6, f = i ? 40 : 1e7, d = {
140
151
  type: "inertia",
141
152
  velocity: n ? t[u] : 0,
142
- bounceStiffness: l,
153
+ bounceStiffness: c,
143
154
  bounceDamping: f,
144
155
  timeConstant: 750,
145
156
  restDelta: 1,
146
157
  restSpeed: 10,
147
158
  ...r,
148
- ...a
159
+ ...o
149
160
  };
150
161
  return this.startAxisValueAnimation(u, d);
151
162
  });
152
- return Promise.all(g).then(o);
163
+ return Promise.all(m).then(a);
153
164
  }
154
165
  startAxisValueAnimation(t, s) {
155
166
  const n = this.getAxisMotionValue(t);
156
- return x(this.visualElement, t), n.start(M(t, n, 0, s, this.visualElement, !1));
167
+ return x(this.visualElement, t), n.start(F(t, n, 0, s, this.visualElement, !1));
157
168
  }
158
169
  stopAnimation() {
159
170
  h((t) => this.getAxisMotionValue(t).stop());
@@ -185,8 +196,8 @@ class dt {
185
196
  return;
186
197
  const { projection: i } = this.visualElement, r = this.getAxisMotionValue(s);
187
198
  if (i && i.layout) {
188
- const { min: e, max: o } = i.layout.layoutBox[s];
189
- r.set(t[s] - L(e, o, 0.5));
199
+ const { min: e, max: a } = i.layout.layoutBox[s], l = r.get() || 0;
200
+ r.set(t[s] - L(e, a, 0.5) + l);
190
201
  }
191
202
  });
192
203
  }
@@ -204,44 +215,44 @@ class dt {
204
215
  this.stopAnimation();
205
216
  const i = { x: 0, y: 0 };
206
217
  h((e) => {
207
- const o = this.getAxisMotionValue(e);
208
- if (o && this.constraints !== !1) {
209
- const c = o.get();
210
- i[e] = N({ min: c, max: c }, this.constraints[e]);
218
+ const a = this.getAxisMotionValue(e);
219
+ if (a && this.constraints !== !1) {
220
+ const l = a.get();
221
+ i[e] = W({ min: l, max: l }, this.constraints[e]);
211
222
  }
212
223
  });
213
224
  const { transformTemplate: r } = this.visualElement.getProps();
214
225
  this.visualElement.current.style.transform = r ? r({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), h((e) => {
215
226
  if (!A(e, t, null))
216
227
  return;
217
- const o = this.getAxisMotionValue(e), { min: c, max: g } = this.constraints[e];
218
- o.set(L(c, g, i[e]));
228
+ const a = this.getAxisMotionValue(e), { min: l, max: m } = this.constraints[e];
229
+ a.set(L(l, m, i[e]));
219
230
  });
220
231
  }
221
232
  addListeners() {
222
233
  if (!this.visualElement.current)
223
234
  return;
224
- H.set(this.visualElement, this);
225
- const t = this.visualElement.current, s = B(t, "pointerdown", (c) => {
226
- const { drag: g, dragListener: u = !0 } = this.getProps();
227
- g && u && this.start(c);
235
+ J.set(this.visualElement, this);
236
+ const t = this.visualElement.current, s = M(t, "pointerdown", (l) => {
237
+ const { drag: m, dragListener: u = !0 } = this.getProps(), o = l.target, c = o !== t && H(o);
238
+ m && u && !c && this.start(l);
228
239
  }), n = () => {
229
- const { dragConstraints: c } = this.getProps();
230
- D(c) && c.current && (this.constraints = this.resolveRefConstraints());
240
+ const { dragConstraints: l } = this.getProps();
241
+ D(l) && l.current && (this.constraints = this.resolveRefConstraints());
231
242
  }, { projection: i } = this.visualElement, r = i.addEventListener("measure", n);
232
243
  i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), y.read(n);
233
- const e = S(window, "resize", () => this.scalePositionWithinConstraints()), o = i.addEventListener("didUpdate", (({ delta: c, hasLayoutChanged: g }) => {
234
- this.isDragging && g && (h((u) => {
235
- const a = this.getAxisMotionValue(u);
236
- a && (this.originPoint[u] += c[u].translate, a.set(a.get() + c[u].translate));
244
+ const e = N(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: m }) => {
245
+ this.isDragging && m && (h((u) => {
246
+ const o = this.getAxisMotionValue(u);
247
+ o && (this.originPoint[u] += l[u].translate, o.set(o.get() + l[u].translate));
237
248
  }), this.visualElement.render());
238
249
  }));
239
250
  return () => {
240
- e(), s(), r(), o && o();
251
+ e(), s(), r(), a && a();
241
252
  };
242
253
  }
243
254
  getProps() {
244
- const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: e = F, dragMomentum: o = !0 } = t;
255
+ const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: e = I, dragMomentum: a = !0 } = t;
245
256
  return {
246
257
  ...t,
247
258
  drag: s,
@@ -249,18 +260,18 @@ class dt {
249
260
  dragPropagation: i,
250
261
  dragConstraints: r,
251
262
  dragElastic: e,
252
- dragMomentum: o
263
+ dragMomentum: a
253
264
  };
254
265
  }
255
266
  }
256
267
  function A(p, t, s) {
257
268
  return (t === !0 || t === p) && (s === null || s === p);
258
269
  }
259
- function J(p, t = 10) {
270
+ function Q(p, t = 10) {
260
271
  let s = null;
261
272
  return Math.abs(p.y) > t ? s = "y" : Math.abs(p.x) > t && (s = "x"), s;
262
273
  }
263
274
  export {
264
- dt as VisualElementDragControls,
265
- H as elementDragControls
275
+ Et as VisualElementDragControls,
276
+ J as elementDragControls
266
277
  };
@@ -1,18 +1,22 @@
1
- import { Feature as s } from "../../motion/features/Feature.js";
2
1
  import { VisualElementDragControls as t } from "./VisualElementDragControls.js";
3
- import { noop as r } from "../../../../../motion-utils/dist/es/noop.js";
4
- class u extends s {
2
+ import { Feature as e } from "../../../../../motion-dom/dist/es/render/Feature.js";
3
+ import { noop as s } from "../../../../../motion-utils/dist/es/noop.js";
4
+ class m extends e {
5
5
  constructor(o) {
6
- super(o), this.removeGroupControls = r, this.removeListeners = r, this.controls = new t(o);
6
+ super(o), this.removeGroupControls = s, this.removeListeners = s, this.controls = new t(o);
7
7
  }
8
8
  mount() {
9
9
  const { dragControls: o } = this.node.getProps();
10
- o && (this.removeGroupControls = o.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || r;
10
+ o && (this.removeGroupControls = o.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || s;
11
+ }
12
+ update() {
13
+ const { dragControls: o } = this.node.getProps(), { dragControls: r } = this.node.prevProps || {};
14
+ o !== r && (this.removeGroupControls(), o && (this.removeGroupControls = o.subscribe(this.controls)));
11
15
  }
12
16
  unmount() {
13
- this.removeGroupControls(), this.removeListeners();
17
+ this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
14
18
  }
15
19
  }
16
20
  export {
17
- u as DragGesture
21
+ m as DragGesture
18
22
  };
@@ -1,9 +1,9 @@
1
- import { calcLength as r } from "../../../projection/geometry/delta-calc.js";
2
- import { mixNumber as t } from "../../../../../../motion-dom/dist/es/utils/mix/number.js";
1
+ import { mixNumber as r } from "../../../../../../motion-dom/dist/es/utils/mix/number.js";
2
+ import { calcLength as t } from "../../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
3
3
  import { progress as u } from "../../../../../../motion-utils/dist/es/progress.js";
4
4
  import { clamp as C } from "../../../../../../motion-utils/dist/es/clamp.js";
5
5
  function a(n, { min: e, max: m }, i) {
6
- return e !== void 0 && n < e ? n = i ? t(e, n, i.min) : Math.max(n, e) : m !== void 0 && n > m && (n = i ? t(m, n, i.max) : Math.min(n, m)), n;
6
+ return e !== void 0 && n < e ? n = i ? r(e, n, i.min) : Math.max(n, e) : m !== void 0 && n > m && (n = i ? r(m, n, i.max) : Math.min(n, m)), n;
7
7
  }
8
8
  function o(n, e, m) {
9
9
  return {
@@ -29,7 +29,7 @@ function w(n, e) {
29
29
  }
30
30
  function y(n, e) {
31
31
  let m = 0.5;
32
- const i = r(n), f = r(e);
32
+ const i = t(n), f = t(e);
33
33
  return f > i ? m = u(e.min, e.max - i, n.min) : i > f && (m = u(n.min, n.max - f, e.min)), C(0, 1, m);
34
34
  }
35
35
  function M(n, e) {
@@ -1,6 +1,6 @@
1
- import { addDomEvent as e } from "../events/add-dom-event.js";
2
- import { Feature as i } from "../motion/features/Feature.js";
1
+ import { Feature as i } from "../../../../motion-dom/dist/es/render/Feature.js";
3
2
  import { pipe as s } from "../../../../motion-utils/dist/es/pipe.js";
3
+ import { addDomEvent as e } from "../../../../motion-dom/dist/es/events/add-dom-event.js";
4
4
  class a extends i {
5
5
  constructor() {
6
6
  super(...arguments), this.isActive = !1;
@@ -1,5 +1,5 @@
1
1
  import { extractEventInfo as m } from "../events/event-info.js";
2
- import { Feature as s } from "../motion/features/Feature.js";
2
+ import { Feature as s } from "../../../../motion-dom/dist/es/render/Feature.js";
3
3
  import { hover as u } from "../../../../motion-dom/dist/es/gestures/hover.js";
4
4
  import { frame as c } from "../../../../motion-dom/dist/es/frameloop/frame.js";
5
5
  function a(e, t, r) {