motion-dom 12.34.2 → 12.34.5

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 (233) hide show
  1. package/dist/cjs/index.js +60 -92
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/animation/AsyncMotionValueAnimation.mjs.map +1 -1
  4. package/dist/es/animation/GroupAnimation.mjs.map +1 -1
  5. package/dist/es/animation/GroupAnimationWithThen.mjs.map +1 -1
  6. package/dist/es/animation/JSAnimation.mjs.map +1 -1
  7. package/dist/es/animation/NativeAnimation.mjs +8 -7
  8. package/dist/es/animation/NativeAnimation.mjs.map +1 -1
  9. package/dist/es/animation/NativeAnimationExtended.mjs.map +1 -1
  10. package/dist/es/animation/NativeAnimationWrapper.mjs.map +1 -1
  11. package/dist/es/animation/animate/single-value.mjs.map +1 -1
  12. package/dist/es/animation/drivers/frame.mjs +1 -1
  13. package/dist/es/animation/drivers/frame.mjs.map +1 -1
  14. package/dist/es/animation/generators/inertia.mjs.map +1 -1
  15. package/dist/es/animation/generators/keyframes.mjs.map +1 -1
  16. package/dist/es/animation/generators/spring/defaults.mjs.map +1 -1
  17. package/dist/es/animation/generators/spring/find.mjs.map +1 -1
  18. package/dist/es/animation/generators/spring/index.mjs +7 -2
  19. package/dist/es/animation/generators/spring/index.mjs.map +1 -1
  20. package/dist/es/animation/generators/utils/calc-duration.mjs.map +1 -1
  21. package/dist/es/animation/generators/utils/create-generator-easing.mjs.map +1 -1
  22. package/dist/es/animation/generators/utils/is-generator.mjs.map +1 -1
  23. package/dist/es/animation/generators/utils/velocity.mjs.map +1 -1
  24. package/dist/es/animation/interfaces/motion-value.mjs.map +1 -1
  25. package/dist/es/animation/interfaces/visual-element-target.mjs.map +1 -1
  26. package/dist/es/animation/interfaces/visual-element-variant.mjs.map +1 -1
  27. package/dist/es/animation/interfaces/visual-element.mjs.map +1 -1
  28. package/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.map +1 -1
  29. package/dist/es/animation/keyframes/KeyframesResolver.mjs.map +1 -1
  30. package/dist/es/animation/keyframes/get-final.mjs.map +1 -1
  31. package/dist/es/animation/keyframes/offsets/default.mjs.map +1 -1
  32. package/dist/es/animation/keyframes/offsets/fill.mjs.map +1 -1
  33. package/dist/es/animation/keyframes/offsets/time.mjs.map +1 -1
  34. package/dist/es/animation/keyframes/utils/apply-px-defaults.mjs.map +1 -1
  35. package/dist/es/animation/keyframes/utils/fill-wildcards.mjs.map +1 -1
  36. package/dist/es/animation/keyframes/utils/is-none.mjs.map +1 -1
  37. package/dist/es/animation/keyframes/utils/make-none-animatable.mjs.map +1 -1
  38. package/dist/es/animation/keyframes/utils/unit-conversion.mjs.map +1 -1
  39. package/dist/es/animation/optimized-appear/data-id.mjs.map +1 -1
  40. package/dist/es/animation/optimized-appear/get-appear-id.mjs.map +1 -1
  41. package/dist/es/animation/utils/WithPromise.mjs.map +1 -1
  42. package/dist/es/animation/utils/active-animations.mjs.map +1 -1
  43. package/dist/es/animation/utils/calc-child-stagger.mjs.map +1 -1
  44. package/dist/es/animation/utils/can-animate.mjs.map +1 -1
  45. package/dist/es/animation/utils/css-variables-conversion.mjs.map +1 -1
  46. package/dist/es/animation/utils/default-transitions.mjs.map +1 -1
  47. package/dist/es/animation/utils/get-final-keyframe.mjs.map +1 -1
  48. package/dist/es/animation/utils/get-value-transition.mjs.map +1 -1
  49. package/dist/es/animation/utils/is-animatable.mjs.map +1 -1
  50. package/dist/es/animation/utils/is-css-variable.mjs.map +1 -1
  51. package/dist/es/animation/utils/is-transition-defined.mjs.map +1 -1
  52. package/dist/es/animation/utils/make-animation-instant.mjs.map +1 -1
  53. package/dist/es/animation/utils/replace-transition-type.mjs.map +1 -1
  54. package/dist/es/animation/utils/resolve-transition.mjs.map +1 -1
  55. package/dist/es/animation/waapi/easing/cubic-bezier.mjs.map +1 -1
  56. package/dist/es/animation/waapi/easing/is-supported.mjs.map +1 -1
  57. package/dist/es/animation/waapi/easing/map-easing.mjs.map +1 -1
  58. package/dist/es/animation/waapi/easing/supported.mjs.map +1 -1
  59. package/dist/es/animation/waapi/start-waapi-animation.mjs.map +1 -1
  60. package/dist/es/animation/waapi/supports/partial-keyframes.mjs.map +1 -1
  61. package/dist/es/animation/waapi/supports/waapi.mjs.map +1 -1
  62. package/dist/es/animation/waapi/utils/accelerated-values.mjs.map +1 -1
  63. package/dist/es/animation/waapi/utils/apply-generator.mjs.map +1 -1
  64. package/dist/es/animation/waapi/utils/linear.mjs.map +1 -1
  65. package/dist/es/animation/waapi/utils/px-values.mjs.map +1 -1
  66. package/dist/es/animation/waapi/utils/unsupported-easing.mjs +1 -1
  67. package/dist/es/animation/waapi/utils/unsupported-easing.mjs.map +1 -1
  68. package/dist/es/effects/MotionValueState.mjs.map +1 -1
  69. package/dist/es/effects/attr/index.mjs.map +1 -1
  70. package/dist/es/effects/prop/index.mjs.map +1 -1
  71. package/dist/es/effects/style/index.mjs.map +1 -1
  72. package/dist/es/effects/style/transform.mjs.map +1 -1
  73. package/dist/es/effects/svg/index.mjs.map +1 -1
  74. package/dist/es/effects/utils/create-dom-effect.mjs.map +1 -1
  75. package/dist/es/effects/utils/create-effect.mjs.map +1 -1
  76. package/dist/es/events/add-dom-event.mjs.map +1 -1
  77. package/dist/es/frameloop/batcher.mjs.map +1 -1
  78. package/dist/es/frameloop/frame.mjs.map +1 -1
  79. package/dist/es/frameloop/index-legacy.mjs.map +1 -1
  80. package/dist/es/frameloop/microtask.mjs.map +1 -1
  81. package/dist/es/frameloop/order.mjs.map +1 -1
  82. package/dist/es/frameloop/render-step.mjs.map +1 -1
  83. package/dist/es/frameloop/sync-time.mjs.map +1 -1
  84. package/dist/es/gestures/drag/state/is-active.mjs.map +1 -1
  85. package/dist/es/gestures/drag/state/set-active.mjs.map +1 -1
  86. package/dist/es/gestures/hover.mjs.map +1 -1
  87. package/dist/es/gestures/press/index.mjs.map +1 -1
  88. package/dist/es/gestures/press/utils/is-keyboard-accessible.mjs.map +1 -1
  89. package/dist/es/gestures/press/utils/keyboard.mjs.map +1 -1
  90. package/dist/es/gestures/press/utils/state.mjs.map +1 -1
  91. package/dist/es/gestures/utils/is-node-or-child.mjs.map +1 -1
  92. package/dist/es/gestures/utils/is-primary-pointer.mjs.map +1 -1
  93. package/dist/es/gestures/utils/setup.mjs.map +1 -1
  94. package/dist/es/index.mjs +1 -1
  95. package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
  96. package/dist/es/projection/animation/mix-values.mjs.map +1 -1
  97. package/dist/es/projection/geometry/conversion.mjs.map +1 -1
  98. package/dist/es/projection/geometry/copy.mjs.map +1 -1
  99. package/dist/es/projection/geometry/delta-apply.mjs.map +1 -1
  100. package/dist/es/projection/geometry/delta-calc.mjs.map +1 -1
  101. package/dist/es/projection/geometry/delta-remove.mjs.map +1 -1
  102. package/dist/es/projection/geometry/models.mjs.map +1 -1
  103. package/dist/es/projection/geometry/utils.mjs.map +1 -1
  104. package/dist/es/projection/node/HTMLProjectionNode.mjs.map +1 -1
  105. package/dist/es/projection/node/create-projection-node.mjs +1 -1
  106. package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
  107. package/dist/es/projection/node/group.mjs.map +1 -1
  108. package/dist/es/projection/node/state.mjs.map +1 -1
  109. package/dist/es/projection/shared/stack.mjs +32 -75
  110. package/dist/es/projection/shared/stack.mjs.map +1 -1
  111. package/dist/es/projection/styles/scale-border-radius.mjs.map +1 -1
  112. package/dist/es/projection/styles/scale-box-shadow.mjs.map +1 -1
  113. package/dist/es/projection/styles/scale-correction.mjs.map +1 -1
  114. package/dist/es/projection/styles/transform.mjs.map +1 -1
  115. package/dist/es/projection/utils/compare-by-depth.mjs.map +1 -1
  116. package/dist/es/projection/utils/each-axis.mjs.map +1 -1
  117. package/dist/es/projection/utils/flat-tree.mjs.map +1 -1
  118. package/dist/es/projection/utils/has-transform.mjs.map +1 -1
  119. package/dist/es/projection/utils/measure.mjs.map +1 -1
  120. package/dist/es/render/Feature.mjs.map +1 -1
  121. package/dist/es/render/VisualElement.mjs.map +1 -1
  122. package/dist/es/render/dom/DOMVisualElement.mjs.map +1 -1
  123. package/dist/es/render/dom/parse-transform.mjs.map +1 -1
  124. package/dist/es/render/dom/style-computed.mjs.map +1 -1
  125. package/dist/es/render/dom/style-set.mjs.map +1 -1
  126. package/dist/es/render/dom/utils/camel-to-dash.mjs.map +1 -1
  127. package/dist/es/render/html/HTMLVisualElement.mjs.map +1 -1
  128. package/dist/es/render/html/utils/build-styles.mjs.map +1 -1
  129. package/dist/es/render/html/utils/build-transform.mjs.map +1 -1
  130. package/dist/es/render/html/utils/render.mjs.map +1 -1
  131. package/dist/es/render/html/utils/scrape-motion-values.mjs.map +1 -1
  132. package/dist/es/render/object/ObjectVisualElement.mjs.map +1 -1
  133. package/dist/es/render/store.mjs.map +1 -1
  134. package/dist/es/render/svg/SVGVisualElement.mjs.map +1 -1
  135. package/dist/es/render/svg/utils/build-attrs.mjs.map +1 -1
  136. package/dist/es/render/svg/utils/camel-case-attrs.mjs.map +1 -1
  137. package/dist/es/render/svg/utils/path.mjs.map +1 -1
  138. package/dist/es/render/svg/utils/render.mjs.map +1 -1
  139. package/dist/es/render/svg/utils/scrape-motion-values.mjs.map +1 -1
  140. package/dist/es/render/utils/animation-state.mjs +14 -9
  141. package/dist/es/render/utils/animation-state.mjs.map +1 -1
  142. package/dist/es/render/utils/get-variant-context.mjs.map +1 -1
  143. package/dist/es/render/utils/is-animation-controls.mjs.map +1 -1
  144. package/dist/es/render/utils/is-controlling-variants.mjs.map +1 -1
  145. package/dist/es/render/utils/is-forced-motion-value.mjs.map +1 -1
  146. package/dist/es/render/utils/is-keyframes-target.mjs.map +1 -1
  147. package/dist/es/render/utils/is-variant-label.mjs.map +1 -1
  148. package/dist/es/render/utils/keys-position.mjs.map +1 -1
  149. package/dist/es/render/utils/keys-transform.mjs.map +1 -1
  150. package/dist/es/render/utils/motion-values.mjs.map +1 -1
  151. package/dist/es/render/utils/reduced-motion/index.mjs.map +1 -1
  152. package/dist/es/render/utils/reduced-motion/state.mjs.map +1 -1
  153. package/dist/es/render/utils/resolve-dynamic-variants.mjs.map +1 -1
  154. package/dist/es/render/utils/resolve-variants.mjs.map +1 -1
  155. package/dist/es/render/utils/setters.mjs.map +1 -1
  156. package/dist/es/render/utils/shallow-compare.mjs.map +1 -1
  157. package/dist/es/render/utils/variant-props.mjs.map +1 -1
  158. package/dist/es/resize/handle-element.mjs.map +1 -1
  159. package/dist/es/resize/handle-window.mjs.map +1 -1
  160. package/dist/es/resize/index.mjs.map +1 -1
  161. package/dist/es/scroll/observe.mjs.map +1 -1
  162. package/dist/es/stats/animation-count.mjs.map +1 -1
  163. package/dist/es/stats/buffer.mjs.map +1 -1
  164. package/dist/es/stats/index.mjs.map +1 -1
  165. package/dist/es/utils/delay.mjs.map +1 -1
  166. package/dist/es/utils/interpolate.mjs.map +1 -1
  167. package/dist/es/utils/is-html-element.mjs.map +1 -1
  168. package/dist/es/utils/is-svg-element.mjs.map +1 -1
  169. package/dist/es/utils/is-svg-svg-element.mjs.map +1 -1
  170. package/dist/es/utils/mix/color.mjs.map +1 -1
  171. package/dist/es/utils/mix/complex.mjs.map +1 -1
  172. package/dist/es/utils/mix/immediate.mjs.map +1 -1
  173. package/dist/es/utils/mix/index.mjs.map +1 -1
  174. package/dist/es/utils/mix/number.mjs.map +1 -1
  175. package/dist/es/utils/mix/visibility.mjs.map +1 -1
  176. package/dist/es/utils/resolve-elements.mjs.map +1 -1
  177. package/dist/es/utils/stagger.mjs.map +1 -1
  178. package/dist/es/utils/supports/linear-easing.mjs.map +1 -1
  179. package/dist/es/utils/supports/memo.mjs.map +1 -1
  180. package/dist/es/utils/supports/scroll-timeline.mjs.map +1 -1
  181. package/dist/es/utils/transform.mjs.map +1 -1
  182. package/dist/es/value/follow-value.mjs.map +1 -1
  183. package/dist/es/value/index.mjs.map +1 -1
  184. package/dist/es/value/map-value.mjs.map +1 -1
  185. package/dist/es/value/spring-value.mjs +1 -1
  186. package/dist/es/value/spring-value.mjs.map +1 -1
  187. package/dist/es/value/subscribe-value.mjs.map +1 -1
  188. package/dist/es/value/transform-value.mjs.map +1 -1
  189. package/dist/es/value/types/auto.mjs.map +1 -1
  190. package/dist/es/value/types/color/hex.mjs.map +1 -1
  191. package/dist/es/value/types/color/hsla-to-rgba.mjs.map +1 -1
  192. package/dist/es/value/types/color/hsla.mjs +1 -1
  193. package/dist/es/value/types/color/hsla.mjs.map +1 -1
  194. package/dist/es/value/types/color/index.mjs.map +1 -1
  195. package/dist/es/value/types/color/rgba.mjs +1 -1
  196. package/dist/es/value/types/color/rgba.mjs.map +1 -1
  197. package/dist/es/value/types/color/utils.mjs.map +1 -1
  198. package/dist/es/value/types/complex/filter.mjs.map +1 -1
  199. package/dist/es/value/types/complex/index.mjs.map +1 -1
  200. package/dist/es/value/types/complex/mask.mjs.map +1 -1
  201. package/dist/es/value/types/dimensions.mjs.map +1 -1
  202. package/dist/es/value/types/int.mjs.map +1 -1
  203. package/dist/es/value/types/maps/defaults.mjs.map +1 -1
  204. package/dist/es/value/types/maps/number.mjs.map +1 -1
  205. package/dist/es/value/types/maps/transform.mjs +2 -2
  206. package/dist/es/value/types/maps/transform.mjs.map +1 -1
  207. package/dist/es/value/types/numbers/index.mjs.map +1 -1
  208. package/dist/es/value/types/numbers/units.mjs.map +1 -1
  209. package/dist/es/value/types/utils/animatable-none.mjs.map +1 -1
  210. package/dist/es/value/types/utils/find.mjs.map +1 -1
  211. package/dist/es/value/types/utils/get-as-type.mjs.map +1 -1
  212. package/dist/es/value/types/utils/is-nullish.mjs.map +1 -1
  213. package/dist/es/value/types/utils/sanitize.mjs.map +1 -1
  214. package/dist/es/value/utils/is-motion-value.mjs.map +1 -1
  215. package/dist/es/value/utils/resolve-motion-value.mjs.map +1 -1
  216. package/dist/es/value/will-change/add-will-change.mjs.map +1 -1
  217. package/dist/es/value/will-change/is.mjs.map +1 -1
  218. package/dist/es/view/index.mjs.map +1 -1
  219. package/dist/es/view/queue.mjs.map +1 -1
  220. package/dist/es/view/start.mjs.map +1 -1
  221. package/dist/es/view/utils/choose-layer-type.mjs.map +1 -1
  222. package/dist/es/view/utils/css.mjs.map +1 -1
  223. package/dist/es/view/utils/get-layer-info.mjs.map +1 -1
  224. package/dist/es/view/utils/get-view-animations.mjs.map +1 -1
  225. package/dist/es/view/utils/has-target.mjs.map +1 -1
  226. package/dist/index.d.ts +0 -4
  227. package/dist/motion-dom.dev.js +60 -92
  228. package/dist/motion-dom.js +1 -1
  229. package/dist/size-rollup-motion-value.js +1 -1
  230. package/dist/size-rollup-motion-value.js.map +1 -1
  231. package/dist/size-rollup-style-effect.js +1 -1
  232. package/dist/size-rollup-style-effect.js.map +1 -1
  233. package/package.json +2 -2
