@dooc-dev/dooc 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +41 -3
- package/dist/compiler/asset-references.d.ts +4 -0
- package/dist/compiler/asset-references.js +117 -0
- package/dist/compiler/bundle-urls.d.ts +1 -1
- package/dist/compiler/bundle-urls.js +15 -5
- package/dist/compiler/check.js +8 -5
- package/dist/compiler/code-languages.js +7 -2
- package/dist/compiler/compile.d.ts +5 -0
- package/dist/compiler/compile.js +105 -10
- package/dist/compiler/config.js +2 -1
- package/dist/compiler/export.d.ts +4 -0
- package/dist/compiler/export.js +140 -0
- package/dist/compiler/figures.js +4 -0
- package/dist/compiler/files.js +80 -41
- package/dist/compiler/fonts.js +4 -1
- package/dist/compiler/icons.d.ts +1 -1
- package/dist/compiler/icons.js +11 -2
- package/dist/compiler/ignored-files.d.ts +3 -0
- package/dist/compiler/ignored-files.js +68 -0
- package/dist/compiler/locales.js +13 -8
- package/dist/compiler/ops.d.ts +6 -0
- package/dist/compiler/ops.js +98 -7
- package/dist/compiler/subformats.d.ts +24 -0
- package/dist/compiler/subformats.js +299 -0
- package/dist/compiler/textfile.js +3 -0
- package/dist/compiler/theme-variants.js +5 -2
- package/dist/core/content-metadata.d.ts +15 -6
- package/dist/core/content-metadata.js +278 -17
- package/dist/core/content-types.d.ts +3 -1
- package/dist/core/figure-frame.js +19 -1
- package/dist/core/files.d.ts +2 -1
- package/dist/core/files.js +6 -8
- package/dist/core/flow-base-css.generated.js +1 -1
- package/dist/core/html.js +3 -3
- package/dist/core/icons.d.ts +3 -0
- package/dist/core/icons.js +3 -0
- package/dist/core/json-tools.d.ts +1 -0
- package/dist/core/json-tools.js +12 -0
- package/dist/core/routing.d.ts +5 -2
- package/dist/core/routing.js +17 -5
- package/dist/core/subformat-record.d.ts +3 -0
- package/dist/core/subformat-record.js +131 -0
- package/dist/core/subformats.d.ts +43 -0
- package/dist/core/subformats.js +81 -0
- package/dist/core/toc-ui.js +25 -23
- package/dist/edit.global.js +322 -95
- package/dist/mcp.js +50 -9
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/transport.d.ts +22 -0
- package/dist/plugins/transport.js +1 -0
- package/dist/plugins.global.js +128 -0
- package/dist/subformats.global.js +127 -0
- package/dist/ui.global.js +91 -38
- package/dist/viewer/build-plugins.d.ts +7 -0
- package/dist/viewer/build-plugins.js +70 -0
- package/dist/viewer/build.d.ts +9 -0
- package/dist/viewer/build.js +32 -5
- package/dist/viewer/editor-tools.d.ts +7 -7
- package/dist/viewer/editor-tools.js +36 -5
- package/dist/viewer/font-picker.js +5 -1
- package/dist/viewer/git-diff.d.ts +3 -0
- package/dist/viewer/git-diff.js +47 -0
- package/dist/viewer/hmr.js +4 -1
- package/dist/viewer/i18n.js +7 -5
- package/dist/viewer/language-picker.d.ts +2 -2
- package/dist/viewer/language-picker.js +26 -9
- package/dist/viewer/lazy-graph.d.ts +2 -0
- package/dist/viewer/lazy-graph.js +30 -0
- package/dist/viewer/locales/eng.json +72 -10
- package/dist/viewer/locales/jpn.json +73 -11
- package/dist/viewer/locales/zho.json +73 -11
- package/dist/viewer/nav-focus.js +8 -1
- package/dist/viewer/nav-update.d.ts +2 -0
- package/dist/viewer/nav-update.js +117 -0
- package/dist/viewer/plugin-style.d.ts +1 -0
- package/dist/viewer/plugin-style.js +82 -0
- package/dist/viewer/resize.d.ts +0 -2
- package/dist/viewer/resize.js +2 -98
- package/dist/viewer/resource-library.d.ts +10 -8
- package/dist/viewer/resource-library.js +179 -30
- package/dist/viewer/search.d.ts +4 -2
- package/dist/viewer/search.js +252 -53
- package/dist/viewer/serve.d.ts +10 -5
- package/dist/viewer/serve.js +789 -278
- package/dist/viewer/site-icon.js +13 -6
- package/dist/viewer/site-title.js +15 -2
- package/dist/viewer/textfile.d.ts +3 -0
- package/dist/viewer/textfile.js +19 -2
- package/dist/viewer/theme-picker.d.ts +2 -0
- package/dist/viewer/theme-picker.js +24 -8
- package/dist/viewer/workspace.d.ts +2 -0
- package/dist/viewer/workspace.js +46 -1
- package/package.json +24 -9
- package/dist/compiler/bundle.d.ts +0 -2
- package/dist/compiler/bundle.js +0 -100
package/dist/viewer/serve.js
CHANGED
|
@@ -24,16 +24,18 @@ import { parseContentSource } from "../compiler/code-blocks.js";
|
|
|
24
24
|
import { compileDraft, createCompiler, } from "../compiler/compile.js";
|
|
25
25
|
import { figureName } from "../compiler/figures.js";
|
|
26
26
|
import { ICONS_DIR, squareSvg } from "../compiler/icons.js";
|
|
27
|
+
import { ignoredFiles } from "../compiler/ignored-files.js";
|
|
27
28
|
import { contentLanguageCode, contentLanguages, isContentLanguage, webLanguage, } from "../compiler/language-codes.js";
|
|
28
29
|
import { setDocTranslation, siteContentLanguages, translationFile, translationFiles, } from "../compiler/locales.js";
|
|
29
30
|
import { readManifest, writeManifest } from "../compiler/manifest.js";
|
|
30
31
|
import { assembleDoc, createDocOps, isOpError } from "../compiler/ops.js";
|
|
32
|
+
import { subformatResponse, validateSubformatFile } from "../compiler/subformats.js";
|
|
31
33
|
import { walkBlocks } from "../core/blocks.js";
|
|
32
|
-
import { docIdOfFile } from "../core/content-metadata.js";
|
|
34
|
+
import { docIdOfFile, flattenTree } from "../core/content-metadata.js";
|
|
33
35
|
import { MAX_EXTENSION_BYTES } from "../core/extension-package.js";
|
|
34
36
|
import { figureFrameHtml, mountFigureFrames } from "../core/figure-frame.js";
|
|
35
37
|
import { blocksHtml, docHtml, escapeHtml, termsHtml } from "../core/html.js";
|
|
36
|
-
import { PLUGINS_ICON } from "../core/icons.js";
|
|
38
|
+
import { FOLDER_ICON_PATH, PLUGINS_ICON } from "../core/icons.js";
|
|
37
39
|
import { DEFAULT_LANG, isLangTag, resolveLanguage, } from "../core/language.js";
|
|
38
40
|
import { defaultPreviewSettings, parsePreviewSettings, } from "../core/previewers.js";
|
|
39
41
|
import { ancestorsOf, childrenOf, docPath, resolveDocPath } from "../core/routing.js";
|
|
@@ -57,21 +59,24 @@ import { mountFontPickers } from "./font-picker.js";
|
|
|
57
59
|
import { createFontSettings } from "./font-settings.js";
|
|
58
60
|
import { fontCss, readFont } from "./fonts.js";
|
|
59
61
|
import { createGitHandler, validateGitOrigin } from "./git.js";
|
|
60
|
-
import { gitBaseBody, gitBaseText } from "./git-diff.js";
|
|
62
|
+
import { gitBaseBody, gitBaseText, setSubformatChanges } from "./git-diff.js";
|
|
61
63
|
import { createHmrHub, HMR_PATH, hmrClientScript, watchProject } from "./hmr.js";
|
|
62
64
|
import { translate } from "./i18n.js";
|
|
63
65
|
import { DEFAULT_SITE_LANGUAGES, loadSiteLanguages } from "./languages.js";
|
|
66
|
+
import { loadGraphScript } from "./lazy-graph.js";
|
|
64
67
|
import { focusNavTree } from "./nav-focus.js";
|
|
68
|
+
import { updateNav } from "./nav-update.js";
|
|
65
69
|
import { loadViewerPlugins } from "./plugin-config.js";
|
|
70
|
+
import { PLUGIN_BLOCK_CSS } from "./plugin-style.js";
|
|
66
71
|
import { createPluginHandler } from "./plugins.js";
|
|
67
|
-
import { mountPanelResize
|
|
72
|
+
import { mountPanelResize } from "./resize.js";
|
|
68
73
|
import { resourceIndex, resourceLibraryHtml, resourceTabs } from "./resource-library.js";
|
|
69
74
|
import { mountSearch, SEARCH_LABELS, searchIndex, searchSections } from "./search.js";
|
|
70
75
|
import { siteIconResponse } from "./site-icon.js";
|
|
71
76
|
import { siteTitleResponse } from "./site-title.js";
|
|
72
77
|
import { previewTextfiles, textfileResponse } from "./textfile.js";
|
|
73
|
-
import { mountThemePickers } from "./theme-picker.js";
|
|
74
|
-
import { readWorkspaceSource } from "./workspace.js";
|
|
78
|
+
import { initializeThemes, mountThemePickers } from "./theme-picker.js";
|
|
79
|
+
import { readWorkspaceSource, sourceFileBase } from "./workspace.js";
|
|
75
80
|
// pkgRoot = the viewer itself (src/ for the client bundles). docsRoot = the docs folder that
|
|
76
81
|
// follows the layout convention (content/ figures/).
|
|
77
82
|
const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
@@ -79,6 +84,7 @@ const root = resolve(process.env.DOCS_ROOT ?? process.cwd());
|
|
|
79
84
|
const CONTENT_PREFIX = "content/";
|
|
80
85
|
const toEntry = (doc, source) => ({
|
|
81
86
|
id: doc.id,
|
|
87
|
+
...(doc.subformat ? { subformat: doc.subformat } : {}),
|
|
82
88
|
...(doc.parent == null ? {} : { parent: doc.parent }),
|
|
83
89
|
file: `${doc.id}.md`,
|
|
84
90
|
sourceFile: doc.file,
|
|
@@ -94,6 +100,7 @@ const toEntry = (doc, source) => ({
|
|
|
94
100
|
figureRefs: doc.refs.figures,
|
|
95
101
|
termRefs: doc.refs.terms,
|
|
96
102
|
terms: source.terms,
|
|
103
|
+
referencedFiles: source.referencedFiles,
|
|
97
104
|
});
|
|
98
105
|
// Recompile source files on every request. The compiler's cache
|
|
99
106
|
// skips re-parsing files unchanged on disk, so it stays cheap even when called on every keystroke
|
|
@@ -103,13 +110,15 @@ let siteLanguages = DEFAULT_SITE_LANGUAGES;
|
|
|
103
110
|
let compiler = createCompiler(root);
|
|
104
111
|
const ops = createDocOps(root);
|
|
105
112
|
/** Compile result → viewer Site (shared by the server's per-request path and one-off publish). */
|
|
106
|
-
export const siteFrom = ({ title, icon, docs, terms, figures, sources, siteErrors, defaultLang, previews, contentLanguages, themes, }, languages = DEFAULT_SITE_LANGUAGES.languages) => {
|
|
113
|
+
export const siteFrom = ({ title, icon, iconVariants, docs, terms, figures, sources, siteErrors, defaultLang, previews, contentLanguages, themes, subformats, }, languages = DEFAULT_SITE_LANGUAGES.languages) => {
|
|
107
114
|
return {
|
|
108
115
|
previews,
|
|
116
|
+
subformats,
|
|
109
117
|
...(contentLanguages ? { contentLanguages } : {}),
|
|
110
118
|
...(themes ? { themes } : {}),
|
|
111
119
|
...(title === undefined ? {} : { title }),
|
|
112
120
|
...(icon === undefined ? {} : { icon }),
|
|
121
|
+
...(iconVariants === undefined ? {} : { iconVariants }),
|
|
113
122
|
entries: docs.flatMap((doc) => {
|
|
114
123
|
const source = sources.get(doc.file);
|
|
115
124
|
return source ? [toEntry(doc, source)] : [];
|
|
@@ -143,9 +152,11 @@ let workspaceSource;
|
|
|
143
152
|
let applicationPreviews = defaultPreviewSettings();
|
|
144
153
|
let watchTextfiles;
|
|
145
154
|
const watchEntryTextfiles = (entries) => {
|
|
146
|
-
watchTextfiles?.(entries
|
|
155
|
+
watchTextfiles?.(entries
|
|
156
|
+
.filter((entry) => !entry.subformat)
|
|
157
|
+
.flatMap((entry) => [
|
|
147
158
|
entry.sourceFile ?? CONTENT_PREFIX + entry.file,
|
|
148
|
-
...
|
|
159
|
+
...(entry.referencedFiles ?? []),
|
|
149
160
|
]));
|
|
150
161
|
};
|
|
151
162
|
const loadSite = (locale) => {
|
|
@@ -177,13 +188,16 @@ const loadSite = (locale) => {
|
|
|
177
188
|
site.errors.push(String(error));
|
|
178
189
|
}
|
|
179
190
|
watchEntryTextfiles(site.entries);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
191
|
+
watchTextfiles?.([manifest.icon, ...Object.values(manifest.themeIcons ?? {})].filter((file) => !!file));
|
|
192
|
+
const workspace = workspaceSource ?? readWorkspaceSource(root);
|
|
193
|
+
const subformats = site.entries.flatMap((entry) => (entry.subformat ? [entry.subformat] : []));
|
|
194
|
+
if (workspace?.protocol === "git" && subformats.length)
|
|
195
|
+
setSubformatChanges(root, subformats);
|
|
183
196
|
return {
|
|
184
197
|
...site,
|
|
185
198
|
fonts: loadProjectFonts(root),
|
|
186
|
-
workspace
|
|
199
|
+
workspace,
|
|
200
|
+
sourceBase: sourceFileBase(root),
|
|
187
201
|
filePaths: manifest.errors.length
|
|
188
202
|
? undefined
|
|
189
203
|
: filesSnapshot(root).files.map((file) => file.path),
|
|
@@ -195,7 +209,9 @@ const loadSite = (locale) => {
|
|
|
195
209
|
const draftContext = (site) => ({
|
|
196
210
|
previews: site.previews,
|
|
197
211
|
root,
|
|
198
|
-
docs: site.entries
|
|
212
|
+
docs: site.entries
|
|
213
|
+
.filter((e) => !e.subformat)
|
|
214
|
+
.map((e) => ({
|
|
199
215
|
id: e.id,
|
|
200
216
|
...(e.parent == null ? {} : { parent: e.parent }),
|
|
201
217
|
file: e.sourceFile ?? CONTENT_PREFIX + e.file,
|
|
@@ -284,6 +300,17 @@ const renderSignature = (site, entry) => JSON.stringify([site.ctx.terms, site.er
|
|
|
284
300
|
const entryHtmlCache = new Map();
|
|
285
301
|
/** Renders only the requested doc, not every doc in site.entries. */
|
|
286
302
|
export const renderEntryHtml = (site, entry) => {
|
|
303
|
+
if (entry.subformat)
|
|
304
|
+
return {
|
|
305
|
+
html: `<article class="res-page resource-library subformat-page">${resourceLibraryHtml({
|
|
306
|
+
codeblocks: [],
|
|
307
|
+
urls: [],
|
|
308
|
+
urlPreviews: [],
|
|
309
|
+
subformats: [entry.subformat],
|
|
310
|
+
errors: [...site.errors, ...entry.errors],
|
|
311
|
+
}, "subformats", docDisplayName(entry.frontmatter, entry.id))}</article>`,
|
|
312
|
+
errors: [...site.errors, ...entry.errors],
|
|
313
|
+
};
|
|
287
314
|
const sig = renderSignature(site, entry);
|
|
288
315
|
const cached = entryHtmlCache.get(entry.file);
|
|
289
316
|
if (cached &&
|
|
@@ -357,12 +384,15 @@ export const isExternallyModified = (baseRaw, currentRaw) => typeof baseRaw ===
|
|
|
357
384
|
*/
|
|
358
385
|
export const resolveContentFile = (rel) => {
|
|
359
386
|
const id = typeof rel === "string" ? docIdOfFile(rel) : undefined;
|
|
360
|
-
|
|
387
|
+
if (flattenTree(readManifest(root).tree).some((node) => node.id === id && node.subformat))
|
|
388
|
+
return undefined;
|
|
389
|
+
const file = id == null ? undefined : sourceDocFile(id, readManifest(root).files);
|
|
390
|
+
return id == null || !file || ignoredFiles(root, [file]).has(file)
|
|
361
391
|
? undefined
|
|
362
392
|
: {
|
|
363
393
|
id,
|
|
364
394
|
name: `${id}.md`,
|
|
365
|
-
abs: textfilePath(root,
|
|
395
|
+
abs: textfilePath(root, file),
|
|
366
396
|
};
|
|
367
397
|
};
|
|
368
398
|
// Default palette — resolves the figures' var(--doc-*) and color-mix() following the theme. The
|
|
@@ -382,7 +412,7 @@ const LIGHT_C = `
|
|
|
382
412
|
color-scheme: light;
|
|
383
413
|
--c-bg0:#ffffff; --c-bg1:#f5f7f9; --c-surface:#fbfcfd; --c-raised:#e9edf2;
|
|
384
414
|
--c-line:#d5dae0; --c-line-soft:#e4e8ec;
|
|
385
|
-
--c-fg:#1a1e23; --c-fg-muted:#5a636c; --c-fg-faint:#
|
|
415
|
+
--c-fg:#1a1e23; --c-fg-muted:#5a636c; --c-fg-faint:#687079; --fw-body:300;
|
|
386
416
|
--c-accent:#c24800; --c-ok:#2f7d4f; --c-danger:#b23c31; --c-warn:#8a6516; --c-info:#3a6ea5;
|
|
387
417
|
--c-shadow:rgba(15,23,32,.14);
|
|
388
418
|
--doc-fg-4:#9099a8; --doc-accent-2:#0277bd; --doc-accent-fg:#ffffff;
|
|
@@ -405,13 +435,15 @@ const CHEVRON_ICON = icon('<path d="M8 5.5 12.5 10 8 14.5"/>', 14);
|
|
|
405
435
|
const GLOBE_ICON = icon('<circle cx="10" cy="10" r="7"/><ellipse cx="10" cy="10" rx="3" ry="7"/><path d="M3 10h14"/>');
|
|
406
436
|
const BOX_ICON = icon('<path d="M3.5 6.5 10 3l6.5 3.5v7L10 17l-6.5-3.5v-7Z"/><path d="M3.5 6.5 10 10l6.5-3.5M10 10v7"/>');
|
|
407
437
|
const STATICS_ICON = icon('<path d="M3 3v14h14M7 13V9m4 4V5m4 8V7"/>');
|
|
438
|
+
const SUBFORMATS_ICON = icon('<rect x="3" y="3" width="14" height="14" rx="1"/><rect x="6" y="8" width="6" height="6" rx="1"/>');
|
|
408
439
|
const GIT_ICON = icon('<path d="M5.5 6.5v7M14.5 6.5v1a4 4 0 0 1-4 4h-5"/><circle cx="5.5" cy="4.5" r="2"/><circle cx="5.5" cy="15.5" r="2"/><circle cx="14.5" cy="4.5" r="2"/>');
|
|
409
440
|
const STORAGE_ICON = icon('<path d="m3 12 2-8h10l2 8"/><rect x="3" y="12" width="14" height="5" rx="1"/><path d="M13 14.5h1"/>');
|
|
441
|
+
const FOLDER_ICON = icon(`<path d="${FOLDER_ICON_PATH}"/>`);
|
|
410
442
|
const workspaceName = (site) => site.workspace?.protocol === "storage" ? workspaceLabel(site.workspace) : "Files";
|
|
411
443
|
const workspaceText = (site) => `<span${site.workspace?.protocol === "storage" ? "" : ' data-i18n="Files"'}>${escapeHtml(workspaceName(site))}</span>`;
|
|
412
444
|
const workspaceIcon = (site) => {
|
|
413
445
|
if (site.workspace?.protocol === "git")
|
|
414
|
-
return
|
|
446
|
+
return FOLDER_ICON;
|
|
415
447
|
return site.workspace?.icon
|
|
416
448
|
? svgImg(site.workspace.icon, "nav-icon workspace-icon")
|
|
417
449
|
: STORAGE_ICON;
|
|
@@ -437,20 +469,23 @@ const THEME_ICONS = {
|
|
|
437
469
|
light: icon('<circle cx="10" cy="10" r="3.4"/><path d="M10 2.6v1.8M10 15.6v1.8M2.6 10h1.8M15.6 10h1.8M4.8 4.8l1.3 1.3M13.9 13.9l1.3 1.3M15.2 4.8l-1.3 1.3M6.1 13.9l-1.3 1.3"/>'),
|
|
438
470
|
dark: icon('<path d="M15.5 12.4A6.2 6.2 0 0 1 7.6 4.5a6.5 6.5 0 1 0 7.9 7.9Z"/>'),
|
|
439
471
|
};
|
|
472
|
+
const FONT_ICON = icon('<path d="M2.5 15 7 4l4.5 11M4 11h6M13 10.5c0-2.5 5-2.5 5 0V15M18 12h-2.5c-3.5 0-3.5 4 0 3L18 13.5"/>');
|
|
473
|
+
const SELECT_ICON = icon('<path d="m5 7 5 5 5-5"/>', 12);
|
|
440
474
|
const fontButton = (target) => {
|
|
441
475
|
const label = target === "editor" ? "Editor font" : "Viewer font";
|
|
442
|
-
return `<button class="pbtn font-control" type="button" data-font-picker="${target}" aria-haspopup="menu" aria-expanded="false" aria-label="${label}" title="${label}" disabled>${
|
|
476
|
+
return `<button class="pbtn font-control${target === "editor" ? " setting-picker" : ""}" type="button" data-font-picker="${target}" aria-haspopup="menu" aria-expanded="false" aria-label="${label}" title="${label}" disabled>${target === "editor" ? `<span data-picker-value></span>${SELECT_ICON}` : FONT_ICON}</button>`;
|
|
443
477
|
};
|
|
444
478
|
const CSS = `
|
|
445
479
|
:root { ${DARK_C} ${DOC_FROM_C} --doc-mono: ${MONO_FONT}; --font-sans: ${SANS_FONT}; }
|
|
480
|
+
html[data-theme] iframe[data-doc-figure-frame]:not([data-theme-ready]) { visibility: hidden; }
|
|
446
481
|
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { ${LIGHT_C} } }
|
|
447
482
|
:root[data-theme="light"] { ${LIGHT_C} }
|
|
448
|
-
body.edit :is(#sidebar, #panel, .resources-pane), .preview-pane[data-theme], .theme-picker[data-theme] { ${DARK_C} ${DOC_FROM_C} }
|
|
483
|
+
body.edit :is(#sidebar, #panel, .resources-pane, .subformat-toast), .preview-pane[data-theme], .theme-picker[data-theme] { ${DARK_C} ${DOC_FROM_C} }
|
|
449
484
|
@media (prefers-color-scheme: light) {
|
|
450
|
-
:root:not([data-editor-theme="dark"]) body.edit :is(#sidebar, #panel, .resources-pane),
|
|
485
|
+
:root:not([data-editor-theme="dark"]) body.edit :is(#sidebar, #panel, .resources-pane, .subformat-toast),
|
|
451
486
|
:is(.preview-pane, .theme-picker)[data-theme="auto"] { ${LIGHT_C} }
|
|
452
487
|
}
|
|
453
|
-
:root[data-editor-theme="light"] body.edit :is(#sidebar, #panel, .resources-pane),
|
|
488
|
+
:root[data-editor-theme="light"] body.edit :is(#sidebar, #panel, .resources-pane, .subformat-toast),
|
|
454
489
|
:is(.preview-pane, .theme-picker)[data-theme="light"] { ${LIGHT_C} }
|
|
455
490
|
.preview-pane { background: var(--c-bg0); color: var(--c-fg); }
|
|
456
491
|
.theme-picker { position: fixed; margin: 0; padding: 5px; width: 148px; border: 1px solid var(--c-line);
|
|
@@ -469,8 +504,9 @@ body.edit :is(#sidebar, #panel, .resources-pane), .preview-pane[data-theme], .th
|
|
|
469
504
|
main { --doc-mono: var(--viewer-font, ${MONO_FONT}); }
|
|
470
505
|
.resources-pane { --doc-mono: var(--editor-font, ${MONO_FONT}); background: var(--c-bg1); color: var(--c-fg); font-family: var(--doc-mono); }
|
|
471
506
|
.page-actions, .pane-actions { position: sticky; display: flex; align-items: center; justify-content: flex-end;
|
|
472
|
-
gap: 2px; height: 36px; padding: 0 24px;
|
|
473
|
-
.page-actions {
|
|
507
|
+
gap: 2px; height: 36px; padding: 0 24px; pointer-events: none; z-index: 5; }
|
|
508
|
+
:is(.page-actions, .pane-actions) > .pbtn { pointer-events: auto; background: var(--c-bg0); }
|
|
509
|
+
.page-actions { top: 0; margin: -20px -24px -36px; }
|
|
474
510
|
.pbtn { flex: none; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
|
|
475
511
|
padding: 0; color: var(--c-fg-faint); background: none; border: none; border-radius: 5px; cursor: pointer;
|
|
476
512
|
transition: color 120ms ease, background 120ms ease; }
|
|
@@ -495,44 +531,77 @@ button { font-family: inherit; font-size: inherit; font-weight: var(--fw-body);
|
|
|
495
531
|
:focus-visible { outline: 1px solid var(--c-accent); outline-offset: 1px; }
|
|
496
532
|
|
|
497
533
|
#doc-search { position: fixed; top: 12px; left: 0; right: 0; z-index: 20;
|
|
498
|
-
width: min(
|
|
499
|
-
padding: 0
|
|
534
|
+
width: min(420px, calc(100vw - 24px)); min-height: 44px; max-height: min(420px, calc(100dvh - 24px)); margin: 0 auto;
|
|
535
|
+
padding: 0 8px 6px; color: var(--c-fg); background: color-mix(in srgb, var(--c-bg1) 82%, transparent);
|
|
500
536
|
border: 1px solid color-mix(in srgb, var(--c-fg-muted) 55%, transparent);
|
|
501
537
|
backdrop-filter: blur(16px); border-radius: 8px; box-shadow: 0 8px 24px #0003; overflow: hidden; }
|
|
502
538
|
#doc-search[open] { display: flex; flex-direction: column; }
|
|
503
539
|
#doc-search :focus-visible { outline-color: var(--c-fg-muted); }
|
|
504
|
-
.search-
|
|
540
|
+
.search-grip { position: relative; flex: none; height: 8px; margin: 0 -8px; cursor: grab; touch-action: none; }
|
|
541
|
+
.search-grip:active { cursor: grabbing; }
|
|
542
|
+
.search-grip::after { content: ""; position: absolute; top: 50%; left: 50%; width: 36px; height: 4px;
|
|
543
|
+
margin: -2px 0 0 -18px; border-radius: 2px; background: var(--c-line); }
|
|
544
|
+
.search-grip:hover::after, .search-grip:focus-visible::after { background: var(--c-fg-muted); }
|
|
545
|
+
.search-head { display: flex; flex: none; align-items: center; gap: 8px; padding: 0 0 0 4px;
|
|
505
546
|
color: var(--c-fg-muted); }
|
|
506
547
|
.search-head svg { flex: none; }
|
|
507
|
-
#doc-search.search-filled .search-head svg { display: none; }
|
|
508
|
-
|
|
548
|
+
#doc-search.search-filled .search-head > svg { display: none; }
|
|
549
|
+
.search-head button, .search-copy { display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
|
|
550
|
+
color: var(--c-fg-muted); background: none; border: 0; border-radius: 4px; cursor: pointer; }
|
|
551
|
+
.search-head button { flex: none; }
|
|
552
|
+
.search-head button + button { margin-left: -8px; }
|
|
553
|
+
.search-head button:hover, .search-copy:hover { color: var(--c-fg); background: color-mix(in srgb, var(--c-fg-muted) 18%, transparent); }
|
|
554
|
+
#doc-search-input { width: 100%; min-width: 0; padding: 3px 0; font: inherit; font-size: 14px;
|
|
509
555
|
color: var(--c-fg); background: none; border: 0; outline: none; }
|
|
510
556
|
#doc-search-input::-webkit-search-cancel-button { appearance: none; }
|
|
511
|
-
.search-status { padding: 8px
|
|
557
|
+
.search-status { padding: 6px 8px; color: var(--c-fg-muted); font-size: 12px; }
|
|
512
558
|
.search-status:empty { display: none; }
|
|
513
559
|
.search-count { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
|
|
514
560
|
clip-path: inset(50%); white-space: nowrap; }
|
|
515
|
-
#doc-search-results { overflow-y: auto;
|
|
561
|
+
#doc-search-results { overflow-y: auto; scrollbar-gutter: stable; margin-right: -2px; padding-right: 2px;
|
|
562
|
+
min-height: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
563
|
+
#doc-search-results:not(:empty) { margin-top: 6px; }
|
|
516
564
|
#doc-search-results a { display: flex; flex: none; flex-direction: column; gap: 6px;
|
|
517
565
|
border: 1px solid var(--c-line); border-radius: 5px; color: var(--c-fg); text-decoration: none;
|
|
518
566
|
background: color-mix(in srgb, var(--c-bg0) 50%, transparent); overflow-wrap: anywhere; }
|
|
519
567
|
#doc-search-results a:hover, #doc-search-results a[aria-selected="true"] { border-color: var(--c-fg-muted); }
|
|
520
|
-
|
|
568
|
+
#doc-search-results mark { color: inherit; background: color-mix(in srgb, var(--c-accent) 32%, transparent);
|
|
569
|
+
border-radius: 2px; }
|
|
570
|
+
.search-meta { display: flex; align-items: center; gap: 6px;
|
|
521
571
|
padding: 5px 10px; border-bottom: 1px solid var(--c-line); color: var(--c-fg-muted); }
|
|
522
|
-
.search-
|
|
572
|
+
.search-kind { display: grid; flex: none; }
|
|
573
|
+
.search-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
523
574
|
#doc-search-results strong { margin: 2px 10px 0; font-weight: 500; }
|
|
524
|
-
#doc-search-results
|
|
525
|
-
.search-
|
|
526
|
-
.search-
|
|
527
|
-
.search-
|
|
528
|
-
.search-
|
|
529
|
-
.search-
|
|
530
|
-
|
|
531
|
-
.search-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
575
|
+
#doc-search-results strong:last-child { margin-bottom: 10px; }
|
|
576
|
+
.search-snippet { margin: 0 10px 10px; color: var(--c-fg-muted); }
|
|
577
|
+
.search-hit { position: relative; flex: none; }
|
|
578
|
+
.search-name + .search-name { margin-top: -4px; }
|
|
579
|
+
.search-name .search-meta { padding-right: 40px; border-bottom: 0; }
|
|
580
|
+
.search-name .search-path { color: var(--c-fg); }
|
|
581
|
+
.search-copy { position: absolute; top: 50%; right: 6px; margin-top: -12px; }
|
|
582
|
+
.search-flash { animation: search-flash 2.6s ease-out; }
|
|
583
|
+
@keyframes search-flash {
|
|
584
|
+
0%, 35% { background-color: color-mix(in srgb, var(--c-accent) 18%, transparent);
|
|
585
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-accent) 18%, transparent); }
|
|
586
|
+
100% { background-color: transparent; box-shadow: 0 0 0 4px transparent; } }
|
|
587
|
+
/* Docked, the panel is a right sidebar like #panel. */
|
|
588
|
+
#doc-search.search-docked { position: sticky; top: 0; left: auto; right: auto; z-index: auto; flex: 0 1 auto;
|
|
589
|
+
align-self: flex-start; width: 320px; min-width: 240px; height: 100vh; min-height: 0; max-height: none; margin: 0;
|
|
590
|
+
padding: 8px 10px 10px; border: 0; border-left: 1px solid var(--c-line); border-radius: 0;
|
|
591
|
+
background: var(--c-bg1); box-shadow: none; backdrop-filter: none; }
|
|
592
|
+
.search-docked #doc-search-results { margin-right: -8px; padding-right: 8px; }
|
|
593
|
+
/* Keep the preview readable; the editor panel gives up width before the search sidebar does. */
|
|
594
|
+
body:has(#doc-search.search-docked[open]) main { min-width: 240px; }
|
|
595
|
+
body:has(#doc-search.search-docked[open]) #panel { flex-shrink: 100; min-width: 240px; }
|
|
596
|
+
.search-docked :is(.search-grip, .search-resize-x, .search-resize-y, .search-resize-xy),
|
|
597
|
+
#doc-search:not(.search-docked) .search-resize-w { display: none; }
|
|
598
|
+
/* Invisible edges: the right and bottom borders resize the window. */
|
|
599
|
+
.search-resize { position: absolute; touch-action: none; }
|
|
600
|
+
.search-resize:focus-visible { outline-offset: -2px; }
|
|
601
|
+
.search-resize-x { top: 0; right: 0; bottom: 0; width: 6px; cursor: ew-resize; }
|
|
602
|
+
.search-resize-y { left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
|
|
603
|
+
.search-resize-xy { right: 0; bottom: 0; width: 12px; height: 12px; cursor: nwse-resize; }
|
|
604
|
+
.search-resize-w { top: 0; left: 0; bottom: 0; width: 6px; cursor: ew-resize; }
|
|
536
605
|
|
|
537
606
|
/* ── sidebar ── */
|
|
538
607
|
#sidebar { width: var(--sidebar-width, 260px); height: 100vh; position: sticky; top: 0; flex: none;
|
|
@@ -541,11 +610,16 @@ button { font-family: inherit; font-size: inherit; font-weight: var(--fw-body);
|
|
|
541
610
|
body.sidebar-closed #sidebar { width: 52px; }
|
|
542
611
|
body.sidebar-closed #sidebar-resize { display: none; }
|
|
543
612
|
.panel-resize { position: absolute; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 6;
|
|
544
|
-
touch-action: none;
|
|
613
|
+
touch-action: none; }
|
|
614
|
+
.panel-resize::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; border-radius: 1px;
|
|
615
|
+
transition: background 120ms ease; }
|
|
545
616
|
#sidebar-resize { right: 0; }
|
|
617
|
+
#sidebar-resize::before { right: -1px; }
|
|
546
618
|
#resize { left: 0; }
|
|
547
|
-
|
|
619
|
+
#resize::before { left: -1px; }
|
|
620
|
+
.panel-resize:hover::before, .panel-resize:focus-visible::before, .panel-resize.drag::before {
|
|
548
621
|
background: color-mix(in srgb, var(--c-accent) 60%, transparent); }
|
|
622
|
+
.panel-resize.drag { outline: none; }
|
|
549
623
|
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
|
|
550
624
|
body.sidebar-closed .site-title { display: none; }
|
|
551
625
|
#sidebar-head { position: relative; flex: none; display: flex; align-items: center; min-width: 0; min-height: 36px;
|
|
@@ -554,8 +628,9 @@ body.sidebar-closed .site-title { display: none; }
|
|
|
554
628
|
background: transparent; border: none; color: var(--c-fg-muted); cursor: pointer; }
|
|
555
629
|
#sidebar-toggle:hover { color: var(--c-fg); }
|
|
556
630
|
#site-icon-slot { position: relative; flex: none; width: 24px; height: 24px; margin: 0 8px 0 16px; color: var(--c-fg-muted); }
|
|
557
|
-
#site-icon, #site-icon-slot > .nav-icon { display: block; width: 100%; height: 100%; object-fit: contain; }
|
|
558
|
-
|
|
631
|
+
#site-icon, #site-icon-slot > .nav-icon, .site-icon-variants > img { display: block; width: 100%; height: 100%; object-fit: contain; }
|
|
632
|
+
.site-icon-variants, .site-icon-variants > span { display: contents; }
|
|
633
|
+
#site-icon[hidden], .site-icon-variants > [hidden], #site-icon-slot:has(#site-icon:not([hidden])) > .nav-icon { display: none; }
|
|
559
634
|
body.sidebar-closed #site-icon-slot { margin: 0 auto; }
|
|
560
635
|
body.sidebar-closed #sidebar-toggle { position: absolute; inset: 0; width: 100%; justify-content: center; padding: 0; }
|
|
561
636
|
body.sidebar-closed #sidebar-toggle svg { visibility: hidden; }
|
|
@@ -574,6 +649,7 @@ body.sidebar-closed #sidebar-toggle svg { visibility: hidden; }
|
|
|
574
649
|
.nav-link.cur { color: var(--c-fg); }
|
|
575
650
|
.nav-link.cur::before { background: var(--c-accent); }
|
|
576
651
|
.nav-icon { flex: none; }
|
|
652
|
+
.nav-row :is(svg.nav-icon, .doc-icon-frame) { translate: 0 1px; }
|
|
577
653
|
.workspace-icon { width: 18px; height: 18px; object-fit: contain; }
|
|
578
654
|
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
579
655
|
/* The doc tree. Top-level docs are .nav-link with an icon,
|
|
@@ -650,33 +726,37 @@ img.doc-icon { flex: none; width: 18px; height: 18px; object-fit: contain; }
|
|
|
650
726
|
.nav-row > a.cur .doc-icon-frame > img, .nav-doc-row:has(> a.cur) > .nav-doc-icon .doc-icon-frame > img { visibility: hidden; }
|
|
651
727
|
.nav-row > a.cur .doc-icon-frame::after, .nav-doc-row:has(> a.cur) > .nav-doc-icon .doc-icon-frame::after {
|
|
652
728
|
content: ""; position: absolute; inset: 0; background: currentColor; mask: var(--doc-icon) center / contain no-repeat; }
|
|
653
|
-
body.sidebar-closed #sidebar-content
|
|
654
|
-
body.sidebar-closed #nav-groups {
|
|
655
|
-
body.sidebar-closed #nav-
|
|
656
|
-
body.sidebar-closed #nav-groups
|
|
657
|
-
body.sidebar-closed #nav-status { display: none; }
|
|
658
|
-
body.sidebar-closed #nav-groups .nav-tree {
|
|
659
|
-
body.sidebar-closed #nav-groups .nav-
|
|
660
|
-
body.sidebar-closed #nav-groups .nav-
|
|
661
|
-
body.sidebar-closed #nav-groups .nav-
|
|
662
|
-
body.sidebar-closed #nav-groups .nav-row >
|
|
663
|
-
body.sidebar-closed #nav-groups
|
|
664
|
-
body.sidebar-closed #nav-groups
|
|
665
|
-
body.sidebar-closed :is(
|
|
729
|
+
body.sidebar-closed :is(#sidebar-content, #nav-docs) { scrollbar-width: none; scrollbar-gutter: auto; }
|
|
730
|
+
body.sidebar-closed #nav-groups { --nav-rail: 8px; }
|
|
731
|
+
body.sidebar-closed #nav-groups .nav-label, body.sidebar-closed #nav-status { opacity: 0; pointer-events: none; }
|
|
732
|
+
body.sidebar-closed #nav-groups .nav-placeholder { visibility: hidden; pointer-events: none; }
|
|
733
|
+
body.sidebar-closed #nav-groups :is(.nav-tree-toggle, .nav-tree-spacer, .new, .nav-delete, .files-upload-status, .files-drop-hint, .extensions-drop-hint, input, .nav-icon-clear) { display: none; }
|
|
734
|
+
body.sidebar-closed #nav-groups .nav-tree { --nav-pad: 18px; --nav-line: 8px; }
|
|
735
|
+
body.sidebar-closed #nav-groups .nav-tree > .nav-item:not(.nav-ancestor) > .nav-row::before { width: calc(var(--nav-pad) - var(--nav-line) - 2px); }
|
|
736
|
+
body.sidebar-closed #nav-groups .nav-ancestor.open > .nav-row::after { top: 50%; }
|
|
737
|
+
body.sidebar-closed #nav-groups .nav-ancestor > .nav-tree > .nav-ancestor > .nav-row::before { height: 50%; }
|
|
738
|
+
body.sidebar-closed #nav-groups :is(.nav-row > .nav-link, .nav-tree-link) { padding-left: 0; padding-right: 0; gap: 0; }
|
|
739
|
+
body.sidebar-closed #nav-groups .nav-doc-row { padding-left: 0; gap: 0; }
|
|
740
|
+
body.sidebar-closed #nav-groups .nav-doc-row > a { padding-left: 0; }
|
|
741
|
+
body.sidebar-closed #nav-groups :is(.nav-doc-icon, .nav-row > a > .nav-icon, .nav-row > a > .doc-icon-frame) { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; }
|
|
742
|
+
body.sidebar-closed #nav-groups .nav-doc-icon { z-index: 1; pointer-events: none; }
|
|
666
743
|
body.edit #sidebar-content { display: flex; flex-direction: column; overflow: hidden; scrollbar-gutter: auto; }
|
|
667
744
|
body.edit #nav-groups { flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
668
745
|
#nav-docs { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
|
|
669
|
-
#nav-tools { position: relative; flex: none;
|
|
670
|
-
|
|
671
|
-
#tools-resize:hover, #tools-resize:focus-visible, body.resizing-tools #tools-resize { background: color-mix(in srgb, var(--c-fg-muted) 20%, transparent); }
|
|
672
|
-
body.resizing-tools, body.resizing-tools * { cursor: row-resize !important; user-select: none !important; }
|
|
673
|
-
.nav-tool-cards { flex: 1; min-height: 0; overflow: auto; }
|
|
746
|
+
#nav-tools { position: relative; flex: none; margin: 10px 8px 4px; padding: 12px 4px 4px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-bg1); }
|
|
747
|
+
.nav-tool-cards { max-height: max(36px, calc(50dvh - 40px)); overflow: auto; }
|
|
674
748
|
#nav-tools .nav-resources { height: 36px; margin: 0; border: 0; border-radius: 4px; }
|
|
675
|
-
.workspace-location { position: absolute; top: -1px; left: 10px; z-index: 3; transform: translateY(-50%); display: flex; align-items: center; gap: 4px;
|
|
676
|
-
|
|
677
|
-
.workspace-
|
|
678
|
-
|
|
679
|
-
|
|
749
|
+
.workspace-location { position: absolute; top: -1px; left: 10px; right: 6px; z-index: 3; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; padding: 0 2px; color: var(--c-fg-muted); font: 600 10px/16px var(--font-sans); cursor: pointer; list-style: none; border-radius: 4px; }
|
|
750
|
+
#nav-tools:not([open]) { padding-bottom: 0; border-color: transparent; border-top-color: var(--c-line); border-radius: 0; }
|
|
751
|
+
.workspace-location::-webkit-details-marker { display: none; }
|
|
752
|
+
.workspace-location:hover { color: var(--c-fg); }
|
|
753
|
+
.workspace-location > .nav-icon { flex: none; width: 14px; height: 14px; background: var(--c-bg1); }
|
|
754
|
+
.workspace-location > .nav-icon:last-child { margin-left: auto; }
|
|
755
|
+
#nav-tools[open] > .workspace-location > .nav-icon:last-child { transform: rotate(90deg); }
|
|
756
|
+
.workspace-address { min-width: 0; padding: 0 2px; background: var(--c-bg1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
757
|
+
body.sidebar-closed #nav-tools { margin-left: 4px; margin-right: 4px; padding-left: 0; padding-right: 0; }
|
|
758
|
+
body.sidebar-closed .workspace-location { left: 2px; right: 2px; min-height: 16px; }
|
|
759
|
+
body.sidebar-closed .workspace-address { display: none; }
|
|
680
760
|
.nav-resources { position: relative; container-type: size; flex: none; height: 42px; margin: 8px 8px 4px;
|
|
681
761
|
border: 1px solid var(--c-line); border-radius: 8px; overflow: hidden;
|
|
682
762
|
background: var(--c-bg1); font-family: var(--font-sans); }
|
|
@@ -738,15 +818,13 @@ article { max-width: 860px; margin: 0 auto; font-family: var(--viewer-font, syst
|
|
|
738
818
|
[data-plugin-controls] button:disabled { opacity: .55; cursor: wait; }
|
|
739
819
|
.plugin-content { padding: 12px; overflow: auto; }
|
|
740
820
|
.plugin-content:empty { display: none; }
|
|
741
|
-
.plugin-content :is(th, td) { padding: 6px 8px; text-align: start; border-bottom: 1px solid var(--doc-border); }
|
|
742
|
-
.plugin-content th { background: var(--doc-bg-2); color: var(--doc-fg-2); font-size: 12px; font-weight: 600; }
|
|
743
|
-
.plugin-content tr:last-child td { border-bottom: 0; }
|
|
744
821
|
.plugin-resize { display: none; height: 12px; align-items: center; justify-content: center;
|
|
745
822
|
cursor: row-resize; touch-action: none; user-select: none; }
|
|
746
823
|
.plugin[data-ready="true"]:not(.collapsed) > .plugin-resize { display: flex; }
|
|
747
|
-
.plugin-resize::before { content: ""; width: 32px; height:
|
|
824
|
+
.plugin-resize::before { content: ""; width: 32px; height: 2px; border-radius: 1px; background: var(--doc-border); }
|
|
748
825
|
.plugin-resize:hover::before, .plugin-resize:focus-visible::before, .plugin-resize.drag::before { background: var(--doc-accent); }
|
|
749
826
|
.plugin-resize:focus-visible { outline: 2px solid var(--doc-accent); outline-offset: -2px; }
|
|
827
|
+
.plugin-resize.drag { outline: none; }
|
|
750
828
|
body:has(.plugin-resize.drag), body:has(.plugin-resize.drag) * { cursor: row-resize !important; user-select: none !important; }
|
|
751
829
|
body:has(.plugin-resize.drag) iframe { pointer-events: none; }
|
|
752
830
|
|
|
@@ -764,83 +842,7 @@ body:has(.plugin-resize.drag) iframe { pointer-events: none; }
|
|
|
764
842
|
.plugin-heading img { display: block; width: 16px; height: 16px; }
|
|
765
843
|
.plugin-heading-context { color: var(--doc-fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
766
844
|
.plugin-heading button { font: inherit; color: var(--doc-fg-2); background: transparent; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
|
|
767
|
-
|
|
768
|
-
.plugin-blocks > :first-child, .plugin-block-columns > div > :first-child { margin-top: 0; }
|
|
769
|
-
.plugin-blocks .plugin-block-heading { margin: 0 0 8px; padding: 0; border: 0; font: inherit; font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--doc-fg); }
|
|
770
|
-
.plugin-block-text { margin: 8px 0; white-space: pre-wrap; }
|
|
771
|
-
.plugin-block-text:has(p, pre, ul, ol) { white-space: normal; }
|
|
772
|
-
.plugin-blocks p { margin: 4px 0; white-space: pre-wrap; }
|
|
773
|
-
.plugin-blocks :is(ul, ol) { margin: 6px 0; padding-left: 22px; }
|
|
774
|
-
.plugin-blocks > :last-child { margin-bottom: 0; }
|
|
775
|
-
.plugin-blocks strong { font-weight: 600; }
|
|
776
|
-
.plugin-blocks a { color: var(--doc-accent); text-underline-offset: 3px; }
|
|
777
|
-
.plugin-blocks code { font-family: var(--doc-mono); }
|
|
778
|
-
.plugin-block-context { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0; color: var(--doc-fg-3); font-size: 11px; }
|
|
779
|
-
.plugin-block-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 16px; margin: 8px 0; }
|
|
780
|
-
.plugin-block-fields > div { min-width: 0; }
|
|
781
|
-
.plugin-block-fields dt { color: var(--doc-fg-3); font-size: 10px; margin-bottom: 1px; }
|
|
782
|
-
.plugin-block-fields dd { margin: 0; min-height: 20px; font-size: 12px; }
|
|
783
|
-
.plugin-block-columns { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 16px; }
|
|
784
|
-
.plugin-block-columns > div, .plugin-block-columns aside { min-width: 0; }
|
|
785
|
-
.plugin-block-columns aside { border-left: 1px solid var(--doc-border); padding-left: 12px; }
|
|
786
|
-
.plugin-block-columns aside .plugin-block-fields { grid-template-columns: 1fr; margin-top: 0; }
|
|
787
|
-
.plugin-block-section { border-top: 1px solid var(--doc-border); padding-top: 6px; margin: 10px 0 0; min-width: 0; }
|
|
788
|
-
.plugin-block-section > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--doc-fg-2); padding: 4px 0; }
|
|
789
|
-
.plugin-block-note { color: var(--doc-warn); font-size: 11px; border-left: 2px solid currentColor; padding-left: 10px; }
|
|
790
|
-
.plugin-block-table { overflow: auto; width: 100%; margin: 8px 0; }
|
|
791
|
-
.plugin-block-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
|
792
|
-
.plugin-block-table :is(th, td) { padding: 5px 8px; min-width: 72px; max-width: 320px; vertical-align: top; }
|
|
793
|
-
.plugin-blocks .plugin-block-code { font: 12px/1.65 var(--doc-mono); padding: 12px; margin: 10px 0; border: 1px solid var(--doc-border); border-radius: 6px; max-height: 400px; overflow: auto; white-space: pre-wrap; }
|
|
794
|
-
.plugin-block-diff code > span { display: inline-block; min-width: 100%; }
|
|
795
|
-
.plugin-block-diff [data-tone="success"] { color: var(--doc-ok); background: color-mix(in srgb, var(--doc-ok) 8%, transparent); }
|
|
796
|
-
.plugin-block-diff [data-tone="danger"] { color: var(--doc-danger); background: color-mix(in srgb, var(--doc-danger) 8%, transparent); }
|
|
797
|
-
.plugin-block-message { padding: 8px 0; border-bottom: 1px solid var(--doc-border); }
|
|
798
|
-
.plugin-block-message:last-child { border-bottom: 0; }
|
|
799
|
-
.plugin-message-byline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
800
|
-
.plugin-message-byline > span:not(.plugin-avatar, .plugin-message-actions) { color: var(--doc-fg-3); font-size: 10px; }
|
|
801
|
-
.plugin-avatar { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; color: var(--doc-accent); background: color-mix(in srgb, var(--doc-accent) 12%, var(--doc-bg)); font-size: 10px; }
|
|
802
|
-
.plugin-task { display: flex; align-items: baseline; gap: 8px; list-style: none; }
|
|
803
|
-
.plugin-message-actions svg { display: block; width: 14px; height: 14px; }
|
|
804
|
-
.plugin-message-actions .plugin-block-button { padding: 4px; border: 0; color: var(--doc-fg-3); }
|
|
805
|
-
.plugin-message-actions { margin-left: auto; display: flex; gap: 4px; }
|
|
806
|
-
.plugin-message-body, .plugin-reactions { margin: 4px 0 0 32px; }
|
|
807
|
-
.plugin-reactions { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; }
|
|
808
|
-
.plugin-reactions button { font: inherit; padding: 2px 8px; border: 1px solid var(--doc-border); border-radius: 12px; background: transparent; color: var(--doc-fg-2); cursor: pointer; }
|
|
809
|
-
.plugin-reactions [aria-pressed="true"] { border-color: var(--doc-accent); color: var(--doc-accent); background: color-mix(in srgb, var(--doc-accent) 8%, transparent); }
|
|
810
|
-
.plugin-badge { display: inline-flex; padding: 1px 7px; border-radius: 5px; font-size: 11px; color: var(--doc-fg-2); background: var(--doc-bg-2); }
|
|
811
|
-
.plugin-badge[data-tone="accent"] { color: var(--doc-accent); background: color-mix(in srgb, var(--doc-accent) 10%, var(--doc-bg)); }
|
|
812
|
-
.plugin-badge[data-tone="success"] { color: var(--doc-ok); background: color-mix(in srgb, var(--doc-ok) 10%, var(--doc-bg)); }
|
|
813
|
-
.plugin-badge[data-tone="warning"] { color: var(--doc-warn); background: color-mix(in srgb, var(--doc-warn) 10%, var(--doc-bg)); }
|
|
814
|
-
.plugin-badge[data-tone="danger"] { color: var(--doc-danger); background: color-mix(in srgb, var(--doc-danger) 10%, var(--doc-bg)); }
|
|
815
|
-
.plugin-copy-value { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; }
|
|
816
|
-
.plugin-copy { width: 22px; height: 22px; padding: 3px; border: 0; background: transparent; color: var(--doc-fg-3); cursor: pointer; flex: none; }
|
|
817
|
-
.plugin-copy svg { width: 14px; height: 14px; }
|
|
818
|
-
.plugin-block-progress { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--doc-fg-3); margin: 12px 0; }
|
|
819
|
-
.plugin-block-progress progress { flex: 1; width: 0; height: 6px; accent-color: var(--doc-accent); }
|
|
820
|
-
.plugin-block-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
|
|
821
|
-
.plugin-block-actions:has([data-block-composer]) { display: block; }
|
|
822
|
-
.plugin-block-button { font: inherit; font-size: 12px; padding: 5px 10px; border: 1px solid var(--doc-border); border-radius: 5px; color: var(--doc-fg); background: transparent; cursor: pointer; }
|
|
823
|
-
.plugin-block-button:hover { background: var(--doc-bg-2); }
|
|
824
|
-
.plugin-block-button:disabled { opacity: .5; cursor: wait; }
|
|
825
|
-
.plugin-action[aria-pressed="true"] { color: var(--doc-accent); background: var(--doc-bg-2); }
|
|
826
|
-
.plugin-danger { color: var(--doc-danger); }
|
|
827
|
-
.plugin [data-plugin-edit-trigger]:focus-visible, .plugin :is(button, summary, input, select, textarea):focus-visible, .plugin-block-table:focus-visible { outline: 2px solid var(--doc-accent); outline-offset: 2px; }
|
|
828
|
-
.plugin-editor { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; font: inherit; font-size: 12px; line-height: 1.5; color: var(--doc-fg); background: var(--doc-bg); min-width: 0; }
|
|
829
|
-
.plugin-editor label { display: grid; gap: 0; font-size: 0; }
|
|
830
|
-
.plugin-editor :is(input, textarea, select) { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; padding: 3px 6px; border: 1px solid var(--doc-border); border-radius: 4px; color: var(--doc-fg); background: var(--doc-bg); font: inherit; font-size: 12px; line-height: 1.5; }
|
|
831
|
-
.plugin-editor textarea { resize: vertical; min-height: 54px; max-height: 40vh; }
|
|
832
|
-
.plugin-editor .plugin-submit { background: var(--doc-accent); color: var(--doc-accent-fg); border-color: transparent; }
|
|
833
|
-
.plugin-editor-notice { color: var(--doc-danger); font-size: 11px; }
|
|
834
|
-
.plugin-editor-notice:empty { display: none; }
|
|
835
|
-
.plugin [hidden] { display: none !important; }
|
|
836
|
-
@container (max-width: 600px) {
|
|
837
|
-
.plugin-block-columns { grid-template-columns: minmax(0, 1fr); gap: 14px; }
|
|
838
|
-
.plugin-block-columns aside { border-left: 0; border-top: 1px solid var(--doc-border); padding: 14px 0 0; }
|
|
839
|
-
.plugin-block-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
840
|
-
.plugin-heading-context { display: none; }
|
|
841
|
-
.plugin-blocks .plugin-block-heading { font-size: 16px; }
|
|
842
|
-
.plugin-message-body, .plugin-reactions { margin-left: 0; }
|
|
843
|
-
}
|
|
845
|
+
${PLUGIN_BLOCK_CSS}
|
|
844
846
|
|
|
845
847
|
article, article * { font-weight: 400; }
|
|
846
848
|
h1, h2, h3 { font-weight: 400; }
|
|
@@ -859,7 +861,7 @@ article h2 { font-size: 20px; margin-top: 24px; margin-bottom: 8px; border-botto
|
|
|
859
861
|
article h3 { font-size: 16px; margin-top: 16px; margin-bottom: 4px; }
|
|
860
862
|
h2[id], h3[id] { scroll-margin-top: 12px; }
|
|
861
863
|
p { margin: 8px 0; }
|
|
862
|
-
ul, ol { margin: 4px 0;
|
|
864
|
+
ul, ol { margin: 4px 0; }
|
|
863
865
|
li { margin: 0; }
|
|
864
866
|
li > ul, li > ol { margin: 0; }
|
|
865
867
|
.fullname { opacity: .7; margin-bottom: 8px; }
|
|
@@ -942,8 +944,10 @@ pre code.code-foldable { display: block; padding-left: 18px; }
|
|
|
942
944
|
.textfile-unavailable { margin: 0; padding: 12px; color: var(--doc-fg-2); font-size: 12px; }
|
|
943
945
|
.textfile.unavailable .codeblk-head { cursor: default; }
|
|
944
946
|
.codeblk .codecopy.ok .ic-ok { display: block; color: var(--doc-ok); }
|
|
945
|
-
table { border-collapse: collapse;
|
|
947
|
+
table { border-collapse: collapse; }
|
|
946
948
|
th, td { border: 1px solid color-mix(in srgb, currentColor 25%, transparent); padding: 4px 10px; }
|
|
949
|
+
th { text-align: start; }
|
|
950
|
+
article thead th { background: var(--doc-bg-2); color: var(--doc-fg-2); font-weight: 500; }
|
|
947
951
|
.data-table { position: relative; min-width: 0; width: 100%; margin: 12px 0; }
|
|
948
952
|
.data-table button { color: inherit; background: transparent; font: inherit; cursor: pointer; }
|
|
949
953
|
.data-table button:focus-visible, .data-table-scroll:focus-visible { outline: 2px solid var(--doc-accent); outline-offset: -2px; }
|
|
@@ -986,8 +990,10 @@ article a { color: var(--doc-accent); }
|
|
|
986
990
|
.callout-body > :last-child { margin-bottom: 0; }
|
|
987
991
|
.errors { border: 1px solid var(--doc-danger); border-radius: 8px; padding: 10px 16px;
|
|
988
992
|
margin-bottom: 16px; color: var(--doc-danger); font-size: 13px; }
|
|
989
|
-
.
|
|
990
|
-
.
|
|
993
|
+
.doc-title { display: flex; align-items: baseline; gap: 12px; max-width: calc(100% - 100px); padding-top: 8px; margin-bottom: 2px; }
|
|
994
|
+
.doc-title > h1 { min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
995
|
+
.in-toc { min-width: 28px; max-width: 100%; }
|
|
996
|
+
.toc-current { position: relative; display: block; max-width: min(240px, 100%); padding: 4px 20px 4px 6px;
|
|
991
997
|
overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 0; border-radius: 4px;
|
|
992
998
|
background: transparent; color: var(--doc-fg-2); font: 12px/20px var(--font-sans); text-align: left; cursor: pointer; }
|
|
993
999
|
.toc-current::after { content: ""; position: absolute; right: 6px; top: 10px; width: 5px; height: 5px;
|
|
@@ -1001,15 +1007,12 @@ article a { color: var(--doc-accent); }
|
|
|
1001
1007
|
.in-toc .lvl2 a { padding-left: 20px; }
|
|
1002
1008
|
.in-toc .lvl3 a { padding-left: 30px; }
|
|
1003
1009
|
.in-toc a:hover, .in-toc a[aria-current] { color: var(--doc-accent); background: color-mix(in srgb, var(--doc-accent) 8%, transparent); }
|
|
1004
|
-
.toc-
|
|
1005
|
-
.toc-
|
|
1006
|
-
.toc-
|
|
1007
|
-
.toc-
|
|
1008
|
-
.toc-
|
|
1009
|
-
.toc-
|
|
1010
|
-
html:has(.page-actions .toc-seek), .preview-pane:has(> .pane-actions .toc-seek) { scrollbar-width: none; }
|
|
1011
|
-
html:has(.page-actions .toc-seek)::-webkit-scrollbar,
|
|
1012
|
-
.preview-pane:has(> .pane-actions .toc-seek)::-webkit-scrollbar { display: none; }
|
|
1010
|
+
.doc-title:has(.toc-card) { display: block; max-width: none; }
|
|
1011
|
+
.doc-title:has(.toc-card) > h1 { max-width: calc(100% - 100px); }
|
|
1012
|
+
.toc-card { margin: 10px 0 14px; padding: 10px; border: 1px solid var(--doc-border); border-radius: 6px; }
|
|
1013
|
+
.toc-card::before { content: attr(aria-label); display: block; margin: 0 10px 6px; color: var(--doc-fg-3); font: 12px/1.5 var(--font-sans); }
|
|
1014
|
+
.toc-card .toc-current { display: none; }
|
|
1015
|
+
.toc-card .toc-options { position: static; padding: 0; border: 0; background: transparent; box-shadow: none; }
|
|
1013
1016
|
main :is(h1, h2, h3)[id] { scroll-margin-top: 52px; }
|
|
1014
1017
|
article strong { font-weight: 700; }
|
|
1015
1018
|
article em { font-style: italic; }
|
|
@@ -1127,7 +1130,7 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
|
|
|
1127
1130
|
.resource-tabs a { padding: 9px 15px; color: var(--doc-fg-3); text-decoration: none; white-space: nowrap; font-size: 13px; border-bottom: 2px solid transparent; }
|
|
1128
1131
|
.resource-tabs a:hover { color: var(--doc-fg); background: color-mix(in srgb, var(--doc-fg) 4%, transparent); }
|
|
1129
1132
|
.resource-tabs a[aria-current] { color: var(--doc-accent); border-bottom-color: currentColor; }
|
|
1130
|
-
.resource-toolbar { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 6px;
|
|
1133
|
+
.resource-toolbar { position: relative; display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 6px;
|
|
1131
1134
|
border-bottom: 1px solid var(--c-line); color: var(--c-fg-muted); font-size: 11px; }
|
|
1132
1135
|
.resource-toolbar > span { flex: none; }
|
|
1133
1136
|
.resource-search {display:flex;align-items:center;gap:5px;flex:0 1 140px;min-width:0;height:24px;border-bottom:1px solid transparent;color:var(--c-fg-faint);}
|
|
@@ -1141,6 +1144,141 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
|
|
|
1141
1144
|
.resource-toolbar select option { background: var(--c-bg1); color: var(--c-fg); }
|
|
1142
1145
|
.resource-count { margin-left: auto; color: var(--doc-fg-3); font-variant-numeric: tabular-nums; }
|
|
1143
1146
|
.resource-items { display: flex; flex-direction: column; }
|
|
1147
|
+
.resource-items[hidden], [data-subformat-board][hidden] { display: none; }
|
|
1148
|
+
.resource-results:has([data-subformat-board]:not([hidden])) { min-width: 0; font-family: var(--font-sans); }
|
|
1149
|
+
.resource-results:has([data-subformat-board]:not([hidden])) .resource-toolbar { position: relative; height: auto; flex-wrap: wrap; gap: 8px 12px; padding: 8px 0 12px; }
|
|
1150
|
+
.resource-results:has([data-subformat-board]:not([hidden])) .resource-toolbar > [data-i18n="Name"] { display: none; }
|
|
1151
|
+
.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); }
|
|
1152
|
+
.resource-results:has([data-subformat-board]:not([hidden])) .resource-search:focus-within { border-color: var(--c-accent); }
|
|
1153
|
+
.resource-results:has([data-subformat-board]:not([hidden])) .resource-count { display: none; }
|
|
1154
|
+
.resources-pane:has([data-subformat-board]:not([hidden])) :is(.preview-content, .resource-library, .resource-results, [data-subformat-board]) { display: flex; flex-direction: column; flex: 1; }
|
|
1155
|
+
.resources-pane:has([data-subformat-board]:not([hidden])) .preview-content { min-height: 100%; }
|
|
1156
|
+
.resource-results:has(> .resource-empty:not([hidden])) [data-subformat-board] { flex: none; }
|
|
1157
|
+
.resource-results:has(> .resource-empty:not([hidden])) .subformat-columns { display: none; }
|
|
1158
|
+
.resource-query { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; max-width: 400px; }
|
|
1159
|
+
.resource-query > select { flex: 0 1 auto; min-width: 64px; max-width: 140px; height: 30px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); color: var(--c-fg); cursor: pointer; }
|
|
1160
|
+
.resource-query > select:focus-visible { outline-color: var(--c-fg-muted); }
|
|
1161
|
+
.subformat-picker { flex: 0 1 auto; min-width: 0; max-width: 220px; }
|
|
1162
|
+
[data-subformat-trigger] { display: block; max-width: 100%; height: 32px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--c-line); background: transparent; color: var(--c-fg); font: 500 18px/30px var(--font-sans); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
1163
|
+
[data-subformat-trigger]:is(:hover, :focus-visible) { border-bottom-color: var(--c-fg-muted); outline: none; }
|
|
1164
|
+
[data-subformat-trigger]:disabled { cursor: default; }
|
|
1165
|
+
.subformat-picker-menu { position: fixed; margin: 0; box-sizing: border-box; width: min(260px, calc(100vw - 16px)); padding: 4px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); color: var(--c-fg); overflow-y: auto; font: 15px/1.6 var(--font-sans); }
|
|
1166
|
+
.subformat-picker-menu button { display: block; width: 100%; padding: 7px 10px; border: 0; background: transparent; color: var(--c-fg); font: inherit; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
|
|
1167
|
+
.subformat-picker-menu button:is(:hover, :focus-visible, [aria-checked="true"]) { background: var(--c-raised); outline: none; }
|
|
1168
|
+
.subformat-picker-menu [data-subformat-add] { margin-top: 4px; border-top: 1px solid var(--c-line); font-size: 13px; }
|
|
1169
|
+
|
|
1170
|
+
.resource-results [data-subformat-change="added"] { color: var(--c-ok); }
|
|
1171
|
+
.resource-results [data-subformat-change="modified"] { color: var(--c-accent); }
|
|
1172
|
+
.subformat-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; min-width: 0; max-width: 100%; margin-left: auto; }
|
|
1173
|
+
.subformat-control { position: relative; min-width: 80px; max-width: 160px; margin-top: 6px; }
|
|
1174
|
+
.subformat-control-label { position: absolute; z-index: 1; top: -7px; left: 7px; padding: 0 4px; background: var(--c-bg1); color: var(--c-fg-muted); font: 11px/14px var(--font-sans); white-space: nowrap; pointer-events: none; }
|
|
1175
|
+
.subformat-control > button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 34px; padding-top: 6px; text-align: left; }
|
|
1176
|
+
.subformat-control > button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1177
|
+
.subformat-control > button > svg { flex: none; }
|
|
1178
|
+
.subformat-setting-menu { font-size: 13px; }
|
|
1179
|
+
.subformat-setting-option { display: flex; align-items: stretch; }
|
|
1180
|
+
.subformat-setting-option > button:first-child { flex: 1; min-width: 0; max-width: none; border: 0; border-radius: 0; text-align: left; background: transparent; }
|
|
1181
|
+
.subformat-setting-option > button[aria-checked="true"] { background: var(--c-raised); }
|
|
1182
|
+
.subformat-setting-option > .subformat-default { display: grid; flex: none; place-items: center; width: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--c-fg-muted); }
|
|
1183
|
+
.subformat-default[data-is-default="false"] svg { opacity: .25; }
|
|
1184
|
+
.subformat-default[data-is-default="true"], .subformat-default:is(:hover, :focus-visible) { color: var(--c-fg); }
|
|
1185
|
+
.subformat-setting-option > .subformat-default[data-layout-changed="true"] { color: var(--c-ok); }
|
|
1186
|
+
.subformat-default:is(:hover, :focus-visible) svg { opacity: 1; }
|
|
1187
|
+
.subformat-default:disabled { cursor: default; }
|
|
1188
|
+
.subformat-controls label { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; white-space: nowrap; }
|
|
1189
|
+
.subformat-card label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--c-fg-muted); }
|
|
1190
|
+
.subformat-controls select, .subformat-controls button, .subformat-create-form select, .subformat-create-form button, .subformat-card select { box-sizing: border-box; min-width: 0; max-width: 100%; min-height: 30px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); color: var(--c-fg); font: inherit; }
|
|
1191
|
+
.subformat-controls select { max-width: 140px; }
|
|
1192
|
+
.subformat-controls [data-subformat-direction] { display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; }
|
|
1193
|
+
.subformat-controls :is(select, button) { cursor: pointer; }
|
|
1194
|
+
.subformat-controls :is(select, button):hover, .subformat-card select:enabled:hover { background: var(--c-raised); }
|
|
1195
|
+
.subformat-controls :is(select, button):focus-visible, .subformat-card select:focus-visible { outline-color: var(--c-fg-muted); }
|
|
1196
|
+
.subformat-card select:disabled { opacity: .55; cursor: default; }
|
|
1197
|
+
.subformat-toast { position: fixed; z-index: 1000; right: 20px; bottom: 20px; box-sizing: border-box;
|
|
1198
|
+
max-width: min(420px, calc(100vw - 40px)); max-height: 40vh; overflow: auto; padding: 12px 16px;
|
|
1199
|
+
border: 1px solid var(--c-danger); border-radius: 6px; background: var(--c-bg1); color: var(--c-danger);
|
|
1200
|
+
font: 13px/1.5 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1201
|
+
.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; }
|
|
1202
|
+
.subformat-column { display: flex; flex-direction: column; flex: 1 0 248px; min-width: 0; }
|
|
1203
|
+
.subformat-cards { flex: 1; min-height: 100px; border-radius: 6px; }
|
|
1204
|
+
.subformat-cards.is-drop-target { background: var(--c-raised); }
|
|
1205
|
+
.subformat-column > h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0 2px 10px; border-bottom: 1px solid var(--c-line); color: var(--c-fg); font: 500 12px/20px var(--font-sans); overflow-wrap: anywhere; }
|
|
1206
|
+
.subformat-count > span { flex: none; min-width: 10px; padding: 0 5px; border-radius: 4px; background: var(--c-raised); color: var(--c-fg-muted); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
|
|
1207
|
+
.subformat-card { max-width: none; margin: 0 0 12px; padding: 14px; border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-bg0); color: var(--c-fg); font-family: var(--font-sans); overflow-wrap: anywhere; }
|
|
1208
|
+
.subformat-card:hover, .subformat-card:focus-within { border-color: var(--c-fg-faint); }
|
|
1209
|
+
.subformat-count { display: inline-flex; align-items: center; gap: 4px; }
|
|
1210
|
+
.resource-results [data-record-change="added"] { --record-color: var(--c-ok); }
|
|
1211
|
+
.resource-results [data-record-change="modified"] { --record-color: var(--c-accent); }
|
|
1212
|
+
.resource-results span[data-record-change] { color: var(--record-color); }
|
|
1213
|
+
.subformat-card[data-record-change] { border-color: var(--record-color); }
|
|
1214
|
+
.subformat-controls [data-subformat-create] { height: 30px; padding-inline: 12px; }
|
|
1215
|
+
.subformat-create-form { position: absolute; z-index: 5; top: calc(100% + 8px); right: 0; box-sizing: border-box; width: min(420px, 100%); max-height: 70vh; overflow: auto; padding: 16px; border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-bg1); }
|
|
1216
|
+
.subformat-create-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
1217
|
+
.subformat-create-form label { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 12px; }
|
|
1218
|
+
.subformat-create-form :is(input, textarea) { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg0); color: var(--c-fg); font: 12px/1.6 var(--doc-mono); }
|
|
1219
|
+
.subformat-create-form :is(input, textarea, select, button):focus-visible { outline-color: var(--c-fg-muted); }
|
|
1220
|
+
.subformat-create-form textarea { resize: vertical; }
|
|
1221
|
+
.subformat-create-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
1222
|
+
.subformat-card[draggable="true"] { cursor: grab; user-select: none; }
|
|
1223
|
+
.subformat-card[draggable="true"] :is(.subformat-card-open, .subformat-card-toggle) { cursor: inherit; }
|
|
1224
|
+
.subformat-card.is-dragging { opacity: .4; border-style: dashed; }
|
|
1225
|
+
.subformat-card-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; box-sizing: border-box; width: fit-content; max-width: 100%; height: 20px; margin: -25px -4px 8px auto; padding: 0 6px; background: var(--c-bg0); }
|
|
1226
|
+
.subformat-card h3 { min-width: 0; margin: 0; font-size: 13px; line-height: 1.55; }
|
|
1227
|
+
.subformat-card-open, .subformat-card-toggle, .subformat-card-copy { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
|
|
1228
|
+
.subformat-card :focus-visible { outline-color: var(--c-fg-muted); }
|
|
1229
|
+
.subformat-card .subformat-card-open:focus { outline: none; }
|
|
1230
|
+
.subformat-card-open:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
|
|
1231
|
+
.subformat-card-open, .subformat-drag-preview strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
|
|
1232
|
+
.subformat-card-toggle, .subformat-card-copy { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin: 0; border-radius: 4px; color: var(--c-fg-muted); }
|
|
1233
|
+
.subformat-card-toggle:hover, .subformat-card-copy:hover { background: var(--c-raised); color: var(--c-fg); }
|
|
1234
|
+
.subformat-card-copy .ic-ok, .subformat-card-copy[data-copied] svg:not(.ic-ok) { display: none; }
|
|
1235
|
+
.subformat-card-copy[data-copied] .ic-ok { display: block; }
|
|
1236
|
+
.subformat-card-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
1237
|
+
.subformat-card .subformat-card-file { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-fg-faint); font-family: var(--doc-mono); font-size: 11px; }
|
|
1238
|
+
.subformat-card-tools .subformat-card-file { flex: 1; max-width: 170px; }
|
|
1239
|
+
.subformat-drag-preview .subformat-card-file { margin-top: 6px; }
|
|
1240
|
+
.subformat-card-references { padding: 2px 0; border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--record-color, var(--c-fg-faint)); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
1241
|
+
.subformat-card-references:disabled { cursor: default; }
|
|
1242
|
+
.subformat-reference-list { position: fixed; margin: 0; box-sizing: border-box; width: min(320px, calc(100vw - 16px)); padding: 4px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); color: var(--c-fg); overflow-y: auto; font: 12px/1.6 var(--font-sans); }
|
|
1243
|
+
.subformat-reference-list ul { margin: 0; padding: 0; list-style: none; }
|
|
1244
|
+
.subformat-reference-list a { display: flex; align-items: baseline; gap: 12px; padding: 7px 8px; color: inherit; text-decoration: none; }
|
|
1245
|
+
.subformat-reference-list a > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1246
|
+
.subformat-reference-list a > span:last-child { flex: none; color: var(--c-fg-muted); font-variant-numeric: tabular-nums; }
|
|
1247
|
+
.subformat-reference-list a:is(:hover, :focus-visible) { background: var(--c-raised); outline-color: var(--c-fg-muted); }
|
|
1248
|
+
.subformat-card dl { margin: 12px 0 0; font-size: 12px; }
|
|
1249
|
+
.subformat-card dt, .subformat-detail dt { color: var(--c-fg-muted); font-size: 11px; }
|
|
1250
|
+
.subformat-card dd, .subformat-detail dd { margin: 4px 0 0; }
|
|
1251
|
+
.subformat-card-meta { display: flex; flex-wrap: wrap; gap: 12px 16px; padding-top: 12px; border-top: 1px solid var(--c-line-soft); }
|
|
1252
|
+
.subformat-card-meta:empty { display: none; }
|
|
1253
|
+
.subformat-card-meta > div { flex: 1 1 auto; min-width: 0; max-width: 100%; }
|
|
1254
|
+
.subformat-card-meta dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
1255
|
+
.subformat-card-details { margin-top: 12px; border-top: 1px solid var(--c-line-soft); }
|
|
1256
|
+
.subformat-card-details dl { display: grid; gap: 12px; }
|
|
1257
|
+
.subformat-card-details dd, .subformat-detail dd { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1258
|
+
.subformat-card-details label { margin-top: 12px; }
|
|
1259
|
+
.subformat-card [hidden] { display: none; }
|
|
1260
|
+
.subformat-drag-preview { position: fixed; left: -10000px; top: 0; box-sizing: border-box; pointer-events: none; border-color: var(--c-fg-faint); box-shadow: 0 8px 24px var(--c-shadow); }
|
|
1261
|
+
.subformat-drag-preview strong { font-size: 13px; }
|
|
1262
|
+
.app-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px;
|
|
1263
|
+
color: var(--c-fg); background: color-mix(in srgb, var(--c-bg1) 90%, transparent);
|
|
1264
|
+
border: 1px solid var(--c-fg-faint); border-radius: 10px; box-shadow: 0 16px 48px #0004; backdrop-filter: blur(16px); }
|
|
1265
|
+
.app-dialog::backdrop { background: #0005; backdrop-filter: blur(2px); }
|
|
1266
|
+
.app-dialog h2 { margin: 0 0 14px; font-size: 16px; overflow-wrap: anywhere; }
|
|
1267
|
+
.app-dialog p { margin: 0 0 22px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--c-fg-muted); }
|
|
1268
|
+
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
1269
|
+
.app-dialog button { padding: 7px 14px; color: inherit; background: var(--c-bg0); border: 1px solid var(--c-line); border-radius: 5px; cursor: pointer; }
|
|
1270
|
+
.app-dialog button:hover { background: var(--c-raised); border-color: var(--c-fg-muted); }
|
|
1271
|
+
.app-dialog button:focus-visible { outline-color: var(--c-fg-muted); }
|
|
1272
|
+
.app-dialog button.danger { color: var(--c-danger); }
|
|
1273
|
+
.subformat-page-name { display: block; box-sizing: border-box; width: 100%; margin: 8px 0 20px; padding: 8px; color: var(--c-fg); background: var(--c-bg0); border: 1px solid var(--c-line); border-radius: 4px; font: inherit; }
|
|
1274
|
+
.subformat-page .resource-query { flex-wrap: wrap; max-width: none; }
|
|
1275
|
+
.subformat-page-title { flex: 1 1 100%; margin: 0 0 12px; color: var(--c-fg); font: 500 24px/1.3 var(--font-sans); overflow-wrap: anywhere; }
|
|
1276
|
+
.subformat-page .resource-toolbar { align-items: flex-end; }
|
|
1277
|
+
.subformat-page .subformat-columns { padding-top: 20px; }
|
|
1278
|
+
body:not(.edit) .subformat-page { padding-top: 64px; }
|
|
1279
|
+
.subformat-detail-path { color: var(--c-fg-muted); font: 11px var(--doc-mono); overflow-wrap: anywhere; }
|
|
1280
|
+
.subformat-detail dl { display: grid; gap: 14px; margin: 20px 0; }
|
|
1281
|
+
.subformat-detail dt { font-size: 12px; }
|
|
1144
1282
|
.resource-item { min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
1145
1283
|
.resource-item[hidden], .resource-empty[hidden] { display: none; }
|
|
1146
1284
|
.resource-item > summary { display: flex; align-items: center; gap: 8px; min-width: 0; height: 28px; padding: 0 6px;
|
|
@@ -1161,8 +1299,6 @@ body.extensions-over #nav-extensions, body.extensions-over .extensions-dropzone
|
|
|
1161
1299
|
.resource-source span { flex: none; opacity: .7; }
|
|
1162
1300
|
.resource-source .resource-source-file { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: 1; }
|
|
1163
1301
|
.resource-badge { flex: none; color: var(--doc-fg-2); font: 11px var(--doc-mono); }
|
|
1164
|
-
.resource-item .term-definition { margin: 0; white-space: pre-wrap; font-size: 13px; }
|
|
1165
|
-
.resource-description { color: var(--doc-fg-3); white-space: pre-wrap; font-size: 12px; margin: 6px 0 0; }
|
|
1166
1302
|
.resource-item .codeblk { margin: 0; }
|
|
1167
1303
|
.resource-item .codeblk > pre { max-height: 260px; overflow: auto; }
|
|
1168
1304
|
.resource-usage { flex: none; margin-left: auto; color: var(--doc-fg-3); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
@@ -1210,6 +1346,119 @@ body.textfile-open #phead :is(.fm-language, #status, #validate, #save, #split-pr
|
|
|
1210
1346
|
#file-editor .cm-textfile-status { padding: 8px 12px; white-space: pre-wrap; }
|
|
1211
1347
|
#file-editor .cm-textfile-status[hidden] { display: none; }
|
|
1212
1348
|
#file-editor .cm-textfile-status.error { color: var(--doc-danger); }
|
|
1349
|
+
#file-editor[data-subformat-register] { position: static; width: auto; max-height: none; padding: 0; border: 0; border-radius: 0; overflow: hidden; }
|
|
1350
|
+
#file-editor[data-subformat-register] fieldset { display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
1351
|
+
.subformat-register-fields { display: grid; flex: 1; min-width: 0; grid-template-columns: minmax(36px, .5fr) 60px minmax(50px, 1.5fr); gap: 6px; margin: 0; padding: 0; border: 0; }
|
|
1352
|
+
.subformat-register-fields :is(input, select) { width: 100%; min-width: 0; height: 28px; padding: 4px; background: transparent; color: var(--c-fg); border: 0; border-bottom: 1px solid var(--c-line); border-radius: 0; font: 12px/18px var(--font-sans); }
|
|
1353
|
+
.subformat-register-fields input:hover, .subformat-register-fields input:focus-visible { background: transparent; outline: none; border-bottom-color: var(--c-fg-muted); }
|
|
1354
|
+
.subformat-register-fields .language-select { min-width: 0; }
|
|
1355
|
+
.subformat-register-fields .subformat-control { align-self: center; min-width: 0; max-width: none; margin: 3px 0 0; }
|
|
1356
|
+
.subformat-register-fields .subformat-control-label { top: -5px; left: 5px; padding: 0 3px; font-size: 9px; line-height: 10px; }
|
|
1357
|
+
.subformat-register-fields .language-select-input { height: 24px; padding: 4px 18px 1px 6px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); font-size: 11px; line-height: 16px; }
|
|
1358
|
+
.subformat-register-fields .language-select::after { right: 6px; top: 9px; width: 4px; height: 4px; }
|
|
1359
|
+
.subformat-register-fields :disabled { opacity: .5; }
|
|
1360
|
+
.subformat-register-fields input::placeholder { color: var(--c-fg-muted); opacity: 1; }
|
|
1361
|
+
.subformat-register-fields input[name="schema"]:not([placeholder="path"])::placeholder { opacity: .55; }
|
|
1362
|
+
#phead:has(.subformat-register-fields) { padding-inline: 6px; }
|
|
1363
|
+
.file-editor-heading:has(.subformat-register-fields) { gap: 4px; margin-left: 2px; }
|
|
1364
|
+
[data-subformat-schema-editor] { flex: 1; min-height: 0; }
|
|
1365
|
+
#file-editor[data-subformat-register] .subformat-create-actions { flex: none; padding: 10px 14px; border-top: 1px solid var(--c-line); }
|
|
1366
|
+
#file-editor[data-subformat-register] [hidden] { display: none; }
|
|
1367
|
+
.schema-editor-host { display: flex; flex-direction: column; min-height: 0; }
|
|
1368
|
+
.schema-editor-host > .cm-editor { flex: 1; min-height: 0; }
|
|
1369
|
+
.schema-editor-host > [hidden] { display: none !important; }
|
|
1370
|
+
.schema-mode-switch:focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: 1px; }
|
|
1371
|
+
.schema-builder { flex: 1; min-height: 0; overflow: auto; container-type: inline-size; padding: 8px 12px 24px; color: var(--c-fg); font: 12px/1.6 var(--font-sans); }
|
|
1372
|
+
.schema-builder label { display: flex; align-items: stretch; flex-direction: column; gap: 4px; min-width: 0; margin: 0; color: var(--c-fg-muted); font-size: 11px; }
|
|
1373
|
+
.schema-builder :is(input, select, textarea, button) { box-sizing: border-box; min-width: 0; min-height: 0; max-width: 100%; padding: 6px 7px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg0); color: var(--c-fg); font: 12px/1.5 var(--font-sans); }
|
|
1374
|
+
.schema-builder :is(input:not([type="checkbox"]), select, textarea) { padding: 4px 6px; border: 0; border-radius: 3px; background: var(--c-bg1); }
|
|
1375
|
+
.schema-builder :is(input:not([type="checkbox"]), select, textarea):hover { background: var(--c-raised); }
|
|
1376
|
+
.schema-builder :is(input:not([type="checkbox"]), select, textarea):focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: 1px; }
|
|
1377
|
+
.schema-builder .schema-type-control { display: block; min-width: 0; max-width: none; margin: 0; }
|
|
1378
|
+
.schema-builder .schema-type-control .language-select-input { height: 28px; padding: 5px 22px 2px 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-bg1); }
|
|
1379
|
+
.schema-type-control .language-select::after { right: 8px; top: 10px; width: 5px; height: 5px; }
|
|
1380
|
+
.schema-builder .schema-type-control > .subformat-control-label { padding: 0 4px; }
|
|
1381
|
+
.schema-builder :is(input, textarea) { width: 100%; }
|
|
1382
|
+
.schema-builder textarea { resize: vertical; }
|
|
1383
|
+
.schema-builder input[type="checkbox"] { flex: none; width: 14px; height: 14px; margin: 0; padding: 0; border-color: var(--c-fg-muted); border-radius: 3px; background: transparent; }
|
|
1384
|
+
.schema-builder input[type="checkbox"]:checked { border-color: var(--c-fg-muted); }
|
|
1385
|
+
.schema-builder input[type="checkbox"]:checked::after { left: 4px; top: 1px; width: 3px; height: 7px; border-color: var(--c-fg); border-width: 0 1.5px 1.5px 0; }
|
|
1386
|
+
.schema-builder input[type="checkbox"]:focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: 3px; }
|
|
1387
|
+
.schema-builder button { cursor: pointer; }
|
|
1388
|
+
.schema-builder button:hover { background: var(--c-raised); }
|
|
1389
|
+
.schema-builder button:disabled { opacity: .45; cursor: default; }
|
|
1390
|
+
.schema-field { position: relative; min-width: 0; }
|
|
1391
|
+
.schema-builder > :is(.schema-field, .schema-add-field, .schema-draft-details) { max-width: 560px; }
|
|
1392
|
+
.schema-builder > .schema-field { margin-bottom: 8px; }
|
|
1393
|
+
.schema-field-row, .schema-add-field { position: relative; display: grid; grid-template-columns: minmax(0, 260px) 112px minmax(128px, 1fr); align-items: center; gap: 8px; padding: 6px 0 2px; }
|
|
1394
|
+
.schema-field-name { display: flex; align-items: center; gap: 2px; min-width: 0; }
|
|
1395
|
+
.schema-field-name > :first-child { flex: 1; min-width: 0; }
|
|
1396
|
+
.schema-field-name > label:first-child > span, .schema-add-field > label:first-child > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1397
|
+
.schema-builder .schema-required { flex: none; display: flex; flex-direction: row-reverse; align-items: center; gap: 4px; padding-inline: 4px; white-space: nowrap; cursor: pointer; }
|
|
1398
|
+
.schema-field-row .language-select, .schema-add-field .language-select { flex: 1; min-width: 0; }
|
|
1399
|
+
.schema-children { container-type: inline-size; margin: 2px 0 0 8px; padding-left: 13px; }
|
|
1400
|
+
.schema-children > .schema-field::before { content: ""; position: absolute; left: -13px; top: 0; height: 20px; border-left: 1px solid var(--c-line-soft); }
|
|
1401
|
+
.schema-children > .schema-field:has(~ .schema-field, ~ .schema-add-field)::before { height: auto; bottom: 0; }
|
|
1402
|
+
.schema-children > .schema-field > .schema-field-row::before { content: ""; position: absolute; left: -13px; top: 20px; width: 9px; border-top: 1px solid var(--c-line-soft); }
|
|
1403
|
+
.schema-children > .schema-add-field::before { content: ""; position: absolute; left: -13px; top: 0; width: 8px; height: 22px; border-left: 1px solid var(--c-line-soft); border-bottom: 1px solid var(--c-line-soft); }
|
|
1404
|
+
.schema-builder .schema-extra-fields { flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; min-height: 28px; width: fit-content; cursor: pointer; }
|
|
1405
|
+
.schema-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
1406
|
+
.schema-field-details { container-type: inline-size; }
|
|
1407
|
+
.schema-field-details[hidden] { display: none; }
|
|
1408
|
+
.schema-field-actions { justify-self: end; display: flex; gap: 2px; }
|
|
1409
|
+
.schema-field-actions button, .schema-field-name button { display: grid; place-items: center; width: 24px; height: 28px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--c-fg-muted); }
|
|
1410
|
+
.schema-field-name > button, .schema-field-name > div { flex: none; }
|
|
1411
|
+
.schema-expand:disabled { visibility: hidden; }
|
|
1412
|
+
.schema-item-name { padding-left: 6px; height: 28px; line-height: 28px; color: var(--c-fg-muted); }
|
|
1413
|
+
.schema-parameter-menu { width: 184px; overflow-y: auto; }
|
|
1414
|
+
.schema-parameter-menu .language-options button { height: auto; min-height: 28px; width: 100%; display: block; padding: 5px 8px; text-align: left; }
|
|
1415
|
+
.schema-parameter-menu .language-options button:focus-visible { background: var(--c-raised); outline: none; }
|
|
1416
|
+
.schema-parameter-group { margin: 4px 0 8px 6px; }
|
|
1417
|
+
.schema-parameter { display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 2px; min-width: 0; grid-column: 1 / -1; }
|
|
1418
|
+
.schema-parameter[data-schema-bound="min"] { grid-column: 1; }
|
|
1419
|
+
.schema-parameter[data-schema-bound="max"] { grid-column: 2; }
|
|
1420
|
+
.schema-parameter label { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: center; gap: 8px; }
|
|
1421
|
+
.schema-parameter label > span { overflow-wrap: anywhere; }
|
|
1422
|
+
.schema-parameter label:has(> textarea) { align-items: start; }
|
|
1423
|
+
.schema-parameter label:has(> input[type="checkbox"]) { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; min-height: 28px; cursor: pointer; }
|
|
1424
|
+
.schema-parameter > button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--c-fg-muted); }
|
|
1425
|
+
.schema-parameter:has(textarea) > button { align-self: start; }
|
|
1426
|
+
.schema-builder [hidden] { display: none; }
|
|
1427
|
+
.schema-constraints { display: grid; gap: 4px; }
|
|
1428
|
+
.schema-parameter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
|
|
1429
|
+
.schema-parameter-row:not(.schema-range) > .schema-parameter { grid-column: 1 / -1; }
|
|
1430
|
+
.schema-range { grid-template-columns: minmax(0, 1fr) minmax(48px, .7fr) minmax(0, 1fr); align-items: center; }
|
|
1431
|
+
.schema-range .schema-parameter { grid-row: 1; }
|
|
1432
|
+
.schema-range [data-schema-bound="max"] { grid-column: 3; }
|
|
1433
|
+
.schema-range .schema-parameter label { grid-template-columns: minmax(0, 1fr) 60px; gap: 4px; }
|
|
1434
|
+
.schema-range .schema-parameter input { font-variant-numeric: tabular-nums; }
|
|
1435
|
+
.schema-range-track { position: relative; grid-column: 1 / -1; height: 24px; }
|
|
1436
|
+
.schema-range > .schema-range-track { grid-column: 2; grid-row: 1; }
|
|
1437
|
+
.schema-range-track::before, .schema-range-track > span { content: ""; position: absolute; top: 11px; left: 5px; right: 5px; height: 2px; background: var(--c-line); }
|
|
1438
|
+
.schema-range-track > span { left: calc(5px + (100% - 10px) * var(--range-min)); right: calc(5px + (100% - 10px) * (1 - var(--range-max))); background: var(--c-fg-muted); }
|
|
1439
|
+
.schema-builder .schema-range-track input { appearance: none; position: absolute; inset: 0; width: 100%; height: 24px; margin: 0; padding: 0; border: 0; background: transparent; pointer-events: none; }
|
|
1440
|
+
.schema-range-track input::-webkit-slider-runnable-track { height: 2px; background: transparent; }
|
|
1441
|
+
.schema-range-track input::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--c-fg-muted); pointer-events: auto; cursor: ew-resize; }
|
|
1442
|
+
.schema-range-track input::-moz-range-track { height: 2px; background: transparent; }
|
|
1443
|
+
.schema-range-track input::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--c-fg-muted); pointer-events: auto; cursor: ew-resize; }
|
|
1444
|
+
.schema-range-track input:focus-visible { z-index: 1; }
|
|
1445
|
+
.schema-range-track input:disabled { opacity: .45; }
|
|
1446
|
+
.schema-range-track input:disabled::-webkit-slider-thumb { pointer-events: none; }
|
|
1447
|
+
.schema-range-track input:disabled::-moz-range-thumb { pointer-events: none; }
|
|
1448
|
+
.schema-add-field { padding: 8px 0 4px; }
|
|
1449
|
+
.schema-add-actions { justify-self: end; display: flex; align-items: center; }
|
|
1450
|
+
.schema-add-actions > button { min-height: 28px; padding: 4px; white-space: nowrap; }
|
|
1451
|
+
.schema-add-actions > button + button { margin-left: 4px; border: 0; background: transparent; color: var(--c-fg-muted); }
|
|
1452
|
+
.schema-builder input[aria-invalid="true"], .schema-builder input[aria-invalid="true"]:focus-visible, .subformat-register-fields input:user-invalid { outline: 1px solid var(--c-danger); outline-offset: 1px; }
|
|
1453
|
+
.schema-json-note { margin: 8px 0 0; color: var(--c-fg-muted); font-size: 11px; }
|
|
1454
|
+
.schema-builder .schema-extra-fields { margin: 6px 0; }
|
|
1455
|
+
.subformat-value-form > label, .subformat-value-form fieldset > label { margin-block: 12px; }
|
|
1456
|
+
.subformat-value-form fieldset { min-width: 0; margin: 12px 0; padding: 0 12px; border: 1px solid var(--c-line); }
|
|
1457
|
+
.subformat-value-form legend { padding-inline: 4px; }
|
|
1458
|
+
.subformat-value-form small { overflow-wrap: anywhere; }
|
|
1459
|
+
@container(max-width:440px) { .schema-field-row, .schema-add-field { grid-template-columns: minmax(0, 1fr) 128px; } .schema-field-row > :first-child, .schema-add-field > :first-child { grid-column: 1 / -1; } }
|
|
1460
|
+
@container(max-width:440px) { .schema-add-field { grid-template-columns: minmax(0, 1fr) auto; } }
|
|
1461
|
+
@container(max-width:440px) { .schema-range { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; } .schema-range [data-schema-bound="max"] { grid-column: 2; } .schema-range > .schema-range-track { grid-column: 1 / -1; grid-row: 2; } .schema-range .schema-parameter label { grid-template-columns: minmax(0, 1fr); gap: 0; } }
|
|
1213
1462
|
|
|
1214
1463
|
/* header band (same height and rule as sidebar-head) */
|
|
1215
1464
|
#phead { flex: none; display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 10px 0 14px;
|
|
@@ -1253,17 +1502,6 @@ body.edit #nav-groups { --nav-rail: 22px; --nav-icon-half: 9px; }
|
|
|
1253
1502
|
.cm-file-preview[data-state="loading"] svg { animation: preview-spin 1s linear infinite; }
|
|
1254
1503
|
@keyframes preview-spin { to { transform: rotate(360deg); } }
|
|
1255
1504
|
@media (prefers-reduced-motion: reduce) { .cm-file-preview[data-state="loading"] svg { animation: none; } }
|
|
1256
|
-
.app-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px;
|
|
1257
|
-
color: var(--c-fg); background: color-mix(in srgb, var(--c-bg1) 90%, transparent);
|
|
1258
|
-
border: 1px solid var(--c-fg-faint); border-radius: 10px; box-shadow: 0 16px 48px #0004; backdrop-filter: blur(16px); }
|
|
1259
|
-
.app-dialog::backdrop { background: #0005; backdrop-filter: blur(2px); }
|
|
1260
|
-
.app-dialog h2 { margin: 0 0 14px; font-size: 16px; overflow-wrap: anywhere; }
|
|
1261
|
-
.app-dialog p { margin: 0 0 22px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--c-fg-muted); }
|
|
1262
|
-
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
1263
|
-
.app-dialog button { padding: 7px 14px; color: inherit; background: var(--c-bg0); border: 1px solid var(--c-line); border-radius: 5px; cursor: pointer; }
|
|
1264
|
-
.app-dialog button:hover { background: var(--c-raised); border-color: var(--c-fg-muted); }
|
|
1265
|
-
.app-dialog button:focus-visible { outline-color: var(--c-fg-muted); }
|
|
1266
|
-
.app-dialog button.danger { color: var(--c-danger); }
|
|
1267
1505
|
.app-dialog:has(.conflict-columns) { width: min(1000px, calc(100vw - 32px)); }
|
|
1268
1506
|
.conflict-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
|
|
1269
1507
|
.conflict-columns h3 { font-size: 13px; margin: 0; }
|
|
@@ -1274,11 +1512,22 @@ body.edit #nav-groups { --nav-rail: 22px; --nav-icon-half: 9px; }
|
|
|
1274
1512
|
min-width: 220px; padding: 4px; flex-direction: column; gap: 1px; color: var(--c-fg);
|
|
1275
1513
|
background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 6px;
|
|
1276
1514
|
box-shadow: 0 10px 28px var(--c-shadow); font-size: 12.5px; }
|
|
1277
|
-
#gear:hover #gearmenu, #gear:focus-within #gearmenu, #gear.open #gearmenu { display: flex; }
|
|
1515
|
+
#gear:hover #gearmenu, #gear:focus-within #gearmenu, #gear.open #gearmenu, #gear:has([aria-expanded="true"]) #gearmenu { display: flex; }
|
|
1278
1516
|
#gearmenu label { display: flex; gap: 10px; align-items: center; cursor: pointer;
|
|
1279
1517
|
padding: 7px 10px; border-radius: 4px; }
|
|
1280
1518
|
#gearmenu label:hover { background: var(--c-raised); }
|
|
1281
1519
|
#gearmenu input { accent-color: var(--c-accent); margin: 0; }
|
|
1520
|
+
.editor-setting { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 8px 4px; }
|
|
1521
|
+
.editor-setting > .nav-icon, .editor-setting-icon { color: var(--c-fg-muted); }
|
|
1522
|
+
.editor-setting-icon { display: grid; place-items: center; }
|
|
1523
|
+
.editor-setting .subformat-control { min-width: 0; max-width: none; margin: 0; }
|
|
1524
|
+
.editor-setting .subformat-control-label { background: var(--c-surface); }
|
|
1525
|
+
.editor-setting .setting-picker, .editor-setting .language-select-input { box-sizing: border-box; width: 100%; min-width: 0; height: 30px; min-height: 30px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-surface); color: var(--c-fg); font: 12px/18px var(--font-sans); }
|
|
1526
|
+
.editor-setting .setting-picker { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
|
|
1527
|
+
.editor-setting .setting-picker > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1528
|
+
.editor-setting .setting-picker > svg { flex: none; }
|
|
1529
|
+
.editor-setting .language-select-input { padding-right: 26px; }
|
|
1530
|
+
.editor-setting .setting-picker:hover { background: var(--c-raised); }
|
|
1282
1531
|
|
|
1283
1532
|
.fm-language { display: flex; align-items: center; flex: 0 1 220px; min-width: 0; gap: 4px; }
|
|
1284
1533
|
.fm-language > .language-select { flex: 1; width: 0; min-width: 0; }
|
|
@@ -1314,7 +1563,7 @@ body.edit #nav-groups { --nav-rail: 22px; --nav-icon-half: 9px; }
|
|
|
1314
1563
|
|
|
1315
1564
|
main.editor-workspace { padding: 0; height: 100vh; display: flex; flex-direction: column; position: sticky; top: 0; }
|
|
1316
1565
|
#split-preview[aria-pressed="true"] { color: var(--c-accent); background: var(--c-raised); }
|
|
1317
|
-
.pane-actions { top: -20px; margin: -20px -24px
|
|
1566
|
+
.pane-actions { top: -20px; margin: -20px -24px -36px; }
|
|
1318
1567
|
#preview-panes { display: flex; flex: 1; min-height: 0; }
|
|
1319
1568
|
#preview-panes[hidden] { display: none; }
|
|
1320
1569
|
.preview-pane.resources-pane { min-height: 0; padding-bottom: 24px; }
|
|
@@ -1322,7 +1571,7 @@ main.editor-workspace { padding: 0; height: 100vh; display: flex; flex-direction
|
|
|
1322
1571
|
.resources-pane .resource-tabs { margin-inline: -24px; padding: 0 12px; }
|
|
1323
1572
|
.preview-pane { flex: 1; min-width: 0; overflow: auto; padding: 20px 24px 50vh; border-top: 2px solid transparent; }
|
|
1324
1573
|
#preview-panes.split .preview-pane { padding: 16px; }
|
|
1325
|
-
#preview-panes.split .pane-actions { top: -16px; margin: -16px -16px
|
|
1574
|
+
#preview-panes.split .pane-actions { top: -16px; margin: -16px -16px -36px; padding-inline: 10px; }
|
|
1326
1575
|
#preview-panes.split .preview-pane + .preview-pane { border-left: 1px solid var(--c-line); }
|
|
1327
1576
|
#preview-panes.split .preview-pane.active { border-top-color: var(--c-accent); }
|
|
1328
1577
|
.preview-pane:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
|
|
@@ -1333,8 +1582,8 @@ main.editor-workspace { padding: 0; height: 100vh; display: flex; flex-direction
|
|
|
1333
1582
|
.language-option[aria-checked="true"]::before { content: "✓"; }
|
|
1334
1583
|
.language-option:hover, .language-option:focus-visible { background: var(--c-raised); outline: none; }
|
|
1335
1584
|
.language-option:disabled { opacity: .5; cursor: wait; }
|
|
1336
|
-
#language-setting {
|
|
1337
|
-
#language-setting .language-select { width:
|
|
1585
|
+
#language-setting { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--c-line); }
|
|
1586
|
+
#language-setting .language-select { width: 100%; }
|
|
1338
1587
|
.cm-code-diagnostic { text-decoration:underline wavy var(--c-warn); text-underline-offset:3px; }
|
|
1339
1588
|
#validate[data-state="error"], .cm-textfile-validate[data-state="error"] { color:var(--c-danger); }
|
|
1340
1589
|
#validate[data-state="valid"], .cm-textfile-validate[data-state="valid"] { color:var(--c-ok); }
|
|
@@ -1406,7 +1655,7 @@ body.corr main article > [data-ln].corr-hi {
|
|
|
1406
1655
|
.files-copy svg {width:14px;height:14px;color:var(--c-fg-faint);}
|
|
1407
1656
|
.files-table tr:hover .files-copy,.files-table tr:focus-within .files-copy {opacity:1;}
|
|
1408
1657
|
@media(hover:none){.files-copy{opacity:1;}}
|
|
1409
|
-
.files-table [data-drop=
|
|
1658
|
+
.files-table [data-drop=into], .files-viewport[data-drop=into] {outline:2px solid var(--c-accent);outline-offset:-2px;}
|
|
1410
1659
|
.files-table .files-placeholder {height:96px;text-align:center;vertical-align:middle;}
|
|
1411
1660
|
.app-dialog textarea {display:block;box-sizing:border-box;width:100%;min-height:64px;max-height:65vh;resize:both;font:inherit;}
|
|
1412
1661
|
@media(max-width:600px){.files-table {min-width:0;}.files-table th:nth-child(2){width:65px;}.files-name{max-width:100%;}}
|
|
@@ -1419,8 +1668,6 @@ body.corr main article > [data-ln].corr-hi {
|
|
|
1419
1668
|
.res-crumbs { color: var(--c-fg-faint); font-size: 12.5px; margin: 0 0 20px; }
|
|
1420
1669
|
.res-crumbs a { color: var(--c-fg-muted); text-decoration: none; }
|
|
1421
1670
|
.res-crumbs a:hover { color: var(--c-fg); }
|
|
1422
|
-
.res-section h2 { font-size: 15px; border: 0; margin: 28px 0 10px; }
|
|
1423
|
-
.res-section h2 a { color: inherit; text-decoration: none; }
|
|
1424
1671
|
.res-sub { color: var(--c-fg-faint); font-size: 11.5px; font-weight: 400; }
|
|
1425
1672
|
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
|
|
1426
1673
|
.res-card { display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: 6px;
|
|
@@ -1435,18 +1682,15 @@ body.corr main article > [data-ln].corr-hi {
|
|
|
1435
1682
|
pointer-events: none; }
|
|
1436
1683
|
.res-preview .res-svg { max-height: 480px; }
|
|
1437
1684
|
.res-preview .res-html { width: 100% !important; }
|
|
1438
|
-
.res-thumb .res-frame { width: 100%; height: 100%; border: 0; pointer-events: none; background: #fff; }
|
|
1439
1685
|
.res-meta { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-top: 1px solid var(--c-line); }
|
|
1440
1686
|
.res-name { font-family: var(--doc-mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1441
1687
|
.res-preview { display: flex; align-items: center; justify-content: center; min-height: 160px; padding: 16px;
|
|
1442
1688
|
border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-bg0); }
|
|
1443
1689
|
.res-preview .res-img { max-width: 100%; max-height: 480px; }
|
|
1444
1690
|
.res-preview.square .res-img { width: 160px; height: 160px; outline: 1px dashed var(--c-line); }
|
|
1445
|
-
.res-preview .res-frame { width: 100%; height: 420px; border: 0; background: #fff; }
|
|
1446
1691
|
.res-markdown { width: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1447
1692
|
.res-thumb .res-markdown { max-height: 100%; overflow: hidden; font-size: 11px; }
|
|
1448
1693
|
.res-preview .res-markdown { max-height: 480px; overflow: auto; }
|
|
1449
|
-
.res-empty { color: var(--c-fg-faint); }
|
|
1450
1694
|
.res-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 13px; }
|
|
1451
1695
|
.res-dl dt { color: var(--c-fg-faint); }
|
|
1452
1696
|
.res-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
|
@@ -1473,14 +1717,31 @@ body.corr main article > [data-ln].corr-hi {
|
|
|
1473
1717
|
.nav-tree-spacer { flex: none; height: 28px; }
|
|
1474
1718
|
@media (hover: none) { .nav-row :is(.new, .nav-delete) { opacity: 1; } }
|
|
1475
1719
|
.nav-row > .nav-create { margin: 7px 12px; opacity: 1; }
|
|
1476
|
-
.nav-add-hover { visibility: hidden; }
|
|
1477
|
-
#sidebar:hover .nav-add-hover, #sidebar:focus-within .nav-add-hover { visibility: visible; }
|
|
1478
1720
|
#sidebar .nav-list:has(> .nav-new-item) > .nav-placeholder { display: none; }
|
|
1721
|
+
.nav-page-menu { position: fixed; inset: auto; margin: 0; padding: 4px; width: 200px;
|
|
1722
|
+
max-width: calc(100vw - 16px); box-sizing: border-box; overflow: auto;
|
|
1723
|
+
border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-surface); color: var(--c-fg);
|
|
1724
|
+
box-shadow: 0 8px 24px var(--c-shadow); font: 12px/1.5 var(--font-sans); }
|
|
1725
|
+
.nav-page-menu > button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px;
|
|
1726
|
+
padding: 7px 10px; border: 0; border-radius: 4px; background: transparent; color: inherit;
|
|
1727
|
+
font: inherit; text-align: left; cursor: pointer; }
|
|
1728
|
+
.nav-page-menu > button svg { width: 16px; height: 16px; flex: none; color: var(--c-fg-muted); }
|
|
1729
|
+
.nav-page-menu > button:not(:disabled):hover { background: var(--c-raised); }
|
|
1730
|
+
.nav-page-menu :focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: -2px; }
|
|
1731
|
+
.nav-page-menu button:disabled { color: var(--c-fg-muted); cursor: default; }
|
|
1732
|
+
.nav-page-menu .nav-page-chevron { display: flex; margin-left: auto; transform: rotate(90deg); }
|
|
1733
|
+
.nav-page-menu .nav-page-chevron svg { width: 12px; height: 12px; }
|
|
1734
|
+
.nav-page-menu .subformat-setting-option > button:is(:hover, :focus-visible) { background: var(--c-raised); }
|
|
1735
|
+
.nav-page-menu .err { margin: 0; padding: 4px 10px; color: var(--c-danger); overflow-wrap: anywhere; }
|
|
1736
|
+
.nav-page-menu .err:empty { display: none; }
|
|
1479
1737
|
/* Keep the title and filename together in a compact create form. */
|
|
1480
1738
|
.nav-row > .nav-new { position: relative; display: flex; flex: 1; min-width: 0;
|
|
1481
1739
|
flex-direction: column; justify-content: center; align-items: stretch; cursor: auto;
|
|
1482
|
-
margin: 4px 0;
|
|
1483
|
-
border: 1px
|
|
1740
|
+
margin: 4px 0; gap: 10px; padding: 12px;
|
|
1741
|
+
border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-raised); }
|
|
1742
|
+
.nav-new-heading { margin: 0; color: var(--c-fg-muted); font-size: 11px; }
|
|
1743
|
+
.nav-new :is(input, button):focus-visible { outline: 1px solid var(--c-fg-muted); outline-offset: 2px; }
|
|
1744
|
+
.nav-new [hidden] { display: none; }
|
|
1484
1745
|
.nav-tree .nav-new { margin-left: calc(var(--nav-pad) - 12px); }
|
|
1485
1746
|
.nav-new > .nav-icon { position: absolute; left: 12px; top: 10px; color: var(--c-fg-faint); }
|
|
1486
1747
|
.nav-new input { font: inherit; color: var(--c-fg); background: transparent; border: none;
|
|
@@ -1490,9 +1751,10 @@ body.corr main article > [data-ln].corr-hi {
|
|
|
1490
1751
|
.nav-new-file { display: flex; align-items: center; color: var(--c-fg-faint);
|
|
1491
1752
|
font: 10px/12px var(--doc-mono); }
|
|
1492
1753
|
.nav-new-file input { flex: 1; font-family: inherit; font-size: inherit; color: var(--c-fg-muted); }
|
|
1493
|
-
.nav-new-
|
|
1494
|
-
|
|
1495
|
-
|
|
1754
|
+
.nav-new-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
1755
|
+
.nav-new-cancel { padding: 4px 8px; color: var(--c-fg-muted); background: none; border: 0; border-radius: 4px; font: inherit; cursor: pointer; }
|
|
1756
|
+
.nav-new-go { flex: none; display: flex; align-items: center; justify-content: center;
|
|
1757
|
+
min-height: 30px; padding: 4px 10px; font: inherit; color: var(--c-fg); background: var(--c-bg0);
|
|
1496
1758
|
border: 1px solid var(--c-line); border-radius: 4px; cursor: pointer; }
|
|
1497
1759
|
.nav-new-go:hover { color: var(--c-accent); border-color: var(--c-accent); }
|
|
1498
1760
|
.nav-new .err { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; padding: 4px;
|
|
@@ -1511,7 +1773,7 @@ body.edit .nav-row { cursor: grab; }
|
|
|
1511
1773
|
.nav-row.drop-into > a { background: color-mix(in srgb, var(--c-accent) 18%, transparent); }
|
|
1512
1774
|
`;
|
|
1513
1775
|
// Contents of #nav-groups (the doc tree). Used by both page()'s initial render and
|
|
1514
|
-
// `GET /api/nav` (edit mode; the client
|
|
1776
|
+
// `GET /api/nav` (edit mode; the client reconciles changed nodes after an md change)
|
|
1515
1777
|
// (= the same value isn't declared in two places).
|
|
1516
1778
|
// Each item is a page row and its children list, emitted even when empty
|
|
1517
1779
|
// (it's the insertion target for the sidebar create form / drag).
|
|
@@ -1528,14 +1790,14 @@ export const navGroupsHtml = (mode, site, currentId, currentRes) => {
|
|
|
1528
1790
|
// A doc-specific icon (icons/<id>.svg), if any, replaces the book icon at top
|
|
1529
1791
|
// level and goes before the label below that.
|
|
1530
1792
|
let link = depth === 0
|
|
1531
|
-
? `<a class="nav-link${cur}" href="/${e.id}" title="${label}">${e.icon ? svgImg(e.icon, "nav-icon doc-icon") : DOCS_ICON}<span class="nav-label">${label}</span></a>`
|
|
1532
|
-
: `<a class="nav-tree-link${cur}" href="/${e.id}" title="${label}">${e.icon ? svgImg(e.icon, "doc-icon") : DOCS_ICON}<span class="nav-label">${label}</span></a>`;
|
|
1793
|
+
? `<a class="nav-link${cur}" href="/${e.id}" title="${label}">${e.icon ? svgImg(e.icon, "nav-icon doc-icon") : e.subformat ? SUBFORMATS_ICON : DOCS_ICON}<span class="nav-label">${label}</span></a>`
|
|
1794
|
+
: `<a class="nav-tree-link${cur}" href="/${e.id}" title="${label}">${e.icon ? svgImg(e.icon, "doc-icon") : e.subformat ? SUBFORMATS_ICON : DOCS_ICON}<span class="nav-label">${label}</span></a>`;
|
|
1533
1795
|
let actions = "";
|
|
1534
1796
|
let editableIcon = "";
|
|
1535
1797
|
if (mode === "edit") {
|
|
1536
1798
|
link = `<a class="${depth === 0 ? "nav-link" : "nav-tree-link"}${cur}" href="/${e.id}" title="${label}" aria-keyshortcuts="F2"><span class="nav-doc-name"><span class="nav-label">${label}</span></span></a>`;
|
|
1537
|
-
editableIcon = `<span class="nav-doc-icon" title="icon" data-i18n-title="icon">${e.icon ? svgImg(e.icon, "doc-icon") : DOCS_ICON}<input type="file" accept=".svg,image/svg+xml" aria-label="icon" data-i18n-aria-label="icon">${e.icon ? '<button class="nav-icon-clear" type="button" title="Remove icon" data-i18n-title="Remove icon" aria-label="Remove icon" data-i18n-aria-label="Remove icon">×</button>' : ""}</span>`;
|
|
1538
|
-
actions = `<button class="new" type="button" data-parent="${escapeHtml(e.id)}" title="Add doc" data-i18n-title="Add doc" aria-label="Add doc" data-i18n-aria-label="Add doc">${PLUS_ICON}</button><button class="nav-delete" type="button" data-doc-action="delete" title="Delete doc" data-i18n-title="Delete doc" aria-label="Delete doc" data-i18n-aria-label="Delete doc">${DELETE_ICON}</button>`;
|
|
1799
|
+
editableIcon = `<span class="nav-doc-icon" title="icon" data-i18n-title="icon">${e.icon ? svgImg(e.icon, "doc-icon") : e.subformat ? SUBFORMATS_ICON : DOCS_ICON}<input type="file" accept=".svg,image/svg+xml" aria-label="icon" data-i18n-aria-label="icon">${e.icon ? '<button class="nav-icon-clear" type="button" title="Remove icon" data-i18n-title="Remove icon" aria-label="Remove icon" data-i18n-aria-label="Remove icon">×</button>' : ""}</span>`;
|
|
1800
|
+
actions = `<button class="new" type="button" data-parent="${escapeHtml(e.id)}" popovertarget="nav-page-menu" aria-haspopup="menu" title="Add doc" data-i18n-title="Add doc" aria-label="Add doc" data-i18n-aria-label="Add doc">${PLUS_ICON}</button><button class="nav-delete" type="button" data-doc-action="delete" title="Delete doc" data-i18n-title="Delete doc" aria-label="Delete doc" data-i18n-aria-label="Delete doc">${DELETE_ICON}</button>`;
|
|
1539
1801
|
}
|
|
1540
1802
|
const branch = childrenOf(site.entries, e.id).length > 0;
|
|
1541
1803
|
const toggle = branch
|
|
@@ -1543,17 +1805,20 @@ export const navGroupsHtml = (mode, site, currentId, currentRes) => {
|
|
|
1543
1805
|
: mode === "edit"
|
|
1544
1806
|
? '<span class="nav-tree-spacer" aria-hidden="true"></span>'
|
|
1545
1807
|
: "";
|
|
1546
|
-
return `<div class="nav-item${open.has(e.id) ? " open" : ""}" data-doc-id="${escapeHtml(e.id)}"><div class="nav-row${mode === "edit" ? " nav-doc-row" : ""}"${mode === "edit" ? ' draggable="true"' : ""}>${editableIcon}${link}${actions}${toggle}</div>${list(e.id, depth + 1)}</div>`;
|
|
1808
|
+
return `<div class="nav-item${open.has(e.id) ? " open" : ""}" data-doc-id="${escapeHtml(e.id)}"${e.subformat ? " data-subformat-nav" : ""}><div class="nav-row${mode === "edit" ? " nav-doc-row" : ""}"${mode === "edit" ? ' draggable="true"' : ""}>${editableIcon}${link}${actions}${toggle}</div>${list(e.id, depth + 1)}</div>`;
|
|
1547
1809
|
})
|
|
1548
1810
|
.join("");
|
|
1549
1811
|
const placeholder = mode === "edit" && depth === 0
|
|
1550
|
-
? `<div class="nav-item nav-placeholder
|
|
1812
|
+
? `<div class="nav-item nav-placeholder"><div class="nav-row"><button class="nav-create" type="button" data-parent="" popovertarget="nav-page-menu" aria-haspopup="menu" title="Add doc" data-i18n-title="Add doc" aria-label="Add doc" data-i18n-aria-label="Add doc">${PLUS_ICON}</button></div></div>`
|
|
1551
1813
|
: "";
|
|
1552
1814
|
return depth === 0
|
|
1553
1815
|
? `<div class="nav-list nav-root" data-parent=""${mode === "edit" ? ' id="nav-docs"' : ""}>${items}${placeholder}</div>`
|
|
1554
1816
|
: `<div class="nav-list nav-tree" data-parent="${escapeHtml(parent ?? "")}" style="--nav-depth:${depth + 1}">${items}${placeholder}</div>`;
|
|
1555
1817
|
};
|
|
1556
|
-
const html = list(undefined, 0) +
|
|
1818
|
+
const html = list(undefined, 0) +
|
|
1819
|
+
(mode === "edit"
|
|
1820
|
+
? `<template data-page-subformats>${escapeHtml(JSON.stringify((site.subformats ?? []).filter((format) => !site.entries.some((entry) => entry.subformat?.ext === format.ext))))}</template>${navFilesHtml(site, currentRes)}`
|
|
1821
|
+
: "");
|
|
1557
1822
|
return docLinks(site, site.contentLanguage ? languageLinks(html, site.contentLanguage) : html);
|
|
1558
1823
|
};
|
|
1559
1824
|
// ── Resources (file management in edit mode; linked figures and terms also in preview) ──
|
|
@@ -1561,7 +1826,9 @@ export const navGroupsHtml = (mode, site, currentId, currentRes) => {
|
|
|
1561
1826
|
// Route is `/_files[/<kind>[/<file>]]` (doc ids can't start with `_`, so no collision).
|
|
1562
1827
|
const RESOURCE_KINDS = ["markdown", "figures", "html", "icons", "terms"];
|
|
1563
1828
|
const siteResources = (site) => [
|
|
1564
|
-
...site.entries
|
|
1829
|
+
...site.entries
|
|
1830
|
+
.filter((entry) => !entry.subformat)
|
|
1831
|
+
.map((entry) => ({
|
|
1565
1832
|
kind: "markdown",
|
|
1566
1833
|
file: entry.file,
|
|
1567
1834
|
path: entry.sourceFile ?? CONTENT_PREFIX + entry.file,
|
|
@@ -1591,17 +1858,17 @@ const resourceHref = (kind, file) => `/_files${kind ? `/${kind}` : ""}${file ? `
|
|
|
1591
1858
|
const navFilesHtml = (site, currentRes) => {
|
|
1592
1859
|
const source = site.workspace;
|
|
1593
1860
|
const statics = currentRes?.startsWith("_statics") ||
|
|
1594
|
-
["
|
|
1595
|
-
const folderIcon = icon('<path d="M2 5h6l2 2h8v10H2Z"/>');
|
|
1861
|
+
["codeblocks", "urls", "url-previews", "dictionary", "code"].includes(currentRes ?? "");
|
|
1596
1862
|
const hint = `<div class="files-drop-hint" aria-hidden="true">${UPLOAD_ICON}<span data-i18n="Upload files">Upload files</span></div>`;
|
|
1597
1863
|
const location = source?.protocol === "git"
|
|
1598
|
-
? `<
|
|
1599
|
-
: `<
|
|
1864
|
+
? `<summary class="workspace-location" aria-label="Workspace tools" data-i18n-aria-label="Workspace tools" data-workspace-protocol="git" title="${escapeHtml(`${source.repo ?? "repo"}[${source.branch}]`)}">${GIT_ICON}<span class="workspace-address"><span class="git-repo-name">${escapeHtml(source.repo ?? "repo")}</span><span class="git-branch-caption">[${escapeHtml(source.branch)}]</span></span>${CHEVRON_ICON}</summary>`
|
|
1865
|
+
: `<summary class="workspace-location" aria-label="Workspace tools" data-i18n-aria-label="Workspace tools" id="nav-storage" data-workspace-protocol="storage" title="${escapeHtml(workspaceName(site))}">${workspaceIcon(site)}<span class="workspace-address">${escapeHtml(source?.folder ?? "Files")} / ${escapeHtml(source?.service ?? "Local")}</span>${CHEVRON_ICON}</summary>`;
|
|
1600
1866
|
const git = source?.protocol === "git"
|
|
1601
1867
|
? `<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>`
|
|
1602
1868
|
: "";
|
|
1603
1869
|
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>`;
|
|
1604
|
-
|
|
1870
|
+
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>`;
|
|
1871
|
+
return `<details id="nav-tools" open>${location}<div class="nav-tool-cards"><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 !== "_git" && currentRes !== "_extensions" && currentRes !== "_subformats" && !statics ? " 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-statics"><div class="nav-item" data-node-id="_statics"><div class="nav-row"><a class="nav-link${statics ? " cur" : ""}" href="/_statics" title="Statics" data-i18n-title="Statics">${STATICS_ICON}<span class="nav-label" data-i18n="Statics">Statics</span></a></div></div></div>${subformats}${git}${extensions}</div></details>`;
|
|
1605
1872
|
};
|
|
1606
1873
|
const formatSize = (bytes) => bytes < 1024
|
|
1607
1874
|
? `${bytes} B`
|
|
@@ -1682,6 +1949,12 @@ export const textfilePreviewHtml = (site, file, source) => {
|
|
|
1682
1949
|
};
|
|
1683
1950
|
export const textfilePreviewErrors = (site, file, source) => {
|
|
1684
1951
|
const errors = textfilePreview(site, file, source).errors;
|
|
1952
|
+
try {
|
|
1953
|
+
validateSubformatFile(root, file, source);
|
|
1954
|
+
}
|
|
1955
|
+
catch (error) {
|
|
1956
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
1957
|
+
}
|
|
1685
1958
|
if (/\.(md|markdown)$/i.test(file)) {
|
|
1686
1959
|
const { doc, source: parsed } = compileDraft(draftContext(site), file, source);
|
|
1687
1960
|
errors.push(...parsed.errors);
|
|
@@ -1708,8 +1981,8 @@ export const resourcesMain = (site, rest) => {
|
|
|
1708
1981
|
}
|
|
1709
1982
|
: undefined;
|
|
1710
1983
|
if (rest === "_statics" || rest.startsWith("_statics/")) {
|
|
1711
|
-
const view = rest.slice("_statics".length).replace(/^\//, "") || "
|
|
1712
|
-
return ["
|
|
1984
|
+
const view = rest.slice("_statics".length).replace(/^\//, "") || "codeblocks";
|
|
1985
|
+
return ["codeblocks", "urls", "url-previews", "dictionary", "code"].includes(view)
|
|
1713
1986
|
? resourcesMain(site, view)
|
|
1714
1987
|
: undefined;
|
|
1715
1988
|
}
|
|
@@ -1722,11 +1995,19 @@ export const resourcesMain = (site, rest) => {
|
|
|
1722
1995
|
main: `<article class="res-page files-page resource-library"><div id="files-manager"></div></article>`,
|
|
1723
1996
|
};
|
|
1724
1997
|
}
|
|
1725
|
-
if (!file && (kind === "dictionary" || kind === "code"
|
|
1998
|
+
if (!file && (kind === "dictionary" || kind === "code"))
|
|
1999
|
+
return resourcesMain(site, "codeblocks");
|
|
2000
|
+
if (!file &&
|
|
2001
|
+
(kind === "codeblocks" ||
|
|
2002
|
+
kind === "urls" ||
|
|
2003
|
+
kind === "url-previews" ||
|
|
2004
|
+
kind === "_subformats")) {
|
|
1726
2005
|
const index = resourceIndex(root, site.filePaths ?? filesSnapshot(root).files.map((item) => item.path));
|
|
2006
|
+
if (site.workspace?.protocol === "git" && index.subformats.length)
|
|
2007
|
+
setSubformatChanges(root, index.subformats);
|
|
1727
2008
|
return {
|
|
1728
|
-
title: "Statics",
|
|
1729
|
-
main: `<article class="res-page files-page resource-library">${resourceTabs(kind)}${resourceLibraryHtml(index, kind)}</article>`,
|
|
2009
|
+
title: kind === "_subformats" ? "Subformats" : "Statics",
|
|
2010
|
+
main: `<article class="res-page files-page resource-library">${kind === "_subformats" ? "" : resourceTabs(kind)}${resourceLibraryHtml(index, kind === "_subformats" ? "subformats" : kind)}</article>`,
|
|
1730
2011
|
};
|
|
1731
2012
|
}
|
|
1732
2013
|
if (kind === "file" && file) {
|
|
@@ -1832,13 +2113,21 @@ const pageTitle = (mode, title, siteTitle) => title === siteTitle ? title : `${t
|
|
|
1832
2113
|
const page = (mode, site, opts) => {
|
|
1833
2114
|
const nav = navGroupsHtml(mode, site, opts.currentId, opts.currentRes);
|
|
1834
2115
|
const siteTitle = escapeHtml(site.title ?? "dooc");
|
|
1835
|
-
const
|
|
2116
|
+
const iconImg = `<img id="site-icon" alt=""${site.icon ? ` src="${svgDataUri(site.icon)}"` : " hidden"}>`;
|
|
2117
|
+
const iconVariants = Object.entries(site.iconVariants ?? {});
|
|
2118
|
+
// The base image sits in a wrapper so theme switching and edit-client's #site-icon.hidden never fight.
|
|
2119
|
+
const iconHtml = iconVariants.length
|
|
2120
|
+
? `<span class="site-icon-variants" data-theme-variants><span data-theme-variant="">${iconImg}</span>${iconVariants.map(([theme, svg]) => `<img data-theme-variant="${escapeHtml(theme)}" alt="" src="${svgDataUri(svg)}" hidden>`).join("")}</span>`
|
|
2121
|
+
: iconImg;
|
|
2122
|
+
const siteIcon = `<span id="site-icon-slot"${mode === "edit" ? ' title="Change site icon" data-i18n-title="Change site icon"' : ""}>${iconHtml}${DOCS_ICON}${mode === "edit" ? '<input type="file" accept=".svg,image/svg+xml" aria-label="Change site icon" data-i18n-aria-label="Change site icon">' : ""}</span>`;
|
|
1836
2123
|
const bootScripts = opts.boot != null
|
|
1837
2124
|
? `<script id="boot" type="application/json">${JSON.stringify(opts.boot).replace(/</g, "\\u003c")}</script>
|
|
1838
2125
|
<script src="/assets/edit.js"></script>`
|
|
1839
2126
|
: !opts.publish
|
|
1840
2127
|
? '<script src="/assets/ui.js"></script>'
|
|
1841
|
-
:
|
|
2128
|
+
: opts.publish.subformatJs
|
|
2129
|
+
? `<script>${inlineScript(opts.publish.subformatJs)}</script>`
|
|
2130
|
+
: "";
|
|
1842
2131
|
// Interaction layer of the schema graph (zoom / pan / box drag / enlarged view). Shared by
|
|
1843
2132
|
// preview / edit. Figures are readable without JS, so defer is enough (= progressive
|
|
1844
2133
|
// enhancement).
|
|
@@ -1847,20 +2136,26 @@ const page = (mode, site, opts) => {
|
|
|
1847
2136
|
|
|
1848
2137
|
|
|
1849
2138
|
<div id="preview-language-menu" role="menu" aria-label="Change language" data-i18n-aria-label="Change language" hidden></div>
|
|
1850
|
-
<div id="preview-panes"><section class="preview-pane active" tabindex="0" aria-label="Active pane" data-i18n-aria-label="Active pane"><div class="pane-actions"><button class="pbtn" type="button" data-theme-picker="document" aria-label="Preview theme"></button>${fontButton("viewer")}<button class="pbtn pane-language" type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="preview-language-menu" aria-label="Change language" data-i18n-aria-label="Change language" title="Change language" data-i18n-title="Change language">${GLOBE_ICON}</button></div><div class="preview-content">${opts.main}</div></section></div></main>`
|
|
2139
|
+
<div id="preview-panes"${opts.currentRes !== undefined ? " hidden" : ""}><section class="preview-pane active" tabindex="0" aria-label="Active pane" data-i18n-aria-label="Active pane"><div class="pane-actions"><button class="pbtn" type="button" data-theme-picker="document" aria-label="Preview theme"></button>${fontButton("viewer")}<button class="pbtn pane-language" type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="preview-language-menu" aria-label="Change language" data-i18n-aria-label="Change language" title="Change language" data-i18n-title="Change language">${GLOBE_ICON}</button></div><div class="preview-content">${opts.main}</div></section></div></main>`
|
|
1851
2140
|
: mode === "edit" && opts.currentRes !== undefined
|
|
1852
2141
|
? `<main class="resources-pane">${opts.main}</main>`
|
|
1853
2142
|
: `<main><div class="page-actions"><button class="pbtn" type="button" data-theme-picker="document" aria-label="Preview theme"></button>${fontButton("viewer")}</div>${opts.main}</main>`;
|
|
1854
2143
|
const graphScript = opts.publish
|
|
1855
2144
|
? `<script>${inlineScript(opts.publish.graphJs)}</script>`
|
|
1856
|
-
:
|
|
2145
|
+
: `<script>(${loadGraphScript.toString()})();</script>`;
|
|
1857
2146
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
1858
2147
|
${opts.publish ? `<meta name="referrer" content="no-referrer"><meta http-equiv="x-dns-prefetch-control" content="off">${opts.publish.network ? "" : `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline' data:; img-src data: blob:; media-src data: blob:; font-src data: blob:; frame-src data: blob:; connect-src 'none'; base-uri 'none'; form-action 'none'">`}` : ""}
|
|
1859
2148
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1860
2149
|
<title>${escapeHtml(pageTitle(mode, opts.title, site.title))}</title>
|
|
1861
|
-
<script>
|
|
2150
|
+
<script>var __name = (f) => f;
|
|
2151
|
+
(${initializeThemes.toString()})(${JSON.stringify(site.themes)});
|
|
2152
|
+
(${mountFigureFrames.toString()})(document);</script>
|
|
1862
2153
|
<style>${fontCss(Boolean(opts.publish))}${CSS}${mode === "edit" ? EDIT_CSS : ""}</style></head>
|
|
1863
|
-
<body${mode === "edit" ? ' class="edit"' : ""}><nav id="sidebar"><div id="sidebar-resize" class="panel-resize" role="separator" tabindex="0" aria-orientation="vertical" aria-controls="sidebar" aria-label="Resize sidebar" data-i18n-aria-label="Resize sidebar" title="Resize sidebar" data-i18n-title="Resize sidebar"></div><div id="sidebar-head">${siteIcon}<div id="site-title" class="site-title" title="${siteTitle}"${mode === "edit" ? ` data-title="${escapeHtml(site.title ?? "")}" tabindex="0" role="button" aria-label="Edit site title" data-i18n-aria-label="Edit site title"` : ""}>${siteTitle}</div><button id="sidebar-toggle" type="button" aria-controls="sidebar-content" aria-expanded="true" title="Close sidebar" data-i18n-title="Close sidebar">${SIDEBAR_ICON}</button></div><div id="sidebar-content"><div id="nav-groups">${nav}</div><div id="nav-status" role="status" aria-live="polite"></div></div></nav>${main}${opts.aside ?? ""}
|
|
2154
|
+
<body${mode === "edit" ? ' class="edit"' : ""}${site.sourceBase ? ` data-source-base="${escapeHtml(site.sourceBase)}"` : ""}><nav id="sidebar"><div id="sidebar-resize" class="panel-resize" role="separator" tabindex="0" aria-orientation="vertical" aria-controls="sidebar" aria-label="Resize sidebar" data-i18n-aria-label="Resize sidebar" title="Resize sidebar" data-i18n-title="Resize sidebar"></div><div id="sidebar-head">${siteIcon}<div id="site-title" class="site-title" title="${siteTitle}"${mode === "edit" ? ` data-title="${escapeHtml(site.title ?? "")}" tabindex="0" role="button" aria-label="Edit site title" data-i18n-aria-label="Edit site title"` : ""}>${siteTitle}</div><button id="sidebar-toggle" type="button" aria-controls="sidebar-content" aria-expanded="true" title="Close sidebar" data-i18n-title="Close sidebar">${SIDEBAR_ICON}</button></div><div id="sidebar-content"><div id="nav-groups">${nav}</div><div id="nav-status" role="status" aria-live="polite"></div></div></nav>${main}${opts.aside ?? ""}
|
|
2155
|
+
<script>
|
|
2156
|
+
(${mountThemePickers.toString()})(${JSON.stringify(THEME_ICONS)}, ${JSON.stringify(site.themes)});
|
|
2157
|
+
(${mountThemeVariants.toString()})(document);
|
|
2158
|
+
</script>
|
|
1864
2159
|
${bootScripts}${graphScript}
|
|
1865
2160
|
<script id="code-grammars" type="application/json">${JSON.stringify(site.codeGrammars ?? []).replace(/</g, "\\u003c")}</script>
|
|
1866
2161
|
${opts.publish ? `<script>${inlineScript(opts.publish.codeJs)}</script>` : '<script src="/assets/code.js" defer></script>'}
|
|
@@ -1873,9 +2168,6 @@ const localeFetch = (url, init = {}) => fetch(url, { ...init, headers: { ...init
|
|
|
1873
2168
|
(${mountTables.toString()})(document);
|
|
1874
2169
|
(${mountToc.toString()})(document);
|
|
1875
2170
|
(${mountVideos.toString()})(document);
|
|
1876
|
-
(${mountFigureFrames.toString()})(document);
|
|
1877
|
-
(${mountThemeVariants.toString()})(document);
|
|
1878
|
-
(${mountThemePickers.toString()})(${JSON.stringify(THEME_ICONS)}, ${JSON.stringify(site.themes)});
|
|
1879
2171
|
void (${mountFontPickers.toString()})(${createFontSettings.toString()}, ${JSON.stringify(site.fonts ?? []).replace(/</g, "\\u003c")});
|
|
1880
2172
|
(() => {
|
|
1881
2173
|
const KEY = "docs:sidebar-open";
|
|
@@ -1907,7 +2199,6 @@ void (${mountFontPickers.toString()})(${createFontSettings.toString()}, ${JSON.s
|
|
|
1907
2199
|
}, true);
|
|
1908
2200
|
})();
|
|
1909
2201
|
(${mountPanelResize.toString()})();
|
|
1910
|
-
(${mountToolsResize.toString()})();
|
|
1911
2202
|
(() => {
|
|
1912
2203
|
// Open/close: by default "the branch containing the current doc is open" (the server adds
|
|
1913
2204
|
// .open), overridden by explicit user actions (sessionStorage = per tab only).
|
|
@@ -1915,6 +2206,8 @@ void (${mountFontPickers.toString()})(${createFontSettings.toString()}, ${JSON.s
|
|
|
1915
2206
|
const readOpen = () => { try { return JSON.parse(sessionStorage.getItem(OPEN_KEY) || "{}"); } catch { return {}; } };
|
|
1916
2207
|
const applyOpen = () => {
|
|
1917
2208
|
const o = readOpen();
|
|
2209
|
+
const tools = document.getElementById("nav-tools");
|
|
2210
|
+
if (tools) tools.open = o._tools !== false;
|
|
1918
2211
|
for (const it of document.querySelectorAll("#nav-groups .nav-item")) {
|
|
1919
2212
|
const key = it.dataset.docId || it.dataset.nodeId;
|
|
1920
2213
|
if (key in o) it.classList.toggle("open", o[key]);
|
|
@@ -1935,6 +2228,11 @@ void (${mountFontPickers.toString()})(${createFontSettings.toString()}, ${JSON.s
|
|
|
1935
2228
|
const it = t.closest(".nav-item");
|
|
1936
2229
|
window.__docsNavOpen(it.dataset.docId || it.dataset.nodeId, !it.classList.contains("open"));
|
|
1937
2230
|
});
|
|
2231
|
+
document.addEventListener("toggle", (event) => {
|
|
2232
|
+
const tools = event.target;
|
|
2233
|
+
if (tools instanceof HTMLDetailsElement && tools.id === "nav-tools" && tools.isConnected)
|
|
2234
|
+
window.__docsNavOpen("_tools", tools.open);
|
|
2235
|
+
}, true);
|
|
1938
2236
|
applyOpen();
|
|
1939
2237
|
window.__docsNavRestore = applyOpen;
|
|
1940
2238
|
const nav = document.getElementById("nav-groups");
|
|
@@ -1942,12 +2240,12 @@ void (${mountFontPickers.toString()})(${createFontSettings.toString()}, ${JSON.s
|
|
|
1942
2240
|
})();
|
|
1943
2241
|
${mode === "edit"
|
|
1944
2242
|
? `(() => {
|
|
1945
|
-
// Sidebar tree editing
|
|
2243
|
+
// Sidebar tree editing stays delegated while navigation nodes are reconciled.
|
|
1946
2244
|
// drag: top 1/4 of a row = before, bottom 1/4 = after, middle = move into that doc's children
|
|
1947
2245
|
// (at the end). The DOM isn't moved, only a marker is shown; on drop, POST /api/move →
|
|
1948
2246
|
// re-fetch the nav regardless of the outcome (= the display is always a copy of
|
|
1949
2247
|
// dooc.yaml; no rollback logic).
|
|
1950
|
-
// The root placeholder and row buttons open the
|
|
2248
|
+
// The root placeholder and row buttons open the page type menu.
|
|
1951
2249
|
const t = (key) => window.__docsTranslate?.(key) ?? key;
|
|
1952
2250
|
const status = document.getElementById("nav-status");
|
|
1953
2251
|
const setStatus = (message, error) => {
|
|
@@ -1959,11 +2257,13 @@ ${mode === "edit"
|
|
|
1959
2257
|
if (window.__docsRefreshNav) return window.__docsRefreshNav();
|
|
1960
2258
|
const cur = document.querySelector("#nav-groups .nav-row a.cur");
|
|
1961
2259
|
const id = (cur && cur.closest(".nav-item").dataset.docId) || "";
|
|
1962
|
-
const rp = location.pathname.startsWith("/_statics") ? location.pathname.slice(1) : ["/_git", "/_extensions"].includes(location.pathname) ? location.pathname.slice(1) : location.pathname.startsWith("/_files") ? location.pathname.slice(8).replace(/^\\/|\\/$/g, "") : null;
|
|
2260
|
+
const rp = location.pathname.startsWith("/_statics") ? location.pathname.slice(1) : ["/_git", "/_extensions", "/_subformats"].includes(location.pathname) ? location.pathname.slice(1) : location.pathname.startsWith("/_files") ? location.pathname.slice(8).replace(/^\\/|\\/$/g, "") : null;
|
|
1963
2261
|
const res = await localeFetch("/api/nav?current=" + encodeURIComponent(id) + (rp == null ? "" : "&res=" + encodeURIComponent(rp)));
|
|
1964
2262
|
if (res.ok) {
|
|
1965
2263
|
const data = await res.json();
|
|
1966
|
-
document.getElementById("nav-groups")
|
|
2264
|
+
(${updateNav.toString()})(document.getElementById("nav-groups"), data.html);
|
|
2265
|
+
const currentPage = document.querySelector('[data-subformat-nav][data-doc-id="' + CSS.escape(id) + '"] > .nav-row > a');
|
|
2266
|
+
if (currentPage && currentPage.pathname !== location.pathname) history.replaceState(null, "", currentPage.href);
|
|
1967
2267
|
const label = document.getElementById("site-title");
|
|
1968
2268
|
if (!label.querySelector("form")) label.textContent = label.title = data.siteTitle || "dooc";
|
|
1969
2269
|
label.dataset.title = data.siteTitle || "";
|
|
@@ -1980,6 +2280,10 @@ ${mode === "edit"
|
|
|
1980
2280
|
};
|
|
1981
2281
|
|
|
1982
2282
|
const docAction = (item, action) => {
|
|
2283
|
+
if (item.hasAttribute("data-subformat-nav")) {
|
|
2284
|
+
document.dispatchEvent(new CustomEvent("docs:subformat-page-action", { detail: { id: item.dataset.docId, action } }));
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
1983
2287
|
if (window.__docsDocAction) {
|
|
1984
2288
|
void window.__docsDocAction(item.dataset.docId, action);
|
|
1985
2289
|
} else {
|
|
@@ -2039,7 +2343,7 @@ ${mode === "edit"
|
|
|
2039
2343
|
busy = true;
|
|
2040
2344
|
input.readOnly = true;
|
|
2041
2345
|
try {
|
|
2042
|
-
const result = await post("/api/site-title", { title: input.value, baseTitle });
|
|
2346
|
+
const result = await post("/api/site-title", { title: input.value, baseTitle, language: new URL(location.href).searchParams.get("lang") });
|
|
2043
2347
|
closed = true;
|
|
2044
2348
|
form.remove();
|
|
2045
2349
|
label.textContent = label.title = result.title;
|
|
@@ -2081,7 +2385,7 @@ ${mode === "edit"
|
|
|
2081
2385
|
const id = slot.closest(".nav-item")?.dataset.docId;
|
|
2082
2386
|
try {
|
|
2083
2387
|
const data = file ? btoa(Array.from(new Uint8Array(await file.arrayBuffer()), (byte) => String.fromCharCode(byte)).join("")) : null;
|
|
2084
|
-
const result = await post(id ? "/api/icon" : "/api/site-icon", { file: id ? id + ".md" : undefined, data });
|
|
2388
|
+
const result = await post(id ? "/api/icon" : "/api/site-icon", { file: id ? id + ".md" : undefined, data, theme: getComputedStyle(document.documentElement).colorScheme === "dark" ? "dark" : "light" });
|
|
2085
2389
|
if (!id) {
|
|
2086
2390
|
const logo = document.getElementById("site-icon");
|
|
2087
2391
|
logo.src = result.icon;
|
|
@@ -2195,18 +2499,18 @@ ${mode === "edit"
|
|
|
2195
2499
|
|
|
2196
2500
|
document.addEventListener("docs:files-changed", () => { void refresh(); });
|
|
2197
2501
|
|
|
2198
|
-
// ──
|
|
2502
|
+
// ── Page type menu and in-sidebar create form ──
|
|
2199
2503
|
const suggestFileName = ${suggestDocFileName.toString()};
|
|
2504
|
+
const availableSubformats = () => JSON.parse(document.querySelector("[data-page-subformats]")?.content.textContent || "[]");
|
|
2200
2505
|
const closeForm = () => { for (const f of document.querySelectorAll(".nav-new-item")) f.remove(); };
|
|
2201
|
-
const openForm = (
|
|
2506
|
+
const openForm = (trigger) => {
|
|
2202
2507
|
closeForm();
|
|
2508
|
+
const parent = trigger.dataset.parent || "";
|
|
2203
2509
|
const host = parent
|
|
2204
2510
|
? document.querySelector('#nav-groups .nav-item[data-doc-id="' + CSS.escape(parent) + '"] > .nav-list')
|
|
2205
2511
|
: document.querySelector("#nav-groups > .nav-list");
|
|
2206
2512
|
if (!host) return;
|
|
2207
|
-
if (parent)
|
|
2208
|
-
window.__docsNavOpen(parent, true);
|
|
2209
|
-
}
|
|
2513
|
+
if (parent) window.__docsNavOpen(parent, true);
|
|
2210
2514
|
const item = document.createElement("div");
|
|
2211
2515
|
item.className = "nav-item nav-new-item";
|
|
2212
2516
|
const row = document.createElement("div");
|
|
@@ -2214,11 +2518,11 @@ ${mode === "edit"
|
|
|
2214
2518
|
const form = document.createElement("form");
|
|
2215
2519
|
form.className = "nav-new";
|
|
2216
2520
|
form.innerHTML =
|
|
2217
|
-
|
|
2218
|
-
'<input name="title" placeholder="title" data-i18n-placeholder="title" required autocomplete="off">' +
|
|
2219
|
-
'<div class="nav-new-file"><input name="name" placeholder="File name" data-i18n-placeholder="File name" aria-label="File name" data-i18n-aria-label="File name" required autocomplete="off" spellcheck="false">' +
|
|
2220
|
-
'<
|
|
2221
|
-
'<div class="err"></div>';
|
|
2521
|
+
'<p class="nav-new-heading" data-i18n="Markdown page">Markdown page</p>' +
|
|
2522
|
+
'<input name="title" placeholder="title" data-i18n-placeholder="title" aria-label="title" data-i18n-aria-label="title" required autocomplete="off">' +
|
|
2523
|
+
'<div class="nav-new-file"><input name="name" placeholder="File name" data-i18n-placeholder="File name" aria-label="File name" data-i18n-aria-label="File name" required autocomplete="off" spellcheck="false"></div>' +
|
|
2524
|
+
'<div class="nav-new-actions"><button type="button" class="nav-new-cancel" data-i18n="Cancel">Cancel</button><button class="nav-new-go" type="submit" data-i18n="Create">Create</button></div>' +
|
|
2525
|
+
'<div class="err" role="alert"></div>';
|
|
2222
2526
|
row.append(form);
|
|
2223
2527
|
item.append(row);
|
|
2224
2528
|
host.append(item);
|
|
@@ -2229,11 +2533,18 @@ ${mode === "edit"
|
|
|
2229
2533
|
const err = form.querySelector(".err");
|
|
2230
2534
|
let nameTouched = false;
|
|
2231
2535
|
let busy = false;
|
|
2536
|
+
const cancel = () => {
|
|
2537
|
+
if (busy) return;
|
|
2538
|
+
closeForm();
|
|
2539
|
+
trigger.focus();
|
|
2540
|
+
};
|
|
2541
|
+
form.querySelector(".nav-new-cancel").addEventListener("click", cancel);
|
|
2232
2542
|
title.addEventListener("input", () => { if (!nameTouched) nameInput.value = suggestFileName(title.value); });
|
|
2233
2543
|
nameInput.addEventListener("input", () => { nameTouched = true; });
|
|
2234
|
-
form.addEventListener("keydown", (e) => {
|
|
2235
|
-
|
|
2236
|
-
|
|
2544
|
+
form.addEventListener("keydown", (e) => {
|
|
2545
|
+
if (e.key === "Escape") { e.preventDefault(); cancel(); }
|
|
2546
|
+
});
|
|
2547
|
+
// Keep partially filled forms when focus moves elsewhere.
|
|
2237
2548
|
form.addEventListener("focusout", (e) => {
|
|
2238
2549
|
if (busy || form.contains(e.relatedTarget) || title.value.trim() || nameInput.value.trim()) return;
|
|
2239
2550
|
setTimeout(() => { if (item.isConnected && !item.contains(document.activeElement)) item.remove(); }, 0);
|
|
@@ -2245,7 +2556,7 @@ ${mode === "edit"
|
|
|
2245
2556
|
submit.setAttribute("aria-busy", "true");
|
|
2246
2557
|
err.textContent = "";
|
|
2247
2558
|
try {
|
|
2248
|
-
await post("/api/create", { parent: parent || undefined,
|
|
2559
|
+
await post("/api/create", { parent: parent || undefined, title: title.value.trim(), name: nameInput.value.trim() });
|
|
2249
2560
|
closeForm();
|
|
2250
2561
|
await refresh();
|
|
2251
2562
|
} catch (error) {
|
|
@@ -2258,11 +2569,121 @@ ${mode === "edit"
|
|
|
2258
2569
|
item.scrollIntoView({ block: "nearest" });
|
|
2259
2570
|
title.focus();
|
|
2260
2571
|
};
|
|
2572
|
+
const menu = document.createElement("div");
|
|
2573
|
+
menu.id = "nav-page-menu";
|
|
2574
|
+
menu.className = "nav-page-menu";
|
|
2575
|
+
menu.popover = "auto";
|
|
2576
|
+
menu.setAttribute("role", "menu");
|
|
2577
|
+
menu.setAttribute("aria-label", t("Page type"));
|
|
2578
|
+
menu.dataset.i18nAriaLabel = "Page type";
|
|
2579
|
+
menu.innerHTML = '<button type="button" role="menuitem" tabindex="-1" data-page-type="markdown">${DOCS_ICON}Markdown</button><button type="button" role="menuitem" tabindex="-1" data-page-type="subformat" aria-haspopup="menu" popovertarget="nav-subformat-menu">${SUBFORMATS_ICON}Subformat<span class="nav-page-chevron">${CHEVRON_ICON}</span></button><div id="nav-subformat-menu" class="subformat-picker-menu subformat-setting-menu" role="menu" aria-label="Subformat" popover="auto"></div><p class="err" role="alert"></p>';
|
|
2580
|
+
document.body.append(menu);
|
|
2581
|
+
const formatsMenu = menu.querySelector("#nav-subformat-menu");
|
|
2582
|
+
const formatTrigger = menu.querySelector('[data-page-type="subformat"]');
|
|
2583
|
+
const markdownTrigger = menu.querySelector('[data-page-type="markdown"]');
|
|
2584
|
+
const menuError = menu.querySelector(".err");
|
|
2585
|
+
let menuTrigger;
|
|
2586
|
+
let addingPage = false;
|
|
2587
|
+
const showMenu = (popup, trigger) => {
|
|
2588
|
+
popup.style.maxHeight = "";
|
|
2589
|
+
popup.showPopover();
|
|
2590
|
+
const rect = trigger.getBoundingClientRect();
|
|
2591
|
+
const top = popup === menu ? rect.top : rect.bottom + 4;
|
|
2592
|
+
const bottom = popup === menu ? rect.bottom : rect.top - 4;
|
|
2593
|
+
const above = innerHeight - top < popup.offsetHeight + 8 && bottom > innerHeight - top;
|
|
2594
|
+
Object.assign(popup.style, {
|
|
2595
|
+
left: Math.max(8, Math.min(rect.left, innerWidth - popup.offsetWidth - 8)) + "px",
|
|
2596
|
+
top: above ? "auto" : top + "px",
|
|
2597
|
+
bottom: above ? innerHeight - bottom + "px" : "auto",
|
|
2598
|
+
maxHeight: Math.max(80, (above ? bottom : innerHeight - top) - 8) + "px",
|
|
2599
|
+
});
|
|
2600
|
+
popup.querySelector("button:not(:disabled)")?.focus();
|
|
2601
|
+
};
|
|
2602
|
+
markdownTrigger.addEventListener("click", () => {
|
|
2603
|
+
if (addingPage) return;
|
|
2604
|
+
menu.hidePopover();
|
|
2605
|
+
openForm(menuTrigger);
|
|
2606
|
+
});
|
|
2607
|
+
formatTrigger.addEventListener("click", (event) => {
|
|
2608
|
+
event.preventDefault();
|
|
2609
|
+
if (addingPage) return;
|
|
2610
|
+
if (formatsMenu.matches(":popover-open")) { formatsMenu.hidePopover(); return; }
|
|
2611
|
+
formatsMenu.replaceChildren();
|
|
2612
|
+
for (const format of availableSubformats()) {
|
|
2613
|
+
const row = document.createElement("div");
|
|
2614
|
+
row.className = "subformat-setting-option";
|
|
2615
|
+
row.setAttribute("role", "none");
|
|
2616
|
+
const option = document.createElement("button");
|
|
2617
|
+
option.type = "button";
|
|
2618
|
+
option.tabIndex = -1;
|
|
2619
|
+
option.setAttribute("role", "menuitem");
|
|
2620
|
+
option.dataset.subformat = format.ext;
|
|
2621
|
+
option.textContent = format.ext;
|
|
2622
|
+
row.append(option);
|
|
2623
|
+
formatsMenu.append(row);
|
|
2624
|
+
}
|
|
2625
|
+
showMenu(formatsMenu, formatTrigger);
|
|
2626
|
+
});
|
|
2627
|
+
formatsMenu.addEventListener("click", async (event) => {
|
|
2628
|
+
const option = event.target.closest("button[data-subformat]");
|
|
2629
|
+
if (!option || addingPage) return;
|
|
2630
|
+
const parent = menuTrigger.dataset.parent || undefined;
|
|
2631
|
+
const subformat = option.dataset.subformat;
|
|
2632
|
+
addingPage = markdownTrigger.disabled = formatTrigger.disabled = true;
|
|
2633
|
+
menu.setAttribute("aria-busy", "true");
|
|
2634
|
+
menuError.textContent = "";
|
|
2635
|
+
setStatus("", false);
|
|
2636
|
+
formatsMenu.hidePopover();
|
|
2637
|
+
try {
|
|
2638
|
+
const result = await post("/api/create", { parent, subformat, title: subformat });
|
|
2639
|
+
menu.hidePopover();
|
|
2640
|
+
await refresh();
|
|
2641
|
+
if (result.path) {
|
|
2642
|
+
if (window.__docsNavigate) await window.__docsNavigate(result.path);
|
|
2643
|
+
else location.href = result.path;
|
|
2644
|
+
}
|
|
2645
|
+
} catch (error) {
|
|
2646
|
+
menuError.textContent = error.message;
|
|
2647
|
+
if (!menu.matches(":popover-open")) setStatus(error.message, true);
|
|
2648
|
+
} finally {
|
|
2649
|
+
addingPage = markdownTrigger.disabled = false;
|
|
2650
|
+
formatTrigger.disabled = !availableSubformats().length;
|
|
2651
|
+
menu.removeAttribute("aria-busy");
|
|
2652
|
+
if (menu.matches(":popover-open")) formatTrigger.focus();
|
|
2653
|
+
}
|
|
2654
|
+
});
|
|
2655
|
+
menu.addEventListener("keydown", (event) => {
|
|
2656
|
+
const popup = event.target.closest('[role="menu"]');
|
|
2657
|
+
const options = [...popup.querySelectorAll("button:not(:disabled)")].filter((button) => button.closest('[role="menu"]') === popup);
|
|
2658
|
+
const index = options.indexOf(document.activeElement);
|
|
2659
|
+
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
2660
|
+
event.preventDefault();
|
|
2661
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? options.length - 1 : (index + (event.key === "ArrowDown" ? 1 : options.length - 1)) % options.length;
|
|
2662
|
+
options[next]?.focus();
|
|
2663
|
+
}
|
|
2664
|
+
if (event.key === "Escape" || event.key === "Tab") {
|
|
2665
|
+
const dismiss = event.key === "Tab" ? menu : popup;
|
|
2666
|
+
dismiss.hidePopover();
|
|
2667
|
+
(dismiss === menu ? menuTrigger : formatTrigger)?.focus();
|
|
2668
|
+
if (event.key === "Escape") event.preventDefault();
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2261
2671
|
document.addEventListener("click", (event) => {
|
|
2262
2672
|
const btn = event.target instanceof Element ? event.target.closest("#sidebar .new, #sidebar .nav-create") : null;
|
|
2263
2673
|
if (!btn) return;
|
|
2264
2674
|
event.preventDefault();
|
|
2265
|
-
|
|
2675
|
+
if (addingPage) return;
|
|
2676
|
+
if (menu.matches(":popover-open")) {
|
|
2677
|
+
menu.hidePopover();
|
|
2678
|
+
if (menuTrigger === btn) return;
|
|
2679
|
+
}
|
|
2680
|
+
menuTrigger = btn;
|
|
2681
|
+
const unavailable = !availableSubformats().length;
|
|
2682
|
+
formatTrigger.disabled = unavailable;
|
|
2683
|
+
formatTrigger.title = unavailable ? t("No subformats available to add.") : "";
|
|
2684
|
+
menuError.textContent = "";
|
|
2685
|
+
menu.setAttribute("aria-label", t("Page type"));
|
|
2686
|
+
showMenu(menu, btn);
|
|
2266
2687
|
});
|
|
2267
2688
|
})();`
|
|
2268
2689
|
: ""}
|
|
@@ -2317,7 +2738,7 @@ document.addEventListener("click", (ev) => {
|
|
|
2317
2738
|
});
|
|
2318
2739
|
</script>
|
|
2319
2740
|
<script>${inlineScript(`(${mountSearch.toString()})(${JSON.stringify(opts.publish ? searchIndex(site) : []).replace(/</g, "\\u003c")}, ${searchSections.toString()}, ${JSON.stringify(Object.fromEntries(SEARCH_LABELS.map((key) => [key, translate(site.defaultLang, key)]))).replace(/</g, "\\u003c")}, ${Boolean(opts.publish)});`)}</script>
|
|
2320
|
-
${opts.publish ? `${opts.publish.pages}<script>${publishRouterScript(opts.publish.first)}${opts.publish.network ? `\n(${mountBundleNetwork.toString()})();` : ""}</script>` : `<script>${hmrClientScript(mode)}</script>`}</body></html>`;
|
|
2741
|
+
${opts.publish ? `${opts.publish.pages}<script>${publishRouterScript(opts.publish.first)}${opts.publish.network && !opts.publish.pluginJs ? `\n(${mountBundleNetwork.toString()})();` : ""}</script>${opts.publish.pluginJs ? `<script>${inlineScript(opts.publish.pluginJs)}</script>` : ""}` : `<script>${hmrClientScript(mode)}</script>`}</body></html>`;
|
|
2321
2742
|
};
|
|
2322
2743
|
// A `</script` inside an inline <script> would close the script early, so escape it.
|
|
2323
2744
|
const inlineScript = (js) => js.replace(/<\/(script)/gi, "<\\/$1");
|
|
@@ -2337,6 +2758,7 @@ const publishRouterScript = (first) => `
|
|
|
2337
2758
|
const page = pages.get(route);
|
|
2338
2759
|
const actions = main.querySelector(":scope > .page-actions");
|
|
2339
2760
|
main.innerHTML = page.innerHTML;
|
|
2761
|
+
document.dispatchEvent(new Event("docs:page-shown"));
|
|
2340
2762
|
if (actions) main.prepend(actions);
|
|
2341
2763
|
document.title = page.dataset.title;
|
|
2342
2764
|
for (const a of document.querySelectorAll("#nav-groups a")) {
|
|
@@ -2365,7 +2787,7 @@ const toHashLinks = (html, route) => html
|
|
|
2365
2787
|
* down to figures / terms / schema graph JS). Each doc is held in a
|
|
2366
2788
|
* <template> and switched via hash routes.
|
|
2367
2789
|
*/
|
|
2368
|
-
export const publishHtml = (site, graphJs, title = site.title ?? "dooc", codeJs = "", mode = "static") => {
|
|
2790
|
+
export const publishHtml = (site, graphJs, title = site.title ?? "dooc", codeJs = "", mode = "static", pluginJs = "", subformatJs = "") => {
|
|
2369
2791
|
const pages = site.entries.map((e) => ({
|
|
2370
2792
|
route: docPath(site.entries, e.id).slice(1),
|
|
2371
2793
|
title: docDisplayName(e.frontmatter, e.id),
|
|
@@ -2391,7 +2813,15 @@ export const publishHtml = (site, graphJs, title = site.title ?? "dooc", codeJs
|
|
|
2391
2813
|
return toHashLinks(page("preview", { ...site, title }, {
|
|
2392
2814
|
title,
|
|
2393
2815
|
main: "",
|
|
2394
|
-
publish: {
|
|
2816
|
+
publish: {
|
|
2817
|
+
graphJs,
|
|
2818
|
+
codeJs,
|
|
2819
|
+
pages: templates,
|
|
2820
|
+
first,
|
|
2821
|
+
network: mode !== "static",
|
|
2822
|
+
pluginJs: mode === "live" ? pluginJs : undefined,
|
|
2823
|
+
subformatJs,
|
|
2824
|
+
},
|
|
2395
2825
|
}), first);
|
|
2396
2826
|
};
|
|
2397
2827
|
// A doc's main content. A doc with an empty body and children (a chapter-heading-only doc) shows
|
|
@@ -2399,7 +2829,7 @@ export const publishHtml = (site, graphJs, title = site.title ?? "dooc", codeJs
|
|
|
2399
2829
|
const entryMain = (site, e) => {
|
|
2400
2830
|
const html = renderEntryHtml(site, e).html;
|
|
2401
2831
|
const kids = childrenOf(site.entries, e.id);
|
|
2402
|
-
if (e.blocks.length > 0 || kids.length === 0) {
|
|
2832
|
+
if (e.subformat || e.blocks.length > 0 || kids.length === 0) {
|
|
2403
2833
|
return html;
|
|
2404
2834
|
}
|
|
2405
2835
|
const items = kids
|
|
@@ -2421,7 +2851,9 @@ export const languageFieldHtml = (defaultLang, language = contentLanguageCode(de
|
|
|
2421
2851
|
export const editorBoot = (entry, site) => {
|
|
2422
2852
|
// Completion candidates are files in the figures/ catalog.
|
|
2423
2853
|
const figures = [...site.ctx.figures.values()].map((f) => f.file);
|
|
2424
|
-
const docs = site.entries
|
|
2854
|
+
const docs = site.entries
|
|
2855
|
+
.filter((e) => !e.subformat)
|
|
2856
|
+
.map((e) => ({
|
|
2425
2857
|
ref: e.sourceFile ?? CONTENT_PREFIX + e.file,
|
|
2426
2858
|
title: docDisplayName(e.frontmatter, e.id),
|
|
2427
2859
|
}));
|
|
@@ -2460,15 +2892,15 @@ export const editorBoot = (entry, site) => {
|
|
|
2460
2892
|
const editorAside = (entry, site) => {
|
|
2461
2893
|
const aside = `<aside id="panel"><div id="resize" class="panel-resize" role="separator" tabindex="0" aria-orientation="vertical" aria-controls="panel" aria-label="Resize editor" data-i18n-aria-label="Resize editor" title="Resize editor" data-i18n-title="Resize editor"></div>
|
|
2462
2894
|
<div id="phead">
|
|
2463
|
-
<button class="pbtn" type="button" data-theme-picker="editor" aria-label="Editor theme"></button>
|
|
2464
|
-
${fontButton("editor")}
|
|
2465
2895
|
${languageFieldHtml(site.defaultLang, site.contentLanguage, entry.translatedLanguages, site.contentLanguages)}
|
|
2466
2896
|
<span id="status"></span>
|
|
2467
2897
|
<button id="validate" class="pbtn" type="button" title="Validate and apply" data-i18n-title="Validate and apply" aria-label="Validate and apply" data-i18n-aria-label="Validate and apply">${icon('<path d="M5 5l-4 5 4 5M15 5l4 5-4 5M7 10l2 2 4-5"/>')}</button>
|
|
2468
2898
|
<button id="save" class="pbtn" data-state="saved" type="button" title="Save (Ctrl+S)" data-i18n-title="Save (Ctrl+S)" aria-label="Save" data-i18n-aria-label="Save">${icon('<path d="M3 3h11l3 3v11H3z"/><path d="M6 3v5h7V3M6 17v-6h8v6"/>')}</button>
|
|
2469
2899
|
<button id="split-preview" class="pbtn" type="button" aria-pressed="false" aria-label="Split view" data-i18n-aria-label="Split view" title="Split view" data-i18n-title="Split view">${icon('<rect x="3" y="3" width="14" height="14" rx="2"/><path d="M10 3v14"/>')}</button>
|
|
2470
2900
|
<div id="gear"><button class="pbtn" type="button" aria-haspopup="true" aria-label="View settings" data-i18n-aria-label="View settings" title="View settings" data-i18n-title="View settings">${GEAR_ICON}</button><div id="gearmenu">
|
|
2471
|
-
<div
|
|
2901
|
+
<div class="editor-setting"><span class="editor-setting-icon" data-setting-theme-icon aria-hidden="true"></span><div class="subformat-control"><span class="subformat-control-label" data-i18n="Editor theme">Editor theme</span><button class="setting-picker" type="button" data-theme-picker="editor" aria-label="Editor theme"><span data-picker-value></span>${SELECT_ICON}</button></div></div>
|
|
2902
|
+
<div class="editor-setting"><span class="editor-setting-icon" aria-hidden="true">${FONT_ICON}</span><div class="subformat-control"><span class="subformat-control-label" data-i18n="Editor font">Editor font</span>${fontButton("editor")}</div></div>
|
|
2903
|
+
<div id="language-setting" class="editor-setting">${GLOBE_ICON}<div class="subformat-control"><span class="subformat-control-label" data-i18n="Language">Editor language</span><select id="ui-language" aria-label="Editor language" data-i18n-aria-label="Language"><option value="eng">English</option><option value="jpn">日本語</option><option value="zho">中文</option></select></div></div>
|
|
2472
2904
|
<label><input type="checkbox" id="opt-autovalidate"><span data-i18n="Auto validate">Auto validate</span></label>
|
|
2473
2905
|
<label><input type="checkbox" id="opt-autosave"><span data-i18n="Auto save">Auto save</span></label>
|
|
2474
2906
|
<label><input type="checkbox" id="opt-corr"><span data-i18n="Source mapping">Source mapping</span></label>
|
|
@@ -2493,6 +2925,7 @@ export const pageDataResponse = (site, path) => {
|
|
|
2493
2925
|
return { status: 400, body: { error: "route must be /<docId>" } };
|
|
2494
2926
|
}
|
|
2495
2927
|
if (path === "/_extensions" ||
|
|
2928
|
+
path === "/_subformats" ||
|
|
2496
2929
|
path === "/_git" ||
|
|
2497
2930
|
path === "/_statics" ||
|
|
2498
2931
|
path.startsWith("/_statics/") ||
|
|
@@ -2501,7 +2934,7 @@ export const pageDataResponse = (site, path) => {
|
|
|
2501
2934
|
try {
|
|
2502
2935
|
const resource = resourcesMain(site, path.startsWith("/_statics")
|
|
2503
2936
|
? path.slice(1)
|
|
2504
|
-
: ["/_git", "/_extensions"].includes(path)
|
|
2937
|
+
: ["/_git", "/_extensions", "/_subformats"].includes(path)
|
|
2505
2938
|
? path.slice(1)
|
|
2506
2939
|
: path.slice("/_files".length).replace(/^\/|\/$/g, ""));
|
|
2507
2940
|
return resource
|
|
@@ -2527,6 +2960,16 @@ export const pageDataResponse = (site, path) => {
|
|
|
2527
2960
|
return { status: 404, body: { error: `${path} is not a doc route` } };
|
|
2528
2961
|
}
|
|
2529
2962
|
const html = entryMain(site, doc);
|
|
2963
|
+
if (doc.subformat)
|
|
2964
|
+
return {
|
|
2965
|
+
status: 200,
|
|
2966
|
+
body: {
|
|
2967
|
+
resource: true,
|
|
2968
|
+
path,
|
|
2969
|
+
title: pageTitle("edit", docDisplayName(doc.frontmatter, doc.id), site.title),
|
|
2970
|
+
html,
|
|
2971
|
+
},
|
|
2972
|
+
};
|
|
2530
2973
|
const errors = [...site.errors, ...doc.errors];
|
|
2531
2974
|
return {
|
|
2532
2975
|
status: 200,
|
|
@@ -2646,7 +3089,7 @@ const handleDraft = async (req, res, save, locale) => {
|
|
|
2646
3089
|
}
|
|
2647
3090
|
}
|
|
2648
3091
|
}
|
|
2649
|
-
const draft = renderDraft(loadSite(locale), target.name, raw, fileDrafts);
|
|
3092
|
+
const draft = renderDraft(save ? loadSite(locale) : site, target.name, raw, fileDrafts);
|
|
2650
3093
|
sendJson(res, 200, { ...draft, saved: save, conflict: false, raw });
|
|
2651
3094
|
};
|
|
2652
3095
|
// Prose lint (/api/lint) = the `lint` of the doc language's adapter (language socket); languages
|
|
@@ -2675,7 +3118,9 @@ const handleCreate = async (req, res) => {
|
|
|
2675
3118
|
const name = typeof body?.name === "string" ? body.name.trim() : "";
|
|
2676
3119
|
const title = typeof body?.title === "string" ? body.title.trim() : "";
|
|
2677
3120
|
const parent = typeof body?.parent === "string" && body.parent !== "" ? body.parent : undefined;
|
|
2678
|
-
const result =
|
|
3121
|
+
const result = typeof body?.subformat === "string"
|
|
3122
|
+
? ops.addSubformat(body.subformat, title, parent)
|
|
3123
|
+
: ops.addFile(name, title, parent);
|
|
2679
3124
|
sendOp(res, isOpError(result) ? result : { ...result, path: docPath(loadSite().entries, result.id) });
|
|
2680
3125
|
};
|
|
2681
3126
|
// Add a figure (sidebar file picker / drag-and-drop). Returns the written file name
|
|
@@ -2693,27 +3138,35 @@ const handleFigure = async (req, res) => {
|
|
|
2693
3138
|
// writes icons/<id>.svg. Response icon = the new data URI (null if removed).
|
|
2694
3139
|
const handleIcon = async (req, res) => {
|
|
2695
3140
|
const body = await readJson(req);
|
|
2696
|
-
const target = resolveContentFile(body?.file);
|
|
2697
|
-
if (!target || !existsSync(target.abs)) {
|
|
2698
|
-
sendJson(res, 404, { error: "target doc not found" });
|
|
2699
|
-
return;
|
|
2700
|
-
}
|
|
2701
3141
|
const manifest = readManifest(root);
|
|
2702
3142
|
if (manifest.errors.length) {
|
|
2703
3143
|
sendJson(res, 409, { error: manifest.errors.join("\n") });
|
|
2704
3144
|
return;
|
|
2705
3145
|
}
|
|
2706
|
-
const
|
|
2707
|
-
const
|
|
2708
|
-
|
|
3146
|
+
const requestedId = typeof body?.file === "string" ? docIdOfFile(body.file) : undefined;
|
|
3147
|
+
const page = flattenTree(manifest.tree).find((node) => node.id === requestedId && node.subformat);
|
|
3148
|
+
const target = page ? undefined : resolveContentFile(body?.file);
|
|
3149
|
+
const id = page?.id ?? (target && existsSync(target.abs) ? target.id : undefined);
|
|
3150
|
+
if (!id) {
|
|
3151
|
+
sendJson(res, 404, { error: "target doc not found" });
|
|
3152
|
+
return;
|
|
3153
|
+
}
|
|
3154
|
+
const previous = docIconFile(id, manifest.files);
|
|
3155
|
+
const file = manifest.format !== "nested" &&
|
|
3156
|
+
manifest.files?.defaultLayout !== false &&
|
|
3157
|
+
!Object.hasOwn(manifest.files?.icons ?? {}, id) &&
|
|
2709
3158
|
!existsSync(textfilePath(root, previous))
|
|
2710
|
-
? defaultFilePath(`${
|
|
3159
|
+
? defaultFilePath(`${id}-icon.svg`)
|
|
2711
3160
|
: previous;
|
|
2712
3161
|
const path = textfilePath(root, file);
|
|
2713
3162
|
if (body?.data == null) {
|
|
2714
3163
|
if (existsSync(path)) {
|
|
2715
3164
|
unlinkSync(path);
|
|
2716
3165
|
}
|
|
3166
|
+
if (manifest.files?.icons && Object.hasOwn(manifest.files.icons, id)) {
|
|
3167
|
+
delete manifest.files.icons[id];
|
|
3168
|
+
writeManifest(root, manifest.tree, manifest);
|
|
3169
|
+
}
|
|
2717
3170
|
sendJson(res, 200, { ok: true, icon: null });
|
|
2718
3171
|
return;
|
|
2719
3172
|
}
|
|
@@ -2733,7 +3186,7 @@ const handleIcon = async (req, res) => {
|
|
|
2733
3186
|
if (file !== previous) {
|
|
2734
3187
|
manifest.files ??= parseFileLayout({});
|
|
2735
3188
|
manifest.files.icons ??= {};
|
|
2736
|
-
manifest.files.icons[
|
|
3189
|
+
manifest.files.icons[id] = file;
|
|
2737
3190
|
writeManifest(root, manifest.tree, manifest);
|
|
2738
3191
|
}
|
|
2739
3192
|
sendJson(res, 200, { ok: true, icon: svgDataUri(svg) });
|
|
@@ -2818,9 +3271,11 @@ const PREBUILT = {
|
|
|
2818
3271
|
"viewer/edit-client.ts": "edit.global.js",
|
|
2819
3272
|
"viewer/ui-client.ts": "ui.global.js",
|
|
2820
3273
|
"viewer/code-highlight.ts": "code.global.js",
|
|
3274
|
+
"viewer/published-plugins.ts": "plugins.global.js",
|
|
3275
|
+
"viewer/published-subformats.ts": "subformats.global.js",
|
|
2821
3276
|
};
|
|
2822
|
-
/**
|
|
2823
|
-
export const bundleClient = async (entry
|
|
3277
|
+
/** Minified client bundle shared by local viewing and published HTML. */
|
|
3278
|
+
export const bundleClient = async (entry) => {
|
|
2824
3279
|
const prebuilt = PREBUILT[entry];
|
|
2825
3280
|
if (usePrebuiltAssets && prebuilt) {
|
|
2826
3281
|
return readViewerAsset(prebuilt).toString("utf8");
|
|
@@ -2832,7 +3287,7 @@ export const bundleClient = async (entry, publish = false) => {
|
|
|
2832
3287
|
format: "iife",
|
|
2833
3288
|
target: "es2022",
|
|
2834
3289
|
write: false,
|
|
2835
|
-
|
|
3290
|
+
minify: true,
|
|
2836
3291
|
});
|
|
2837
3292
|
return out.outputFiles?.[0]?.text ?? "";
|
|
2838
3293
|
};
|
|
@@ -3056,6 +3511,17 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3056
3511
|
}
|
|
3057
3512
|
return;
|
|
3058
3513
|
}
|
|
3514
|
+
if (path === "/api/subformat") {
|
|
3515
|
+
if (!isLocalToolRequest(req.headers.host ?? "", req.headers.origin, req.headers["content-type"])) {
|
|
3516
|
+
sendJson(res, 403, {
|
|
3517
|
+
error: "Record changes require a same-origin local editor request",
|
|
3518
|
+
});
|
|
3519
|
+
return;
|
|
3520
|
+
}
|
|
3521
|
+
const result = subformatResponse(root, await readJson(req));
|
|
3522
|
+
sendJson(res, result.status, result.body);
|
|
3523
|
+
return;
|
|
3524
|
+
}
|
|
3059
3525
|
if (path === "/api/code-file") {
|
|
3060
3526
|
if (!isLocalToolRequest(req.headers.host ?? "", req.headers.origin, req.headers["content-type"])) {
|
|
3061
3527
|
sendJson(res, 403, {
|
|
@@ -3104,7 +3570,9 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3104
3570
|
const grammar = siteLanguages.codeGrammars?.find((entry) => entry.name === extension || entry.aliases?.includes(extension));
|
|
3105
3571
|
const language = existsSync(join(root, ".dooc/editor-tools", `${extension}.json`))
|
|
3106
3572
|
? extension
|
|
3107
|
-
: (
|
|
3573
|
+
: (readManifest(root).subformats?.find((config) => config.ext === extension)?.format ??
|
|
3574
|
+
grammar?.name ??
|
|
3575
|
+
extension);
|
|
3108
3576
|
const result = await validateTextfileCode(root, language, input.content);
|
|
3109
3577
|
for (const message of textfilePreviewErrors(loadSite(locale), input.file, result.content))
|
|
3110
3578
|
result.findings.push({
|
|
@@ -3202,6 +3670,26 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3202
3670
|
await handleCreate(req, res);
|
|
3203
3671
|
return;
|
|
3204
3672
|
}
|
|
3673
|
+
if (path === "/api/subformat-page") {
|
|
3674
|
+
if (!isLocalToolRequest(req.headers.host ?? "", req.headers.origin, req.headers["content-type"])) {
|
|
3675
|
+
sendJson(res, 403, {
|
|
3676
|
+
error: "Page changes require a same-origin local editor request",
|
|
3677
|
+
});
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
const body = await readJson(req);
|
|
3681
|
+
const id = typeof body?.id === "string" ? body.id : "";
|
|
3682
|
+
if (!loadSite().entries.some((entry) => entry.id === id && entry.subformat)) {
|
|
3683
|
+
sendJson(res, 404, { error: "Subformat page not found" });
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3686
|
+
sendOp(res, body?.action === "delete"
|
|
3687
|
+
? ops.remove(id)
|
|
3688
|
+
: body?.action === "rename" && typeof body.title === "string"
|
|
3689
|
+
? ops.renameSubformat(id, body.title)
|
|
3690
|
+
: { status: 400, error: "Unknown page action" });
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3205
3693
|
if (path === "/api/icon") {
|
|
3206
3694
|
await handleIcon(req, res);
|
|
3207
3695
|
return;
|
|
@@ -3239,7 +3727,9 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3239
3727
|
}
|
|
3240
3728
|
const site = loadSite(locale);
|
|
3241
3729
|
if (req.method === "GET" && path === "/api/search") {
|
|
3242
|
-
sendJson(res, 200, searchIndex(site
|
|
3730
|
+
sendJson(res, 200, searchIndex(site, mode === "edit"
|
|
3731
|
+
? (site.filePaths ?? filesSnapshot(root).files.map((file) => file.path))
|
|
3732
|
+
: []));
|
|
3243
3733
|
return;
|
|
3244
3734
|
}
|
|
3245
3735
|
// edit-mode-only APIs (used by edit-client.ts). handle() strips the query from path, so
|
|
@@ -3296,6 +3786,7 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3296
3786
|
}
|
|
3297
3787
|
if ((mode === "edit" &&
|
|
3298
3788
|
(path === "/_extensions" ||
|
|
3789
|
+
path === "/_subformats" ||
|
|
3299
3790
|
path === "/_git" ||
|
|
3300
3791
|
path === "/_statics" ||
|
|
3301
3792
|
path.startsWith("/_statics/") ||
|
|
@@ -3304,7 +3795,7 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3304
3795
|
path === "/_files/terms") {
|
|
3305
3796
|
const rest = path.startsWith("/_statics")
|
|
3306
3797
|
? path.slice(1)
|
|
3307
|
-
: ["/_git", "/_extensions"].includes(path)
|
|
3798
|
+
: ["/_git", "/_extensions", "/_subformats"].includes(path)
|
|
3308
3799
|
? path.slice(1)
|
|
3309
3800
|
: requestUrl.pathname.slice("/_files".length).replace(/^\/|\/$/g, "");
|
|
3310
3801
|
const page = resourcesMain(site, rest);
|
|
@@ -3313,7 +3804,8 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3313
3804
|
return;
|
|
3314
3805
|
}
|
|
3315
3806
|
const editor = mode === "edit"
|
|
3316
|
-
? (site.entries.find((entry) => entry.
|
|
3807
|
+
? (site.entries.find((entry) => !entry.subformat &&
|
|
3808
|
+
entry.id === requestUrl.searchParams.get("editor")) ?? site.entries.find((entry) => !entry.subformat))
|
|
3317
3809
|
: undefined;
|
|
3318
3810
|
if (editor) {
|
|
3319
3811
|
const { aside, boot } = editorAside(editor, site);
|
|
@@ -3338,7 +3830,7 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3338
3830
|
sendPage(res, mode, site, { ...page, currentRes: rest });
|
|
3339
3831
|
return;
|
|
3340
3832
|
}
|
|
3341
|
-
const id = resolveDocPath(site.entries,
|
|
3833
|
+
const id = resolveDocPath(site.entries, requestUrl.pathname);
|
|
3342
3834
|
const doc = site.entries.find((e) => e.id === id);
|
|
3343
3835
|
if (!doc) {
|
|
3344
3836
|
notFound(res, path);
|
|
@@ -3349,9 +3841,28 @@ export const startServer = async (mode, port = 5179, pluginModule, startup) => {
|
|
|
3349
3841
|
main: entryMain(site, doc),
|
|
3350
3842
|
currentId: doc.id,
|
|
3351
3843
|
};
|
|
3352
|
-
if (mode === "edit") {
|
|
3844
|
+
if (mode === "edit" && !doc.subformat) {
|
|
3353
3845
|
Object.assign(opts, editorAside(doc, site));
|
|
3354
3846
|
}
|
|
3847
|
+
if (mode === "edit" && doc.subformat) {
|
|
3848
|
+
const editor = site.entries.find((entry) => !entry.subformat);
|
|
3849
|
+
if (editor) {
|
|
3850
|
+
const { aside, boot } = editorAside(editor, site);
|
|
3851
|
+
Object.assign(opts, {
|
|
3852
|
+
aside,
|
|
3853
|
+
main: entryMain(site, editor),
|
|
3854
|
+
currentRes: path,
|
|
3855
|
+
boot: {
|
|
3856
|
+
...boot,
|
|
3857
|
+
resource: {
|
|
3858
|
+
path,
|
|
3859
|
+
title: pageTitle(mode, opts.title, site.title),
|
|
3860
|
+
html: entryMain(site, doc),
|
|
3861
|
+
},
|
|
3862
|
+
},
|
|
3863
|
+
});
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3355
3866
|
sendPage(res, mode, site, opts);
|
|
3356
3867
|
};
|
|
3357
3868
|
const server = createServer((req, res) => {
|