@weasel-js/labkit 1.2.0 → 1.3.0-pre.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.
Files changed (196) hide show
  1. package/dist/_dts/{DrawCommand-C_XboUpz.d.ts → DrawCommand-DBB45NfN.d.ts} +196 -52
  2. package/dist/_dts/PrefsForm-BYa6cWnO.d.ts +201 -0
  3. package/dist/_dts/index-DgcNdEdh.d.ts +314 -0
  4. package/dist/_dts/types-1Sdxy_Pv.d.ts +90 -0
  5. package/dist/_dts/types-AHlQxBNN.d.ts +162 -0
  6. package/dist/_dts/{useTrialState-BMNIx3Cy.d.ts → useTrialState-CsGMjhu9.d.ts} +5 -87
  7. package/dist/canvas/index.d.ts +7 -3
  8. package/dist/canvas/index.js +2 -1
  9. package/dist/chrome/index.d.ts +86 -0
  10. package/dist/chrome/index.js +8 -0
  11. package/dist/chrome/index.js.map +1 -0
  12. package/dist/{chunk-VUU5UXHE.js → chunk-4TMMVIDM.js} +8 -5
  13. package/dist/chunk-4TMMVIDM.js.map +1 -0
  14. package/dist/{chunk-THBG7FQZ.js → chunk-HFDVGF4X.js} +15 -12
  15. package/dist/chunk-HFDVGF4X.js.map +1 -0
  16. package/dist/{chunk-574LJAV4.js → chunk-NS54R52R.js} +31 -21
  17. package/dist/chunk-NS54R52R.js.map +1 -0
  18. package/dist/{chunk-G5TJVQQT.js → chunk-O2BULFHX.js} +5 -14
  19. package/dist/chunk-O2BULFHX.js.map +1 -0
  20. package/dist/chunk-O7NVSCLN.js +266 -0
  21. package/dist/chunk-O7NVSCLN.js.map +1 -0
  22. package/dist/chunk-PO6L3NSH.js +366 -0
  23. package/dist/chunk-PO6L3NSH.js.map +1 -0
  24. package/dist/chunk-PQJ5B2U2.js +27 -0
  25. package/dist/chunk-PQJ5B2U2.js.map +1 -0
  26. package/dist/chunk-RVNN4CHQ.js +212 -0
  27. package/dist/chunk-RVNN4CHQ.js.map +1 -0
  28. package/dist/chunk-TLGRYALP.js +6151 -0
  29. package/dist/chunk-TLGRYALP.js.map +1 -0
  30. package/dist/{chunk-SFL7NFKN.js → chunk-V7PRSIRQ.js} +15 -7
  31. package/dist/chunk-V7PRSIRQ.js.map +1 -0
  32. package/dist/{chunk-BOHF3PQO.js → chunk-Z6HJ5FEM.js} +8111 -5190
  33. package/dist/chunk-Z6HJ5FEM.js.map +1 -0
  34. package/dist/chunk-ZZAYVX4X.js +505 -0
  35. package/dist/chunk-ZZAYVX4X.js.map +1 -0
  36. package/dist/controls/index.d.ts +19 -5
  37. package/dist/controls/index.js +3 -1
  38. package/dist/dragdrop/index.d.ts +4 -2
  39. package/dist/index.d.ts +246 -106
  40. package/dist/index.js +673 -559
  41. package/dist/index.js.map +1 -1
  42. package/dist/layers/index.d.ts +5 -3
  43. package/dist/layers/index.js +2 -1
  44. package/dist/passthrough/weasel-canvas.d.ts +69 -13
  45. package/dist/passthrough/weasel-canvas.js +1 -1
  46. package/dist/passthrough/weasel-ui.d.ts +3799 -3672
  47. package/dist/passthrough/weasel-ui.js +2 -2
  48. package/dist/primitives/index.d.ts +102 -8
  49. package/dist/primitives/index.js +4 -1
  50. package/dist/state/index.d.ts +3 -2
  51. package/dist/state/index.js +2 -2
  52. package/dist/styles.css +542 -153
  53. package/dist/surface/index.js +2 -1
  54. package/dist/ui/layers/index.js +4 -3
  55. package/dist/undo/index.d.ts +4 -2
  56. package/package.json +16 -7
  57. package/src/canvas/AGENTS.md +4 -0
  58. package/src/canvas/CanvasStack.tsx +6 -2
  59. package/src/canvas/useLayerScheduler.ts +22 -15
  60. package/src/canvas/usePanZoom.test.ts +80 -0
  61. package/src/canvas/usePanZoom.ts +16 -2
  62. package/src/chrome/ChromeRegions.stories.tsx +106 -0
  63. package/src/chrome/builtins.test.ts +153 -0
  64. package/src/chrome/builtins.tsx +205 -0
  65. package/src/chrome/index.ts +25 -0
  66. package/src/chrome/merge.test.ts +51 -0
  67. package/src/chrome/merge.ts +52 -0
  68. package/src/chrome/regions/PaletteRegion.less +14 -0
  69. package/src/chrome/regions/PaletteRegion.test.tsx +36 -0
  70. package/src/chrome/regions/PaletteRegion.tsx +41 -0
  71. package/src/chrome/regions/SidebarRegion.tsx +56 -0
  72. package/src/chrome/regions/StatusRegion.tsx +31 -0
  73. package/src/chrome/regions/TitleBarRegion.tsx +41 -0
  74. package/src/chrome/regions/ToolbarRegion.test.tsx +82 -0
  75. package/src/chrome/regions/ToolbarRegion.tsx +71 -0
  76. package/src/chrome/regions/ViewportRegion.less +42 -0
  77. package/src/chrome/regions/ViewportRegion.tsx +37 -0
  78. package/src/chrome/regions/regions.test.tsx +81 -0
  79. package/src/chrome/types.ts +127 -0
  80. package/src/config/builder.test.ts +87 -0
  81. package/src/config/builder.ts +224 -0
  82. package/src/config/fromConfigField.test.ts +93 -0
  83. package/src/config/fromConfigField.ts +74 -0
  84. package/src/config/index.ts +22 -0
  85. package/src/config/resolve.test.ts +120 -0
  86. package/src/config/resolve.ts +67 -0
  87. package/src/config/rules.ts +68 -0
  88. package/src/config/types.ts +108 -0
  89. package/src/config/useConfigSchema.ts +30 -0
  90. package/src/config/visible.ts +20 -0
  91. package/src/controls/ControlPanel.less +4 -58
  92. package/src/controls/ControlPanel.stories.tsx +86 -0
  93. package/src/controls/ControlPanel.test.tsx +223 -10
  94. package/src/controls/ControlPanel.tsx +202 -203
  95. package/src/dragdrop/DragDropRuntime.tsx +36 -18
  96. package/src/dragdrop/DragGhost.less +1 -1
  97. package/src/dragdrop/Palette.less +1 -1
  98. package/src/index.ts +25 -3
  99. package/src/instrument/SineWave.smoke.test.tsx +8 -1
  100. package/src/instrument/defineInstrument.test.ts +38 -1
  101. package/src/instrument/defineInstrument.ts +31 -4
  102. package/src/instrument/index.ts +1 -0
  103. package/src/instrument/types.ts +27 -4
  104. package/src/instrument/validateConfigSchema.test.ts +13 -3
  105. package/src/instrument/validateConfigSchema.ts +7 -10
  106. package/src/lab/Lab.chrome.test.tsx +65 -0
  107. package/src/lab/Lab.tsx +58 -15
  108. package/src/lab/LabContext.ts +6 -0
  109. package/src/lab/LabFullChrome.stories.tsx +308 -0
  110. package/src/lab/LabHeader.test.tsx +42 -0
  111. package/src/lab/LabHeader.tsx +57 -0
  112. package/src/lab/LabPalette.test.tsx +35 -0
  113. package/src/lab/LabPalette.tsx +34 -0
  114. package/src/lab/LabShell.less +50 -3
  115. package/src/lab/Workspace.less +1 -30
  116. package/src/lab/Workspace.test.tsx +20 -10
  117. package/src/lab/Workspace.tsx +5 -8
  118. package/src/lab/index.ts +2 -0
  119. package/src/layers/AGENTS.md +1 -1
  120. package/src/layers/LayerList.less +31 -7
  121. package/src/layers/LayerList.tsx +17 -4
  122. package/src/passthrough/weasel-ui.ts +23 -0
  123. package/src/primitives/DragHandleGlyph.tsx +29 -0
  124. package/src/primitives/FloatingPanel.less +28 -0
  125. package/src/primitives/FloatingPanel.stories.tsx +46 -0
  126. package/src/primitives/FloatingPanel.test.tsx +240 -0
  127. package/src/primitives/FloatingPanel.tsx +190 -0
  128. package/src/primitives/FpsMeter.test.tsx +44 -0
  129. package/src/primitives/FpsMeter.tsx +20 -9
  130. package/src/primitives/JobProgress.less +69 -0
  131. package/src/primitives/JobProgress.stories.tsx +48 -0
  132. package/src/primitives/JobProgress.tsx +65 -0
  133. package/src/primitives/Legend.less +47 -0
  134. package/src/primitives/Legend.stories.tsx +32 -0
  135. package/src/primitives/Legend.test.tsx +57 -0
  136. package/src/primitives/Legend.tsx +40 -0
  137. package/src/primitives/Sidebar.less +32 -2
  138. package/src/primitives/StatusBar.less +7 -0
  139. package/src/primitives/StatusBar.tsx +10 -3
  140. package/src/primitives/Toolbar.less +50 -3
  141. package/src/primitives/Toolbar.test.tsx +67 -1
  142. package/src/primitives/Toolbar.tsx +72 -6
  143. package/src/primitives/ZoomControl.less +31 -0
  144. package/src/primitives/ZoomControl.tsx +76 -0
  145. package/src/primitives/floating.entry.test.tsx +14 -0
  146. package/src/primitives/index.ts +10 -2
  147. package/src/primitives/useRovingTabIndex.test.ts +27 -0
  148. package/src/primitives/useRovingTabIndex.ts +79 -0
  149. package/src/state/store.ts +11 -3
  150. package/src/state/toolSlot.test.ts +36 -0
  151. package/src/state/types.ts +4 -0
  152. package/src/styles.less +6 -0
  153. package/src/surface/useTiledSurface.ts +14 -10
  154. package/src/test-setup.ts +26 -0
  155. package/src/theme/base.less +19 -2
  156. package/src/theme/interstellar.tokens.json +6 -2
  157. package/src/tools/types.ts +24 -0
  158. package/src/trial/Trial.config.test.tsx +113 -0
  159. package/src/trial/Trial.job.test.tsx +13 -15
  160. package/src/trial/Trial.less +115 -10
  161. package/src/trial/Trial.stories.tsx +1 -0
  162. package/src/trial/Trial.test.tsx +67 -96
  163. package/src/trial/Trial.tsx +80 -39
  164. package/src/trial/TrialChrome.tsx +99 -80
  165. package/src/trial/TrialDragContext.ts +10 -0
  166. package/src/trial/TrialTitleBar.tsx +41 -0
  167. package/src/trial/index.ts +1 -15
  168. package/src/trial/trialChrome.borders.test.ts +38 -0
  169. package/src/ui/layers/LayerStack.less +9 -9
  170. package/src/ui/layers/LayerStack.tsx +1 -13
  171. package/src/ui/properties/CurveField.less +2 -2
  172. package/src/ui/properties/CurveField.test.tsx +11 -11
  173. package/src/ui/properties/PropertyGroup.less +2 -2
  174. package/src/ui/properties/PropertyPanel.less +55 -41
  175. package/src/ui/properties/SpeechBalloonPanels.stories.tsx +4 -2
  176. package/src/ui/properties/storyLayouts.tsx +2 -2
  177. package/dist/_dts/index-JFAYj5Tv.d.ts +0 -144
  178. package/dist/_dts/types-x92Kfeme.d.ts +0 -62
  179. package/dist/chunk-574LJAV4.js.map +0 -1
  180. package/dist/chunk-5R2ATYPJ.js +0 -201
  181. package/dist/chunk-5R2ATYPJ.js.map +0 -1
  182. package/dist/chunk-73KA7WBO.js +0 -5992
  183. package/dist/chunk-73KA7WBO.js.map +0 -1
  184. package/dist/chunk-BOHF3PQO.js.map +0 -1
  185. package/dist/chunk-G5TJVQQT.js.map +0 -1
  186. package/dist/chunk-PMAU3SEE.js +0 -126
  187. package/dist/chunk-PMAU3SEE.js.map +0 -1
  188. package/dist/chunk-SFL7NFKN.js.map +0 -1
  189. package/dist/chunk-THBG7FQZ.js.map +0 -1
  190. package/dist/chunk-VUU5UXHE.js.map +0 -1
  191. package/src/instrument/capabilityDetector.test.ts +0 -64
  192. package/src/instrument/capabilityDetector.ts +0 -20
  193. package/src/trial/DefaultSidebar.tsx +0 -29
  194. package/src/trial/DefaultStatusBar.tsx +0 -19
  195. package/src/trial/DefaultToolbar.tsx +0 -92
  196. package/src/trial/slotTypes.ts +0 -54
