@fxi/zartigl 0.10.4 → 0.11.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/dist/engine.d.ts CHANGED
@@ -178,7 +178,10 @@ export declare function createColorRampTexture(gl: WebGL2RenderingContext, ramp?
178
178
  alphaFade?: AlphaFade;
179
179
  }): WebGLTexture;
180
180
 
181
- /** The frame source decoding `manifest`: scalar or vector by its encoding. */
181
+ /**
182
+ * The frame source decoding `manifest`: scalar or vector by its encoding.
183
+ * Scalar frames decode through WebCodecs where the browser supports it.
184
+ */
182
185
  export declare function createGeoVideoFrameSource(manifest: GeoVideoManifest, options?: {
183
186
  cacheSize?: number;
184
187
  }): GeoVideoScalarSource | GeoVideoVectorSource;
@@ -366,6 +369,8 @@ export declare class GeoVideoClock {
366
369
  /** Playhead, epoch ms. Assigning it also resets a terminal step's hold. */
367
370
  get ms(): number;
368
371
  set ms(value: number);
372
+ /** Progress through the final sample's held step, 0 elsewhere. */
373
+ get holdFraction(): number;
369
374
  /** Playback held, e.g. while a timeline thumb is held. */
370
375
  held: boolean;
371
376
  private playingValue;
@@ -381,6 +386,49 @@ export declare class GeoVideoClock {
381
386
  advance(dt: number, times: ArrayLike<number>, stepsPerSecond: number, range?: readonly [number, number], loop?: boolean, holdLastStep?: boolean): boolean;
382
387
  }
383
388
 
389
+ /**
390
+ * Scalar-luma GeoVideo decoded with WebCodecs, in decode order: playback
391
+ * feeds the decoder sample after sample instead of seeking a video element,
392
+ * which redecodes from the previous keyframe at every step. A step behind
393
+ * the last one taken, or past a later keyframe, restarts at its keyframe.
394
+ * Frames stay images, decoded on the GPU by GEOVIDEO_SCALAR_GLSL like those
395
+ * of GeoVideoScalarSource, which serves browsers without WebCodecs for the
396
+ * codec.
397
+ */
398
+ export declare class GeoVideoCodecScalarSource extends GeoVideoScalarSource {
399
+ private track;
400
+ private data;
401
+ /** Decode-order sample presenting each video frame. */
402
+ private sampleOfFrame;
403
+ private decoder;
404
+ /** Next sample (decode order) to feed; -1 when the decoder needs a reset. */
405
+ private fed;
406
+ /** Last video frame handed out; later frames can still be reached. */
407
+ private taken;
408
+ /** Decoded frames not taken yet, by video frame. */
409
+ private readonly outputs;
410
+ private progress;
411
+ private failure;
412
+ /** Aborts the media download of the current load on release. */
413
+ private loading;
414
+ /** True once the media decodes through WebCodecs. */
415
+ get usesWebCodecs(): boolean;
416
+ protected loadMedia(): Promise<void>;
417
+ release(): void;
418
+ protected decode(index: number, signal: AbortSignal): Promise<GeoVideoScalarFrame>;
419
+ private config;
420
+ /** Video frame `frame`, owned by the caller. */
421
+ private decodeFrame;
422
+ private dropOutputsBefore;
423
+ private keySample;
424
+ private restart;
425
+ private feed;
426
+ /** Next output, dequeue or error; a timer for decoders without events. */
427
+ private waitProgress;
428
+ private notify;
429
+ private closeDecoder;
430
+ }
431
+
384
432
  /**
385
433
  * GeoVideo frames as textures, decoded ahead of the playhead: vector frames
386
434
  * as float (u, v, validity, 0), scalar frames as the browser decodes them,
@@ -416,6 +464,8 @@ export declare class GeoVideoField {
416
464
  get maxSpeed(): number;
417
465
  /** Resolves once the step at `ms` is uploaded. */
418
466
  prime(ms: number): Promise<void>;
467
+ /** The uploaded texture of the step at `ms`, or null. */
468
+ texture(ms: number): WebGLTexture | null;
419
469
  /** True once the frames interpolated at `ms` are uploaded. */
420
470
  ready(ms: number): boolean;
421
471
  /**
@@ -530,7 +580,8 @@ export declare abstract class GeoVideoFrameSource<TFrame> {
530
580
  private drop;
531
581
  private load;
532
582
  private loadMask;
533
- private loadVideo;
583
+ /** Open the media; the default reads frames by seeking a video element. */
584
+ protected loadMedia(): Promise<void>;
534
585
  /** Seek to a frame and wait until it is presented. */
535
586
  private presentFrame;
536
587
  /**
@@ -539,6 +590,8 @@ export declare abstract class GeoVideoFrameSource<TFrame> {
539
590
  * playback would otherwise buffer far beyond the requested frame.
540
591
  */
541
592
  private primeDecoder;
593
+ /** Media time inside the video frame showing step `index`. */
594
+ protected stepSeconds(index: number): number;
542
595
  /**
543
596
  * Seek and capture one step. `signal` aborts it between steps; a seek
544
597
  * already started completes first, keeping the queue serial.
@@ -667,6 +720,12 @@ export declare class GeoVideoPlayback {
667
720
  constructor(options: GeoVideoPlaybackOptions, repaint: () => void, emit: <K extends keyof GeoVideoPlaybackEvents>(event: K, ...args: Parameters<GeoVideoPlaybackEvents[K]>) => void);
668
721
  load(gl: WebGL2RenderingContext, manifest: GeoVideoManifest): Promise<void>;
669
722
  sample(now: number): readonly [WebGLTexture, WebGLTexture, number] | null;
723
+ /**
724
+ * Through the final step of a chunk followed by a decoded one, the last
725
+ * frame blends into the next chunk's first, as steps do within a chunk:
726
+ * the chunk swap then lands on the frame already shown.
727
+ */
728
+ private handoff;
670
729
  get time(): number;
671
730
  get preloadedMediaUrl(): string | undefined;
672
731
  setStepsPerSecond(value: number): void;
@@ -861,6 +920,23 @@ export declare function getPalettes(options?: {
861
920
  includeDeprecated?: boolean;
862
921
  }): PaletteMeta[];
863
922
 
923
+ /**
924
+ * Glow gain at glow = 1. A thin trail covers about a quarter of its glow
925
+ * texel, so this keeps the halo faint even over dense trails.
926
+ */
927
+ export declare const GLOW_GAIN = 1.2;
928
+
929
+ /**
930
+ * Particle glow, `vec4 glowGather(sampler2D trails, ivec2 texel)` and
931
+ * `vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain)`; GLSL
932
+ * ES 3.0. Gather the trails into a texture GLOW_SCALE× smaller, then add it
933
+ * under them at GLOW_GAIN × the style's glow.
934
+ */
935
+ export declare const GLOW_GLSL: string;
936
+
937
+ /** Trail texels per glow texel along each axis: the chunk's GLOW_SCALE. */
938
+ export declare const GLOW_SCALE = 4;
939
+
864
940
  /** Color grade of a style `particles.grade`; an object tunes the vibrant one. */
865
941
  export declare function gradeToColorGrade(grade: ParticleGrade | undefined): ColorGrade;
866
942
 
package/dist/engine.js CHANGED
@@ -1,116 +1,63 @@
1
- import { I as u, J as v, K as f, L as x, G as g, M as _, N as V, T as p, O as G, P as C, b as S, Q as b, c as y, R as L, S as R, l as O, z as h, D as A, U as T, V as k, n as I, u as D, q as F, A as B, C as E, m as w, B as N, W as P, X as z, Y as M, Z as U, o as H, _ as K, $ as Y, a0 as q, E as J, a1 as Q, a2 as W, H as X, v as Z, a3 as $ } from "./geovideo-index-BqOLqzgA.js";
2
- import { B as ee, C as ae, e as oe, b as ne, d as re, c as ce, g as te, i as se, a as ie, r as le } from "./backdrop-DctkJ45Q.js";
3
- var e = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physical) {
4
- if (physical > 0.5) return texel.xyz;
5
- return vec3(mix(minimum, maximum, texel.rg), texel.a);
6
- }
7
-
8
- vec3 blendVelocity(vec3 a, vec3 b, float fraction) {
9
- if (fraction <= 0.0) return a;
10
- return mix(a, b, fraction);
11
- }`, a = `vec3 applyVibrance(vec3 c, float v) {
12
- float mx = max(c.r, max(c.g, c.b));
13
- float mn = min(c.r, min(c.g, c.b));
14
- float boost = v * (1.0 - (mx - mn));
15
- float luma = dot(c, vec3(0.299, 0.587, 0.114));
16
- return mix(vec3(luma), c, 1.0 + boost);
17
- }
18
-
19
- vec3 gradeColor(vec3 c, vec4 g) {
20
- float m = max(c.r, max(c.g, c.b));
21
- if (m > 0.0) {
22
-
23
-
24
- float e = g.x > 1e-3 ? (1.0 - exp(-g.x * m)) / (1.0 - exp(-g.x)) : m;
25
-
26
- e += g.w * smoothstep(0.5, 1.0, e) * (1.0 - e);
27
- c *= e / m;
28
- }
29
-
30
- c = mix(c, c * c * (3.0 - 2.0 * c), g.y);
31
- return clamp(applyVibrance(c, g.z), 0.0, 1.0);
32
- }`, o = `uniform vec2 u_code_range;
33
- uniform vec2 u_value_range;
34
- uniform float u_scalar_transfer;
35
-
36
- float geoVideoScalarCode(float r) {
37
- return clamp((r - u_code_range.x) / (u_code_range.y - u_code_range.x), 0.0, 1.0);
38
- }
39
-
40
- float geoVideoScalarValue(float r) {
41
- float code = geoVideoScalarCode(r);
42
- float t = mix(code, (pow(10.0, code) - 1.0) / 9.0, u_scalar_transfer);
43
- return mix(u_value_range.x, u_value_range.y, t);
44
- }`, n = `uint pcg(uint v) {
45
- uint state = v * 747796405u + 2891336453u;
46
- uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
47
- return (word >> 22u) ^ word;
48
- }
49
-
50
- float random(uvec3 v) {
51
- return float(pcg(v.x ^ pcg(v.y ^ pcg(v.z))) >> 8u) * (1.0 / 16777216.0);
52
- }`, r = `vec3 applyVibrance(vec3 c, float v) {
53
- float mx = max(c.r, max(c.g, c.b));
54
- float mn = min(c.r, min(c.g, c.b));
55
- float boost = v * (1.0 - (mx - mn));
56
- float luma = dot(c, vec3(0.299, 0.587, 0.114));
57
- return mix(vec3(luma), c, 1.0 + boost);
58
- }`;
59
- const c = r, t = a, s = n, i = o, l = e;
1
+ import { K as o, L as s, G as r, M as i, j as d, N as G, O as c, P as t, Q as l, R as V, m as n, S, U as C, V as L, T as u, W as m, X as O, Y as _, Z as p, b as R, _ as A, c as T, $ as x, a0 as g, n as k, B as F, F as I, a1 as h, a2 as v, p as D, x as E, u as f, C as B, E as b, o as N, D as P, a3 as y, a4 as M, a5 as W, a6 as U, q as H, a7 as K, a8 as Y, a9 as j, H as q, aa as J, ab as Q, J as X, v as Z, ac as $ } from "./engine-BBxJ6x3s.js";
2
+ import { B as z, a as aa, f as ea, b as oa, e as sa, c as ra, g as ia, i as da, r as Ga, d as ca } from "./backdrop-Dceb4d8E.js";
60
3
  export {
61
- ee as BACKDROP_OFF,
62
- t as COLOR_GRADE_GLSL,
63
- ae as COLOR_GRADE_OFF,
64
- oe as COLOR_GRADE_VIBRANT,
65
- i as GEOVIDEO_SCALAR_GLSL,
66
- u as GeoVideoArchiveSource,
67
- v as GeoVideoClock,
68
- f as GeoVideoField,
69
- x as GeoVideoFrameSource,
70
- g as GeoVideoPlayback,
71
- _ as GeoVideoScalarSource,
72
- V as GeoVideoVectorSource,
73
- s as RANDOM_GLSL,
74
- p as TrailFade,
75
- l as VELOCITY_BLEND_GLSL,
76
- c as VIBRANCE_GLSL,
77
- G as alphaFadeAt,
78
- C as assertGeoVideoIndexIdentity,
79
- ne as backdropVec4,
80
- re as colorGradeToGrade,
81
- ce as colorGradeVec4,
82
- S as createColorRampTexture,
83
- b as createGeoVideoFrameSource,
84
- y as createProgram,
85
- L as createShader,
86
- R as fadeToFrames,
87
- O as fadeToOpacity,
88
- h as formatUnit,
89
- A as geoVideoChunkSources,
90
- T as geoVideoGrid,
91
- k as geoVideoIndexChunks,
92
- I as geoVideoScalarUniforms,
93
- D as geoVideoTimelineValues,
94
- F as getPalettes,
95
- te as gradeToColorGrade,
4
+ z as BACKDROP_OFF,
5
+ o as COLOR_GRADE_GLSL,
6
+ aa as COLOR_GRADE_OFF,
7
+ ea as COLOR_GRADE_VIBRANT,
8
+ s as GEOVIDEO_SCALAR_GLSL,
9
+ r as GLOW_GAIN,
10
+ i as GLOW_GLSL,
11
+ d as GLOW_SCALE,
12
+ G as GeoVideoArchiveSource,
13
+ c as GeoVideoClock,
14
+ t as GeoVideoCodecScalarSource,
15
+ l as GeoVideoField,
16
+ V as GeoVideoFrameSource,
17
+ n as GeoVideoPlayback,
18
+ S as GeoVideoScalarSource,
19
+ C as GeoVideoVectorSource,
20
+ L as RANDOM_GLSL,
21
+ u as TrailFade,
22
+ m as VELOCITY_BLEND_GLSL,
23
+ O as VIBRANCE_GLSL,
24
+ _ as alphaFadeAt,
25
+ p as assertGeoVideoIndexIdentity,
26
+ oa as backdropVec4,
27
+ sa as colorGradeToGrade,
28
+ ra as colorGradeVec4,
29
+ R as createColorRampTexture,
30
+ A as createGeoVideoFrameSource,
31
+ T as createProgram,
32
+ x as createShader,
33
+ g as fadeToFrames,
34
+ k as fadeToOpacity,
35
+ F as formatUnit,
36
+ I as geoVideoChunkSources,
37
+ h as geoVideoGrid,
38
+ v as geoVideoIndexChunks,
39
+ D as geoVideoScalarUniforms,
40
+ E as geoVideoTimelineValues,
41
+ f as getPalettes,
42
+ ia as gradeToColorGrade,
96
43
  B as isGeoVideoArchiveSource,
97
- se as isHexColor,
98
- E as loadGeoVideoIndex,
99
- w as loadGeoVideoManifest,
100
- N as nextChunk,
101
- P as nextChunkSpan,
102
- z as pairChunk,
103
- M as pairChunkSpan,
44
+ da as isHexColor,
45
+ b as loadGeoVideoIndex,
46
+ N as loadGeoVideoManifest,
47
+ P as nextChunk,
48
+ y as nextChunkSpan,
49
+ M as pairChunk,
50
+ W as pairChunkSpan,
104
51
  U as parseTimeRange,
105
- ie as resolveBackdrop,
106
- le as resolveColorGrade,
52
+ Ga as resolveBackdrop,
53
+ ca as resolveColorGrade,
107
54
  H as resolveColorRamp,
108
55
  K as stepTime,
109
56
  Y as subtractIsoDuration,
110
- q as timeBracket,
111
- J as timeRangeBounds,
112
- Q as timeStep,
113
- W as validateGeoVideoIndex,
57
+ j as timeBracket,
58
+ q as timeRangeBounds,
59
+ J as timeStep,
60
+ Q as validateGeoVideoIndex,
114
61
  X as validateGeoVideoManifest,
115
62
  Z as validateScalarColorDomain,
116
63
  $ as velocityTexels