@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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -2
  3. package/canvas.css +2409 -0
  4. package/dist/app.d.ts +605 -0
  5. package/dist/app.d.ts.map +1 -0
  6. package/dist/app.js +4784 -0
  7. package/dist/app.js.map +1 -0
  8. package/dist/dom.d.ts +73 -0
  9. package/dist/dom.d.ts.map +1 -0
  10. package/dist/dom.js +105 -0
  11. package/dist/dom.js.map +1 -0
  12. package/dist/glyphs.d.ts +51 -0
  13. package/dist/glyphs.d.ts.map +1 -0
  14. package/dist/glyphs.js +335 -0
  15. package/dist/glyphs.js.map +1 -0
  16. package/dist/icon-picker.d.ts +205 -0
  17. package/dist/icon-picker.d.ts.map +1 -0
  18. package/dist/icon-picker.js +554 -0
  19. package/dist/icon-picker.js.map +1 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +4 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/inline.d.ts +86 -0
  25. package/dist/inline.d.ts.map +1 -0
  26. package/dist/inline.js +221 -0
  27. package/dist/inline.js.map +1 -0
  28. package/dist/inspector.d.ts +83 -0
  29. package/dist/inspector.d.ts.map +1 -0
  30. package/dist/inspector.js +932 -0
  31. package/dist/inspector.js.map +1 -0
  32. package/dist/layers.d.ts +39 -0
  33. package/dist/layers.d.ts.map +1 -0
  34. package/dist/layers.js +146 -0
  35. package/dist/layers.js.map +1 -0
  36. package/dist/library.d.ts +52 -0
  37. package/dist/library.d.ts.map +1 -0
  38. package/dist/library.js +214 -0
  39. package/dist/library.js.map +1 -0
  40. package/dist/messages/en.d.ts +531 -0
  41. package/dist/messages/en.d.ts.map +1 -0
  42. package/dist/messages/en.js +590 -0
  43. package/dist/messages/en.js.map +1 -0
  44. package/dist/messages/es.d.ts +4 -0
  45. package/dist/messages/es.d.ts.map +1 -0
  46. package/dist/messages/es.js +575 -0
  47. package/dist/messages/es.js.map +1 -0
  48. package/dist/messages/index.d.ts +416 -0
  49. package/dist/messages/index.d.ts.map +1 -0
  50. package/dist/messages/index.js +10 -0
  51. package/dist/messages/index.js.map +1 -0
  52. package/dist/panels.d.ts +87 -0
  53. package/dist/panels.d.ts.map +1 -0
  54. package/dist/panels.js +332 -0
  55. package/dist/panels.js.map +1 -0
  56. package/dist/placement.d.ts +29 -0
  57. package/dist/placement.d.ts.map +1 -0
  58. package/dist/placement.js +93 -0
  59. package/dist/placement.js.map +1 -0
  60. package/dist/presence-layer.d.ts +26 -0
  61. package/dist/presence-layer.d.ts.map +1 -0
  62. package/dist/presence-layer.js +91 -0
  63. package/dist/presence-layer.js.map +1 -0
  64. package/dist/presence.d.ts +105 -0
  65. package/dist/presence.d.ts.map +1 -0
  66. package/dist/presence.js +223 -0
  67. package/dist/presence.js.map +1 -0
  68. package/dist/shape-grid.d.ts +52 -0
  69. package/dist/shape-grid.d.ts.map +1 -0
  70. package/dist/shape-grid.js +194 -0
  71. package/dist/shape-grid.js.map +1 -0
  72. package/dist/story.d.ts +95 -0
  73. package/dist/story.d.ts.map +1 -0
  74. package/dist/story.js +424 -0
  75. package/dist/story.js.map +1 -0
  76. package/dist/tooltip.d.ts +22 -0
  77. package/dist/tooltip.d.ts.map +1 -0
  78. package/dist/tooltip.js +89 -0
  79. package/dist/tooltip.js.map +1 -0
  80. package/dist/view-only.d.ts +21 -0
  81. package/dist/view-only.d.ts.map +1 -0
  82. package/dist/view-only.js +58 -0
  83. package/dist/view-only.js.map +1 -0
  84. 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
- # 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. 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).