@glissade/scene 0.10.1-pre.0 → 0.10.1-pre.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 (2) hide show
  1. package/dist/index.js +35 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as quantize, B as applyToPoint, C as validateSketch, D as breakLines, E as MEASURE_QUANTUM_PX, F as createDisplayListBuilder, H as invert, I as filtersToCanvasFilter, L as glow, M as segmentWords, N as setDefaultMeasurer, O as estimatingMeasurer, P as FilterValidationError, R as validateFilters, S as validateHachure, T as resolveAnchor, U as matEquals, V as fromTRS, W as multiply, _ as flatten, a as Circle, b as roughen, c as Path, d as Video, f as pathFromSegs, g as arcLength, h as SketchValidationError, i as setLayoutEngine, j as segmentGraphemes, k as fallbackMeasurer, l as Rect, m as roundedRectSegs, n as getLayoutEngine, o as Group, p as revealSchedule, r as requireLayoutEngine, s as ImageNode, t as LayoutEngineMissingError, u as Text, v as hachureLines, w as Node, x as sketchStrokes, y as resolveSketch, z as IDENTITY } from "./layoutEngine.js";
2
- import { bindTimeline, buildFontRegistry, compileTimeline, createPlayhead, emitDevWarning, evaluateAt, key, parseCmap, signal, stagger, track, validateFonts, vec2Signal } from "@glissade/core";
2
+ import { bindTimeline, buildFontRegistry, compileTimeline, createPlayhead, emitDevWarning, evaluateAt, key, lerpColor, parseCmap, signal, stagger, track, validateFonts, vec2Signal } from "@glissade/core";
3
3
  //#region src/highlight.ts
4
4
  /**
5
5
  * Marker-style text highlight: per-line rounded rects behind a Text node's
@@ -958,6 +958,38 @@ var ShaderEffect = class extends Group {
958
958
  };
959
959
  }
960
960
  };
961
+ const smoothstep = (u) => u * u * (3 - 2 * u);
962
+ const GAUSS_K = 2.4;
963
+ const GAUSS_NORM = 1 - Math.exp(-5.76 / 2);
964
+ const gaussianEase = (u) => (1 - Math.exp(-((u * GAUSS_K) ** 2) / 2)) / GAUSS_NORM;
965
+ /**
966
+ * Densify `stops` into a `smooth`/`gaussian` oklab ramp. The output spans the
967
+ * input's offset range with GRADIENT_RAMP_STEPS uniformly-spaced stops; each
968
+ * point eases its blend within the authored segment it falls in. Returns the
969
+ * input unchanged for `linear` (or a single stop) — the canvas-native path.
970
+ */
971
+ function densifyStops(stops, mode) {
972
+ if (mode === "linear" || stops.length < 2) return stops;
973
+ const ease = mode === "gaussian" ? gaussianEase : smoothstep;
974
+ const o0 = stops[0].offset;
975
+ const span = stops[stops.length - 1].offset - o0;
976
+ if (span <= 0) return stops;
977
+ const out = [];
978
+ let seg = 0;
979
+ for (let i = 0; i < 64; i++) {
980
+ const offset = o0 + span * (i / 63);
981
+ while (seg < stops.length - 2 && offset > stops[seg + 1].offset) seg++;
982
+ const a = stops[seg];
983
+ const b = stops[seg + 1];
984
+ const w = b.offset - a.offset;
985
+ const u = w > 0 ? Math.min(1, Math.max(0, (offset - a.offset) / w)) : 0;
986
+ out.push({
987
+ offset,
988
+ color: lerpColor(a.color, b.color, ease(u))
989
+ });
990
+ }
991
+ return out;
992
+ }
961
993
  //#endregion
962
994
  //#region src/raster2d.ts
963
995
  /**
@@ -982,7 +1014,8 @@ function resolveFill(ctx, paint, bounds) {
982
1014
  const ty = paint.to ? paint.to[1] : bounds ? bounds.maxY : 0;
983
1015
  g = ctx.createLinearGradient(fx, fy, tx, ty);
984
1016
  }
985
- for (const s of paint.stops) g.addColorStop(s.offset, s.color);
1017
+ const stops = paint.interpolation ? densifyStops(paint.stops, paint.interpolation) : paint.stops;
1018
+ for (const s of stops) g.addColorStop(s.offset, s.color);
986
1019
  return g;
987
1020
  }
988
1021
  function fontString(font) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.10.1-pre.0",
3
+ "version": "0.10.1-pre.1",
4
4
  "description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "yoga-layout": "^3.2.1",
23
- "@glissade/core": "0.10.1-pre.0"
23
+ "@glissade/core": "0.10.1-pre.1"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",