nextra-dgmo 0.2.5 → 0.2.6
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/dist/client.css +63 -0
- package/dist/nextra-client.js +7 -1
- package/dist/nextra-client.js.map +1 -1
- package/package.json +3 -3
package/dist/client.css
CHANGED
|
@@ -117,6 +117,69 @@ html.dark .dgmo-dark {
|
|
|
117
117
|
opacity: 1;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/* === Full-screen lightbox ===
|
|
121
|
+
* The expand button clones the visible diagram into a native <dialog> that
|
|
122
|
+
* the client shows with showModal(): top-layer, so it escapes any transformed
|
|
123
|
+
* or overflow-clipped ancestor (docs sidebars) and fills the whole viewport.
|
|
124
|
+
* Escape / backdrop-click / the close button dismiss it. The <dialog> itself
|
|
125
|
+
* fills the viewport with a transparent background (so a click landing on it
|
|
126
|
+
* — outside the centered card — reads as a backdrop dismiss); the dim comes
|
|
127
|
+
* from ::backdrop. */
|
|
128
|
+
.dgmo-lightbox {
|
|
129
|
+
width: 100vw;
|
|
130
|
+
height: 100vh;
|
|
131
|
+
max-width: 100vw;
|
|
132
|
+
max-height: 100vh;
|
|
133
|
+
margin: 0;
|
|
134
|
+
padding: 0;
|
|
135
|
+
border: 0;
|
|
136
|
+
background: transparent;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
}
|
|
139
|
+
.dgmo-lightbox[open] {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
}
|
|
144
|
+
.dgmo-lightbox::backdrop {
|
|
145
|
+
background: rgba(0, 0, 0, 0.72);
|
|
146
|
+
}
|
|
147
|
+
.dgmo-lightbox-svg {
|
|
148
|
+
width: 95vw;
|
|
149
|
+
max-width: 95vw;
|
|
150
|
+
max-height: 95vh;
|
|
151
|
+
overflow: auto;
|
|
152
|
+
border-radius: 0.5em;
|
|
153
|
+
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
|
|
154
|
+
}
|
|
155
|
+
.dgmo-lightbox-svg > svg {
|
|
156
|
+
display: block;
|
|
157
|
+
width: 100%;
|
|
158
|
+
height: auto;
|
|
159
|
+
max-width: 100%;
|
|
160
|
+
}
|
|
161
|
+
.dgmo-lightbox-close {
|
|
162
|
+
position: fixed;
|
|
163
|
+
top: max(1rem, env(safe-area-inset-top));
|
|
164
|
+
right: max(1rem, env(safe-area-inset-right));
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
width: 2.4em;
|
|
169
|
+
height: 2.4em;
|
|
170
|
+
border: 0;
|
|
171
|
+
border-radius: 50%;
|
|
172
|
+
background: rgba(0, 0, 0, 0.5);
|
|
173
|
+
color: #fff;
|
|
174
|
+
font-size: 1.25rem;
|
|
175
|
+
line-height: 1;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
transition: background-color 0.15s ease;
|
|
178
|
+
}
|
|
179
|
+
.dgmo-lightbox-close:hover {
|
|
180
|
+
background: rgba(0, 0, 0, 0.75);
|
|
181
|
+
}
|
|
182
|
+
|
|
120
183
|
/* === Frame the whole block ===
|
|
121
184
|
* When the source panel is open, diagram + toolbar + code get one shared
|
|
122
185
|
* border so the code visibly belongs to the chart above it. The frame box
|
package/dist/nextra-client.js
CHANGED
|
@@ -5,7 +5,9 @@ import "nextra-dgmo/client.css";
|
|
|
5
5
|
import { useEffect } from "react";
|
|
6
6
|
import { usePathname } from "next/navigation";
|
|
7
7
|
|
|
8
|
-
// node_modules/.pnpm/remark-dgmo@0.
|
|
8
|
+
// node_modules/.pnpm/remark-dgmo@0.7.0_@diagrammo+dgmo@0.49.0_@lezer+common@1.5.2_@lezer+highlight@1.2.3_@lezer+lr@1.4.10_/node_modules/remark-dgmo/dist/client.js
|
|
9
|
+
import { startCountdowns } from "@diagrammo/dgmo/countdown";
|
|
10
|
+
import { startClocks } from "@diagrammo/dgmo/clock";
|
|
9
11
|
var clickHandlerBound = false;
|
|
10
12
|
var themeObserverBound = false;
|
|
11
13
|
function isInteractiveBrowser() {
|
|
@@ -24,6 +26,10 @@ function bindDgmo() {
|
|
|
24
26
|
clickHandlerBound = true;
|
|
25
27
|
}
|
|
26
28
|
tightenViewBoxes();
|
|
29
|
+
if (typeof window.setInterval === "function") {
|
|
30
|
+
startCountdowns();
|
|
31
|
+
startClocks();
|
|
32
|
+
}
|
|
27
33
|
if (!themeObserverBound) {
|
|
28
34
|
const html = document.documentElement;
|
|
29
35
|
const reTighten = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nextra-client.tsx","../node_modules/.pnpm/remark-dgmo@0.6.0_@diagrammo+dgmo@0.48.1_@lezer+common@1.5.2_@lezer+highlight@1.2.3_@lezer+lr@1.4.10_/node_modules/remark-dgmo/src/client.ts"],"sourcesContent":["/**\n * Nextra-shaped client wrapper for `remark-dgmo`'s framework-neutral\n * `bindDgmo()` function. Drop this once inside your `app/layout.tsx`\n * (typically alongside Nextra's layout) and it will:\n *\n * - run `bindDgmo()` on initial mount, tightening every diagram's\n * viewBox to content bounds and wiring showcase-mode copy buttons;\n * - re-run `bindDgmo()` on every client-side route change (Next's\n * app router does not refire `DOMContentLoaded` semantics on soft\n * navigation).\n *\n * Lives in this package — not in `remark-dgmo` — so that Next's `'use\n * client'` directive and `next/navigation` import stay out of the\n * framework-agnostic core.\n */\n// Side-effect CSS import: Next's app-router CSS pipeline picks this up\n// because the component is a Client Component imported from a layout.\n// Self-references the package via its exports map so it works at both\n// build time (tsup marks it external) and consumer time (Next resolves\n// it through node_modules/nextra-dgmo/dist/client.css). Mounting\n// `<DgmoClient />` is now the only thing a consumer has to do for both\n// runtime rebinding AND theme-aware styling.\nimport 'nextra-dgmo/client.css';\nimport { useEffect } from 'react';\nimport { usePathname } from 'next/navigation';\nimport { bindDgmo } from 'remark-dgmo/client.js';\n\nexport function DgmoClient(): null {\n const pathname = usePathname();\n\n useEffect(() => {\n // bindDgmo is idempotent — it scans for already-bound buttons and\n // skips them — so calling it on every pathname change is safe and\n // covers both initial paint and subsequent SPA navigations.\n bindDgmo();\n }, [pathname]);\n\n return null;\n}\n\nexport default DgmoClient;\n","/**\n * Framework-neutral client-side enhancement for diagrams emitted by\n * `remark-dgmo`:\n *\n * - Bind a delegated click handler for the showcase toolbar buttons:\n * `.dgmo-copy` copies the source string in `data-dgmo-source` to the\n * clipboard. `.dgmo-open` is an `<a href>` whose default-action\n * navigation is preserved — except when it lives inside a `<summary>`\n * (the collapsible toolbar case), where we have to manually navigate\n * because the same click's `preventDefault()` cancels both the\n * summary's toggle AND the anchor's nav.\n * - Tighten each diagram's `viewBox` to its actual content bounds via\n * `SVGGraphicsElement.getBBox()`, since SVG-export from the renderer\n * embeds a generous bounding box.\n *\n * `bindDgmo()` is safe to call multiple times: the click handler is bound\n * once-and-only-once (idempotent), and viewBox tightening is run every\n * invocation so SPA-style frameworks (Docusaurus) can re-run it after\n * route changes.\n *\n * In a non-browser environment, `bindDgmo()` is a no-op. We can't just check\n * for `window`/`document`: some SSG renderers (Docusaurus's static export among\n * them) evaluate client modules against a PARTIAL DOM that defines `window` and\n * `document` but NOT the browser-only APIs this function relies on\n * (`MutationObserver`, `requestAnimationFrame`, `SVGGraphicsElement.getBBox`).\n * So we feature-detect those too and bail unless we're in a real browser —\n * otherwise the module-level auto-init below throws during server render.\n */\n\nlet clickHandlerBound = false;\nlet themeObserverBound = false;\n\nfunction isInteractiveBrowser(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof MutationObserver !== 'undefined' &&\n typeof requestAnimationFrame !== 'undefined'\n );\n}\n\nexport function bindDgmo(): void {\n if (!isInteractiveBrowser()) return;\n\n if (!clickHandlerBound) {\n // Capture phase, not bubble: the handler must run BEFORE any\n // framework-level click handling. Docusaurus (markdown.format 'md')\n // maps the raw <details> onto its theme Details component, whose React\n // onClick — delegated at the app root — toggles the panel for ANY click\n // inside the <summary>, including our copy/open buttons. Capturing at\n // document and stopping propagation for in-summary buttons keeps those\n // clicks ours; plain summary clicks pass through untouched so the\n // toggle (native or framework-managed) still works.\n document.addEventListener(\n 'click',\n (e) => {\n void handleToolbarBtnClick(e);\n },\n true\n );\n clickHandlerBound = true;\n }\n tightenViewBoxes();\n\n // Color-mode toggles flip which dual-render wrapper is `display: none`.\n // The wrapper that was hidden at load couldn't be measured (getBBox\n // returns 0 on display:none subtrees), so its SVG keeps the full\n // un-tightened viewBox and looks tiny when it becomes visible. Watch\n // for the host's color-mode signal flipping and re-tighten then.\n //\n // Double-rAF defers the measurement until AFTER the browser has\n // finished the layout pass that the display-change triggered. Without\n // it, MutationObserver fires synchronously before layout and getBBox\n // still returns 0 on the freshly-visible element.\n if (!themeObserverBound) {\n const html = document.documentElement;\n const reTighten = () => {\n requestAnimationFrame(() => requestAnimationFrame(tightenViewBoxes));\n };\n new MutationObserver(reTighten).observe(html, {\n attributes: true,\n attributeFilter: ['data-theme', 'class'],\n });\n themeObserverBound = true;\n }\n}\n\nasync function handleToolbarBtnClick(e: Event): Promise<void> {\n const target = e.target as Element | null;\n if (!target || typeof target.closest !== 'function') return;\n const btn = target.closest('.dgmo-toolbar-btn') as HTMLElement | null;\n if (!btn) return;\n\n // The showcase toolbar IS the <summary> of a <details> disclosure, so a\n // click on any descendant would also toggle the disclosure unless we\n // cancel the default action. preventDefault here cancels the summary's\n // toggle — but it also cancels an anchor's navigation, so we have to\n // manually re-open the link below when the open-in-editor button is\n // nested inside a summary.\n const insideSummary = !!btn.closest('summary');\n if (insideSummary) {\n e.preventDefault();\n // Keep the click from reaching framework toggle handlers (Docusaurus's\n // Details component collapses the panel on any in-summary click).\n e.stopPropagation();\n }\n\n if (btn.matches('button.dgmo-expand')) {\n openDgmoLightbox(btn);\n return;\n }\n\n if (btn.matches('button.dgmo-copy')) {\n const src = btn.dataset['dgmoSource'] ?? '';\n try {\n await navigator.clipboard.writeText(src);\n } catch {\n return;\n }\n btn.classList.add('dgmo-copy--success');\n setTimeout(() => btn.classList.remove('dgmo-copy--success'), 1500);\n return;\n }\n\n if (insideSummary && btn.matches('a.dgmo-open')) {\n const anchor = btn as HTMLAnchorElement;\n if (anchor.href) {\n window.open(\n anchor.href,\n anchor.target || '_blank',\n 'noopener,noreferrer'\n );\n }\n }\n}\n\n// ============================================================\n// Full-screen lightbox (expand toolbar button)\n// ============================================================\n//\n// MIRROR of the canonical helper in @diagrammo/dgmo's `auto/shared.ts`\n// (`openDgmoLightbox`), kept near-verbatim here for the same reason copy/open\n// handling is mirrored per surface. The `.dgmo-lightbox*` CSS is single-sourced\n// in dgmo's BLOCK_CSS (this package's client.css is a generated byte-copy).\n\nconst LIGHTBOX_XLINK_NS = 'http://www.w3.org/1999/xlink';\nconst LIGHTBOX_REF_ATTRS = [\n 'clip-path',\n 'mask',\n 'filter',\n 'fill',\n 'stroke',\n 'marker-start',\n 'marker-mid',\n 'marker-end',\n];\nlet lightboxIdSeq = 0;\n\nconst LIGHTBOX_CLOSE_ICON =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"m4 4 8 8\"/><path d=\"m12 4-8 8\"/></svg>';\n\n/**\n * Namespace a cloned SVG's ids + internal `url(#id)`/`href=\"#id\"` refs so the\n * clone can't clash with the still-mounted inline copy (WebKit resolves\n * duplicate ids to the first match, corrupting gradients/clips/masks).\n */\nfunction namespaceLightboxSvgIds(root: SVGElement, prefix: string): void {\n const map = new Map<string, string>();\n root.querySelectorAll('[id]').forEach((el) => {\n const oldId = el.getAttribute('id');\n if (!oldId) return;\n const newId = prefix + oldId;\n map.set(oldId, newId);\n el.setAttribute('id', newId);\n });\n if (map.size === 0) return;\n const remap = (value: string): string =>\n value.replace(/url\\(#([^)]+)\\)/g, (m, id: string) => {\n const next = map.get(id);\n return next ? `url(#${next})` : m;\n });\n root.querySelectorAll('*').forEach((el) => {\n for (const attr of LIGHTBOX_REF_ATTRS) {\n const v = el.getAttribute(attr);\n if (v && v.includes('url(#')) el.setAttribute(attr, remap(v));\n }\n const style = el.getAttribute('style');\n if (style && style.includes('url(#'))\n el.setAttribute('style', remap(style));\n const href = el.getAttribute('href');\n if (href && href.startsWith('#') && map.has(href.slice(1)))\n el.setAttribute('href', '#' + map.get(href.slice(1)));\n const xhref = el.getAttributeNS(LIGHTBOX_XLINK_NS, 'href');\n if (xhref && xhref.startsWith('#') && map.has(xhref.slice(1)))\n el.setAttributeNS(\n LIGHTBOX_XLINK_NS,\n 'href',\n '#' + map.get(xhref.slice(1))\n );\n });\n}\n\n/**\n * Open the diagram belonging to `fromButton`'s block in a full-viewport\n * `<dialog>` lightbox: clone the currently-visible color-mode SVG, namespace\n * its ids, then `showModal()`. Escape / backdrop-click / close button dismiss.\n */\nfunction openDgmoLightbox(fromButton: Element): void {\n if (typeof document === 'undefined') return;\n const block = fromButton.closest('.dgmo');\n if (!block) return;\n\n const wrappers = block.querySelectorAll('.dgmo-light, .dgmo-dark, .dgmo-svg');\n let svg: SVGSVGElement | null = null;\n for (const w of Array.from(wrappers)) {\n if (window.getComputedStyle(w).display === 'none') continue;\n const found = w.querySelector('svg');\n if (found) {\n svg = found as SVGSVGElement;\n break;\n }\n }\n if (!svg) svg = block.querySelector('svg');\n if (!svg) return;\n\n const clone = svg.cloneNode(true) as SVGSVGElement;\n namespaceLightboxSvgIds(clone, `dgmo-lb-${++lightboxIdSeq}-`);\n\n const dialog = document.createElement('dialog');\n dialog.className = 'dgmo-lightbox';\n dialog.setAttribute('aria-label', 'Diagram, full screen');\n\n const closeBtn = document.createElement('button');\n closeBtn.type = 'button';\n closeBtn.className = 'dgmo-lightbox-close';\n closeBtn.setAttribute('aria-label', 'Close full screen');\n closeBtn.innerHTML = LIGHTBOX_CLOSE_ICON;\n\n const host = document.createElement('div');\n host.className = 'dgmo-lightbox-svg';\n host.appendChild(clone);\n\n dialog.appendChild(closeBtn);\n dialog.appendChild(host);\n document.body.appendChild(dialog);\n\n const close = (): void => {\n if (dialog.open) dialog.close();\n };\n closeBtn.addEventListener('click', close);\n dialog.addEventListener('click', (e) => {\n if (e.target === dialog) close();\n });\n dialog.addEventListener('close', () => dialog.remove());\n dialog.showModal();\n}\n\nfunction tightenViewBoxes(): void {\n const WRAPPER_SELECTORS = '.dgmo-light, .dgmo-dark, .dgmo-svg';\n document.querySelectorAll(WRAPPER_SELECTORS).forEach((node) => {\n const wrapper = node as HTMLElement;\n const svg = wrapper.querySelector('svg') as SVGSVGElement | null;\n if (!svg) return;\n\n // `getBBox()` returns 0,0,0,0 on elements whose ancestor is `display: none`.\n // Under dual-render the inactive color-mode wrapper IS display:none at load,\n // so its SVG would stay un-tightened — and then look small after the user\n // toggles into it. Set the wrapper to inline-style `display: block`\n // synchronously, read getBBox, then restore. Modern browsers don't paint\n // between these synchronous DOM writes, so there's no visible flicker.\n const computed = window.getComputedStyle(wrapper);\n const wasHidden = computed.display === 'none';\n const savedInlineDisplay = wrapper.style.display;\n if (wasHidden) {\n wrapper.style.display = 'block';\n // Force a synchronous layout pass before getBBox so the freshly-\n // shown element actually has bounds. Without this, some browsers\n // still report 0,0,0,0 because they batch the display change for\n // the next frame.\n void wrapper.offsetHeight;\n }\n\n try {\n const bbox = (svg as unknown as SVGGraphicsElement).getBBox();\n if (bbox.width > 0 && bbox.height > 0) {\n const pad = 16;\n svg.setAttribute(\n 'viewBox',\n `${bbox.x - pad} ${bbox.y - pad} ${bbox.width + pad * 2} ${\n bbox.height + pad * 2\n }`\n );\n }\n } catch {\n // ignore: SVG not yet in the DOM, or getBBox unsupported\n }\n\n if (wasHidden) {\n wrapper.style.display = savedInlineDisplay;\n // Clearing the only inline property leaves `style=\"\"` on the\n // element in Chrome/Safari. React 19's post-hydration check reads\n // that empty attribute as a server-vs-client mismatch on the\n // wrapper div (the wrapper is React-owned; only its `innerHTML`\n // is dangerouslySetInnerHTML). Drop the empty attribute so the\n // wrapper round-trips back to its SSR shape.\n if (savedInlineDisplay === '' && wrapper.getAttribute('style') === '') {\n wrapper.removeAttribute('style');\n }\n }\n });\n}\n\n// Auto-init on initial load. Docusaurus-style SPA wrappers also re-call\n// bindDgmo on route changes; that's safe (the click handler is bound once,\n// viewBox tightening runs every time).\nif (isInteractiveBrowser()) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', bindDgmo);\n } else {\n bindDgmo();\n }\n}\n"],"mappings":";;;AAsBA,OAAO;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;;;ACK5B,IAAI,oBAAoB;AACxB,IAAI,qBAAqB;AAEzB,SAAS,uBAAgC;AACvC,SACE,OAAO,WAAW,eAClB,OAAO,aAAa,eACpB,OAAO,qBAAqB,eAC5B,OAAO,0BAA0B;AAErC;AAEO,SAAS,WAAiB;AAC/B,MAAI,CAAC,qBAAqB,EAAG;AAE7B,MAAI,CAAC,mBAAmB;AAStB,aAAS;MACP;MACA,CAAC,MAAM;AACL,aAAK,sBAAsB,CAAC;MAC9B;MACA;IACF;AACA,wBAAoB;EACtB;AACA,mBAAiB;AAYjB,MAAI,CAAC,oBAAoB;AACvB,UAAM,OAAO,SAAS;AACtB,UAAM,YAAY,MAAM;AACtB,4BAAsB,MAAM,sBAAsB,gBAAgB,CAAC;IACrE;AACA,QAAI,iBAAiB,SAAS,EAAE,QAAQ,MAAM;MAC5C,YAAY;MACZ,iBAAiB,CAAC,cAAc,OAAO;IACzC,CAAC;AACD,yBAAqB;EACvB;AACF;AAEA,eAAe,sBAAsB,GAAyB;AAC5D,QAAM,SAAS,EAAE;AACjB,MAAI,CAAC,UAAU,OAAO,OAAO,YAAY,WAAY;AACrD,QAAM,MAAM,OAAO,QAAQ,mBAAmB;AAC9C,MAAI,CAAC,IAAK;AAQV,QAAM,gBAAgB,CAAC,CAAC,IAAI,QAAQ,SAAS;AAC7C,MAAI,eAAe;AACjB,MAAE,eAAe;AAGjB,MAAE,gBAAgB;EACpB;AAEA,MA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H;AAKA,IAAI,qBAAqB,GAAG;AAC1B,MAAI,SAAS,eAAe,WAAW;AACrC,aAAS,iBAAiB,oBAAoB,QAAQ;EACxD,OAAO;AACL,aAAS;EACX;AACF;;;ADtSO,SAAS,aAAmB;AACjC,QAAM,WAAW,YAAY;AAE7B,YAAU,MAAM;AAId,aAAS;AAAA,EACX,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACT;AAEA,IAAO,wBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/nextra-client.tsx","../node_modules/.pnpm/remark-dgmo@0.7.0_@diagrammo+dgmo@0.49.0_@lezer+common@1.5.2_@lezer+highlight@1.2.3_@lezer+lr@1.4.10_/node_modules/remark-dgmo/src/client.ts"],"sourcesContent":["/**\n * Nextra-shaped client wrapper for `remark-dgmo`'s framework-neutral\n * `bindDgmo()` function. Drop this once inside your `app/layout.tsx`\n * (typically alongside Nextra's layout) and it will:\n *\n * - run `bindDgmo()` on initial mount, tightening every diagram's\n * viewBox to content bounds and wiring showcase-mode copy buttons;\n * - re-run `bindDgmo()` on every client-side route change (Next's\n * app router does not refire `DOMContentLoaded` semantics on soft\n * navigation).\n *\n * Lives in this package — not in `remark-dgmo` — so that Next's `'use\n * client'` directive and `next/navigation` import stay out of the\n * framework-agnostic core.\n */\n// Side-effect CSS import: Next's app-router CSS pipeline picks this up\n// because the component is a Client Component imported from a layout.\n// Self-references the package via its exports map so it works at both\n// build time (tsup marks it external) and consumer time (Next resolves\n// it through node_modules/nextra-dgmo/dist/client.css). Mounting\n// `<DgmoClient />` is now the only thing a consumer has to do for both\n// runtime rebinding AND theme-aware styling.\nimport 'nextra-dgmo/client.css';\nimport { useEffect } from 'react';\nimport { usePathname } from 'next/navigation';\nimport { bindDgmo } from 'remark-dgmo/client.js';\n\nexport function DgmoClient(): null {\n const pathname = usePathname();\n\n useEffect(() => {\n // bindDgmo is idempotent — it scans for already-bound buttons and\n // skips them — so calling it on every pathname change is safe and\n // covers both initial paint and subsequent SPA navigations.\n bindDgmo();\n }, [pathname]);\n\n return null;\n}\n\nexport default DgmoClient;\n","/**\n * Framework-neutral client-side enhancement for diagrams emitted by\n * `remark-dgmo`:\n *\n * - Bind a delegated click handler for the showcase toolbar buttons:\n * `.dgmo-copy` copies the source string in `data-dgmo-source` to the\n * clipboard. `.dgmo-open` is an `<a href>` whose default-action\n * navigation is preserved — except when it lives inside a `<summary>`\n * (the collapsible toolbar case), where we have to manually navigate\n * because the same click's `preventDefault()` cancels both the\n * summary's toggle AND the anchor's nav.\n * - Tighten each diagram's `viewBox` to its actual content bounds via\n * `SVGGraphicsElement.getBBox()`, since SVG-export from the renderer\n * embeds a generous bounding box.\n *\n * `bindDgmo()` is safe to call multiple times: the click handler is bound\n * once-and-only-once (idempotent), and viewBox tightening is run every\n * invocation so SPA-style frameworks (Docusaurus) can re-run it after\n * route changes.\n *\n * In a non-browser environment, `bindDgmo()` is a no-op. We can't just check\n * for `window`/`document`: some SSG renderers (Docusaurus's static export among\n * them) evaluate client modules against a PARTIAL DOM that defines `window` and\n * `document` but NOT the browser-only APIs this function relies on\n * (`MutationObserver`, `requestAnimationFrame`, `SVGGraphicsElement.getBBox`).\n * So we feature-detect those too and bail unless we're in a real browser —\n * otherwise the module-level auto-init below throws during server render.\n */\n\n// Lean, zero-import ~1 KB ticker for the `countdown` chart type — the only\n// dynamic dgmo chart. Its own subpath so this client bundle never pulls the\n// render pipeline. Lights up all five remark host wrappers (Astro, Docusaurus,\n// Fumadocs, Nextra, VitePress) — they all call bindDgmo().\nimport { startCountdowns } from '@diagrammo/dgmo/countdown';\n// Same deal for the `clock` chart type — a sibling ~1 KB 1s ticker on its own\n// subpath. Updates the baked `data-dgmo-clock` analog/digital world-clock rows.\nimport { startClocks } from '@diagrammo/dgmo/clock';\n\nlet clickHandlerBound = false;\nlet themeObserverBound = false;\n\nfunction isInteractiveBrowser(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof MutationObserver !== 'undefined' &&\n typeof requestAnimationFrame !== 'undefined'\n );\n}\n\nexport function bindDgmo(): void {\n if (!isInteractiveBrowser()) return;\n\n if (!clickHandlerBound) {\n // Capture phase, not bubble: the handler must run BEFORE any\n // framework-level click handling. Docusaurus (markdown.format 'md')\n // maps the raw <details> onto its theme Details component, whose React\n // onClick — delegated at the app root — toggles the panel for ANY click\n // inside the <summary>, including our copy/open buttons. Capturing at\n // document and stopping propagation for in-summary buttons keeps those\n // clicks ours; plain summary clicks pass through untouched so the\n // toggle (native or framework-managed) still works.\n document.addEventListener(\n 'click',\n (e) => {\n void handleToolbarBtnClick(e);\n },\n true\n );\n clickHandlerBound = true;\n }\n tightenViewBoxes();\n\n // Seed the dynamic chart types (countdown, clock) and register their 1s\n // tickers (idempotent; no-op when none are on the page). Both call\n // `window.setInterval`, so gate on it: a partial DOM can clear the\n // interactive-browser guard above yet still lack timers (some SSG runtimes).\n if (typeof window.setInterval === 'function') {\n startCountdowns();\n startClocks();\n }\n\n // Color-mode toggles flip which dual-render wrapper is `display: none`.\n // The wrapper that was hidden at load couldn't be measured (getBBox\n // returns 0 on display:none subtrees), so its SVG keeps the full\n // un-tightened viewBox and looks tiny when it becomes visible. Watch\n // for the host's color-mode signal flipping and re-tighten then.\n //\n // Double-rAF defers the measurement until AFTER the browser has\n // finished the layout pass that the display-change triggered. Without\n // it, MutationObserver fires synchronously before layout and getBBox\n // still returns 0 on the freshly-visible element.\n if (!themeObserverBound) {\n const html = document.documentElement;\n const reTighten = () => {\n requestAnimationFrame(() => requestAnimationFrame(tightenViewBoxes));\n };\n new MutationObserver(reTighten).observe(html, {\n attributes: true,\n attributeFilter: ['data-theme', 'class'],\n });\n themeObserverBound = true;\n }\n}\n\nasync function handleToolbarBtnClick(e: Event): Promise<void> {\n const target = e.target as Element | null;\n if (!target || typeof target.closest !== 'function') return;\n const btn = target.closest('.dgmo-toolbar-btn') as HTMLElement | null;\n if (!btn) return;\n\n // The showcase toolbar IS the <summary> of a <details> disclosure, so a\n // click on any descendant would also toggle the disclosure unless we\n // cancel the default action. preventDefault here cancels the summary's\n // toggle — but it also cancels an anchor's navigation, so we have to\n // manually re-open the link below when the open-in-editor button is\n // nested inside a summary.\n const insideSummary = !!btn.closest('summary');\n if (insideSummary) {\n e.preventDefault();\n // Keep the click from reaching framework toggle handlers (Docusaurus's\n // Details component collapses the panel on any in-summary click).\n e.stopPropagation();\n }\n\n if (btn.matches('button.dgmo-expand')) {\n openDgmoLightbox(btn);\n return;\n }\n\n if (btn.matches('button.dgmo-copy')) {\n const src = btn.dataset['dgmoSource'] ?? '';\n try {\n await navigator.clipboard.writeText(src);\n } catch {\n return;\n }\n btn.classList.add('dgmo-copy--success');\n setTimeout(() => btn.classList.remove('dgmo-copy--success'), 1500);\n return;\n }\n\n if (insideSummary && btn.matches('a.dgmo-open')) {\n const anchor = btn as HTMLAnchorElement;\n if (anchor.href) {\n window.open(\n anchor.href,\n anchor.target || '_blank',\n 'noopener,noreferrer'\n );\n }\n }\n}\n\n// ============================================================\n// Full-screen lightbox (expand toolbar button)\n// ============================================================\n//\n// MIRROR of the canonical helper in @diagrammo/dgmo's `auto/shared.ts`\n// (`openDgmoLightbox`), kept near-verbatim here for the same reason copy/open\n// handling is mirrored per surface. The `.dgmo-lightbox*` CSS is single-sourced\n// in dgmo's BLOCK_CSS (this package's client.css is a generated byte-copy).\n\nconst LIGHTBOX_XLINK_NS = 'http://www.w3.org/1999/xlink';\nconst LIGHTBOX_REF_ATTRS = [\n 'clip-path',\n 'mask',\n 'filter',\n 'fill',\n 'stroke',\n 'marker-start',\n 'marker-mid',\n 'marker-end',\n];\nlet lightboxIdSeq = 0;\n\nconst LIGHTBOX_CLOSE_ICON =\n '<svg width=\"20\" height=\"20\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"m4 4 8 8\"/><path d=\"m12 4-8 8\"/></svg>';\n\n/**\n * Namespace a cloned SVG's ids + internal `url(#id)`/`href=\"#id\"` refs so the\n * clone can't clash with the still-mounted inline copy (WebKit resolves\n * duplicate ids to the first match, corrupting gradients/clips/masks).\n */\nfunction namespaceLightboxSvgIds(root: SVGElement, prefix: string): void {\n const map = new Map<string, string>();\n root.querySelectorAll('[id]').forEach((el) => {\n const oldId = el.getAttribute('id');\n if (!oldId) return;\n const newId = prefix + oldId;\n map.set(oldId, newId);\n el.setAttribute('id', newId);\n });\n if (map.size === 0) return;\n const remap = (value: string): string =>\n value.replace(/url\\(#([^)]+)\\)/g, (m, id: string) => {\n const next = map.get(id);\n return next ? `url(#${next})` : m;\n });\n root.querySelectorAll('*').forEach((el) => {\n for (const attr of LIGHTBOX_REF_ATTRS) {\n const v = el.getAttribute(attr);\n if (v && v.includes('url(#')) el.setAttribute(attr, remap(v));\n }\n const style = el.getAttribute('style');\n if (style && style.includes('url(#'))\n el.setAttribute('style', remap(style));\n const href = el.getAttribute('href');\n if (href && href.startsWith('#') && map.has(href.slice(1)))\n el.setAttribute('href', '#' + map.get(href.slice(1)));\n const xhref = el.getAttributeNS(LIGHTBOX_XLINK_NS, 'href');\n if (xhref && xhref.startsWith('#') && map.has(xhref.slice(1)))\n el.setAttributeNS(\n LIGHTBOX_XLINK_NS,\n 'href',\n '#' + map.get(xhref.slice(1))\n );\n });\n}\n\n/**\n * Open the diagram belonging to `fromButton`'s block in a full-viewport\n * `<dialog>` lightbox: clone the currently-visible color-mode SVG, namespace\n * its ids, then `showModal()`. Escape / backdrop-click / close button dismiss.\n */\nfunction openDgmoLightbox(fromButton: Element): void {\n if (typeof document === 'undefined') return;\n const block = fromButton.closest('.dgmo');\n if (!block) return;\n\n const wrappers = block.querySelectorAll('.dgmo-light, .dgmo-dark, .dgmo-svg');\n let svg: SVGSVGElement | null = null;\n for (const w of Array.from(wrappers)) {\n if (window.getComputedStyle(w).display === 'none') continue;\n const found = w.querySelector('svg');\n if (found) {\n svg = found as SVGSVGElement;\n break;\n }\n }\n if (!svg) svg = block.querySelector('svg');\n if (!svg) return;\n\n const clone = svg.cloneNode(true) as SVGSVGElement;\n namespaceLightboxSvgIds(clone, `dgmo-lb-${++lightboxIdSeq}-`);\n\n const dialog = document.createElement('dialog');\n dialog.className = 'dgmo-lightbox';\n dialog.setAttribute('aria-label', 'Diagram, full screen');\n\n const closeBtn = document.createElement('button');\n closeBtn.type = 'button';\n closeBtn.className = 'dgmo-lightbox-close';\n closeBtn.setAttribute('aria-label', 'Close full screen');\n closeBtn.innerHTML = LIGHTBOX_CLOSE_ICON;\n\n const host = document.createElement('div');\n host.className = 'dgmo-lightbox-svg';\n host.appendChild(clone);\n\n dialog.appendChild(closeBtn);\n dialog.appendChild(host);\n document.body.appendChild(dialog);\n\n const close = (): void => {\n if (dialog.open) dialog.close();\n };\n closeBtn.addEventListener('click', close);\n dialog.addEventListener('click', (e) => {\n if (e.target === dialog) close();\n });\n dialog.addEventListener('close', () => dialog.remove());\n dialog.showModal();\n}\n\nfunction tightenViewBoxes(): void {\n const WRAPPER_SELECTORS = '.dgmo-light, .dgmo-dark, .dgmo-svg';\n document.querySelectorAll(WRAPPER_SELECTORS).forEach((node) => {\n const wrapper = node as HTMLElement;\n const svg = wrapper.querySelector('svg') as SVGSVGElement | null;\n if (!svg) return;\n\n // `getBBox()` returns 0,0,0,0 on elements whose ancestor is `display: none`.\n // Under dual-render the inactive color-mode wrapper IS display:none at load,\n // so its SVG would stay un-tightened — and then look small after the user\n // toggles into it. Set the wrapper to inline-style `display: block`\n // synchronously, read getBBox, then restore. Modern browsers don't paint\n // between these synchronous DOM writes, so there's no visible flicker.\n const computed = window.getComputedStyle(wrapper);\n const wasHidden = computed.display === 'none';\n const savedInlineDisplay = wrapper.style.display;\n if (wasHidden) {\n wrapper.style.display = 'block';\n // Force a synchronous layout pass before getBBox so the freshly-\n // shown element actually has bounds. Without this, some browsers\n // still report 0,0,0,0 because they batch the display change for\n // the next frame.\n void wrapper.offsetHeight;\n }\n\n try {\n const bbox = (svg as unknown as SVGGraphicsElement).getBBox();\n if (bbox.width > 0 && bbox.height > 0) {\n const pad = 16;\n svg.setAttribute(\n 'viewBox',\n `${bbox.x - pad} ${bbox.y - pad} ${bbox.width + pad * 2} ${\n bbox.height + pad * 2\n }`\n );\n }\n } catch {\n // ignore: SVG not yet in the DOM, or getBBox unsupported\n }\n\n if (wasHidden) {\n wrapper.style.display = savedInlineDisplay;\n // Clearing the only inline property leaves `style=\"\"` on the\n // element in Chrome/Safari. React 19's post-hydration check reads\n // that empty attribute as a server-vs-client mismatch on the\n // wrapper div (the wrapper is React-owned; only its `innerHTML`\n // is dangerouslySetInnerHTML). Drop the empty attribute so the\n // wrapper round-trips back to its SSR shape.\n if (savedInlineDisplay === '' && wrapper.getAttribute('style') === '') {\n wrapper.removeAttribute('style');\n }\n }\n });\n}\n\n// Auto-init on initial load. Docusaurus-style SPA wrappers also re-call\n// bindDgmo on route changes; that's safe (the click handler is bound once,\n// viewBox tightening runs every time).\nif (isInteractiveBrowser()) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', bindDgmo);\n } else {\n bindDgmo();\n }\n}\n"],"mappings":";;;AAsBA,OAAO;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;;;ACS5B,SAAS,uBAAuB;AAGhC,SAAS,mBAAmB;AAE5B,IAAI,oBAAoB;AACxB,IAAI,qBAAqB;AAEzB,SAAS,uBAAgC;AACvC,SACE,OAAO,WAAW,eAClB,OAAO,aAAa,eACpB,OAAO,qBAAqB,eAC5B,OAAO,0BAA0B;AAErC;AAEO,SAAS,WAAiB;AAC/B,MAAI,CAAC,qBAAqB,EAAG;AAE7B,MAAI,CAAC,mBAAmB;AAStB,aAAS;MACP;MACA,CAAC,MAAM;AACL,aAAK,sBAAsB,CAAC;MAC9B;MACA;IACF;AACA,wBAAoB;EACtB;AACA,mBAAiB;AAMjB,MAAI,OAAO,OAAO,gBAAgB,YAAY;AAC5C,oBAAgB;AAChB,gBAAY;EACd;A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Y,SAAS,YAAY;AACvC,UAAM,qBAAqB,QAAQ,MAAM;AACzC,QAAI,WAAW;AACb,cAAQ,MAAM,UAAU;AAKxB,WAAK,QAAQ;IACf;AAEA,QAAI;AACF,YAAM,OAAQ,IAAsC,QAAQ;AAC5D,UAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,GAAG;AACrC,cAAM,MAAM;AACZ,YAAI;UACF;UACA,GAAG,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,QAAQ,MAAM,CAAC,IACrD,KAAK,SAAS,MAAM,CACtB;QACF;MACF;IACF,QAAQ;IAER;AAEA,QAAI,WAAW;AACb,cAAQ,MAAM,UAAU;AAOxB,UAAI,uBAAuB,MAAM,QAAQ,aAAa,OAAO,MAAM,IAAI;AACrE,gBAAQ,gBAAgB,OAAO;MACjC;IACF;EACF,CAAC;AACH;AAKA,IAAI,qBAAqB,GAAG;AAC1B,MAAI,SAAS,eAAe,WAAW;AACrC,aAAS,iBAAiB,oBAAoB,QAAQ;EACxD,OAAO;AACL,aAAS;EACX;AACF;;;ADxTO,SAAS,aAAmB;AACjC,QAAM,WAAW,YAAY;AAE7B,YAAU,MAAM;AAId,aAAS;AAAA,EACX,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACT;AAEA,IAAO,wBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextra-dgmo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Nextra integration to render DGMO diagrams from fenced code blocks at build time. Two-step install: `withDgmo()` in next.config.mjs plus `<DgmoClient />` in app/layout.tsx — the client component handles route-change rebinding and auto-imports the theme-aware stylesheet.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"remark-dgmo": "^0.
|
|
98
|
+
"remark-dgmo": "^0.7.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@diagrammo/dgmo": "^0.
|
|
101
|
+
"@diagrammo/dgmo": "^0.49.0",
|
|
102
102
|
"@eslint/js": "^10.0.1",
|
|
103
103
|
"@types/node": "^22.10.0",
|
|
104
104
|
"@types/react": "^19.0.0",
|