@dooc-dev/dooc 0.0.0-stage → 0.0.1
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/README.md +26 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +244 -0
- package/dist/code.global.js +285 -0
- package/dist/compiler/bundle-urls.d.ts +3 -0
- package/dist/compiler/bundle-urls.js +294 -0
- package/dist/compiler/bundle.d.ts +2 -0
- package/dist/compiler/bundle.js +100 -0
- package/dist/compiler/check-prose.d.ts +11 -0
- package/dist/compiler/check-prose.js +138 -0
- package/dist/compiler/check-types.d.ts +44 -0
- package/dist/compiler/check-types.js +1 -0
- package/dist/compiler/check.d.ts +5 -0
- package/dist/compiler/check.js +450 -0
- package/dist/compiler/code-blocks.d.ts +17 -0
- package/dist/compiler/code-blocks.js +198 -0
- package/dist/compiler/code-languages.d.ts +10 -0
- package/dist/compiler/code-languages.js +109 -0
- package/dist/compiler/compile.d.ts +95 -0
- package/dist/compiler/compile.js +410 -0
- package/dist/compiler/config.d.ts +7 -0
- package/dist/compiler/config.js +52 -0
- package/dist/compiler/dialect.d.ts +24 -0
- package/dist/compiler/dialect.js +198 -0
- package/dist/compiler/drawio.d.ts +26 -0
- package/dist/compiler/drawio.js +176 -0
- package/dist/compiler/figures.d.ts +14 -0
- package/dist/compiler/figures.js +221 -0
- package/dist/compiler/file-cache.d.ts +14 -0
- package/dist/compiler/file-cache.js +61 -0
- package/dist/compiler/files.d.ts +29 -0
- package/dist/compiler/files.js +431 -0
- package/dist/compiler/fonts.d.ts +10 -0
- package/dist/compiler/fonts.js +54 -0
- package/dist/compiler/format.d.ts +1 -0
- package/dist/compiler/format.js +42 -0
- package/dist/compiler/from-mdast.d.ts +16 -0
- package/dist/compiler/from-mdast.js +142 -0
- package/dist/compiler/icons.d.ts +14 -0
- package/dist/compiler/icons.js +85 -0
- package/dist/compiler/language-codes.d.ts +7 -0
- package/dist/compiler/language-codes.js +17 -0
- package/dist/compiler/locales.d.ts +7 -0
- package/dist/compiler/locales.js +67 -0
- package/dist/compiler/manifest.d.ts +6 -0
- package/dist/compiler/manifest.js +30 -0
- package/dist/compiler/ops.d.ts +44 -0
- package/dist/compiler/ops.js +362 -0
- package/dist/compiler/public-file.d.ts +2 -0
- package/dist/compiler/public-file.js +93 -0
- package/dist/compiler/serialize.d.ts +3 -0
- package/dist/compiler/serialize.js +16 -0
- package/dist/compiler/terms.d.ts +9 -0
- package/dist/compiler/terms.js +44 -0
- package/dist/compiler/textfile-remote.d.ts +12 -0
- package/dist/compiler/textfile-remote.js +124 -0
- package/dist/compiler/textfile.d.ts +9 -0
- package/dist/compiler/textfile.js +113 -0
- package/dist/compiler/theme-variants.d.ts +4 -0
- package/dist/compiler/theme-variants.js +22 -0
- package/dist/compiler/zip.d.ts +6 -0
- package/dist/compiler/zip.js +48 -0
- package/dist/core/blocks.d.ts +99 -0
- package/dist/core/blocks.js +29 -0
- package/dist/core/code-file.d.ts +12 -0
- package/dist/core/code-file.js +68 -0
- package/dist/core/content-metadata.d.ts +48 -0
- package/dist/core/content-metadata.js +264 -0
- package/dist/core/content-types.d.ts +45 -0
- package/dist/core/content-types.js +1 -0
- package/dist/core/figure-frame.d.ts +12 -0
- package/dist/core/figure-frame.js +108 -0
- package/dist/core/file-embed.d.ts +13 -0
- package/dist/core/file-embed.js +43 -0
- package/dist/core/files.d.ts +15 -0
- package/dist/core/files.js +59 -0
- package/dist/core/flow-base-css.generated.d.ts +1 -0
- package/dist/core/flow-base-css.generated.js +4 -0
- package/dist/core/flow-css.d.ts +9 -0
- package/dist/core/flow-css.js +54 -0
- package/dist/core/graph-common.d.ts +32 -0
- package/dist/core/graph-common.js +113 -0
- package/dist/core/graph.d.ts +117 -0
- package/dist/core/graph.js +480 -0
- package/dist/core/html.d.ts +29 -0
- package/dist/core/html.js +444 -0
- package/dist/core/icons.d.ts +1 -0
- package/dist/core/icons.js +1 -0
- package/dist/core/inline.d.ts +27 -0
- package/dist/core/inline.js +42 -0
- package/dist/core/language.d.ts +41 -0
- package/dist/core/language.js +44 -0
- package/dist/core/languages/ja.d.ts +2 -0
- package/dist/core/languages/ja.js +5 -0
- package/dist/core/markdown.d.ts +27 -0
- package/dist/core/markdown.js +154 -0
- package/dist/core/previewers.d.ts +37 -0
- package/dist/core/previewers.js +103 -0
- package/dist/core/routing.d.ts +20 -0
- package/dist/core/routing.js +64 -0
- package/dist/core/schema-comments.d.ts +14 -0
- package/dist/core/schema-comments.js +52 -0
- package/dist/core/schema-graph-flow.d.ts +9 -0
- package/dist/core/schema-graph-flow.js +379 -0
- package/dist/core/schema-graph-mount.d.ts +9 -0
- package/dist/core/schema-graph-mount.js +105 -0
- package/dist/core/schema-graph.d.ts +254 -0
- package/dist/core/schema-graph.js +981 -0
- package/dist/core/table-ui.d.ts +2 -0
- package/dist/core/table-ui.js +180 -0
- package/dist/core/taxonomy.d.ts +12 -0
- package/dist/core/taxonomy.js +49 -0
- package/dist/core/term-reference.d.ts +5 -0
- package/dist/core/term-reference.js +19 -0
- package/dist/core/terms-ui.d.ts +6 -0
- package/dist/core/terms-ui.js +22 -0
- package/dist/core/textfile.d.ts +10 -0
- package/dist/core/textfile.js +39 -0
- package/dist/core/theme-variants.d.ts +3 -0
- package/dist/core/theme-variants.js +37 -0
- package/dist/core/toc-ui.d.ts +2 -0
- package/dist/core/toc-ui.js +161 -0
- package/dist/core/video-ui.d.ts +2 -0
- package/dist/core/video-ui.js +253 -0
- package/dist/core/workspace.d.ts +15 -0
- package/dist/core/workspace.js +28 -0
- package/dist/edit.global.js +305 -0
- package/dist/flow.global.js +4959 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +31 -0
- package/dist/mcp.d.ts +24 -0
- package/dist/mcp.js +467 -0
- package/dist/plugins/actions.d.ts +45 -0
- package/dist/plugins/actions.js +125 -0
- package/dist/plugins/blocks.d.ts +92 -0
- package/dist/plugins/blocks.js +99 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/oauth.d.ts +14 -0
- package/dist/plugins/oauth.js +164 -0
- package/dist/plugins/runtime.d.ts +24 -0
- package/dist/plugins/runtime.js +339 -0
- package/dist/plugins/types.d.ts +56 -0
- package/dist/plugins/types.js +1 -0
- package/dist/plugins/view.d.ts +29 -0
- package/dist/plugins/view.js +60 -0
- package/dist/ui.global.js +77 -0
- package/dist/viewer/assets.d.ts +2 -0
- package/dist/viewer/assets.js +3 -0
- package/dist/viewer/build.d.ts +12 -0
- package/dist/viewer/build.js +55 -0
- package/dist/viewer/bundle-network.d.ts +2 -0
- package/dist/viewer/bundle-network.js +88 -0
- package/dist/viewer/code-file.d.ts +20 -0
- package/dist/viewer/code-file.js +42 -0
- package/dist/viewer/editor-tools.d.ts +38 -0
- package/dist/viewer/editor-tools.js +211 -0
- package/dist/viewer/file-references.d.ts +14 -0
- package/dist/viewer/file-references.js +38 -0
- package/dist/viewer/font-picker.d.ts +4 -0
- package/dist/viewer/font-picker.js +145 -0
- package/dist/viewer/font-settings.d.ts +11 -0
- package/dist/viewer/font-settings.js +50 -0
- package/dist/viewer/fonts/LICENSE.txt +119 -0
- package/dist/viewer/fonts/udev-gothic-regular.woff2 +0 -0
- package/dist/viewer/fonts.d.ts +2 -0
- package/dist/viewer/fonts.js +13 -0
- package/dist/viewer/git-diff.d.ts +3 -0
- package/dist/viewer/git-diff.js +33 -0
- package/dist/viewer/git-types.d.ts +73 -0
- package/dist/viewer/git-types.js +1 -0
- package/dist/viewer/git.d.ts +5 -0
- package/dist/viewer/git.js +337 -0
- package/dist/viewer/hmr.d.ts +53 -0
- package/dist/viewer/hmr.js +335 -0
- package/dist/viewer/i18n.d.ts +6 -0
- package/dist/viewer/i18n.js +65 -0
- package/dist/viewer/ja-lint.d.ts +3 -0
- package/dist/viewer/ja-lint.js +44 -0
- package/dist/viewer/language-picker.d.ts +2 -0
- package/dist/viewer/language-picker.js +233 -0
- package/dist/viewer/languages.d.ts +11 -0
- package/dist/viewer/languages.js +20 -0
- package/dist/viewer/locales/eng.json +294 -0
- package/dist/viewer/locales/jpn.json +294 -0
- package/dist/viewer/locales/zho.json +294 -0
- package/dist/viewer/nav-focus.d.ts +2 -0
- package/dist/viewer/nav-focus.js +64 -0
- package/dist/viewer/plugin-blocks.d.ts +3 -0
- package/dist/viewer/plugin-blocks.js +115 -0
- package/dist/viewer/plugin-config.d.ts +35 -0
- package/dist/viewer/plugin-config.js +57 -0
- package/dist/viewer/plugin-view.d.ts +3 -0
- package/dist/viewer/plugin-view.js +28 -0
- package/dist/viewer/plugins.d.ts +8 -0
- package/dist/viewer/plugins.js +214 -0
- package/dist/viewer/resize.d.ts +4 -0
- package/dist/viewer/resize.js +238 -0
- package/dist/viewer/resource-library.d.ts +29 -0
- package/dist/viewer/resource-library.js +104 -0
- package/dist/viewer/search.d.ts +16 -0
- package/dist/viewer/search.js +358 -0
- package/dist/viewer/serve.d.ts +206 -0
- package/dist/viewer/serve.js +3233 -0
- package/dist/viewer/site-icon.d.ts +8 -0
- package/dist/viewer/site-icon.js +56 -0
- package/dist/viewer/textfile.d.ts +9 -0
- package/dist/viewer/textfile.js +50 -0
- package/dist/viewer/theme-picker.d.ts +2 -0
- package/dist/viewer/theme-picker.js +135 -0
- package/dist/viewer/workspace.d.ts +4 -0
- package/dist/viewer/workspace.js +47 -0
- package/package.json +127 -5
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/** Keep the native select as the language enum and change-event source. */
|
|
2
|
+
export const mountLanguagePickers = (t) => {
|
|
3
|
+
for (const select of document.querySelectorAll("#fm-lang, #ui-language")) {
|
|
4
|
+
const translations = select.id === "fm-lang";
|
|
5
|
+
const trigger = select
|
|
6
|
+
.closest(".fm-language")
|
|
7
|
+
?.querySelector("[data-language-open]");
|
|
8
|
+
const wrapper = document.createElement("div");
|
|
9
|
+
wrapper.className = "language-select";
|
|
10
|
+
const popup = document.createElement("div");
|
|
11
|
+
popup.className = "language-picker";
|
|
12
|
+
popup.id = `${select.id}-picker`;
|
|
13
|
+
popup.popover = "manual";
|
|
14
|
+
const input = document.createElement("input");
|
|
15
|
+
input.type = "text";
|
|
16
|
+
input.className = "language-select-input";
|
|
17
|
+
input.autocomplete = "off";
|
|
18
|
+
input.spellcheck = false;
|
|
19
|
+
input.setAttribute("role", "combobox");
|
|
20
|
+
input.setAttribute("aria-autocomplete", "list");
|
|
21
|
+
input.setAttribute("aria-haspopup", "listbox");
|
|
22
|
+
input.setAttribute("aria-expanded", "false");
|
|
23
|
+
const list = document.createElement("div");
|
|
24
|
+
list.className = "language-options";
|
|
25
|
+
list.id = `${select.id}-options`;
|
|
26
|
+
list.tabIndex = -1;
|
|
27
|
+
list.setAttribute("role", "listbox");
|
|
28
|
+
if (translations) {
|
|
29
|
+
list.setAttribute("aria-multiselectable", "true");
|
|
30
|
+
input.setAttribute("aria-keyshortcuts", "Control+Enter");
|
|
31
|
+
}
|
|
32
|
+
input.setAttribute("aria-controls", list.id);
|
|
33
|
+
const empty = document.createElement("div");
|
|
34
|
+
empty.className = "language-empty";
|
|
35
|
+
empty.setAttribute("role", "status");
|
|
36
|
+
popup.append(list, empty);
|
|
37
|
+
select.before(wrapper);
|
|
38
|
+
wrapper.append(select, input, popup);
|
|
39
|
+
select.hidden = true;
|
|
40
|
+
let active = 0;
|
|
41
|
+
let query = "";
|
|
42
|
+
const isOpen = () => popup.matches(":popover-open");
|
|
43
|
+
const selectedText = () => select.selectedOptions[0]?.text ?? "";
|
|
44
|
+
const position = () => {
|
|
45
|
+
const rect = input.getBoundingClientRect();
|
|
46
|
+
const below = innerHeight - rect.bottom;
|
|
47
|
+
const above = below < 240 && rect.top > below;
|
|
48
|
+
Object.assign(popup.style, {
|
|
49
|
+
width: `${rect.width}px`,
|
|
50
|
+
left: `${rect.left}px`,
|
|
51
|
+
maxHeight: `${Math.max(80, Math.min(360, (above ? rect.top : below) - 12))}px`,
|
|
52
|
+
top: above ? "auto" : `${rect.bottom + 4}px`,
|
|
53
|
+
bottom: above ? `${innerHeight - rect.top + 4}px` : "auto",
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const highlight = (index) => {
|
|
57
|
+
const options = [...list.querySelectorAll("button")];
|
|
58
|
+
active = options.length ? (index + options.length) % options.length : 0;
|
|
59
|
+
options.forEach((option, i) => {
|
|
60
|
+
option.dataset.active = String(i === active);
|
|
61
|
+
});
|
|
62
|
+
const option = options[active];
|
|
63
|
+
if (option) {
|
|
64
|
+
input.setAttribute("aria-activedescendant", option.id);
|
|
65
|
+
if (isOpen())
|
|
66
|
+
option.scrollIntoView({ block: "nearest" });
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
input.removeAttribute("aria-activedescendant");
|
|
70
|
+
};
|
|
71
|
+
const render = () => {
|
|
72
|
+
const words = query.normalize("NFKC").toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
73
|
+
const fragment = document.createDocumentFragment();
|
|
74
|
+
let selected = 0;
|
|
75
|
+
let count = 0;
|
|
76
|
+
for (const [i, option] of [...select.options].entries()) {
|
|
77
|
+
if (option.disabled ||
|
|
78
|
+
!words.every((word) => option.text.normalize("NFKC").toLowerCase().includes(word)))
|
|
79
|
+
continue;
|
|
80
|
+
const item = document.createElement("button");
|
|
81
|
+
item.type = "button";
|
|
82
|
+
item.tabIndex = -1;
|
|
83
|
+
item.id = `${select.id}-option-${i}`;
|
|
84
|
+
item.dataset.value = option.value;
|
|
85
|
+
item.textContent = item.title = option.text;
|
|
86
|
+
item.disabled = select.disabled;
|
|
87
|
+
item.setAttribute("role", "option");
|
|
88
|
+
item.setAttribute("aria-selected", translations ? (option.dataset.added ?? "false") : String(option.selected));
|
|
89
|
+
if (translations) {
|
|
90
|
+
const marker = document.createElement("span");
|
|
91
|
+
marker.className = "language-toggle";
|
|
92
|
+
marker.textContent = option.dataset.added === "true" ? "✓" : "+";
|
|
93
|
+
marker.title = t(option.value === select.dataset.source
|
|
94
|
+
? "Source language cannot be removed"
|
|
95
|
+
: option.dataset.added === "true"
|
|
96
|
+
? "Remove translation"
|
|
97
|
+
: "Add translation");
|
|
98
|
+
item.textContent = option.text;
|
|
99
|
+
item.prepend(marker);
|
|
100
|
+
item.setAttribute("aria-current", String(option.selected));
|
|
101
|
+
}
|
|
102
|
+
if (option.selected)
|
|
103
|
+
selected = count;
|
|
104
|
+
fragment.append(item);
|
|
105
|
+
count++;
|
|
106
|
+
}
|
|
107
|
+
list.replaceChildren(fragment);
|
|
108
|
+
empty.hidden = count > 0;
|
|
109
|
+
empty.textContent = t("No results");
|
|
110
|
+
highlight(selected);
|
|
111
|
+
};
|
|
112
|
+
const sync = () => {
|
|
113
|
+
input.title = selectedText();
|
|
114
|
+
input.readOnly = select.disabled;
|
|
115
|
+
if (trigger)
|
|
116
|
+
trigger.disabled = select.disabled;
|
|
117
|
+
input.setAttribute("aria-disabled", String(select.disabled));
|
|
118
|
+
input.placeholder = t("Search languages");
|
|
119
|
+
input.setAttribute("aria-label", select.getAttribute("aria-label") ?? t("Language"));
|
|
120
|
+
if (translations)
|
|
121
|
+
input.setAttribute("aria-description", t("Enter to edit; Ctrl+Enter to add or remove translation"));
|
|
122
|
+
if (!isOpen() || !query)
|
|
123
|
+
input.value = selectedText();
|
|
124
|
+
if (isOpen())
|
|
125
|
+
render();
|
|
126
|
+
};
|
|
127
|
+
popup.addEventListener("beforetoggle", (event) => {
|
|
128
|
+
const open = event.newState === "open";
|
|
129
|
+
input.setAttribute("aria-expanded", String(open));
|
|
130
|
+
trigger?.setAttribute("aria-expanded", String(open));
|
|
131
|
+
if (open) {
|
|
132
|
+
render();
|
|
133
|
+
position();
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
query = "";
|
|
137
|
+
input.value = selectedText();
|
|
138
|
+
input.removeAttribute("aria-activedescendant");
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const choose = (item) => {
|
|
142
|
+
if (!item || select.disabled)
|
|
143
|
+
return;
|
|
144
|
+
select.value = item.dataset.value ?? "";
|
|
145
|
+
if (!translations)
|
|
146
|
+
popup.hidePopover();
|
|
147
|
+
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
148
|
+
sync();
|
|
149
|
+
};
|
|
150
|
+
const toggle = (item) => {
|
|
151
|
+
if (!item || select.disabled || item.dataset.value === select.dataset.source)
|
|
152
|
+
return;
|
|
153
|
+
select.dispatchEvent(new CustomEvent("docs:toggle-language", { detail: item.dataset.value }));
|
|
154
|
+
};
|
|
155
|
+
const open = () => {
|
|
156
|
+
if (isOpen() || select.disabled)
|
|
157
|
+
return;
|
|
158
|
+
popup.showPopover();
|
|
159
|
+
input.select();
|
|
160
|
+
};
|
|
161
|
+
input.addEventListener("focus", open);
|
|
162
|
+
trigger?.addEventListener("click", () => {
|
|
163
|
+
input.focus();
|
|
164
|
+
open();
|
|
165
|
+
});
|
|
166
|
+
input.addEventListener("click", open);
|
|
167
|
+
input.addEventListener("input", () => {
|
|
168
|
+
query = input.value;
|
|
169
|
+
if (isOpen())
|
|
170
|
+
render();
|
|
171
|
+
else
|
|
172
|
+
popup.showPopover();
|
|
173
|
+
});
|
|
174
|
+
input.addEventListener("keydown", (event) => {
|
|
175
|
+
if (event.isComposing)
|
|
176
|
+
return;
|
|
177
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
if (isOpen())
|
|
180
|
+
highlight(active + (event.key === "ArrowDown" ? 1 : -1));
|
|
181
|
+
else
|
|
182
|
+
open();
|
|
183
|
+
}
|
|
184
|
+
else if (event.key === "Enter" && isOpen()) {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
const item = list.querySelector('[data-active="true"]');
|
|
187
|
+
if (translations && event.ctrlKey)
|
|
188
|
+
toggle(item);
|
|
189
|
+
else
|
|
190
|
+
choose(item);
|
|
191
|
+
}
|
|
192
|
+
else if (event.key === "Escape" && isOpen()) {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
popup.hidePopover();
|
|
195
|
+
input.select();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
list.addEventListener("pointerdown", (event) => event.preventDefault());
|
|
199
|
+
list.addEventListener("click", (event) => {
|
|
200
|
+
const target = event.target;
|
|
201
|
+
const item = target.closest("button");
|
|
202
|
+
if (translations && target.closest(".language-toggle"))
|
|
203
|
+
toggle(item);
|
|
204
|
+
else
|
|
205
|
+
choose(item);
|
|
206
|
+
});
|
|
207
|
+
popup.addEventListener("toggle", () => {
|
|
208
|
+
if (isOpen())
|
|
209
|
+
highlight(active);
|
|
210
|
+
});
|
|
211
|
+
wrapper.addEventListener("focusout", (event) => {
|
|
212
|
+
if (isOpen() &&
|
|
213
|
+
!(event.relatedTarget instanceof Node && wrapper.contains(event.relatedTarget)))
|
|
214
|
+
popup.hidePopover();
|
|
215
|
+
});
|
|
216
|
+
document.addEventListener("pointerdown", (event) => {
|
|
217
|
+
if (isOpen() && event.target instanceof Node && !wrapper.contains(event.target))
|
|
218
|
+
popup.hidePopover();
|
|
219
|
+
});
|
|
220
|
+
new ResizeObserver(() => {
|
|
221
|
+
if (isOpen())
|
|
222
|
+
position();
|
|
223
|
+
}).observe(input);
|
|
224
|
+
select.addEventListener("change", sync);
|
|
225
|
+
new MutationObserver(sync).observe(select, {
|
|
226
|
+
childList: true,
|
|
227
|
+
subtree: true,
|
|
228
|
+
attributes: true,
|
|
229
|
+
});
|
|
230
|
+
document.addEventListener("docs:ui-language", sync);
|
|
231
|
+
sync();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LanguageRegistration } from "shiki/core";
|
|
2
|
+
import type { LanguageAdapter } from "../core/language.js";
|
|
3
|
+
export declare const BUILTIN_LANGUAGES: readonly LanguageAdapter[];
|
|
4
|
+
export interface SiteLanguages {
|
|
5
|
+
languages: readonly LanguageAdapter[];
|
|
6
|
+
codeLanguages?: string[];
|
|
7
|
+
codeGrammars?: LanguageRegistration[];
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_SITE_LANGUAGES: SiteLanguages;
|
|
10
|
+
/** docs.config.mjs + built-ins (configured adapters first, so they override a built-in code). */
|
|
11
|
+
export declare const loadSiteLanguages: (root: string) => Promise<SiteLanguages>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Built-in language adapters for the Node tools (viewer / CLI / MCP): the browser-safe core
|
|
2
|
+
// adapters plus their Node-only prose lint. docs.config.mjs adapters take precedence.
|
|
3
|
+
import { loadCodeLanguages } from "../compiler/code-languages.js";
|
|
4
|
+
import { loadDocsConfig } from "../compiler/config.js";
|
|
5
|
+
import { ja } from "../core/languages/ja.js";
|
|
6
|
+
export const BUILTIN_LANGUAGES = [
|
|
7
|
+
// textlint is heavy; load it on the first lint request.
|
|
8
|
+
{ ...ja, lint: async (body) => (await import("./ja-lint.js")).lintJa(body) },
|
|
9
|
+
];
|
|
10
|
+
export const DEFAULT_SITE_LANGUAGES = {
|
|
11
|
+
languages: BUILTIN_LANGUAGES,
|
|
12
|
+
};
|
|
13
|
+
/** docs.config.mjs + built-ins (configured adapters first, so they override a built-in code). */
|
|
14
|
+
export const loadSiteLanguages = async (root) => {
|
|
15
|
+
const config = await loadDocsConfig(root);
|
|
16
|
+
return {
|
|
17
|
+
...(await loadCodeLanguages(root)),
|
|
18
|
+
languages: [...config.languages, ...BUILTIN_LANGUAGES],
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Editor font": "Editor font",
|
|
3
|
+
"Viewer font": "Viewer font",
|
|
4
|
+
"Default font": "Default font",
|
|
5
|
+
"Loading fonts": "Loading fonts",
|
|
6
|
+
"Font choice applies only to this tab": "Font choice applies only to this tab; browser storage is unavailable.",
|
|
7
|
+
"Invalid font file": "This font file could not be loaded. Choose a valid font supported by your browser.",
|
|
8
|
+
"Preview theme": "Preview theme",
|
|
9
|
+
"Editor theme": "Editor theme",
|
|
10
|
+
"Open link": "Open link",
|
|
11
|
+
"Copy link": "Copy link",
|
|
12
|
+
"Collapse preview": "Collapse preview",
|
|
13
|
+
"Expand preview": "Expand preview",
|
|
14
|
+
"Resize plugin card": "Resize plugin card",
|
|
15
|
+
"Open the local viewer to load plugin data": "Open the local viewer to load plugin data",
|
|
16
|
+
"Load data": "Load data",
|
|
17
|
+
"Connect account": "Connect account",
|
|
18
|
+
"Forget connection": "Forget connection",
|
|
19
|
+
"Load data using your connected account": "Load data using your connected account",
|
|
20
|
+
"Loading plugin data": "Loading plugin data",
|
|
21
|
+
"Continue to service": "Continue to service",
|
|
22
|
+
"Connected as {name}": "Connected as {name}",
|
|
23
|
+
"Connection forgotten in dooc": "Connection forgotten in dooc",
|
|
24
|
+
"Connect this plugin again": "Connect this plugin again",
|
|
25
|
+
"Plugin is not configured": "Plugin is not configured",
|
|
26
|
+
"Plugin request failed": "Plugin request failed",
|
|
27
|
+
"Plugin service request failed": "Plugin service request failed",
|
|
28
|
+
"Access denied by the service": "Access denied by the service",
|
|
29
|
+
"Collapse code": "Collapse code",
|
|
30
|
+
"Expand code": "Expand code",
|
|
31
|
+
"Language": "Editor language",
|
|
32
|
+
"Save": "Save",
|
|
33
|
+
"Save (Ctrl+S)": "Save (Ctrl+S)",
|
|
34
|
+
"View settings": "View settings",
|
|
35
|
+
"Auto save": "Auto save",
|
|
36
|
+
"Front-matter fields": "Front-matter fields",
|
|
37
|
+
"title": "title",
|
|
38
|
+
"desc": "desc",
|
|
39
|
+
"lang": "lang",
|
|
40
|
+
"Remove icon": "Remove icon",
|
|
41
|
+
"icon": "icon",
|
|
42
|
+
"rename": "rename",
|
|
43
|
+
"Enter to save / Esc to cancel": "Enter to save / Esc to cancel",
|
|
44
|
+
"Change doc id": "Change doc id",
|
|
45
|
+
"Delete doc": "Delete doc",
|
|
46
|
+
"Add doc": "Add doc",
|
|
47
|
+
"Resources": "Resources",
|
|
48
|
+
"markdown": "Markdown",
|
|
49
|
+
"figures": "Figures",
|
|
50
|
+
"html": "HTML",
|
|
51
|
+
"icons": "Icons",
|
|
52
|
+
"Resize sidebar": "Resize sidebar",
|
|
53
|
+
"Resize document tree": "Resize document tree",
|
|
54
|
+
"Resize editor": "Resize editor",
|
|
55
|
+
"Close sidebar": "Close sidebar",
|
|
56
|
+
"Open sidebar": "Open sidebar",
|
|
57
|
+
"Create": "Create",
|
|
58
|
+
"Unsaved changes": "Unsaved changes",
|
|
59
|
+
"Modified (waiting for auto-save)": "Modified (waiting for auto-save)",
|
|
60
|
+
"Enter to rename / Esc to cancel (file links follow)": "Enter to rename / Esc to cancel (file links follow)",
|
|
61
|
+
"Icon must be svg": "Icon must be svg",
|
|
62
|
+
"Change site icon": "Change site icon",
|
|
63
|
+
"Icon set (auto-padded to 1:1)": "Icon set (auto-padded to 1:1)",
|
|
64
|
+
"Icon removed": "Icon removed",
|
|
65
|
+
"Only svg / png / webp / jpeg can be added": "Only svg / png / webp / jpeg can be added",
|
|
66
|
+
"Updated externally (keeping unsaved changes)": "Updated externally (keeping unsaved changes)",
|
|
67
|
+
"Changed externally — keeping your changes (you'll be asked again on save)": "Changed externally — keeping your changes (you'll be asked again on save)",
|
|
68
|
+
"You have unsaved changes. Discard them and leave?": "You have unsaved changes. Discard them and leave?",
|
|
69
|
+
"Saved": "Saved",
|
|
70
|
+
"Auto": "Auto",
|
|
71
|
+
"Light": "Light",
|
|
72
|
+
"Dark": "Dark",
|
|
73
|
+
"Theme": "Theme",
|
|
74
|
+
"Saved {time}": "Saved {time}",
|
|
75
|
+
"Saved (validation errors: {count})": "Saved (validation errors: {count})",
|
|
76
|
+
"Failed to save: {error}": "Failed to save: {error}",
|
|
77
|
+
"Delete \"{file}\"? (this cannot be undone)": "Delete \"{file}\" and all its translations? (this cannot be undone)",
|
|
78
|
+
"Failed to delete: {error}": "Failed to delete: {error}",
|
|
79
|
+
"Adding figures… ({count})": "Adding figures… ({count})",
|
|
80
|
+
"Added figures: {names}": "Added figures: {names}",
|
|
81
|
+
"Failed to add figures: {error}": "Failed to add figures: {error}",
|
|
82
|
+
"Failed to set icon: {error}": "Failed to set icon: {error}",
|
|
83
|
+
"Failed to update preview: {error}": "Failed to update preview: {error}",
|
|
84
|
+
"Failed to apply external changes: {error}": "Failed to apply external changes: {error}",
|
|
85
|
+
"Can't rename: {error}": "Can't rename: {error}",
|
|
86
|
+
"Applied external changes": "Applied external changes",
|
|
87
|
+
"Contents": "Contents",
|
|
88
|
+
"Copy code": "Copy code",
|
|
89
|
+
"External conflict": "This doc was updated elsewhere. Apply the external changes?\n\nOK: discard unsaved edits and apply external changes\nCancel: keep your edits and skip this save",
|
|
90
|
+
"Referenced documents: {list}": "Referenced by these documents:\n{list}\n\nDelete anyway? (links will be left dangling)",
|
|
91
|
+
"heading": "heading",
|
|
92
|
+
"subheading": "subheading",
|
|
93
|
+
"code fence": "code fence",
|
|
94
|
+
"figure reference": "figure reference",
|
|
95
|
+
"Templates": "Templates",
|
|
96
|
+
"Figures": "Figures",
|
|
97
|
+
"Doc links": "Doc links",
|
|
98
|
+
"Terms": "Terms",
|
|
99
|
+
"Custom syntax": "Custom syntax",
|
|
100
|
+
"path": "path",
|
|
101
|
+
"size": "size",
|
|
102
|
+
"kind": "kind",
|
|
103
|
+
"syntax": "syntax",
|
|
104
|
+
"doc": "doc",
|
|
105
|
+
"used in": "used in",
|
|
106
|
+
"none": "none",
|
|
107
|
+
"Split view": "Split view",
|
|
108
|
+
"Change language": "Change language",
|
|
109
|
+
"Active pane": "Active pane",
|
|
110
|
+
"Activate pane": "Activate pane",
|
|
111
|
+
"Failed to load pane": "Failed to load pane",
|
|
112
|
+
"Close pane and discard its unsaved changes?": "Close pane and discard its unsaved changes?",
|
|
113
|
+
"Validate and apply": "Validate and apply",
|
|
114
|
+
"Auto validate": "Auto validate",
|
|
115
|
+
"Source mapping": "Source mapping",
|
|
116
|
+
"Validation pending": "Validation pending",
|
|
117
|
+
"Validating": "Validating",
|
|
118
|
+
"Validation passed": "Validation passed",
|
|
119
|
+
"Validation errors": "Validation errors",
|
|
120
|
+
"Saving": "Saving",
|
|
121
|
+
"Save failed": "Save failed",
|
|
122
|
+
"Expand section": "Expand section",
|
|
123
|
+
"Collapse section": "Collapse section",
|
|
124
|
+
"terms": "Terms",
|
|
125
|
+
"Edit text file": "Edit text file",
|
|
126
|
+
"Create file": "Create file",
|
|
127
|
+
"Reload file": "Reload file",
|
|
128
|
+
"Working…": "Working…",
|
|
129
|
+
"File not found — save to create it.": "File not found — save to create it.",
|
|
130
|
+
"Discard file edits and reload?": "Discard file edits and reload?",
|
|
131
|
+
"File changed externally. Reload it before saving.": "File changed externally. Reload it before saving.",
|
|
132
|
+
"Edits made while reloading were kept. Reload again when ready.": "Edits made while reloading were kept. Reload again when ready.",
|
|
133
|
+
"File not found": "File not found",
|
|
134
|
+
"File has not been loaded": "File has not been loaded",
|
|
135
|
+
"File could not be loaded": "File could not be loaded",
|
|
136
|
+
"View remote text file": "View remote text file",
|
|
137
|
+
"Remote files are read-only": "Remote files are read-only",
|
|
138
|
+
"Edits made while validating were kept. Validate again when ready.": "Edits made while validating were kept. Validate again when ready.",
|
|
139
|
+
"Updating preview": "Updating preview",
|
|
140
|
+
"Preview is up to date": "Preview is up to date",
|
|
141
|
+
"Preview could not be updated": "Preview could not be updated",
|
|
142
|
+
"Conflicting changes": "Conflicting changes",
|
|
143
|
+
"Use my edits": "Use my edits",
|
|
144
|
+
"Use external changes": "Use external changes",
|
|
145
|
+
"File was deleted": "File was deleted",
|
|
146
|
+
"Cancel": "Cancel",
|
|
147
|
+
"Search documents": "Search documents",
|
|
148
|
+
"No results": "No results",
|
|
149
|
+
"Searching…": "Searching…",
|
|
150
|
+
"Could not load search. Press Ctrl+F to retry.": "Could not load search. Press Ctrl+F to retry.",
|
|
151
|
+
"{count} results": "{count} results",
|
|
152
|
+
"Showing {shown} of {count} results": "Showing {shown} of {count} results",
|
|
153
|
+
"Add translation": "Add translation",
|
|
154
|
+
"Folder": "Folder",
|
|
155
|
+
"Move search": "Move search",
|
|
156
|
+
"Resize search": "Resize search",
|
|
157
|
+
"Notice": "Notice",
|
|
158
|
+
"OK": "OK",
|
|
159
|
+
"Discard changes": "Discard changes",
|
|
160
|
+
"Copy section URL": "Copy section URL",
|
|
161
|
+
"Copied": "Copied",
|
|
162
|
+
"Could not copy URL": "Could not copy URL",
|
|
163
|
+
"Search languages": "Search languages",
|
|
164
|
+
"Remove translation": "Remove translation",
|
|
165
|
+
"Source language cannot be removed": "Source language cannot be removed",
|
|
166
|
+
"Enter to edit; Ctrl+Enter to add or remove translation": "Enter to edit; Ctrl+Enter to add or remove translation",
|
|
167
|
+
"Preview has not been updated": "Preview has not been updated",
|
|
168
|
+
"Table": "Table",
|
|
169
|
+
"Image": "Image",
|
|
170
|
+
"HTML": "HTML",
|
|
171
|
+
"Markdown": "Markdown",
|
|
172
|
+
"Code": "Code",
|
|
173
|
+
"Video": "Video",
|
|
174
|
+
"Loading": "Loading",
|
|
175
|
+
"Retry": "Retry",
|
|
176
|
+
"Reload": "Reload",
|
|
177
|
+
"Close": "Close",
|
|
178
|
+
"File preview": "File preview",
|
|
179
|
+
"Files": "Files",
|
|
180
|
+
"Search files": "Search files",
|
|
181
|
+
"Extension": "Extension",
|
|
182
|
+
"Default folder layout": "Default folder layout",
|
|
183
|
+
"Folder restructure": "Folder restructure",
|
|
184
|
+
"Move": "Move",
|
|
185
|
+
"Move up": "Move up",
|
|
186
|
+
"Move down": "Move down",
|
|
187
|
+
"Move to root": "Move to root",
|
|
188
|
+
"Name": "Name",
|
|
189
|
+
"Size": "Size",
|
|
190
|
+
"Select": "Select",
|
|
191
|
+
"Copy path": "Copy path",
|
|
192
|
+
"File path": "File path",
|
|
193
|
+
"File created": "File created",
|
|
194
|
+
"Copy failed": "Copy failed",
|
|
195
|
+
"Place new files in files/<extension>/": "Place new files in files/<extension>/",
|
|
196
|
+
"Document changed. Retry from the current block.": "Document changed. Retry from the current block.",
|
|
197
|
+
"Document changed. Insert the file from Files.": "Document changed. Insert the file from Files.",
|
|
198
|
+
"File name": "File name",
|
|
199
|
+
"Renamed to {filename}": "Renamed to {filename}",
|
|
200
|
+
"Enter a file name ending in .md": "Enter a file name ending in .md",
|
|
201
|
+
"Upload files": "Upload files",
|
|
202
|
+
"Uploading {count}/{total}": "Uploading {count}/{total}",
|
|
203
|
+
"Files uploaded": "Files uploaded",
|
|
204
|
+
"File exceeds 64 MiB": "File exceeds 64 MiB",
|
|
205
|
+
"Choose files inside the folder": "Choose files inside the folder",
|
|
206
|
+
"Click a column to sort; row numbers refer to the source": "Click a column to sort; row numbers refer to the source",
|
|
207
|
+
"Column": "Column",
|
|
208
|
+
"Resize table": "Resize table",
|
|
209
|
+
"Back to document": "Back to document",
|
|
210
|
+
"File details": "File details",
|
|
211
|
+
"Show Git changes": "Show Git changes",
|
|
212
|
+
"Resource views": "Resource views",
|
|
213
|
+
"Dictionary": "Dictionary",
|
|
214
|
+
"Code blocks": "Code blocks",
|
|
215
|
+
"Code language": "Code language",
|
|
216
|
+
"URLs": "URLs",
|
|
217
|
+
"Domain": "Domain",
|
|
218
|
+
"All": "All",
|
|
219
|
+
"references": "references",
|
|
220
|
+
"Definitions from term files and Markdown": "Definitions from term files and Markdown",
|
|
221
|
+
"Code blocks collected from Markdown files": "Code blocks collected from Markdown files",
|
|
222
|
+
"External links and embeds with their source locations": "External links and embeds with their source locations",
|
|
223
|
+
"Search resources": "Search resources",
|
|
224
|
+
"Files with errors": "Files with errors",
|
|
225
|
+
"No matching resources": "No matching resources",
|
|
226
|
+
"Organize files": "Organize files",
|
|
227
|
+
"Auto-save paused": "Auto-save paused",
|
|
228
|
+
"Reload failed": "Reload failed",
|
|
229
|
+
"Waiting for auto-save": "Waiting for auto-save",
|
|
230
|
+
"Conflict unresolved. Auto-save is paused; your edits are kept.": "Conflict unresolved. Auto-save is paused; your edits are kept.",
|
|
231
|
+
"File not found — editing will create it automatically.": "File not found — editing will create it automatically.",
|
|
232
|
+
"Play": "Play",
|
|
233
|
+
"Pause": "Pause",
|
|
234
|
+
"Seek": "Seek",
|
|
235
|
+
"Mute": "Mute",
|
|
236
|
+
"Unmute": "Unmute",
|
|
237
|
+
"Volume": "Volume",
|
|
238
|
+
"Video settings": "Video settings",
|
|
239
|
+
"Playback speed": "Playback speed",
|
|
240
|
+
"Fullscreen": "Fullscreen",
|
|
241
|
+
"Video could not be played": "Video could not be played",
|
|
242
|
+
"Fullscreen is unavailable": "Fullscreen is unavailable",
|
|
243
|
+
"Some registered fonts could not be loaded": "Some registered fonts could not be loaded",
|
|
244
|
+
"Done": "Done",
|
|
245
|
+
"Git operation failed": "Git operation failed",
|
|
246
|
+
"Create pull request": "Create pull request",
|
|
247
|
+
"Base branch": "Base branch",
|
|
248
|
+
"Draft": "Draft",
|
|
249
|
+
"Open pull request": "Open pull request",
|
|
250
|
+
"Merge method": "Merge method",
|
|
251
|
+
"Merge pull request": "Merge pull request",
|
|
252
|
+
"Merge #{number} into {base} using {method}?": "Merge #{number} into {base} using {method}?",
|
|
253
|
+
"Reset edits": "Reset edits",
|
|
254
|
+
"Discard these pull request edits?": "Discard these pull request edits?",
|
|
255
|
+
"Branch": "Branch",
|
|
256
|
+
"Switch branch": "Switch branch",
|
|
257
|
+
"New branch": "New branch",
|
|
258
|
+
"Create branch": "Create branch",
|
|
259
|
+
"Changes": "Changes",
|
|
260
|
+
"Git uses saved files.": "Git uses saved files.",
|
|
261
|
+
"Stage": "Stage",
|
|
262
|
+
"Unstage": "Unstage",
|
|
263
|
+
"Working tree clean": "Working tree clean",
|
|
264
|
+
"Commit message": "Commit message",
|
|
265
|
+
"Commit staged changes": "Commit staged changes",
|
|
266
|
+
"Fetch": "Fetch",
|
|
267
|
+
"Pull (fast-forward)": "Pull (fast-forward)",
|
|
268
|
+
"Push": "Push",
|
|
269
|
+
"Connect an origin provider from the viewer module to enable remote operations.": "Connect an origin provider from the viewer module to enable remote operations.",
|
|
270
|
+
"Pull requests": "Pull requests",
|
|
271
|
+
"No open pull requests": "No open pull requests",
|
|
272
|
+
"Description": "Description",
|
|
273
|
+
"Operation completed, but reload failed: {error}": "Operation completed, but reload failed: {error}",
|
|
274
|
+
"Stash is occupied. Commit the current changes before switching branches.": "Stash is occupied. Commit the current changes before switching branches.",
|
|
275
|
+
"Stash saved changes and switch to {branch}?": "Stash saved changes and switch to {branch}?",
|
|
276
|
+
"Stash and switch": "Stash and switch",
|
|
277
|
+
"Create the first commit to switch branches.": "Create the first commit to switch branches.",
|
|
278
|
+
"Stash · empty": "Stash · empty",
|
|
279
|
+
"Restore stash": "Restore stash",
|
|
280
|
+
"Stash changes": "Stash changes",
|
|
281
|
+
"Statics": "Statics",
|
|
282
|
+
"Workspace tools": "Workspace tools",
|
|
283
|
+
"Resize workspace tools": "Resize workspace tools",
|
|
284
|
+
"Git controls": "Git controls",
|
|
285
|
+
"Actions": "Actions",
|
|
286
|
+
"Updated": "Updated",
|
|
287
|
+
"Copy": "Copy",
|
|
288
|
+
"Edit": "Edit",
|
|
289
|
+
"Saving…": "Saving…",
|
|
290
|
+
"Reload actions before saving again.": "Reload actions before saving again.",
|
|
291
|
+
"Saved, but refresh failed. Reload actions before saving again.": "Saved, but refresh failed. Reload actions before saving again.",
|
|
292
|
+
"Actions could not be loaded.": "Actions could not be loaded.",
|
|
293
|
+
"An open draft is no longer editable. Copy or cancel it before reloading.": "An open draft is no longer editable. Copy or cancel it before reloading."
|
|
294
|
+
}
|