@weasel-js/labkit 1.0.4 → 1.1.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 (85) hide show
  1. package/README.md +6 -6
  2. package/dist/_dts/{index-CFlDPeZh.d.ts → index-iAP6XbH3.d.ts} +17 -7
  3. package/dist/_dts/{useExperimentState-D7EQnnwJ.d.ts → useTrialState-DYe2vUwN.d.ts} +60 -36
  4. package/dist/canvas/index.d.ts +1 -1
  5. package/dist/chunk-3TYUJR7Z.js +488 -0
  6. package/dist/chunk-3TYUJR7Z.js.map +1 -0
  7. package/dist/{chunk-BAPZPDDA.js → chunk-C6GJKPUI.js} +365 -340
  8. package/dist/chunk-C6GJKPUI.js.map +1 -0
  9. package/dist/{chunk-DWV7SFKR.js → chunk-DJLDIRFN.js} +28 -12
  10. package/dist/chunk-DJLDIRFN.js.map +1 -0
  11. package/dist/{chunk-DEWXYFEU.js → chunk-NRKWVTVT.js} +3 -3
  12. package/dist/{chunk-DEWXYFEU.js.map → chunk-NRKWVTVT.js.map} +1 -1
  13. package/dist/dragdrop/index.d.ts +1 -1
  14. package/dist/index.d.ts +149 -149
  15. package/dist/index.js +164 -159
  16. package/dist/index.js.map +1 -1
  17. package/dist/layers/index.d.ts +2 -2
  18. package/dist/passthrough/weasel-canvas.js +1 -1
  19. package/dist/passthrough/weasel-ui.d.ts +9 -2
  20. package/dist/passthrough/weasel-ui.js +2 -2
  21. package/dist/state/index.d.ts +12 -12
  22. package/dist/state/index.js +5 -5
  23. package/dist/state/index.js.map +1 -1
  24. package/dist/styles.css +21 -13
  25. package/dist/ui/layers/index.js +3 -3
  26. package/dist/undo/index.d.ts +1 -1
  27. package/package.json +1 -1
  28. package/src/canvas/AGENTS.md +6 -2
  29. package/src/dragdrop/dragDrop.test.tsx +4 -7
  30. package/src/index.test.ts +52 -0
  31. package/src/index.ts +11 -7
  32. package/src/instrument/SineWave.smoke.test.tsx +1 -1
  33. package/src/instrument/capabilityDetector.ts +1 -1
  34. package/src/instrument/types.ts +18 -6
  35. package/src/lab/Lab.less +16 -0
  36. package/src/lab/Lab.stories.tsx +5 -5
  37. package/src/lab/Lab.test.tsx +25 -25
  38. package/src/lab/Lab.tsx +50 -50
  39. package/src/lab/LabContext.ts +12 -12
  40. package/src/lab/LabShell.tsx +1 -1
  41. package/src/lab/{WorkspaceGrid.less → Workspace.less} +2 -2
  42. package/src/lab/{WorkspaceGrid.stories.tsx → Workspace.stories.tsx} +13 -13
  43. package/src/lab/{WorkspaceGrid.test.tsx → Workspace.test.tsx} +24 -24
  44. package/src/lab/{WorkspaceGrid.tsx → Workspace.tsx} +18 -18
  45. package/src/lab/index.ts +2 -2
  46. package/src/layers/AGENTS.md +3 -3
  47. package/src/primitives/Toolbar.stories.tsx +2 -2
  48. package/src/state/SingletonExperiment.test.tsx +8 -8
  49. package/src/state/SingletonExperiment.tsx +9 -9
  50. package/src/state/context.tsx +12 -12
  51. package/src/state/document.test.ts +369 -0
  52. package/src/state/document.ts +194 -0
  53. package/src/state/helpers.test.ts +74 -46
  54. package/src/state/helpers.ts +21 -29
  55. package/src/state/index.ts +16 -8
  56. package/src/state/store.test.ts +440 -41
  57. package/src/state/store.ts +159 -102
  58. package/src/state/types.ts +29 -12
  59. package/src/state/{useExperimentState.test.tsx → useTrialState.test.tsx} +18 -18
  60. package/src/state/useTrialState.ts +29 -0
  61. package/src/styles.less +2 -2
  62. package/src/theme/base.less +1 -1
  63. package/src/{workspace → trial}/DefaultSidebar.tsx +3 -3
  64. package/src/{workspace → trial}/DefaultStatusBar.tsx +5 -4
  65. package/src/{workspace → trial}/DefaultToolbar.tsx +9 -8
  66. package/src/trial/Trial.canvas.test.tsx +80 -0
  67. package/src/{workspace/Workspace.less → trial/Trial.less} +1 -1
  68. package/src/{workspace/Workspace.stories.tsx → trial/Trial.stories.tsx} +13 -18
  69. package/src/{workspace/Workspace.test.tsx → trial/Trial.test.tsx} +26 -26
  70. package/src/{workspace/Workspace.tsx → trial/Trial.tsx} +48 -43
  71. package/src/{workspace/WorkspaceChrome.tsx → trial/TrialChrome.tsx} +42 -42
  72. package/src/{workspace → trial}/index.ts +13 -13
  73. package/src/{workspace → trial}/slotTypes.ts +16 -16
  74. package/src/{workspace/workspaceOps.test.ts → trial/trialOps.test.ts} +38 -44
  75. package/src/trial/trialOps.ts +99 -0
  76. package/src/ui/format.test.ts +33 -0
  77. package/src/ui/format.ts +11 -0
  78. package/src/ui/properties/CurveField.tsx +6 -6
  79. package/src/ui/properties/SpeechBalloonPanels.stories.tsx +3 -3
  80. package/dist/chunk-BAPZPDDA.js.map +0 -1
  81. package/dist/chunk-DWV7SFKR.js.map +0 -1
  82. package/dist/chunk-KSTEW2AF.js +0 -367
  83. package/dist/chunk-KSTEW2AF.js.map +0 -1
  84. package/src/state/useExperimentState.ts +0 -31
  85. package/src/workspace/workspaceOps.ts +0 -102