package/dist/es/index.mjs CHANGED
@@ -171,6 +171,6 @@ export { scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps } from '.
171
171
  export { LayoutAnimationBuilder, parseAnimateLayoutArgs } from './layout/LayoutAnimationBuilder.mjs';
172
172
  export { cancelSync, sync } from './frameloop/index-legacy.mjs';
173
173
  export { addScaleCorrector, scaleCorrectors } from './projection/styles/scale-correction.mjs';
174
- export { hasReducedMotionListener, prefersReducedMotion } from './render/utils/reduced-motion/state.mjs';
175
174
  export { cancelFrame, frame, frameData, frameSteps } from './frameloop/frame.mjs';
175
+ export { hasReducedMotionListener, prefersReducedMotion } from './render/utils/reduced-motion/state.mjs';
176
176
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutAnimationBuilder.mjs","sources":["../../../src/layout/LayoutAnimationBuilder.ts"],"sourcesContent":["import type { Box } from \"motion-utils\"\nimport { GroupAnimation } from \"../animation/GroupAnimation\"\nimport type {\n AnimationOptions,\n AnimationPlaybackControls,\n Transition,\n} from \"../animation/types\"\nimport { frame } from \"../frameloop\"\nimport { copyBoxInto } from \"../projection/geometry/copy\"\nimport { createBox } from \"../projection/geometry/models\"\nimport { HTMLProjectionNode } from \"../projection/node/HTMLProjectionNode\"\nimport type { IProjectionNode } from \"../projection/node/types\"\nimport { HTMLVisualElement } from \"../render/html/HTMLVisualElement\"\nimport { visualElementStore } from \"../render/store\"\nimport type { VisualElement } from \"../render/VisualElement\"\nimport { resolveElements, type ElementOrSelector } from \"../utils/resolve-elements\"\n\ntype LayoutAnimationScope = Element | Document\n\ninterface LayoutElementRecord {\n element: Element\n visualElement: VisualElement\n projection: IProjectionNode\n}\n\ninterface LayoutAttributes {\n layout?: boolean | \"position\" | \"size\" | \"preserve-aspect\"\n layoutId?: string\n}\n\ntype LayoutBuilderResolve = (animation: GroupAnimation) => void\ntype LayoutBuilderReject = (error: unknown) => void\n\ninterface ProjectionOptions {\n layout?: boolean | \"position\" | \"size\" | \"preserve-aspect\"\n layoutId?: string\n animationType?: \"size\" | \"position\" | \"both\" | \"preserve-aspect\"\n transition?: Transition\n crossfade?: boolean\n}\n\nconst layoutSelector = \"[data-layout], [data-layout-id]\"\nconst noop = () => {}\nfunction snapshotFromTarget(projection: IProjectionNode): LayoutElementRecord[\"projection\"][\"snapshot\"] {\n const target = projection.targetWithTransforms || projection.target\n if (!target) return undefined\n\n const measuredBox = createBox()\n const layoutBox = createBox()\n copyBoxInto(measuredBox, target as Box)\n copyBoxInto(layoutBox, target as Box)\n\n return {\n animationId: projection.root?.animationId ?? 0,\n measuredBox,\n layoutBox,\n latestValues: projection.animationValues || projection.latestValues || {},\n source: projection.id,\n }\n}\n\nexport class LayoutAnimationBuilder {\n private scope: LayoutAnimationScope\n private updateDom: () => void | Promise<void>\n private defaultOptions?: AnimationOptions\n private sharedTransitions = new Map<string, AnimationOptions>()\n private notifyReady: LayoutBuilderResolve = noop\n private rejectReady: LayoutBuilderReject = noop\n private readyPromise: Promise<GroupAnimation>\n\n constructor(\n scope: LayoutAnimationScope,\n updateDom: () => void | Promise<void>,\n defaultOptions?: AnimationOptions\n ) {\n this.scope = scope\n this.updateDom = updateDom\n this.defaultOptions = defaultOptions\n\n this.readyPromise = new Promise<GroupAnimation>((resolve, reject) => {\n this.notifyReady = resolve\n this.rejectReady = reject\n })\n\n frame.postRender(() => {\n this.start().then(this.notifyReady).catch(this.rejectReady)\n })\n }\n\n shared(id: string, transition: AnimationOptions): this {\n this.sharedTransitions.set(id, transition)\n return this\n }\n\n then(\n resolve: LayoutBuilderResolve,\n reject?: LayoutBuilderReject\n ): Promise<void> {\n return this.readyPromise.then(resolve, reject)\n }\n\n private async start(): Promise<GroupAnimation> {\n const beforeElements = collectLayoutElements(this.scope)\n const beforeRecords = this.buildRecords(beforeElements)\n\n beforeRecords.forEach(({ projection }) => {\n const hasCurrentAnimation = Boolean(projection.currentAnimation)\n const isSharedLayout = Boolean(projection.options.layoutId)\n if (hasCurrentAnimation && isSharedLayout) {\n const snapshot = snapshotFromTarget(projection)\n if (snapshot) {\n projection.snapshot = snapshot\n } else if (projection.snapshot) {\n projection.snapshot = undefined\n }\n } else if (\n projection.snapshot &&\n (projection.currentAnimation || projection.isProjecting())\n ) {\n projection.snapshot = undefined\n }\n projection.isPresent = true\n projection.willUpdate()\n })\n\n await this.updateDom()\n\n const afterElements = collectLayoutElements(this.scope)\n const afterRecords = this.buildRecords(afterElements)\n this.handleExitingElements(beforeRecords, afterRecords)\n\n afterRecords.forEach(({ projection }) => {\n const instance = projection.instance as HTMLElement | undefined\n const resumeFromInstance = projection.resumeFrom\n ?.instance as HTMLElement | undefined\n if (!instance || !resumeFromInstance) return\n if (!(\"style\" in instance)) return\n\n const currentTransform = instance.style.transform\n const resumeFromTransform = resumeFromInstance.style.transform\n\n if (\n currentTransform &&\n resumeFromTransform &&\n currentTransform === resumeFromTransform\n ) {\n instance.style.transform = \"\"\n instance.style.transformOrigin = \"\"\n }\n })\n\n afterRecords.forEach(({ projection }) => {\n projection.isPresent = true\n })\n\n const root = getProjectionRoot(afterRecords, beforeRecords)\n root?.didUpdate()\n\n await new Promise<void>((resolve) => {\n frame.postRender(() => resolve())\n })\n\n const animations = collectAnimations(afterRecords)\n const animation = new GroupAnimation(animations)\n\n return animation\n }\n\n private buildRecords(elements: Element[]): LayoutElementRecord[] {\n const records: LayoutElementRecord[] = []\n const recordMap = new Map<Element, LayoutElementRecord>()\n\n for (const element of elements) {\n const parentRecord = findParentRecord(element, recordMap, this.scope)\n const { layout, layoutId } = readLayoutAttributes(element)\n const override = layoutId\n ? this.sharedTransitions.get(layoutId)\n : undefined\n const transition = override || this.defaultOptions\n const record = getOrCreateRecord(element, parentRecord?.projection, {\n layout,\n layoutId,\n animationType: typeof layout === \"string\" ? layout : \"both\",\n transition: transition as Transition,\n })\n recordMap.set(element, record)\n records.push(record)\n }\n\n return records\n }\n\n private handleExitingElements(\n beforeRecords: LayoutElementRecord[],\n afterRecords: LayoutElementRecord[]\n ): void {\n const afterElementsSet = new Set(afterRecords.map((record) => record.element))\n\n beforeRecords.forEach((record) => {\n if (afterElementsSet.has(record.element)) return\n\n // For shared layout elements, relegate to set up resumeFrom\n // so the remaining element animates from this position\n if (record.projection.options.layoutId) {\n record.projection.isPresent = false\n record.projection.relegate()\n }\n\n record.visualElement.unmount()\n visualElementStore.delete(record.element)\n })\n\n // Clear resumeFrom on EXISTING nodes that point to unmounted projections\n // This prevents crossfade animation when the source element was removed entirely\n // But preserve resumeFrom for NEW nodes so they can animate from the old position\n // Also preserve resumeFrom for lead nodes that were just promoted via relegate\n const beforeElementsSet = new Set(beforeRecords.map((record) => record.element))\n afterRecords.forEach(({ element, projection }) => {\n if (\n beforeElementsSet.has(element) &&\n projection.resumeFrom &&\n !projection.resumeFrom.instance &&\n !projection.isLead()\n ) {\n projection.resumeFrom = undefined\n projection.snapshot = undefined\n }\n })\n }\n}\n\nexport function parseAnimateLayoutArgs(\n scopeOrUpdateDom: ElementOrSelector | (() => void),\n updateDomOrOptions?: (() => void) | AnimationOptions,\n options?: AnimationOptions\n): {\n scope: Element | Document\n updateDom: () => void\n defaultOptions?: AnimationOptions\n} {\n // animateLayout(updateDom)\n if (typeof scopeOrUpdateDom === \"function\") {\n return {\n scope: document,\n updateDom: scopeOrUpdateDom,\n defaultOptions: updateDomOrOptions as AnimationOptions | undefined,\n }\n }\n\n // animateLayout(scope, updateDom, options?)\n const elements = resolveElements(scopeOrUpdateDom)\n const scope = elements[0] || document\n\n return {\n scope,\n updateDom: updateDomOrOptions as () => void,\n defaultOptions: options,\n }\n}\n\nfunction collectLayoutElements(scope: LayoutAnimationScope): Element[] {\n const elements = Array.from(scope.querySelectorAll(layoutSelector))\n\n if (scope instanceof Element && scope.matches(layoutSelector)) {\n if (!elements.includes(scope)) {\n elements.unshift(scope)\n }\n }\n\n return elements\n}\n\nfunction readLayoutAttributes(element: Element): LayoutAttributes {\n const layoutId = element.getAttribute(\"data-layout-id\") || undefined\n const rawLayout = element.getAttribute(\"data-layout\")\n let layout: LayoutAttributes[\"layout\"]\n\n if (rawLayout === \"\" || rawLayout === \"true\") {\n layout = true\n } else if (rawLayout) {\n layout = rawLayout as LayoutAttributes[\"layout\"]\n }\n\n return {\n layout,\n layoutId,\n }\n}\n\nfunction createVisualState() {\n return {\n latestValues: {},\n renderState: {\n transform: {},\n transformOrigin: {},\n style: {},\n vars: {},\n },\n }\n}\n\nfunction getOrCreateRecord(\n element: Element,\n parentProjection?: IProjectionNode,\n projectionOptions?: ProjectionOptions\n): LayoutElementRecord {\n const existing = visualElementStore.get(element) as VisualElement | undefined\n const visualElement =\n existing ??\n new HTMLVisualElement(\n {\n props: {},\n presenceContext: null,\n visualState: createVisualState(),\n },\n { allowProjection: true }\n )\n\n if (!existing || !visualElement.projection) {\n visualElement.projection = new HTMLProjectionNode(\n visualElement.latestValues,\n parentProjection\n )\n }\n\n visualElement.projection.setOptions({\n ...projectionOptions,\n visualElement,\n })\n\n if (!visualElement.current) {\n visualElement.mount(element as HTMLElement)\n } else if (!visualElement.projection.instance) {\n // Mount projection if VisualElement is already mounted but projection isn't\n // This happens when animate() was called before animateLayout()\n visualElement.projection.mount(element as HTMLElement)\n }\n\n if (!existing) {\n visualElementStore.set(element, visualElement)\n }\n\n return {\n element,\n visualElement,\n projection: visualElement.projection as IProjectionNode,\n }\n}\n\nfunction findParentRecord(\n element: Element,\n recordMap: Map<Element, LayoutElementRecord>,\n scope: LayoutAnimationScope\n) {\n let parent = element.parentElement\n\n while (parent) {\n const record = recordMap.get(parent)\n if (record) return record\n\n if (parent === scope) break\n parent = parent.parentElement\n }\n\n return undefined\n}\n\nfunction getProjectionRoot(\n afterRecords: LayoutElementRecord[],\n beforeRecords: LayoutElementRecord[]\n) {\n const record = afterRecords[0] || beforeRecords[0]\n return record?.projection.root\n}\n\nfunction collectAnimations(afterRecords: LayoutElementRecord[]) {\n const animations = new Set<AnimationPlaybackControls>()\n\n afterRecords.forEach((record) => {\n const animation = record.projection.currentAnimation\n if (animation) animations.add(animation)\n })\n\n return Array.from(animations)\n}\n"],"names":[],"mappings":";;;;;;;;;AAyCA,MAAM,cAAc,GAAG,iCAAiC,CAAA;AACxD,MAAM,IAAI,GAAG,MAAK,GAAG,CAAA;AACrB,SAAS,kBAAkB,CAAC,UAA2B,EAAA;IACnD,MAAM,MAAM,GAAG,UAAU,CAAC,oBAAoB,IAAI,UAAU,CAAC,MAAM,CAAA;AACnE,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,SAAS,CAAA;AAE7B,IAAA,MAAM,WAAW,GAAG,SAAS,EAAE,CAAA;AAC/B,IAAA,MAAM,SAAS,GAAG,SAAS,EAAE,CAAA;AAC7B,IAAA,WAAW,CAAC,WAAW,EAAE,MAAa,CAAC,CAAA;AACvC,IAAA,WAAW,CAAC,SAAS,EAAE,MAAa,CAAC,CAAA;IAErC,OAAO;AACH,QAAA,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC;QAC9C,WAAW;QACX,SAAS;QACT,YAAY,EAAE,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,YAAY,IAAI,EAAE;QACzE,MAAM,EAAE,UAAU,CAAC,EAAE;KACxB,CAAA;AACL,CAAC;MAEY,sBAAsB,CAAA;AAS/B,IA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AO,SAAS,CAAA;AACpB,CAAC;AAED,SAAS,iBAAiB,CACtB,YAAmC,EACnC,aAAoC,EAAA;IAEpC,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;AAClD,IAAA,OAAO,MAAM,EAAE,UAAU,CAAC,IAAI,CAAA;AAClC,CAAC;AAED,SAAS,iBAAiB,CAAC,YAAmC,EAAA;AAC1D,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B,CAAA;AAEvD,IAAA,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;AAC5B,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAA;AACpD,QAAA,IAAI,SAAS;AAAE,YAAA,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAC5C,KAAC,CAAC,CAAA;AAEF,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AACjC;;;;"}
1
+ {"version":3,"file":"LayoutAnimationBuilder.mjs","sources":["../../../src/layout/LayoutAnimationBuilder.ts"],"sourcesContent":["import type { Box } from \"motion-utils\"\nimport { GroupAnimation } from \"../animation/GroupAnimation\"\nimport type {\n AnimationOptions,\n AnimationPlaybackControls,\n Transition,\n} from \"../animation/types\"\nimport { frame } from \"../frameloop\"\nimport { copyBoxInto } from \"../projection/geometry/copy\"\nimport { createBox } from \"../projection/geometry/models\"\nimport { HTMLProjectionNode } from \"../projection/node/HTMLProjectionNode\"\nimport type { IProjectionNode } from \"../projection/node/types\"\nimport { HTMLVisualElement } from \"../render/html/HTMLVisualElement\"\nimport { visualElementStore } from \"../render/store\"\nimport type { VisualElement } from \"../render/VisualElement\"\nimport { resolveElements, type ElementOrSelector } from \"../utils/resolve-elements\"\n\ntype LayoutAnimationScope = Element | Document\n\ninterface LayoutElementRecord {\n element: Element\n visualElement: VisualElement\n projection: IProjectionNode\n}\n\ninterface LayoutAttributes {\n layout?: boolean | \"position\" | \"size\" | \"preserve-aspect\"\n layoutId?: string\n}\n\ntype LayoutBuilderResolve = (animation: GroupAnimation) => void\ntype LayoutBuilderReject = (error: unknown) => void\n\ninterface ProjectionOptions {\n layout?: boolean | \"position\" | \"size\" | \"preserve-aspect\"\n layoutId?: string\n animationType?: \"size\" | \"position\" | \"both\" | \"preserve-aspect\"\n transition?: Transition\n crossfade?: boolean\n}\n\nconst layoutSelector = \"[data-layout], [data-layout-id]\"\nconst noop = () => {}\nfunction snapshotFromTarget(projection: IProjectionNode): LayoutElementRecord[\"projection\"][\"snapshot\"] {\n const target = projection.targetWithTransforms || projection.target\n if (!target) return undefined\n\n const measuredBox = createBox()\n const layoutBox = createBox()\n copyBoxInto(measuredBox, target as Box)\n copyBoxInto(layoutBox, target as Box)\n\n return {\n animationId: projection.root?.animationId ?? 0,\n measuredBox,\n layoutBox,\n latestValues: projection.animationValues || projection.latestValues || {},\n source: projection.id,\n }\n}\n\nexport class LayoutAnimationBuilder {\n private scope: LayoutAnimationScope\n private updateDom: () => void | Promise<void>\n private defaultOptions?: AnimationOptions\n private sharedTransitions = new Map<string, AnimationOptions>()\n private notifyReady: LayoutBuilderResolve = noop\n private rejectReady: LayoutBuilderReject = noop\n private readyPromise: Promise<GroupAnimation>\n\n constructor(\n scope: LayoutAnimationScope,\n updateDom: () => void | Promise<void>,\n defaultOptions?: AnimationOptions\n ) {\n this.scope = scope\n this.updateDom = updateDom\n this.defaultOptions = defaultOptions\n\n this.readyPromise = new Promise<GroupAnimation>((resolve, reject) => {\n this.notifyReady = resolve\n this.rejectReady = reject\n })\n\n frame.postRender(() => {\n this.start().then(this.notifyReady).catch(this.rejectReady)\n })\n }\n\n shared(id: string, transition: AnimationOptions): this {\n this.sharedTransitions.set(id, transition)\n return this\n }\n\n then(\n resolve: LayoutBuilderResolve,\n reject?: LayoutBuilderReject\n ): Promise<void> {\n return this.readyPromise.then(resolve, reject)\n }\n\n private async start(): Promise<GroupAnimation> {\n const beforeElements = collectLayoutElements(this.scope)\n const beforeRecords = this.buildRecords(beforeElements)\n\n beforeRecords.forEach(({ projection }) => {\n const hasCurrentAnimation = Boolean(projection.currentAnimation)\n const isSharedLayout = Boolean(projection.options.layoutId)\n if (hasCurrentAnimation && isSharedLayout) {\n const snapshot = snapshotFromTarget(projection)\n if (snapshot) {\n projection.snapshot = snapshot\n } else if (projection.snapshot) {\n projection.snapshot = undefined\n }\n } else if (\n projection.snapshot &&\n (projection.currentAnimation || projection.isProjecting())\n ) {\n projection.snapshot = undefined\n }\n projection.isPresent = true\n projection.willUpdate()\n })\n\n await this.updateDom()\n\n const afterElements = collectLayoutElements(this.scope)\n const afterRecords = this.buildRecords(afterElements)\n this.handleExitingElements(beforeRecords, afterRecords)\n\n afterRecords.forEach(({ projection }) => {\n const instance = projection.instance as HTMLElement | undefined\n const resumeFromInstance = projection.resumeFrom\n ?.instance as HTMLElement | undefined\n if (!instance || !resumeFromInstance) return\n if (!(\"style\" in instance)) return\n\n const currentTransform = instance.style.transform\n const resumeFromTransform = resumeFromInstance.style.transform\n\n if (\n currentTransform &&\n resumeFromTransform &&\n currentTransform === resumeFromTransform\n ) {\n instance.style.transform = \"\"\n instance.style.transformOrigin = \"\"\n }\n })\n\n afterRecords.forEach(({ projection }) => {\n projection.isPresent = true\n })\n\n const root = getProjectionRoot(afterRecords, beforeRecords)\n root?.didUpdate()\n\n await new Promise<void>((resolve) => {\n frame.postRender(() => resolve())\n })\n\n const animations = collectAnimations(afterRecords)\n const animation = new GroupAnimation(animations)\n\n return animation\n }\n\n private buildRecords(elements: Element[]): LayoutElementRecord[] {\n const records: LayoutElementRecord[] = []\n const recordMap = new Map<Element, LayoutElementRecord>()\n\n for (const element of elements) {\n const parentRecord = findParentRecord(element, recordMap, this.scope)\n const { layout, layoutId } = readLayoutAttributes(element)\n const override = layoutId\n ? this.sharedTransitions.get(layoutId)\n : undefined\n const transition = override || this.defaultOptions\n const record = getOrCreateRecord(element, parentRecord?.projection, {\n layout,\n layoutId,\n animationType: typeof layout === \"string\" ? layout : \"both\",\n transition: transition as Transition,\n })\n recordMap.set(element, record)\n records.push(record)\n }\n\n return records\n }\n\n private handleExitingElements(\n beforeRecords: LayoutElementRecord[],\n afterRecords: LayoutElementRecord[]\n ): void {\n const afterElementsSet = new Set(afterRecords.map((record) => record.element))\n\n beforeRecords.forEach((record) => {\n if (afterElementsSet.has(record.element)) return\n\n // For shared layout elements, relegate to set up resumeFrom\n // so the remaining element animates from this position\n if (record.projection.options.layoutId) {\n record.projection.isPresent = false\n record.projection.relegate()\n }\n\n record.visualElement.unmount()\n visualElementStore.delete(record.element)\n })\n\n // Clear resumeFrom on EXISTING nodes that point to unmounted projections\n // This prevents crossfade animation when the source element was removed entirely\n // But preserve resumeFrom for NEW nodes so they can animate from the old position\n // Also preserve resumeFrom for lead nodes that were just promoted via relegate\n const beforeElementsSet = new Set(beforeRecords.map((record) => record.element))\n afterRecords.forEach(({ element, projection }) => {\n if (\n beforeElementsSet.has(element) &&\n projection.resumeFrom &&\n !projection.resumeFrom.instance &&\n !projection.isLead()\n ) {\n projection.resumeFrom = undefined\n projection.snapshot = undefined\n }\n })\n }\n}\n\nexport function parseAnimateLayoutArgs(\n scopeOrUpdateDom: ElementOrSelector | (() => void),\n updateDomOrOptions?: (() => void) | AnimationOptions,\n options?: AnimationOptions\n): {\n scope: Element | Document\n updateDom: () => void\n defaultOptions?: AnimationOptions\n} {\n // animateLayout(updateDom)\n if (typeof scopeOrUpdateDom === \"function\") {\n return {\n scope: document,\n updateDom: scopeOrUpdateDom,\n defaultOptions: updateDomOrOptions as AnimationOptions | undefined,\n }\n }\n\n // animateLayout(scope, updateDom, options?)\n const elements = resolveElements(scopeOrUpdateDom)\n const scope = elements[0] || document\n\n return {\n scope,\n updateDom: updateDomOrOptions as () => void,\n defaultOptions: options,\n }\n}\n\nfunction collectLayoutElements(scope: LayoutAnimationScope): Element[] {\n const elements = Array.from(scope.querySelectorAll(layoutSelector))\n\n if (scope instanceof Element && scope.matches(layoutSelector)) {\n if (!elements.includes(scope)) {\n elements.unshift(scope)\n }\n }\n\n return elements\n}\n\nfunction readLayoutAttributes(element: Element): LayoutAttributes {\n const layoutId = element.getAttribute(\"data-layout-id\") || undefined\n const rawLayout = element.getAttribute(\"data-layout\")\n let layout: LayoutAttributes[\"layout\"]\n\n if (rawLayout === \"\" || rawLayout === \"true\") {\n layout = true\n } else if (rawLayout) {\n layout = rawLayout as LayoutAttributes[\"layout\"]\n }\n\n return {\n layout,\n layoutId,\n }\n}\n\nfunction createVisualState() {\n return {\n latestValues: {},\n renderState: {\n transform: {},\n transformOrigin: {},\n style: {},\n vars: {},\n },\n }\n}\n\nfunction getOrCreateRecord(\n element: Element,\n parentProjection?: IProjectionNode,\n projectionOptions?: ProjectionOptions\n): LayoutElementRecord {\n const existing = visualElementStore.get(element) as VisualElement | undefined\n const visualElement =\n existing ??\n new HTMLVisualElement(\n {\n props: {},\n presenceContext: null,\n visualState: createVisualState(),\n },\n { allowProjection: true }\n )\n\n if (!existing || !visualElement.projection) {\n visualElement.projection = new HTMLProjectionNode(\n visualElement.latestValues,\n parentProjection\n )\n }\n\n visualElement.projection.setOptions({\n ...projectionOptions,\n visualElement,\n })\n\n if (!visualElement.current) {\n visualElement.mount(element as HTMLElement)\n } else if (!visualElement.projection.instance) {\n // Mount projection if VisualElement is already mounted but projection isn't\n // This happens when animate() was called before animateLayout()\n visualElement.projection.mount(element as HTMLElement)\n }\n\n if (!existing) {\n visualElementStore.set(element, visualElement)\n }\n\n return {\n element,\n visualElement,\n projection: visualElement.projection as IProjectionNode,\n }\n}\n\nfunction findParentRecord(\n element: Element,\n recordMap: Map<Element, LayoutElementRecord>,\n scope: LayoutAnimationScope\n) {\n let parent = element.parentElement\n\n while (parent) {\n const record = recordMap.get(parent)\n if (record) return record\n\n if (parent === scope) break\n parent = parent.parentElement\n }\n\n return undefined\n}\n\nfunction getProjectionRoot(\n afterRecords: LayoutElementRecord[],\n beforeRecords: LayoutElementRecord[]\n) {\n const record = afterRecords[0] || beforeRecords[0]\n return record?.projection.root\n}\n\nfunction collectAnimations(afterRecords: LayoutElementRecord[]) {\n const animations = new Set<AnimationPlaybackControls>()\n\n afterRecords.forEach((record) => {\n const animation = record.projection.currentAnimation\n if (animation) animations.add(animation)\n })\n\n return Array.from(animations)\n}\n"],"names":[],"mappings":";;;;;;;;;AAyCA,MAAM,cAAc,GAAG,iCAAiC;AACxD,MAAM,IAAI,GAAG,MAAK,EAAE,CAAC;AACrB,SAAS,kBAAkB,CAAC,UAA2B,EAAA;IACnD,MAAM,MAAM,GAAG,UAAU,CAAC,oBAAoB,IAAI,UAAU,CAAC,MAAM;AACnE,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,SAAS;AAE7B,IAAA,MAAM,WAAW,GAAG,SAAS,EAAE;AAC/B,IAAA,MAAM,SAAS,GAAG,SAAS,EAAE;AAC7B,IAAA,WAAW,CAAC,WAAW,EAAE,MAAa,CAAC;AACvC,IAAA,WAAW,CAAC,SAAS,EAAE,MAAa,CAAC;IAErC,OAAO;AACH,QAAA,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC;QAC9C,WAAW;QACX,SAAS;QACT,YAAY,EAAE,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,YAAY,IAAI,EAAE;QACzE,MAAM,EAAE,UAAU,CAAC,EAAE;KACxB;AACL;MAEa,sBAAsB,CAAA;AAS/B,IAAA,WAAA,CACI,KAA2B,EAC3B,SAAqC,EACrC,cAAiC,EAAA;AAR7B,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,GAAG,EAA4B;QACvD,IAAA,CAAA,WAAW,GAAyB,IAAI;QACxC,IAAA,CAAA,WAAW,GAAwB,IAAI;AAQ3C,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;AAC1B,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;QAEpC,IAAI,C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,gBAAgB,CACrB,OAAgB,EAChB,SAA4C,EAC5C,KAA2B,EAAA;AAE3B,IAAA,IAAI,MAAM,GAAG,OAAO,CAAC,aAAa;IAElC,OAAO,MAAM,EAAE;QACX,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;AACpC,QAAA,IAAI,MAAM;AAAE,YAAA,OAAO,MAAM;QAEzB,IAAI,MAAM,KAAK,KAAK;YAAE;AACtB,QAAA,MAAM,GAAG,MAAM,CAAC,aAAa;IACjC;AAEA,IAAA,OAAO,SAAS;AACpB;AAEA,SAAS,iBAAiB,CACtB,YAAmC,EACnC,aAAoC,EAAA;IAEpC,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;AAClD,IAAA,OAAO,MAAM,EAAE,UAAU,CAAC,IAAI;AAClC;AAEA,SAAS,iBAAiB,CAAC,YAAmC,EAAA;AAC1D,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B;AAEvD,IAAA,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;AAC5B,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,gBAAgB;AACpD,QAAA,IAAI,SAAS;AAAE,YAAA,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;AAC5C,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AACjC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mix-values.mjs","sources":["../../../../src/projection/animation/mix-values.ts"],"sourcesContent":["import { mixNumber } from \"../../utils/mix/number\"\nimport { percent, px } from \"../../value/types/numbers/units\"\nimport type { AnyResolvedKeyframe } from \"../../animation/types\"\nimport {\n progress as calcProgress,\n circOut,\n EasingFunction,\n noop,\n} from \"motion-utils\"\nimport type { ResolvedValues } from \"../../node/types\"\n\nconst borders = [\"TopLeft\", \"TopRight\", \"BottomLeft\", \"BottomRight\"]\nconst numBorders = borders.length\n\nconst asNumber = (value: AnyResolvedKeyframe) =>\n typeof value === \"string\" ? parseFloat(value) : value\n\nconst isPx = (value: AnyResolvedKeyframe) =>\n typeof value === \"number\" || px.test(value)\n\nexport function mixValues(\n target: ResolvedValues,\n follow: ResolvedValues,\n lead: ResolvedValues,\n progress: number,\n shouldCrossfadeOpacity: boolean,\n isOnlyMember: boolean\n) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(\n 0,\n (lead.opacity as number) ?? 1,\n easeCrossfadeIn(progress)\n )\n target.opacityExit = mixNumber(\n (follow.opacity as number) ?? 1,\n 0,\n easeCrossfadeOut(progress)\n )\n } else if (isOnlyMember) {\n target.opacity = mixNumber(\n (follow.opacity as number) ?? 1,\n (lead.opacity as number) ?? 1,\n progress\n )\n }\n\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = `border${borders[i]}Radius`\n let followRadius = getRadius(follow, borderLabel)\n let leadRadius = getRadius(lead, borderLabel)\n\n if (followRadius === undefined && leadRadius === undefined) continue\n\n followRadius ||= 0\n leadRadius ||= 0\n\n const canMix =\n followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius)\n\n if (canMix) {\n target[borderLabel] = Math.max(\n mixNumber(\n asNumber(followRadius),\n asNumber(leadRadius),\n progress\n ),\n 0\n )\n\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\"\n }\n } else {\n target[borderLabel] = leadRadius\n }\n }\n\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(\n (follow.rotate as number) || 0,\n (lead.rotate as number) || 0,\n progress\n )\n }\n}\n\nfunction getRadius(values: ResolvedValues, radiusName: string) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius\n}\n\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut)\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop)\n\nfunction compress(\n min: number,\n max: number,\n easing: EasingFunction\n): EasingFunction {\n return (p: number) => {\n // Could replace ifs with clamp\n if (p < min) return 0\n if (p > max) return 1\n return easing(calcProgress(min, max, p))\n }\n}\n"],"names":["calcProgress"],"mappings":";;;;AAWA,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,CAAA;AACpE,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAA;AAEjC,MAAM,QAAQ,GAAG,CAAC,KAA0B,KACxC,OAAO,KAAK,KAAK,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;AAEzD,MAAM,IAAI,GAAG,CAAC,KAA0B,KACpC,OAAO,KAAK,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAE/B,SAAA,SAAS,CACrB,MAAsB,EACtB,MAAsB,EACtB,IAAoB,EACpB,QAAgB,EAChB,sBAA+B,EAC/B,YAAqB,EAAA;IAErB,IAAI,sBAAsB,EAAE;AACxB,QAAA,MAAM,CAAC,OAAO,GAAG,SAAS,CACtB,CAAC,EACA,IAAI,CAAC,OAAkB,IAAI,CAAC,EAC7B,eAAe,CAAC,QAAQ,CAAC,CAC5B,CAAA;AACD,QAAA,MAAM,CAAC,WAAW,GAAG,SAAS,CACzB,MAAM,CAAC,OAAkB,IAAI,CAAC,EAC/B,CAAC,EACD,gBAAgB,CAAC,QAAQ,CAAC,CAC7B,CAAA;KACJ;SAAM,IAAI,YAAY,EAAE;AACrB,QAAA,MAAM,CAAC,OAAO,GAAG,SAAS,CACrB,MAAM,CAAC,OAAkB,IAAI,CAAC,EAC9B,IAAI,CAAC,OAAkB,IAAI,CAAC,EAC7B,QAAQ,CACX,CAAA;KACJ;AAED;;AAEG;AACH,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;QACjC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B,EAAE,UAAkB,EAAA;AACzD,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,SAAS;AACnC,UAAE,MAAM,CAAC,UAAU,CAAC;AACpB,UAAE,MAAM,CAAC,YAAY,CAAA;AAC7B,CAAC;AAED,MAAM,eAAe,iBAAiB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;AAC/D,MAAM,gBAAgB,iBAAiB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEhE,SAAS,QAAQ,CACb,GAAW,EACX,GAAW,EACX,MAAsB,EAAA;IAEtB,OAAO,CAAC,CAAS,KAAI;;QAEjB,IAAI,CAAC,GAAG,GAAG;AAAE,YAAA,OAAO,CAAC,CAAA;QACrB,IAAI,CAAC,GAAG,GAAG;AAAE,YAAA,OAAO,CAAC,CAAA;QACrB,OAAO,MAAM,CAACA,QAAY,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;AAC5C,KAAC,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"mix-values.mjs","sources":["../../../../src/projection/animation/mix-values.ts"],"sourcesContent":["import { mixNumber } from \"../../utils/mix/number\"\nimport { percent, px } from \"../../value/types/numbers/units\"\nimport type { AnyResolvedKeyframe } from \"../../animation/types\"\nimport {\n progress as calcProgress,\n circOut,\n EasingFunction,\n noop,\n} from \"motion-utils\"\nimport type { ResolvedValues } from \"../../node/types\"\n\nconst borders = [\"TopLeft\", \"TopRight\", \"BottomLeft\", \"BottomRight\"]\nconst numBorders = borders.length\n\nconst asNumber = (value: AnyResolvedKeyframe) =>\n typeof value === \"string\" ? parseFloat(value) : value\n\nconst isPx = (value: AnyResolvedKeyframe) =>\n typeof value === \"number\" || px.test(value)\n\nexport function mixValues(\n target: ResolvedValues,\n follow: ResolvedValues,\n lead: ResolvedValues,\n progress: number,\n shouldCrossfadeOpacity: boolean,\n isOnlyMember: boolean\n) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(\n 0,\n (lead.opacity as number) ?? 1,\n easeCrossfadeIn(progress)\n )\n target.opacityExit = mixNumber(\n (follow.opacity as number) ?? 1,\n 0,\n easeCrossfadeOut(progress)\n )\n } else if (isOnlyMember) {\n target.opacity = mixNumber(\n (follow.opacity as number) ?? 1,\n (lead.opacity as number) ?? 1,\n progress\n )\n }\n\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = `border${borders[i]}Radius`\n let followRadius = getRadius(follow, borderLabel)\n let leadRadius = getRadius(lead, borderLabel)\n\n if (followRadius === undefined && leadRadius === undefined) continue\n\n followRadius ||= 0\n leadRadius ||= 0\n\n const canMix =\n followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius)\n\n if (canMix) {\n target[borderLabel] = Math.max(\n mixNumber(\n asNumber(followRadius),\n asNumber(leadRadius),\n progress\n ),\n 0\n )\n\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\"\n }\n } else {\n target[borderLabel] = leadRadius\n }\n }\n\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(\n (follow.rotate as number) || 0,\n (lead.rotate as number) || 0,\n progress\n )\n }\n}\n\nfunction getRadius(values: ResolvedValues, radiusName: string) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius\n}\n\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut)\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop)\n\nfunction compress(\n min: number,\n max: number,\n easing: EasingFunction\n): EasingFunction {\n return (p: number) => {\n // Could replace ifs with clamp\n if (p < min) return 0\n if (p > max) return 1\n return easing(calcProgress(min, max, p))\n }\n}\n"],"names":["calcProgress"],"mappings":";;;;AAWA,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC;AACpE,MAAM,UAAU,GA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;;QAEjB,IAAI,CAAC,GAAG,GAAG;AAAE,YAAA,OAAO,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG;AAAE,YAAA,OAAO,CAAC;QACrB,OAAO,MAAM,CAACA,QAAY,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAA,CAAC;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.mjs","sources":["../../../../src/projection/geometry/conversion.ts"],"sourcesContent":["import { BoundingBox, Box, TransformPoint } from \"motion-utils\"\n\n/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nexport function convertBoundingBoxToBox({\n top,\n left,\n right,\n bottom,\n}: BoundingBox): Box {\n return {\n x: { min: left, max: right },\n y: { min: top, max: bottom },\n }\n}\n\nexport function convertBoxToBoundingBox({ x, y }: Box): BoundingBox {\n return { top: y.min, right: x.max, bottom: y.max, left: x.min }\n}\n\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nexport function transformBoxPoints(\n point: BoundingBox,\n transformPoint?: TransformPoint\n) {\n if (!transformPoint) return point\n const topLeft = transformPoint({ x: point.left, y: point.top })\n const bottomRight = transformPoint({ x: point.right, y: point.bottom })\n\n return {\n top: topLeft.y,\n left: topLeft.x,\n bottom: bottomRight.y,\n right: bottomRight.x,\n }\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACG,SAAU,uBAAuB,CAAC,EACpC,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,GACI,EAAA;IACV,OAAO;QACH,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;QAC5B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE;KAC/B,CAAA;AACL,CAAC;SAEe,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAO,EAAA;IACjD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAA;AACnE,CAAC;AAED;;;;AAIG;AACa,SAAA,kBAAkB,CAC9B,KAAkB,EAClB,cAA+B,EAAA;AAE/B,IAAA,IAAI,CAAC,cAAc;AAAE,QAAA,OAAO,KAAK,CAAA;AACjC,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;AAC/D,IAAA,MAAM,WAAW,GAAG,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IAEvE,OAAO;QACH,GAAG,EAAE,OAAO,CAAC,CAAC;QACd,IAAI,EAAE,OAAO,CAAC,CAAC;QACf,MAAM,EAAE,WAAW,CAAC,CAAC;QACrB,KAAK,EAAE,WAAW,CAAC,CAAC;KACvB,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"conversion.mjs","sources":["../../../../src/projection/geometry/conversion.ts"],"sourcesContent":["import { BoundingBox, Box, TransformPoint } from \"motion-utils\"\n\n/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nexport function convertBoundingBoxToBox({\n top,\n left,\n right,\n bottom,\n}: BoundingBox): Box {\n return {\n x: { min: left, max: right },\n y: { min: top, max: bottom },\n }\n}\n\nexport function convertBoxToBoundingBox({ x, y }: Box): BoundingBox {\n return { top: y.min, right: x.max, bottom: y.max, left: x.min }\n}\n\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nexport function transformBoxPoints(\n point: BoundingBox,\n transformPoint?: TransformPoint\n) {\n if (!transformPoint) return point\n const topLeft = transformPoint({ x: point.left, y: point.top })\n const bottomRight = transformPoint({ x: point.right, y: point.bottom })\n\n return {\n top: topLeft.y,\n left: topLeft.x,\n bottom: bottomRight.y,\n right: bottomRight.x,\n }\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACG,SAAU,uBAAuB,CAAC,EACpC,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,GACI,EAAA;IACV,OAAO;QACH,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;QAC5B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE;KAC/B;AACL;SAEgB,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAO,EAAA;IACjD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE;AACnE;AAEA;;;;AAIG;AACG,SAAU,kBAAkB,CAC9B,KAAkB,EAClB,cAA+B,EAAA;AAE/B,IAAA,IAAI,CAAC,cAAc;AAAE,QAAA,OAAO,KAAK;AACjC,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AAC/D,IAAA,MAAM,WAAW,GAAG,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IAEvE,OAAO;QACH,GAAG,EAAE,OAAO,CAAC,CAAC;QACd,IAAI,EAAE,OAAO,CAAC,CAAC;QACf,MAAM,EAAE,WAAW,CAAC,CAAC;QACrB,KAAK,EAAE,WAAW,CAAC,CAAC;KACvB;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"copy.mjs","sources":["../../../../src/projection/geometry/copy.ts"],"sourcesContent":["import { Axis, AxisDelta, Box } from \"motion-utils\"\n\n/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyAxisInto(axis: Axis, originAxis: Axis) {\n axis.min = originAxis.min\n axis.max = originAxis.max\n}\n\n/**\n * Reset a box to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyBoxInto(box: Box, originBox: Box) {\n copyAxisInto(box.x, originBox.x)\n copyAxisInto(box.y, originBox.y)\n}\n\n/**\n * Reset a delta to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyAxisDeltaInto(delta: AxisDelta, originDelta: AxisDelta) {\n delta.translate = originDelta.translate\n delta.scale = originDelta.scale\n delta.originPoint = originDelta.originPoint\n delta.origin = originDelta.origin\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACa,SAAA,YAAY,CAAC,IAAU,EAAE,UAAgB,EAAA;AACrD,IAAA,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAA;AACzB,IAAA,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAA;AAC7B,CAAC;AAED;;;;AAIG;AACa,SAAA,WAAW,CAAC,GAAQ,EAAE,SAAc,EAAA;IAChD,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAChC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC;AAED;;;;AAIG;AACa,SAAA,iBAAiB,CAAC,KAAgB,EAAE,WAAsB,EAAA;AACtE,IAAA,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAA;AACvC,IAAA,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAA;AAC/B,IAAA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAA;AAC3C,IAAA,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;AACrC;;;;"}
1
+ {"version":3,"file":"copy.mjs","sources":["../../../../src/projection/geometry/copy.ts"],"sourcesContent":["import { Axis, AxisDelta, Box } from \"motion-utils\"\n\n/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyAxisInto(axis: Axis, originAxis: Axis) {\n axis.min = originAxis.min\n axis.max = originAxis.max\n}\n\n/**\n * Reset a box to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyBoxInto(box: Box, originBox: Box) {\n copyAxisInto(box.x, originBox.x)\n copyAxisInto(box.y, originBox.y)\n}\n\n/**\n * Reset a delta to the provided origin box.\n *\n * This is a mutative operation.\n */\nexport function copyAxisDeltaInto(delta: AxisDelta, originDelta: AxisDelta) {\n delta.translate = originDelta.translate\n delta.scale = originDelta.scale\n delta.originPoint = originDelta.originPoint\n delta.origin = originDelta.origin\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACG,SAAU,YAAY,CAAC,IAAU,EAAE,UAAgB,EAAA;AACrD,IAAA,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG;AACzB,IAAA,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG;AAC7B;AAEA;;;;AAIG;AACG,SAAU,WAAW,CAAC,GAAQ,EAAE,SAAc,EAAA;IAChD,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAChC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AACpC;AAEA;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,KAAgB,EAAE,WAAsB,EAAA;AACtE,IAAA,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;AACvC,IAAA,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK;AAC/B,IAAA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW;AAC3C,IAAA,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;AACrC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"delta-apply.mjs","sources":["../../../../src/projection/geometry/delta-apply.ts"],"sourcesContent":["import { Axis, Box, Delta, Point } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { ResolvedValues } from \"../../render/types\"\nimport { hasTransform } from \"../utils/has-transform\"\n\n/**\n * Scales a point based on a factor and an originPoint\n */\nexport function scalePoint(point: number, scale: number, originPoint: number) {\n const distanceFromOrigin = point - originPoint\n const scaled = scale * distanceFromOrigin\n return originPoint + scaled\n}\n\n/**\n * Applies a translate/scale delta to a point\n */\nexport function applyPointDelta(\n point: number,\n translate: number,\n scale: number,\n originPoint: number,\n boxScale?: number\n): number {\n if (boxScale !== undefined) {\n point = scalePoint(point, boxScale, originPoint)\n }\n\n return scalePoint(point, scale, originPoint) + translate\n}\n\n/**\n * Applies a translate/scale delta to an axis\n */\nexport function applyAxisDelta(\n axis: Axis,\n translate: number = 0,\n scale: number = 1,\n originPoint: number,\n boxScale?: number\n): void {\n axis.min = applyPointDelta(\n axis.min,\n translate,\n scale,\n originPoint,\n boxScale\n )\n\n axis.max = applyPointDelta(\n axis.max,\n translate,\n scale,\n originPoint,\n boxScale\n )\n}\n\n/**\n * Applies a translate/scale delta to a box\n */\nexport function applyBoxDelta(box: Box, { x, y }: Delta): void {\n applyAxisDelta(box.x, x.translate, x.scale, x.originPoint)\n applyAxisDelta(box.y, y.translate, y.scale, y.originPoint)\n}\n\nconst TREE_SCALE_SNAP_MIN = 0.999999999999\nconst TREE_SCALE_SNAP_MAX = 1.0000000000001\n\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within updateLayoutDelta for future refactoring\n */\nexport function applyTreeDeltas(\n box: Box,\n treeScale: Point,\n treePath: any[],\n isSharedTransition: boolean = false\n) {\n const treeLength = treePath.length\n if (!treeLength) return\n\n // Reset the treeScale\n treeScale.x = treeScale.y = 1\n\n let node: any\n let delta: Delta | undefined\n\n for (let i = 0; i < treeLength; i++) {\n node = treePath[i]\n delta = node.projectionDelta\n\n /**\n * TODO: Prefer to remove this, but currently we have motion components with\n * display: contents in Framer.\n */\n const { visualElement } = node.options\n if (\n visualElement &&\n visualElement.props.style &&\n visualElement.props.style.display === \"contents\"\n ) {\n continue\n }\n\n if (\n isSharedTransition &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root\n ) {\n transformBox(box, {\n x: -node.scroll.offset.x,\n y: -node.scroll.offset.y,\n })\n }\n\n if (delta) {\n // Incoporate each ancestor's scale into a cumulative treeScale for this component\n treeScale.x *= delta.x.scale\n treeScale.y *= delta.y.scale\n\n // Apply each ancestor's calculated delta into this component's recorded layout box\n applyBoxDelta(box, delta)\n }\n\n if (isSharedTransition && hasTransform(node.latestValues)) {\n transformBox(box, node.latestValues)\n }\n }\n\n /**\n * Snap tree scale back to 1 if it's within a non-perceivable threshold.\n * This will help reduce useless scales getting rendered.\n */\n if (\n treeScale.x < TREE_SCALE_SNAP_MAX &&\n treeScale.x > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.x = 1.0\n }\n if (\n treeScale.y < TREE_SCALE_SNAP_MAX &&\n treeScale.y > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.y = 1.0\n }\n}\n\nexport function translateAxis(axis: Axis, distance: number) {\n axis.min = axis.min + distance\n axis.max = axis.max + distance\n}\n\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nexport function transformAxis(\n axis: Axis,\n axisTranslate?: number,\n axisScale?: number,\n boxScale?: number,\n axisOrigin: number = 0.5\n): void {\n const originPoint = mixNumber(axis.min, axis.max, axisOrigin)\n\n // Apply the axis delta to the final axis\n applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale)\n}\n\n/**\n * Apply a transform to a box from the latest resolved motion values.\n */\nexport function transformBox(box: Box, transform: ResolvedValues) {\n transformAxis(\n box.x,\n transform.x as number,\n transform.scaleX as number,\n transform.scale as number,\n transform.originX as number\n )\n transformAxis(\n box.y,\n transform.y as number,\n transform.scaleY as number,\n transform.scale as number,\n transform.originY as number\n )\n}\n"],"names":[],"mappings":";;;AAKA;;AAEG;SACa,UAAU,CAAC,KAAa,EAAE,KAAa,EAAE,WAAmB,EAAA;AACxE,IAAA,MAAM,kBAAkB,GAAG,KAAK,GAAG,WAAW,CAAA;AAC9C,IAAA,MAAM,MAAM,GAAG,KAAK,GAAG,kBAAkB,CAAA;IACzC,OAAO,WAAW,GAAG,MAAM,CAAA;AAC/B,CAAC;AAED;;AAEG;AACG,SAAU,eAAe,CAC3B,KAAa,EACb,SAAiB,EACjB,KAAa,EACb,WAAmB,EACnB,QAAiB,EAAA;AAEjB,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;KACnD;IAED,OAAO,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,SAAS,CAAA;AAC5D,CAAC;AAED;;AAEG;AACa,SAAA,cAAc,CAC1B,IAAU,EACV,SAAA,GAAoB,CAAC,EACrB,KAAgB,GAAA,CAAC,EACjB,WAAmB,EACnB,QAAiB,EAAA;AAEjB,IAAA,IAAI,CAAC,GAAG,GAAG,eAAe,CACtB,IAAI,CAAC,GAAG,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,CACX,CAAA;AAED,IAAA,IAAI,CAAC,GAAG,GAAG,eAAe,CACtB,IAAI,CAAC,GAAG,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,CACX,CAAA;AACL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tB,SAAkB,EAClB,QAAiB,EACjB,UAAA,GAAqB,GAAG,EAAA;AAExB,IAAA,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;;IAG7D,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;AACzE,CAAC;AAED;;AAEG;AACa,SAAA,YAAY,CAAC,GAAQ,EAAE,SAAyB,EAAA;IAC5D,aAAa,CACT,GAAG,CAAC,CAAC,EACL,SAAS,CAAC,CAAW,EACrB,SAAS,CAAC,MAAgB,EAC1B,SAAS,CAAC,KAAe,EACzB,SAAS,CAAC,OAAiB,CAC9B,CAAA;IACD,aAAa,CACT,GAAG,CAAC,CAAC,EACL,SAAS,CAAC,CAAW,EACrB,SAAS,CAAC,MAAgB,EAC1B,SAAS,CAAC,KAAe,EACzB,SAAS,CAAC,OAAiB,CAC9B,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"delta-apply.mjs","sources":["../../../../src/projection/geometry/delta-apply.ts"],"sourcesContent":["import { Axis, Box, Delta, Point } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { ResolvedValues } from \"../../render/types\"\nimport { hasTransform } from \"../utils/has-transform\"\n\n/**\n * Scales a point based on a factor and an originPoint\n */\nexport function scalePoint(point: number, scale: number, originPoint: number) {\n const distanceFromOrigin = point - originPoint\n const scaled = scale * distanceFromOrigin\n return originPoint + scaled\n}\n\n/**\n * Applies a translate/scale delta to a point\n */\nexport function applyPointDelta(\n point: number,\n translate: number,\n scale: number,\n originPoint: number,\n boxScale?: number\n): number {\n if (boxScale !== undefined) {\n point = scalePoint(point, boxScale, originPoint)\n }\n\n return scalePoint(point, scale, originPoint) + translate\n}\n\n/**\n * Applies a translate/scale delta to an axis\n */\nexport function applyAxisDelta(\n axis: Axis,\n translate: number = 0,\n scale: number = 1,\n originPoint: number,\n boxScale?: number\n): void {\n axis.min = applyPointDelta(\n axis.min,\n translate,\n scale,\n originPoint,\n boxScale\n )\n\n axis.max = applyPointDelta(\n axis.max,\n translate,\n scale,\n originPoint,\n boxScale\n )\n}\n\n/**\n * Applies a translate/scale delta to a box\n */\nexport function applyBoxDelta(box: Box, { x, y }: Delta): void {\n applyAxisDelta(box.x, x.translate, x.scale, x.originPoint)\n applyAxisDelta(box.y, y.translate, y.scale, y.originPoint)\n}\n\nconst TREE_SCALE_SNAP_MIN = 0.999999999999\nconst TREE_SCALE_SNAP_MAX = 1.0000000000001\n\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within updateLayoutDelta for future refactoring\n */\nexport function applyTreeDeltas(\n box: Box,\n treeScale: Point,\n treePath: any[],\n isSharedTransition: boolean = false\n) {\n const treeLength = treePath.length\n if (!treeLength) return\n\n // Reset the treeScale\n treeScale.x = treeScale.y = 1\n\n let node: any\n let delta: Delta | undefined\n\n for (let i = 0; i < treeLength; i++) {\n node = treePath[i]\n delta = node.projectionDelta\n\n /**\n * TODO: Prefer to remove this, but currently we have motion components with\n * display: contents in Framer.\n */\n const { visualElement } = node.options\n if (\n visualElement &&\n visualElement.props.style &&\n visualElement.props.style.display === \"contents\"\n ) {\n continue\n }\n\n if (\n isSharedTransition &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root\n ) {\n transformBox(box, {\n x: -node.scroll.offset.x,\n y: -node.scroll.offset.y,\n })\n }\n\n if (delta) {\n // Incoporate each ancestor's scale into a cumulative treeScale for this component\n treeScale.x *= delta.x.scale\n treeScale.y *= delta.y.scale\n\n // Apply each ancestor's calculated delta into this component's recorded layout box\n applyBoxDelta(box, delta)\n }\n\n if (isSharedTransition && hasTransform(node.latestValues)) {\n transformBox(box, node.latestValues)\n }\n }\n\n /**\n * Snap tree scale back to 1 if it's within a non-perceivable threshold.\n * This will help reduce useless scales getting rendered.\n */\n if (\n treeScale.x < TREE_SCALE_SNAP_MAX &&\n treeScale.x > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.x = 1.0\n }\n if (\n treeScale.y < TREE_SCALE_SNAP_MAX &&\n treeScale.y > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.y = 1.0\n }\n}\n\nexport function translateAxis(axis: Axis, distance: number) {\n axis.min = axis.min + distance\n axis.max = axis.max + distance\n}\n\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nexport function transformAxis(\n axis: Axis,\n axisTranslate?: number,\n axisScale?: number,\n boxScale?: number,\n axisOrigin: number = 0.5\n): void {\n const originPoint = mixNumber(axis.min, axis.max, axisOrigin)\n\n // Apply the axis delta to the final axis\n applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale)\n}\n\n/**\n * Apply a transform to a box from the latest resolved motion values.\n */\nexport function transformBox(box: Box, transform: ResolvedValues) {\n transformAxis(\n box.x,\n transform.x as number,\n transform.scaleX as number,\n transform.scale as number,\n transform.originX as number\n )\n transformAxis(\n box.y,\n transform.y as number,\n transform.scaleY as number,\n transform.scale as number,\n transform.originY as number\n )\n}\n"],"names":[],"mappings":";;;AAKA;;AAEG;SACa,UAAU,CAAC,KAAa,EAAE,KAAa,EAAE,WAAmB,EAAA;AACxE,IAAA,MAAM,kBAAkB,GAAG,KAAK,GAAG,WAAW;AAC9C,IAAA,MAAM,MAAM,GAAG,KAAK,GAAG,kBAAkB;IACzC,OAAO,WAAW,GAAG,MAAM;AAC/B;AAEA;;AAEG;AACG,SAAU,eAAe,CAC3B,KAAa,EACb,SAAiB,EACjB,KAAa,EACb,WAAmB,EACnB,QAAiB,EAAA;AAEjB,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC;IACpD;IAEA,OAAO,UAAU,CAAC,KAAK,EAAE,KAAK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;IACrB;AACJ;AAEM,SAAU,aAAa,CAAC,IAAU,EAAE,QAAgB,EAAA;IACtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,QAAQ;IAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,QAAQ;AAClC;AAEA;;;;AAIG;AACG,SAAU,aAAa,CACzB,IAAU,EACV,aAAsB,EACtB,SAAkB,EAClB,QAAiB,EACjB,UAAA,GAAqB,GAAG,EAAA;AAExB,IAAA,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC;;IAG7D,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC;AACzE;AAEA;;AAEG;AACG,SAAU,YAAY,CAAC,GAAQ,EAAE,SAAyB,EAAA;IAC5D,aAAa,CACT,GAAG,CAAC,CAAC,EACL,SAAS,CAAC,CAAW,EACrB,SAAS,CAAC,MAAgB,EAC1B,SAAS,CAAC,KAAe,EACzB,SAAS,CAAC,OAAiB,CAC9B;IACD,aAAa,CACT,GAAG,CAAC,CAAC,EACL,SAAS,CAAC,CAAW,EACrB,SAAS,CAAC,MAAgB,EAC1B,SAAS,CAAC,KAAe,EACzB,SAAS,CAAC,OAAiB,CAC9B;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"delta-calc.mjs","sources":["../../../../src/projection/geometry/delta-calc.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { ResolvedValues } from \"../../render/types\"\n\nconst SCALE_PRECISION = 0.0001\nconst SCALE_MIN = 1 - SCALE_PRECISION\nconst SCALE_MAX = 1 + SCALE_PRECISION\nconst TRANSLATE_PRECISION = 0.01\nconst TRANSLATE_MIN = 0 - TRANSLATE_PRECISION\nconst TRANSLATE_MAX = 0 + TRANSLATE_PRECISION\n\nexport function calcLength(axis: Axis) {\n return axis.max - axis.min\n}\n\nexport function isNear(\n value: number,\n target: number,\n maxDistance: number\n): boolean {\n return Math.abs(value - target) <= maxDistance\n}\n\nexport function calcAxisDelta(\n delta: AxisDelta,\n source: Axis,\n target: Axis,\n origin: number = 0.5\n) {\n delta.origin = origin\n delta.originPoint = mixNumber(source.min, source.max, delta.origin)\n delta.scale = calcLength(target) / calcLength(source)\n delta.translate =\n mixNumber(target.min, target.max, delta.origin) - delta.originPoint\n\n if (\n (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) ||\n isNaN(delta.scale)\n ) {\n delta.scale = 1.0\n }\n\n if (\n (delta.translate >= TRANSLATE_MIN &&\n delta.translate <= TRANSLATE_MAX) ||\n isNaN(delta.translate)\n ) {\n delta.translate = 0.0\n }\n}\n\nexport function calcBoxDelta(\n delta: Delta,\n source: Box,\n target: Box,\n origin?: ResolvedValues\n): void {\n calcAxisDelta(\n delta.x,\n source.x,\n target.x,\n origin ? (origin.originX as number) : undefined\n )\n calcAxisDelta(\n delta.y,\n source.y,\n target.y,\n origin ? (origin.originY as number) : undefined\n )\n}\n\nexport function calcRelativeAxis(target: Axis, relative: Axis, parent: Axis) {\n target.min = parent.min + relative.min\n target.max = target.min + calcLength(relative)\n}\n\nexport function calcRelativeBox(target: Box, relative: Box, parent: Box) {\n calcRelativeAxis(target.x, relative.x, parent.x)\n calcRelativeAxis(target.y, relative.y, parent.y)\n}\n\nexport function calcRelativeAxisPosition(\n target: Axis,\n layout: Axis,\n parent: Axis\n) {\n target.min = layout.min - parent.min\n target.max = target.min + calcLength(layout)\n}\n\nexport function calcRelativePosition(target: Box, layout: Box, parent: Box) {\n calcRelativeAxisPosition(target.x, layout.x, parent.x)\n calcRelativeAxisPosition(target.y, layout.y, parent.y)\n}\n"],"names":[],"mappings":";;AAIA,MAAM,eAAe,GAAG,MAAM,CAAA;AAC9B,MAAM,SAAS,GAAG,CAAC,GAAG,eAAe,CAAA;AACrC,MAAM,S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AC;SAEe,oBAAoB,CAAC,MAAW,EAAE,MAAW,EAAE,MAAW,EAAA;AACtE,IAAA,wBAAwB,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AACtD,IAAA,wBAAwB,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AAC1D;;;;"}
1
+ {"version":3,"file":"delta-calc.mjs","sources":["../../../../src/projection/geometry/delta-calc.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { ResolvedValues } from \"../../render/types\"\n\nconst SCALE_PRECISION = 0.0001\nconst SCALE_MIN = 1 - SCALE_PRECISION\nconst SCALE_MAX = 1 + SCALE_PRECISION\nconst TRANSLATE_PRECISION = 0.01\nconst TRANSLATE_MIN = 0 - TRANSLATE_PRECISION\nconst TRANSLATE_MAX = 0 + TRANSLATE_PRECISION\n\nexport function calcLength(axis: Axis) {\n return axis.max - axis.min\n}\n\nexport function isNear(\n value: number,\n target: number,\n maxDistance: number\n): boolean {\n return Math.abs(value - target) <= maxDistance\n}\n\nexport function calcAxisDelta(\n delta: AxisDelta,\n source: Axis,\n target: Axis,\n origin: number = 0.5\n) {\n delta.origin = origin\n delta.originPoint = mixNumber(source.min, source.max, delta.origin)\n delta.scale = calcLength(target) / calcLength(source)\n delta.translate =\n mixNumber(target.min, target.max, delta.origin) - delta.originPoint\n\n if (\n (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) ||\n isNaN(delta.scale)\n ) {\n delta.scale = 1.0\n }\n\n if (\n (delta.translate >= TRANSLATE_MIN &&\n delta.translate <= TRANSLATE_MAX) ||\n isNaN(delta.translate)\n ) {\n delta.translate = 0.0\n }\n}\n\nexport function calcBoxDelta(\n delta: Delta,\n source: Box,\n target: Box,\n origin?: ResolvedValues\n): void {\n calcAxisDelta(\n delta.x,\n source.x,\n target.x,\n origin ? (origin.originX as number) : undefined\n )\n calcAxisDelta(\n delta.y,\n source.y,\n target.y,\n origin ? (origin.originY as number) : undefined\n )\n}\n\nexport function calcRelativeAxis(target: Axis, relative: Axis, parent: Axis) {\n target.min = parent.min + relative.min\n target.max = target.min + calcLength(relative)\n}\n\nexport function calcRelativeBox(target: Box, relative: Box, parent: Box) {\n calcRelativeAxis(target.x, relative.x, parent.x)\n calcRelativeAxis(target.y, relative.y, parent.y)\n}\n\nexport function calcRelativeAxisPosition(\n target: Axis,\n layout: Axis,\n parent: Axis\n) {\n target.min = layout.min - parent.min\n target.max = target.min + calcLength(layout)\n}\n\nexport function calcRelativePosition(target: Box, layout: Box, parent: Box) {\n calcRelativeAxisPosition(target.x, layout.x, parent.x)\n calcRelativeAxisPosition(target.y, layout.y, parent.y)\n}\n"],"names":[],"mappings":";;AAIA,MAAM,eAAe,GAAG,MAAM;AAC9B,MAAM,SAAS,GAAG,CAAC,GAAG,eAAe;AACrC,MAAM,SAAS,GAAG,CAAC,GAAG,eAAe;AACrC,MAAM,mBAAmB,GAAG,IAAI;AAChC,MAAM,aAAa,GAAG,CAAC,GAAG,mBAAmB;AAC7C,MAAM,aAAa,GAAG,CAAC,GAAG,mBAAmB;AAEvC,SAAU,UAAU,CAAC,IAAU,EAAA;AACjC,IAAA,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG;AAC9B;SAEgB,MAAM,CAClB,KAAa,EACb,MAAc,EACd,WAAmB,EAAA;IAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,WAAW;AAClD;AAEM,SAAU,aAAa,CACzB,KAAgB,EAChB,MAAY,EACZ,MAAY,EACZ,MAAA,GAAiB,GAAG,EAAA;AAEpB,IAAA,KAAK,CAAC,MAAM,GAAG,MAAM;AACrB,IAAA,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MA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AC;AAClD;SAEgB,eAAe,CAAC,MAAW,EAAE,QAAa,EAAE,MAAW,EAAA;AACnE,IAAA,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAChD,IAAA,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACpD;SAEgB,wBAAwB,CACpC,MAAY,EACZ,MAAY,EACZ,MAAY,EAAA;IAEZ,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG;IACpC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC;AAChD;SAEgB,oBAAoB,CAAC,MAAW,EAAE,MAAW,EAAE,MAAW,EAAA;AACtE,IAAA,wBAAwB,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,IAAA,wBAAwB,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1D;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"delta-remove.mjs","sources":["../../../../src/projection/geometry/delta-remove.ts"],"sourcesContent":["import { Axis, Box } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { percent } from \"../../value/types/numbers/units\"\nimport { ResolvedValues } from \"../../render/types\"\nimport { scalePoint } from \"./delta-apply\"\n\n/**\n * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse\n */\nexport function removePointDelta(\n point: number,\n translate: number,\n scale: number,\n originPoint: number,\n boxScale?: number\n): number {\n point -= translate\n point = scalePoint(point, 1 / scale, originPoint)\n\n if (boxScale !== undefined) {\n point = scalePoint(point, 1 / boxScale, originPoint)\n }\n\n return point\n}\n\n/**\n * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse\n */\nexport function removeAxisDelta(\n axis: Axis,\n translate: number | string = 0,\n scale: number = 1,\n origin: number = 0.5,\n boxScale?: number,\n originAxis: Axis = axis,\n sourceAxis: Axis = axis\n): void {\n if (percent.test(translate)) {\n translate = parseFloat(translate as string)\n const relativeProgress = mixNumber(\n sourceAxis.min,\n sourceAxis.max,\n translate / 100\n )\n translate = relativeProgress - sourceAxis.min\n }\n\n if (typeof translate !== \"number\") return\n\n let originPoint = mixNumber(originAxis.min, originAxis.max, origin)\n if (axis === originAxis) originPoint -= translate\n\n axis.min = removePointDelta(\n axis.min,\n translate,\n scale,\n originPoint,\n boxScale\n )\n\n axis.max = removePointDelta(\n axis.max,\n translate,\n scale,\n originPoint,\n boxScale\n )\n}\n\n/**\n * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nexport function removeAxisTransforms(\n axis: Axis,\n transforms: ResolvedValues,\n [key, scaleKey, originKey]: string[],\n origin?: Axis,\n sourceAxis?: Axis\n) {\n removeAxisDelta(\n axis,\n transforms[key] as number,\n transforms[scaleKey] as number,\n transforms[originKey] as number,\n transforms.scale as number,\n origin,\n sourceAxis\n )\n}\n\n/**\n * The names of the motion values we want to apply as translation, scale and origin.\n */\nconst xKeys = [\"x\", \"scaleX\", \"originX\"]\nconst yKeys = [\"y\", \"scaleY\", \"originY\"]\n\n/**\n * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nexport function removeBoxTransforms(\n box: Box,\n transforms: ResolvedValues,\n originBox?: Box,\n sourceBox?: Box\n): void {\n removeAxisTransforms(\n box.x,\n transforms,\n xKeys,\n originBox ? originBox.x : undefined,\n sourceBox ? sourceBox.x : undefined\n )\n removeAxisTransforms(\n box.y,\n transforms,\n yKeys,\n originBox ? originBox.y : undefined,\n sourceBox ? sourceBox.y : undefined\n )\n}\n"],"names":[],"mappings":";;;;AAMA;;AAE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AAG,GAAG,gBAAgB,CACvB,IAAI,CAAC,GAAG,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,CACX,CAAA;AACL,CAAC;AAED;;;AAGG;SACa,oBAAoB,CAChC,IAAU,EACV,UAA0B,EAC1B,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAW,EACpC,MAAa,EACb,UAAiB,EAAA;IAEjB,eAAe,CACX,IAAI,EACJ,UAAU,CAAC,GAAG,CAAW,EACzB,UAAU,CAAC,QAAQ,CAAW,EAC9B,UAAU,CAAC,SAAS,CAAW,EAC/B,UAAU,CAAC,KAAe,EAC1B,MAAM,EACN,UAAU,CACb,CAAA;AACL,CAAC;AAED;;AAEG;AACH,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AACxC,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAExC;;;AAGG;AACG,SAAU,mBAAmB,CAC/B,GAAQ,EACR,UAA0B,EAC1B,SAAe,EACf,SAAe,EAAA;AAEf,IAAA,oBAAoB,CAChB,GAAG,CAAC,CAAC,EACL,UAAU,EACV,KAAK,EACL,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,EACnC,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CACtC,CAAA;AACD,IAAA,oBAAoB,CAChB,GAAG,CAAC,CAAC,EACL,UAAU,EACV,KAAK,EACL,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,EACnC,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CACtC,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"delta-remove.mjs","sources":["../../../../src/projection/geometry/delta-remove.ts"],"sourcesContent":["import { Axis, Box } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { percent } from \"../../value/types/numbers/units\"\nimport { ResolvedValues } from \"../../render/types\"\nimport { scalePoint } from \"./delta-apply\"\n\n/**\n * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse\n */\nexport function removePointDelta(\n point: number,\n translate: number,\n scale: number,\n originPoint: number,\n boxScale?: number\n): number {\n point -= translate\n point = scalePoint(point, 1 / scale, originPoint)\n\n if (boxScale !== undefined) {\n point = scalePoint(point, 1 / boxScale, originPoint)\n }\n\n return point\n}\n\n/**\n * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse\n */\nexport function removeAxisDelta(\n axis: Axis,\n translate: number | string = 0,\n scale: number = 1,\n origin: number = 0.5,\n boxScale?: number,\n originAxis: Axis = axis,\n sourceAxis: Axis = axis\n): void {\n if (percent.test(translate)) {\n translate = parseFloat(translate as string)\n const relativeProgress = mixNumber(\n sourceAxis.min,\n sourceAxis.max,\n translate / 100\n )\n translate = relativeProgress - sourceAxis.min\n }\n\n if (typeof translate !== \"number\") return\n\n let originPoint = mixNumber(originAxis.min, originAxis.max, origin)\n if (axis === originAxis) originPoint -= translate\n\n axis.min = removePointDelta(\n axis.min,\n translate,\n scale,\n originPoint,\n boxScale\n )\n\n axis.max = removePointDelta(\n axis.max,\n translate,\n scale,\n originPoint,\n boxScale\n )\n}\n\n/**\n * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nexport function removeAxisTransforms(\n axis: Axis,\n transforms: ResolvedValues,\n [key, scaleKey, originKey]: string[],\n origin?: Axis,\n sourceAxis?: Axis\n) {\n removeAxisDelta(\n axis,\n transforms[key] as number,\n transforms[scaleKey] as number,\n transforms[originKey] as number,\n transforms.scale as number,\n origin,\n sourceAxis\n )\n}\n\n/**\n * The names of the motion values we want to apply as translation, scale and origin.\n */\nconst xKeys = [\"x\", \"scaleX\", \"originX\"]\nconst yKeys = [\"y\", \"scaleY\", \"originY\"]\n\n/**\n * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nexport function removeBoxTransforms(\n box: Box,\n transforms: ResolvedValues,\n originBox?: Box,\n sourceBox?: Box\n): void {\n removeAxisTransforms(\n box.x,\n transforms,\n xKeys,\n originBox ? originBox.x : undefined,\n sourceBox ? sourceBox.x : undefined\n )\n removeAxisTransforms(\n box.y,\n transforms,\n yKeys,\n originBox ? originBox.y : undefined,\n sourceBox ? sourceBox.y : undefined\n )\n}\n"],"names":[],"mappings":";;;;AAMA;;AAEG;AACG,SAAU,gBAAgB,CAC5B,KAAa,EACb,SAAiB,EACjB,KAAa,EACb,WAAmB,EACnB,QAAiB,EAAA;IAEjB,KAAK,IAAI,SAAS;IAClB,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,WAAW,CAAC;AAEjD,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,QAAQ,EAAE,WAAW,CAAC;IACxD;AAEA,IAAA,OAAO,KAAK;AAChB;AAEA;;AAEG;AACG,SAAU,eAAe,CAC3B,IAAU,EACV,SAAA,GAA6B,CAAC,EAC9B,KAAA,GAAgB,CAAC,EACjB,MAAA,GAAiB,GAAG,EACpB,QAAiB,EACjB,aAAmB,IAAI,EACvB,aAAmB,IAAI,EAAA;AAEvB,IAAA,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACzB,QAAA,SAAS,GAAG,UAAU,CAAC,SAAmB,CAAC;AAC3C,QAAA,MAAM,gBAAgB,GAAG,SAAS,CAC9B,UAAU,CAAC,GAAG,EACd,UAAU,CAAC,GAAG,EACd,SAAS,GAAG,GAAG,CAClB;AACD,QAAA,SAAS,GAAG,gBAAgB,GAAG,UAAU,CAAC,GAAG;IACjD;IAEA,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE;AAEnC,IAAA,IAAI,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;I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/projection/geometry/models.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\n\nexport const createAxisDelta = (): AxisDelta => ({\n translate: 0,\n scale: 1,\n origin: 0,\n originPoint: 0,\n})\n\nexport const createDelta = (): Delta => ({\n x: createAxisDelta(),\n y: createAxisDelta(),\n})\n\nexport const createAxis = (): Axis => ({ min: 0, max: 0 })\n\nexport const createBox = (): Box => ({\n x: createAxis(),\n y: createAxis(),\n})\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,GAAG,OAAkB;AAC7C,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,WAAW,EAAE,CAAC;AACjB,CAAA,EAAC;AAEW,MAAA,WAAW,GAAG,OAAc;IACrC,CAAC,EAAE,eAAe,EAAE;IACpB,CAAC,EAAE,eAAe,EAAE;AACvB,CAAA,EAAC;AAEW,MAAA,UAAU,GAAG,OAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAC;AAE7C,MAAA,SAAS,GAAG,OAAY;IACjC,CAAC,EAAE,UAAU,EAAE;IACf,CAAC,EAAE,UAAU,EAAE;AAClB,CAAA;;;;"}
1
+ {"version":3,"file":"models.mjs","sources":["../../../../src/projection/geometry/models.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\n\nexport const createAxisDelta = (): AxisDelta => ({\n translate: 0,\n scale: 1,\n origin: 0,\n originPoint: 0,\n})\n\nexport const createDelta = (): Delta => ({\n x: createAxisDelta(),\n y: createAxisDelta(),\n})\n\nexport const createAxis = (): Axis => ({ min: 0, max: 0 })\n\nexport const createBox = (): Box => ({\n x: createAxis(),\n y: createAxis(),\n})\n"],"names":[],"mappings":"AAEO,MAAM,eAAe,GAAG,OAAkB;AAC7C,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,WAAW,EAAE,CAAC;AACjB,CAAA;AAEM,MAAM,WAAW,GAAG,OAAc;IACrC,CAAC,EAAE,eAAe,EAAE;IACpB,CAAC,EAAE,eAAe,EAAE;AACvB,CAAA;AAEM,MAAM,UAAU,GAAG,OAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;AAElD,MAAM,SAAS,GAAG,OAAY;IACjC,CAAC,EAAE,UAAU,EAAE;IACf,CAAC,EAAE,UAAU,EAAE;AAClB,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../src/projection/geometry/utils.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\nimport { calcLength } from \"./delta-calc\"\n\nfunction isAxisDeltaZero(delta: AxisDelta) {\n return delta.translate === 0 && delta.scale === 1\n}\n\nexport function isDeltaZero(delta: Delta) {\n return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y)\n}\n\nexport function axisEquals(a: Axis, b: Axis) {\n return a.min === b.min && a.max === b.max\n}\n\nexport function boxEquals(a: Box, b: Box) {\n return axisEquals(a.x, b.x) && axisEquals(a.y, b.y)\n}\n\nexport function axisEqualsRounded(a: Axis, b: Axis) {\n return (\n Math.round(a.min) === Math.round(b.min) &&\n Math.round(a.max) === Math.round(b.max)\n )\n}\n\nexport function boxEqualsRounded(a: Box, b: Box) {\n return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y)\n}\n\nexport function aspectRatio(box: Box): number {\n return calcLength(box.x) / calcLength(box.y)\n}\n\nexport function axisDeltaEquals(a: AxisDelta, b: AxisDelta) {\n return (\n a.translate === b.translate &&\n a.scale === b.scale &&\n a.originPoint === b.originPoint\n )\n}\n"],"names":[],"mappings":";;AAGA,SAAS,eAAe,CAAC,KAAgB,EAAA;IACrC,OAAO,KAAK,CAAC,SAAS,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,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Ae,CAAC,CAAY,EAAE,CAAY,EAAA;AACtD,IAAA,QACI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;AAC3B,QAAA,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;AACnB,QAAA,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW,EAClC;AACL;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../src/projection/geometry/utils.ts"],"sourcesContent":["import { Axis, AxisDelta, Box, Delta } from \"motion-utils\"\nimport { calcLength } from \"./delta-calc\"\n\nfunction isAxisDeltaZero(delta: AxisDelta) {\n return delta.translate === 0 && delta.scale === 1\n}\n\nexport function isDeltaZero(delta: Delta) {\n return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y)\n}\n\nexport function axisEquals(a: Axis, b: Axis) {\n return a.min === b.min && a.max === b.max\n}\n\nexport function boxEquals(a: Box, b: Box) {\n return axisEquals(a.x, b.x) && axisEquals(a.y, b.y)\n}\n\nexport function axisEqualsRounded(a: Axis, b: Axis) {\n return (\n Math.round(a.min) === Math.round(b.min) &&\n Math.round(a.max) === Math.round(b.max)\n )\n}\n\nexport function boxEqualsRounded(a: Box, b: Box) {\n return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y)\n}\n\nexport function aspectRatio(box: Box): number {\n return calcLength(box.x) / calcLength(box.y)\n}\n\nexport function axisDeltaEquals(a: AxisDelta, b: AxisDelta) {\n return (\n a.translate === b.translate &&\n a.scale === b.scale &&\n a.originPoint === b.originPoint\n )\n}\n"],"names":[],"mappings":";;AAGA,SAAS,eAAe,CAAC,KAAgB,EAAA;IACrC,OAAO,KAAK,CAAC,SAAS,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC;AACrD;AAEM,SAAU,WAAW,CAAC,KAAY,EAAA;AACpC,IAAA,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;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1 +1 @@
1
- {"version":3,"file":"HTMLProjectionNode.mjs","sources":["../../../../src/projection/node/HTMLProjectionNode.ts"],"sourcesContent":["import { createProjectionNode } from \"./create-projection-node\"\nimport { DocumentProjectionNode } from \"./DocumentProjectionNode\"\nimport { IProjectionNode } from \"./types\"\n\nexport const rootProjectionNode: { current: IProjectionNode | undefined } = {\n current: undefined,\n}\n\nexport const HTMLProjectionNode = createProjectionNode<HTMLElement>({\n measureScroll: (instance) => ({\n x: instance.scrollLeft,\n y: instance.scrollTop,\n }),\n defaultParent: () => {\n if (!rootProjectionNode.current) {\n const documentNode = new DocumentProjectionNode({})\n documentNode.mount(window)\n documentNode.setOptions({ layoutScroll: true })\n rootProjectionNode.current = documentNode\n }\n return rootProjectionNode.current\n },\n resetTransform: (instance, value) => {\n instance.style.transform = value !== undefined ? value : \"none\"\n },\n checkIsScrollRoot: (instance) =>\n Boolean(window.getComputedStyle(instance).position === \"fixed\"),\n})\n"],"names":[],"mappings":";;;AAIa,MAAA,kBAAkB,GAA6C;AACxE,IAAA,OAAO,EAAE,SAAS;EACrB;AAEM,MAAM,kBAAkB,GAAG,oBAAoB,CAAc;AAChE,IAAA,aAAa,EAAE,CAAC,QAAQ,MAAM;QAC1B,CAAC,EAAE,QAAQ,CAAC,UAAU;QACtB,CAAC,EAAE,QAAQ,CAAC,SAAS;KACxB,CAAC;IACF,aAAa,EAAE,MAAK;AAChB,QAAA,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;AAC7B,YAAA,MAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,EAAE,CAAC,CAAA;AACnD,YAAA,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAC1B,YAAY,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;AAC/C,YAAA,kBAAkB,CAAC,OAAO,GAAG,YAAY,CAAA;SAC5C;QACD,OAAO,kBAAkB,CAAC,OAAO,CAAA;KACpC;AACD,IAAA,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAI;AAChC,QAAA,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,KAAK,SAAS,GAAG,KAAK,GAAG,MAAM,CAAA;KAClE;AACD,IAAA,iBAAiB,EAAE,CAAC,QAAQ,KACxB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtE,CAAA;;;;"}
1
+ {"version":3,"file":"HTMLProjectionNode.mjs","sources":["../../../../src/projection/node/HTMLProjectionNode.ts"],"sourcesContent":["import { createProjectionNode } from \"./create-projection-node\"\nimport { DocumentProjectionNode } from \"./DocumentProjectionNode\"\nimport { IProjectionNode } from \"./types\"\n\nexport const rootProjectionNode: { current: IProjectionNode | undefined } = {\n current: undefined,\n}\n\nexport const HTMLProjectionNode = createProjectionNode<HTMLElement>({\n measureScroll: (instance) => ({\n x: instance.scrollLeft,\n y: instance.scrollTop,\n }),\n defaultParent: () => {\n if (!rootProjectionNode.current) {\n const documentNode = new DocumentProjectionNode({})\n documentNode.mount(window)\n documentNode.setOptions({ layoutScroll: true })\n rootProjectionNode.current = documentNode\n }\n return rootProjectionNode.current\n },\n resetTransform: (instance, value) => {\n instance.style.transform = value !== undefined ? value : \"none\"\n },\n checkIsScrollRoot: (instance) =>\n Boolean(window.getComputedStyle(instance).position === \"fixed\"),\n})\n"],"names":[],"mappings":";;;AAIO,MAAM,kBAAkB,GAA6C;AACxE,IAAA,OAAO,EAAE,SAAS;;AAGf,MAAM,kBAAkB,GAAG,oBAAoB,CAAc;AAChE,IAAA,aAAa,EAAE,CAAC,QAAQ,MAAM;QAC1B,CAAC,EAAE,QAAQ,CAAC,UAAU;QACtB,CAAC,EAAE,QAAQ,CAAC,SAAS;KACxB,CAAC;IACF,aAAa,EAAE,MAAK;AAChB,QAAA,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;AAC7B,YAAA,MAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,EAAE,CAAC;AACnD,YAAA,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;YAC1B,YAAY,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC/C,YAAA,kBAAkB,CAAC,OAAO,GAAG,YAAY;QAC7C;QACA,OAAO,kBAAkB,CAAC,OAAO;IACrC,CAAC;AACD,IAAA,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAI;AAChC,QAAA,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,KAAK,SAAS,GAAG,KAAK,GAAG,MAAM;IACnE,CAAC;AACD,IAAA,iBAAiB,EAAE,CAAC,QAAQ,KACxB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtE,CAAA;;;;"}
@@ -19,7 +19,7 @@ import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../
19
19
  import { calcLength, calcRelativeBox, calcRelativePosition, calcBoxDelta, isNear } from '../geometry/delta-calc.mjs';
20
20
  import { removeBoxTransforms } from '../geometry/delta-remove.mjs';
21
21
  import { createBox, createDelta } from '../geometry/models.mjs';
22
- import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, aspectRatio, boxEquals } from '../geometry/utils.mjs';
22
+ import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, boxEquals, aspectRatio } from '../geometry/utils.mjs';
23
23
  import { NodeStack } from '../shared/stack.mjs';
24
24
  import { buildProjectionTransform } from '../styles/transform.mjs';
25
25
  import { eachAxis } from '../utils/each-axis.mjs';