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

+61
View File
@@ -0,0 +1,61 @@
(async () => {
const assert = (ok, message) => { if (!ok) throw Error(message); };
const wait = async check => { for (let n=0;n<150;n++) { if(check()) return; await new Promise(r=>setTimeout(r,25)); } throw Error('Timed out: '+check); };
const frame = document.createElement('iframe'); frame.style='width:100%;height:950px;border:0'; document.body.append(frame);
try {
await new Promise(resolve => { frame.onload=resolve; frame.src='/e/-/editor-fixture?edittype=html'; });
const w=frame.contentWindow, d=frame.contentDocument;
await wait(() => w.PagesWikiCodeMirror);
const editor=w.PagesWikiCodeMirror, e=w.PagesEditor;
e.paused=true;
const before=editor.state.doc.toString();
const select=d.querySelector('[data-theme-select]');
const change=async id=>{
select.value=id; select.dispatchEvent(new w.Event('change',{bubbles:true}));
await wait(()=>!select.disabled);
await new Promise(r=>setTimeout(r,80));
assert(!d.querySelector('[data-theme-status]').textContent,'Theme loading error');
};
await change('light');
assert(w.getComputedStyle(editor.dom).backgroundColor==='rgb(247, 247, 247)','Light theme editor remained dark');
assert(w.getComputedStyle(editor.contentDOM).color==='rgb(32, 32, 32)','Light editor text is not dark');
const token=[...d.querySelectorAll('.cm-line span')].find(el=>el.textContent==='h1');
assert(token && w.getComputedStyle(token).color!==w.getComputedStyle(editor.contentDOM).color,'Semantic syntax colors missing');
editor.focus(); await new Promise(r=>setTimeout(r,100));
const cursor=d.querySelector('.cm-fat-cursor,.cm-cursor');
assert(cursor && parseFloat(w.getComputedStyle(cursor).borderBottomWidth)>=2,'Underline cursor missing');
const vimKey=(key,code,keyCode,shiftKey=false)=>editor.contentDOM.dispatchEvent(new w.KeyboardEvent('keydown',{key,code,keyCode,shiftKey,bubbles:true,cancelable:true}));
vimKey('v','KeyV',86);assert(d.body.dataset.editorMode==='visual','Vim visual state not tracked');
vimKey('Escape','Escape',27);assert(d.body.dataset.editorMode==='normal','Vim normal state not tracked');
vimKey('A','KeyA',65,true);assert(d.body.dataset.editorMode==='insert','Vim A insertion not tracked');
vimKey('Escape','Escape',27);
vimKey('R','KeyR',82,true);assert(d.body.dataset.editorMode==='replace','Vim replace state not tracked');
vimKey('Escape','Escape',27);
assert(d.cookie.includes('pageswiki_theme=light'),'Theme choice not retained');
assert(w.PagesWikiCodeMirror===editor && editor.state.doc.toString()===before,'Theme switch replaced editor or lost content');
await change('nanoha-dark');
assert(w.getComputedStyle(editor.dom).backgroundColor!=='rgb(247, 247, 247)','Dark theme did not apply');
await change('index-white');
w.setEditorPreviewVisible(true);
await e.renderPreview();
const article=d.createElement('div'); article.style='width:300px';
const pre=d.createElement('pre'), code=d.createElement('code'); code.textContent='x'.repeat(500); pre.append(code); article.append(pre); d.querySelector('#preview').append(article);
const ancestry=[]; for(let el=pre;el;el=el.parentElement) ancestry.push(el.tagName+'#'+el.id+':'+w.getComputedStyle(el).display+':'+el.clientWidth);
assert(pre.clientWidth>0 && pre.clientWidth<=300 && pre.scrollWidth>pre.clientWidth,'Code block dimensions: '+pre.clientWidth+'/'+pre.scrollWidth+' '+ancestry.join(' > '));
assert(w.getComputedStyle(pre).borderInlineStartWidth==='3px','Code block styling missing');
// PlainText follows the same save/draft machinery but never renders markup.
const plainFrame=d.createElement('iframe'); d.body.append(plainFrame);
await new Promise(resolve=>{plainFrame.onload=resolve;plainFrame.src='/e/-/plain-test.txt?edittype=plain';});
const pw=plainFrame.contentWindow,pd=plainFrame.contentDocument;
await wait(()=>pw.PagesWikiCodeMirror);
const pe=pw.PagesEditor; pe.paused=true;
const literal='<img src=x onerror="alert(1)">\n# Literal\n{{children}}';
pe.setText(literal); await pe.renderPreview();
assert(pd.querySelector('#preview').textContent===literal && !pd.querySelector('#preview img'),'PlainText preview interpreted markup');
assert(await pe.saveNow(),'PlainText save failed');
const state=await pe.state();assert(state.body===literal && state.content_type==='text/plain; charset=utf-8','PlainText canonical data changed');
await pe.switchFormat('html');assert(pe.format()==='plain','PlainText silently switched to HTML');
plainFrame.remove();
document.body.dataset.vimReady='1';
} catch(error) { const out=document.createElement('pre'); out.id='error';out.textContent=error.stack;document.body.append(out); }
})();