Refactor architecture into eight components and consolidate reliability work
Build and publish container images / images (push) Successful in 9m34s
Release container images / release (push) Successful in 36s

Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts.

Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation.

Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
This commit is contained in:
Anya Tokugawa committed 2026-11-01 15:23:31 +09:00
1 parent 9dd425f765
commit d5d21b7841
302 files changed
+20037 -3492

No files matched your search

+119 -122
View File
@@ -11996,6 +11996,32 @@
return state.facet(selectionConfig);
}
var UnicodeRegexpSupport = /x/.unicode != null ? "gu" : "g";
function highlightActiveLine() {
return activeLineHighlighter;
}
var lineDeco = /* @__PURE__ */ Decoration.line({ class: "cm-activeLine" });
var activeLineHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
constructor(view) {
this.decorations = this.getDeco(view);
}
update(update) {
if (update.docChanged || update.selectionSet)
this.decorations = this.getDeco(update.view);
}
getDeco(view) {
let lastLineStart = -1, deco = [];
for (let r of view.state.selection.ranges) {
let line = view.lineBlockAt(r.head);
if (line.from > lastLineStart) {
deco.push(lineDeco.range(line.from));
lastLineStart = line.from;
}
}
return Decoration.set(deco);
}
}, {
decorations: (v) => v.decorations
});
var Outside = "-10000px";
var TooltipViewManager = class {
constructor(view, facet, createTooltipView, removeTooltipView) {
@@ -12969,6 +12995,26 @@
last = last * 10 + 9;
return last;
}
var activeLineGutterMarker = /* @__PURE__ */ new class extends GutterMarker {
constructor() {
super(...arguments);
this.elementClass = "cm-activeLineGutter";
}
}();
var activeLineGutterHighlighter = /* @__PURE__ */ gutterLineClass.compute(["selection"], (state) => {
let marks2 = [], last = -1;
for (let range of state.selection.ranges) {
let linePos = state.doc.lineAt(range.head).from;
if (linePos > last) {
last = linePos;
marks2.push(activeLineGutterMarker.range(linePos));
}
}
return RangeSet.of(marks2);
});
function highlightActiveLineGutter() {
return activeLineGutterHighlighter;
}
// node_modules/@lezer/common/dist/index.js
var DefaultBufferLength = 1024;
@@ -38654,28 +38700,50 @@
}
// src/editor.js
var pagesWikiHighlightStyle = HighlightStyle.define([
{ tag: tags.heading, class: "pw-syntax-heading" },
{ tag: [tags.link, tags.url], class: "pw-syntax-link" },
{ tag: tags.emphasis, class: "pw-syntax-emphasis" },
{ tag: tags.strong, class: "pw-syntax-strong" },
{ tag: [tags.keyword, tags.operatorKeyword], class: "pw-syntax-keyword" },
{ tag: [tags.tagName, tags.typeName, tags.monospace], class: "pw-syntax-type" },
{ tag: [tags.string, tags.special(tags.string)], class: "pw-syntax-string" },
{ tag: [tags.number, tags.bool, tags.null, tags.attributeName], class: "pw-syntax-number" },
{ tag: tags.comment, class: "pw-syntax-comment" },
{ tag: [tags.variableName, tags.propertyName], class: "pw-syntax-variable" },
{ tag: tags.function(tags.variableName), class: "pw-syntax-function" },
{ tag: tags.operator, class: "pw-syntax-operator" },
{ tag: tags.invalid, class: "pw-syntax-invalid" }
]);
var pagesWikiTheme = EditorView.theme({
".cm-selectionBackground": {
backgroundColor: "rgba(255, 216, 102, 0.48) !important"
backgroundColor: "var(--editor-selection) !important"
},
"&.cm-focused .cm-selectionBackground": {
backgroundColor: "rgba(255, 216, 102, 0.58) !important"
backgroundColor: "var(--editor-selection) !important"
},
".cm-selectionLayer .cm-selectionBackground": {
backgroundColor: "rgba(255, 216, 102, 0.58) !important"
backgroundColor: "var(--editor-selection) !important"
},
".cm-content ::selection": {
backgroundColor: "rgba(255, 216, 102, 0.48) !important",
color: "#ffffff !important"
backgroundColor: "var(--editor-selection) !important",
color: "var(--fg) !important"
}
});
var vimMode = "INSERT";
var languageAliases = { js: "javascript", ts: "typescript", py: "python", sh: "shell", bash: "shell", zsh: "shell", yml: "yaml", md: "markdown", c: "cpp", "c++": "cpp", xml: "html", htm: "html" };
function languageExtension(mode) {
switch (String(mode || "").toLowerCase()) {
mode = String(mode || "").toLowerCase();
switch (languageAliases[mode] || mode) {
case "html":
return html();
case "markdown":
return markdown();
return markdown({ codeLanguages: (info) => {
const mode2 = info.trim().split(/\s+/)[0].toLowerCase();
if (["md", "markdown"].includes(mode2)) return null;
const support = languageExtension(mode2);
return support?.language || support;
} });
case "javascript":
return javascript({ jsx: true });
case "typescript":
@@ -38744,6 +38812,7 @@
}
function setEditorMode(mode) {
vimMode = mode;
document.body.dataset.editorMode = mode.toLowerCase();
const el = document.getElementById("editor-vim-mode");
if (!el) {
return;
@@ -38756,6 +38825,7 @@
if (!word || word.from === word.to && !context.explicit) {
return null;
}
if (!context.explicit && !word.text.startsWith("{{")) return null;
return {
from: word.from,
options: [
@@ -38767,10 +38837,13 @@
{ label: "```go", type: "snippet", apply: "```go\n\n```" },
{ label: "```bash", type: "snippet", apply: "```bash\n\n```" },
{ label: "[link](url)", type: "snippet", apply: "[text](url)" },
{ label: "{{children}}", type: "function", apply: "{{children}}" },
{ label: "{{children}}", type: "function", apply: "{{children}}", boost: 5 },
{ label: "{{children:/}}", type: "function", apply: "{{children:/}}" },
{ label: "{{children:/ exclude=/draft}}", type: "function", apply: "{{children:/ exclude=/draft}}" }
]
].map((option) => option.label.startsWith("{{") ? { ...option, apply(view, completion, from, to) {
const tail = view.state.sliceDoc(to, to + 2).match(/^\}{1,2}/)?.[0] || "";
view.dispatch({ changes: { from, to: to + tail.length, insert: option.label }, selection: { anchor: from + option.label.length } });
} } : option)
};
}
function installVimCommands() {
@@ -38786,9 +38859,8 @@
const quit = () => {
location.href = window.PagesWikiCurrentPath || "/";
};
const saveQuit = () => {
save();
setTimeout(quit, 120);
const saveQuit = async () => {
if (await window.PagesEditor?.saveNow()) quit();
};
Vim.defineEx("write", "w", save);
Vim.defineEx("w", "w", save);
@@ -38798,41 +38870,11 @@
Vim.defineEx("x", "x", saveQuit);
}
function attachVimModeTracking(view) {
view.dom.addEventListener(
"keydown",
(ev) => {
if (ev.key === "Escape" || ev.ctrlKey && ev.key === "[") {
setEditorMode("NORMAL");
return;
}
if (vimMode === "NORMAL") {
if (ev.key === "i" || ev.key === "a" || ev.key === "o" || ev.key === "O") {
setEditorMode("INSERT");
return;
}
if (ev.key === "R") {
setEditorMode("REPLACE");
return;
}
if (ev.key === "v" || ev.key === "V") {
setEditorMode("VISUAL");
return;
}
}
if (vimMode === "VISUAL" && ev.key === "Escape") {
setEditorMode("NORMAL");
}
},
true
);
view.dom.addEventListener(
"focusin",
() => {
if (!vimMode) {
setEditorMode("INSERT");
}
}
);
getCM(view)?.on("vim-mode-change", (event) => {
const mode = String(event.mode || "normal").toUpperCase();
setEditorMode(mode);
view.dom.classList.toggle("pageswiki-vim-visual", mode === "VISUAL");
});
}
function attachStatusBar(view) {
const cursorEl = document.getElementById("editor-cursor");
@@ -38851,10 +38893,30 @@
view.dom.addEventListener("focusin", updateCursor);
}
window.PagesWikiEditor = {
highlightCodeBlock(code, mode) {
mode = String(mode || "").toLowerCase();
const language2 = languageExtension(mode);
const text = code.textContent;
if (!language2 || text.length > 32768) return false;
const parser14 = (language2.language || language2).parser;
const fragment = document.createDocumentFragment();
let offset = 0;
highlightTree(parser14.parse(text), pagesWikiHighlightStyle, (from, to, classes) => {
if (from > offset) fragment.append(document.createTextNode(text.slice(offset, from)));
const span = document.createElement("span");
span.className = classes;
span.textContent = text.slice(from, to);
fragment.append(span);
offset = to;
});
fragment.append(document.createTextNode(text.slice(offset)));
code.replaceChildren(fragment);
return true;
},
createViewer(target, text, mode, minimap) {
const extensions = [
lineNumbers(),
syntaxHighlighting(defaultHighlightStyle),
syntaxHighlighting(pagesWikiHighlightStyle),
pagesWikiTheme,
EditorState.readOnly.of(true),
EditorView.editable.of(false)
@@ -38874,9 +38936,12 @@
return view;
},
create(target, initialText, mode, options = {}) {
const keymapName = String(options.keymap || "default").toLowerCase();
const mobile = window.matchMedia("(pointer: coarse) and (hover: none)").matches;
const keymapName = mobile ? "default" : String(options.keymap || "default").toLowerCase();
const extensions = [
lineNumbers(),
highlightActiveLine(),
highlightActiveLineGutter(),
history(),
bracketMatching(),
closeBrackets(),
@@ -38904,7 +38969,7 @@
])
);
if (options.syntax !== false) {
extensions.push(syntaxHighlighting(defaultHighlightStyle));
extensions.push(syntaxHighlighting(pagesWikiHighlightStyle));
}
if (options.autocomplete !== false) {
extensions.push(
@@ -38918,6 +38983,9 @@
if (language2) {
extensions.push(language2);
}
if (mode === "html" || mode === "markdown") {
extensions.push(EditorState.languageData.of(() => [{ closeBrackets: { brackets: ["(", "[", "'", '"', "`"] } }]));
}
const view = new EditorView({
state: EditorState.create({
doc: initialText,
@@ -38928,87 +38996,16 @@
attachStatusBar(view);
if (keymapName === "vim") {
attachVimModeTracking(view);
attachPagesWikiExFallback(view);
}
return view;
}
};
function attachPagesWikiExFallback(view) {
let active = false;
let buffer = "";
function save() {
if (window.PagesEditor && window.PagesEditor.saveNow) {
window.PagesEditor.saveNow();
}
}
function quit() {
location.href = window.PagesWikiCurrentPath || "/";
}
view.dom.addEventListener(
"keydown",
(ev) => {
if (!active && vimMode === "NORMAL" && ev.key === ":") {
active = true;
buffer = "";
return;
}
if (!active) {
return;
}
if (ev.key === "Escape" || ev.ctrlKey && ev.key === "[") {
active = false;
buffer = "";
return;
}
if (ev.key === "Enter") {
const cmd2 = buffer.trim();
active = false;
buffer = "";
if (cmd2 === "w") {
ev.preventDefault();
save();
return;
}
if (cmd2 === "q") {
ev.preventDefault();
quit();
return;
}
if (cmd2 === "wq" || cmd2 === "x") {
ev.preventDefault();
save();
setTimeout(quit, 120);
return;
}
return;
}
if (ev.key.length === 1) {
buffer += ev.key;
}
if (ev.key === "Backspace") {
buffer = buffer.slice(0, -1);
}
},
true
);
}
var pagesWikiPreviewTimer = null;
function schedulePagesWikiPreview(view) {
const textarea = document.getElementById("editor");
if (textarea) {
textarea.value = view.state.doc.toString();
textarea.dispatchEvent(new Event("input", { bubbles: true }));
}
if (pagesWikiPreviewTimer) {
clearTimeout(pagesWikiPreviewTimer);
}
pagesWikiPreviewTimer = setTimeout(
() => {
if (window.PagesEditor && window.PagesEditor.renderPreview) {
window.PagesEditor.renderPreview();
}
},
350
);
}
})();
//# sourceMappingURL=editor.bundle.js.map