@dooc-dev/dooc 0.0.26 → 0.0.28

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 (44) hide show
  1. package/dist/edit.global.js +280 -260
  2. package/dist/engine/compiler/format-collections.js +9 -3
  3. package/dist/engine/core/html.js +3 -5
  4. package/dist/engine/core/icons.js +2 -2
  5. package/dist/frontend/document-application.js +185 -90
  6. package/dist/frontend/git-style.d.ts +1 -0
  7. package/dist/frontend/git-style.js +172 -0
  8. package/dist/frontend/language-picker.d.ts +5 -1
  9. package/dist/frontend/language-picker.js +19 -4
  10. package/dist/frontend/link-preview.d.ts +2 -0
  11. package/dist/frontend/link-preview.js +385 -0
  12. package/dist/frontend/locales/eng.json +137 -3
  13. package/dist/frontend/locales/jpn.json +139 -5
  14. package/dist/frontend/locales/zho.json +137 -3
  15. package/dist/frontend/resource-download.js +11 -6
  16. package/dist/frontend/scrollbars.d.ts +1 -0
  17. package/dist/frontend/scrollbars.js +9 -0
  18. package/dist/frontend/video-ui.js +9 -3
  19. package/dist/manifest.global.js +188 -186
  20. package/dist/mcp-relay.mjs +20 -1
  21. package/dist/plugins.global.js +31 -31
  22. package/dist/server/build.js +11 -8
  23. package/dist/server/cli.js +6 -1
  24. package/dist/server/git-origin.js +1 -1
  25. package/dist/server/git.js +49 -26
  26. package/dist/server/operation-log.js +9 -1
  27. package/dist/server/serve.d.ts +1 -0
  28. package/dist/server/serve.js +18 -7
  29. package/dist/server/static-client.js +4 -14
  30. package/dist/server/workspace-server.js +2 -1
  31. package/dist/subformats.global.js +57 -57
  32. package/dist/ui.global.js +71 -69
  33. package/dist/workspace/git-review.d.ts +5 -0
  34. package/dist/workspace/git-review.js +56 -0
  35. package/dist/workspace/git-types.d.ts +29 -2
  36. package/dist/workspace/git-types.js +5 -1
  37. package/dist/workspace/github.d.ts +1 -1
  38. package/dist/workspace/github.js +73 -9
  39. package/dist/workspace/mcp-tools.js +20 -1
  40. package/dist/workspace-worker.global.js +337 -87
  41. package/package.json +1 -1
  42. package/dist/workspace-mcp-worker.global.js +0 -3263
  43. package/dist/workspace-reader-mcp-worker.global.js +0 -3263
  44. package/dist/workspace-reader-worker.global.js +0 -3263
@@ -1,5 +1,5 @@
1
1
  import { FORMAT_META_FIELDS, formatMetadataSchema, formatTraits, inFormatFolder, matchesFormat, } from "../core/format-collections.js";
2
- import { fileFormat } from "../core/formats.js";
2
+ import { fenceFormat, fileFormat } from "../core/formats.js";
3
3
  import { matchesSubformatRecord, sortSubformatRecords, validateSubformatOptions, } from "../core/subformats.js";
4
4
  import { parseContentSource } from "./code-blocks.js";
5
5
  import { figureName } from "./figures.js";
@@ -11,12 +11,18 @@ export const readFormatCollection = (root, selector, options = {}, textfiles) =>
11
11
  validateSubformatOptions(options, FORMAT_META_FIELDS);
12
12
  const paths = projectFiles(root).map((file) => file.path);
13
13
  const index = resourceIndex(root, paths);
14
+ const alias = selector && fenceFormat(selector);
15
+ const match = alias !== selector &&
16
+ !index.formats?.includes(selector) &&
17
+ !paths.some((file) => fileFormat(file) === selector)
18
+ ? alias
19
+ : selector;
14
20
  const records = [];
