kuinetic 0.2.3 → 0.3.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.
- package/README.md +2 -2
- package/dist/esm/advanced/index.mjs +1 -1
- package/dist/esm/{chunk-FYMZW5N2.mjs → chunk-4QKMEDM4.mjs} +6745 -2562
- package/dist/esm/{chunk-FASAEQDR.mjs → chunk-7NW4OLOC.mjs} +506 -29
- package/dist/esm/{chunk-MZQG2VMG.mjs → chunk-DAVDOYOS.mjs} +92 -495
- package/dist/esm/{chunk-AEQGC2KM.mjs → chunk-EDFJTT5B.mjs} +2 -1
- package/dist/esm/core/index.mjs +3 -3
- package/dist/esm/effects/index.mjs +3 -3
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/notes/index.mjs +284 -5
- package/dist/kuinetic.advanced.js +2 -1
- package/dist/kuinetic.advanced.min.js +1 -1
- package/dist/kuinetic.all.js +5158 -930
- package/dist/kuinetic.all.min.js +2 -2
- package/dist/kuinetic.css +1207 -73
- package/dist/kuinetic.js +5157 -929
- package/dist/kuinetic.min.css +1 -1
- package/dist/kuinetic.min.js +1 -1
- package/dist/kuinetic.notes.js +1 -1
- package/dist/types/advanced/shaders.d.ts +1 -1
- package/dist/types/core/channels.d.ts +1 -1
- package/dist/types/core/easing.d.ts +9 -0
- package/dist/types/core/effect-context.d.ts +5 -0
- package/dist/types/core/element-config.d.ts +2 -0
- package/dist/types/core/flip.d.ts +25 -1
- package/dist/types/core/gesture.d.ts +5 -0
- package/dist/types/core/image-flight.d.ts +23 -0
- package/dist/types/core/js-effect-preparer.d.ts +3 -1
- package/dist/types/core/owned-styles.d.ts +2 -1
- package/dist/types/core/params.d.ts +1 -1
- package/dist/types/core/parse.d.ts +1 -0
- package/dist/types/core/registry.d.ts +1 -1
- package/dist/types/core/types.d.ts +11 -1
- package/dist/types/effects/auto-motion.d.ts +8 -0
- package/dist/types/effects/carousel/archive.d.ts +18 -0
- package/dist/types/effects/carousel/coast.d.ts +7 -0
- package/dist/types/effects/carousel/deck.d.ts +26 -2
- package/dist/types/effects/carousel/drag.d.ts +19 -7
- package/dist/types/effects/carousel/glide.d.ts +89 -0
- package/dist/types/effects/carousel/index.d.ts +7 -0
- package/dist/types/effects/carousel/line.d.ts +10 -0
- package/dist/types/effects/carousel/row-copies.d.ts +10 -0
- package/dist/types/effects/carousel/row.d.ts +3 -0
- package/dist/types/effects/carousel/shape-fit.d.ts +46 -0
- package/dist/types/effects/carousel/sources.d.ts +26 -0
- package/dist/types/effects/carousel/sphere.d.ts +23 -0
- package/dist/types/effects/carousel/stack.d.ts +4 -3
- package/dist/types/effects/catalog/confetti.d.ts +2 -0
- package/dist/types/effects/catalog/cursor-trail.d.ts +2 -0
- package/dist/types/effects/catalog/curtains.d.ts +2 -0
- package/dist/types/effects/catalog/image-flight.d.ts +2 -0
- package/dist/types/effects/catalog/line-boil.d.ts +2 -0
- package/dist/types/effects/catalog/number-tokens.d.ts +5 -0
- package/dist/types/effects/catalog/numbers-shared.d.ts +3 -4
- package/dist/types/effects/catalog/text-shared.d.ts +13 -6
- package/dist/types/effects/catalog/typewriter-scatter.d.ts +5 -0
- package/dist/types/effects/catalog/view-transitions.d.ts +32 -1
- package/dist/types/effects/catalog/wobble.d.ts +2 -0
- package/dist/types/effects/gestures/drag-options.d.ts +17 -0
- package/dist/types/effects/layout/departures.d.ts +21 -0
- package/dist/types/effects/motion-path/fit.d.ts +4 -0
- package/dist/types/effects/scroll-mechanics/progress-output.d.ts +9 -0
- package/dist/types/effects/step-marking.d.ts +7 -4
- package/dist/types/effects/svg/morph-loop.d.ts +5 -0
- package/dist/types/effects/svg/text-path.d.ts +2 -0
- package/dist/types/effects/three-d/cube.d.ts +2 -0
- package/dist/types/effects/tween/index.d.ts +2 -1
- package/dist/types/effects/tween/properties.d.ts +1 -1
- package/dist/types/effects/tween/toggle.d.ts +6 -0
- package/dist/types/notes/effects.d.ts +1 -0
- package/dist/types/notes/index.d.ts +11 -0
- package/dist/types/notes/showcase.d.ts +1 -0
- package/dist/types/showcase/lightbox-flight.d.ts +11 -0
- package/dist/types/showcase/lightbox.d.ts +2 -1
- package/dist/types/showcase/modal-shell.d.ts +5 -0
- package/package.json +1 -1
|
@@ -103,6 +103,10 @@ export interface AutoMotionRequest {
|
|
|
103
103
|
setSpinning?(spinning: boolean): void;
|
|
104
104
|
/** Called whenever the author-facing paused state changes, to mirror it onto pause controls. */
|
|
105
105
|
onPausedChange(paused: boolean): void;
|
|
106
|
+
/** Optional elapsed share of the current autoplay period; absent means no timer frames. */
|
|
107
|
+
onAutoplayProgress?(progress: number): void;
|
|
108
|
+
/** Begin as if the author's pause control were already pressed. See {@link createDeckMotion}. */
|
|
109
|
+
startPaused?: boolean;
|
|
106
110
|
}
|
|
107
111
|
export interface AutoMotion {
|
|
108
112
|
/** Whether any motion was configured at all. */
|
|
@@ -136,6 +140,7 @@ export interface DeckMotionRequest {
|
|
|
136
140
|
settleMs: number;
|
|
137
141
|
/** Step the deck one place. */
|
|
138
142
|
step(direction: 1 | -1): void;
|
|
143
|
+
onAutoplayProgress?: AutoMotionRequest['onAutoplayProgress'];
|
|
139
144
|
/**
|
|
140
145
|
* The continuous half, for a deck that has a continuous position to spin (`spin:`). Omitted, the
|
|
141
146
|
* deck has no `spin:` parameter and only `autoplay:` is read.
|
|
@@ -163,6 +168,9 @@ export interface DeckMotion {
|
|
|
163
168
|
* read the same parameters, warn the same way and reflect pause the same way — the only things a
|
|
164
169
|
* deck supplies are how it steps and, if it spins, how it advances.
|
|
165
170
|
*
|
|
171
|
+
* A pause carried over from the deck this one replaced is taken up only if there is a control to lift
|
|
172
|
+
* it: a deck left stopped with no way to restart it would be worse than one that moves.
|
|
173
|
+
*
|
|
166
174
|
* @complexity O(1) at setup plus one scoped query for a named `pause:`; O(m) per pause toggle in the
|
|
167
175
|
* matched controls.
|
|
168
176
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { createAttributeLedger, StyleLedger } from '../../core/owned-styles.js';
|
|
3
|
+
import type { EffectParams } from '../../core/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The bounded half of `shape:line attribute:`: the app names the arrangement, this answers where a
|
|
6
|
+
* place is in the column. The flex row stays the only layout, so the switch is one transform
|
|
7
|
+
* interpolation. Heights are read at row measurement boundaries, never during a flight.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createArchive(host: HTMLElement, params: EffectParams, ctx: PrepareContext, attributes: ReturnType<typeof createAttributeLedger>): {
|
|
10
|
+
isColumn: () => boolean;
|
|
11
|
+
pixelAt: (place: number) => number;
|
|
12
|
+
bound: (place: number) => number | undefined;
|
|
13
|
+
positionAt: (from: number, dy: number) => number;
|
|
14
|
+
measure(slides: readonly HTMLElement[], styles: ReadonlyMap<Element, StyleLedger>): void;
|
|
15
|
+
/** Hold the deck's own motion too: a spin frame would restart every card's staggered delay. */
|
|
16
|
+
fly(live: number, slides: readonly HTMLElement[], styles: ReadonlyMap<Element, StyleLedger>, hold: (holding: boolean) => void): void;
|
|
17
|
+
watch(onSwitch: () => void): () => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
/** A finite pixel coast; the deck keeps ownership of position and its motion hold. */
|
|
3
|
+
export declare function createCoast(el: Element, ctx: PrepareContext, move: (dx: number) => void, done: () => void): {
|
|
4
|
+
stop: () => void;
|
|
5
|
+
start(velocity: number, baseline?: number): void;
|
|
6
|
+
release(): void;
|
|
7
|
+
};
|
|
@@ -39,8 +39,8 @@ export declare const SPINNING_ATTR = "data-kui-ring-spinning";
|
|
|
39
39
|
* A published fact rather than a CSS derivation, because it is a branch on the sign or magnitude of
|
|
40
40
|
* a `calc()`, which CSS cannot take. The ring answers it with "is this slot's plane turned more
|
|
41
41
|
* than a quarter turn away" (`faceAt`); the stack with "has it left the visible depth". The
|
|
42
|
-
* stylesheet hangs `pointer-events` on it for every shape
|
|
43
|
-
*
|
|
42
|
+
* stylesheet hangs `pointer-events` on it for every shape; `inert` also takes back-facing slots
|
|
43
|
+
* and their descendants out of the tab order without hiding the outward ring.
|
|
44
44
|
*
|
|
45
45
|
* That matters for more than tidiness. A card turned away from the viewer still occupies its
|
|
46
46
|
* projected screen rectangle for hit-testing purposes — `backface-visibility: hidden` stops it
|
|
@@ -62,6 +62,8 @@ export type Face = 'front' | 'back';
|
|
|
62
62
|
* it, and the next change to that slot transitions normally.
|
|
63
63
|
*/
|
|
64
64
|
export declare const WRAP_ATTR = "data-kui-ring-wrap";
|
|
65
|
+
/** Commit a layout change while its transitions are suspended, then restore the author's flag. */
|
|
66
|
+
export declare function commitWithoutTransition(win: Window, node: Element, write?: () => void): void;
|
|
65
67
|
/**
|
|
66
68
|
* Which way a deck's cards travel across the screen as its position grows, as the sign a drag's
|
|
67
69
|
* pixels are multiplied by: `1` when the next card sits to the right of the live one (so advancing
|
|
@@ -123,12 +125,34 @@ export declare function snapPosition(position: number, total: number): {
|
|
|
123
125
|
export declare const DECK_PARAMETERS: ParameterSchema;
|
|
124
126
|
/** What a deck's shape contributes; everything else is shared. */
|
|
125
127
|
export interface DeckLayout {
|
|
128
|
+
coastSpeed?(spinMs: number): number;
|
|
129
|
+
unwrapped?: boolean;
|
|
130
|
+
advanceBoth?: boolean;
|
|
126
131
|
/** The primitive's id: names the mirrored timing properties (`--kui-<id>-duration`). */
|
|
127
132
|
id: string;
|
|
128
133
|
/** Prefix for warnings, the word an author would recognise. */
|
|
129
134
|
label: string;
|
|
130
135
|
/** Whether a slot at this place is presented to the viewer. `place` is `offset - drift`. */
|
|
131
136
|
faceOf(place: number, offset: number, count: number): Face;
|
|
137
|
+
/** A depth ring's cached view through author transforms; absent for other layouts. */
|
|
138
|
+
view?: {
|
|
139
|
+
measure(nodes: readonly Element[]): void;
|
|
140
|
+
faceOf(place: number, count: number, index: number): Face | undefined;
|
|
141
|
+
travelSign(): 1 | -1 | undefined;
|
|
142
|
+
keyboardSign?(): 1 | -1;
|
|
143
|
+
pixelPosition?(): number;
|
|
144
|
+
pickup?(position: number): number | undefined;
|
|
145
|
+
watch(refresh: () => void, goTo: (position: number) => void, hold: (holding: boolean) => void): Cleanup;
|
|
146
|
+
render?(position: number): void;
|
|
147
|
+
positionAt?(from: number, dx: number, dy?: number): number;
|
|
148
|
+
/** A shape with real ends clamps a place; `undefined` means it is circular right now. */
|
|
149
|
+
bound?(position: number): number | undefined;
|
|
150
|
+
};
|
|
151
|
+
/** A second drag axis, for a shape that has one. */
|
|
152
|
+
pitch?: {
|
|
153
|
+
begin(): void;
|
|
154
|
+
move(turns: number): void;
|
|
155
|
+
};
|
|
132
156
|
/**
|
|
133
157
|
* The shape's own reading of a circular offset, when it is not the offset itself.
|
|
134
158
|
*
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
2
|
import type { Cleanup } from '../../core/types.js';
|
|
3
3
|
export interface RingDragRequest {
|
|
4
|
+
unwrapped?: boolean;
|
|
5
|
+
pickup?(): void;
|
|
6
|
+
keyboardSign?(): 1 | -1;
|
|
7
|
+
free?: boolean;
|
|
8
|
+
coastSpeed(): number;
|
|
9
|
+
moveFree?(position: number): void;
|
|
10
|
+
advanceBoth?: boolean;
|
|
4
11
|
el: Element;
|
|
5
12
|
ctx: PrepareContext;
|
|
6
13
|
/** `grab:false` still installs the keyboard half — that is accessibility, not decoration. */
|
|
@@ -17,6 +24,14 @@ export interface RingDragRequest {
|
|
|
17
24
|
* the card under the pointer follows it whatever the shape.
|
|
18
25
|
*/
|
|
19
26
|
travelSign(): 1 | -1;
|
|
27
|
+
positionAt?(from: number, dx: number, dy?: number): number;
|
|
28
|
+
/** A shape with real ends clamps a place before a key press can wrap it. */
|
|
29
|
+
bound?(place: number): number | undefined;
|
|
30
|
+
/** A second axis: the gesture recognises either direction, and touch-action stays pan-y. */
|
|
31
|
+
pitch?: {
|
|
32
|
+
begin(): void;
|
|
33
|
+
move(turns: number): void;
|
|
34
|
+
};
|
|
20
35
|
/** Move the ring to a continuous position and re-render. */
|
|
21
36
|
moveTo(position: number): void;
|
|
22
37
|
/** Publish or clear the dragging state the stylesheet suspends its transition on. */
|
|
@@ -77,10 +92,7 @@ export declare function snapTo(projected: number): number;
|
|
|
77
92
|
* @complexity O(1) time and space.
|
|
78
93
|
*/
|
|
79
94
|
export declare function wrapPlace(place: number, total: number): number;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* @complexity O(1) per pointer event and per key; O(1) space.
|
|
85
|
-
*/
|
|
86
|
-
export declare function createRingDrag(request: RingDragRequest): Cleanup;
|
|
95
|
+
export declare function nearestPlace(place: number, current: number, total: number): number;
|
|
96
|
+
export declare function createRingDrag(request: RingDragRequest): Cleanup & {
|
|
97
|
+
interrupt(): void;
|
|
98
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Cleanup } from '../../core/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Changing a live deck's effect: the cards glide from where they are to where the new shape wants them.
|
|
4
|
+
*
|
|
5
|
+
* Setting `data-kui` reinstalls the effect, and between the two shapes three things change at once:
|
|
6
|
+
* each card's transform, its layout box (a grid cell becomes a place in a flex row, a stack's padding
|
|
7
|
+
* comes or goes), and the host's camera. A CSS transition can only ever see the first, and only when
|
|
8
|
+
* nothing resolves style between teardown and install. So it flew some pairs by luck and jumped
|
|
9
|
+
* others. This file is the one owner of that move, and the transition stays out of it.
|
|
10
|
+
*
|
|
11
|
+
* ## A pose, not a box
|
|
12
|
+
*
|
|
13
|
+
* `core/flip.ts` measures bounding boxes, and that is the wrong record here: the box of a card turned
|
|
14
|
+
* sixty degrees on a ring says nothing about the turn, so a FLIP from it would flatten the picture on
|
|
15
|
+
* the first frame. What is recorded is the card's whole mapping to the page: the host's camera and
|
|
16
|
+
* scale, then the card's layout position, then its computed transform. On arrival that mapping is
|
|
17
|
+
* re-expressed under the *new* camera and the new layout box, which gives the one transform that
|
|
18
|
+
* paints the card exactly where it was. Computed values, so a card caught mid-glide or mid-step
|
|
19
|
+
* records where it is right now.
|
|
20
|
+
*
|
|
21
|
+
* Layout positions are `offsetLeft` chains rather than rects. They ignore every transform, including
|
|
22
|
+
* an ancestor's, so the arithmetic stays in one coordinate space whatever the page does above the deck.
|
|
23
|
+
*
|
|
24
|
+
* ## One start keyframe, no end keyframe
|
|
25
|
+
*
|
|
26
|
+
* Each animation names only its start and leaves the end to the underlying value. So a spin, a drag
|
|
27
|
+
* or an arrow press during the glide changes the target and the card follows, and nothing has to
|
|
28
|
+
* cancel anything. It also writes nothing inline: when it ends, the stylesheet is simply back.
|
|
29
|
+
*
|
|
30
|
+
* ## The transition has to sit out exactly one moment
|
|
31
|
+
*
|
|
32
|
+
* `arriving` holds `transition-property: none` while the new shape is stamped and committed, so the
|
|
33
|
+
* install itself starts no transition. That also covers any forced style read during install, such as
|
|
34
|
+
* the flattening check before a ring places its cards, which used to commit `transform: none` and fly
|
|
35
|
+
* every card out from the host's centre. `flying` restores the transition before the first frame, so
|
|
36
|
+
* a later step travels as usual underneath the glide. Two layers, never over the same change.
|
|
37
|
+
*
|
|
38
|
+
* ## A row's box and its copies
|
|
39
|
+
*
|
|
40
|
+
* A row clips, and it stops clipping for the length of the glide, because a ring's cards stand outside
|
|
41
|
+
* its box. So a card past the row's edge is treated as out of sight at either end. Leaving a row it
|
|
42
|
+
* fades in rather than popping into view when the clip lets go. Arriving at a row it fades out rather
|
|
43
|
+
* than blinking away when the clip comes back. A card across the edge meets a clip that moves.
|
|
44
|
+
*
|
|
45
|
+
* Copies have no pose to glide between, since they exist in one shape only, so they cross-fade. The
|
|
46
|
+
* new row's fade in where they stand. The old row's, already taken out by its teardown, go back in the
|
|
47
|
+
* host out of flow for as long as they take to fade out where they stood. `deck.ts` never counts a copy
|
|
48
|
+
* as a slide, so no deck picks one up.
|
|
49
|
+
*/
|
|
50
|
+
/** Attribute on the host, from the start of the install until the last card lands. */
|
|
51
|
+
export declare const GLIDE_ATTR = "data-kui-deck-glide";
|
|
52
|
+
/** A 4x4 matrix in column order, as `matrix3d()` spells it. */
|
|
53
|
+
type Matrix = readonly number[];
|
|
54
|
+
/**
|
|
55
|
+
* A computed `transform` as a matrix: the browser only ever resolves one to these three spellings.
|
|
56
|
+
*
|
|
57
|
+
* @complexity O(1) time and space.
|
|
58
|
+
*/
|
|
59
|
+
export declare function matrixOf(value: string): Matrix;
|
|
60
|
+
/**
|
|
61
|
+
* Note where a departing deck's cards are, for a deck that takes over this host in this same task.
|
|
62
|
+
*
|
|
63
|
+
* Call before anything is restored. The microtask is the expiry: a reinstall is synchronous, so a
|
|
64
|
+
* recording still here afterwards means the new effect was not a deck, and it must not reach a deck
|
|
65
|
+
* installed long after, when these poses describe nothing on screen. Skipped where the Web Animations
|
|
66
|
+
* API is missing, since nothing could play it.
|
|
67
|
+
*
|
|
68
|
+
* @complexity O(n) time in cards; one forced layout.
|
|
69
|
+
*/
|
|
70
|
+
export declare function recordDeckPoses(host: HTMLElement, nodes: readonly Element[], win: Window): void;
|
|
71
|
+
export interface GlideTiming {
|
|
72
|
+
durationMs: number;
|
|
73
|
+
easing: string;
|
|
74
|
+
/** Land immediately: the new arrangement, with no travel. */
|
|
75
|
+
reducedMotion: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** A deck taking over from another: land its cards once they are placed. */
|
|
78
|
+
export type DeckArrival = (nodes: readonly Element[], timing: GlideTiming, win: Window) => Cleanup;
|
|
79
|
+
/**
|
|
80
|
+
* Claim a recording for a deck installing on this host, and hold its transition off.
|
|
81
|
+
*
|
|
82
|
+
* Call before the deck writes anything. No recording means this is not a switch: a first load, or
|
|
83
|
+
* a host that had some other effect, and those are exactly as they were.
|
|
84
|
+
*
|
|
85
|
+
* @returns How to land the cards once they are placed, or `undefined`.
|
|
86
|
+
* @complexity O(1) time and space.
|
|
87
|
+
*/
|
|
88
|
+
export declare function claimDeckArrival(host: HTMLElement): DeckArrival | undefined;
|
|
89
|
+
export {};
|
|
@@ -120,6 +120,13 @@ export declare const CAROUSEL_PRIMITIVES: Primitive[];
|
|
|
120
120
|
*
|
|
121
121
|
* None of them declares `transitions`: nothing here renders through a CSS `transition:` on the
|
|
122
122
|
* host box for `phaseOf` to derive `state` from — the ring is `renderer: 'javascript'` throughout.
|
|
123
|
+
*
|
|
124
|
+
* All of them are `cloak: true`. Before the script runs, a ring is its cards laid out flat in the
|
|
125
|
+
* page's flow, and the first frame after start snaps them onto the ring: a flash of the wrong
|
|
126
|
+
* layout on every load (the showcase hero showed it). Under `<html data-kui-cloak>` the host and its
|
|
127
|
+
* cards stay hidden until the host's `data-kui-state` lands, which happens in the same task that
|
|
128
|
+
* places the cards (no frame or timer in between), and the CSS-only two-second release still shows
|
|
129
|
+
* them if the script never runs.
|
|
123
130
|
*/
|
|
124
131
|
export declare const CAROUSEL_PRESETS: Preset[];
|
|
125
132
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { EffectParams } from '../../core/types.js';
|
|
3
|
+
export interface LineGeometry {
|
|
4
|
+
stride: number;
|
|
5
|
+
cycle: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/** Geometry is read at row measurement boundaries, never while the row moves. */
|
|
10
|
+
export declare function createLine(host: HTMLElement, params: EffectParams, ctx: PrepareContext): (geometry: LineGeometry) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
/** Marks a row's extra image. It is never a slide, whatever selector the deck was given. */
|
|
3
|
+
export declare const ROW_COPY_ATTR = "data-kui-row-copy";
|
|
4
|
+
/** Image sources can change without changing a fixed-size image's observed box. */
|
|
5
|
+
export declare function watchCopySources(host: Element, ctx: PrepareContext, refresh: () => void): () => void;
|
|
6
|
+
/** Fresh image visuals only: never duplicate links, IDs, effects or semantic slides. */
|
|
7
|
+
export declare function createRowCopies(host: Element, ctx: PrepareContext): {
|
|
8
|
+
clear: () => void;
|
|
9
|
+
measure(slides: readonly HTMLElement[], widths: number[], cycle: number, required: number): HTMLImageElement[];
|
|
10
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { StyleLedger } from '../../core/owned-styles.js';
|
|
3
|
+
import type { EffectParams } from '../../core/types.js';
|
|
4
|
+
export interface ProjectedBounds {
|
|
5
|
+
minX: number;
|
|
6
|
+
maxX: number;
|
|
7
|
+
minY: number;
|
|
8
|
+
maxY: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HelixGeometry {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
radius: number;
|
|
14
|
+
rise: number;
|
|
15
|
+
count: number;
|
|
16
|
+
arc: number;
|
|
17
|
+
tilt: number;
|
|
18
|
+
perspective: number;
|
|
19
|
+
camera: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The fade seam is centered half a place away from zero for an even circular numbering. */
|
|
22
|
+
export declare function helixCentre(count: number): number;
|
|
23
|
+
/** Project the CSS helix's card corners across its reachable places, once per geometry change. */
|
|
24
|
+
export declare function projectHelix(g: HelixGeometry): ProjectedBounds;
|
|
25
|
+
/** A shared two-dimensional scale bound; old rings retain their radius-only solver. */
|
|
26
|
+
export declare function fitProjectedBounds(bounds: ProjectedBounds, room: {
|
|
27
|
+
left: number;
|
|
28
|
+
right: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}): number;
|
|
31
|
+
export interface ShapeFitRequest {
|
|
32
|
+
el: Element;
|
|
33
|
+
ctx: PrepareContext;
|
|
34
|
+
styles: StyleLedger;
|
|
35
|
+
params: EffectParams;
|
|
36
|
+
arc: number;
|
|
37
|
+
tilt: number;
|
|
38
|
+
sphere?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** A sphere's silhouette is a circle at any rotation, so it needs no sampling and stays right under a second axis. */
|
|
41
|
+
export declare function projectSphere(g: HelixGeometry): ProjectedBounds;
|
|
42
|
+
/** Observe geometry only; the moving deck never asks this solver for a frame. */
|
|
43
|
+
export declare function createHelixFit(request: ShapeFitRequest): {
|
|
44
|
+
render(elements: readonly Element[], count: number): void;
|
|
45
|
+
release(): void;
|
|
46
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { StyleLedger } from '../../core/owned-styles.js';
|
|
3
|
+
import type { EffectParams, EffectSpec, EffectVariant } from '../../core/types.js';
|
|
4
|
+
export declare function deckSourceVariant(spec: EffectSpec): EffectVariant;
|
|
5
|
+
/** A scroll-driven deck has one source; its clock must not write over the scroller. */
|
|
6
|
+
export declare function deckMotionParams(params: EffectParams, ctx: PrepareContext, label: string): EffectParams;
|
|
7
|
+
/** Physical pixels per second, sampled after the single position writer has rendered. */
|
|
8
|
+
export declare function createDeckSpeed(ctx: PrepareContext, styles: StyleLedger): {
|
|
9
|
+
reset: () => void;
|
|
10
|
+
sample(pixel: number, discrete: boolean): void;
|
|
11
|
+
release(): void;
|
|
12
|
+
};
|
|
13
|
+
interface ScrollDeck {
|
|
14
|
+
el: Element;
|
|
15
|
+
params: EffectParams;
|
|
16
|
+
ctx: PrepareContext;
|
|
17
|
+
count(): number;
|
|
18
|
+
position(): number;
|
|
19
|
+
dragging(): boolean;
|
|
20
|
+
move(position: number): void;
|
|
21
|
+
resetSpeed(): void;
|
|
22
|
+
driving(active: boolean): void;
|
|
23
|
+
}
|
|
24
|
+
/** A grab rebases the scroll source instead of letting a dirty scroll frame steal it. */
|
|
25
|
+
export declare function trackDeckScroll(request: ScrollDeck): () => void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { DeckAttachment } from './deck.js';
|
|
3
|
+
import type { ShapeFitRequest } from './shape-fit.js';
|
|
4
|
+
/**
|
|
5
|
+
* One added latitude per card, in degrees, spread for equal area. Longitude stays `place * spacing`,
|
|
6
|
+
* so the live card, the wrap and every control keep the ring's own meaning. The first card sits on
|
|
7
|
+
* the equator so a deck opens facing a card, not a pole.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sphereLatitude(index: number, count: number): number;
|
|
10
|
+
/** Where a card's face points after the CSS placement, with every angle in radians. */
|
|
11
|
+
export declare function sphereNormal(angle: number, latitude: number, tilt: number): [number, number, number];
|
|
12
|
+
/** Latitudes are written when the slides change, never per frame. */
|
|
13
|
+
export declare function createSphereAttachment(request: Omit<ShapeFitRequest, 'sphere'>): DeckAttachment;
|
|
14
|
+
/**
|
|
15
|
+
* The second axis of `drag-axis:both`: one host variable every slot reads, so a drag costs no per-card
|
|
16
|
+
* work. Bounded so the pole never tips past the camera and sideways drags keep their direction.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSpherePitch(ctx: PrepareContext, tiltParamDeg: number, arcDeg: number): {
|
|
19
|
+
value: () => number;
|
|
20
|
+
begin(): void;
|
|
21
|
+
/** `turns` is the drag as a fraction of a full cycle, the same law as the ring's own axis. */
|
|
22
|
+
move(turns: number): void;
|
|
23
|
+
};
|
|
@@ -65,13 +65,14 @@ export declare function stackPlace(offset: number, count: number): number;
|
|
|
65
65
|
* list), `opacity` and `filter` for the recession, `discrete` for the host's `display: grid` — the
|
|
66
66
|
* same reasoning `SPATIAL_RING_PRIMITIVE` gives for its own pair, widened by what a stack paints.
|
|
67
67
|
* `reducedMotion: 'shorten'` for the same reason as the ring: the deck must keep working, and the
|
|
68
|
-
* policy
|
|
68
|
+
* base.css policy shortens the marked host's slot transitions, while `deck.ts` starts any
|
|
69
|
+
* auto-motion paused.
|
|
69
70
|
*/
|
|
70
71
|
export declare const SPATIAL_STACK_PRIMITIVE: Primitive;
|
|
71
72
|
/**
|
|
72
73
|
* `carousel-stack` — the family name first, the shape second, as `carousel-fade`/`carousel-slide`/
|
|
73
74
|
* `carousel-3d` already read. One name: the diagonal's direction is two signed lengths (`shift:`,
|
|
74
|
-
* `rise:`), so a left-hand or downward stack is a parameter, not a catalogue entry. `requiresOwnSubtree
|
|
75
|
-
*
|
|
75
|
+
* `rise:`), so a left-hand or downward stack is a parameter, not a catalogue entry. `requiresOwnSubtree`,
|
|
76
|
+
* `phase: 'idle'` and `cloak: true` for the reasons `CAROUSEL_PRESETS` gives for the ring.
|
|
76
77
|
*/
|
|
77
78
|
export declare const STACK_PRESETS: Preset[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { ContinuousSetup } from '../../core/instances.js';
|
|
3
|
+
import type { Cleanup, EffectParams } from '../../core/types.js';
|
|
4
|
+
/** App-formatted LTR characters: O(n) matching, boundary reads only, no animation-frame loop. */
|
|
5
|
+
export declare function prepareNumberTokens(el: Element, params: EffectParams, ctx: PrepareContext): ContinuousSetup | Cleanup;
|
|
@@ -10,10 +10,9 @@ export interface CountLayers {
|
|
|
10
10
|
/** `aria-hidden` node the ticking display writes to on every frame. */
|
|
11
11
|
decorative: HTMLElement;
|
|
12
12
|
/**
|
|
13
|
-
* Visually-hidden twin
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* install, from the same `to`/`format` the tween itself will settle on.
|
|
13
|
+
* Visually-hidden twin holding the destination value, never intermediate animation frames.
|
|
14
|
+
* A live odometer writes it once per incoming value; a fixed counter writes it at install.
|
|
15
|
+
* The number is content, so it carries no aria-live announcement.
|
|
17
16
|
*/
|
|
18
17
|
srOnly: HTMLElement;
|
|
19
18
|
/**
|
|
@@ -39,17 +39,18 @@ export interface SplitLayers {
|
|
|
39
39
|
* — the decorative layer is free to sit mid-scramble, mid-type, or split into spans without a
|
|
40
40
|
* screen reader ever seeing an incomplete or garbled read of the content.
|
|
41
41
|
*
|
|
42
|
-
* @param el - Element whose text is being taken over.
|
|
43
|
-
* every DOM-surgery primitive in this module shares that constraint. Callers are expected to
|
|
42
|
+
* @param el - Element whose text is being taken over. Callers are expected to
|
|
44
43
|
* have already checked {@link hasInteractiveDescendant} and bailed out if it is true; this
|
|
45
44
|
* function itself does not guard, so a caller that skips the check still flattens a link.
|
|
46
45
|
* @param doc - Document to create nodes in, rather than the ambient global, so callers can point
|
|
47
46
|
* this at a test document.
|
|
48
47
|
* @returns The decorative layer to populate, the captured text, and a cleanup.
|
|
49
|
-
* @
|
|
48
|
+
* @param preserveMarkup - Seed the decorative layer with a trimmed copy of the authored tree
|
|
49
|
+
* for segmentation. Typing and scrambling instead start with an empty display layer.
|
|
50
|
+
* @complexity O(n) time and space in subtree size when preserving markup.
|
|
50
51
|
* @overallScore 100
|
|
51
52
|
*/
|
|
52
|
-
export declare function installSplitLayers(el: Element, doc: Document): SplitLayers;
|
|
53
|
+
export declare function installSplitLayers(el: Element, doc: Document, preserveMarkup?: boolean): SplitLayers;
|
|
53
54
|
/**
|
|
54
55
|
* Grapheme clusters, not UTF-16 code units — an emoji, a flag, or a base letter plus combining
|
|
55
56
|
* mark stays one unit instead of being torn across two "characters".
|
|
@@ -89,6 +90,8 @@ export declare function applyStaggerVars(el: HTMLElement, params: EffectParams):
|
|
|
89
90
|
* @overallScore 100
|
|
90
91
|
*/
|
|
91
92
|
export declare function stepMsFor(params: EffectParams, ticks: number, fallback: number): number;
|
|
93
|
+
/** Deterministic variation stays within .75–3 steps, with pauses after punctuation. */
|
|
94
|
+
export declare function naturalTypeDelay(graphemes: string[], count: number, step: number): number;
|
|
92
95
|
/**
|
|
93
96
|
* Total time before every staggered `.kui-split-item` has finished its reveal keyframe: the last
|
|
94
97
|
* item's `--kui-i * --kui-stagger` delay (text.css), plus its own duration. `prepareSplitText`
|
|
@@ -106,6 +109,7 @@ export interface StepRunOptions {
|
|
|
106
109
|
delayMs: number;
|
|
107
110
|
/** Milliseconds between ticks. */
|
|
108
111
|
stepMs: number;
|
|
112
|
+
nextDelay?: () => number;
|
|
109
113
|
/** One frame of work. Returns `true` when there is nothing left to do. */
|
|
110
114
|
tick(): boolean;
|
|
111
115
|
}
|
|
@@ -179,7 +183,9 @@ export declare function rewrapLineSpans(container: Element, doc: Document): HTML
|
|
|
179
183
|
* @complexity O(n) time and space in text length, dominated by the chosen unit's own cost.
|
|
180
184
|
* @overallScore 100
|
|
181
185
|
*/
|
|
182
|
-
export declare function appendSpansFor(unit: SplitUnit, container: Element, doc: Document, text
|
|
186
|
+
export declare function appendSpansFor(unit: SplitUnit, container: Element, doc: Document, text?: string): HTMLElement[];
|
|
187
|
+
/** A stationary clipping box around each moving item; whitespace remains in normal flow. */
|
|
188
|
+
export declare function applySplitMask(items: HTMLElement[], doc: Document, direction: string): void;
|
|
183
189
|
export interface TypeState {
|
|
184
190
|
index: number;
|
|
185
191
|
deleting: boolean;
|
|
@@ -210,10 +216,11 @@ export declare const SCRAMBLE_CHARSETS: Record<string, string>;
|
|
|
210
216
|
* @param resolved - Count of graphemes (from the start) considered final.
|
|
211
217
|
* @param charset - Characters to draw unresolved positions from.
|
|
212
218
|
* @param random - Source of randomness, injected so the frame is reproducible in tests.
|
|
219
|
+
* @param ranks - Optional per-grapheme resolve ranks; omitted keeps left-to-right resolution.
|
|
213
220
|
* @complexity O(n) time and space in grapheme count.
|
|
214
221
|
* @overallScore 100
|
|
215
222
|
*/
|
|
216
|
-
export declare function scrambledFrame(graphemes: string[], resolved: number, charset: string, random: () => number): string;
|
|
223
|
+
export declare function scrambledFrame(graphemes: string[], resolved: number, charset: string, random: () => number, ranks?: number[]): string;
|
|
217
224
|
/**
|
|
218
225
|
* The generic variable-font axis: `data-kui="var-axis axis:GRAD from:0 to:150"`.
|
|
219
226
|
*
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { SetupResult } from '../../core/instances.js';
|
|
3
|
+
import type { EffectParams } from '../../core/types.js';
|
|
4
|
+
import type { SplitLayers } from './text-shared.js';
|
|
5
|
+
export declare function prepareScatterTypewriter(layers: SplitLayers, params: EffectParams, ctx: PrepareContext, words: string[]): SetupResult;
|
|
@@ -1,5 +1,36 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
1
2
|
import type { Registry } from '../../core/registry.js';
|
|
2
|
-
import type { Preset, Primitive } from '../../core/types.js';
|
|
3
|
+
import type { EffectParams, Preset, Primitive } from '../../core/types.js';
|
|
4
|
+
export declare const swapOwners: WeakMap<Element, {
|
|
5
|
+
version: number;
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
/** Only curtain-enabled targets participate; ordinary view-swap retains its own lifecycle. */
|
|
9
|
+
export declare function reserveSwap(target: Element): () => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The state change `view-swap` performs, as one function the browser can call at the right moment.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately tiny, and deliberately expressed in markup the author already has. `aria-controls`
|
|
14
|
+
* is what a disclosure button already points at, `[data-open]` is already the attribute
|
|
15
|
+
* `catalog/discrete.ts`'s six names read to decide open from closed, and `aria-expanded` is
|
|
16
|
+
* already the control's own state. So the whole vocabulary here is "flip the thing you already
|
|
17
|
+
* told the browser about", which is the most this library can own without becoming the
|
|
18
|
+
* component: it does not manage focus, it does not move the element, it does not route.
|
|
19
|
+
*
|
|
20
|
+
* Returns `undefined` when there is nothing to flip, so the caller can warn once at install time
|
|
21
|
+
* rather than silently on every click.
|
|
22
|
+
*
|
|
23
|
+
* @complexity O(1) time and space beyond the one `querySelector`.
|
|
24
|
+
* @overallScore 100
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveSwapTarget(el: Element, params: EffectParams, ctx: PrepareContext): Element | undefined;
|
|
27
|
+
/** Validate with the DOM's attribute-name grammar without changing the target. */
|
|
28
|
+
export declare function resolveSwapAttribute(params: EffectParams, ctx: PrepareContext): string | undefined;
|
|
29
|
+
export declare function resolveSwapValues(params: EffectParams, ctx: PrepareContext, next?: boolean): {
|
|
30
|
+
value: string;
|
|
31
|
+
values: string[];
|
|
32
|
+
} | undefined;
|
|
33
|
+
export declare const VIEW_SWAP: Primitive;
|
|
3
34
|
export declare const VIEW_TRANSITION_PRIMITIVES: Primitive[];
|
|
4
35
|
export declare const VIEW_TRANSITION_PRESETS: Preset[];
|
|
5
36
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { EffectParams } from '../../core/types.js';
|
|
3
|
+
type Axis = 'x' | 'y';
|
|
4
|
+
type Point = Record<Axis, number>;
|
|
5
|
+
/** Extra reads/listeners exist only on a host opting into the round-2 drag options. */
|
|
6
|
+
export declare function dragOptions(el: Element, params: EffectParams, ctx: PrepareContext): {
|
|
7
|
+
publish: boolean;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
dominant: boolean;
|
|
10
|
+
bounded: boolean;
|
|
11
|
+
render: (point: Point) => Point;
|
|
12
|
+
pickup: () => void;
|
|
13
|
+
onResize(callback: () => void): void;
|
|
14
|
+
target: (key: Axis, value: number) => number;
|
|
15
|
+
destroy: () => void | undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { Box, FlipSnapshot } from '../../core/flip.js';
|
|
3
|
+
import type { Cleanup } from '../../core/types.js';
|
|
4
|
+
export declare const LEAVING = "data-kui-leaving";
|
|
5
|
+
type DepartureTiming = {
|
|
6
|
+
durationMs: number;
|
|
7
|
+
delayMs: number;
|
|
8
|
+
easing?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Read only the running FLIP offset; the cached destination itself is never exposed to exits. */
|
|
11
|
+
export declare function interruptedSnapshot(before: FlipSnapshot, win: Window): FlipSnapshot;
|
|
12
|
+
/** Pin an owned character at its pre-update box while its renderer closes the gap. */
|
|
13
|
+
export declare function pinDeparture(node: HTMLElement, box: Box, host: HTMLElement): void;
|
|
14
|
+
/** Original direct children only; the app retains ownership of removal and focus. */
|
|
15
|
+
export declare function departures(host: HTMLElement, ctx: PrepareContext, timing: DepartureTiming): {
|
|
16
|
+
hold(): void;
|
|
17
|
+
update(): void;
|
|
18
|
+
excludes(node: Element): boolean;
|
|
19
|
+
destroy: Cleanup;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Primitive } from '../../core/types.js';
|
|
2
|
+
/** Uniform scaling preserves smooth controls and arc rotations/flags as authored. */
|
|
3
|
+
export declare function transformPath(path: string, scale: number, dx: number, dy: number): string;
|
|
4
|
+
export declare const preparePathFit: NonNullable<Primitive['prepare']>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PrepareContext } from '../../core/effect-context.js';
|
|
2
|
+
import type { ProgressHandler } from './tracker.js';
|
|
3
|
+
/** A document-length source, independent of the progress bar's fixed box. */
|
|
4
|
+
export declare function trackPageProgress(ctx: PrepareContext, onProgress: ProgressHandler): import("../../index.js").Cleanup;
|
|
5
|
+
/** Only the visual output is smoothed; discrete marking still receives raw progress. */
|
|
6
|
+
export declare function smoothProgress(ctx: PrepareContext, write: (value: number) => void): {
|
|
7
|
+
write(value: number): void;
|
|
8
|
+
release(): void;
|
|
9
|
+
};
|