@dooc-dev/dooc 0.0.4 → 0.0.6
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 +157 -58
- package/dist/code-worker.global.js +152 -0
- package/dist/code.global.js +101 -101
- 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 +17 -5
- package/dist/compiler/check.js +10 -5
- package/dist/compiler/code-languages.js +7 -2
- package/dist/compiler/compile.d.ts +5 -0
- package/dist/compiler/compile.js +117 -12
- package/dist/compiler/config.js +2 -1
- package/dist/compiler/dxf.d.ts +1 -0
- package/dist/compiler/dxf.js +81 -0
- package/dist/compiler/export.d.ts +4 -0
- package/dist/compiler/export.js +147 -0
- package/dist/compiler/figures.js +43 -10
- package/dist/compiler/files.js +82 -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 +5 -0
- package/dist/compiler/ignored-files.js +98 -0
- package/dist/compiler/locales.js +13 -8
- package/dist/compiler/ops.d.ts +6 -0
- package/dist/compiler/ops.js +99 -8
- package/dist/compiler/subformat-schema.d.ts +14 -0
- package/dist/compiler/subformat-schema.js +92 -0
- package/dist/compiler/subformats.d.ts +22 -0
- package/dist/compiler/subformats.js +339 -0
- package/dist/compiler/textfile.js +3 -0
- package/dist/compiler/theme-variants.js +5 -2
- package/dist/core/code-file.js +7 -5
- package/dist/core/code-grammars.d.ts +5 -0
- package/dist/core/code-grammars.js +34 -0
- package/dist/core/content-metadata.d.ts +16 -6
- package/dist/core/content-metadata.js +283 -17
- package/dist/core/content-types.d.ts +4 -2
- package/dist/core/escape-html.d.ts +1 -0
- package/dist/core/escape-html.js +1 -0
- package/dist/core/figure-frame.js +20 -2
- package/dist/core/file-embed.js +7 -3
- 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.d.ts +4 -1
- package/dist/core/html.js +11 -10
- 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/language.js +5 -2
- package/dist/core/markdown.js +3 -1
- package/dist/core/previewers.d.ts +8 -0
- package/dist/core/previewers.js +2 -0
- package/dist/core/routing.d.ts +5 -2
- package/dist/core/routing.js +17 -5
- package/dist/core/schema-fields.d.ts +13 -0
- package/dist/core/schema-fields.js +175 -0
- package/dist/core/schema-graph-mount.js +26 -3
- package/dist/core/schema-refs.d.ts +8 -0
- package/dist/core/schema-refs.js +82 -0
- 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 +26 -24
- package/dist/edit.global.js +326 -118
- package/dist/flow.global.js +3 -3
- package/dist/graph/abnfDiagram-S7VZAUFO-ASBULSKE.js +1 -0
- package/dist/graph/architecture-WOLXFQ4H-V57EDXXY.js +1 -0
- package/dist/graph/architectureDiagram-YGSQEFNW-GIMP347N.js +36 -0
- package/dist/graph/blockDiagram-APKKGZFW-RDL2T4JW.js +140 -0
- package/dist/graph/bpmnIcons-APHXDYXF-TWOSQNUQ.js +1 -0
- package/dist/graph/c4Diagram-KJ2TOQU5-75LIUC4F.js +38 -0
- package/dist/graph/chunk-26TUJSYJ.js +1 -0
- package/dist/graph/chunk-3LU66YMI.js +1 -0
- package/dist/graph/chunk-3RNHDNP5.js +1 -0
- package/dist/graph/chunk-3Y2PDVDE.js +1 -0
- package/dist/graph/chunk-3YJHMOOA.js +3 -0
- package/dist/graph/chunk-4KILFWYV.js +339 -0
- package/dist/graph/chunk-4QDE4SUK.js +1 -0
- package/dist/graph/chunk-5OO6DATX.js +1 -0
- package/dist/graph/chunk-5UUEAHTN.js +1 -0
- package/dist/graph/chunk-6T55RVVR.js +1 -0
- package/dist/graph/chunk-ARAJTKOH.js +2 -0
- package/dist/graph/chunk-BBD5CEDC.js +72 -0
- package/dist/graph/chunk-BVXT562I.js +1 -0
- package/dist/graph/chunk-BZAMCJ6B.js +32 -0
- package/dist/graph/chunk-C6J4A356.js +15 -0
- package/dist/graph/chunk-EG5UVNOC.js +213 -0
- package/dist/graph/chunk-GF4TOPUK.js +1 -0
- package/dist/graph/chunk-GYT4IYBZ.js +1 -0
- package/dist/graph/chunk-HJG2HUYJ.js +88 -0
- package/dist/graph/chunk-HOPPTA6H.js +62 -0
- package/dist/graph/chunk-I3DMZIHV.js +1 -0
- package/dist/graph/chunk-IC23EEF6.js +1 -0
- package/dist/graph/chunk-ISO77HML.js +1 -0
- package/dist/graph/chunk-JD7ZBJD2.js +1 -0
- package/dist/graph/chunk-JRSH5GNS.js +1 -0
- package/dist/graph/chunk-JSHWCPFJ.js +1 -0
- package/dist/graph/chunk-K2KLZU7M.js +10 -0
- package/dist/graph/chunk-K4I76XBX.js +14 -0
- package/dist/graph/chunk-KT4VPQD5.js +135 -0
- package/dist/graph/chunk-KU6GTEMS.js +1 -0
- package/dist/graph/chunk-LT6LXKCR.js +136 -0
- package/dist/graph/chunk-MPR575IN.js +1 -0
- package/dist/graph/chunk-N3OHKGRZ.js +1 -0
- package/dist/graph/chunk-O656ZI37.js +1 -0
- package/dist/graph/chunk-OFZLK5G4.js +1 -0
- package/dist/graph/chunk-PDH25ALM.js +2 -0
- package/dist/graph/chunk-PW2RGZ3O.js +1 -0
- package/dist/graph/chunk-QCJUF4YA.js +1 -0
- package/dist/graph/chunk-QEEA3KYY.js +2 -0
- package/dist/graph/chunk-QYAXYFNI.js +1 -0
- package/dist/graph/chunk-QYTM6GY3.js +1 -0
- package/dist/graph/chunk-R63JUMUK.js +1 -0
- package/dist/graph/chunk-SCEY3ZPT.js +1 -0
- package/dist/graph/chunk-VM2H7G2R.js +1 -0
- package/dist/graph/chunk-XQS73SBQ.js +1 -0
- package/dist/graph/chunk-YCRLJT2S.js +1 -0
- package/dist/graph/chunk-Z4FIZ7CR.js +1 -0
- package/dist/graph/chunk-ZMCB7VP2.js +1 -0
- package/dist/graph/chunk-ZSZXN4BT.js +2 -0
- package/dist/graph/classDiagram-v2-L25IHNXF-JL7LVDZH.js +217 -0
- package/dist/graph/cose-bilkent-JH36ORCC-PNM3EYPB.js +1 -0
- package/dist/graph/cynefin-EF2NZ3EQ-PSXP3DXL.js +1 -0
- package/dist/graph/cynefinDiagram-L36ESFBY-QVY54CXO.js +62 -0
- package/dist/graph/dagre-SPEB5RXH-HPGQXBZJ.js +4 -0
- package/dist/graph/diagram-3B7GL73J-DWH5WS2P.js +200 -0
- package/dist/graph/diagram-DNEMPZML-TEGH2U5I.js +24 -0
- package/dist/graph/diagram-L3MUGCDN-X4MREUWR.js +41 -0
- package/dist/graph/diagram-LA4NIPWU-NXT746HG.js +24 -0
- package/dist/graph/diagram-MHCOC4E2-JGHXSAGS.js +3 -0
- package/dist/graph/diagram-XPFHEONP-ZHZPBLT4.js +30 -0
- package/dist/graph/ebnfDiagram-UZSYDL2S-SMF6KJ43.js +1 -0
- package/dist/graph/elk-XV6XMXQE-AZ4HLCWI.js +27 -0
- package/dist/graph/erDiagram-EYBAPDEH-B3JNJ357.js +99 -0
- package/dist/graph/eventmodeling-K75KTNOO-WG6DDYMC.js +1 -0
- package/dist/graph/flowDiagram-MALGAFMO-2R7EYAQI.js +1 -0
- package/dist/graph/ganttDiagram-23REXITY-YXBYWFOJ.js +292 -0
- package/dist/graph/gitGraph-VSP46ZUC-VBFWJBBT.js +1 -0
- package/dist/graph/gitGraphDiagram-STJD7YCW-4FZDCFGV.js +106 -0
- package/dist/graph/info-OHQRW6UA-ALVDUVYV.js +1 -0
- package/dist/graph/infoDiagram-KBXO4MBG-7EHX2GQG.js +2 -0
- package/dist/graph/ishikawaDiagram-M35NCXHK-FRZD2PWQ.js +70 -0
- package/dist/graph/journeyDiagram-OPLOXDXO-7Z66JCPR.js +139 -0
- package/dist/graph/kanban-definition-BZKZHSQY-NN5AIKTE.js +89 -0
- package/dist/graph/katex-DXDNVO6V.js +257 -0
- package/dist/graph/mindmap-definition-I2QAS2VK-HDPCABN2.js +98 -0
- package/dist/graph/packet-JDAUHWVQ-5MQIBWAH.js +1 -0
- package/dist/graph/pegDiagram-FD4XPPHP-H2BFNCKT.js +1 -0
- package/dist/graph/pie-XZMESJXO-T5VRKHVT.js +1 -0
- package/dist/graph/pieDiagram-J4AKIIQI-O3NJSVD3.js +39 -0
- package/dist/graph/quadrantDiagram-XTYBLID2-TMTZJI3P.js +7 -0
- package/dist/graph/radar-ABXABTNO-C6FXIBYW.js +1 -0
- package/dist/graph/railroad-I3PHUGI6-ZSO5JXB3.js +1 -0
- package/dist/graph/railroad-abnf-LNEFI6M7-CI4GQRHB.js +1 -0
- package/dist/graph/railroad-ebnf-DWYD2UWJ-MUENNCGK.js +1 -0
- package/dist/graph/railroad-peg-JR7BVNR7-N3X5GGIX.js +1 -0
- package/dist/graph/railroadDiagram-MRQ6NCDL-JHWS23UO.js +1 -0
- package/dist/graph/requirementDiagram-Y7LWUY3S-7DVLPO4B.js +84 -0
- package/dist/graph/sankeyDiagram-WGJFYUXA-Z5L4R5TR.js +40 -0
- package/dist/graph/schema-graph-global.js +639 -0
- package/dist/graph/sequenceDiagram-5NDRBG5M-RCTU25NT.js +169 -0
- package/dist/graph/sizeCapture-INFHLROL-RROY32P5.js +1 -0
- package/dist/graph/stateDiagram-v2-FJ4FJNEA-BXUSPWDK.js +291 -0
- package/dist/graph/swimlanes-UMQ2AFYF-LDD74Q2S.js +1 -0
- package/dist/graph/swimlanesDiagram-OMPLPG4O-ZYULLJSU.js +8 -0
- package/dist/graph/timeline-definition-SEUHKTQE-ZQSMIVAS.js +120 -0
- package/dist/graph/treeView-D4JQ5SDB-42S7U73N.js +1 -0
- package/dist/graph/treemap-SAJKECNS-RUBYQ7XF.js +1 -0
- package/dist/graph/usecaseDiagram-AFA6YXN4-57RDRYXF.js +370 -0
- package/dist/graph/vennDiagram-NNMJR3RB-5C3LVAV6.js +34 -0
- package/dist/graph/wardley-7MLQ67FV-NV5HXTTC.js +1 -0
- package/dist/graph/wardleyDiagram-S7YFUSEH-6D5BKXHM.js +78 -0
- package/dist/graph/xychartDiagram-GGNKY7IX-6ET3ZM67.js +7 -0
- package/dist/mcp.js +54 -12
- 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 +95 -0
- package/dist/subformats.global.js +21 -0
- package/dist/ui.global.js +80 -60
- package/dist/viewer/build-plugins.d.ts +7 -0
- package/dist/viewer/build-plugins.js +70 -0
- package/dist/viewer/build.d.ts +11 -0
- package/dist/viewer/build.js +52 -11
- package/dist/viewer/code-file.js +7 -2
- package/dist/viewer/editor-tools.d.ts +7 -7
- package/dist/viewer/editor-tools.js +36 -5
- package/dist/viewer/figure-preview.d.ts +4 -0
- package/dist/viewer/figure-preview.js +54 -0
- 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 +8 -4
- 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-preview.d.ts +2 -0
- package/dist/viewer/lazy-preview.js +43 -0
- package/dist/viewer/locales/eng.json +95 -10
- package/dist/viewer/locales/jpn.json +96 -11
- package/dist/viewer/locales/zho.json +96 -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-blocks.js +1 -1
- package/dist/viewer/plugin-style.d.ts +1 -0
- package/dist/viewer/plugin-style.js +82 -0
- package/dist/viewer/plugins.js +1 -1
- package/dist/viewer/resize.d.ts +0 -2
- package/dist/viewer/resize.js +2 -98
- package/dist/viewer/resource-library.d.ts +11 -9
- package/dist/viewer/resource-library.js +181 -31
- package/dist/viewer/search.d.ts +4 -2
- package/dist/viewer/search.js +252 -53
- package/dist/viewer/serve.d.ts +11 -5
- package/dist/viewer/serve.js +913 -295
- package/dist/viewer/site-icon.js +13 -6
- package/dist/viewer/site-title.js +15 -2
- package/dist/viewer/textfile.d.ts +5 -0
- package/dist/viewer/textfile.js +34 -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 +27 -10
- package/dist/compiler/bundle.d.ts +0 -2
- package/dist/compiler/bundle.js +0 -100
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Load enhancement scripts only when their content is near the viewport. */
|
|
2
|
+
export const loadPreviewScript = (src, selector, type = "") => {
|
|
3
|
+
const root = document.querySelector("main") ?? document.body;
|
|
4
|
+
let requested = false;
|
|
5
|
+
const load = () => {
|
|
6
|
+
if (requested)
|
|
7
|
+
return;
|
|
8
|
+
requested = true;
|
|
9
|
+
const script = document.createElement("script");
|
|
10
|
+
script.type = type;
|
|
11
|
+
script.src = src;
|
|
12
|
+
script.onload = () => {
|
|
13
|
+
observer.disconnect();
|
|
14
|
+
visibility.disconnect();
|
|
15
|
+
pending.clear();
|
|
16
|
+
};
|
|
17
|
+
script.onerror = () => {
|
|
18
|
+
script.remove();
|
|
19
|
+
requested = false;
|
|
20
|
+
};
|
|
21
|
+
document.head.append(script);
|
|
22
|
+
};
|
|
23
|
+
const pending = new Set();
|
|
24
|
+
const visibility = new IntersectionObserver((entries) => {
|
|
25
|
+
if (entries.some((entry) => entry.isIntersecting && root.contains(entry.target)))
|
|
26
|
+
load();
|
|
27
|
+
}, { rootMargin: "200px" });
|
|
28
|
+
const watch = () => {
|
|
29
|
+
for (const node of pending)
|
|
30
|
+
if (!root.contains(node)) {
|
|
31
|
+
visibility.unobserve(node);
|
|
32
|
+
pending.delete(node);
|
|
33
|
+
}
|
|
34
|
+
for (const node of root.querySelectorAll(selector))
|
|
35
|
+
if (!pending.has(node)) {
|
|
36
|
+
pending.add(node);
|
|
37
|
+
visibility.observe(node);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const observer = new MutationObserver(watch);
|
|
41
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
42
|
+
watch();
|
|
43
|
+
};
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"Save (Ctrl+S)": "Save (Ctrl+S)",
|
|
36
36
|
"View settings": "View settings",
|
|
37
37
|
"Auto save": "Auto save",
|
|
38
|
+
"Wrap lines": "Wrap lines",
|
|
38
39
|
"Front-matter fields": "Front-matter fields",
|
|
39
40
|
"title": "title",
|
|
40
41
|
"desc": "desc",
|
|
@@ -153,9 +154,14 @@
|
|
|
153
154
|
"{count} results": "{count} results",
|
|
154
155
|
"Showing {shown} of {count} results": "Showing {shown} of {count} results",
|
|
155
156
|
"Add translation": "Add translation",
|
|
156
|
-
"Folder": "Folder",
|
|
157
157
|
"Move search": "Move search",
|
|
158
158
|
"Resize search": "Resize search",
|
|
159
|
+
"Matches text": "Matches text",
|
|
160
|
+
"Matches file name": "Matches file name",
|
|
161
|
+
"Matches folder name": "Matches folder name",
|
|
162
|
+
"Close search": "Close search",
|
|
163
|
+
"Move search to sidebar": "Move search to sidebar",
|
|
164
|
+
"Float search": "Float search",
|
|
159
165
|
"Notice": "Notice",
|
|
160
166
|
"OK": "OK",
|
|
161
167
|
"Discard changes": "Discard changes",
|
|
@@ -212,16 +218,21 @@
|
|
|
212
218
|
"File details": "File details",
|
|
213
219
|
"Show Git changes": "Show Git changes",
|
|
214
220
|
"Resource views": "Resource views",
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
221
|
+
"Default": "Default",
|
|
222
|
+
"Set as default": "Set as default",
|
|
223
|
+
"Group by": "Group by",
|
|
224
|
+
"Sort by": "Sort by",
|
|
225
|
+
"Newest first": "Newest first",
|
|
226
|
+
"Oldest first": "Oldest first",
|
|
227
|
+
"Unassigned": "Unassigned",
|
|
228
|
+
"Records": "Records",
|
|
229
|
+
"Codeblocks": "Codeblocks",
|
|
230
|
+
"Format": "Format",
|
|
218
231
|
"URLs": "URLs",
|
|
232
|
+
"URL previews": "URL previews",
|
|
219
233
|
"Domain": "Domain",
|
|
220
234
|
"All": "All",
|
|
221
235
|
"references": "references",
|
|
222
|
-
"Definitions from term files and Markdown": "Definitions from term files and Markdown",
|
|
223
|
-
"Code blocks collected from Markdown files": "Code blocks collected from Markdown files",
|
|
224
|
-
"External links and embeds with their source locations": "External links and embeds with their source locations",
|
|
225
236
|
"Search resources": "Search resources",
|
|
226
237
|
"Files with errors": "Files with errors",
|
|
227
238
|
"No matching resources": "No matching resources",
|
|
@@ -281,14 +292,21 @@
|
|
|
281
292
|
"Restore stash": "Restore stash",
|
|
282
293
|
"Stash changes": "Stash changes",
|
|
283
294
|
"Statics": "Statics",
|
|
295
|
+
"Subformats": "Subformats",
|
|
296
|
+
"Expand card": "Expand card",
|
|
297
|
+
"Collapse card": "Collapse card",
|
|
298
|
+
"View details": "View details",
|
|
299
|
+
"Click for details; double-click to edit": "Click for details; double-click to edit",
|
|
300
|
+
"No grouping": "No grouping",
|
|
301
|
+
"Ascending": "Ascending",
|
|
302
|
+
"Descending": "Descending",
|
|
303
|
+
"No subformats configured. Add subformats to dooc.yaml.": "No subformats configured. Add subformats to dooc.yaml.",
|
|
284
304
|
"Workspace tools": "Workspace tools",
|
|
285
|
-
"Resize workspace tools": "Resize workspace tools",
|
|
286
305
|
"Git controls": "Git controls",
|
|
287
306
|
"Actions": "Actions",
|
|
288
307
|
"Updated": "Updated",
|
|
289
308
|
"Copy": "Copy",
|
|
290
309
|
"Edit": "Edit",
|
|
291
|
-
"Saving…": "Saving…",
|
|
292
310
|
"Reload actions before saving again.": "Reload actions before saving again.",
|
|
293
311
|
"Saved, but refresh failed. Reload actions before saving again.": "Saved, but refresh failed. Reload actions before saving again.",
|
|
294
312
|
"Actions could not be loaded.": "Actions could not be loaded.",
|
|
@@ -315,5 +333,72 @@
|
|
|
315
333
|
"Sign out": "Sign out",
|
|
316
334
|
"Not signed in": "Not signed in",
|
|
317
335
|
"Continue login": "Continue login",
|
|
318
|
-
"Provided by viewer": "Provided by viewer"
|
|
336
|
+
"Provided by viewer": "Provided by viewer",
|
|
337
|
+
"Added": "Added",
|
|
338
|
+
"Modified": "Modified",
|
|
339
|
+
"Add subformat…": "Add subformat…",
|
|
340
|
+
"Delete": "Delete",
|
|
341
|
+
"Delete subformat {ext} and its sidebar page? Records and schema files will be kept.": "Delete subformat {ext} and its sidebar page? Records and schema files will be kept.",
|
|
342
|
+
"Subformat changed externally. Reload and try again.": "Subformat changed externally. Reload and try again.",
|
|
343
|
+
"Move or remove this subformat page's child pages before deleting it.": "Move or remove this subformat page's child pages before deleting it.",
|
|
344
|
+
"Add subformat": "Add subformat",
|
|
345
|
+
"Extension": "Extension",
|
|
346
|
+
"Storage format": "Storage format",
|
|
347
|
+
"Schema file (optional)": "Schema file (optional)",
|
|
348
|
+
"Create automatically": "Create automatically",
|
|
349
|
+
"Form": "Form",
|
|
350
|
+
"Enter a valid number.": "Enter a valid number.",
|
|
351
|
+
"Value editing mode": "Value editing mode",
|
|
352
|
+
"{format} text": "{format} text",
|
|
353
|
+
"Schema editing mode": "Schema editing mode",
|
|
354
|
+
"JSON text": "JSON text",
|
|
355
|
+
"Build kit": "Build kit",
|
|
356
|
+
"Field settings": "Field settings",
|
|
357
|
+
"Field name": "Field name",
|
|
358
|
+
"New field name": "New field name",
|
|
359
|
+
"New field type": "New field type",
|
|
360
|
+
"Remove field": "Remove field",
|
|
361
|
+
"Add field": "Add field",
|
|
362
|
+
"Required": "Required",
|
|
363
|
+
"Allow extra fields": "Allow extra fields",
|
|
364
|
+
"Schema settings": "Schema settings",
|
|
365
|
+
"Remove nested fields before changing the type.": "Remove nested fields before changing the type.",
|
|
366
|
+
"Any type": "Any type",
|
|
367
|
+
"One choice per line. Use \"\" for empty text, \"a\\nb\" for multiline text, and JSON for other types.": "One choice per line. Use \"\" for empty text, \"a\\nb\" for multiline text, and JSON for other types.",
|
|
368
|
+
"Enter at least one choice.": "Enter at least one choice.",
|
|
369
|
+
"Enter a non-empty JSON array of schemas.": "Enter a non-empty JSON array of schemas.",
|
|
370
|
+
"Enter a JSON schema object or boolean.": "Enter a JSON schema object or boolean.",
|
|
371
|
+
"Enter an object containing named schemas.": "Enter an object containing named schemas.",
|
|
372
|
+
"The constant must match the field type.": "The constant must match the field type.",
|
|
373
|
+
"Change existing choices or defaults before changing the type.": "Change existing choices or defaults before changing the type.",
|
|
374
|
+
"Choices (one per line)": "Choices (one per line)",
|
|
375
|
+
"Item type": "Item type",
|
|
376
|
+
"Rename linked fields in JSON text.": "Rename linked fields in JSON text.",
|
|
377
|
+
"Additional rules are preserved in JSON text.": "Additional rules are preserved in JSON text.",
|
|
378
|
+
"Enter a field name.": "Enter a field name.",
|
|
379
|
+
"Enter a unique field name.": "Enter a unique field name.",
|
|
380
|
+
"A field with this name already exists.": "A field with this name already exists.",
|
|
381
|
+
"Each choice must match the field type.": "Each choice must match the field type.",
|
|
382
|
+
"Choices must be unique.": "Choices must be unique.",
|
|
383
|
+
"Enter a value greater than {minimum}.": "Enter a value greater than {minimum}.",
|
|
384
|
+
"Page type": "Page type",
|
|
385
|
+
"Markdown page": "Markdown page",
|
|
386
|
+
"No subformats available to add.": "No subformats available to add.",
|
|
387
|
+
"Add page": "Add page",
|
|
388
|
+
"Remove page": "Remove page",
|
|
389
|
+
"Rename page": "Rename page",
|
|
390
|
+
"Remove this page from the sidebar? The records will be kept.": "Remove this page from the sidebar? The records will be kept.",
|
|
391
|
+
"Parameters": "Parameters",
|
|
392
|
+
"Items": "Items",
|
|
393
|
+
"Remove parameter": "Remove parameter",
|
|
394
|
+
"Check the parameter value.": "Check the parameter value.",
|
|
395
|
+
"Download PDF": "Download PDF",
|
|
396
|
+
"Choose date": "Choose date",
|
|
397
|
+
"Previous month": "Previous month",
|
|
398
|
+
"Next month": "Next month",
|
|
399
|
+
"Today": "Today",
|
|
400
|
+
"Clear": "Clear",
|
|
401
|
+
"Enter a valid date (YYYY-MM-DD).": "Enter a valid date (YYYY-MM-DD).",
|
|
402
|
+
"Load preview": "Load preview",
|
|
403
|
+
"Preview unavailable": "Preview unavailable"
|
|
319
404
|
}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"Save (Ctrl+S)": "保存(Ctrl+S)",
|
|
36
36
|
"View settings": "表示設定",
|
|
37
37
|
"Auto save": "自動保存",
|
|
38
|
+
"Wrap lines": "折り返す",
|
|
38
39
|
"Front-matter fields": "文書の属性を表示",
|
|
39
40
|
"title": "タイトル",
|
|
40
41
|
"desc": "説明",
|
|
@@ -153,9 +154,14 @@
|
|
|
153
154
|
"{count} results": "{count} 件",
|
|
154
155
|
"Showing {shown} of {count} results": "{count} 件中 {shown} 件を表示",
|
|
155
156
|
"Add translation": "翻訳用の文書を追加",
|
|
156
|
-
"Folder": "フォルダー",
|
|
157
157
|
"Move search": "検索窓を移動",
|
|
158
158
|
"Resize search": "検索窓のサイズを変更",
|
|
159
|
+
"Matches text": "本文に一致",
|
|
160
|
+
"Matches file name": "ファイル名に一致",
|
|
161
|
+
"Matches folder name": "フォルダー名に一致",
|
|
162
|
+
"Close search": "検索窓を閉じる",
|
|
163
|
+
"Move search to sidebar": "検索窓をサイドバーに置く",
|
|
164
|
+
"Float search": "検索窓をフロートにする",
|
|
159
165
|
"Notice": "お知らせ",
|
|
160
166
|
"OK": "閉じる",
|
|
161
167
|
"Discard changes": "変更を破棄",
|
|
@@ -212,16 +218,21 @@
|
|
|
212
218
|
"File details": "ファイル情報",
|
|
213
219
|
"Show Git changes": "Git差分を表示",
|
|
214
220
|
"Resource views": "リソースの表示",
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
221
|
+
"Default": "既定値",
|
|
222
|
+
"Set as default": "既定値にする",
|
|
223
|
+
"Group by": "グループ化",
|
|
224
|
+
"Sort by": "並べ替え",
|
|
225
|
+
"Newest first": "新しい順",
|
|
226
|
+
"Oldest first": "古い順",
|
|
227
|
+
"Unassigned": "未設定",
|
|
228
|
+
"Records": "レコード",
|
|
229
|
+
"Codeblocks": "コードブロック",
|
|
230
|
+
"Format": "形式",
|
|
231
|
+
"URLs": "URL",
|
|
232
|
+
"URL previews": "URLプレビュー",
|
|
219
233
|
"Domain": "ドメイン",
|
|
220
234
|
"All": "すべて",
|
|
221
235
|
"references": "か所で使用",
|
|
222
|
-
"Definitions from term files and Markdown": "用語ファイルとMarkdown内の定義を横断して探せます",
|
|
223
|
-
"Code blocks collected from Markdown files": "Markdown内のコードを、言語や内容から探せます",
|
|
224
|
-
"External links and embeds with their source locations": "外部リンク・埋め込みURLと、その使用箇所を確認できます",
|
|
225
236
|
"Search resources": "リソースを検索",
|
|
226
237
|
"Files with errors": "読み取り・解析エラー",
|
|
227
238
|
"No matching resources": "該当するリソースはありません",
|
|
@@ -281,14 +292,21 @@
|
|
|
281
292
|
"Restore stash": "stashを復元",
|
|
282
293
|
"Stash changes": "変更をstashへ退避",
|
|
283
294
|
"Statics": "Statics",
|
|
295
|
+
"Subformats": "Subformats",
|
|
296
|
+
"Expand card": "カードを展開",
|
|
297
|
+
"Collapse card": "カードを折りたたむ",
|
|
298
|
+
"View details": "詳細を表示",
|
|
299
|
+
"Click for details; double-click to edit": "クリックで詳細、ダブルクリックで編集",
|
|
300
|
+
"No grouping": "グループ化なし",
|
|
301
|
+
"Ascending": "昇順",
|
|
302
|
+
"Descending": "降順",
|
|
303
|
+
"No subformats configured. Add subformats to dooc.yaml.": "subformat が未設定です。dooc.yaml に subformats を追加してください。",
|
|
284
304
|
"Workspace tools": "ワークスペース操作",
|
|
285
|
-
"Resize workspace tools": "下部カードの高さを変更",
|
|
286
305
|
"Git controls": "Git操作",
|
|
287
306
|
"Actions": "操作",
|
|
288
307
|
"Updated": "更新しました",
|
|
289
308
|
"Copy": "コピー",
|
|
290
309
|
"Edit": "編集",
|
|
291
|
-
"Saving…": "保存中…",
|
|
292
310
|
"Reload actions before saving again.": "再保存する前に再読み込みしてください。",
|
|
293
311
|
"Saved, but refresh failed. Reload actions before saving again.": "保存は完了しましたが、再取得に失敗しました。再保存する前に再読み込みしてください。",
|
|
294
312
|
"Actions could not be loaded.": "操作を取得できませんでした。",
|
|
@@ -315,5 +333,72 @@
|
|
|
315
333
|
"Sign out": "ログアウト",
|
|
316
334
|
"Not signed in": "未ログイン",
|
|
317
335
|
"Continue login": "ログインを続ける",
|
|
318
|
-
"Provided by viewer": "開発用プラグイン"
|
|
336
|
+
"Provided by viewer": "開発用プラグイン",
|
|
337
|
+
"Added": "新規",
|
|
338
|
+
"Modified": "変更",
|
|
339
|
+
"Add subformat…": "subformatを追加…",
|
|
340
|
+
"Delete": "削除",
|
|
341
|
+
"Delete subformat {ext} and its sidebar page? Records and schema files will be kept.": "subformat {ext} とサイドバーのページを削除しますか? レコードとスキーマファイルは保持されます。",
|
|
342
|
+
"Subformat changed externally. Reload and try again.": "subformatが外部で変更されました。再読み込みしてやり直してください。",
|
|
343
|
+
"Move or remove this subformat page's child pages before deleting it.": "削除する前に、このsubformatページの子ページを移動または削除してください。",
|
|
344
|
+
"Add subformat": "subformatを追加",
|
|
345
|
+
"Extension": "拡張子",
|
|
346
|
+
"Storage format": "保存形式",
|
|
347
|
+
"Schema file (optional)": "スキーマファイル(任意)",
|
|
348
|
+
"Create automatically": "自動作成",
|
|
349
|
+
"Form": "フォーム",
|
|
350
|
+
"Enter a valid number.": "有効な数値を入力してください。",
|
|
351
|
+
"Value editing mode": "値の編集モード",
|
|
352
|
+
"{format} text": "{format}テキスト",
|
|
353
|
+
"Schema editing mode": "スキーマ編集モード",
|
|
354
|
+
"JSON text": "JSON text",
|
|
355
|
+
"Build kit": "Build kit",
|
|
356
|
+
"Field settings": "フィールド設定",
|
|
357
|
+
"Field name": "フィールド名",
|
|
358
|
+
"New field name": "新しいフィールド名",
|
|
359
|
+
"New field type": "新しいフィールドの型",
|
|
360
|
+
"Remove field": "フィールドを削除",
|
|
361
|
+
"Add field": "フィールドを追加",
|
|
362
|
+
"Required": "必須",
|
|
363
|
+
"Allow extra fields": "未定義のフィールドを許可",
|
|
364
|
+
"Schema settings": "スキーマ全体の設定",
|
|
365
|
+
"Remove nested fields before changing the type.": "型を変える前に入れ子のフィールドを削除してください。",
|
|
366
|
+
"Any type": "任意の型",
|
|
367
|
+
"One choice per line. Use \"\" for empty text, \"a\\nb\" for multiline text, and JSON for other types.": "選択肢は1行に1つ。空文字は \"\"、改行入りは \"a\\nb\"、その他の型はJSONで入力します。",
|
|
368
|
+
"Enter at least one choice.": "選択肢を1つ以上入力してください。",
|
|
369
|
+
"Enter a non-empty JSON array of schemas.": "スキーマを1つ以上含むJSON配列を入力してください。",
|
|
370
|
+
"Enter a JSON schema object or boolean.": "JSON Schemaオブジェクトまたは真偽値を入力してください。",
|
|
371
|
+
"Enter an object containing named schemas.": "名前付きスキーマを含むオブジェクトを入力してください。",
|
|
372
|
+
"The constant must match the field type.": "固定値をフィールドの型に合わせてください。",
|
|
373
|
+
"Change existing choices or defaults before changing the type.": "型を変える前に既存の選択肢や既定値を変更してください。",
|
|
374
|
+
"Choices (one per line)": "選択肢(1行に1つ)",
|
|
375
|
+
"Item type": "配列要素の型",
|
|
376
|
+
"Rename linked fields in JSON text.": "参照されるフィールド名はJSON textで変更してください。",
|
|
377
|
+
"Additional rules are preserved in JSON text.": "その他のルールはJSON textに保持されています。",
|
|
378
|
+
"Enter a field name.": "フィールド名を入力してください。",
|
|
379
|
+
"Enter a unique field name.": "重複しないフィールド名を入力してください。",
|
|
380
|
+
"A field with this name already exists.": "同じ名前のフィールドが既にあります。",
|
|
381
|
+
"Each choice must match the field type.": "選択肢の値をフィールドの型に合わせてください。",
|
|
382
|
+
"Choices must be unique.": "選択肢を重複させないでください。",
|
|
383
|
+
"Enter a value greater than {minimum}.": "{minimum}より大きい値を入力してください。",
|
|
384
|
+
"Page type": "ページの種類",
|
|
385
|
+
"Markdown page": "Markdown ページ",
|
|
386
|
+
"No subformats available to add.": "追加できる subformat はありません。",
|
|
387
|
+
"Add page": "ページを追加",
|
|
388
|
+
"Remove page": "ページを削除",
|
|
389
|
+
"Rename page": "ページ名を変更",
|
|
390
|
+
"Remove this page from the sidebar? The records will be kept.": "サイドバーからこのページを削除しますか? レコードは保持されます。",
|
|
391
|
+
"Parameters": "パラメーター",
|
|
392
|
+
"Items": "配列要素",
|
|
393
|
+
"Remove parameter": "パラメーターを削除",
|
|
394
|
+
"Check the parameter value.": "パラメーターの値を確認してください。",
|
|
395
|
+
"Download PDF": "PDFをダウンロード",
|
|
396
|
+
"Choose date": "日付を選択",
|
|
397
|
+
"Previous month": "前の月",
|
|
398
|
+
"Next month": "次の月",
|
|
399
|
+
"Today": "今日",
|
|
400
|
+
"Clear": "クリア",
|
|
401
|
+
"Enter a valid date (YYYY-MM-DD).": "有効な日付を入力してください(YYYY-MM-DD)。",
|
|
402
|
+
"Load preview": "プレビューを読み込む",
|
|
403
|
+
"Preview unavailable": "プレビューを読み込めません"
|
|
319
404
|
}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"Save (Ctrl+S)": "保存(Ctrl+S)",
|
|
36
36
|
"View settings": "显示设置",
|
|
37
37
|
"Auto save": "自动保存",
|
|
38
|
+
"Wrap lines": "自动换行",
|
|
38
39
|
"Front-matter fields": "显示文档属性",
|
|
39
40
|
"title": "标题",
|
|
40
41
|
"desc": "描述",
|
|
@@ -153,9 +154,14 @@
|
|
|
153
154
|
"{count} results": "{count} 条结果",
|
|
154
155
|
"Showing {shown} of {count} results": "显示 {count} 条结果中的 {shown} 条",
|
|
155
156
|
"Add translation": "添加翻译文档",
|
|
156
|
-
"Folder": "文件夹",
|
|
157
157
|
"Move search": "移动搜索窗口",
|
|
158
158
|
"Resize search": "调整搜索窗口大小",
|
|
159
|
+
"Matches text": "匹配正文",
|
|
160
|
+
"Matches file name": "匹配文件名",
|
|
161
|
+
"Matches folder name": "匹配文件夹名",
|
|
162
|
+
"Close search": "关闭搜索窗口",
|
|
163
|
+
"Move search to sidebar": "将搜索窗口放到侧边栏",
|
|
164
|
+
"Float search": "让搜索窗口浮动",
|
|
159
165
|
"Notice": "提示",
|
|
160
166
|
"OK": "关闭",
|
|
161
167
|
"Discard changes": "放弃更改",
|
|
@@ -212,16 +218,21 @@
|
|
|
212
218
|
"File details": "文件信息",
|
|
213
219
|
"Show Git changes": "显示 Git 差异",
|
|
214
220
|
"Resource views": "资源视图",
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
221
|
+
"Default": "默认值",
|
|
222
|
+
"Set as default": "设为默认值",
|
|
223
|
+
"Group by": "分组依据",
|
|
224
|
+
"Sort by": "排序依据",
|
|
225
|
+
"Newest first": "从新到旧",
|
|
226
|
+
"Oldest first": "从旧到新",
|
|
227
|
+
"Unassigned": "未设置",
|
|
228
|
+
"Records": "记录",
|
|
229
|
+
"Codeblocks": "代码块",
|
|
230
|
+
"Format": "格式",
|
|
231
|
+
"URLs": "URL",
|
|
232
|
+
"URL previews": "URL 预览",
|
|
219
233
|
"Domain": "域名",
|
|
220
234
|
"All": "全部",
|
|
221
235
|
"references": "处引用",
|
|
222
|
-
"Definitions from term files and Markdown": "汇总术语文件和 Markdown 中的定义",
|
|
223
|
-
"Code blocks collected from Markdown files": "按语言和内容查找 Markdown 中的代码",
|
|
224
|
-
"External links and embeds with their source locations": "查看外部链接、嵌入 URL 及其来源",
|
|
225
236
|
"Search resources": "搜索资源",
|
|
226
237
|
"Files with errors": "读取或解析错误",
|
|
227
238
|
"No matching resources": "没有匹配的资源",
|
|
@@ -281,14 +292,21 @@
|
|
|
281
292
|
"Restore stash": "恢复 stash",
|
|
282
293
|
"Stash changes": "暂存更改",
|
|
283
294
|
"Statics": "Statics",
|
|
295
|
+
"Subformats": "Subformats",
|
|
296
|
+
"Expand card": "展开卡片",
|
|
297
|
+
"Collapse card": "折叠卡片",
|
|
298
|
+
"View details": "查看详情",
|
|
299
|
+
"Click for details; double-click to edit": "单击查看详情;双击编辑",
|
|
300
|
+
"No grouping": "不分组",
|
|
301
|
+
"Ascending": "升序",
|
|
302
|
+
"Descending": "降序",
|
|
303
|
+
"No subformats configured. Add subformats to dooc.yaml.": "尚未配置子格式。请在 dooc.yaml 中添加 subformats。",
|
|
284
304
|
"Workspace tools": "工作区工具",
|
|
285
|
-
"Resize workspace tools": "调整底部卡片高度",
|
|
286
305
|
"Git controls": "Git 操作",
|
|
287
306
|
"Actions": "操作",
|
|
288
307
|
"Updated": "已更新",
|
|
289
308
|
"Copy": "复制",
|
|
290
309
|
"Edit": "编辑",
|
|
291
|
-
"Saving…": "正在保存…",
|
|
292
310
|
"Reload actions before saving again.": "再次保存前请重新加载。",
|
|
293
311
|
"Saved, but refresh failed. Reload actions before saving again.": "保存已完成,但刷新失败。再次保存前请重新加载。",
|
|
294
312
|
"Actions could not be loaded.": "无法加载操作。",
|
|
@@ -315,5 +333,72 @@
|
|
|
315
333
|
"Sign out": "退出登录",
|
|
316
334
|
"Not signed in": "未登录",
|
|
317
335
|
"Continue login": "继续登录",
|
|
318
|
-
"Provided by viewer": "由查看器提供"
|
|
336
|
+
"Provided by viewer": "由查看器提供",
|
|
337
|
+
"Added": "新增",
|
|
338
|
+
"Modified": "修改",
|
|
339
|
+
"Add subformat…": "添加子格式…",
|
|
340
|
+
"Delete": "删除",
|
|
341
|
+
"Delete subformat {ext} and its sidebar page? Records and schema files will be kept.": "删除子格式 {ext} 及其侧边栏页面?记录和模式文件将保留。",
|
|
342
|
+
"Subformat changed externally. Reload and try again.": "子格式已被外部修改。请重新加载后重试。",
|
|
343
|
+
"Move or remove this subformat page's child pages before deleting it.": "删除前,请先移动或删除此子格式页面的子页面。",
|
|
344
|
+
"Add subformat": "添加子格式",
|
|
345
|
+
"Extension": "扩展名",
|
|
346
|
+
"Storage format": "存储格式",
|
|
347
|
+
"Schema file (optional)": "模式文件(可选)",
|
|
348
|
+
"Create automatically": "自动创建",
|
|
349
|
+
"Form": "表单",
|
|
350
|
+
"Enter a valid number.": "请输入有效的数值。",
|
|
351
|
+
"Value editing mode": "值编辑模式",
|
|
352
|
+
"{format} text": "{format}文本",
|
|
353
|
+
"Schema editing mode": "模式编辑方式",
|
|
354
|
+
"JSON text": "JSON text",
|
|
355
|
+
"Build kit": "Build kit",
|
|
356
|
+
"Field settings": "字段设置",
|
|
357
|
+
"Field name": "字段名称",
|
|
358
|
+
"New field name": "新字段名称",
|
|
359
|
+
"New field type": "新字段类型",
|
|
360
|
+
"Remove field": "删除字段",
|
|
361
|
+
"Add field": "添加字段",
|
|
362
|
+
"Required": "必填",
|
|
363
|
+
"Allow extra fields": "允许额外字段",
|
|
364
|
+
"Schema settings": "模式设置",
|
|
365
|
+
"Remove nested fields before changing the type.": "更改类型前,请先删除嵌套字段。",
|
|
366
|
+
"Any type": "任意类型",
|
|
367
|
+
"One choice per line. Use \"\" for empty text, \"a\\nb\" for multiline text, and JSON for other types.": "每行一个选项。空文本用 \"\",多行文本用 \"a\\nb\",其他类型用JSON。",
|
|
368
|
+
"Enter at least one choice.": "请至少输入一个选项。",
|
|
369
|
+
"Enter a non-empty JSON array of schemas.": "请输入至少包含一个模式的JSON数组。",
|
|
370
|
+
"Enter a JSON schema object or boolean.": "请输入JSON模式对象或布尔值。",
|
|
371
|
+
"Enter an object containing named schemas.": "请输入包含命名模式的对象。",
|
|
372
|
+
"The constant must match the field type.": "常量必须符合字段类型。",
|
|
373
|
+
"Change existing choices or defaults before changing the type.": "更改类型前,请先修改现有选项或默认值。",
|
|
374
|
+
"Choices (one per line)": "选项(每行一个)",
|
|
375
|
+
"Item type": "数组项类型",
|
|
376
|
+
"Rename linked fields in JSON text.": "请在JSON text中重命名关联字段。",
|
|
377
|
+
"Additional rules are preserved in JSON text.": "其他规则保留在JSON text中。",
|
|
378
|
+
"Enter a field name.": "请输入字段名称。",
|
|
379
|
+
"Enter a unique field name.": "请输入唯一的字段名称。",
|
|
380
|
+
"A field with this name already exists.": "已存在同名字段。",
|
|
381
|
+
"Each choice must match the field type.": "每个选项必须符合字段类型。",
|
|
382
|
+
"Choices must be unique.": "选项不能重复。",
|
|
383
|
+
"Enter a value greater than {minimum}.": "请输入大于{minimum}的值。",
|
|
384
|
+
"Page type": "页面类型",
|
|
385
|
+
"Markdown page": "Markdown 页面",
|
|
386
|
+
"No subformats available to add.": "没有可添加的子格式。",
|
|
387
|
+
"Add page": "添加页面",
|
|
388
|
+
"Remove page": "移除页面",
|
|
389
|
+
"Rename page": "重命名页面",
|
|
390
|
+
"Remove this page from the sidebar? The records will be kept.": "从侧边栏移除此页面?记录将被保留。",
|
|
391
|
+
"Parameters": "参数",
|
|
392
|
+
"Items": "数组元素",
|
|
393
|
+
"Remove parameter": "移除参数",
|
|
394
|
+
"Check the parameter value.": "请检查参数值。",
|
|
395
|
+
"Download PDF": "下载 PDF",
|
|
396
|
+
"Choose date": "选择日期",
|
|
397
|
+
"Previous month": "上个月",
|
|
398
|
+
"Next month": "下个月",
|
|
399
|
+
"Today": "今天",
|
|
400
|
+
"Clear": "清除",
|
|
401
|
+
"Enter a valid date (YYYY-MM-DD).": "请输入有效日期(YYYY-MM-DD)。",
|
|
402
|
+
"Load preview": "加载预览",
|
|
403
|
+
"Preview unavailable": "无法加载预览"
|
|
319
404
|
}
|
package/dist/viewer/nav-focus.js
CHANGED
|
@@ -7,9 +7,16 @@ export const focusNavTree = (root) => {
|
|
|
7
7
|
for (let item = current; item; item = item.parentElement?.closest("[data-doc-id]")) {
|
|
8
8
|
path.unshift(item);
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const closed = document.body.classList.contains("sidebar-closed");
|
|
11
|
+
const width = closed
|
|
12
|
+
? Number(root.dataset.expandedWidth) ||
|
|
13
|
+
Number.parseFloat(getComputedStyle(root).getPropertyValue("--sidebar-width")) ||
|
|
14
|
+
260
|
|
15
|
+
: root.clientWidth;
|
|
11
16
|
if (!width)
|
|
12
17
|
return;
|
|
18
|
+
if (!closed)
|
|
19
|
+
root.dataset.expandedWidth = String(width);
|
|
13
20
|
const indent = 48 + Math.max(0, path.length - 2) * 29;
|
|
14
21
|
const ancestors = new Set(path.length > 2 && width < indent + 150 ? path.slice(0, -1) : []);
|
|
15
22
|
const items = [...root.querySelectorAll(".nav-item[data-doc-id]")];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** Reconcile server navigation while retaining the user's tree and controls. */
|
|
2
|
+
export const updateNav = (root, html) => {
|
|
3
|
+
const template = root.ownerDocument.createElement("template");
|
|
4
|
+
template.innerHTML = html;
|
|
5
|
+
const key = (node) => {
|
|
6
|
+
if (!(node instanceof HTMLElement))
|
|
7
|
+
return;
|
|
8
|
+
if (node.dataset.docId)
|
|
9
|
+
return `doc:${node.dataset.docId}`;
|
|
10
|
+
if (node.dataset.nodeId)
|
|
11
|
+
return `tool:${node.dataset.nodeId}`;
|
|
12
|
+
if (node.id)
|
|
13
|
+
return `id:${node.id}`;
|
|
14
|
+
if (node.matches(".nav-list[data-parent]"))
|
|
15
|
+
return `list:${node.dataset.parent}`;
|
|
16
|
+
};
|
|
17
|
+
const keyed = new Map();
|
|
18
|
+
for (const node of root.querySelectorAll("[id], [data-doc-id], [data-node-id], .nav-list")) {
|
|
19
|
+
const id = key(node);
|
|
20
|
+
if (id)
|
|
21
|
+
keyed.set(id, node);
|
|
22
|
+
}
|
|
23
|
+
const active = root.contains(document.activeElement) ? document.activeElement : null;
|
|
24
|
+
const scroll = [
|
|
25
|
+
root.parentElement,
|
|
26
|
+
root.querySelector("#nav-docs"),
|
|
27
|
+
root.querySelector(".nav-tool-cards"),
|
|
28
|
+
]
|
|
29
|
+
.filter((node) => node instanceof HTMLElement)
|
|
30
|
+
.map((node) => ({ node, top: node.scrollTop, left: node.scrollLeft }));
|
|
31
|
+
const used = new Set();
|
|
32
|
+
const removed = [];
|
|
33
|
+
const sameType = (a, b) => a.nodeType === b.nodeType &&
|
|
34
|
+
(!(a instanceof Element) ||
|
|
35
|
+
(b instanceof Element &&
|
|
36
|
+
a.localName === b.localName &&
|
|
37
|
+
a.namespaceURI === b.namespaceURI));
|
|
38
|
+
const patch = (parent, source) => {
|
|
39
|
+
const previous = [...parent.childNodes];
|
|
40
|
+
let cursor = parent.firstChild;
|
|
41
|
+
for (const next of source.childNodes) {
|
|
42
|
+
const id = key(next);
|
|
43
|
+
const candidate = id
|
|
44
|
+
? keyed.get(id)
|
|
45
|
+
: previous.find((node) => !used.has(node) &&
|
|
46
|
+
!key(node) &&
|
|
47
|
+
!(node instanceof Element && node.matches(".nav-new-item")) &&
|
|
48
|
+
sameType(node, next));
|
|
49
|
+
const current = candidate && !used.has(candidate) && sameType(candidate, next)
|
|
50
|
+
? candidate
|
|
51
|
+
: next.cloneNode(false);
|
|
52
|
+
used.add(current);
|
|
53
|
+
if (current !== cursor) {
|
|
54
|
+
const container = parent;
|
|
55
|
+
if (current.isConnected && container.isConnected && container.moveBefore)
|
|
56
|
+
container.moveBefore(current, cursor);
|
|
57
|
+
else
|
|
58
|
+
parent.insertBefore(current, cursor);
|
|
59
|
+
}
|
|
60
|
+
if (current instanceof Element && next instanceof Element) {
|
|
61
|
+
const fresh = current !== candidate;
|
|
62
|
+
for (const name of new Set([
|
|
63
|
+
...current.getAttributeNames(),
|
|
64
|
+
...next.getAttributeNames(),
|
|
65
|
+
])) {
|
|
66
|
+
if (!fresh &&
|
|
67
|
+
(name === "inert" ||
|
|
68
|
+
(name === "open" && current.localName === "details") ||
|
|
69
|
+
(name === "style" && current.matches(".nav-list")) ||
|
|
70
|
+
(name === "aria-expanded" && current.matches(".nav-tree-toggle"))))
|
|
71
|
+
continue;
|
|
72
|
+
let value = next.getAttribute(name);
|
|
73
|
+
if (!fresh && name === "class" && current.matches(".nav-item")) {
|
|
74
|
+
const classes = new Set((value ?? "").split(/\s+/).filter(Boolean));
|
|
75
|
+
for (const state of ["open", "nav-ancestor", "dragging"])
|
|
76
|
+
if (current.classList.contains(state))
|
|
77
|
+
classes.add(state);
|
|
78
|
+
else
|
|
79
|
+
classes.delete(state);
|
|
80
|
+
value = [...classes].join(" ");
|
|
81
|
+
}
|
|
82
|
+
if (value === current.getAttribute(name))
|
|
83
|
+
continue;
|
|
84
|
+
if (value === null)
|
|
85
|
+
current.removeAttribute(name);
|
|
86
|
+
else
|
|
87
|
+
current.setAttribute(name, value);
|
|
88
|
+
}
|
|
89
|
+
if (current instanceof HTMLTemplateElement && next instanceof HTMLTemplateElement) {
|
|
90
|
+
if (current.innerHTML !== next.innerHTML)
|
|
91
|
+
current.innerHTML = next.innerHTML;
|
|
92
|
+
}
|
|
93
|
+
else if (!current.matches(".files-upload-status"))
|
|
94
|
+
patch(current, next);
|
|
95
|
+
}
|
|
96
|
+
else if (current.nodeValue !== next.nodeValue)
|
|
97
|
+
current.nodeValue = next.nodeValue;
|
|
98
|
+
cursor = current.nextSibling;
|
|
99
|
+
}
|
|
100
|
+
for (const node of previous)
|
|
101
|
+
if (!used.has(node) && !(node instanceof Element && node.matches(".nav-new-item")))
|
|
102
|
+
removed.push({ parent, node });
|
|
103
|
+
};
|
|
104
|
+
patch(root, template.content);
|
|
105
|
+
// Reparent descendants before deleting their old branch.
|
|
106
|
+
for (const { parent, node } of removed)
|
|
107
|
+
if (node.parentNode === parent && !used.has(node))
|
|
108
|
+
node.remove();
|
|
109
|
+
if (active instanceof HTMLElement && active.isConnected && document.activeElement !== active)
|
|
110
|
+
active.focus({ preventScroll: true });
|
|
111
|
+
for (const { node, top, left } of scroll) {
|
|
112
|
+
if (node.scrollTop !== top)
|
|
113
|
+
node.scrollTop = top;
|
|
114
|
+
if (node.scrollLeft !== left)
|
|
115
|
+
node.scrollLeft = left;
|
|
116
|
+
}
|
|
117
|
+
};
|