@tltdsh/mx 1.0.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.
Files changed (3) hide show
  1. package/LICENSE +12 -0
  2. package/mx.min.js +1 -0
  3. package/package.json +27 -0
package/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2026 tltdsh
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
12
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/mx.min.js ADDED
@@ -0,0 +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)
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@tltdsh/mx",
3
+ "version": "1.0.0",
4
+ "description": "Tiny DOM-first UI library. 890 bytes brotli.",
5
+ "license": "0BSD",
6
+ "author": "tltdsh",
7
+
8
+ "main": "mx.min.js",
9
+ "module": "mx.min.js",
10
+ "exports": {
11
+ ".": "./mx.min.js"
12
+ },
13
+ "files": [
14
+ "mx.min.js"
15
+ ],
16
+ "keywords": [
17
+ "ui",
18
+ "dom",
19
+ "framework",
20
+ "tiny",
21
+ "lightweight",
22
+ "components",
23
+ "custom-elements",
24
+ "no-dependencies",
25
+ "no-build"
26
+ ]
27
+ }