UNPKG

@dlightjs/markit

Version:

Markit for DLight

60 lines 32.7 kB
var qt=Object.defineProperty;var zt=(N,e,t)=>e in N?qt(N,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):N[e]=t;var x=(N,e,t)=>(zt(N,typeof e!="symbol"?e+"":e,t),t);import{createElement as Wr,insertNode as jr,ForNode as Gr,ExpNode as Jr,PropView as Qr}from"@dlightjs/dlight";import{parse as Xr}from"@iandx/markit";import{View as Yr,required as Zr}from"@dlightjs/dlight";import{createElement as Kt,setHTMLProp as He,insertNode as Ot,ForNode as Wt,ExpNode as jt,PropView as Gt}from"@dlightjs/dlight";import{View as Jt,required as Qt}from"@dlightjs/dlight";import{css as Xt}from"@emotion/css";import Ae from"clsx";var J=class extends Jt{$p$ast;_$contentKey="ast";ast=Qt;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&2&&e&&He(e,"className",()=>Ae(this.dlightMarkitBlockquote,"dlight-markit-blockquote"),[this.dlightMarkitBlockquote]),t&&t.update(s)},e=Kt("blockquote"),He(e,"className",()=>Ae(this.dlightMarkitBlockquote,"dlight-markit-blockquote"),[this.dlightMarkitBlockquote]),t=new Wt(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new Gt(o=>{let r;return o(i=>{i&1&&(r&&r._$setProp("mdProps",()=>s.props,[]),r&&r._$setContent(()=>s.content,[]))}),r=new E[s.type],r._$init([["mdProps",s.props,[]]],[s.content,[]],null,null),[r]}),n=new jt(a,[]),[n]}),Ot(e,t,0),e._$nodes=[t],[e]}dlightMarkitBlockquote=Xt` padding: 4px 0 4px 18px; border-left: solid 3px gray; margin: 4px 0; `;$$dlightMarkitBlockquote=2},Le=J;import{createElement as ne,setHTMLProp as S,insertNode as tt,ForNode as $e,ExpNode as st,PropView as rt}from"@dlightjs/dlight";import{View as hr,required as ot}from"@dlightjs/dlight";import{css as at}from"@emotion/css";import{createElement as Yt,insertNode as Zt,ForNode as es,ExpNode as ts,PropView as ss}from"@dlightjs/dlight";import{View as rs,required as os}from"@dlightjs/dlight";var Q=class extends rs{$p$ast;_$contentKey="ast";ast=os;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=Yt("strong"),e.setAttribute("class","dlight-markit-bold"),t=new es(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new ss(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new ts(a,[]),[n]}),Zt(e,t,0),e._$nodes=[t],[e]}},Ce=Q;import{createElement as as,setHTMLProp as R}from"@dlightjs/dlight";import{View as is,required as ds}from"@dlightjs/dlight";import{css as ns}from"@emotion/css";import Se from"clsx";var X=class extends is{$p$ast;_$contentKey="ast";ast=ds;$$ast=1;Body(){let e;return this._$update=t=>{t&1&&e&&R(e,"textContent",()=>this.ast,[this.ast]),t&2&&e&&R(e,"className",()=>Se(this.dlightMarkitCode,"dlight-markit-code"),[this.dlightMarkitCode])},e=as("span"),R(e,"className",()=>Se(this.dlightMarkitCode,"dlight-markit-code"),[this.dlightMarkitCode]),R(e,"textContent",()=>this.ast,[this.ast]),[e]}dlightMarkitCode=ns` border-radius: 4px; background-color: Gainsboro; color: DarkOrange; padding: 4px; font-size: 95%; `;$$dlightMarkitCode=2},_e=X;import{createElement as $s,setHTMLProp as Ie,insertNode as ps,ForNode as ls,ExpNode as ms,PropView as us}from"@dlightjs/dlight";import{View as hs,required as Ns}from"@dlightjs/dlight";import{css as Ps}from"@emotion/css";import Fe from"clsx";var Y=class extends hs{$p$ast;_$contentKey="ast";ast=Ns;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&2&&e&&Ie(e,"className",()=>Fe(this.dlightMarkitHighlight,"dlight-markit-highlight"),[this.dlightMarkitHighlight]),t&&t.update(s)},e=$s("span"),Ie(e,"className",()=>Fe(this.dlightMarkitHighlight,"dlight-markit-highlight"),[this.dlightMarkitHighlight]),t=new ls(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new us(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new ms(a,[]),[n]}),ps(e,t,0),e._$nodes=[t],[e]}dlightMarkitHighlight=Ps` background-color: yellow; `;$$dlightMarkitHighlight=2},be=Y;import{createElement as Ts,insertNode as ys,ForNode as fs,ExpNode as gs,PropView as cs}from"@dlightjs/dlight";import{View as Ms,required as ks}from"@dlightjs/dlight";var Z=class extends Ms{$p$ast;_$contentKey="ast";ast=ks;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=Ts("em"),e.setAttribute("class","dlight-markit-italic"),t=new fs(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new cs(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new gs(a,[]),[n]}),ys(e,t,0),e._$nodes=[t],[e]}},De=Z;import{createElement as xs,setHTMLProp as Ve,insertNode as Es,ForNode as vs,ExpNode as ws,PropView as Hs}from"@dlightjs/dlight";import{View as As,required as Be}from"@dlightjs/dlight";var ee=class extends As{$p$ast;_$contentKey="ast";ast=Be;$$ast=1;$p$mdProps;mdProps=Be;$$mdProps=2;$s$mdProps=["linkUrl"];linkUrl;$$linkUrl=4;get $f$linkUrl(){return this._$cache("linkUrl",[this.mdProps?.linkUrl])?this.linkUrl:this.mdProps.linkUrl}Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&6&&e&&Ve(e,"href",()=>this.linkUrl,[this.linkUrl]),t&&t.update(s)},e=xs("a"),e.setAttribute("class","dlight-markit-link"),Ve(e,"href",()=>this.linkUrl,[this.linkUrl]),t=new vs(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new Hs(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new ws(a,[]),[n]}),Es(e,t,0),e._$nodes=[t],[e]}},Ue=ee;import{createElement as Ls,setHTMLProp as Re,insertNode as Cs,ForNode as Ss,ExpNode as _s,PropView as Is}from"@dlightjs/dlight";import{View as Fs,required as bs}from"@dlightjs/dlight";import{css as Ds}from"@emotion/css";import qe from"clsx";var te=class extends Fs{$p$ast;_$contentKey="ast";ast=bs;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&2&&e&&Re(e,"className",()=>qe(this.dlightMarkitStrike,"dlight-markit-strike"),[this.dlightMarkitStrike]),t&&t.update(s)},e=Ls("span"),Re(e,"className",()=>qe(this.dlightMarkitStrike,"dlight-markit-strike"),[this.dlightMarkitStrike]),t=new Ss(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new Is(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new _s(a,[]),[n]}),Cs(e,t,0),e._$nodes=[t],[e]}dlightMarkitStrike=Ds` text-decoration: line-through; `;$$dlightMarkitStrike=2},ze=te;import{createElement as Vs,insertNode as Bs,ForNode as Us,ExpNode as Rs,PropView as qs}from"@dlightjs/dlight";import{View as zs,required as Ks}from"@dlightjs/dlight";var se=class extends zs{$p$ast;_$contentKey="ast";ast=Ks;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=Vs("sub"),e.setAttribute("class","dlight-markit-subscript"),t=new Us(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new qs(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new Rs(a,[]),[n]}),Bs(e,t,0),e._$nodes=[t],[e]}},Ke=se;import{createElement as Os,insertNode as Ws,ForNode as js,ExpNode as Gs,PropView as Js}from"@dlightjs/dlight";import{View as Qs,required as Xs}from"@dlightjs/dlight";var re=class extends Qs{$p$ast;_$contentKey="ast";ast=Xs;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=Os("sup"),e.setAttribute("class","dlight-markit-superscript"),t=new js(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new Js(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new Gs(a,[]),[n]}),Ws(e,t,0),e._$nodes=[t],[e]}},Oe=re;import{createElement as Ys,setHTMLProp as We,insertNode as Zs,ForNode as er,ExpNode as tr,PropView as sr}from"@dlightjs/dlight";import{View as rr,required as or}from"@dlightjs/dlight";import{css as ar}from"@emotion/css";import je from"clsx";var oe=class extends rr{$p$ast;_$contentKey="ast";ast=or;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&2&&e&&We(e,"className",()=>je(this.dlightMarkitUnderline,"dlight-markit-underline"),[this.dlightMarkitUnderline]),t&&t.update(s)},e=Ys("span"),We(e,"className",()=>je(this.dlightMarkitUnderline,"dlight-markit-underline"),[this.dlightMarkitUnderline]),t=new er(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new sr(o=>{let r;return o(i=>{i&1&&r&&r._$setContent(()=>s.content,[])}),r=new y[s.type],r._$init(null,[s.content,[]],null,null),[r]}),n=new tr(a,[]),[n]}),Zs(e,t,0),e._$nodes=[t],[e]}dlightMarkitUnderline=ar` text-decoration: underline; `;$$dlightMarkitUnderline=2},Ge=oe;import{createElement as ir,setHTMLProp as Je}from"@dlightjs/dlight";import{View as dr,required as nr}from"@dlightjs/dlight";var ae=class extends dr{$p$ast;_$contentKey="ast";ast=nr;$$ast=1;Body(){let e;return this._$update=t=>{t&1&&e&&Je(e,"textContent",()=>this.ast,[this.ast])},e=ir("span"),e.setAttribute("class","dlight-markit-text"),Je(e,"textContent",()=>this.ast,[this.ast]),[e]}},Qe=ae;import{createElement as Xe,setHTMLProp as H}from"@dlightjs/dlight";import{View as $r,required as Ye}from"@dlightjs/dlight";import{css as pr}from"@emotion/css";import Ze from"clsx";var ie=class extends $r{$p$ast;_$contentKey="ast";ast=Ye;$$ast=1;$p$mdProps;mdProps=Ye;$$mdProps=2;$s$mdProps=["footnoteSupId"];footnoteSupId;$$footnoteSupId=4;get $f$footnoteSupId(){return this._$cache("footnoteSupId",[this.mdProps?.footnoteSupId])?this.footnoteSupId:this.mdProps.footnoteSupId}Body(){let e,t;return this._$update=s=>{s&1&&(e&&H(e,"href",()=>`#Markit-Footnote-${this.ast}-0`,[this.ast]),t&&H(t,"textContent",()=>this.ast,[this.ast])),s&7&&t&&H(t,"id",()=>`Markit-FootnoteSup-${this.ast}-${this.footnoteSupId}`,[this.ast,this.footnoteSupId]),s&8&&e&&H(e,"className",()=>Ze(this.dlightMarkitFootnoteSup,"dlight-markit-footnote-sup"),[this.dlightMarkitFootnoteSup])},e=ie.$t0.cloneNode(!0),t=e.firstChild,H(e,"className",()=>Ze(this.dlightMarkitFootnoteSup,"dlight-markit-footnote-sup"),[this.dlightMarkitFootnoteSup]),H(e,"href",()=>`#Markit-Footnote-${this.ast}-0`,[this.ast]),H(t,"id",()=>`Markit-FootnoteSup-${this.ast}-${this.footnoteSupId}`,[this.ast,this.footnoteSupId]),H(t,"textContent",()=>this.ast,[this.ast]),[e]}dlightMarkitFootnoteSup=pr` color: gray; text-decoration: none; `;$$dlightMarkitFootnoteSup=8},q=ie;x(q,"$t0",(()=>{let e,t;return e=Xe("a"),t=Xe("sup"),t.setAttribute("class","dlight-markit-footnote-sup"),e.appendChild(t),e})());var et=q;import{addInlineRule as lr}from"@iandx/markit";var mr={Text:Qe,Bold:Ce,Italic:De,Strike:ze,Code:_e,Link:Ue,Underline:Ge,Highlight:be,Superscript:Oe,Subscript:Ke,FootnoteSup:et},de=new Proxy(mr,{get(N,e){return N[e]??N.Text}}),ur=({name:N,rule:e,view:t})=>{lr([{name:N,rule:e}]),de[N]=t},y=de;import z from"clsx";var pe=class extends hr{$p$ast;_$contentKey="ast";ast=ot;$$ast=1;$p$mdProps;mdProps=ot;$$mdProps=2;$s$mdProps=["isChecked"];isChecked;$$isChecked=4;get $f$isChecked(){return this._$cache("isChecked",[this.mdProps?.isChecked])?this.isChecked:this.mdProps.isChecked}Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=ne("div"),e.setAttribute("class","dlight-markit-checklist"),t=new $e(this.ast,1,null,({item:s,content:$},d,a)=>{let n,o,r,i;return d[a]=(l,P)=>{({item:s,content:$}=P),l&1&&(r&&r.updateArray(s,null),i&&i.updateArray($,null)),l&6&&o&&S(o,"checked",()=>this.isChecked,[this.isChecked]),l&8&&n&&S(n,"className",()=>z(this.dlightMarkitCheckboxWrap,"dlight-markit-checklist-wrap"),[this.dlightMarkitCheckboxWrap]),l&16&&o&&S(o,"className",()=>z(this.dlightMarkitCheckbox,"dlight-markit-checkbox"),[this.dlightMarkitCheckbox]),r&&r.update(l),i&&i.update(l)},n=pe.$t0.cloneNode(!0),o=n.firstChild,S(n,"className",()=>z(this.dlightMarkitCheckboxWrap,"dlight-markit-checklist-wrap"),[this.dlightMarkitCheckboxWrap]),S(o,"className",()=>z(this.dlightMarkitCheckbox,"dlight-markit-checkbox"),[this.dlightMarkitCheckbox]),S(o,"checked",()=>this.isChecked,[this.isChecked]),r=new $e(s,1,null,(l,P,T)=>{let u,m;return P[T]=(p,h)=>{l=h,p&1&&m&&m.update(()=>u,[]),u&&u.update(p)},u=new rt(p=>{let h;return p(M=>{M&1&&(h&&h._$setProp("mdProps",()=>l.props,[]),h&&h._$setContent(()=>l.content,[]))}),h=new y[l.type],h._$init([["mdProps",l.props,[]]],[l.content,[]],null,null),[h]}),m=new st(u,[]),[m]}),tt(n,r,1),i=new $e($,1,null,(l,P,T)=>{let u,m;return P[T]=(p,h)=>{l=h,p&1&&m&&m.update(()=>u,[]),u&&u.update(p)},u=new rt(p=>{let h;return p(M=>{M&1&&(h&&h._$setProp("mdProps",()=>l.props,[]),h&&h._$setContent(()=>l.content,[]))}),h=new E[l.type],h._$init([["mdProps",l.props,[]]],[l.content,[]],null,null),[h]}),m=new st(u,[]),[m]}),[n,i]}),tt(e,t,0),e._$nodes=[t],[e]}dlightMarkitCheckboxWrap=at` display: flex; flex-direction: row; align-items: center; `;$$dlightMarkitCheckboxWrap=8;dlightMarkitCheckbox=at` margin-right: 5px; `;$$dlightMarkitCheckbox=16},K=pe;x(K,"$t0",(()=>{let e,t;return e=ne("div"),t=ne("input"),t.disabled=!0,t.type="checkbox",e.appendChild(t),e})());var it=K;import{createElement as Nr,setHTMLProp as dt}from"@dlightjs/dlight";import{View as Pr,required as nt}from"@dlightjs/dlight";import{css as Tr}from"@emotion/css";import $t from"clsx";var le=class extends Pr{$p$ast;_$contentKey="ast";ast=nt;$p$mdProps;mdProps=nt;$$mdProps=2;$s$mdProps=["dividerType","dlightMarkitDivider"];dividerType;$$dividerType=4;$s$dividerType=["dlightMarkitDivider"];get $f$dividerType(){return this._$cache("dividerType",[this.mdProps?.dividerType])?this.dividerType:this.mdProps.dividerType}Body(){let e;return this._$update=t=>{t&14&&e&&dt(e,"className",()=>$t(this.dlightMarkitDivider,"dlight-markit-divider"),[this.dlightMarkitDivider])},e=Nr("div"),dt(e,"className",()=>$t(this.dlightMarkitDivider,"dlight-markit-divider"),[this.dlightMarkitDivider]),[e]}dlightMarkitDivider;$$dlightMarkitDivider=8;get $f$dlightMarkitDivider(){return this._$cache("dlightMarkitDivider",[this.dividerType])?this.dlightMarkitDivider:Tr` border-top-width: 1px; border-bottom-width: 1px; border-color: gray; margin: 4px; height: 0px; width: auto; border-style: ${this.dividerType}; `}},pt=le;import{createElement as yr,insertNode as fr,ForNode as gr,ExpNode as lt,PropView as mt}from"@dlightjs/dlight";import{View as cr,required as ut}from"@dlightjs/dlight";var me=class extends cr{$p$ast;_$contentKey="ast";ast=ut;$$ast=1;$p$mdProps;mdProps=ut;$$mdProps=2;$s$mdProps=["headingName"];headingName;$$headingName=4;get $f$headingName(){return this._$cache("headingName",[this.mdProps?.headingLevel])?this.headingName:`h${this.mdProps.headingLevel}`}Body(){let e,t;return this._$update=s=>{s&6&&t&&t.update(()=>e,[this.headingName]),e&&e.update(s)},e=new mt(s=>{let $,d;return s(a=>{a&1&&d&&d.updateArray(this.ast,null),d&&d.update(a)}),$=yr(this.headingName),$.setAttribute("class","dlight-markit-heading"),d=new gr(this.ast,1,null,(a,n,o)=>{let r,i;return n[o]=(l,P)=>{a=P,l&1&&i&&i.update(()=>r,[]),r&&r.update(l)},r=new mt(l=>{let P;return l(T=>{T&1&&(P&&P._$setProp("mdProps",()=>a.props,[]),P&&P._$setContent(()=>a.content,[]))}),P=new y[a.type],P._$init([["mdProps",a.props,[]]],[a.content,[]],null,null),[P]}),i=new lt(r,[]),[i]}),fr($,d,0),$._$nodes=[d],[$]}),t=new lt(e,[this.headingName]),[t]}},ht=me;import{createElement as Nt,setHTMLProp as Pt,insertNode as Tt,ForNode as ue,ExpNode as yt,PropView as ft}from"@dlightjs/dlight";import{View as Mr,required as gt}from"@dlightjs/dlight";var he=class extends Mr{$p$ast;_$contentKey="ast";ast=gt;$$ast=1;$p$mdProps;mdProps=gt;$$mdProps=2;$s$mdProps=["start"];start;$$start=4;get $f$start(){return this._$cache("start",[this.mdProps?.start])?this.start:this.mdProps.start}Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),s&6&&e&&Pt(e,"start",()=>this.start,[this.start]),t&&t.update(s)},e=Nt("ol"),e.setAttribute("class","dlight-markit-ordered-list-ol"),Pt(e,"start",()=>this.start,[this.start]),t=new ue(this.ast,1,null,({content:s,item:$},d,a)=>{let n,o,r;return d[a]=(i,l)=>{({content:s,item:$}=l),i&1&&(o&&o.updateArray($,null),r&&r.updateArray(s,null)),o&&o.update(i),r&&r.update(i)},n=Nt("li"),n.setAttribute("class","dlight-markit-ordered-list-li"),o=new ue($,1,null,(i,l,P)=>{let T,u;return l[P]=(m,p)=>{i=p,m&1&&u&&u.update(()=>T,[]),T&&T.update(m)},T=new ft(m=>{let p;return m(h=>{h&1&&(p&&p._$setProp("mdProps",()=>i.props,[]),p&&p._$setContent(()=>i.content,[]))}),p=new y[i.type],p._$init([["mdProps",i.props,[]]],[i.content,[]],null,null),[p]}),u=new yt(T,[]),[u]}),Tt(n,o,0),n._$nodes=[o],r=new ue(s,1,null,(i,l,P)=>{let T,u;return l[P]=(m,p)=>{i=p,m&1&&u&&u.update(()=>T,[]),T&&T.update(m)},T=new ft(m=>{let p;return m(h=>{h&1&&(p&&p._$setProp("mdProps",()=>i.props,[]),p&&p._$setContent(()=>i.content,[]))}),p=new E[i.type],p._$init([["mdProps",i.props,[]]],[i.content,[]],null,null),[p]}),u=new yt(T,[]),[u]}),[n,r]}),Tt(e,t,0),e._$nodes=[t],[e]}},ct=he;import{createElement as kr,insertNode as xr,ForNode as Er,ExpNode as vr,PropView as wr}from"@dlightjs/dlight";import{View as Hr,required as Ar}from"@dlightjs/dlight";var Ne=class extends Hr{$p$ast;_$contentKey="ast";ast=Ar;$$ast=1;Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=kr("div"),e.setAttribute("class","dlight-markit-paragraph"),t=new Er(this.ast,1,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&1&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new wr(o=>{let r;return o(i=>{i&1&&(r&&r._$setProp("mdProps",()=>s.props,[]),r&&r._$setContent(()=>s.content,[]))}),r=new y[s.type],r._$init([["mdProps",s.props,[]]],[s.content,[]],null,null),[r]}),n=new vr(a,[]),[n]}),xr(e,t,0),e._$nodes=[t],[e]}},Mt=Ne;import{createElement as b,setHTMLProp as _,insertNode as D,ForNode as V,CondNode as Lr,ExpNode as kt,PropView as xt}from"@dlightjs/dlight";import{View as Cr,required as Et}from"@dlightjs/dlight";import{css as Pe}from"@emotion/css";import{clsx as I}from"clsx";var Te=class extends Cr{$p$ast;_$contentKey="ast";ast=Et;$$ast=1;$p$mdProps;mdProps=Et;$$mdProps=2;$s$mdProps=["headerAligns","rowAligns"];headerAligns;$$headerAligns=4;get $f$headerAligns(){return this._$cache("headerAligns",[this.mdProps?.headerAligns])?this.headerAligns:this.mdProps.headerAligns}rowAligns;$$rowAligns=8;get $f$rowAligns(){return this._$cache("rowAligns",[this.mdProps?.rowAligns])?this.rowAligns:this.mdProps.rowAligns}Body(){let e,t,s,$;return this._$update=d=>{d&1&&(s&&s.updateArray(this.ast.slice(1),null),$&&$.updateArray(this.ast[0].entries(),null)),d&16&&e&&_(e,"className",()=>I(this.dlightMarkitTable,"dlight-markit-table"),[this.dlightMarkitTable]),s&&s.update(d),$&&$.update(d)},e=Te.$t0.cloneNode(!0),t=e.firstChild,_(e,"className",()=>I(this.dlightMarkitTable,"dlight-markit-table"),[this.dlightMarkitTable]),s=new V(this.ast.slice(1),1,null,(d,a,n)=>{let o,r;return a[n]=(i,l)=>{d=l,i&1&&r&&r.updateArray(d.entries(),null),r&&r.update(i)},o=b("tr"),o.setAttribute("class","dlight-markit-table-tr"),r=new V(d.entries(),1,null,([i,l],P,T)=>{let u;return P[T]=(m,p)=>{[i,l]=p,m&1&&u&&u.updateArray(l,null),u&&u.update(m)},u=new V(l,1,null,({type:m,content:p,mdProps:h},M,k)=>{let v,L;return M[k]=(g,w)=>{({type:m,content:p,mdProps:h}=w),g&1&&L&&L.updateCond(),g&74&&v&&_(v,"className",()=>I(this.dlightMarkitTableTd(this.rowAligns[i]),"dlight-markit-table-td"),[this.dlightMarkitTableTd,this.rowAligns]),L&&L.update(g)},v=b("td"),_(v,"className",()=>I(this.dlightMarkitTableTd(this.rowAligns[i]),"dlight-markit-table-td"),[this.dlightMarkitTableTd,this.rowAligns]),L=new Lr(1,g=>{if(m){if(g.cond===0)return g.didntChange=!0,[];g.cond=0;let w,B;return g.updateFunc=U=>{U&1&&B&&B.update(()=>w,[]),w&&w.update(U)},w=new xt(U=>{let C;return U(Rt=>{Rt&1&&(C&&C._$setProp("mdProps",()=>h,[h]),C&&C._$setContent(()=>p,[]))}),C=new y[m],C._$init([["mdProps",h,[h]]],[p,[]],null,null),[C]}),B=new kt(w,[]),g.cond===0?[B]:g.updateCond()}else return g.cond===1?(g.didntChange=!0,[]):(g.cond=1,g.updateFunc=w=>{},g.cond===1?[]:g.updateCond())}),D(v,L,0),v._$nodes=[L],[v]}),[u]}),D(o,r,0),o._$nodes=[r],[o]}),D(e,s,1),$=new V(this.ast[0].entries(),1,null,([d,a],n,o)=>{let r;return n[o]=(i,l)=>{[d,a]=l,i&1&&r&&r.updateArray(a,null),r&&r.update(i)},r=new V(a,1,null,({type:i,content:l,mdProps:P},T,u)=>{let m,p,h;return T[u]=(M,k)=>{({type:i,content:l,mdProps:P}=k),M&1&&h&&h.update(()=>p,[]),M&38&&m&&_(m,"className",()=>I(this.dlightMarkitTableTh(this.headerAligns[d]),"dlight-markit-table-th"),[this.dlightMarkitTableTh,this.headerAligns]),p&&p.update(M)},m=b("th"),_(m,"className",()=>I(this.dlightMarkitTableTh(this.headerAligns[d]),"dlight-markit-table-th"),[this.dlightMarkitTableTh,this.headerAligns]),p=new xt(M=>{let k;return M(v=>{v&1&&(k&&k._$setProp("mdProps",()=>P,[P]),k&&k._$setContent(()=>l,[]))}),k=new y[i],k._$init([["mdProps",P,[P]]],[l,[]],null,null),[k]}),h=new kt(p,[]),D(m,h,0),m._$nodes=[h],[m]}),[r]}),D(t,$,0),[e]}dlightMarkitTable=Pe` border-collapse: collapse; `;$$dlightMarkitTable=16;dlightMarkitTableTh=e=>Pe` border: solid 1px gray; padding: 5px; text-align: ${e}; `;$$dlightMarkitTableTh=32;dlightMarkitTableTd=e=>Pe` border: solid 1px gray; padding: 5px; text-align: ${e}; `;$$dlightMarkitTableTd=64},O=Te;x(O,"$t0",(()=>{let e,t;return e=b("table"),t=b("tr"),t.setAttribute("class","dlight-markit-table-tr"),e.appendChild(t),e})());var vt=O;import{createElement as wt,insertNode as Ht,ForNode as ye,ExpNode as At,PropView as Lt}from"@dlightjs/dlight";import{View as Sr,required as Ct}from"@dlightjs/dlight";var fe=class extends Sr{$p$ast;_$contentKey="ast";ast=Ct;$$ast=1;$p$mdProps;mdProps=Ct;$$mdProps=2;$s$mdProps=["level"];level;get $f$level(){return this._$cache("level",[this.mdProps?.level])?this.level:this.mdProps.level}Body(){let e,t;return this._$update=s=>{s&1&&t&&t.updateArray(this.ast,null),t&&t.update(s)},e=wt("ul"),e.setAttribute("class","dlight-markit-unordered-list-ul"),t=new ye(this.ast,1,null,({content:s,item:$},d,a)=>{let n,o,r;return d[a]=(i,l)=>{({content:s,item:$}=l),i&1&&(o&&o.updateArray($,null),r&&r.updateArray(s,null)),o&&o.update(i),r&&r.update(i)},n=wt("li"),n.setAttribute("class","dlight-markit-unordered-list-li"),o=new ye($,1,null,(i,l,P)=>{let T,u;return l[P]=(m,p)=>{i=p,m&1&&u&&u.update(()=>T,[]),T&&T.update(m)},T=new Lt(m=>{let p;return m(h=>{h&1&&(p&&p._$setProp("mdProps",()=>i.props,[]),p&&p._$setContent(()=>i.content,[]))}),p=new y[i.type],p._$init([["mdProps",i.props,[]]],[i.content,[]],null,null),[p]}),u=new At(T,[]),[u]}),Ht(n,o,0),n._$nodes=[o],r=new ye(s,1,null,(i,l,P)=>{let T,u;return l[P]=(m,p)=>{i=p,m&1&&u&&u.update(()=>T,[]),T&&T.update(m)},T=new Lt(m=>{let p;return m(h=>{h&1&&(p&&p._$setProp("mdProps",()=>i.props,[]),p&&p._$setContent(()=>i.content,[]))}),p=new E[i.type],p._$init([["mdProps",i.props,[]]],[i.content,[]],null,null),[p]}),u=new At(T,[]),[u]}),[n,r]}),Ht(e,t,0),e._$nodes=[t],[e]}},St=fe;import{createElement as W,setHTMLProp as f,insertNode as _r,CondNode as Ir}from"@dlightjs/dlight";import{View as Fr,required as _t}from"@dlightjs/dlight";import{css as ge}from"@emotion/css";import A from"clsx";var ce=class extends Fr{$p$ast;_$contentKey="ast";ast=_t;$p$mdProps;mdProps=_t;$$mdProps=2;$s$mdProps=["imageUrl","alt","title","zoomSize","alignment","linkUrl","dlightMarkitImageDiv"];imageUrl;$$imageUrl=4;get $f$imageUrl(){return this._$cache("imageUrl",[this.mdProps?.imageUrl])?this.imageUrl:this.mdProps.imageUrl}alt;$$alt=8;get $f$alt(){return this._$cache("alt",[this.mdProps?.altContent])?this.alt:this.mdProps.altContent}title;$$title=16;get $f$title(){return this._$cache("title",[this.mdProps?.title])?this.title:this.mdProps.title}zoomSize;$$zoomSize=32;$s$zoomSize=["dlightMarkitImageDiv"];get $f$zoomSize(){return this._$cache("zoomSize",[this.mdProps?.zoomSize])?this.zoomSize:this.mdProps.zoomSize}alignment;$$alignment=64;$s$alignment=["dlightMarkitImageDiv"];get $f$alignment(){return this._$cache("alignment",[this.mdProps?.alignment])?this.alignment:this.mdProps.alignment}linkUrl;$$linkUrl=128;get $f$linkUrl(){return this._$cache("linkUrl",[this.mdProps?.linkUrl])?this.linkUrl:this.mdProps.linkUrl}margins={left:"0px auto 0px 0px",center:"0px auto",right:"0px 0px 0px auto"};$$margins=256;$s$margins=["dlightMarkitImageDiv"];Body(){let e,t;return this._$update=s=>{s&130&&t&&t.updateCond(),s&866&&e&&f(e,"className",()=>A(this.dlightMarkitImageDiv,"dlight-markit-image-div"),[this.dlightMarkitImageDiv]),t&&t.update(s)},e=W("div"),f(e,"className",()=>A(this.dlightMarkitImageDiv,"dlight-markit-image-div"),[this.dlightMarkitImageDiv]),t=new Ir(130,s=>{if(this.linkUrl){if(s.cond===0)return s.didntChange=!0,[];s.cond=0;let $,d;return s.updateFunc=a=>{a&6&&d&&f(d,"src",()=>this.imageUrl,[this.imageUrl]),a&10&&d&&f(d,"alt",()=>this.alt,[this.alt]),a&18&&d&&f(d,"title",()=>this.title,[this.title]),a&130&&$&&f($,"href",()=>this.linkUrl,[this.linkUrl]),a&1024&&d&&f(d,"className",()=>A(this.dlightMarkitImage,"dlight-markit-image"),[this.dlightMarkitImage]),a&2048&&$&&f($,"className",()=>A(this.dlightMarkitImageA,"dlight-markit-image-a"),[this.dlightMarkitImageA])},$=ce.$t0.cloneNode(!0),d=$.firstChild,f($,"className",()=>A(this.dlightMarkitImageA,"dlight-markit-image-a"),[this.dlightMarkitImageA]),f($,"href",()=>this.linkUrl,[this.linkUrl]),f(d,"className",()=>A(this.dlightMarkitImage,"dlight-markit-image"),[this.dlightMarkitImage]),f(d,"title",()=>this.title,[this.title]),f(d,"alt",()=>this.alt,[this.alt]),f(d,"src",()=>this.imageUrl,[this.imageUrl]),s.cond===0?[$]:s.updateCond()}else{if(s.cond===1)return s.didntChange=!0,[];s.cond=1;let $;return s.updateFunc=d=>{d&6&&$&&f($,"src",()=>this.imageUrl,[this.imageUrl]),d&10&&$&&f($,"alt",()=>this.alt,[this.alt]),d&18&&$&&f($,"title",()=>this.title,[this.title]),d&1024&&$&&f($,"className",()=>A(this.dlightMarkitImage,"dlight-markit-image"),[this.dlightMarkitImage])},$=W("img"),f($,"className",()=>A(this.dlightMarkitImage,"dlight-markit-image"),[this.dlightMarkitImage]),f($,"title",()=>this.title,[this.title]),f($,"alt",()=>this.alt,[this.alt]),f($,"src",()=>this.imageUrl,[this.imageUrl]),s.cond===1?[$]:s.updateCond()}}),_r(e,t,0),e._$nodes=[t],[e]}dlightMarkitImageDiv;$$dlightMarkitImageDiv=512;get $f$dlightMarkitImageDiv(){return this._$cache("dlightMarkitImageDiv",[this.margins,this.alignment,this.zoomSize])?this.dlightMarkitImageDiv:ge` margin: ${this.margins[this.alignment]}; width: ${this.zoomSize}; height: ${this.zoomSize}; `}dlightMarkitImage=ge` width: 100%; `;$$dlightMarkitImage=1024;dlightMarkitImageA=ge` display: block; `;$$dlightMarkitImageA=2048},j=ce;x(j,"$t0",(()=>{let e,t;return e=W("a"),t=W("img"),e.appendChild(t),e})());var It=j;import{createElement as Me,setHTMLProp as c,insertNode as Ft,ForNode as bt,ExpNode as br,PropView as Dr}from"@dlightjs/dlight";import{View as Vr,required as Dt}from"@dlightjs/dlight";import{css as ke}from"@emotion/css";import Br from"@iandx/markit";import F from"clsx";var xe=class extends Vr{$p$ast;_$contentKey="ast";ast=Dt;$$ast=1;$p$mdProps;mdProps=Dt;$$mdProps=2;$s$mdProps=["noteName","footnoteIdx","rerender","elementOrder","footNoteSubTrees"];noteName;$$noteName=4;$s$noteName=["footNoteSubTrees"];get $f$noteName(){return this._$cache("noteName",[this.mdProps?.noteName])?this.noteName:this.mdProps.noteName}footnoteIdx;$$footnoteIdx=8;get $f$footnoteIdx(){return this._$cache("footnoteIdx",[this.mdProps?.footnoteIdx])?this.footnoteIdx:this.mdProps.footnoteIdx}rerender;get $f$rerender(){return this._$cache("rerender",[this.mdProps?.rerender])?this.rerender:this.mdProps.rerender}elementOrder;get $f$elementOrder(){return this._$cache("elementOrder",[this.mdProps?.elementOrder])?this.elementOrder:this.mdProps.elementOrder}footNoteSubTrees;$$footNoteSubTrees=64;get $f$footNoteSubTrees(){return this._$cache("footNoteSubTrees",[this.noteName])?this.footNoteSubTrees:Br.ast.findInlineItems("FootnoteSup",e=>e.content===this.noteName)}Body(){let e,t,s,$;return this._$update=d=>{d&1&&s&&s.updateArray(this.ast,null),d&6&&t&&c(t,"textContent",()=>`[${this.noteName}] `,[this.noteName]),d&14&&e&&c(e,"id",()=>`Markit-Footnote-${this.noteName}-${this.footnoteIdx}`,[this.noteName,this.footnoteIdx]),d&70&&$&&$.updateArray(this.footNoteSubTrees,null),d&128&&e&&c(e,"className",()=>F(this.dlightMarkitFootNoteWrap,"dlight-markit-footnote-wrap"),[this.dlightMarkitFootNoteWrap]),d&256&&t&&c(t,"className",()=>F(this.dlightMarkitNoteName,"dlight-markit-note-name"),[this.dlightMarkitNoteName]),s&&s.update(d),$&&$.update(d)},e=xe.$t0.cloneNode(!0),t=e.firstChild,c(e,"className",()=>F(this.dlightMarkitFootNoteWrap,"dlight-markit-footnote-wrap"),[this.dlightMarkitFootNoteWrap]),c(e,"id",()=>`Markit-Footnote-${this.noteName}-${this.footnoteIdx}`,[this.noteName,this.footnoteIdx]),c(t,"className",()=>F(this.dlightMarkitNoteName,"dlight-markit-note-name"),[this.dlightMarkitNoteName]),c(t,"textContent",()=>`[${this.noteName}] `,[this.noteName]),s=new bt(this.ast,1,null,(d,a,n)=>{let o,r;return a[n]=(i,l)=>{d=l,i&1&&r&&r.update(()=>o,[]),o&&o.update(i)},o=new Dr(i=>{let l;return i(P=>{P&1&&l&&l._$setContent(()=>d.content,[])}),l=new y[d.type],l._$init(null,[d.content,[]],null,null),[l]}),r=new br(o,[]),[r]}),Ft(e,s,1),$=new bt(this.footNoteSubTrees,70,null,(d,a,n)=>{let o;return a[n]=(r,i)=>{d=i,r&70&&o&&c(o,"href",()=>`#Markit-FootnoteSup-${this.noteName}-${d.props.footnoteSupId}`,[this.noteName]),r&512&&o&&c(o,"className",()=>F(this.dlightMarkitFootNote,"dlight-markit-footnote"),[this.dlightMarkitFootNote])},o=Me("a"),c(o,"className",()=>F(this.dlightMarkitFootNote,"dlight-markit-footnote"),[this.dlightMarkitFootNote]),c(o,"href",()=>`#Markit-FootnoteSup-${this.noteName}-${d.props.footnoteSupId}`,[this.noteName]),o.textContent="\u21A9",[o]}),Ft(e,$,2),[e]}dlightMarkitFootNoteWrap=ke` font-size: small; `;$$dlightMarkitFootNoteWrap=128;dlightMarkitNoteName=ke` white-space: pre-wrap; `;$$dlightMarkitNoteName=256;dlightMarkitFootNote=ke` text-decoration: none; color: gray; `;$$dlightMarkitFootNote=512},G=xe;x(G,"$t0",(()=>{let e,t;return e=Me("div"),t=Me("span"),e.appendChild(t),e})());var Vt=G;import{createElement as Ur,insertNode as Rr}from"@dlightjs/dlight";import{View as qr,required as Bt}from"@dlightjs/dlight";var Ee=class extends qr{$p$ast;_$contentKey="ast";ast=Bt;$$ast=1;$p$mdProps;mdProps=Bt;$$mdProps=2;$s$mdProps=["language"];language;get $f$language(){return this._$cache("language",[this.mdProps?.language])?this.language:this.mdProps.language}Body(){let e,t;return this._$update=s=>{s&1&&t&&t._$setContent(()=>this.ast,[this.ast])},e=Ur("div"),t=new y.Text,t._$init(null,[this.ast,[this.ast]],null,null),Rr(e,t,0),e._$nodes=[t],[e]}},Ut=Ee;import{addBlockRule as zr}from"@iandx/markit";var Kr={Paragraph:Mt,Heading:ht,UnorderedList:St,OrderedList:ct,Table:vt,Blockquote:Le,Divider:pt,CheckList:it,Image:It,Footnote:Vt,CodeBlock:Ut},ve=new Proxy(Kr,{get(N,e){return N[e]??N.Paragraph}}),Or=({name:N,rule:e,view:t})=>{zr({name:N,rule:e}),ve[N]=t},E=ve;var we=class extends Yr{$p$str;_$contentKey="str";str=Zr;$$str=1;$s$str=["markitAst","omitAst"];$p$getAst;getAst;$$getAst=2;$s$getAst=["omitAst"];markitAst;$$markitAst=4;$s$markitAst=["omitAst"];get $f$markitAst(){return this._$cache("markitAst",[this.str])?this.markitAst:Xr(this.str)}omitAst;get $f$omitAst(){return this._$cache("omitAst",[this.getAst,this.markitAst])?this.omitAst:this.getAst?.(this.markitAst)}Body(){let e,t;return this._$update=s=>{s&5&&t&&t.updateArray(this.markitAst,null),t&&t.update(s)},e=Wr("div"),t=new Gr(this.markitAst,5,null,(s,$,d)=>{let a,n;return $[d]=(o,r)=>{s=r,o&5&&n&&n.update(()=>a,[]),a&&a.update(o)},a=new Qr(o=>{let r;return o(i=>{i&5&&(r&&r._$setProp("mdProps",()=>s.props,[]),r&&r._$setContent(()=>s.content,[]))}),r=new E[s.type],r._$init([["mdProps",s.props,[]]],[s.content,[]],null,null),[r]}),n=new Jr(a,[]),[n]}),jr(e,t,0),e._$nodes=[t],[e]}},eo=we;export{ve as BlockRenderer,de as InlineRenderer,eo as MarkitView,Or as addBlockRule,ur as addInlineRule}; //# sourceMappingURL=index.js.map