@tltdsh/mx 1.0.2 → 1.0.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/README.md CHANGED
@@ -1,19 +1,31 @@
1
1
  # mx.js
2
2
 
3
- Expressive UI library in **890 bytes** (brotli) for building high-end, enterprise-level applications. 4 globals, zero dependencies, no build step.
3
+ Expressive UI library in **862 bytes** (brotli) for building high-end, enterprise-level applications. 4 globals, zero dependencies, no build step.
4
4
 
5
5
  [**Documentation**](https://mxjs.dev)
6
6
 
7
7
  ## Install
8
8
 
9
- ```
10
- npm i @tltdsh/mx
9
+ ### CDN (recommended)
10
+
11
+ ```html
12
+ <!-- jsDelivr (multi-CDN, recommended) -->
13
+ <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx"></script>
14
+
15
+ <!-- unpkg -->
16
+ <script src="https://unpkg.com/@tltdsh/mx"></script>
11
17
  ```
12
18
 
13
- ### Script tag (globals)
19
+ ### Pinned version
14
20
 
15
21
  ```html
16
- <script src="https://unpkg.com/@tltdsh/mx"></script>
22
+ <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.0.3/mx.min.js"></script>
23
+ ```
24
+
25
+ ### npm / yarn / bun
26
+
27
+ ```
28
+ npm i @tltdsh/mx
17
29
  ```
18
30
 
19
31
  ### ESM
package/mx.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,n){n=components={},define=(e,t={})=>{if(t.$){let e=t.$;t.$=function(t){let n=e.call(this,i(this.$state||={},t));return n._?this.render(n):this.render(...n)}}n[e=e.toLowerCase()]=t};let s={value:1,checked:1,selected:1},i=Object.assign,a="http://www.w3.org/2000/svg",o=(t,s)=>{if(t=="svg"|s)return e.createElementNS(a,t);let o=e.createElement(t),r=n[t];return r&&i(o,r),o};t.R=t.removeAttribute,t.$attrs=function(e,t,n){for(t in e)n=e[t],t[0]=="."?this[t.slice(1)]=n:n?.call?this[t]=n:n==null|n===!1?this.R(t):this.setAttribute(t,n==!0?"":n);return this},t.render=function(...i){let t=this,e=t.firstChild,n=t.namespaceURI==a;for(let a of i){if(a==null|a===!1)continue;let r,c,l;if(a._)[r,c,l]=a;else if(a.nodeType){e!=a&&(e?e.replaceWith(a):t.append(a)),e=a.nextSibling;continue}if(e)r?e.localName!=r&&e.replaceWith(e=o(r,n)):e.localName?e.replaceWith(e=new Text(a)):e.nodeValue!=""+a&&(e.nodeValue=""+a);else if(r)t.append(e=o(r,n));else{t.append(a);continue}if(r){let t=c;if(e.$)e._$=0;else{let n=e._$||={},o=n.__||={},i=n._=-~n._;for(let o in n){if(o[0]=="_")continue;(!t||!(o in c))&&(o[0]!="."&&(e.R(o),s[o]&&(e[o]="")),delete n[o])}if(t)for(let t in c){let a=c[t];if(a==n[t]){a?.call||s[t]?o[t]=i:t[0]=="."&&(o[t.slice(1)]=i);continue}t[0]=="."?(e[t.slice(1)]=a,o[t.slice(1)]=i,n[t]=a):a!=null&a!==!1?(a?.call?(e[t]=a,o[t]=i):(e.setAttribute(t,a),s[t]&&(e[t]=a,o[t]=i)),n[t]=a):(e.R(t),s[t]&&(e[t]=""),delete n[t])}for(let t in o)o[t]!=i&&(e[t]=null,delete o[t])}e.$?e.$.call(e,c):e.render(...l)}e=e.nextSibling}for(;e;){let t=e.nextSibling;e.remove(),e=t}return this};let l={},r=e=>new Proxy(e,{get:(t,n)=>e.bind(0,n)}),c=e=>(l[e]||=e.replace(/[A-Z]/g,"-$&").toLowerCase());mx=r((e,t,...n)=>{e=c(e);let s=t?.constructor==Object&&!t.nodeType?[e,t,n]:[e,null,[t,...n]];return s._=1,s}),dom=r((e,t,...n)=>{let s=o(c(e));if(t?.constructor==Object&&!t.nodeType){if(s.$)return s.$(t);s.$attrs(t)}else n=[t,...n];return s.render(...n),s})}(document,Element.prototype)
1
+ !function(f,g,u){u=components={},define=(f,g={})=>{if(g.$){let f=g.$;g.$=function(g){let u=f.call(this,l(this.$state||={},g));return u._?this.render(u):this.render(...u)}}u[f=f.toLowerCase()]=g};let e={value:1,checked:1,selected:1},l=Object.assign,k="http://www.w3.org/2000/svg",n=(g,e)=>{if(g=="svg"|e)return f.createElementNS(k,g);let n=f.createElement(g),m=u[g];return m&&l(n,m),n};g.$attrs=function(f,g,u){for(g in f)u=f[g],g[0]=="."?this[g.slice(1)]=u:u?.call?this[g]=u:u==null|u===!1?this.removeAttribute(g):this.setAttribute(g,u==!0?"":u);return this},g.render=function(...l){let g=this,f=g.firstChild,u=g.namespaceURI==k;for(let k of l){if(k==null|k===!1)continue;let m,d,o;if(k._)[m,d,o]=k;else if(k.nodeType){f!=k&&(f?f.replaceWith(k):g.append(k)),f=k.nextSibling;continue}if(f)m?f.localName!=m&&f.replaceWith(f=n(m,u)):f.localName?f.replaceWith(f=new Text(k)):f.nodeValue!=""+k&&(f.nodeValue=""+k);else if(m)g.append(f=n(m,u));else{g.append(k);continue}if(m){let g=d;if(f.$)f._$=0;else{let u=f._$||={},n=u.__||={},l=u._=-~u._;for(let n in u){if(n[0]=="_")continue;(!g||!(n in d))&&(n[0]!="."&&(f.removeAttribute(n),e[n]&&(f[n]="")),delete u[n])}if(g)for(let g in d){let k=d[g];if(k==u[g]){k?.call||e[g]?n[g]=l:g[0]=="."&&(n[g.slice(1)]=l);continue}g[0]=="."?(f[g.slice(1)]=k,n[g.slice(1)]=l,u[g]=k):k!=null&k!==!1?(k?.call?(f[g]=k,n[g]=l):(f.setAttribute(g,k),e[g]&&(f[g]=k,n[g]=l)),u[g]=k):(f.removeAttribute(g),e[g]&&(f[g]=""),delete u[g])}for(let g in n)n[g]!=l&&(f[g]=null,delete n[g])}f.$?f.$.call(f,d):f.render(...o)}f=f.nextSibling}for(;f;){let g=f.nextSibling;f.remove(),f=g}return this};let o={},m=f=>new Proxy(f,{get:(g,u)=>f.bind(0,u)}),d=f=>(o[f]||=f.replace(/[A-Z]/g,"-$&").toLowerCase());mx=m((f,g,...u)=>{f=d(f);let e=g?.constructor==Object&&!g.nodeType?[f,g,u]:[f,null,[g,...u]];return e._=1,e}),dom=m((f,g,...u)=>{let e=n(d(f));if(g?.constructor==Object&&!g.nodeType){if(e.$)return e.$(g);e.$attrs(g)}else u=[g,...u];return e.render(...u),e})}(document,Element.prototype)
package/mx.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  var mx, dom, define, components;
2
- !function(e,t,n){n=components={},define=(e,t={})=>{if(t.$){let e=t.$;t.$=function(t){let n=e.call(this,i(this.$state||={},t));return n._?this.render(n):this.render(...n)}}n[e=e.toLowerCase()]=t};let s={value:1,checked:1,selected:1},i=Object.assign,a="http://www.w3.org/2000/svg",o=(t,s)=>{if(t=="svg"|s)return e.createElementNS(a,t);let o=e.createElement(t),r=n[t];return r&&i(o,r),o};t.R=t.removeAttribute,t.$attrs=function(e,t,n){for(t in e)n=e[t],t[0]=="."?this[t.slice(1)]=n:n?.call?this[t]=n:n==null|n===!1?this.R(t):this.setAttribute(t,n==!0?"":n);return this},t.render=function(...i){let t=this,e=t.firstChild,n=t.namespaceURI==a;for(let a of i){if(a==null|a===!1)continue;let r,c,l;if(a._)[r,c,l]=a;else if(a.nodeType){e!=a&&(e?e.replaceWith(a):t.append(a)),e=a.nextSibling;continue}if(e)r?e.localName!=r&&e.replaceWith(e=o(r,n)):e.localName?e.replaceWith(e=new Text(a)):e.nodeValue!=""+a&&(e.nodeValue=""+a);else if(r)t.append(e=o(r,n));else{t.append(a);continue}if(r){let t=c;if(e.$)e._$=0;else{let n=e._$||={},o=n.__||={},i=n._=-~n._;for(let o in n){if(o[0]=="_")continue;(!t||!(o in c))&&(o[0]!="."&&(e.R(o),s[o]&&(e[o]="")),delete n[o])}if(t)for(let t in c){let a=c[t];if(a==n[t]){a?.call||s[t]?o[t]=i:t[0]=="."&&(o[t.slice(1)]=i);continue}t[0]=="."?(e[t.slice(1)]=a,o[t.slice(1)]=i,n[t]=a):a!=null&a!==!1?(a?.call?(e[t]=a,o[t]=i):(e.setAttribute(t,a),s[t]&&(e[t]=a,o[t]=i)),n[t]=a):(e.R(t),s[t]&&(e[t]=""),delete n[t])}for(let t in o)o[t]!=i&&(e[t]=null,delete o[t])}e.$?e.$.call(e,c):e.render(...l)}e=e.nextSibling}for(;e;){let t=e.nextSibling;e.remove(),e=t}return this};let l={},r=e=>new Proxy(e,{get:(t,n)=>e.bind(0,n)}),c=e=>(l[e]||=e.replace(/[A-Z]/g,"-$&").toLowerCase());mx=r((e,t,...n)=>{e=c(e);let s=t?.constructor==Object&&!t.nodeType?[e,t,n]:[e,null,[t,...n]];return s._=1,s}),dom=r((e,t,...n)=>{let s=o(c(e));if(t?.constructor==Object&&!t.nodeType){if(s.$)return s.$(t);s.$attrs(t)}else n=[t,...n];return s.render(...n),s})}(document,Element.prototype);
2
+ !function(f,g,u){u=components={},define=(f,g={})=>{if(g.$){let f=g.$;g.$=function(g){let u=f.call(this,l(this.$state||={},g));return u._?this.render(u):this.render(...u)}}u[f=f.toLowerCase()]=g};let e={value:1,checked:1,selected:1},l=Object.assign,k="http://www.w3.org/2000/svg",n=(g,e)=>{if(g=="svg"|e)return f.createElementNS(k,g);let n=f.createElement(g),m=u[g];return m&&l(n,m),n};g.$attrs=function(f,g,u){for(g in f)u=f[g],g[0]=="."?this[g.slice(1)]=u:u?.call?this[g]=u:u==null|u===!1?this.removeAttribute(g):this.setAttribute(g,u==!0?"":u);return this},g.render=function(...l){let g=this,f=g.firstChild,u=g.namespaceURI==k;for(let k of l){if(k==null|k===!1)continue;let m,d,o;if(k._)[m,d,o]=k;else if(k.nodeType){f!=k&&(f?f.replaceWith(k):g.append(k)),f=k.nextSibling;continue}if(f)m?f.localName!=m&&f.replaceWith(f=n(m,u)):f.localName?f.replaceWith(f=new Text(k)):f.nodeValue!=""+k&&(f.nodeValue=""+k);else if(m)g.append(f=n(m,u));else{g.append(k);continue}if(m){let g=d;if(f.$)f._$=0;else{let u=f._$||={},n=u.__||={},l=u._=-~u._;for(let n in u){if(n[0]=="_")continue;(!g||!(n in d))&&(n[0]!="."&&(f.removeAttribute(n),e[n]&&(f[n]="")),delete u[n])}if(g)for(let g in d){let k=d[g];if(k==u[g]){k?.call||e[g]?n[g]=l:g[0]=="."&&(n[g.slice(1)]=l);continue}g[0]=="."?(f[g.slice(1)]=k,n[g.slice(1)]=l,u[g]=k):k!=null&k!==!1?(k?.call?(f[g]=k,n[g]=l):(f.setAttribute(g,k),e[g]&&(f[g]=k,n[g]=l)),u[g]=k):(f.removeAttribute(g),e[g]&&(f[g]=""),delete u[g])}for(let g in n)n[g]!=l&&(f[g]=null,delete n[g])}f.$?f.$.call(f,d):f.render(...o)}f=f.nextSibling}for(;f;){let g=f.nextSibling;f.remove(),f=g}return this};let o={},m=f=>new Proxy(f,{get:(g,u)=>f.bind(0,u)}),d=f=>(o[f]||=f.replace(/[A-Z]/g,"-$&").toLowerCase());mx=m((f,g,...u)=>{f=d(f);let e=g?.constructor==Object&&!g.nodeType?[f,g,u]:[f,null,[g,...u]];return e._=1,e}),dom=m((f,g,...u)=>{let e=n(d(f));if(g?.constructor==Object&&!g.nodeType){if(e.$)return e.$(g);e.$attrs(g)}else u=[g,...u];return e.render(...u),e})}(document,Element.prototype);
3
3
  export { mx, dom, define, components };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tltdsh/mx",
3
- "version": "1.0.2",
4
- "description": "Expressive UI library in 890 bytes for building high-end, enterprise-level applications. 4 globals, zero dependencies, no build step.",
3
+ "version": "1.0.4",
4
+ "description": "Expressive UI library in 862 bytes for building high-end, enterprise-level applications. 4 globals, zero dependencies, no build step.",
5
5
  "license": "0BSD",
6
6
  "author": "tltdsh",
7
7
  "homepage": "https://mxjs.dev",