@code0-tech/pictor 0.18.3 → 1.1.0

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 (464) hide show
  1. package/dist/_virtual/__vite-optional-peer-dep_@emotion/is-prop-valid_framer-motion.js +6 -0
  2. package/dist/_virtual/rolldown_runtime.js +18 -0
  3. package/dist/assets/Alert.style.css +1 -0
  4. package/dist/assets/Aurora.style.css +1 -0
  5. package/dist/assets/Avatar.style.css +1 -0
  6. package/dist/assets/Badge.style.css +1 -0
  7. package/dist/assets/Breadcrumb.style.css +1 -0
  8. package/dist/assets/Button.style.css +1 -0
  9. package/dist/assets/ButtonGroup.style.css +1 -0
  10. package/dist/assets/Card.style.css +1 -0
  11. package/dist/assets/Chart.style.css +1 -0
  12. package/dist/assets/Col.style.css +1 -0
  13. package/dist/assets/ColorInput.style.css +1 -0
  14. package/dist/assets/Command.style.css +1 -0
  15. package/dist/assets/Container.style.css +1 -0
  16. package/dist/assets/ContextMenu.style.css +1 -0
  17. package/dist/assets/DataTable.style.css +1 -0
  18. package/dist/assets/DateInput.style.css +1 -0
  19. package/dist/assets/Dialog.style.css +1 -0
  20. package/dist/assets/Editor.styles.css +1 -0
  21. package/dist/assets/EditorInput.style.css +1 -0
  22. package/dist/assets/FileInput.style.css +1 -0
  23. package/dist/assets/FileTabs.style.css +1 -0
  24. package/dist/assets/FullScreen.style.css +1 -0
  25. package/dist/assets/Gantt.style.css +1 -0
  26. package/dist/assets/Icon.style.css +1 -0
  27. package/dist/assets/Input.style.css +1 -0
  28. package/dist/assets/InputWrapper.style.css +1 -0
  29. package/dist/assets/JsonView.style.css +1 -0
  30. package/dist/assets/Layout.style.css +1 -0
  31. package/dist/assets/Menu.style.css +1 -0
  32. package/dist/assets/Progress.style.css +1 -0
  33. package/dist/assets/Quote.style.css +1 -0
  34. package/dist/assets/Resizable.style.css +1 -0
  35. package/dist/assets/Row.style.css +1 -0
  36. package/dist/assets/ScrollArea.style.css +1 -0
  37. package/dist/assets/SegmentedControl.style.css +1 -0
  38. package/dist/assets/SelectInput.style.css +1 -0
  39. package/dist/assets/Tab.style.css +1 -0
  40. package/dist/assets/Text.style.css +1 -0
  41. package/dist/assets/Toast.style.css +1 -0
  42. package/dist/assets/Tooltip.style.css +1 -0
  43. package/dist/components/alert/Alert.js +34 -41
  44. package/dist/components/aurora/Aurora.js +27 -22
  45. package/dist/components/avatar/Avatar.js +57 -55
  46. package/dist/components/badge/Badge.js +58 -64
  47. package/dist/components/breadcrumb/Breadcrumb.js +16 -20
  48. package/dist/components/button/Button.js +24 -31
  49. package/dist/components/button-group/ButtonGroup.js +29 -31
  50. package/dist/components/card/Card.js +30 -44
  51. package/dist/components/card/CardSection.js +21 -29
  52. package/dist/components/chart/Chart.js +138 -153
  53. package/dist/components/chart/LineChart.js +75 -74
  54. package/dist/components/chart/index.js +3 -8
  55. package/dist/components/col/Col.js +19 -29
  56. package/dist/components/command/Command.js +101 -134
  57. package/dist/components/container/Container.js +19 -23
  58. package/dist/components/context-menu/ContextMenu.d.ts +1 -1
  59. package/dist/components/context-menu/ContextMenu.js +119 -125
  60. package/dist/components/data-table/DataTable.js +53 -63
  61. package/dist/components/data-table/DataTableColumn.js +18 -22
  62. package/dist/components/data-table/DataTableFilterInput.js +208 -205
  63. package/dist/components/data-table/DataTableFilterSuggestionMenu.js +59 -48
  64. package/dist/components/data-table/DataTableHeader.js +34 -38
  65. package/dist/components/data-table/DataTablePagination.js +62 -74
  66. package/dist/components/data-table/index.js +7 -22
  67. package/dist/components/dialog/Dialog.js +107 -102
  68. package/dist/components/editor/Editor.js +352 -322
  69. package/dist/components/file-tabs/FileTabs.js +78 -73
  70. package/dist/components/file-tabs/FileTabs.service.js +85 -87
  71. package/dist/components/file-tabs/FileTabs.view.js +0 -1
  72. package/dist/components/file-tabs/index.js +3 -9
  73. package/dist/components/flex/Flex.js +19 -23
  74. package/dist/components/form/CheckboxInput.js +73 -76
  75. package/dist/components/form/ColorInput.js +378 -353
  76. package/dist/components/form/DateInput.js +315 -265
  77. package/dist/components/form/EditorInput.js +597 -579
  78. package/dist/components/form/EmailInput.js +30 -23
  79. package/dist/components/form/FileInput.js +93 -123
  80. package/dist/components/form/Input.js +64 -57
  81. package/dist/components/form/Input.utils.js +25 -37
  82. package/dist/components/form/InputDescription.js +11 -11
  83. package/dist/components/form/InputLabel.js +18 -22
  84. package/dist/components/form/InputMessage.js +17 -17
  85. package/dist/components/form/InputWrapper.js +56 -65
  86. package/dist/components/form/NumberInput.js +41 -20
  87. package/dist/components/form/PasswordInput.js +71 -54
  88. package/dist/components/form/PinInput.js +50 -65
  89. package/dist/components/form/RadioGroup.js +42 -50
  90. package/dist/components/form/RadioInput.js +31 -29
  91. package/dist/components/form/SelectInput.js +69 -92
  92. package/dist/components/form/SwitchInput.js +17 -18
  93. package/dist/components/form/TagInput.js +108 -122
  94. package/dist/components/form/TextAreaInput.js +24 -21
  95. package/dist/components/form/TextInput.js +30 -22
  96. package/dist/components/form/index.js +22 -87
  97. package/dist/components/form/useForm.js +87 -88
  98. package/dist/components/fullscreen/FullScreen.js +28 -27
  99. package/dist/components/gantt/Gantt.js +100 -98
  100. package/dist/components/gantt/GanttGroup.js +210 -194
  101. package/dist/components/gantt/GanttHeader.js +79 -81
  102. package/dist/components/gantt/GanttItem.js +19 -22
  103. package/dist/components/icon/Icon.d.ts +6 -4
  104. package/dist/components/icon/Icon.js +53 -42
  105. package/dist/components/icon/codezero/codezero.js +10 -0
  106. package/dist/components/icon/codezero/gls.js +9 -0
  107. package/dist/components/icon/codezero/index.js +17 -13
  108. package/dist/components/json-view/JsonView.js +120 -109
  109. package/dist/components/layout/Layout.js +101 -78
  110. package/dist/components/menu/Menu.js +135 -141
  111. package/dist/components/progress/ProgressCircle.js +60 -48
  112. package/dist/components/progress/ProgressLinear.js +39 -42
  113. package/dist/components/quote/Quote.js +52 -43
  114. package/dist/components/resizable/Resizable.js +36 -33
  115. package/dist/components/row/Row.js +19 -23
  116. package/dist/components/scroll-area/ScrollArea.js +66 -76
  117. package/dist/components/segmented-control/SegmentedControl.d.ts +2 -2
  118. package/dist/components/segmented-control/SegmentedControl.js +46 -26
  119. package/dist/components/spacing/Spacing.js +16 -23
  120. package/dist/components/tab/Tab.js +73 -40
  121. package/dist/components/text/Text.js +19 -25
  122. package/dist/components/toast/Toast.d.ts +1 -1
  123. package/dist/components/toast/Toast.js +104 -83
  124. package/dist/components/tooltip/Tooltip.js +66 -60
  125. package/dist/index.js +76 -261
  126. package/dist/node_modules/@lezer/common/dist/index.js +778 -143
  127. package/dist/node_modules/@lezer/highlight/dist/index.js +305 -536
  128. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +55 -55
  129. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +49 -32
  130. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +57 -46
  131. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +17 -16
  132. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +8 -11
  133. package/dist/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +4 -5
  134. package/dist/node_modules/framer-motion/dist/es/context/LazyContext.js +4 -5
  135. package/dist/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +7 -8
  136. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/create.js +13 -11
  137. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/index.js +4 -5
  138. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +12 -14
  139. package/dist/node_modules/framer-motion/dist/es/context/PresenceContext.js +4 -5
  140. package/dist/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +4 -5
  141. package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +5 -7
  142. package/dist/node_modules/framer-motion/dist/es/events/event-info.js +8 -13
  143. package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +252 -281
  144. package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +19 -21
  145. package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +57 -67
  146. package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +24 -27
  147. package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +16 -19
  148. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +130 -124
  149. package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +39 -42
  150. package/dist/node_modules/framer-motion/dist/es/gestures/press.js +22 -27
  151. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +36 -44
  152. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +22 -32
  153. package/dist/node_modules/framer-motion/dist/es/motion/features/animations.js +6 -12
  154. package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +47 -37
  155. package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +12 -16
  156. package/dist/node_modules/framer-motion/dist/es/motion/features/gestures.js +10 -20
  157. package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +58 -59
  158. package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +7 -11
  159. package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +10 -13
  160. package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +42 -43
  161. package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +19 -18
  162. package/dist/node_modules/framer-motion/dist/es/motion/index.js +64 -58
  163. package/dist/node_modules/framer-motion/dist/es/motion/utils/symbol.js +2 -4
  164. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +18 -20
  165. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +53 -62
  166. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +45 -49
  167. package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +4 -38
  168. package/dist/node_modules/framer-motion/dist/es/render/components/create-proxy.js +7 -17
  169. package/dist/node_modules/framer-motion/dist/es/render/components/m/proxy.js +3 -0
  170. package/dist/node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.js +10 -12
  171. package/dist/node_modules/framer-motion/dist/es/render/components/motion/proxy.js +5 -7
  172. package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +6 -10
  173. package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +18 -15
  174. package/dist/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +14 -18
  175. package/dist/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +4 -23
  176. package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +8 -9
  177. package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +20 -23
  178. package/dist/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +6 -8
  179. package/dist/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +27 -29
  180. package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +23 -21
  181. package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +8 -9
  182. package/dist/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +5 -7
  183. package/dist/node_modules/framer-motion/dist/es/utils/distance.js +5 -8
  184. package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.js +2 -4
  185. package/dist/node_modules/framer-motion/dist/es/utils/is-browser.js +2 -4
  186. package/dist/node_modules/framer-motion/dist/es/utils/is-ref-object.js +3 -5
  187. package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js +11 -0
  188. package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +20 -25
  189. package/dist/node_modules/framer-motion/dist/es/utils/use-constant.js +6 -7
  190. package/dist/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +5 -6
  191. package/dist/node_modules/motion/dist/es/react.js +196 -0
  192. package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +104 -111
  193. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.js +126 -143
  194. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +81 -105
  195. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +25 -37
  196. package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.js +7 -9
  197. package/dist/node_modules/motion-dom/dist/es/animation/drivers/frame.js +10 -16
  198. package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.js +29 -36
  199. package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.js +18 -28
  200. package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.js +156 -170
  201. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/calc-duration.js +6 -12
  202. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.js +13 -12
  203. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/is-generator.js +3 -5
  204. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/velocity.js +6 -8
  205. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/motion-value.js +42 -45
  206. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.js +52 -57
  207. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-variant.js +22 -27
  208. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element.js +18 -21
  209. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +58 -67
  210. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.js +61 -70
  211. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.js +5 -7
  212. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/default.js +5 -7
  213. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/fill.js +9 -11
  214. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/time.js +3 -5
  215. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.js +3 -6
  216. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/is-none.js +4 -6
  217. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.js +15 -15
  218. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.js +32 -35
  219. package/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id.js +3 -6
  220. package/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/get-appear-id.js +4 -6
  221. package/dist/node_modules/motion-dom/dist/es/animation/utils/WithPromise.js +19 -26
  222. package/dist/node_modules/motion-dom/dist/es/animation/utils/calc-child-stagger.js +4 -6
  223. package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.js +14 -21
  224. package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.js +21 -29
  225. package/dist/node_modules/motion-dom/dist/es/animation/utils/default-transitions.js +25 -22
  226. package/dist/node_modules/motion-dom/dist/es/animation/utils/get-value-transition.js +5 -7
  227. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-animatable.js +3 -7
  228. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +4 -8
  229. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.js +15 -19
  230. package/dist/node_modules/motion-dom/dist/es/animation/utils/make-animation-instant.js +3 -5
  231. package/dist/node_modules/motion-dom/dist/es/animation/utils/replace-transition-type.js +12 -14
  232. package/dist/node_modules/motion-dom/dist/es/animation/utils/resolve-transition.js +10 -9
  233. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.js +2 -4
  234. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.js +8 -11
  235. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/supported.js +32 -14
  236. package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.js +16 -20
  237. package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.js +21 -32
  238. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.js +7 -11
  239. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.js +5 -7
  240. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.js +5 -9
  241. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/linear.js +5 -9
  242. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.js +12 -14
  243. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.js +3 -5
  244. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.js +27 -26
  245. package/dist/node_modules/motion-dom/dist/es/frameloop/frame.js +4 -9
  246. package/dist/node_modules/motion-dom/dist/es/frameloop/microtask.js +3 -5
  247. package/dist/node_modules/motion-dom/dist/es/frameloop/order.js +10 -20
  248. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.js +29 -42
  249. package/dist/node_modules/motion-dom/dist/es/frameloop/sync-time.js +11 -13
  250. package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/is-active.js +6 -9
  251. package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/set-active.js +8 -10
  252. package/dist/node_modules/motion-dom/dist/es/gestures/hover.js +32 -36
  253. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.js +32 -32
  254. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +16 -15
  255. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.js +23 -24
  256. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/state.js +2 -4
  257. package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.js +2 -4
  258. package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.js +2 -4
  259. package/dist/node_modules/motion-dom/dist/es/gestures/utils/setup.js +13 -11
  260. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.js +20 -29
  261. package/dist/node_modules/motion-dom/dist/es/projection/geometry/conversion.js +34 -22
  262. package/dist/node_modules/motion-dom/dist/es/projection/geometry/copy.js +7 -11
  263. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.js +41 -53
  264. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.js +28 -38
  265. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.js +23 -21
  266. package/dist/node_modules/motion-dom/dist/es/projection/geometry/models.js +15 -17
  267. package/dist/node_modules/motion-dom/dist/es/projection/geometry/utils.js +18 -26
  268. package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.js +10 -12
  269. package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.js +19 -24
  270. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.js +554 -592
  271. package/dist/node_modules/motion-dom/dist/es/projection/node/state.js +4 -14
  272. package/dist/node_modules/motion-dom/dist/es/projection/shared/stack.js +48 -52
  273. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-border-radius.js +10 -20
  274. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-box-shadow.js +11 -16
  275. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +14 -20
  276. package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.js +9 -12
  277. package/dist/node_modules/motion-dom/dist/es/projection/utils/compare-by-depth.js +2 -4
  278. package/dist/node_modules/motion-dom/dist/es/projection/utils/each-axis.js +3 -5
  279. package/dist/node_modules/motion-dom/dist/es/projection/utils/flat-tree.js +16 -18
  280. package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.js +11 -15
  281. package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.js +8 -11
  282. package/dist/node_modules/motion-dom/dist/es/render/Feature.js +6 -9
  283. package/dist/node_modules/motion-dom/dist/es/render/VisualElement.js +198 -260
  284. package/dist/node_modules/motion-dom/dist/es/render/dom/DOMVisualElement.js +25 -27
  285. package/dist/node_modules/motion-dom/dist/es/render/dom/is-css-var.js +2 -4
  286. package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.js +49 -60
  287. package/dist/node_modules/motion-dom/dist/es/render/dom/style-set.js +4 -6
  288. package/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +3 -5
  289. package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +35 -35
  290. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +25 -28
  291. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +33 -37
  292. package/dist/node_modules/motion-dom/dist/es/render/html/utils/render.js +5 -11
  293. package/dist/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +8 -12
  294. package/dist/node_modules/motion-dom/dist/es/render/store.js +2 -4
  295. package/dist/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +37 -39
  296. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +18 -30
  297. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/camel-case-attrs.js +25 -27
  298. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/is-svg-tag.js +2 -4
  299. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/path.js +11 -13
  300. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/render.js +6 -10
  301. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +11 -14
  302. package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.js +128 -138
  303. package/dist/node_modules/motion-dom/dist/es/render/utils/get-variant-context.js +16 -19
  304. package/dist/node_modules/motion-dom/dist/es/render/utils/is-animation-controls.js +3 -5
  305. package/dist/node_modules/motion-dom/dist/es/render/utils/is-controlling-variants.js +8 -11
  306. package/dist/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +5 -8
  307. package/dist/node_modules/motion-dom/dist/es/render/utils/is-keyframes-target.js +2 -4
  308. package/dist/node_modules/motion-dom/dist/es/render/utils/is-variant-label.js +3 -5
  309. package/dist/node_modules/motion-dom/dist/es/render/utils/keys-position.js +10 -12
  310. package/dist/node_modules/motion-dom/dist/es/render/utils/keys-transform.js +20 -23
  311. package/dist/node_modules/motion-dom/dist/es/render/utils/motion-values.js +18 -24
  312. package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +8 -14
  313. package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.js +2 -5
  314. package/dist/node_modules/motion-dom/dist/es/render/utils/resolve-dynamic-variants.js +5 -7
  315. package/dist/node_modules/motion-dom/dist/es/render/utils/resolve-variants.js +16 -18
  316. package/dist/node_modules/motion-dom/dist/es/render/utils/setters.js +14 -18
  317. package/dist/node_modules/motion-dom/dist/es/render/utils/shallow-compare.js +7 -13
  318. package/dist/node_modules/motion-dom/dist/es/render/utils/variant-props.js +10 -13
  319. package/dist/node_modules/motion-dom/dist/es/resize/handle-element.js +31 -35
  320. package/dist/node_modules/motion-dom/dist/es/resize/handle-window.js +18 -21
  321. package/dist/node_modules/motion-dom/dist/es/resize/index.js +5 -7
  322. package/dist/node_modules/motion-dom/dist/es/stats/buffer.js +5 -0
  323. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.js +7 -0
  324. package/dist/node_modules/motion-dom/dist/es/utils/delay.js +9 -11
  325. package/dist/node_modules/motion-dom/dist/es/utils/interpolate.js +29 -40
  326. package/dist/node_modules/motion-dom/dist/es/utils/is-html-element.js +4 -6
  327. package/dist/node_modules/motion-dom/dist/es/utils/is-svg-element.js +4 -6
  328. package/dist/node_modules/motion-dom/dist/es/utils/is-svg-svg-element.js +4 -6
  329. package/dist/node_modules/motion-dom/dist/es/utils/mix/color.js +26 -27
  330. package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.js +44 -45
  331. package/dist/node_modules/motion-dom/dist/es/utils/mix/immediate.js +3 -5
  332. package/dist/node_modules/motion-dom/dist/es/utils/mix/index.js +5 -7
  333. package/dist/node_modules/motion-dom/dist/es/utils/mix/number.js +2 -4
  334. package/dist/node_modules/motion-dom/dist/es/utils/mix/visibility.js +4 -7
  335. package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +11 -14
  336. package/dist/node_modules/motion-dom/dist/es/utils/supports/flags.js +2 -4
  337. package/dist/node_modules/motion-dom/dist/es/utils/supports/linear-easing.js +9 -11
  338. package/dist/node_modules/motion-dom/dist/es/utils/supports/memo.js +6 -8
  339. package/dist/node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.js +3 -5
  340. package/dist/node_modules/motion-dom/dist/es/value/index.js +89 -211
  341. package/dist/node_modules/motion-dom/dist/es/value/types/auto.js +4 -6
  342. package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.js +15 -17
  343. package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla-to-rgba.js +17 -20
  344. package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla.js +9 -11
  345. package/dist/node_modules/motion-dom/dist/es/value/types/color/index.js +12 -14
  346. package/dist/node_modules/motion-dom/dist/es/value/types/color/rgba.js +12 -15
  347. package/dist/node_modules/motion-dom/dist/es/value/types/color/utils.js +13 -17
  348. package/dist/node_modules/motion-dom/dist/es/value/types/complex/filter.js +22 -22
  349. package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.js +43 -44
  350. package/dist/node_modules/motion-dom/dist/es/value/types/complex/mask.js +11 -10
  351. package/dist/node_modules/motion-dom/dist/es/value/types/dimensions.js +14 -9
  352. package/dist/node_modules/motion-dom/dist/es/value/types/int.js +5 -7
  353. package/dist/node_modules/motion-dom/dist/es/value/types/maps/defaults.js +22 -27
  354. package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +61 -69
  355. package/dist/node_modules/motion-dom/dist/es/value/types/maps/transform.js +29 -36
  356. package/dist/node_modules/motion-dom/dist/es/value/types/numbers/index.js +12 -16
  357. package/dist/node_modules/motion-dom/dist/es/value/types/numbers/units.js +10 -17
  358. package/dist/node_modules/motion-dom/dist/es/value/types/test.js +2 -4
  359. package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.js +9 -11
  360. package/dist/node_modules/motion-dom/dist/es/value/types/utils/color-regex.js +2 -4
  361. package/dist/node_modules/motion-dom/dist/es/value/types/utils/find.js +10 -8
  362. package/dist/node_modules/motion-dom/dist/es/value/types/utils/float-regex.js +2 -4
  363. package/dist/node_modules/motion-dom/dist/es/value/types/utils/get-as-type.js +2 -4
  364. package/dist/node_modules/motion-dom/dist/es/value/types/utils/is-nullish.js +3 -5
  365. package/dist/node_modules/motion-dom/dist/es/value/types/utils/sanitize.js +2 -4
  366. package/dist/node_modules/motion-dom/dist/es/value/types/utils/single-color-regex.js +2 -4
  367. package/dist/node_modules/motion-dom/dist/es/value/utils/is-motion-value.js +2 -4
  368. package/dist/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +4 -6
  369. package/dist/node_modules/motion-dom/dist/es/value/will-change/add-will-change.js +10 -13
  370. package/dist/node_modules/motion-dom/dist/es/value/will-change/is.js +4 -6
  371. package/dist/node_modules/motion-utils/dist/es/array.js +6 -9
  372. package/dist/node_modules/motion-utils/dist/es/clamp.js +2 -4
  373. package/dist/node_modules/motion-utils/dist/es/easing/anticipate.js +3 -5
  374. package/dist/node_modules/motion-utils/dist/es/easing/back.js +5 -9
  375. package/dist/node_modules/motion-utils/dist/es/easing/circ.js +4 -8
  376. package/dist/node_modules/motion-utils/dist/es/easing/cubic-bezier.js +14 -17
  377. package/dist/node_modules/motion-utils/dist/es/easing/ease.js +3 -7
  378. package/dist/node_modules/motion-utils/dist/es/easing/modifiers/mirror.js +2 -4
  379. package/dist/node_modules/motion-utils/dist/es/easing/modifiers/reverse.js +2 -4
  380. package/dist/node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.js +2 -4
  381. package/dist/node_modules/motion-utils/dist/es/easing/utils/is-easing-array.js +2 -4
  382. package/dist/node_modules/motion-utils/dist/es/easing/utils/map.js +28 -31
  383. package/dist/node_modules/motion-utils/dist/es/errors.js +7 -13
  384. package/dist/node_modules/motion-utils/dist/es/format-error-message.js +3 -5
  385. package/dist/node_modules/motion-utils/dist/es/global-config.js +2 -4
  386. package/dist/node_modules/motion-utils/dist/es/is-numerical-string.js +2 -4
  387. package/dist/node_modules/motion-utils/dist/es/is-object.js +2 -4
  388. package/dist/node_modules/motion-utils/dist/es/is-zero-value-string.js +2 -4
  389. package/dist/node_modules/motion-utils/dist/es/memo.js +5 -7
  390. package/dist/node_modules/motion-utils/dist/es/noop.js +2 -4
  391. package/dist/node_modules/motion-utils/dist/es/pipe.js +2 -4
  392. package/dist/node_modules/motion-utils/dist/es/progress.js +4 -6
  393. package/dist/node_modules/motion-utils/dist/es/subscription-manager.js +23 -28
  394. package/dist/node_modules/motion-utils/dist/es/time-conversion.js +2 -5
  395. package/dist/node_modules/motion-utils/dist/es/velocity-per-second.js +2 -4
  396. package/dist/node_modules/motion-utils/dist/es/warn-once.js +5 -7
  397. package/dist/node_modules/prettier/plugins/babel.js +9582 -7023
  398. package/dist/node_modules/prettier/plugins/estree.js +6997 -4377
  399. package/dist/node_modules/prettier/standalone.js +3444 -2415
  400. package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +21 -21
  401. package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +18 -14
  402. package/dist/node_modules/react/compiler-runtime.js +8 -10
  403. package/dist/utils/arrayService.js +0 -1
  404. package/dist/utils/color.js +46 -41
  405. package/dist/utils/component.js +60 -129
  406. package/dist/utils/contextStore.js +48 -58
  407. package/dist/utils/index.d.ts +1 -0
  408. package/dist/utils/index.js +7 -18
  409. package/dist/utils/motion.d.ts +55 -0
  410. package/dist/utils/motion.js +87 -0
  411. package/dist/utils/reactiveArrayService.js +80 -76
  412. package/dist/utils/size.js +14 -26
  413. package/dist/utils/utils.js +0 -1
  414. package/dist/utils/view.js +27 -24
  415. package/dist/vite-env.d.js +0 -1
  416. package/package.json +30 -25
  417. package/dist/_virtual/compiler-runtime.js +0 -5
  418. package/dist/_virtual/compiler-runtime2.js +0 -4
  419. package/dist/_virtual/react-compiler-runtime.development.js +0 -4
  420. package/dist/_virtual/react-compiler-runtime.production.js +0 -4
  421. package/dist/assets/components/alert/Alert.style.css +0 -1
  422. package/dist/assets/components/aurora/Aurora.style.css +0 -1
  423. package/dist/assets/components/avatar/Avatar.style.css +0 -1
  424. package/dist/assets/components/badge/Badge.style.css +0 -1
  425. package/dist/assets/components/breadcrumb/Breadcrumb.style.css +0 -1
  426. package/dist/assets/components/button/Button.style.css +0 -1
  427. package/dist/assets/components/button-group/ButtonGroup.style.css +0 -1
  428. package/dist/assets/components/card/Card.style.css +0 -1
  429. package/dist/assets/components/chart/Chart.style.css +0 -1
  430. package/dist/assets/components/col/Col.style.css +0 -1
  431. package/dist/assets/components/command/Command.style.css +0 -1
  432. package/dist/assets/components/container/Container.style.css +0 -1
  433. package/dist/assets/components/context-menu/ContextMenu.style.css +0 -1
  434. package/dist/assets/components/data-table/DataTable.style.css +0 -1
  435. package/dist/assets/components/dialog/Dialog.style.css +0 -1
  436. package/dist/assets/components/editor/Editor.styles.css +0 -1
  437. package/dist/assets/components/file-tabs/FileTabs.style.css +0 -1
  438. package/dist/assets/components/form/ColorInput.style.css +0 -1
  439. package/dist/assets/components/form/DateInput.style.css +0 -1
  440. package/dist/assets/components/form/EditorInput.style.css +0 -1
  441. package/dist/assets/components/form/FileInput.style.css +0 -1
  442. package/dist/assets/components/form/Input.style.css +0 -1
  443. package/dist/assets/components/form/InputWrapper.style.css +0 -1
  444. package/dist/assets/components/form/SelectInput.style.css +0 -1
  445. package/dist/assets/components/fullscreen/FullScreen.style.css +0 -1
  446. package/dist/assets/components/gantt/Gantt.style.css +0 -1
  447. package/dist/assets/components/icon/Icon.style.css +0 -1
  448. package/dist/assets/components/json-view/JsonView.style.css +0 -1
  449. package/dist/assets/components/layout/Layout.style.css +0 -1
  450. package/dist/assets/components/menu/Menu.style.css +0 -1
  451. package/dist/assets/components/progress/Progress.style.css +0 -1
  452. package/dist/assets/components/quote/Quote.style.css +0 -1
  453. package/dist/assets/components/resizable/Resizable.style.css +0 -1
  454. package/dist/assets/components/row/Row.style.css +0 -1
  455. package/dist/assets/components/scroll-area/ScrollArea.style.css +0 -1
  456. package/dist/assets/components/segmented-control/SegmentedControl.style.css +0 -1
  457. package/dist/assets/components/tab/Tab.style.css +0 -1
  458. package/dist/assets/components/text/Text.style.css +0 -1
  459. package/dist/assets/components/toast/Toast.style.css +0 -1
  460. package/dist/assets/components/tooltip/Tooltip.style.css +0 -1
  461. package/dist/components/icon/codezero/codezero.svg.js +0 -5
  462. package/dist/components/icon/codezero/gls.svg.js +0 -5
  463. /package/dist/assets/{components/flex/Flex.style.css → Flex.style.css} +0 -0
  464. /package/dist/assets/{components/spacing/Spacing.style.css → Spacing.style.css} +0 -0
