@refrakt-md/editor 0.32.0 → 0.34.0

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.
Files changed (46) hide show
  1. package/app/dist/assets/{index-MAa41Aoo.js → index-B9evDjiY.js} +1 -1
  2. package/app/dist/assets/{index-DC3NN32V.js → index-BEzsLLEi.js} +1 -1
  3. package/app/dist/assets/{index-B5EwV3L4.js → index-BRNcz3ZN.js} +1 -1
  4. package/app/dist/assets/{index-9FYuyjkb.js → index-BbKNPcZu.js} +1 -1
  5. package/app/dist/assets/{index-BYbu3e1g.js → index-BgoT2u0j.js} +1 -1
  6. package/app/dist/assets/{index-8OoX8730.js → index-BhvgBV4C.js} +1 -1
  7. package/app/dist/assets/{index-CokXa7Q0.js → index-C3621cGO.js} +1 -1
  8. package/app/dist/assets/{index-CTvbHdnl.js → index-C6O8opFI.js} +1 -1
  9. package/app/dist/assets/index-CCQ-z9aR.js +618 -0
  10. package/app/dist/assets/{index-BcuLfpXj.js → index-CGfziSaO.js} +1 -1
  11. package/app/dist/assets/{index-BGnYPYsz.js → index-CiVwGhFG.js} +1 -1
  12. package/app/dist/assets/{index-BX59bp8A.js → index-Cnibris1.js} +1 -1
  13. package/app/dist/assets/{index-C22IGCT5.js → index-DNGu9cr1.js} +1 -1
  14. package/app/dist/assets/{index-B_Cn-SCf.js → index-DcwpakCF.js} +1 -1
  15. package/app/dist/assets/{index-BtDnPCJm.js → index-DyjCpEtL.js} +1 -1
  16. package/app/dist/assets/{index-dOZj_cPm.js → index-MRvFn3Sl.js} +1 -1
  17. package/app/dist/assets/{index-CNFIYp8p.js → index-RTh1eW1u.js} +1 -1
  18. package/app/dist/assets/{index-B4gO_iPW.js → index-ojg7U5eP.js} +1 -1
  19. package/app/dist/assets/{index-Dy9gwdZ7.js → index-xzyBNgk5.js} +1 -1
  20. package/app/dist/index.html +1 -1
  21. package/app/src/lib/api/client.ts +6 -2
  22. package/app/src/lib/editor/attribute-completion.ts +5 -5
  23. package/app/src/lib/editor/block-parser.ts +91 -35
  24. package/app/src/lib/editor/content-model-resolver.ts +1 -1
  25. package/app/src/lib/editor/inline-markdown.ts +17 -15
  26. package/app/src/lib/editor/rune-palette.ts +3 -3
  27. package/app/src/lib/editor/section-mapper.ts +30 -24
  28. package/app/src/lib/preview/block-renderer.ts +17 -6
  29. package/app/src/lib/state/editor.svelte.ts +6 -2
  30. package/dist/community-tags-builder.d.ts.map +1 -1
  31. package/dist/community-tags-builder.js +4 -1
  32. package/dist/community-tags-builder.js.map +1 -1
  33. package/dist/layout-resolver.d.ts.map +1 -1
  34. package/dist/layout-resolver.js +30 -4
  35. package/dist/layout-resolver.js.map +1 -1
  36. package/dist/preview-builder.d.ts.map +1 -1
  37. package/dist/preview-builder.js +3 -1
  38. package/dist/preview-builder.js.map +1 -1
  39. package/dist/preview.d.ts.map +1 -1
  40. package/dist/preview.js +27 -3
  41. package/dist/preview.js.map +1 -1
  42. package/dist/server.d.ts.map +1 -1
  43. package/dist/server.js +26 -12
  44. package/dist/server.js.map +1 -1
  45. package/package.json +6 -6
  46. package/app/dist/assets/index-CzUb_76y.js +0 -618
