@diagrammo/dgmo 0.35.0 → 0.36.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/.claude/commands/dgmo.md +24 -11
- package/SKILL.md +11 -6
- package/dist/advanced.cjs +2 -2
- package/dist/advanced.js +2 -2
- package/dist/auto.cjs +3 -3
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/docs/ai-integration.md +3 -1
- package/package.json +1 -1
package/.claude/commands/dgmo.md
CHANGED
|
@@ -63,7 +63,20 @@ For **examples** of real diagrams, call `mcp__dgmo__get_examples("<type>")` —
|
|
|
63
63
|
|
|
64
64
|
## Your Workflow
|
|
65
65
|
|
|
66
|
-
**Primary goal: get the user seeing a visualization as fast as possible.**
|
|
66
|
+
**Primary goal: get the user seeing a visualization as fast as possible — in the desktop app if they have it, otherwise on the web.**
|
|
67
|
+
|
|
68
|
+
### Where the diagram goes — decide this once per session
|
|
69
|
+
|
|
70
|
+
Before showing the first diagram, call `mcp__dgmo__check_app_installed()` **once** and remember the answer for the rest of the session. It decides your default visual output:
|
|
71
|
+
|
|
72
|
+
- **App installed → open the saved file live in the app.** Save the `.dgmo` source first (see "Always save the source"), then `mcp__dgmo__open_in_app({ dgmo, filePath: "<absolute path to the saved file>" })`. The app opens *that file*, so the user edits it in the app and changes autosave back to the same file — one source of truth, live re-render. Do NOT open an online URL and do NOT render a PNG.
|
|
73
|
+
- **App not installed → open the online editor.** `mcp__dgmo__share_diagram(dgmo)` then `open <url>` in the shell. This lands the user on online.diagrammo.app with the chart and the code side-by-side, tweakable and shareable. Don't just print the URL — always `open` it.
|
|
74
|
+
|
|
75
|
+
**Always save the source.** Whether or not the app is installed, write the diagram to `<name>.dgmo` in the current project/working directory so the user always has one editable artifact. Use a short kebab-case name from the diagram's title (e.g. `checkout-flow.dgmo`). This file IS the deliverable; the app or URL just displays it.
|
|
76
|
+
|
|
77
|
+
**Never render an image unless the user explicitly asks** (see "Image output"). A PNG/SVG is not a default output — don't create files the user didn't request.
|
|
78
|
+
|
|
79
|
+
Don't ask the user how they want to view the diagram — the check above decides it. They can ask for a PNG, the desktop app, or a share URL explicitly if they want something else.
|
|
67
80
|
|
|
68
81
|
### Creating a new diagram
|
|
69
82
|
|
|
@@ -71,14 +84,12 @@ For **examples** of real diagrams, call `mcp__dgmo__get_examples("<type>")` —
|
|
|
71
84
|
2. **Get syntax + examples** — call `mcp__dgmo__get_language_reference("<type>")` and `mcp__dgmo__get_examples("<type>")`.
|
|
72
85
|
3. **Write the `.dgmo` content** — compose the markup.
|
|
73
86
|
4. **Validate first** — call `mcp__dgmo__validate_diagram(dgmo)` to catch syntax errors before rendering. If errors come back, fix them and validate again.
|
|
74
|
-
5. **
|
|
75
|
-
|
|
76
|
-
**Exception — image-output intent detected:** if the user's prompt explicitly asks for an image or saved file (phrases like "save as PNG", "export to SVG", "make an image", "render to a file", "give me a png", "I need an SVG"), skip the share URL and go straight to `mcp__dgmo__render_diagram` (see "Image output" below). The detection is intent-based, not keyword-strict — if in doubt, default to share URL and offer "Want me to save as PNG/SVG instead?"
|
|
87
|
+
5. **Save the source** — write the validated markup to `<name>.dgmo` in the working directory.
|
|
88
|
+
6. **Show it** — per "Where the diagram goes": app installed → `mcp__dgmo__open_in_app({ dgmo, filePath })`; not installed → `mcp__dgmo__share_diagram(dgmo)` + `open <url>`.
|
|
77
89
|
|
|
78
|
-
|
|
79
|
-
6. **Save the source file** (if working in a project) — write it to `<name>.dgmo` so the user has an editable copy.
|
|
90
|
+
**Exception — image-output intent detected:** if the user's prompt explicitly asks for an image or saved file (phrases like "save as PNG", "export to SVG", "make an image", "render to a file", "give me a png", "I need an SVG"), still save the `.dgmo` source, then go to `mcp__dgmo__render_diagram` (see "Image output") instead of step 6. Detection is intent-based — if in doubt, use the step-6 default and offer "Want me to save as PNG/SVG instead?"
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
**Side-by-side variants** use `mcp__dgmo__preview_diagram` (multi-diagram preview is its killer feature). See "Side-by-side variants" below.
|
|
82
93
|
|
|
83
94
|
### Editing an existing diagram
|
|
84
95
|
|
|
@@ -88,7 +99,7 @@ When the user asks to modify a `.dgmo` file or says "update this diagram":
|
|
|
88
99
|
2. **Understand it** — identify the chart type, key elements, and structure.
|
|
89
100
|
3. **Make the change** — edit the file using the Edit tool. Preserve the user's style and organization.
|
|
90
101
|
4. **Validate** — call `mcp__dgmo__validate_diagram(dgmo)` on the updated content.
|
|
91
|
-
5. **
|
|
102
|
+
5. **Show it** — per "Where the diagram goes": app installed → `mcp__dgmo__open_in_app({ dgmo, filePath: "<the file you just edited>" })` so it re-renders live in the app; not installed → `mcp__dgmo__share_diagram(dgmo)` + `open <url>`. (Image-output exception applies — if the user asked for a PNG/SVG file explicitly, render to file instead.)
|
|
92
103
|
|
|
93
104
|
Keep the diff minimal — don't rewrite the whole file when adding one element.
|
|
94
105
|
|
|
@@ -150,11 +161,12 @@ Trigger phrases: "save as PNG", "export to SVG", "make an image", "render to a f
|
|
|
150
161
|
|
|
151
162
|
| What the user wants | How to do it |
|
|
152
163
|
|---|---|
|
|
153
|
-
| **
|
|
164
|
+
| **Open in the desktop app (no saved file)** | `mcp__dgmo__open_in_app({ dgmo })` — deep-links an ephemeral copy into Diagrammo. Prefer the `filePath` form (open the saved file) whenever you've saved the source. |
|
|
165
|
+
| **Force the online editor even though the app is installed** | `mcp__dgmo__share_diagram(dgmo)` + `open <url>` |
|
|
154
166
|
| **Local HTML preview (not online.diagrammo.app)** | `mcp__dgmo__preview_diagram([{dgmo, title}])` — useful when the user specifically wants a local file or is offline |
|
|
155
167
|
| **Copy markup to clipboard** | Run `echo '<dgmo markup>' \| pbcopy` |
|
|
156
168
|
|
|
157
|
-
(The
|
|
169
|
+
(The default visual output is decided by `check_app_installed` — open the saved file in the app when installed, otherwise the online share URL. See "Where the diagram goes" above. The options here are for when the user explicitly asks for something else.)
|
|
158
170
|
|
|
159
171
|
### Embedding diagrams in docs
|
|
160
172
|
|
|
@@ -187,7 +199,7 @@ If the user wants the link in clipboard rather than opened (e.g., they want to p
|
|
|
187
199
|
echo '<url>' | pbcopy
|
|
188
200
|
```
|
|
189
201
|
|
|
190
|
-
Then tell the user it's been copied. Otherwise, the default is
|
|
202
|
+
Then tell the user it's been copied. Otherwise, the default visual output is the app-aware behavior from "Where the diagram goes" (open the saved file in the app when installed, else `open <url>`).
|
|
191
203
|
|
|
192
204
|
## CLI Reference
|
|
193
205
|
|
|
@@ -271,6 +283,7 @@ series A (red), B (blue), C (green) ⚠ for ≥2 series, prefer the indented b
|
|
|
271
283
|
|
|
272
284
|
## Tips
|
|
273
285
|
|
|
286
|
+
- Output target: call `mcp__dgmo__check_app_installed()` once per session. App installed → save the `.dgmo` and open that file live in the app (`open_in_app` with `filePath`); not installed → online share URL. Always save the source either way; never render a PNG unless asked.
|
|
274
287
|
- Default palette: `slate` — use it unless the user requests otherwise.
|
|
275
288
|
- Always validate before rendering — `validate_diagram` is much faster than a failed render.
|
|
276
289
|
- Always call `get_examples` before generating an unfamiliar chart type — real examples beat guessing.
|
package/SKILL.md
CHANGED
|
@@ -429,14 +429,19 @@ era 1718-05-08 -> 1718-05-17 Blockade Active blue
|
|
|
429
429
|
**Fetch more:** call `get_language_reference(type)` for a type's full syntax and `get_examples(type)` for starter templates. `suggest_chart_type` returns the chosen type's reference automatically.
|
|
430
430
|
<!-- DGMO-AI-CORE:END -->
|
|
431
431
|
|
|
432
|
-
##
|
|
432
|
+
## Output — where the diagram goes
|
|
433
433
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
434
|
+
**Always save the `.dgmo` source** to `<name>.dgmo` in the working directory — it's the editable deliverable; the app/URL just displays it. **Never render a PNG/SVG unless the user explicitly asks** for an image.
|
|
435
|
+
|
|
436
|
+
Decide the visual output **once per session** with `check_app_installed`:
|
|
437
|
+
|
|
438
|
+
1. **App installed →** save the source, then `open_in_app({ dgmo, filePath: "<abs path to the saved file>" })`. The app opens *that file*, so in-app edits autosave back to it — one source of truth, live re-render. **Best UX.** Don't open an online URL and don't render a PNG.
|
|
439
|
+
2. **App not installed →** `share_diagram` returns a `https://online.diagrammo.app/...` URL; `open` it. Same chart + editor view in the browser. **Preferred fallback.**
|
|
440
|
+
|
|
441
|
+
Other tools (use only when the user asks for them):
|
|
442
|
+
3. `render_diagram` — PNG or SVG to a file path. Use when the user wants an image artifact (export, embed, attach).
|
|
438
443
|
4. `generate_report` — renders multiple diagrams into an HTML report with table of contents.
|
|
439
|
-
5. `preview_diagram` — local HTML preview in the browser
|
|
444
|
+
5. `preview_diagram` — local HTML preview in the browser; also the multi-diagram side-by-side tool.
|
|
440
445
|
6. `list_chart_types` / `get_language_reference` — discovery; call `get_language_reference` before generating an unfamiliar chart type.
|
|
441
446
|
|
|
442
447
|
## When to use dgmo
|
package/dist/advanced.cjs
CHANGED
|
@@ -59426,9 +59426,9 @@ var init_renderer20 = __esm({
|
|
|
59426
59426
|
}
|
|
59427
59427
|
});
|
|
59428
59428
|
|
|
59429
|
-
//
|
|
59429
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59430
59430
|
var require_lz_string = __commonJS({
|
|
59431
|
-
"
|
|
59431
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports2, module2) {
|
|
59432
59432
|
"use strict";
|
|
59433
59433
|
var LZString = (function() {
|
|
59434
59434
|
var f = String.fromCharCode;
|
package/dist/advanced.js
CHANGED
|
@@ -59450,9 +59450,9 @@ var init_renderer20 = __esm({
|
|
|
59450
59450
|
}
|
|
59451
59451
|
});
|
|
59452
59452
|
|
|
59453
|
-
//
|
|
59453
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59454
59454
|
var require_lz_string = __commonJS({
|
|
59455
|
-
"
|
|
59455
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports, module) {
|
|
59456
59456
|
"use strict";
|
|
59457
59457
|
var LZString = (function() {
|
|
59458
59458
|
var f = String.fromCharCode;
|
package/dist/auto.cjs
CHANGED
|
@@ -59064,9 +59064,9 @@ var init_renderer20 = __esm({
|
|
|
59064
59064
|
}
|
|
59065
59065
|
});
|
|
59066
59066
|
|
|
59067
|
-
//
|
|
59067
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59068
59068
|
var require_lz_string = __commonJS({
|
|
59069
|
-
"
|
|
59069
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports2, module2) {
|
|
59070
59070
|
"use strict";
|
|
59071
59071
|
var LZString = (function() {
|
|
59072
59072
|
var f = String.fromCharCode;
|
|
@@ -64499,7 +64499,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
64499
64499
|
|
|
64500
64500
|
// src/auto/index.ts
|
|
64501
64501
|
init_safe_href();
|
|
64502
|
-
var VERSION = "0.
|
|
64502
|
+
var VERSION = "0.36.0";
|
|
64503
64503
|
var DEFAULTS = {
|
|
64504
64504
|
theme: "auto",
|
|
64505
64505
|
palette: "slate",
|
package/dist/auto.js
CHANGED
|
@@ -378,7 +378,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
378
378
|
.dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-comment,
|
|
379
379
|
.dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-noteContent,
|
|
380
380
|
.dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-punctuation { color: #616e88; }
|
|
381
|
-
`;Ox();var n5="0.
|
|
381
|
+
`;Ox();var n5="0.36.0",KKt={theme:"auto",palette:"slate",showSource:!0,showEditorLink:!0},AR={...KKt},X_=new Set,ZKt="https://online.diagrammo.app",QKt=8192,o0t=256*1024,JKt=200,t7t=1200,e7t="[dgmo:auto]",r7t=/[\x00-\x1F--]/g,e5="dgmoAutoStyles";function va(...t){typeof console<"u"&&console.warn&&console.warn(e7t,...t)}function a0t(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function n7t(t){t.querySelectorAll("script, foreignObject").forEach(n=>n.remove());let r=[t,...Array.from(t.querySelectorAll("*"))];for(let n of r){for(let o of Array.from(n.attributes))o.name.toLowerCase().startsWith("on")&&n.removeAttribute(o.name);if(n.hasAttribute("href")&&lu(n.getAttribute("href"))===null&&n.removeAttribute("href"),n.hasAttributeNS("http://www.w3.org/1999/xlink","href")){let o=n.getAttributeNS("http://www.w3.org/1999/xlink","href");lu(o)===null&&n.removeAttributeNS("http://www.w3.org/1999/xlink","href")}}}function s0t(t){try{return gE().some(e=>e.id===t)}catch{return!1}}function l0t(){if(typeof document>"u")return null;let t=document.currentScript;if(t&&t instanceof HTMLScriptElement)return t;let e=document.querySelectorAll('script[src*="auto.js"], script[src*="auto.min.js"]');return e.length===0?null:e[e.length-1]}var o7t=["theme","palette","showSource","showEditorLink"],c0t=["__proto__","constructor","prototype"],i7t=["auto","light","dark","transparent"];function u0t(t){return typeof t=="string"&&i7t.includes(t)}function d0t(t){if(!t)return{};let e;try{e=JSON.parse(t)}catch(n){return va("data-config: invalid JSON",n),{}}if(!a0t(e))return va("data-config: not an object"),{};for(let n of c0t)if(Object.prototype.hasOwnProperty.call(e,n))return va("data-config: rejected (prototype-pollution key:",n,")"),{};let r={};for(let[n,o]of Object.entries(e)){if(!o7t.includes(n)){va("data-config: dropping unknown key",n);continue}if(n==="theme"){if(!u0t(o)){va("data-config: rejected theme",o);continue}r.theme=o}else if(n==="palette"){if(typeof o!="string"||!s0t(o)){va("data-config: rejected palette",o);continue}r.palette=o}else if(n==="showSource"){if(typeof o!="boolean"){va("data-config: rejected showSource",o);continue}r.showSource=o}else if(n==="showEditorLink"){if(typeof o!="boolean"){va("data-config: rejected showEditorLink",o);continue}r.showEditorLink=o}}return r}function f0t(t=document){let e=t.querySelectorAll(".dgmo:not([data-dgmo-processed]), .language-dgmo:not([data-dgmo-processed])");return Array.from(e).filter(r=>!r.closest(".dgmo-rendered"))}function p0t(t){if(t==="light"||t==="dark"||t==="transparent")return t;if(typeof document>"u")return"light";let e=document.documentElement,r=e.getAttribute("data-theme");return r==="dark"?"dark":r==="light"?"light":e.classList.contains("dark")?"dark":e.classList.contains("light")?"light":typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function h0t(){if(typeof document>"u")return;let t=document.documentElement;if(t?.dataset?.[e5]==="1")return;if(document.querySelector('link[rel="stylesheet"][href*="auto.css"]')){t&&t.dataset&&(t.dataset[e5]="1");return}let r=document.createElement("style");r.setAttribute("data-dgmo-auto",""),r.textContent=n0t,document.head.appendChild(r),t&&t.dataset&&(t.dataset[e5]="1")}function a7t(t){let e=document.createDocumentFragment(),r;try{r=r0t(t)}catch{return e.appendChild(document.createTextNode(t)),e}for(let n of r){if(!n.text)continue;let o=document.createElement("span");o.className=`dgmo-tok-${n.role}`,o.textContent=n.text,e.appendChild(o)}return e}var m0t='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 5.5V3a1.5 1.5 0 0 0-1.5-1.5H3A1.5 1.5 0 0 0 1.5 3v6A1.5 1.5 0 0 0 3 10.5h2.5"/></svg>',s7t='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 8.5 6.5 12 13 4.5"/></svg>',l7t='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 2h5v5"/><path d="M14 2L7 9"/><path d="M13 9v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4"/></svg>';function NR(t,e){t.innerHTML=e}function c7t(t,e,r){let n=document.createElement("div");n.className="dgmo-source-panel";let o=document.createElement("button");o.type="button",o.className="dgmo-source-toggle",o.setAttribute("aria-expanded","false");let i=document.createElement("span");i.className="dgmo-chevron",i.setAttribute("aria-hidden","true"),i.textContent="\u25B8",o.appendChild(i);let a=document.createElement("span");a.textContent="DGMO source",o.appendChild(a);let s=document.createElement("div");s.className="dgmo-source-body";let l=document.createElement("pre");l.className="dgmo-source-pre",l.appendChild(a7t(t)),s.appendChild(l);let c=document.createElement("div");c.className="dgmo-source-actions";let u=document.createElement("button");if(u.type="button",u.className="dgmo-btn dgmo-btn-copy",u.setAttribute("aria-label","Copy DGMO source"),u.title="Copy source",NR(u,m0t),u.addEventListener("click",()=>{u7t(t,u)}),c.appendChild(u),r){let d=document.createElement("a");d.className="dgmo-btn dgmo-btn-editor",d.target="_blank",d.rel="noopener noreferrer",d.setAttribute("aria-label","Open in editor"),NR(d,l7t),e?(d.href=e,d.title="Open in editor"):(d.setAttribute("aria-disabled","true"),d.title="Diagram too large for share link; copy source and paste into editor",d.addEventListener("click",f=>f.preventDefault())),c.appendChild(d)}return s.appendChild(c),n.appendChild(o),n.appendChild(s),o.addEventListener("click",()=>{let d=s.classList.toggle("dgmo-open");o.setAttribute("aria-expanded",d?"true":"false")}),n}async function u7t(t,e){let r=!1;try{navigator?.clipboard?.writeText&&(await navigator.clipboard.writeText(t),r=!0)}catch{}if(!r&&typeof document<"u")try{let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),r=document.execCommand("copy"),document.body.removeChild(n)}catch{r=!1}r?(NR(e,s7t),e.classList.add("dgmo-btn-copied"),setTimeout(()=>{NR(e,m0t),e.classList.remove("dgmo-btn-copied")},t7t)):va("clipboard write failed")}function Y_(t){let e=document.createElement("div");e.className="dgmo-error-banner",e.setAttribute("role","alert");let r=document.createElement("div");if(r.className="dgmo-error-banner-title",r.textContent=`${t.severity??"error"}: ${t.message}`,e.appendChild(r),t.line!==void 0&&t.line>0){let n=document.createElement("div");n.className="dgmo-error-banner-loc",n.textContent=t.column!==void 0?`at ${t.line}:${t.column}`:`at line ${t.line}`,e.appendChild(n)}return e}function d7t(t){let e=t.split(`
|
|
382
382
|
`).map(r=>r.trim()).find(r=>r.length>0);return e?e.replace(r7t,"").slice(0,JKt):"DGMO diagram"}function f7t(t){if(t.tagName==="CODE"){let e=t.parentElement;if(e?.tagName==="PRE"){let r=Array.from(e.childNodes).filter(n=>n.nodeType===1||n.nodeType===3&&(n.textContent||"").trim().length>0);if(r.length===1&&r[0]===t)return e}}return t}async function g0t(t){if(!(t instanceof HTMLElement))return{};if(t.dataset.dgmoProcessed==="true")return{};t.dataset.dgmoProcessed="true";let e=t.textContent||"";if(new TextEncoder().encode(e).byteLength>o0t){t.style.visibility="";let y=Y_({message:`DGMO source too large to render \u2014 ${o0t/1024} KB max`,severity:"error"});return t.parentElement?.insertBefore(y,t),va("source exceeds 256 KB cap"),{}}let n=AR,o=n.theme==="transparent"?"transparent":p0t(n.theme),i=o==="transparent"?"transparent":o,a=d7t(e),s=t.dataset.showSource,l=n.showSource;s==="true"?l=!0:s==="false"?l=!1:s!==void 0&&va("data-show-source: invalid value",s,'\u2014 expected "true" or "false"');let c;try{c=await Dxt(e,{theme:i,palette:n.palette})}catch(y){t.style.visibility="";let v=y instanceof Error?y.message:"Render failed unexpectedly",b=Y_({message:v,severity:"error"});return t.parentElement?.insertBefore(b,t),va("render() rejected:",y),{}}if(c.diagnostics&&c.diagnostics.length>0){t.style.visibility="";let y=c.diagnostics[0],v=Y_({message:y.message,severity:y.severity,line:y.line,...y.column!==void 0&&{column:y.column}});return t.parentElement?.insertBefore(v,t),va("diagnostic:",y.message,y.line,y.column),{}}if(!c.svg){t.style.visibility="";let y=Y_({message:"Empty SVG returned from renderer",severity:"error"});return t.parentElement?.insertBefore(y,t),{}}let u=document.createElement("div"),d=o==="dark"?"dgmo-theme-dark":o==="transparent"?"dgmo-theme-transparent":"dgmo-theme-light";u.className=`dgmo-rendered ${d}`,u.dataset.dgmoProcessed="true";let f=document.createElement("div");f.innerHTML=c.svg;let p=f.querySelector("svg");if(!p){t.style.visibility="";let y=Y_({message:"Empty SVG returned from renderer",severity:"error"});return t.parentElement?.insertBefore(y,t),{}}if(n7t(p),p.setAttribute("role","img"),p.setAttribute("aria-label",a),u.appendChild(p),l){let y=null;if(n.showEditorLink){let b=o==="dark"?"dark":"light",x=Gxt(e,{baseUrl:ZKt,palette:n.palette,theme:b});if(x.url){let w=`utm_source=auto-embed&utm_medium=html&utm_campaign=${encodeURIComponent(n5)}`,S=x.url.indexOf("#"),_;if(S===-1){let L=x.url.includes("?")?"&":"?";_=x.url+L+w}else{let L=x.url.slice(0,S),A=x.url.slice(S+1),M=L.includes("?")?"&":"?",T=A.length>0?"&":"";_=L+M+w+"#"+A+T+w}y=_,lu(y)||(y=null)}else x.error==="too-large"&&x.compressedSize>QKt&&(y=null)}let v=c7t(e,y,n.showEditorLink);u.appendChild(v)}let m={wrapper:u,source:e,perElementShowSource:s==="true"?!0:s==="false"?!1:null};return X_.add(m),f7t(t).replaceWith(u),{wrapper:u}}function o5(t={}){if(!a0t(t))return;for(let r of c0t)if(Object.prototype.hasOwnProperty.call(t,r)){va("initialize: rejected (prototype-pollution key:",r,")");return}let e={...AR};u0t(t.theme)&&(e.theme=t.theme),typeof t.palette=="string"&&s0t(t.palette)&&(e.palette=t.palette),typeof t.showSource=="boolean"&&(e.showSource=t.showSource),typeof t.showEditorLink=="boolean"&&(e.showEditorLink=t.showEditorLink),AR=e}async function i5(t={}){h0t();for(let r of Array.from(X_))document.contains(r.wrapper)||X_.delete(r);let e;if(t.nodes){e=("length"in t.nodes&&typeof t.nodes!="string"?Array.from(t.nodes):[]).filter(o=>o instanceof Element&&(o.matches(".dgmo, .language-dgmo")||o.querySelector(".dgmo, .language-dgmo")!==null));let n=[];for(let o of e)o.matches(".dgmo, .language-dgmo")&&n.push(o),o.querySelectorAll(".dgmo:not([data-dgmo-processed]), .language-dgmo:not([data-dgmo-processed])").forEach(a=>n.push(a));e=Array.from(new Set(n)).filter(o=>!o.closest(".dgmo-rendered"))}else e=f0t();await Promise.all(e.map(r=>g0t(r).catch(()=>({}))))}function p7t(){if(AR.theme==="auto")for(let t of Array.from(X_)){let e=document.createElement("pre");e.className="dgmo",e.textContent=t.source,t.perElementShowSource!==null&&(e.dataset.showSource=String(t.perElementShowSource)),t.wrapper.replaceWith(e),X_.delete(t),g0t(e)}}function h7t(){if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>p7t();t.addEventListener?t.addEventListener("change",e):"addListener"in t&&typeof t.addListener=="function"&&t.addListener(e)}function r5(){if(typeof document>"u")return;document.querySelectorAll(".dgmo:not(.dgmo-rendered), .language-dgmo").forEach(e=>{e.closest(".dgmo-rendered")||(e.style.visibility="visible")}),document.documentElement&&document.documentElement.dataset&&(document.documentElement.dataset.dgmoAutoFailed="1")}function m7t(){try{h0t();let t=l0t(),e=t?.getAttribute("data-auto"),r=t?.getAttribute("data-config");if(r){let o=d0t(r);o5(o)}if(h7t(),typeof window<"u"&&window.setTimeout(()=>{document.querySelectorAll(".dgmo:not(.dgmo-rendered):not([data-dgmo-processed])").length>0&&(va("safety timeout: un-hiding unrendered sources"),r5())},3e4),e==="false")return;let n=()=>{i5().catch(o=>{va("run() crashed:",o),r5()})};typeof document<"u"&&document.readyState!=="loading"?n():typeof document<"u"&&document.addEventListener("DOMContentLoaded",n,{once:!0})}catch(t){va("bootstrap failed:",t),r5()}}var y0t=Object.freeze({initialize:o5,run:i5,version:n5});function i0t(t,e){try{Object.defineProperty(t,e,{value:y0t,writable:!1,configurable:!1,enumerable:!0})}catch{}}typeof window<"u"&&(i0t(window,"dgmo"),i0t(window,"diagrammo"),m7t());var g7t=y0t;return c5(y7t);})();
|
|
383
383
|
/*! Bundled license information:
|
|
384
384
|
|
package/dist/auto.mjs
CHANGED
|
@@ -59088,9 +59088,9 @@ var init_renderer20 = __esm({
|
|
|
59088
59088
|
}
|
|
59089
59089
|
});
|
|
59090
59090
|
|
|
59091
|
-
//
|
|
59091
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59092
59092
|
var require_lz_string = __commonJS({
|
|
59093
|
-
"
|
|
59093
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports, module) {
|
|
59094
59094
|
"use strict";
|
|
59095
59095
|
var LZString = (function() {
|
|
59096
59096
|
var f = String.fromCharCode;
|
|
@@ -64509,7 +64509,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
64509
64509
|
|
|
64510
64510
|
// src/auto/index.ts
|
|
64511
64511
|
init_safe_href();
|
|
64512
|
-
var VERSION = "0.
|
|
64512
|
+
var VERSION = "0.36.0";
|
|
64513
64513
|
var DEFAULTS = {
|
|
64514
64514
|
theme: "auto",
|
|
64515
64515
|
palette: "slate",
|
package/dist/index.cjs
CHANGED
|
@@ -59064,9 +59064,9 @@ var init_renderer20 = __esm({
|
|
|
59064
59064
|
}
|
|
59065
59065
|
});
|
|
59066
59066
|
|
|
59067
|
-
//
|
|
59067
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59068
59068
|
var require_lz_string = __commonJS({
|
|
59069
|
-
"
|
|
59069
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports2, module2) {
|
|
59070
59070
|
"use strict";
|
|
59071
59071
|
var LZString = (function() {
|
|
59072
59072
|
var f = String.fromCharCode;
|
package/dist/index.js
CHANGED
|
@@ -59088,9 +59088,9 @@ var init_renderer20 = __esm({
|
|
|
59088
59088
|
}
|
|
59089
59089
|
});
|
|
59090
59090
|
|
|
59091
|
-
//
|
|
59091
|
+
// node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
|
|
59092
59092
|
var require_lz_string = __commonJS({
|
|
59093
|
-
"
|
|
59093
|
+
"node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports, module) {
|
|
59094
59094
|
"use strict";
|
|
59095
59095
|
var LZString = (function() {
|
|
59096
59096
|
var f = String.fromCharCode;
|
package/docs/ai-integration.md
CHANGED
|
@@ -47,7 +47,9 @@ For Claude Code this copies the `/dgmo` skill into `~/.claude/commands/` (full d
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
**
|
|
50
|
+
**Tools:** `check_app_installed`, `suggest_chart_type`, `get_language_reference`, `get_examples`, `validate_diagram`, `open_in_app`, `share_diagram`, `render_diagram`, `preview_diagram`, `generate_report`, `list_chart_types`. `dgmo mcp` execs the installed server, or fetches it on demand via `npx` if it isn't installed yet — so no separate `dgmo-mcp` step is required. (If you'd rather not install the CLI at all, `{ "command": "npx", "args": ["-y", "@diagrammo/dgmo-mcp"] }` still works.) See `dgmo-mcp/README.md` for full options.
|
|
51
|
+
|
|
52
|
+
Output default is app-aware: `check_app_installed` decides it — when the Diagrammo desktop app is installed, the diagram source is saved and opened live in the app (`open_in_app` with the saved file path); otherwise an online share URL is opened. A PNG/SVG is rendered only when the user explicitly asks.
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|