@pixerate/flair 0.8.0 → 0.10.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/CHANGELOG.md +21 -0
- package/README.md +13 -6
- package/dist/catalog/index.d.ts +9 -3
- package/dist/catalog/index.js +2 -1
- package/dist/chunk-OHW7UG6D.js +336 -0
- package/dist/chunk-OHW7UG6D.js.map +1 -0
- package/dist/chunk-P5TSANZY.js +1 -0
- package/dist/{chunk-EQS4EXNM.js → chunk-SH66CNLC.js} +52 -6
- package/dist/chunk-SH66CNLC.js.map +1 -0
- package/dist/{chunk-FHXOMIQY.js → chunk-STGGN4MR.js} +2185 -209
- package/dist/chunk-STGGN4MR.js.map +1 -0
- package/dist/{chunk-TDMD5XAU.js → chunk-YACVME3D.js} +75 -4
- package/dist/{chunk-TDMD5XAU.js.map → chunk-YACVME3D.js.map} +1 -1
- package/dist/{chunk-EZRRKQFV.js → chunk-YLJWC4N2.js} +96 -1
- package/dist/chunk-YLJWC4N2.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/editor/index.d.ts +3 -4
- package/dist/editor/index.js +5 -4
- package/dist/editor/index.js.map +1 -1
- package/dist/index.d.ts +65 -6
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/{renderer-0_Ap1tyi.d.ts → renderer-SNYZu__R.d.ts} +17 -0
- package/dist/svg-CpeanaE_.d.ts +375 -0
- package/dist/{types-CNPIrnTf.d.ts → types-D8uhzDyN.d.ts} +8 -2
- package/dist/vector/index.d.ts +21 -112
- package/dist/vector/index.js +8 -2
- package/package.json +1 -1
- package/dist/chunk-CFCLT2XL.js +0 -1
- package/dist/chunk-EQS4EXNM.js.map +0 -1
- package/dist/chunk-EZRRKQFV.js.map +0 -1
- package/dist/chunk-FHXOMIQY.js.map +0 -1
- package/dist/clock-BhdXWH-n.d.ts +0 -47
- package/dist/motion-Ce0lmzm3.d.ts +0 -179
- /package/dist/{chunk-CFCLT2XL.js.map → chunk-P5TSANZY.js.map} +0 -0
package/dist/clock-BhdXWH-n.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Time source for generative animations and playback.
|
|
3
|
-
* By default that is real time (animation frames and timers).
|
|
4
|
-
* A ManualClock instead moves only when told to, enabling frame-exact
|
|
5
|
-
* rendering, video recording, scrubbing, or fast simulation without waiting.
|
|
6
|
-
*/
|
|
7
|
-
interface Clock {
|
|
8
|
-
/** Current time in milliseconds. */
|
|
9
|
-
now(): number;
|
|
10
|
-
/** Resolves on the next frame. */
|
|
11
|
-
frame(): Promise<void>;
|
|
12
|
-
/** Resolves after `ms` milliseconds of this clock's time. */
|
|
13
|
-
sleep(ms: number): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Whether the clock follows wall time. Live clocks stop when the tab is in
|
|
16
|
-
* the background (browsers pause animation frames there).
|
|
17
|
-
*/
|
|
18
|
-
readonly live: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare const pageHidden: () => boolean;
|
|
21
|
-
declare const realClock: Clock;
|
|
22
|
-
/**
|
|
23
|
-
* A clock that only moves when {@link advance} or {@link tick} is called.
|
|
24
|
-
* Each call fires the sleeps that fall due, in order, letting awaiting code
|
|
25
|
-
* run before the next sleep fires, then resolves pending frames.
|
|
26
|
-
*/
|
|
27
|
-
declare class ManualClock implements Clock {
|
|
28
|
-
readonly live = false;
|
|
29
|
-
private time;
|
|
30
|
-
private frames;
|
|
31
|
-
private sleepers;
|
|
32
|
-
private seq;
|
|
33
|
-
constructor(start?: number);
|
|
34
|
-
now(): number;
|
|
35
|
-
frame(): Promise<void>;
|
|
36
|
-
sleep(ms: number): Promise<void>;
|
|
37
|
-
get pending(): boolean;
|
|
38
|
-
advance(ms: number): Promise<void>;
|
|
39
|
-
tick(fps?: number): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A repeatable pseudo-random number in [0, 1) for a key and index.
|
|
43
|
-
* Useful for deterministic, reproducible animations.
|
|
44
|
-
*/
|
|
45
|
-
declare function jitter(key: string, n: number): number;
|
|
46
|
-
|
|
47
|
-
export { type Clock as C, ManualClock as M, jitter as j, pageHidden as p, realClock as r };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vector motion: animated SVG pictures described as data. A picture changes in
|
|
3
|
-
* steps (step 0 when it starts, step n at `steps[n - 1]` ms), and everything
|
|
4
|
-
* here is a pure function of its arguments, so a frame comes out the same
|
|
5
|
-
* however it is reached (played, stepped for a recording, or seeked).
|
|
6
|
-
*/
|
|
7
|
-
/** Easing curves by name. */
|
|
8
|
-
declare const EASES: {
|
|
9
|
-
readonly linear: (t: number) => number;
|
|
10
|
-
readonly "in-out": (t: number) => number;
|
|
11
|
-
readonly out: (t: number) => number;
|
|
12
|
-
};
|
|
13
|
-
type EaseName = keyof typeof EASES;
|
|
14
|
-
/** How long a change takes by default, in ms. */
|
|
15
|
-
declare const STEP_MS = 800;
|
|
16
|
-
/**
|
|
17
|
-
* When `step` starts, in ms since the media started (step 0 at 0, step n at
|
|
18
|
-
* `steps[n - 1]`), or undefined if it has not started yet.
|
|
19
|
-
*/
|
|
20
|
-
declare function stepStart(steps: readonly number[], step: number): number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* How far a change that plays on `step` (after `delay` ms, over `ms`) has
|
|
23
|
-
* got at `timeMs`, eased: 0 before it starts, 1 once it is over.
|
|
24
|
-
*/
|
|
25
|
-
declare function stepProgress(steps: readonly number[], timeMs: number, step: number, options?: {
|
|
26
|
-
delay?: number;
|
|
27
|
-
ms?: number;
|
|
28
|
-
ease?: EaseName;
|
|
29
|
-
}): number;
|
|
30
|
-
/** The key an item in a list of data keeps from one state to the next. */
|
|
31
|
-
type DataKey = (item: unknown, index: number) => string;
|
|
32
|
-
/**
|
|
33
|
-
* Keys items by their `id`, `key`, `name` or `label` (or a link's `source`
|
|
34
|
-
* and `target`), else by position.
|
|
35
|
-
*/
|
|
36
|
-
declare const defaultDataKey: DataKey;
|
|
37
|
-
/**
|
|
38
|
-
* Data between two states, `u` of the way from `a` to `b`. Numbers blend;
|
|
39
|
-
* lists match their items by key (`keyOf`), so each keeps its identity and
|
|
40
|
-
* moves rather than jumping, with items only in `b` growing from nothing and
|
|
41
|
-
* items only in `a` shrinking away; objects blend field by field; anything
|
|
42
|
-
* else changes halfway.
|
|
43
|
-
*/
|
|
44
|
-
declare function lerpData<D>(a: D, b: D, u: number, keyOf?: DataKey): D;
|
|
45
|
-
/**
|
|
46
|
-
* The data to show at `timeMs`, for media whose data has a state per step:
|
|
47
|
-
* `states[n]` is shown from step n (the last one stays), reached by moving
|
|
48
|
-
* from the state before it over `ms`.
|
|
49
|
-
*/
|
|
50
|
-
declare function stepData<D>(states: readonly D[], steps: readonly number[], timeMs: number, options?: {
|
|
51
|
-
ms?: number;
|
|
52
|
-
ease?: EaseName;
|
|
53
|
-
keyOf?: DataKey;
|
|
54
|
-
}): D;
|
|
55
|
-
/**
|
|
56
|
-
* An animated SVG picture: markup plus changes to its elements. Draw it with
|
|
57
|
-
* `SvgPlayer` (or `svgView`), or compute frames yourself with `svgFrame`.
|
|
58
|
-
*/
|
|
59
|
-
interface SvgMotion {
|
|
60
|
-
/** One self-contained `<svg>` with a `viewBox`: no scripts, no outside links. */
|
|
61
|
-
svg: string;
|
|
62
|
-
/** Changes to its elements, each on a step. */
|
|
63
|
-
animate?: SvgAnimation[];
|
|
64
|
-
}
|
|
65
|
-
/** A box in an SVG's `viewBox` units: `[x, y, width, height]`. */
|
|
66
|
-
type SvgBox = readonly [number, number, number, number];
|
|
67
|
-
/** A change to one element of an {@link SvgMotion}, or (with `view`) to the whole picture. */
|
|
68
|
-
interface SvgAnimation {
|
|
69
|
-
/** The element's `id` in the SVG (not needed for `view`). */
|
|
70
|
-
id?: string;
|
|
71
|
-
/** The step it plays on: 0 (default) when the media starts, 1 with the next shot, and so on. */
|
|
72
|
-
step?: number;
|
|
73
|
-
/** Ms after the step starts. */
|
|
74
|
-
delay?: number;
|
|
75
|
-
/** How long it takes, in ms (default {@link STEP_MS}). */
|
|
76
|
-
ms?: number;
|
|
77
|
-
ease?: EaseName;
|
|
78
|
-
/**
|
|
79
|
-
* Attributes from one value to another: numbers, colours (`#rrggbb`), or
|
|
80
|
-
* strings whose numbers change while the rest stays the same (a path's
|
|
81
|
-
* `d`, a `transform`, `points`).
|
|
82
|
-
*/
|
|
83
|
-
attrs?: Record<string, readonly [string | number, string | number]>;
|
|
84
|
-
/** Draws a line or outline on along its length, from 0 to 1 (or between two fractions). */
|
|
85
|
-
draw?: boolean | readonly [number, number];
|
|
86
|
-
/**
|
|
87
|
-
* Zooms and pans the whole picture to frame a box (`[x, y, width, height]`
|
|
88
|
-
* in the `viewBox`'s units) or an element by id (with a margin round it),
|
|
89
|
-
* from where the last `view` left it (at first, the whole `viewBox`).
|
|
90
|
-
*/
|
|
91
|
-
view?: SvgBox | string;
|
|
92
|
-
/**
|
|
93
|
-
* Moves the element along a path (by id) from its start to its end, or
|
|
94
|
-
* between the fractions in `at`; draw the element round (0, 0), like a
|
|
95
|
-
* circle at `cx="0" cy="0"`.
|
|
96
|
-
*/
|
|
97
|
-
along?: string;
|
|
98
|
-
/** How far along the path `along` moves the element, from and to (default [0, 1]). */
|
|
99
|
-
at?: readonly [number, number];
|
|
100
|
-
/** Counts the element's text from one number to the other. */
|
|
101
|
-
count?: readonly [number, number];
|
|
102
|
-
/** How a count is written: `{n}` stands for the number ("{n}%", "$ {n}M"). */
|
|
103
|
-
format?: string;
|
|
104
|
-
/** Decimals in a count (default 0). */
|
|
105
|
-
decimals?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Writes this text into the element letter by letter: none of it when the
|
|
108
|
-
* change starts, all of it when it ends (a typewriter).
|
|
109
|
-
*/
|
|
110
|
-
write?: string;
|
|
111
|
-
/**
|
|
112
|
-
* With `write`: letters not yet written show characters picked from this
|
|
113
|
-
* string, changing every {@link SCRAMBLE_MS} ms, so the text decodes
|
|
114
|
-
* rather than types. The same time always picks the same characters.
|
|
115
|
-
*/
|
|
116
|
-
scramble?: string;
|
|
117
|
-
/** With `write`: shown after the written letters while it writes ("▌", "|"). */
|
|
118
|
-
caret?: string;
|
|
119
|
-
}
|
|
120
|
-
/** How often scrambled letters change, in ms (see `SvgAnimation.scramble`). */
|
|
121
|
-
declare const SCRAMBLE_MS = 50;
|
|
122
|
-
/**
|
|
123
|
-
* `text` with `u` (0–1) of its letters written (see `SvgAnimation.write`):
|
|
124
|
-
* the rest scrambled from `scramble` (picked by `timeMs`) or left off, then
|
|
125
|
-
* the caret while it is unfinished. Letters are code points, so emoji and
|
|
126
|
-
* accents are never split.
|
|
127
|
-
*/
|
|
128
|
-
declare function writtenText(text: string, u: number, options?: {
|
|
129
|
-
scramble?: string;
|
|
130
|
-
caret?: string;
|
|
131
|
-
timeMs?: number;
|
|
132
|
-
}): string;
|
|
133
|
-
/** What one element of an animated SVG shows at a time. */
|
|
134
|
-
interface SvgElementFrame {
|
|
135
|
-
attrs: Record<string, string>;
|
|
136
|
-
/** How much of its length is drawn, 0–1. */
|
|
137
|
-
draw?: number;
|
|
138
|
-
text?: string;
|
|
139
|
-
/** Where it is along a path: the path's id and the fraction of its length. */
|
|
140
|
-
along?: {
|
|
141
|
-
path: string;
|
|
142
|
-
at: number;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* The whole picture's framing (on the frame for {@link SVG_PICTURE}): `u`
|
|
146
|
-
* of the way from one view to the next, `null` being the whole `viewBox`.
|
|
147
|
-
*/
|
|
148
|
-
view?: {
|
|
149
|
-
from: SvgBox | string | null;
|
|
150
|
-
to: SvgBox | string;
|
|
151
|
-
u: number;
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
/** The key of the whole picture's frame in {@link svgFrame}'s result (for `view`). */
|
|
155
|
-
declare const SVG_PICTURE = "";
|
|
156
|
-
/** A value `u` of the way between two attribute values (see `SvgAnimation.attrs`). */
|
|
157
|
-
declare function lerpAttr(a: string | number, b: string | number, u: number): string;
|
|
158
|
-
/** Formats a number for a count animation (`{n}` stands for the rounded number). */
|
|
159
|
-
declare function formatCount(value: number, options?: {
|
|
160
|
-
decimals?: number;
|
|
161
|
-
format?: string;
|
|
162
|
-
}): string;
|
|
163
|
-
/**
|
|
164
|
-
* What each animated element shows at `timeMs`. For each attribute (or
|
|
165
|
-
* line, count or writing) the latest change to have started wins; before the first
|
|
166
|
-
* one starts, the element shows that change's starting value, so something
|
|
167
|
-
* that grows in later is hidden until then.
|
|
168
|
-
*/
|
|
169
|
-
declare function svgFrame(animations: readonly SvgAnimation[], steps: readonly number[], timeMs: number): Map<string, SvgElementFrame>;
|
|
170
|
-
/**
|
|
171
|
-
* The opening tag of the root element at the start of `markup` (up to its
|
|
172
|
-
* first `>`), cut out without a regular expression, so checks on it stay
|
|
173
|
-
* linear however long or odd the markup is.
|
|
174
|
-
*/
|
|
175
|
-
declare function svgOpeningTag(markup: string): string;
|
|
176
|
-
/** Problems with an {@link SvgMotion}, as sentences; none when it can be drawn. */
|
|
177
|
-
declare function svgMotionIssues(motion: unknown): string[];
|
|
178
|
-
|
|
179
|
-
export { type DataKey as D, EASES as E, type SvgMotion as S, type EaseName as a, SCRAMBLE_MS as b, STEP_MS as c, SVG_PICTURE as d, type SvgAnimation as e, type SvgBox as f, type SvgElementFrame as g, defaultDataKey as h, formatCount as i, lerpData as j, stepProgress as k, lerpAttr as l, stepStart as m, svgFrame as n, svgMotionIssues as o, svgOpeningTag as p, stepData as s, writtenText as w };
|
|
File without changes
|