@oh-just-another/react-ui 0.59.0 → 0.61.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 (51) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +4 -4
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/color-palette.d.ts +5 -0
  5. package/dist/color-palette.d.ts.map +1 -1
  6. package/dist/color-palette.js +5 -0
  7. package/dist/color-palette.js.map +1 -1
  8. package/dist/color-swatch-picker.d.ts.map +1 -1
  9. package/dist/color-swatch-picker.js +4 -14
  10. package/dist/color-swatch-picker.js.map +1 -1
  11. package/dist/command-palette.js +1 -1
  12. package/dist/command-palette.js.map +1 -1
  13. package/dist/comments-panel.js +1 -1
  14. package/dist/constants.d.ts +4 -7
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +5 -2
  17. package/dist/constants.js.map +1 -1
  18. package/dist/context.d.ts +1 -1
  19. package/dist/context.js +1 -1
  20. package/dist/diagram-canvas.d.ts +2 -2
  21. package/dist/diagram-canvas.js +1 -1
  22. package/dist/diagram-root.d.ts +2 -2
  23. package/dist/diagram-root.js +2 -2
  24. package/dist/drawing-panel.js +2 -2
  25. package/dist/drawing-panel.js.map +1 -1
  26. package/dist/help-dialog.js +2 -2
  27. package/dist/hooks.d.ts +6 -3
  28. package/dist/hooks.d.ts.map +1 -1
  29. package/dist/hooks.js +7 -2
  30. package/dist/hooks.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/layer-panel.js +2 -2
  36. package/dist/link-caption-editor.d.ts +3 -3
  37. package/dist/link-caption-editor.d.ts.map +1 -1
  38. package/dist/link-caption-editor.js +8 -5
  39. package/dist/link-caption-editor.js.map +1 -1
  40. package/dist/main-menu.js +1 -1
  41. package/dist/property-panel.d.ts.map +1 -1
  42. package/dist/property-panel.js +28 -3
  43. package/dist/property-panel.js.map +1 -1
  44. package/dist/sidebar.js +2 -2
  45. package/dist/toast.js +1 -1
  46. package/dist/toolbar.d.ts +2 -2
  47. package/dist/toolbar.js +6 -6
  48. package/dist/toolbar.js.map +1 -1
  49. package/dist/versioning.js +1 -1
  50. package/package.json +9 -9
  51. package/src/styles.css +35 -29
package/CHANGELOG.md CHANGED
@@ -1,5 +1,94 @@
1
1
  # @oh-just-another/react-ui
2
2
 
