motion-start 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +39 -0
  3. package/package.json +64 -0
  4. package/src/animation/UseAnimatedState.svelte +86 -0
  5. package/src/animation/UseAnimation.svelte +61 -0
  6. package/src/animation/animate.ts +78 -0
  7. package/src/animation/animation-controls.ts +101 -0
  8. package/src/animation/types.ts +83 -0
  9. package/src/animation/use-animated-state.ts +1 -0
  10. package/src/animation/use-animation.ts +74 -0
  11. package/src/animation/utils/default-transitions.ts +70 -0
  12. package/src/animation/utils/easing.ts +55 -0
  13. package/src/animation/utils/is-animatable.ts +42 -0
  14. package/src/animation/utils/is-animation-controls.ts +17 -0
  15. package/src/animation/utils/is-keyframes-target.ts +17 -0
  16. package/src/animation/utils/transitions.ts +218 -0
  17. package/src/animation/utils/variant-resolvers.ts +15 -0
  18. package/src/components/AnimatePresence/AnimatePresence.svelte +180 -0
  19. package/src/components/AnimatePresence/PresenceChild/PresenceChild.svelte +78 -0
  20. package/src/components/AnimatePresence/PresenceChild/index.ts +7 -0
  21. package/src/components/AnimatePresence/PresenceChild/types.ts +10 -0
  22. package/src/components/AnimatePresence/index.ts +46 -0
  23. package/src/components/AnimatePresence/types.ts +79 -0
  24. package/src/components/AnimatePresence/use-presence.ts +90 -0
  25. package/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte +239 -0
  26. package/src/components/AnimateSharedLayout/index.ts +11 -0
  27. package/src/components/AnimateSharedLayout/types.ts +111 -0
  28. package/src/components/AnimateSharedLayout/utils/batcher.ts +96 -0
  29. package/src/components/AnimateSharedLayout/utils/crossfader.ts +260 -0
  30. package/src/components/AnimateSharedLayout/utils/rotate.ts +48 -0
  31. package/src/components/AnimateSharedLayout/utils/stack.ts +160 -0
  32. package/src/components/LazyMotion/LazyMotion.svelte +82 -0
  33. package/src/components/LazyMotion/index.ts +42 -0
  34. package/src/components/LazyMotion/types.ts +58 -0
  35. package/src/components/MotionConfig/MotionConfig.svelte +56 -0
  36. package/src/components/MotionConfig/MotionConfigScaleCorrection.ts +47 -0
  37. package/src/components/MotionConfig/index.ts +20 -0
  38. package/src/components/MotionDiv.svelte +8 -0
  39. package/src/context/DOMcontext.ts +21 -0
  40. package/src/context/LayoutGroupContext.ts +13 -0
  41. package/src/context/LazyContext.ts +18 -0
  42. package/src/context/MotionConfigContext.ts +48 -0
  43. package/src/context/MotionContext/MotionContext.svelte +27 -0
  44. package/src/context/MotionContext/MotionContextProvider.svelte +22 -0
  45. package/src/context/MotionContext/UseCreateMotionContext.svelte +34 -0
  46. package/src/context/MotionContext/create.ts +1 -0
  47. package/src/context/MotionContext/index.ts +14 -0
  48. package/src/context/MotionContext/utils.ts +29 -0
  49. package/src/context/PresenceContext.ts +26 -0
  50. package/src/context/ScaleCorrectionProvider.svelte +27 -0
  51. package/src/context/SharedLayoutContext.ts +29 -0
  52. package/src/events/UseDomEvent.svelte +67 -0
  53. package/src/events/UsePointerEvent.svelte +76 -0
  54. package/src/events/event-info.ts +69 -0
  55. package/src/events/types.ts +15 -0
  56. package/src/events/use-dom-event.ts +48 -0
  57. package/src/events/use-pointer-event.ts +29 -0
  58. package/src/events/utils.ts +25 -0
  59. package/src/gestures/PanSession.ts +298 -0
  60. package/src/gestures/UseFocusGesture.svelte +31 -0
  61. package/src/gestures/UseGestures.svelte +17 -0
  62. package/src/gestures/UseHoverGesture.svelte +40 -0
  63. package/src/gestures/UsePanGesture.svelte +58 -0
  64. package/src/gestures/UseTapGesture.svelte +77 -0
  65. package/src/gestures/drag/UseDrag.svelte +55 -0
  66. package/src/gestures/drag/UseDragControls.svelte +145 -0
  67. package/src/gestures/drag/VisualElementDragControls.ts +632 -0
  68. package/src/gestures/drag/types.ts +307 -0
  69. package/src/gestures/drag/use-drag-controls.ts +148 -0
  70. package/src/gestures/drag/use-drag.ts +15 -0
  71. package/src/gestures/drag/utils/constraints.ts +157 -0
  72. package/src/gestures/drag/utils/lock.ts +69 -0
  73. package/src/gestures/types.ts +257 -0
  74. package/src/gestures/use-focus-gesture.ts +16 -0
  75. package/src/gestures/use-gestures.ts +2 -0
  76. package/src/gestures/use-hover-gesture.ts +10 -0
  77. package/src/gestures/use-pan-gesture.ts +22 -0
  78. package/src/gestures/use-tap-gesture.ts +14 -0
  79. package/src/gestures/utils/event-type.ts +24 -0
  80. package/src/gestures/utils/is-node-or-child.ts +31 -0
  81. package/src/index.ts +104 -0
  82. package/src/motion/Motion.svelte +246 -0
  83. package/src/motion/MotionSSR.svelte +244 -0
  84. package/src/motion/features/AnimationState.svelte +29 -0
  85. package/src/motion/features/Exit.svelte +32 -0
  86. package/src/motion/features/UseFeatures.svelte +39 -0
  87. package/src/motion/features/animations.ts +22 -0
  88. package/src/motion/features/definitions.ts +49 -0
  89. package/src/motion/features/drag.ts +24 -0
  90. package/src/motion/features/gestures.ts +24 -0
  91. package/src/motion/features/layout/Animate.svelte +314 -0
  92. package/src/motion/features/layout/Animate.ts +9 -0
  93. package/src/motion/features/layout/AnimateLayoutContextProvider.svelte +14 -0
  94. package/src/motion/features/layout/Measure.svelte +98 -0
  95. package/src/motion/features/layout/Measure.ts +9 -0
  96. package/src/motion/features/layout/MeasureContextProvider.svelte +32 -0
  97. package/src/motion/features/layout/index.ts +20 -0
  98. package/src/motion/features/layout/types.ts +71 -0
  99. package/src/motion/features/layout/utils.ts +40 -0
  100. package/src/motion/features/types.ts +53 -0
  101. package/src/motion/features/use-features.ts +16 -0
  102. package/src/motion/index.ts +64 -0
  103. package/src/motion/types.ts +278 -0
  104. package/src/motion/utils/UseLayoutId.svelte +18 -0
  105. package/src/motion/utils/UseVisualElement.svelte +104 -0
  106. package/src/motion/utils/UseVisualState.svelte +137 -0
  107. package/src/motion/utils/is-forced-motion-value.ts +23 -0
  108. package/src/motion/utils/make-renderless-component.ts +17 -0
  109. package/src/motion/utils/should-inhert-variant.ts +6 -0
  110. package/src/motion/utils/use-motion-ref.ts +41 -0
  111. package/src/motion/utils/use-visual-element.ts +13 -0
  112. package/src/motion/utils/use-visual-state.ts +24 -0
  113. package/src/motion/utils/valid-prop.ts +80 -0
  114. package/src/render/dom/M.svelte +16 -0
  115. package/src/render/dom/UseRender.svelte +37 -0
  116. package/src/render/dom/create-motion-class.ts +12 -0
  117. package/src/render/dom/create-visual-element.ts +22 -0
  118. package/src/render/dom/featureBundle.ts +22 -0
  119. package/src/render/dom/motion-minimal.ts +22 -0
  120. package/src/render/dom/motion-proxy.ts +107 -0
  121. package/src/render/dom/motion.ts +62 -0
  122. package/src/render/dom/projection/convert-to-relative.ts +40 -0
  123. package/src/render/dom/projection/default-scale-correctors.ts +138 -0
  124. package/src/render/dom/projection/measure.ts +28 -0
  125. package/src/render/dom/projection/relative-set.ts +27 -0
  126. package/src/render/dom/projection/scale-correction.ts +22 -0
  127. package/src/render/dom/projection/types.ts +13 -0
  128. package/src/render/dom/projection/utils.ts +69 -0
  129. package/src/render/dom/svg-visual-element.ts +114 -0
  130. package/src/render/dom/types.ts +32 -0
  131. package/src/render/dom/use-render.ts +11 -0
  132. package/src/render/dom/utils/UseInitialMotionProps.svelte +26 -0
  133. package/src/render/dom/utils/batch-layout.ts +77 -0
  134. package/src/render/dom/utils/camel-to-dash.ts +20 -0
  135. package/src/render/dom/utils/create-config.ts +33 -0
  136. package/src/render/dom/utils/css-variables-conversion.ts +121 -0
  137. package/src/render/dom/utils/filter-props.ts +55 -0
  138. package/src/render/dom/utils/is-css-variable.ts +18 -0
  139. package/src/render/dom/utils/is-svg-component.ts +41 -0
  140. package/src/render/dom/utils/parse-dom-variant.ts +26 -0
  141. package/src/render/dom/utils/unit-conversion.ts +258 -0
  142. package/src/render/dom/utils/use-html-props.ts +2 -0
  143. package/src/render/dom/utils/use-svg-props.ts +1 -0
  144. package/src/render/dom/value-types/animatable-none.ts +24 -0
  145. package/src/render/dom/value-types/defaults.ts +30 -0
  146. package/src/render/dom/value-types/dimensions.ts +27 -0
  147. package/src/render/dom/value-types/find.ts +31 -0
  148. package/src/render/dom/value-types/get-as-type.ts +21 -0
  149. package/src/render/dom/value-types/number.ts +83 -0
  150. package/src/render/dom/value-types/test.ts +17 -0
  151. package/src/render/dom/value-types/type-auto.ts +21 -0
  152. package/src/render/dom/value-types/type-int.ts +23 -0
  153. package/src/render/dom/value-types/types.ts +8 -0
  154. package/src/render/html/UseHTMLProps.svelte +33 -0
  155. package/src/render/html/UseInitialMotionValues.svelte +27 -0
  156. package/src/render/html/UseStyle.svelte +47 -0
  157. package/src/render/html/config-motion.ts +23 -0
  158. package/src/render/html/supported-elements.ts +10 -0
  159. package/src/render/html/types.ts +64 -0
  160. package/src/render/html/use-props.ts +14 -0
  161. package/src/render/html/utils/build-projection-transform.ts +53 -0
  162. package/src/render/html/utils/build-styles.ts +121 -0
  163. package/src/render/html/utils/build-transform.ts +79 -0
  164. package/src/render/html/utils/create-render-state.ts +18 -0
  165. package/src/render/html/utils/render.ts +22 -0
  166. package/src/render/html/utils/scrape-motion-values.ts +26 -0
  167. package/src/render/html/utils/transform.ts +51 -0
  168. package/src/render/html/visual-element.ts +129 -0
  169. package/src/render/index.ts +703 -0
  170. package/src/render/svg/UseSVGProps.svelte +34 -0
  171. package/src/render/svg/config-motion.ts +51 -0
  172. package/src/render/svg/lowercase-elements.ts +35 -0
  173. package/src/render/svg/supported-elements.ts +10 -0
  174. package/src/render/svg/types.ts +51 -0
  175. package/src/render/svg/use-props.ts +14 -0
  176. package/src/render/svg/utils/build-attrs.ts +58 -0
  177. package/src/render/svg/utils/camel-case-attrs.ts +27 -0
  178. package/src/render/svg/utils/create-render-state.ts +17 -0
  179. package/src/render/svg/utils/path.ts +49 -0
  180. package/src/render/svg/utils/render.ts +22 -0
  181. package/src/render/svg/utils/scrape-motion-values.ts +26 -0
  182. package/src/render/svg/utils/transform-origin.ts +30 -0
  183. package/src/render/svg/visual-element.ts +44 -0
  184. package/src/render/types.ts +148 -0
  185. package/src/render/utils/animation-state.ts +375 -0
  186. package/src/render/utils/animation.ts +167 -0
  187. package/src/render/utils/compare-by-depth.ts +18 -0
  188. package/src/render/utils/flat-tree.ts +35 -0
  189. package/src/render/utils/is-draggable.ts +17 -0
  190. package/src/render/utils/lifecycles.ts +172 -0
  191. package/src/render/utils/motion-values.ts +59 -0
  192. package/src/render/utils/projection.ts +38 -0
  193. package/src/render/utils/setters.ts +910 -0
  194. package/src/render/utils/state.ts +113 -0
  195. package/src/render/utils/types.ts +12 -0
  196. package/src/render/utils/variants.ts +76 -0
  197. package/src/types/geometry.ts +91 -0
  198. package/src/types.ts +1088 -0
  199. package/src/utils/UseUnmountEffect.svelte +11 -0
  200. package/src/utils/array.ts +18 -0
  201. package/src/utils/each-axis.ts +15 -0
  202. package/src/utils/errors.ts +22 -0
  203. package/src/utils/fix-process-env.ts +22 -0
  204. package/src/utils/geometry/delta-apply.ts +162 -0
  205. package/src/utils/geometry/delta-calc.ts +89 -0
  206. package/src/utils/geometry/index.ts +83 -0
  207. package/src/utils/is-browser.ts +12 -0
  208. package/src/utils/is-numerical-string.ts +15 -0
  209. package/src/utils/is-ref-object.ts +16 -0
  210. package/src/utils/noop.ts +15 -0
  211. package/src/utils/resolve-value.ts +23 -0
  212. package/src/utils/shallow-compare.ts +23 -0
  213. package/src/utils/subscription-manager.ts +49 -0
  214. package/src/utils/time-conversion.ts +18 -0
  215. package/src/utils/transform.ts +120 -0
  216. package/src/utils/use-constant.ts +23 -0
  217. package/src/utils/use-cycle.ts +78 -0
  218. package/src/utils/use-force-update.ts +7 -0
  219. package/src/utils/use-isomorphic-effect.ts +8 -0
  220. package/src/utils/use-reduced-motion.ts +70 -0
  221. package/src/utils/use-unmount-effect.ts +8 -0
  222. package/src/value/index.ts +409 -0
  223. package/src/value/scroll/use-element-scroll.ts +73 -0
  224. package/src/value/scroll/use-viewport-scroll.ts +81 -0
  225. package/src/value/scroll/utils.ts +76 -0
  226. package/src/value/use-combine-values.ts +53 -0
  227. package/src/value/use-motion-template.ts +57 -0
  228. package/src/value/use-motion-value.ts +27 -0
  229. package/src/value/use-spring.ts +84 -0
  230. package/src/value/use-transform.ts +216 -0
  231. package/src/value/use-velocity.ts +44 -0
  232. package/src/value/utils/is-motion-value.ts +15 -0
  233. package/src/value/utils/resolve-motion-value.ts +29 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ based on framer-motion@4.1.17,
