@tltdsh/mx 1.2.4 → 1.2.6

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/CLAUDE.md CHANGED
@@ -13,7 +13,7 @@ When transferring from React/Vue/Svelte, read [mxjs.dev/what-mx-is-not](https://
13
13
  | Rule | Do | Don't |
14
14
  |------|----|-------|
15
15
  | Component definition | `$(props) {}` (method shorthand) | `$: function(props) {}` - legacy |
16
- | Component name | `define('my-widget', {...})` kebab-case | `define('myWidget', {...})` - lookup silently fails |
16
+ | Component name | `define('my-widget', {...})` kebab-case (camelCase also works — auto-converts to kebab) | Mismatched names between define and call site |
17
17
  | Call site | `mx.myWidget()` camelCase | `mx.MyWidget()` - PascalCase gives `-my-widget` (invalid) |
18
18
  | State updates | `this.$({ key: value })` | `this.$state.key = value` - bypasses the merge, forbidden |
19
19
  | Empty re-render | Pass actual changed data: `this.$({ key: newValue })` | `this.$({})` with empty object - code smell |
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mx.js
2
2
 
3
- Sub-1KB reactive DOM reconciliation engine for building massive platforms and user interfaces at scale. **849 bytes** brotli. 4 globals, zero dependencies, no virtual DOM, no build step. Small enough to fit in an AI context window.
3
+ Sub-1KB reactive DOM reconciliation engine for building massive platforms and user interfaces at scale. **770 bytes** brotli. 4 globals, zero dependencies, no virtual DOM, no build step. Small enough to fit in an AI context window.
4
4
 
5
5
  **Full documentation & live playground: [mxjs.dev](https://mxjs.dev)**
6
6
 
@@ -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.2.4/mx.min.js"></script>
24
+ <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.2.6/mx.min.js"></script>
25
25
  ```
26
26
 
27
27
  ### npm / yarn / bun
package/mx.d.ts CHANGED
@@ -98,6 +98,8 @@ interface MxHTMLAttrs {
98
98
  nonce?: string;
99
99
  part?: string;
100
100
  exportparts?: string;
101
+ is?: string;
102
+ blocking?: 'render';
101
103
 
102
104
  // Popover
103
105
  popover?: 'auto' | 'manual' | boolean;
@@ -633,7 +635,7 @@ interface DomProxy extends DomHTMLTags {
633
635
 
634
636
  /**
635
637
  * Register a component by name. The `$` function becomes the render function.
636
- * Name is lowercased - CamelCase in mx/dom auto-converts to kebab-case.
638
+ * Name auto-converts camelCase to kebab-case, same as mx/dom call sites.
637
639
  *
638
640
  * @example
639
641
  * define('counter', {
package/mx.min.js CHANGED
@@ -1 +1 @@
1
- !function(m,f,o){o=components={},define=(m,f={})=>{if(f.$){let g=f.$$||=f.$;f.$=function(f){let o=g.call(this,l(this.$state||={},f));return this.render(...o?._?[o]:o||[])}}o[m.toLowerCase()]=f};let i={selected:1,checked:1,value:1},l=Object.assign,e="http://www.w3.org/2000/svg",n=(f,i)=>{if("svg"==f|i)return m.createElementNS(e,f);return l(m.createElement(f),o[f])};f.$attrs=function(m,f,o){for(f in m)o=m[f],f[0]=="."?this[f.slice(1)]=o:o?.call?this[f]=o:o!=null&!1!==o?this.setAttribute(f,o):this.R(f);return this},f.render=function(...l){let f=this,m=f.firstChild,o=e==f.namespaceURI;for(let e of l){let d,g,h;if(e==null|!1===e)continue;if(e._)[g,d,h]=e;else if(e.nodeType){e!=m&&(m?m.replaceWith(e):f.append(e)),m=e.nextSibling;continue}if(m)!g?m.localName?m.replaceWith(m=new Text(e)):m.data!=e+""&&(m.data=e):g!=m.localName&&m.replaceWith(m=n(g,o));else if(g)f.append(m=n(g,o));else{f.append(e);continue}if(g){if(m.$)m._$=0,m.$(d);else{m.render(...h);let o=m._$||={},n=o.__||={},l=o._=-~o._;for(let f in o){if(f[0]=="_")continue;d&&f in d||((f[0]!="."?(i[f]&&(delete n[f],m[f]=""),m.R(f)):i[f.slice(1)]&&delete n[f.slice(1)]),delete o[f])}for(let f in d){let e=d[f];e===o[f]?f[0]=="."?(m[f.slice(1)]=e,n[f.slice(1)]=l):i[f]?(m[f]=e,n[f]=l):e?.call&&(n[f]=l):f[0]=="."?(m[f.slice(1)]=e,n[f.slice(1)]=l,o[f]=e):e!=null&!1!==e?(e.call?(m[f]=e,n[f]=l):(i[f]&&(m[f]=e,n[f]=l),m.setAttribute(f,e)),o[f]=e):(i[f]&&(delete n[f],m[f]=""),m.R(f),delete o[f])}for(let f in n)l-n[f]&&(m[f]=null,delete n[f])}}m=m.nextSibling}for(let f;m;m=f)f=m.nextSibling,m.remove();return this};let g=m=>new Proxy(m,{get:(f,o)=>m.bind(0,o)}),_={},d=m=>_[m]||=m.replace(/[A-Z]/g,"-$&").toLowerCase();mx=g((m,f,...o)=>{m=d(m);let i=f?.constructor==Object&&!f?.nodeType?[m,f,o]:[m,null,[f,...o]];return i._=1,i}),dom=g((m,f,...o)=>{m=d(m);let i=n(m);f?.constructor==Object&&!f?.nodeType?i.$?i.$(f):i.$attrs(f).render(...o):i.render(f,...o);return i}),f.R=f.removeAttribute}(document,Element.prototype)
1
+ !function($,l,_,d){let R="http://www.w3.org/2000/svg",t={selected:1,value:1,checked:1},n={},w=$=>n[$]||=$.replace(/[A-Z]/g,"-$&").toLowerCase(),i=Object.assign,m=$=>new Proxy($,{get:(l,_)=>$.bind(0,_)}),g=(l,t)=>!t&"svg"!=l?i($.createElement(l),_[l]):$.createElementNS(R,l);define=(l,$={})=>{if($.$){$.$$||=$.$;$.$=function(l){let _=$.$$.call(this,i(this.$state||={},l));return this.render(..._?._?[_]:_||[])}}_[w(l)]=$};_=components={},l.render=function(...i){let l=this,_=R==l.namespaceURI,$=l.firstChild;for(let R of i){let m,w,v;if(R==null|!1===R)continue;if(R._)[m,w,v]=R;else if(R.nodeType){$!=R&&($?$.replaceWith(R):l.append(R)),$=R.nextSibling;continue}if($)!m?$.localName?$.replaceWith($=new Text(R)):R+""!=$.data&&($.data=R):m!=$.localName&&$.replaceWith($=g(m,_));else if(m)l.append($=g(m,_));else{l.append(R);continue}if(m){if($.$)$._$=0,$.$(w);else{$.render(...v);let _=$._$||={},g=$._$$||={},i=d=-~d;for(let l in _){w&&l in w||((l[0]=="."?t[l.slice(1)]&&delete g[l.slice(1)]:(t[l]&&(delete g[l],$[l]=""),$.R(l))),delete _[l])}for(let l in w){let R=w[l];_[l]===R?l[0]=="."?($[l.slice(1)]=R,g[l.slice(1)]=i):t[l]?($[l]=R,g[l]=i):R?.call&&(g[l]=i):l[0]=="."?($[l.slice(1)]=R,g[l.slice(1)]=i,_[l]=R):R!=null&!1!==R?(R.call?($[l]=R,g[l]=i):(t[l]?($[l]=R,g[l]=i):delete g[l],$.setAttribute(l,R)),_[l]=R):(t[l]&&(delete g[l],$[l]=""),$.R(l),delete _[l])}for(let l in g)i-g[l]&&(delete g[l],$[l]=null)}}$=$.nextSibling}for(let l;$;$=l)l=$.nextSibling,$.remove();return this},l.R=l.removeAttribute,l.$attrs=function($,l,R){for(l in $)R=$[l],l[0]=="."?this[l.slice(1)]=R:R!=null&!1!==R?(R.call?this[l]=R:this.setAttribute(l,R)):this.R(l);return this},mx=m(($,l,..._)=>{$=w($);let t=l?.constructor==Object&&!l?.nodeType?[$,l,_]:[$,null,[l,..._]];t._=1;return t}),dom=m(($,l,..._)=>{$=w($);let t=g($);l?.constructor==Object&&!l?.nodeType?t.$?t.$(l):t.$attrs(l).render(..._):t.render(l,..._);return t})}(document,Element.prototype)
package/mx.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  var mx, dom, define, components;
2
- !function(m,f,o){o=components={},define=(m,f={})=>{if(f.$){let g=f.$$||=f.$;f.$=function(f){let o=g.call(this,l(this.$state||={},f));return this.render(...o?._?[o]:o||[])}}o[m.toLowerCase()]=f};let i={selected:1,checked:1,value:1},l=Object.assign,e="http://www.w3.org/2000/svg",n=(f,i)=>{if("svg"==f|i)return m.createElementNS(e,f);return l(m.createElement(f),o[f])};f.$attrs=function(m,f,o){for(f in m)o=m[f],f[0]=="."?this[f.slice(1)]=o:o?.call?this[f]=o:o!=null&!1!==o?this.setAttribute(f,o):this.R(f);return this},f.render=function(...l){let f=this,m=f.firstChild,o=e==f.namespaceURI;for(let e of l){let d,g,h;if(e==null|!1===e)continue;if(e._)[g,d,h]=e;else if(e.nodeType){e!=m&&(m?m.replaceWith(e):f.append(e)),m=e.nextSibling;continue}if(m)!g?m.localName?m.replaceWith(m=new Text(e)):m.data!=e+""&&(m.data=e):g!=m.localName&&m.replaceWith(m=n(g,o));else if(g)f.append(m=n(g,o));else{f.append(e);continue}if(g){if(m.$)m._$=0,m.$(d);else{m.render(...h);let o=m._$||={},n=o.__||={},l=o._=-~o._;for(let f in o){if(f[0]=="_")continue;d&&f in d||((f[0]!="."?(i[f]&&(delete n[f],m[f]=""),m.R(f)):i[f.slice(1)]&&delete n[f.slice(1)]),delete o[f])}for(let f in d){let e=d[f];e===o[f]?f[0]=="."?(m[f.slice(1)]=e,n[f.slice(1)]=l):i[f]?(m[f]=e,n[f]=l):e?.call&&(n[f]=l):f[0]=="."?(m[f.slice(1)]=e,n[f.slice(1)]=l,o[f]=e):e!=null&!1!==e?(e.call?(m[f]=e,n[f]=l):(i[f]&&(m[f]=e,n[f]=l),m.setAttribute(f,e)),o[f]=e):(i[f]&&(delete n[f],m[f]=""),m.R(f),delete o[f])}for(let f in n)l-n[f]&&(m[f]=null,delete n[f])}}m=m.nextSibling}for(let f;m;m=f)f=m.nextSibling,m.remove();return this};let g=m=>new Proxy(m,{get:(f,o)=>m.bind(0,o)}),_={},d=m=>_[m]||=m.replace(/[A-Z]/g,"-$&").toLowerCase();mx=g((m,f,...o)=>{m=d(m);let i=f?.constructor==Object&&!f?.nodeType?[m,f,o]:[m,null,[f,...o]];return i._=1,i}),dom=g((m,f,...o)=>{m=d(m);let i=n(m);f?.constructor==Object&&!f?.nodeType?i.$?i.$(f):i.$attrs(f).render(...o):i.render(f,...o);return i}),f.R=f.removeAttribute}(document,Element.prototype);
2
+ !function($,l,_,d){let R="http://www.w3.org/2000/svg",t={selected:1,value:1,checked:1},n={},w=$=>n[$]||=$.replace(/[A-Z]/g,"-$&").toLowerCase(),i=Object.assign,m=$=>new Proxy($,{get:(l,_)=>$.bind(0,_)}),g=(l,t)=>!t&"svg"!=l?i($.createElement(l),_[l]):$.createElementNS(R,l);define=(l,$={})=>{if($.$){$.$$||=$.$;$.$=function(l){let _=$.$$.call(this,i(this.$state||={},l));return this.render(..._?._?[_]:_||[])}}_[w(l)]=$};_=components={},l.render=function(...i){let l=this,_=R==l.namespaceURI,$=l.firstChild;for(let R of i){let m,w,v;if(R==null|!1===R)continue;if(R._)[m,w,v]=R;else if(R.nodeType){$!=R&&($?$.replaceWith(R):l.append(R)),$=R.nextSibling;continue}if($)!m?$.localName?$.replaceWith($=new Text(R)):R+""!=$.data&&($.data=R):m!=$.localName&&$.replaceWith($=g(m,_));else if(m)l.append($=g(m,_));else{l.append(R);continue}if(m){if($.$)$._$=0,$.$(w);else{$.render(...v);let _=$._$||={},g=$._$$||={},i=d=-~d;for(let l in _){w&&l in w||((l[0]=="."?t[l.slice(1)]&&delete g[l.slice(1)]:(t[l]&&(delete g[l],$[l]=""),$.R(l))),delete _[l])}for(let l in w){let R=w[l];_[l]===R?l[0]=="."?($[l.slice(1)]=R,g[l.slice(1)]=i):t[l]?($[l]=R,g[l]=i):R?.call&&(g[l]=i):l[0]=="."?($[l.slice(1)]=R,g[l.slice(1)]=i,_[l]=R):R!=null&!1!==R?(R.call?($[l]=R,g[l]=i):(t[l]?($[l]=R,g[l]=i):delete g[l],$.setAttribute(l,R)),_[l]=R):(t[l]&&(delete g[l],$[l]=""),$.R(l),delete _[l])}for(let l in g)i-g[l]&&(delete g[l],$[l]=null)}}$=$.nextSibling}for(let l;$;$=l)l=$.nextSibling,$.remove();return this},l.R=l.removeAttribute,l.$attrs=function($,l,R){for(l in $)R=$[l],l[0]=="."?this[l.slice(1)]=R:R!=null&!1!==R?(R.call?this[l]=R:this.setAttribute(l,R)):this.R(l);return this},mx=m(($,l,..._)=>{$=w($);let t=l?.constructor==Object&&!l?.nodeType?[$,l,_]:[$,null,[l,..._]];t._=1;return t}),dom=m(($,l,..._)=>{$=w($);let t=g($);l?.constructor==Object&&!l?.nodeType?t.$?t.$(l):t.$attrs(l).render(..._):t.render(l,..._);return t})}(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.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "<1KB UI engine. Build big. Ship small. Iterate fast.",
5
5
  "license": "0BSD",
6
6
  "author": "tltdsh",