kuinetic 0.1.3 → 0.2.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 (125) hide show
  1. package/README.md +93 -10
  2. package/dist/esm/advanced/index.mjs +4727 -0
  3. package/dist/esm/chunk-AEQGC2KM.mjs +189 -0
  4. package/dist/esm/chunk-MQSNMYRP.mjs +9332 -0
  5. package/dist/esm/chunk-RVTYN6NZ.mjs +3446 -0
  6. package/dist/esm/chunk-U43BX5O2.mjs +2984 -0
  7. package/dist/esm/core/index.mjs +16 -9
  8. package/dist/esm/effects/index.mjs +19 -4
  9. package/dist/esm/index.mjs +17 -10
  10. package/dist/kuinetic.advanced.js +5070 -0
  11. package/dist/kuinetic.advanced.min.js +749 -0
  12. package/dist/kuinetic.all.js +15218 -5595
  13. package/dist/kuinetic.all.min.js +2 -0
  14. package/dist/kuinetic.css +2900 -360
  15. package/dist/kuinetic.js +15217 -5593
  16. package/dist/kuinetic.min.css +1 -0
  17. package/dist/kuinetic.min.js +7 -0
  18. package/dist/types/3d/angles.d.ts +30 -0
  19. package/dist/types/3d/flattening.d.ts +49 -0
  20. package/dist/types/3d/index.d.ts +36 -0
  21. package/dist/types/3d/model-3d.d.ts +115 -0
  22. package/dist/types/3d/register.d.ts +26 -0
  23. package/dist/types/3d/webgl.d.ts +24 -0
  24. package/dist/types/advanced/audio.d.ts +322 -0
  25. package/dist/types/advanced/base.d.ts +233 -0
  26. package/dist/types/advanced/camera-3d.d.ts +236 -0
  27. package/dist/types/advanced/fluid-cursor.d.ts +149 -0
  28. package/dist/types/advanced/gl-utils.d.ts +52 -0
  29. package/dist/types/advanced/glsl.d.ts +60 -0
  30. package/dist/types/advanced/index.d.ts +23 -0
  31. package/dist/types/advanced/particles.d.ts +108 -0
  32. package/dist/types/advanced/scenes.d.ts +207 -0
  33. package/dist/types/advanced/shaders.d.ts +972 -0
  34. package/dist/types/browser/boot.d.ts +72 -0
  35. package/dist/types/core/activation.d.ts +227 -2
  36. package/dist/types/core/animator.d.ts +446 -11
  37. package/dist/types/core/attrs.d.ts +9 -0
  38. package/dist/types/core/breakpoints.d.ts +260 -0
  39. package/dist/types/core/bundles.d.ts +71 -0
  40. package/dist/types/core/callback.d.ts +64 -0
  41. package/dist/types/core/capabilities.d.ts +47 -0
  42. package/dist/types/core/channels.d.ts +120 -2
  43. package/dist/types/core/cloak-selectors.d.ts +47 -0
  44. package/dist/types/core/compile.d.ts +207 -2
  45. package/dist/types/core/control.d.ts +218 -0
  46. package/dist/types/core/declarations.d.ts +128 -0
  47. package/dist/types/core/derived/aggregate.d.ts +43 -0
  48. package/dist/types/core/derived/book.d.ts +30 -0
  49. package/dist/types/core/derived/diagnostics.d.ts +51 -0
  50. package/dist/types/core/derived/group-gate.d.ts +62 -0
  51. package/dist/types/core/derived/install.d.ts +110 -0
  52. package/dist/types/core/derived/late-matches.d.ts +19 -0
  53. package/dist/types/core/derived/types.d.ts +108 -0
  54. package/dist/types/core/easing.d.ts +57 -0
  55. package/dist/types/core/element-config.d.ts +47 -6
  56. package/dist/types/core/element-size.d.ts +23 -0
  57. package/dist/types/core/event-sources.d.ts +39 -0
  58. package/dist/types/core/flip.d.ts +34 -1
  59. package/dist/types/core/gesture.d.ts +12 -0
  60. package/dist/types/core/host-facts.d.ts +155 -0
  61. package/dist/types/core/index.d.ts +7 -3
  62. package/dist/types/core/owned-styles.d.ts +129 -2
  63. package/dist/types/core/params.d.ts +48 -0
  64. package/dist/types/core/parse.d.ts +28 -1
  65. package/dist/types/core/register-into.d.ts +29 -0
  66. package/dist/types/core/registry.d.ts +10 -3
  67. package/dist/types/core/repeat.d.ts +91 -0
  68. package/dist/types/core/sequence.d.ts +126 -0
  69. package/dist/types/core/stagger-config.d.ts +199 -0
  70. package/dist/types/core/stagger-keys.d.ts +63 -0
  71. package/dist/types/core/stagger.d.ts +187 -6
  72. package/dist/types/core/style-plan.d.ts +21 -16
  73. package/dist/types/core/target.d.ts +128 -0
  74. package/dist/types/core/threshold-reachability.d.ts +45 -0
  75. package/dist/types/core/time-scale.d.ts +9 -0
  76. package/dist/types/core/toggle-actions.d.ts +141 -0
  77. package/dist/types/core/travel.d.ts +59 -0
  78. package/dist/types/core/types.d.ts +705 -13
  79. package/dist/types/core/unquoted-selectors.d.ts +53 -0
  80. package/dist/types/effects/carousel/drag.d.ts +80 -0
  81. package/dist/types/effects/carousel/index.d.ts +149 -0
  82. package/dist/types/effects/catalog/background-media.d.ts +152 -0
  83. package/dist/types/effects/catalog/discrete.d.ts +13 -0
  84. package/dist/types/effects/catalog/interaction-proximity.d.ts +24 -0
  85. package/dist/types/effects/catalog/interaction-reveal.d.ts +248 -0
  86. package/dist/types/effects/catalog/interaction-shared.d.ts +42 -0
  87. package/dist/types/effects/catalog/interaction-states.d.ts +68 -0
  88. package/dist/types/effects/catalog/materials.d.ts +67 -0
  89. package/dist/types/effects/catalog/media-shared.d.ts +3 -2
  90. package/dist/types/effects/catalog/numbers-shared.d.ts +8 -5
  91. package/dist/types/effects/catalog/shared.d.ts +2 -2
  92. package/dist/types/effects/catalog/text-shared.d.ts +92 -10
  93. package/dist/types/effects/catalog/transforms.d.ts +13 -0
  94. package/dist/types/effects/catalog/view-transitions.d.ts +13 -0
  95. package/dist/types/effects/forms/primitives.d.ts +15 -4
  96. package/dist/types/effects/gestures/index.d.ts +53 -0
  97. package/dist/types/effects/index.d.ts +5 -0
  98. package/dist/types/effects/layout/presets.d.ts +35 -0
  99. package/dist/types/effects/motion-path/index.d.ts +35 -0
  100. package/dist/types/effects/scroll-mechanics/params.d.ts +23 -0
  101. package/dist/types/effects/scroll-mechanics/presets.d.ts +51 -0
  102. package/dist/types/effects/scroll-mechanics/section-index.d.ts +47 -0
  103. package/dist/types/effects/shared.d.ts +162 -2
  104. package/dist/types/effects/step-index.d.ts +121 -0
  105. package/dist/types/effects/step-marking.d.ts +41 -33
  106. package/dist/types/effects/svg/icon-parts.d.ts +23 -0
  107. package/dist/types/effects/three-d/flip-parts.d.ts +46 -0
  108. package/dist/types/effects/tween/index.d.ts +57 -0
  109. package/dist/types/effects/tween/properties.d.ts +107 -0
  110. package/dist/types/effects/tween/waypoints.d.ts +106 -0
  111. package/dist/types/showcase/compare.d.ts +4 -0
  112. package/dist/types/showcase/device-frame.d.ts +3 -0
  113. package/dist/types/showcase/hotspots.d.ts +3 -0
  114. package/dist/types/showcase/index.d.ts +30 -0
  115. package/dist/types/showcase/lightbox.d.ts +3 -0
  116. package/dist/types/showcase/media-source.d.ts +13 -0
  117. package/dist/types/showcase/modal-shell.d.ts +22 -0
  118. package/dist/types/showcase/scroll-story.d.ts +4 -0
  119. package/dist/types/showcase/shared.d.ts +47 -0
  120. package/dist/types/showcase/slideshow.d.ts +3 -0
  121. package/dist/types/showcase/slow-mo.d.ts +5 -0
  122. package/package.json +14 -7
  123. package/dist/esm/chunk-5DON3UFQ.mjs +0 -4380
  124. package/dist/esm/chunk-JT4PZL3A.mjs +0 -773
  125. package/dist/esm/chunk-QUVFODSQ.mjs +0 -1278
