@lumencast/runtime 0.3.0 → 0.5.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 +57 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/animate/frame-coalescer.d.ts +13 -0
- package/dist/animate/frame-coalescer.d.ts.map +1 -0
- package/dist/animate/frame-coalescer.js +46 -0
- package/dist/animate/frame-coalescer.js.map +1 -0
- package/dist/animate/keyframes.d.ts +1 -1
- package/dist/animate/keyframes.d.ts.map +1 -1
- package/dist/animate/keyframes.js +20 -6
- package/dist/animate/keyframes.js.map +1 -1
- package/dist/animate/transitions.d.ts +33 -1
- package/dist/animate/transitions.d.ts.map +1 -1
- package/dist/animate/transitions.js +78 -3
- package/dist/animate/transitions.js.map +1 -1
- package/dist/{broadcast-B82fQPph.js → broadcast-3vYij4k-.js} +3 -3
- package/dist/{broadcast-B82fQPph.js.map → broadcast-3vYij4k-.js.map} +1 -1
- package/dist/{control-DIfwMYRb.js → control-BFNkY7-6.js} +4 -4
- package/dist/{control-DIfwMYRb.js.map → control-BFNkY7-6.js.map} +1 -1
- package/dist/{index-BFZXQAD7.js → index-CyOlpZAL.js} +318 -145
- package/dist/index-CyOlpZAL.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/lumencast.js +9 -2
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +11 -1
- package/dist/mount.js.map +1 -1
- package/dist/render/bind-animate.d.ts +40 -0
- package/dist/render/bind-animate.d.ts.map +1 -0
- package/dist/render/bind-animate.js +329 -0
- package/dist/render/bind-animate.js.map +1 -0
- package/dist/render/bundle.d.ts +48 -6
- package/dist/render/bundle.d.ts.map +1 -1
- package/dist/render/bundle.js +71 -4
- package/dist/render/bundle.js.map +1 -1
- package/dist/render/color-interp.d.ts +18 -0
- package/dist/render/color-interp.d.ts.map +1 -0
- package/dist/render/color-interp.js +303 -0
- package/dist/render/color-interp.js.map +1 -0
- package/dist/render/css-color.d.ts +16 -0
- package/dist/render/css-color.d.ts.map +1 -0
- package/dist/render/css-color.js +130 -0
- package/dist/render/css-color.js.map +1 -0
- package/dist/render/diagnostics.d.ts +26 -0
- package/dist/render/diagnostics.d.ts.map +1 -0
- package/dist/render/diagnostics.js +58 -0
- package/dist/render/diagnostics.js.map +1 -0
- package/dist/render/fill.d.ts +15 -3
- package/dist/render/fill.d.ts.map +1 -1
- package/dist/render/fill.js +81 -14
- package/dist/render/fill.js.map +1 -1
- package/dist/render/filter-clamp.d.ts +35 -0
- package/dist/render/filter-clamp.d.ts.map +1 -0
- package/dist/render/filter-clamp.js +90 -0
- package/dist/render/filter-clamp.js.map +1 -0
- package/dist/render/keyframe-player.d.ts +4 -1
- package/dist/render/keyframe-player.d.ts.map +1 -1
- package/dist/render/keyframe-player.js +2 -2
- package/dist/render/keyframe-player.js.map +1 -1
- package/dist/render/primitives/frame.d.ts +16 -1
- package/dist/render/primitives/frame.d.ts.map +1 -1
- package/dist/render/primitives/frame.js +44 -13
- package/dist/render/primitives/frame.js.map +1 -1
- package/dist/render/primitives/image.d.ts +1 -1
- package/dist/render/primitives/image.d.ts.map +1 -1
- package/dist/render/primitives/image.js +8 -5
- package/dist/render/primitives/image.js.map +1 -1
- package/dist/render/primitives/index.d.ts +3 -0
- package/dist/render/primitives/index.d.ts.map +1 -1
- package/dist/render/primitives/index.js.map +1 -1
- package/dist/render/primitives/instance.d.ts +1 -1
- package/dist/render/primitives/instance.d.ts.map +1 -1
- package/dist/render/primitives/instance.js +10 -13
- package/dist/render/primitives/instance.js.map +1 -1
- package/dist/render/primitives/shape.d.ts +9 -3
- package/dist/render/primitives/shape.d.ts.map +1 -1
- package/dist/render/primitives/shape.js +58 -14
- package/dist/render/primitives/shape.js.map +1 -1
- package/dist/render/primitives/text.d.ts +35 -4
- package/dist/render/primitives/text.d.ts.map +1 -1
- package/dist/render/primitives/text.js +181 -9
- package/dist/render/primitives/text.js.map +1 -1
- package/dist/render/prop-allowlist.d.ts +10 -0
- package/dist/render/prop-allowlist.d.ts.map +1 -0
- package/dist/render/prop-allowlist.js +112 -0
- package/dist/render/prop-allowlist.js.map +1 -0
- package/dist/render/svg-path.d.ts +35 -0
- package/dist/render/svg-path.d.ts.map +1 -0
- package/dist/render/svg-path.js +211 -0
- package/dist/render/svg-path.js.map +1 -0
- package/dist/render/tree.d.ts.map +1 -1
- package/dist/render/tree.js +30 -5
- package/dist/render/tree.js.map +1 -1
- package/dist/{status-pill-DNHbHdag.js → status-pill-DIpXc5du.js} +2 -2
- package/dist/{status-pill-DNHbHdag.js.map → status-pill-DIpXc5du.js.map} +1 -1
- package/dist/{test-Dp0QrKYM.js → test-ByRec1kd.js} +4 -4
- package/dist/{test-Dp0QrKYM.js.map → test-ByRec1kd.js.map} +1 -1
- package/dist/tree-D5wYHpPu.js +1230 -0
- package/dist/tree-D5wYHpPu.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/animate/frame-coalescer.ts +63 -0
- package/src/animate/keyframes.ts +24 -5
- package/src/animate/transitions.ts +85 -3
- package/src/index.ts +24 -0
- package/src/mount.ts +12 -1
- package/src/render/bind-animate.tsx +370 -0
- package/src/render/bundle.ts +102 -10
- package/src/render/color-interp.ts +303 -0
- package/src/render/css-color.ts +145 -0
- package/src/render/diagnostics.ts +75 -0
- package/src/render/fill.tsx +85 -14
- package/src/render/filter-clamp.ts +99 -0
- package/src/render/keyframe-player.tsx +10 -2
- package/src/render/primitives/frame.tsx +53 -14
- package/src/render/primitives/image.tsx +8 -4
- package/src/render/primitives/index.ts +3 -0
- package/src/render/primitives/instance.tsx +14 -15
- package/src/render/primitives/shape.tsx +78 -14
- package/src/render/primitives/text.tsx +226 -9
- package/src/render/prop-allowlist.ts +119 -0
- package/src/render/svg-path.ts +215 -0
- package/src/render/tree.tsx +41 -6
- package/src/types.ts +27 -0
- package/dist/index-BFZXQAD7.js.map +0 -1
- package/dist/tree-x5Qd9Kq0.js +0 -508
- package/dist/tree-x5Qd9Kq0.js.map +0 -1
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
// LSML 1.1 §6.3 `bindAnimate` — continuous interpolation toward a live
|
|
2
|
+
// leaf value (ADR 001 §3.3, issue #33).
|
|
3
|
+
//
|
|
4
|
+
// Per binding, the hook subscribes the existing leaf-grain signal and
|
|
5
|
+
// retargets a Framer motion value on change — NO remount, the DOM node
|
|
6
|
+
// is identical before/after (RC#6). Scalar channels (§6.1) ride motion
|
|
7
|
+
// values attached to a wrapping `motion.div` ; colour channels (§6.5)
|
|
8
|
+
// are interpolated component-wise in sRGB through the strict shared
|
|
9
|
+
// parser and flow back into the primitive's resolved prop (which
|
|
10
|
+
// re-validates them — RC#11 belt and braces).
|
|
11
|
+
//
|
|
12
|
+
// Anti-DoS (Bastion RC#13) : deltas are coalesced per frame — one
|
|
13
|
+
// retarget max per rAF per binding, whatever the producer's rate
|
|
14
|
+
// (1 kHz tested in E2E). Retargets interrupt in-flight springs with
|
|
15
|
+
// velocity carry (§6.2/§6.4 — framer preserves a motion value's
|
|
16
|
+
// velocity when a spring animation is replaced ; no snap).
|
|
17
|
+
//
|
|
18
|
+
// R8 runtime half (issue #42) : `filter.blur` / `filter.brightness`
|
|
19
|
+
// values arriving live re-pass the same caps as the compiler before
|
|
20
|
+
// they may touch the composed CSS filter (see filter-clamp.ts).
|
|
21
|
+
//
|
|
22
|
+
// Stagger (§6.7) : inside a `repeat` iteration the FIRST animated
|
|
23
|
+
// retarget per binding is delayed by the ambient StaggerContext delay ;
|
|
24
|
+
// steady-state retargets are never delayed (a permanently-lagging gauge
|
|
25
|
+
// would defeat the purpose of a live binding). Documented hypothesis —
|
|
26
|
+
// the spec only constrains animation *starts*.
|
|
27
|
+
import { animate, useMotionValue, useTransform, } from "framer-motion";
|
|
28
|
+
import { effect } from "@preact/signals-react";
|
|
29
|
+
import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
30
|
+
import { scopedPath } from "./scope";
|
|
31
|
+
import { StaggerContext } from "./stagger-context";
|
|
32
|
+
import { toFramer } from "../animate/transitions";
|
|
33
|
+
import { createFrameCoalescer } from "../animate/frame-coalescer";
|
|
34
|
+
import { clampFilterChannel, warnRejectedFilter } from "./filter-clamp";
|
|
35
|
+
import { warnRejectedColor } from "./css-color";
|
|
36
|
+
import { emitDiagnostic } from "./diagnostics";
|
|
37
|
+
import { cssColorToRgba, mixRgba, serializeRgba } from "./color-interp";
|
|
38
|
+
/** §6.5 colour-typed bindAnimate keys → the runtime prop name the
|
|
39
|
+
* primitive reads (and re-validates through `parseCssColor`). */
|
|
40
|
+
export const BIND_ANIMATE_COLOR_PROPS = {
|
|
41
|
+
"style.color": "colour",
|
|
42
|
+
fill: "fill",
|
|
43
|
+
background: "background",
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Validate + normalise one live bindAnimate value into per-channel
|
|
47
|
+
* numeric targets. Returns `null` on rejection (wrong JSON shape per
|
|
48
|
+
* §6.3, non-finite numbers, filter values outside the R8 caps when the
|
|
49
|
+
* channel rejects rather than clamps). A `null` keeps the last
|
|
50
|
+
* known-good target — the raw input never reaches a style.
|
|
51
|
+
*
|
|
52
|
+
* Exported pure for the hostile-delta fixture suite (issue #42).
|
|
53
|
+
*/
|
|
54
|
+
export function resolveScalarTargets(key, raw) {
|
|
55
|
+
switch (key) {
|
|
56
|
+
case "opacity": {
|
|
57
|
+
const v = toFiniteScalar(raw);
|
|
58
|
+
if (v === null)
|
|
59
|
+
return null;
|
|
60
|
+
return { opacity: v < 0 ? 0 : v > 1 ? 1 : v };
|
|
61
|
+
}
|
|
62
|
+
case "transform.translate": {
|
|
63
|
+
if (!Array.isArray(raw) || raw.length !== 2)
|
|
64
|
+
return null;
|
|
65
|
+
const tx = toFiniteScalar(raw[0]);
|
|
66
|
+
const ty = toFiniteScalar(raw[1]);
|
|
67
|
+
if (tx === null || ty === null)
|
|
68
|
+
return null;
|
|
69
|
+
return { x: tx, y: ty };
|
|
70
|
+
}
|
|
71
|
+
case "transform.scale": {
|
|
72
|
+
const s = toFiniteScalar(raw);
|
|
73
|
+
if (s !== null)
|
|
74
|
+
return { scaleX: s, scaleY: s };
|
|
75
|
+
if (Array.isArray(raw) && raw.length === 2) {
|
|
76
|
+
const sx = toFiniteScalar(raw[0]);
|
|
77
|
+
const sy = toFiniteScalar(raw[1]);
|
|
78
|
+
if (sx === null || sy === null)
|
|
79
|
+
return null;
|
|
80
|
+
return { scaleX: sx, scaleY: sy };
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
case "transform.rotate": {
|
|
85
|
+
const v = toFiniteScalar(raw);
|
|
86
|
+
if (v === null)
|
|
87
|
+
return null;
|
|
88
|
+
return { rotate: v };
|
|
89
|
+
}
|
|
90
|
+
case "filter.blur": {
|
|
91
|
+
const v = clampFilterChannel("blur", raw);
|
|
92
|
+
return v === null ? null : { blur: v };
|
|
93
|
+
}
|
|
94
|
+
case "filter.brightness": {
|
|
95
|
+
const v = clampFilterChannel("brightness", raw);
|
|
96
|
+
return v === null ? null : { brightness: v };
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ── IEEE-754 `-0` policy (R8 / PR #39 coherence, issue #33) ───────────
|
|
103
|
+
// `-0 < 0` is FALSE, so a plain sign clamp lets -0 through. Uniform
|
|
104
|
+
// rule : no -0 ever reaches a motion value or a style. Per channel :
|
|
105
|
+
// · opacity — the negative case CLAMPS to 0 (`-5 → 0`), so -0 follows
|
|
106
|
+
// the same line and normalises to +0 (rejecting -0 while clamping
|
|
107
|
+
// -5 would be incoherent within the channel) ;
|
|
108
|
+
// · translate / scale / rotate — negatives are valid values and
|
|
109
|
+
// `-0 == 0` is mathematically neutral, so -0 normalises to +0 (a
|
|
110
|
+
// producer computing `-x` at x = 0 must not be rejected into a
|
|
111
|
+
// stale last-good) ;
|
|
112
|
+
// · filter.blur / filter.brightness — REJECTED (null → last-good) by
|
|
113
|
+
// `clampFilterChannel` : the R8 gate treats any negative sign,
|
|
114
|
+
// including -0, as hostile input (compiler mirror, issues #39/#41
|
|
115
|
+
// — do not relax here).
|
|
116
|
+
/** Finite-number gate + `-0 → +0` normalisation for the generic scalar
|
|
117
|
+
* channels (filter channels go through `clampFilterChannel` instead). */
|
|
118
|
+
function toFiniteScalar(v) {
|
|
119
|
+
if (typeof v !== "number" || !Number.isFinite(v))
|
|
120
|
+
return null;
|
|
121
|
+
return Object.is(v, -0) ? 0 : v;
|
|
122
|
+
}
|
|
123
|
+
/** Default retarget transition when neither a per-leaf wire directive
|
|
124
|
+
* nor a compiled `transitions` entry resolves : the §6.2 default
|
|
125
|
+
* spring (stiffness 170, damping 26, mass 1). A spring is the only
|
|
126
|
+
* curve with well-defined retarget semantics (velocity carry) — a
|
|
127
|
+
* documented hypothesis, see the PR for issue #33. */
|
|
128
|
+
export const DEFAULT_BIND_ANIMATE_TRANSITION = {
|
|
129
|
+
kind: "spring",
|
|
130
|
+
stiffness: 170,
|
|
131
|
+
damping: 26,
|
|
132
|
+
mass: 1,
|
|
133
|
+
};
|
|
134
|
+
/** node.transitions lookup key for each bindAnimate key (mirrors the
|
|
135
|
+
* compiler's `transitionKeysForBindAnimate`). */
|
|
136
|
+
function transitionLookupKey(key) {
|
|
137
|
+
switch (key) {
|
|
138
|
+
case "opacity":
|
|
139
|
+
return "opacity";
|
|
140
|
+
case "transform.translate":
|
|
141
|
+
return "x";
|
|
142
|
+
case "transform.scale":
|
|
143
|
+
return "scale";
|
|
144
|
+
case "transform.rotate":
|
|
145
|
+
return "rotate";
|
|
146
|
+
case "filter.blur":
|
|
147
|
+
case "filter.brightness":
|
|
148
|
+
return "filter";
|
|
149
|
+
default:
|
|
150
|
+
return BIND_ANIMATE_COLOR_PROPS[key] ?? key;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const NO_COLORS = {};
|
|
154
|
+
/**
|
|
155
|
+
* Drive a node's `animateBindings`. Must be called unconditionally
|
|
156
|
+
* (hook) ; cheap no-op when the node has no bindings.
|
|
157
|
+
*/
|
|
158
|
+
export function useBindAnimate(node, store, scope) {
|
|
159
|
+
const bindings = node.animateBindings;
|
|
160
|
+
const staggerDelayMs = useContext(StaggerContext);
|
|
161
|
+
// Fixed channel set — created unconditionally so hook order is
|
|
162
|
+
// stable ; unbound channels stay at their identity value.
|
|
163
|
+
const opacity = useMotionValue(1);
|
|
164
|
+
const x = useMotionValue(0);
|
|
165
|
+
const y = useMotionValue(0);
|
|
166
|
+
const scaleX = useMotionValue(1);
|
|
167
|
+
const scaleY = useMotionValue(1);
|
|
168
|
+
const rotate = useMotionValue(0);
|
|
169
|
+
const blur = useMotionValue(0);
|
|
170
|
+
const brightness = useMotionValue(1);
|
|
171
|
+
// Composed CSS filter — both functions always present so framer
|
|
172
|
+
// interpolates structurally-identical lists (same form as the
|
|
173
|
+
// compiler emits, clamped per R8).
|
|
174
|
+
const filter = useTransform([blur, brightness], ([b, br]) => `blur(${b}px) brightness(${br})`);
|
|
175
|
+
const [colorProps, setColorProps] = useState(NO_COLORS);
|
|
176
|
+
const channels = useRef({
|
|
177
|
+
opacity,
|
|
178
|
+
x,
|
|
179
|
+
y,
|
|
180
|
+
scaleX,
|
|
181
|
+
scaleY,
|
|
182
|
+
rotate,
|
|
183
|
+
blur,
|
|
184
|
+
brightness,
|
|
185
|
+
});
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (!bindings || Object.keys(bindings).length === 0)
|
|
188
|
+
return;
|
|
189
|
+
const mvs = channels.current;
|
|
190
|
+
const controls = new Map();
|
|
191
|
+
const colorState = new Map();
|
|
192
|
+
const animatedOnce = new Set();
|
|
193
|
+
let mounted = false;
|
|
194
|
+
const transitionFor = (key, fullPath) => {
|
|
195
|
+
const live = store.transitionSignal(fullPath).peek();
|
|
196
|
+
const declared = live ?? node.transitions?.[transitionLookupKey(key)];
|
|
197
|
+
const base = toFramer(declared ?? DEFAULT_BIND_ANIMATE_TRANSITION);
|
|
198
|
+
// §6.7 — stagger delays only the first animated retarget.
|
|
199
|
+
if (staggerDelayMs > 0 && !animatedOnce.has(key)) {
|
|
200
|
+
return { ...base, delay: staggerDelayMs / 1000 };
|
|
201
|
+
}
|
|
202
|
+
return base;
|
|
203
|
+
};
|
|
204
|
+
const dispatch = (key, value, instant) => {
|
|
205
|
+
const colorProp = BIND_ANIMATE_COLOR_PROPS[key];
|
|
206
|
+
const fullPath = scopedPath(scope, bindings[key]);
|
|
207
|
+
if (colorProp !== undefined) {
|
|
208
|
+
// §6.5 — canonicalise BOTH endpoints through the strict parser
|
|
209
|
+
// before interpolating ; never a raw string.
|
|
210
|
+
const end = cssColorToRgba(value);
|
|
211
|
+
if (end === null) {
|
|
212
|
+
warnRejectedColor(`bindAnimate.${key}`, node.id);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const prev = colorState.get(key);
|
|
216
|
+
if (instant || prev === undefined) {
|
|
217
|
+
colorState.set(key, { current: end });
|
|
218
|
+
setColorProps((p) => ({ ...p, [colorProp]: serializeRgba(end) }));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const start = prev.current;
|
|
222
|
+
const tx = transitionFor(key, fullPath);
|
|
223
|
+
animatedOnce.add(key);
|
|
224
|
+
controls.get(`color:${key}`)?.stop();
|
|
225
|
+
controls.set(`color:${key}`, animate(0, 1, {
|
|
226
|
+
...tx,
|
|
227
|
+
onUpdate: (t) => {
|
|
228
|
+
const mixed = mixRgba(start, end, t);
|
|
229
|
+
prev.current = mixed;
|
|
230
|
+
setColorProps((p) => ({ ...p, [colorProp]: serializeRgba(mixed) }));
|
|
231
|
+
},
|
|
232
|
+
}));
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const targets = resolveScalarTargets(key, value);
|
|
236
|
+
if (targets === null) {
|
|
237
|
+
// R9 — the offending value is never logged.
|
|
238
|
+
if (key.startsWith("filter."))
|
|
239
|
+
warnRejectedFilter(`bindAnimate.${key}`, node.id);
|
|
240
|
+
else
|
|
241
|
+
warnRejectedBindValue(key, node.id);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (instant) {
|
|
245
|
+
// §6.3.1 — on mount the rendered state initialises from the
|
|
246
|
+
// bound value instantly (there is no previous state).
|
|
247
|
+
for (const [ch, v] of Object.entries(targets)) {
|
|
248
|
+
mvs[ch].jump(v);
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const tx = transitionFor(key, fullPath);
|
|
253
|
+
animatedOnce.add(key);
|
|
254
|
+
for (const [ch, v] of Object.entries(targets)) {
|
|
255
|
+
// framer's animate() replaces any in-flight animation on the
|
|
256
|
+
// motion value and seeds the new spring with the value's
|
|
257
|
+
// current velocity — §6.2 velocity carry, no snap.
|
|
258
|
+
controls.set(ch, animate(mvs[ch], v, tx));
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
// RC#13 — one retarget max per rAF per binding.
|
|
262
|
+
const coalescer = createFrameCoalescer((key, value) => dispatch(key, value, false));
|
|
263
|
+
const disposers = Object.entries(bindings).map(([key, path]) => effect(() => {
|
|
264
|
+
const v = store.signal(scopedPath(scope, path)).value;
|
|
265
|
+
if (v === undefined)
|
|
266
|
+
return;
|
|
267
|
+
if (!mounted)
|
|
268
|
+
dispatch(key, v, true);
|
|
269
|
+
else
|
|
270
|
+
coalescer.push(key, v);
|
|
271
|
+
}));
|
|
272
|
+
mounted = true;
|
|
273
|
+
return () => {
|
|
274
|
+
for (const d of disposers)
|
|
275
|
+
d();
|
|
276
|
+
coalescer.dispose();
|
|
277
|
+
for (const c of controls.values())
|
|
278
|
+
c.stop();
|
|
279
|
+
};
|
|
280
|
+
// node/store/scope identity changes re-wire every subscription ;
|
|
281
|
+
// staggerDelayMs is stable per repeat iteration.
|
|
282
|
+
}, [node, bindings, store, scope, staggerDelayMs]);
|
|
283
|
+
const motionStyle = useMemo(() => {
|
|
284
|
+
if (!bindings)
|
|
285
|
+
return null;
|
|
286
|
+
const style = {};
|
|
287
|
+
let any = false;
|
|
288
|
+
for (const key of Object.keys(bindings)) {
|
|
289
|
+
switch (key) {
|
|
290
|
+
case "opacity":
|
|
291
|
+
style.opacity = opacity;
|
|
292
|
+
any = true;
|
|
293
|
+
break;
|
|
294
|
+
case "transform.translate":
|
|
295
|
+
style.x = x;
|
|
296
|
+
style.y = y;
|
|
297
|
+
any = true;
|
|
298
|
+
break;
|
|
299
|
+
case "transform.scale":
|
|
300
|
+
style.scaleX = scaleX;
|
|
301
|
+
style.scaleY = scaleY;
|
|
302
|
+
any = true;
|
|
303
|
+
break;
|
|
304
|
+
case "transform.rotate":
|
|
305
|
+
style.rotate = rotate;
|
|
306
|
+
any = true;
|
|
307
|
+
break;
|
|
308
|
+
case "filter.blur":
|
|
309
|
+
case "filter.brightness":
|
|
310
|
+
style.filter = filter;
|
|
311
|
+
any = true;
|
|
312
|
+
break;
|
|
313
|
+
default:
|
|
314
|
+
break; // colour keys flow through colorProps, not the wrapper
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (!any)
|
|
318
|
+
return null;
|
|
319
|
+
style.willChange = "transform, opacity, filter";
|
|
320
|
+
return style;
|
|
321
|
+
}, [bindings, opacity, x, y, scaleX, scaleY, rotate, filter]);
|
|
322
|
+
return { motionStyle, colorProps };
|
|
323
|
+
}
|
|
324
|
+
/** R9 diagnostic — shape-invalid bindAnimate value (non-filter
|
|
325
|
+
* channels). Structured event, value withheld. */
|
|
326
|
+
function warnRejectedBindValue(key, nodeId) {
|
|
327
|
+
emitDiagnostic(nodeId, `bindAnimate.${key}`, "rejected bound value : JSON shape does not match the property type (LSML §6.3)");
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=bind-animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-animate.js","s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,CAAC;gBACnB,KAAK,mBAAmB;oBACtB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;oBACtB,GAAG,GAAG,IAAI,CAAC;oBACX,MAAM;gBACR;oBACE,MAAM,CAAC,uDAAuD;YAClE,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,KAAK,CAAC,UAAU,GAAG,4BAA4B,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACrC,CAAC;AAED;mDACmD;AACnD,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAe;IACzD,cAAc,CACZ,MAAM,EACN,eAAe,GAAG,EAAE,EACpB,gFAAgF,CACjF,CAAC;AACJ,CAAC"}
|
package/dist/render/bundle.d.ts
CHANGED
|
@@ -22,6 +22,17 @@ export interface RenderNode {
|
|
|
22
22
|
* the primitive applies no `initial` and the prior no-mount-play
|
|
23
23
|
* behaviour holds (backward compatible). */
|
|
24
24
|
animate_initial?: Record<string, number | string>;
|
|
25
|
+
/** LSML 1.1 §6.3 — animation targets bound to leaf paths
|
|
26
|
+
* (`bindAnimate`). Keys are the spec property names (`opacity`,
|
|
27
|
+
* `transform.translate`, `transform.scale`, `transform.rotate`,
|
|
28
|
+
* `filter.blur`, `filter.brightness`, plus the kind's colour-typed
|
|
29
|
+
* property per §6.5 : `style.color` / `fill` / `background`) ; values
|
|
30
|
+
* are LeafPaths. The runtime subscribes each path's leaf-grain signal
|
|
31
|
+
* and retargets a Framer motion value on change — continuous
|
|
32
|
+
* interpolation toward the live value, no remount. Deltas are
|
|
33
|
+
* coalesced per frame (one retarget max per rAF per binding,
|
|
34
|
+
* ADR 001 RC#13). */
|
|
35
|
+
animateBindings?: Record<string, string>;
|
|
25
36
|
/** LSML 1.1 §6.6 — multi-step keyframe sequence played on mount or
|
|
26
37
|
* whenever `keyframes.key` (LeafPath) changes. Coexists with
|
|
27
38
|
* `transitions` ; the runtime applies whichever was last triggered
|
|
@@ -63,9 +74,11 @@ export interface RenderBundle {
|
|
|
63
74
|
external_adapters?: ExternalAdapter[];
|
|
64
75
|
assets?: Asset[];
|
|
65
76
|
/** LSML 1.1 §17.3 — capability profiles required for correct rendering.
|
|
66
|
-
* Each entry is
|
|
67
|
-
* checks every entry against its supported list ; an
|
|
68
|
-
* profile raises BUNDLE_INCOMPATIBLE per
|
|
77
|
+
* Each entry is an `x-<vendor>.<name>/<version>` string. The runtime
|
|
78
|
+
* checks every behavioural entry against its supported list ; an
|
|
79
|
+
* unrecognised behavioural profile raises BUNDLE_INCOMPATIBLE per
|
|
80
|
+
* §17.3.1. Authoring profiles (`x-<vendor>.authoring/<major>`, §17.5.1)
|
|
81
|
+
* are advisory : ignored at render time, never a rejection cause. */
|
|
69
82
|
profiles?: string[];
|
|
70
83
|
}
|
|
71
84
|
/**
|
|
@@ -80,6 +93,10 @@ export interface RenderBundle {
|
|
|
80
93
|
* reject.
|
|
81
94
|
*/
|
|
82
95
|
export declare const SUPPORTED_PROFILES: ReadonlySet<string>;
|
|
96
|
+
/** True when `id` has the complete authoring-profile form
|
|
97
|
+
* `x-<vendor>.authoring/<major>` (LSML 1.1 §17.5.1, ADR 001 RC#14).
|
|
98
|
+
* Such profiles are advisory : ignored at render time, never rejected. */
|
|
99
|
+
export declare function isAuthoringProfile(id: string): boolean;
|
|
83
100
|
export declare class BundleIncompatibleError extends Error {
|
|
84
101
|
readonly code: "BUNDLE_INCOMPATIBLE";
|
|
85
102
|
readonly unsupportedProfiles: string[];
|
|
@@ -87,7 +104,20 @@ export declare class BundleIncompatibleError extends Error {
|
|
|
87
104
|
}
|
|
88
105
|
/** Validate a bundle's `profiles[]` against the runtime's supported
|
|
89
106
|
* set. Throws `BundleIncompatibleError` listing every offending entry
|
|
90
|
-
* when at least one is not supported.
|
|
107
|
+
* when at least one behavioural profile is not supported.
|
|
108
|
+
*
|
|
109
|
+
* Authoring profiles (`x-<vendor>.authoring/<major>`, LSML 1.1 §17.5.1)
|
|
110
|
+
* are advisory and skipped : their absence from the supported set is
|
|
111
|
+
* never a rejection cause. Every other (behavioural) unsupported profile
|
|
112
|
+
* keeps the hard §17.3.1 `BUNDLE_INCOMPATIBLE` rejection.
|
|
113
|
+
*
|
|
114
|
+
* Malformed-shape guard : `bundle` may come from an unchecked
|
|
115
|
+
* `json as RenderBundle` cast on untrusted server JSON
|
|
116
|
+
* (`FetcherImpl.get`). A non-array `profiles` or a non-string entry is
|
|
117
|
+
* therefore reachable at runtime and is rejected as
|
|
118
|
+
* `BundleIncompatibleError` (typed, code BUNDLE_INCOMPATIBLE) — never a
|
|
119
|
+
* raw TypeError. The diagnostic never echoes the malformed value, only a
|
|
120
|
+
* shape placeholder. */
|
|
91
121
|
export declare function validateBundleProfiles(bundle: {
|
|
92
122
|
profiles?: string[];
|
|
93
123
|
}, supported?: ReadonlySet<string>): void;
|
|
@@ -98,12 +128,24 @@ export interface BundleFetcher {
|
|
|
98
128
|
* flight" handoff path. */
|
|
99
129
|
preload(bundle: RenderBundle): void;
|
|
100
130
|
}
|
|
131
|
+
/** Resolves the absolute URL of a scene's render bundle. Supplied by the
|
|
132
|
+
* host (`MountOptions.resolveBundleUrl`) when the server is not at the
|
|
133
|
+
* default host-root LSDP/1 layout — e.g. reached through a gateway prefix
|
|
134
|
+
* (`https://gw/orion/api/v1/scenes/{id}/render-bundle?v={hash}`). */
|
|
135
|
+
export type BundleUrlResolver = (sceneId: string, sceneVersion: string) => string;
|
|
101
136
|
export interface BundleFetcherOptions {
|
|
102
137
|
/** Base URL of the server. The fetcher constructs
|
|
103
|
-
* `${baseUrl}/lsdp/v1/scenes/{id}/bundle?v={hash}`.
|
|
138
|
+
* `${baseUrl}/lsdp/v1/scenes/{id}/bundle?v={hash}`. Ignored when
|
|
139
|
+
* `resolveUrl` is provided. */
|
|
104
140
|
baseUrl: string;
|
|
105
|
-
/** Path prefix for bundle resolution. Defaults to `/lsdp/v1/scenes`.
|
|
141
|
+
/** Path prefix for bundle resolution. Defaults to `/lsdp/v1/scenes`.
|
|
142
|
+
* Ignored when `resolveUrl` is provided. */
|
|
106
143
|
pathPrefix?: string;
|
|
144
|
+
/** When set, takes full control of URL construction — the host owns the
|
|
145
|
+
* whole URL (base, path prefix and `/bundle` vs `/render-bundle` suffix).
|
|
146
|
+
* Lets a gateway-prefixed server be addressed without changing the
|
|
147
|
+
* host-root default. */
|
|
148
|
+
resolveUrl?: BundleUrlResolver;
|
|
107
149
|
fetchImpl?: typeof fetch;
|
|
108
150
|
}
|
|
109
151
|
export declare function createBundleFetcher(opts: BundleFetcherOptions): BundleFetcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/render/bundle.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;kEAC8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC;;kCAE8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACzC;;;;;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;wBAewB;AACxB,wBAAgB,sBAAsB,CACpC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAC/B,SAAS,GAAE,WAAW,CAAC,MAAM,CAAsB,GAClD,IAAI,CAaN;AAID,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE;gCAC4B;IAC5B,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CACrC;AAED;;;sEAGsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;AAElF,MAAM,WAAW,oBAAoB;IACnC;;oCAEgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB;iDAC6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;6BAGyB;IACzB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAmDD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,aAAa,CAE7E"}
|
package/dist/render/bundle.js
CHANGED
|
@@ -24,6 +24,45 @@
|
|
|
24
24
|
export const SUPPORTED_PROFILES = new Set([
|
|
25
25
|
"x-lumencast.color-srgb-1.0",
|
|
26
26
|
]);
|
|
27
|
+
// LSML 1.1 §17.5.1 + ADR 001 RC#14 — authoring-profile detection.
|
|
28
|
+
//
|
|
29
|
+
// An authoring profile is advisory : a runtime that does not support it
|
|
30
|
+
// MUST NOT reject the bundle and renders the underlying primitives as if
|
|
31
|
+
// the profile were absent. Detection matches the COMPLETE identifier form
|
|
32
|
+
// `x-<vendor>.authoring/<major>` :
|
|
33
|
+
//
|
|
34
|
+
// - `x-` prefix, then one or more lowercase name segments separated by
|
|
35
|
+
// dots, where `.authoring` is the EXACT TERMINAL segment before `/` ;
|
|
36
|
+
// - `<major>` is a bare integer (no `.minor`) ;
|
|
37
|
+
// - never a substring test : a behavioural profile whose name merely
|
|
38
|
+
// *contains* `.authoring` in a non-terminal position is NOT exempted
|
|
39
|
+
// and keeps §17.3.1 hard-rejection semantics.
|
|
40
|
+
//
|
|
41
|
+
// Anti-ReDoS note : both regexes below are anchored and unambiguous —
|
|
42
|
+
// the character classes exclude the `.` and `/` separators, so there is
|
|
43
|
+
// exactly one possible parse per input (linear time, no backtracking).
|
|
44
|
+
const AUTHORING_NAME_RE = /^x-[a-z0-9-]+(?:\.[a-z0-9-]+)*$/;
|
|
45
|
+
const AUTHORING_MAJOR_RE = /^(?:0|[1-9][0-9]*)$/;
|
|
46
|
+
const AUTHORING_SUFFIX = ".authoring";
|
|
47
|
+
/** True when `id` has the complete authoring-profile form
|
|
48
|
+
* `x-<vendor>.authoring/<major>` (LSML 1.1 §17.5.1, ADR 001 RC#14).
|
|
49
|
+
* Such profiles are advisory : ignored at render time, never rejected. */
|
|
50
|
+
export function isAuthoringProfile(id) {
|
|
51
|
+
const slash = id.indexOf("/");
|
|
52
|
+
if (slash < 0)
|
|
53
|
+
return false;
|
|
54
|
+
const name = id.slice(0, slash);
|
|
55
|
+
const major = id.slice(slash + 1);
|
|
56
|
+
if (!AUTHORING_MAJOR_RE.test(major))
|
|
57
|
+
return false;
|
|
58
|
+
if (!name.endsWith(AUTHORING_SUFFIX))
|
|
59
|
+
return false;
|
|
60
|
+
// `name` minus the terminal `.authoring` segment must still be a valid
|
|
61
|
+
// `x-<vendor>[.<segment>...]` prefix — this is what makes `.authoring`
|
|
62
|
+
// a real terminal segment rather than a substring of another one
|
|
63
|
+
// (e.g. `x-evilauthoring/1` or `x-evil.authoring.fx/1` do not match).
|
|
64
|
+
return AUTHORING_NAME_RE.test(name.slice(0, -AUTHORING_SUFFIX.length));
|
|
65
|
+
}
|
|
27
66
|
export class BundleIncompatibleError extends Error {
|
|
28
67
|
code = "BUNDLE_INCOMPATIBLE";
|
|
29
68
|
unsupportedProfiles;
|
|
@@ -35,12 +74,32 @@ export class BundleIncompatibleError extends Error {
|
|
|
35
74
|
}
|
|
36
75
|
/** Validate a bundle's `profiles[]` against the runtime's supported
|
|
37
76
|
* set. Throws `BundleIncompatibleError` listing every offending entry
|
|
38
|
-
* when at least one is not supported.
|
|
77
|
+
* when at least one behavioural profile is not supported.
|
|
78
|
+
*
|
|
79
|
+
* Authoring profiles (`x-<vendor>.authoring/<major>`, LSML 1.1 §17.5.1)
|
|
80
|
+
* are advisory and skipped : their absence from the supported set is
|
|
81
|
+
* never a rejection cause. Every other (behavioural) unsupported profile
|
|
82
|
+
* keeps the hard §17.3.1 `BUNDLE_INCOMPATIBLE` rejection.
|
|
83
|
+
*
|
|
84
|
+
* Malformed-shape guard : `bundle` may come from an unchecked
|
|
85
|
+
* `json as RenderBundle` cast on untrusted server JSON
|
|
86
|
+
* (`FetcherImpl.get`). A non-array `profiles` or a non-string entry is
|
|
87
|
+
* therefore reachable at runtime and is rejected as
|
|
88
|
+
* `BundleIncompatibleError` (typed, code BUNDLE_INCOMPATIBLE) — never a
|
|
89
|
+
* raw TypeError. The diagnostic never echoes the malformed value, only a
|
|
90
|
+
* shape placeholder. */
|
|
39
91
|
export function validateBundleProfiles(bundle, supported = SUPPORTED_PROFILES) {
|
|
40
92
|
const profiles = bundle.profiles;
|
|
41
|
-
if (!profiles
|
|
93
|
+
if (!profiles)
|
|
94
|
+
return;
|
|
95
|
+
if (!Array.isArray(profiles)) {
|
|
96
|
+
throw new BundleIncompatibleError(["<malformed: profiles is not an array>"]);
|
|
97
|
+
}
|
|
98
|
+
if (profiles.length === 0)
|
|
42
99
|
return;
|
|
43
|
-
const missing = profiles
|
|
100
|
+
const missing = profiles
|
|
101
|
+
.filter((p) => typeof p !== "string" || (!isAuthoringProfile(p) && !supported.has(p)))
|
|
102
|
+
.map((p) => (typeof p === "string" ? p : "<malformed: non-string profile entry>"));
|
|
44
103
|
if (missing.length > 0) {
|
|
45
104
|
throw new BundleIncompatibleError(missing);
|
|
46
105
|
}
|
|
@@ -49,12 +108,20 @@ class FetcherImpl {
|
|
|
49
108
|
cache = new Map();
|
|
50
109
|
baseUrl;
|
|
51
110
|
pathPrefix;
|
|
111
|
+
resolveUrl;
|
|
52
112
|
fetchImpl;
|
|
53
113
|
constructor(opts) {
|
|
54
114
|
this.baseUrl = opts.baseUrl.replace(/\/$/, "");
|
|
55
115
|
this.pathPrefix = (opts.pathPrefix ?? "/lsdp/v1/scenes").replace(/\/$/, "");
|
|
116
|
+
this.resolveUrl = opts.resolveUrl;
|
|
56
117
|
this.fetchImpl = opts.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
57
118
|
}
|
|
119
|
+
buildUrl(sceneId, sceneVersion) {
|
|
120
|
+
if (this.resolveUrl) {
|
|
121
|
+
return this.resolveUrl(sceneId, sceneVersion);
|
|
122
|
+
}
|
|
123
|
+
return `${this.baseUrl}${this.pathPrefix}/${encodeURIComponent(sceneId)}/bundle?v=${encodeURIComponent(sceneVersion)}`;
|
|
124
|
+
}
|
|
58
125
|
preload(bundle) {
|
|
59
126
|
// LSML 1.1 §17.3.1 — reject early if any declared profile is
|
|
60
127
|
// unsupported by this runtime. Authors get an actionable error
|
|
@@ -66,7 +133,7 @@ class FetcherImpl {
|
|
|
66
133
|
const cached = this.cache.get(sceneVersion);
|
|
67
134
|
if (cached)
|
|
68
135
|
return cached;
|
|
69
|
-
const url =
|
|
136
|
+
const url = this.buildUrl(sceneId, sceneVersion);
|
|
70
137
|
const response = await this.fetchImpl(url);
|
|
71
138
|
if (!response.ok) {
|
|
72
139
|
throw new Error(`bundle fetch failed: ${response.status} ${response.statusText}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/render/bundle.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,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AG,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAe,EAAE,YAAoB;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAiB,CAAC;QACrD,IAAI,IAAI,CAAC,aAAa,KAAK,YAAY,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,2CAA2C,YAAY,SAAS,IAAI,CAAC,aAAa,EAAE,CACrF,CAAC;QACJ,CAAC;QACD,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,IAA0B;IAC5D,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** RGBA channels, each in [0, 1]. */
|
|
2
|
+
export type Rgba = readonly [number, number, number, number];
|
|
3
|
+
/**
|
|
4
|
+
* Canonicalise + convert an untrusted colour value to RGBA channels in
|
|
5
|
+
* [0, 1]. The value passes through `parseCssColor` FIRST — anything the
|
|
6
|
+
* strict parser rejects converts to `null` here (never interpolate a
|
|
7
|
+
* raw string, §6.5 step 1 / RC#11). `currentcolor` is also rejected :
|
|
8
|
+
* it has no concrete channels without computed-style context.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cssColorToRgba(value: unknown): Rgba | null;
|
|
11
|
+
/** Component-wise sRGB lerp (§6.5 step 2). `t` may overshoot (springs) ;
|
|
12
|
+
* channels clamp back into [0, 1] after mixing. */
|
|
13
|
+
export declare function mixRgba(a: Rgba, b: Rgba, t: number): Rgba;
|
|
14
|
+
/** Serialise RGBA back to `rgba()` form (§6.5 step 3). The output is
|
|
15
|
+
* always re-accepted by `parseCssColor` (integer channels, alpha with
|
|
16
|
+
* at most 4 decimals). */
|
|
17
|
+
export declare function serializeRgba(rgba: Rgba): string;
|
|
18
|
+
//# sourceMappingURL=color-interp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-interp.d.ts","sourceRoot":"","sources":["../../src/render/color-interp.ts"],"names":[],"mappings":"AAmBA,qCAAqC;AACrC,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AA8J7D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAuC1D;AAqDD;oDACoD;AACpD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAOzD;AAED;;2BAE2B;AAC3B,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAOhD"}
|