microui-wc 0.1.0 β 0.1.1
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/demo/shell.html +4 -4
- package/dist/AGENTS.md +55 -55
- package/dist/README.md +7 -7
- package/dist/components.css +1 -1
- package/dist/microui.css +1 -1
- package/dist/styles/components/switch.css +1 -1
- package/package.json +2 -2
- package/src/styles/components/switch.css +7 -8
- package/src/styles/components.css +6 -6
package/demo/shell.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<!-- Preload critical resources -->
|
|
29
29
|
<link rel="preload" as="image" type="image/webp" href="../assets/logo-banner-400.webp"
|
|
30
30
|
imagesrcset="../assets/logo-banner-400.webp 1x, ../assets/logo-banner-800.webp 2x" fetchpriority="high">
|
|
31
|
-
<link rel="preload" as="style" href="../dist/microui.css?v=2.0.
|
|
31
|
+
<link rel="preload" as="style" href="../dist/microui.css?v=2.0.197">
|
|
32
32
|
<!-- Self-hosted fonts: Preload Roboto only (icons now use inline SVG) -->
|
|
33
33
|
<link rel="preload" href="../assets/fonts/roboto-400.woff2" as="font" type="font/woff2" crossorigin>
|
|
34
34
|
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
/* Material Symbols font removed - icons use inline SVG now */
|
|
79
79
|
</style>
|
|
80
80
|
<!-- Async CSS loading: media=print prevents blocking, onload switches to all -->
|
|
81
|
-
<link rel="stylesheet" href="../dist/microui.css?v=2.0.
|
|
81
|
+
<link rel="stylesheet" href="../dist/microui.css?v=2.0.197" media="print" onload="this.media='all'">
|
|
82
82
|
<noscript>
|
|
83
|
-
<link rel="stylesheet" href="../dist/microui.css?v=2.0.
|
|
83
|
+
<link rel="stylesheet" href="../dist/microui.css?v=2.0.197">
|
|
84
84
|
</noscript>
|
|
85
85
|
<style>
|
|
86
86
|
/* Size-adjusted Arial fallback to match Roboto metrics (from Capsize) */
|
|
@@ -467,7 +467,7 @@
|
|
|
467
467
|
if (loadedRoutes.has(name)) return;
|
|
468
468
|
loadedRoutes.add(name);
|
|
469
469
|
const start = performance.now();
|
|
470
|
-
await import('../dist/routes/' + name + '.js?v=2.0.
|
|
470
|
+
await import('../dist/routes/' + name + '.js?v=2.0.197');
|
|
471
471
|
console.log('[Shell] Route ' + name + '.js loaded in ' + (performance.now() - start).toFixed(0) + 'ms');
|
|
472
472
|
}
|
|
473
473
|
|
package/dist/AGENTS.md
CHANGED
|
@@ -5,42 +5,42 @@
|
|
|
5
5
|
## π¨ REGOLE INVIOLABILI
|
|
6
6
|
|
|
7
7
|
> [!CAUTION]
|
|
8
|
-
>
|
|
8
|
+
> These rules can NEVER be violated. Any code that violates these rules must be rejected.
|
|
9
9
|
|
|
10
10
|
### β NO SHADOW DOM
|
|
11
11
|
|
|
12
|
-
**microUI
|
|
12
|
+
**microUI must NEVER use Shadow DOM.** All components must:
|
|
13
13
|
- Usare Light DOM (il DOM normale)
|
|
14
14
|
- Inserire gli elementi direttamente nel documento
|
|
15
15
|
- Usare classi CSS con prefisso `mu-` per l'incapsulamento
|
|
16
16
|
- Mai usare `this.attachShadow()` o `this.shadowRoot`
|
|
17
17
|
|
|
18
18
|
```javascript
|
|
19
|
-
// β
|
|
19
|
+
// β FORBIDDEN - Non usare MAI
|
|
20
20
|
this.attachShadow({ mode: 'open' });
|
|
21
21
|
this.shadowRoot.innerHTML = '...';
|
|
22
22
|
|
|
23
|
-
// β
|
|
23
|
+
// β
CORRECT - Usa Light DOM
|
|
24
24
|
this.innerHTML = '...';
|
|
25
25
|
this.classList.add('mu-component');
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### π§ͺ TEST ISOLATION OBBLIGATORIA
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**Tests MUST be run with `test-isolated.js`**, never with `bun test` diretto.
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
# β SBAGLIATO - Test falliscono per linkedom globalThis pollution
|
|
34
34
|
bun test tests/components
|
|
35
35
|
|
|
36
|
-
# β
|
|
36
|
+
# β
CORRECT - Each test in separate process
|
|
37
37
|
bun run scripts/test-isolated.js
|
|
38
38
|
|
|
39
|
-
# β
|
|
39
|
+
# β
CORRECT - E2E tests
|
|
40
40
|
bun run test:e2e
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
**
|
|
43
|
+
**Why?** linkedom (used to simulate DOM in unit tests) pollutes `globalThis` e il registry dei custom elements. When tests are run in parallel in the same process, the registrations conflict.
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
@@ -137,7 +137,7 @@ export class MuExample extends MuElement {
|
|
|
137
137
|
_attachEventListeners() {
|
|
138
138
|
const input = this.querySelector('input');
|
|
139
139
|
|
|
140
|
-
// β
|
|
140
|
+
// β
CORRECT: Usa this.listen() per auto-cleanup
|
|
141
141
|
this.listen(input, 'input', (e) => {
|
|
142
142
|
this.dispatchEvent(new CustomEvent('mu-input', {
|
|
143
143
|
bubbles: true,
|
|
@@ -145,10 +145,10 @@ export class MuExample extends MuElement {
|
|
|
145
145
|
}));
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
// β
|
|
148
|
+
// β
CORRECT: this.listen() per eventi window/document
|
|
149
149
|
this.listen(window, 'resize', () => this._handleResize());
|
|
150
150
|
|
|
151
|
-
// β
|
|
151
|
+
// β
CORRECT: Keyboard accessibility
|
|
152
152
|
if (!this.disabled) {
|
|
153
153
|
this.setupActivation(() => this._handleClick());
|
|
154
154
|
}
|
|
@@ -159,12 +159,12 @@ export class MuExample extends MuElement {
|
|
|
159
159
|
// ========================
|
|
160
160
|
|
|
161
161
|
_startPolling() {
|
|
162
|
-
// β
|
|
162
|
+
// β
CORRECT: Usa this.setInterval() per auto-cleanup
|
|
163
163
|
this.setInterval(() => this._poll(), 5000);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
_debounce() {
|
|
167
|
-
// β
|
|
167
|
+
// β
CORRECT: Usa this.setTimeout() per auto-cleanup
|
|
168
168
|
this.setTimeout(() => this._doSomething(), 300);
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -186,35 +186,35 @@ if (!customElements.get('mu-example')) {
|
|
|
186
186
|
}
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
### β οΈ ANTI-PATTERN:
|
|
189
|
+
### β οΈ ANTI-PATTERN: What NEVER to Do
|
|
190
190
|
|
|
191
191
|
```javascript
|
|
192
|
-
// β
|
|
192
|
+
// β FORBIDDEN: addEventListener diretto (memory leak)
|
|
193
193
|
this.querySelector('button').addEventListener('click', handler);
|
|
194
194
|
|
|
195
|
-
// β
|
|
195
|
+
// β FORBIDDEN: setTimeout/setInterval raw (memory leak)
|
|
196
196
|
setTimeout(() => this.update(), 1000);
|
|
197
197
|
setInterval(() => this.poll(), 5000);
|
|
198
198
|
|
|
199
|
-
// β
|
|
199
|
+
// β FORBIDDEN: Nessun super.connectedCallback() (AbortController non inizializzato)
|
|
200
200
|
connectedCallback() {
|
|
201
201
|
this.render(); // this.listen() non funzionerΓ !
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// β
|
|
204
|
+
// β FORBIDDEN: innerHTML senza escaping (XSS vulnerability)
|
|
205
205
|
this.innerHTML = `<div>${userInput}</div>`;
|
|
206
206
|
|
|
207
|
-
// β
|
|
207
|
+
// β FORBIDDEN: removeEventListener con arrow function (non funziona mai)
|
|
208
208
|
window.removeEventListener('resize', () => this.handleResize());
|
|
209
209
|
|
|
210
|
-
// β
|
|
210
|
+
// β FORBIDDEN: Temporal dead zone con setTimeout
|
|
211
211
|
const id = setTimeout(() => { this._timers.delete(id); }, delay);
|
|
212
212
|
|
|
213
|
-
// β
|
|
213
|
+
// β FORBIDDEN: Shadow DOM
|
|
214
214
|
this.attachShadow({ mode: 'open' });
|
|
215
215
|
|
|
216
|
-
// β
|
|
217
|
-
//
|
|
216
|
+
// β FORBIDDEN: DOM Teleportation senza reset del flag listener (Bug Jan 2026)
|
|
217
|
+
// When a component moves ITSELF in the DOM (e.g. appendChild(this)),
|
|
218
218
|
// disconnectedCallback aborta i listener ma il flag impedisce ri-registrazione
|
|
219
219
|
connectedCallback() {
|
|
220
220
|
if (!this._listenerSetup) { // β οΈ Il flag resta true dopo disconnect!
|
|
@@ -222,7 +222,7 @@ connectedCallback() {
|
|
|
222
222
|
this.listen(this, 'click', handler); // Perso dopo teleportation
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
// β
|
|
225
|
+
// β
CORRECT: Reset del flag in disconnectedCallback
|
|
226
226
|
disconnectedCallback() {
|
|
227
227
|
super.disconnectedCallback();
|
|
228
228
|
this._listenerSetup = false; // Permette ri-registrazione dopo move
|
|
@@ -231,7 +231,7 @@ disconnectedCallback() {
|
|
|
231
231
|
|
|
232
232
|
### β
PATTERN OBBLIGATORI
|
|
233
233
|
|
|
234
|
-
| Pattern |
|
|
234
|
+
| Pattern | Method | Why |
|
|
235
235
|
|---------|--------|--------|
|
|
236
236
|
| **Event Listeners** | `this.listen(target, type, handler)` | Auto-cleanup via AbortController |
|
|
237
237
|
| **Timers** | `this.setTimeout()` / `this.setInterval()` | Auto-cleanup su disconnectedCallback |
|
|
@@ -243,9 +243,9 @@ disconnectedCallback() {
|
|
|
243
243
|
|
|
244
244
|
### π SOTA Patterns (Feb 2026)
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
Modern patterns that should be used for new components and migrations.
|
|
247
247
|
|
|
248
|
-
#### β
Performance CSS (
|
|
248
|
+
#### β
Performance CSS (Implemented)
|
|
249
249
|
|
|
250
250
|
Il framework applica **by default** le seguenti ottimizzazioni:
|
|
251
251
|
|
|
@@ -319,8 +319,8 @@ I seguenti componenti potrebbero beneficiare della **Popover API**:
|
|
|
319
319
|
Prima di completare un componente, verifica:
|
|
320
320
|
|
|
321
321
|
- [ ] Tutti i contenuti user-facing usano `escapeHTML()`
|
|
322
|
-
- [ ]
|
|
323
|
-
- [ ] Slot content
|
|
322
|
+
- [ ] Interpolated attributes in innerHTML are escaped
|
|
323
|
+
- [ ] Slot content controlled (developer-provided) or escaped
|
|
324
324
|
- [ ] Nessun `eval()`, `Function()`, `document.write()`
|
|
325
325
|
|
|
326
326
|
### βΏ Accessibility Checklist
|
|
@@ -342,7 +342,7 @@ Prima di completare un componente, verifica:
|
|
|
342
342
|
|
|
343
343
|
## TL;DR - Copy-Paste Templates
|
|
344
344
|
|
|
345
|
-
### Agent-First Features
|
|
345
|
+
### Agent-First Features
|
|
346
346
|
microUI is optimized for AI Agents with deep introspection, runtime feedback, enterprise-scale infrastructure, and 2026 multimodal/MCP support.
|
|
347
347
|
|
|
348
348
|
**1. Introspection (Metadata)**
|
|
@@ -359,7 +359,7 @@ const errors = await page.evaluate(() => window.__MICROUI_ERRORS__);
|
|
|
359
359
|
if (errors.length > 0) console.error('microUI Errors:', errors);
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
-
**3. Agent API
|
|
362
|
+
**3. Agent API - LLM-Friendly Component Access**
|
|
363
363
|
Direct API for LLM agents to introspect and interact with components:
|
|
364
364
|
|
|
365
365
|
```javascript
|
|
@@ -385,7 +385,7 @@ const components = microUI.getRegisteredComponents();
|
|
|
385
385
|
// Returns: Map<tag, constructor>
|
|
386
386
|
```
|
|
387
387
|
|
|
388
|
-
**4. Enterprise-Scale Features
|
|
388
|
+
**4. Enterprise-Scale Features - Large Application Infrastructure**
|
|
389
389
|
|
|
390
390
|
For building complex, multi-team applications:
|
|
391
391
|
|
|
@@ -437,7 +437,7 @@ microUI.getErrors(); // All caught errors
|
|
|
437
437
|
</mu-error-boundary>
|
|
438
438
|
```
|
|
439
439
|
|
|
440
|
-
**5. Agent Automation
|
|
440
|
+
**5. Agent Automation - 2026 Multimodal & MCP Support**
|
|
441
441
|
|
|
442
442
|
Based on UI-TARS, A2UI, and Anthropic MCP research (2025-2026):
|
|
443
443
|
|
|
@@ -726,7 +726,7 @@ microUI follows **Material Design 3 Window Size Classes** for adaptive layouts:
|
|
|
726
726
|
|
|
727
727
|
### Breakpoints API
|
|
728
728
|
```javascript
|
|
729
|
-
import { breakpoints } from 'microui/core/breakpoints';
|
|
729
|
+
import { breakpoints } from 'microui-wc/core/breakpoints';
|
|
730
730
|
|
|
731
731
|
// Reactive subscriptions (for components that need to react to changes)
|
|
732
732
|
const unsubscribe = breakpoints.subscribe((size) => {
|
|
@@ -789,7 +789,7 @@ class MyComponent extends MuElement {
|
|
|
789
789
|
|
|
790
790
|
### Signals (Reactive State)
|
|
791
791
|
```javascript
|
|
792
|
-
import { signal, computed, effect } from 'microui';
|
|
792
|
+
import { signal, computed, effect } from 'microui-wc';
|
|
793
793
|
|
|
794
794
|
const count = signal(0, 'my-counter'); // name for debugging
|
|
795
795
|
const doubled = computed(() => count() * 2);
|
|
@@ -805,7 +805,7 @@ count.peek(); // Read without tracking
|
|
|
805
805
|
|
|
806
806
|
### EventBus (CrossBus)
|
|
807
807
|
```javascript
|
|
808
|
-
import { bus } from 'microui';
|
|
808
|
+
import { bus } from 'microui-wc';
|
|
809
809
|
|
|
810
810
|
// Subscribe
|
|
811
811
|
const unsub = bus.on('my:event', (data) => console.log(data));
|
|
@@ -822,7 +822,7 @@ unsub();
|
|
|
822
822
|
Centralized LIFO stack for handling ESC key in modal-like components. When multiple modals/dropdowns are open, ESC closes only the **topmost** one.
|
|
823
823
|
|
|
824
824
|
```javascript
|
|
825
|
-
import { keyboard } from 'microui/core/keyboard';
|
|
825
|
+
import { keyboard } from 'microui-wc/core/keyboard';
|
|
826
826
|
|
|
827
827
|
class MuMyModal extends MuElement {
|
|
828
828
|
#unsubEsc = null;
|
|
@@ -859,7 +859,7 @@ class MuMyModal extends MuElement {
|
|
|
859
859
|
Centralized z-index constants to avoid magic numbers. Auto-injected as CSS custom properties.
|
|
860
860
|
|
|
861
861
|
```javascript
|
|
862
|
-
import { Z_INDEX } from 'microui/core/layers';
|
|
862
|
+
import { Z_INDEX } from 'microui-wc/core/layers';
|
|
863
863
|
|
|
864
864
|
// Use in JavaScript
|
|
865
865
|
this.style.zIndex = Z_INDEX.modal;
|
|
@@ -886,7 +886,7 @@ this.style.zIndex = Z_INDEX.modal;
|
|
|
886
886
|
|
|
887
887
|
### Confirm Dialog (Agent-Friendly)
|
|
888
888
|
```javascript
|
|
889
|
-
import { muConfirm } from 'microui';
|
|
889
|
+
import { muConfirm } from 'microui-wc';
|
|
890
890
|
|
|
891
891
|
// Simple confirm - returns Promise<boolean>
|
|
892
892
|
const ok = await muConfirm('Delete this item?');
|
|
@@ -934,7 +934,7 @@ fetcher.addEventListener('mu-success', (e) => {
|
|
|
934
934
|
|
|
935
935
|
### Form State Management
|
|
936
936
|
```javascript
|
|
937
|
-
import { createFormState } from 'microui';
|
|
937
|
+
import { createFormState } from 'microui-wc';
|
|
938
938
|
|
|
939
939
|
const form = document.querySelector('mu-form');
|
|
940
940
|
const state = createFormState(form, {
|
|
@@ -963,7 +963,7 @@ state.reset(); // Reset to initial values
|
|
|
963
963
|
|
|
964
964
|
### Toast Notifications
|
|
965
965
|
```javascript
|
|
966
|
-
import { showToast } from 'microui';
|
|
966
|
+
import { showToast } from 'microui-wc';
|
|
967
967
|
|
|
968
968
|
showToast('Operation successful', {
|
|
969
969
|
variant: 'success', // 'info' | 'success' | 'warning' | 'error'
|
|
@@ -973,7 +973,7 @@ showToast('Operation successful', {
|
|
|
973
973
|
|
|
974
974
|
### Theme Control
|
|
975
975
|
```javascript
|
|
976
|
-
import { Theme } from 'microui';
|
|
976
|
+
import { Theme } from 'microui-wc';
|
|
977
977
|
|
|
978
978
|
Theme.init(); // Auto-detect or use saved
|
|
979
979
|
Theme.set('dark'); // 'light' | 'dark' | 'system'
|
|
@@ -983,7 +983,7 @@ const current = Theme.get();
|
|
|
983
983
|
|
|
984
984
|
### View Transitions
|
|
985
985
|
```javascript
|
|
986
|
-
import { transition } from 'microui';
|
|
986
|
+
import { transition } from 'microui-wc';
|
|
987
987
|
|
|
988
988
|
await transition(() => {
|
|
989
989
|
document.querySelector('#content').innerHTML = newHTML;
|
|
@@ -1002,7 +1002,7 @@ await microUICache.clear();
|
|
|
1002
1002
|
|
|
1003
1003
|
// Get cache status
|
|
1004
1004
|
await microUICache.status();
|
|
1005
|
-
// Returns: { version: "
|
|
1005
|
+
// Returns: { version: "0.1.0", caches: { "microui-precache-2.0.18": 5 } }
|
|
1006
1006
|
|
|
1007
1007
|
// Force check for updates
|
|
1008
1008
|
await microUICache.update();
|
|
@@ -1269,7 +1269,7 @@ microUI provides centralized utilities for safe HTML rendering. **Always use the
|
|
|
1269
1269
|
|
|
1270
1270
|
```javascript
|
|
1271
1271
|
// Import centralized utility
|
|
1272
|
-
import { escapeHTML } from 'microui';
|
|
1272
|
+
import { escapeHTML } from 'microui-wc';
|
|
1273
1273
|
|
|
1274
1274
|
// β
SAFE: Escape user-provided content
|
|
1275
1275
|
const userName = '<script>alert("xss")</script>';
|
|
@@ -1307,7 +1307,7 @@ dist/
|
|
|
1307
1307
|
βββ microui.min.js # Full IIFE bundle (231 KB)
|
|
1308
1308
|
βββ microui.css # Combined CSS (64 KB)
|
|
1309
1309
|
βββ microui.d.ts # TypeScript definitions
|
|
1310
|
-
βββ routes/ #
|
|
1310
|
+
βββ routes/ # Route Bundles (SOTA)
|
|
1311
1311
|
β βββ shell.js # App Shell (Navbar, Theme, Bus) - 5 KB
|
|
1312
1312
|
β βββ home.js # Home route components
|
|
1313
1313
|
β βββ chunk-*.js # Shared dependencies (deduplicated)
|
|
@@ -1318,7 +1318,7 @@ dist/
|
|
|
1318
1318
|
|
|
1319
1319
|
---
|
|
1320
1320
|
|
|
1321
|
-
## Automatic Bundle Dependencies
|
|
1321
|
+
## Automatic Bundle Dependencies
|
|
1322
1322
|
|
|
1323
1323
|
> **Build-time static analysis** detects which components each page uses.
|
|
1324
1324
|
|
|
@@ -1376,7 +1376,7 @@ const routes = componentsToRoutes(["mu-tabs", "mu-button"]);
|
|
|
1376
1376
|
// [\"buttons\", \"tabs\"]
|
|
1377
1377
|
```
|
|
1378
1378
|
|
|
1379
|
-
### Auto-Versioning
|
|
1379
|
+
### Auto-Versioning
|
|
1380
1380
|
|
|
1381
1381
|
The build script automatically increments the version cache buster in `demo/shell.html`:
|
|
1382
1382
|
|
|
@@ -1384,12 +1384,12 @@ The build script automatically increments the version cache buster in `demo/shel
|
|
|
1384
1384
|
bun run build:framework
|
|
1385
1385
|
# Output:
|
|
1386
1386
|
# π Updating version cache buster...
|
|
1387
|
-
# β
Version updated
|
|
1387
|
+
# β
Version updated
|
|
1388
1388
|
```
|
|
1389
1389
|
|
|
1390
1390
|
**How it works:**
|
|
1391
1391
|
- Extracts current version from `?v=X.X.X` pattern
|
|
1392
|
-
- Increments patch version (e.g., `
|
|
1392
|
+
- Increments patch version (e.g., `0.1.0 β 0.1.1`)
|
|
1393
1393
|
- Replaces all occurrences in demo/shell.html
|
|
1394
1394
|
|
|
1395
1395
|
**Benefits:**
|
|
@@ -1400,7 +1400,7 @@ bun run build:framework
|
|
|
1400
1400
|
|
|
1401
1401
|
---
|
|
1402
1402
|
|
|
1403
|
-
## App Shell Architecture
|
|
1403
|
+
## App Shell Architecture
|
|
1404
1404
|
|
|
1405
1405
|
For SOTA performance, use the **App Shell** pattern. Load the critical shell first, then lazily load routes.
|
|
1406
1406
|
|
|
@@ -1562,7 +1562,7 @@ Add to `<head>` for faster loading:
|
|
|
1562
1562
|
Use the View Transitions API for cinematic page changes:
|
|
1563
1563
|
|
|
1564
1564
|
```javascript
|
|
1565
|
-
import { transition, transitionNamed } from 'microui';
|
|
1565
|
+
import { transition, transitionNamed } from 'microui-wc';
|
|
1566
1566
|
|
|
1567
1567
|
// Basic transition
|
|
1568
1568
|
await transition(() => {
|
|
@@ -1720,7 +1720,7 @@ btn.render?.();
|
|
|
1720
1720
|
|
|
1721
1721
|
---
|
|
1722
1722
|
|
|
1723
|
-
## Page-Based App Development
|
|
1723
|
+
## Page-Based App Development
|
|
1724
1724
|
|
|
1725
1725
|
> **For AI Agents building apps with microUI.** This is the recommended architecture.
|
|
1726
1726
|
|
|
@@ -1905,7 +1905,7 @@ bun run build:framework
|
|
|
1905
1905
|
### Global Store Pattern
|
|
1906
1906
|
```javascript
|
|
1907
1907
|
// store/index.js - Centralized reactive state
|
|
1908
|
-
import { signal, computed, effect } from 'microui';
|
|
1908
|
+
import { signal, computed, effect } from 'microui-wc';
|
|
1909
1909
|
|
|
1910
1910
|
export const store = {
|
|
1911
1911
|
// Core state
|
|
@@ -1952,7 +1952,7 @@ if (savedUser) store.user.set(JSON.parse(savedUser));
|
|
|
1952
1952
|
### Binding State to Components
|
|
1953
1953
|
```javascript
|
|
1954
1954
|
import { store } from './store/index.js';
|
|
1955
|
-
import { effect } from 'microui';
|
|
1955
|
+
import { effect } from 'microui-wc';
|
|
1956
1956
|
|
|
1957
1957
|
// Auto-update UI when state changes
|
|
1958
1958
|
effect(() => {
|
package/dist/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="assets/logo-icon-64.webp" alt="microUI" width="80">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">microUI</h1>
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
<!DOCTYPE html>
|
|
41
41
|
<html lang="en">
|
|
42
42
|
<head>
|
|
43
|
-
<link rel="stylesheet" href="https://unpkg.com/microui/dist/microui.css">
|
|
43
|
+
<link rel="stylesheet" href="https://unpkg.com/microui-wc/dist/microui.css">
|
|
44
44
|
</head>
|
|
45
45
|
<body>
|
|
46
46
|
<mu-card variant="elevated">
|
|
47
47
|
<h2>Hello microUI! π</h2>
|
|
48
48
|
<mu-button variant="filled">Get Started</mu-button>
|
|
49
49
|
</mu-card>
|
|
50
|
-
<script type="module" src="https://unpkg.com/microui/dist/microui.esm.js"></script>
|
|
50
|
+
<script type="module" src="https://unpkg.com/microui-wc/dist/microui.esm.js"></script>
|
|
51
51
|
</body>
|
|
52
52
|
</html>
|
|
53
53
|
```
|
|
@@ -127,13 +127,13 @@ microUI is the **only framework designed specifically for AI coding agents**:
|
|
|
127
127
|
|
|
128
128
|
```javascript
|
|
129
129
|
// Agent SDK - Query components semantically
|
|
130
|
-
import { findByLabel, findByRole } from 'microui/agent-api';
|
|
130
|
+
import { findByLabel, findByRole } from 'microui-wc/agent-api';
|
|
131
131
|
|
|
132
132
|
const submitBtn = findByLabel('Submit')[0];
|
|
133
133
|
const allInputs = findByRole('textbox');
|
|
134
134
|
|
|
135
135
|
// MCP Protocol support for multi-agent orchestration
|
|
136
|
-
import { registerWithCrossBus } from 'microui';
|
|
136
|
+
import { registerWithCrossBus } from 'microui-wc';
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
**Features for AI:**
|
|
@@ -156,7 +156,7 @@ microUI follows **Material Design 3 Window Size Classes** for adaptive layouts:
|
|
|
156
156
|
|
|
157
157
|
```javascript
|
|
158
158
|
// Import the centralized breakpoints utility
|
|
159
|
-
import { breakpoints } from 'microui/core/breakpoints';
|
|
159
|
+
import { breakpoints } from 'microui-wc/core/breakpoints';
|
|
160
160
|
|
|
161
161
|
// Reactive subscriptions
|
|
162
162
|
breakpoints.subscribe((size) => {
|
|
@@ -197,7 +197,7 @@ npm install microui
|
|
|
197
197
|
bun add microui
|
|
198
198
|
|
|
199
199
|
# CDN (no install)
|
|
200
|
-
<script type="module" src="https://unpkg.com/microui"></script>
|
|
200
|
+
<script type="module" src="https://unpkg.com/microui-wc/dist/microui.esm.js"></script>
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
---
|