@kieransimkin/dancemoves 3.0.2

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 (50) hide show
  1. package/LICENSE +338 -0
  2. package/README.md +893 -0
  3. package/RUDIMENTS-API.md +394 -0
  4. package/docs/README.md +73 -0
  5. package/docs/api/adapters.md +400 -0
  6. package/docs/api/downloads.md +158 -0
  7. package/docs/api/effects.md +463 -0
  8. package/docs/api/javascript.md +500 -0
  9. package/docs/api/paper-planes.md +167 -0
  10. package/docs/api/styling.md +292 -0
  11. package/docs/api/surface.json +446 -0
  12. package/docs/api/wordpress.md +365 -0
  13. package/docs/clay-transform-validation.md +84 -0
  14. package/docs/development.md +254 -0
  15. package/docs/guide.md +288 -0
  16. package/docs/javascript-api.md +292 -0
  17. package/docs/javascript-server.md +150 -0
  18. package/docs/react-next.md +185 -0
  19. package/docs/releasing-shared.md +162 -0
  20. package/docs/rudiments-source-integrity.md +80 -0
  21. package/docs/shared-feature-coverage.md +34 -0
  22. package/docs/shared-runtime-migration.md +111 -0
  23. package/docs/source-audit.md +120 -0
  24. package/docs/validation-setup.md +102 -0
  25. package/docs/wordpress-examples.md +206 -0
  26. package/docs/wordpress-shared-runtime.md +133 -0
  27. package/lib/admin.min.js +1 -0
  28. package/lib/assets/DanceRudiments-LICENSE +21 -0
  29. package/lib/assets/DanceRudiments-build-manifest.json +21 -0
  30. package/lib/assets/paper-dreams-plane-atlas.png +0 -0
  31. package/lib/build-manifest.json +117 -0
  32. package/lib/dancemoves.css +9 -0
  33. package/lib/dancemoves.min.js +5 -0
  34. package/lib/index.cjs +4802 -0
  35. package/lib/index.d.ts +71 -0
  36. package/lib/index.mjs +4780 -0
  37. package/lib/react.cjs +154 -0
  38. package/lib/react.d.ts +12 -0
  39. package/lib/react.mjs +135 -0
  40. package/lib/rudiments.d.ts +124 -0
  41. package/lib/server.cjs +411 -0
  42. package/lib/server.d.ts +11 -0
  43. package/lib/server.mjs +367 -0
  44. package/lib/styles/clay-stars-effects.css +1 -0
  45. package/lib/styles/clay-stars-rudiments.css +1 -0
  46. package/lib/styles/dance-moves-core.css +1 -0
  47. package/lib/styles/ks-epk-device-orientation.css +1 -0
  48. package/lib/styles/paper-dreams-flight.css +1 -0
  49. package/lib/wordpress.js +5 -0
  50. package/package.json +101 -0