3
+ Copyright (c) 2018 Framer B.V.
4
+ */
5
+ import type { AxisBox2D, BoxDelta, Point2D } from "../../types/geometry.js";
6
+ /**
7
+ * Represents the size and position we want to project a given visual
8
+ * element into.
9
+ */
10
+ export interface TargetProjection {
11
+ /**
12
+ * Whether we should attempt to project into this target box.
13
+ */
14
+ isEnabled: boolean;
15
+ /**
16
+ * Whether we should attempt to project into this target box.
17
+ */
18
+ isHydrated: boolean;
19
+ /**
20
+ * Whether this target box is locked. We might want to lock the box, for
21
+ * instance if the user is dragging or animating it. Otherwise
22
+ * we want to rebase the target box ontop of the measured layout.
23
+ */
24
+ isTargetLocked: boolean;
25
+ /**
26
+ * The parent-relative box we want to derive the viewport box from, if defined.
27
+ * This is currently all relative to the top/left of the parent box,
28
+ * but could be expanded in the future.
29
+ */
30
+ relativeTarget?: AxisBox2D;
31
+ /**
32
+ * The viewport-relative box we want to project the element into.
33
+ */
34
+ target: AxisBox2D;
35
+ /**
36
+ * The viewport-relative box we want to project the element into after
37
+ * it's had x/y/scale transforms applied.
38
+ */
39
+ targetFinal: AxisBox2D;
40
+ }
41
+ /**
42
+ * Data about the element's current layout. Contains the latest measurements
43
+ * as well as the latest calculations of how to project from this layout
44
+ * into a given TargetProjection.
45
+ */
46
+ export interface LayoutState {
47
+ /**
48
+ * Whether we've hydrated this state with the latest measurements.
49
+ */
50
+ isHydrated: boolean;
51
+ /**
52
+ * The latest viewport-box measurements of the element without transforms.
53
+ */
54
+ layout: AxisBox2D;
55
+ /**
56
+ * The measured viewport box as corrected by parent transforms up the
57
+ * visual element tree.
58
+ */
59
+ layoutCorrected: AxisBox2D;
60
+ /**
61
+ * The cumulative tree scale for this element. This starts at 1 per axis.
62
+ * When a transform is applied to an element we also apply it to the tree scale.
63
+ * The final value is used for scale-correcting values like border-radius,
64
+ * as well as ensuring calculated CSS translations are applied to compensate
65
+ * for this scale.
66
+ */
67
+ treeScale: Point2D;
68
+ /**
69
+ * A mutable piece of data that we write into the latest projection calculations
70
+ * that, when applied to an element, will project it from its layoutCorrected
71
+ * box into the provided TargetProjection.target
72
+ */
73
+ delta: BoxDelta;
74
+ /**
75
+ * A mutable piece of data that will project an element from layoutCorrected
76
+ * into TargetProjection.targetFinal.
77
+ */
78
+ deltaFinal: BoxDelta;
79
+ /**
80
+ * The latest generated delta transform. This is used to compare against
81
+ * the previously-generated transform to determine whether we need to trigger
82
+ * a render.
83
+ */
84
+ deltaTransform: string;
85
+ }
86
+
87
+
88
+ /**
89
+ based on framer-motion@4.0.3,
90
+ Copyright (c) 2018 Framer B.V.
91
+ */
92
+ import { axisBox, delta } from '../../utils/geometry/index.js';
93
+
94
+ var createProjectionState = function () { return ({
95
+ isEnabled: false,
96
+ isTargetLocked: false,
97
+ target: axisBox(),
98
+ targetFinal: axisBox(),
99
+ } as TargetProjection); };
100
+ function createLayoutState() {
101
+ return {
102
+ isHydrated: false,
103
+ layout: axisBox(),
104
+ layoutCorrected: axisBox(),
105
+ treeScale: { x: 1, y: 1 },
106
+ delta: delta(),
107
+ deltaFinal: delta(),
108
+ deltaTransform: "",
109
+ } as LayoutState;
110
+ }
111
+ var zeroLayout = createLayoutState();
112
+
113
+ export { createLayoutState, createProjectionState, zeroLayout };
@@ -0,0 +1,12 @@
1
+ /**
2
+ based on framer-motion@4.1.17,
3
+ Copyright (c) 2018 Framer B.V.
4
+ */
5
+ export enum AnimationType {
6
+ Animate = "animate",
7
+ Hover = "whileHover",
8
+ Tap = "whileTap",
9
+ Drag = "whileDrag",
10
+ Focus = "whileFocus",
11
+ Exit = "exit"
12
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ based on framer-motion@4.1.17,
3
+ Copyright (c) 2018 Framer B.V.
4
+ */
5
+ import type { MotionProps } from "../../motion/types";
6
+ import type { TargetAndTransition, TargetResolver } from "../../types";
7
+ import type { ResolvedValues, VisualElement } from "../types";
8
+
9
+
10
+ /**
11
+ based on framer-motion@4.0.3,
12
+ Copyright (c) 2018 Framer B.V.
13
+ */
14
+ /**
15
+ * Decides if the supplied variable is an array of variant labels
16
+ */
17
+ function isVariantLabels(v: unknown): v is string[] {
18
+ return Array.isArray(v);
19
+ }
20
+ /**
21
+ * Decides if the supplied variable is variant label
22
+ */
23
+ function isVariantLabel(v: unknown): v is string | string[] {
24
+ return typeof v === "string" || isVariantLabels(v);
25
+ }
26
+ /**
27
+ * Creates an object containing the latest state of every MotionValue on a VisualElement
28
+ */
29
+ function getCurrent(visualElement) {
30
+ var current = {};
31
+ visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });
32
+ return current;
33
+ }
34
+ /**
35
+ * Creates an object containing the latest velocity of every MotionValue on a VisualElement
36
+ */
37
+ function getVelocity(visualElement) {
38
+ var velocity = {};
39
+ visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
40
+ return velocity;
41
+ }
42
+ function resolveVariantFromProps(props: MotionProps, definition: TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues): TargetAndTransition;
43
+ function resolveVariantFromProps(props: MotionProps, definition?: string | TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues): undefined | TargetAndTransition;
44
+ function resolveVariantFromProps(props: MotionProps, definition?: string | TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues) {
45
+ var _a;
46
+ if (currentValues === void 0) { currentValues = {}; }
47
+ if (currentVelocity === void 0) { currentVelocity = {}; }
48
+ if (typeof definition === "string") {
49
+ definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
50
+ }
51
+ return typeof definition === "function"
52
+ ? definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity)
53
+ : definition;
54
+ }
55
+ function resolveVariant(visualElement: VisualElement, definition: TargetAndTransition | TargetResolver, custom?: any): TargetAndTransition;
56
+ function resolveVariant(visualElement: VisualElement, definition?: string | TargetAndTransition | TargetResolver, custom?: any): TargetAndTransition | undefined;
57
+ function resolveVariant(visualElement: VisualElement, definition?: string | TargetAndTransition | TargetResolver, custom?: any) {
58
+ var props = visualElement.getProps();
59
+ return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
60
+ }
61
+ function checkIfControllingVariants(props: MotionProps) {
62
+ var _a;
63
+ return (typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" ||
64
+ isVariantLabel(props.initial) ||
65
+ isVariantLabel(props.animate) ||
66
+ isVariantLabel(props.whileHover) ||
67
+ isVariantLabel(props.whileDrag) ||
68
+ isVariantLabel(props.whileTap) ||
69
+ isVariantLabel(props.whileFocus) ||
70
+ isVariantLabel(props.exit));
71
+ }
72
+ function checkIfVariantNode(props: MotionProps) {
73
+ return Boolean(checkIfControllingVariants(props) || props.variants);
74
+ }
75
+
76
+ export { checkIfControllingVariants, checkIfVariantNode, isVariantLabel, isVariantLabels, resolveVariant, resolveVariantFromProps };
@@ -0,0 +1,91 @@
1
+ /**
2
+ based on framer-motion@4.1.17,
3
+ Copyright (c) 2018 Framer B.V.
4
+ */
5
+ /**
6
+ * A typically user-facing description of a bounding box using traditional t/l/r/b
7
+ *
8
+ * @public
9
+ */
10
+ export interface BoundingBox2D {
11
+ top: number;
12
+ left: number;
13
+ bottom: number;
14
+ right: number;
15
+ }
16
+ /**
17
+ * A 3D bounding box
18
+ *
19
+ * @public
20
+ */
21
+ export interface BoundingBox3D extends BoundingBox2D {
22
+ front: number;
23
+ back: number;
24
+ }
25
+ /**
26
+ * A description of a single axis using non-axis specific terms to denote the min and max
27
+ * value of any axis.
28
+ *
29
+ * @public
30
+ */
31
+ export interface Axis {
32
+ min: number;
33
+ max: number;
34
+ }
35
+ /**
36
+ * A description of a bounding box describing each axis individually. This allows us
37
+ * to treate each axis generically.
38
+ *
39
+ * @public
40
+ */
41
+ export interface AxisBox2D {
42
+ x: Axis;
43
+ y: Axis;
44
+ }
45
+ /**
46
+ * @public
47
+ */
48
+ export interface AxisBox3D extends AxisBox2D {
49
+ z: Axis;
50
+ }
51
+ /**
52
+ * A description of a two-dimensional point
53
+ *
54
+ * @public
55
+ */
56
+ export interface Point2D {
57
+ x: number;
58
+ y: number;
59
+ }
60
+ /**
61
+ * A description of a three-dimensional point
62
+ *
63
+ * @public
64
+ */
65
+ export interface Point3D extends Point2D {
66
+ z: number;
67
+ }
68
+ /**
69
+ * A function that accepts a two-dimensional point and returns a new one.
70
+ *
71
+ * @public
72
+ */
73
+ export type TransformPoint2D = (point: Point2D) => Point2D;
74
+ /**
75
+ * The transform delta that, when applied to Axis a will visually transform it to Axis b
76
+ * @public
77
+ */
78
+ export interface AxisDelta {
79
+ translate: number;
80
+ scale: number;
81
+ origin: number;
82
+ originPoint: number;
83
+ }
84
+ /**
85
+ * The transform delta that, when applied to Box a will visually transform it to Box b.
86
+ * @public
87
+ */
88
+ export interface BoxDelta {
89
+ x: AxisDelta;
90
+ y: AxisDelta;
91
+ }