@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.
- package/CHANGELOG.md +138 -0
- package/dist/{chunk-P6MGECVO.js → chunk-44EWMJV2.js} +3 -3
- package/dist/{chunk-P6MGECVO.js.map → chunk-44EWMJV2.js.map} +1 -1
- package/dist/{chunk-XXQ6FLCJ.js → chunk-H6N2JSZ3.js} +3 -3
- package/dist/{chunk-XXQ6FLCJ.js.map → chunk-H6N2JSZ3.js.map} +1 -1
- package/dist/{chunk-HAGOFNP5.js → chunk-HPFJUUTF.js} +25 -20
- package/dist/chunk-HPFJUUTF.js.map +1 -0
- package/dist/{chunk-3LPQ2XZG.js → chunk-L5YNZYEG.js} +8 -13
- package/dist/chunk-L5YNZYEG.js.map +1 -0
- package/dist/{chunk-LXJDWBEL.js → chunk-PNNZSYRD.js} +2 -2
- package/dist/{chunk-LXJDWBEL.js.map → chunk-PNNZSYRD.js.map} +1 -1
- package/dist/{chunk-GREL4MVO.js → chunk-QEZL53V6.js} +308 -186
- package/dist/chunk-QEZL53V6.js.map +1 -0
- package/dist/{depSchema-BubKMv-2.d.ts → depSchema-FKQBEfg7.d.ts} +53 -51
- package/dist/{grid-Z_Af3vTl.d.ts → grid-CuxXjaQV.d.ts} +21 -5
- package/dist/index.d.ts +146 -39
- package/dist/index.js +6 -6
- package/dist/insert.js +2 -2
- package/dist/{math-E3rZn4bR.d.ts → math-CeGmGPy8.d.ts} +4 -19
- package/dist/math.d.ts +2 -2
- package/dist/math.js +2 -2
- package/dist/move.d.ts +2 -2
- package/dist/move.js +3 -3
- package/dist/renderer.d.ts +4 -4
- package/dist/renderer.js +6 -6
- package/dist/resize.js +3 -3
- package/package.json +10 -10
- package/dist/chunk-3LPQ2XZG.js.map +0 -1
- package/dist/chunk-GREL4MVO.js.map +0 -1
- package/dist/chunk-HAGOFNP5.js.map +0 -1
|
@@ -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
|
|
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
|
-
|
|
974
|
-
|
|
975
|
-
declare function
|
|
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:
|
|
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:
|
|
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:
|
|
984
|
-
declare function apply(m:
|
|
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):
|
|
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:
|
|
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 `
|
|
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?:
|
|
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():
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
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 →
|
|
1722
|
+
* View → GlMat3 helper for layer `draw` implementations on world-space layers.
|
|
1712
1723
|
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
*
|
|
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):
|
|
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:
|
|
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
|
|
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
|
|
2532
|
-
set(v: View
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2845
|
-
set(v: View
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
22
|
-
units: Record<Unit,
|
|
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
|
|
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 };
|