@meltemi/diagrams-canvas 0.0.0-stage → 1.10.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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -2
  3. package/canvas.css +3008 -0
  4. package/dist/add-icons.d.ts +137 -0
  5. package/dist/add-icons.d.ts.map +1 -0
  6. package/dist/add-icons.js +387 -0
  7. package/dist/add-icons.js.map +1 -0
  8. package/dist/app.d.ts +762 -0
  9. package/dist/app.d.ts.map +1 -0
  10. package/dist/app.js +5698 -0
  11. package/dist/app.js.map +1 -0
  12. package/dist/dom.d.ts +75 -0
  13. package/dist/dom.d.ts.map +1 -0
  14. package/dist/dom.js +107 -0
  15. package/dist/dom.js.map +1 -0
  16. package/dist/glyphs.d.ts +56 -0
  17. package/dist/glyphs.d.ts.map +1 -0
  18. package/dist/glyphs.js +407 -0
  19. package/dist/glyphs.js.map +1 -0
  20. package/dist/icon-picker.d.ts +210 -0
  21. package/dist/icon-picker.d.ts.map +1 -0
  22. package/dist/icon-picker.js +565 -0
  23. package/dist/icon-picker.js.map +1 -0
  24. package/dist/index.d.ts +4 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +4 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/inline.d.ts +86 -0
  29. package/dist/inline.d.ts.map +1 -0
  30. package/dist/inline.js +221 -0
  31. package/dist/inline.js.map +1 -0
  32. package/dist/inspector.d.ts +168 -0
  33. package/dist/inspector.d.ts.map +1 -0
  34. package/dist/inspector.js +1246 -0
  35. package/dist/inspector.js.map +1 -0
  36. package/dist/layers.d.ts +39 -0
  37. package/dist/layers.d.ts.map +1 -0
  38. package/dist/layers.js +146 -0
  39. package/dist/layers.js.map +1 -0
  40. package/dist/library.d.ts +58 -0
  41. package/dist/library.d.ts.map +1 -0
  42. package/dist/library.js +223 -0
  43. package/dist/library.js.map +1 -0
  44. package/dist/messages/en.d.ts +589 -0
  45. package/dist/messages/en.d.ts.map +1 -0
  46. package/dist/messages/en.js +645 -0
  47. package/dist/messages/en.js.map +1 -0
  48. package/dist/messages/es.d.ts +4 -0
  49. package/dist/messages/es.d.ts.map +1 -0
  50. package/dist/messages/es.js +619 -0
  51. package/dist/messages/es.js.map +1 -0
  52. package/dist/messages/index.d.ts +463 -0
  53. package/dist/messages/index.d.ts.map +1 -0
  54. package/dist/messages/index.js +10 -0
  55. package/dist/messages/index.js.map +1 -0
  56. package/dist/panels.d.ts +87 -0
  57. package/dist/panels.d.ts.map +1 -0
  58. package/dist/panels.js +332 -0
  59. package/dist/panels.js.map +1 -0
  60. package/dist/placement.d.ts +29 -0
  61. package/dist/placement.d.ts.map +1 -0
  62. package/dist/placement.js +93 -0
  63. package/dist/placement.js.map +1 -0
  64. package/dist/presence-layer.d.ts +62 -0
  65. package/dist/presence-layer.d.ts.map +1 -0
  66. package/dist/presence-layer.js +211 -0
  67. package/dist/presence-layer.js.map +1 -0
  68. package/dist/presence.d.ts +152 -0
  69. package/dist/presence.d.ts.map +1 -0
  70. package/dist/presence.js +292 -0
  71. package/dist/presence.js.map +1 -0
  72. package/dist/shape-grid.d.ts +52 -0
  73. package/dist/shape-grid.d.ts.map +1 -0
  74. package/dist/shape-grid.js +194 -0
  75. package/dist/shape-grid.js.map +1 -0
  76. package/dist/story.d.ts +95 -0
  77. package/dist/story.d.ts.map +1 -0
  78. package/dist/story.js +424 -0
  79. package/dist/story.js.map +1 -0
  80. package/dist/tooltip.d.ts +22 -0
  81. package/dist/tooltip.d.ts.map +1 -0
  82. package/dist/tooltip.js +89 -0
  83. package/dist/tooltip.js.map +1 -0
  84. package/dist/trail.d.ts +60 -0
  85. package/dist/trail.d.ts.map +1 -0
  86. package/dist/trail.js +107 -0
  87. package/dist/trail.js.map +1 -0
  88. package/dist/view-only.d.ts +21 -0
  89. package/dist/view-only.d.ts.map +1 -0
  90. package/dist/view-only.js +61 -0
  91. package/dist/view-only.js.map +1 -0
  92. 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,78 @@
1
- # Temporary Holding Version
1
+ # @meltemi/diagrams-canvas
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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. A person may also have a `pointer` (`{ x, y }` in
51
+ diagram units): the canvas draws a cursor in their colour with the name at its tail, which glides
52
+ to the next point in 200 ms and keeps its size at every zoom. Each message replaces the last; a
53
+ message with nobody, an empty canvas or another diagram clears it, and ids the diagram does not
54
+ have, and pointers that are not two finite numbers, are ignored. Once a host has sent `presence`,
55
+ the canvas tells it where the person's own pointer is with `presencePointer` messages (diagram
56
+ units and the diagram's id, `null` when it leaves), at most every 50 ms.
57
+
58
+ The Pointer tool (K, or its toggle before the grid's) draws a trail that fades in 800 ms and edits
59
+ nothing, on every canvas, read-only ones included; the trail is no part of the document or of any
60
+ export. In the colour of the person: the `me: { colour }` of the last `presence` message, else the
61
+ render's `colors.accent`. A person's `laser` (`{ batch, points }`, at most 64 points `{ x, y, t }`,
62
+ `t` in milliseconds since the batch's first point) is drawn once per `batch` as that person's trail,
63
+ and the canvas posts the points of the person's own strokes with `presenceLaser` messages to a host
64
+ that has sent `presence`, at most every 50 ms.
65
+
66
+ Popovers, menus, side panels, tooltips and target outlines open and close with short transitions
67
+ on the motion tokens of `canvas.css` (`--mdg-motion-fast`, `--mdg-motion`, `--mdg-motion-slow`,
68
+ `--mdg-ease`). When the system asks for reduced motion they are zero and nothing moves.
69
+
70
+ ## Documentation
71
+
72
+ - [Editor guide](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/editor.md)
73
+ - [Playground](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/playground.md)
74
+ - [All documentation](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/README.md)
75
+
76
+ ## Licence
77
+
78
+ 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).