@dogsbay/ssg-cli 0.2.0-beta.186 → 0.2.0-beta.188

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 (28) hide show
  1. package/AGENTS.md +168 -0
  2. package/README.md +3 -1
  3. package/THIRD-PARTY-NOTICES.txt +23 -17
  4. package/chunks/{build-command-X76EICE4.mjs → build-command-NJATVOUY.mjs} +34 -25
  5. package/chunks/check-command-FL5O3AXB.mjs +577 -0
  6. package/chunks/chunk-2EM7IEQT.mjs +95 -0
  7. package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
  8. package/chunks/chunk-5NQOUB5I.mjs +4534 -0
  9. package/chunks/{chunk-YQ2K646L.mjs → chunk-CYJ6GFVM.mjs} +32 -3
  10. package/chunks/{chunk-XQORVEL6.mjs → chunk-FFIXBXHD.mjs} +60 -233
  11. package/chunks/chunk-GFG5I7WI.mjs +807 -0
  12. package/chunks/{chunk-AOHGXC4D.mjs → chunk-GZ3E45TE.mjs} +518 -240
  13. package/chunks/chunk-IAAKV7V2.mjs +37 -0
  14. package/chunks/{chunk-YA6TJOAM.mjs → chunk-VJ6AESSJ.mjs} +216 -24
  15. package/chunks/chunk-X3UPCLX5.mjs +503 -0
  16. package/chunks/{chunk-TRECVC6H.mjs → chunk-ZDH4JRVX.mjs} +1041 -4051
  17. package/chunks/{chunk-FNP5PNJW.mjs → chunk-ZRGJHNES.mjs} +6 -0
  18. package/chunks/compare-W4DJYVHT.mjs +239 -0
  19. package/chunks/compare-command-U36H55IE.mjs +144 -0
  20. package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
  21. package/chunks/{dev-DXMZPST7.mjs → dev-X3PKN4G3.mjs} +77 -26
  22. package/chunks/{menu-W7ZXME4A.mjs → menu-J3CLVADF.mjs} +5 -3
  23. package/chunks/{publish-command-AVMRM4UZ.mjs → publish-command-SAPICGGM.mjs} +15 -8
  24. package/chunks/{release-diff-3OZOYBXR.mjs → release-diff-Y7X63MT3.mjs} +13 -7
  25. package/chunks/{serve-U2YV7AQH.mjs → serve-7DR4WSYA.mjs} +2 -2
  26. package/cli.mjs +17 -10
  27. package/package.json +4 -3
  28. package/chunks/check-command-SXDUKSAZ.mjs +0 -256
@@ -2,6 +2,7 @@
2
2
  import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
