@meltemi/diagrams-canvas 0.0.0-stage → 1.9.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/LICENSE +21 -0
- package/README.md +64 -2
- package/canvas.css +2409 -0
- package/dist/app.d.ts +605 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +4784 -0
- package/dist/app.js.map +1 -0
- package/dist/dom.d.ts +73 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +105 -0
- package/dist/dom.js.map +1 -0
- package/dist/glyphs.d.ts +51 -0
- package/dist/glyphs.d.ts.map +1 -0
- package/dist/glyphs.js +335 -0
- package/dist/glyphs.js.map +1 -0
- package/dist/icon-picker.d.ts +205 -0
- package/dist/icon-picker.d.ts.map +1 -0
- package/dist/icon-picker.js +554 -0
- package/dist/icon-picker.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/inline.d.ts +86 -0
- package/dist/inline.d.ts.map +1 -0
- package/dist/inline.js +221 -0
- package/dist/inline.js.map +1 -0
- package/dist/inspector.d.ts +83 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +932 -0
- package/dist/inspector.js.map +1 -0
- package/dist/layers.d.ts +39 -0
- package/dist/layers.d.ts.map +1 -0
- package/dist/layers.js +146 -0
- package/dist/layers.js.map +1 -0
- package/dist/library.d.ts +52 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +214 -0
- package/dist/library.js.map +1 -0
- package/dist/messages/en.d.ts +531 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +590 -0
- package/dist/messages/en.js.map +1 -0
- package/dist/messages/es.d.ts +4 -0
- package/dist/messages/es.d.ts.map +1 -0
- package/dist/messages/es.js +575 -0
- package/dist/messages/es.js.map +1 -0
- package/dist/messages/index.d.ts +416 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +10 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/panels.d.ts +87 -0
- package/dist/panels.d.ts.map +1 -0
- package/dist/panels.js +332 -0
- package/dist/panels.js.map +1 -0
- package/dist/placement.d.ts +29 -0
- package/dist/placement.d.ts.map +1 -0
- package/dist/placement.js +93 -0
- package/dist/placement.js.map +1 -0
- package/dist/presence-layer.d.ts +26 -0
- package/dist/presence-layer.d.ts.map +1 -0
- package/dist/presence-layer.js +91 -0
- package/dist/presence-layer.js.map +1 -0
- package/dist/presence.d.ts +105 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +223 -0
- package/dist/presence.js.map +1 -0
- package/dist/shape-grid.d.ts +52 -0
- package/dist/shape-grid.d.ts.map +1 -0
- package/dist/shape-grid.js +194 -0
- package/dist/shape-grid.js.map +1 -0
- package/dist/story.d.ts +95 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/story.js +424 -0
- package/dist/story.js.map +1 -0
- package/dist/tooltip.d.ts +22 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +89 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/view-only.d.ts +21 -0
- package/dist/view-only.d.ts.map +1 -0
- package/dist/view-only.js +58 -0
- package/dist/view-only.js.map +1 -0
- package/package.json +40 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Architecture Studio contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @meltemi/diagrams-canvas
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The canvas: the browser application that draws a diagram beside its code and turns every gesture
|
|
4
|
+
(move, resize, route, label, group, align, play) into a small edit of the text. It runs in a host
|
|
5
|
+
that implements `CanvasHostApi`, such as the VS Code webview or the playground, and styles itself
|
|
6
|
+
with `canvas.css`.
|
|
7
|
+
|
|
8
|
+
It is part of [Meltemi Diagrams](https://github.com/askenaz-dev/meltemi-diagrams#readme), diagrams as code with a canvas, motion and
|
|
9
|
+
exports. Every package of the product has the same version.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @meltemi/diagrams-canvas
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Node 22.12.0 or later. The package is an ES module with type declarations.
|
|
18
|
+
|
|
19
|
+
## Use
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { CanvasApp } from "@meltemi/diagrams-canvas";
|
|
23
|
+
import { resolveLocale, setLocale } from "@meltemi/diagrams-i18n";
|
|
24
|
+
import "@meltemi/diagrams-canvas/canvas.css";
|
|
25
|
+
|
|
26
|
+
// The interface language, English or Spanish, is set before the canvas is created.
|
|
27
|
+
const locale = resolveLocale(navigator.language);
|
|
28
|
+
setLocale(locale);
|
|
29
|
+
document.documentElement.lang = locale;
|
|
30
|
+
// `host` posts canvas messages to the editor services and delivers their answers.
|
|
31
|
+
const app = new CanvasApp(document.getElementById("canvas"), host);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The canvas speaks the interface language of `@meltemi/diagrams-i18n`: its toolbar, palette,
|
|
35
|
+
menus, inspector controls, dialogs, announcements and story timeline. The words the host sends,
|
|
36
|
+
such as field labels and statuses, are shown as they arrive. The page's `lang` lets the stylesheet
|
|
37
|
+
make room for longer words.
|
|
38
|
+
|
|
39
|
+
A host can make the canvas only show by sending `readOnly: true` in the settings of its `settings`
|
|
40
|
+
message (`CanvasSettings`, in `@meltemi/diagrams-editor`); each `settings` message replaces the
|
|
41
|
+
settings as a whole, so a later one without it makes the canvas edit again, with no reload. While
|
|
42
|
+
it is on the canvas sends no message that changes the document, and selection, zoom, pan, the
|
|
43
|
+
minimap, stories and effects keep working ([editor guide](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/editor.md)).
|
|
44
|
+
A host that never sends it, such as the VS Code extension, sees no change.
|
|
45
|
+
|
|
46
|
+
A host that shares the diagram can show who else is in it with `presence` messages (`HostMessage`,
|
|
47
|
+
in `@meltemi/diagrams-editor`): the other people, each with a name, a colour and the ids they have
|
|
48
|
+
selected. The canvas draws an outline in the person's colour around each of those and a tag with
|
|
49
|
+
the name (always text, never markup) on a layer above the scene that is never selected, copied or
|
|
50
|
+
exported and that nothing of is sent back. Each message replaces the last; a message with nobody,
|
|
51
|
+
an empty canvas or another diagram clears it, and ids the diagram does not have are ignored.
|
|
52
|
+
|
|
53
|
+
Popovers, menus, side panels, tooltips and target outlines open and close with short transitions
|
|
54
|
+
on the motion tokens of `canvas.css` (`--mdg-motion-fast`, `--mdg-motion`, `--mdg-motion-slow`,
|
|
55
|
+
`--mdg-ease`). When the system asks for reduced motion they are zero and nothing moves.
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
- [Editor guide](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/editor.md)
|
|
60
|
+
- [Playground](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/playground.md)
|
|
61
|
+
- [All documentation](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/README.md)
|
|
62
|
+
|
|
63
|
+
## Licence
|
|
64
|
+
|
|
65
|
+
MIT. Third-party components and their licences are listed in [THIRD_PARTY_LICENSES.md](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/THIRD_PARTY_LICENSES.md).
|