dotquilt 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +64 -2
- package/dist/animations.d.ts +105 -0
- package/dist/animations.js +107 -0
- package/dist/catalog-styles.d.ts +4 -0
- package/dist/catalog-styles.js +12 -0
- package/dist/chart-animations.d.ts +36 -0
- package/dist/chart-animations.js +25 -0
- package/dist/chart-styles.d.ts +3 -0
- package/dist/chart-styles.js +23 -0
- package/dist/chart.css +4 -0
- package/dist/chart.d.ts +73 -0
- package/dist/chart.js +80 -0
- package/dist/circle.css +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +9 -0
- package/dist/internal/binding.d.ts +13 -0
- package/dist/internal/binding.js +21 -0
- package/dist/internal/capture.d.ts +4 -0
- package/dist/internal/capture.js +13 -0
- package/dist/internal/chart-appearance.d.ts +12 -0
- package/dist/internal/chart-appearance.js +2 -0
- package/dist/internal/chart-definitions.d.ts +19 -0
- package/dist/internal/chart-definitions.js +149 -0
- package/dist/internal/chart-factory.d.ts +12 -0
- package/dist/internal/chart-factory.js +31 -0
- package/dist/internal/chart-field.d.ts +22 -0
- package/dist/internal/chart-field.js +74 -0
- package/dist/internal/chart-idle.d.ts +3 -0
- package/dist/internal/chart-idle.js +96 -0
- package/dist/internal/chart-math.d.ts +8 -0
- package/dist/internal/chart-math.js +19 -0
- package/dist/internal/chart-participant.d.ts +8 -0
- package/dist/internal/chart-participant.js +4 -0
- package/dist/internal/chart-projection.d.ts +11 -0
- package/dist/internal/chart-projection.js +69 -0
- package/dist/internal/content-box.d.ts +11 -0
- package/dist/internal/content-box.js +36 -0
- package/dist/internal/coordinated-handoff.d.ts +4 -0
- package/dist/internal/coordinated-handoff.js +158 -0
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +20 -0
- package/dist/internal/defaults.d.ts +11 -0
- package/dist/internal/defaults.js +11 -0
- package/dist/internal/dense/managed-painter.d.ts +4 -0
- package/dist/internal/dense/managed-painter.js +361 -0
- package/dist/internal/dense/runner.d.ts +2 -0
- package/dist/internal/dense/runner.js +5 -0
- package/dist/internal/dense-loader.d.ts +83 -0
- package/dist/internal/dense-loader.js +331 -0
- package/dist/internal/dissolve.d.ts +27 -0
- package/dist/internal/dissolve.js +216 -0
- package/dist/internal/dom.d.ts +23 -0
- package/dist/internal/dom.js +104 -0
- package/dist/internal/effect.d.ts +2 -0
- package/dist/internal/effect.js +17 -0
- package/dist/internal/element.d.ts +89 -0
- package/dist/internal/element.js +384 -0
- package/dist/internal/event-element.d.ts +8 -0
- package/dist/internal/event-element.js +20 -0
- package/dist/internal/frames.d.ts +1 -0
- package/dist/internal/frames.js +51 -0
- package/dist/internal/handoff.d.ts +56 -0
- package/dist/internal/handoff.js +102 -0
- package/dist/internal/ledger.d.ts +13 -0
- package/dist/internal/ledger.js +78 -0
- package/dist/internal/loading-controller.d.ts +62 -0
- package/dist/internal/loading-controller.js +698 -0
- package/dist/internal/marks.d.ts +153 -0
- package/dist/internal/marks.js +227 -0
- package/dist/internal/math.d.ts +2 -0
- package/dist/internal/math.js +2 -0
- package/dist/internal/morph-marks.d.ts +62 -0
- package/dist/internal/morph-marks.js +205 -0
- package/dist/internal/morph.d.ts +35 -0
- package/dist/internal/morph.js +488 -0
- package/dist/internal/paint.d.ts +29 -0
- package/dist/internal/paint.js +1 -0
- package/dist/internal/painter.d.ts +20 -0
- package/dist/internal/painter.js +155 -0
- package/dist/internal/preset-data.d.ts +12 -0
- package/dist/internal/preset-data.js +31 -0
- package/dist/internal/preset.d.ts +22 -0
- package/dist/internal/preset.js +86 -0
- package/dist/internal/pulse.d.ts +7 -0
- package/dist/internal/pulse.js +74 -0
- package/dist/internal/reveal-effect.d.ts +7 -0
- package/dist/internal/reveal-effect.js +24 -0
- package/dist/internal/reveal.d.ts +5 -0
- package/dist/internal/reveal.js +11 -0
- package/dist/internal/runner.d.ts +9 -0
- package/dist/internal/runner.js +70 -0
- package/dist/internal/services.d.ts +12 -0
- package/dist/internal/services.js +159 -0
- package/dist/internal/skeleton-handoff.d.ts +26 -0
- package/dist/internal/skeleton-handoff.js +6 -0
- package/dist/internal/skeleton-source.d.ts +5 -0
- package/dist/internal/skeleton-source.js +106 -0
- package/dist/internal/surface.d.ts +4 -0
- package/dist/internal/surface.js +21 -0
- package/dist/internal/table-definitions.d.ts +27 -0
- package/dist/internal/table-definitions.js +139 -0
- package/dist/internal/table-factory.d.ts +12 -0
- package/dist/internal/table-factory.js +44 -0
- package/dist/internal/table-field.d.ts +12 -0
- package/dist/internal/table-field.js +75 -0
- package/dist/internal/table-model.d.ts +21 -0
- package/dist/internal/table-model.js +117 -0
- package/dist/internal/table-projection.d.ts +7 -0
- package/dist/internal/table-projection.js +110 -0
- package/dist/internal/target-changes.d.ts +3 -0
- package/dist/internal/target-changes.js +2 -0
- package/dist/internal/target-tracker.d.ts +18 -0
- package/dist/internal/target-tracker.js +33 -0
- package/dist/internal/targets.d.ts +3 -0
- package/dist/internal/targets.js +15 -0
- package/dist/internal/text-definitions.d.ts +141 -0
- package/dist/internal/text-definitions.js +228 -0
- package/dist/internal/text-glyphs.d.ts +4 -0
- package/dist/internal/text-glyphs.js +32 -0
- package/dist/internal/text-morph.d.ts +32 -0
- package/dist/internal/text-morph.js +113 -0
- package/dist/internal/text-playback.d.ts +4 -0
- package/dist/internal/text-playback.js +119 -0
- package/dist/internal/text-scramble.d.ts +18 -0
- package/dist/internal/text-scramble.js +47 -0
- package/dist/internal/time.d.ts +9 -0
- package/dist/internal/time.js +13 -0
- package/dist/internal/unstyled.d.ts +8 -0
- package/dist/internal/unstyled.js +8 -0
- package/dist/line.css +5 -0
- package/dist/region-css.d.ts +1 -0
- package/dist/region-css.js +6 -0
- package/dist/region-styles.d.ts +3 -0
- package/dist/region-styles.js +15 -0
- package/dist/region.css +1 -0
- package/dist/region.d.ts +31 -0
- package/dist/region.js +100 -0
- package/dist/register-all.d.ts +2 -0
- package/dist/register-all.js +33 -0
- package/dist/server.d.ts +63 -0
- package/dist/server.js +141 -0
- package/dist/skeleton-animations.d.ts +10 -0
- package/dist/skeleton-animations.js +35 -0
- package/dist/skeleton-block.d.ts +50 -0
- package/dist/skeleton-block.js +260 -0
- package/dist/skeleton-circle.d.ts +5 -0
- package/dist/skeleton-circle.js +11 -0
- package/dist/skeleton-family.css +13 -0
- package/dist/skeleton-line.d.ts +5 -0
- package/dist/skeleton-line.js +11 -0
- package/dist/skeleton-text.css +5 -0
- package/dist/skeleton-text.d.ts +22 -0
- package/dist/skeleton-text.js +115 -0
- package/dist/skeleton.css +4 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.js +4 -0
- package/dist/static-catalog-styles.d.ts +8 -0
- package/dist/static-catalog-styles.js +44 -0
- package/dist/styles.d.ts +4 -0
- package/dist/styles.js +18 -0
- package/dist/table-animations.d.ts +11 -0
- package/dist/table-animations.js +4 -0
- package/dist/table-styles.d.ts +2 -0
- package/dist/table-styles.js +12 -0
- package/dist/table.css +3 -0
- package/dist/table.d.ts +88 -0
- package/dist/table.js +126 -0
- package/dist/text-animations.d.ts +31 -0
- package/dist/text-animations.js +40 -0
- package/dist/text-styles.d.ts +3 -0
- package/dist/text-styles.js +24 -0
- package/dist/text.css +3 -0
- package/dist/text.d.ts +42 -0
- package/dist/text.js +402 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.js +18 -0
- package/dist/typing-styles.d.ts +1 -0
- package/dist/typing-styles.js +7 -0
- package/dist/typing.css +4 -0
- package/dist/typing.d.ts +35 -0
- package/dist/typing.js +164 -0
- package/package.json +100 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const brand = Symbol('dotquilt.animation');
|
|
2
|
+
export function definitionOf(binding) {
|
|
3
|
+
const value = binding[brand];
|
|
4
|
+
if (!value ||
|
|
5
|
+
binding.contractVersion !== 1 ||
|
|
6
|
+
value.family !== binding.family ||
|
|
7
|
+
value.phase !== binding.phase)
|
|
8
|
+
throw new TypeError();
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
/** Validate a family map without importing the optional animation authoring runtime. */
|
|
12
|
+
export function validateBindings(bindings, family) {
|
|
13
|
+
for (const phase of ['idle', 'handoff']) {
|
|
14
|
+
const binding = bindings?.[phase];
|
|
15
|
+
if (binding) {
|
|
16
|
+
if (binding.family !== family || binding.phase !== phase)
|
|
17
|
+
throw new TypeError();
|
|
18
|
+
definitionOf(binding);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Dot } from '../animations.js';
|
|
2
|
+
import type { PaintEntry, Painter } from './painter.js';
|
|
3
|
+
export declare function capturePoints(points: readonly PaintEntry[], limit?: number): readonly Dot[];
|
|
4
|
+
export declare function capturePainter(painter: Painter | undefined, limit?: number): readonly Dot[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function capturePoints(points, limit = 4096) {
|
|
2
|
+
return Object.freeze(points.slice(0, limit).map((point) => Object.freeze({
|
|
3
|
+
x: (point[0] ?? 0) + 0,
|
|
4
|
+
y: (point[1] ?? 0) + 0,
|
|
5
|
+
size: point[2] ?? 0,
|
|
6
|
+
opacity: point[3] ?? 0,
|
|
7
|
+
tone: point[4] ? 'accent' : 'base',
|
|
8
|
+
...(point[5] ? { angle: point[5] } : {}),
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
export function capturePainter(painter, limit) {
|
|
12
|
+
return (painter?.capture?.(limit) ?? capturePoints(painter?.points ?? [], limit));
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Immutable snapshot metadata, shared by independently evaluated compatible recipes. */
|
|
2
|
+
export declare const chartAppearance: unique symbol;
|
|
3
|
+
export interface Appearance {
|
|
4
|
+
/** Distance between mark centres across. */
|
|
5
|
+
readonly pitch: number;
|
|
6
|
+
/** Distance between rows; dashes have a different pitch down than across. */
|
|
7
|
+
readonly rows: number;
|
|
8
|
+
/** Radius of each painter command. */
|
|
9
|
+
readonly scale: number;
|
|
10
|
+
/** The loader's mark; with dashes, the built-in recipes follow the line. */
|
|
11
|
+
readonly mark?: import('../types.js').Mark | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface MorphWipeOptions {
|
|
2
|
+
readonly morphEnd: number;
|
|
3
|
+
readonly wipeStart: number;
|
|
4
|
+
readonly edge: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const morphFactory: import("../animations.js").AnimationFactory<"chart", "handoff", MorphWipeOptions>;
|
|
7
|
+
export declare const ridgeFactory: import("../animations.js").AnimationFactory<"chart", "idle", {
|
|
8
|
+
amplitude: number;
|
|
9
|
+
highlightWidth: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const defaultRidge: import("../animations.js").AnimationBinding<"chart", "idle", {
|
|
12
|
+
amplitude: number;
|
|
13
|
+
highlightWidth: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const defaultMorphWipe: import("../animations.js").AnimationBinding<"chart", "handoff", {
|
|
16
|
+
morphEnd: number;
|
|
17
|
+
wipeStart: number;
|
|
18
|
+
edge: number;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { chartAppearance } from './chart-appearance.js';
|
|
2
|
+
import { chartBinding, chartFactory } from './chart-factory.js';
|
|
3
|
+
import { chartPainter } from './chart-field.js';
|
|
4
|
+
import { mix, smooth } from './chart-math.js';
|
|
5
|
+
import { managedPainter } from './dense/managed-painter.js';
|
|
6
|
+
import { createDenseRunner as createRunner } from './dense/runner.js';
|
|
7
|
+
import { createHandoff } from './handoff.js';
|
|
8
|
+
import { handoff } from './marks.js';
|
|
9
|
+
import { clamp } from './math.js';
|
|
10
|
+
import { createRevealEffect } from './reveal-effect.js';
|
|
11
|
+
import { nativeSurface } from './surface.js';
|
|
12
|
+
import { createTargetTracker } from './target-tracker.js';
|
|
13
|
+
const geometry = (input) => input.kind === 'bar' ? input.bars : input.points;
|
|
14
|
+
const morphDefinition = /* @__PURE__ */ Object.freeze({
|
|
15
|
+
id: 'dotquilt/chart/morph-wipe',
|
|
16
|
+
family: 'chart',
|
|
17
|
+
phase: 'handoff',
|
|
18
|
+
handoff: createHandoff,
|
|
19
|
+
painter: managedPainter,
|
|
20
|
+
snapshot: nativeSurface,
|
|
21
|
+
reveal: createRevealEffect,
|
|
22
|
+
targets: createTargetTracker,
|
|
23
|
+
// design/SPEC.md: the field glides onto the line (~570 ms), then the line
|
|
24
|
+
// draws in (~570 ms).
|
|
25
|
+
duration: (surface) => geometry(surface.input).length ? handoff.duration : 150,
|
|
26
|
+
prepare(surface) {
|
|
27
|
+
const input = surface.input, items = geometry(input), columns = input.kind === 'line' ? new Map() : undefined, dashes = Reflect.get(surface, chartAppearance)
|
|
28
|
+
?.mark === 'dash';
|
|
29
|
+
if (columns)
|
|
30
|
+
for (const d of surface.source) {
|
|
31
|
+
const key = Math.round(d.x), old = columns.get(key);
|
|
32
|
+
if (!old || d.opacity > old.opacity)
|
|
33
|
+
columns.set(key, d);
|
|
34
|
+
}
|
|
35
|
+
return Object.freeze(surface.source.map((d, i) => {
|
|
36
|
+
let x = d.x, y = d.y, size = d.size, opacity = d.opacity, angle = 0;
|
|
37
|
+
if (input.kind === 'line' && items.length) {
|
|
38
|
+
// Sample the supplied path in its original order, including descending
|
|
39
|
+
// or vertical segments. No sorting or invented data values.
|
|
40
|
+
const position = clamp(d.x / Math.max(1, surface.width)) * (items.length - 1), cursor = Math.floor(position), a = items[cursor], b = items[Math.min(cursor + 1, items.length - 1)];
|
|
41
|
+
if (a && b) {
|
|
42
|
+
const target = mix(a.y, b.y, position - cursor), crest = columns?.get(Math.round(d.x))?.y ?? d.y;
|
|
43
|
+
x = mix(a.x, b.x, position - cursor);
|
|
44
|
+
y = d.y + target - crest;
|
|
45
|
+
if (Math.abs(y - target) < 5.5) {
|
|
46
|
+
y = target;
|
|
47
|
+
opacity = 0.95;
|
|
48
|
+
if (dashes)
|
|
49
|
+
angle = Math.atan2(b.y - a.y, b.x - a.x);
|
|
50
|
+
}
|
|
51
|
+
else if (y > target && y < input.baseline) {
|
|
52
|
+
opacity =
|
|
53
|
+
0.05 +
|
|
54
|
+
clamp(1 - (y - target) / Math.max(1, input.baseline - target)) *
|
|
55
|
+
0.22;
|
|
56
|
+
}
|
|
57
|
+
else
|
|
58
|
+
opacity *= 0.03;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if (input.kind === 'bar' && input.bars.length) {
|
|
62
|
+
const bar = input.bars[Math.min(input.bars.length - 1, Math.floor((d.x / Math.max(1, surface.width)) * input.bars.length))];
|
|
63
|
+
if (bar) {
|
|
64
|
+
x =
|
|
65
|
+
bar.x +
|
|
66
|
+
clamp(((d.x / Math.max(1, surface.width)) * input.bars.length) % 1) *
|
|
67
|
+
bar.width;
|
|
68
|
+
y = bar.y + clamp(d.y / Math.max(1, surface.height)) * bar.height;
|
|
69
|
+
opacity =
|
|
70
|
+
0.18 + 0.6 * (1 - clamp(d.y / Math.max(1, surface.height)));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (input.kind === 'scatter' && items.length) {
|
|
74
|
+
const point = items[i % items.length];
|
|
75
|
+
if (point) {
|
|
76
|
+
x = point.x;
|
|
77
|
+
y = point.y;
|
|
78
|
+
opacity = i < items.length ? 0.85 : 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
x,
|
|
83
|
+
y,
|
|
84
|
+
size,
|
|
85
|
+
opacity,
|
|
86
|
+
...(angle ? { angle } : {}),
|
|
87
|
+
});
|
|
88
|
+
}));
|
|
89
|
+
},
|
|
90
|
+
draw({ surface, options, prepared, progress: p, dot, reveal, }) {
|
|
91
|
+
if (!geometry(surface.input).length) {
|
|
92
|
+
const q = smooth(p);
|
|
93
|
+
for (const d of surface.source)
|
|
94
|
+
dot({ ...d, opacity: d.opacity * (1 - q) });
|
|
95
|
+
reveal({ opacity: q });
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const front = smooth((p - options.wipeStart) / (1 - options.wipeStart));
|
|
99
|
+
reveal({ opacity: 1, clipStart: front });
|
|
100
|
+
for (let i = 0; i < surface.source.length; i++) {
|
|
101
|
+
const d = surface.source[i], end = prepared[i];
|
|
102
|
+
if (!d || !end)
|
|
103
|
+
continue;
|
|
104
|
+
const nx = d.x / Math.max(1, surface.width), q = smooth((p - nx * 0.35) / Math.max(0.1, options.morphEnd - 0.35)), x = mix(d.x, end.x, q), leave = p >= 1
|
|
105
|
+
? 0
|
|
106
|
+
: front <= 0
|
|
107
|
+
? 1
|
|
108
|
+
: clamp((x - front * surface.width + options.edge) / options.edge);
|
|
109
|
+
// Dashes turn from the idle's slope to the line's.
|
|
110
|
+
const angle = mix(d.angle ?? 0, end.angle ?? 0, q);
|
|
111
|
+
dot({
|
|
112
|
+
x,
|
|
113
|
+
y: mix(d.y, end.y, q),
|
|
114
|
+
size: mix(d.size, end.size, q),
|
|
115
|
+
opacity: mix(d.opacity, end.opacity, q) * leave,
|
|
116
|
+
tone: q > 0.3 ? 'accent' : d.tone,
|
|
117
|
+
...(angle ? { angle } : {}),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
export const morphFactory = /* @__PURE__ */ chartFactory(morphDefinition, {
|
|
123
|
+
morphEnd: [0.55, 0.55, 0.95],
|
|
124
|
+
wipeStart: [0.48, 0.15, 0.6],
|
|
125
|
+
edge: [40, 4, 80],
|
|
126
|
+
});
|
|
127
|
+
// The default Ridge entry retains only its own silhouette. Optional recipes use
|
|
128
|
+
// the same painter/scheduler but do not become hidden default dependencies.
|
|
129
|
+
const ridgeDefinition = /* @__PURE__ */ Object.freeze({
|
|
130
|
+
id: 'dotquilt/chart/ridge',
|
|
131
|
+
family: 'chart',
|
|
132
|
+
phase: 'idle',
|
|
133
|
+
runner: createRunner,
|
|
134
|
+
snapshot: nativeSurface,
|
|
135
|
+
draw: /* @__PURE__ */ chartPainter(),
|
|
136
|
+
});
|
|
137
|
+
export const ridgeFactory = /* @__PURE__ */ chartFactory(ridgeDefinition, {
|
|
138
|
+
amplitude: [0.24, 0, 0.4],
|
|
139
|
+
highlightWidth: [90, 20, 180],
|
|
140
|
+
});
|
|
141
|
+
export const defaultRidge = /* @__PURE__ */ chartBinding(ridgeDefinition, {
|
|
142
|
+
amplitude: 0.24,
|
|
143
|
+
highlightWidth: 90,
|
|
144
|
+
});
|
|
145
|
+
export const defaultMorphWipe = /* @__PURE__ */ chartBinding(morphDefinition, {
|
|
146
|
+
morphEnd: 0.55,
|
|
147
|
+
wipeStart: 0.48,
|
|
148
|
+
edge: 40,
|
|
149
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnimationFactory, AnimationPhase } from '../animations.js';
|
|
2
|
+
/** First-party schemas contain only a few finite numbers, never caller graphs. */
|
|
3
|
+
export declare function chartFactory<P extends AnimationPhase, O extends object>(definition: Readonly<{
|
|
4
|
+
family: 'chart';
|
|
5
|
+
phase: P;
|
|
6
|
+
id: string;
|
|
7
|
+
}>, schema: Record<keyof O, readonly [number, number, number]>): AnimationFactory<'chart', P, O>;
|
|
8
|
+
export declare function chartBinding<P extends AnimationPhase, O extends object>(definition: Readonly<{
|
|
9
|
+
family: 'chart';
|
|
10
|
+
phase: P;
|
|
11
|
+
id: string;
|
|
12
|
+
}>, parsed: O): ReturnType<AnimationFactory<'chart', P, O>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LoaderConfigurationError } from '../types.js';
|
|
2
|
+
import { brand } from './binding.js';
|
|
3
|
+
import { clamp } from './math.js';
|
|
4
|
+
/** First-party schemas contain only a few finite numbers, never caller graphs. */
|
|
5
|
+
export function chartFactory(definition, schema) {
|
|
6
|
+
return (options = {}) => {
|
|
7
|
+
if (!options ||
|
|
8
|
+
Object.getPrototypeOf(options) !== Object.prototype ||
|
|
9
|
+
Reflect.ownKeys(options).some((key) => !Object.hasOwn(schema, key)))
|
|
10
|
+
throw new LoaderConfigurationError('invalid-options', 'Invalid chart options');
|
|
11
|
+
const parsed = { ...options };
|
|
12
|
+
for (const key of Object.keys(schema)) {
|
|
13
|
+
const [fallback, min, max] = schema[key];
|
|
14
|
+
const value = parsed[key] ?? fallback;
|
|
15
|
+
if (!Number.isFinite(value))
|
|
16
|
+
throw new LoaderConfigurationError('invalid-options', 'Invalid chart options');
|
|
17
|
+
parsed[key] = clamp(value, min, max);
|
|
18
|
+
}
|
|
19
|
+
return chartBinding(definition, parsed);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function chartBinding(definition, parsed) {
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
contractVersion: 1,
|
|
25
|
+
family: 'chart',
|
|
26
|
+
phase: definition.phase,
|
|
27
|
+
id: definition.id,
|
|
28
|
+
options: Object.freeze(parsed),
|
|
29
|
+
[brand]: definition,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IdlePaint } from './paint.js';
|
|
2
|
+
export type ChartStyle = [
|
|
3
|
+
opacity: number,
|
|
4
|
+
size: number,
|
|
5
|
+
lift: number,
|
|
6
|
+
accent: number
|
|
7
|
+
];
|
|
8
|
+
export type ChartShader = (options: Readonly<Record<string, number>>, timeMs: number, still: boolean, w: number, h: number, t: number) => readonly [
|
|
9
|
+
crest: (x: number) => number,
|
|
10
|
+
style: (x: number, base: ChartStyle, c: number, n: number, distance: number) => ChartStyle,
|
|
11
|
+
/** How much the crest is a line that dashes follow: 1, or 0 for bars and scatter. */
|
|
12
|
+
line?: number
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* The chart idle (design/SPEC.md): a faint field of marks with a soft ridge
|
|
16
|
+
* line and a shaded area under it. The ridge drifts slowly, the field
|
|
17
|
+
* breathes ±7% every 3.2 s, and a teal glow drifts across every 2.8 s; the
|
|
18
|
+
* glow is drawn as accent marks over the resting ones. Every mark is the same
|
|
19
|
+
* size; the grid starts half a pitch in, like the CSS dot grid. Dashes follow
|
|
20
|
+
* the line: near the crest they turn to its slope, and level off below it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function chartPainter(configure?: ChartShader): IdlePaint;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { chartAppearance } from './chart-appearance.js';
|
|
2
|
+
import { noise, ridgeHeight } from './chart-math.js';
|
|
3
|
+
import { clamp } from './math.js';
|
|
4
|
+
/**
|
|
5
|
+
* The chart idle (design/SPEC.md): a faint field of marks with a soft ridge
|
|
6
|
+
* line and a shaded area under it. The ridge drifts slowly, the field
|
|
7
|
+
* breathes ±7% every 3.2 s, and a teal glow drifts across every 2.8 s; the
|
|
8
|
+
* glow is drawn as accent marks over the resting ones. Every mark is the same
|
|
9
|
+
* size; the grid starts half a pitch in, like the CSS dot grid. Dashes follow
|
|
10
|
+
* the line: near the crest they turn to its slope, and level off below it.
|
|
11
|
+
*/
|
|
12
|
+
export function chartPainter(configure) {
|
|
13
|
+
return ({ surface: rawSurface, options: rawOptions, timeMs, still, dot }) => {
|
|
14
|
+
const surface = rawSurface, options = rawOptions;
|
|
15
|
+
const w = surface.width, full = surface.height, h = Math.max(0, full - 25), t = still ? 0 : timeMs / 1000;
|
|
16
|
+
const { pitch = 9, rows = pitch, scale = 2.2, mark, } = Reflect.get(surface, chartAppearance) ?? {};
|
|
17
|
+
if (Math.ceil(w / pitch) * Math.ceil(full / rows) > 4096)
|
|
18
|
+
throw new TypeError();
|
|
19
|
+
const shader = configure?.(options, timeMs, still, w, h, t);
|
|
20
|
+
const follow = mark === 'dash' ? (shader?.[2] ?? 1) : 0;
|
|
21
|
+
const amplitude = options.amplitude ?? 0.24, sigma = 0.2 * ((options.highlightWidth ?? 90) / 90), breath = still ? 1 : 0.93 + 0.07 * Math.sin((2 * Math.PI * t) / 3.2), glowAt = -0.5 + 2 * sineInOut((t / 2.8) % 1), band = rows * 1.45;
|
|
22
|
+
// Scratch belongs to this invocation: nested paints cannot overwrite it.
|
|
23
|
+
const base = [0, 0, 0, 0];
|
|
24
|
+
let count = 0;
|
|
25
|
+
const crest = (x) => shader ? shader[0](x) : ridgeHeight(x / Math.max(1, w), h, t, amplitude);
|
|
26
|
+
for (let x = pitch / 2; x < w; x += pitch) {
|
|
27
|
+
const u = x / Math.max(1, w), ridge = crest(x),
|
|
28
|
+
// The line's direction here, over one pitch.
|
|
29
|
+
slope = follow
|
|
30
|
+
? Math.atan2(crest(x + pitch / 2) - crest(x - pitch / 2), pitch)
|
|
31
|
+
: 0;
|
|
32
|
+
for (let y = rows / 2; y < full; y += rows) {
|
|
33
|
+
const distance = y - ridge, c = Math.exp(-((distance / band) ** 2)), area = distance > 0 && y < h ? 0.26 : 0, v = Math.max(c, area),
|
|
34
|
+
// Only custom variants read the noise term.
|
|
35
|
+
n = shader ? noise(x + y * 0.7, t) : 0;
|
|
36
|
+
base[0] = (0.05 + (0.63 - 0.05) * v) * breath;
|
|
37
|
+
base[1] = 1;
|
|
38
|
+
base[2] = 0;
|
|
39
|
+
base[3] = 0;
|
|
40
|
+
const value = shader ? shader[1](x, base, c, n, distance) : base;
|
|
41
|
+
// Marks on the crest take its slope; the area below stays level.
|
|
42
|
+
const angle = follow * c * slope;
|
|
43
|
+
if (value[0] >= 0.012 && ++count <= 4096)
|
|
44
|
+
dot({
|
|
45
|
+
x,
|
|
46
|
+
y: y + value[2],
|
|
47
|
+
size: value[1] * scale,
|
|
48
|
+
opacity: clamp(value[0]),
|
|
49
|
+
tone: value[3] ? 'accent' : 'base',
|
|
50
|
+
...(angle ? { angle } : {}),
|
|
51
|
+
});
|
|
52
|
+
if (still || v < 0.02)
|
|
53
|
+
continue;
|
|
54
|
+
const d = (u * 0.8 + (y / Math.max(1, full)) * 0.2 - glowAt) / sigma;
|
|
55
|
+
if (d < -3.2 || d > 3.2)
|
|
56
|
+
continue;
|
|
57
|
+
const glow = Math.exp(-d * d) * 0.9 * v;
|
|
58
|
+
if (glow >= 0.02 && ++count <= 4096)
|
|
59
|
+
dot({
|
|
60
|
+
x,
|
|
61
|
+
y: y + value[2],
|
|
62
|
+
size: value[1] * scale,
|
|
63
|
+
opacity: glow,
|
|
64
|
+
tone: 'accent',
|
|
65
|
+
...(angle ? { angle } : {}),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Sine in-out, the curve the spec gives marks and the idle glow. */
|
|
72
|
+
function sineInOut(p) {
|
|
73
|
+
return 0.5 - 0.5 * Math.cos(Math.PI * p);
|
|
74
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AnimationFactory } from '../animations.js';
|
|
2
|
+
export type Silhouette = 'ridge' | 'scan' | 'terrain' | 'bars' | 'scatter' | 'cycle';
|
|
3
|
+
export declare function chartIdle<O extends object>(kind: Silhouette, schema: Record<keyof O, readonly [number, number, number]>): AnimationFactory<'chart', 'idle', O>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { chartFactory } from './chart-factory.js';
|
|
2
|
+
import { chartPainter } from './chart-field.js';
|
|
3
|
+
import { mix, noise, ridgeHeight, smooth } from './chart-math.js';
|
|
4
|
+
import { clamp } from './math.js';
|
|
5
|
+
import { createRunner } from './runner.js';
|
|
6
|
+
import { nativeSurface } from './surface.js';
|
|
7
|
+
const sequence = ['ridge', 'bars', 'scatter'];
|
|
8
|
+
const crest = (x, w, h, t, kind, a) => {
|
|
9
|
+
const nx = x / w;
|
|
10
|
+
if (kind === 'bars' || kind === 'scatter') {
|
|
11
|
+
const column = Math.floor(nx * 10);
|
|
12
|
+
return (h *
|
|
13
|
+
(0.28 +
|
|
14
|
+
0.25 * noise(column * 71, 0) +
|
|
15
|
+
a * 0.25 * Math.sin(t * 0.8 + column)));
|
|
16
|
+
}
|
|
17
|
+
if (kind === 'scan')
|
|
18
|
+
return (h *
|
|
19
|
+
(0.48 +
|
|
20
|
+
0.12 * Math.sin(nx * 7 - t) +
|
|
21
|
+
a * 0.55 * Math.sin(nx * 3 + t * 0.4)));
|
|
22
|
+
return ridgeHeight(nx, h, t, a);
|
|
23
|
+
};
|
|
24
|
+
function styleValues(out, opacity, accent) {
|
|
25
|
+
// Every mark is the same size (design/SPEC.md); shape comes from opacity.
|
|
26
|
+
out[0] = opacity;
|
|
27
|
+
out[1] = 1;
|
|
28
|
+
out[2] = 0;
|
|
29
|
+
out[3] = Number(accent);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
export function chartIdle(kind, schema) {
|
|
33
|
+
return chartFactory(Object.freeze({
|
|
34
|
+
id: `dotquilt/chart/${kind}`,
|
|
35
|
+
family: 'chart',
|
|
36
|
+
phase: 'idle',
|
|
37
|
+
runner: createRunner,
|
|
38
|
+
snapshot: nativeSurface,
|
|
39
|
+
draw: chartPainter((numeric, timeMs, still, w, h, t) => {
|
|
40
|
+
let a = kind;
|
|
41
|
+
let b = kind, blend = 0;
|
|
42
|
+
if (kind === 'cycle') {
|
|
43
|
+
const hold = numeric.holdMs, step = hold + numeric.blendMs, i = Math.floor(timeMs / step);
|
|
44
|
+
a = sequence[i % 3];
|
|
45
|
+
b = sequence[(i + 1) % 3] ?? 'bars';
|
|
46
|
+
blend = still
|
|
47
|
+
? 0
|
|
48
|
+
: smooth(((timeMs % step) - hold) / numeric.blendMs);
|
|
49
|
+
}
|
|
50
|
+
// Reuse numeric scratch within this frame, never an emitted dot or caller data.
|
|
51
|
+
const firstStyle = [0, 0, 0, 0], secondStyle = [0, 0, 0, 0];
|
|
52
|
+
const amplitude = numeric.amplitude ?? (numeric.sway ?? 0.06) * 4, sx = w + 80 - ((t * 145) % (w + 180));
|
|
53
|
+
const style = (variant, x, base, c, n, distance, out) => {
|
|
54
|
+
if (variant === 'scan') {
|
|
55
|
+
const band = Math.exp(-(((x - sx) / numeric.bandWidth) ** 2)), trail = x > sx ? Math.exp(-(x - sx) / numeric.trail) : 0;
|
|
56
|
+
return styleValues(out, 0.045 +
|
|
57
|
+
c * (0.2 + 0.6 * Math.max(band, trail * 0.65)) +
|
|
58
|
+
band * 0.1, band > 0.3 && c > 0.5);
|
|
59
|
+
}
|
|
60
|
+
if (variant === 'terrain') {
|
|
61
|
+
const land = clamp(0.5 + distance / (h * 0.35));
|
|
62
|
+
return styleValues(out,
|
|
63
|
+
// Relief deepens the shaded land below the crest.
|
|
64
|
+
0.08 +
|
|
65
|
+
0.27 * land * numeric.relief * (0.45 + 0.55 * n) +
|
|
66
|
+
c * 0.45, base[3]);
|
|
67
|
+
}
|
|
68
|
+
if (variant === 'bars') {
|
|
69
|
+
const cw = w / 10, column = clamp(((0.38 - Math.abs((x % cw) / cw - 0.5)) * cw) / 5), fill = clamp(distance / 7 + 0.5) * column;
|
|
70
|
+
return styleValues(out, 0.045 + fill * (0.23 + n * 0.16) + c * column * 0.3, c * column > 0.6);
|
|
71
|
+
}
|
|
72
|
+
if (variant === 'scatter') {
|
|
73
|
+
// Cycle's schema contains timing only; use Scatter's built-in geometry.
|
|
74
|
+
const cw = w / 10, radius = numeric.radius ?? 13, spread = numeric.spread ?? 0.24, dx = (x % cw) - cw / 2, spot = Math.exp(-(dx * dx + distance * distance) / radius ** 2), satellite = Math.exp(-(dx * dx + (distance - h * spread) ** 2) / 85);
|
|
75
|
+
return styleValues(out, 0.04 + spot * 0.75 + satellite * 0.3, spot > 0.65);
|
|
76
|
+
}
|
|
77
|
+
return base;
|
|
78
|
+
};
|
|
79
|
+
// Bars and scatter have no line for dashes to follow.
|
|
80
|
+
const line = (kind) => kind === 'bars' || kind === 'scatter' ? 0 : 1;
|
|
81
|
+
return [
|
|
82
|
+
(x) => mix(crest(x, w, h, t, a, amplitude), crest(x, w, h, t, b, amplitude), blend),
|
|
83
|
+
(x, base, c, n, distance) => {
|
|
84
|
+
const first = style(a, x, base, c, n, distance, firstStyle), second = blend
|
|
85
|
+
? style(b, x, base, c, n, distance, secondStyle)
|
|
86
|
+
: first;
|
|
87
|
+
// The selected schema has populated and bounded each recipe-specific number.
|
|
88
|
+
for (let i = 0; i < 3; i++)
|
|
89
|
+
first[i] = mix(first[i], second[i], blend);
|
|
90
|
+
return first;
|
|
91
|
+
},
|
|
92
|
+
mix(line(a), line(b), blend),
|
|
93
|
+
];
|
|
94
|
+
}),
|
|
95
|
+
}), schema);
|
|
96
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const mix: (a: number, b: number, p: number) => number;
|
|
2
|
+
export declare const smooth: (n: number) => number;
|
|
3
|
+
export declare const noise: (x: number, t: number) => number;
|
|
4
|
+
/**
|
|
5
|
+
* The ridge line from design/SPEC.md's mockup: two slow sines drifting in
|
|
6
|
+
* opposite directions. `nx` is the position across (0–1), `t` seconds.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ridgeHeight: (nx: number, h: number, t: number, a: number) => number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { clamp } from './math.js';
|
|
2
|
+
export const mix = (a, b, p) => a + (b - a) * p;
|
|
3
|
+
export const smooth = (n) => {
|
|
4
|
+
const p = clamp(n);
|
|
5
|
+
return p * p * (3 - 2 * p);
|
|
6
|
+
};
|
|
7
|
+
export const noise = (x, t) => 0.5 +
|
|
8
|
+
0.25 * Math.sin(x * 0.041 + t * 0.46) +
|
|
9
|
+
0.15 * Math.sin(x * 0.017 - t * 0.71) +
|
|
10
|
+
0.1 * Math.cos(x * 0.083 + t * 0.19);
|
|
11
|
+
/**
|
|
12
|
+
* The ridge line from design/SPEC.md's mockup: two slow sines drifting in
|
|
13
|
+
* opposite directions. `nx` is the position across (0–1), `t` seconds.
|
|
14
|
+
*/
|
|
15
|
+
export const ridgeHeight = (nx, h, t, a) => h *
|
|
16
|
+
(0.5 +
|
|
17
|
+
a *
|
|
18
|
+
(0.83 * Math.sin(2 * Math.PI * (1.1 * nx - t / 7.2)) +
|
|
19
|
+
0.29 * Math.sin(2 * Math.PI * (2.9 * nx + t / 4.32))));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Region-owned handoff preparation; never another readiness controller. */
|
|
2
|
+
export declare const chartHandoff: unique symbol;
|
|
3
|
+
/** Whether a dense loader needs its own rich handoff: a provider or a chosen animation. */
|
|
4
|
+
export declare const richHandoff: unique symbol;
|
|
5
|
+
export interface RichParticipant extends HTMLElement {
|
|
6
|
+
readonly [richHandoff]: boolean;
|
|
7
|
+
[chartHandoff](owner: import('../region.js').LoadingRegion, participants?: readonly RichParticipant[]): import('./handoff.js').HandoffSource;
|
|
8
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Region-owned handoff preparation; never another readiness controller. */
|
|
2
|
+
export const chartHandoff = Symbol('dotquilt.chart-handoff');
|
|
3
|
+
/** Whether a dense loader needs its own rich handoff: a provider or a chosen animation. */
|
|
4
|
+
export const richHandoff = Symbol('dotquilt.rich-handoff');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChartInput, ChartVariant, TargetProvider } from '../chart.js';
|
|
2
|
+
/** At most two synchronous attempts; only null permits a second attempt. */
|
|
3
|
+
export declare function chartProjection(provider: TargetProvider | undefined, bounds: Readonly<{
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}>, variant: ChartVariant, report: (code: string) => void): ChartInput;
|
|
7
|
+
export declare const emptyChartSource: readonly never[];
|
|
8
|
+
export declare const emptyChartInput: Readonly<{
|
|
9
|
+
kind: 'scatter';
|
|
10
|
+
points: readonly never[];
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** At most two synchronous attempts; only null permits a second attempt. */
|
|
2
|
+
export function chartProjection(provider, bounds, variant, report) {
|
|
3
|
+
if (!provider)
|
|
4
|
+
return emptyChartInput;
|
|
5
|
+
try {
|
|
6
|
+
let raw = provider(bounds);
|
|
7
|
+
if (raw === null)
|
|
8
|
+
raw = provider(bounds);
|
|
9
|
+
if (raw === null)
|
|
10
|
+
return emptyChartInput;
|
|
11
|
+
if (!raw || typeof raw !== 'object')
|
|
12
|
+
throw new TypeError();
|
|
13
|
+
const value = raw;
|
|
14
|
+
const rects = value.kind === 'rects' || value.kind === 'bar';
|
|
15
|
+
const items = rects
|
|
16
|
+
? 'rects' in value
|
|
17
|
+
? value.rects
|
|
18
|
+
: value.bars
|
|
19
|
+
: 'points' in value
|
|
20
|
+
? value.points
|
|
21
|
+
: undefined;
|
|
22
|
+
if (!Array.isArray(items) || items.length > 2048)
|
|
23
|
+
throw new TypeError();
|
|
24
|
+
const kind = value.kind === 'points'
|
|
25
|
+
? variant === 'scatter'
|
|
26
|
+
? 'scatter'
|
|
27
|
+
: 'line'
|
|
28
|
+
: value.kind === 'rects'
|
|
29
|
+
? 'bar'
|
|
30
|
+
: value.kind;
|
|
31
|
+
if (!['line', 'bar', 'scatter'].includes(kind))
|
|
32
|
+
throw new TypeError();
|
|
33
|
+
const copied = Object.freeze(Array.from(items, (item) => {
|
|
34
|
+
if (!item || typeof item !== 'object')
|
|
35
|
+
throw new TypeError();
|
|
36
|
+
const x = finiteNumber(item.x), y = finiteNumber(item.y);
|
|
37
|
+
if (rects) {
|
|
38
|
+
const width = finiteNumber(item.width), height = finiteNumber(item.height);
|
|
39
|
+
if (width < 0 || height < 0)
|
|
40
|
+
throw new TypeError();
|
|
41
|
+
return Object.freeze({ x, y, width, height });
|
|
42
|
+
}
|
|
43
|
+
return Object.freeze({ x, y });
|
|
44
|
+
}));
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
kind,
|
|
47
|
+
[kind === 'bar' ? 'bars' : 'points']: copied,
|
|
48
|
+
...(kind === 'scatter'
|
|
49
|
+
? {}
|
|
50
|
+
: {
|
|
51
|
+
baseline: finiteNumber('baseline' in value ? value.baseline : bounds.height),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
report('invalid-geometry');
|
|
57
|
+
return emptyChartInput;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export const emptyChartSource = /* @__PURE__ */ Object.freeze([]);
|
|
61
|
+
export const emptyChartInput = /* @__PURE__ */ Object.freeze({
|
|
62
|
+
kind: 'scatter',
|
|
63
|
+
points: emptyChartSource,
|
|
64
|
+
});
|
|
65
|
+
function finiteNumber(n) {
|
|
66
|
+
if (!Number.isFinite(n))
|
|
67
|
+
throw new TypeError();
|
|
68
|
+
return n;
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Fresh content-box bounds without constructing a rich animation surface. */
|
|
2
|
+
export declare function contentBox(host: HTMLElement): {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Cheap summary of what a rich surface depends on: its size, dot pitch and
|
|
8
|
+
* colours. Environment notifications rebuild the surface only when this
|
|
9
|
+
* changes; otherwise they just re-check eligibility.
|
|
10
|
+
*/
|
|
11
|
+
export declare function surfaceEnvironment(host: HTMLElement): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Fresh content-box bounds without constructing a rich animation surface. */
|
|
2
|
+
export function contentBox(host) {
|
|
3
|
+
const css = host.ownerDocument.defaultView?.getComputedStyle(host);
|
|
4
|
+
const dimension = (axis, edges) => Math.max(0, (parseFloat(css?.[axis] ?? '') || 0) -
|
|
5
|
+
(css?.boxSizing === 'border-box'
|
|
6
|
+
? edges.reduce((sum, side) => sum +
|
|
7
|
+
(parseFloat(css.getPropertyValue(`padding-${side}`)) || 0) +
|
|
8
|
+
(parseFloat(css.getPropertyValue(`border-${side}-width`)) || 0), 0)
|
|
9
|
+
: 0));
|
|
10
|
+
return {
|
|
11
|
+
width: dimension('width', ['left', 'right']),
|
|
12
|
+
height: dimension('height', ['top', 'bottom']),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Cheap summary of what a rich surface depends on: its size, dot pitch and
|
|
17
|
+
* colours. Environment notifications rebuild the surface only when this
|
|
18
|
+
* changes; otherwise they just re-check eligibility.
|
|
19
|
+
*/
|
|
20
|
+
export function surfaceEnvironment(host) {
|
|
21
|
+
const win = host.ownerDocument.defaultView;
|
|
22
|
+
const css = win?.getComputedStyle(host);
|
|
23
|
+
const field = host.shadowRoot?.querySelector('.surface');
|
|
24
|
+
const fieldCss = field && win?.getComputedStyle(field);
|
|
25
|
+
return [
|
|
26
|
+
css?.width,
|
|
27
|
+
css?.height,
|
|
28
|
+
css?.color,
|
|
29
|
+
css?.direction,
|
|
30
|
+
css?.getPropertyValue('--dotquilt-color'),
|
|
31
|
+
css?.getPropertyValue('--dotquilt-accent-color'),
|
|
32
|
+
fieldCss?.backgroundSize,
|
|
33
|
+
fieldCss?.gap,
|
|
34
|
+
fieldCss?.color,
|
|
35
|
+
].join('|');
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LoadingRegion } from '../region.js';
|
|
2
|
+
import { type HandoffSource } from './handoff.js';
|
|
3
|
+
/** All source painters share one total, wrapper effect and explicit-target ledger. */
|
|
4
|
+
export declare function coordinatedHandoff(owner: LoadingRegion, sources: readonly HandoffSource[]): HandoffSource;
|