@tltdsh/mx 1.0.4 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +16 -8
  2. package/mx.d.ts +20 -20
  3. package/package.json +251 -37
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mx.js
2
2
 
3
- Expressive UI library in **862 bytes** (brotli) for building high-end, enterprise-level applications. 4 globals, zero dependencies, no build step.
3
+ Sub-1KB reactive DOM reconciliation engine for building massive platforms and user interfaces at scale. **862 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
  [**Documentation**](https://mxjs.dev)
6
6
 
@@ -19,7 +19,7 @@ Expressive UI library in **862 bytes** (brotli) for building high-end, enterpris
19
19
  ### Pinned version
20
20
 
21
21
  ```html
22
- <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.0.3/mx.min.js"></script>
22
+ <script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.0.6/mx.min.js"></script>
23
23
  ```
24
24
 
25
25
  ### npm / yarn / bun
@@ -28,17 +28,25 @@ Expressive UI library in **862 bytes** (brotli) for building high-end, enterpris
28
28
  npm i @tltdsh/mx
29
29
  ```
30
30
 
31
- ### ESM
31
+ ### ESM (bundler)
32
32
 
33
33
  ```js
34
34
  import { mx, dom, define, components } from '@tltdsh/mx'
35
35
  ```
36
36
 
37
+ ### ESM (dynamic import from CDN)
38
+
39
+ ```js
40
+ const { mx, dom, define, components } = await import('https://cdn.jsdelivr.net/npm/@tltdsh/mx/mx.mjs')
41
+ ```
42
+
43
+ Works in any modern browser or Deno - no install, no bundler, one line.
44
+
37
45
  ## 4 Globals
38
46
 
39
47
  | Global | Returns | Use for |
40
48
  |--------|---------|---------|
41
- | `mx.tag(attrs?, ...children)` | Description array | Inside `render()` — efficient reconciliation |
49
+ | `mx.tag(attrs?, ...children)` | Description array | Inside `render()` - efficient reconciliation |
42
50
  | `dom.tag(attrs?, ...children)` | HTMLElement | Persistent references, calling `.$()` later |
43
51
  | `define(name, { $() {} })` | void | Register a component |
44
52
  | `components` | object | Component registry |
@@ -180,7 +188,7 @@ let rowMap = new Map(
180
188
  data.map(d => [d.id, dom.tableRow({ data: d })])
181
189
  )
182
190
 
183
- // Nodes move by identity — internal state preserved on reorder
191
+ // Nodes move by identity - internal state preserved on reorder
184
192
  container.render(...data.map(d => rowMap.get(d.id)))
185
193
  ```
186
194
 
@@ -190,8 +198,8 @@ container.render(...data.map(d => rowMap.get(d.id)))
190
198
  - `dom.*` = real HTMLElements for persistent references
191
199
  - `$()` always returns array of children
192
200
  - `??=` protects `$state` from parent prop overwrites
193
- - Never `addEventListener` inside `$()` — use direct property assignment
194
- - Numbers auto-cast — no `String()` needed
201
+ - Never `addEventListener` inside `$()` - use direct property assignment
202
+ - Numbers auto-cast - no `String()` needed
195
203
  - Use `_ =>` for unused arrow params
196
204
  - `clearInterval(this._interval)` at top of `$()` for timers
197
205
  - `this._cache ||= new Map` for persistent Maps
@@ -206,4 +214,4 @@ import { mx, dom, define, type MxChild, type MxAttrs } from '@tltdsh/mx'
206
214
 
207
215
  ## License
208
216
 
209
- 0BSD — do whatever you want.
217
+ 0BSD - do whatever you want.
package/mx.d.ts CHANGED
@@ -2,12 +2,12 @@
2
2
  // https://mxjs.dev
3
3
 
4
4
  // ---------------------------------------------------------------------------
5
- // Children — everything render() and mx/dom accept as child nodes
5
+ // Children - everything render() and mx/dom accept as child nodes
6
6
  // ---------------------------------------------------------------------------
7
7
 
8
8
  /** A description array returned by mx.*() calls */
9
9
  interface MxDescription extends Array<any> {
10
- /** Internal marker — distinguishes descriptions from plain arrays */
10
+ /** Internal marker - distinguishes descriptions from plain arrays */
11
11
  _: 1 | true;
12
12
  }
13
13
 
@@ -233,11 +233,11 @@ interface MxSVGAttrs {
233
233
  /**
234
234
  * Full attribute type. Supports:
235
235
  * - Standard HTML/SVG attributes (autocomplete)
236
- * - `'.prop': value` — sets element property directly
237
- * - `onclick: fn` — event handler as property (auto-cleaned)
238
- * - `name: null | false` — removes attribute
239
- * - `name: true` — sets empty attribute
240
- * - `[key: string]: any` — custom attributes, data-*, aria-*
236
+ * - `'.prop': value` - sets element property directly
237
+ * - `onclick: fn` - event handler as property (auto-cleaned)
238
+ * - `name: null | false` - removes attribute
239
+ * - `name: true` - sets empty attribute
240
+ * - `[key: string]: any` - custom attributes, data-*, aria-*
241
241
  */
242
242
  type MxAttrs = MxHTMLAttrs & MxSVGAttrs & {
243
243
  [key: string]: any;
@@ -261,7 +261,7 @@ interface MxComponentDefinition {
261
261
  }
262
262
 
263
263
  // ---------------------------------------------------------------------------
264
- // Component element — an HTMLElement created by define()
264
+ // Component element - an HTMLElement created by define()
265
265
  // ---------------------------------------------------------------------------
266
266
 
267
267
  interface MxElement extends HTMLElement {
@@ -279,7 +279,7 @@ interface MxElement extends HTMLElement {
279
279
  }
280
280
 
281
281
  // ---------------------------------------------------------------------------
282
- // mx proxy — creates virtual descriptions for reconciliation
282
+ // mx proxy - creates virtual descriptions for reconciliation
283
283
  // ---------------------------------------------------------------------------
284
284
 
285
285
  /**
@@ -443,7 +443,7 @@ interface MxHTMLTags {
443
443
  }
444
444
 
445
445
  /**
446
- * `mx` — creates virtual descriptions for render reconciliation.
446
+ * `mx` - creates virtual descriptions for render reconciliation.
447
447
  *
448
448
  * CamelCase auto-converts to kebab-case:
449
449
  * `mx.priceChart()` → `<price-chart>`
@@ -454,12 +454,12 @@ interface MxHTMLTags {
454
454
  * mx.myComponent({ count: 5 })
455
455
  */
456
456
  interface MxProxy extends MxHTMLTags {
457
- /** Any tag name — CamelCase converts to kebab-case */
457
+ /** Any tag name - CamelCase converts to kebab-case */
458
458
  [tag: string]: MxTagFn;
459
459
  }
460
460
 
461
461
  // ---------------------------------------------------------------------------
462
- // dom proxy — creates real HTMLElements
462
+ // dom proxy - creates real HTMLElements
463
463
  // ---------------------------------------------------------------------------
464
464
 
465
465
  type DomTagFn<T extends Element = Element> = (attrs?: MxAttrs | MxChild, ...children: MxChild[]) => T;
@@ -575,7 +575,7 @@ interface DomHTMLTags {
575
575
  }
576
576
 
577
577
  /**
578
- * `dom` — creates real HTMLElements with attributes and children applied.
578
+ * `dom` - creates real HTMLElements with attributes and children applied.
579
579
  *
580
580
  * CamelCase auto-converts to kebab-case:
581
581
  * `dom.priceChart()` → `<price-chart>` HTMLElement
@@ -590,17 +590,17 @@ interface DomHTMLTags {
590
590
  * chart.$({ asset: newAsset }) // update later
591
591
  */
592
592
  interface DomProxy extends DomHTMLTags {
593
- /** Any tag name — CamelCase converts to kebab-case. Returns Element (or MxElement for components). */
593
+ /** Any tag name - CamelCase converts to kebab-case. Returns Element (or MxElement for components). */
594
594
  [tag: string]: DomTagFn<Element>;
595
595
  }
596
596
 
597
597
  // ---------------------------------------------------------------------------
598
- // define() — register a component
598
+ // define() - register a component
599
599
  // ---------------------------------------------------------------------------
600
600
 
601
601
  /**
602
602
  * Register a component by name. The `$` function becomes the render function.
603
- * Name is lowercased — CamelCase in mx/dom auto-converts to kebab-case.
603
+ * Name is lowercased - CamelCase in mx/dom auto-converts to kebab-case.
604
604
  *
605
605
  * @example
606
606
  * define('counter', {
@@ -636,7 +636,7 @@ declare global {
636
636
  /** Alias for removeAttribute (used internally) */
637
637
  R(name: string): void;
638
638
 
639
- /** Component state — merged via Object.assign on each $() call */
639
+ /** Component state - merged via Object.assign on each $() call */
640
640
  $state: Record<string, any>;
641
641
 
642
642
  /**
@@ -649,16 +649,16 @@ declare global {
649
649
  _$: any;
650
650
  }
651
651
 
652
- /** mx — virtual description proxy */
652
+ /** mx - virtual description proxy */
653
653
  var mx: MxProxy;
654
654
 
655
- /** dom — real element proxy */
655
+ /** dom - real element proxy */
656
656
  var dom: DomProxy;
657
657
 
658
658
  /** Register a component */
659
659
  var define: MxDefine;
660
660
 
661
- /** Component registry — maps lowercase names to definitions */
661
+ /** Component registry - maps lowercase names to definitions */
662
662
  var components: Record<string, MxComponentDefinition>;
663
663
  }
664
664
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tltdsh/mx",
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.",
3
+ "version": "1.0.6",
4
+ "description": "Sub-1KB reactive DOM reconciliation engine for building massive platforms and user interfaces at scale. 862 bytes brotli, zero dependencies, no build step. Small enough for AI context windows.",
5
5
  "license": "0BSD",
6
6
  "author": "tltdsh",
7
7
  "homepage": "https://mxjs.dev",
@@ -26,74 +26,288 @@
26
26
  "sideEffects": true,
27
27
  "keywords": [
28
28
  "ui",
29
+ "ui-library",
30
+ "ui-framework",
31
+ "ui-engine",
29
32
  "dom",
30
- "framework",
31
- "library",
32
- "engine",
33
- "protocol",
33
+ "dom-reconciliation",
34
+ "dom-diffing",
35
+ "dom-patching",
36
+ "dom-manipulation",
37
+ "dom-first",
34
38
  "reactive",
35
- "expressive",
39
+ "reactivity",
36
40
  "render",
37
41
  "rendering",
38
42
  "reconciliation",
39
- "virtual-dom",
43
+ "diff",
44
+ "patch",
40
45
  "components",
41
- "component-library",
46
+ "component-system",
42
47
  "custom-elements",
43
48
  "web-components",
44
- "enterprise",
45
- "production",
49
+ "declarative",
50
+ "view",
51
+ "view-layer",
52
+ "templating",
53
+ "state-management",
54
+ "data-binding",
55
+ "frontend",
56
+ "front-end",
57
+ "framework",
58
+ "micro-framework",
59
+ "engine",
46
60
  "tiny",
47
61
  "lightweight",
62
+ "ultra-lightweight",
48
63
  "minimal",
64
+ "minimalist",
49
65
  "small",
50
66
  "micro",
67
+ "1kb",
68
+ "sub-1kb",
51
69
  "fast",
52
70
  "performant",
53
- "efficient",
54
71
  "high-performance",
55
- "no-dependencies",
72
+ "efficient",
73
+ "zero-overhead",
74
+ "zero-dependency",
56
75
  "zero-dependencies",
76
+ "no-dependencies",
77
+ "dependency-free",
57
78
  "no-build",
58
79
  "no-bundler",
59
80
  "no-compile",
81
+ "no-tooling",
60
82
  "no-jsx",
83
+ "virtual-dom",
84
+ "vdom",
61
85
  "no-virtual-dom",
62
- "dom-first",
63
- "dom-manipulation",
64
- "svg",
65
- "frontend",
66
- "front-end",
67
- "view",
68
- "view-layer",
69
- "template",
70
- "templating",
71
- "declarative",
72
- "state-management",
73
- "state",
86
+ "buildless",
87
+ "cdn",
88
+ "cdn-ready",
89
+ "script-tag",
90
+ "esm",
91
+ "es-modules",
74
92
  "vanilla",
75
93
  "vanilla-js",
94
+ "vanilla-javascript",
95
+ "plain-javascript",
76
96
  "plain-js",
97
+ "pure-javascript",
77
98
  "browser",
99
+ "browser-native",
78
100
  "client-side",
79
- "spa",
80
- "single-page-app",
81
101
  "web",
82
102
  "webapp",
83
- "web-app",
103
+ "spa",
104
+ "single-page-app",
84
105
  "html",
106
+ "svg",
85
107
  "javascript",
86
108
  "js",
87
- "ui-library",
88
- "ui-framework",
89
- "ui-engine",
90
- "element",
91
- "node",
92
- "tree",
93
- "diff",
94
- "patch",
109
+ "typescript",
95
110
  "proxy",
96
111
  "keyed",
97
- "keyed-list"
112
+ "keyed-list",
113
+ "llm-friendly",
114
+ "ai-friendly",
115
+ "context-window",
116
+ "copilot-friendly",
117
+ "vibe-coding",
118
+ "prompt-friendly",
119
+ "ai-first",
120
+ "single-file",
121
+ "react-alternative",
122
+ "jquery-alternative",
123
+ "preact-alternative",
124
+ "vue-alternative",
125
+ "svelte-alternative",
126
+ "angular-alternative",
127
+ "htmx-alternative",
128
+ "unopinionated",
129
+ "simple",
130
+ "beginner-friendly",
131
+ "enterprise",
132
+ "enterprise-grade",
133
+ "enterprise-ui",
134
+ "production",
135
+ "production-ready",
136
+ "production-grade",
137
+ "large-scale",
138
+ "at-scale",
139
+ "massive",
140
+ "saas",
141
+ "b2b",
142
+ "b2c",
143
+ "fintech",
144
+ "medtech",
145
+ "healthtech",
146
+ "edtech",
147
+ "dashboard",
148
+ "admin-panel",
149
+ "back-office",
150
+ "data-driven",
151
+ "data-visualization",
152
+ "real-time",
153
+ "realtime",
154
+ "live-update",
155
+ "protocol",
156
+ "stable-api",
157
+ "api-stable",
158
+ "semver",
159
+ "long-term",
160
+ "future-proof",
161
+ "backwards-compatible",
162
+ "scalable",
163
+ "mission-critical",
164
+ "ultra-fast",
165
+ "ultrafast",
166
+ "superfast",
167
+ "blazing-fast",
168
+ "instant",
169
+ "snappy",
170
+ "low-latency",
171
+ "zero-latency",
172
+ "sub-millisecond",
173
+ "60fps",
174
+ "smooth",
175
+ "jank-free",
176
+ "memory-efficient",
177
+ "low-memory",
178
+ "small-footprint",
179
+ "zero-bloat",
180
+ "no-bloat",
181
+ "lean",
182
+ "slim",
183
+ "compact",
184
+ "nano",
185
+ "featherweight",
186
+ "atomic",
187
+ "modular",
188
+ "composable",
189
+ "extensible",
190
+ "embeddable",
191
+ "portable",
192
+ "universal",
193
+ "isomorphic",
194
+ "ssr-compatible",
195
+ "ssg",
196
+ "static-site",
197
+ "jamstack",
198
+ "headless",
199
+ "cms",
200
+ "widget",
201
+ "micro-frontend",
202
+ "micro-app",
203
+ "island",
204
+ "islands-architecture",
205
+ "progressive-enhancement",
206
+ "graceful-degradation",
207
+ "accessible",
208
+ "a11y",
209
+ "responsive",
210
+ "mobile-first",
211
+ "pwa",
212
+ "offline",
213
+ "web-platform",
214
+ "platform",
215
+ "app-framework",
216
+ "application-framework",
217
+ "crud",
218
+ "form",
219
+ "forms",
220
+ "table",
221
+ "list",
222
+ "grid",
223
+ "chart",
224
+ "tree",
225
+ "tree-view",
226
+ "tabs",
227
+ "modal",
228
+ "dropdown",
229
+ "tooltip",
230
+ "notification",
231
+ "toast",
232
+ "animation",
233
+ "transition",
234
+ "routing",
235
+ "router",
236
+ "navigation",
237
+ "lazy-loading",
238
+ "virtual-scroll",
239
+ "infinite-scroll",
240
+ "pagination",
241
+ "search",
242
+ "filter",
243
+ "sort",
244
+ "drag-and-drop",
245
+ "event-driven",
246
+ "event-handling",
247
+ "lifecycle",
248
+ "hooks-free",
249
+ "class-free",
250
+ "functional",
251
+ "imperative",
252
+ "direct-dom",
253
+ "real-dom",
254
+ "dom-api",
255
+ "element",
256
+ "node",
257
+ "html5",
258
+ "css3",
259
+ "modern-web",
260
+ "web-standard",
261
+ "standards-compliant",
262
+ "cross-browser",
263
+ "chrome",
264
+ "firefox",
265
+ "safari",
266
+ "edge",
267
+ "webkit",
268
+ "blink",
269
+ "v8",
270
+ "javascriptcore",
271
+ "spidermonkey",
272
+ "deno",
273
+ "bun",
274
+ "node",
275
+ "npm",
276
+ "yarn",
277
+ "pnpm",
278
+ "open-source",
279
+ "0bsd",
280
+ "mit",
281
+ "free",
282
+ "no-license-restriction",
283
+ "commercial-friendly",
284
+ "startup",
285
+ "indie",
286
+ "indie-hacker",
287
+ "solo-developer",
288
+ "side-project",
289
+ "mvp",
290
+ "prototype",
291
+ "rapid-development",
292
+ "rapid-prototyping",
293
+ "hackathon",
294
+ "code-golf",
295
+ "demoscene",
296
+ "js13k",
297
+ "size-optimized",
298
+ "brotli-optimized",
299
+ "gzip-optimized",
300
+ "compression-friendly",
301
+ "bandwidth-efficient",
302
+ "edge-compute",
303
+ "edge-function",
304
+ "serverless",
305
+ "cloudflare-workers",
306
+ "lambda",
307
+ "vercel",
308
+ "netlify",
309
+ "firebase",
310
+ "deno-deploy",
311
+ "fly-io"
98
312
  ]
99
313
  }