@@ -0,0 +1,292 @@
1
+ # CSS and HTML contract
2
+
3
+ [Documentation index](../README.md) · [JavaScript](javascript.md) ·
4
+ [Adapters](adapters.md)
5
+
6
+ Baseline: DanceMoves 2.8.0, commit
7
+ `4cb6a71f60459b5579be87d7e55ac8b1426c578e`.
8
+ Sources: [core JavaScript](../../assets/dance-moves-core.js),
9
+ [core stylesheet](../../assets/dance-moves-core.css),
10
+ [catalogue adopter](../../assets/dance-moves-catalogue-timing.js),
11
+ [orientation JavaScript](../../assets/ks-epk-device-orientation.js),
12
+ [orientation stylesheet](../../assets/ks-epk-device-orientation.css),
13
+ [Clay/Stars JavaScript](../../assets/clay-stars-effects.js), and
14
+ [Clay/Stars stylesheet](../../assets/clay-stars-effects.css).
15
+
16
+ ## Timing custom properties
17
+
18
+ The core writes these properties to `document.documentElement.style` during
19
+ initialisation. Time values have an `ms` suffix and six decimal places. They are
20
+ outputs of the page's boot-time BPM; changing a variable does not change the
21
+ JavaScript clock or persist WordPress metadata.
22
+
23
+ | Property | Value / availability |
24
+ | --- | --- |
25
+ | `--dance-moves-beat` | `60000 / bpm` milliseconds. |
26
+ | `--dance-moves-tick` | `3750 / bpm` milliseconds. |
27
+ | `--dance-moves-1t` through `--dance-moves-16t` | Duration of the corresponding integer tick count. All sixteen exist. |
28
+ | `--dance-moves-32t`, `--dance-moves-64t`, `--dance-moves-128t`, `--dance-moves-192t`, `--dance-moves-432t`, `--dance-moves-1584t`, `--dance-moves-2208t` | Additional predefined durations, processed by `durationMilliseconds()`. |
29
+ | `--dance-moves-neg-64t` | Negative duration of 64 ticks, for animation offsets. |
30
+ | `--dance-moves-lyric-disclosure-duration` | Duration of the quantised configured disclosure ticks; defaults to six ticks. |
31
+ | `--dance-moves-lyric-disclosure-ticks` | Corresponding unitless tick count. |
32
+ | `--dance-moves-shared-control-duration` | Written only when `sharedControlTicks > 0`; quantised tick duration. |
33
+ | `--dance-moves-shared-control-ticks` | Corresponding unitless tick count, under the same condition. |
34
+
35
+ There is no automatic property for an arbitrary count such as
36
+ `--dance-moves-48t`. A release may declare its own property using
37
+ `DanceMoves.durationMilliseconds(48)`, or use an appropriate expression based on
38
+ `--dance-moves-tick`. Preserve the integer-tick/long-duration quantisation rule.
39
+ The predefined names are not a guarantee that arbitrary CSS expressions or
40
+ JavaScript timers will be rewritten automatically.
41
+
42
+ ```css
43
+ /* Release-owned selectors; retain this release's own keyframes and design. */
44
+ .example-epk .cover {
45
+ transition: transform var(--dance-moves-8t) ease;
46
+ }
47
+ .example-epk .ambient {
48
+ animation-duration: var(--dance-moves-64t);
49
+ animation-delay: var(--dance-moves-neg-64t);
50
+ }
51
+ @media (prefers-reduced-motion: reduce) {
52
+ .example-epk .cover { transition: none; }
53
+ .example-epk .ambient { animation: none; }
54
+ }
55
+ ```
56
+
57
+ ## Declarative interval starts
58
+
59
+ | Attribute | Set by | Contract |
60
+ | --- | --- | --- |
61
+ | `data-dance-moves-start-interval` | Page author | Finite numeric interval of at least one tick. Core scans once during initialisation, then calls `deferStart()`. The interval is rounded to an integer, not to a whole-beat duration quantum. |
62
+ | `data-dance-moves-start-clock` | Page author | Literal `audio` chooses the active song; any other/missing value chooses the page clock. |
63
+ | `data-dance-moves-waiting="true"` | `deferStart()` | Scheduling state, removed when released. This attribute alone does not pause CSS animations. |
64
+ | `data-dance-moves-started="true"` | `deferStart()` | Marks the released start and removes the declarative CSS pause. |
65
+
66
+ ```html
67
+ <div data-dance-moves-start-interval="16">Page-beat entrance</div>
68
+ <div data-dance-moves-start-interval="64"
69
+ data-dance-moves-start-clock="audio">Song-bar entrance</div>
70
+ ```
71
+
72
+ The stylesheet pauses the marked element and its `::before`/`::after` animations
73
+ until `data-dance-moves-started="true"`. It does not automatically pause all
74
+ unmarked descendants. At release, `deferStart()` rewinds and plays all animations
75
+ returned by the element's subtree animation query, then invokes an optional
76
+ `start` callback and dispatches bubbling `dance-moves-start` on the element.
77
+ It does not use the narrower cue-animation ownership filter for that rewind.
78
+
79
+ Invalid declarative intervals are skipped by JavaScript but their marker can
80
+ still match the CSS pause selector. Remove an invalid marker rather than leaving
81
+ an element permanently paused. Dynamically inserted markers require an explicit
82
+ `deferStart()` call. Cancelling a deferred start does not clean up its attributes;
83
+ the owning adapter must restore its intended DOM state.
84
+
85
+ ## Shared controls and lyric disclosures
86
+
87
+ When the page's `sharedControlTicks` is positive, the core marks
88
+ `html[data-dance-moves-shared-controls="true"]`. On that page, `.ks-epk
89
+ .epk-button` and `.ks-epk .epk-download` receive important transitions for
90
+ `background-color, color, transform, border-color`, using the shared duration
91
+ and `ease`. This is a specific shared-control override, not a generic transition
92
+ registry. The configured page-ID list is in the [WordPress reference](wordpress.md).
93
+
94
+ `.ks-epk .ks-epk-lyrics-track summary span[aria-hidden]` receives an important
95
+ transform transition using the disclosure duration and `ease`. Both shared
96
+ control transitions and this disclosure transition are removed under reduced
97
+ motion. These rules affect existing markup; the plugin does not create the
98
+ player, downloads or complete lyric section.
99
+
100
+ ## Timed lyric component
101
+
102
+ The core supplies one visual-only layer, appended directly to `document.body`:
103
+
104
+ ```html
105
+ <div class="dance-moves-lyric-popover"
106
+ aria-hidden="true"
107
+ data-dance-moves-lyric-state="idle">
108
+ <span class="dance-moves-lyric-popover__text"></span>
109
+ </div>
110
+ ```
111
+
112
+ It is **not a descendant of the EPK root**. A selector such as
113
+ `.ks-epk .dance-moves-lyric-popover` will not match the generated layer. Use a
114
+ release-specific body/page selector or deliberately assign a release marker to
115
+ the component. Palette defaults are declared on the component itself, so override
116
+ these properties on a matching component selector, not only on an ancestor.
117
+
118
+ | Styling hook | Meaning |
119
+ | --- | --- |
120
+ | `.dance-moves-lyric-popover` | Fixed, non-interactive outer layer; neutral default `z-index: 9998`, safe-area-aware side/bottom offsets, six-tick opacity/transform transitions. |
121
+ | `.dance-moves-lyric-popover__text` | Actual text node container; neutral type, border, background, padding and wrapping. |
122
+ | `--dance-moves-lyric-bg` | Default `rgba(20, 20, 24, 0.94)` on the outer layer. |
123
+ | `--dance-moves-lyric-border` | Default `rgba(255, 255, 255, 0.28)` on the outer layer. |
124
+ | `--dance-moves-lyric-color` | Default `#fff` on the outer layer. |
125
+ | `data-dance-moves-lyric-state="active"` | Current text is nonblank during playback; visible treatment. |
126
+ | `data-dance-moves-lyric-state="idle"` | Initial, blank, paused or ended visual state; default opacity zero. |
127
+ | `data-dance-moves-lyric-index` | Index of the last rendered lyric entry, including `-1` before the first entry. Not present before the first update. |
128
+ | `data-dance-moves-lyric-pulse="true"` | Removed and re-added on index changes to restart the text arrival animation. |
129
+ | `dance-moves-lyric-arrive` | Neutral six-tick arrival keyframe animation, attached to the text span while the pulse marker is present. |
130
+
131
+ The default text block has a maximum width of `min(44rem, 100%)`, balanced centred
132
+ text and responsive font sizing. Reduced motion removes component animation,
133
+ transitions and transforms but keeps the words. Forced colours use `Canvas`,
134
+ `CanvasText`, a two-pixel border and no shadow.
135
+
136
+ For example, a **structural override**, not an approved song treatment, could
137
+ reserve space above a particular page's player:
138
+
139
+ ```css
140
+ /* Substitute the actual owning page and its reviewed player clearance. */
141
+ body.page-id-252 .dance-moves-lyric-popover {
142
+ bottom: max(6rem, env(safe-area-inset-bottom));
143
+ }
144
+ ```
145
+
146
+ Do not use this example as approval to enable lyrics on page 252 or copy its
147
+ artwork/identity elsewhere. Follow the release-specific visual-language process
148
+ in the [guide](../guide.md). An override must preserve safe areas, narrow-screen
149
+ wrapping, real text, player clearance, reduced motion, forced colours and the
150
+ complete accessible lyric section.
151
+
152
+ The layer is `aria-hidden`, not a live region. The complete readable lyrics
153
+ remain the accessible source. Text is assigned with `textContent`; timing-file
154
+ content is never HTML. `onLyric()` and `dance-moves-lyric` run **before** that
155
+ frame's component update, so use their detail payload rather than expecting the
156
+ DOM to have already changed. Pause/end hide the visual layer without clearing
157
+ its text/index and without sending a blank lyric event. Custom renderers need
158
+ corresponding media lifecycle listeners.
159
+
160
+ Enabling pop-ups without usable lyric entries is not a supported publishing
161
+ workflow. Initialisation creates the layer only when entries exist, but a later
162
+ bound-audio tick can create an empty idle layer when the flag is enabled even
163
+ with an empty lyric list. Do not use mere layer existence as proof of successful
164
+ LRC loading.
165
+
166
+ ## Core and catalogue DOM diagnostics
167
+
168
+ These are outputs for inspection, not writable configuration APIs. Attributes
169
+ use their HTML names below; JavaScript reads them through camel-cased `dataset`.
170
+
171
+ | Element | Attribute | Values / purpose |
172
+ | --- | --- | --- |
173
+ | `<html>` | `data-dance-moves-version` | Boot configuration version string. |
174
+ | `<html>` and first `.ks-epk` | `data-dance-moves-bpm` | Effective numeric BPM string. |
175
+ | `<html>` and first `.ks-epk` | `data-dance-moves-bpm-source` | `explicit` or `fallback`. |
176
+ | `<html>` | `data-dance-moves-shared-controls` | `true` when the shared-control override is enabled; otherwise absent. |
177
+ | First `.ks-epk` | `data-dance-moves-lyric-timing` | Resolved lyric URL, when configured. |
178
+ | First `.ks-epk` | `data-dance-moves-cue-timing` | Resolved cue URL, when configured. |
179
+ | `<html>` | `data-dance-moves-cue-count`, `data-dance-moves-lyric-count` | Parsed entry counts after both fetch promises settle. |
180
+ | `<html>` | `data-dance-moves-cue-status`, `data-dance-moves-lyric-status` | Final `ready` for nonempty lists, otherwise `none`; a fetch failure briefly writes `unavailable` but initialisation overwrites it. |
181
+ | Matching `<audio>` | `data-dance-moves-timing` | `master-length` once bound. |
182
+ | Designated `<audio>` | `data-dance-moves-master` | Author-supplied, presence-only candidate for duration inference when no master duration is supplied. |
183
+ | Catalogue EPK root | `data-dance-moves-catalogue-root` | `ready`. |
184
+ | Catalogue EPK root and `<html>` | `data-dance-moves-catalogue-timing` | `ready` after a conversion pass. |
185
+ | Catalogue EPK root | `data-dance-moves-catalogue-timing-conversions` | Retained evidence count, capped at 1,000; not necessarily all actual conversions. |
186
+ | Elements needing pseudo-element overrides | `data-dance-moves-timing-element` | Generated numeric selector identifier. |
187
+
188
+ The generated style element has ID `dance-moves-catalogue-pseudo-timing`.
189
+ Select the actual EPK root when auditing; a broad readiness selector can match
190
+ `<html>` first. Catalogue conversion covers owned timing declarations and
191
+ referenced variables, not arbitrary JavaScript, shaders or canvas phase logic.
192
+ Its reduced-motion rule clamps the owned root, descendants and pseudo-elements
193
+ to one `0.01ms` animation iteration, zero delay, `0.01ms` transitions, and
194
+ `scroll-behavior: auto`. See the [ownership caveats](adapters.md#what-gets-converted)
195
+ before assuming a broad stylesheet selector isolates the EPK from other elements.
196
+
197
+ ## Orientation DOM state and release outputs
198
+
199
+ | Hook | Meaning |
200
+ | --- | --- |
201
+ | `.ks-epk-orientation-control` | Body-level permission/status button, with visible focus treatment, forced-colours fallback and safe-area positioning; hidden by reduced-motion CSS. |
202
+ | `data-ks-orientation` | On the adapter root: `supported` while reset/idle, `active` after a target commit. It is not an enum containing every permission failure. |
203
+ | `data-ks-orientation-adapter` | Configured adapter key or `detected`. |
204
+ | `data-ks-orientation-window` | Runtime mapping window: `2000` milliseconds. |
205
+ | `data-ks-orientation-target-ticks` | Target write cadence, normally `2`. |
206
+ | `data-ks-orientation-target-milliseconds` | Corresponding cadence, with three decimal places. |
207
+
208
+ The input lifecycle, page mapping and helper APIs are in the
209
+ [adapter reference](adapters.md#orientation-page-map). The following CSS outputs
210
+ belong to the named release; they are not a cross-release configuration contract.
211
+ The runtime writes/resets them, so direct manual changes may be overwritten.
212
+
213
+ | Adapter | Output location and properties |
214
+ | --- | --- |
215
+ | Light Will Win | Root `--lww-cover-x`, `--lww-cover-y`; selected cards `--lww-tilt-x`, `--lww-tilt-y`. |
216
+ | Dying for a Diagnosis | Cover `--cover-x`, `--cover-y`, `--cover-rotate`; parallax image gets an inline `transform`. |
217
+ | Presents & Chocolate | Root `--pc-sensor-x`, `--pc-sensor-y`, `--pc-sensor-rotate`. |
218
+ | Fully Nocturnal | Root `--fnx-shift-x`, `--fnx-shift-y`; cover `--fnx-card-x`, `--fnx-card-y`, `--fnx-card-shift-x`, `--fnx-card-shift-y`. |
219
+ | Amnesty, honestly? | Root `--epk-tilt-x`, `--epk-tilt-y`, `--epk-shift-x`, `--epk-shift-y`, `--epk-heading-x`, `--epk-heading-y`. |
220
+ | Walk With Me | Cover `--wwm-tilt-x`, `--wwm-tilt-y`, `--wwm-shift-x`, `--wwm-shift-y`, `--wwm-glow-x`, `--wwm-glow-y`. |
221
+ | Dmitri My Talisman | Root `--mx`, `--my`, `--parallax-x`, `--parallax-y`, `--tilt-x`, `--tilt-y`. |
222
+ | Clay/Stars | Delegates to `DanceMovesClayStars`; outputs below. |
223
+ | California Screamin' | Root `--cs-x`, `--cs-y`; reset writes `0`. |
224
+
225
+ Most active orientation targets transition `transform` over
226
+ `var(--dance-moves-2t, 62.5ms)` with the bundled easing. Light Will Win's hero
227
+ instead transitions `background-position`; therefore **not all existing
228
+ orientation CSS is compositor-only**. Device measurements, not a blanket claim,
229
+ are required for performance approval. Existing page CSS supplies the rest of
230
+ the artwork-specific transform composition.
231
+
232
+ ## Clay/Stars DOM and styling state
233
+
234
+ The treatment is scoped to `.ks-clay-stars-v2`. The content filter can add
235
+ `.ks-warm-bloom`, `.ks-lens-flare`, `.ks-specular-sweep` inside the cover wrapper,
236
+ and `.ks-cloud-field` alongside the atmosphere layer. They are decorative,
237
+ `aria-hidden` elements; they are not shared artwork components.
238
+
239
+ | Hook | Meaning |
240
+ | --- | --- |
241
+ | `data-dance-moves-clay-runtime` | `ready` after initialisation, `stopped` after teardown. |
242
+ | `data-dance-moves-clay-lifecycle` | Last lifecycle label, such as `reset`, `hidden`, `visible`, `seeking`, `seeked` or `reduced-motion`. |
243
+ | `data-dance-moves-cue`, `data-dance-moves-cue-type` | Lowercased, whitespace-hyphenated cue state, removed on clear. |
244
+ | `data-dance-moves-performance` | `full`, `constrained` or `minimal`; controlled by the adaptive monitor. |
245
+ | `data-dance-moves-performance-reason` | Reason such as `initial`, `sustained-low-fps`, `low-fps-after-constrained`, `recovery-probe`, `recovery-probe-failed` or `recovery-confirmed`. |
246
+ | `--ks-master-intensity` | Root output of the enabled/intensity settings. |
247
+ | `--ks-particle-release-duration` | Root output of the configured release ticks. |
248
+ | `--ks-rx`, `--ks-ry` | Cover rotation targets in degrees. |
249
+ | `--ks-tx`, `--ks-ty` | Cover translation targets in pixels. |
250
+ | `--ks-bloom-x`, `--ks-bloom-y`, `--ks-flare-x`, `--ks-flare-y`, `--ks-spec-x`, `--ks-spec-y` | Cover-level light-plane translation targets in pixels. |
251
+ | `.ks-particle-release` | Transient control class during a captured-orbit release. |
252
+ | `--ks-orbit-release-opacity`, `--ks-orbit-release-transform` | Control-local captured pseudo-element state used during release, then removed. |
253
+
254
+ `constrained` and `minimal` stop the cloud, atmosphere and gold-sparkle ambient
255
+ loops while preserving static layers. `minimal` additionally removes filtering
256
+ and blending on the cloud/atmosphere planes. These markers do not imply that the
257
+ whole EPK or all interactions have stopped. Recovery can restore a higher tier;
258
+ see [performance behaviour](adapters.md#recoverable-claystars-performance-tiers).
259
+ The stylesheet's older comment about two poor windows is not the current
260
+ JavaScript default, which is three.
261
+
262
+ Reduced motion removes the non-essential treatment's animations/transitions;
263
+ forced colours hides decorative light/cloud planes and sparkle pseudo-elements
264
+ and simplifies shadows. Do not override these fallbacks with later high-specificity
265
+ release rules. Use `setParameters()` and the documented lifecycle rather than
266
+ manually forcing profile attributes while the monitor is running.
267
+
268
+
269
+ ## Shared-effect and paper-plane outputs
270
+
271
+ The new primitives do not inherit the Clay/Stars appearance. See [effects.md](effects.md)
272
+ for full option/default and lifecycle contracts, and [paper-planes.md](paper-planes.md)
273
+ for the generated sprite DOM. All fields below are output state, not settings to
274
+ mutate instead of calling the corresponding API.
275
+
276
+ | Owner | Output | Meaning |
277
+ | --- | --- | --- |
278
+ | `pointer()` root | `--dance-moves-x`, `--dance-moves-y` | Four-decimal normalized input values; unitless. |
279
+ | `pointer()` root | `data-dance-moves-pointer` | Ready/active/reset reason. |
280
+ | `playbackPulse()` root | `--dance-moves-pulse-duration`, `--dance-moves-pulse-delay` | Default-prefix second-valued duration and negative phase; custom prefix allowed. |
281
+ | `playbackPulse()` root | `.dance-moves-playing`, `data-dance-moves-pulse` | Default playing class and inactive/paused/playing marker; class configurable. |
282
+ | `cueClass()` root | `.dance-moves-cue-active`, `data-dance-moves-cue-effect` | Default finite class and lifecycle reason; class configurable. |
283
+ | `cueTimeline()` root | `data-dance-moves-cue-timeline` | Last published render reason, not necessarily snapshot status. |
284
+ | `quality()` root | `data-dance-moves-quality`, `data-dance-moves-quality-reason` | Current tier and publish reason. |
285
+ | `quality()` root | `data-dance-moves-fps`, `data-dance-moves-reference-fps` | Last sample/reference as one-decimal strings. Not physical display-rate proof. |
286
+ | Paper stage | `data-quality`, `--paper-dreams-atlas` | Full/compact/static stage mode and atlas URL. |
287
+ | Paper plane | `data-depth`, `data-flight-state`, sprite/size/opacity properties | Per-plane visual state; see the dedicated table. |
288
+
289
+ Callbacks may still run when their effect is inactive; the consumer must provide
290
+ its own static rendering branch. The generic quality controller does not install
291
+ CSS reductions. Do not rely on writing a tier attribute to enforce reduced motion,
292
+ or assume forced-colour hiding always cancels a renderer's JavaScript loop.