package/README.md CHANGED
@@ -10,8 +10,13 @@ wherever CSS can do it. Standalone, MIT, npm + CDN, framework-agnostic. No produ
10
10
  <h1 data-kui="fade-up">Hello.</h1>
11
11
  ```
12
12
 
13
- 252 named effects across scroll reveals, hover/interaction, text, numbers, layout, SVG, 3D, and
14
- gesture-driven motion. 100% branch/statement/function/line test coverage, over 800 tests.
13
+ 302 named effects across scroll reveals, hover/interaction, text, numbers, layout, SVG, 3D, and
14
+ gesture-driven motion. 3,800+ unit tests. The jsdom suite holds `src/` at 100%
15
+ line/branch/function/statement coverage with two carve-outs: the WebGL tier in `src/advanced/`
16
+ (`shaders.ts`, `gl-utils.ts`, `fluid-cursor.ts`, `particles.ts`), whose GPU paths cannot execute
17
+ without a real context and report below 100%, and `src/effects/gestures/primitives.ts`, which
18
+ `vitest.config.ts` excludes from the metric outright. Both are exercised by the real-browser tier
19
+ under `test/browser/` instead.
15
20
 
16
21
  ## Install
17
22
 
@@ -23,12 +28,23 @@ load) — download `kuinetic.js` + `kuinetic.css`, or use them straight from the
23
28
  ```html
