@tltdsh/mx 1.4.0 → 1.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/AGENTS.md CHANGED
@@ -251,11 +251,11 @@ this.$attrs({ disabled, class: 'my-component' });
251
251
 
252
252
  Caveats vs `render()`: `$attrs` cannot clear event handlers (it calls `removeAttribute`, which is a no-op for handlers) and does not reset `value`/`checked`/`selected` properties on null. For full cleanup semantics, use `render()` with fresh descriptions. See [mxjs.dev/reference](https://mxjs.dev/reference).
253
253
 
254
- **Stamp system**: Event handlers set via `render()` attrs in render N but absent in render N+1 are auto-nullified. You never manually remove handlers.
254
+ **Handler cleanup**: `render()` keeps a per-element cache of what it last applied; a handler or `.prop` present in render N but absent in render N+1 is nulled from that cache before the children reconcile. You never manually remove handlers.
255
255
 
256
256
  **Custom events**: `on*` attrs only register listeners for spec-known handler properties (`onclick`, `oninput`, ...). A custom event type (`onping: fn`) is a silent expando - use `addEventListener` once (guarded) for custom events.
257
257
 
258
- **Children-first ordering**: `render()` reconciles an element's children before applying its own attributes (load-bearing for `select.value`). Consequences: a child that dispatches an event synchronously during mount is missed by the parent's not-yet-attached handler, and a child reading a parent attribute during `$()` sees the previous render's value. Pass data via `$state`, dispatch after mount.
258
+ **Children-first ordering**: `render()` reconciles an element's children before applying its own attributes (load-bearing for `select.value`). Consequences: a child that dispatches an event synchronously during mount is missed by the parent's not-yet-attached handler; a child reading a parent attribute during `$()` sees the previous render's value if it changed, `null` if the new description dropped it (removals are undone before children reconcile) or added it. Pass data via `$state`, dispatch after mount.
259
259
 
260
260
  ---
261
261
 
package/CLAUDE.md CHANGED
@@ -251,11 +251,11 @@ this.$attrs({ disabled, class: 'my-component' });
251
251
 
252
252
  Caveats vs `render()`: `$attrs` cannot clear event handlers (it calls `removeAttribute`, which is a no-op for handlers) and does not reset `value`/`checked`/`selected` properties on null. For full cleanup semantics, use `render()` with fresh descriptions. See [mxjs.dev/reference](https://mxjs.dev/reference).
253
253
 
254
- **Stamp system**: Event handlers set via `render()` attrs in render N but absent in render N+1 are auto-nullified. You never manually remove handlers.
254
+ **Handler cleanup**: `render()` keeps a per-element cache of what it last applied; a handler or `.prop` present in render N but absent in render N+1 is nulled from that cache before the children reconcile. You never manually remove handlers.
255
255
 
256
256
  **Custom events**: `on*` attrs only register listeners for spec-known handler properties (`onclick`, `oninput`, ...). A custom event type (`onping: fn`) is a silent expando - use `addEventListener` once (guarded) for custom events.
257
257
 
258
- **Children-first ordering**: `render()` reconciles an element's children before applying its own attributes (load-bearing for `select.value`). Consequences: a child that dispatches an event synchronously during mount is missed by the parent's not-yet-attached handler, and a child reading a parent attribute during `$()` sees the previous render's value. Pass data via `$state`, dispatch after mount.
258
+ **Children-first ordering**: `render()` reconciles an element's children before applying its own attributes (load-bearing for `select.value`). Consequences: a child that dispatches an event synchronously during mount is missed by the parent's not-yet-attached handler; a child reading a parent attribute during `$()` sees the previous render's value if it changed, `null` if the new description dropped it (removals are undone before children reconcile) or added it. Pass data via `$state`, dispatch after mount.
259
259
 
260
260
  ---
261
261
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ Sub-1KB reactive DOM reconciliation engine for building massive platforms and us
21
21
  ### Pinned version
22
22
 
23
23
  ```html
24
- <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.4.0/mx.min.js"></script>
24
+ <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.4.1/mx.min.js"></script>
25
25
  ```
26
26
 
27
27
  ### npm / yarn / bun
package/mx.d.ts CHANGED
@@ -144,6 +144,13 @@ interface MxHTMLAttrs {
144
144
  'aria-orientation'?: 'horizontal' | 'vertical';
145
145
  'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other';
146
146
 
147
+ // ARIA form validation cluster (accessibility)
148
+ // Absent IS the default ("not required", "valid", "editable") for these three,
149
+ // so plain booleans are fine: `false` removes the attribute, which reads the same.
150
+ 'aria-required'?: boolean | 'true' | 'false';
151
+ 'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';
152
+ 'aria-readonly'?: boolean | 'true' | 'false';
153
+
147
154
  // Loading
148
155
  fetchpriority?: 'high' | 'low' | 'auto';
149
156
 
package/mx.min.js CHANGED
@@ -1 +1 @@
1
- !function(m,i,_,u){let $='http://www.w3.org/2000/svg',t={__proto__:null,value:1,checked:1,selected:1},x=Symbol(),n=(i,t)=>!t&'svg'!=i?l(m.createElement(i),_[i]):m.createElementNS($,i),R=m=>h[m]||=m.replace(/[A-Z]/g,'-$&').toLowerCase(),h={},l=Object.assign,w=(m,n={})=>new Proxy(m,{get:(i,_)=>n[_]||=m.bind(0,_)});define=(i,m={})=>{if(m.$)m.$$||=m.$,m.$=function(i){let _=m.$$.call(this,l(this.$state||={},i));return this.render(..._?._?[_]:_||[])};_[R(i)]=m};i.render=function(...l){let i=this,_=i.namespaceURI==$&'foreignObject'!=i.localName,m=i.firstChild;for(let $ of l){let w,R,g;if($==null|!1===$)continue;if($._)[w,R,g]=$;else if($.nodeType){$!=m&&(m?m.replaceWith($):i.append($)),m=$.nextSibling;continue}if(m)!w?m.splitText?m.data!=$+''&&(m.data=$+''):m.replaceWith(m=new Text($)):w!=m.localName&&m.replaceWith(m=n(w,_));else if(w)i.append(m=n(w,_));else{i.append($);continue}if(w)if(m.$)m[x]=0,m.$(R);else{m.render(...g);let[_,n]=m[x]||=[{},{}],l=u=-~u;for(let i in _){R&&Object.hasOwn(R,i)||(('.'==i[0]?t[i.slice(1)]&&delete n[i.slice(1)]:(t[i]&&(delete n[i],m[i]=''),m.R(i))),delete _[i])}for(let i in R){let $=R[i],k=i.slice(1);_[i]===$?'.'==i[0]?(m[k]===$||(m[k]=$),n[k]=l):t[i]?(m[i]===$||(m[i]=$),n[i]=l):$?.call&&(n[i]=l):'.'==i[0]?(m[k]===$||(m[k]=$),n[k]=l,_[i]=$):$!=null&!1!==$?($.call?(m[i]=$,n[i]=l):(t[i]?(m[i]===$||(m[i]=$),n[i]=l):delete n[i],m.setAttribute(i,$)),_[i]=$):(t[i]&&(delete n[i],m[i]=''),m.R(i),delete _[i])}for(let i in n)l-n[i]&&(delete n[i],m[i]=null,m.R(i))}m=m.nextSibling}for(let $;m;m=$)$=m.nextSibling,i.removeChild(m);return this},i.R=i.removeAttribute,_=components={},i.$attrs=function(m,i,$){for(i in m)$=m[i],'.'==i[0]?this[i.slice(1)]=$:$!=null&!1!==$?($.call?this[i]=$:this.setAttribute(i,$)):this.R(i);return this},mx=w((m,i,..._)=>(m=R(m),_=i?.__proto__==Object.prototype&&!i?.nodeType?[m,i,_]:[m,null,[i,..._]],_._=1,_)),dom=w((m,i,..._)=>(m=n(R(m)),i?.__proto__==Object.prototype&&!i?.nodeType?m.$?m.$(i):m.render(..._).$attrs(i):m.render(i,..._),m))}(document,Element.prototype)
1
+ !function(l,i){let _='http://www.w3.org/2000/svg',w=l=>s[l]||=l.replace(/[A-Z]/g,'-$&').toLowerCase(),A=Symbol(),f=Object.assign,R=components={},$=(l,n={})=>new Proxy(l,{get:(_,i)=>n[i]||=l.bind(0,i)}),g=Symbol(),s={},n=(i,d)=>'svg'!=i&!d?f(l.createElement(i),R[i]):l.createElementNS(_,i),d={__proto__:null,value:1,selected:1,checked:1};define=(i,l={})=>{R[w(i)]=l;if(l.$)l.$$||=l.$,l.$=function(i){let _=l.$$.call(this,f(this.$state||={},i));return this.render(..._?._?[_]:_||[])}},dom=$((l,i,..._)=>(l=n(w(l)),i?.__proto__==Object.prototype&&!i?.nodeType?l.$?l.$(i):l.render(..._).$attrs(i):l.render(i,..._),l)),i.render=function(...f){let i=this,R=_==i.namespaceURI&'foreignObject'!=i.localName,l=i.firstChild,e;for(let _ of f){let $,w,m;if(_==null|!1===_)continue;if(_._)[$,w,m]=_;else if(_.nodeType){if(!e){for(let _ of f)_?.nodeType&&(_[g]=f);e=1}for(;l&&l!=_&&l[g]!=f;l=$)$=l.nextSibling,i.removeChild(l);l!=_&&(l?.nextSibling==_?i.removeChild(l):i.insertBefore(_,l)),l=_.nextSibling;continue}if(l)!$?l.splitText?l.data!=''+_&&(l.data=''+_):l.replaceWith(l=new Text(_)):$!=l.localName&&l.replaceWith(l=n($,R));else i.append(l=$?n($,R):new Text(_));if($)if(l.$)l[A]=0,l.$(w);else{let R=l[A]||={__proto__:null};for(let i in R)w&&Object.hasOwn(w,i)||(i[0]=='.'?(delete R[i],d[i=i.slice(1)]||w&&Object.hasOwn(w,i)&&w[i]||(l[i]=null,l.R(i))):(d[i]?l[i]='':R[i]?.call&&(l[i]=null),l.R(i),delete R[i]));l.render(...m);for(let i in w)_=w[i],i[0]=='.'?(R[i]=_,l[i=i.slice(1)]===_||(l[i]=_)):i in R&&R[i]===_?d[i]&&(l[i]===_||(l[i]=_)):_!=null&!1!==_?(_.call?l[i]=_:(d[i]&&(l[i]===_||(l[i]=_)),l.setAttribute(i,_)),R[i]=_):(d[i]?l[i]==''||(l[i]=''):R[i]?.call&&(l[i]=null),l.R(i),delete R[i])}l=l.nextSibling}for(let $;l;l=$)$=l.nextSibling,i.removeChild(l);return this},i.$attrs=function(l,i,_){for(i in l)_=l[i],i[0]=='.'?this[i.slice(1)]=_:_!=null&!1!==_?(_.call?this[i]=_:this.setAttribute(i,_)):this.R(i);return this},i.R=i.removeAttribute,mx=$((l,i,..._)=>(l=w(l),_=i?.__proto__==Object.prototype&&!i?.nodeType?[l,i,_]:[l,null,[i,..._]],_._=1,_))}(document,Element.prototype)
package/mx.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  let mx, dom, define, components;
2
- !function(m,i,_,u){let $='http://www.w3.org/2000/svg',t={__proto__:null,value:1,checked:1,selected:1},x=Symbol(),n=(i,t)=>!t&'svg'!=i?l(m.createElement(i),_[i]):m.createElementNS($,i),R=m=>h[m]||=m.replace(/[A-Z]/g,'-$&').toLowerCase(),h={},l=Object.assign,w=(m,n={})=>new Proxy(m,{get:(i,_)=>n[_]||=m.bind(0,_)});define=(i,m={})=>{if(m.$)m.$$||=m.$,m.$=function(i){let _=m.$$.call(this,l(this.$state||={},i));return this.render(..._?._?[_]:_||[])};_[R(i)]=m};i.render=function(...l){let i=this,_=i.namespaceURI==$&'foreignObject'!=i.localName,m=i.firstChild;for(let $ of l){let w,R,g;if($==null|!1===$)continue;if($._)[w,R,g]=$;else if($.nodeType){$!=m&&(m?m.replaceWith($):i.append($)),m=$.nextSibling;continue}if(m)!w?m.splitText?m.data!=$+''&&(m.data=$+''):m.replaceWith(m=new Text($)):w!=m.localName&&m.replaceWith(m=n(w,_));else if(w)i.append(m=n(w,_));else{i.append($);continue}if(w)if(m.$)m[x]=0,m.$(R);else{m.render(...g);let[_,n]=m[x]||=[{},{}],l=u=-~u;for(let i in _){R&&Object.hasOwn(R,i)||(('.'==i[0]?t[i.slice(1)]&&delete n[i.slice(1)]:(t[i]&&(delete n[i],m[i]=''),m.R(i))),delete _[i])}for(let i in R){let $=R[i],k=i.slice(1);_[i]===$?'.'==i[0]?(m[k]===$||(m[k]=$),n[k]=l):t[i]?(m[i]===$||(m[i]=$),n[i]=l):$?.call&&(n[i]=l):'.'==i[0]?(m[k]===$||(m[k]=$),n[k]=l,_[i]=$):$!=null&!1!==$?($.call?(m[i]=$,n[i]=l):(t[i]?(m[i]===$||(m[i]=$),n[i]=l):delete n[i],m.setAttribute(i,$)),_[i]=$):(t[i]&&(delete n[i],m[i]=''),m.R(i),delete _[i])}for(let i in n)l-n[i]&&(delete n[i],m[i]=null,m.R(i))}m=m.nextSibling}for(let $;m;m=$)$=m.nextSibling,i.removeChild(m);return this},i.R=i.removeAttribute,_=components={},i.$attrs=function(m,i,$){for(i in m)$=m[i],'.'==i[0]?this[i.slice(1)]=$:$!=null&!1!==$?($.call?this[i]=$:this.setAttribute(i,$)):this.R(i);return this},mx=w((m,i,..._)=>(m=R(m),_=i?.__proto__==Object.prototype&&!i?.nodeType?[m,i,_]:[m,null,[i,..._]],_._=1,_)),dom=w((m,i,..._)=>(m=n(R(m)),i?.__proto__==Object.prototype&&!i?.nodeType?m.$?m.$(i):m.render(..._).$attrs(i):m.render(i,..._),m))}(document,Element.prototype)
2
+ !function(l,i){let _='http://www.w3.org/2000/svg',w=l=>s[l]||=l.replace(/[A-Z]/g,'-$&').toLowerCase(),A=Symbol(),f=Object.assign,R=components={},$=(l,n={})=>new Proxy(l,{get:(_,i)=>n[i]||=l.bind(0,i)}),g=Symbol(),s={},n=(i,d)=>'svg'!=i&!d?f(l.createElement(i),R[i]):l.createElementNS(_,i),d={__proto__:null,value:1,selected:1,checked:1};define=(i,l={})=>{R[w(i)]=l;if(l.$)l.$$||=l.$,l.$=function(i){let _=l.$$.call(this,f(this.$state||={},i));return this.render(..._?._?[_]:_||[])}},dom=$((l,i,..._)=>(l=n(w(l)),i?.__proto__==Object.prototype&&!i?.nodeType?l.$?l.$(i):l.render(..._).$attrs(i):l.render(i,..._),l)),i.render=function(...f){let i=this,R=_==i.namespaceURI&'foreignObject'!=i.localName,l=i.firstChild,e;for(let _ of f){let $,w,m;if(_==null|!1===_)continue;if(_._)[$,w,m]=_;else if(_.nodeType){if(!e){for(let _ of f)_?.nodeType&&(_[g]=f);e=1}for(;l&&l!=_&&l[g]!=f;l=$)$=l.nextSibling,i.removeChild(l);l!=_&&(l?.nextSibling==_?i.removeChild(l):i.insertBefore(_,l)),l=_.nextSibling;continue}if(l)!$?l.splitText?l.data!=''+_&&(l.data=''+_):l.replaceWith(l=new Text(_)):$!=l.localName&&l.replaceWith(l=n($,R));else i.append(l=$?n($,R):new Text(_));if($)if(l.$)l[A]=0,l.$(w);else{let R=l[A]||={__proto__:null};for(let i in R)w&&Object.hasOwn(w,i)||(i[0]=='.'?(delete R[i],d[i=i.slice(1)]||w&&Object.hasOwn(w,i)&&w[i]||(l[i]=null,l.R(i))):(d[i]?l[i]='':R[i]?.call&&(l[i]=null),l.R(i),delete R[i]));l.render(...m);for(let i in w)_=w[i],i[0]=='.'?(R[i]=_,l[i=i.slice(1)]===_||(l[i]=_)):i in R&&R[i]===_?d[i]&&(l[i]===_||(l[i]=_)):_!=null&!1!==_?(_.call?l[i]=_:(d[i]&&(l[i]===_||(l[i]=_)),l.setAttribute(i,_)),R[i]=_):(d[i]?l[i]==''||(l[i]=''):R[i]?.call&&(l[i]=null),l.R(i),delete R[i])}l=l.nextSibling}for(let $;l;l=$)$=l.nextSibling,i.removeChild(l);return this},i.$attrs=function(l,i,_){for(i in l)_=l[i],i[0]=='.'?this[i.slice(1)]=_:_!=null&!1!==_?(_.call?this[i]=_:this.setAttribute(i,_)):this.R(i);return this},i.R=i.removeAttribute,mx=$((l,i,..._)=>(l=w(l),_=i?.__proto__==Object.prototype&&!i?.nodeType?[l,i,_]:[l,null,[i,..._]],_._=1,_))}(document,Element.prototype)
3
3
  export { mx, dom, define, components };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tltdsh/mx",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "<1KB UI engine. Build big. Ship small. Iterate fast.",
5
5
  "license": "0BSD",
6
6
  "author": "tltdsh",