@@ -1,8 +1,10 @@
1
- import { d as LayerDescriptor } from '../_dts/index-JFAYj5Tv.js';
2
- export { L as LayerCapability } from '../_dts/index-JFAYj5Tv.js';
1
+ import { f as LayerDescriptor } from '../_dts/index-DgcNdEdh.js';
2
+ export { L as LayerCapability } from '../_dts/index-DgcNdEdh.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import 'react';
5
- import '../_dts/types-x92Kfeme.js';
5
+ import '../_dts/types-AHlQxBNN.js';
6
+ import '../_dts/PrefsForm-BYa6cWnO.js';
7
+ import '../_dts/types-1Sdxy_Pv.js';
6
8
  import '../_dts/types-DJ79Tg5J.js';
7
9
 
8
10
  /** Props for `<LayerList>`. */
@@ -1,3 +1,4 @@
1
- export { LayerList } from '../chunk-SFL7NFKN.js';
1
+ export { LayerList } from '../chunk-V7PRSIRQ.js';
2
+ import '../chunk-PQJ5B2U2.js';
2
3
  //# sourceMappingURL=index.js.map
3
4
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,68 @@
1
+ import { N as Node, V as View, P as Path, D as DrawCommand, S as Scene, B as Bounds, a as ViewportDims, b as PathDrawCommand } from '../_dts/DrawCommand-DBB45NfN.js';
1
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
  import { Ref } from 'react';
