@fxi/zartigl 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/engine.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Transparent ends of a ramp, as fractions of the ramp from each end: `low`
3
+ * fades the lowest values in from transparent, `high` fades the highest out.
4
+ */
5
+ export declare interface AlphaFade {
6
+ low?: number;
7
+ high?: number;
8
+ curve?: AlphaFadeCurve;
9
+ }
10
+
11
+ /** Alpha factor at ramp position `t` in [0, 1]; the stricter end wins. */
12
+ export declare function alphaFadeAt(t: number, fade: AlphaFade): number;
13
+
14
+ /** Shape of an alpha fade inside its zone; the same curves as `logScale`. */
15
+ export declare type AlphaFadeCurve = "linear" | "log" | "exp";
16
+
1
17
  /** Throws unless the index was written for this catalog entry and source. */
2
18
  export declare function assertGeoVideoIndexIdentity(source: CatalogGeoVideoArchiveSource, index: GeoVideoIndex, entry: CatalogEntry): void;
3
19
 
@@ -157,7 +173,10 @@ declare interface CoordArrays {
157
173
  longitude: Float32Array;
158
174
  }
159
175
 
160
- export declare function createColorRampTexture(gl: WebGL2RenderingContext, ramp?: ColorRampInput): WebGLTexture;
176
+ export declare function createColorRampTexture(gl: WebGL2RenderingContext, ramp?: ColorRampInput, options?: {
177
+ reverse?: boolean;
178
+ alphaFade?: AlphaFade;
179
+ }): WebGLTexture;
161
180
 
162
181
  /** The frame source decoding `manifest`: scalar or vector by its encoding. */