3
  import {
4
4
  cardBodyHasLink,
5
+ followRenamedId,
5
6
  headingIds,
6
7
  isDetailsSheet,
7
8
  isEmptyTableHead,
@@ -11,7 +12,7 @@ import {
11
12
  renderAroundGroup,
12
13
  stepLead,
13
14
  stepTitle
14
- } from "./chunk-YA6TJOAM.mjs";
15
+ } from "./chunk-VJ6AESSJ.mjs";
15
16
  import {
16
17
  collapseLines,
17
18
  parseLineRanges,
@@ -51,6 +52,9 @@ function dirname(p) {
51
52
  const i = p.lastIndexOf("/");
52
53
  return i <= 0 ? p.startsWith("/") ? "/" : "" : p.slice(0, i);
53
54
  }
55
+ function join(...parts) {
56
+ return normalize(parts.filter(Boolean).join("/"));
57
+ }
54
58
  function relative(fromDir, to) {
55
59
  const a = fromDir ? normalize(fromDir).split("/") : [];
56
60
  const b = to ? normalize(to).split("/") : [];
@@ -71,6 +75,492 @@ function splitHref(href) {
71
75
  return i < 0 ? { path: href, suffix: "" } : { path: href.slice(0, i), suffix: href.slice(i) };
72
76
  }
73
77
 
78
+ // node_modules/@dogsbay/render-html/dist/diff.js
79
+ var diffMarksOf = (node) => node;
80
+ function hasDiffMarks(node) {
81
+ const m = diffMarksOf(node);
82
+ return Boolean(m.diff || m.diffInline);
83
+ }
84
+ var escapeHtmlText = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
85
+ function inlineSegmentsToHtml(segments) {
86
+ return segments.map((s) => {
87
+ const text = escapeHtmlText(s.text);
88
+ if (s.op === "ins")
89
+ return `<ins class="db-diff-ins">${text}</ins>`;
90
+ if (s.op === "del")
91
+ return `<del class="db-diff-del">${text}</del>`;
92
+ return text;
93
+ }).join("");
94
+ }
95
+ var CODE_DIFF_MAX_LINES = 1500;
96
+ function buildMergedCodeDiff(oldCode, newCode) {
97
+ const a = oldCode.split("\n");
98
+ const b = newCode.split("\n");
99
+ if (a.length > CODE_DIFF_MAX_LINES || b.length > CODE_DIFF_MAX_LINES)
100
+ return null;
101
+ const m = a.length;
102
+ const n = b.length;
103
+ const lcs = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
104
+ for (let i2 = m - 1; i2 >= 0; i2--) {
105
+ for (let j2 = n - 1; j2 >= 0; j2--) {
106
+ lcs[i2][j2] = a[i2] === b[j2] ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
107
+ }
108
+ }
109
+ const out = [];
110
+ const addLines = [];
111
+ const removeLines = [];
112
+ let i = 0;
113
+ let j = 0;
114
+ const emit = (text, kind) => {
115
+ out.push(text);
116
+ if (kind === "add")
117
+ addLines.push(out.length);
118
+ else if (kind === "remove")
119
+ removeLines.push(out.length);
120
+ };
121
+ while (i < m && j < n) {
122
+ if (a[i] === b[j]) {
123
+ emit(b[j]);
124
+ i++;
125
+ j++;
126
+ } else if (lcs[i + 1][j] >= lcs[i][j + 1]) {
127
+ emit(a[i], "remove");
128
+ i++;
129
+ } else {
130
+ emit(b[j], "add");
131
+ j++;
132
+ }
133
+ }
134
+ while (i < m)
135
+ emit(a[i++], "remove");
136
+ while (j < n)
137
+ emit(b[j++], "add");
138
+ return { code: out.join("\n"), addLines, removeLines };
139
+ }
140
+ var toLineSpec = (lines) => {
141
+ const parts = [];
142
+ for (let i = 0; i < lines.length; ) {
143
+ let j = i;
144
+ while (j + 1 < lines.length && lines[j + 1] === lines[j] + 1)
145
+ j++;
146
+ parts.push(i === j ? String(lines[i]) : `${lines[i]}-${lines[j]}`);
147
+ i = j + 1;
148
+ }
149
+ return parts.join(",");
150
+ };
151
+ var codeTextOf = (node) => node.props?.code ?? node.html ?? "";
152
+ var whitespaceOnly = (oldCode, newCode) => oldCode !== newCode && oldCode.replace(/\s+/g, "") === newCode.replace(/\s+/g, "");
153
+ function mergedCodeNode(node) {
154
+ const peer = diffMarksOf(node).diffPeer;
155
+ if (!peer)
156
+ return null;
157
+ const oldCode = codeTextOf(peer);
158
+ const newCode = codeTextOf(node);
159
+ const merged = buildMergedCodeDiff(oldCode, newCode);
160
+ if (merged === null)
161
+ return null;
162
+ return {
163
+ node: {
164
+ ...node,
165
+ html: void 0,
166
+ props: { ...node.props, code: merged.code, copyText: newCode, diffAdd: toLineSpec(merged.addLines), diffRemove: toLineSpec(merged.removeLines) }
167
+ },
168
+ whitespaceOnly: whitespaceOnly(oldCode, newCode)
169
+ };
170
+ }
171
+ var TAB_GLYPH = { added: "+", changed: "\u2022", removed: "\u2212", moved: "\u2192" };
172
+ function tabDiffSignal(tab) {
173
+ const own = diffMarksOf(tab).diff;
174
+ if (own)
175
+ return own;
176
+ const deep = (n) => hasDiffMarks(n) || (n.children ?? []).some(deep);
177
+ return (tab.children ?? []).some(deep) ? "changed" : void 0;
178
+ }
179
+ function injectAttrs(rendered, attrs2) {
180
+ const m = rendered.match(/<([A-Za-z][\w.-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/);
181
+ if (!m || m.index === void 0)
182
+ return rendered;
183
+ const insertAt = m.index + 1 + m[1].length;
184
+ return `${rendered.slice(0, insertAt)} ${attrs2}${rendered.slice(insertAt)}`;
185
+ }
186
+ var attrEsc = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
187
+ function decorateDiffHtml(node, rendered, renderPeer) {
188
+ const marks = diffMarksOf(node);
189
+ if (!marks.diff && !marks.diffInline)
190
+ return rendered;
191
+ if (marks.diff === "changed" && marks.diffPeer && node.type === "code") {
192
+ const merged = mergedCodeNode(node);
193
+ if (merged) {
194
+ return `<div data-diff="changed" class="db-diff-code${merged.whitespaceOnly ? " db-diff-code-ws" : ""}"><div class="db-diff-code-merged">${renderPeer(merged.node)}</div><div class="db-diff-code-clean">${rendered}</div></div>
195
+ `;
196
+ }
197
+ return `<div class="db-diff-pair" data-diff="changed"><div class="db-diff-pair-label">before</div>` + injectAttrs(renderPeer(marks.diffPeer), 'data-diff="removed"') + `<div class="db-diff-pair-label">after</div>${injectAttrs(rendered, 'data-diff="added"')}</div>
198
+ `;
199
+ }
200
+ const attrs2 = (marks.diff === "moved" && marks.diffMovedFrom ? `data-diff="moved" data-diff-from="${attrEsc(marks.diffMovedFrom.join(" \u203A "))}"` : `data-diff="${attrEsc(marks.diff ?? "changed")}"`) + renamedAttrs(node, marks);
201
+ if (node.type === "html") {
202
+ if (marks.diff === "changed" && marks.diffPeer) {
203
+ return `<div ${attrs2} class="db-diff-html">${rendered}<details class="db-diff-html-before"><summary>Show previous version</summary><div data-diff="removed">${renderPeer(marks.diffPeer)}</div></details></div>
204
+ `;
205
+ }
206
+ return `<div ${attrs2}>${rendered}</div>
207
+ `;
208
+ }
209
+ return injectAttrs(rendered, attrs2);
210
+ }
211
+ function renamedAttrs(node, marks = diffMarksOf(node)) {
212
+ return node.type === "heading" && typeof marks.diffRenamedFrom === "string" ? ` data-diff-renamed data-diff-was="${attrEsc(marks.diffRenamedFrom)}"` : "";
213
+ }
214
+ var DIFF_CSS = `/* tree-diff decorations \u2014 one DiffTree, rendered by the normal components.
215
+ Colours read the Tailwind theme token (--color-success) first, then the raw one (--success): a page built
216
+ with "@theme inline" (render-html's) has only the raw ones, and the pills fell back to Canvas, white in a
217
+ page that declares no color-scheme, under light text in dark mode.
218
+ Mark styling is GUARDED by html:not([data-diff-hidden]) rather than
219
+ force-reset under hidden mode: a reset like "border-left: none
220
+ !important" also clobbers a component's OWN border (an added warning
221
+ callout lost its left edge \u2014 user find, adapters/mysql). Guarded
222
+ rules simply stop applying, and component styling survives. */
223
+ [data-diff] { position: relative; }
224
+ html:not([data-diff-hidden]) [data-diff="added"] {
225
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 12%, transparent);
226
+ border-left: 3px solid var(--color-success, var(--success, oklch(0.72 0.19 150)));
227
+ padding-left: 0.75rem;
228
+ }
229
+ html:not([data-diff-hidden]) [data-diff="removed"] {
230
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 10%, transparent);
231
+ border-left: 3px solid var(--color-destructive, var(--destructive, oklch(0.64 0.21 25)));
232
+ padding-left: 0.75rem;
233
+ opacity: 0.75;
234
+ }
235
+ html:not([data-diff-hidden]) [data-diff="removed"] :is(p, li, code, pre) { text-decoration: line-through; text-decoration-thickness: 1px; }
236
+ html:not([data-diff-hidden]) [data-diff="changed"] {
237
+ border-left: 3px solid var(--color-warning, var(--warning, oklch(0.8 0.16 85)));
238
+ padding-left: 0.75rem;
239
+ }
240
+ html:not([data-diff-hidden]) [data-diff="moved"] {
241
+ border-left: 3px dashed var(--color-info, var(--info, oklch(0.7 0.14 240)));
242
+ padding-left: 0.75rem;
243
+ }
244
+ html:not([data-diff-hidden]) [data-diff="moved"][data-diff-from]::after {
245
+ content: "moved from " attr(data-diff-from);
246
+ display: block;
247
+ font-size: 0.75rem;
248
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
249
+ opacity: 0.8;
250
+ }
251
+ html:not([data-diff-hidden]) [data-diff="changed"][data-diff-renamed][data-diff-was]::after {
252
+ content: "was: " attr(data-diff-was);
253
+ display: block;
254
+ font-size: 0.75rem;
255
+ font-weight: normal;
256
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
257
+ opacity: 0.8;
258
+ }
259
+
260
+ /* Explicit "added"/"removed" label pills straddling the block's top
261
+ edge. Components with their own chrome (callouts, code blocks)
262
+ camouflage a tint-only mark \u2014 a green-tinted warning callout reads
263
+ as a callout variant, not as new content (user feedback,
264
+ better-auth adapters/mysql). Table rows are excluded (a pill can't
265
+ straddle a tr); nested marks defer to the outermost label. */
266
+ html:not([data-diff-hidden]) [data-diff="added"]:not(tr, th, td)::before,
267
+ html:not([data-diff-hidden]) [data-diff="removed"]:not(tr, th, td)::before {
268
+ position: absolute;
269
+ top: 0;
270
+ right: 0.6rem;
271
+ transform: translateY(-55%);
272
+ font-size: 0.65rem;
273
+ font-weight: 600;
274
+ letter-spacing: 0.04em;
275
+ line-height: 1.4;
276
+ padding: 0 0.5rem;
277
+ border-radius: 99px;
278
+ z-index: 1;
279
+ text-decoration: none;
280
+ color: var(--color-foreground, var(--foreground, CanvasText));
281
+ }
282
+ html:not([data-diff-hidden]) [data-diff="added"]:not(tr, th, td)::before {
283
+ content: "added";
284
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 25%, var(--color-background, var(--background, Canvas)));
285
+ border: 1px solid color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 45%, transparent);
286
+ }
287
+ html:not([data-diff-hidden]) [data-diff="removed"]:not(tr, th, td)::before {
288
+ content: "removed";
289
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 20%, var(--color-background, var(--background, Canvas)));
290
+ border: 1px solid color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 45%, transparent);
291
+ }
292
+ [data-diff] [data-diff]::before { content: none !important; }
293
+
294
+ /* Nav change markers (the sidebar is client-rendered from nav.json, so
295
+ the styles ship here rather than with the component). Same contract as
296
+ the tab markers: a GLYPH carries the meaning, colour reinforces it,
297
+ visually-hidden text announces it. */
298
+ .db-nav-mark {
299
+ display: inline-flex;
300
+ align-items: center;
301
+ justify-content: center;
302
+ flex-shrink: 0;
303
+ width: 1rem;
304
+ height: 1rem;
305
+ margin-left: auto;
306
+ border-radius: 99px;
307
+ font-size: 0.75rem;
308
+ font-weight: 700;
309
+ line-height: 1;
310
+ color: var(--color-muted-foreground, var(--muted-foreground, currentColor));
311
+ }
312
+ .db-nav-mark[data-nav-mark="added"] { color: var(--color-success, var(--success, oklch(0.72 0.19 150))); }
313
+ .db-nav-mark[data-nav-mark="changed"] { color: var(--color-warning, var(--warning, oklch(0.8 0.16 85))); }
314
+ .db-nav-mark[data-nav-mark="removed"] { color: var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))); }
315
+ .db-nav-mark[data-nav-mark="moved"] { color: var(--color-info, var(--info, oklch(0.7 0.14 240))); }
316
+ /* a subtree marker is a hint about descendants, not a claim about this row */
317
+ .db-nav-mark[data-nav-mark-subtree] { opacity: 0.55; }
318
+ /* removed pages get a SECOND non-colour signal */
319
+ /* Belt-and-braces: a subtree mark must never strike through its own row. */
320
+ [data-nav-mark-row="removed"]:not([data-nav-mark-subtree]) { text-decoration: line-through; opacity: 0.7; }
321
+ @media (forced-colors: active) {
322
+ .db-nav-mark { color: CanvasText; }
323
+ }
324
+
325
+ /* Which tab changed? A marked panel is invisible until opened, so its
326
+ trigger carries a marker (the group's bar says "in here", the marker
327
+ says "this one"). The marker is a GLYPH, not a colored dot: colour
328
+ alone fails WCAG 1.4.1 and background-tinted dots vanish entirely in
329
+ forced-colors mode. Colour reinforces; shape carries the meaning.
330
+ Visually-hidden text rides along (emitted by the serializer). */
331
+ .db-tab-mark {
332
+ display: inline-block;
333
+ margin-left: 0.35rem;
334
+ font-size: 0.75rem;
335
+ font-weight: 700;
336
+ line-height: 1;
337
+ vertical-align: middle;
338
+ color: var(--color-muted-foreground, var(--muted-foreground, currentColor));
339
+ }
340
+ [data-diff-hidden] .db-tab-mark { display: none; }
341
+ .db-tab-mark[data-diff-tab="changed"] { color: var(--color-warning, var(--warning, oklch(0.8 0.16 85))); }
342
+ .db-tab-mark[data-diff-tab="added"] { color: var(--color-success, var(--success, oklch(0.72 0.19 150))); }
343
+ .db-tab-mark[data-diff-tab="removed"] { color: var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))); }
344
+ .db-tab-mark[data-diff-tab="moved"] { color: var(--color-info, var(--info, oklch(0.7 0.14 240))); }
345
+ @media (forced-colors: active) {
346
+ .db-tab-mark { color: CanvasText; }
347
+ }
348
+ ins.db-diff-ins {
349
+ text-decoration: none;
350
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 22%, transparent);
351
+ border-radius: 2px;
352
+ padding: 0 1px;
353
+ }
354
+ del.db-diff-del {
355
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 18%, transparent);
356
+ border-radius: 2px;
357
+ padding: 0 1px;
358
+ }
359
+ .db-diff-pair { display: grid; gap: 0.25rem; margin-block: 1rem; }
360
+ .db-diff-pair-label {
361
+ font-size: 0.7rem;
362
+ text-transform: uppercase;
363
+ letter-spacing: 0.08em;
364
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
365
+ opacity: 0.8;
366
+ }
367
+ tr[data-diff] { border-left-width: 3px; }
368
+
369
+ /* Folded unchanged sections are CHROME, not content callouts:
370
+ dashed, dimmed, compact \u2014 visually "collapsed context". */
371
+ .db-diff-fold {
372
+ border: 1px dashed color-mix(in oklch, currentColor 25%, transparent);
373
+ opacity: 0.7;
374
+ margin-block: 0.5rem;
375
+ }
376
+ .db-diff-fold:hover, .db-diff-fold[open] { opacity: 1; }
377
+ .db-diff-fold summary, .db-diff-fold [data-slot="trigger"] {
378
+ font-size: 0.85rem;
379
+ }
380
+
381
+ /* The comparison banner at the top of each reader page. */
382
+ .db-diff-banner-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; width: 100%; }
383
+ .db-diff-banner {
384
+ border: 1px solid color-mix(in oklch, currentColor 15%, transparent);
385
+ border-radius: 8px;
386
+ padding: 0.75rem 1rem;
387
+ margin-block-end: 1.5rem;
388
+ font-size: 0.85rem;
389
+ display: flex;
390
+ flex-wrap: wrap;
391
+ gap: 0.4rem 1rem;
392
+ align-items: center;
393
+ }
394
+ .db-diff-banner .db-chip {
395
+ display: inline-block;
396
+ border-radius: 99px;
397
+ padding: 0.05rem 0.6rem;
398
+ font-size: 0.75rem;
399
+ border: 1px solid transparent;
400
+ }
401
+ .db-chip-added { background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 15%, transparent); }
402
+ .db-chip-removed { background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 12%, transparent); }
403
+ .db-chip-changed { background: color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 15%, transparent); }
404
+ .db-chip-moved { background: color-mix(in oklch, var(--color-info, var(--info, oklch(0.7 0.14 240))) 12%, transparent); }
405
+ .db-chip-muted { border-color: color-mix(in oklch, currentColor 25%, transparent); opacity: 0.8; }
406
+
407
+ /* The persistent view-switcher bar (Reader / Docs-ops / Agent):
408
+ perspectives on ONE comparison \u2014 tabs are links, verification
409
+ lives in the chrome, the Monitor CTA sits next to the value. */
410
+ .db-cmp-bar {
411
+ position: sticky;
412
+ /* BELOW the docs header, not under it: both were sticky at top:0 and
413
+ the header's higher z-index simply swallowed this bar on scroll \u2014
414
+ the chrome carrying the trust contract was the chrome that vanished.
415
+ --db-header-height is declared by DocsLayout (the header sizes itself
416
+ from the same variable, so they cannot drift). */
417
+ top: var(--db-header-height, 3.25rem);
418
+ z-index: 30;
419
+ display: flex;
420
+ flex-wrap: wrap;
421
+ gap: 0.4rem 0.9rem;
422
+ align-items: center;
423
+ padding: 0.5rem 0.9rem;
424
+ margin-block-end: 1rem;
425
+ border: 1px solid color-mix(in oklch, currentColor 15%, transparent);
426
+ border-radius: 8px;
427
+ background: var(--color-background, var(--background, Canvas));
428
+ font-size: 0.8rem;
429
+ }
430
+ .db-cmp-bar .db-chip {
431
+ display: inline-block;
432
+ border-radius: 99px;
433
+ padding: 0.05rem 0.6rem;
434
+ font-size: 0.75rem;
435
+ border: 1px solid transparent;
436
+ }
437
+ .db-cmp-bar button.db-chip { cursor: pointer; background: transparent; font: inherit; font-size: 0.75rem; color: inherit; }
438
+ .db-cmp-tabs {
439
+ display: inline-flex;
440
+ gap: 0.15rem;
441
+ border: 1px solid color-mix(in oklch, currentColor 20%, transparent);
442
+ border-radius: 99px;
443
+ padding: 0.1rem;
444
+ }
445
+ .db-cmp-tab {
446
+ padding: 0.1rem 0.7rem;
447
+ border-radius: 99px;
448
+ text-decoration: none;
449
+ color: inherit;
450
+ }
451
+ .db-cmp-tab[aria-current="page"] {
452
+ background: color-mix(in oklch, currentColor 12%, transparent);
453
+ font-weight: 600;
454
+ }
455
+ .db-cmp-pairs { position: relative; display: inline-block; }
456
+ .db-cmp-pairs summary { cursor: pointer; }
457
+ .db-cmp-pairs ul {
458
+ position: absolute;
459
+ top: 100%;
460
+ left: 0;
461
+ margin: 0.25rem 0 0;
462
+ padding: 0.35rem 0.75rem;
463
+ list-style: none;
464
+ background: var(--color-background, var(--background, Canvas));
465
+ border: 1px solid color-mix(in oklch, currentColor 20%, transparent);
466
+ border-radius: 8px;
467
+ white-space: nowrap;
468
+ z-index: 40;
469
+ }
470
+ .db-cmp-monitor { text-decoration: none; border-color: color-mix(in oklch, currentColor 30%, transparent) !important; }
471
+ .db-cmp-monitor:hover { background: color-mix(in oklch, currentColor 10%, transparent); }
472
+
473
+ /* A wholly added/removed PAGE carries one mark around all its content.
474
+ The per-block tint would be overwhelming at page scale, so page level
475
+ gets a stronger edge and a much lighter wash \u2014 legible at a glance,
476
+ still readable as prose. The "added"/"removed" pill (the ::before on
477
+ [data-diff]) rides on this wrapper, which is exactly right: it labels
478
+ the page, once. */
479
+ html:not([data-diff-hidden]) [data-diff].db-diff-page {
480
+ border-left-width: 5px;
481
+ padding-left: 1rem;
482
+ padding-block: 0.5rem;
483
+ border-radius: 0 6px 6px 0;
484
+ }
485
+ html:not([data-diff-hidden]) [data-diff="added"].db-diff-page {
486
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 5%, transparent);
487
+ }
488
+ html:not([data-diff-hidden]) [data-diff="removed"].db-diff-page {
489
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 5%, transparent);
490
+ opacity: 1; /* the page is READABLE \u2014 the mark says removed, not the dimming */
491
+ }
492
+ /* \u2026and a removed PAGE is not struck through \u2014 that is for a deleted line,
493
+ not for a document the reader still needs to read. */
494
+ [data-diff="removed"].db-diff-page :is(p, li, code, pre) { text-decoration: none; }
495
+
496
+ /* Changed raw HTML: the faithful new render, plus the previous version
497
+ one click away. Without it a deletion inside opaque markup (a dropped
498
+ table column) is simply invisible \u2014 the reader is told "something
499
+ changed" and shown no evidence. */
500
+ .db-diff-html-before {
501
+ margin-block-start: 0.5rem;
502
+ font-size: 0.8rem;
503
+ border: 1px dashed color-mix(in oklch, currentColor 25%, transparent);
504
+ border-radius: 6px;
505
+ padding: 0.25rem 0.6rem;
506
+ }
507
+ /* Full-strength text: the summary is a CONTROL \u2014 dimming it (opacity or
508
+ muted-foreground) drops it below 4.5:1 and axe rightly fails it. */
509
+ .db-diff-html-before summary { cursor: pointer; color: inherit; }
510
+ .db-diff-html-before[open] summary { margin-block-end: 0.5rem; }
511
+ [data-diff-hidden] .db-diff-html-before { display: none; }
512
+
513
+ /* Merged code diffs carry a hidden clean twin (the post-change
514
+ render); Hide highlights swaps them. */
515
+ .db-diff-code { position: relative; }
516
+ .db-diff-code-clean { display: none; }
517
+ [data-diff-hidden] .db-diff-code-clean { display: block; }
518
+ [data-diff-hidden] .db-diff-code-merged { display: none; }
519
+
520
+ /* Whitespace-only code edits are still marked (indentation is
521
+ semantic in YAML/Python/markdown) \u2014 but NAMED, so the reader
522
+ is not hunting an invisible 3-space shift. */
523
+ html:not([data-diff-hidden]) .db-diff-code-ws .db-diff-code-merged::before {
524
+ content: "whitespace only";
525
+ position: absolute;
526
+ top: 0;
527
+ right: 0.6rem;
528
+ transform: translateY(-55%);
529
+ z-index: 1;
530
+ font-size: 0.65rem;
531
+ font-weight: 600;
532
+ letter-spacing: 0.04em;
533
+ line-height: 1.4;
534
+ padding: 0 0.5rem;
535
+ border-radius: 99px;
536
+ color: var(--color-foreground, var(--foreground, CanvasText));
537
+ background: color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 22%, var(--color-background, var(--background, Canvas)));
538
+ border: 1px solid color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 45%, transparent);
539
+ }
540
+
541
+ /* Hide highlights \u2014 read the target version clean. One attribute on
542
+ <html>: the guarded mark rules above stop applying by themselves;
543
+ only content that does not exist in the target version (removed
544
+ blocks, del runs, the "before" code side) needs hiding, plus the
545
+ ins tint. */
546
+ [data-diff-hidden] :is([data-diff="removed"], del.db-diff-del, .db-diff-pair-label) { display: none !important; }
547
+ [data-diff-hidden] ins.db-diff-ins { background: transparent; padding: 0; }
548
+ `;
549
+
550
+ // node_modules/@dogsbay/render-html/dist/url.js
551
+ var SCHEME_REFS = /&(?:#(\d+)|#x([0-9a-f]+)|(tab|newline|colon));?/gi;
552
+ function scriptUrl(raw, kind) {
553
+ const v = raw.replace(SCHEME_REFS, (_, dec, hex, named) => {
554
+ if (named)
555
+ return { tab: " ", newline: "\n", colon: ":" }[named.toLowerCase()];
556
+ const cp = Number.parseInt(dec ?? hex, dec ? 10 : 16);
557
+ return cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : "";
558
+ });
559
+ if (kind === "image" && /^data:image\//i.test(v.replace(/[\u0000-\u0020\u007f]+/g, "")))
560
+ return false;
561
+ return !isSafeHref(v, kind);
562
+ }
563
+
74
564
  // node_modules/@dogsbay/render-html/dist/icons.js
75
565
  var svg = (body, cls = "db-icon") => `<svg class="${cls}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${body}</svg>`;
76
566
  var PATHS = {
@@ -284,154 +774,6 @@ var ALERT_VARIANT = {
284
774
  var ALERT_TITLE_CLASS = "mb-1 text-sm font-semibold leading-none tracking-tight";
285
775
  var ALERT_BODY_CLASS = "text-sm [&_p]:leading-relaxed";
286
776
 
287
- // node_modules/@dogsbay/render-html/dist/diff.js
288
- var diffMarksOf = (node) => node;
289
- function hasDiffMarks(node) {
290
- const m = diffMarksOf(node);
291
- return Boolean(m.diff || m.diffInline);
292
- }
293
- var escapeHtmlText = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
294
- function inlineSegmentsToHtml(segments) {
295
- return segments.map((s) => {
296
- const text = escapeHtmlText(s.text);
297
- if (s.op === "ins")
298
- return `<ins class="db-diff-ins">${text}</ins>`;
299
- if (s.op === "del")
300
- return `<del class="db-diff-del">${text}</del>`;
301
- return text;
302
- }).join("");
303
- }
304
- var CODE_DIFF_MAX_LINES = 1500;
305
- function buildMergedCodeDiff(oldCode, newCode) {
306
- const a = oldCode.split("\n");
307
- const b = newCode.split("\n");
308
- if (a.length > CODE_DIFF_MAX_LINES || b.length > CODE_DIFF_MAX_LINES)
309
- return null;
310
- const m = a.length;
311
- const n = b.length;
312
- const lcs = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
313
- for (let i2 = m - 1; i2 >= 0; i2--) {
314
- for (let j2 = n - 1; j2 >= 0; j2--) {
315
- lcs[i2][j2] = a[i2] === b[j2] ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
316
- }
317
- }
318
- const out = [];
319
- const addLines = [];
320
- const removeLines = [];
321
- let i = 0;
322
- let j = 0;
323
- const emit = (text, kind) => {
324
- out.push(text);
325
- if (kind === "add")
326
- addLines.push(out.length);
327
- else if (kind === "remove")
328
- removeLines.push(out.length);
329
- };
330
- while (i < m && j < n) {
331
- if (a[i] === b[j]) {
332
- emit(b[j]);
333
- i++;
334
- j++;
335
- } else if (lcs[i + 1][j] >= lcs[i][j + 1]) {
336
- emit(a[i], "remove");
337
- i++;
338
- } else {
339
- emit(b[j], "add");
340
- j++;
341
- }
342
- }
343
- while (i < m)
344
- emit(a[i++], "remove");
345
- while (j < n)
346
- emit(b[j++], "add");
347
- return { code: out.join("\n"), addLines, removeLines };
348
- }
349
- var toLineSpec = (lines) => {
350
- const parts = [];
351
- for (let i = 0; i < lines.length; ) {
352
- let j = i;
353
- while (j + 1 < lines.length && lines[j + 1] === lines[j] + 1)
354
- j++;
355
- parts.push(i === j ? String(lines[i]) : `${lines[i]}-${lines[j]}`);
356
- i = j + 1;
357
- }
358
- return parts.join(",");
359
- };
360
- var codeTextOf = (node) => node.props?.code ?? node.html ?? "";
361
- var whitespaceOnly = (oldCode, newCode) => oldCode !== newCode && oldCode.replace(/\s+/g, "") === newCode.replace(/\s+/g, "");
362
- function mergedCodeNode(node) {
363
- const peer = diffMarksOf(node).diffPeer;
364
- if (!peer)
365
- return null;
366
- const oldCode = codeTextOf(peer);
367
- const newCode = codeTextOf(node);
368
- const merged = buildMergedCodeDiff(oldCode, newCode);
369
- if (merged === null)
370
- return null;
371
- return {
372
- node: {
373
- ...node,
374
- html: void 0,
375
- props: { ...node.props, code: merged.code, copyText: newCode, diffAdd: toLineSpec(merged.addLines), diffRemove: toLineSpec(merged.removeLines) }
376
- },
377
- whitespaceOnly: whitespaceOnly(oldCode, newCode)
378
- };
379
- }
380
- var TAB_GLYPH = { added: "+", changed: "\u2022", removed: "\u2212", moved: "\u2192" };
381
- function tabDiffSignal(tab) {
382
- const own = diffMarksOf(tab).diff;
383
- if (own)
384
- return own;
385
- const deep = (n) => hasDiffMarks(n) || (n.children ?? []).some(deep);
386
- return (tab.children ?? []).some(deep) ? "changed" : void 0;
387
- }
388
- function injectAttrs(rendered, attrs2) {
389
- const m = rendered.match(/<([A-Za-z][\w.-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/);
390
- if (!m || m.index === void 0)
391
- return rendered;
392
- const insertAt = m.index + 1 + m[1].length;
393
- return `${rendered.slice(0, insertAt)} ${attrs2}${rendered.slice(insertAt)}`;
394
- }
395
- var attrEsc = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
396
- function decorateDiffHtml(node, rendered, renderPeer) {
397
- const marks = diffMarksOf(node);
398
- if (!marks.diff && !marks.diffInline)
399
- return rendered;
400
- if (marks.diff === "changed" && marks.diffPeer && node.type === "code") {
401
- const merged = mergedCodeNode(node);
402
- if (merged) {
403
- return `<div data-diff="changed" class="db-diff-code${merged.whitespaceOnly ? " db-diff-code-ws" : ""}"><div class="db-diff-code-merged">${renderPeer(merged.node)}</div><div class="db-diff-code-clean">${rendered}</div></div>
404
- `;
405
- }
406
- return `<div class="db-diff-pair" data-diff="changed"><div class="db-diff-pair-label">before</div>` + injectAttrs(renderPeer(marks.diffPeer), 'data-diff="removed"') + `<div class="db-diff-pair-label">after</div>${injectAttrs(rendered, 'data-diff="added"')}</div>
407
- `;
408
- }
409
- const attrs2 = marks.diff === "moved" && marks.diffMovedFrom ? `data-diff="moved" data-diff-from="${attrEsc(marks.diffMovedFrom.join(" \u203A "))}"` : `data-diff="${attrEsc(marks.diff ?? "changed")}"`;
410
- if (node.type === "html") {
411
- if (marks.diff === "changed" && marks.diffPeer) {
412
- return `<div ${attrs2} class="db-diff-html">${rendered}<details class="db-diff-html-before"><summary>Show previous version</summary><div data-diff="removed">${renderPeer(marks.diffPeer)}</div></details></div>
413
- `;
414
- }
415
- return `<div ${attrs2}>${rendered}</div>
416
- `;
417
- }
418
- return injectAttrs(rendered, attrs2);
419
- }
420
-
421
- // node_modules/@dogsbay/render-html/dist/url.js
422
- var SCHEME_REFS = /&(?:#(\d+)|#x([0-9a-f]+)|(tab|newline|colon));?/gi;
423
- function scriptUrl(raw, kind) {
424
- const v = raw.replace(SCHEME_REFS, (_, dec, hex, named) => {
425
- if (named)
426
- return { tab: " ", newline: "\n", colon: ":" }[named.toLowerCase()];
427
- const cp = Number.parseInt(dec ?? hex, dec ? 10 : 16);
428
- return cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : "";
429
- });
430
- if (kind === "image" && /^data:image\//i.test(v.replace(/[\u0000-\u0020\u007f]+/g, "")))
431
- return false;
432
- return !isSafeHref(v, kind);
433
- }
434
-
435
777
  // node_modules/@dogsbay/render-html/dist/api-markdown.js
436
778
  var md = new lib_default({ html: false, linkify: false, typographer: false });
437
779
  var blockMd = new lib_default({ html: false, linkify: false, typographer: false });
@@ -847,7 +1189,7 @@ function linkUrl(href, ctx) {
847
1189
  ctx.unsafeUrls?.add(href.slice(0, 80));
848
1190
  return "#";
849
1191
  }
850
- return ctx.link(href);
1192
+ return ctx.link(followRenamedId(href));
851
1193
  }
852
1194
  function assetUrl(src, ctx) {
853
1195
  if (scriptUrl(src, "image")) {
@@ -1183,10 +1525,15 @@ function withSourceAttrs(html, n, ctx) {
1183
1525
  const { kept, end } = dropAttrs(html, m[0].length, new Set(added.map(([name]) => name)));
1184
1526
  return `${m[0]}${added.map(([name, value]) => ` ${name}="${value}"`).join("")}${kept}${html.slice(end)}`;
1185
1527
  }
1528
+ function termIdAttr(n, ctx) {
1529
+ const given = str2(n.props?.id);
1530
+ const id = given ? pageId(given) : void 0;
1531
+ return id && !ctx.ids.has(id) ? (ctx.ids.add(id), ` id="${esc(id)}"`) : "";
1532
+ }
1186
1533
  function keyValueList(list3, ctx) {
1187
1534
  const parts = (list3.children ?? []).map((c) => {
1188
1535
  if (c.type === "dt")
1189
- return `<dt data-part="label">${renderInline(c.inline, ctx)}</dt>`;
1536
+ return `<dt data-part="label"${termIdAttr(c, ctx)}>${renderInline(c.inline, ctx)}</dt>`;
1190
1537
  if (c.type === "dd")
1191
1538
  return `<dd data-part="value">${itemBody(c, ctx)}</dd>`;
1192
1539
  return renderBlocks([c], ctx);
@@ -1288,7 +1635,7 @@ function block(n, ctx) {
1288
1635
  return `<dl${attrs(passthrough(p, "my-4 space-y-2"))}>${renderBlocks(n.children, ctx)}</dl>
1289
1636
  `;
1290
1637
  case "dt":
1291
- return `<dt class="font-semibold">${renderInline(n.inline, ctx)}</dt>`;
1638
+ return `<dt class="font-semibold"${termIdAttr(n, ctx)}>${renderInline(n.inline, ctx)}</dt>`;
1292
1639
  case "dd":
1293
1640
  return `<dd class="ml-6 text-muted-foreground">${itemBody(n, ctx)}</dd>`;
1294
1641
  case "footnote-list":
@@ -1308,7 +1655,9 @@ function block(n, ctx) {
1308
1655
  const split = title ? void 0 : stepLead(n.inline);
1309
1656
  const lead = title ? `<strong class="step-title">${esc(title)}</strong>` : split ? `<strong class="step-title">${renderInline(split.title, ctx)}</strong>` : "";
1310
1657
  const text = renderInline(split ? split.rest : n.inline, ctx);
1311
- return `<li${sourceAttrText(n, ctx)}>${lead}${lead && text ? " " : ""}${text}${renderBlocks(n.children, ctx)}</li>`;
1658
+ const stepId = str2(p.id) ? pageId(str2(p.id)) : void 0;
1659
+ const idAttr = stepId && !ctx.ids.has(stepId) ? (ctx.ids.add(stepId), ` id="${esc(stepId)}"`) : "";
1660
+ return `<li${idAttr}${sourceAttrText(n, ctx)}>${lead}${lead && text ? " " : ""}${text}${renderBlocks(n.children, ctx)}</li>`;
1312
1661
  }
1313
1662
  case "tabs":
1314
1663
  return renderAroundGroup(n, "tab", (g) => tabs(g, ctx), (c) => renderBlocks([c], ctx), "");
@@ -1650,6 +1999,8 @@ function callout(n, ctx) {
1650
1999
  const body = renderBlocks(n.children, ctx);
1651
2000
  if (flagOn(p.collapsible) || p.collapsed != null) {
1652
2001
  const open = p.collapsed === false || p.collapsed === "false" || flagOn(p.open);
2002
+ if (type === "plain")
2003
+ return plainCollapsible(titleHtml, body, open, { ...p, "data-type": p["data-type"] ?? type }, ctx);
1653
2004
  return collapsibleAlert(variant, titleHtml, body, open, { ...p, "data-type": p["data-type"] ?? type }, ctx);
1654
2005
  }
1655
2006
  return `<div${attrs({ ...passthrough(p, `${ALERT_BASE} ${ALERT_VARIANT[variant]} my-4`), "data-variant": variant, "data-type": type, role: "note" })}>` + alertIcon(variant, p, ctx) + `<div data-part="title" class="${ALERT_TITLE_CLASS}">${titleHtml}</div><div class="${ALERT_BODY_CLASS}">${body}</div></div>
@@ -1699,6 +2050,11 @@ function collapsibleAlert(variant, titleHtml, body, open, p, ctx) {
1699
2050
  return `<details${attrs({ ...passthrough(p, `group/collapsible relative my-4 w-full overflow-hidden rounded-lg border [&>summary]:list-none [&>summary::-webkit-details-marker]:hidden ${c.border}`), "data-variant": variant, open })}><summary class="flex cursor-pointer select-none items-center gap-2 px-4 py-3 text-sm font-semibold ${c.summary}"><span class="shrink-0 [&>svg]:size-4 ${c.icon}">${icon2}</span><span class="flex-1 text-foreground" data-part="title">${titleHtml}</span><span class="shrink-0 text-muted-foreground transition-transform duration-200 group-open/collapsible:rotate-180">${chevronSvg.replace("<svg ", '<svg aria-hidden="true" focusable="false" ')}</span></summary><div class="px-4 py-3 text-sm [&_p]:leading-relaxed ${c.body}">${body}</div></details>
1700
2051
  `;
1701
2052
  }
2053
+ function plainCollapsible(titleHtml, body, open, p, ctx) {
2054
+ const icon2 = str2(p.icon) ? alertIcon("plain", p, ctx) : "";
2055
+ return `<details${attrs({ ...passthrough(p, "group/collapsible relative my-4 w-full overflow-hidden rounded-lg border border-border [&>summary]:list-none [&>summary::-webkit-details-marker]:hidden"), "data-variant": "plain", open })}><summary class="flex cursor-pointer select-none items-center gap-2 px-4 py-3 text-sm font-semibold">${icon2 ? `<span class="shrink-0 [&>svg]:size-4">${icon2}</span>` : ""}<span class="flex-1 text-foreground" data-part="title">${titleHtml}</span><span class="shrink-0 text-muted-foreground transition-transform duration-200 group-open/collapsible:rotate-180">${chevronSvg.replace("<svg ", '<svg aria-hidden="true" focusable="false" ')}</span></summary><div class="px-4 py-3 text-sm [&_p]:leading-relaxed">${body}</div></details>
2056
+ `;
2057
+ }
1702
2058
  var AVATAR = "relative inline-flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted";
1703
2059
  var AVATAR_IMAGE = "absolute inset-0 aspect-square h-full w-full object-cover before:absolute before:inset-0 before:flex before:items-center before:justify-center before:rounded-full before:bg-muted before:text-sm before:font-semibold before:text-muted-foreground before:content-[attr(data-initials)]";
1704
2060
  var AVATAR_FALLBACK = "flex h-full w-full items-center justify-center rounded-full bg-muted text-sm font-semibold text-muted-foreground";
@@ -1728,7 +2084,11 @@ function example(n, ctx) {
1728
2084
  }
1729
2085
  function steps(n, ctx) {
1730
2086
  const p = n.props ?? {};
1731
- const items = (n.children ?? []).map((c) => c.type === "step" ? markedBlock(c, ctx) : `<li>${markedBlock(c, ctx)}</li>`).join("");
2087
+ const kids = n.children ?? [];
2088
+ const first = kids.findIndex((c) => c.type === "step");
2089
+ if (first > 0)
2090
+ return renderBlocks(kids.slice(0, first), ctx) + steps({ ...n, children: kids.slice(first) }, ctx);
2091
+ const items = kids.map((c) => c.type === "step" ? markedBlock(c, ctx) : `<li>${markedBlock(c, ctx)}</li>`).join("");
1732
2092
  return `<ol${attrs({ ...passthrough(p, "steps-list"), role: "list" })}>${items}</ol>
1733
2093
  `;
1734
2094
  }
@@ -1798,7 +2158,7 @@ function details(n, ctx) {
1798
2158
  const title = str2(p.title) ?? str2(p.summary) ?? ctx.t("details");
1799
2159
  const type = (str2(p.variant) ?? str2(p.type) ?? "").toLowerCase();
1800
2160
  const variant = ALERT_VARIANT[VARIANT_ALIAS[type] ?? type] ? VARIANT_ALIAS[type] ?? type : "note";
1801
- const html = collapsibleAlert(variant, titleMarkup(title, ctx), renderBlocks(n.children, ctx), flagOn(p.open), p, ctx);
2161
+ const html = type === "plain" ? plainCollapsible(titleMarkup(title, ctx), renderBlocks(n.children, ctx), flagOn(p.open), p, ctx) : collapsibleAlert(variant, titleMarkup(title, ctx), renderBlocks(n.children, ctx), flagOn(p.open), p, ctx);
1802
2162
  if (!isDetailsSheet(p))
1803
2163
  return html;
1804
2164
  return `<db-details-sheet${attrs({ "close-label": ctx.t("close") || "Close" })}>${html.trimEnd()}</db-details-sheet>
@@ -1911,87 +2271,8 @@ function createRenderContext(options = {}) {
1911
2271
  };
1912
2272
  }
1913
2273
 
1914
- // src/core/nav.ts
1915
- function slugFromPath(p) {
1916
- let s = normalize(p).replace(/^\/+/, "").replace(/\.(md|markdown)$/i, "");
1917
- if (s === "index") return "";
1918
- if (s.endsWith("/index")) s = s.slice(0, -"/index".length);
1919
- return s;
1920
- }
1921
- function navFromMenu(items) {
1922
- const walk = (it) => {
1923
- const target = it.file ?? it.href;
1924
- const node = { label: it.label, children: (it.children ?? []).map(walk) };
1925
- if (target) {
1926
- if (isExternal(target)) {
1927
- if (scriptUrl(target, "link")) node.refused = target;
1928
- else node.href = target;
1929
- } else {
1930
- const hash = target.indexOf("#");
1931
- const path = (hash < 0 ? target : target.slice(0, hash)).replace(/\?.*$/, "");
1932
- node.slug = slugFromPath(path.replace(/\.html$/, ".md"));
1933
- if (hash >= 0 && hash < target.length - 1) node.fragment = target.slice(hash);
1934
- }
1935
- }
1936
- if (it.unlisted) node.unlisted = true;
1937
- if (it.singlePage) node.singlePage = it.singlePage;
1938
- return node;
1939
- };
1940
- return items.map(walk);
1941
- }
1942
- function navFromPages(pages) {
1943
- const root = { label: "", children: [] };
1944
- const dirs = /* @__PURE__ */ new Map([["", root]]);
1945
- const sorted = [...pages].sort((a, b) => (a.order ?? 1e9) - (b.order ?? 1e9) || a.slug.localeCompare(b.slug));
1946
- const ensureDir = (dir) => {
1947
- const hit = dirs.get(dir);
1948
- if (hit) return hit;
1949
- const parent = ensureDir(dirname(dir));
1950
- const node = { label: humanize(dir.split("/").pop()), children: [] };
1951
- parent.children.push(node);
1952
- dirs.set(dir, node);
1953
- return node;
1954
- };
1955
- for (const p of sorted) {
1956
- if (p.slug === "") continue;
1957
- const existing = dirs.get(p.slug);
1958
- if (existing) {
1959
- existing.slug = p.slug;
1960
- existing.label = p.title;
1961
- continue;
1962
- }
1963
- if (pages.some((q) => q.slug.startsWith(p.slug + "/"))) {
1964
- const sec = ensureDir(p.slug);
1965
- sec.slug = p.slug;
1966
- sec.label = p.title;
1967
- continue;
1968
- }
1969
- ensureDir(dirname(p.slug)).children.push({ label: p.title, slug: p.slug, children: [] });
1970
- }
1971
- return root.children;
1972
- }
1973
- function humanize(s) {
1974
- const t = s.replace(/[-_]+/g, " ").trim();
1975
- return t.charAt(0).toUpperCase() + t.slice(1);
1976
- }
1977
- function indexNav(nav, o = {}) {
1978
- const order = [];
1979
- const trail = /* @__PURE__ */ new Map();
1980
- const walk = (nodes, chain) => {
1981
- for (const n of nodes) {
1982
- const here = [...chain, n];
1983
- if (n.slug != null && !n.fragment && !(o.skipAliases && n.alias) && !trail.has(n.slug)) {
1984
- trail.set(n.slug, here);
1985
- order.push(n.slug);
1986
- }
1987
- walk(n.children, here);
1988
- }
1989
- };
1990
- walk(nav, []);
1991
- return { order, trail };
1992
- }
1993
-
1994
2274
  export {
2275
+ DIFF_CSS,
1995
2276
  scriptUrl,
1996
2277
  whenAttrs,
1997
2278
  inlineText,
@@ -2001,12 +2282,9 @@ export {
2001
2282
  createRenderContext,
2002
2283
  normalize,
2003
2284
  dirname,
2285
+ join,
2004
2286
  relative,
2005
2287
  rootPrefix,
2006
2288
  isExternal,
2007
- splitHref,
2008
- slugFromPath,
2009
- navFromMenu,
2010
- navFromPages,
2011
- indexNav
2289
+ splitHref
2012
2290
  };