@weasel-js/core 1.5.1 → 1.5.2

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.
@@ -1,13 +1,13 @@
1
1
  import { GradStop, ColorSpace, TextureHandle, FillStyle, Stroke, ScreenLength } from '@weasel-js/paint';
2
+ import { NodeId, Bounds, View, SelectionApi, ActionDeps, IngestItem, DragSample, Point2 } from '@weasel-js/routing';
2
3
  import { a as Path, P as PoseDescriptor } from './poseDescriptor-PgfVKfa0.js';
3
4
  import { ResolvedRun, TextStyle, TextVerticalAlign } from '@weasel-js/text';
5
+ import { Mat3 } from '@weasel-js/geom';
4
6
  import * as _weasel_js_history from '@weasel-js/history';
5
7
  import { Op, History, SerializedHistory } from '@weasel-js/history';
6
- import { NodeId, Bounds, View as View$1, SelectionApi, ActionDeps, IngestItem, DragSample, Point2 } from '@weasel-js/routing';
7
8
  import { a as SceneAdapter, L as LayoutStrategy, I as InsertAdapter } from './types-BdaK9PcP.js';
8
9
  import { ActiveToolContextValue } from '@weasel-js/routing/react';
9
10
  import { B as BoundsConstraint, P as PointSnapBehavior } from './types-BHGdrOcu.js';
10
- import { Mat3 as Mat3$1 } from '@weasel-js/geom';
11
11
 
12
12
  /**
13
13
  * Axis-aligned rectangle pose with optional rotation. The canonical pose
@@ -627,7 +627,7 @@ interface FitViewToBoundsOptions {
627
627
  * returns `currentView` unchanged and logs a `console.warn`. Callers that
628
628
  * want to no-op silently can detect zero area themselves before calling.
629
629
  */
630
- declare function fitViewToBounds(bounds: Bounds, viewportDims: ViewportDims, currentView: View$1, opts?: FitViewToBoundsOptions): View$1;
630
+ declare function fitViewToBounds(bounds: Bounds, viewportDims: ViewportDims, currentView: View, opts?: FitViewToBoundsOptions): View;
631
631
 
632
632
  /**
633
633
  * Minimal compile/link/lookup wrapper for a GL program. Throws
@@ -970,37 +970,48 @@ declare class GradientRampAtlas {
970
970
  * `apply(m, x, y)` returns `[m * (x, y, 1)] = [m00*x + m01*y + tx,
971
971
  * m10*x + m11*y + ty]`.
972
972
  */
973
- type Mat3 = Float32Array;
974
- declare function identity(): Mat3;
975
- declare function multiply(out: Mat3, m: Mat3): Mat3;
973
+
974
+ type GlMat3 = Float32Array;
975
+ declare function identity(): GlMat3;
976
+ declare function multiply(out: GlMat3, m: GlMat3): GlMat3;
976
977
  /** `m · T(tx, ty)`: composes onto `m`, where `@weasel-js/geom`'s `translate`
977
978
  * constructs a fresh matrix. */
978
- declare function translated(m: Mat3, tx: number, ty: number): Mat3;
979
+ declare function translated(m: GlMat3, tx: number, ty: number): GlMat3;
979
980
  /** `m · S(sx, sy)`: composes onto `m`, where geom's `scale` constructs one. */
980
- declare function scaled(m: Mat3, sx: number, sy: number): Mat3;
981
+ declare function scaled(m: GlMat3, sx: number, sy: number): GlMat3;
982
+ /** This layout read as the kernel's 6-element affine. The two carry the same
983
+ * logical order, so the conversion is a repack and nothing else — it exists
984
+ * so the repack has a name instead of appearing inline at each crossing. */
985
+ declare function toAffine(m: GlMat3): Mat3;
986
+ /** The kernel's affine in this layout. The inverse of {@link toAffine}, and
987
+ * what an `SvgGroupNode.transform` (also a kernel affine) becomes on its way
988
+ * to a `GroupDrawCommand`. */
989
+ declare function fromAffine(a: Mat3): GlMat3;
981
990
  /** Inverse of an affine matrix, or `null` when `@weasel-js/geom`'s `invert`
982
991
  * finds it singular — the same rule, read through this layout. */
