@oh-just-another/diagram 0.1.0 → 0.2.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 +64 -0
- package/README.md +18 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/bindings.d.ts +3 -3
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js +2 -2
- package/dist/bindings.js.map +1 -1
- package/dist/oja-diagram-element.d.ts +4 -4
- package/dist/oja-diagram-element.d.ts.map +1 -1
- package/dist/oja-diagram-element.js +5 -5
- package/dist/oja-diagram-element.js.map +1 -1
- package/dist/oja-diagram.global.js +60 -24
- package/dist/oja-diagram.global.js.map +4 -4
- package/dist/render-worker.js +4 -4
- package/dist/render-worker.js.map +4 -4
- package/dist/styles.generated.d.ts +1 -1
- package/dist/styles.generated.d.ts.map +1 -1
- package/dist/styles.generated.js +1 -1
- package/dist/styles.generated.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# @oh-just-another/diagram
|
|
2
2
|
|
|
3
|
+
## 0.2.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
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [0548ab3]
|
|
29
|
+
- Updated dependencies [762dd8a]
|
|
30
|
+
- Updated dependencies [4722388]
|
|
31
|
+
- Updated dependencies [05707ed]
|
|
32
|
+
- Updated dependencies [20af638]
|
|
33
|
+
- Updated dependencies [84450bc]
|
|
34
|
+
- @oh-just-another/react-ui@0.60.0
|
|
35
|
+
- @oh-just-another/editor@0.61.0
|
|
36
|
+
- @oh-just-another/scene@0.61.0
|
|
37
|
+
|
|
38
|
+
## 0.1.1
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [783749e]
|
|
43
|
+
- Updated dependencies [c189261]
|
|
44
|
+
- Updated dependencies [c189261]
|
|
45
|
+
- Updated dependencies [179bad8]
|
|
46
|
+
- Updated dependencies [1c4941e]
|
|
47
|
+
- Updated dependencies [6d184ad]
|
|
48
|
+
- Updated dependencies [2fbc079]
|
|
49
|
+
- Updated dependencies [ca48e8a]
|
|
50
|
+
- Updated dependencies [bdc847e]
|
|
51
|
+
- Updated dependencies [511a22a]
|
|
52
|
+
- Updated dependencies [a9558d9]
|
|
53
|
+
- Updated dependencies [22b90f9]
|
|
54
|
+
- Updated dependencies [dda2e56]
|
|
55
|
+
- Updated dependencies [34ddb22]
|
|
56
|
+
- Updated dependencies [70a08d8]
|
|
57
|
+
- Updated dependencies [bd2e26c]
|
|
58
|
+
- Updated dependencies [5d8a282]
|
|
59
|
+
- Updated dependencies [71a6c8b]
|
|
60
|
+
- Updated dependencies [71a6c8b]
|
|
61
|
+
- Updated dependencies [7f69f29]
|
|
62
|
+
- Updated dependencies [cf8b735]
|
|
63
|
+
- @oh-just-another/scene@0.60.0
|
|
64
|
+
- @oh-just-another/editor@0.60.0
|
|
65
|
+
- @oh-just-another/react-ui@0.59.0
|
|
66
|
+
|
|
3
67
|
## 0.1.0
|
|
4
68
|
|
|
5
69
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @oh-just-another/diagram
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@oh-just-another/diagram)
|
|
4
|
+
|
|
3
5
|
The diagram editor as a framework-neutral custom element — `<oja-diagram>`.
|
|
4
6
|
|
|
5
7
|
L7 wrapper over `@oh-just-another/editor`. It mounts the React editor inside its own shadow root (styles isolated, floating UI portaled into the same root) and exposes a plain DOM surface — so Vue, Svelte, Angular or a hand-written HTML page all drive it the same way, without touching React. React is bundled in; consumers never install or import it.
|
|
@@ -32,6 +34,8 @@ From a CDN, no bundler:
|
|
|
32
34
|
<oja-diagram grid style="height: 100vh"></oja-diagram>
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
The global bundle (`dist/oja-diagram.global.js`) is ~875 KB raw, ~260 KB gzipped — everything included (React, editor, UI). Budget enforced in CI via `size-limit`.
|
|
38
|
+
|
|
35
39
|
Drive it imperatively:
|
|
36
40
|
|
|
37
41
|
```ts
|
|
@@ -43,20 +47,20 @@ el.loadScene(savedScene);
|
|
|
43
47
|
|
|
44
48
|
## API
|
|
45
49
|
|
|
46
|
-
| Kind | Name
|
|
47
|
-
| --------- |
|
|
48
|
-
| Attribute | `theme`
|
|
49
|
-
| Attribute | `renderer`
|
|
50
|
-
| Attribute | `grid` / `snap`
|
|
51
|
-
| Property | `scene`
|
|
52
|
-
| Property | `editor`
|
|
53
|
-
| Method | `getScene()` / `loadScene(scene)`
|
|
54
|
-
| Method | `undo()` / `redo()` / `zoomToFit()`
|
|
55
|
-
| Method | `
|
|
56
|
-
| Event | `ready`
|
|
57
|
-
| Event | `scenechange`
|
|
58
|
-
| Event | `selectionchange`
|
|
59
|
-
| Event | `themechange`
|
|
50
|
+
| Kind | Name | Notes |
|
|
51
|
+
| --------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
52
|
+
| Attribute | `theme` | `dark` \| `light` \| `system`. |
|
|
53
|
+
| Attribute | `renderer` | `canvas2d` \| `webgl2` \| `offscreen`. Omit to auto-detect. |
|
|
54
|
+
| Attribute | `grid` / `snap` | Boolean — present = on. |
|
|
55
|
+
| Property | `scene` | A `Scene`. Reading returns the current scene; assigning loads it. |
|
|
56
|
+
| Property | `editor` | The live engine (`EditorInstance`), or `null` before `ready`. |
|
|
57
|
+
| Method | `getScene()` / `loadScene(scene)` | Read / replace the scene. |
|
|
58
|
+
| Method | `undo()` / `redo()` / `zoomToFit()` | History and viewport. |
|
|
59
|
+
| Method | `getActiveTool()` / `setActiveTool(tool)`, `getSelection()` / `setSelection(ids)` | Active tool and selection. |
|
|
60
|
+
| Event | `ready` | Fires once the editor mounts; `detail.editor` is the live engine. |
|
|
61
|
+
| Event | `scenechange` | `detail` is the new `Scene`. |
|
|
62
|
+
| Event | `selectionchange` | `detail` is an array of selected element ids. |
|
|
63
|
+
| Event | `themechange` | `detail` is the new theme. |
|
|
60
64
|
|
|
61
65
|
`defineOjaDiagram(tag?)` registers the element (the package does this on import); pass a tag name to register under a different name.
|
|
62
66
|
|