@@ -3172,7 +3172,7 @@ function serialToEntry(se, custom, logger) {
3172
3172
  };
3173
3173
  }
3174
3174
 
3175
- // ../core/dist/chunk-AYGSXNY3.js
3175
+ // ../core/dist/chunk-3B4QEB2G.js
3176
3176
  function worldToScreen(worldX, worldY, view) {
3177
3177
  return [view.panX + worldX * view.zoom.x, view.panY + worldY * view.zoom.y];
3178
3178
  }
@@ -8052,7 +8052,7 @@ var IDENTITY_POSE_COMPOSITION = {
8052
8052
  compose: (_parent, child) => child,
8053
8053
  decompose: (_parent, world) => world
8054
8054
  };
8055
- function composeWorldPose(adapter, id, compose) {
8055
+ function composeWorldPose(adapter, id, compose2) {
8056
8056
  const chain = [id];
8057
8057
  const seen = /* @__PURE__ */ new Set([id]);
8058
8058
  let cursor = adapter.getParent(id);
@@ -8064,16 +8064,16 @@ function composeWorldPose(adapter, id, compose) {
8064
8064
  }
8065
8065
  let world = adapter.getPose(chain[chain.length - 1]);
8066
8066
  for (let i = chain.length - 2; i >= 0; i--) {
8067
- world = compose(world, adapter.getPose(chain[i]));
8067
+ world = compose2(world, adapter.getPose(chain[i]));
8068
8068
  }
8069
8069
  return world;
8070
8070
  }
8071
8071
  function translateRectPose(pose, dx, dy) {
8072
8072
  return { ...pose, x: pose.x + dx, y: pose.y + dy };
8073
8073
  }
8074
- function rebaseLocalPose(adapter, worldPose, newParentId, compose, decompose) {
8074
+ function rebaseLocalPose(adapter, worldPose, newParentId, compose2, decompose) {
8075
8075
  if (newParentId === null) return worldPose;
8076
- const parentWorld = composeWorldPose(adapter, newParentId, compose);
8076
+ const parentWorld = composeWorldPose(adapter, newParentId, compose2);
8077
8077
  return decompose(parentWorld, worldPose);
8078
8078
  }
8079
8079
  function translatePoseGeneric(pose, dx, dy, projection) {
@@ -10968,9 +10968,17 @@ function arraysEqual(a, b) {
10968
10968
  return true;
10969
10969
  }
10970
10970
  function createPartitionedReorderOp(args) {
10971
- const { ids, fn, label } = args;
10972
- let restore = null;
10971
+ const { ids, direction, fn, label, prevOrders } = args;
10972
+ const argsForSerial = {
10973
+ ids,
10974
+ direction,
10975
+ label,
10976
+ prevOrders: prevOrders ? prevOrders.map((e) => ({ ...e, before: e.before.slice() })) : void 0
10977
+ };
10978
+ let restore = prevOrders ? prevOrders.map((e) => ({ ...e, before: e.before.slice() })) : null;
10973
10979
  return {
10980
+ name: "reorder",
10981
+ args: argsForSerial,
10974
10982
  label,
10975
10983
  apply(adapter) {
10976
10984
  const a = adapter;
@@ -10993,6 +11001,7 @@ function createPartitionedReorderOp(args) {
10993
11001
  mutated = true;
10994
11002
  }
10995
11003
  restore = snapshots;
11004
+ argsForSerial.prevOrders = snapshots.map((e) => ({ ...e, before: e.before.slice() }));
10996
11005
  return mutated;
10997
11006
  },
10998
11007
  invert() {
@@ -11024,10 +11033,17 @@ var REORDER_DIRECTIONS = {
11024
11033
  back: { fn: sendToBack, defaultLabel: "Send to back" }
11025
11034
  };
11026
11035
  function createReorderOp(args) {
11027
- const { ids, direction, label } = args;
11036
+ const { ids, direction, label, prevOrders } = args;
11028
11037
  const { fn, defaultLabel } = REORDER_DIRECTIONS[direction];
11029
- return createPartitionedReorderOp({ ids, fn, label: label ?? defaultLabel });
11038
+ return createPartitionedReorderOp({
11039
+ ids,
11040
+ direction,
11041
+ fn,
11042
+ label: label ?? defaultLabel,
11043
+ prevOrders
11044
+ });
11030
11045
  }
11046
+ registerOpFactory("reorder", (args) => createReorderOp(args));
11031
11047
  function createMoveToIndexOp(args) {
11032
11048
  const { ids, parentId, index, label } = args;
11033
11049
  const argsForSerial = {
@@ -18276,7 +18292,7 @@ function makeContainerAwareBoundsResolver(getPose, getBounds, getChildren, isCon
18276
18292
  const visit = (nid) => {
18277
18293
  const kids = getChildren(nid);
18278
18294
  if (kids.length === 0) {
18279
- out.push(nid);
18295
+ if (!isContainer(nid)) out.push(nid);
18280
18296
  return;
18281
18297
  }
18282
18298
  for (const k of kids) visit(k);
@@ -24807,5 +24823,5 @@ function oklchToOklab(L, C, h) {
24807
24823
  }
24808
24824
 
24809
24825
  export { FALLBACK_FIT_VIEW, MinimapCanvas, SceneViewCanvas, UnknownIcon, buildSceneViewCommands, computeFitView2, computeIndicatorCommand, eligibleContribution, evaluateEnabled, oklabToSrgbU8, oklchToOklab, renderSceneToCanvas, rgbaToHex, useActionsRegistry, useOptionalDepRegistry };
24810
- //# sourceMappingURL=chunk-DWV7SFKR.js.map
24811
- //# sourceMappingURL=chunk-DWV7SFKR.js.map
24826
+ //# sourceMappingURL=chunk-DJLDIRFN.js.map
24827
+ //# sourceMappingURL=chunk-DJLDIRFN.js.map