@diagrammo/dgmo-standalone 0.64.0 → 0.65.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 +105 -0
- package/dist/auto.css +11 -0
- package/dist/auto.js +140 -129
- package/dist/element.js +142 -131
- package/package.json +4 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diagrammo LLC
|
|
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
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @diagrammo/dgmo-standalone
|
|
2
|
+
|
|
3
|
+
**Diagrams in a plain web page. One `<script>` tag, no build step.**
|
|
4
|
+
|
|
5
|
+
Write a diagram as text, get an SVG. No npm install, no bundler, no framework —
|
|
6
|
+
paste a script tag into a page you already have.
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/npm/@diagrammo/dgmo-standalone/dist/element.js"></script>
|
|
10
|
+
|
|
11
|
+
<dgmo-diagram palette="slate">pie Crew Rations
|
|
12
|
+
|
|
13
|
+
Salt Pork: 34
|
|
14
|
+
Hardtack: 28
|
|
15
|
+
Rum: 17
|
|
16
|
+
Limes: 21</dgmo-diagram>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
That is the whole install.
|
|
20
|
+
|
|
21
|
+
## Two ways in
|
|
22
|
+
|
|
23
|
+
**`element.js`** gives you a `<dgmo-diagram>` element to write in your own
|
|
24
|
+
markup — use it when you control the HTML.
|
|
25
|
+
|
|
26
|
+
**`auto.js`** scans the page for `<pre class="dgmo">` blocks and draws them —
|
|
27
|
+
use it when you *don't* control the HTML, which is the usual case with markdown,
|
|
28
|
+
a CMS, or a static-site generator emitting ```` ```dgmo ```` fences.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/@diagrammo/dgmo-standalone/dist/auto.js"></script>
|
|
32
|
+
|
|
33
|
+
<pre class="dgmo">bar Ship Stores
|
|
34
|
+
|
|
35
|
+
Salt Pork 34
|
|
36
|
+
Hardtack 28
|
|
37
|
+
Rum 17</pre>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Load one or the other, not both — each carries a complete copy of the renderer.
|
|
41
|
+
|
|
42
|
+
Optional styling for the auto-scanner lives at `dist/auto.css`; the element
|
|
43
|
+
brings its own.
|
|
44
|
+
|
|
45
|
+
## Pinning a version
|
|
46
|
+
|
|
47
|
+
The examples above float to the latest release, which is fine for a demo and a
|
|
48
|
+
poor idea for a page you will not revisit. Pin it:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<!-- replace VERSION with the number shown at the top of this npm page -->
|
|
52
|
+
<script src="https://cdn.jsdelivr.net/npm/@diagrammo/dgmo-standalone@VERSION/dist/element.js"></script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
unpkg works the same way — swap the host for `unpkg.com/`.
|
|
56
|
+
|
|
57
|
+
## What you get
|
|
58
|
+
|
|
59
|
+
40+ chart types from one text format: flowcharts, sequence diagrams,
|
|
60
|
+
timelines, org charts, gantt, maps, and the usual bar/line/pie family. The
|
|
61
|
+
renderer infers the chart type from what you wrote, so there is one syntax to
|
|
62
|
+
learn rather than one per chart.
|
|
63
|
+
|
|
64
|
+
Themes and palettes are attributes — `palette="slate"`, `theme="dark"`. Maps
|
|
65
|
+
fetch their basemaps on demand from `@diagrammo/dgmo` on the same CDN, so a page
|
|
66
|
+
with no map downloads no map data.
|
|
67
|
+
|
|
68
|
+
## Watching a diagram somebody showed you
|
|
69
|
+
|
|
70
|
+
If someone published a diagram at Diagrammo — *showed it on the web* — you can
|
|
71
|
+
watch it from any page, and every reader gets the version its author has now:
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/@diagrammo/dgmo-standalone/dist/element.js"></script>
|
|
75
|
+
|
|
76
|
+
<dgmo-diagram watch="https://online.diagrammo.app/d/dgm_7f2a91"></dgmo-diagram>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Paste the share link you were sent, or just the id at the end of it. The
|
|
80
|
+
diagram is fetched when the page loads — there is no polling, so a page left
|
|
81
|
+
open shows what it fetched on arrival until it is reloaded.
|
|
82
|
+
|
|
83
|
+
If your page sends a `Content-Security-Policy` header, it needs
|
|
84
|
+
`connect-src https://api.diagrammo.app` or the browser will block the request.
|
|
85
|
+
That case is not silent: the element draws a card naming the diagram and says
|
|
86
|
+
what went wrong, as it does when a diagram is missing or its author has stopped
|
|
87
|
+
showing it.
|
|
88
|
+
|
|
89
|
+
## When you want a different package
|
|
90
|
+
|
|
91
|
+
This one exists for the no-build case. Reach for a sibling instead when:
|
|
92
|
+
|
|
93
|
+
- **You are using npm and a bundler** → [`@diagrammo/dgmo`](https://www.npmjs.com/package/@diagrammo/dgmo), the library. It does not contain these two files, deliberately: they are a complete renderer twice over, and shipping them to every `npm install` meant 39% of the tarball for something no `import` could reach.
|
|
94
|
+
- **You are rendering markdown at build time** → [`remark-dgmo`](https://www.npmjs.com/package/remark-dgmo) and its wrappers for Astro, Docusaurus, Fumadocs, Nextra and VitePress. They draw the SVG during the build, so the reader downloads a picture and no renderer at all.
|
|
95
|
+
- **You want it on the command line** → [`@diagrammo/dgmo-cli`](https://www.npmjs.com/package/@diagrammo/dgmo-cli), or `brew install dgmo`.
|
|
96
|
+
|
|
97
|
+
## Links
|
|
98
|
+
|
|
99
|
+
- **Language reference and gallery** — <https://diagrammo.app>
|
|
100
|
+
- **Try it in the browser** — <https://online.diagrammo.app>
|
|
101
|
+
- **Issues** — <https://github.com/diagrammo/dgmo/issues>
|
|
102
|
+
|
|
103
|
+
MIT licensed — the full text is in `LICENSE`, in this package. Labels are drawn
|
|
104
|
+
in [Inter](https://rsms.me/inter/) when your page already provides it, falling
|
|
105
|
+
back to the system interface font; no font files are bundled.
|
package/dist/auto.css
CHANGED
|
@@ -26,6 +26,17 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
26
26
|
font-family: ui-monospace, monospace;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* A watched diagram that could not be drawn: the reference card, then this
|
|
30
|
+
sentence. Deliberately not styled as an error — a publisher who stopped
|
|
31
|
+
showing a diagram did something on purpose, and a red box would tell the
|
|
32
|
+
reader the page is broken. */
|
|
33
|
+
.dgmo--live-state .dgmo-live-note {
|
|
34
|
+
margin: 0.5em 0 0;
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
line-height: 1.5;
|
|
37
|
+
opacity: 0.8;
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
/* @diagrammo/dgmo block — standard embed chrome.
|
|
30
41
|
* Override the [data-theme="dark"] selectors if your site uses .dark or
|
|
31
42
|
* another color-mode convention. */
|