comark-ui 0.7.1 → 0.7.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.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/client-Bjd6VcGQ.mjs +241 -0
  3. package/dist/client.d.mts +11 -1
  4. package/dist/client.mjs +3 -26
  5. package/dist/{editor-BAdok66p.mjs → editor-DmxNPK7K.mjs} +522 -68
  6. package/dist/{editor-CNivEuMH.d.mts → editor-KD97dL_1.d.mts} +21 -3
  7. package/dist/editor-vue.d.mts +1 -1
  8. package/dist/editor-vue.mjs +1 -1
  9. package/dist/editor.d.mts +2 -2
  10. package/dist/editor.mjs +1 -1
  11. package/dist/html.d.mts +7 -1
  12. package/dist/html.mjs +29 -9
  13. package/dist/{index-B0YvApci.d.mts → index-BUDHsvnm.d.mts} +11 -2
  14. package/dist/index.d.mts +1 -1
  15. package/dist/index.mjs +2 -2
  16. package/dist/react.d.mts +2 -2
  17. package/dist/react.mjs +20 -6
  18. package/dist/skills/before-after-evidence/SKILL.md +72 -0
  19. package/dist/skills/before-after-evidence/agents/openai.yaml +3 -0
  20. package/dist/skills/before-after-evidence/references/blocks.md +54 -0
  21. package/dist/skills/before-after-evidence/references/example.md +37 -0
  22. package/dist/skills/before-after-evidence/references/measuring.md +50 -0
  23. package/dist/skills/comark-ui/SKILL.md +9 -2
  24. package/dist/skills/comark-ui/references/annotate.md +4 -2
  25. package/dist/skills/comark-ui/references/comments.md +43 -0
  26. package/dist/skills/comark-ui/references/diagrams.md +7 -1
  27. package/dist/skills/comark-ui/references/lint.md +1 -1
  28. package/dist/skills/comark-ui/references/outline.md +9 -1
  29. package/dist/skills/comark-ui/references/quiz.md +1 -1
  30. package/dist/skills/comark-ui/references/ui.md +1 -1
  31. package/dist/skills/review-document/SKILL.md +64 -0
  32. package/dist/skills/review-document/agents/openai.yaml +3 -0
  33. package/dist/skills/review-document/references/blocks.md +69 -0
  34. package/dist/skills/review-document/references/example.md +51 -0
  35. package/dist/skills/teach-lesson/SKILL.md +78 -0
  36. package/dist/skills/teach-lesson/agents/openai.yaml +3 -0
  37. package/dist/skills/teach-lesson/references/blocks.md +91 -0
  38. package/dist/skills/teach-lesson/references/example.md +70 -0
  39. package/dist/skills/visual-explanation/SKILL.md +67 -0
  40. package/dist/skills/visual-explanation/agents/openai.yaml +3 -0
  41. package/dist/skills/visual-explanation/references/blocks.md +89 -0
  42. package/dist/skills/visual-explanation/references/example.md +25 -0
  43. package/dist/skills.d.mts +18 -0
  44. package/dist/skills.mjs +326 -0
  45. package/dist/{src-DROB05U6.mjs → src-PkmYCSNu.mjs} +1 -0
  46. package/dist/svelte/Mermaid.svelte +16 -0
  47. package/dist/svelte/index.d.ts +1 -1
  48. package/dist/svelte/index.js +4 -8
  49. package/dist/{typeset-css-DPB0S1bV.mjs → typeset-css-5aJ7cSmh.mjs} +14 -0
  50. package/dist/vue.d.mts +2 -2
  51. package/dist/vue.mjs +33 -6
  52. package/package.json +46 -44
package/README.md CHANGED
@@ -50,7 +50,7 @@ Vue, React, and Svelte leave out annotate and diff, which render only to HTML.
50
50
 
51
51
  | Export | What it does |
52
52
  | --- | --- |
