@oh-just-another/state 0.60.0 → 0.62.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 +110 -0
- package/README.md +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/actions/actionKeyboard.js +2 -2
- package/dist/actions/actionKeyboard.js.map +1 -1
- package/dist/actions/actionMode.d.ts +0 -2
- package/dist/actions/actionMode.d.ts.map +1 -1
- package/dist/actions/actionMode.js +37 -37
- package/dist/actions/actionMode.js.map +1 -1
- package/dist/actions/types.d.ts +1 -1
- package/dist/built-in-handlers.d.ts +8 -0
- package/dist/built-in-handlers.d.ts.map +1 -1
- package/dist/built-in-handlers.js +31 -16
- package/dist/built-in-handlers.js.map +1 -1
- package/dist/constants.d.ts +110 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +111 -4
- package/dist/constants.js.map +1 -1
- package/dist/editor/animation-scene.d.ts.map +1 -1
- package/dist/editor/animation-scene.js +37 -1
- package/dist/editor/animation-scene.js.map +1 -1
- package/dist/editor/event-fanout.d.ts +6 -6
- package/dist/editor/event-fanout.d.ts.map +1 -1
- package/dist/editor/event-fanout.js +8 -8
- package/dist/editor/event-fanout.js.map +1 -1
- package/dist/editor/hit-test.d.ts +8 -0
- package/dist/editor/hit-test.d.ts.map +1 -1
- package/dist/editor/hit-test.js +31 -16
- package/dist/editor/hit-test.js.map +1 -1
- package/dist/editor/link-handle-drag.d.ts +20 -0
- package/dist/editor/link-handle-drag.d.ts.map +1 -1
- package/dist/editor/link-handle-drag.js +71 -2
- package/dist/editor/link-handle-drag.js.map +1 -1
- package/dist/editor/pointer-binding.d.ts.map +1 -1
- package/dist/editor/pointer-binding.js +93 -39
- package/dist/editor/pointer-binding.js.map +1 -1
- package/dist/editor/public/brush.d.ts +69 -8
- package/dist/editor/public/brush.d.ts.map +1 -1
- package/dist/editor/public/brush.js +189 -20
- package/dist/editor/public/brush.js.map +1 -1
- package/dist/editor/public/cursor.js +4 -5
- package/dist/editor/public/cursor.js.map +1 -1
- package/dist/editor/render-orchestrator.d.ts +9 -6
- package/dist/editor/render-orchestrator.d.ts.map +1 -1
- package/dist/editor/render-orchestrator.js +25 -28
- package/dist/editor/render-orchestrator.js.map +1 -1
- package/dist/editor-events.d.ts +5 -5
- package/dist/editor-events.d.ts.map +1 -1
- package/dist/editor.d.ts +64 -19
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +116 -60
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/modes.d.ts +24 -5
- package/dist/modes.d.ts.map +1 -1
- package/dist/modes.js.map +1 -1
- package/dist/overlay.d.ts +7 -19
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +18 -49
- package/dist/overlay.js.map +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,115 @@
|
|
|
1
1
|
# @oh-just-another/state
|
|
2
2
|
|
|
3
|
+
## 0.62.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/renderer-core@0.60.1
|
|
14
|
+
|
|
15
|
+
## 0.61.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 0548ab3: Unify the active tool into a single `editor.activeTool` value object (breaking).
|
|
20
|
+
- `state`: `editor.activeTool: ActiveTool` (`{ type, locked, lastActiveTool }`)
|
|
21
|
+
replaces `editor.mode` and `editor.toolLocked`; `setActiveTool(type)` replaces
|
|
22
|
+
`setMode`. `EditorOptions.initialMode` → `initialTool`. The typed `mode` event
|
|
23
|
+
is now `tool` and fires with the `ActiveTool` object on a type switch or a
|
|
24
|
+
lock flip. The action category `"mode"` is now `"tool"`. The vestigial
|
|
25
|
+
`"eyedropper"` mode is removed from `Mode` — colour sampling is armed from
|
|
26
|
+
the colour picker (`beginEyedropperPick`) and never was a toolbar tool.
|
|
27
|
+
- `react-ui`: `useMode()` → `useActiveTool(): ActiveTool`;
|
|
28
|
+
`DiagramRoot`/`DiagramCanvas` prop `initialMode` → `initialTool`.
|
|
29
|
+
- `editor`: `EditorAPI.getMode/setMode` → `getActiveTool/setActiveTool`;
|
|
30
|
+
`initialMode` prop → `initialTool`; re-exports `ActiveTool`.
|
|
31
|
+
- `diagram` (+ vue/svelte/angular wrappers): element methods and controller
|
|
32
|
+
`getMode/setMode` → `getActiveTool/setActiveTool`.
|
|
33
|
+
|
|
34
|
+
Tool ids are unchanged (`"select"`, `"draw-rect"`, …). There are no visible
|
|
35
|
+
behaviour changes — this is an API refactor establishing one source of truth
|
|
36
|
+
for "which tool is active".
|
|
37
|
+
|
|
38
|
+
- 762dd8a: Brush capture pipeline upgrade: input streamlining (low-pass with commit-time catch-up), speed-simulated pressure for mouse/touch (slow = thick, fast = thin) with rate-limited pen pressure, sample decimation with a soft point cap, and end tapering. `BrushElement` gains an optional regeneration payload (`pressures`, `simulatePressure`, `baseWidth`) carried through serialization; `Editor.beginBrushStroke` accepts a `pointerType` argument to pick the pressure source. The live preview runs the same pipeline as the commit.
|
|
39
|
+
- 4722388: Editable width for committed brush strokes. `style.strokeWidth` never
|
|
40
|
+
affected brushes (their widths are baked per point), so the property panel's
|
|
41
|
+
Thin/Medium/Thick control silently did nothing for them. A brush-only
|
|
42
|
+
selection now gets a popover range slider driving the new
|
|
43
|
+
`Editor.setBrushWidth(ids, width)`, which scales every baked point width by
|
|
44
|
+
`newWidth / baseWidth` — the stroke keeps its exact pressure profile at the
|
|
45
|
+
new thickness — and records the new `baseWidth`. Legacy strokes without a
|
|
46
|
+
recorded base fall back to their widest point. One undo step.
|
|
47
|
+
- 05707ed: Drag the caption pill along its link. With the link selected, dragging the
|
|
48
|
+
pill slides the label along the drawn path (the cursor is projected back onto
|
|
49
|
+
the polyline — new `projectPointToPathT` in scene); within a few pixels of
|
|
50
|
+
the arc-length middle it snaps back to the default placement
|
|
51
|
+
(`label.position` removed, so elbow links regain longest-segment
|
|
52
|
+
auto-placement). One undo step, Escape reverts, double-click still opens the
|
|
53
|
+
inline text editor, and handle dots keep pointer priority over the pill.
|
|
54
|
+
Tunable snap radius: `LINK_LABEL_DRAG_SNAP_PX`.
|
|
55
|
+
- 84450bc: Link captions: measured rounded pill, multiline, correct placement and hit-testing.
|
|
56
|
+
- `scene`: new shared label geometry (`linkLabelAnchor`, `estimateLinkLabelBox`,
|
|
57
|
+
`linkLabelBounds`, `pointAlongPath`) — one source of truth for the renderer,
|
|
58
|
+
hit-testing and culling. `findLinkAt` now also hits inside the caption pill.
|
|
59
|
+
Elbow links place an unpositioned label on the longest segment's midpoint;
|
|
60
|
+
explicit `label.position` is clamped away from the arrowheads. Tunables in
|
|
61
|
+
`constants.ts` (`LINK_LABEL_MAX_WIDTH`, paddings, clearance).
|
|
62
|
+
- `renderer-core`: the caption is a rounded pill sized by real `measureText`
|
|
63
|
+
word-wrap (multiline, `\n` breaks) instead of a square estimated box; it
|
|
64
|
+
rides the drawn geometry (flattened curve for bezier, not the chord), and
|
|
65
|
+
`computeLinkWorldBounds` unions the pill so dirty-rect / viewport culling
|
|
66
|
+
never clip it. `LABEL_POSITION` / `LABEL_FONT_SIZE` constants moved to
|
|
67
|
+
`scene` as `LINK_LABEL_DEFAULT_POSITION` / `LINK_LABEL_DEFAULT_FONT_SIZE`.
|
|
68
|
+
- `state`: `linkLabelWorld` uses the shared anchor, so the inline editor opens
|
|
69
|
+
exactly over the pill (including bezier and elbow links).
|
|
70
|
+
- `react-ui`: the inline caption editor is a multiline textarea — Enter
|
|
71
|
+
commits, Shift+Enter inserts a newline, Escape cancels.
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- 50a2bd4: Fix: with a creation tool active (draw-edge, draw-rect, …) a press on a
|
|
76
|
+
selected shape's edge no longer grabs the shape's resize/rotate handle — it
|
|
77
|
+
starts the new link / element as expected. Selection chrome (resize, rotate,
|
|
78
|
+
group and selected-link endpoint handles) is now pressable only under the
|
|
79
|
+
select tool, and the overlay stops drawing the handles while a creation tool
|
|
80
|
+
is active (outlines stay; the hand tool keeps the chrome visible).
|
|
81
|
+
- 20af638: Fix: the caption pill no longer fights the bend/segment handles. The
|
|
82
|
+
"add waypoint" and elbow segment handles slide out from under the label pill
|
|
83
|
+
along their own span (`getLinkWaypointMidpoints` is label-aware; new shared
|
|
84
|
+
`getElbowSegmentHandles` keeps the drawn dot and the grab point identical), so
|
|
85
|
+
a click on the pill selects the link and a double-click opens the inline
|
|
86
|
+
caption editor. Visible handle dots keep pointer priority — an existing
|
|
87
|
+
waypoint dot sitting inside the pill is still grabbable (dots draw above the
|
|
88
|
+
pill).
|
|
89
|
+
- 3c50ef1: Tile cache honours per-element hide (B12, hide half). `renderViaTiles` accepts
|
|
90
|
+
`hideElements`: tiles bake with the set applied, and an element entering or
|
|
91
|
+
leaving the set invalidates only the tiles it touches — so the stroke-eraser
|
|
92
|
+
preview and per-element visibility no longer drop very large scenes off the
|
|
93
|
+
tile-cache path into a full re-render every frame. Group-isolation dim still
|
|
94
|
+
takes the full path (dimming almost everything would re-rasterise most tiles
|
|
95
|
+
anyway).
|
|
96
|
+
- f960332: Fix: mp4 shapes survive a page reload. The video file-drop handler never
|
|
97
|
+
persisted the bytes into `Scene.files`, so a restored scene had only a dead
|
|
98
|
+
`blob:` URL and nothing to rehydrate from (the "dead-blob-url" renderer
|
|
99
|
+
warning) on every backend. The handler now stores the file (`fileId` on the
|
|
100
|
+
shape), and scene rehydration grew a video branch: it rebuilds the hidden,
|
|
101
|
+
muted, looping `<video>` element from the persisted bytes (shared
|
|
102
|
+
`createHiddenLoopingVideo` factory with the drop handler) and resumes
|
|
103
|
+
playback best-effort. Videos dropped BEFORE this fix have no stored bytes and
|
|
104
|
+
still won't restore — re-add them once.
|
|
105
|
+
- Updated dependencies [762dd8a]
|
|
106
|
+
- Updated dependencies [05707ed]
|
|
107
|
+
- Updated dependencies [20af638]
|
|
108
|
+
- Updated dependencies [84450bc]
|
|
109
|
+
- @oh-just-another/scene@0.61.0
|
|
110
|
+
- @oh-just-another/renderer-core@0.60.0
|
|
111
|
+
- @oh-just-another/history@0.57.4
|
|
112
|
+
|
|
3
113
|
## 0.60.0
|
|
4
114
|
|
|
5
115
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -23,11 +23,11 @@ const editor = new Editor({
|
|
|
23
23
|
mainTarget: layered.get("main"),
|
|
24
24
|
overlayTarget: layered.get("overlay"),
|
|
25
25
|
initialScene: emptyScene(),
|
|
26
|
-
|
|
26
|
+
initialTool: "select",
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
editor.subscribe(() => render());
|
|
30
|
-
editor.
|
|
30
|
+
editor.setActiveTool("draw-rect");
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Concepts
|
|
@@ -36,7 +36,7 @@ editor.setMode("draw-rect");
|
|
|
36
36
|
|
|
37
37
|
The centerpiece controller (`Editor`, `EditorOptions`, `LoadSceneOptions`). It owns the scene, selection, and viewport, and exposes a high-level API spanning:
|
|
38
38
|
|
|
39
|
-
- **Tools
|
|
39
|
+
- **Tools** — `activeTool` (`{ type, locked, lastActiveTool }`, the single source of truth), `setActiveTool`, `setToolLocked` (sticky tool).
|
|
40
40
|
- **Selection** — `selection`, `selectAll`, `deleteSelected`, `moveSelectionBy`, `focusCycle`, plus link selection (`selectedLinks`, `selectedLink`).
|
|
41
41
|
- **History** — `undo`, `redo`, `canUndo`, `canRedo`, `history` (backed by `@oh-just-another/history`).
|
|
42
42
|
- **Hit-testing** — `hitTest(worldPoint)` returns a `PressTarget`; `hitAnnotation`.
|
|
@@ -48,7 +48,7 @@ The centerpiece controller (`Editor`, `EditorOptions`, `LoadSceneOptions`). It o
|
|
|
48
48
|
- **Text editing** — inline caret/selection model: `beginTextEdit`, `commitTextEdit`, `cancelTextEdit`, `setEditingText`, `setTextCaretFromPoint`, `extendTextSelectionToPoint`, `caretIndexAtWorldPoint`, `editingTextOverlay`, plus `createTextAt`.
|
|
49
49
|
- **Image / file insert** — `insertImage`, `addElement`, `beginPlacement`, and a `FileDropRegistry` (see below).
|
|
50
50
|
- **GIF / animation playback** — `togglePlayback`, `hoverAnimatedElement`, `isPlaybackPaused`.
|
|
51
|
-
- **Brush strokes** — `beginBrushStroke
|
|
51
|
+
- **Brush strokes** — `beginBrushStroke` (a `pointerType` argument picks the pressure source: real pen pressure, or speed-simulated for mouse/touch), `extendBrushStroke`, `commitBrushStroke`, `cancelBrushStroke`, `pendingBrushStroke`. Capture streamlines input, decimates samples, and tapers stroke ends on commit; the live preview matches the committed result.
|
|
52
52
|
- **Annotations / comments** — `addAnnotation`, `removeAnnotation`, `toggleAnnotationResolved`, `addComment`, `removeComment`, `setSelectedAnnotation`, `setCommentAuthor`.
|
|
53
53
|
- **Scene lifecycle** — `scene`, `loadScene`.
|
|
54
54
|
|