163
182
  export declare function createGeoVideoFrameSource(manifest: GeoVideoManifest, options?: {
@@ -527,7 +546,7 @@ export declare interface GeoVideoScalarEncoding {
527
546
  codeMax: number;
528
547
  valueMin: number;
529
548
  valueMax: number;
530
- transfer: "linear";
549
+ transfer: "linear" | "log10-1p9";
531
550
  colorSpace: "bt709";
532
551
  colorRange: "limited" | "full";
533
552
  }
@@ -549,9 +568,11 @@ export declare class GeoVideoScalarSource extends GeoVideoFrameSource<GeoVideoSc
549
568
  }
550
569
 
551
570
  /** Uniforms of GEOVIDEO_SCALAR_GLSL for a scalar-luma encoding. */
552
- export declare function geoVideoScalarUniforms(encoding: Pick<GeoVideoScalarEncoding, "codeMin" | "codeMax" | "valueMin" | "valueMax">): {
571
+ export declare function geoVideoScalarUniforms(encoding: Pick<GeoVideoScalarEncoding, "codeMin" | "codeMax" | "valueMin" | "valueMax"> & Partial<Pick<GeoVideoScalarEncoding, "transfer">>): {
553
572
  codeRange: [number, number];
554
573
  valueRange: [number, number];
574
+ /** `u_scalar_transfer`: 0 linear, 1 "log10-1p9". */
575
+ transfer: number;
555
576
  };
556
577
 
557
578
  declare interface GeoVideoSnapshotLoopTimeline {
@@ -624,7 +645,13 @@ export declare class GeoVideoVectorSource extends GeoVideoFrameSource<GeoVideoVe
624
645
  protected capture(video: HTMLVideoElement, rows: number, mask: Uint8Array): Promise<GeoVideoVectorFrame | null>;
625
646
  }
626
647
 
627
- export declare function getPalettes(): PaletteMeta[];
648
+ /**
649
+ * Palettes to offer, without deprecated ones (still resolvable for old
650
+ * configs) unless `includeDeprecated`.
651
+ */
652
+ export declare function getPalettes(options?: {
653
+ includeDeprecated?: boolean;
654
+ }): PaletteMeta[];
628
655
 
629
656
  /** Color grade of a style `particles.grade`; an object tunes the vibrant one. */
630
657
  export declare function gradeToColorGrade(grade: ParticleGrade | undefined): ColorGrade;
@@ -649,6 +676,7 @@ export declare const isHexColor: (value: unknown) => value is string;
649
676
  /** A partial style: any key left out takes the value below it. */
650
677
  declare interface LayerStyleInput {
651
678
  palette?: string;
679
+ reversePalette?: boolean;
652
680
  renderMode?: StyleRenderMode;
653
681
  particles?: ParticleStyleInput;
654
682
  raster?: Partial<RasterStyle>;
@@ -742,6 +770,17 @@ declare interface RasterStyle {
742
770
  vibrance: number;
743
771
  /** Fixed physical-value domain; null follows the data. */
744
772
  colorDomain: [number, number] | null;
773
+ /**
774
+ * Fraction of the color range, from its low end, over which colors fade in
775
+ * from transparent, [0, 1]: a field that is mostly zero (fires, heat
776
+ * stress) shows only where something happens. Values below the domain are
777
+ * transparent too.
778
+ */
779
+ alphaFadeLow: number;
780
+ /** Fraction of the color range, from its high end, fading out, [0, 1]. */
781
+ alphaFadeHigh: number;
782
+ /** Shape of both fades: "log" rises fast, "exp" stays faint longer. */
783
+ alphaFadeCurve: AlphaFadeCurve;
745
784
  }
746
785
 
747
786
  /**
@@ -758,17 +797,18 @@ export declare function resolveBackdrop(input?: Partial<BackdropStyle>): Backdro
758
797
  */
759
798
  export declare function resolveColorGrade(input?: Partial<ColorGrade>): ColorGrade;
760
799
 
800
+ /**
801
+ * Stops of a ramp, reversed on request, then with `alphaFade` multiplied into
802
+ * the alpha of its ends. The fade follows positions, not colors: on a reversed
803
+ * ramp it still fades the low values.
804
+ */
761
805
  export declare function resolveColorRamp(input: ColorRampInput, options?: {
762
806
  reverse?: boolean;
807
+ alphaFade?: AlphaFade;
763
808
  }): Record<number, string>;
764
809
 
765
810
  export declare type ScalarColorDomain = [number, number];
766
811
 
767
- /**
768
- * Layer style: how a layer looks, with the same keys in the catalog
769
- * `defaults`, the engines and story views. Playback (how time moves) is not
770
- * part of it, so `particles.speed` is always the particle speed.
771
- */
772
812
  declare type StyleRenderMode = "particles" | "raster" | "raster+particles";
773
813
 
774
814
  /** `anchor` minus an ISO 8601 duration, calendar months and years in UTC. */
package/dist/engine.js CHANGED
@@ -1,6 +1,6 @@
1
- import { I as i, J as u, K as m, G as v, T as g, L as x, b as f, M as _, c as p, N as V, O as G, l as C, z as S, E as b, P as R, Q as O, n as L, t as A, A as h, B as I, D as T, m as y, C as D, R as F, S as k, U as B, V as E, p as w, W as M, F as N, X as P, H as z, v as U } from "./geovideo-index-BYdh3auq.js";
2
- import { B as K, C as J, e as Q, b as W, d as X, c as j, g as q, i as Y, a as Z, r as $ } from "./backdrop-DctkJ45Q.js";
3
- var e = `vec3 applyVibrance(vec3 c, float v) {
1
+ import { I as i, J as u, K as m, G as v, T as g, L as f, M as x, b as _, N as p, c as V, O as G, P as C, l as S, z as b, E as R, Q as O, R as A, n as L, t as h, A as F, B as I, D as T, m as y, C as D, S as k, U as B, V as E, W as w, p as M, X as N, F as P, Y as z, H as U, v as H } from "./geovideo-index-BJjE_fgO.js";
2
+ import { B as J, C as Q, e as W, b as X, d as Y, c as j, g as q, i as Z, a as $, r as aa } from "./backdrop-DctkJ45Q.js";
3
+ var a = `vec3 applyVibrance(vec3 c, float v) {
4
4
  float mx = max(c.r, max(c.g, c.b));
5
5
  float mn = min(c.r, min(c.g, c.b));
6
6
  float boost = v * (1.0 - (mx - mn));
@@ -21,12 +21,18 @@ vec3 gradeColor(vec3 c, vec4 g) {
21
21
 
22
22
  c = mix(c, c * c * (3.0 - 2.0 * c), g.y);
23
23
  return clamp(applyVibrance(c, g.z), 0.0, 1.0);
24
- }`, a = `uniform vec2 u_code_range;
25
- uniform vec2 u_value_range;
24
+ }`, e = `uniform vec2 u_code_range;
25
+ uniform vec2 u_value_range;
26
+ uniform float u_scalar_transfer;
27
+
28
+ float geoVideoScalarCode(float r) {
29
+ return clamp((r - u_code_range.x) / (u_code_range.y - u_code_range.x), 0.0, 1.0);
30
+ }
26
31
 
27
32
  float geoVideoScalarValue(float r) {
28
- float code = clamp((r - u_code_range.x) / (u_code_range.y - u_code_range.x), 0.0, 1.0);
29
- return mix(u_value_range.x, u_value_range.y, code);
33
+ float code = geoVideoScalarCode(r);
34
+ float t = mix(code, (pow(10.0, code) - 1.0) / 9.0, u_scalar_transfer);
35
+ return mix(u_value_range.x, u_value_range.y, t);
30
36
  }`, o = `uint pcg(uint v) {
31
37
  uint state = v * 747796405u + 2891336453u;
32
38
  uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
@@ -42,12 +48,12 @@ float random(uvec3 v) {
42
48
  float luma = dot(c, vec3(0.299, 0.587, 0.114));
43
49
  return mix(vec3(luma), c, 1.0 + boost);
44
50
  }`;
45
- const n = r, c = e, t = o, s = a;
51
+ const n = r, c = a, t = o, s = e;
46
52
  export {
47
- K as BACKDROP_OFF,
53
+ J as BACKDROP_OFF,
48
54
  c as COLOR_GRADE_GLSL,
49
- J as COLOR_GRADE_OFF,
50
- Q as COLOR_GRADE_VIBRANT,
55
+ Q as COLOR_GRADE_OFF,
56
+ W as COLOR_GRADE_VIBRANT,
51
57
  s as GEOVIDEO_SCALAR_GLSL,
52
58
  i as GeoVideoArchiveSource,
53
59
  u as GeoVideoFrameSource,
@@ -56,39 +62,40 @@ export {
56
62
  t as RANDOM_GLSL,
57
63
  g as TrailFade,
58
64
  n as VIBRANCE_GLSL,
65
+ f as alphaFadeAt,
59
66
  x as assertGeoVideoIndexIdentity,
60
- W as backdropVec4,
61
- X as colorGradeToGrade,
67
+ X as backdropVec4,
68
+ Y as colorGradeToGrade,
62
69
  j as colorGradeVec4,
63
- f as createColorRampTexture,
64
- _ as createGeoVideoFrameSource,
65
- p as createProgram,
66
- V as createShader,
67
- G as fadeToFrames,
68
- C as fadeToOpacity,
69
- S as formatUnit,
70
- b as geoVideoChunkSources,
71
- R as geoVideoGrid,
72
- O as geoVideoIndexChunks,
70
+ _ as createColorRampTexture,
71
+ p as createGeoVideoFrameSource,
72
+ V as createProgram,
73
+ G as createShader,
74
+ C as fadeToFrames,
75
+ S as fadeToOpacity,
76
+ b as formatUnit,
77
+ R as geoVideoChunkSources,
78
+ O as geoVideoGrid,
79
+ A as geoVideoIndexChunks,
73
80
  L as geoVideoScalarUniforms,
74
- A as geoVideoTimelineValues,
75
- h as getPalettes,
81
+ h as geoVideoTimelineValues,
82
+ F as getPalettes,
76
83
  q as gradeToColorGrade,
77
84
  I as isGeoVideoArchiveSource,
78
- Y as isHexColor,
85
+ Z as isHexColor,
79
86
  T as loadGeoVideoIndex,
80
87
  y as loadGeoVideoManifest,
81
88
  D as nextChunk,
82
- F as nextChunkSpan,
83
- k as pairChunk,
84
- B as pairChunkSpan,
85
- E as parseTimeRange,
86
- Z as resolveBackdrop,
87
- $ as resolveColorGrade,
88
- w as resolveColorRamp,
89
- M as subtractIsoDuration,
90
- N as timeRangeBounds,
91
- P as validateGeoVideoIndex,
92
- z as validateGeoVideoManifest,
93
- U as validateScalarColorDomain
89
+ k as nextChunkSpan,
90
+ B as pairChunk,
91
+ E as pairChunkSpan,
92
+ w as parseTimeRange,
93
+ $ as resolveBackdrop,
94
+ aa as resolveColorGrade,
95
+ M as resolveColorRamp,
96
+ N as subtractIsoDuration,
97
+ P as timeRangeBounds,
98
+ z as validateGeoVideoIndex,
99
+ U as validateGeoVideoManifest,
100
+ H as validateScalarColorDomain
94
101
  };