@oh-just-another/react-ui 0.59.0 → 0.60.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/CHANGELOG.md +73 -0
- package/README.md +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +1 -1
- package/dist/diagram-canvas.d.ts +2 -2
- package/dist/diagram-canvas.js +1 -1
- package/dist/diagram-root.d.ts +2 -2
- package/dist/diagram-root.js +2 -2
- package/dist/drawing-panel.js +2 -2
- package/dist/drawing-panel.js.map +1 -1
- package/dist/help-dialog.js +2 -2
- package/dist/hooks.d.ts +6 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +7 -2
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/link-caption-editor.d.ts +3 -3
- package/dist/link-caption-editor.d.ts.map +1 -1
- package/dist/link-caption-editor.js +8 -5
- package/dist/link-caption-editor.js.map +1 -1
- package/dist/property-panel.d.ts.map +1 -1
- package/dist/property-panel.js +28 -3
- package/dist/property-panel.js.map +1 -1
- package/dist/toolbar.d.ts +2 -2
- package/dist/toolbar.js +6 -6
- package/dist/toolbar.js.map +1 -1
- package/package.json +8 -8
- package/src/styles.css +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# @oh-just-another/react-ui
|
|
2
2
|
|
|
3
|
+
## 0.60.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0548ab3: Unify the active tool into a single `editor.activeTool` value object (breaking).
|
|
8
|
+
- `state`: `editor.activeTool: ActiveTool` (`{ type, locked, lastActiveTool }`)
|
|
9
|
+
replaces `editor.mode` and `editor.toolLocked`; `setActiveTool(type)` replaces
|
|
10
|
+
`setMode`. `EditorOptions.initialMode` → `initialTool`. The typed `mode` event
|
|
11
|
+
is now `tool` and fires with the `ActiveTool` object on a type switch or a
|
|
12
|
+
lock flip. The action category `"mode"` is now `"tool"`. The vestigial
|
|
13
|
+
`"eyedropper"` mode is removed from `Mode` — colour sampling is armed from
|
|
14
|
+
the colour picker (`beginEyedropperPick`) and never was a toolbar tool.
|
|
15
|
+
- `react-ui`: `useMode()` → `useActiveTool(): ActiveTool`;
|
|
16
|
+
`DiagramRoot`/`DiagramCanvas` prop `initialMode` → `initialTool`.
|
|
17
|
+
- `editor`: `EditorAPI.getMode/setMode` → `getActiveTool/setActiveTool`;
|
|
18
|
+
`initialMode` prop → `initialTool`; re-exports `ActiveTool`.
|
|
19
|
+
- `diagram` (+ vue/svelte/angular wrappers): element methods and controller
|
|
20
|
+
`getMode/setMode` → `getActiveTool/setActiveTool`.
|
|
21
|
+
|
|
22
|
+
Tool ids are unchanged (`"select"`, `"draw-rect"`, …). There are no visible
|
|
23
|
+
behaviour changes — this is an API refactor establishing one source of truth
|
|
24
|
+
for "which tool is active".
|
|
25
|
+
|
|
26
|
+
- 4722388: Editable width for committed brush strokes. `style.strokeWidth` never
|
|
27
|
+
affected brushes (their widths are baked per point), so the property panel's
|
|
28
|
+
Thin/Medium/Thick control silently did nothing for them. A brush-only
|
|
29
|
+
selection now gets a popover range slider driving the new
|
|
30
|
+
`Editor.setBrushWidth(ids, width)`, which scales every baked point width by
|
|
31
|
+
`newWidth / baseWidth` — the stroke keeps its exact pressure profile at the
|
|
32
|
+
new thickness — and records the new `baseWidth`. Legacy strokes without a
|
|
33
|
+
recorded base fall back to their widest point. One undo step.
|
|
34
|
+
- 84450bc: Link captions: measured rounded pill, multiline, correct placement and hit-testing.
|
|
35
|
+
- `scene`: new shared label geometry (`linkLabelAnchor`, `estimateLinkLabelBox`,
|
|
36
|
+
`linkLabelBounds`, `pointAlongPath`) — one source of truth for the renderer,
|
|
37
|
+
hit-testing and culling. `findLinkAt` now also hits inside the caption pill.
|
|
38
|
+
Elbow links place an unpositioned label on the longest segment's midpoint;
|
|
39
|
+
explicit `label.position` is clamped away from the arrowheads. Tunables in
|
|
40
|
+
`constants.ts` (`LINK_LABEL_MAX_WIDTH`, paddings, clearance).
|
|
41
|
+
- `renderer-core`: the caption is a rounded pill sized by real `measureText`
|
|
42
|
+
word-wrap (multiline, `\n` breaks) instead of a square estimated box; it
|
|
43
|
+
rides the drawn geometry (flattened curve for bezier, not the chord), and
|
|
44
|
+
`computeLinkWorldBounds` unions the pill so dirty-rect / viewport culling
|
|
45
|
+
never clip it. `LABEL_POSITION` / `LABEL_FONT_SIZE` constants moved to
|
|
46
|
+
`scene` as `LINK_LABEL_DEFAULT_POSITION` / `LINK_LABEL_DEFAULT_FONT_SIZE`.
|
|
47
|
+
- `state`: `linkLabelWorld` uses the shared anchor, so the inline editor opens
|
|
48
|
+
exactly over the pill (including bezier and elbow links).
|
|
49
|
+
- `react-ui`: the inline caption editor is a multiline textarea — Enter
|
|
50
|
+
commits, Shift+Enter inserts a newline, Escape cancels.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [0548ab3]
|
|
55
|
+
- Updated dependencies [762dd8a]
|
|
56
|
+
- Updated dependencies [4722388]
|
|
57
|
+
- Updated dependencies [05707ed]
|
|
58
|
+
- Updated dependencies [50a2bd4]
|
|
59
|
+
- Updated dependencies [20af638]
|
|
60
|
+
- Updated dependencies [84450bc]
|
|
61
|
+
- Updated dependencies [acd01dc]
|
|
62
|
+
- Updated dependencies [da9d406]
|
|
63
|
+
- Updated dependencies [3c50ef1]
|
|
64
|
+
- Updated dependencies [f960332]
|
|
65
|
+
- Updated dependencies [99f9ab1]
|
|
66
|
+
- Updated dependencies [f9778a1]
|
|
67
|
+
- Updated dependencies [ea2f4e3]
|
|
68
|
+
- @oh-just-another/state@0.61.0
|
|
69
|
+
- @oh-just-another/scene@0.61.0
|
|
70
|
+
- @oh-just-another/renderer-core@0.60.0
|
|
71
|
+
- @oh-just-another/renderer-canvas@0.61.0
|
|
72
|
+
- @oh-just-another/renderer-svg@0.57.4
|
|
73
|
+
- @oh-just-another/templates@0.57.4
|
|
74
|
+
- @oh-just-another/versioning@0.57.4
|
|
75
|
+
|
|
3
76
|
## 0.59.0
|
|
4
77
|
|
|
5
78
|
### 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()}
|
|
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()` / `
|
|
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 `
|
|
153
|
-
- **Hooks subscribe via the editor's `subscribe`.** `Editor.
|
|
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.
|