fancy-ui-vue 0.3.0 → 0.4.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.
Files changed (102) hide show
  1. package/README.md +9 -6
  2. package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +23 -12
  3. package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +10 -1
  4. package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +6 -0
  5. package/dist/components/bg-falling-stars/bg-falling-stars-core.js +24 -2
  6. package/dist/components/bg-stars/StarsBackground.vue.js +1 -1
  7. package/dist/components/bg-stars/StarsBackground.vue2.js +13 -1
  8. package/dist/components/bg-stars/bg-stars-core.d.ts +6 -0
  9. package/dist/components/bg-stars/bg-stars-core.js +21 -1
  10. package/dist/components/book/Book.vue.js +5 -83
  11. package/dist/components/book/Book.vue2.js +82 -1
  12. package/dist/components/box-reveal/BoxReveal.vue.js +5 -47
  13. package/dist/components/box-reveal/BoxReveal.vue2.js +48 -1
  14. package/dist/components/compare/StarField.vue.js +1 -1
  15. package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
  16. package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +14 -5
  17. package/dist/components/flickering-grid/FlickeringGrid.vue.js +19 -1
  18. package/dist/components/flickering-grid/flickering-grid-core.d.ts +6 -0
  19. package/dist/components/flickering-grid/flickering-grid-core.js +30 -1
  20. package/dist/components/flip-words/FlipWords.vue.js +1 -1
  21. package/dist/components/flip-words/FlipWords.vue2.js +14 -7
  22. package/dist/components/hyper-text/HyperText.vue.js +6 -97
  23. package/dist/components/hyper-text/HyperText.vue2.js +101 -0
  24. package/dist/components/letter-pullup/LetterPullup.vue.js +6 -38
  25. package/dist/components/letter-pullup/LetterPullup.vue2.js +40 -0
  26. package/dist/components/logo-cloud/AnimatedLogoCloud.vue.js +1 -1
  27. package/dist/components/magnetic-field/MagnetPuck.vue.d.ts +51 -0
  28. package/dist/components/magnetic-field/MagnetPuck.vue.js +7 -0
  29. package/dist/components/magnetic-field/MagnetPuck.vue2.js +191 -0
  30. package/dist/components/magnetic-field/MagneticField.vue.d.ts +39 -0
  31. package/dist/components/magnetic-field/MagneticField.vue.js +7 -0
  32. package/dist/components/magnetic-field/MagneticField.vue2.js +157 -0
  33. package/dist/components/magnetic-field/MagneticItem.vue.d.ts +28 -0
  34. package/dist/components/magnetic-field/MagneticItem.vue.js +7 -0
  35. package/dist/components/magnetic-field/MagneticItem.vue2.js +72 -0
  36. package/dist/components/magnetic-field/index.d.ts +10 -0
  37. package/dist/components/magnetic-field/magnetic-field-core.d.ts +163 -0
  38. package/dist/components/magnetic-field/magnetic-field-core.js +534 -0
  39. package/dist/components/magnetic-field/magnetic-field-source.d.ts +58 -0
  40. package/dist/components/magnetic-field/magnetic-field-source.js +58 -0
  41. package/dist/components/magnetic-field/types.d.ts +14 -0
  42. package/dist/components/magnetic-field/types.js +5 -0
  43. package/dist/components/matrix-rain/MatrixRain.vue.js +20 -1
  44. package/dist/components/matrix-rain/matrix-rain-core.d.ts +6 -0
  45. package/dist/components/matrix-rain/matrix-rain-core.js +28 -6
  46. package/dist/components/noise-reveal/NoiseReveal.vue.js +7 -0
  47. package/dist/components/noise-reveal/noise-reveal-core.js +23 -7
  48. package/dist/components/pixel-scene/PixelScene.vue.d.ts +60 -0
  49. package/dist/components/pixel-scene/PixelScene.vue.js +184 -0
  50. package/dist/components/pixel-scene/PixelScene.vue2.js +4 -0
  51. package/dist/components/pixel-scene/index.d.ts +4 -0
  52. package/dist/components/pixel-scene/pixel-scene-core.d.ts +256 -0
  53. package/dist/components/pixel-scene/pixel-scene-core.js +878 -0
  54. package/dist/components/pixel-scene/pixel-scene-hdr.d.ts +68 -0
  55. package/dist/components/pixel-scene/pixel-scene-hdr.js +312 -0
  56. package/dist/components/pixel-scene/pixel-scene-scenes.d.ts +31 -0
  57. package/dist/components/pixel-scene/pixel-scene-scenes.js +1074 -0
  58. package/dist/components/ripple/Ripple.vue.js +1 -1
  59. package/dist/components/ripple/Ripple.vue2.js +6 -1
  60. package/dist/components/sparkles/Sparkles.vue.js +10 -1
  61. package/dist/components/sparkles/sparkles-core.d.ts +6 -0
  62. package/dist/components/sparkles/sparkles-core.js +26 -2
  63. package/dist/components/sparkles-text/SparklesText.vue.js +6 -88
  64. package/dist/components/sparkles-text/SparklesText.vue2.js +100 -0
  65. package/dist/components/story-thread/StoryNode.vue.d.ts +11 -0
  66. package/dist/components/story-thread/StoryNode.vue.js +7 -0
  67. package/dist/components/story-thread/StoryNode.vue2.js +23 -0
  68. package/dist/components/story-thread/StoryThread.vue.d.ts +56 -0
  69. package/dist/components/story-thread/StoryThread.vue.js +7 -0
  70. package/dist/components/story-thread/StoryThread.vue2.js +103 -0
  71. package/dist/components/story-thread/index.d.ts +5 -0
  72. package/dist/components/story-thread/story-thread-core.d.ts +119 -0
  73. package/dist/components/story-thread/story-thread-core.js +491 -0
  74. package/dist/components/story-thread/types.d.ts +1 -0
  75. package/dist/components/sun-switch/SunSwitch.vue.d.ts +61 -0
  76. package/dist/components/sun-switch/SunSwitch.vue.js +7 -0
  77. package/dist/components/sun-switch/SunSwitch.vue2.js +559 -0
  78. package/dist/components/sun-switch/index.d.ts +4 -0
  79. package/dist/components/sun-switch/pixel-wave-core.d.ts +82 -0
  80. package/dist/components/sun-switch/pixel-wave-core.js +508 -0
  81. package/dist/components/sun-switch/sun-switch-core.d.ts +251 -0
  82. package/dist/components/sun-switch/sun-switch-core.js +546 -0
  83. package/dist/components/sun-switch/sun-switch-hdr.d.ts +70 -0
  84. package/dist/components/sun-switch/sun-switch-hdr.js +311 -0
  85. package/dist/components/terminal-text/TerminalText.vue.js +1 -1
  86. package/dist/components/terminal-text/TerminalText.vue2.js +36 -4
  87. package/dist/components/text-generate-effect/TextGenerateEffect.vue.js +5 -72
  88. package/dist/components/text-generate-effect/TextGenerateEffect.vue2.js +74 -1
  89. package/dist/components/text-reveal-card/TextRevealCard.vue.js +5 -101
  90. package/dist/components/text-reveal-card/TextRevealCard.vue2.js +98 -1
  91. package/dist/components/text-reveal-card/TextRevealStars.vue.js +1 -1
  92. package/dist/components/text-reveal-card/TextRevealStars.vue2.js +29 -12
  93. package/dist/components/tracing-beam/TracingBeam.vue.d.ts +20 -1
  94. package/dist/components/tracing-beam/TracingBeam.vue.js +5 -164
  95. package/dist/components/tracing-beam/TracingBeam.vue2.js +168 -1
  96. package/dist/index.d.ts +4 -0
  97. package/dist/index.js +361 -338
  98. package/dist/styles.css +731 -89
  99. package/package.json +1 -1
  100. package/dist/components/hyper-text/HyperText.vue3.js +0 -5
  101. package/dist/components/letter-pullup/LetterPullup.vue3.js +0 -5
  102. package/dist/components/sparkles-text/SparklesText.vue3.js +0 -5
