@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,115 @@
1
+ # Motion recipe system
2
+
3
+ Motion recipes are the shared interface used by the DOM runtime, CLI, MCP
4
+ server, gallery, inspector, and framework adapters.
5
+ They make an effect discoverable and testable without limiting a project-owned
6
+ recipe to a fixed list of visual ideas.
7
+
8
+ ## Contract
9
+
10
+ Create recipes with `defineMotionRecipe()`. A recipe declares:
11
+
12
+ - a stable kebab-case id, semantic intent, family, and tags;
13
+ - a root selector and root-scoped semantic slots;
14
+ - bounded parameters and supported triggers;
15
+ - reduced-motion, no-JavaScript, and accessibility behavior;
16
+ - performance cost and plugin dependencies;
17
+ - preview and fixture metadata; and
18
+ - either a declarative timeline or typed `setup(context)` implementation.
19
+
20
+ The validator rejects document-global roots such as `body`, incomplete numeric
21
+ parameters, missing fallbacks, and declarative layout animation that has not
22
+ explicitly opted into the high-cost path.
23
+
24
+ ## Runtime specs and authoring metadata
25
+
26
+ A recipe manifest serves two audiences with very different needs. The browser
27
+ reads the root selector, slots, parameters, triggers, reduced-motion strategy,
28
+ performance class, dependencies and `setup`. Humans and agents read the title,
29
+ description, intent, family, tags, accessibility notes, no-JavaScript
30
+ behaviour, preview settings and fixture markup.
31
+
32
+ The second group is roughly sixty percent of the payload and none of it is used
33
+ while animating, so the two are stored separately:
34
+
35
+ | Module | Contents | Imported by |
36
+ | --- | --- | --- |
37
+ | `src/recipes/specs.js` | Lean runtime specs, one named export per recipe | The browser runtime |
38
+ | `src/recipes/authoring.js` | Prose, preview data, fixture markup | CLI, MCP server, gallery, inspector, docs |
39
+ | `src/recipes/builtins.js` | The two merged into complete manifests | Tooling |
40
+ | `src/recipes/runtime-registry.js` | A registry over the lean specs | `createSyncedMotion` |
41
+
42
+ This is why the registry has a mode:
43
+
44
+ ```js
45
+ createMotionRegistry(recipes) // 'complete' -- the default
46
+ createMotionRegistry(specs, { mode: 'runtime' }) // lean specs
47
+ ```
48
+
49
+ `complete` requires the full manifest and is what `defineMotionRecipe` uses by
50
+ default, so a recipe you write yourself must still declare its fallbacks and
51
+ fixtures. `runtime` validates only what the browser reads.
52
+
53
+ Because each spec is a separate named export annotated `/* @__PURE__ */`, a page
54
+ that imports three recipes bundles three recipes. When adding a recipe, annotate
55
+ both the `spec(...)` call and the nested `setupFactory(...)` call, or bundlers
56
+ will retain all sixty; `npm run size:check` will fail if you forget.
57
+
58
+ After changing any recipe, regenerate the reference:
59
+
60
+ ```bash
61
+ npm run docs:build
62
+ ```
63
+
64
+ ## Registry and service seam
65
+
66
+ `createMotionRegistry(recipes)` owns registration, id resolution, validation,
67
+ and the serializable public catalog. `createMotionService(registry)` exposes
68
+ catalog, recipe lookup, deterministic suggestion, validation, and motion-plan
69
+ data without performing file or process side effects. The CLI and MCP server
70
+ must use this service rather than reimplementing catalog logic.
71
+
72
+ The built-in registry contains sixty stable recipe IDs across twelve families:
73
+ reveals/entrances, split-text/typography, scroll/parallax, pinned storytelling,
74
+ horizontal galleries, hover/focus/pointer, navigation/overlay, media/mask/clip,
75
+ loops/progress/ambient, FLIP/layout, SVG/path/morph, and page-load/route.
76
+ Every family contains five implemented recipes.
77
+
78
+ ## Preview fixtures
79
+
80
+ Every recipe owns at least one serializable fixture. `preview.fixture` must
81
+ resolve to a unique fixture ID. A fixture declares a label, semantic markup,
82
+ and optional bounded parameter values. Its markup must contain exactly one
83
+ recipe root and every required slot inside that root. This contract lets the
84
+ gallery and agents render previews without maintaining a second ID map.
85
+
86
+ ```js
87
+ preview: { fixture: 'default', viewport: 'standard', activation: 'auto' },
88
+ fixtures: [{
89
+ id: 'default',
90
+ label: 'Default',
91
+ markup: '<section data-motion-example><p data-motion-item>Readable content</p></section>',
92
+ parameters: {},
93
+ }]
94
+ ```
95
+
96
+ ## Runtime lifecycle
97
+
98
+ `createMotionRuntime()` resolves matching recipe roots, verifies required slots,
99
+ and mounts recipes inside those roots. It exposes:
100
+
101
+ - `mount()` and `mountRecipe()`;
102
+ - `refresh()` for layout-dependent trigger recalculation;
103
+ - `inspect()` for registered, mounted, skipped, and failed recipes; and
104
+ - `destroy()` for deterministic teardown.
105
+
106
+ The runtime uses `gsap.matchMedia()` so responsive and reduced-motion contexts
107
+ are reverted together. A missing slot skips animation but does not hide or
108
+ remove authored content. `createSyncedMotion()` remains supported while the
109
+ existing attribute patterns are migrated onto recipe manifests.
110
+
111
+ ## Ownership
112
+
113
+ Recipes orchestrate motion and semantic state. They do not own typography,
114
+ spacing, colour, layout, or final component presentation. Those remain Synced
115
+ Flow and consuming-project responsibilities.
@@ -0,0 +1,65 @@
1
+ # CLI and MCP tools
2
+
3
+ Synced Motion ships a local `synced-motion` executable. Human-facing text is
4
+ the default; pass `--json` when an agent or build tool needs stable structured
5
+ data.
6
+
7
+ ```bash
8
+ npx synced-motion --help # every command
9
+ npx synced-motion <command> --help # one command in detail
10
+ npx synced-motion --version
11
+ ```
12
+
13
+ ## Commands
14
+
15
+ - `add <id...>` prints ready-to-paste markup for one or more recipes,
16
+ including every required slot. The command writes nothing; redirect it
17
+ where you want it.
18
+
19
+ ```bash
20
+ npx synced-motion add reveal-rise
21
+ npx synced-motion add pinned-steps marquee > partials/motion.html
22
+ ```
23
+
24
+ When a recipe needs an optional GSAP plugin, `add` says so on stderr, so the
25
+ markup can still be piped cleanly.
26
+ - `catalog` lists registered recipe manifests.
27
+ - `recipe <id>` returns one manifest.
28
+ - `suggest "<brief>"` ranks recipes using deterministic catalog metadata.
29
+ - `plan <id...>` returns roots, slots, defaults, reduced-motion behavior, and
30
+ performance metadata for an integration.
31
+ - `scan --file <path>` finds registered hooks and missing required slots.
32
+ - `compose "<brief>" --file <path>` combines deterministic suggestions, a
33
+ recipe plan, markup diagnostics, and performance warnings.
34
+ - `validate` validates the active registry; pass `--file <recipe.json>` to validate a custom declarative recipe.
35
+ - `doctor` checks that the registry and service are usable.
36
+ - `init --agents` installs project config, scripts, and managed AI guidance.
37
+ - `agents install|status` manages only the marked Synced Motion guidance block.
38
+ - `mcp` starts the project-local stdio MCP server.
39
+
40
+ The 1.0 catalog contains sixty implemented and verified recipes: five recipes
41
+ in each of twelve families. Placeholder or no-op entries are rejected from the
42
+ launch catalog. The CLI, MCP server, public service, gallery, and inspector all
43
+ read the same source registry.
44
+
45
+ ## MCP server
46
+
47
+ Start the server with:
48
+
49
+ ```bash
50
+ npx synced-motion mcp
51
+ ```
52
+
53
+ It exposes:
54
+
55
+ - `motion_catalog`
56
+ - `motion_recipe`
57
+ - `motion_suggest`
58
+ - `motion_validate`
59
+ - `motion_plan`
60
+ - `motion_scan`
61
+ - `motion_compose`
62
+
63
+ These tools call the same service module as the CLI. Protocol tests connect an
64
+ MCP client over an in-memory transport and execute the real server tool surface.
65
+ The server runs locally over stdio and does not require a hosted AI provider.
@@ -0,0 +1,39 @@
1
+ # Migrating a Webflow experience
2
+
3
+ ## Inventory first
4
+
5
+ Capture every page-load, click, hover, scroll, pin, scrub, reveal, and menu interaction. Record trigger, target, start/end position, duration, ease, stagger, and reduced-motion behavior.
6
+
7
+ ## Replace generated identity
8
+
9
+ Replace opaque Webflow interaction attributes with readable semantic hooks:
10
+
11
+ ```html
12
+ <!-- Before -->
13
+ <a data-wf-element-id="645ee970-6c97-eea3-d61b-013ab5a5f236">...</a>
14
+
15
+ <!-- After -->
16
+ <a data-motion-step-link>...</a>
17
+ ```
18
+
19
+ ## Preserve ownership boundaries
20
+
21
+ - Convert Webflow variables to Synced Flow tokens.
22
+ - Convert utility layout to `sf-*` primitives.
23
+ - Keep unique editorial section classes in the consuming site.
24
+ - Make state controllers work before adding GSAP presentation.
25
+ - Toggle semantic state instead of animating final brand colors inline.
26
+
27
+ ## Removal order
28
+
29
+ 1. Rebuild one interaction locally.
30
+ 2. Verify it against the reference in both scroll directions.
31
+ 3. Disable the equivalent Webflow interaction.
32
+ 4. Remove its generated IDs and overrides.
33
+ 5. Repeat until the Webflow runtime owns no behavior.
34
+ 6. Remove Webflow JavaScript and jQuery.
35
+ 7. Remove unused compatibility CSS and metadata.
36
+ 8. Run browser, accessibility, reduced-motion, performance, and build checks.
37
+
38
+ Never remove the Webflow runtime before replacing and verifying every behavior it owns.
39
+
package/package.json ADDED
@@ -0,0 +1,167 @@
1
+ {
2
+ "name": "@syncedco/motion",
3
+ "version": "0.1.0",
4
+ "description": "Accessible, framework-neutral scroll and interaction animation for the web. Sixty validated GSAP recipes with reduced-motion, no-JS and cleanup behaviour built into the contract.",
5
+ "type": "module",
6
+ "author": "Scott Mackey",
7
+ "homepage": "https://github.com/SyncedCo/synced-motion#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/SyncedCo/synced-motion.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/SyncedCo/synced-motion/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "sideEffects": [
19
+ "./dist/styles.css"
20
+ ],
21
+ "files": [
22
+ "bin",
23
+ "dist",
24
+ "docs",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "CONTRIBUTING.md",
28
+ "CODE_OF_CONDUCT.md",
29
+ "SECURITY.md",
30
+ "SUPPORT.md",
31
+ "TRADEMARKS.md",
32
+ "LICENSE"
33
+ ],
34
+ "main": "./dist/index.js",
35
+ "module": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "bin": {
38
+ "synced-motion": "./bin/synced-motion.mjs"
39
+ },
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "import": "./dist/index.js"
44
+ },
45
+ "./full": {
46
+ "types": "./dist/full.d.ts",
47
+ "import": "./dist/full.js"
48
+ },
49
+ "./plugins": {
50
+ "types": "./dist/plugins.d.ts",
51
+ "import": "./dist/plugins.js"
52
+ },
53
+ "./recipes": {
54
+ "types": "./dist/recipes.d.ts",
55
+ "import": "./dist/recipes.js"
56
+ },
57
+ "./styles.css": "./dist/styles.css",
58
+ "./lenis": {
59
+ "types": "./dist/lenis.d.ts",
60
+ "import": "./dist/lenis.js"
61
+ },
62
+ "./mcp": {
63
+ "types": "./dist/mcp.d.ts",
64
+ "import": "./dist/mcp.js"
65
+ },
66
+ "./react": {
67
+ "types": "./dist/react.d.ts",
68
+ "import": "./dist/react.js"
69
+ },
70
+ "./vue": {
71
+ "types": "./dist/vue.d.ts",
72
+ "import": "./dist/vue.js"
73
+ },
74
+ "./svelte": {
75
+ "types": "./dist/svelte.d.ts",
76
+ "import": "./dist/svelte.js"
77
+ },
78
+ "./astro": {
79
+ "types": "./dist/astro.d.ts",
80
+ "import": "./dist/astro.js"
81
+ },
82
+ "./wordpress": {
83
+ "types": "./dist/wordpress.d.ts",
84
+ "import": "./dist/wordpress.js"
85
+ }
86
+ },
87
+ "scripts": {
88
+ "build": "tsup && node scripts/copy-declarations.mjs",
89
+ "dev": "vite example",
90
+ "gallery": "vite example --open /gallery/",
91
+ "cli": "node ./bin/synced-motion.mjs",
92
+ "mcp": "node ./bin/synced-motion.mjs mcp",
93
+ "motion:validate": "node ./bin/synced-motion.mjs validate",
94
+ "motion:doctor": "node ./bin/synced-motion.mjs doctor",
95
+ "motion:mcp": "node ./bin/synced-motion.mjs mcp",
96
+ "mcp:check": "node scripts/check-mcp.mjs",
97
+ "flow:build": "synced-flow build",
98
+ "flow:check": "synced-flow build --check",
99
+ "flow:lint": "synced-flow lint",
100
+ "flow:doctor": "synced-flow doctor",
101
+ "flow:watch": "synced-flow watch",
102
+ "test": "vitest run",
103
+ "test:watch": "vitest",
104
+ "test:browser": "playwright test",
105
+ "test:browser:ui": "playwright test --ui",
106
+ "units:check": "node scripts/check-units.mjs",
107
+ "types:check": "node scripts/check-declarations.mjs",
108
+ "size:check": "node scripts/check-size.mjs",
109
+ "docs:build": "node scripts/build-docs.mjs",
110
+ "docs:check": "node scripts/build-docs.mjs --check",
111
+ "gallery:build": "vite build --config example/gallery/vite.config.js",
112
+ "check": "npm run flow:check && npm run flow:lint && npm run flow:doctor && npm run units:check && npm run test && npm run build && npm run types:check && npm run size:check && npm run docs:check && npm run motion:validate && npm run motion:doctor && npm run mcp:check",
113
+ "pack:check": "npm pack --dry-run"
114
+ },
115
+ "keywords": [
116
+ "animation",
117
+ "gsap",
118
+ "scrolltrigger",
119
+ "lenis",
120
+ "synced-flow",
121
+ "motion",
122
+ "scroll-animation"
123
+ ],
124
+ "license": "MIT",
125
+ "peerDependencies": {
126
+ "@gsap/react": ">=2.1.0",
127
+ "gsap": ">=3.13.0",
128
+ "react": ">=18.0.0",
129
+ "vue": ">=3.0.0"
130
+ },
131
+ "peerDependenciesMeta": {
132
+ "@gsap/react": {
133
+ "optional": true
134
+ },
135
+ "react": {
136
+ "optional": true
137
+ },
138
+ "vue": {
139
+ "optional": true
140
+ }
141
+ },
142
+ "dependencies": {
143
+ "@modelcontextprotocol/sdk": "^1.29.0",
144
+ "lenis": "^1.3.25",
145
+ "zod": "^4.4.3"
146
+ },
147
+ "devDependencies": {
148
+ "@gsap/react": "^2.1.2",
149
+ "@playwright/test": "^1.62.0",
150
+ "@syncedco/flow": "^0.3.2",
151
+ "axe-core": "^4.12.1",
152
+ "gsap": "^3.15.0",
153
+ "jsdom": "^29.1.1",
154
+ "react": "^19.2.7",
155
+ "tsup": "^8.5.1",
156
+ "typescript": "5.7.3",
157
+ "vite": "^8.1.4",
158
+ "vitest": "^4.1.10",
159
+ "vue": "^3.5.40"
160
+ },
161
+ "engines": {
162
+ "node": ">=20"
163
+ },
164
+ "overrides": {
165
+ "esbuild": "^0.28.1"
166
+ }
167
+ }