15
21
  const add = (file, format, line, inline, source) => {
16
22
  const traits = formatTraits(format);
17
23
  if (inline && !traits.includes("codes"))
18
24
  traits.push("codes");
19
- if (!matchesFormat(format, selector, traits) ||
25
+ if (!matchesFormat(format, match, traits) ||
20
26
  (options.folder && !inFormatFolder(file, options.folder)))
21
27
  return;
22
28
  const folder = file.slice(0, file.lastIndexOf("/")) || ".";
@@ -69,5 +75,5 @@ export const formatCollectionBlock = (collection, options = {}) => ({
69
75
  lang: "json",
70
76
  lines: JSON.stringify(formatMetadataSchema(collection.ext.slice(7)), null, 2).split("\n"),
71
77
  subformat: collection,
72
- embed: { view: "grid", columns: 3, rows: 2, fields: ["format", "folder"], ...options },
78
+ embed: { view: "grid", columns: 3, rows: 2, fields: ["folder"], ...options },
73
79
  });
@@ -16,7 +16,7 @@ import { termAnchor } from "./term-reference.js";
16
16
  import { parseFileReference, textfileName } from "./textfile.js";
17
17
  export { escapeHtml } from "./escape-html.js";
18
18
  export const emptyCtx = { figures: new Map(), terms: [] };
19
- // File links open their resource page; SVGs and terms also have hover previews.
19
+ // File links open their resource page; figures and terms carry reusable hover previews.
20
20
  const segmentsHtml = (text, ctx, seg) => inlineHtml(seg(text), ctx);
21
21
  const inlineHtml = (segments, ctx) => segments
22
22
  .map((s) => {
@@ -59,9 +59,7 @@ const inlineHtml = (segments, ctx) => segments
59
59
  (figureRef.fragment
60
60
  ? `#${encodeURIComponent(figureRef.fragment)}`
61
61
  : "");
62
- const pop = fig.kind === "svg"
63
- ? `<span class="figpop">${(ctx.figurePreview ?? figureFrameHtml)(fig, "fig-frame figpop-frame")}</span>`
64
- : "";
62
+ const pop = `<span class="figpop">${(ctx.figurePreview ?? figureFrameHtml)(fig, "fig-frame figpop-frame")}</span>`;
65
63
  return `<a class="figref" href="${escapeHtml(href)}">${label}${pop}</a>`;
66
64
  }
67
65
  }
@@ -402,7 +400,7 @@ const blockContentHtml = (b, ctx, seg) => {
402
400
  const label = b.embed?.title ?? b.alt ?? b.subformat.ext;
403
401
  const fields = b.embed?.fields?.flatMap((name) => b.subformat?.fields.filter((field) => field.name === name) ?? []) ?? b.subformat.fields;
404
402
  const previews = b.subformat.resource
405
- ? `<template data-format-previews>${b.subformat.records.map((record) => `<div data-format-preview="${escapeHtml(JSON.stringify(record.data))}">${blocksHtml(record.preview ?? [], ctx)}</div>`).join("")}</template>`
403
+ ? `<template data-format-previews>${b.subformat.records.map((record) => `<div data-format-preview="${escapeHtml(JSON.stringify(record.data))}">${blocksHtml(record.preview ?? [], ctx)}<a class="resource-source" href="/_files/file/${encodeURIComponent(record.file)}">${escapeHtml(record.file)}</a></div>`).join("")}</template>`
406
404
  : "";
407
405
  const collection = b.subformat.resource
408
406
  ? {
@@ -4,8 +4,8 @@ export const SEARCH_ICON_PATH = "M14 14l4 4M15 9a6 6 0 1 1-12 0 6 6 0 0 1 12 0";
4
4
  export const CHECK_ICON = '<svg class="ic-ok" viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 10 4 4 8-8"/></svg>';
5
5
  export const PLUGINS_ICON = '<svg class="nav-icon" viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 2 4 2v5l-4 2-4-2V4Zm-4 2 4 2 4-2m-4 2v5M6 9l-4 2v5l4 2 4-2v-5m-8 0 4 2 4-2m-4 2v5m8-9 4 2v5l-4 2-4-2m0-5 4 2 4-2m-4 2v5"/></svg>';
6
6
  const glyph = (paths) => `<svg class="nav-icon" viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
7
- export const LLM_ICON = glyph('<path d="M4 3.5h12v9H9l-4 4v-4H4Z"/><path d="M7 7.5h6M7 10h3"/>');
8
- export const SUBFORMATS_ICON = glyph('<rect x="3" y="3" width="14" height="14" rx="1"/><rect x="6" y="8" width="6" height="6" rx="1"/>');
7
+ export const LLM_ICON = glyph('<path d="m8 4 1.8 4.2L14 10l-4.2 1.8L8 16l-1.8-4.2L2 10l4.2-1.8ZM15 2v5m-2.5-2.5h5M16 13v4m-2-2h4"/>');
8
+ export const SUBFORMATS_ICON = glyph('<path d="m6 6-4 4 4 4M14 6l4 4-4 4"/><circle cx="10" cy="10" r="2"/>');
9
9
  /** One glyph per Library view, so views are told apart without reading their names. */
10
10
  export const LIBRARY_ICONS = {
11
11
  codeblocks: glyph('<path d="m7 6-4 4 4 4M13 6l4 4-4 4"/>'),
@@ -21,7 +21,7 @@ import { docIdOfFile, flattenTree, isContentPage, pageUrlKind, } from "../engine
21
21
  import { figureFrameHtml, mountFigureFrames } from "../engine/core/figure-frame.js";
22
22
  import { defaultFilePath, docIconFile, isSkillFile, manifestDirectory, parseFileLayout, docFile as sourceDocFile, suggestDocFileName, } from "../engine/core/files.js";
23
23
  import { FORMAT_TRAITS, formatSelector, matchesFormat, parseFormatQuery, } from "../engine/core/format-collections.js";
24
- import { fileFormat, isReferenceLibrary, REFERENCE_LIBRARIES, } from "../engine/core/formats.js";
24
+ import { fenceFormat, fileFormat, isReferenceLibrary, REFERENCE_LIBRARIES, } from "../engine/core/formats.js";
25
25
  import { blocksHtml, docHtml, escapeHtml, resourceDownloadHtml, termsHtml, } from "../engine/core/html.js";
26
26
  import { FOLDER_ICON_PATH, LIBRARY_ICONS, LLM_ICON, libraryIcon, PLUGINS_ICON, SUBFORMATS_ICON, } from "../engine/core/icons.js";
27
27
  import { DEFAULT_LANG, isLangTag, resolveLanguage, } from "../engine/core/language.js";
@@ -47,9 +47,11 @@ import { deferredFigureHtml, mountFigurePreviews } from "./figure-preview.js";
47
47
  import { fileReferences } from "./file-references.js";
48
48
  import { mountFontPickers } from "./font-picker.js";
49
49
  import { createFontSettings } from "./font-settings.js";
50
+ import { GIT_CSS } from "./git-style.js";
50
51
  import { translate } from "./i18n.js";
51
52
  import { jsonSchemaHtml } from "./json-schema.js";
52
53
  import { loadPreviewScript } from "./lazy-preview.js";
54
+ import { mountLinkPreviews } from "./link-preview.js";
53
55
  import { focusNavTree } from "./nav-focus.js";
54
56
  import { readNavigationText, startNavLoading } from "./nav-loading.js";
55
57
  import { updateNav } from "./nav-update.js";
@@ -58,6 +60,7 @@ import { PLUGIN_BLOCK_CSS } from "./plugin-style.js";
58
60
  import { mountPanelResize } from "./resize.js";
59
61
  import { mountDownloadBlock, mountResourceDownloads, mountResourceExpand, } from "./resource-download.js";
60
62
  import { formatPageHtml, libraryPageHtml, resourceIndex, resourceLibraryHtml, resourceTabs, } from "./resource-library.js";
63
+ import { SCROLLBAR_CSS } from "./scrollbars.js";
61
64
  import { mountSearch, SEARCH_LABELS, searchIndex, searchSections } from "./search.js";
62
65
  import { mountSectionFolds } from "./section-fold.js";
63
66
  import { mountTables } from "./table-ui.js";
@@ -447,16 +450,15 @@ export const createDocumentApplication = (root, host) => {
447
450
  const entryHtmlCache = new Map();
448
451
  /** Renders only the requested doc, not every doc in site.entries. */
449
452
  const renderEntryHtml = (site, entry) => {
450
- if (entry.library || entry.format) {
451
- if (entry.format &&
452
- (entry.format.includes("/") || Object.hasOwn(FORMAT_TRAITS, entry.format)))
453
- return {
454
- html: `<article class="res-page resource-library">${renderFormatCollection(site, entry.format)}</article>`,
455
- errors: [...site.errors, ...entry.errors],
456
- };
453
+ if (entry.format)
454
+ return {
455
+ html: `<article class="res-page resource-library">${renderFormatCollection(site, entry.format, "", docDisplayName(entry.frontmatter, entry.id))}</article>`,
456
+ errors: [...site.errors, ...entry.errors],
457
+ };
458
+ if (entry.library) {
457
459
  const index = resourceIndex(site.root ?? root, site.filePaths ?? filesSnapshot(site.root ?? root).files.map((item) => item.path), site.previews?.domains);
458
460
  return {
459
- html: `<article class="res-page resource-library subformat-page">${entry.format ? formatPageHtml(index, entry.format, docDisplayName(entry.frontmatter, entry.id), formatPreview(site, index.files?.map((item) => item.file) ?? [])) : libraryPageHtml(index, entry.library ?? "", docDisplayName(entry.frontmatter, entry.id))}</article>`,
461
+ html: `<article class="res-page resource-library subformat-page">${libraryPageHtml(index, entry.library, docDisplayName(entry.frontmatter, entry.id))}</article>`,
460
462
  errors: [...site.errors, ...entry.errors],
461
463
  };
462
464
  }
@@ -659,12 +661,8 @@ main:has(> .subformat-page [data-subformat-page]) > .page-actions { float: right
659
661
  padding: 0; color: var(--c-fg-faint); background: none; border: none; border-radius: 5px; cursor: pointer;
660
662
  transition: color 120ms ease, background 120ms ease; }
661
663
  .pbtn:hover, .pbtn:focus-visible, #gear.open > .pbtn { color: var(--c-fg); background: var(--c-raised); }
662
- * { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--c-fg-muted) 42%, transparent) transparent; }
663
- ::-webkit-scrollbar { width: 7px; height: 7px; }
664
- ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
665
- ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--c-fg-muted) 42%, transparent); border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }
666
- ::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--c-fg-muted) 68%, transparent); }
667
- @supports selector(::-webkit-scrollbar) { * { scrollbar-width: auto; scrollbar-color: auto; } }
664
+ * { box-sizing: border-box; }
665
+ ${SCROLLBAR_CSS}
668
666
  input[type="checkbox"] { appearance: none; position: relative; display: inline-block; flex: none; width: 15px; height: 15px; margin: 0; vertical-align: middle; border: 1px solid var(--c-fg-muted); border-radius: 4px; background: transparent; cursor: pointer; }
669
667
  input[type="checkbox"]:checked { border-color: var(--c-accent); }
670
668
  input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--c-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
@@ -1307,6 +1305,22 @@ details summary { cursor: pointer; opacity: .8; }
1307
1305
  .dictpop-description { display: block; margin-top: 8px; padding-top: 8px;
1308
1306
  border-top: 1px solid var(--doc-border); color: var(--doc-fg-3); font-size: 12px; }
1309
1307
  .dictref:focus-visible .dictpop { display: block; }
1308
+ body[data-link-previews] :is(.figref:hover .figpop, .figref:focus-visible .figpop, .dictref:hover .dictpop, .dictref:focus-visible .dictpop) { display: none; }
1309
+ [data-link-preview-press] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
1310
+ .link-preview { position: fixed; box-sizing: border-box; margin: 0; width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 12px; border: 1px solid var(--doc-border); border-radius: 6px; background: var(--doc-bg); color: var(--doc-fg); font: 12px/1.5 var(--font-sans); overflow: hidden; }
1311
+ .link-preview > strong, .link-preview-source { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1312
+ .link-preview-source { margin-top: 2px; color: var(--doc-fg-3); font-size: 11px; }
1313
+ .link-preview > iframe { display: block; width: 100%; height: min(180px, 35dvh); margin-top: 10px; border: 0; border-top: 1px solid var(--doc-border); pointer-events: none; }
1314
+ .link-preview > p { margin: 12px 0 0; color: var(--doc-fg-3); }
1315
+ dialog.link-preview { inset: auto 0 max(12px, env(safe-area-inset-bottom)); margin: 0 auto; width: min(560px, calc(100vw - 24px)); padding: 16px; overscroll-behavior: contain; }
1316
+ dialog.link-preview::backdrop { background: #0005; touch-action: none; }
1317
+ dialog.link-preview > strong { font-size: 16px; }
1318
+ dialog.link-preview > iframe { height: min(360px, 50dvh); max-height: calc(100dvh - 180px); pointer-events: auto; }
1319
+ .link-preview-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
1320
+ .link-preview-actions button { min-width: 88px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--doc-border); border-radius: 5px; background: var(--doc-bg); color: var(--doc-fg); font: inherit; font-size: 14px; cursor: pointer; }
1321
+ .link-preview-actions button:last-child { color: var(--doc-accent); }
1322
+ .link-preview-actions button:hover { background: var(--doc-bg-2); }
1323
+ .link-preview-actions button:focus-visible { outline: 2px solid var(--doc-accent); outline-offset: 2px; }
1310
1324
  .terms { margin: 18px 0; }
1311
1325
  .terms .dict-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; color: var(--doc-fg-3); font-size: 12px; }
1312
1326
  .terms .dict-toolbar label { display: flex; align-items: center; gap: 8px; }
@@ -1370,7 +1384,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1370
1384
  #manifest-manager { max-width: 760px; margin-inline: auto; }
1371
1385
  .manifest-toolbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-block: 8px; background: var(--c-bg1); }
1372
1386
  .manifest-toolbar h1 { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; font: 500 14px/1.5 var(--font-sans); overflow-wrap: anywhere; }
1373
- .manifest-page :is(input, select, button) { box-sizing: border-box; min-width: 0; max-width: 100%; min-height: 30px; border: 1px solid var(--c-line); border-radius: 4px; padding: 4px 8px; background: var(--c-bg1); color: var(--c-fg); font: inherit; }
1387
+ .manifest-page :where(input:not([type="checkbox"]), select, button) { box-sizing: border-box; min-width: 0; max-width: 100%; min-height: 30px; border: 1px solid var(--c-line); border-radius: 4px; padding: 4px 8px; background: var(--c-bg1); color: var(--c-fg); font: inherit; }
1374
1388
  .manifest-page button { cursor: pointer; }
1375
1389
  .manifest-page button:hover { background: var(--c-raised); }
1376
1390
  .manifest-page button:disabled { opacity: .5; cursor: default; }
@@ -1378,7 +1392,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1378
1392
  .manifest-page :is(input, select, button, summary, a):focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
1379
1393
  .manifest-page .manifest-path-input { font-family: var(--doc-mono); }
1380
1394
  .manifest-completions { inset: auto; box-sizing: border-box; font: 12px/1.6 var(--doc-mono); }
1381
- .manifest-completions .language-options { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1395
+ .manifest-completions .language-options { overscroll-behavior: contain; }
1382
1396
  .manifest-completions button { border: 0; border-radius: 0; background: transparent; }
1383
1397
  .resources-pane .manifest-tabs { margin: 0 0 4px; padding: 0; }
1384
1398
  .manifest-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; background: transparent; color: var(--c-fg-muted); }
@@ -1389,7 +1403,6 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1389
1403
  .manifest-group > summary { display: flex; align-items: center; gap: 8px; min-height: 30px; padding-inline: 4px; list-style: none; opacity: 1; font-weight: 500; }
1390
1404
  .manifest-remove-format { margin-inline-start: auto; }
1391
1405
  .manifest-reference { display: flex; align-items: center; gap: 8px; }
1392
- .manifest-reference input { min-height: 0; accent-color: var(--c-accent); }
1393
1406
  .manifest-path-row > .manifest-field { flex: 1; }
1394
1407
  .manifest-group > summary::-webkit-details-marker { display: none; }
1395
1408
  .manifest-group > summary::before { content: ""; flex: none; width: 5px; height: 5px; margin-inline: 2px 4px; border-right: 1px solid var(--c-fg-muted); border-bottom: 1px solid var(--c-fg-muted); transform: rotate(-45deg); }
@@ -1397,8 +1410,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1397
1410
  .manifest-group > summary:hover { background: var(--c-raised); }
1398
1411
  .manifest-group > .manifest-grid { margin-left: 8px; padding: 12px 0 2px 16px; border-left: 1px solid var(--c-line); }
1399
1412
  .manifest-field { position: relative; display: block; min-width: 0; align-self: start; }
1400
- .manifest-field :is(input, select) { min-height: 34px; padding-top: 6px; }
1401
- .manifest-grid :is(input, select) { width: 100%; }
1413
+ .manifest-field :is(input, select) { width: 100%; min-height: 34px; padding-top: 6px; }
1402
1414
  .manifest-paths { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 8px; border: 1px solid var(--c-line); border-radius: 4px; }
1403
1415
  .manifest-paths > legend { padding-inline: 4px; color: var(--c-fg-muted); font: 11px/14px var(--font-sans); }
1404
1416
  .manifest-paths button { display: inline-grid; place-items: center; width: 30px; padding: 0; }
@@ -1409,49 +1421,14 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1409
1421
  .manifest-error { white-space: pre-wrap; overflow-wrap: anywhere; }
1410
1422
  .manifest-source { margin-top: 14px; border: 1px solid var(--c-line); border-radius: 4px; overflow: hidden; }
1411
1423
  .manifest-source .cm-editor { height: 65dvh; background: var(--c-bg1); color: var(--c-fg); }
1412
- .manifest-source .cm-scroller { overflow: auto; font: 12px/1.65 var(--doc-mono); scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1424
+ .manifest-source .cm-scroller { overflow: auto; font: 12px/1.65 var(--doc-mono); }
1413
1425
  .manifest-source .cm-gutters { background: transparent; color: var(--c-fg-muted); border: 0; }
1414
1426
  @container (max-width: 540px) { .manifest-grid { grid-template-columns: minmax(0, 1fr); } }
1415
1427
  @media (max-width: 600px) {
1416
- .manifest-page :is(input, select, button, summary, .manifest-schema-link) { min-height: 44px; }
1428
+ .manifest-page :is(input:not([type="checkbox"]), select, button, summary, .manifest-reference, .manifest-schema-link) { min-height: 44px; }
1417
1429
  .manifest-paths button { width: 44px; }
1418
1430
  .manifest-schema-link { display: inline-flex; align-items: center; }
1419
1431
  }
1420
- .git-page { padding-top: 8px; font: 12px/1.55 var(--font-sans); }
1421
- .git-page > #git-manager { max-width: 880px; margin-inline: auto; }
1422
- .git-toolbar { gap: 8px; padding-block: 6px; }
1423
- .git-toolbar > :last-child { margin-left: auto; }
1424
- .git-controls > section { padding: 4px 0; }
1425
- .git-page .resource-tabs { margin: 12px 0; padding: 0; }
1426
- .git-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
1427
- .git-toolbar, .git-actions, .git-branches { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 30px; }
1428
- .git-toolbar { border-bottom: 1px solid var(--c-line); margin: 4px 0 8px; padding-inline: 6px; }
1429
- .git-toolbar strong { font-size: 13px; font-weight: 500; }
1430
- .git-branches { gap: 12px; margin-bottom: 8px; }
1431
- .git-branches > form { flex: 1; }
1432
- .git-branches input { width: 150px; flex: 1; }
1433
- .git-actions { margin: 6px 0; }
1434
- .git-page :is(input:not([type=checkbox]), textarea, select) { box-sizing: border-box; min-width: 0; max-width: 100%; border: 1px solid var(--c-line); border-radius: 4px; padding: 4px 8px; background: var(--c-bg1); color: var(--c-fg); font: inherit; }
1435
- .git-page :is(input:not([type=checkbox]), select) { height: 28px; }
1436
- .git-branches :is(input, select), .git-actions select { border-color: transparent; background: transparent; }
1437
- .git-page :is(input, textarea, select):focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: -1px; }
1438
- .git-page select:focus-visible { outline: none; background: var(--c-raised); }
1439
- .git-page select option { background: var(--c-bg1); color: var(--c-fg); }
1440
- .git-page .git-text-button { width: auto; padding: 0 8px; font: inherit; }
1441
- .git-page .pbtn:disabled { opacity: .45; cursor: default; }
1442
- .git-page .pbtn:disabled:hover { background: transparent; color: var(--c-fg-muted); }
1443
- .git-page .resource-item > summary .pbtn { width: 24px; height: 24px; }
1444
- .git-field { display: flex; flex-direction: column; gap: 4px; color: var(--c-fg-muted); }
1445
- .git-field textarea { resize: vertical; }
1446
- .git-form { display: flex; flex-direction: column; gap: 8px; }
1447
- .git-form > button { align-self: flex-start; }
1448
- .git-commit { margin: 10px 0 18px; }
1449
- .git-commit textarea { height: 54px; }
1450
- .git-caption, .git-notice { margin: 6px 0; font-size: 11px; color: var(--c-fg-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
1451
- .git-notice:empty { display: none; }
1452
- .git-status { width: 2ch; flex: none; white-space: pre; color: var(--c-fg-muted); }
1453
- .git-diff { max-height: 320px; overflow: auto; padding: 8px; background: var(--c-surface); font: 11px/1.6 var(--editor-font, ${MONO_FONT}); }
1454
- .git-checkbox { display: flex; align-items: center; gap: 6px; }
1455
1432
  .resource-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--doc-border); margin-bottom: 18px; }
1456
1433
  .resource-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; color: var(--doc-fg-3); text-decoration: none; white-space: nowrap; font-size: 13px; border-bottom: 2px solid transparent; }
1457
1434
  .resource-tabs a svg, .resource-item > summary > svg { flex: none; width: 15px; height: 15px; }
@@ -1479,7 +1456,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1479
1456
  .resource-results:has([data-subformat-board]:not([hidden])) .resource-toolbar > [data-i18n="Name"] { display: none; }
1480
1457
  .resource-results:has([data-subformat-board]:not([hidden])) .resource-search { flex: 1 1 160px; max-width: 260px; height: 30px; box-sizing: border-box; gap: 8px; padding: 0 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg0); }
1481
1458
  .resource-results:has([data-subformat-board]:not([hidden])) .resource-search:focus-within { border-color: var(--c-accent); }
1482
- .resource-results:has([data-subformat-board]:not([hidden])) .resource-count { display: none; }
1459
+ .resource-results:has([data-subformat-board]:not([hidden])) .resource-count:not(.format-page-count) { display: none; }
1483
1460
  .resources-pane:has([data-subformat-board]:not([hidden])) :is(.preview-content, .resource-library, .resource-results, [data-subformat-board]):not([hidden]) { display: flex; flex-direction: column; flex: 1; }
1484
1461
  .resources-pane:has([data-subformat-board]:not([hidden])) .preview-content { min-height: 100%; }
1485
1462
  .resource-results:has(> .resource-empty:not([hidden])) [data-subformat-board] { flex: none; }
@@ -1551,7 +1528,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1551
1528
  max-width: min(420px, calc(100vw - 40px)); max-height: 40vh; overflow: auto; padding: 12px 16px;
1552
1529
  border: 1px solid var(--c-danger); border-radius: 6px; background: var(--c-bg1); color: var(--c-danger);
1553
1530
  font: 13px/1.5 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; }
1554
- .subformat-columns { display: flex; flex: 1; gap: 20px; min-width: 0; overflow-x: auto; padding: 16px 2px 12px; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1531
+ .subformat-columns { display: flex; flex: 1; gap: 20px; min-width: 0; overflow-x: auto; padding: 16px 2px 12px; }
1555
1532
  .subformat-column { display: flex; flex-direction: column; flex: 1 0 248px; min-width: 0; }
1556
1533
  .subformat-cards { flex: 1; min-height: 100px; border-radius: 6px; transition: background-color 100ms ease-out; }
1557
1534
  .subformat-cards.is-drop-target { background: var(--c-raised); }
@@ -1617,8 +1594,8 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1617
1594
  .subformat-embed-toolbar .resource-search { flex: 1 1 160px; max-width: 260px; height: 32px; padding-inline: 8px; border: 1px solid var(--c-line); border-radius: 4px; }
1618
1595
  .subformat-embed-toolbar .resource-search[hidden] { display: none; }
1619
1596
  .subformat-embed-toolbar .resource-search:focus-within { border-color: var(--c-accent); }
1620
- .subformat-embed > [data-subformat-board] { box-sizing: border-box; max-height: min(640px, 65dvh); padding: 12px 2px 4px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1621
- .subformat-embed > [data-subformat-board]:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
1597
+ .subformat-embed > [data-subformat-board], .format-gallery > [data-subformat-board] { box-sizing: border-box; min-width: 0; max-height: min(640px, 65dvh); padding: 12px 2px 4px; overflow: auto; }
1598
+ .subformat-embed [data-subformat-board]:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
1622
1599
  .subformat-embed .subformat-table { overflow: visible; }
1623
1600
  .subformat-embed .subformat-control-label { background: var(--doc-bg); }
1624
1601
  .subformat-embed .subformat-columns { display: block; padding: 0; overflow: visible; }
@@ -1630,19 +1607,71 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1630
1607
  .format-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; font-size: 12px; }
1631
1608
  .format-navigation label { display: flex; align-items: center; gap: 8px; }
1632
1609
  .format-navigation code { color: var(--doc-fg-3); overflow-wrap: anywhere; }
1633
- .format-navigation select, .format-folder select, .format-dimension input { min-height: 32px; border: 1px solid var(--c-line); border-radius: 4px; padding: 4px 8px; background: var(--doc-bg); color: var(--doc-fg); font: inherit; }
1634
- .format-navigation select, .format-folder select { max-width: min(240px, 65vw); }
1635
- .format-collection .format-folder, .format-collection .format-dimension { display: block; }
1636
- .format-collection .subformat-embed-toolbar .format-dimension { flex: 0 0 60px; min-width: 60px; max-width: 60px; }
1637
- .format-folder select, .format-dimension input { width: 100%; max-width: none; min-height: 34px; box-sizing: border-box; }
1638
- .format-pagination { display: flex; align-items: center; gap: 8px; min-height: 32px; font-variant-numeric: tabular-nums; }
1639
- .format-collection [data-subformat-view="grid"] .subformat-cards { display: grid; grid-template-columns: repeat(var(--format-columns, 3), minmax(200px, 1fr)); gap: 16px; }
1610
+ .format-navigation select, .format-folder select { min-height: 34px; border: 1px solid var(--c-line); border-radius: 4px; padding: 4px 8px; background: var(--doc-bg); color: var(--doc-fg); font: inherit; box-sizing: border-box; }
1611
+ .format-navigation select { max-width: min(240px, 65vw); }
1612
+ .format-collection .subformat-embed-toolbar { align-items: center; gap: 8px; }
1613
+ .format-collection .format-folder { display: block; flex: 1 1 120px; max-width: 240px; margin: 0; order: 1; }
1614
+ .format-folder select { width: 100%; max-width: none; }
1615
+ .format-view-switch { display: inline-flex; align-items: center; border: 1px solid var(--c-line); border-radius: 5px; overflow: hidden; }
1616
+ .format-view-switch > button { display: grid; place-items: center; width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 0; }
1617
+ .format-view-switch > button[aria-pressed="true"] { color: var(--doc-accent); background: var(--c-raised); }
1618
+ .format-view-switch > .format-view-cycle, .format-folder-icon { display: none; }
1619
+ .format-layout { order: 2; }
1620
+ .format-layout > button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 6px; }
1621
+ .format-layout-count { position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%); padding: 0 3px; background: var(--c-bg1); font-size: 10px; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
1622
+ .format-layout > button > .format-grid-boxes { width: 26px; height: 26px; }
1623
+ .format-layout-popover { width: min(244px, calc(100vw - 16px)); padding: 12px; font-size: 12px; }
1624
+ .format-grid-size { position: relative; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--c-line); border-radius: 4px; }
1625
+ .format-grid-size > legend { position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%); padding: 0 6px; background: var(--c-bg1); font-variant-numeric: tabular-nums; white-space: nowrap; }
1626
+ .format-grid-size > button { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 1; padding: 0; border: 0; background: none; color: var(--c-fg-muted); cursor: nwse-resize; touch-action: none; }
1627
+ .format-grid-size > button:hover { color: var(--doc-accent); background: none; }
1628
+ .format-grid-boxes { display: block; width: 100%; height: 100%; stroke: currentColor; stroke-width: 1; fill: color-mix(in srgb, currentColor 8%, transparent); }
1629
+ .format-grid-boxes > * { vector-effect: non-scaling-stroke; }
1630
+ .format-grid-ellipsis { fill: none; stroke-width: 1.5; stroke-linecap: round; }
1631
+ .format-grid-grip { position: absolute; right: -12px; bottom: -12px; display: grid; place-items: center; width: 24px; height: 24px; background: var(--c-bg1); color: var(--doc-fg); }
1632
+ .format-display-settings { order: 5; font: 12px/1.6 var(--font-sans); }
1633
+ .format-display-settings > button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
1634
+ .format-display-fields { width: min(300px, calc(100vw - 16px)); padding: 16px 12px; }
1635
+ .format-display-fields:popover-open { display: grid; gap: 16px; }
1636
+ .format-display-fields .subformat-control { margin: 0; }
1637
+ .format-filter-popover { width: min(480px, calc(100vw - 16px)); padding: 12px; font-size: 12px; }
1638
+ .format-filter-popover button { width: auto; }
1639
+ .format-collection :is([data-subformat-filters], [data-subformat-parameters]) { display: inline-flex; align-items: center; gap: 6px; }
1640
+ .format-filter-count { color: var(--doc-accent); font-variant-numeric: tabular-nums; }
1641
+ .format-collection [data-subformat-parameters] { order: 3; }
1642
+ .format-collection [data-subformat-filters] { order: 4; }
1643
+ .format-collection :is(.subformat-search-toggle, .resource-search) { order: -2; }
1644
+ .format-page-count { order: -1; margin-left: 0; padding-inline: 4px; color: var(--c-fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
1645
+ .format-gallery { display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 8px; align-items: stretch; }
1646
+ .format-gallery > [data-subformat-board] { min-height: 180px; padding-block: 0; }
1647
+ .format-gallery > button { display: grid; place-items: center; width: 28px; padding: 0; border: 1px solid var(--c-line); border-radius: 4px; background: var(--doc-bg); color: var(--doc-fg); cursor: pointer; }
1648
+ .format-gallery > button:disabled { opacity: .35; cursor: default; }
1649
+ .format-gallery > button:enabled:hover { background: var(--c-raised); }
1650
+ .format-collection :is(.format-gallery > button, .format-view-switch button, .format-display-settings > button, .format-grid-size > button):focus-visible { outline: 2px solid var(--doc-accent); outline-offset: -2px; }
1651
+ .format-collection [data-subformat-view="grid"] .subformat-cards { display: grid; grid-template-columns: repeat(var(--format-columns, 3), minmax(min(100%, 240px), 1fr)); gap: 16px; }
1652
+ .format-collection .format-card { display: flex; flex-direction: column; padding: 0; border-radius: 8px; overflow: hidden; }
1653
+ .format-card-header { display: flex; align-items: center; gap: 8px; padding: 3px 8px; min-height: 32px; border-bottom: 1px solid var(--c-line); }
1654
+ .format-card-header > h3 { flex: 1; min-width: 0; margin: 0; font: 500 13px/1.4 var(--font-sans); }
1655
+ .format-card-format { flex: none; font: 11px/1.4 var(--doc-mono); color: var(--c-fg-muted); }
1656
+ .format-card-header .subformat-card-tools { position: static; display: flex; align-items: center; flex: none; gap: 2px; height: auto; margin: 0; padding: 0; background: transparent; }
1657
+ .format-card-header :is(.subformat-card-copy, .subformat-card-toggle, .resource-download) { width: 24px; height: 28px; }
1658
+ .format-card-header .resource-download-status { position: absolute; z-index: 2; margin-top: 56px; padding: 4px 8px; background: var(--doc-bg); border: 1px solid var(--c-line); }
1640
1659
  .format-preview { overflow: auto; min-width: 0; max-height: 240px; }
1641
1660
  .format-preview :is(.fig, .codeblk, .data-table, pre) { margin: 0; }
1642
1661
  .format-preview figcaption { display: none; }
1643
- .format-preview :is(img, video, iframe) { max-width: 100%; max-height: 220px; object-fit: contain; }
1644
- .format-collection .subformat-card-meta { margin-top: 12px; }
1645
- .subformat-table { max-width: 100%; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1662
+ .format-preview :is(img, video, iframe):not(.resource-modal *) { max-width: 100%; max-height: 220px; object-fit: contain; }
1663
+ .format-card > .format-preview { display: grid; flex: 1; align-items: center; min-height: 180px; padding: 12px; box-sizing: border-box; background: var(--doc-bg-2); }
1664
+ .format-card > .format-preview .fig > :is(img, iframe) { margin-inline: auto; }
1665
+ .format-card > .format-preview:has(.fig > :is(img, iframe[data-doc-figure-frame="svg"])) { container-type: size; grid-template-columns: minmax(0, 1fr); }
1666
+ .format-card > .format-preview .fig > :is(img, iframe[data-doc-figure-frame="svg"]):not(.resource-modal *) { max-height: 100cqh; }
1667
+ .format-card > .format-preview:has(video) { display: block; min-height: 0; max-height: none; padding: 0; overflow: visible; }
1668
+ .format-card > .format-preview .video-player > video:not(.resource-modal *) { height: 180px; border-radius: 0; }
1669
+ .format-card .video-controls:not(.resource-modal *) { flex-wrap: wrap; padding: 6px 10px; gap: 4px; border-top: 1px solid var(--c-line); }
1670
+ .format-card .video-time:not(.resource-modal *) { flex: 1 0 100%; order: 1; text-align: right; }
1671
+ .format-card .video-status:not(.resource-modal *) { padding-inline: 10px; }
1672
+ .format-card > .subformat-card-details { padding: 0 12px 12px; }
1673
+
1674
+ .subformat-table { max-width: 100%; overflow-x: auto; }
1646
1675
  .subformat-table table { width: 100%; margin: 0; border-collapse: collapse; font: 13px/1.6 var(--font-sans); }
1647
1676
  .subformat-table :is(th, td) { min-width: 100px; padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--c-line); white-space: pre-wrap; overflow-wrap: anywhere; }
1648
1677
  .subformat-table th { font-weight: 500; }
@@ -1660,32 +1689,74 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1660
1689
  .subformat-list-record .subformat-card-open { display: block; max-width: 100%; white-space: nowrap; text-overflow: ellipsis; }
1661
1690
  .subformat-list-record > .subformat-card-tools { grid-column: 3; grid-row: 1; gap: 0; height: 24px; margin: 0; padding: 0; background: transparent; }
1662
1691
  .subformat-list-record .subformat-card-file { margin-top: 8px; font-family: var(--font-sans); white-space: normal; }
1663
- .subformat-list-record :is(.subformat-card-toggle, .subformat-card-copy, .resource-download) { width: 24px; height: 24px; }
1664
- .subformat-list-record :is(.subformat-card-toggle, .subformat-card-copy, .resource-download) svg { width: 12px; height: 12px; }
1665
- .subformat-list-record > .subformat-card-meta { flex-wrap: nowrap; grid-column: 2; grid-row: 1; min-width: 0; margin: 0; padding: 0; border: 0; gap: 16px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
1692
+ .subformat-list-record > .subformat-card-tools :is(.subformat-card-toggle, .subformat-card-copy, .resource-download) { width: 24px; height: 24px; }
1693
+ .subformat-list-record > .subformat-card-tools :is(.subformat-card-toggle, .subformat-card-copy, .resource-download) svg { width: 12px; height: 12px; }
1694
+ .subformat-list-record > .subformat-card-meta { flex-wrap: nowrap; grid-column: 2; grid-row: 1; min-width: 0; margin: 0; padding: 0; border: 0; gap: 16px; overflow-x: auto; }
1666
1695
  .subformat-list-record > .subformat-card-meta > div { display: flex; align-items: baseline; gap: 6px; flex: none; min-width: 0; max-width: 32ch; }
1667
1696
  .subformat-list-record > .subformat-card-meta dt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1668
1697
  .subformat-list-record > .subformat-card-meta dd { margin: 0; }
1669
1698
  .subformat-list-record > .subformat-card-details { grid-column: 1 / -1; margin: 0; }
1699
+ .format-list-record { grid-template-columns: 56px minmax(120px, 1fr) minmax(0, 1fr) auto; }
1700
+ .format-list-record > h3 { grid-column: 2; }
1701
+ .format-list-record > .subformat-card-meta { grid-column: 3; }
1702
+ .format-list-record > .subformat-card-tools { grid-column: 4; }
1703
+ .format-list-preview { grid-column: 1; grid-row: 1; display: grid; place-items: center; width: 56px; height: 48px; padding: 4px; box-sizing: border-box; overflow: hidden; border: 1px solid var(--c-line); border-radius: 3px; background: var(--doc-bg-2); }
1704
+ .format-list-preview > * { max-width: 100%; max-height: 100%; overflow: hidden; }
1705
+ .format-list-preview :is(img, iframe, video):not(.resource-modal *) { width: 46px !important; height: 38px !important; max-height: 38px; object-fit: contain; }
1706
+ .format-list-preview :is(.codeblk-head, figcaption) { display: none; }
1707
+ .format-list-preview pre { padding: 0; font-size: 5px; line-height: 1.2; }
1670
1708
  @media (hover: hover) and (pointer: fine) {
1671
- .subformat-list-record :is(.subformat-card-copy, .resource-download) { opacity: 0; }
1672
- .subformat-list-record:is(:hover, :focus-within) :is(.subformat-card-copy, .resource-download) { opacity: 1; }
1709
+ .subformat-list-record > .subformat-card-tools :is(.subformat-card-copy, .resource-download) { opacity: 0; }
1710
+ .subformat-list-record:is(:hover, :focus-within) > .subformat-card-tools :is(.subformat-card-copy, .resource-download) { opacity: 1; }
1673
1711
  }
1674
1712
  @container (max-width: 600px) {
1675
1713
  .subformat-list-record { grid-template-columns: minmax(0, 1fr) auto; }
1676
1714
  .subformat-list-record > .subformat-card-tools { grid-column: 2; grid-row: 1; }
1677
1715
  .subformat-list-record > .subformat-card-meta { grid-column: 1 / -1; grid-row: 2; }
1716
+ .format-list-record { grid-template-columns: 48px minmax(0, 1fr) auto; }
1717
+ .format-list-record > h3 { grid-column: 2; }
1718
+ .format-list-record > .subformat-card-tools { grid-column: 3; grid-row: 1 / 3; }
1719
+ .format-list-record > .subformat-card-meta { grid-column: 2; grid-row: 2; }
1720
+ .format-list-preview { grid-row: 1 / 3; width: 48px; }
1678
1721
  .subformat-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1679
1722
  .subformat-filter-row > label:nth-child(3) { grid-column: 1; }
1680
1723
  .subformat-embed-toolbar .subformat-control { flex: 1 1 120px; max-width: none; }
1681
1724
  }
1682
1725
  @media (max-width: 600px) {
1683
- .subformat-embed > [data-subformat-board] { max-height: min(480px, 55dvh); }
1726
+ .subformat-embed > [data-subformat-board], .format-gallery > [data-subformat-board] { max-height: min(480px, 55dvh); }
1684
1727
  .subformat-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1685
1728
  .subformat-filters :is(select, input, button), .subformat-embed .subformat-controls button { min-height: 44px; }
1686
1729
  .subformat-embed-toolbar .subformat-search-toggle { width: 44px; height: 44px; }
1687
1730
  .subformat-embed-toolbar .resource-search { height: 42px; }
1688
- .format-folder select, .format-dimension input { min-height: 44px; }
1731
+ .format-collection .subformat-embed-toolbar { flex-wrap: nowrap; gap: 4px; padding-block: 8px; overflow-x: auto; }
1732
+ .format-collection .subformat-search-toggle { flex: none; width: 32px; height: 36px; }
1733
+ .format-collection .resource-search { flex: 0 0 140px; }
1734
+ .format-collection .format-page-count { padding-inline: 0; font-size: 11px; }
1735
+ .format-collection .format-view-switch { flex: none; border: 0; }
1736
+ .format-view-switch > [data-format-view] { display: none; }
1737
+ .format-collection .format-view-switch > .format-view-cycle { display: grid; width: 32px; height: 36px; min-height: 36px; border: 1px solid var(--c-line); border-radius: 4px; }
1738
+ .format-collection :is(.format-display-settings, .format-layout) { flex: none; }
1739
+ .format-collection .format-layout > button { width: 36px; height: 36px; min-height: 36px; padding: 4px; }
1740
+ .format-collection .format-layout > button > .format-grid-boxes { width: 24px; height: 24px; }
1741
+ .format-collection :is([data-format-display], [data-subformat-filters], [data-subformat-parameters]) { flex: none; display: grid; place-items: center; position: relative; width: 32px; height: 36px; min-height: 36px; padding: 0; }
1742
+ .format-collection :is([data-format-display] > span, .format-control-text) { display: none; }
1743
+ .format-filter-count { position: absolute; top: -4px; right: 0; padding-inline: 2px; background: var(--doc-bg); font-size: 10px; }
1744
+ .format-collection .format-folder { position: relative; flex: 0 0 32px; height: 36px; max-width: 32px; }
1745
+ .format-folder > .subformat-control-label { display: none; }
1746
+ .format-folder-icon { display: grid; place-items: center; width: 32px; height: 36px; box-sizing: border-box; border: 1px solid var(--c-line); border-radius: 4px; }
1747
+ .format-folder[data-active="true"] .format-folder-icon { color: var(--doc-accent); }
1748
+ .format-folder:focus-within { outline: 2px solid var(--doc-accent); outline-offset: 1px; }
1749
+ .format-folder > select { position: absolute; inset: 0; min-height: 36px; height: 36px; opacity: 0; cursor: pointer; }
1750
+ .format-card-header { flex-wrap: wrap; }
1751
+ .format-card-header > h3 { flex-basis: calc(100% - 60px); }
1752
+ .format-card-header .subformat-card-tools { margin-left: auto; }
1753
+ .format-card-header .subformat-card-tools :is(button, .resource-download), .format-card .video-controls:not(.resource-modal *) > button { width: 40px; height: 40px; }
1754
+ }
1755
+ @media (max-width: 360px) {
1756
+ .format-collection .subformat-embed-toolbar { gap: 2px; }
1757
+ .format-collection :is(.subformat-search-toggle, .format-view-switch > .format-view-cycle, [data-format-display], [data-subformat-filters], [data-subformat-parameters], .format-folder-icon) { width: 28px; }
1758
+ .format-collection .format-folder { flex-basis: 28px; max-width: 28px; }
1759
+ .format-collection .format-layout > button { width: 32px; }
1689
1760
  }
1690
1761
  .subformat-icon-form { flex: 1 0 100%; min-width: 0; padding-block: 8px; }
1691
1762
  .subformat-icon-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
@@ -1805,6 +1876,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
1805
1876
  // (autosave / correspondence display / fm visibility) are gathered in the header gear's
1806
1877
  // menu. Width is drag-resizable.
1807
1878
  const EDIT_CSS = `
1879
+ ${GIT_CSS}
1808
1880
  body.line-wrap-off .cm-content { white-space: pre; }
1809
1881
  a.file-editor-title { color: inherit; text-decoration: none; }
1810
1882
  a.file-editor-title:hover { color: var(--c-accent); text-decoration: underline; }
@@ -2440,8 +2512,8 @@ body.edit .nav-row { cursor: grab; }
2440
2512
  ? `<div class="nav-resources" id="nav-git"><div class="nav-item" data-node-id="_git"><div class="nav-row"><a class="nav-link${currentRes === "_git" ? " cur" : ""}" href="/_git" title="Git controls" data-i18n-title="Git controls">${GIT_ICON}<span class="nav-label">Git</span></a></div></div></div>`
2441
2513
  : "";
2442
2514
  const extensions = `<div class="nav-resources" id="nav-extensions" data-scope="${createHash("sha256").update(root).digest("hex")}"><div class="nav-item" data-node-id="_extensions"><div class="nav-row"><a class="nav-link${currentRes === "_extensions" ? " cur" : ""}" href="/_extensions" title="Plugins" data-i18n-title="Plugins">${PLUGINS_ICON}<span class="nav-label" data-i18n="Plugins">Plugins</span></a></div></div><div class="extensions-drop-hint" aria-hidden="true">${PLUGINS_ICON}<span data-i18n="Add plugins">Add plugins</span></div></div>`;
2443
- const subformats = `<div class="nav-resources" id="nav-subformats"><div class="nav-item" data-node-id="_subformats"><div class="nav-row"><a class="nav-link${currentRes === "_subformats" ? " cur" : ""}" href="/_subformats" title="Subformats" data-i18n-title="Subformats">${SUBFORMATS_ICON}<span class="nav-label" data-i18n="Subformats">Subformats</span></a></div></div></div><div class="nav-resources" id="nav-llm"><div class="nav-item"><div class="nav-row"><button type="button" class="nav-link" data-llm-open aria-controls="llm-chat">${LLM_ICON}<span class="nav-label">LLM</span></button></div></div></div>`;
2444
- return `<details id="nav-tools" open>${location}<div class="nav-tool-cards"><div class="nav-resources" id="nav-manifest"><div class="nav-item" data-node-id="_manifest"><div class="nav-row"><a class="nav-link${currentRes === "_manifest" ? " cur" : ""}" href="/_manifest" title="dooc.yaml">${GEAR_ICON}<span class="nav-label">dooc.yaml</span></a></div></div></div><div class="nav-resources" id="nav-files"><div class="nav-item" data-node-id="_files"><div class="nav-row"><a class="nav-link${currentRes !== undefined && currentRes !== "_manifest" && currentRes !== "_git" && currentRes !== "_extensions" && currentRes !== "_subformats" && !library && !format ? " cur" : ""}" href="/_files" title="Files" data-i18n-title="Files">${FOLDER_ICON}<span class="nav-label" data-i18n="Files">Files</span></a><span class="files-upload-status" role="status"></span></div></div>${hint}</div><div class="nav-resources" id="nav-library"><div class="nav-item" data-node-id="_library"><div class="nav-row"><a class="nav-link${library ? " cur" : ""}" href="/_library" title="Library" data-i18n-title="Library">${STATICS_ICON}<span class="nav-label" data-i18n="Library">Library</span></a></div></div></div><div class="nav-resources" id="nav-format"><div class="nav-item" data-node-id="_format"><div class="nav-row"><a class="nav-link${format ? " cur" : ""}" href="/_format" title="Format" data-i18n-title="Format">${libraryIcon("codeblocks") ?? STATICS_ICON}<span class="nav-label" data-i18n="Format">Format</span></a></div></div></div>${subformats}${git}${extensions}</div></details>`;
2515
+ const subformats = `<div class="nav-resources" id="nav-subformats"><div class="nav-item" data-node-id="_subformats"><div class="nav-row"><a class="nav-link${currentRes === "_subformats" ? " cur" : ""}" href="/_subformats" title="Subformats" data-i18n-title="Subformats">${SUBFORMATS_ICON}<span class="nav-label" data-i18n="Subformats">Subformats</span></a></div></div></div><div class="nav-resources" id="nav-llm"><div class="nav-item" data-node-id="_llm"><div class="nav-row"><a class="nav-link${currentRes === "_llm" ? " cur" : ""}" href="/_llm" title="LLM">${LLM_ICON}<span class="nav-label">LLM</span></a></div></div></div>`;
2516
+ return `<details id="nav-tools" open>${location}<div class="nav-tool-cards"><div class="nav-resources" id="nav-manifest"><div class="nav-item" data-node-id="_manifest"><div class="nav-row"><a class="nav-link${currentRes === "_manifest" ? " cur" : ""}" href="/_manifest" title="dooc.yaml">${GEAR_ICON}<span class="nav-label">dooc.yaml</span></a></div></div></div><div class="nav-resources" id="nav-files"><div class="nav-item" data-node-id="_files"><div class="nav-row"><a class="nav-link${currentRes !== undefined && currentRes !== "_manifest" && currentRes !== "_git" && currentRes !== "_extensions" && currentRes !== "_subformats" && currentRes !== "_llm" && !library && !format ? " cur" : ""}" href="/_files" title="Files" data-i18n-title="Files">${FOLDER_ICON}<span class="nav-label" data-i18n="Files">Files</span></a><span class="files-upload-status" role="status"></span></div></div>${hint}</div><div class="nav-resources" id="nav-library"><div class="nav-item" data-node-id="_library"><div class="nav-row"><a class="nav-link${library ? " cur" : ""}" href="/_library" title="Library" data-i18n-title="Library">${STATICS_ICON}<span class="nav-label" data-i18n="Library">Library</span></a></div></div></div><div class="nav-resources" id="nav-format"><div class="nav-item" data-node-id="_format"><div class="nav-row"><a class="nav-link${format ? " cur" : ""}" href="/_format" title="Format" data-i18n-title="Format">${libraryIcon("codeblocks") ?? STATICS_ICON}<span class="nav-label" data-i18n="Format">Format</span></a></div></div></div>${subformats}${git}${extensions}</div></details>`;
2445
2517
  };
2446
2518
  const formatSize = (bytes) => bytes < 1024
2447
2519
  ? `${bytes} B`
@@ -2620,16 +2692,26 @@ body.edit .nav-row { cursor: grab; }
2620
2692
  }
2621
2693
  };
2622
2694
  };
