@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 +2 -2
- package/CLAUDE.md +2 -2
- package/README.md +1 -1
- package/mx.d.ts +7 -0
- package/mx.min.js +1 -1
- package/mx.mjs +1 -1
- package/package.json +1 -1
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
|
-
**
|
|
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
|
|
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
|
-
**
|
|
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
|
|
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.
|
|
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(
|
|
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(
|
|
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 };
|