@@ -1,285 +1,256 @@
1
- import { addPointerEvent as k } from "../../events/add-pointer-event.js";
2
- import { extractEventInfo as B } from "../../events/event-info.js";
3
- import { getContextWindow as j } from "../../utils/get-context-window.js";
4
- import { isRefObject as P } from "../../utils/is-ref-object.js";
5
- import { PanSession as T } from "../pan/PanSession.js";
6
- import { applyConstraints as b, calcRelativeConstraints as I, resolveDragElastic as w, calcViewportConstraints as R, defaultElastic as O, rebaseAxisConstraints as W, calcOrigin as z } from "./utils/constraints.js";
7
- import { createBox as F } from "../../../../../motion-dom/dist/es/projection/geometry/models.js";
8
- import { frame as C } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
9
- import { eachAxis as p } from "../../../../../motion-dom/dist/es/projection/utils/each-axis.js";
10
- import { invariant as U } from "../../../../../motion-utils/dist/es/errors.js";
11
- import { measurePageBox as _ } from "../../../../../motion-dom/dist/es/projection/utils/measure.js";
12
- import { convertBoxToBoundingBox as K, convertBoundingBoxToBox as N } from "../../../../../motion-dom/dist/es/projection/geometry/conversion.js";
13
- import { addValueToWillChange as L } from "../../../../../motion-dom/dist/es/value/will-change/add-will-change.js";
14
- import { animateMotionValue as $ } from "../../../../../motion-dom/dist/es/animation/interfaces/motion-value.js";
15
- import { addDomEvent as q } from "../../../../../motion-dom/dist/es/events/add-dom-event.js";
16
- import { setDragLock as G } from "../../../../../motion-dom/dist/es/gestures/drag/state/set-active.js";
17
- import { resize as V } from "../../../../../motion-dom/dist/es/resize/index.js";
18
- import { percent as H } from "../../../../../motion-dom/dist/es/value/types/numbers/units.js";
19
- import { calcLength as J } from "../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
20
- import { mixNumber as M } from "../../../../../motion-dom/dist/es/utils/mix/number.js";
21
- import { isElementTextInput as Q } from "../../../../../motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js";
22
- const X = /* @__PURE__ */ new WeakMap();
23
- class At {
24
- constructor(t) {
25
- this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = F(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
26
- }
27
- start(t, { snapToCursor: s = !1, distanceThreshold: n } = {}) {
28
- const { presenceContext: i } = this.visualElement;
29
- if (i && i.isPresent === !1)
30
- return;
31
- const e = (r) => {
32
- s && this.snapToCursor(B(r).point), this.stopAnimation();
33
- }, o = (r, l) => {
34
- const { drag: g, dragPropagation: d, onDragStart: v } = this.getProps();
35
- if (g && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = G(g), !this.openDragLock))
36
- return;
37
- this.latestPointerEvent = r, 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), p((f) => {
38
- let D = this.getAxisMotionValue(f).get() || 0;
39
- if (H.test(D)) {
40
- const { projection: y } = this.visualElement;
41
- if (y && y.layout) {
42
- const x = y.layout.layoutBox[f];
43
- x && (D = J(x) * (parseFloat(D) / 100));
44
- }
45
- }
46
- this.originPoint[f] = D;
47
- }), v && C.update(() => v(r, l), !1, !0), L(this.visualElement, "transform");
48
- const { animationState: E } = this.visualElement;
49
- E && E.setActive("whileDrag", !0);
50
- }, a = (r, l) => {
51
- this.latestPointerEvent = r, this.latestPanInfo = l;
52
- const { dragPropagation: g, dragDirectionLock: d, onDirectionLock: v, onDrag: E } = this.getProps();
53
- if (!g && !this.openDragLock)
54
- return;
55
- const { offset: f } = l;
56
- if (d && this.currentDirection === null) {
57
- this.currentDirection = Z(f), this.currentDirection !== null && v && v(this.currentDirection);
58
- return;
59
- }
60
- this.updateAxis("x", l.point, f), this.updateAxis("y", l.point, f), this.visualElement.render(), E && C.update(() => E(r, l), !1, !0);
61
- }, u = (r, l) => {
62
- this.latestPointerEvent = r, this.latestPanInfo = l, this.stop(r, l), this.latestPointerEvent = null, this.latestPanInfo = null;
63
- }, c = () => {
64
- const { dragSnapToOrigin: r } = this.getProps();
65
- (r || this.constraints) && this.startAnimation({ x: 0, y: 0 });
66
- }, { dragSnapToOrigin: h } = this.getProps();
67
- this.panSession = new T(t, {
68
- onSessionStart: e,
69
- onStart: o,
70
- onMove: a,
71
- onSessionEnd: u,
72
- resumeAnimation: c
73
- }, {
74
- transformPagePoint: this.visualElement.getTransformPagePoint(),
75
- dragSnapToOrigin: h,
76
- distanceThreshold: n,
77
- contextWindow: j(this.visualElement),
78
- element: this.visualElement.current
79
- });
80
- }
81
- /**
82
- * @internal
83
- */
84
- stop(t, s) {
85
- const n = t || this.latestPointerEvent, i = s || this.latestPanInfo, e = this.isDragging;
86
- if (this.cancel(), !e || !i || !n)
87
- return;
88
- const { velocity: o } = i;
89
- this.startAnimation(o);
90
- const { onDragEnd: a } = this.getProps();
91
- a && C.postRender(() => a(n, i));
92
- }
93
- /**
94
- * @internal
95
- */
96
- cancel() {
97
- this.isDragging = !1;
98
- const { projection: t, animationState: s } = this.visualElement;
99
- t && (t.isAnimationBlocked = !1), this.endPanSession();
100
- const { dragPropagation: n } = this.getProps();
101
- !n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), s && s.setActive("whileDrag", !1);
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
- }
112
- updateAxis(t, s, n) {
113
- const { drag: i } = this.getProps();
114
- if (!n || !A(t, i, this.currentDirection))
115
- return;
116
- const e = this.getAxisMotionValue(t);
117
- let o = this.originPoint[t] + n[t];
118
- this.constraints && this.constraints[t] && (o = b(o, this.constraints[t], this.elastic[t])), e.set(o);
119
- }
120
- resolveConstraints() {
121
- const { dragConstraints: t, dragElastic: s } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, i = this.constraints;
122
- t && P(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && n ? this.constraints = I(n.layoutBox, t) : this.constraints = !1, this.elastic = w(s), i !== this.constraints && !P(t) && n && this.constraints && !this.hasMutatedConstraints && p((e) => {
123
- this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = W(n.layoutBox[e], this.constraints[e]));
124
- });
125
- }
126
- resolveRefConstraints() {
127
- const { dragConstraints: t, onMeasureDragConstraints: s } = this.getProps();
128
- if (!t || !P(t))
129
- return !1;
130
- const n = t.current;
131
- U(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
- const { projection: i } = this.visualElement;
133
- if (!i || !i.layout)
134
- return !1;
135
- i.root && (i.root.scroll = void 0, i.root.updateScroll());
136
- const e = _(n, i.root, this.visualElement.getTransformPagePoint());
137
- let o = R(i.layout.layoutBox, e);
138
- if (s) {
139
- const a = s(K(o));
140
- this.hasMutatedConstraints = !!a, a && (o = N(a));
141
- }
142
- return o;
143
- }
144
- startAnimation(t) {
145
- const { drag: s, dragMomentum: n, dragElastic: i, dragTransition: e, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), u = this.constraints || {}, c = p((h) => {
146
- if (!A(h, s, this.currentDirection))
147
- return;
148
- let r = u && u[h] || {};
149
- (o === !0 || o === h) && (r = { min: 0, max: 0 });
150
- const l = i ? 200 : 1e6, g = i ? 40 : 1e7, d = {
151
- type: "inertia",
152
- velocity: n ? t[h] : 0,
153
- bounceStiffness: l,
154
- bounceDamping: g,
155
- timeConstant: 750,
156
- restDelta: 1,
157
- restSpeed: 10,
158
- ...e,
159
- ...r
160
- };
161
- return this.startAxisValueAnimation(h, d);
162
- });
163
- return Promise.all(c).then(a);
164
- }
165
- startAxisValueAnimation(t, s) {
166
- const n = this.getAxisMotionValue(t);
167
- return L(this.visualElement, t), n.start($(t, n, 0, s, this.visualElement, !1));
168
- }
169
- stopAnimation() {
170
- p((t) => this.getAxisMotionValue(t).stop());
171
- }
172
- /**
173
- * Drag works differently depending on which props are provided.
174
- *
175
- * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
176
- * - Otherwise, we apply the delta to the x/y motion values.
177
- */
178
- getAxisMotionValue(t) {
179
- const s = `_drag${t.toUpperCase()}`, i = this.visualElement.getProps()[s];
180
- return i || this.visualElement.getValue(t, this.visualElement.latestValues[t] ?? 0);
181
- }
182
- snapToCursor(t) {
183
- p((s) => {
184
- const { drag: n } = this.getProps();
185
- if (!A(s, n, this.currentDirection))
186
- return;
187
- const { projection: i } = this.visualElement, e = this.getAxisMotionValue(s);
188
- if (i && i.layout) {
189
- const { min: o, max: a } = i.layout.layoutBox[s], u = e.get() || 0;
190
- e.set(t[s] - M(o, a, 0.5) + u);
191
- }
192
- });
193
- }
194
- /**
195
- * When the viewport resizes we want to check if the measured constraints
196
- * have changed and, if so, reposition the element within those new constraints
197
- * relative to where it was before the resize.
198
- */
199
- scalePositionWithinConstraints() {
200
- if (!this.visualElement.current)
201
- return;
202
- const { drag: t, dragConstraints: s } = this.getProps(), { projection: n } = this.visualElement;
203
- if (!P(s) || !n || !this.constraints)
204
- return;
205
- this.stopAnimation();
206
- const i = { x: 0, y: 0 };
207
- p((o) => {
208
- const a = this.getAxisMotionValue(o);
209
- if (a && this.constraints !== !1) {
210
- const u = a.get();
211
- i[o] = z({ min: u, max: u }, this.constraints[o]);
212
- }
213
- });
214
- const { transformTemplate: e } = this.visualElement.getProps();
215
- this.visualElement.current.style.transform = e ? e({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.constraints = !1, this.resolveConstraints(), p((o) => {
216
- if (!A(o, t, null))
217
- return;
218
- const a = this.getAxisMotionValue(o), { min: u, max: c } = this.constraints[o];
219
- a.set(M(u, c, i[o]));
220
- }), this.visualElement.render();
221
- }
222
- addListeners() {
223
- if (!this.visualElement.current)
224
- return;
225
- X.set(this.visualElement, this);
226
- const t = this.visualElement.current, s = k(t, "pointerdown", (c) => {
227
- const { drag: h, dragListener: r = !0 } = this.getProps(), l = c.target, g = l !== t && Q(l);
228
- h && r && !g && this.start(c);
229
- });
230
- let n;
231
- const i = () => {
232
- const { dragConstraints: c } = this.getProps();
233
- P(c) && c.current && (this.constraints = this.resolveRefConstraints(), n || (n = Y(t, c.current, () => this.scalePositionWithinConstraints())));
234
- }, { projection: e } = this.visualElement, o = e.addEventListener("measure", i);
235
- e && !e.layout && (e.root && e.root.updateScroll(), e.updateLayout()), C.read(i);
236
- const a = q(window, "resize", () => this.scalePositionWithinConstraints()), u = e.addEventListener("didUpdate", (({ delta: c, hasLayoutChanged: h }) => {
237
- this.isDragging && h && (p((r) => {
238
- const l = this.getAxisMotionValue(r);
239
- l && (this.originPoint[r] += c[r].translate, l.set(l.get() + c[r].translate));
240
- }), this.visualElement.render());
241
- }));
242
- return () => {
243
- a(), s(), o(), u && u(), n && n();
244
- };
245
- }
246
- getProps() {
247
- const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: e = !1, dragElastic: o = O, dragMomentum: a = !0 } = t;
248
- return {
249
- ...t,
250
- drag: s,
251
- dragDirectionLock: n,
252
- dragPropagation: i,
253
- dragConstraints: e,
254
- dragElastic: o,
255
- dragMomentum: a
256
- };
257
- }
258
- }
259
- function S(m) {
260
- let t = !0;
261
- return () => {
262
- if (t) {
263
- t = !1;
264
- return;
265
- }
266
- m();
267
- };
1
+ import { invariant } from "../../../../../motion-utils/dist/es/errors.js";
2
+ import { frame } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
3
+ import { percent } from "../../../../../motion-dom/dist/es/value/types/numbers/units.js";
4
+ import { mixNumber } from "../../../../../motion-dom/dist/es/utils/mix/number.js";
5
+ import { animateMotionValue } from "../../../../../motion-dom/dist/es/animation/interfaces/motion-value.js";
6
+ import { addValueToWillChange } from "../../../../../motion-dom/dist/es/value/will-change/add-will-change.js";
7
+ import { setDragLock } from "../../../../../motion-dom/dist/es/gestures/drag/state/set-active.js";
8
+ import { isElementTextInput } from "../../../../../motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js";
9
+ import { resize } from "../../../../../motion-dom/dist/es/resize/index.js";
10
+ import { createBox } from "../../../../../motion-dom/dist/es/projection/geometry/models.js";
11
+ import { convertBoundingBoxToBox, convertBoxToBoundingBox } from "../../../../../motion-dom/dist/es/projection/geometry/conversion.js";
12
+ import { measurePageBox } from "../../../../../motion-dom/dist/es/projection/utils/measure.js";
13
+ import { calcLength } from "../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
14
+ import { eachAxis } from "../../../../../motion-dom/dist/es/projection/utils/each-axis.js";
15
+ import { addDomEvent } from "../../../../../motion-dom/dist/es/events/add-dom-event.js";
16
+ import { isRefObject } from "../../utils/is-ref-object.js";
17
+ import { extractEventInfo } from "../../events/event-info.js";
18
+ import { addPointerEvent } from "../../events/add-pointer-event.js";
19
+ import { getContextWindow } from "../../utils/get-context-window.js";
20
+ import { PanSession } from "../pan/PanSession.js";
21
+ import { applyConstraints, calcOrigin, calcRelativeConstraints, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, resolveDragElastic } from "./utils/constraints.js";
22
+ var elementDragControls = /* @__PURE__ */ new WeakMap(), VisualElementDragControls = class {
23
+ constructor(i) {
24
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = {
25
+ x: 0,
26
+ y: 0
27
+ }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = createBox(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = i;
28
+ }
29
+ start(i, { snapToCursor: C = !1, distanceThreshold: w } = {}) {
30
+ let { presenceContext: D } = this.visualElement;
31
+ if (D && D.isPresent === !1) return;
32
+ let O = (i) => {
33
+ C && this.snapToCursor(extractEventInfo(i).point), this.stopAnimation();
34
+ }, k = (i, C) => {
35
+ let { drag: w, dragPropagation: D, onDragStart: O } = this.getProps();
36
+ if (w && !D && (this.openDragLock && this.openDragLock(), this.openDragLock = setDragLock(w), !this.openDragLock)) return;
37
+ this.latestPointerEvent = i, 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), eachAxis((i) => {
38
+ let x = this.getAxisMotionValue(i).get() || 0;
39
+ if (percent.test(x)) {
40
+ let { projection: S } = this.visualElement;
41
+ if (S && S.layout) {
42
+ let C = S.layout.layoutBox[i];
43
+ C && (x = calcLength(C) * (parseFloat(x) / 100));
44
+ }
45
+ }
46
+ this.originPoint[i] = x;
47
+ }), O && frame.update(() => O(i, C), !1, !0), addValueToWillChange(this.visualElement, "transform");
48
+ let { animationState: k } = this.visualElement;
49
+ k && k.setActive("whileDrag", !0);
50
+ }, A = (i, S) => {
51
+ this.latestPointerEvent = i, this.latestPanInfo = S;
52
+ let { dragPropagation: C, dragDirectionLock: w, onDirectionLock: T, onDrag: E } = this.getProps();
53
+ if (!C && !this.openDragLock) return;
54
+ let { offset: D } = S;
55
+ if (w && this.currentDirection === null) {
56
+ this.currentDirection = getCurrentDirection(D), this.currentDirection !== null && T && T(this.currentDirection);
57
+ return;
58
+ }
59
+ this.updateAxis("x", S.point, D), this.updateAxis("y", S.point, D), this.visualElement.render(), E && frame.update(() => E(i, S), !1, !0);
60
+ }, j = (i, x) => {
61
+ this.latestPointerEvent = i, this.latestPanInfo = x, this.stop(i, x), this.latestPointerEvent = null, this.latestPanInfo = null;
62
+ }, M = () => {
63
+ let { dragSnapToOrigin: i } = this.getProps();
64
+ (i || this.constraints) && this.startAnimation({
65
+ x: 0,
66
+ y: 0
67
+ });
68
+ }, { dragSnapToOrigin: N } = this.getProps();
69
+ this.panSession = new PanSession(i, {
70
+ onSessionStart: O,
71
+ onStart: k,
72
+ onMove: A,
73
+ onSessionEnd: j,
74
+ resumeAnimation: M
75
+ }, {
76
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
77
+ dragSnapToOrigin: N,
78
+ distanceThreshold: w,
79
+ contextWindow: getContextWindow(this.visualElement),
80
+ element: this.visualElement.current
81
+ });
82
+ }
83
+ stop(i, S) {
84
+ let C = i || this.latestPointerEvent, w = S || this.latestPanInfo, T = this.isDragging;
85
+ if (this.cancel(), !T || !w || !C) return;
86
+ let { velocity: E } = w;
87
+ this.startAnimation(E);
88
+ let { onDragEnd: D } = this.getProps();
89
+ D && frame.postRender(() => D(C, w));
90
+ }
91
+ cancel() {
92
+ this.isDragging = !1;
93
+ let { projection: i, animationState: x } = this.visualElement;
94
+ i && (i.isAnimationBlocked = !1), this.endPanSession();
95
+ let { dragPropagation: S } = this.getProps();
96
+ !S && this.openDragLock && (this.openDragLock(), this.openDragLock = null), x && x.setActive("whileDrag", !1);
97
+ }
98
+ endPanSession() {
99
+ this.panSession && this.panSession.end(), this.panSession = void 0;
100
+ }
101
+ updateAxis(i, x, S) {
102
+ let { drag: C } = this.getProps();
103
+ if (!S || !shouldDrag(i, C, this.currentDirection)) return;
104
+ let w = this.getAxisMotionValue(i), T = this.originPoint[i] + S[i];
105
+ this.constraints && this.constraints[i] && (T = applyConstraints(T, this.constraints[i], this.elastic[i])), w.set(T);
106
+ }
107
+ resolveConstraints() {
108
+ let { dragConstraints: i, dragElastic: x } = this.getProps(), S = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, C = this.constraints;
109
+ i && isRefObject(i) ? this.constraints ||= this.resolveRefConstraints() : i && S ? this.constraints = calcRelativeConstraints(S.layoutBox, i) : this.constraints = !1, this.elastic = resolveDragElastic(x), C !== this.constraints && !isRefObject(i) && S && this.constraints && !this.hasMutatedConstraints && eachAxis((i) => {
110
+ this.constraints !== !1 && this.getAxisMotionValue(i) && (this.constraints[i] = rebaseAxisConstraints(S.layoutBox[i], this.constraints[i]));
111
+ });
112
+ }
113
+ resolveRefConstraints() {
114
+ let { dragConstraints: x, onMeasureDragConstraints: S } = this.getProps();
115
+ if (!x || !isRefObject(x)) return !1;
116
+ let C = x.current;
117
+ invariant(C !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
118
+ let { projection: w } = this.visualElement;
119
+ if (!w || !w.layout) return !1;
120
+ w.root && (w.root.scroll = void 0, w.root.updateScroll());
121
+ let T = measurePageBox(C, w.root, this.visualElement.getTransformPagePoint()), E = calcViewportConstraints(w.layout.layoutBox, T);
122
+ if (S) {
123
+ let i = S(convertBoxToBoundingBox(E));
124
+ this.hasMutatedConstraints = !!i, i && (E = convertBoundingBoxToBox(i));
125
+ }
126
+ return E;
127
+ }
128
+ startAnimation(i) {
129
+ let { drag: x, dragMomentum: S, dragElastic: C, dragTransition: w, dragSnapToOrigin: T, onDragTransitionEnd: E } = this.getProps(), D = this.constraints || {}, O = eachAxis((E) => {
130
+ if (!shouldDrag(E, x, this.currentDirection)) return;
131
+ let O = D && D[E] || {};
132
+ (T === !0 || T === E) && (O = {
133
+ min: 0,
134
+ max: 0
135
+ });
136
+ let k = C ? 200 : 1e6, A = C ? 40 : 1e7, j = {
137
+ type: "inertia",
138
+ velocity: S ? i[E] : 0,
139
+ bounceStiffness: k,
140
+ bounceDamping: A,
141
+ timeConstant: 750,
142
+ restDelta: 1,
143
+ restSpeed: 10,
144
+ ...w,
145
+ ...O
146
+ };
147
+ return this.startAxisValueAnimation(E, j);
148
+ });
149
+ return Promise.all(O).then(E);
150
+ }
151
+ startAxisValueAnimation(i, x) {
152
+ let S = this.getAxisMotionValue(i);
153
+ return addValueToWillChange(this.visualElement, i), S.start(animateMotionValue(i, S, 0, x, this.visualElement, !1));
154
+ }
155
+ stopAnimation() {
156
+ eachAxis((i) => this.getAxisMotionValue(i).stop());
157
+ }
158
+ getAxisMotionValue(i) {
159
+ let x = `_drag${i.toUpperCase()}`;
160
+ return this.visualElement.getProps()[x] || this.visualElement.getValue(i, this.visualElement.latestValues[i] ?? 0);
161
+ }
162
+ snapToCursor(i) {
163
+ eachAxis((x) => {
164
+ let { drag: S } = this.getProps();
165
+ if (!shouldDrag(x, S, this.currentDirection)) return;
166
+ let { projection: w } = this.visualElement, T = this.getAxisMotionValue(x);
167
+ if (w && w.layout) {
168
+ let { min: S, max: E } = w.layout.layoutBox[x], D = T.get() || 0;
169
+ T.set(i[x] - mixNumber(S, E, .5) + D);
170
+ }
171
+ });
172
+ }
173
+ scalePositionWithinConstraints() {
174
+ if (!this.visualElement.current) return;
175
+ let { drag: i, dragConstraints: x } = this.getProps(), { projection: S } = this.visualElement;
176
+ if (!isRefObject(x) || !S || !this.constraints) return;
177
+ this.stopAnimation();
178
+ let w = {
179
+ x: 0,
180
+ y: 0
181
+ };
182
+ eachAxis((i) => {
183
+ let x = this.getAxisMotionValue(i);
184
+ if (x && this.constraints !== !1) {
185
+ let S = x.get();
186
+ w[i] = calcOrigin({
187
+ min: S,
188
+ max: S
189
+ }, this.constraints[i]);
190
+ }
191
+ });
192
+ let { transformTemplate: T } = this.visualElement.getProps();
193
+ this.visualElement.current.style.transform = T ? T({}, "") : "none", S.root && S.root.updateScroll(), S.updateLayout(), this.constraints = !1, this.resolveConstraints(), eachAxis((x) => {
194
+ if (!shouldDrag(x, i, null)) return;
195
+ let S = this.getAxisMotionValue(x), { min: T, max: E } = this.constraints[x];
196
+ S.set(mixNumber(T, E, w[x]));
197
+ }), this.visualElement.render();
198
+ }
199
+ addListeners() {
200
+ if (!this.visualElement.current) return;
201
+ elementDragControls.set(this.visualElement, this);
202
+ let i = this.visualElement.current, S = addPointerEvent(i, "pointerdown", (x) => {
203
+ let { drag: S, dragListener: C = !0 } = this.getProps(), w = x.target, T = w !== i && isElementTextInput(w);
204
+ S && C && !T && this.start(x);
205
+ }), C, w = () => {
206
+ let { dragConstraints: x } = this.getProps();
207
+ isRefObject(x) && x.current && (this.constraints = this.resolveRefConstraints(), C ||= startResizeObservers(i, x.current, () => this.scalePositionWithinConstraints()));
208
+ }, { projection: T } = this.visualElement, E = T.addEventListener("measure", w);
209
+ T && !T.layout && (T.root && T.root.updateScroll(), T.updateLayout()), frame.read(w);
210
+ let O = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()), k = T.addEventListener("didUpdate", (({ delta: i, hasLayoutChanged: x }) => {
211
+ this.isDragging && x && (eachAxis((x) => {
212
+ let S = this.getAxisMotionValue(x);
213
+ S && (this.originPoint[x] += i[x].translate, S.set(S.get() + i[x].translate));
214
+ }), this.visualElement.render());
215
+ }));
216
+ return () => {
217
+ O(), S(), E(), k && k(), C && C();
218
+ };
219
+ }
220
+ getProps() {
221
+ let i = this.visualElement.getProps(), { drag: x = !1, dragDirectionLock: S = !1, dragPropagation: C = !1, dragConstraints: w = !1, dragElastic: T = defaultElastic, dragMomentum: E = !0 } = i;
222
+ return {
223
+ ...i,
224
+ drag: x,
225
+ dragDirectionLock: S,
226
+ dragPropagation: C,
227
+ dragConstraints: w,
228
+ dragElastic: T,
229
+ dragMomentum: E
230
+ };
231
+ }
232
+ };
233
+ function skipFirstCall(i) {
234
+ let x = !0;
235
+ return () => {
236
+ if (x) {
237
+ x = !1;
238
+ return;
239
+ }
240
+ i();
241
+ };
268
242
  }
269
- function Y(m, t, s) {
270
- const n = V(m, S(s)), i = V(t, S(s));
271
- return () => {
272
- n(), i();
273
- };
243
+ function startResizeObservers(i, x, S) {
244
+ let C = resize(i, skipFirstCall(S)), w = resize(x, skipFirstCall(S));
245
+ return () => {
246
+ C(), w();
247
+ };
274
248
  }
275
- function A(m, t, s) {
276
- return (t === !0 || t === m) && (s === null || s === m);
249
+ function shouldDrag(i, x, S) {
250
+ return (x === !0 || x === i) && (S === null || S === i);
277
251
  }
278
- function Z(m, t = 10) {
279
- let s = null;
280
- return Math.abs(m.y) > t ? s = "y" : Math.abs(m.x) > t && (s = "x"), s;
252
+ function getCurrentDirection(i, x = 10) {
253
+ let S = null;
254
+ return Math.abs(i.y) > x ? S = "y" : Math.abs(i.x) > x && (S = "x"), S;
281
255
  }
282
- export {
283
- At as VisualElementDragControls,
284
- X as elementDragControls
285
- };
256
+ export { VisualElementDragControls };
@@ -1,22 +1,20 @@
1
- import { VisualElementDragControls as t } from "./VisualElementDragControls.js";
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
- constructor(o) {
6
- super(o), this.removeGroupControls = s, this.removeListeners = s, this.controls = new t(o);
7
- }
8
- mount() {
9
- const { dragControls: o } = this.node.getProps();
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)));
15
- }
16
- unmount() {
17
- this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
18
- }
19
- }
20
- export {
21
- m as DragGesture
1
+ import { noop } from "../../../../../motion-utils/dist/es/noop.js";
2
+ import { Feature } from "../../../../../motion-dom/dist/es/render/Feature.js";
3
+ import { VisualElementDragControls } from "./VisualElementDragControls.js";
4
+ var DragGesture = class extends Feature {
5
+ constructor(r) {
6
+ super(r), this.removeGroupControls = noop, this.removeListeners = noop, this.controls = new VisualElementDragControls(r);
7
+ }
8
+ mount() {
9
+ let { dragControls: r } = this.node.getProps();
10
+ r && (this.removeGroupControls = r.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || noop;
11
+ }
12
+ update() {
13
+ let { dragControls: e } = this.node.getProps(), { dragControls: r } = this.node.prevProps || {};
14
+ e !== r && (this.removeGroupControls(), e && (this.removeGroupControls = e.subscribe(this.controls)));
15
+ }
16
+ unmount() {
17
+ this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
18
+ }
22
19
  };
20
+ export { DragGesture };