@tltdsh/mx 1.2.5 → 1.3.0
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 +1 -1
- package/README.md +2 -2
- package/mx.d.ts +11 -2
- package/mx.min.js +1 -1
- package/mx.mjs +1 -1
- package/package.json +1 -1
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
|
|
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. **
|
|
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.
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.3.0/mx.min.js"></script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### npm / yarn / bun
|
package/mx.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ interface MxHTMLAttrs {
|
|
|
33
33
|
style?: string;
|
|
34
34
|
title?: string;
|
|
35
35
|
tabindex?: number | string;
|
|
36
|
-
role?: string;
|
|
36
|
+
role?: 'alert' | 'alertdialog' | 'button' | 'checkbox' | 'dialog' | 'grid' | 'gridcell' | 'link' | 'listbox' | 'menu' | 'menubar' | 'menuitem' | 'option' | 'progressbar' | 'radio' | 'radiogroup' | 'region' | 'row' | 'rowgroup' | 'scrollbar' | 'search' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'tablist' | 'tabpanel' | 'textbox' | 'toolbar' | 'tooltip' | 'tree' | 'treeitem' | 'navigation' | 'banner' | 'main' | 'complementary' | 'contentinfo' | 'form' | 'presentation' | 'none' | (string & {});
|
|
37
37
|
slot?: string;
|
|
38
38
|
hidden?: boolean;
|
|
39
39
|
|
|
@@ -99,6 +99,7 @@ interface MxHTMLAttrs {
|
|
|
99
99
|
part?: string;
|
|
100
100
|
exportparts?: string;
|
|
101
101
|
is?: string;
|
|
102
|
+
blocking?: 'render';
|
|
102
103
|
|
|
103
104
|
// Popover
|
|
104
105
|
popover?: 'auto' | 'manual' | boolean;
|
|
@@ -112,6 +113,14 @@ interface MxHTMLAttrs {
|
|
|
112
113
|
'aria-placeholder'?: string;
|
|
113
114
|
'aria-errormessage'?: string;
|
|
114
115
|
|
|
116
|
+
// ARIA states cluster (accessibility)
|
|
117
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
118
|
+
'aria-expanded'?: boolean | 'true' | 'false';
|
|
119
|
+
'aria-disabled'?: boolean | 'true' | 'false';
|
|
120
|
+
'aria-selected'?: boolean | 'true' | 'false';
|
|
121
|
+
'aria-checked'?: boolean | 'true' | 'false' | 'mixed';
|
|
122
|
+
'aria-pressed'?: boolean | 'true' | 'false' | 'mixed';
|
|
123
|
+
|
|
115
124
|
// Loading
|
|
116
125
|
fetchpriority?: 'high' | 'low' | 'auto';
|
|
117
126
|
|
|
@@ -634,7 +643,7 @@ interface DomProxy extends DomHTMLTags {
|
|
|
634
643
|
|
|
635
644
|
/**
|
|
636
645
|
* Register a component by name. The `$` function becomes the render function.
|
|
637
|
-
* Name
|
|
646
|
+
* Name auto-converts camelCase to kebab-case, same as mx/dom call sites.
|
|
638
647
|
*
|
|
639
648
|
* @example
|
|
640
649
|
* define('counter', {
|
package/mx.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
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(
|
|
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 };
|