3
+ ## 0.61.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac128db: Dark theme now restyles the chrome only — the canvas always stays light. Scene colors are raw hex authored against light paper, so a dark canvas silently broke user content; `UI_SURFACE.dark.canvas` and `--du-canvas-bg` are light in every theme, and the bundled color picker always offers the light element palette. Canvas-drawn chrome (selection, handles, anchors, marquee, badges, minimap frame) is unified on the iris accent (`CANVAS_CHROME_ACCENT`, iris9 — the same accent the DOM chrome uses) instead of the ad-hoc `#1a73e8`/`#2563eb` blues. Undeclared CSS variables and stale accent fallbacks in the stylesheet now resolve to the real theme tokens, so the affected popovers follow the active theme.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [ac128db]
12
+ - @oh-just-another/tokens@0.58.0
13
+ - @oh-just-another/state@0.62.0
14
+ - @oh-just-another/renderer-core@0.60.1
15
+ - @oh-just-another/templates@0.57.5
16
+ - @oh-just-another/renderer-canvas@0.61.1
17
+ - @oh-just-another/renderer-svg@0.57.5
18
+
19
+ ## 0.60.0
20
+
21
+ ### Minor Changes
22
+
23
+ - 0548ab3: Unify the active tool into a single `editor.activeTool` value object (breaking).
24
+ - `state`: `editor.activeTool: ActiveTool` (`{ type, locked, lastActiveTool }`)
25
+ replaces `editor.mode` and `editor.toolLocked`; `setActiveTool(type)` replaces
26
+ `setMode`. `EditorOptions.initialMode` → `initialTool`. The typed `mode` event
27
+ is now `tool` and fires with the `ActiveTool` object on a type switch or a
28
+ lock flip. The action category `"mode"` is now `"tool"`. The vestigial
29
+ `"eyedropper"` mode is removed from `Mode` — colour sampling is armed from
30
+ the colour picker (`beginEyedropperPick`) and never was a toolbar tool.
31
+ - `react-ui`: `useMode()` → `useActiveTool(): ActiveTool`;
32
+ `DiagramRoot`/`DiagramCanvas` prop `initialMode` → `initialTool`.
33
+ - `editor`: `EditorAPI.getMode/setMode` → `getActiveTool/setActiveTool`;
34
+ `initialMode` prop → `initialTool`; re-exports `ActiveTool`.
35
+ - `diagram` (+ vue/svelte/angular wrappers): element methods and controller
36
+ `getMode/setMode` → `getActiveTool/setActiveTool`.
37
+
38
+ Tool ids are unchanged (`"select"`, `"draw-rect"`, …). There are no visible
39
+ behaviour changes — this is an API refactor establishing one source of truth
40
+ for "which tool is active".
41
+
42
+ - 4722388: Editable width for committed brush strokes. `style.strokeWidth` never
43
+ affected brushes (their widths are baked per point), so the property panel's
44
+ Thin/Medium/Thick control silently did nothing for them. A brush-only
45
+ selection now gets a popover range slider driving the new
46
+ `Editor.setBrushWidth(ids, width)`, which scales every baked point width by
47
+ `newWidth / baseWidth` — the stroke keeps its exact pressure profile at the
48
+ new thickness — and records the new `baseWidth`. Legacy strokes without a
49
+ recorded base fall back to their widest point. One undo step.
50
+ - 84450bc: Link captions: measured rounded pill, multiline, correct placement and hit-testing.
51
+ - `scene`: new shared label geometry (`linkLabelAnchor`, `estimateLinkLabelBox`,
52
+ `linkLabelBounds`, `pointAlongPath`) — one source of truth for the renderer,
53
+ hit-testing and culling. `findLinkAt` now also hits inside the caption pill.
54
+ Elbow links place an unpositioned label on the longest segment's midpoint;
55
+ explicit `label.position` is clamped away from the arrowheads. Tunables in
56
+ `constants.ts` (`LINK_LABEL_MAX_WIDTH`, paddings, clearance).
57
+ - `renderer-core`: the caption is a rounded pill sized by real `measureText`
58
+ word-wrap (multiline, `\n` breaks) instead of a square estimated box; it
59
+ rides the drawn geometry (flattened curve for bezier, not the chord), and
60
+ `computeLinkWorldBounds` unions the pill so dirty-rect / viewport culling
61
+ never clip it. `LABEL_POSITION` / `LABEL_FONT_SIZE` constants moved to
62
+ `scene` as `LINK_LABEL_DEFAULT_POSITION` / `LINK_LABEL_DEFAULT_FONT_SIZE`.
63
+ - `state`: `linkLabelWorld` uses the shared anchor, so the inline editor opens
64
+ exactly over the pill (including bezier and elbow links).
65
+ - `react-ui`: the inline caption editor is a multiline textarea — Enter
66
+ commits, Shift+Enter inserts a newline, Escape cancels.
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [0548ab3]
71
+ - Updated dependencies [762dd8a]
72
+ - Updated dependencies [4722388]
73
+ - Updated dependencies [05707ed]
74
+ - Updated dependencies [50a2bd4]
75
+ - Updated dependencies [20af638]
76
+ - Updated dependencies [84450bc]
77
+ - Updated dependencies [acd01dc]
78
+ - Updated dependencies [da9d406]
79
+ - Updated dependencies [3c50ef1]
80
+ - Updated dependencies [f960332]
81
+ - Updated dependencies [99f9ab1]
82
+ - Updated dependencies [f9778a1]
83
+ - Updated dependencies [ea2f4e3]
84
+ - @oh-just-another/state@0.61.0
85
+ - @oh-just-another/scene@0.61.0
86
+ - @oh-just-another/renderer-core@0.60.0
87
+ - @oh-just-another/renderer-canvas@0.61.0
88
+ - @oh-just-another/renderer-svg@0.57.4
89
+ - @oh-just-another/templates@0.57.4
90
+ - @oh-just-another/versioning@0.57.4
91
+
3
92
  ## 0.59.0