983
- declare function invert(m: Mat3): Mat3 | null;
984
- declare function apply(m: Mat3, x: number, y: number): [number, number];
992
+ declare function invert(m: GlMat3): GlMat3 | null;
993
+ declare function apply(m: GlMat3, x: number, y: number): [number, number];
985
994
  /**
986
995
  * Map screen pixel coords (0..width on X, 0..height on Y, top-left origin)
987
996
  * into clip space (-1..1 on X, 1..-1 on Y — note Y flip so screen-down
988
997
  * matches clip-down).
989
998
  */
990
- declare function screenToClip(width: number, height: number): Mat3;
999
+ declare function screenToClip(width: number, height: number): GlMat3;
991
1000
  /**
992
1001
  * Uniform-equivalent scale factor: the square root of the absolute
993
1002
  * determinant of the linear part, i.e. the geometric mean of the two axis
994
1003
  * scales. Rotation-invariant. Under non-uniform scale it is between the two
995
1004
  * axes and exact on neither — the same compromise `meanScale` documents.
996
1005
  */
997
- declare function meanScaleOf(m: Mat3): number;
1006
+ declare function meanScaleOf(m: GlMat3): number;
998
1007
  /** The renderer's 3x3 matrix operations, as one namespace. These work on the
999
1008
  * 9-element `Float32Array` form the GL uniform upload wants — distinct from
1000
- * `@weasel-js/geom`'s 6-element affine `Mat3`, though the logical element
1009
+ * `@weasel-js/geom`'s 6-element affine `GlMat3`, though the logical element
1001
1010
  * order is the same. */
