@syncedco/motion 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/CODE_OF_CONDUCT.md +26 -0
  3. package/CONTRIBUTING.md +100 -0
  4. package/LICENSE +22 -0
  5. package/README.md +278 -0
  6. package/SECURITY.md +36 -0
  7. package/SUPPORT.md +38 -0
  8. package/TRADEMARKS.md +14 -0
  9. package/bin/synced-motion.mjs +5 -0
  10. package/dist/astro.d.ts +15 -0
  11. package/dist/astro.js +51 -0
  12. package/dist/astro.js.map +1 -0
  13. package/dist/chunk-24KKECMK.js +281 -0
  14. package/dist/chunk-24KKECMK.js.map +1 -0
  15. package/dist/chunk-3WUVBPYX.js +162 -0
  16. package/dist/chunk-3WUVBPYX.js.map +1 -0
  17. package/dist/chunk-HCWQV65E.js +20 -0
  18. package/dist/chunk-HCWQV65E.js.map +1 -0
  19. package/dist/chunk-JET2MYEG.js +2287 -0
  20. package/dist/chunk-JET2MYEG.js.map +1 -0
  21. package/dist/chunk-KA3OPI4F.js +40 -0
  22. package/dist/chunk-KA3OPI4F.js.map +1 -0
  23. package/dist/chunk-ML7HTCZT.js +642 -0
  24. package/dist/chunk-ML7HTCZT.js.map +1 -0
  25. package/dist/chunk-NIXAEIHN.js +23 -0
  26. package/dist/chunk-NIXAEIHN.js.map +1 -0
  27. package/dist/chunk-VOIQPPQZ.js +299 -0
  28. package/dist/chunk-VOIQPPQZ.js.map +1 -0
  29. package/dist/chunk-WCG7TQSH.js +31 -0
  30. package/dist/chunk-WCG7TQSH.js.map +1 -0
  31. package/dist/cli.js +382 -0
  32. package/dist/cli.js.map +1 -0
  33. package/dist/full.d.ts +13 -0
  34. package/dist/full.js +201 -0
  35. package/dist/full.js.map +1 -0
  36. package/dist/index.d.ts +249 -0
  37. package/dist/index.js +183 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/lenis.d.ts +19 -0
  40. package/dist/lenis.js +7 -0
  41. package/dist/lenis.js.map +1 -0
  42. package/dist/mcp.d.ts +16 -0
  43. package/dist/mcp.js +82 -0
  44. package/dist/mcp.js.map +1 -0
  45. package/dist/plugins.d.ts +14 -0
  46. package/dist/plugins.js +17 -0
  47. package/dist/plugins.js.map +1 -0
  48. package/dist/react.d.ts +7 -0
  49. package/dist/react.js +32 -0
  50. package/dist/react.js.map +1 -0
  51. package/dist/recipes.d.ts +76 -0
  52. package/dist/recipes.js +129 -0
  53. package/dist/recipes.js.map +1 -0
  54. package/dist/styles.css +57 -0
  55. package/dist/styles.css.map +1 -0
  56. package/dist/svelte.d.ts +10 -0
  57. package/dist/svelte.js +30 -0
  58. package/dist/svelte.js.map +1 -0
  59. package/dist/vue.d.ts +13 -0
  60. package/dist/vue.js +35 -0
  61. package/dist/vue.js.map +1 -0
  62. package/dist/wordpress.d.ts +15 -0
  63. package/dist/wordpress.js +49 -0
  64. package/dist/wordpress.js.map +1 -0
  65. package/docs/API.md +176 -0
  66. package/docs/ATTRIBUTE-API.md +358 -0
  67. package/docs/CAPABILITIES.md +82 -0
  68. package/docs/INTEGRATIONS.md +92 -0
  69. package/docs/PERFORMANCE.md +150 -0
  70. package/docs/README.md +35 -0
  71. package/docs/RECIPE-REFERENCE.md +1358 -0
  72. package/docs/RECIPES.md +115 -0
  73. package/docs/TOOLING.md +65 -0
  74. package/docs/WEBFLOW-MIGRATION.md +39 -0
  75. package/package.json +167 -0