53
- | `ComarkKit` | The schema: StarterKit, task lists, inline images (drawn as players for video and audio), tables, and Comark's components, slots, and comments, each keeping the attributes it has no field for. |
53
+ | `ComarkKit` | The schema: StarterKit, task lists, inline images (drawn as players for video and audio), tables, footnotes, definition lists, CriticMarkup, and Comark's components, slots, and comments, each keeping the attributes it has no field for. |
54
54
  | `fromMarkdown`, `toMarkdown` | Convert between Markdown and the editor's JSON with Comark's own parser and writer. Front matter stays beside the document. |
55
55
  | `checkMarkdown(markdown, { plugins })` | Whether the editor can save the document without changing what readers see, judged with the plugins the page renders with. A document it can't keep opens read-only. |
56
56
  | `Upload` | Uploads pasted and dropped files. Each shows a placeholder with its progress until `upload(file, progress)` returns its URL. The placeholder is a decoration, so a collaborative document never holds a file that hasn't arrived. |
@@ -60,7 +60,7 @@ Vue, React, and Svelte leave out annotate and diff, which render only to HTML.
60
60
 
61
61
  ## Agents
62
62
 
63
- The package ships the [comark-ui agent skill](https://github.com/onmax/comark-ui/tree/main/skills/comark-ui): a `SKILL.md` that says how to install the plugins, which block shows what, and how to check the result, and a reference for each package. Install it with `npx skills add onmax/comark-ui`, or bundle it in your own app from `comark-ui/skills/comark-ui/`, which always matches the plugins it installed.
63
+ The package ships the [comark-ui agent skill](https://github.com/onmax/comark-ui/tree/main/skills/comark-ui): a `SKILL.md` that says how to install the plugins, which block shows what, and how to check the result, and a reference for each package. Install it with `vp dlx skills add onmax/comark-ui`, link it from `node_modules` with `vp dlx skills experimental_sync` (experimental), or bundle it in your own app from `comark-ui/skills/comark-ui/`, which always matches the plugins it installed. `vp` comes with [Vite+](https://viteplus.dev/guide/global-cli); without it, `pnpm dlx` takes the same arguments.
64
64
 
65
65
  ## Linting
66
66
 
@@ -0,0 +1,241 @@
1
+ import { theme } from "comark-zoom/theme";
2
+ //#region src/script.ts
3
+ /**
4
+ * Starts the Copy image and Copy source buttons of every `.cmm` Mermaid diagram on the page and returns a function that
5
+ * stops them. Every caller shares one set of listeners, which stop with the last caller. The function is
6
+ * self-contained: the HTML renderer inlines its source as a script, so it must not use anything from outside its body.
7
+ */
8
+ function start() {
9
+ const running = window.__comarkMermaid;
10
+ if (running) {
11
+ running.users++;
12
+ return running.stop;
13
+ }
14
+ const listeners = new AbortController();
15
+ const signal = listeners.signal;
16
+ document.documentElement.setAttribute("data-mermaid-ready", "");
17
+ const links = /* @__PURE__ */ new Set();
18
+ const PROPERTIES = [
19
+ "fill",
20
+ "fill-opacity",
21
+ "stroke",
22
+ "stroke-opacity",
23
+ "stroke-width",
24
+ "stroke-dasharray",
25
+ "stroke-linecap",
26
+ "stroke-linejoin",
27
+ "opacity",
28
+ "color",
29
+ "rx",
30
+ "ry",
31
+ "font-family",
32
+ "font-size",
33
+ "font-weight",
34
+ "font-style",
35
+ "letter-spacing",
36
+ "text-anchor",
37
+ "dominant-baseline",
38
+ "paint-order"
39
+ ];
40
+ function background(from) {
41
+ const probe = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
42
+ for (let at = from; at && probe; at = at.parentElement) {
43
+ const color = getComputedStyle(at).backgroundColor;
44
+ probe.clearRect(0, 0, 1, 1);
45
+ probe.fillStyle = color;
46
+ probe.fillRect(0, 0, 1, 1);
47
+ if (probe.getImageData(0, 0, 1, 1).data[3] === 255) return color;
48
+ }
49
+ return "#fff";
50
+ }
51
+ function png(root) {
52
+ const svg = root.querySelector(".pele-diagram>svg");
53
+ if (!svg) return Promise.reject(/* @__PURE__ */ new Error("no diagram"));
54
+ const width = Number(svg.getAttribute("width")) || svg.viewBox.baseVal.width;
55
+ const height = Number(svg.getAttribute("height")) || svg.viewBox.baseVal.height;
56
+ if (!(width > 0 && height > 0)) return Promise.reject(/* @__PURE__ */ new Error("no size"));
57
+ const copy = svg.cloneNode(true);
58
+ if (!(copy instanceof SVGSVGElement)) return Promise.reject(/* @__PURE__ */ new Error("no diagram"));
59
+ const from = [svg, ...svg.querySelectorAll("*")];
60
+ const to = [copy, ...copy.querySelectorAll("*")];
61
+ from.forEach((node, index) => {
62
+ const into = to[index];
63
+ if (!(into instanceof SVGElement)) return;
64
+ const style = getComputedStyle(node);
65
+ for (const property of PROPERTIES) into.style.setProperty(property, style.getPropertyValue(property));
66
+ });
67
+ copy.setAttribute("viewBox", `0 0 ${width} ${height}`);
68
+ copy.setAttribute("width", String(width));
69
+ copy.setAttribute("height", String(height));
70
+ copy.style.maxWidth = "none";
71
+ copy.style.width = `${width}px`;
72
+ copy.style.height = `${height}px`;
73
+ const scale = Math.min(2, 4096 / width, 4096 / height);
74
+ const canvas = document.createElement("canvas");
75
+ canvas.width = Math.max(1, Math.round(width * scale));
76
+ canvas.height = Math.max(1, Math.round(height * scale));
77
+ const fill = background(svg.parentElement ?? root);
78
+ const image = new Image();
79
+ return new Promise((resolve, reject) => {
80
+ image.onerror = () => reject(/* @__PURE__ */ new Error("not drawn"));
81
+ image.onload = () => {
82
+ const context = canvas.getContext("2d");
83
+ if (!context) return reject(/* @__PURE__ */ new Error("no canvas"));
84
+ context.fillStyle = fill;
85
+ context.fillRect(0, 0, canvas.width, canvas.height);
86
+ context.drawImage(image, 0, 0, canvas.width, canvas.height);
87
+ canvas.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("no image")), "image/png");
88
+ };
89
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(copy))}`;
90
+ });
91
+ }
92
+ const part = (root, selector) => root.querySelector(`:scope>.cmm-bar>${selector}`);
93
+ function say(root, button, message, state) {
94
+ const status = part(root, ".cmm-status");
95
+ if (!status) return;
96
+ button.setAttribute("data-state", state);
97
+ status.textContent = message;
98
+ setTimeout(() => {
99
+ if (status.textContent !== message) return;
100
+ button.removeAttribute("data-state");
101
+ status.textContent = "";
102
+ }, state === "done" ? 1500 : 6e3);
103
+ }
104
+ function copyImage(root, button) {
105
+ const open = part(root, ".cmm-open");
106
+ if (open) open.hidden = true;
107
+ const image = png(root);
108
+ image.catch(() => {});
109
+ const clipboard = navigator.clipboard;
110
+ (clipboard && "ClipboardItem" in window ? clipboard.write([new ClipboardItem({ "image/png": image })]) : Promise.reject(/* @__PURE__ */ new Error("no clipboard"))).then(() => say(root, button, "Image copied", "done"), () => image.then((blob) => {
111
+ if (!open) return;
112
+ if (open.href) {
113
+ URL.revokeObjectURL(open.href);
114
+ links.delete(open.href);
115
+ }
116
+ open.href = URL.createObjectURL(blob);
117
+ links.add(open.href);
118
+ open.hidden = false;
119
+ say(root, button, "Couldn't copy the image. Open the PNG to save it.", "failed");
120
+ }, () => say(root, button, "Couldn't draw the image. Copy the source instead.", "failed")));
121
+ }
122
+ function copySource(root, button) {
123
+ const source = (root.getAttribute("data-source") ?? "").replace(/\n$/, "");
124
+ const longest = Math.max(2, ...(source.match(/`+/g) ?? []).map((run) => run.length));
125
+ const fence = "`".repeat(longest + 1);
126
+ const markdown = `${fence}mermaid\n${source}\n${fence}`;
127
+ const shown = root.querySelector(":scope>.cmm-markdown");
128
+ const failed = () => {
129
+ const pre = shown ?? document.createElement("pre");
130
+ pre.className = "cmm-markdown";
131
+ pre.textContent = markdown;
132
+ if (!shown) root.append(pre);
133
+ const range = document.createRange();
134
+ range.selectNodeContents(pre);
135
+ const selection = getSelection();
136
+ selection?.removeAllRanges();
137
+ selection?.addRange(range);
138
+ say(root, button, "Couldn't copy, so the source is selected. Press Ctrl+C or ⌘C.", "failed");
139
+ };
140
+ const clipboard = navigator.clipboard;
141
+ if (!clipboard) return failed();
142
+ clipboard.writeText(markdown).then(() => {
143
+ shown?.remove();
144
+ say(root, button, "Source copied", "done");
145
+ }, failed);
146
+ }
147
+ document.addEventListener("click", (event) => {
148
+ const button = event.target instanceof Element ? event.target.closest(".cmm>.cmm-bar>button") : null;
149
+ const root = button?.parentElement?.parentElement;
150
+ if (!button || !root) return;
151
+ if (button.classList.contains("cmm-image")) copyImage(root, button);
152
+ else if (button.classList.contains("cmm-source")) copySource(root, button);
153
+ }, { signal });
154
+ const state = {
155
+ users: 1,
156
+ stop: () => {
157
+ if (--state.users > 0) return;
158
+ listeners.abort();
159
+ for (const link of links) URL.revokeObjectURL(link);
160
+ document.documentElement.removeAttribute("data-mermaid-ready");
161
+ window.__comarkMermaid = void 0;
162
+ }
163
+ };
164
+ window.__comarkMermaid = state;
165
+ return state.stop;
166
+ }
167
+ //#endregion
168
+ //#region src/client.ts
169
+ /**
170
+ * comark-pele's diagrams on the shared `--comark-*` tokens, on a card like comark-diagrams'. Pele paints with its
171
+ * `--pele-*` variables, so setting them on the wrapper themes every diagram, light and dark, without drawing it
172
+ * again. The rules sit in the `comark` layer, so host `--pele-*` values are preserved and win over these fallbacks.
173
+ */
174
+ const mermaidCss = `@layer comark{${[
175
+ theme(".cmm,.pele-diagram"),
176
+ theme(":root"),
177
+ `:where(:root){--pele-bg:var(--_comark-background);--pele-fg:var(--_comark-foreground);--pele-muted:var(--_comark-muted);--pele-line:var(--_comark-muted);--pele-surface:var(--_comark-accent);--pele-surface-alt:color-mix(in srgb,var(--_comark-accent),var(--_comark-foreground) 6%);--pele-border:var(--_comark-border);--pele-accent:var(--ui-primary,var(--primary,var(--_comark-foreground)));--pele-critical:var(--ui-error,var(--destructive,#dc2626));--pele-error:var(--ui-error,var(--destructive,#dc2626));--pele-font:var(--_comark-font);--pele-radius:calc(var(--_comark-radius) - 4px);--pele-series-1:var(--comark-chart-1,var(--ui-chart-1,var(--chart-1,#3b82f6)));--pele-series-2:var(--comark-chart-2,var(--ui-chart-2,var(--chart-2,#f97316)));--pele-series-3:var(--comark-chart-3,var(--ui-chart-3,var(--chart-3,#10b981)));--pele-series-4:var(--comark-chart-4,var(--ui-chart-4,var(--chart-4,#a855f7)));--pele-series-5:var(--comark-chart-5,var(--ui-chart-5,var(--chart-5,#f43f5e)));--pele-series-6:var(--comark-chart-6,var(--ui-chart-6,var(--chart-6,#eab308)));--pele-series-7:var(--comark-chart-7,var(--ui-chart-7,var(--chart-7,#06b6d4)));--pele-series-8:var(--comark-chart-8,var(--ui-chart-8,var(--chart-8,#ec4899)))}`,
178
+ ".pele-diagram{box-sizing:border-box;margin-block:1.5rem;padding:1rem;overflow-x:auto;border:1px solid var(--_comark-border);border-radius:var(--_comark-radius);background:var(--_comark-background);color:var(--_comark-foreground);text-align:center}",
179
+ ".pele-diagram>svg{min-width:min(28rem,var(--cmm-svg,28rem))}",
180
+ ".pele-source{margin:0;color:var(--_comark-muted);text-align:left}",
181
+ ".cmm{--comark-wide-width:calc(var(--cmm-svg) + 2rem + 2px);--pele-zoom-top:auto;--pele-zoom-bottom:.5rem;position:relative;margin-block:1.5rem}",
182
+ ".cmm>.pele-diagram{margin-block:0}",
183
+ ".cmm-bar{position:absolute;top:.375rem;right:.375rem;z-index:1;display:flex;align-items:center;gap:.125rem;padding:.125rem;border-radius:calc(var(--_comark-radius) - 2px);background:var(--_comark-background);opacity:0;transition:opacity .15s}",
184
+ "html:not([data-mermaid-ready]) .cmm-bar{display:none}",
185
+ ".cmm:is(:hover,:focus-within)>.cmm-bar,.cmm-bar:has(.cmm-status:not(:empty),.cmm-open:not([hidden])){opacity:1}",
186
+ "@media (hover:none){.cmm-bar{opacity:1}}",
187
+ ".cmm:has(>.pele-diagram[data-error]) .cmm-image{display:none}",
188
+ ".cmm-bar>button{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin:0;padding:0;border:1px solid transparent;border-radius:calc(var(--_comark-radius) - 2px);background:transparent;color:var(--_comark-muted);position:relative;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .15s ease,color .15s ease}",
189
+ "@media (hover:hover){.cmm-bar>button:hover{background:var(--_comark-accent);color:var(--_comark-foreground)}}",
190
+ "@media (prefers-reduced-motion:no-preference){.cmm-bar>button{transition:background-color .15s ease,color .15s ease,scale .15s ease-out}.cmm-bar>button:active{scale:.96}}",
191
+ ".cmm-bar>button:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--_comark-ring) 50%,transparent)}",
192
+ ".cmm-bar svg{width:.75rem;height:.75rem;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}",
193
+ ".cmm-done,.cmm-bar>[data-state=done] .cmm-idle{display:none}",
194
+ ".cmm-bar>[data-state=done] .cmm-done{display:block}",
195
+ ".cmm-open{padding:0 .375rem;color:var(--_comark-foreground);font:500 .75rem/1.5rem var(--_comark-font);text-decoration:underline;text-underline-offset:2px}",
196
+ ".cmm-open[hidden]{display:none}",
197
+ ".cmm-status{position:absolute;top:calc(100% + .25rem);right:0;width:max-content;max-width:18rem;padding:.25rem .5rem;border-radius:calc(var(--_comark-radius) - 4px);background:var(--_comark-foreground);color:var(--_comark-background);font:.75rem/1.25rem var(--_comark-font);text-align:left;pointer-events:none}",
198
+ ".cmm-status:empty{display:none}",
199
+ ".cmm-markdown{margin:.5rem 0 0;padding:.75rem 1rem;overflow-x:auto;border:1px solid var(--_comark-border);border-radius:var(--_comark-radius);background:var(--_comark-accent);color:var(--_comark-foreground);font:.8125rem/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre}",
200
+ ".cz-item>.pele-diagram>svg{min-width:0}",
201
+ "@media print{.pele-diagram{break-inside:avoid}.cmm-bar{display:none}}"
202
+ ].join("")}}`;
203
+ /** Sizes Mermaid cards after Pele draws them in Vue, React, and Svelte, and adds the styles to the page once. */
204
+ function addMermaidStyles() {
205
+ for (const card of document.querySelectorAll(".pele-diagram")) {
206
+ const svg = card.querySelector(":scope > svg");
207
+ const width = Number(svg?.getAttribute("width"));
208
+ const block = card.parentElement?.classList.contains("cmm") ? card.parentElement : card;
209
+ if (Number.isFinite(width) && width > 0 && !card.querySelector(":scope > .pele-error")) {
210
+ block.dataset.wide = "";
211
+ block.style.setProperty("--cmm-svg", `${Math.ceil(width)}px`);
212
+ } else {
213
+ delete block.dataset.wide;
214
+ block.style.removeProperty("--cmm-svg");
215
+ }
216
+ }
217
+ if (document.querySelector("style[data-comark-mermaid]")) return;
218
+ const style = document.createElement("style");
219
+ style.dataset.comarkMermaid = "";
220
+ style.textContent = mermaidCss;
221
+ document.head.append(style);
222
+ }
223
+ const icon = (name, path) => `<svg class="cmm-${name}" viewBox="0 0 24 24" aria-hidden="true">${path}</svg>`;
224
+ const done = icon("done", "<path d=\"M20 6 9 17l-5-5\"/>");
225
+ /**
226
+ * The inside of a diagram's bar, the same in every renderer: Copy image, Copy source, the link to the PNG for when the
227
+ * clipboard refuses it, and the status line that says whether the copy worked.
228
+ */
229
+ function mermaidBar() {
230
+ return `<button type="button" class="cmm-image" aria-label="Copy image" title="Copy image">` + icon("idle", "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"m21 15-5-5L5 21\"/>") + `${done}</button><button type="button" class="cmm-source" aria-label="Copy source" title="Copy source">` + icon("idle", "<path d=\"m16 18 6-6-6-6\"/><path d=\"m8 6-6 6 6 6\"/>") + `${done}</button><a class="cmm-open" target="_blank" rel="noopener" hidden>Open PNG</a><span class="cmm-status" role="status"></span>`;
231
+ }
232
+ /**
233
+ * Adds the Mermaid styles and starts the buttons of every diagram on the page, and returns a function that stops them.
234
+ * The Vue, React, and Svelte diagrams call it on mount and stop it on unmount.
235
+ */
236
+ function startMermaid() {
237
+ addMermaidStyles();
238
+ return start();
239
+ }
240
+ //#endregion
241
+ export { start as a, startMermaid as i, mermaidBar as n, mermaidCss as r, addMermaidStyles as t };
package/dist/client.d.mts CHANGED
@@ -6,7 +6,17 @@ import { t as typesetCss } from "./typeset-css-DdOGL7WF.mjs";
6
6
  * again. The rules sit in the `comark` layer, so host `--pele-*` values are preserved and win over these fallbacks.
7
7
  */
8
8
  export declare const mermaidCss: string;
9
- /** Adds the Mermaid styles to the page once. The Vue, React, and Svelte diagrams call it when Pele draws them. */
9
+ /** Sizes Mermaid cards after Pele draws them in Vue, React, and Svelte, and adds the styles to the page once. */
10
10
  export declare function addMermaidStyles(): void;
11
+ /**
12
+ * The inside of a diagram's bar, the same in every renderer: Copy image, Copy source, the link to the PNG for when the
13
+ * clipboard refuses it, and the status line that says whether the copy worked.
14
+ */
15
+ export declare function mermaidBar(): string;
16
+ /**
17
+ * Adds the Mermaid styles and starts the buttons of every diagram on the page, and returns a function that stops them.
18
+ * The Vue, React, and Svelte diagrams call it on mount and stop it on unmount.
19
+ */
20
+ export declare function startMermaid(): () => void;
11
21
  //#endregion
12
22
  export { typesetCss };
package/dist/client.mjs CHANGED
@@ -1,26 +1,3 @@
1
- import { t as typesetCss } from "./typeset-css-DPB0S1bV.mjs";
2
- import { theme } from "comark-zoom/theme";
3
- //#region src/client.ts
4
- /**
5
- * comark-pele's diagrams on the shared `--comark-*` tokens, on a card like comark-diagrams'. Pele paints with its
6
- * `--pele-*` variables, so setting them on the wrapper themes every diagram, light and dark, without drawing it
7
- * again. The rules sit in the `comark` layer, so host `--pele-*` values are preserved and win over these fallbacks.
8
- */
9
- const mermaidCss = `@layer comark{${[
10
- theme(".pele-diagram"),
11
- theme(":root"),
12
- `:where(:root){--pele-bg:var(--_comark-background);--pele-fg:var(--_comark-foreground);--pele-muted:var(--_comark-muted);--pele-line:var(--_comark-muted);--pele-surface:var(--_comark-accent);--pele-surface-alt:color-mix(in srgb,var(--_comark-accent),var(--_comark-foreground) 6%);--pele-border:var(--_comark-border);--pele-accent:var(--ui-primary,var(--primary,var(--_comark-foreground)));--pele-critical:var(--ui-error,var(--destructive,#dc2626));--pele-error:var(--ui-error,var(--destructive,#dc2626));--pele-font:var(--_comark-font);--pele-radius:calc(var(--_comark-radius) - 4px);--pele-series-1:var(--comark-chart-1,var(--ui-chart-1,var(--chart-1,#3b82f6)));--pele-series-2:var(--comark-chart-2,var(--ui-chart-2,var(--chart-2,#f97316)));--pele-series-3:var(--comark-chart-3,var(--ui-chart-3,var(--chart-3,#10b981)));--pele-series-4:var(--comark-chart-4,var(--ui-chart-4,var(--chart-4,#a855f7)));--pele-series-5:var(--comark-chart-5,var(--ui-chart-5,var(--chart-5,#f43f5e)));--pele-series-6:var(--comark-chart-6,var(--ui-chart-6,var(--chart-6,#eab308)));--pele-series-7:var(--comark-chart-7,var(--ui-chart-7,var(--chart-7,#06b6d4)));--pele-series-8:var(--comark-chart-8,var(--ui-chart-8,var(--chart-8,#ec4899)))}`,
13
- ".pele-diagram{margin:1.5rem 0;padding:1rem;overflow-x:auto;border:1px solid var(--_comark-border);border-radius:var(--_comark-radius);background:var(--_comark-background);color:var(--_comark-foreground);text-align:center}",
14
- ".pele-source{margin:0;color:var(--_comark-muted);text-align:left}",
15
- "@media print{.pele-diagram{break-inside:avoid}}"
16
- ].join("")}}`;
17
- /** Adds the Mermaid styles to the page once. The Vue, React, and Svelte diagrams call it when Pele draws them. */
18
- function addMermaidStyles() {
19
- if (document.querySelector("style[data-comark-mermaid]")) return;
20
- const style = document.createElement("style");
21
- style.dataset.comarkMermaid = "";
22
- style.textContent = mermaidCss;
23
- document.head.append(style);
24
- }
25
- //#endregion
26
- export { addMermaidStyles, mermaidCss, typesetCss };
1
+ import { t as typesetCss } from "./typeset-css-5aJ7cSmh.mjs";
2
+ import { i as startMermaid, n as mermaidBar, r as mermaidCss, t as addMermaidStyles } from "./client-Bjd6VcGQ.mjs";
3
+ export { addMermaidStyles, mermaidBar, mermaidCss, startMermaid, typesetCss };