takumi-motion 0.0.0-stage → 1.0.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -2
  3. package/dist/capture-DdEVFwPq.js +1586 -0
  4. package/dist/capture-DdEVFwPq.js.map +1 -0
  5. package/dist/capture-QxKhbtOv.d.ts +533 -0
  6. package/dist/easing-Bh7ZDult.js +397 -0
  7. package/dist/easing-Bh7ZDult.js.map +1 -0
  8. package/dist/fonts-DgS7GYoh.d.ts +112 -0
  9. package/dist/fonts.d.ts +2 -0
  10. package/dist/fonts.js +197 -0
  11. package/dist/fonts.js.map +1 -0
  12. package/dist/index-CasRCPrh.d.ts +1359 -0
  13. package/dist/index-D6Qd49Mm.d.ts +297 -0
  14. package/dist/index.d.ts +810 -0
  15. package/dist/index.js +1165 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/kit-TNo_LBhD.d.ts +37 -0
  18. package/dist/measure-CNgubKM7.d.ts +65 -0
  19. package/dist/measure-D8A5XPBy.js +269 -0
  20. package/dist/measure-D8A5XPBy.js.map +1 -0
  21. package/dist/node-DqDgKXL0.js +2 -0
  22. package/dist/presets-AIq8sCOG.d.ts +63 -0
  23. package/dist/react/index.d.ts +3 -0
  24. package/dist/react/index.js +3 -0
  25. package/dist/react/kit.d.ts +2 -0
  26. package/dist/react/kit.js +79 -0
  27. package/dist/react/kit.js.map +1 -0
  28. package/dist/react-BBWqBqk5.js +2719 -0
  29. package/dist/react-BBWqBqk5.js.map +1 -0
  30. package/dist/render-BvgGfLuH.js +1149 -0
  31. package/dist/render-BvgGfLuH.js.map +1 -0
  32. package/dist/render-C7S9eTaR.d.ts +390 -0
  33. package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
  34. package/dist/sampler-grBiOLYV.js +538 -0
  35. package/dist/sampler-grBiOLYV.js.map +1 -0
  36. package/dist/shared-j5kwM0OJ.js +491 -0
  37. package/dist/shared-j5kwM0OJ.js.map +1 -0
  38. package/dist/surface-C9vjHiYY.js +561 -0
  39. package/dist/surface-C9vjHiYY.js.map +1 -0
  40. package/dist/templates/index.d.ts +2 -0
  41. package/dist/templates/index.js +1 -0
  42. package/dist/templates-DY2W2F57.js +1254 -0
  43. package/dist/templates-DY2W2F57.js.map +1 -0
  44. package/dist/themes-C2wBV-LE.d.ts +34 -0
  45. package/dist/types-SNVXff6w.d.ts +101 -0
  46. package/dist/with-audit-CGTfVmLF.js +1220 -0
  47. package/dist/with-audit-CGTfVmLF.js.map +1 -0
  48. package/dist/with-audit-POT13GwY.d.ts +373 -0
  49. package/dist/with-audit.d.ts +2 -0
  50. package/dist/with-audit.js +1 -0
  51. package/package.json +105 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 elcoosp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,142 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <img src="https://cdn.jsdelivr.net/gh/elcoosp/takumi-motion@main/docs/logo.png" alt="Takumi Motion Logo" width="200"/>