4
93
 
5
94
  ### Minor Changes
package/README.md CHANGED
@@ -24,7 +24,7 @@ import { installBuiltinTemplates, loadTemplateLibrary } from "@oh-just-another/t
24
24
  installBuiltinTemplates();
25
25
 
26
26
  export const App = () => (
27
- <DiagramCanvas initialScene={emptyScene()} initialMode="select">
27
+ <DiagramCanvas initialScene={emptyScene()} initialTool="select">
28
28
  <Toolbar />
29
29
  <Palette />
30
30
  <PropertyPanel />
@@ -124,7 +124,7 @@ Every component reads the editor from context, so most take no required props.
124
124
  | `useDiagram()` / `useDiagramOptional()` | Live `Editor` (imperative; no re-render on change). |
125
125
  | `useDiagramContext()` / `useDiagramContextOptional()` | Raw context value. |
126
126
  | `useEditorSelector(select)` | Custom selector — re-renders when the projected value changes. |
127
- | `useScene()` / `useSelection()` / `useMode()` | Reactive slices of editor state. |
127
+ | `useScene()` / `useSelection()` / `useActiveTool()` | Reactive slices of editor state. |
128
128
  | `useHistory()` | `canUndo` / `canRedo` + `undo` / `redo`. |
129
129
  | `useLayers()` / `useActiveLayerId()` | Layer list and active layer. |
130
130
  | `useAnnotations()` / `useSelectedAnnotation()` / `useSelectedLink()` | Annotation and link selection state. |
@@ -149,8 +149,8 @@ help, and context-menu modules additionally export their item/section types (`To
149
149
 
150
150
  ## Design notes
151
151
 
152
- - **`<DiagramCanvas>` owns the editor's lifetime.** Created in `useLayoutEffect` so children's effects see the provider value on first paint; disposed on unmount. `initialScene` and `initialMode` are read once — runtime updates go through the editor API (`editor.loadScene`, `editor.setMode`).
153
- - **Hooks subscribe via the editor's `subscribe`.** `Editor.setMode` calls `notify()` so `useMode` (and similar bespoke selectors) re-render on mode changes.
152
+ - **`<DiagramCanvas>` owns the editor's lifetime.** Created in `useLayoutEffect` so children's effects see the provider value on first paint; disposed on unmount. `initialScene` and `initialTool` are read once — runtime updates go through the editor API (`editor.loadScene`, `editor.setActiveTool`).
153
+ - **Hooks subscribe via the editor's `subscribe`.** `Editor.setActiveTool` calls `notify()` so `useActiveTool` (and similar bespoke selectors) re-render on tool changes.
154
154
  - **No global state.** Every editor instance is independent — composition via context lets multiple canvases live on the same page (useful for diff viewers, presentation modes).
155
155
  - **Toolbar item kinds are a discriminated union.** Hosts can mix builtin `mode` / `undo` / `redo` items with arbitrary `action` items in one declarative array.
156
156
  - **Palette uses SVG icons through `dangerouslySetInnerHTML`.** Template authors define the icon markup; the same SVG goes through the canvas renderer's SVG parser, so palette and canvas stay visually identical.