24
29
  <link rel="stylesheet" href="./kuinetic.css">
25
30
  <script src="./kuinetic.js"></script>
31
+ ```
32
+
33
+ That is the whole integration — no JavaScript of your own. The script starts itself once the
34
+ document is ready, with `observe: true`, so elements added later by your app, a CMS or a
35
+ client-side router are picked up automatically.
36
+
37
+ To drive it by hand instead, put `data-kui-manual` on the tag and the script does nothing until you
38
+ say so:
39
+
40
+ ```html
41
+ <script src="./kuinetic.js" data-kui-manual></script>
26
42
  <script>
27
43
  kuinetic.kuinetic({ observe: true }).start()
28
44
  </script>
29
45
  ```
30
46
 
31
- **One tag, self-hosted** — CSS embedded, auto-started with `observe: true`:
47
+ **One tag, self-hosted** — same auto-start, CSS embedded so there is no `<link>` either:
32
48
 
33
49
  ```html
34
50
  <script src="./kuinetic.all.js"></script>
@@ -38,7 +54,7 @@ load) — download `kuinetic.js` + `kuinetic.css`, or use them straight from the
38
54
 
39
55
  ```html
40
56
  <!-- one-tag convenience -->
41
- <script src="https://kuinetic.pages.dev/kuinetic.all.js"></script>
57
+ <script src="https://kuinetic.pages.dev/kuinetic.all.min.js"></script>
42
58
  ```
43
59
 
44
60
  Or via npm, with a bundler:
@@ -54,6 +70,37 @@ import 'kuinetic/css'
54
70
  kuinetic({ observe: true }).start()