@@ -1 +1 @@
1
- import{g as G,E as A,C as N,s as I,t as p,o as Y,h as k,p as j,a as U,L as Z,b as B,f as D,v as M}from"./index-CzUb_76y.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),$e=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),me=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-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",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[$e],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&T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Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[le,se,ie,ce,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function T(e,t){let o=t&&t.getChild("TagName");return o?e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return s?.name=="StartTag"?{type:"openTag",from:t,context:C(a)}:s?.name=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:s?.name=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let m=E(n);o.push(m),n.global&&O.push(m),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let m=O,c=r;n.attributes&&(m=m.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,m,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let m=e[n],c=a[n];if(m.children)for(let u of m.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var m;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,$=P(c,S);if($){let g=f[$];i=g?.children||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[((m=f[i])===null||m===void 0?void 0:m.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:i?.attrs||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let $=f[T(c,S)],g=($?.attrValues||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),$=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push($?$.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(($?.children||(S?a:s)).map(x=>x.openCompletion));if(S&&$?.text.length){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat($.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:me.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function qe(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var m,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let $=S.parent;if(((c=(m=$.parent)===null||m===void 0?void 0:m.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,$.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let $=S.parent;if(S.from==l-2&&((u=$.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,$,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,qe as xml,w as xmlLanguage};
1
+ import{g as G,E as A,C as N,s as I,t as p,o as Y,h as k,p as j,a as U,L as Z,b as B,f as D,v as M}from"./index-CCQ-z9aR.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),$e=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),me=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,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gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[le,se,ie,ce,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function T(e,t){let o=t&&t.getChild("TagName");return o?e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return s?.name=="StartTag"?{type:"openTag",from:t,context:C(a)}:s?.name=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:s?.name=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let m=E(n);o.push(m),n.global&&O.push(m),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let m=O,c=r;n.attributes&&(m=m.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,m,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let m=e[n],c=a[n];if(m.children)for(let u of m.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var m;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,$=P(c,S);if($){let g=f[$];i=g?.children||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[((m=f[i])===null||m===void 0?void 0:m.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:i?.attrs||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let $=f[T(c,S)],g=($?.attrValues||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),$=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push($?$.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(($?.children||(S?a:s)).map(x=>x.openCompletion));if(S&&$?.text.length){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat($.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:me.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function qe(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var m,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let $=S.parent;if(((c=(m=$.parent)===null||m===void 0?void 0:m.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,$.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let $=S.parent;if(S.from==l-2&&((u=$.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,$,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,qe as xml,w as xmlLanguage};
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>refrakt editor</title>
7
- <script type="module" crossorigin src="/assets/index-CzUb_76y.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CCQ-z9aR.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CzvG5PZT.css">
9
9
  </head>
10
10
  <body>
@@ -86,7 +86,9 @@ export async function updateRouteRules(routeRules: RouteRule[]): Promise<void> {
86
86
  });
87
87
  if (!res.ok) {
88
88
  const data = await res.json().catch(() => ({}));
89
- throw new Error((data as { error?: string }).error ?? `Failed to update route rules: ${res.status}`);
89
+ throw new Error(
90
+ (data as { error?: string }).error ?? `Failed to update route rules: ${res.status}`,
91
+ );
90
92
  }
91
93
  }
92
94
 
@@ -125,7 +127,9 @@ export async function createDirectory(options: {
125
127
  });
126
128
  if (!res.ok) {
127
129
  const data = await res.json().catch(() => ({}));
128
- throw new Error((data as { error?: string }).error ?? `Failed to create directory: ${res.status}`);
130
+ throw new Error(
131
+ (data as { error?: string }).error ?? `Failed to create directory: ${res.status}`,
132
+ );
129
133
  }
130
134
  return res.json();
131
135
  }
@@ -58,8 +58,10 @@ function getDynamicValues(tagName: string, attrName: string, aggregated: Aggrega
58
58
  const design = aggregated['design'] as { contexts?: Record<string, unknown> } | undefined;
59
59
  if (!design?.contexts) return [];
60
60
  const scopes = Object.keys(design.contexts);
61
- if ((tagName === 'sandbox' && attrName === 'context') ||
62
- (tagName === 'design-context' && attrName === 'scope')) {
61
+ if (
62
+ (tagName === 'sandbox' && attrName === 'context') ||
63
+ (tagName === 'design-context' && attrName === 'scope')
64
+ ) {
63
65
  return scopes;
64
66
  }
65
67
  return [];
@@ -134,9 +136,7 @@ export function attributeCompletionSource(
134
136
 
135
137
  // Get already-used attributes
136
138
  const before = doc.slice(Math.max(0, pos - 500), pos);
137
- const usedAttrs = new Set(
138
- [...before.matchAll(/(\w[\w-]*)="/g)].map((m) => m[1]),
139
- );
139
+ const usedAttrs = new Set([...before.matchAll(/(\w[\w-]*)="/g)].map((m) => m[1]));
140
140
 
141
141
  const options = Object.entries(rune.attributes)
142
142
  .filter(([name]) => !usedAttrs.has(name))
@@ -305,7 +305,11 @@ export function parseBlocks(source: string): ParsedBlock[] {
305
305
  // ── Blockquote ───────────────────────────────────────────
306
306
  if (trimmed.startsWith('>')) {
307
307
  const start = i;
308
- while (i < lines.length && (lines[i].trimStart().startsWith('>') || (lines[i].trim() !== '' && !isBlockStart(lines[i])))) {
308
+ while (
309
+ i < lines.length &&
310
+ (lines[i].trimStart().startsWith('>') ||
311
+ (lines[i].trim() !== '' && !isBlockStart(lines[i])))
312
+ ) {
309
313
  i++;
310
314
  }
311
315
  const src = lines.slice(start, i).join('\n');
@@ -327,7 +331,11 @@ export function parseBlocks(source: string): ParsedBlock[] {
327
331
  while (i < lines.length) {
328
332
  const lt = lines[i].trimStart();
329
333
  // Continue if it's a list item, continuation indent, or blank line within
330
- if (/^(\d+\.|[-*+])\s/.test(lt) || (lt === '' && i + 1 < lines.length && /^(\s+|\d+\.|[-*+]\s)/.test(lines[i + 1])) || (lt !== '' && lines[i].startsWith(' '))) {
334
+ if (
335
+ /^(\d+\.|[-*+])\s/.test(lt) ||
336
+ (lt === '' && i + 1 < lines.length && /^(\s+|\d+\.|[-*+]\s)/.test(lines[i + 1])) ||
337
+ (lt !== '' && lines[i].startsWith(' '))
338
+ ) {
331
339
  i++;
332
340
  } else {
333
341
  break;
@@ -414,7 +422,10 @@ export function parseContentTree(content: string): ContentNode[] {
414
422
  const line = lines[i];
415
423
  const trimmed = line.trimStart();
416
424
 
417
- if (trimmed === '') { i++; continue; }
425
+ if (trimmed === '') {
426
+ i++;
427
+ continue;
428
+ }
418
429
 
419
430
  // Fenced code
420
431
  if (trimmed.startsWith('```') || trimmed.startsWith('~~~')) {
@@ -468,7 +479,10 @@ export function parseContentTree(content: string): ContentNode[] {
468
479
  const lt = lines[i].trimStart();
469
480
  const nestedOpen = RUNE_OPEN_RE.exec(lt);
470
481
  if (nestedOpen && nestedOpen[1] === name && nestedOpen[3] !== '/') depth++;
471
- if (closeRe.test(lt)) { depth--; if (depth === 0) break; }
482
+ if (closeRe.test(lt)) {
483
+ depth--;
484
+ if (depth === 0) break;
485
+ }
472
486
  innerLines.push(lines[i]);
473
487
  i++;
474
488
  }
@@ -521,7 +535,12 @@ export function parseContentTree(content: string): ContentNode[] {
521
535
  // Blockquote
522
536
  if (trimmed.startsWith('>')) {
523
537
  const start = i;
524
- while (i < lines.length && (lines[i].trimStart().startsWith('>') || (lines[i].trim() !== '' && !isBlockStart(lines[i])))) i++;
538
+ while (
539
+ i < lines.length &&
540
+ (lines[i].trimStart().startsWith('>') ||
541
+ (lines[i].trim() !== '' && !isBlockStart(lines[i])))
542
+ )
543
+ i++;
525
544
  const src = lines.slice(start, i).join('\n');
526
545
  nodes.push({ type: 'quote', label: 'Blockquote', source: src });
527
546
  continue;
@@ -548,9 +567,16 @@ export function parseContentTree(content: string): ContentNode[] {
548
567
  i++;
549
568
  } else if (lt !== '' && lines[i].startsWith(' ')) {
550
569
  i++;
551
- } else { break; }
570
+ } else {
571
+ break;
572
+ }
552
573
  }
553
- nodes.push({ type: 'list', label: ordered ? 'Ordered list' : 'List', source: lines.slice(start, i).join('\n'), listOrdered: ordered });
574
+ nodes.push({
575
+ type: 'list',
576
+ label: ordered ? 'Ordered list' : 'List',
577
+ source: lines.slice(start, i).join('\n'),
578
+ listOrdered: ordered,
579
+ });
554
580
  continue;
555
581
  }
556
582
 
@@ -571,7 +597,11 @@ export function parseContentTree(content: string): ContentNode[] {
571
597
  * Replace a nested rune node's source within a parent content string.
572
598
  * Finds the node's original source and replaces it with the new source.
573
599
  */
574
- export function replaceNodeSource(parentContent: string, oldSource: string, newSource: string): string {
600
+ export function replaceNodeSource(
601
+ parentContent: string,
602
+ oldSource: string,
603
+ newSource: string,
604
+ ): string {
575
605
  const idx = parentContent.indexOf(oldSource);
576
606
  if (idx === -1) return parentContent;
577
607
  return parentContent.slice(0, idx) + newSource + parentContent.slice(idx + oldSource.length);
@@ -583,21 +613,38 @@ export function replaceNodeSource(parentContent: string, oldSource: string, newS
583
613
  function defaultTemplate(match: string): string {
584
614
  const primary = match.includes('|') ? match.split('|')[0] : match;
585
615
  switch (primary) {
586
- case 'heading': return '## Heading';
587
- case 'heading:1': return '# Heading';
588
- case 'heading:2': return '## Heading';
589
- case 'heading:3': return '### Heading';
590
- case 'heading:4': return '#### Heading';
591
- case 'heading:5': return '##### Heading';
592
- case 'heading:6': return '###### Heading';
593
- case 'paragraph': return 'Text content';
594
- case 'list': case 'list:unordered': return '- Item 1\n- Item 2';
595
- case 'list:ordered': return '1. Item 1\n2. Item 2';
596
- case 'fence': return '```\ncode\n```';
597
- case 'image': return '![alt](url)';
598
- case 'blockquote': case 'quote': return '> Quote';
599
- case 'any': return 'Content';
600
- default: return 'Content';
616
+ case 'heading':
617
+ return '## Heading';
618
+ case 'heading:1':
619
+ return '# Heading';
620
+ case 'heading:2':
621
+ return '## Heading';
622
+ case 'heading:3':
623
+ return '### Heading';
624
+ case 'heading:4':
625
+ return '#### Heading';
626
+ case 'heading:5':
627
+ return '##### Heading';
628
+ case 'heading:6':
629
+ return '###### Heading';
630
+ case 'paragraph':
631
+ return 'Text content';
632
+ case 'list':
633
+ case 'list:unordered':
634
+ return '- Item 1\n- Item 2';
635
+ case 'list:ordered':
636
+ return '1. Item 1\n2. Item 2';
637
+ case 'fence':
638
+ return '```\ncode\n```';
639
+ case 'image':
640
+ return '![alt](url)';
641
+ case 'blockquote':
642
+ case 'quote':
643
+ return '> Quote';
644
+ case 'any':
645
+ return 'Content';
646
+ default:
647
+ return 'Content';
601
648
  }
602
649
  }
603
650
 
@@ -712,7 +759,9 @@ export function removeListItem(
712
759
  const newListSource = remaining.join('\n\n');
713
760
  const idx = innerContent.indexOf(listNode.source);
714
761
  if (idx === -1) return innerContent;
715
- return innerContent.slice(0, idx) + newListSource + innerContent.slice(idx + listNode.source.length);
762
+ return (
763
+ innerContent.slice(0, idx) + newListSource + innerContent.slice(idx + listNode.source.length)
764
+ );
716
765
  }
717
766
 
718
767
  /**
@@ -734,7 +783,8 @@ export function reorderListItem(
734
783
 
735
784
  const listNode = field.nodes[0];
736
785
  const items = splitListItems(listNode.source);
737
- if (fromIndex < 0 || fromIndex >= items.length || toIndex < 0 || toIndex >= items.length) return innerContent;
786
+ if (fromIndex < 0 || fromIndex >= items.length || toIndex < 0 || toIndex >= items.length)
787
+ return innerContent;
738
788
 
739
789
  // Move item from fromIndex to toIndex
740
790
  const reordered = [...items];
@@ -752,7 +802,9 @@ export function reorderListItem(
752
802
  const newListSource = reordered.join('\n');
753
803
  const idx = innerContent.indexOf(listNode.source);
754
804
  if (idx === -1) return innerContent;
755
- return innerContent.slice(0, idx) + newListSource + innerContent.slice(idx + listNode.source.length);
805
+ return (
806
+ innerContent.slice(0, idx) + newListSource + innerContent.slice(idx + listNode.source.length)
807
+ );
756
808
  }
757
809
 
758
810
  /**
@@ -815,7 +867,7 @@ export function reorderGreedyItem(
815
867
  if (fromIndex < 0 || fromIndex >= field.nodes.length) return innerContent;
816
868
  if (toIndex < 0 || toIndex >= field.nodes.length) return innerContent;
817
869
 
818
- const nodesSources = field.nodes.map(n => n.source);
870
+ const nodesSources = field.nodes.map((n) => n.source);
819
871
 
820
872
  const reordered = [...nodesSources];
821
873
  const [moved] = reordered.splice(fromIndex, 1);
@@ -861,13 +913,13 @@ function findField(
861
913
  zoneName?: string,
862
914
  ): { field: ResolvedField | null; fields: ResolvedField[] | null } {
863
915
  if (structure.type === 'sequence') {
864
- const field = structure.fields.find(f => f.name === fieldName) ?? null;
916
+ const field = structure.fields.find((f) => f.name === fieldName) ?? null;
865
917
  return { field, fields: structure.fields };
866
918
  }
867
919
  if (structure.type === 'delimited' && zoneName) {
868
- const zone = structure.zones.find(z => z.name === zoneName);
920
+ const zone = structure.zones.find((z) => z.name === zoneName);
869
921
  if (!zone) return { field: null, fields: null };
870
- const field = zone.fields.find(f => f.name === fieldName) ?? null;
922
+ const field = zone.fields.find((f) => f.name === fieldName) ?? null;
871
923
  return { field, fields: zone.fields };
872
924
  }
873
925
  return { field: null, fields: null };
@@ -895,7 +947,7 @@ function insertInSequence(
895
947
  fieldName: string,
896
948
  template: string,
897
949
  ): string {
898
- const fieldIndex = fields.findIndex(f => f.name === fieldName);
950
+ const fieldIndex = fields.findIndex((f) => f.name === fieldName);
899
951
  if (fieldIndex === -1) return innerContent;
900
952
 
901
953
  // Find the last filled field before this one to insert after
@@ -940,7 +992,7 @@ function insertInDelimited(
940
992
  fields: ResolvedField[],
941
993
  template: string,
942
994
  ): string {
943
- const zoneIndex = structure.zones.findIndex(z => z.name === zoneName);
995
+ const zoneIndex = structure.zones.findIndex((z) => z.name === zoneName);
944
996
  if (zoneIndex === -1) return innerContent;
945
997
 
946
998
  // Split content at delimiters (---) to find zone boundaries
@@ -1025,8 +1077,12 @@ export function buildRuneMap(runes: RuneInfo[]): Map<string, RuneInfo> {
1025
1077
  export function extractRuneInner(example: string, name: string): string {
1026
1078
  const lines = example.split('\n');
1027
1079
  // Strip opening tag line ({% name ... %})
1028
- const openRe = new RegExp(`^\\{%\\s+${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b.*%\\}\\s*$`);
1029
- const closeRe = new RegExp(`^\\{%\\s+/${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*%\\}\\s*$`);
1080
+ const openRe = new RegExp(
1081
+ `^\\{%\\s+${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b.*%\\}\\s*$`,
1082
+ );
1083
+ const closeRe = new RegExp(
1084
+ `^\\{%\\s+/${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*%\\}\\s*$`,
1085
+ );
1030
1086
 
1031
1087
  let start = 0;
1032
1088
  let end = lines.length;
@@ -1077,7 +1133,7 @@ export function groupIntoEditorBlocks(blocks: ParsedBlock[]): EditorBlock[] {
1077
1133
 
1078
1134
  function flushProse() {
1079
1135
  if (proseChildren.length === 0) return;
1080
- const source = proseChildren.map(b => b.source).join('\n\n');
1136
+ const source = proseChildren.map((b) => b.source).join('\n\n');
1081
1137
  result.push({
1082
1138
  id: `prose_${proseChildren[0].id}`,
1083
1139
  type: 'prose',
@@ -59,7 +59,7 @@ function nodeMatchesType(node: ContentNode, match: string): boolean {
59
59
 
60
60
  // Pipe-separated alternatives: 'list|fence'
61
61
  if (match.includes('|')) {
62
- return match.split('|').some(m => nodeMatchesType(node, m));
62
+ return match.split('|').some((m) => nodeMatchesType(node, m));
63
63
  }
64
64
 
65
65
  // heading:N
@@ -134,21 +134,23 @@ function serializeNode(node: ChildNode): string {
134
134
  * Strip inline markdown formatting to produce plain text (for matching).
135
135
  */
136
136
  export function stripInlineMarkdown(source: string): string {
137
- return source
138
- // Links: [text](url) or [text](url "title") → text
139
- .replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
140
- // Images: ![alt](url) → alt
141
- .replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
142
- // Bold: **text** or __text__
143
- .replace(/\*\*(.+?)\*\*/g, '$1')
144
- .replace(/__(.+?)__/g, '$1')
145
- // Italic: *text* or _text_
146
- .replace(/\*(.+?)\*/g, '$1')
147
- .replace(/_(.+?)_/g, '$1')
148
- // Strikethrough: ~~text~~
149
- .replace(/~~(.+?)~~/g, '$1')
150
- // Inline code: `text`
151
- .replace(/`([^`]+)`/g, '$1');
137
+ return (
138
+ source
139
+ // Links: [text](url) or [text](url "title") → text
140
+ .replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
141
+ // Images: ![alt](url) → alt
142
+ .replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
143
+ // Bold: **text** or __text__
144
+ .replace(/\*\*(.+?)\*\*/g, '$1')
145
+ .replace(/__(.+?)__/g, '$1')
146
+ // Italic: *text* or _text_
147
+ .replace(/\*(.+?)\*/g, '$1')
148
+ .replace(/_(.+?)_/g, '$1')
149
+ // Strikethrough: ~~text~~
150
+ .replace(/~~(.+?)~~/g, '$1')
151
+ // Inline code: `text`
152
+ .replace(/`([^`]+)`/g, '$1')
153
+ );
152
154
  }
153
155
 
154
156
  // ── Helpers ──────────────────────────────────────────────────
@@ -14,9 +14,9 @@ import type { RuneInfo } from '../api/client.js';
14
14
  */
15
15
  function stripSnippetPlaceholders(line: string): string {
16
16
  return line
17
- .replace(/\$\{\d+\|([^,}]+)[^}]*\}/g, '$1') // ${N|first,...|} → first
18
- .replace(/\$\{\d+:([^}]*)}/g, '$1') // ${N:text} → text
19
- .replace(/\$\d+/g, ''); // $0, $1 → empty
17
+ .replace(/\$\{\d+\|([^,}]+)[^}]*\}/g, '$1') // ${N|first,...|} → first
18
+ .replace(/\$\{\d+:([^}]*)}/g, '$1') // ${N:text} → text
19
+ .replace(/\$\d+/g, ''); // $0, $1 → empty
20
20
  }
21
21
 
22
22
  /**
@@ -21,9 +21,24 @@ export interface SectionMapping {
21
21
  */
22
22
  export function isEditableSection(el: HTMLElement): boolean {
23
23
  const blockTags = new Set([
24
- 'DIV', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER', 'NAV',
25
- 'UL', 'OL', 'LI', 'TABLE', 'BLOCKQUOTE', 'PRE', 'FIGURE',
26
- 'DETAILS', 'SUMMARY', 'ASIDE', 'MAIN', 'FORM',
24
+ 'DIV',
25
+ 'SECTION',
26
+ 'ARTICLE',
27
+ 'HEADER',
28
+ 'FOOTER',
29
+ 'NAV',
30
+ 'UL',
31
+ 'OL',
32
+ 'LI',
33
+ 'TABLE',
34
+ 'BLOCKQUOTE',
35
+ 'PRE',
36
+ 'FIGURE',
37
+ 'DETAILS',
38
+ 'SUMMARY',
39
+ 'ASIDE',
40
+ 'MAIN',
41
+ 'FORM',
27
42
  ]);
28
43
  for (const child of el.children) {
29
44
  if (blockTags.has(child.tagName)) return false;
@@ -88,7 +103,10 @@ export function findSectionMapping(
88
103
 
89
104
  // For multi-line paragraphs, check if the joined text matches
90
105
  if (node.type === 'paragraph') {
91
- const joined = node.source.split('\n').map(l => l.trim()).join(' ');
106
+ const joined = node.source
107
+ .split('\n')
108
+ .map((l) => l.trim())
109
+ .join(' ');
92
110
  const joinedPlain = stripInlineMarkdown(joined);
93
111
  if (normalizeText(joinedPlain) === normalizedRendered) {
94
112
  return {
@@ -112,11 +130,7 @@ export function findSectionMapping(
112
130
  // Fallback: try matching against child nodes of rune nodes
113
131
  for (const node of nodes) {
114
132
  if (node.children) {
115
- const result = findSectionMapping(
116
- node.innerContent ?? '',
117
- dataName,
118
- renderedText,
119
- );
133
+ const result = findSectionMapping(node.innerContent ?? '', dataName, renderedText);
120
134
  if (result) return result;
121
135
  }
122
136
  }
@@ -196,8 +210,9 @@ function findListItemMapping(
196
210
 
197
211
  // Match continuation lines (description text)
198
212
  if (lines.length > 1) {
199
- const contLines = lines.slice(1)
200
- .map(l => l.replace(/^\s+/, ''))
213
+ const contLines = lines
214
+ .slice(1)
215
+ .map((l) => l.replace(/^\s+/, ''))
201
216
  .filter(Boolean);
202
217
  const contText = contLines.join(' ');
203
218
  const contPlain = stripInlineMarkdown(contText);
@@ -205,7 +220,7 @@ function findListItemMapping(
205
220
  const contSource = lines.slice(1).join('\n');
206
221
  // Find indentation from first non-empty continuation line
207
222
  // (lines[1] may be a blank separator line)
208
- const firstContentLine = lines.slice(1).find(l => l.trim().length > 0);
223
+ const firstContentLine = lines.slice(1).find((l) => l.trim().length > 0);
209
224
  const indentMatch = firstContentLine?.match(/^(\s+)/);
210
225
  const indent = indentMatch ? indentMatch[1] : '';
211
226
  // Include leading blank lines in the prefix so the replacement
@@ -272,10 +287,7 @@ export function findActionMapping(
272
287
  if (!match) continue;
273
288
 
274
289
  const [, listPrefix, linkText, linkUrl] = match;
275
- if (
276
- normalizeText(linkText) === normalizedRendered ||
277
- linkUrl === href
278
- ) {
290
+ if (normalizeText(linkText) === normalizedRendered || linkUrl === href) {
279
291
  return { source: line, listPrefix, text: linkText, href: linkUrl };
280
292
  }
281
293
  }
@@ -396,10 +408,7 @@ export interface ImageMapping {
396
408
  * Find a markdown image in the rune's inner content,
397
409
  * matching by rendered src (from the <img> element's src attribute).
398
410
  */
399
- export function findImageMapping(
400
- innerContent: string,
401
- renderedSrc: string,
402
- ): ImageMapping | null {
411
+ export function findImageMapping(innerContent: string, renderedSrc: string): ImageMapping | null {
403
412
  const lines = innerContent.split('\n');
404
413
  for (const line of lines) {
405
414
  const match = line.trim().match(/^!\[([^\]]*)\]\(([^)]*)\)\s*$/);
@@ -466,10 +475,7 @@ export function applyIconEdit(
466
475
  mapping: IconMapping,
467
476
  newIconName: string,
468
477
  ): string {
469
- const newSource = mapping.source.replace(
470
- /name=["'][^"']+["']/,
471
- `name="${newIconName}"`,
472
- );
478
+ const newSource = mapping.source.replace(/name=["'][^"']+["']/, `name="${newIconName}"`);
473
479
  const idx = innerContent.indexOf(mapping.source);
474
480
  if (idx === -1) return innerContent;
475
481
  return innerContent.slice(0, idx) + newSource + innerContent.slice(idx + mapping.source.length);
@@ -5,11 +5,16 @@ import type { ThemeConfig, RendererNode } from '@refrakt-md/transform';
5
5
  import type { SerializedTag, AggregatedData } from '@refrakt-md/types';
6
6
  import { baseConfig } from '@refrakt-md/runes';
7
7
 
8
- type PostTransformFn = (node: SerializedTag, context: { modifiers: Record<string, string>; parentType?: string }) => SerializedTag;
8
+ type PostTransformFn = (
9
+ node: SerializedTag,
10
+ context: { modifiers: Record<string, string>; parentType?: string },
11
+ ) => SerializedTag;
9
12
 
10
13
  /** Runes needing external resources or runtime data — show placeholder in editor */
11
14
  const RUNTIME_ONLY_TYPES = new Set([
12
- 'nav', 'nav-group', 'nav-item', // needs RfContext.pages
15
+ 'nav',
16
+ 'nav-group',
17
+ 'nav-item', // needs RfContext.pages
13
18
  ]);
14
19
 
15
20
  /**
@@ -72,7 +77,9 @@ export function renderBlockPreview(
72
77
  ): { html: string; isComponent: boolean } {
73
78
  const ast = Markdoc.parse(source);
74
79
  const fullConfig = restoreFunctions(themeConfig, communityPostTransforms, communityStyles);
75
- const mergedTags = extraTags ? { ...tags, ...extraTags as Record<string, import('@markdoc/markdoc').Schema> } : tags;
80
+ const mergedTags = extraTags
81
+ ? { ...tags, ...(extraTags as Record<string, import('@markdoc/markdoc').Schema>) }
82
+ : tags;
76
83
  const renderable = Markdoc.transform(ast, {
77
84
  tags: mergedTags,
78
85
  nodes,
@@ -121,7 +128,9 @@ function injectSandboxDesignTokens(node: RendererNode, aggregated: AggregatedDat
121
128
  if (node === null || node === undefined) return node;
122
129
  if (typeof node === 'string' || typeof node === 'number') return node;
123
130
  if (Array.isArray(node)) {
124
- return node.map(n => injectSandboxDesignTokens(n as RendererNode, aggregated)) as RendererNode;
131
+ return node.map((n) =>
132
+ injectSandboxDesignTokens(n as RendererNode, aggregated),
133
+ ) as RendererNode;
125
134
  }
126
135
 
127
136
  const tag = node as SerializedTag;
@@ -129,7 +138,7 @@ function injectSandboxDesignTokens(node: RendererNode, aggregated: AggregatedDat
129
138
  const design = aggregated['design'] as { contexts?: Record<string, unknown> } | undefined;
130
139
  const contexts = design?.contexts ?? {};
131
140
  const contextChild = tag.children?.find(
132
- c => (c as SerializedTag)?.attributes?.['data-field'] === 'context',
141
+ (c) => (c as SerializedTag)?.attributes?.['data-field'] === 'context',
133
142
  ) as SerializedTag | undefined;
134
143
  const scope = (contextChild?.attributes?.content as string) ?? 'default';
135
144
  const tokens = contexts[scope];
@@ -145,7 +154,9 @@ function injectSandboxDesignTokens(node: RendererNode, aggregated: AggregatedDat
145
154
  }
146
155
 
147
156
  if (tag.children?.length) {
148
- const newChildren = tag.children.map(c => injectSandboxDesignTokens(c as RendererNode, aggregated));
157
+ const newChildren = tag.children.map((c) =>
158
+ injectSandboxDesignTokens(c as RendererNode, aggregated),
159
+ );
149
160
  return { ...tag, children: newChildren };
150
161
  }
151
162
 
@@ -1,4 +1,8 @@
1
- import { parseFrontmatterClient, serializeFrontmatter, type Frontmatter } from '../utils/frontmatter.js';
1
+ import {
2
+ parseFrontmatterClient,
3
+ serializeFrontmatter,
4
+ type Frontmatter,
5
+ } from '../utils/frontmatter.js';
2
6
  import type { RuneInfo, RouteRule } from '../api/client.js';
3
7
  import type { RendererNode } from '@refrakt-md/transform';
4
8
 
@@ -83,7 +87,7 @@ class EditorState {
83
87
 
84
88
  /** Whether the current file is a layout or a regular page */
85
89
  currentFileType = $derived<'page' | 'layout'>(
86
- this.currentPath?.endsWith('_layout.md') ? 'layout' : 'page'
90
+ this.currentPath?.endsWith('_layout.md') ? 'layout' : 'page',
87
91
  );
88
92
 
89
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"community-tags-builder.d.ts","sourceRoot":"","sources":["../src/community-tags-builder.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC7C,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC,CAyDnC"}
1
+ {"version":3,"file":"community-tags-builder.d.ts","sourceRoot":"","sources":["../src/community-tags-builder.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC7C,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC,CA4DnC"}