2623
- const renderFormatCollection = (site, selector, query = "") => {
2624
- const collection = readFormatCollection(site.root ?? root, selector, parseFormatQuery(query));
2695
+ const renderFormatCollection = (site, selector, query = "", title = selector) => {
2696
+ const project = site.root ?? root;
2697
+ const alias = selector && fenceFormat(selector);
2698
+ if (!query && site.subformats?.some(({ ext }) => ext === selector || ext === alias)) {
2699
+ const files = site.filePaths ?? filesSnapshot(project).files.map((item) => item.path);
2700
+ const index = resourceIndex(project, files, site.previews?.domains);
2701
+ const format = index.formats?.includes(selector) ? selector : alias;
2702
+ if (index.subformats.some(({ ext }) => ext === format))
2703
+ return `<div class="subformat-page">${formatPageHtml(index, format, title)}</div>`;
2704
+ }
2705
+ const options = parseFormatQuery(query);
2706
+ const collection = readFormatCollection(project, selector, options);
2625
2707
  const missing = collection.records
2626
2708
  .filter((record) => record.preview?.some((block) => block.type === "figureRef" && !site.ctx.figures.has(block.name)))
2627
2709
  .map((record) => record.file);
2628
2710
  const figures = new Map(site.ctx.figures);
2629
2711
  if (missing.length)
2630
- for (const figure of loadFigures(join(site.root ?? root, "figures"), missing).figures)
2712
+ for (const figure of loadFigures(join(project, "figures"), missing).figures)
2631
2713
  figures.set(figure.name, figure);
2632
- return blocksHtml([formatCollectionBlock(collection, parseFormatQuery(query))], {
2714
+ return blocksHtml([formatCollectionBlock(collection, options)], {
2633
2715
  ...site.ctx,
2634
2716
  figures,
2635
2717
  figurePreview: figureFrameHtml,
@@ -2648,6 +2730,11 @@ body.edit .nav-row { cursor: grab; }
2648
2730
  main: `<article class="res-page resource-library manifest-page"><div id="manifest-manager" data-file="${escapeHtml(file)}"></div></article>`,
2649
2731
  };
2650
2732
  }
2733
+ if (rest === "_llm")
2734
+ return {
2735
+ title: "LLM",
2736
+ main: '<article class="res-page resource-library llm-page"><div id="llm-providers"></div></article>',
2737
+ };
2651
2738
  if (rest === "_extensions")
2652
2739
  return {
2653
2740
  title: "Plugins",
@@ -2678,10 +2765,7 @@ body.edit .nav-row { cursor: grab; }
2678
2765
  }
2679
2766
  choices.add(selector);
2680
2767
  const navigation = `<nav class="format-navigation" aria-label="Format collections" data-i18n-aria-label="Format collections"><label><span data-i18n="Collection">Collection</span><select data-format-path>${[...choices].map((value) => `<option value="${escapeHtml(value)}"${value === selector ? " selected" : ""}${value ? "" : ' data-i18n="All formats"'}>${escapeHtml(value || "All formats")}</option>`).join("")}</select></label><code>format/${escapeHtml(selector || "all")}</code></nav>`;
2681
- const registered = !query && site.subformats?.some((format) => format.ext === selector);
2682
- const content = registered
2683
- ? formatPageHtml(resourceIndex(site.root ?? root, files, site.previews?.domains), selector, selector)
2684
- : renderFormatCollection(site, selector, query);
2768
+ const content = renderFormatCollection(site, selector, query);
2685
2769
  return {
2686
2770
  title: "Format",
2687
2771
  main: `<article class="res-page resource-library resource-results">${navigation}${content}</article>`,
@@ -2914,6 +2998,7 @@ toggle.setAttribute("aria-expanded", String(open));
2914
2998
  toggle.title = open ? "Close sidebar" : "Open sidebar";
2915
2999
  </script><script src="/assets/client.js"></script></body></html>`;
2916
3000
  return `${frame}${script(`
3001
+ (${mountLinkPreviews.toString()})(${workspaceFetch.toString()}, ${!opts.publish || !!opts.publish.network}, ${JSON.stringify(SCROLLBAR_CSS)});
2917
3002
  (${mountDocumentLinks.toString()})(${showDialog.toString()}, ${!opts.publish || !!opts.publish.network}${opts.publish ? "" : `, ${workspaceFetch.toString()}`});
2918
3003
  (${mountThemePickers.toString()})(${JSON.stringify(THEME_ICONS)}, ${JSON.stringify(site.themes)});
2919
3004
  (${mountThemeVariants.toString()})(document);
@@ -3049,7 +3134,7 @@ ${mode === "edit"
3049
3134
  const cur = document.querySelector("#nav-groups .nav-row a.cur");
3050
3135
  const id = (cur && cur.closest(".nav-item").dataset.docId) || "";
3051
3136
  const pathname = location.pathname.slice((globalThis.__doocClientBase ?? "").length) || "/";
3052
- const rp = pathname.startsWith("/_library") ? pathname.slice(1) : ["/_manifest", "/_git", "/_extensions", "/_subformats", "/_format"].includes(pathname) ? pathname.slice(1) : pathname.startsWith("/_files") ? pathname.slice(8).replace(/^\\/|\\/$/g, "") : null;
3137
+ const rp = pathname.startsWith("/_library") ? pathname.slice(1) : ["/_manifest", "/_git", "/_extensions", "/_llm", "/_subformats", "/_format"].includes(pathname) ? pathname.slice(1) : pathname.startsWith("/_files") ? pathname.slice(8).replace(/^\\/|\\/$/g, "") : null;
3053
3138
  const res = await localeFetch("/api/nav?current=" + encodeURIComponent(id) + (rp == null ? "" : "&res=" + encodeURIComponent(rp)));
3054
3139
  if (res.ok) {
3055
3140
  const data = await res.json();
@@ -3900,6 +3985,7 @@ ${languageFieldHtml(site.defaultLang, site.contentLanguage, entry.translatedLang
3900
3985
  }
3901
3986
  if (path === "/_manifest" ||
3902
3987
  path === "/_extensions" ||
3988
+ path === "/_llm" ||
3903
3989
  path === "/_subformats" ||
3904
3990
  /^\/_format(?:[/?]|$)/.test(path) ||
3905
3991
  path === "/_git" ||
@@ -3914,6 +4000,7 @@ ${languageFieldHtml(site.defaultLang, site.contentLanguage, entry.translatedLang
3914
4000
  "/_manifest",
3915
4001
  "/_git",
3916
4002
  "/_extensions",
4003
+ "/_llm",
3917
4004
  "/_subformats",
3918
4005
  "/_format",
3919
4006
  ].includes(path)
@@ -4620,6 +4707,7 @@ ${languageFieldHtml(site.defaultLang, site.contentLanguage, entry.translatedLang
4620
4707
  if ((mode === "edit" &&
4621
4708
  (path === "/_manifest" ||
4622
4709
  path === "/_extensions" ||
4710
+ path === "/_llm" ||
4623
4711
  path === "/_subformats" ||
4624
4712
  /^\/_format(?:[/?]|$)/.test(path) ||
4625
4713
  path === "/_git" ||
@@ -4631,7 +4719,14 @@ ${languageFieldHtml(site.defaultLang, site.contentLanguage, entry.translatedLang
4631
4719
  path.startsWith("/_files/schema/")) {
4632
4720
  const rest = path.startsWith("/_library") || /^\/_format(?:[/?]|$)/.test(path)
4633
4721
  ? path.slice(1)
4634
- : ["/_manifest", "/_git", "/_extensions", "/_subformats", "/_format"].includes(path)
4722
+ : [
4723
+ "/_manifest",
4724
+ "/_git",
4725
+ "/_extensions",
4726
+ "/_llm",
4727
+ "/_subformats",
4728
+ "/_format",
4729
+ ].includes(path)
4635
4730
  ? path.slice(1)
4636
4731
  : requestUrl.pathname.slice("/_files".length).replace(/^\/|\/$/g, "");
4637
4732
  const formatParams = new URLSearchParams(requestUrl.search);