@@ -0,0 +1,76 @@
1
+ import type { MotionRuntimeRecipe } from './index.js'
2
+
3
+ /**
4
+ * Individually importable runtime recipe specs.
5
+ *
6
+ * Import only what a page uses so bundlers can drop the rest:
7
+ *
8
+ * ```js
9
+ * import { revealRise, marquee } from '@syncedco/motion/recipes'
10
+ * ```
11
+ */
12
+
13
+ export declare const accessibleMenu: MotionRuntimeRecipe
14
+ export declare const accordionDisclosure: MotionRuntimeRecipe
15
+ export declare const ambientFloat: MotionRuntimeRecipe
16
+ export declare const commandPalette: MotionRuntimeRecipe
17
+ export declare const counterValue: MotionRuntimeRecipe
18
+ export declare const dialogOverlay: MotionRuntimeRecipe
19
+ export declare const expandPanels: MotionRuntimeRecipe
20
+ export declare const flipCardToDetail: MotionRuntimeRecipe
21
+ export declare const flipFilterGrid: MotionRuntimeRecipe
22
+ export declare const flipListReorder: MotionRuntimeRecipe
23
+ export declare const flipNavIndicator: MotionRuntimeRecipe
24
+ export declare const horizontalComparisonSlider: MotionRuntimeRecipe
25
+ export declare const horizontalFeatureRail: MotionRuntimeRecipe
26
+ export declare const horizontalGalleryScrub: MotionRuntimeRecipe
27
+ export declare const horizontalGallerySnap: MotionRuntimeRecipe
28
+ export declare const horizontalLogoReel: MotionRuntimeRecipe
29
+ export declare const hoverLift: MotionRuntimeRecipe
30
+ export declare const hoverMediaSwitch: MotionRuntimeRecipe
31
+ export declare const imageFocusPan: MotionRuntimeRecipe
32
+ export declare const layoutAccordionGrid: MotionRuntimeRecipe
33
+ export declare const loopingLogoBelt: MotionRuntimeRecipe
34
+ export declare const magneticAction: MotionRuntimeRecipe
35
+ export declare const marquee: MotionRuntimeRecipe
36
+ export declare const mediaClipReveal: MotionRuntimeRecipe
37
+ export declare const mediaCurtainSplit: MotionRuntimeRecipe
38
+ export declare const mediaExpand: MotionRuntimeRecipe
39
+ export declare const navActiveIndicator: MotionRuntimeRecipe
40
+ export declare const pageLoadBrandMark: MotionRuntimeRecipe
41
+ export declare const pageLoadHero: MotionRuntimeRecipe
42
+ export declare const pinnedChapterCrossfade: MotionRuntimeRecipe
43
+ export declare const pinnedFounderStory: MotionRuntimeRecipe
44
+ export declare const pinnedProductExplainer: MotionRuntimeRecipe
45
+ export declare const pinnedStatement: MotionRuntimeRecipe
46
+ export declare const pinnedSteps: MotionRuntimeRecipe
47
+ export declare const pointerSpotlight: MotionRuntimeRecipe
48
+ export declare const progressRing: MotionRuntimeRecipe
49
+ export declare const revealClipWipe: MotionRuntimeRecipe
50
+ export declare const revealDirectional: MotionRuntimeRecipe
51
+ export declare const revealRise: MotionRuntimeRecipe
52
+ export declare const revealScaleIn: MotionRuntimeRecipe
53
+ export declare const revealStaggerCascade: MotionRuntimeRecipe
54
+ export declare const routeFade: MotionRuntimeRecipe
55
+ export declare const routeScrollRestore: MotionRuntimeRecipe
56
+ export declare const routeSharedMedia: MotionRuntimeRecipe
57
+ export declare const scrollDepthStack: MotionRuntimeRecipe
58
+ export declare const scrollDrift: MotionRuntimeRecipe
59
+ export declare const scrollExit: MotionRuntimeRecipe
60
+ export declare const scrollParallax: MotionRuntimeRecipe
61
+ export declare const scrollProgressMeter: MotionRuntimeRecipe
62
+ export declare const splitCharsShimmer: MotionRuntimeRecipe
63
+ export declare const splitLinesRise: MotionRuntimeRecipe
64
+ export declare const splitWordsCascade: MotionRuntimeRecipe
65
+ export declare const svgIconState: MotionRuntimeRecipe
66
+ export declare const svgLineDraw: MotionRuntimeRecipe
67
+ export declare const svgOrbit: MotionRuntimeRecipe
68
+ export declare const svgPathMorph: MotionRuntimeRecipe
69
+ export declare const svgSignatureReveal: MotionRuntimeRecipe
70
+ export declare const textHighlightSweep: MotionRuntimeRecipe
71
+ export declare const typewriterAnnounce: MotionRuntimeRecipe
72
+ export declare const videoPosterPlay: MotionRuntimeRecipe
73
+
74
+ /** Every built-in spec. Importing this opts into all sixty recipes. */
75
+ export declare const builtinMotionSpecs: readonly MotionRuntimeRecipe[]
76
+ export declare const SHARED_REDUCED_MOTION: Readonly<{ strategy: 'final'; behavior: string }>
@@ -0,0 +1,129 @@
1
+ import {
2
+ SHARED_REDUCED_MOTION,
3
+ accessibleMenu,
4
+ accordionDisclosure,
5
+ ambientFloat,
6
+ builtinMotionSpecs,
7
+ commandPalette,
8
+ counterValue,
9
+ dialogOverlay,
10
+ expandPanels,
11
+ flipCardToDetail,
12
+ flipFilterGrid,
13
+ flipListReorder,
14
+ flipNavIndicator,
15
+ horizontalComparisonSlider,
16
+ horizontalFeatureRail,
17
+ horizontalGalleryScrub,
18
+ horizontalGallerySnap,
19
+ horizontalLogoReel,
20
+ hoverLift,
21
+ hoverMediaSwitch,
22
+ imageFocusPan,
23
+ layoutAccordionGrid,
24
+ loopingLogoBelt,
25
+ magneticAction,
26
+ marquee,
27
+ mediaClipReveal,
28
+ mediaCurtainSplit,
29
+ mediaExpand,
30
+ navActiveIndicator,
31
+ pageLoadBrandMark,
32
+ pageLoadHero,
33
+ pinnedChapterCrossfade,
34
+ pinnedFounderStory,
35
+ pinnedProductExplainer,
36
+ pinnedStatement,
37
+ pinnedSteps,
38
+ pointerSpotlight,
39
+ progressRing,
40
+ revealClipWipe,
41
+ revealDirectional,
42
+ revealRise,
43
+ revealScaleIn,
44
+ revealStaggerCascade,
45
+ routeFade,
46
+ routeScrollRestore,
47
+ routeSharedMedia,
48
+ scrollDepthStack,
49
+ scrollDrift,
50
+ scrollExit,
51
+ scrollParallax,
52
+ scrollProgressMeter,
53
+ splitCharsShimmer,
54
+ splitLinesRise,
55
+ splitWordsCascade,
56
+ svgIconState,
57
+ svgLineDraw,
58
+ svgOrbit,
59
+ svgPathMorph,
60
+ svgSignatureReveal,
61
+ textHighlightSweep,
62
+ typewriterAnnounce,
63
+ videoPosterPlay
64
+ } from "./chunk-JET2MYEG.js";
65
+ export {
66
+ SHARED_REDUCED_MOTION,
67
+ accessibleMenu,
68
+ accordionDisclosure,
69
+ ambientFloat,
70
+ builtinMotionSpecs,
71
+ commandPalette,
72
+ counterValue,
73
+ dialogOverlay,
74
+ expandPanels,
75
+ flipCardToDetail,
76
+ flipFilterGrid,
77
+ flipListReorder,
78
+ flipNavIndicator,
79
+ horizontalComparisonSlider,
80
+ horizontalFeatureRail,
81
+ horizontalGalleryScrub,
82
+ horizontalGallerySnap,
83
+ horizontalLogoReel,
84
+ hoverLift,
85
+ hoverMediaSwitch,
86
+ imageFocusPan,
87
+ layoutAccordionGrid,
88
+ loopingLogoBelt,
89
+ magneticAction,
90
+ marquee,
91
+ mediaClipReveal,
92
+ mediaCurtainSplit,
93
+ mediaExpand,
94
+ navActiveIndicator,
95
+ pageLoadBrandMark,
96
+ pageLoadHero,
97
+ pinnedChapterCrossfade,
98
+ pinnedFounderStory,
99
+ pinnedProductExplainer,
100
+ pinnedStatement,
101
+ pinnedSteps,
102
+ pointerSpotlight,
103
+ progressRing,
104
+ revealClipWipe,
105
+ revealDirectional,
106
+ revealRise,
107
+ revealScaleIn,
108
+ revealStaggerCascade,
109
+ routeFade,
110
+ routeScrollRestore,
111
+ routeSharedMedia,
112
+ scrollDepthStack,
113
+ scrollDrift,
114
+ scrollExit,
115
+ scrollParallax,
116
+ scrollProgressMeter,
117
+ splitCharsShimmer,
118
+ splitLinesRise,
119
+ splitWordsCascade,
120
+ svgIconState,
121
+ svgLineDraw,
122
+ svgOrbit,
123
+ svgPathMorph,
124
+ svgSignatureReveal,
125
+ textHighlightSweep,
126
+ typewriterAnnounce,
127
+ videoPosterPlay
128
+ };
129
+ //# sourceMappingURL=recipes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"mappings":"","names":[]}
@@ -0,0 +1,57 @@
1
+ /* src/styles.css */
2
+ @layer synced-motion {
3
+ :root {
4
+ --motion-duration-fast: 180ms;
5
+ --motion-duration-base: 480ms;
6
+ --motion-duration-slow: 800ms;
7
+ --motion-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
8
+ }
9
+ html[data-motion-scroll-locked] {
10
+ overflow: hidden;
11
+ }
12
+ [data-motion-hover-group][data-motion-recipe] [data-motion-hover-media],
13
+ [data-motion-scroll-steps][data-motion-recipe] [data-motion-step-panel] {
14
+ opacity: 0;
15
+ pointer-events: none;
16
+ visibility: hidden;
17
+ }
18
+ [data-motion-hover-group][data-motion-recipe] [data-motion-hover-media][data-active],
19
+ [data-motion-scroll-steps][data-motion-recipe] [data-motion-step-panel][data-active] {
20
+ opacity: 1;
21
+ pointer-events: auto;
22
+ visibility: visible;
23
+ }
24
+ [data-motion-step-link] {
25
+ color: var(--sf-colour-muted, currentColor);
26
+ transition: color var(--motion-duration-base) var(--motion-ease-out);
27
+ }
28
+ [data-motion-step-link][data-active] {
29
+ color: var(--sf-colour-primary, currentColor);
30
+ }
31
+ [data-motion-expand-panel] {
32
+ transition: flex var(--motion-duration-slow) var(--motion-ease-out), color var(--motion-duration-base) var(--motion-ease-out);
33
+ }
34
+ [data-motion-menu][data-state=closed] [data-motion-menu-panel] {
35
+ pointer-events: none;
36
+ visibility: hidden;
37
+ }
38
+ [data-motion-menu][data-state=open] [data-motion-menu-panel] {
39
+ pointer-events: auto;
40
+ visibility: visible;
41
+ }
42
+ @media (prefers-reduced-motion: reduce) {
43
+ *,
44
+ *::before,
45
+ *::after {
46
+ scroll-behavior: auto !important;
47
+ }
48
+ [data-motion-reveal],
49
+ [data-motion-stagger] > *,
50
+ [data-motion-parallax] {
51
+ opacity: 1 !important;
52
+ transform: none !important;
53
+ visibility: visible !important;
54
+ }
55
+ }
56
+ }
57
+ /*# sourceMappingURL=styles.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/styles.css"],"mappings":";AAAA;AACE;AACE,4BAAwB;AACxB,4BAAwB;AACxB,4BAAwB;AACxB,uBAAmB,aAAa,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;AACjD;AAEA,MAAI,CAAC;AACH,cAAU;AACZ;AAEA,GAAC,wBAAwB,CAAC,oBAAoB,CAAC;AAAA,EAC/C,CAAC,yBAAyB,CAAC,oBAAoB,CAAC;AAC9C,aAAS;AACT,oBAAgB;AAChB,gBAAY;AACd;AAEA,GAAC,wBAAwB,CAAC,oBAAoB,CAAC,wBAAwB,CAAC;AAAA,EACxE,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC;AACtE,aAAS;AACT,oBAAgB;AAChB,gBAAY;AACd;AAEA,GAAC;AACC,WAAO,IAAI,iBAAiB,EAAE;AAC9B,gBAAY,MAAM,IAAI,wBAAwB,IAAI;AACpD;AAEA,GAAC,sBAAsB,CAAC;AACtB,WAAO,IAAI,mBAAmB,EAAE;AAClC;AAEA,GAAC;AACC,gBACE,KAAK,IAAI,wBAAwB,IAAI,kBAAkB,EACvD,MAAM,IAAI,wBAAwB,IAAI;AAC1C;AAEA,GAAC,iBAAiB,CAAC,mBAAqB,CAAC;AACvC,oBAAgB;AAChB,gBAAY;AACd;AAEA,GAAC,iBAAiB,CAAC,iBAAmB,CAAC;AACrC,oBAAgB;AAChB,gBAAY;AACd;AAEA,UAAO,wBAAyB;AAC9B;AAAA,IACA,CAAC;AAAA,IACD,CAAC;AACC,uBAAiB;AACnB;AAEA,KAAC;AAAA,IACD,CAAC,qBAAqB,EAAE;AAAA,IACxB,CAAC;AACC,eAAS;AACT,iBAAW;AACX,kBAAY;AACd;AACF;AACF;","names":[]}
@@ -0,0 +1,10 @@
1
+ import type { MotionRuntime, MotionRuntimeOptions } from './index.js'
2
+
3
+ export interface SvelteMotionAction {
4
+ readonly runtime: MotionRuntime | undefined
5
+ update(options?: Omit<MotionRuntimeOptions, 'root'>): void
6
+ refresh(): void
7
+ destroy(): void
8
+ }
9
+
10
+ export declare function syncedMotion(node: Element, options?: Omit<MotionRuntimeOptions, 'root'>): SvelteMotionAction
package/dist/svelte.js ADDED
@@ -0,0 +1,30 @@
1
+ import {
2
+ createMotionController
3
+ } from "./chunk-KA3OPI4F.js";
4
+ import "./chunk-VOIQPPQZ.js";
5
+ import "./chunk-24KKECMK.js";
6
+ import "./chunk-JET2MYEG.js";
7
+
8
+ // src/adapters/svelte.js
9
+ function syncedMotion(node, options = {}) {
10
+ const controller = createMotionController(node, options);
11
+ controller.mount();
12
+ return {
13
+ get runtime() {
14
+ return controller.runtime;
15
+ },
16
+ update(nextOptions = {}) {
17
+ controller.mount(node, nextOptions);
18
+ },
19
+ refresh() {
20
+ controller.refresh();
21
+ },
22
+ destroy() {
23
+ controller.destroy();
24
+ }
25
+ };
26
+ }
27
+ export {
28
+ syncedMotion
29
+ };
30
+ //# sourceMappingURL=svelte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/svelte.js"],"mappings":";;;;;;;;AAEO,SAAS,aAAa,MAAM,UAAU,CAAC,GAAG;AAC/C,QAAM,aAAa,uBAAuB,MAAM,OAAO;AACvD,aAAW,MAAM;AACjB,SAAO;AAAA,IACL,IAAI,UAAU;AAAE,aAAO,WAAW;AAAA,IAAQ;AAAA,IAC1C,OAAO,cAAc,CAAC,GAAG;AAAE,iBAAW,MAAM,MAAM,WAAW;AAAA,IAAE;AAAA,IAC/D,UAAU;AAAE,iBAAW,QAAQ;AAAA,IAAE;AAAA,IACjC,UAAU;AAAE,iBAAW,QAAQ;AAAA,IAAE;AAAA,EACnC;AACF;","names":[]}
package/dist/vue.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { MotionRuntime, MotionRuntimeOptions } from './index.js'
2
+
3
+ export interface VueMotionController {
4
+ runtime: { value: MotionRuntime | undefined }
5
+ mount(): Promise<MotionRuntime | undefined>
6
+ refresh(): void
7
+ destroy(): void
8
+ }
9
+
10
+ export declare function useSyncedMotion(
11
+ rootRef: Element | { value?: Element | null },
12
+ options?: Omit<MotionRuntimeOptions, 'root'>,
13
+ ): VueMotionController
package/dist/vue.js ADDED
@@ -0,0 +1,35 @@
1
+ import {
2
+ createMotionController
3
+ } from "./chunk-KA3OPI4F.js";
4
+ import "./chunk-VOIQPPQZ.js";
5
+ import "./chunk-24KKECMK.js";
6
+ import "./chunk-JET2MYEG.js";
7
+
8
+ // src/adapters/vue.js
9
+ import { nextTick, onMounted, onUnmounted, shallowRef, unref } from "vue";
10
+ function useSyncedMotion(rootRef, options = {}) {
11
+ const runtime = shallowRef();
12
+ let controller;
13
+ const mount = async () => {
14
+ await nextTick();
15
+ const root = unref(rootRef);
16
+ if (!root) return void 0;
17
+ controller?.destroy();
18
+ controller = createMotionController(root, options);
19
+ runtime.value = controller.mount();
20
+ return runtime.value;
21
+ };
22
+ const refresh = () => controller?.refresh();
23
+ const destroy = () => {
24
+ controller?.destroy();
25
+ controller = void 0;
26
+ runtime.value = void 0;
27
+ };
28
+ onMounted(mount);
29
+ onUnmounted(destroy);
30
+ return { runtime, mount, refresh, destroy };
31
+ }
32
+ export {
33
+ useSyncedMotion
34
+ };
35
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/vue.js"],"mappings":";;;;;;;;AAAA,SAAS,UAAU,WAAW,aAAa,YAAY,aAAa;AAG7D,SAAS,gBAAgB,SAAS,UAAU,CAAC,GAAG;AACrD,QAAM,UAAU,WAAW;AAC3B,MAAI;AAEJ,QAAM,QAAQ,YAAY;AACxB,UAAM,SAAS;AACf,UAAM,OAAO,MAAM,OAAO;AAC1B,QAAI,CAAC,KAAM,QAAO;AAClB,gBAAY,QAAQ;AACpB,iBAAa,uBAAuB,MAAM,OAAO;AACjD,YAAQ,QAAQ,WAAW,MAAM;AACjC,WAAO,QAAQ;AAAA,EACjB;AACA,QAAM,UAAU,MAAM,YAAY,QAAQ;AAC1C,QAAM,UAAU,MAAM;AACpB,gBAAY,QAAQ;AACpB,iBAAa;AACb,YAAQ,QAAQ;AAAA,EAClB;AAEA,YAAU,KAAK;AACf,cAAY,OAAO;AACnB,SAAO,EAAE,SAAS,OAAO,SAAS,QAAQ;AAC5C;","names":[]}
@@ -0,0 +1,15 @@
1
+ import type { MotionRuntime, MotionRuntimeOptions } from './index.js'
2
+
3
+ export interface WordPressMotionOptions extends Omit<MotionRuntimeOptions, 'root'> {
4
+ document?: Document
5
+ root?: Document | Element | string | (() => Document | Element | null | undefined)
6
+ }
7
+
8
+ export interface WordPressMotionController {
9
+ readonly runtime: MotionRuntime | undefined
10
+ mount(root?: Document | Element): MotionRuntime | undefined
11
+ refresh(): void
12
+ destroy(): void
13
+ }
14
+
15
+ export declare function createWordPressMotion(options?: WordPressMotionOptions): WordPressMotionController
@@ -0,0 +1,49 @@
1
+ import {
2
+ createMotionController,
3
+ resolveMotionRoot
4
+ } from "./chunk-KA3OPI4F.js";
5
+ import "./chunk-VOIQPPQZ.js";
6
+ import "./chunk-24KKECMK.js";
7
+ import "./chunk-JET2MYEG.js";
8
+
9
+ // src/adapters/wordpress.js
10
+ function createWordPressMotion(options = {}) {
11
+ const ownerDocument = options.document ?? globalThis.document;
12
+ if (!ownerDocument) return { runtime: void 0, mount() {
13
+ }, refresh() {
14
+ }, destroy() {
15
+ } };
16
+ const controller = createMotionController();
17
+ let destroyed = false;
18
+ const mount = (nextRoot) => {
19
+ if (destroyed) return void 0;
20
+ const requested = nextRoot?.nodeType ? nextRoot : typeof options.root === "function" ? options.root() : options.root;
21
+ const root = typeof requested === "string" ? ownerDocument.querySelector(requested) : resolveMotionRoot(requested) ?? ownerDocument;
22
+ const { document: _document, root: _root, ...runtimeOptions } = options;
23
+ return controller.mount(root, runtimeOptions);
24
+ };
25
+ const onMount = (event) => mount(event.detail?.root);
26
+ const onRefresh = () => controller.refresh();
27
+ ownerDocument.addEventListener("motion:mount", onMount);
28
+ ownerDocument.addEventListener("motion:refresh", onRefresh);
29
+ if (ownerDocument.readyState === "loading") ownerDocument.addEventListener("DOMContentLoaded", mount, { once: true });
30
+ else mount();
31
+ return {
32
+ get runtime() {
33
+ return controller.runtime;
34
+ },
35
+ mount,
36
+ refresh: onRefresh,
37
+ destroy() {
38
+ destroyed = true;
39
+ ownerDocument.removeEventListener("DOMContentLoaded", mount);
40
+ ownerDocument.removeEventListener("motion:mount", onMount);
41
+ ownerDocument.removeEventListener("motion:refresh", onRefresh);
42
+ controller.destroy();
43
+ }
44
+ };
45
+ }
46
+ export {
47
+ createWordPressMotion
48
+ };
49
+ //# sourceMappingURL=wordpress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/wordpress.js"],"mappings":";;;;;;;;;AAEO,SAAS,sBAAsB,UAAU,CAAC,GAAG;AAClD,QAAM,gBAAgB,QAAQ,YAAY,WAAW;AACrD,MAAI,CAAC,cAAe,QAAO,EAAE,SAAS,QAAW,QAAQ;AAAA,EAAC,GAAG,UAAU;AAAA,EAAC,GAAG,UAAU;AAAA,EAAC,EAAE;AACxF,QAAM,aAAa,uBAAuB;AAC1C,MAAI,YAAY;AAEhB,QAAM,QAAQ,CAAC,aAAa;AAC1B,QAAI,UAAW,QAAO;AACtB,UAAM,YAAY,UAAU,WAAW,WAAY,OAAO,QAAQ,SAAS,aAAa,QAAQ,KAAK,IAAI,QAAQ;AACjH,UAAM,OAAO,OAAO,cAAc,WAAW,cAAc,cAAc,SAAS,IAAI,kBAAkB,SAAS,KAAK;AACtH,UAAM,EAAE,UAAU,WAAW,MAAM,OAAO,GAAG,eAAe,IAAI;AAChE,WAAO,WAAW,MAAM,MAAM,cAAc;AAAA,EAC9C;AACA,QAAM,UAAU,CAAC,UAAU,MAAM,MAAM,QAAQ,IAAI;AACnD,QAAM,YAAY,MAAM,WAAW,QAAQ;AAC3C,gBAAc,iBAAiB,gBAAgB,OAAO;AACtD,gBAAc,iBAAiB,kBAAkB,SAAS;AAC1D,MAAI,cAAc,eAAe,UAAW,eAAc,iBAAiB,oBAAoB,OAAO,EAAE,MAAM,KAAK,CAAC;AAAA,MAC/G,OAAM;AAEX,SAAO;AAAA,IACL,IAAI,UAAU;AAAE,aAAO,WAAW;AAAA,IAAQ;AAAA,IAC1C;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AACR,kBAAY;AACZ,oBAAc,oBAAoB,oBAAoB,KAAK;AAC3D,oBAAc,oBAAoB,gBAAgB,OAAO;AACzD,oBAAc,oBAAoB,kBAAkB,SAAS;AAC7D,iBAAW,QAAQ;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
package/docs/API.md ADDED
@@ -0,0 +1,176 @@
1
+ # JavaScript API
2
+
3
+ The attribute vocabulary is in [the attribute API](ATTRIBUTE-API.md); every
4
+ recipe is listed in [the recipe reference](RECIPE-REFERENCE.md). This page
5
+ covers the JavaScript surface.
6
+
7
+ ## `createSyncedMotion(options?)`
8
+
9
+ The high-level entry point. Mounts every built-in recipe found in the root,
10
+ wires optional smooth scrolling, and refreshes triggers once fonts have loaded.
11
+
12
+ ```js
13
+ import { createSyncedMotion } from '@syncedco/motion'
14
+
15
+ const motion = createSyncedMotion({ smoothScroll: true })
16
+ ```
17
+
18
+ | Option | Type | Default | Notes |
19
+ | --- | --- | --- | --- |
20
+ | `root` | `Document \| Element` | `document` | Scopes every selector. |
21
+ | `smoothScroll` | `boolean \| object` | `false` | `true` enables Lenis; an object is passed to Lenis. Ignored under reduced motion. |
22
+ | `revealStart` | `string` | `'top 84%'` | ScrollTrigger start for the reveal and split families. |
23
+ | `reducedMotion` | `'system' \| 'reduce'` | `'system'` | Force reduced motion regardless of the media query. |
24
+ | `reducedMotionQuery` | `string` | `'(prefers-reduced-motion: reduce)'` | Override for testing. |
25
+ | `parameterOverrides` | `Record<string, Record<string, unknown>>` | `{}` | Per-recipe parameter values, keyed by recipe ID. |
26
+ | `dependencies` | `object` | `{}` | Supply GSAP or optional plugins. See [performance](PERFORMANCE.md#optional-gsap-plugins). |
27
+ | `debug` | `boolean` | `false` | Show ScrollTrigger markers. |
28
+ | `strict` | `boolean` | `true` | Rethrow mount errors. Set `false` to collect them in `inspect().errors` instead. |
29
+
30
+ ### Returned instance
31
+
32
+ | Member | Description |
33
+ | --- | --- |
34
+ | `gsap`, `ScrollTrigger` | The instances in use. |
35
+ | `registry` | The active registry. |
36
+ | `smoothScroll` | The Lenis adapter, or `undefined`. |
37
+ | `mountRecipe(id, root?, parameters?)` | Mount one recipe, optionally into markup added after load. Returns mount keys. |
38
+ | `refresh()` | Recalculate trigger positions after a layout change. |
39
+ | `inspect()` | Current diagnostics. See below. |
40
+ | `destroy()` | Tear everything down and restore the authored DOM. |
41
+
42
+ Call `destroy()` on route change and on hot reload.
43
+
44
+ ## `inspect()`
45
+
46
+ ```js
47
+ {
48
+ active: true,
49
+ reduced: false,
50
+ registered: ['reveal-rise', ...],
51
+ mounted: [{ id, root: { selector, tag, id }, slots, performance }],
52
+ skipped: [{ id, root, reason, slots?, dependencies?, fix? }],
53
+ errors: [{ id, phase, message }],
54
+ }
55
+ ```
56
+
57
+ `reason` is one of:
58
+
59
+ | Reason | Meaning |
60
+ | --- | --- |
61
+ | `missing-slots` | The root matched but a required slot was absent. `slots` lists them. |
62
+ | `missing-dependency` | An optional GSAP plugin was not supplied. `dependencies` and `fix` explain it. |
63
+ | `no-op` | The recipe ran but produced no active behaviour, typically under reduced motion. |
64
+
65
+ A skipped recipe never hides content.
66
+
67
+ ## `createMotionRuntime(options?)`
68
+
69
+ The lower-level runtime, for when you want to choose the recipes yourself.
70
+
71
+ ```js
72
+ import { createMotionRuntime, createMotionRegistry } from '@syncedco/motion'
73
+ import { revealRise } from '@syncedco/motion/recipes'
74
+
75
+ const runtime = createMotionRuntime({
76
+ registry: createMotionRegistry([revealRise], { mode: 'runtime' }),
77
+ })
78
+ ```
79
+
80
+ Accepts everything `createSyncedMotion` does except `smoothScroll` and
81
+ `revealStart`, plus:
82
+
83
+ | Option | Type | Notes |
84
+ | --- | --- | --- |
85
+ | `registry` | `MotionRegistry` | The registry to mount. |
86
+ | `recipes` | `MotionRecipe[]` | Shorthand: builds a registry from these. |
87
+ | `autoMount` | `boolean` | Defaults to `true`. Set `false` to call `mount()` yourself. |
88
+
89
+ It returns the same surface as `createSyncedMotion`, plus `mount()`.
90
+
91
+ ## Registries
92
+
93
+ ```js
94
+ createMotionRegistry(recipes?, { mode }) // build your own
95
+ createBuiltinMotionRegistry() // all sixty, complete manifests
96
+ createRuntimeMotionRegistry(specs?) // all sixty, lean specs
97
+ ```
98
+
99
+ `mode` is `'complete'` (default) or `'runtime'`. Complete requires the full
100
+ manifest including prose, preview and fixture metadata; runtime accepts lean
101
+ specs. See [the recipe system](RECIPES.md#runtime-specs-and-authoring-metadata).
102
+
103
+ | Method | Description |
104
+ | --- | --- |
105
+ | `register(recipe)` | Add one recipe. Throws on a duplicate ID. |
106
+ | `has(id)` / `get(id)` | Look up by ID. |
107
+ | `list()` | Every registered recipe. |
108
+ | `resolve(ids?)` | Recipes for the given IDs. Throws on an unknown ID. |
109
+ | `catalog()` | Serialisable catalog: `{ schemaVersion, count, recipes }`. |
110
+ | `validate()` | Validate everything registered. |
111
+ | `mode` | The registry's validation mode. |
112
+
113
+ ## Defining a recipe
114
+
115
+ ```js
116
+ defineMotionRecipe(recipe, { mode }) // validates, freezes, returns it
117
+ validateMotionRecipe(recipe, { mode }) // { ok, issues }
118
+ compileMotionRecipe(recipe) // selectors plus a setup function
119
+ ```
120
+
121
+ `defineMotionRecipe` throws `MotionRecipeValidationError` (with an `issues`
122
+ array and `recipeId`) when validation fails. Full contract in
123
+ [the recipe system](RECIPES.md).
124
+
125
+ ### `setup(context)`
126
+
127
+ ```js
128
+ setup({ gsap, ScrollTrigger, root, scope, slots, parameters, reduced, debug, recipe }) {
129
+ if (reduced) return
130
+ const tween = gsap.from(slots.items, { autoAlpha: 0, y: '1rem' })
131
+ return () => tween.revert()
132
+ }
133
+ ```
134
+
135
+ | Field | Description |
136
+ | --- | --- |
137
+ | `gsap`, `ScrollTrigger` | Always present. |
138
+ | `SplitText`, `Flip`, `DrawSVGPlugin`, `MorphSVGPlugin`, `MotionPathPlugin` | Present only when supplied via `dependencies`. Declare them in the recipe's `dependencies` array and the runtime will skip the recipe rather than hand you `undefined`. |
139
+ | `root` / `scope` | The matched root element. |
140
+ | `slots` | `Record<string, Element[]>`, keyed by slot name. |
141
+ | `parameters` | Resolved, validated, within declared bounds. |
142
+ | `reduced` | Whether reduced motion is active. |
143
+ | `recipe` | The manifest. |
144
+
145
+ Return a cleanup function, an object with `destroy()`, or `false` to record the
146
+ mount as a no-op. Anything you create must be reverted by that cleanup.
147
+
148
+ ## Service, inspector and Lenis
149
+
150
+ `createMotionService(registry)` is the side-effect-free query layer shared by
151
+ the CLI, MCP server and gallery: `catalog()`, `recipe(id)`, `suggest(brief)`,
152
+ `plan(ids)`, `scanMarkup(markup)`, `compose(brief, options)` and `validate()`.
153
+ It touches no files or processes. `createDefaultMotionService()` builds one over
154
+ the built-in catalog.
155
+
156
+ `createMotionInspector({ registry, runtime })` backs the gallery: select a
157
+ recipe and fixture, coerce parameters within their bounds, subscribe to
158
+ snapshots. `createLenisAdapter({ gsap, ScrollTrigger, options })` returns
159
+ `{ lenis, start, stop, scrollTo, destroy }` and drives Lenis from the GSAP
160
+ ticker.
161
+
162
+ ## Framework adapters
163
+
164
+ See [framework and CMS integrations](INTEGRATIONS.md).
165
+
166
+ ## TypeScript
167
+
168
+ Declarations ship for every subpath. `npm run types:check` verifies both that a
169
+ consumer on NodeNext can import them and that every runtime export of every
170
+ entry point is declared.
171
+
172
+ Exported types include `MotionRecipe`, `MotionRuntimeRecipe`, `MotionRegistry`,
173
+ `MotionRegistryMode`, `MotionRuntime`, `MotionRuntimeOptions`,
174
+ `SyncedMotionOptions`, `SyncedMotionInstance`, `MotionRecipeContext`,
175
+ `MotionRecipeSlot`, `MotionRecipeParameter`, `MotionTriggerType` and
176
+ `MotionPerformanceClass`.