@oh-just-another/react-ui 0.58.0 → 0.59.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 +104 -0
- package/README.md +3 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/color-swatch-picker.d.ts +8 -1
- package/dist/color-swatch-picker.d.ts.map +1 -1
- package/dist/color-swatch-picker.js +7 -3
- package/dist/color-swatch-picker.js.map +1 -1
- package/dist/constants.d.ts +43 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +8 -4
- package/dist/context-menu.js.map +1 -1
- package/dist/diagram-canvas.d.ts +3 -1
- package/dist/diagram-canvas.d.ts.map +1 -1
- package/dist/diagram-canvas.js +1 -1
- package/dist/diagram-canvas.js.map +1 -1
- package/dist/diagram-root.d.ts +7 -1
- package/dist/diagram-root.d.ts.map +1 -1
- package/dist/diagram-root.js +10 -1
- package/dist/diagram-root.js.map +1 -1
- package/dist/drawing-panel.d.ts +14 -0
- package/dist/drawing-panel.d.ts.map +1 -0
- package/dist/drawing-panel.js +54 -0
- package/dist/drawing-panel.js.map +1 -0
- package/dist/help-dialog.d.ts.map +1 -1
- package/dist/help-dialog.js +9 -2
- package/dist/help-dialog.js.map +1 -1
- package/dist/hooks.d.ts +14 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +14 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/minimap.d.ts +25 -0
- package/dist/minimap.d.ts.map +1 -0
- package/dist/minimap.js +196 -0
- package/dist/minimap.js.map +1 -0
- package/dist/property-panel.d.ts.map +1 -1
- package/dist/property-panel.js +139 -24
- package/dist/property-panel.js.map +1 -1
- package/dist/search-overlay.d.ts +18 -0
- package/dist/search-overlay.d.ts.map +1 -0
- package/dist/search-overlay.js +162 -0
- package/dist/search-overlay.js.map +1 -0
- package/dist/selection-floating-panel.d.ts.map +1 -1
- package/dist/selection-floating-panel.js +5 -2
- package/dist/selection-floating-panel.js.map +1 -1
- package/dist/stats-panel.d.ts +14 -0
- package/dist/stats-panel.d.ts.map +1 -0
- package/dist/stats-panel.js +104 -0
- package/dist/stats-panel.js.map +1 -0
- package/dist/toolbar.d.ts.map +1 -1
- package/dist/toolbar.js +22 -8
- package/dist/toolbar.js.map +1 -1
- package/dist/zen-mode.d.ts +30 -0
- package/dist/zen-mode.d.ts.map +1 -0
- package/dist/zen-mode.js +62 -0
- package/dist/zen-mode.js.map +1 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# @oh-just-another/react-ui
|
|
2
2
|
|
|
3
|
+
## 0.59.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1c4941e: New `<DrawingPanel>` — a floating tool-options panel that appears while the brush or eraser is active. It edits `editor.brushSettings` (via the new `useBrushSettings` hook): line colour, enclosed-fill colour, opacity and width for the brush; only the width (which doubles as the eraser radius) for the eraser. `<Diagram>` mounts it automatically top-right, hidden in zen mode; opt out with the new `hideDrawingPanel` prop. This is a functional scaffold intended for restyling.
|
|
8
|
+
- ca48e8a: Add two interaction tools: an eraser (mode `erase`, hotkey `E`) and a laser pointer (mode `laser`, hotkey `K`).
|
|
9
|
+
- Eraser: press-and-drag sweeps shapes under the cursor into a pending set (previewed dimmed) and deletes them all in one undo step on release. Attached links are removed with their shapes, like a Delete-key delete.
|
|
10
|
+
- Laser pointer: press-and-drag paints an ephemeral red trail that fades over a couple of seconds. Nothing is written to the scene or history — it lives purely on the overlay. Available in read-only mode. Collab replication of trails is a follow-up.
|
|
11
|
+
|
|
12
|
+
Both tools appear in the default toolbar (`DEFAULT_TOOLBAR` / `DEFAULT_VERTICAL_TOOLBAR`) and are registered as `mode-erase` / `mode-laser` actions. TTL, colour and width of the laser trail are tunable via `state/constants.ts`.
|
|
13
|
+
|
|
14
|
+
- bdc847e: Add four editor tools:
|
|
15
|
+
- **Eyedropper** — new `eyedropper` mode (toolbar button, `Alt+I`). Click a
|
|
16
|
+
shape to sample its fill/stroke and apply it to the selection.
|
|
17
|
+
`Editor.pickColorAt` / `applyEyedropperAt` + pure `pickColorAt`.
|
|
18
|
+
- **Convert element type** — `Editor.convertSelection(target)` and pure
|
|
19
|
+
`computeConvertType` switch rectangle ↔ ellipse ↔ diamond (polygon) in place,
|
|
20
|
+
preserving position/size/style. New "Shape type" property-panel control.
|
|
21
|
+
- **Image crop** — optional normalised `crop` rect on `ImageElement` (additive,
|
|
22
|
+
serialised). New `crop` mode entered by double-clicking an image or the
|
|
23
|
+
property-panel Crop button: drag a frame, `Enter` to apply, `Esc` to cancel.
|
|
24
|
+
Canvas2D renders the cropped source region (`RenderTarget.drawImage` gains an
|
|
25
|
+
optional `crop` arg). `Editor.beginImageCrop` / `commitImageCrop` /
|
|
26
|
+
`cancelImageCrop` + pure `computeSetImageCrop` / `cropRectFromWorldDrag`.
|
|
27
|
+
- **Flowchart auto-generate** — `Cmd/Ctrl+Alt+Arrow` spawns a connected node
|
|
28
|
+
from the selected node in that direction. `Editor.spawnConnectedNode` + pure
|
|
29
|
+
`computeSpawnConnectedNode`.
|
|
30
|
+
|
|
31
|
+
Also exposes `worldToLocal` from `@oh-just-another/scene`.
|
|
32
|
+
|
|
33
|
+
- 511a22a: The eyedropper is no longer a standalone toolbar tool (its palette button and the `Alt+I` hotkey / `mode-eyedropper` action are removed). Instead, every colour picker (`ColorSwatchPicker`) gains an optional pipette button via a new `onEyedrop` prop: clicking it arms `Editor.beginEyedropperPick(onPick)` and the next canvas click samples the colour of the shape under the cursor straight into that swatch — without changing the current tool mode. New editor API: `beginEyedropperPick` and the `isEyedropperArmed` flag; the cursor shows a crosshair while armed.
|
|
34
|
+
- dda2e56: Add a `<Minimap>` component (react-ui) — a small overview canvas that renders the whole scene with a frame for the current viewport; click / drag to pan the main view. Add `exportMermaid(scene)` (importers) — writes a `flowchart TD` string (inverse of `importMermaid`), round-tripping node + edge structure and emitting `%% skipped: <type>` comments for non-graph elements.
|
|
35
|
+
- 70a08d8: Read-only chrome. `<DiagramRoot>` / `<DiagramCanvas>` accept a `readOnly` prop (applied on mount and synced on change), a new `useReadOnly()` hook exposes the flag reactively, and the `<Toolbar>` disables creation / mutation tools (draw modes, insert-image, tool-lock, undo/redo) in read-only while keeping select / hand live.
|
|
36
|
+
- 7f69f29: Add scene text search, a stats/dimensions overlay, and zen mode.
|
|
37
|
+
- `state`: `searchScene(scene, query)` / `elementSearchText(element)` — a pure, case-insensitive substring index over text shapes, frame names, and edge labels; plus `Editor.selectLink(id)` to programmatically select a single connector.
|
|
38
|
+
- `react-ui`: `<SearchOverlay>` (⌘F) finds and frames matching text with next/prev navigation; `<StatsPanel>` (⌥/) shows the selection's x/y/w/h/angle and scene totals; `<ZenModeProvider>` / `useZenMode` (⌥Z, Esc to exit) hides chrome for focused work. All three are wired into `<Editor>` from `@oh-just-another/editor`.
|
|
39
|
+
|
|
40
|
+
- cf8b735: Add styled text runs (rich text, phase 1): a `TextElement` can now carry an optional `runs` overlay — contiguous substrings each with a partial `TextStyle` (bold / italic / colour / decoration) over the element's base style. The flat `text` stays the source of truth (`runs.map(r => r.text).join("") === text`), so plain-text scenes render, serialise and round-trip byte-for-byte unchanged.
|
|
41
|
+
- `scene`: `TextRun` type + `TextElement.runs?`; pure helpers `runsToText`, `normalizeRuns`, `sliceRuns`, and `applyStyleToRange(el, from, to, partial)` (splits/merges/coalesces runs, sheds the overlay when uniform).
|
|
42
|
+
- `serialization`: additive optional `runs` in the text schema; legacy documents (no `runs`) round-trip unchanged.
|
|
43
|
+
- `renderer-core`: the text renderer draws each visual line's style segments with per-run font + fill through the shared `RenderTarget`, so Canvas2D, WebGL2 and SVG all honour runs. Line breaking still uses the element's base metrics.
|
|
44
|
+
- `state`: `Editor.applyTextStyleToRange(id, from, to, partial)` applies a style to a character range as one undo step.
|
|
45
|
+
- `react-ui`: the text formatting controls (bold / italic / underline / strikethrough / colour) target the current inline-edit selection when one is active — styling just those characters — and fall back to whole-element styling otherwise.
|
|
46
|
+
|
|
47
|
+
Full inline rich-text editing (per-run wrap metrics, caret-aware run editing) is a follow-up.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- a9558d9: Reworked flowchart keyboard model. Arrow-key bindings are reworked and disambiguated by modifier: `Arrow` nudges (unchanged); `Cmd/Ctrl+Arrow` grows a flowchart CREATE session (each press adds a pending connected sibling, previewed on the overlay, committed as one undo step when Cmd/Ctrl is released, cancelled on Escape); `Alt+Arrow` navigates to the adjacent node (graph neighbour, else spatially nearest); `Cmd/Ctrl+Shift+Arrow` aligns (moved off the old plain `Alt+Arrow`). The old `Cmd/Ctrl+Alt+Arrow` spawn binding is retired.
|
|
52
|
+
|
|
53
|
+
New API: `editor.growFlowchart` / `commitFlowchart` / `cancelFlowchart` / `navigateFlowchart` / `flowchartPreview`, the pure `computeSpawnConnectedNodes`, and `endpointElementId` (scene). `<Diagram>` wires the keyup-commit / Escape-cancel lifecycle for you.
|
|
54
|
+
|
|
55
|
+
- 22b90f9: The keyboard-shortcuts help dialog now lists every real binding. The `arrange` category (align / flip / distribute) was missing from the dialog's category order and is now shown, and keyTest-driven bindings (nudge arrows, Enter edit/create, plus flowchart create/navigate) surface their chips via a new display-only `Action.displayHotkey` field instead of rendering as "—". `displayHotkey` is never dispatched (only `hotkey`/`keyTest`/`sequence` are), which also closes a latent hole where a display matcher could fire a Ctrl-modified combo the `keyTest` deliberately excluded.
|
|
56
|
+
- 34ddb22: The minimap now supports wheel zoom: scrolling over it zooms the main view into the world spot under the cursor (recentering there first, matching its click-to-pan), using the same delta→factor curve as the main canvas. The handler is a non-passive listener so it doesn't scroll the page, and doesn't interfere with click/drag panning. Tunable via `MINIMAP_WHEEL_ZOOM_SPEED` / `MINIMAP_WHEEL_ZOOM_MAX_STEP`.
|
|
57
|
+
- bd2e26c: Make read-only (view) mode a true guard. Every mutating `Editor` method reachable from the UI (`updateStyle`, `updateTextProps`, `deleteSelected`, `duplicateSelected`, group/ungroup, align/flip/distribute, z-order, `moveSelectionBy`, `setLink`, `convertSelection`, `clear`, etc.) is now a no-op while `readOnly` is set, backstopping direct panel/hotkey calls that previously bypassed the pointer-level gate. The overlay keeps the selection outline (halo) but no longer paints resize/rotate/group handles or link endpoint grips in read-only, and the property panel / selection floating panel / mutating context-menu entries are hidden. `copy` / `copy-style` are flagged view-safe so they stay live.
|
|
58
|
+
- 5d8a282: Fix the bold / italic / underline / strikethrough toggles in the text style popover never applying to an in-edit text selection. The toggle button was a component defined inside `TextDecorationControl`, so it got a fresh identity on every panel re-render; during inline text editing the panel re-renders continuously (caret blink), and a remount between `mousedown` and `mouseup` swallowed the synthesized `click`. Hoisted the toggle to a stable module-level component so the button persists across re-renders and the click fires. Colour was unaffected (it goes through a stable control).
|
|
59
|
+
- 71a6c8b: Fix the search bar (⌘F) jumping to a match the moment it opens, before the user types anything. The query was retained across close/open, so reopening re-ran the reveal effect against the stale query and framed the previous match. The query and active index are now reset on close, so the bar always opens empty and only navigates once the user types.
|
|
60
|
+
- 71a6c8b: Search navigation no longer blows a small match up to fill the whole canvas. Jumping to a match now centers it while preserving the current zoom, only zooming out when the match is too large to fit — a small element stays small and just lands in the center. Adds `Editor.revealSelection(padding)` and the pure `computeRevealBounds` helper (never zooms in, unlike `zoomToSelection`'s fit-to-fill).
|
|
61
|
+
- Updated dependencies [783749e]
|
|
62
|
+
- Updated dependencies [c189261]
|
|
63
|
+
- Updated dependencies [c189261]
|
|
64
|
+
- Updated dependencies [c189261]
|
|
65
|
+
- Updated dependencies [641842b]
|
|
66
|
+
- Updated dependencies [c189261]
|
|
67
|
+
- Updated dependencies [c58054b]
|
|
68
|
+
- Updated dependencies [b156869]
|
|
69
|
+
- Updated dependencies [0d3934e]
|
|
70
|
+
- Updated dependencies [0d3934e]
|
|
71
|
+
- Updated dependencies [b0a9f3b]
|
|
72
|
+
- Updated dependencies [571f13b]
|
|
73
|
+
- Updated dependencies [ca48e8a]
|
|
74
|
+
- Updated dependencies [1975a9b]
|
|
75
|
+
- Updated dependencies [1975a9b]
|
|
76
|
+
- Updated dependencies [bdc847e]
|
|
77
|
+
- Updated dependencies [511a22a]
|
|
78
|
+
- Updated dependencies [a9558d9]
|
|
79
|
+
- Updated dependencies [22b90f9]
|
|
80
|
+
- Updated dependencies [99b5bee]
|
|
81
|
+
- Updated dependencies [f381039]
|
|
82
|
+
- Updated dependencies [394d3ce]
|
|
83
|
+
- Updated dependencies [295f38b]
|
|
84
|
+
- Updated dependencies [bd2e26c]
|
|
85
|
+
- Updated dependencies [97de2fd]
|
|
86
|
+
- Updated dependencies [407f203]
|
|
87
|
+
- Updated dependencies [744f4b8]
|
|
88
|
+
- Updated dependencies [71a6c8b]
|
|
89
|
+
- Updated dependencies [7f69f29]
|
|
90
|
+
- Updated dependencies [dde8279]
|
|
91
|
+
- Updated dependencies [cec8f83]
|
|
92
|
+
- Updated dependencies [1975a9b]
|
|
93
|
+
- Updated dependencies [1975a9b]
|
|
94
|
+
- Updated dependencies [1975a9b]
|
|
95
|
+
- Updated dependencies [1975a9b]
|
|
96
|
+
- Updated dependencies [cf8b735]
|
|
97
|
+
- Updated dependencies [571f13b]
|
|
98
|
+
- Updated dependencies [f8302c3]
|
|
99
|
+
- @oh-just-another/scene@0.60.0
|
|
100
|
+
- @oh-just-another/state@0.60.0
|
|
101
|
+
- @oh-just-another/renderer-core@0.59.0
|
|
102
|
+
- @oh-just-another/renderer-canvas@0.60.0
|
|
103
|
+
- @oh-just-another/renderer-svg@0.57.3
|
|
104
|
+
- @oh-just-another/templates@0.57.3
|
|
105
|
+
- @oh-just-another/versioning@0.57.3
|
|
106
|
+
|
|
3
107
|
## 0.58.0
|
|
4
108
|
|
|
5
109
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @oh-just-another/react-ui
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@oh-just-another/react-ui)
|
|
4
|
+
|
|
3
5
|
React 18+ wrappers around the editor — `DiagramCanvas`, `Toolbar`, `Palette`, `PropertyPanel`, plus a small set of hooks. Mount it with three lines of JSX, customize with hooks for everything else.
|
|
4
6
|
|
|
5
7
|
The React binding layer (L5) over `@oh-just-another/state`; needs React + DOM. For a single drop-in component, use `@oh-just-another/editor`.
|
|
@@ -47,6 +49,7 @@ Every component reads the editor from context, so most take no required props.
|
|
|
47
49
|
| `TopBar` / `BottomBar` | Edge-anchored bars for toolbars and status chrome. |
|
|
48
50
|
| `Sidebar` | Collapsible side container for panels. |
|
|
49
51
|
| `BottomSheet` | Sliding bottom container (touch / mobile layouts). |
|
|
52
|
+
| `Minimap` | Overview canvas with a viewport frame; click / drag to pan. |
|
|
50
53
|
|
|
51
54
|
### Toolbar & zoom
|
|
52
55
|
|