55
71
  ```
56
72
 
73
+ ### Experimental: the advanced tier
74
+
75
+ A separate, opt-in set of WebGL, CSS-3D and Web-Audio primitives — shader surfaces, a depth camera,
76
+ particle dissolve, a fluid cursor trail, and an audio-reactive driver. It is a **tier**: a second
77
+ file you add beside core, never a different build of core.
78
+
79
+ ```html
80
+ <script src="./kuinetic.js"></script>
81
+ <script src="./kuinetic.advanced.js"></script>
82
+ ```
83
+
84
+ In either order, with nothing else. Core is not shipped twice — the tier externalises it — and the
85
+ two find each other and share one animator. A later tier (`kuinetic.3d.js`, when it exists) is
86
+ another tag on the same terms, never a combined bundle.
87
+
88
+ Or via npm, where the subpath resolves to the same package instance:
89
+
90
+ ```js
91
+ import { kuinetic } from 'kuinetic'
92
+ import { registerAdvanced } from 'kuinetic/advanced'
93
+
94
+ const k = kuinetic()
95
+ registerAdvanced(k) // or one module at a time: registerShaders, registerCamera, …
96
+ k.start()
97
+ ```
98
+
99
+ It is **unstable and not covered by the guarantees the rest of this README makes** — the API can
100
+ change without a major version, and nothing here is CSS-first or zero-dependency. Nothing is imported
101
+ unless you write that import: the default entry is byte-for-byte the same whether or not this
102
+ subpath exists. See `docs/advanced-modules.md` for what each module does and what it costs.
103
+
57
104
  ### CDN reference
58
105
 
59
106
  Every file is mirrored on jsDelivr and unpkg — both update automatically from every npm release,
@@ -63,15 +110,29 @@ no separate action needed — and additionally self-hosted on Cloudflare at **`k
63
110
  |---|---|---|---|
