nextra-dgmo 0.2.3 → 0.2.4

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.
@@ -5,7 +5,7 @@ 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.5.3_@diagrammo+dgmo@0.48.1_@lezer+common@1.5.2_@lezer+highlight@1.2.3_@lezer+lr@1.4.10_/node_modules/remark-dgmo/dist/client.js
8
+ // node_modules/.pnpm/remark-dgmo@0.5.4_@diagrammo+dgmo@0.48.1_@lezer+common@1.5.2_@lezer+highlight@1.2.3_@lezer+lr@1.4.10_/node_modules/remark-dgmo/dist/client.js
9
9
  var clickHandlerBound = false;
10
10
  var themeObserverBound = false;
11
11
  function isInteractiveBrowser() {
@@ -14,9 +14,13 @@ function isInteractiveBrowser() {
14
14
  function bindDgmo() {
15
15
  if (!isInteractiveBrowser()) return;
16
16
  if (!clickHandlerBound) {
17
- document.addEventListener("click", (e) => {
18
- void handleToolbarBtnClick(e);
19
- });
17
+ document.addEventListener(
18
+ "click",
19
+ (e) => {
20
+ void handleToolbarBtnClick(e);
21
+ },
22
+ true
23
+ );
20
24
  clickHandlerBound = true;
21
25
  }
22
26
  tightenViewBoxes();
@@ -38,7 +42,10 @@ async function handleToolbarBtnClick(e) {
38
42
  const btn = target.closest(".dgmo-toolbar-btn");
39
43
  if (!btn) return;
40
44
  const insideSummary = !!btn.closest("summary");
41
- if (insideSummary) e.preventDefault();
45
+ if (insideSummary) {
46
+ e.preventDefault();
47
+ e.stopPropagation();
48
+ }
42
49
  if (btn.matches("button.dgmo-copy")) {
43
50
  const src = btn.dataset["dgmoSource"] ?? "";
44
51
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/nextra-client.tsx","../node_modules/.pnpm/remark-dgmo@0.5.3_@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 document.addEventListener('click', (e) => {\n void handleToolbarBtnClick(e);\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) e.preventDefault();\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\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;AACtB,aAAS,iBAAiB,SAAS,CAAC,MAAM;AACxC,WAAK,sBAAsB,CAAC;IAC9B,CAAC;AACD,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,MA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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;;;ADvJO,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.5.4_@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-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\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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,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;;;ADxKO,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",
3
+ "version": "0.2.4",
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,7 +95,7 @@
95
95
  }
96
96
  },
97
97
  "dependencies": {
98
- "remark-dgmo": "^0.5.3"
98
+ "remark-dgmo": "^0.5.4"
99
99
  },
100
100
  "devDependencies": {
101
101
  "@diagrammo/dgmo": "^0.48.1",