3
- import { N as Node, V as View, D as DrawCommand, S as Scene, B as Bounds, a as ViewportDims, P as PathDrawCommand } from '../_dts/DrawCommand-C_XboUpz.js';
4
+
5
+ /**
6
+ * NodeShape — the **shape trait's** registry. Each trait of a node
7
+ * (shape, routing, label, icon, affordances, …) is its own registry;
8
+ * this one holds the per-kind `paint` + `silhouette` (and future
9
+ * fields) used by `defaultDrawOne`, clipping, non-rect hit-testing,
10
+ * and lasso/area-select.
11
+ *
12
+ * Teaching the kit about a new kind of shape goes through this registry
13
+ * rather than by overriding `drawOne`. Overrides are still possible but
14
+ * shouldn't be the default seam: most consumers want the same dispatch
15
+ * logic, just extended with their own shape kinds (images, custom paths,
16
+ * SVG fragments, etc.).
17
+ *
18
+ * Built-in entries (`kit:text`, `kit:path`, `kit:rect-fallback`) are
19
+ * registered at module load. Consumer entries added via
20
+ * `registerNodeShape` join the chain; the first entry whose
21
+ * `matches` predicate returns true paints the node.
22
+ *
23
+ * Two priority tiers:
24
+ * - `'high'` — checked before all `'normal'` entries. Use this to
25
+ * override a kit built-in for a specific data shape (e.g. a custom
26
+ * text renderer that wins over `kit:text`).
27
+ * - `'normal'` (default) — appended after the built-ins.
28
+ *
29
+ * Within a tier, entries run in registration order. Each
30
+ * `registerNodeShape` call returns a disposer that removes the
31
+ * entry — useful for tests, for plugin lifecycles, and for swapping
32
+ * implementations at runtime.
33
+ *
34
+ * See `docs/superpowers/specs/2026-05-24-node-traits-reframe-design.md`
35
+ * for the trait taxonomy.
36
+ */
37
+
38
+ /** Optional per-call paint context, threaded through `defaultDrawOne`'s third
39
+ * argument. Lets a rendering entry point override ambient environment reads
40
+ * — the headless `renderSceneToPixels` path supplies its own bitmap resolver
41
+ * here so consumers reuse their own decode caches. Custom painters may
42
+ * ignore it entirely. */
43
+ interface NodePaintCtx {
44
+ /** Override bitmap resolution for image nodes. When set it is authoritative:
45
+ * the global `imageCache` is not consulted, and an `undefined` result
46
+ * paints the deterministic grey placeholder outline (never the ambient
47
+ * load-status error variant). */
48
+ resolveImage?: (node: Node<unknown, string, unknown>) => ImageBitmap | undefined;
49
+ /** The node's derived path, resolved by the scene-aware `drawOne` wrapper
50
+ * before painting: `paint` has no scene handle, and deriving needs the
51
+ * dependencies' poses. **Absent** for a node that derives from nothing —
52
+ * the wrapper hands such a node the caller's own ctx untouched. `null`
53
+ * means the node derives but has nothing to draw. */
54
+ derivedPath?: Path | null;
55
+ }
56
+ /**
57
+ * Per-node draw function — the scene-slot `drawOne` signature shared by
58
+ * `<SceneCanvas>`, `renderSceneToCanvas` and `renderSceneToPixels`, so a
59
+ * consumer can reuse one callback across a main canvas and a detached view.
60
+ *
61
+ * Called once per node in the walk. Returned commands are world-space; the
62
+ * caller applies the view transform at the group level. `ctx` is supplied by
63
+ * the scene-aware wrappers — see {@link NodePaintCtx}.
64
+ */
65
+ type SceneViewDrawOne<TData, TLayer extends string, TPose> = (node: Node<TData, TLayer, TPose>, pose: TPose, view: View, ctx?: NodePaintCtx) => DrawCommand[];
4
66
 