@@ -0,0 +1,68 @@
1
+ /**
2
+ * PixelScene HDR layer — framework-free, byte-identical in the Svelte, React
3
+ * and Vue trees (see shared-cores.json).
4
+ *
5
+ * The picture is painted in a 2D canvas, which stops at SDR white. This module
6
+ * lays a WebGPU canvas over it (`rgba16float`, `colorSpace: "srgb"`,
7
+ * `toneMapping: { mode: "extended" }`) and redraws every cell whose glow is
8
+ * above zero as a hard square at `glow ×` its colour, alpha 1: one instanced
9
+ * quad per cell, no blur, no falloff term in the shader. Halos are made of
10
+ * cells by `pixelHalos` in the core.
11
+ *
12
+ * Encoding: the canvas reads its values as extended (gamma-encoded) sRGB, so
13
+ * each channel is sent as `encodeExt(srgbToLinear(c) × glow)`, computed on
14
+ * the CPU. A glow of exactly 1 reproduces the 2D dot.
15
+ *
16
+ * One GPUDevice per page, reference-counted across instances; each instance
17
+ * owns its context, uniform, instance buffer and bind group. Nothing touches
18
+ * `window` or `navigator` at import.
19
+ */
20
+ import { type PixelSceneFrame } from "./pixel-scene-core.js";
21
+ /** SDR white ≈ 203 nits; 1000 nits / 203 ≈ 4.9. Every glow is clamped to it. */
22
+ export declare const PIXEL_SCENE_HDR_PEAK = 4.9;
23
+ /**
24
+ * A lost device usually comes back (GPU process restarted, driver reset, tab
25
+ * woken from a discarded state). The components start the layer again after
26
+ * `PIXEL_SCENE_HDR_RESTART_MS × attempt`, up to `PIXEL_SCENE_HDR_RESTARTS`
27
+ * times per mount, before dropping the HDR canvas for good.
28
+ */
29
+ export declare const PIXEL_SCENE_HDR_RESTARTS = 3;
30
+ export declare const PIXEL_SCENE_HDR_RESTART_MS = 600;
31
+ /**
32
+ * Sync and SSR-safe: WebGPU is exposed and the display reports
33
+ * `(dynamic-range: high)`. Decides whether the HDR canvas is rendered at all.
34
+ */
35
+ export declare function pixelSceneHdrAvailable(): boolean;
36
+ /**
37
+ * Two HDR looks, kept side by side to compare:
38
+ * - `calibrated`: `colorSpace: "srgb"`, each channel sent as
39
+ * `encodeExt(linear(c) × glow)`, so a glow of 1 is the 2D dot exactly and
40
+ * a glow of 4.9 is 4.9 × SDR white;
41
+ * - `vivid`: the prototype's transfer, `colorSpace: "display-p3"`, each channel
42
+ * sent as `linear(c) × g` with `g = 1 + (glow − 1) × VIVID_SCALE`. The canvas
43
+ * reads that as encoded, so lights land far hotter (lamps reach the panel
44
+ * peak) and colours more saturated; the scale brings the calibrated levels
45
+ * back to the prototype's.
46
+ */
47
+ export type PixelSceneHdrLook = "calibrated" | "vivid";
48
+ export declare const PIXEL_SCENE_HDR_LOOKS: readonly PixelSceneHdrLook[];
49
+ /** Maps the calibrated glow levels onto the prototype's (star 3.5 → 2.1, sun 4.9 → 2.8). */
50
+ export declare const VIVID_SCALE = 0.45;
51
+ /** One channel (0–255) at `glow ×` SDR, encoded for the canvas of `look`. */
52
+ export declare function encodeGlowChannel(c8: number, glow: number, look?: PixelSceneHdrLook): number;
53
+ export interface PixelSceneHdr {
54
+ /** Draws the HDR squares for one painted frame. */
55
+ render(frame: PixelSceneFrame): void;
56
+ destroy(): void;
57
+ /** Resolves when the shared device is lost; the 2D picture carries on. */
58
+ readonly lost: Promise<void>;
59
+ /** Instances drawn by the last `render` (diagnostics, tests). */
60
+ readonly count: number;
61
+ }
62
+ /** Next power of two ≥ n, at least the start capacity. */
63
+ export declare function hdrCapacityFor(n: number): number;
64
+ /**
65
+ * Starts the layer on `canvas`. Resolves null when WebGPU, the adapter, the
66
+ * context or extended tone mapping is missing; never throws.
67
+ */
68
+ export declare function startPixelSceneHdr(canvas: HTMLCanvasElement, look?: PixelSceneHdrLook): Promise<PixelSceneHdr | null>;
@@ -0,0 +1,312 @@
1
+ import { srgbToLinear, encodeExt } from "./pixel-scene-core.js";
2
+ const PIXEL_SCENE_HDR_PEAK = 4.9;
3
+ const PIXEL_SCENE_HDR_RESTARTS = 3;
4
+ const PIXEL_SCENE_HDR_RESTART_MS = 600;
5
+ const FPI = 8;
6
+ const START_CAPACITY = 4096;
7
+ const FORMAT = "rgba16float";
8
+ const WGSL = (
9
+ /* wgsl */
10
+ `
11
+ struct Frame { size: vec2f, dot: f32, pad: f32 };
12
+ @group(0) @binding(0) var<uniform> frame: Frame;
13
+ struct In { @location(0) cell: vec4f, @location(1) colour: vec4f };
14
+ struct Out { @builtin(position) pos: vec4f, @location(0) colour: vec4f };
15
+ struct Out2 { @builtin(position) pos: vec4f, @location(0) colour: vec4f, @location(1) p: vec2f, @location(2) cell: vec4f };
16
+ @vertex fn vs(@builtin(vertex_index) vi: u32, inst: In) -> Out2 {
17
+ let corners = array<vec2f, 6>(vec2f(0, 0), vec2f(1, 0), vec2f(0, 1), vec2f(0, 1), vec2f(1, 0), vec2f(1, 1));
18
+ // a soft cell (cell.z > 0, px) widens its quad to carry its halo
19
+ let reach = select(0.0, inst.cell.z * 4.0 + 1.0, inst.cell.z > 0.0);
20
+ let p = inst.cell.xy - vec2f(reach) + corners[vi] * (frame.dot + 2.0 * reach);
21
+ var o: Out2;
22
+ o.pos = vec4f(p.x / frame.size.x * 2.0 - 1.0, 1.0 - p.y / frame.size.y * 2.0, 0.0, 1.0);
23
+ o.colour = inst.colour;
24
+ o.p = p;
25
+ o.cell = inst.cell;
26
+ return o;
27
+ }
28
+ // a hard square at the pre-encoded colour; soft cells (house windows) also get
29
+ // the first prototype's golden halo, exp(-d / radius) around the square
30
+ @fragment fn fs(o: Out2) -> @location(0) vec4f {
31
+ let half = vec2f(frame.dot * 0.5);
32
+ let q = abs(o.p - (o.cell.xy + half)) - half;
33
+ let d = length(max(q, vec2f(0.0)));
34
+ let core = select(0.0, 1.0, d <= 0.001);
35
+ let h = select(0.0, exp(-d / max(o.cell.z, 0.001)) * 0.55, o.cell.z > 0.0);
36
+ let v = core + h * (1.0 - core);
37
+ return vec4f(o.colour.rgb * v, max(core, clamp(h * 0.25, 0.0, 1.0)));
38
+ }
39
+ `
40
+ );
41
+ function pixelSceneHdrAvailable() {
42
+ try {
43
+ if (typeof navigator === "undefined" || typeof window === "undefined") return false;
44
+ if (!navigator.gpu) return false;
45
+ return typeof window.matchMedia === "function" && window.matchMedia("(dynamic-range: high)").matches;
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
50
+ const VIVID_SCALE = 0.45;
51
+ function encodeGlowChannel(c8, glow, look = "calibrated") {
52
+ const g = Math.min(PIXEL_SCENE_HDR_PEAK, Math.max(0, glow));
53
+ if (look === "vivid") return srgbToLinear(c8) * (g > 0 ? 1 + (g - 1) * VIVID_SCALE : 0);
54
+ return encodeExt(srgbToLinear(c8) * g);
55
+ }
56
+ let shared = null;
57
+ const PIPELINES = /* @__PURE__ */ new WeakMap();
58
+ function acquire(gpu) {
59
+ if (!shared) {
60
+ const s = { device: Promise.resolve(null), refs: 0, onLost: /* @__PURE__ */ new Set() };
61
+ s.device = (async () => {
62
+ const adapter = await gpu.requestAdapter();
63
+ if (!adapter) return null;
64
+ const device = await adapter.requestDevice();
65
+ void device.lost.then(() => {
66
+ if (shared === s) shared = null;
67
+ for (const fn of [...s.onLost]) fn();
68
+ s.onLost.clear();
69
+ });
70
+ return device;
71
+ })().catch(() => null);
72
+ shared = s;
73
+ }
74
+ shared.refs++;
75
+ return shared;
76
+ }
77
+ function release(s) {
78
+ s.refs--;
79
+ if (s.refs > 0) return;
80
+ if (shared === s) shared = null;
81
+ s.onLost.clear();
82
+ void s.device.then((d) => d?.destroy());
83
+ }
84
+ function pipelineFor(device) {
85
+ let p = PIPELINES.get(device);
86
+ if (p) return p;
87
+ const module = device.createShaderModule({ code: WGSL });
88
+ p = device.createRenderPipeline({
89
+ layout: "auto",
90
+ vertex: {
91
+ module,
92
+ entryPoint: "vs",
93
+ buffers: [
94
+ {
95
+ arrayStride: FPI * 4,
96
+ stepMode: "instance",
97
+ attributes: [
98
+ { shaderLocation: 0, offset: 0, format: "float32x4" },
99
+ { shaderLocation: 1, offset: 16, format: "float32x4" }
100
+ ]
101
+ }
102
+ ]
103
+ },
104
+ fragment: {
105
+ module,
106
+ entryPoint: "fs",
107
+ targets: [
108
+ {
109
+ format: FORMAT,
110
+ blend: {
111
+ color: { srcFactor: "one", dstFactor: "one", operation: "max" },
112
+ alpha: { srcFactor: "one", dstFactor: "one", operation: "max" }
113
+ }
114
+ }
115
+ ]
116
+ },
117
+ primitive: { topology: "triangle-list" }
118
+ });
119
+ PIPELINES.set(device, p);
120
+ return p;
121
+ }
122
+ function hdrCapacityFor(n) {
123
+ let c = START_CAPACITY;
124
+ while (c < n) c *= 2;
125
+ return c;
126
+ }
127
+ async function startPixelSceneHdr(canvas, look = "calibrated") {
128
+ if (!pixelSceneHdrAvailable()) return null;
129
+ const gpu = navigator.gpu;
130
+ if (!gpu) return null;
131
+ const s = acquire(gpu);
132
+ let held = true;
133
+ const drop = () => {
134
+ if (held) {
135
+ held = false;
136
+ release(s);
137
+ }
138
+ };
139
+ try {
140
+ const device = await s.device;
141
+ if (!device) {
142
+ drop();
143
+ return null;
144
+ }
145
+ const context = canvas.getContext("webgpu");
146
+ if (!context) {
147
+ drop();
148
+ return null;
149
+ }
150
+ context.configure({
151
+ device,
152
+ format: FORMAT,
153
+ alphaMode: "premultiplied",
154
+ colorSpace: look === "vivid" ? "display-p3" : "srgb",
155
+ toneMapping: { mode: "extended" }
156
+ });
157
+ let extended = false;
158
+ try {
159
+ const applied = context.getConfiguration?.();
160
+ extended = applied?.toneMapping?.mode === "extended";
161
+ } catch {
162
+ extended = false;
163
+ }
164
+ if (!extended) {
165
+ try {
166
+ context.unconfigure();
167
+ } catch {
168
+ }
169
+ drop();
170
+ return null;
171
+ }
172
+ const pipeline = pipelineFor(device);
173
+ const uniform = device.createBuffer({
174
+ size: 16,
175
+ usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
176
+ });
177
+ const uniformData = new Float32Array(4);
178
+ const bindGroup = device.createBindGroup({
179
+ layout: pipeline.getBindGroupLayout(0),
180
+ entries: [{ binding: 0, resource: { buffer: uniform } }]
181
+ });
182
+ let capacity = START_CAPACITY;
183
+ let data = new Float32Array(capacity * FPI);
184
+ let instances = device.createBuffer({
185
+ size: data.byteLength,
186
+ usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
187
+ });
188
+ let destroyed = false;
189
+ let count = 0;
190
+ let resolveLost = () => {
191
+ };
192
+ const lost = new Promise((r) => {
193
+ resolveLost = r;
194
+ });
195
+ const onLost = () => {
196
+ destroyed = true;
197
+ resolveLost();
198
+ };
199
+ s.onLost.add(onLost);
200
+ const layer = {
201
+ get lost() {
202
+ return lost;
203
+ },
204
+ get count() {
205
+ return count;
206
+ },
207
+ render(frame) {
208
+ if (destroyed || frame.width <= 0 || frame.height <= 0) return;
209
+ if (canvas.width !== frame.width) canvas.width = frame.width;
210
+ if (canvas.height !== frame.height) canvas.height = frame.height;
211
+ const rendering = frame.pixelated ? "pixelated" : "";
212
+ if (canvas.style && canvas.style.imageRendering !== rendering)
213
+ canvas.style.imageRendering = rendering;
214
+ const { cols, rows, color, glow, hcol, cellCss, dpr } = frame;
215
+ const soft = frame.soft;
216
+ const n = cols * rows;
217
+ let k = 0;
218
+ for (let y = 0; y < rows; y++) {
219
+ const oy = Math.round(y * cellCss * dpr);
220
+ for (let x = 0; x < cols; x++) {
221
+ const i = y * cols + x;
222
+ if (i >= n) break;
223
+ const g = glow[i];
224
+ if (!(g > 0)) continue;
225
+ const h = hcol[i];
226
+ const c = h >= 0 ? h : color[i];
227
+ if (c < 0) continue;
228
+ if (k >= capacity) {
229
+ capacity = hdrCapacityFor(k + 1);
230
+ const next = new Float32Array(capacity * FPI);
231
+ next.set(data);
232
+ data = next;
233
+ instances.destroy();
234
+ instances = device.createBuffer({
235
+ size: data.byteLength,
236
+ usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
237
+ });
238
+ }
239
+ const o = k * FPI;
240
+ data[o] = Math.round(x * cellCss * dpr);
241
+ data[o + 1] = oy;
242
+ data[o + 2] = soft ? soft[i] * cellCss * dpr : 0;
243
+ data[o + 3] = 0;
244
+ data[o + 4] = encodeGlowChannel(c >> 16 & 255, g, look);
245
+ data[o + 5] = encodeGlowChannel(c >> 8 & 255, g, look);
246
+ data[o + 6] = encodeGlowChannel(c & 255, g, look);
247
+ data[o + 7] = 1;
248
+ k++;
249
+ }
250
+ }
251
+ count = k;
252
+ uniformData[0] = frame.width;
253
+ uniformData[1] = frame.height;
254
+ uniformData[2] = frame.size;
255
+ uniformData[3] = 0;
256
+ try {
257
+ device.queue.writeBuffer(uniform, 0, uniformData);
258
+ if (k) device.queue.writeBuffer(instances, 0, data, 0, k * FPI);
259
+ const encoder = device.createCommandEncoder();
260
+ const pass = encoder.beginRenderPass({
261
+ colorAttachments: [
262
+ {
263
+ view: context.getCurrentTexture().createView(),
264
+ clearValue: { r: 0, g: 0, b: 0, a: 0 },
265
+ loadOp: "clear",
266
+ storeOp: "store"
267
+ }
268
+ ]
269
+ });
270
+ if (k) {
271
+ pass.setPipeline(pipeline);
272
+ pass.setBindGroup(0, bindGroup);
273
+ pass.setVertexBuffer(0, instances);
274
+ pass.draw(6, k);
275
+ }
276
+ pass.end();
277
+ device.queue.submit([encoder.finish()]);
278
+ } catch {
279
+ }
280
+ },
281
+ destroy() {
282
+ if (destroyed && !held) return;
283
+ destroyed = true;
284
+ s.onLost.delete(onLost);
285
+ try {
286
+ context.unconfigure();
287
+ } catch {
288
+ }
289
+ try {
290
+ uniform.destroy();
291
+ instances.destroy();
292
+ } catch {
293
+ }
294
+ drop();
295
+ }
296
+ };
297
+ return layer;
298
+ } catch {
299
+ drop();
300
+ return null;
301
+ }
302
+ }
303
+ export {
304
+ PIXEL_SCENE_HDR_PEAK,
305
+ PIXEL_SCENE_HDR_RESTARTS,
306
+ PIXEL_SCENE_HDR_RESTART_MS,
307
+ VIVID_SCALE,
308
+ encodeGlowChannel,
309
+ hdrCapacityFor,
310
+ pixelSceneHdrAvailable,
311
+ startPixelSceneHdr
312
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * PixelScene scenes — framework-free, byte-identical in the Svelte, React and
3
+ * Vue trees (see shared-cores.json).
4
+ *
5
+ * Four painters (alpine, meadow, sea, mountains) with complete day and night
6
+ * palettes, the sprites they use and the drawing helpers. A painter fills the
7
+ * whole grid every frame through `put(x, y, colour, inkAlpha, lit, haloCells)`:
8
+ *
9
+ * - `colour` is what the lens shows;
10
+ * - `inkAlpha` is the resting dot outside the lens (0 = none);
11
+ * - `lit`: false = plain, true = shown in colour outside the lens too (HDR
12
+ * {@link LIT_GLOW}), a number = lit and HDR at that multiple of SDR white;
13
+ * - `haloCells > 0` makes the cell an emitter: `pixelHalos` lights the cells
14
+ * around it as Bayer-dithered hard squares.
15
+ *
16
+ * Layout is by fractions of COLS / ROWS so a scene fits any box. Everything is
17
+ * a square on the grid: no blur, no gradient between cells.
18
+ *
19
+ * Re-entrancy: the drawing target (`G`, `COLS`, `ROWS`, `NIGHT`) is module
20
+ * state. Painting is synchronous and two instances paint one after the other
21
+ * inside their own animation frames, so this is safe — never add an `await`
22
+ * inside a painter. Per-size caches are keyed on ROWS / NIGHT.
23
+ *
24
+ * Compiles under `noUncheckedIndexedAccess`; the `!` assertions are in bounds
25
+ * by construction.
26
+ */
27
+ import { type ScenePainter } from "./pixel-scene-core.js";
28
+ export type PixelSceneName = "alpine" | "meadow" | "sea" | "mountains";
29
+ export declare const PIXEL_SCENES: readonly PixelSceneName[];
30
+ /** The painter for a scene; an unknown name falls back to alpine. */
31
+ export declare function getScenePainter(name: PixelSceneName): ScenePainter;