@tltdsh/mx 1.2.3 → 1.2.4
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 +2 -2
- package/mx.d.ts +2 -1
- package/mx.min.js +1 -1
- package/mx.mjs +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -24,7 +24,7 @@ When transferring from React/Vue/Svelte, read [mxjs.dev/what-mx-is-not](https://
|
|
|
24
24
|
| Inline styles | `style: 'width:' + pct + '%'` | `style: { width: pct + '%' }` - not supported |
|
|
25
25
|
| Array children | `mx.ul(...items.map(i => mx.li(i)))` | `mx.ul(items.map(...))` - stringifies to `"1,2,3"` text |
|
|
26
26
|
| No attrs, just children | `mx.div(child1, child2)` | `mx.div({}, child)` or `mx.div(null, child)` |
|
|
27
|
-
| Boolean attributes | `disabled: true` sets `disabled=""` | Expecting it to set a JS property |
|
|
27
|
+
| Boolean attributes | `disabled: true` sets `disabled="true"` | Expecting it to set a JS property |
|
|
28
28
|
| First arg type | `mx.div({class: 'x'}, child)` | `mx.div(myMap, child)` - non-plain-Object treated as child |
|
|
29
29
|
|
|
30
30
|
---
|
|
@@ -216,7 +216,7 @@ After processing all children, excess old DOM nodes are removed.
|
|
|
216
216
|
| `name: 'value'` | `setAttribute` | `class: 'active'` |
|
|
217
217
|
| `'.name': value` | `el[name] = value` (property) | `'.value': text` |
|
|
218
218
|
| `name: null` / `false` | `removeAttribute` | `disabled: null` |
|
|
219
|
-
| `name: true` | `setAttribute(name, '')` | `disabled: true` |
|
|
219
|
+
| `name: true` | `setAttribute(name, 'true')` | `disabled: true` |
|
|
220
220
|
| `onname: fn` | `el[name] = fn` (property) | `onclick: handler` |
|
|
221
221
|
|
|
222
222
|
**Dual-track**: `value`, `checked`, `selected` automatically set both attribute AND property.
|
package/CLAUDE.md
CHANGED
|
@@ -24,7 +24,7 @@ When transferring from React/Vue/Svelte, read [mxjs.dev/what-mx-is-not](https://
|
|
|
24
24
|
| Inline styles | `style: 'width:' + pct + '%'` | `style: { width: pct + '%' }` - not supported |
|
|
25
25
|
| Array children | `mx.ul(...items.map(i => mx.li(i)))` | `mx.ul(items.map(...))` - stringifies to `"1,2,3"` text |
|
|
26
26
|
| No attrs, just children | `mx.div(child1, child2)` | `mx.div({}, child)` or `mx.div(null, child)` |
|
|
27
|
-
| Boolean attributes | `disabled: true` sets `disabled=""` | Expecting it to set a JS property |
|
|
27
|
+
| Boolean attributes | `disabled: true` sets `disabled="true"` | Expecting it to set a JS property |
|
|
28
28
|
| First arg type | `mx.div({class: 'x'}, child)` | `mx.div(myMap, child)` - non-plain-Object treated as child |
|
|
29
29
|
|
|
30
30
|
---
|
|
@@ -216,7 +216,7 @@ After processing all children, excess old DOM nodes are removed.
|
|
|
216
216
|
| `name: 'value'` | `setAttribute` | `class: 'active'` |
|
|
217
217
|
| `'.name': value` | `el[name] = value` (property) | `'.value': text` |
|
|
218
218
|
| `name: null` / `false` | `removeAttribute` | `disabled: null` |
|
|
219
|
-
| `name: true` | `setAttribute(name, '')` | `disabled: true` |
|
|
219
|
+
| `name: true` | `setAttribute(name, 'true')` | `disabled: true` |
|
|
220
220
|
| `onname: fn` | `el[name] = fn` (property) | `onclick: handler` |
|
|
221
221
|
|
|
222
222
|
**Dual-track**: `value`, `checked`, `selected` automatically set both attribute AND property.
|
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.2.
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.2.4/mx.min.js"></script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### npm / yarn / bun
|
|
@@ -174,7 +174,7 @@ Excess old nodes are removed. That's it.
|
|
|
174
174
|
```js
|
|
175
175
|
mx.div({ class: 'active' }) // setAttribute
|
|
176
176
|
mx.input({ '.value': text }) // el.value = text (property)
|
|
177
|
-
mx.button({ disabled: true }) // setAttribute(name, '')
|
|
177
|
+
mx.button({ disabled: true }) // setAttribute(name, 'true')
|
|
178
178
|
mx.button({ disabled: null }) // removeAttribute
|
|
179
179
|
mx.button({ onclick: handler }) // el.onclick = handler (auto-cleaned)
|
|
180
180
|
```
|
package/mx.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ interface MxHTMLAttrs {
|
|
|
97
97
|
autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
98
98
|
nonce?: string;
|
|
99
99
|
part?: string;
|
|
100
|
+
exportparts?: string;
|
|
100
101
|
|
|
101
102
|
// Popover
|
|
102
103
|
popover?: 'auto' | 'manual' | boolean;
|
|
@@ -268,7 +269,7 @@ interface MxSVGAttrs {
|
|
|
268
269
|
* - `'.prop': value` - sets element property directly
|
|
269
270
|
* - `onclick: fn` - event handler as property (auto-cleaned)
|
|
270
271
|
* - `name: null | false` - removes attribute
|
|
271
|
-
* - `name: true` - sets
|
|
272
|
+
* - `name: true` - sets attribute to the string "true" (`setAttribute(name, 'true')`)
|
|
272
273
|
* - `[key: string]: any` - custom attributes, data-*, aria-*
|
|
273
274
|
*/
|
|
274
275
|
type MxAttrs = MxHTMLAttrs & MxSVGAttrs & {
|
package/mx.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(m,f,o){o=components={},define=(m,f={})=>{if(f.$){let
|
|
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)
|
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
|
|
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);
|
|
3
3
|
export { mx, dom, define, components };
|