1002
1011
  declare const mat3: {
1003
1012
  identity: typeof identity;
1013
+ toAffine: typeof toAffine;
1014
+ fromAffine: typeof fromAffine;
1004
1015
  multiply: typeof multiply;
1005
1016
  translated: typeof translated;
1006
1017
  scaled: typeof scaled;
@@ -1013,7 +1024,7 @@ declare const mat3: {
1013
1024
  /** Row-major 4×5 color matrix identity. */
1014
1025
  declare const IDENTITY_COLOR_MATRIX: Float32Array<ArrayBuffer>;
1015
1026
  interface GroupFrame {
1016
- transform?: Mat3;
1027
+ transform?: GlMat3;
1017
1028
  alpha?: number;
1018
1029
  /** Row-major 4×5 color matrix (20 floats). Absent leaves the stack unchanged. */
1019
1030
  colorMatrix?: Float32Array | number[];
@@ -1022,7 +1033,7 @@ declare class GroupState {
1022
1033
  private transformStack;
1023
1034
  private alphaStack;
1024
1035
  private colorMatrixStack;
1025
- get transform(): Mat3;
1036
+ get transform(): GlMat3;
1026
1037
  get alpha(): number;
1027
1038
  get colorMatrix(): Float32Array;
1028
1039
  push(frame: GroupFrame): void;
@@ -1180,7 +1191,7 @@ interface PathDrawCommand {
1180
1191
  * is how a container node's transform reaches its descendants. */
1181
1192
  interface GroupDrawCommand {
1182
1193
  kind: 'group';
1183
- transform?: Mat3;
1194
+ transform?: GlMat3;
1184
1195
  alpha?: number;
1185
1196
  /**
1186
1197
  * Optional 4×5 color matrix (row-major, 20 numbers) — `out = M₄ₓ₄ * in + bias`.
@@ -1402,7 +1413,7 @@ declare class DrawBatch {
1402
1413
  * alpha). An affine maps a rect to a parallelogram, so two triangles still
1403
1414
  * cover it and the batch draws at `u_model` identity.
1404
1415
  */
1405
- pushRect(x: number, y: number, w: number, h: number, m: Mat3, r: number, g: number, b: number, a: number): void;
1416
+ pushRect(x: number, y: number, w: number, h: number, m: GlMat3, r: number, g: number, b: number, a: number): void;
1406
1417
  /**
1407
1418
  * Append one image quad: the destination rect `(x, y, w, h)` mapped through
1408
1419
  * `m`, sampling `(u0, v0)`-`(u1, v1)`, every corner carrying `post` as the
@@ -1416,7 +1427,7 @@ declare class DrawBatch {
1416
1427
  * `slot` is the texture unit the corners sample, which `draw.ts` assigns per
1417
1428
  * bitmap within the run.
1418
1429
  */
1419
- pushQuad(x: number, y: number, w: number, h: number, m: Mat3, u0: number, v0: number, u1: number, v1: number, post: number, slot: number): void;
1430
+ pushQuad(x: number, y: number, w: number, h: number, m: GlMat3, u0: number, v0: number, u1: number, v1: number, post: number, slot: number): void;
1420
1431
  /**
1421
1432
  * Append one glyph quad: the box `(x0, y0)`-`(x1, y1)` mapped through `m`,
1422
1433
  * sampling `(u0, v0)`-`(u1, v1)` of the font atlas at `slot`, painted in
@@ -1438,7 +1449,7 @@ declare class DrawBatch {
1438
1449
  * winding, which is what lets a run of mixed rects, image quads and glyphs
1439
1450
  * keep the canonical index pattern.
1440
1451
  */
1441
- pushGlyph(x0: number, y0: number, x1: number, y1: number, baselineY: number, tanItalic: number, m: Mat3, u0: number, v0: number, u1: number, v1: number, r: number, g: number, b: number, a: number, slot: number, mode: number): void;
1452
+ pushGlyph(x0: number, y0: number, x1: number, y1: number, baselineY: number, tanItalic: number, m: GlMat3, u0: number, v0: number, u1: number, v1: number, r: number, g: number, b: number, a: number, slot: number, mode: number): void;
1442
1453
  /**
1443
1454
  * Append one rect filled by a gradient: the corners of `(x, y, w, h)` mapped
1444
1455
  * through `m`, sampling the ramp atlas at `slot`.
@@ -1455,16 +1466,16 @@ declare class DrawBatch {
1455
1466
  * Values outside 0..1 are the sampler's business; the atlas clamps to the
1456
1467
  * edge texel, which is what the gradient shader's own `clamp` did.
1457
1468
  */
1458
- pushGradientRect(x: number, y: number, w: number, h: number, m: Mat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
1469
+ pushGradientRect(x: number, y: number, w: number, h: number, m: GlMat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
1459
1470
  /** `pushMesh` for a mesh filled by a gradient — see `pushGradientRect` for
1460
1471
  * what `uv`, `post` and `mode` carry. */
1461
- pushGradientMesh(mesh: Mesh, m: Mat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
1472
+ pushGradientMesh(mesh: Mesh, m: GlMat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
1462
1473
  /**
1463
1474
  * Append a tessellated mesh through `m`, all vertices carrying `rgba`. The
1464
1475
  * mesh's own indices are rebased onto the staged vertices, which is why the
1465
1476
  * index buffer is uploaded per flush rather than written once.
1466
1477
  */
1467
- pushMesh(mesh: Mesh, m: Mat3, r: number, g: number, b: number, a: number): void;
1478
+ pushMesh(mesh: Mesh, m: GlMat3, r: number, g: number, b: number, a: number): void;
1468
1479
  /** Upload the staged geometry into the next set of buffers and bind its VAO.
1469
1480
  * Returns the index count for the caller's `drawElements`. */
1470
1481
  uploadAndBind(): number;
@@ -1648,7 +1659,7 @@ declare class WeaselRenderer {
1648
1659
  * it — every other command carries its own transform in the stream, so
1649
1660
  * callers with no view concept can keep calling `render(commands)`.
1650
1661
  */
1651
- render(commands: DrawCommand[], viewMatrix?: Mat3): void;
1662
+ render(commands: DrawCommand[], viewMatrix?: GlMat3): void;
1652
1663
  /** Change the curve-flattening tolerance after construction. `undefined`
1653
1664
  * restores the cached `DEFAULT_FLATTEN_TOLERANCE` route. */
1654
1665
  setFlattenTolerance(tolerance: number | undefined): void;
@@ -1708,23 +1719,14 @@ declare function frameRect(sheet: SpriteSheet, index: number): {
1708
1719
  };
1709
1720
 
1710
1721
  /**
1711
- * View → Mat3 helper for layer `draw` implementations on world-space layers.
1722
+ * View → GlMat3 helper for layer `draw` implementations on world-space layers.
1712
1723
  *
1713
- * The kit's main package ships a `View` type at
1714
- * `src/core/viewport/view.ts`; we re-declare a structurally compatible
1715
- * shape here to avoid a runtime cross-package import. Exported as
1716
- * `ViewLike` from the package barrel.
1724
+ * `View` is `@weasel-js/routing`'s, the one every viewport action is typed
1725
+ * in. A type-only import emits no runtime edge, so there is no reason for the
1726
+ * renderer to hold a second structurally-identical declaration and put it in
1727
+ * the emitted `.d.ts` anonymously.
1717
1728
  */
1718
1729
 
1719
- /** A weasel View — `{x, y, scale: {x, y}}`. Local type to avoid a cross-package import. */
1720
- interface View {
1721
- x: number;
1722
- y: number;
1723
- scale: {
1724
- x: number;
1725
- y: number;
1726
- };
1727
- }
1728
1730
  /**
1729
1731
  * Build the world→screen transform matrix for a `View`.
1730
1732
  * Use as the `transform` field of a `kind: 'group'` DrawCommand to wrap
@@ -1735,7 +1737,7 @@ interface View {
1735
1737
  * Column-major layout (matches `mat3.identity()`):
1736
1738
  * `[scale.x, 0, 0, 0, scale.y, 0, -view.x*scale.x, -view.y*scale.y, 1]`.
1737
1739
  */
1738
- declare function viewToMat3(view: View): Mat3;
1740
+ declare function viewToMat3(view: View): GlMat3;
1739
1741
 
1740
1742
  /** A screen-space rectangle, CSS pixels. */
1741
1743
  interface CullRect {
@@ -1760,7 +1762,7 @@ interface CullRect {
1760
1762
  *
1761
1763
  * Returns `cmds` itself when nothing was dropped.
1762
1764
  */
1763
- declare function cullDrawCommands(cmds: DrawCommand[], transform: Mat3, rect: CullRect): DrawCommand[];
1765
+ declare function cullDrawCommands(cmds: DrawCommand[], transform: GlMat3, rect: CullRect): DrawCommand[];
1764
1766
 
1765
1767
  /** Options for stroke tessellation. */
1766
1768
  interface StrokeOptions {
@@ -2517,7 +2519,7 @@ interface ViewAnimationOptions {
2517
2519
  /** Easing curve. Default `easeOutCubic`. */
2518
2520
  easing?: EasingSpec;
2519
2521
  /** Replace the kit's log-scale / fixed-anchor curve. */
2520
- interpolator?: InterpolatorFactory<View$1>;
2522
+ interpolator?: InterpolatorFactory<View>;
2521
2523
  /** Fires when the target is reached. Not called on cancel. */
2522
2524
  onDone?: () => void;
2523
2525
  }
@@ -2528,21 +2530,21 @@ interface AnimateToBoundsOptions extends FitViewToBoundsOptions, ViewAnimationOp
2528
2530
  * channel `view.set` uses, so a camera animation on an uncontrolled canvas
2529
2531
  * costs no React render. */
2530
2532
  interface ViewChannel {
2531
- get(): View$1;
2532
- set(v: View$1): void;
2533
+ get(): View;
2534
+ set(v: View): void;
2533
2535
  }
2534
2536
  /** The camera animation surface. One animation at a time. */
2535
2537
  interface ViewAnimationApi {
2536
2538
  /** Glide from the live view to `to`. A thunk receives the pending target when
2537
2539
  * one is in flight, so successive discrete steps compound. */
2538
- animate(to: View$1 | ((base: View$1) => View$1), opts?: ViewAnimationOptions): void;
2540
+ animate(to: View | ((base: View) => View), opts?: ViewAnimationOptions): void;
2539
2541
  /** `fitViewToBounds` composed with `animate`. */
2540
2542
  animateToBounds(bounds: Bounds, dims: ViewportDims, opts?: AnimateToBoundsOptions): void;
2541
2543
  /** Cancel. The view stays where it is — no jump to the target. */
2542
2544
  stop(): void;
2543
2545
  isAnimating(): boolean;
2544
2546
  /** Where the in-flight animation is heading, or null when none is. */
2545
- target(): View$1 | null;
2547
+ target(): View | null;
2546
2548
  /** Cancel unless the write that prompted this came from the runner's own
2547
2549
  * per-frame write. Feed it from every channel that can move the camera. */
2548
2550
  stopIfExternal(): void;
@@ -2836,19 +2838,19 @@ interface GeometryProjection {
2836
2838
  id?: string;
2837
2839
  data: unknown;
2838
2840
  pose: unknown;
2839
- }, m: Mat3$1): unknown | null;
2841
+ }, m: Mat3): unknown | null;
2840
2842
  }
2841
2843
 
2842
2844
  /** Minimal view API the action layer consumes. */
2843
2845
  interface ViewApi {
2844
- get(): View$1;
2845
- set(v: View$1): void;
2846
+ get(): View;
2847
+ set(v: View): void;
2846
2848
  /** Optional recenter callback. When wired, `viewportZoomAction`'s `reset`
2847
2849
  * branch (Cmd-0) calls this instead of resetting to identity — letting
2848
2850
  * consumers re-fit the page (or other reference bounds) into the workspace.
2849
2851
  * Return the target `View` to let the action animate there; return nothing
2850
2852
  * to keep dispatching the view yourself. */
2851
- recenter?(): View$1 | void;
2853
+ recenter?(): View | void;
2852
2854
  /** Optional canvas-local host dimensions (CSS px). When wired,
2853
2855
  * `viewportZoomAction`'s keyboard branches (Cmd+= / Cmd+-) anchor at the
2854
2856
  * host center instead of the top-left origin. Null when the host isn't
@@ -2859,11 +2861,11 @@ interface ViewApi {
2859
2861
  } | null;
2860
2862
  /** Optional camera animation. `<SceneCanvas>` wires these three; a consumer
2861
2863
  * publishing their own `view` dep need not, and actions fall back to `set`. */
2862
- animate?(to: View$1, opts?: ViewAnimationOptions): void;
2864
+ animate?(to: View, opts?: ViewAnimationOptions): void;
2863
2865
  stopAnimation?(): void;
2864
2866
  /** Where an in-flight camera animation is heading, or null. Compute the next
2865
2867
  * discrete step from this so repeated presses compound. */
2866
- animationTarget?(): View$1 | null;
2868
+ animationTarget?(): View | null;
2867
2869
  /** Optional momentum decay. `<SceneCanvas>` wires this from `useDecayLoop`;
2868
2870
  * a consumer publishing their own `view` dep need not, and `viewport.dragPan`
2869
2871
  * simply lands the pan without coasting. */
@@ -3476,4 +3478,4 @@ declare module '@weasel-js/routing' {
3476
3478
  }
3477
3479
  }
3478
3480
 
3479
- export { type PoseOverrides as $, type PoseComposition as A, type SliceDep as B, type CullRect as C, type DrawCommand as D, type Effect as E, type VertexColorChannel as F, type GroupDrawCommand as G, type InsertExtras as H, IDENTITY_COLOR_MATRIX as I, type SerializedScene as J, type GeometryProjection as K, type ContentHandlerEntry as L, type Mesh as M, type Node as N, type SvgIngestOptions as O, type PathDrawCommand as P, type PanBounds as Q, type RenderTarget as R, SPRITE_STRIDE as S, type TextDrawCommand as T, type Animator as U, type View as V, WeaselRenderer as W, ColorOverrideRegistry as X, type UseSceneOptions as Y, type SceneRegistry as Z, type RegisteredOp as _, type ImageDrawCommand as a, type StaggerPerItem as a$, type DerivedDep as a0, type ViewportDims as a1, ShaderProgram as a2, type BooleansAdapter as a3, type UseAnimatorOptions as a4, type SpringPresetName as a5, type EasingSpec as a6, type AnimationHandle as a7, type SampledTrack as a8, type AddLayerSpec as a9, type InterpolatorFactory as aA, type Keyframe as aB, type LassoSelectDep as aC, type LayerRecord as aD, type LayoutDep as aE, type LeafNode as aF, type LoopFactory as aG, type LoopOptions as aH, type NestedTimeline as aI, type NodeAtPointDep as aJ, type PhysicsHandle as aK, type PhysicsOptions as aL, type PoseAdapter as aM, type PoseClosure as aN, type PoseOverride as aO, RECT_POSE_COMPOSITION as aP, RIGID_POSE_COMPOSITION as aQ, type ResizePolicy as aR, SPRING_PRESETS as aS, type SerializedNode as aT, type SnapDep as aU, type SpringOptions as aV, type SpringPreset as aW, type StaggerBuilder as aX, type StaggerDelay as aY, type StaggerFactory as aZ, type StaggerOptions as a_, type AddNodeSpec as aa, type AnimateToBoundsOptions as ab, type AreaSelectDep as ac, type BezierEasing as ad, type BooleanOp as ae, type BooleanOpResult as af, type ClipboardDep as ag, type ClipboardIngestCtx as ah, type ColorOverride as ai, type ColorOverrideFn as aj, type ContainerNode as ak, type DecayLoopConfig as al, type DecayOptions as am, EASINGS as an, type EasingFn as ao, type EasingName as ap, type EditAnchorsDep as aq, type EventBooking as ar, type EventBookingHandle as as, type EventTrack as at, type FitViewToBoundsOptions as au, IDENTITY_POSE_COMPOSITION as av, type IngestCtx as aw, type IngestionDep as ax, type InsertDep as ay, type Interpolate as az, type ImageMinification as b, registerContentHandler as b$, type StaggerSpringPoseOptions as b0, type StaggerTweenOptions as b1, type SvgUnpacker as b2, type SystemLayerRecord as b3, type SystemLayerSpec as b4, type TextEditDep as b5, type TimelineClock as b6, type TimelineEvent as b7, type TimelineHandle as b8, type TimelineOptions as b9, easeInOutBounce as bA, easeInOutCirc as bB, easeInOutCubic as bC, easeInOutElastic as bD, easeInOutExpo as bE, easeInOutQuad as bF, easeInOutQuart as bG, easeInOutQuint as bH, easeInOutSine as bI, easeInQuad as bJ, easeInQuart as bK, easeInQuint as bL, easeInSine as bM, easeOut as bN, easeOutBack as bO, easeOutBounce as bP, easeOutCirc as bQ, easeOutCubic as bR, easeOutElastic as bS, easeOutExpo as bT, easeOutQuad as bU, easeOutQuart as bV, easeOutQuint as bW, easeOutSine as bX, fitViewToBounds as bY, linear as bZ, rebaseLocalPose as b_, type TimelineTrack as ba, type Track as bb, type TweenLoopOptions as bc, type TweenOptions as bd, type UserLayerRecord as be, VIEW_ANIMATION_KEY as bf, type ViewAnimationApi as bg, type ViewApi as bh, type ViewChannel as bi, applyBooleanOp as bj, asNodeId as bk, composeRectPose as bl, composeRigidPose as bm, composeWorldPose as bn, cubicBezierEasing as bo, decomposeRectPose as bp, decomposeRigidPose as bq, easeIn as br, easeInBack as bs, easeInBounce as bt, easeInCirc as bu, easeInCubic as bv, easeInElastic as bw, easeInExpo as bx, easeInOut as by, easeInOutBack as bz, type Mat3 as c, resolveEasing as c0, resolveStrokeWidth as c1, translateRectPose as c2, useDecayLoop as c3, useViewAnimation as c4, useViewAnimationOn as c5, worldPoseLookup as c6, ShaderCompileError as d, type ShaderDrawCommand as e, type ShaderProgramHandle as f, type ShaderUniform as g, type SolidPaint as h, type SpriteSheet as i, type SpritesDrawCommand as j, type StrokeOptions as k, type WeaselRendererOptions as l, blur as m, buildGradientRamp as n, cullDrawCommands as o, frameRect as p, mat3 as q, registerEffect as r, registerProgram as s, tessellateStroke as t, vignette as u, viewToMat3 as v, type Scene as w, type RectPose as x, type InertiaConfig as y, type ViewAnimationOptions as z };
3481
+ export { type DerivedDep as $, type SliceDep as A, type VertexColorChannel as B, type CullRect as C, type DrawCommand as D, type Effect as E, type InsertExtras as F, type GlMat3 as G, type SerializedScene as H, IDENTITY_COLOR_MATRIX as I, type GeometryProjection as J, type ContentHandlerEntry as K, type SvgIngestOptions as L, type Mesh as M, type Node as N, type PanBounds as O, type PathDrawCommand as P, type Animator as Q, type RenderTarget as R, SPRITE_STRIDE as S, type TextDrawCommand as T, ColorOverrideRegistry as U, type ViewAnimationOptions as V, WeaselRenderer as W, type UseSceneOptions as X, type SceneRegistry as Y, type RegisteredOp as Z, type PoseOverrides as _, type GroupDrawCommand as a, type StaggerSpringPoseOptions as a$, type ViewportDims as a0, ShaderProgram as a1, type BooleansAdapter as a2, type UseAnimatorOptions as a3, type SpringPresetName as a4, type EasingSpec as a5, type AnimationHandle as a6, type SampledTrack as a7, type AddLayerSpec as a8, type AddNodeSpec as a9, type Keyframe as aA, type LassoSelectDep as aB, type LayerRecord as aC, type LayoutDep as aD, type LeafNode as aE, type LoopFactory as aF, type LoopOptions as aG, type NestedTimeline as aH, type NodeAtPointDep as aI, type PhysicsHandle as aJ, type PhysicsOptions as aK, type PoseAdapter as aL, type PoseClosure as aM, type PoseOverride as aN, RECT_POSE_COMPOSITION as aO, RIGID_POSE_COMPOSITION as aP, type ResizePolicy as aQ, SPRING_PRESETS as aR, type SerializedNode as aS, type SnapDep as aT, type SpringOptions as aU, type SpringPreset as aV, type StaggerBuilder as aW, type StaggerDelay as aX, type StaggerFactory as aY, type StaggerOptions as aZ, type StaggerPerItem as a_, type AnimateToBoundsOptions as aa, type AreaSelectDep as ab, type BezierEasing as ac, type BooleanOp as ad, type BooleanOpResult as ae, type ClipboardDep as af, type ClipboardIngestCtx as ag, type ColorOverride as ah, type ColorOverrideFn as ai, type ContainerNode as aj, type DecayLoopConfig as ak, type DecayOptions as al, EASINGS as am, type EasingFn as an, type EasingName as ao, type EditAnchorsDep as ap, type EventBooking as aq, type EventBookingHandle as ar, type EventTrack as as, type FitViewToBoundsOptions as at, IDENTITY_POSE_COMPOSITION as au, type IngestCtx as av, type IngestionDep as aw, type InsertDep as ax, type Interpolate as ay, type InterpolatorFactory as az, type ImageDrawCommand as b, resolveEasing as b$, type StaggerTweenOptions as b0, type SvgUnpacker as b1, type SystemLayerRecord as b2, type SystemLayerSpec as b3, type TextEditDep as b4, type TimelineClock as b5, type TimelineEvent as b6, type TimelineHandle as b7, type TimelineOptions as b8, type TimelineTrack as b9, easeInOutCirc as bA, easeInOutCubic as bB, easeInOutElastic as bC, easeInOutExpo as bD, easeInOutQuad as bE, easeInOutQuart as bF, easeInOutQuint as bG, easeInOutSine as bH, easeInQuad as bI, easeInQuart as bJ, easeInQuint as bK, easeInSine as bL, easeOut as bM, easeOutBack as bN, easeOutBounce as bO, easeOutCirc as bP, easeOutCubic as bQ, easeOutElastic as bR, easeOutExpo as bS, easeOutQuad as bT, easeOutQuart as bU, easeOutQuint as bV, easeOutSine as bW, fitViewToBounds as bX, linear as bY, rebaseLocalPose as bZ, registerContentHandler as b_, type Track as ba, type TweenLoopOptions as bb, type TweenOptions as bc, type UserLayerRecord as bd, VIEW_ANIMATION_KEY as be, type ViewAnimationApi as bf, type ViewApi as bg, type ViewChannel as bh, applyBooleanOp as bi, asNodeId as bj, composeRectPose as bk, composeRigidPose as bl, composeWorldPose as bm, cubicBezierEasing as bn, decomposeRectPose as bo, decomposeRigidPose as bp, easeIn as bq, easeInBack as br, easeInBounce as bs, easeInCirc as bt, easeInCubic as bu, easeInElastic as bv, easeInExpo as bw, easeInOut as bx, easeInOutBack as by, easeInOutBounce as bz, type ImageMinification as c, resolveStrokeWidth as c0, translateRectPose as c1, useDecayLoop as c2, useViewAnimation as c3, useViewAnimationOn as c4, worldPoseLookup as c5, ShaderCompileError as d, type ShaderDrawCommand as e, type ShaderProgramHandle as f, type ShaderUniform as g, type SolidPaint as h, type SpriteSheet as i, type SpritesDrawCommand as j, type StrokeOptions as k, type WeaselRendererOptions as l, blur as m, buildGradientRamp as n, cullDrawCommands as o, frameRect as p, mat3 as q, registerEffect as r, registerProgram as s, tessellateStroke as t, vignette as u, viewToMat3 as v, type Scene as w, type RectPose as x, type InertiaConfig as y, type PoseComposition as z };
@@ -10,17 +10,33 @@ import { DebugSink } from '@weasel-js/routing';
10
10
  * as base units) or a `{ value, unit }` tag that's resolved against a
11
11
  * `UnitSystem` at the API boundary. Internals never see units.
12
12
  *
13
- * Linear factors only. No per-axis units. No mixed-unit arithmetic.
13
+ * An entry is affine — `base = value * factor + offset` — so a scale that
14
+ * puts zero somewhere else (degC against K) is expressible. No per-axis
15
+ * units. No mixed-unit arithmetic.
14
16
  */
15
17
  /** A unit name (e.g. `'in'`, `'ft'`, `'mm'`). Looked up in a `UnitSystem`. */
16
18
  type Unit = string;
17
- /** Conversion table mapping unit names to factors against a base unit. */
19
+ /** What one unit is worth in base units: `base = value * factor + offset`. */
20
+ interface UnitScale {
21
+ factor: number;
22
+ /** Where this unit puts zero, in base units. Absent is 0 — a pure scale. */
23
+ offset?: number;
24
+ }
25
+ /** One unit's conversion. A bare number is the `{ factor }` shorthand. */
26
+ type UnitEntry = number | UnitScale;
27
+ /** Conversion table mapping unit names to their scale against a base unit. */
18
28
  interface UnitSystem {
19
29
  /** Name of the base unit, e.g. 'in'. All conversions resolve to this. */
20
30
  base: Unit;
21
- /** Factor to multiply a value in `unit` by to get base units. base unit's factor is 1. */
22
- units: Record<Unit, number>;
31
+ /** How to reach base units from each unit. The base unit's entry is 1. */
32
+ units: Record<Unit, UnitEntry>;
23
33
  }
34
+ /**
35
+ * One unit's scale, with the bare-number shorthand widened and the offset
36
+ * defaulted — what every conversion in the kit reads. Throws if the system
37
+ * does not carry the unit.
38
+ */
39
+ declare function unitScale(unitSystem: UnitSystem, unit: Unit): Required<UnitScale>;
24
40
  /** Value at a unit-aware API boundary: bare number (in base units) or `{ value, unit }` tag. */
25
41
  type UnitValue = number | {
26
42
  value: number;
@@ -139,4 +155,4 @@ declare function pointToGridCell(point: {
139
155
  row: number;
140
156
  };
141
157
 
142
- export { ANGLE_RADIANS as A, IMPERIAL_INCHES as I, METRIC_MM as M, type OriginProjection as O, PIXELS as P, RECT_ORIGIN_PROJECTION as R, type UseMoveOptions as U, type UnitValue as a, type UnitSystem as b, type Unit as c, formatUnit as f, gridSnapStrategy as g, pointToGridCell as p, resolveUnit as r };
158
+ export { ANGLE_RADIANS as A, IMPERIAL_INCHES as I, METRIC_MM as M, type OriginProjection as O, PIXELS as P, RECT_ORIGIN_PROJECTION as R, type UseMoveOptions as U, type UnitValue as a, type UnitSystem as b, type UnitEntry as c, type Unit as d, type UnitScale as e, formatUnit as f, gridSnapStrategy as g, pointToGridCell as p, resolveUnit as r, unitScale as u };