64
111
  | `kuinetic.js` | [`/npm/kuinetic`](https://cdn.jsdelivr.net/npm/kuinetic) † | [`/kuinetic`](https://unpkg.com/kuinetic) † | [`/kuinetic.js`](https://kuinetic.pages.dev/kuinetic.js) |
65
112
  | `kuinetic.css` | [`/npm/kuinetic/dist/kuinetic.css`](https://cdn.jsdelivr.net/npm/kuinetic/dist/kuinetic.css) | [`/kuinetic/dist/kuinetic.css`](https://unpkg.com/kuinetic/dist/kuinetic.css) | [`/kuinetic.css`](https://kuinetic.pages.dev/kuinetic.css) |
66
- | `kuinetic.all.js` | [`/npm/kuinetic/dist/kuinetic.all.js`](https://cdn.jsdelivr.net/npm/kuinetic/dist/kuinetic.all.js) | [`/kuinetic/dist/kuinetic.all.js`](https://unpkg.com/kuinetic/dist/kuinetic.all.js) | [`/kuinetic.all.js`](https://kuinetic.pages.dev/kuinetic.all.js) |
113
+ | `kuinetic.all.min.js` | [`/npm/kuinetic/dist/kuinetic.all.min.js`](https://cdn.jsdelivr.net/npm/kuinetic/dist/kuinetic.all.min.js) | [`/kuinetic/dist/kuinetic.all.min.js`](https://unpkg.com/kuinetic/dist/kuinetic.all.min.js) | [`/kuinetic.all.min.js`](https://kuinetic.pages.dev/kuinetic.all.min.js) |
114
+ | `kuinetic.advanced.min.js` | [`/npm/kuinetic/dist/kuinetic.advanced.min.js`](https://cdn.jsdelivr.net/npm/kuinetic/dist/kuinetic.advanced.min.js) | [`/kuinetic/dist/kuinetic.advanced.min.js`](https://unpkg.com/kuinetic/dist/kuinetic.advanced.min.js) | — |
67
115
 
68
116
  † shorthand — resolves via the `"jsdelivr"`/`"unpkg"` fields in `package.json`; only `kuinetic.js`
69
117
  gets one, since a package can only designate a single default file that way.
70
118
 
71
- `kuinetic.js` is the split bundle — side-effect-free on load, pair it with `kuinetic.css`, which
72
- keeps working even if the JS is slow,
73
- blocked, or fails to load. `kuinetic.all.js` is the one-tag drop-in — CSS embedded, auto-started
74
- with `observe: true` — trading that CSS-independence guarantee for one less step.
119
+ `kuinetic.js` is the split bundle — pair it with `kuinetic.css`, which keeps working even if the JS
120
+ is slow, blocked, or fails to load. `kuinetic.all.min.js` is the one-tag drop-in, the same thing with
121
+ the CSS embedded, trading that CSS-independence guarantee for one less step. (`kuinetic.all.js` is
122
+ its readable, unminified twin, about twice the transfer size; use it only for debugging.)
123
+ `kuinetic.advanced.min.js` is a tier: it needs core on the page, in either order, and never carries
124
+ a copy of it.
125
+
126
+ Every one of those browser bundles starts itself once the document is ready. `data-kui-manual` on a
127
+ `<script>` tag turns that off for that file. Importing from npm does **not** start anything — a
128
+ module import stays side-effect-free, which is the guarantee the bundler path is built on.
129
+
130
+ > **Changed in 0.2.** These bundles used to do nothing until you called
131
+ > `kuinetic.kuinetic({ observe: true }).start()` yourself, and `kuinetic.all.js` started itself the
132
+ > instant it parsed rather than at `DOMContentLoaded`. If you already write that call, it keeps
133
+ > working and your animator is still the one the page uses — you will see one console line saying
134
+ > the call is now redundant. Add `data-kui-manual` to the tag to silence it and go back to driving
135
+ > everything by hand.
75
136
 
76
137
  ## Your first animation
77
138
 
@@ -86,6 +147,16 @@ comma-separating them — no wrapper element, no extra markup:
86
147
  <h1 data-kui="slide-up 800ms, blur-in 400ms">
87
148
  ```
88
149
 
150
+ A composition worth repeating gets a name, with no build step. Define it once in a `<template>` —
151
+ which never renders, so it can sit anywhere on the page, including below the elements that use it:
152
+
153
+ ```html
154
+ <template data-kui-define="card-in" data-kui="fade-up 700ms, blur-in 400ms at:-200ms"></template>
155
+
156
+ <article data-kui="card-in"></article>
157
+ <article data-kui="card-in 300ms">…the same bundle, faster</article>
158
+ ```
159
+
89
160
  Not every effect is a scroll reveal — switch `on:` to drive it from hover, click, focus, or call it
90
161
  manually:
91
162
 
@@ -93,10 +164,22 @@ manually:
93
164
  <button data-kui="shine-sweep">Hover me</button>
94
165
  ```
95
166
 
167
+ Every animated element dispatches `kui:start` / `kui:finish` / `kui:reverse-finish` / `kui:cancel`
168
+ as ordinary bubbling DOM events, so `addEventListener('kui:finish', fn)` is all you need to chain
169
+ work off an animation — and it is what any project with a build step should use. On a no-build page,
170
+ `func:` names a global function to run at that same moment instead:
171
+
172
+ ```html
173
+ <div data-kui="fade-up func:onReveal">…</div>
174
+ ```
175
+
176
+ `func:` is a lookup by name on `window`, so never build its value from a CMS field or any other
177
+ untrusted input — see Getting Started for the full note.
178
+
96
179
  ## Docs
97
180
 
98
181
  - **Getting Started** — install, first animation, timing, composition, common mistakes.
99
- - **Catalog** — all 252 named effects, grouped by category, with renderer and channel metadata.
182
+ - **Catalog** — all 302 named effects, grouped by category, with renderer and channel metadata.
100
183
  - **Architecture** — the attribute grammar, the composition model, and why the library is built
101
184
  the way it is (`docs/design.md` in this repo).
102
185