3
+ <p>
4
+ <strong>Deterministic server-side animation engine: any React component or raw HTML string → GIF/WebP/APNG/PNG-sequence/sprite-sheet/still at any user-given surface, rendered by Rust (takumi).</strong><br/>
5
+ v1.0 <em>Velocity</em> — the performance pass: solver/tween/compile/evaluate memoization (geomean <strong>1.71×</strong>), binary-search chunk indexing, zero-copy GIF passes, min-SAD PNG filtering (<strong>−90%+</strong> atlas bytes), and worker-pool parallel capture — byte-identical at any worker count.
6
+ </p>
7
+ <p>
8
+ <img src="https://img.shields.io/badge/TypeScript-5.x-007ACC?style=flat-square&logo=typescript" alt="TypeScript"/>
9
+ <img src="https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react" alt="React"/>
10
+ <img src="https://img.shields.io/badge/Rust-Takumi%20Engine-000000?style=flat-square&logo=rust" alt="Rust"/>
11
+ <img src="https://img.shields.io/badge/Testing-Vitest-6E9F18?style=flat-square&logo=vitest" alt="Testing"/>
12
+ <img src="https://img.shields.io/badge/Outputs-GIF%20%7C%20WebP%20%7C%20APNG-FF6B6B?style=flat-square" alt="Outputs"/>
13
+ <img src="https://img.shields.io/badge/Architecture-Deterministic%20%26%20Frame--Indexed-9B59B6?style=flat-square" alt="Architecture"/>
14
+ <img src="https://img.shields.io/badge/Quality-Audit%20%2B%20X--Ray-2ECC71?style=flat-square" alt="Quality"/>
15
+ </p>
16
+ </div>
2
17
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
18
+ ---
19
+
20
+ ## Overview
21
+
22
+ Takumi Motion is a declarative, deterministic animation engine that bridges high-level React component trees or raw HTML with high-performance, server-side rendering. By compiling animation timelines ahead of time and delegating rasterization to a Rust backend (`takumi`), it guarantees byte-exact, reproducible outputs without the runtime overhead, layout thrashing, or non-determinism of traditional browser-based animation libraries.
23
+
24
+ ## Key Features
25
+
26
+ - **v1.0 Velocity (performance)**: memoized spring solvers, binary-search tween sampling,
27
+ structural compile dedupe, identity-memoized track resolution, zero-copy GIF hold collapse,
28
+ and the standard min-SAD PNG filter heuristic — geomean 1.71× across 13 benches
29
+ (`docs/BENCHMARKS.md`), differential-tested byte-identical against the frozen v0.9.1 pipeline.
30
+ - **Worker-pool parallel capture**: `renderReactBanner({ bannerModule, workers: "auto" })` runs
31
+ the capture stage across worker threads; an adaptive gate (cores × frames × measured work)
32
+ only spawns when it wins.
33
+
34
+
35
+ - **Data Motion & Charts**: Deterministic chart primitives (`LineChart`, `BarChart`, `Donut`, `CountUp` v2) that react to a static data channel injected at setup, ensuring no network fetches occur during render.
36
+ - **Measured FLIP (`<Morph>`)**: Layout truth with `TM_LAYOUT_SHIFT` auditing. Interpolates position and size channels directly during prewarm, preventing text stretching or elliptical dots common in scale-based FLIP techniques.
37
+ - **Material Pack**: Declarative alpha masks (`<Mask>`), directional reveals (`<Reveal>`), variable font weight tracks (`<VariableText>`), and background-clip text fills (`<GradientText>`).
38
+ - **Deterministic Particles**: O(1) per-frame closed-form particle systems (`sparkle`, `confetti`) using seeded randomness (`mulberry32`), ensuring byte-identical replays across any frame index.
39
+ - **Forever Reel**: `<Banner loop>` with `enter="wrap"` or `exit="wrap"` guarantees byte-identical seams between the last and first frames, verified by `report.seam`.
40
+ - **X-ray Auditing**: Per-frame channel attribution (`--explain`) and labeled PNG storyboard contact sheets for precise size-budget instrumentation and visual QA.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pnpm add takumi-motion
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ Define a banner using React components, orchestrate scenes, and render it server-side to a deterministic format.
51
+
52
+ ```tsx
53
+ import { defineBanner, Banner, Scene, Layer } from "takumi-motion/react";
54
+ import { renderReactBanner } from "takumi-motion";
55
+
56
+ export const launchBanner = defineBanner(function TakumiMotionLaunch() {
57
+ return (
58
+ <Banner preset="readme" theme="tokyo-night" transitionMs={250}>
59
+ <Layer bottom>
60
+ <div style={{ position: "absolute", bottom: 0, width: 850, height: 3, backgroundColor: "#7aa2f7" }} />
61
+ </Layer>
62
+
63
+ <Scene duration={100} enter="rise" exit="crossfade">
64
+ <h1 style={{ fontSize: 48, fontWeight: 700, color: "#c0caf5" }}>
65
+ takumi-motion
66
+ </h1>
67
+ </Scene>
68
+ </Banner>
69
+ );
70
+ });
71
+
72
+ // Render server-side to WebP (or GIF, APNG, PNG-sequence, still)
73
+ const report = await renderReactBanner({
74
+ banner: launchBanner,
75
+ format: "webp",
76
+ out: "./out/launch-banner.webp"
77
+ });
78
+
79
+ console.log(report.lint); // Review authoring lint warnings (e.g., TM_LAYOUT_SHIFT)
80
+
81
+ // v1.0 — heavy banners: parallel capture across worker threads (byte-identical output;
82
+ // the auto gate only spawns when cores × frames × measured work amortize it).
83
+ const parallel = await renderReactBanner({
84
+ bannerModule: "./launch-banner.tsx", // module entry — the file's default export
85
+ workers: "auto",
86
+ });
87
+ ```
88
+
89
+ ## CLI Usage
90
+
91
+ The engine provides a comprehensive CLI for rendering, auditing, and scaffolding.
92
+
93
+ ```bash
94
+ # Render a banner to default formats
95
+ takumi-motion render banner.tsx --preset readme --out ./out
96
+
97
+ # Render with a specific data file for chart primitives
98
+ takumi-motion render banner.tsx --data metrics.json --format webp
99
+
100
+ # Audit a banner for layout shifts and seam integrity (ideal for CI gates)
101
+ takumi-motion check banner.tsx
102
+
103
+ # Generate an engine-exact filmstrip preview (byte-deterministic)
104
+ takumi-motion render banner.tsx --filmstrip
105
+
106
+ # Preview the captured CSS in the browser (approximate layout)
107
+ takumi-motion preview banner.tsx -o banner-preview.html
108
+
109
+ # Scaffold a new banner project or list available resources
110
+ takumi-motion init
111
+ takumi-motion templates | presets | fonts
112
+ ```
113
+
114
+ ## Development
115
+
116
+ > [!NOTE]
117
+ > This project uses `tsx` for execution and `vitest` for testing. Ensure dependencies are installed before running local scripts.
118
+
119
+ ```bash
120
+ # Install dependencies
121
+ pnpm install
122
+
123
+ # Build the project
124
+ pnpm run build
125
+
126
+ # Run the comprehensive Vitest suite
127
+ pnpm run test
128
+
129
+ # Run visual QA and smoke tests
130
+ pnpm run smoke
131
+
132
+ # Extract test fixtures
133
+ pnpm run fixtures
134
+ ```
135
+
136
+ ## Authoring & Best Practices
137
+
138
+ - **Style Safety**: Always use camelCase for style properties (e.g., `fontWeight`, not `font-weight`). React 19 serializes kebab-case keys in a way that causes Rust parse errors in takumi. The linter will catch this as `TM_KEBAB_STYLE`.
139
+ - **Determinism**: Never use `Math.random()` or network fetches inside render functions. Use the provided `randomFor` utilities or inject data via the `data` channel at setup.
140
+ - **Performance**: Settled animation descriptors return `null`, emitting no style overrides. This allows the chunk-merger to effectively collapse static frames, drastically reducing output file size.
141
+
142
+ For detailed guidelines on adding new animation primitives, handling layout shifts, and configuring chart primitives, refer to [`docs/AUTHORING.md`](docs/AUTHORING.md).