5
67
  /**
6
68
  * `renderSceneToCanvas` — substrate for detached, read-only scene views
@@ -21,17 +83,6 @@ import { N as Node, V as View, D as DrawCommand, S as Scene, B as Bounds, a as V
21
83
  * in sync by hand where it matters (DPR handling, viewToMat3 wrap).
22
84
  */
23
85
 
24
- /**
25
- * Per-node draw function. Mirrors the scene-slot `drawOne` signature on
26
- * `<SceneCanvas>` (`SceneSlotConfig.drawOne`) so consumers can reuse the
27
- * same callback (or a simplified variant) between a main canvas and a
28
- * detached scene-view canvas.
29
- *
30
- * The function is called once per node in `scene.renderOrder()`. Returned
31
- * commands are in world coords; the caller's `view` is applied at the
32
- * group level (see `renderSceneToCanvas`'s implementation).
33
- */
34
- type SceneViewDrawOne<TData, TLayer extends string, TPose> = (node: Node<TData, TLayer, TPose>, pose: TPose, view: View) => DrawCommand[];
35
86
  /** What to draw into an existing canvas: the scene, the view, and the same
36
87
  * painting hooks `<SceneCanvas>` takes. */
37
88
  interface RenderSceneToCanvasArgs<TData, TLayer extends string, TPose> {
@@ -254,7 +305,12 @@ interface MinimapCanvasProps<TData, TLayer extends string, TPose> {
254
305
  * can reuse it (typically simplified — just colored AABBs). */
255
306
  drawOne: SceneViewDrawOne<TData, TLayer, TPose>;
256
307
  /** Fit policy. Defaults to `"scene"` (AABB union of leaf poses). See
257
- * `MinimapFit` for the full shape. */
308
+ * `MinimapFit` for the full shape.
309
+ *
310
+ * Framing is derived from **document** poses, not `scene.overrides` — a
311
+ * node moved by an override paints where the override puts it, outside the
312
+ * frame if it goes there, rather than making the whole minimap rescale on
313
+ * every frame of a drag or a settle. */
258
314
  fit?: MinimapFit<TData, TLayer, TPose>;
259
315
  /** Pose → AABB. Defaults to identity (`pose as Bounds`), matching
260
316
  * `sceneAdapter` / `useSelectTool`. */
@@ -1,3 +1,3 @@
1
- export { FALLBACK_FIT_VIEW, MinimapCanvas, SceneViewCanvas, buildSceneViewCommands, computeFitView, computeIndicatorCommand, renderSceneToCanvas } from '../chunk-BOHF3PQO.js';
1
+ export { FALLBACK_FIT_VIEW, MinimapCanvas, SceneViewCanvas, buildSceneViewCommands, computeFitView, computeIndicatorCommand, renderSceneToCanvas } from '../chunk-Z6HJ5FEM.js';
2
2
  //# sourceMappingURL=weasel-canvas.js.map
3
3
  //# sourceMappingURL=weasel-canvas.js.map