xote 4.3.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/xote.umd.js CHANGED
@@ -1 +1 @@
1
- (function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g.xote={}))})(this,(function(g){"use strict";let T={contents:0};function X(){return T.contents=T.contents+1|0,T.contents}function Ae(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Ce(e){if(e!=null)return Ae(e)}function re(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function q(e,t){return e!==void 0?re(e):t}function Ne(e,t,n){return e.reduce(n,t)}function Ie(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],c=t(a);c!==void 0&&(r[l]=re(c),l=l+1|0)}return r.length=l,r}function Me(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,C=new Map,F=new Map,p={contents:void 0},N=new Set,O={contents:!1},b={contents:!1};function H(e){if(C.get(e)===void 0){C.set(e,new Set);return}}function je(e,t){let n=C.get(e);if(n!==void 0){n.forEach(t);return}}function Re(e,t){let n=C.get(e);if(n!==void 0){n.add(t);return}}function Pe(e,t){let n=C.get(e);if(n!==void 0){n.delete(t);return}}function De(e){return Array.from(q(C.get(e),new Set).values())}function le(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function Fe(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function Le(e){let t=p.contents;return t!==void 0?t===e:!1}function xe(e){if(!O.contents){O.contents=!0;try{e(),O.contents=!1;return}catch(t){throw O.contents=!1,t}}}function Ge(e,t){H(t);let n=Le(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Re(t,e)}function I(e){e.deps.forEach(t=>Pe(t,e.id)),e.deps.clear()}function Be(e){let t=F.get(e);if(t===void 0)return;F.delete(e);let n=h.get(t);if(n!==void 0){I(n),h.delete(t);return}}function ue(e){return Ne(e,0,(t,n)=>n>t?n:t)}function Ve(e){let t=[];return e.deps.forEach(n=>je(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),ue(t)+1|0}function ze(e){let t=[];return e.deps.forEach(n=>{let r=F.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),ue(t)+1|0}function V(e){return typeof e.kind=="object"?ze(e):Ve(e)}function We(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,c=typeof r.kind=="object"?0:1,d=u-c|0;return d!==0?d:n.level-r.level|0}function Ke(e){b.contents=!0,I(e),le(e.id,()=>{e.run(),b.contents=!1}),e.level=V(e)}function ie(){for(;N.size>0;){let e=Array.from(N.values());N.clear(),e.sort(We),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Ke(n)})}}function oe(e){if(H(e),De(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,oe(r.VAL));N.add(t)}),N.size>0)return xe(ie)}function ce(e){let t=F.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){b.contents=!0,I(n),le(t,()=>{n.run(),n.dirty=!1,b.contents=!1}),n.level=V(n);return}}function Xe(e){let t=O.contents;O.contents=!0;try{let n=e();return t||(O.contents=!1,N.size>0&&ie()),n}catch(n){throw t||(O.contents=!1),n}}let qe=Fe,He=H;function de(e,t,n){let r=X();return He(r),{id:r,value:{contents:e},version:{contents:0},equals:q(n,(l,u)=>l===u),name:t}}function Ue(e){ce(e.id);let t=p.contents;return t!==void 0&&Ge(t,e.id),e.value.contents}function Je(e){return ce(e.id),e.value.contents}function se(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,oe(e.id)}function Qe(e,t){se(e,t(e.value.contents))}const Ye=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,batch:Xe,get:Ue,make:de,peek:Je,set:se,untrack:qe,update:Qe},Symbol.toStringTag,{value:"Module"}));function ae(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function Ze(e,t){let n=X(),r={contents:void 0},u=ae(n,"Effect",()=>{let d=r.contents;d!==void 0&&d(),r.contents=e()},t);h.set(n,u),b.contents=!0,I(u);let a=p.contents;p.contents=n;try{u.run(),b.contents=!1}catch(d){throw p.contents=a,b.contents=!1,d}return p.contents=a,u.level=V(u),{dispose:()=>{let d=h.get(n);if(d===void 0)return;let x=r.contents;x!==void 0&&x(),I(d),h.delete(n)}}}const et=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:Ze},Symbol.toStringTag,{value:"Module"}));function tt(e,t){let n=de(void 0,t,void 0),r=X(),l=()=>{let c=e();n.value.contents=c},u=ae(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),b.contents=!0,I(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,b.contents=!1}catch(c){throw p.contents=a,b.contents=!1,c}return p.contents=a,u.level=V(u),F.set(n.id,r),n}function nt(e){Be(e.id)}const rt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:nt,make:tt},Symbol.toStringTag,{value:"Module"}));let o=Ye,S=rt,w=et;function fe(e){return Ie(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function pe(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let c=n[a];return u.TAG==="Static"?c===u._0:(r[u._0]=c,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function U(e,t){return pe(fe(e),t)}const lt=Object.freeze(Object.defineProperty({__proto__:null,match:U,matchPath:pe,parsePattern:fe},Symbol.toStringTag,{value:"Module"}));function ut(e,t){delete e[t]}let it={},z={contents:void 0};function ot(){return{disposers:[],computeds:[]}}function M(e,t){let n=z.contents;z.contents=e;let r=t();return z.contents=n,r}function j(e,t){e.disposers.push(t)}function me(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function R(e,t){e.__xote_owner__=t}function he(e){return Ce(e.__xote_owner__)}let ct={currentOwner:z,createOwner:ot,runWithOwner:M,addDisposer:j,disposeOwner:me,setOwner:R,getOwner:he};function _e(e,t){return[e,{TAG:"Static",_0:t}]}function ge(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Se(e,t){return[e,{TAG:"Compute",_0:t}]}let dt={$$static:_e,signal:ge,computed:Se};function L(e){let t=he(e);t!==void 0&&me(t),Array.from(e.childNodes||[]).forEach(L)}function k(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return R(l,u),M(u,()=>{r.forEach(i=>{let m=i[1],E=i[0];switch(m.TAG){case"Static":l.setAttribute(E,m._0);return;case"SignalValue":let v=m._0;l.setAttribute(E,o.peek(v));let y=w.run(()=>{l.setAttribute(E,o.get(v))},void 0);return j(u,y);case"Compute":let B=m._0;l.setAttribute(E,B());let D=w.run(()=>{l.setAttribute(E,B())},void 0);return j(u,D)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=k(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,c=document.createTextNode(o.peek(a)),d={disposers:[],computeds:[]};return R(c,d),M(d,()=>{let i=w.run(()=>{c.textContent=o.get(a)},void 0);j(d,i)}),c;case"Fragment":let x=document.createDocumentFragment();return e._0.forEach(i=>{let m=k(i);x.appendChild(m)}),x;case"SignalFragment":let un=e._0,Y={disposers:[],computeds:[]},P=document.createElement("div");return P.setAttribute("style","display: contents"),R(P,Y),M(Y,()=>{let i=w.run(()=>{let m=o.get(un);Array.from(P.childNodes||[]).forEach(L),P.innerHTML="",m.forEach(v=>{let y=k(v);P.appendChild(y)})},void 0);j(Y,i)}),P;case"LazyComponent":let we={disposers:[],computeds:[]},on=M(we,e._0),ke=k(on);return R(ke,we),ke;case"KeyedList":let Z=e.renderItem,ee=e.keyFn,Oe=e.signal,te={disposers:[],computeds:[]},ne=document.createComment(" keyed-list-start "),G=document.createComment(" keyed-list-end ");R(ne,te);let A={},cn=()=>{let i=G.parentNode;if(i==null)return;let m=o.get(Oe),E={};m.forEach(s=>{E[ee(s)]=s});let v=[];Object.keys(A).forEach(s=>{if(E[s]===void 0){v.push(s);return}}),v.forEach(s=>{let f=A[s];if(f!==void 0){L(f.element),f.element.remove(),ut(A,s);return}});let y=[],B={};m.forEach(s=>{let f=ee(s),K=A[f];if(K!==void 0){if(K.item!==s){B[f]=!0;let an=Z(s),fn=k(an),$e={key:f,item:s,element:fn};y.push($e),A[f]=$e;return}y.push(K);return}let dn=Z(s),sn=k(dn),Te={key:f,item:s,element:sn};y.push(Te),A[f]=Te});let D={contents:ne.nextSibling};y.forEach(s=>{let f=D.contents;if(f==null){i.insertBefore(s.element,G);return}if(f===G){i.insertBefore(s.element,G);return}if(f===s.element){D.contents=f.nextSibling;return}q(B[s.key],!1)?(L(f),i.replaceChild(s.element,f),D.contents=s.element.nextSibling):(i.insertBefore(s.element,f),D.contents=s.element.nextSibling)})},W=document.createDocumentFragment();return W.appendChild(ne),o.peek(Oe).forEach(i=>{let m=ee(i),E=Z(i),v=k(E),y={key:m,item:i,element:v};A[m]=y,W.appendChild(v)}),W.appendChild(G),M(te,()=>{let i=w.run(()=>{cn()},void 0);j(te,i)}),W}}let st={disposeElement:L,render:k};function at(e){return{TAG:"Text",_0:e}}function ft(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function pt(e){return{TAG:"Fragment",_0:e}}function J(e){return{TAG:"SignalFragment",_0:e}}function mt(e,t){return{TAG:"SignalFragment",_0:S.make(()=>o.get(e).map(t),void 0)}}function ht(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(d=>d),a=n!==void 0?n:[].map(d=>d),c=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:u,events:a,children:c}}function _t(e,t,n,r){return _("div",e,t,n)}function gt(e,t,n,r){return _("span",e,t,n)}function St(e,t,n,r){return _("button",e,t,n)}function Et(e,t,n){return _("input",e,t,void 0)}function bt(e,t,n,r){return _("h1",e,t,n)}function vt(e,t,n,r){return _("h2",e,t,n)}function yt(e,t,n,r){return _("h3",e,t,n)}function wt(e,t,n,r){return _("p",e,t,n)}function kt(e,t,n,r){return _("ul",e,t,n)}function Ot(e,t,n,r){return _("li",e,t,n)}function Ee(e,t,n,r){return _("a",e,t,n)}function be(e,t){let n=k(e);t.appendChild(n)}function Tt(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return be(e,n)}let ve=_e;const $t=Object.freeze(Object.defineProperty({__proto__:null,Attributes:dt,DOM:it,Reactivity:ct,Render:st,a:Ee,attr:ve,button:St,computedAttr:Se,div:_t,element:_,fragment:pt,h1:bt,h2:vt,h3:yt,input:Et,keyedList:ht,li:Ot,list:mt,mount:be,mountById:Tt,p:wt,signalAttr:ge,signalFragment:J,span:gt,text:at,textSignal:ft,ul:kt},Symbol.toStringTag,{value:"Module"}));let $=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function Q(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function At(){o.set($,Q());let e=t=>o.set($,Q());window.addEventListener("popstate",e)}function ye(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.pushState(d,"",c),o.set($,a)}function Ct(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.replaceState(d,"",c),o.set($,a)}function Nt(e,t){return J(S.make(()=>{let n=o.get($),r=U(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function It(e){return J(S.make(()=>{let t=o.get($),n=Me(e,r=>{let l=U(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function Mt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=c=>{c.preventDefault(),ye(e,void 0,void 0)};return Ee(l.concat([ve("href",e)]),[["click",a]],u)}const jt=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:Q,init:At,link:Mt,location:$,push:ye,replace:Ct,route:Nt,routes:It},Symbol.toStringTag,{value:"Module"}));let Rt=o.Id,Pt=o.Scheduler,Dt=o.make,Ft=o.get,Lt=o.peek,xt=o.set,Gt=o.update,Bt=o.batch,Vt=o.untrack,zt={Id:Rt,Scheduler:Pt,make:Dt,get:Ft,peek:Lt,set:xt,update:Gt,batch:Bt,untrack:Vt},Wt=S.Id,Kt=S.Signal,Xt=S.Observer,qt=S.Scheduler,Ht=S.make,Ut=S.dispose,Jt={Id:Wt,Signal:Kt,Observer:Xt,Scheduler:qt,make:Ht,dispose:Ut},Qt=w.Id,Yt=w.Observer,Zt=w.Scheduler,en=w.run,tn={Id:Qt,Observer:Yt,Scheduler:Zt,run:en},nn=$t,rn=lt,ln=jt;g.Component=nn,g.Computed=Jt,g.Effect=tn,g.Route=rn,g.Router=ln,g.Signal=zt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g.xote={}))})(this,(function(g){"use strict";let T={contents:0};function q(){return T.contents=T.contents+1|0,T.contents}function Ce(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Ne(e){if(e!=null)return Ce(e)}function le(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function H(e,t){return e!==void 0?le(e):t}function Ie(e,t,n){return e.reduce(n,t)}function Me(e,t){let n=e.length,r=new Array(n),l=0;for(let u=0;u<n;++u){let a=e[u],c=t(a);c!==void 0&&(r[l]=le(c),l=l+1|0)}return r.length=l,r}function je(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}let h=new Map,C=new Map,L=new Map,p={contents:void 0},N=new Set,k={contents:!1},v={contents:!1};function U(e){if(C.get(e)===void 0){C.set(e,new Set);return}}function Re(e,t){let n=C.get(e);if(n!==void 0){n.forEach(t);return}}function Pe(e,t){let n=C.get(e);if(n!==void 0){n.add(t);return}}function De(e,t){let n=C.get(e);if(n!==void 0){n.delete(t);return}}function Fe(e){return Array.from(H(C.get(e),new Set).values())}function ue(e,t){let n=p.contents;p.contents=e;try{let r=t();return p.contents=n,r}catch(r){throw p.contents=n,r}}function Le(e){let t=p.contents;p.contents=void 0;try{let n=e();return p.contents=t,n}catch(n){throw p.contents=t,n}}function xe(e){let t=p.contents;return t!==void 0?t===e:!1}function Ge(e){if(!k.contents){k.contents=!0;try{e(),k.contents=!1;return}catch(t){throw k.contents=!1,t}}}function Be(e,t){U(t);let n=xe(e),r=h.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),Pe(t,e)}function I(e){e.deps.forEach(t=>De(t,e.id)),e.deps.clear()}function Ve(e){let t=L.get(e);if(t===void 0)return;L.delete(e);let n=h.get(t);if(n!==void 0){I(n),h.delete(t);return}}function ie(e){return Ie(e,0,(t,n)=>n>t?n:t)}function ze(e){let t=[];return e.deps.forEach(n=>Re(n,r=>{if(r===e.id)return;let l=h.get(r);if(l===void 0)return;if(typeof l.kind=="object"){t.push(l.level);return}})),ie(t)+1|0}function We(e){let t=[];return e.deps.forEach(n=>{let r=L.get(n);if(r===void 0||r===e.id)return;let l=h.get(r);if(l!==void 0){t.push(l.level);return}}),ie(t)+1|0}function z(e){return typeof e.kind=="object"?We(e):ze(e)}function Ke(e,t){let n=h.get(e),r=h.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let u=typeof n.kind=="object"?0:1,c=typeof r.kind=="object"?0:1,d=u-c|0;return d!==0?d:n.level-r.level|0}function Xe(e){v.contents=!0,I(e),ue(e.id,()=>{e.run(),v.contents=!1}),e.level=z(e)}function oe(){for(;N.size>0;){let e=Array.from(N.values());N.clear(),e.sort(Ke),e.forEach(t=>{let n=h.get(t);if(n!==void 0)return Xe(n)})}}function ce(e){if(U(e),Fe(e).forEach(t=>{let n=h.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,ce(r.VAL));N.add(t)}),N.size>0)return Ge(oe)}function de(e){let t=L.get(e);if(t===void 0)return;let n=h.get(t);if(n!==void 0&&n.dirty){v.contents=!0,I(n),ue(t,()=>{n.run(),n.dirty=!1,v.contents=!1}),n.level=z(n);return}}function qe(e){let t=k.contents;k.contents=!0;try{let n=e();return t||(k.contents=!1,N.size>0&&oe()),n}catch(n){throw t||(k.contents=!1),n}}let He=Le,Ue=U;function se(e,t,n){let r=q();return Ue(r),{id:r,value:{contents:e},version:{contents:0},equals:H(n,(l,u)=>l===u),name:t}}function Je(e){de(e.id);let t=p.contents;return t!==void 0&&Be(t,e.id),e.value.contents}function Qe(e){return de(e.id),e.value.contents}function ae(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,ce(e.id)}function Ye(e,t){ae(e,t(e.value.contents))}const Ze=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,batch:qe,get:Je,make:se,peek:Qe,set:ae,untrack:He,update:Ye},Symbol.toStringTag,{value:"Module"}));function fe(e,t,n,r){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0,name:r}}function et(e,t){let n=q(),r={contents:void 0},u=fe(n,"Effect",()=>{let d=r.contents;d!==void 0&&d(),r.contents=e()},t);h.set(n,u),v.contents=!0,I(u);let a=p.contents;p.contents=n;try{u.run(),v.contents=!1}catch(d){throw p.contents=a,v.contents=!1,d}return p.contents=a,u.level=z(u),{dispose:()=>{let d=h.get(n);if(d===void 0)return;let G=r.contents;G!==void 0&&G(),I(d),h.delete(n)}}}const tt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:et},Symbol.toStringTag,{value:"Module"}));function nt(e,t){let n=se(void 0,t,void 0),r=q(),l=()=>{let c=e();n.value.contents=c},u=fe(r,{NAME:"Computed",VAL:n.id},l,void 0);h.set(r,u),v.contents=!0,I(u);let a=p.contents;p.contents=r;try{u.run(),u.dirty=!1,v.contents=!1}catch(c){throw p.contents=a,v.contents=!1,c}return p.contents=a,u.level=z(u),L.set(n.id,r),n}function rt(e){Ve(e.id)}const lt=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:rt,make:nt},Symbol.toStringTag,{value:"Module"}));let o=Ze,S=lt,w=tt;function pe(e){return Me(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function me(e,t){let n=t.split("/").filter(u=>u!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((u,a)=>{let c=n[a];return u.TAG==="Static"?c===u._0:(r[u._0]=c,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function J(e,t){return me(pe(e),t)}const ut=Object.freeze(Object.defineProperty({__proto__:null,match:J,matchPath:me,parsePattern:pe},Symbol.toStringTag,{value:"Module"}));function it(e,t){delete e[t]}function M(e,t,n){switch(t){case"checked":e.checked=n==="true";return;case"value":e.value=n;return;default:e.setAttribute(t,n);return}}let ot={setAttrOrProp:M},W={contents:void 0};function ct(){return{disposers:[],computeds:[]}}function j(e,t){let n=W.contents;W.contents=e;let r=t();return W.contents=n,r}function R(e,t){e.disposers.push(t)}function he(e){e.disposers.forEach(t=>t.dispose()),e.computeds.forEach(t=>S.dispose(t))}function P(e,t){e.__xote_owner__=t}function _e(e){return Ne(e.__xote_owner__)}let dt={currentOwner:W,createOwner:ct,runWithOwner:j,addDisposer:R,disposeOwner:he,setOwner:P,getOwner:_e};function ge(e,t){return[e,{TAG:"Static",_0:t}]}function Se(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Ee(e,t){return[e,{TAG:"Compute",_0:t}]}let st={$$static:ge,signal:Se,computed:Ee};function x(e){let t=_e(e);t!==void 0&&he(t),Array.from(e.childNodes||[]).forEach(x)}function O(e){switch(e.TAG){case"Element":let t=e.children,n=e.events,r=e.attrs,l=document.createElement(e.tag),u={disposers:[],computeds:[]};return P(l,u),j(u,()=>{r.forEach(i=>{let m=i[1],E=i[0];switch(m.TAG){case"Static":return M(l,E,m._0);case"SignalValue":let y=m._0;M(l,E,o.peek(y));let b=w.run(()=>{M(l,E,o.get(y))},void 0);return R(u,b);case"Compute":let V=m._0;M(l,E,V());let F=w.run(()=>{M(l,E,V())},void 0);return R(u,F)}}),n.forEach(i=>{l.addEventListener(i[0],i[1])}),t.forEach(i=>{let m=O(i);l.appendChild(m)})}),l;case"Text":return document.createTextNode(e._0);case"SignalText":let a=e._0,c=document.createTextNode(o.peek(a)),d={disposers:[],computeds:[]};return P(c,d),j(d,()=>{let i=w.run(()=>{c.textContent=o.get(a)},void 0);R(d,i)}),c;case"Fragment":let G=document.createDocumentFragment();return e._0.forEach(i=>{let m=O(i);G.appendChild(m)}),G;case"SignalFragment":let on=e._0,Z={disposers:[],computeds:[]},D=document.createElement("div");return D.setAttribute("style","display: contents"),P(D,Z),j(Z,()=>{let i=w.run(()=>{let m=o.get(on);Array.from(D.childNodes||[]).forEach(x),D.innerHTML="",m.forEach(y=>{let b=O(y);D.appendChild(b)})},void 0);R(Z,i)}),D;case"LazyComponent":let Oe={disposers:[],computeds:[]},cn=j(Oe,e._0),ke=O(cn);return P(ke,Oe),ke;case"KeyedList":let ee=e.renderItem,te=e.keyFn,Te=e.signal,ne={disposers:[],computeds:[]},re=document.createComment(" keyed-list-start "),B=document.createComment(" keyed-list-end ");P(re,ne);let A={},dn=()=>{let i=B.parentNode;if(i==null)return;let m=o.get(Te),E={};m.forEach(s=>{E[te(s)]=s});let y=[];Object.keys(A).forEach(s=>{if(E[s]===void 0){y.push(s);return}}),y.forEach(s=>{let f=A[s];if(f!==void 0){x(f.element),f.element.remove(),it(A,s);return}});let b=[],V={};m.forEach(s=>{let f=te(s),X=A[f];if(X!==void 0){if(X.item!==s){V[f]=!0;let fn=ee(s),pn=O(fn),Ae={key:f,item:s,element:pn};b.push(Ae),A[f]=Ae;return}b.push(X);return}let sn=ee(s),an=O(sn),$e={key:f,item:s,element:an};b.push($e),A[f]=$e});let F={contents:re.nextSibling};b.forEach(s=>{let f=F.contents;if(f==null){i.insertBefore(s.element,B);return}if(f===B){i.insertBefore(s.element,B);return}if(f===s.element){F.contents=f.nextSibling;return}H(V[s.key],!1)?(x(f),i.replaceChild(s.element,f),F.contents=s.element.nextSibling):(i.insertBefore(s.element,f),F.contents=s.element.nextSibling)})},K=document.createDocumentFragment();return K.appendChild(re),o.peek(Te).forEach(i=>{let m=te(i),E=ee(i),y=O(E),b={key:m,item:i,element:y};A[m]=b,K.appendChild(y)}),K.appendChild(B),j(ne,()=>{let i=w.run(()=>{dn()},void 0);R(ne,i)}),K}}let at={disposeElement:x,render:O};function ft(e){return{TAG:"Text",_0:e}}function pt(e){return{TAG:"SignalText",_0:S.make(e,void 0)}}function mt(e){return{TAG:"Fragment",_0:e}}function Q(e){return{TAG:"SignalFragment",_0:e}}function ht(e,t){return{TAG:"SignalFragment",_0:S.make(()=>o.get(e).map(t),void 0)}}function _t(e,t,n){return{TAG:"KeyedList",signal:e,keyFn:t,renderItem:n}}function _(e,t,n,r,l){let u=t!==void 0?t:[].map(d=>d),a=n!==void 0?n:[].map(d=>d),c=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:u,events:a,children:c}}function gt(e,t,n,r){return _("div",e,t,n)}function St(e,t,n,r){return _("span",e,t,n)}function Et(e,t,n,r){return _("button",e,t,n)}function vt(e,t,n){return _("input",e,t,void 0)}function yt(e,t,n,r){return _("h1",e,t,n)}function bt(e,t,n,r){return _("h2",e,t,n)}function wt(e,t,n,r){return _("h3",e,t,n)}function Ot(e,t,n,r){return _("p",e,t,n)}function kt(e,t,n,r){return _("ul",e,t,n)}function Tt(e,t,n,r){return _("li",e,t,n)}function ve(e,t,n,r){return _("a",e,t,n)}function ye(e,t){let n=O(e);t.appendChild(n)}function $t(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return ye(e,n)}let be=ge;const At=Object.freeze(Object.defineProperty({__proto__:null,Attributes:st,DOM:ot,Reactivity:dt,Render:at,a:ve,attr:be,button:Et,computedAttr:Ee,div:gt,element:_,fragment:mt,h1:yt,h2:bt,h3:wt,input:vt,keyedList:_t,li:Tt,list:ht,mount:ye,mountById:$t,p:Ot,signalAttr:Se,signalFragment:Q,span:St,text:ft,textSignal:pt,ul:kt},Symbol.toStringTag,{value:"Module"}));let $=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function Y(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Ct(){o.set($,Y());let e=t=>o.set($,Y());window.addEventListener("popstate",e)}function we(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.pushState(d,"",c),o.set($,a)}function Nt(e,t,n,r){let l=t!==void 0?t:"",u=n!==void 0?n:"",a={pathname:e,search:l,hash:u},c=e+l+u,d={};window.history.replaceState(d,"",c),o.set($,a)}function It(e,t){return Q(S.make(()=>{let n=o.get($),r=J(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]},void 0))}function Mt(e){return Q(S.make(()=>{let t=o.get($),n=je(e,r=>{let l=J(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]},void 0))}function jt(e,t,n,r){let l=t!==void 0?t:[],u=n!==void 0?n:[],a=c=>{c.preventDefault(),we(e,void 0,void 0)};return ve(l.concat([be("href",e)]),[["click",a]],u)}const Rt=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:Y,init:Ct,link:jt,location:$,push:we,replace:Nt,route:It,routes:Mt},Symbol.toStringTag,{value:"Module"}));let Pt=o.Id,Dt=o.Scheduler,Ft=o.make,Lt=o.get,xt=o.peek,Gt=o.set,Bt=o.update,Vt=o.batch,zt=o.untrack,Wt={Id:Pt,Scheduler:Dt,make:Ft,get:Lt,peek:xt,set:Gt,update:Bt,batch:Vt,untrack:zt},Kt=S.Id,Xt=S.Signal,qt=S.Observer,Ht=S.Scheduler,Ut=S.make,Jt=S.dispose,Qt={Id:Kt,Signal:Xt,Observer:qt,Scheduler:Ht,make:Ut,dispose:Jt},Yt=w.Id,Zt=w.Observer,en=w.Scheduler,tn=w.run,nn={Id:Yt,Observer:Zt,Scheduler:en,run:tn},rn=At,ln=ut,un=Rt;g.Component=rn,g.Computed=Qt,g.Effect=nn,g.Route=ln,g.Router=un,g.Signal=Wt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xote",
3
- "version": "4.3.1",
3
+ "version": "4.4.1",
4
4
  "repository": {
5
5
  "url": "https://github.com/brnrdog/xote"
6
6
  },
@@ -29,6 +29,16 @@ module DOM = {
29
29
  @send external insertBefore: (Dom.element, Dom.element, Dom.element) => unit = "insertBefore"
30
30
  @set external setTextContent: (Dom.element, string) => unit = "textContent"
31
31
  @set external setValue: (Dom.element, string) => unit = "value"
32
+ @set external setChecked: (Dom.element, bool) => unit = "checked"
33
+
34
+ /* Set attribute or property depending on attribute name */
35
+ let setAttrOrProp = (el: Dom.element, key: string, value: string): unit => {
36
+ switch key {
37
+ | "value" => setValue(el, value)
38
+ | "checked" => setChecked(el, value == "true")
39
+ | _ => setAttribute(el, key, value)
40
+ }
41
+ }
32
42
  }
33
43
 
34
44
  /* ============================================================================
@@ -238,22 +248,22 @@ module Render = {
238
248
  /* Set attributes */
239
249
  attrs->Array.forEach(((key, value)) => {
240
250
  switch value {
241
- | Static(v) => DOM.setAttribute(el, key, v)
251
+ | Static(v) => DOM.setAttrOrProp(el, key, v)
242
252
  | SignalValue(signal) => {
243
- DOM.setAttribute(el, key, Signal.peek(signal))
253
+ DOM.setAttrOrProp(el, key, Signal.peek(signal))
244
254
  let disposer = Effect.run(
245
255
  () => {
246
- DOM.setAttribute(el, key, Signal.get(signal))
256
+ DOM.setAttrOrProp(el, key, Signal.get(signal))
247
257
  None
248
258
  },
249
259
  )
250
260
  addDisposer(owner, disposer)
251
261
  }
252
262
  | Compute(compute) => {
253
- DOM.setAttribute(el, key, compute())
263
+ DOM.setAttrOrProp(el, key, compute())
254
264
  let disposer = Effect.run(
255
265
  () => {
256
- DOM.setAttribute(el, key, compute())
266
+ DOM.setAttrOrProp(el, key, compute())
257
267
  None
258
268
  },
259
269
  )
@@ -5,7 +5,23 @@ import * as Core__Dict from "@rescript/core/src/Core__Dict.res.mjs";
5
5
  import * as Core__Option from "@rescript/core/src/Core__Option.res.mjs";
6
6
  import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
7
7
 
8
- let DOM = {};
8
+ function setAttrOrProp(el, key, value) {
9
+ switch (key) {
10
+ case "checked" :
11
+ el.checked = value === "true";
12
+ return;
13
+ case "value" :
14
+ el.value = value;
15
+ return;
16
+ default:
17
+ el.setAttribute(key, value);
18
+ return;
19
+ }
20
+ }
21
+
22
+ let DOM = {
23
+ setAttrOrProp: setAttrOrProp
24
+ };
9
25
 
10
26
  let currentOwner = {
11
27
  contents: undefined
@@ -116,20 +132,19 @@ function render(node) {
116
132
  let key = param[0];
117
133
  switch (value.TAG) {
118
134
  case "Static" :
119
- el.setAttribute(key, value._0);
120
- return;
135
+ return setAttrOrProp(el, key, value._0);
121
136
  case "SignalValue" :
122
137
  let signal = value._0;
123
- el.setAttribute(key, Signals.Signal.peek(signal));
138
+ setAttrOrProp(el, key, Signals.Signal.peek(signal));
124
139
  let disposer = Signals.Effect.run(() => {
125
- el.setAttribute(key, Signals.Signal.get(signal));
140
+ setAttrOrProp(el, key, Signals.Signal.get(signal));
126
141
  }, undefined);
127
142
  return addDisposer(owner, disposer);
128
143
  case "Compute" :
129
144
  let compute = value._0;
130
- el.setAttribute(key, compute());
145
+ setAttrOrProp(el, key, compute());
131
146
  let disposer$1 = Signals.Effect.run(() => {
132
- el.setAttribute(key, compute());
147
+ setAttrOrProp(el, key, compute());
133
148
  }, undefined);
134
149
  return addDisposer(owner, disposer$1);
135
150
  }
package/src/Xote__JSX.res CHANGED
@@ -63,23 +63,76 @@ module Elements = {
63
63
  /* Helper to convert a computed function to an attributeValue */
64
64
  let computed = (f: unit => string): attributeValue => Any(f)
65
65
 
66
- /* Props type for HTML elements - supports common attributes and events */
67
- type props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data> = {
68
- /* Standard attributes - can be static strings or reactive values */
66
+ /* Props type for HTML elements - supports common attributes and events
67
+ * String-like attributes use polymorphic types to accept strings, signals, or computed functions
68
+ */
69
+ type props<
70
+ 'id,
71
+ 'class,
72
+ 'style,
73
+ 'typ,
74
+ 'name,
75
+ 'value,
76
+ 'placeholder,
77
+ 'min,
78
+ 'max,
79
+ 'step,
80
+ 'pattern,
81
+ 'autoComplete,
82
+ 'accept,
83
+ 'forAttr,
84
+ 'href,
85
+ 'target,
86
+ 'src,
87
+ 'alt,
88
+ 'width,
89
+ 'height,
90
+ 'role,
91
+ 'ariaLabel,
92
+ > = {
93
+ /* Standard attributes - can be static strings, signals, or computed values */
69
94
  id?: 'id,
70
95
  class?: 'class,
71
96
  style?: 'style,
72
- /* Input attributes */
97
+ /* Form/Input attributes */
73
98
  @as("type") type_?: 'typ,
99
+ name?: 'name,
74
100
  value?: 'value,
75
101
  placeholder?: 'placeholder,
76
102
  disabled?: bool,
77
103
  checked?: bool,
104
+ required?: bool,
105
+ readOnly?: bool,
106
+ maxLength?: int,
107
+ minLength?: int,
108
+ min?: 'min,
109
+ max?: 'max,
110
+ step?: 'step,
111
+ pattern?: 'pattern,
112
+ autoComplete?: 'autoComplete,
113
+ multiple?: bool,
114
+ accept?: 'accept,
115
+ rows?: int,
116
+ cols?: int,
117
+ /* Label attributes */
118
+ @as("for") for_?: 'forAttr,
78
119
  /* Link attributes */
79
120
  href?: 'href,
80
121
  target?: 'target,
122
+ /* Image attributes */
123
+ src?: 'src,
124
+ alt?: 'alt,
125
+ width?: 'width,
126
+ height?: 'height,
127
+ /* Accessibility attributes */
128
+ role?: 'role,
129
+ tabIndex?: int,
130
+ @as("aria-label") ariaLabel?: 'ariaLabel,
131
+ @as("aria-hidden") ariaHidden?: bool,
132
+ @as("aria-expanded") ariaExpanded?: bool,
133
+ @as("aria-selected") ariaSelected?: bool,
81
134
  /* Data attributes */
82
- data?: 'data,
135
+ data?: Obj.t,
83
136
  /* Event handlers */
84
137
  onClick?: Dom.event => unit,
85
138
  onInput?: Dom.event => unit,
@@ -118,10 +171,34 @@ module Elements = {
118
171
 
119
172
  /* Convert props to attrs array */
120
173
  let propsToAttrs = (
121
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
174
+ props: props<
175
+ 'id,
176
+ 'class,
177
+ 'style,
178
+ 'typ,
179
+ 'name,
180
+ 'value,
181
+ 'placeholder,
182
+ 'min,
183
+ 'max,
184
+ 'step,
185
+ 'pattern,
186
+ 'autoComplete,
187
+ 'accept,
188
+ 'forAttr,
189
+ 'href,
190
+ 'target,
191
+ 'src,
192
+ 'alt,
193
+ 'width,
194
+ 'height,
195
+ 'role,
196
+ 'ariaLabel,
197
+ >,
122
198
  ): array<(string, Component.attrValue)> => {
123
199
  let attrs = []
124
200
 
201
+ /* Standard attributes */
125
202
  switch props.id {
126
203
  | Some(v) => attrs->Array.push(convertAttrValue("id", v))
127
204
  | None => ()
@@ -137,11 +214,17 @@ module Elements = {
137
214
  | None => ()
138
215
  }
139
216
 
217
+ /* Form/Input attributes */
140
218
  switch props.type_ {
141
219
  | Some(v) => attrs->Array.push(convertAttrValue("type", v))
142
220
  | None => ()
143
221
  }
144
222
 
223
+ switch props.name {
224
+ | Some(v) => attrs->Array.push(convertAttrValue("name", v))
225
+ | None => ()
226
+ }
227
+
145
228
  switch props.value {
146
229
  | Some(v) => attrs->Array.push(convertAttrValue("value", v))
147
230
  | None => ()
@@ -162,6 +245,78 @@ module Elements = {
162
245
  | _ => ()
163
246
  }
164
247
 
248
+ switch props.required {
249
+ | Some(true) => attrs->Array.push(Component.attr("required", "true"))
250
+ | _ => ()
251
+ }
252
+
253
+ switch props.readOnly {
254
+ | Some(true) => attrs->Array.push(Component.attr("readonly", "true"))
255
+ | _ => ()
256
+ }
257
+
258
+ switch props.maxLength {
259
+ | Some(v) => attrs->Array.push(Component.attr("maxlength", Int.toString(v)))
260
+ | None => ()
261
+ }
262
+
263
+ switch props.minLength {
264
+ | Some(v) => attrs->Array.push(Component.attr("minlength", Int.toString(v)))
265
+ | None => ()
266
+ }
267
+
268
+ switch props.min {
269
+ | Some(v) => attrs->Array.push(convertAttrValue("min", v))
270
+ | None => ()
271
+ }
272
+
273
+ switch props.max {
274
+ | Some(v) => attrs->Array.push(convertAttrValue("max", v))
275
+ | None => ()
276
+ }
277
+
278
+ switch props.step {
279
+ | Some(v) => attrs->Array.push(convertAttrValue("step", v))
280
+ | None => ()
281
+ }
282
+
283
+ switch props.pattern {
284
+ | Some(v) => attrs->Array.push(convertAttrValue("pattern", v))
285
+ | None => ()
286
+ }
287
+
288
+ switch props.autoComplete {
289
+ | Some(v) => attrs->Array.push(convertAttrValue("autocomplete", v))
290
+ | None => ()
291
+ }
292
+
293
+ switch props.multiple {
294
+ | Some(true) => attrs->Array.push(Component.attr("multiple", "true"))
295
+ | _ => ()
296
+ }
297
+
298
+ switch props.accept {
299
+ | Some(v) => attrs->Array.push(convertAttrValue("accept", v))
300
+ | None => ()
301
+ }
302
+
303
+ switch props.rows {
304
+ | Some(v) => attrs->Array.push(Component.attr("rows", Int.toString(v)))
305
+ | None => ()
306
+ }
307
+
308
+ switch props.cols {
309
+ | Some(v) => attrs->Array.push(Component.attr("cols", Int.toString(v)))
310
+ | None => ()
311
+ }
312
+
313
+ /* Label attributes */
314
+ switch props.for_ {
315
+ | Some(v) => attrs->Array.push(convertAttrValue("for", v))
316
+ | None => ()
317
+ }
318
+
319
+ /* Link attributes */
165
320
  switch props.href {
166
321
  | Some(v) => attrs->Array.push(convertAttrValue("href", v))
167
322
  | None => ()
@@ -172,6 +327,62 @@ module Elements = {
172
327
  | None => ()
173
328
  }
174
329
 
330
+ /* Image attributes */
331
+ switch props.src {
332
+ | Some(v) => attrs->Array.push(convertAttrValue("src", v))
333
+ | None => ()
334
+ }
335
+
336
+ switch props.alt {
337
+ | Some(v) => attrs->Array.push(convertAttrValue("alt", v))
338
+ | None => ()
339
+ }
340
+
341
+ switch props.width {
342
+ | Some(v) => attrs->Array.push(convertAttrValue("width", v))
343
+ | None => ()
344
+ }
345
+
346
+ switch props.height {
347
+ | Some(v) => attrs->Array.push(convertAttrValue("height", v))
348
+ | None => ()
349
+ }
350
+
351
+ /* Accessibility attributes */
352
+ switch props.role {
353
+ | Some(v) => attrs->Array.push(convertAttrValue("role", v))
354
+ | None => ()
355
+ }
356
+
357
+ switch props.tabIndex {
358
+ | Some(v) => attrs->Array.push(Component.attr("tabindex", Int.toString(v)))
359
+ | None => ()
360
+ }
361
+
362
+ switch props.ariaLabel {
363
+ | Some(v) => attrs->Array.push(convertAttrValue("aria-label", v))
364
+ | None => ()
365
+ }
366
+
367
+ switch props.ariaHidden {
368
+ | Some(true) => attrs->Array.push(Component.attr("aria-hidden", "true"))
369
+ | Some(false) => attrs->Array.push(Component.attr("aria-hidden", "false"))
370
+ | None => ()
371
+ }
372
+
373
+ switch props.ariaExpanded {
374
+ | Some(true) => attrs->Array.push(Component.attr("aria-expanded", "true"))
375
+ | Some(false) => attrs->Array.push(Component.attr("aria-expanded", "false"))
376
+ | None => ()
377
+ }
378
+
379
+ switch props.ariaSelected {
380
+ | Some(true) => attrs->Array.push(Component.attr("aria-selected", "true"))
381
+ | Some(false) => attrs->Array.push(Component.attr("aria-selected", "false"))
382
+ | None => ()
383
+ }
384
+
385
+ /* Data attributes */
175
386
  switch props.data {
176
387
  | Some(_dataObj) => {
177
388
  let _ = %raw(`
@@ -188,7 +399,30 @@ module Elements = {
188
399
 
189
400
  /* Convert props to events array */
190
401
  let propsToEvents = (
191
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
402
+ props: props<
403
+ 'id,
404
+ 'class,
405
+ 'style,
406
+ 'typ,
407
+ 'name,
408
+ 'value,
409
+ 'placeholder,
410
+ 'min,
411
+ 'max,
412
+ 'step,
413
+ 'pattern,
414
+ 'autoComplete,
415
+ 'accept,
416
+ 'forAttr,
417
+ 'href,
418
+ 'target,
419
+ 'src,
420
+ 'alt,
421
+ 'width,
422
+ 'height,
423
+ 'role,
424
+ 'ariaLabel,
425
+ >,
192
426
  ): array<(string, Dom.event => unit)> => {
193
427
  let events = []
194
428
 
@@ -247,7 +481,30 @@ module Elements = {
247
481
 
248
482
  /* Extract children from props */
249
483
  let getChildren = (
250
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
484
+ props: props<
485
+ 'id,
486
+ 'class,
487
+ 'style,
488
+ 'typ,
489
+ 'name,
490
+ 'value,
491
+ 'placeholder,
492
+ 'min,
493
+ 'max,
494
+ 'step,
495
+ 'pattern,
496
+ 'autoComplete,
497
+ 'accept,
498
+ 'forAttr,
499
+ 'href,
500
+ 'target,
501
+ 'src,
502
+ 'alt,
503
+ 'width,
504
+ 'height,
505
+ 'role,
506
+ 'ariaLabel,
507
+ >,
251
508
  ): array<element> => {
252
509
  switch props.children {
253
510
  | Some(Fragment(children)) => children
@@ -259,7 +516,30 @@ module Elements = {
259
516
  /* Create an element from a tag string and props */
260
517
  let createElement = (
261
518
  tag: string,
262
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
519
+ props: props<
520
+ 'id,
521
+ 'class,
522
+ 'style,
523
+ 'typ,
524
+ 'name,
525
+ 'value,
526
+ 'placeholder,
527
+ 'min,
528
+ 'max,
529
+ 'step,
530
+ 'pattern,
531
+ 'autoComplete,
532
+ 'accept,
533
+ 'forAttr,
534
+ 'href,
535
+ 'target,
536
+ 'src,
537
+ 'alt,
538
+ 'width,
539
+ 'height,
540
+ 'role,
541
+ 'ariaLabel,
542
+ >,
263
543
  ): element => {
264
544
  Component.Element({
265
545
  tag,
@@ -272,17 +552,86 @@ module Elements = {
272
552
  /* JSX functions for HTML elements */
273
553
  let jsx = (
274
554
  tag: string,
275
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
555
+ props: props<
556
+ 'id,
557
+ 'class,
558
+ 'style,
559
+ 'typ,
560
+ 'name,
561
+ 'value,
562
+ 'placeholder,
563
+ 'min,
564
+ 'max,
565
+ 'step,
566
+ 'pattern,
567
+ 'autoComplete,
568
+ 'accept,
569
+ 'forAttr,
570
+ 'href,
571
+ 'target,
572
+ 'src,
573
+ 'alt,
574
+ 'width,
575
+ 'height,
576
+ 'role,
577
+ 'ariaLabel,
578
+ >,
276
579
  ): element => createElement(tag, props)
277
580
 
278
581
  let jsxs = (
279
582
  tag: string,
280
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
583
+ props: props<
584
+ 'id,
585
+ 'class,
586
+ 'style,
587
+ 'typ,
588
+ 'name,
589
+ 'value,
590
+ 'placeholder,
591
+ 'min,
592
+ 'max,
593
+ 'step,
594
+ 'pattern,
595
+ 'autoComplete,
596
+ 'accept,
597
+ 'forAttr,
598
+ 'href,
599
+ 'target,
600
+ 'src,
601
+ 'alt,
602
+ 'width,
603
+ 'height,
604
+ 'role,
605
+ 'ariaLabel,
606
+ >,
281
607
  ): element => createElement(tag, props)
282
608
 
283
609
  let jsxKeyed = (
284
610
  tag: string,
285
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
611
+ props: props<
612
+ 'id,
613
+ 'class,
614
+ 'style,
615
+ 'typ,
616
+ 'name,
617
+ 'value,
618
+ 'placeholder,
619
+ 'min,
620
+ 'max,
621
+ 'step,
622
+ 'pattern,
623
+ 'autoComplete,
624
+ 'accept,
625
+ 'forAttr,
626
+ 'href,
627
+ 'target,
628
+ 'src,
629
+ 'alt,
630
+ 'width,
631
+ 'height,
632
+ 'role,
633
+ 'ariaLabel,
634
+ >,
286
635
  ~key: option<string>=?,
287
636
  _: unit,
288
637
  ): element => {
@@ -292,7 +641,30 @@ module Elements = {
292
641
 
293
642
  let jsxsKeyed = (
294
643
  tag: string,
295
- props: props<'id, 'class, 'style, 'typ, 'value, 'placeholder, 'href, 'target, 'data>,
644
+ props: props<
645
+ 'id,
646
+ 'class,
647
+ 'style,
648
+ 'typ,
649
+ 'name,
650
+ 'value,
651
+ 'placeholder,
652
+ 'min,
653
+ 'max,
654
+ 'step,
655
+ 'pattern,
656
+ 'autoComplete,
657
+ 'accept,
658
+ 'forAttr,
659
+ 'href,
660
+ 'target,
661
+ 'src,
662
+ 'alt,
663
+ 'width,
664
+ 'height,
665
+ 'role,
666
+ 'ariaLabel,
667
+ >,
296
668
  ~key: option<string>=?,
297
669
  _: unit,
298
670
  ): element => {