@weasel-js/labkit 0.7.1 → 0.8.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 orochi235
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -172,51 +172,6 @@ interface History {
172
172
  resumeJournal(journal: Journal): void;
173
173
  }
174
174
 
175
- /**
176
- * Pose composition for hierarchical scene graphs.
177
- *
178
- * As of the nesting change, `getPose(id)` on adapters returns the
179
- * **local** pose — relative to the object's direct parent. Anything in the
180
- * kit that needs to draw, hit-test, snap, or otherwise reason about world
181
- * coordinates routes through `composeWorldPose`, which walks the parent
182
- * chain and folds local poses together via a consumer-supplied `compose`.
183
- *
184
- * Pose shape is generic, so the compose strategy is too. For the common
185
- * `{x, y, width, height}` axis-aligned rect, use `composeRectPose` —
186
- * translation only, child dimensions preserved. Custom pose shapes (paths,
187
- * matrix transforms) supply their own.
188
- *
189
- * The inverse — `rebaseLocalPose` — converts a world-space pose into a
190
- * local pose under a target parent. Used when reparenting so the visual
191
- * world position of a child is preserved across the parent change.
192
- */
193
- /**
194
- * Axis-aligned rectangle pose with optional rotation. The canonical pose
195
- * shape used by `composeRectPose` and the `unionBounds` helper. Rotation is
196
- * in radians, pivoted on the unrotated AABB center; absent === 0. Kit-side
197
- * code that consumes rotation already reads `pose.rotation ?? 0`
198
- * (`SceneCanvas.defaultDrawOne`, `rotate/handle.ts`, `pathInWorld.ts`), so
199
- * the slot exists on every default scene whether or not the consumer
200
- * populates it. Defined here in core/transforms so the compose helpers
201
- * don't depend on features.
202
- */
203
- interface RectPose {
204
- x: number;
205
- y: number;
206
- width: number;
207
- height: number;
208
- /** Rotation in radians around the unrotated AABB center. Absent === 0. */
209
- rotation?: number;
210
- }
211
- /** Consumer's pose-composition strategy for hierarchical scenes. `compose`
212
- * folds a child's pose (in parent's frame) up to the next frame; `decompose`
213
- * is its inverse. Default is IDENTITY — an absolute-pose scene where every
214
- * node already stores world coords (parent is grouping-only, no transform). */
215
- interface PoseComposition<TPose> {
216
- compose: (parent: TPose, child: TPose) => TPose;
217
- decompose: (parent: TPose, world: TPose) => TPose;
218
- }
219
-
220
175
  /** Fill rule used by polygon path hit-testing and `ctx.fill()`. */
221
176
  type PathFillRule = 'nonzero' | 'evenodd';
222
177
  /**
@@ -246,6 +201,23 @@ interface RectPath {
246
201
  /** Canonical path shape — either an axis-aligned rect (fast path) or a polygon command stream. */
247
202
  type Path = PolygonPath | RectPath;
248
203
 
204
+ /**
205
+ * Axis-aligned rectangle pose with optional rotation. The canonical pose
206
+ * shape used by `composeRectPose` and the `unionBounds` helper. Rotation is
207
+ * in radians, pivoted on the unrotated AABB center; absent === 0. Kit-side
208
+ * code that consumes rotation already reads `pose.rotation ?? 0`
209
+ * (`SceneCanvas.defaultDrawOne`, `rotate/handle.ts`, `pathInWorld.ts`), so
210
+ * the slot exists on every default scene whether or not the consumer
211
+ * populates it.
212
+ */
213
+ interface RectPose {
214
+ x: number;
215
+ y: number;
216
+ width: number;
217
+ height: number;
218
+ /** Rotation in radians around the unrotated AABB center. Absent === 0. */
219
+ rotation?: number;
220
+ }
249
221
  /**
250
222
  * # SceneNode — the thing in the scene
251
223
  *
@@ -791,6 +763,19 @@ interface TextStyle {
791
763
  underline?: boolean;
792
764
  /** Default `false`. */
793
765
  strikethrough?: boolean;
766
+ /**
767
+ * Outline painted over the glyph fill. Omitted (the default) means no
768
+ * outline — there is no such thing as a default text stroke.
769
+ *
770
+ * Only glyphs on the outline tier are stroked: above
771
+ * `textOutlineMinScreenSize` a glyph is a real `PolygonPath`, so it gets
772
+ * the ordinary tessellated ribbon with real joins, caps and miters, in any
773
+ * paint. Below it a glyph is a sampled distance field with no geometry to
774
+ * stroke, and it renders unstroked rather than approximated. `width` is in
775
+ * world units, like every other stroke in the kit — it does not scale with
776
+ * `fontSize`.
777
+ */
778
+ stroke?: Stroke;
794
779
  }
795
780
 
796
781
  /**
@@ -818,6 +803,9 @@ interface ResolvedRun {
818
803
  fontWeight: number;
819
804
  fontStyle: 'normal' | 'italic';
820
805
  fill: FillStyle;
806
+ /** Outline over this run's glyphs, or absent for none. Painted only on the
807
+ * outline tier — a distance field has no geometry to stroke. */
808
+ stroke?: Stroke;
821
809
  /** Extra advance added after each glyph of this run, in world units. */
822
810
  letterSpacing: number;
823
811
  /** Draw a rule below this run's baseline. Additive over the node style. */
@@ -968,4 +956,4 @@ interface ShaderDrawCommand {
968
956
  };
969
957
  }
970
958
 
971
- export type { Bounds as B, DrawCommand as D, History as H, Node as N, Op as O, PathDrawCommand as P, Scene as S, View as V, ViewportDims as a, NodeId as b, Path as c, PoseComposition as d };
959
+ export type { Bounds as B, DrawCommand as D, History as H, Node as N, Op as O, PathDrawCommand as P, Scene as S, View as V, ViewportDims as a, NodeId as b, Path as c };