@fluixi/dom 1.0.0-alpha.76 → 1.0.0-alpha.78
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 +59 -212
- package/dist/cdn/dom-client.cjs +1 -0
- package/dist/cdn/dom-client.d.ts +20 -0
- package/dist/cdn/dom-client.d.ts.map +1 -0
- package/dist/cdn/dom-client.global.js +1 -0
- package/dist/cdn/dom-client.js +31 -0
- package/dist/cdn/dom-client.mjs +1 -0
- package/dist/cdn/dom.cjs +1 -1
- package/dist/cdn/dom.d.ts +2 -0
- package/dist/cdn/dom.d.ts.map +1 -1
- package/dist/cdn/dom.global.js +1 -1
- package/dist/cdn/dom.js +8 -0
- package/dist/cdn/dom.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/dom/hydration.cjs +1 -1
- package/dist/lib/dom/hydration.mjs +1 -1
- package/dist/lib/dom/index.cjs +1 -1
- package/dist/lib/dom/index.mjs +1 -1
- package/dist/lib/dom/island.cjs +1 -1
- package/dist/lib/dom/island.mjs +1 -1
- package/dist/lib/dom/runtime.cjs +1 -1
- package/dist/lib/dom/runtime.mjs +1 -1
- package/dist/lib/dom/versions.cjs +1 -1
- package/dist/lib/dom/versions.js +1 -1
- package/dist/lib/dom/versions.mjs +1 -1
- package/dist/lib/flow/dynamic.d.ts +2 -2
- package/dist/lib/flow/dynamic.js +2 -2
- package/dist/lib/flow/error-boundary.d.ts +2 -2
- package/dist/lib/flow/error-boundary.js +2 -2
- package/dist/lib/flow/index-flow.d.ts +2 -2
- package/dist/lib/flow/index-flow.js +2 -2
- package/dist/lib/flow/portal.d.ts +2 -2
- package/dist/lib/flow/portal.js +2 -2
- package/dist/lib/flow/show.d.ts +2 -2
- package/dist/lib/flow/show.js +2 -2
- package/dist/lib/flow/switch.d.ts +2 -2
- package/dist/lib/flow/switch.js +2 -2
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +1 -1
- package/package.json +7 -13
package/README.md
CHANGED
|
@@ -4,22 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
# @fluixi/dom
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**The DOM runtime the compiler targets — surgical fine-grained updates, hydration and SSR.**
|
|
8
8
|
|
|
9
9
|
[](./LICENSE)
|
|
10
10
|

|
|
11
11
|
[](https://www.npmjs.com/package/@fluixi/dom)
|
|
12
|
-

|
|
13
12
|
|
|
14
13
|
---
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
The runtime `@fluixi/compiler` emits calls into. It provides the low-level DOM operations —
|
|
16
|
+
element creation, reactive attributes and properties, insertion, control flow, hydration —
|
|
17
|
+
that make a change update exactly the binding depending on it. Usable directly, though most
|
|
18
|
+
code reaches it through compiled JSX or `` html`` `` templates.
|
|
17
19
|
|
|
18
20
|
## Features
|
|
19
21
|
|
|
20
22
|
- 🎯 **Fine-Grained Reactivity**: Only updates the exact DOM nodes that need to change
|
|
21
23
|
- 🔄 **Signal & Store Integration**: Works with any reactive system (signals, stores, observables)
|
|
22
|
-
-
|
|
24
|
+
- 🔁 **Hydration**: adopts server-rendered nodes in place rather than rebuilding beside them
|
|
23
25
|
- 🚀 **Optimized Performance**: Template caching, event delegation, and minimal re-renders
|
|
24
26
|
- 🧩 **Control Flow Components**: Built-in Show, For, Switch, Portal, and more
|
|
25
27
|
- 📦 **Zero Dependencies**: Core runtime has no external dependencies on reactive systems
|
|
@@ -72,21 +74,18 @@ document.body.appendChild(div);
|
|
|
72
74
|
setCount(1); // DOM updates to "Count: 1"
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
###
|
|
77
|
+
### Components
|
|
78
|
+
|
|
79
|
+
Bindings work as soon as you import — the example above needs no setup. Rendering
|
|
80
|
+
*components* needs one seam filled in, so a component call is owned and disposable:
|
|
76
81
|
|
|
77
82
|
```typescript
|
|
78
|
-
import
|
|
79
|
-
import { createEffect, batch } from '@fluixi/reactive/signal';
|
|
80
|
-
|
|
81
|
-
// Initialize with your reactive system
|
|
82
|
-
initializeIntegration({
|
|
83
|
-
signalSystem: {
|
|
84
|
-
createEffect,
|
|
85
|
-
batch,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
83
|
+
import '@fluixi/core'; // wires it for you at import time
|
|
88
84
|
```
|
|
89
85
|
|
|
86
|
+
Using `@fluixi/dom` without `@fluixi/core`? Fill the seam yourself — see
|
|
87
|
+
[Integration](#integration).
|
|
88
|
+
|
|
90
89
|
## Core API
|
|
91
90
|
|
|
92
91
|
### DOM Manipulation
|
|
@@ -96,7 +95,7 @@ initializeIntegration({
|
|
|
96
95
|
Insert dynamic content with automatic reactivity tracking.
|
|
97
96
|
|
|
98
97
|
```typescript
|
|
99
|
-
import { insert
|
|
98
|
+
import { insert } from '@fluixi/dom';
|
|
100
99
|
import { createSignal } from '@fluixi/reactive/signal';
|
|
101
100
|
|
|
102
101
|
const [text, setText] = createSignal('Hello');
|
|
@@ -109,7 +108,7 @@ insert(div, () => text());
|
|
|
109
108
|
insert(div, 'Static text');
|
|
110
109
|
|
|
111
110
|
// With a marker for positioning
|
|
112
|
-
const marker = createTextNode('');
|
|
111
|
+
const marker = document.createTextNode('');
|
|
113
112
|
div.appendChild(marker);
|
|
114
113
|
insert(div, () => text(), marker);
|
|
115
114
|
```
|
|
@@ -334,193 +333,66 @@ ErrorBoundary({
|
|
|
334
333
|
});
|
|
335
334
|
```
|
|
336
335
|
|
|
337
|
-
## Integration
|
|
338
|
-
|
|
339
|
-
The package provides a flexible integration system that works with any reactive library.
|
|
336
|
+
## Integration
|
|
340
337
|
|
|
341
|
-
|
|
338
|
+
This package renders; it doesn't own a reactive system. One seam connects the two — how a
|
|
339
|
+
component call is wrapped — and it is a single function:
|
|
342
340
|
|
|
343
341
|
```typescript
|
|
344
|
-
import {
|
|
345
|
-
import * as signals from '@fluixi/reactive/signal';
|
|
346
|
-
|
|
347
|
-
initializeIntegration({
|
|
348
|
-
signalSystem: {
|
|
349
|
-
createEffect: signals.createEffect,
|
|
350
|
-
batch: signals.batch,
|
|
351
|
-
createMemo: signals.createMemo,
|
|
352
|
-
untrack: signals.untrack,
|
|
353
|
-
getOwner: signals.getOwner,
|
|
354
|
-
runWithOwner: signals.runWithOwner,
|
|
355
|
-
createRoot: signals.createRoot,
|
|
356
|
-
onCleanup: signals.onCleanup,
|
|
357
|
-
},
|
|
358
|
-
});
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Initialize with Store System
|
|
342
|
+
import { registerCreateComponent } from '@fluixi/dom';
|
|
362
343
|
|
|
363
|
-
|
|
364
|
-
import { initializeIntegration } from '@fluixi/dom';
|
|
365
|
-
import * as store from '@fluixi/reactive/store';
|
|
366
|
-
|
|
367
|
-
initializeIntegration({
|
|
368
|
-
storeSystem: {
|
|
369
|
-
isStore: store.isStore,
|
|
370
|
-
unwrap: store.unwrap,
|
|
371
|
-
isStoreProxy: store.isStoreProxy,
|
|
372
|
-
},
|
|
373
|
-
});
|
|
344
|
+
registerCreateComponent((Comp, props) => myOwnedCall(Comp, props));
|
|
374
345
|
```
|
|
375
346
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
347
|
+
**You almost never call this.** Importing `@fluixi/core` wires `@fluixi/reactive` in for
|
|
348
|
+
you at import time, so an app just imports and renders. It matters if you use `@fluixi/dom`
|
|
349
|
+
on its own, or drive it with a different reactive library.
|
|
379
350
|
|
|
380
351
|
```typescript
|
|
381
|
-
import {
|
|
352
|
+
import { isIntegrationInitialized, resetIntegration } from '@fluixi/dom';
|
|
382
353
|
|
|
383
|
-
//
|
|
384
|
-
|
|
354
|
+
isIntegrationInitialized(); // has something claimed the seam?
|
|
355
|
+
resetIntegration(); // drop it again — tests
|
|
385
356
|
```
|
|
386
357
|
|
|
387
|
-
|
|
358
|
+
`initializeIntegration({ signalSystem })` is the older entry point and still works; it picks
|
|
359
|
+
`createComponent` off what you pass and ignores the rest.
|
|
388
360
|
|
|
389
|
-
|
|
361
|
+
## Templates
|
|
390
362
|
|
|
391
|
-
|
|
392
|
-
|
|
363
|
+
`` html`` `` templates are compiled, not interpreted: `@fluixi/compiler` turns them into the
|
|
364
|
+
same calls this package exposes, so they cost nothing at runtime and need no template
|
|
365
|
+
library.
|
|
393
366
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
batch: myBatch,
|
|
397
|
-
});
|
|
367
|
+
```ts
|
|
368
|
+
import { html } from '@fluixi/core';
|
|
398
369
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
370
|
+
function Counter() {
|
|
371
|
+
const n = $signal(0);
|
|
372
|
+
return html`<button @click=${() => n.set(n() + 1)}>${n()}</button>`;
|
|
373
|
+
}
|
|
403
374
|
```
|
|
404
375
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
### Basic Usage
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
import { signal } from '@fluixi/dom/reactive';
|
|
413
|
-
import { html } from 'lit';
|
|
414
|
-
import { createSignal } from '@fluixi/reactive/signal';
|
|
415
|
-
|
|
416
|
-
const [count, setCount] = createSignal(0);
|
|
417
|
-
|
|
418
|
-
const template = html`
|
|
419
|
-
<div>
|
|
420
|
-
<p>Count: ${signal(count)}</p>
|
|
421
|
-
<button @click=${() => setCount(count() + 1)}>Increment</button>
|
|
422
|
-
</div>
|
|
423
|
-
`;
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Reactive Directives
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
import { signal, $if, $each } from '@fluixi/dom/reactive';
|
|
430
|
-
import { html } from 'lit';
|
|
431
|
-
|
|
432
|
-
const [items, setItems] = createSignal(['a', 'b', 'c']);
|
|
433
|
-
const [show, setShow] = createSignal(true);
|
|
434
|
-
|
|
435
|
-
const template = html`
|
|
436
|
-
<div>
|
|
437
|
-
${$if(show,
|
|
438
|
-
html`<p>Visible content</p>`,
|
|
439
|
-
html`<p>Hidden</p>`
|
|
440
|
-
)}
|
|
441
|
-
|
|
442
|
-
${$each(items,
|
|
443
|
-
(item) => item,
|
|
444
|
-
(item) => html`<li>${item}</li>`
|
|
445
|
-
)}
|
|
446
|
-
</div>
|
|
447
|
-
`;
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### Auto-wrapping with `rx`
|
|
451
|
-
|
|
452
|
-
```typescript
|
|
453
|
-
import { rx } from '@fluixi/dom/reactive';
|
|
454
|
-
|
|
455
|
-
const [name, setName] = createSignal('World');
|
|
456
|
-
|
|
457
|
-
// Automatically wraps signal accessors
|
|
458
|
-
const template = rx`
|
|
459
|
-
<div>Hello, ${name}!</div>
|
|
460
|
-
`;
|
|
461
|
-
```
|
|
376
|
+
The lit-html bridge this package once carried is gone — `lit` is not a dependency, and the
|
|
377
|
+
`@fluixi/dom/reactive` entry with its `$if`/`$each`/`rx` helpers no longer exists. Templates
|
|
378
|
+
go through the compiler now.
|
|
462
379
|
|
|
463
380
|
## Advanced Usage
|
|
464
381
|
|
|
465
|
-
### Custom Effect System
|
|
466
|
-
|
|
467
|
-
```typescript
|
|
468
|
-
import { registerEffectCreator } from '@fluixi/dom';
|
|
469
|
-
|
|
470
|
-
registerEffectCreator((fn) => {
|
|
471
|
-
// Your custom effect implementation
|
|
472
|
-
const dispose = myCustomEffect(fn);
|
|
473
|
-
return dispose;
|
|
474
|
-
});
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
### Custom Batch Function
|
|
478
|
-
|
|
479
|
-
```typescript
|
|
480
|
-
import { registerBatch } from '@fluixi/dom';
|
|
481
|
-
|
|
482
|
-
registerBatch((fn) => {
|
|
483
|
-
// Your custom batching logic
|
|
484
|
-
myCustomBatch(fn);
|
|
485
|
-
});
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
### Reactive Bindings
|
|
489
|
-
|
|
490
|
-
```typescript
|
|
491
|
-
import { createReactiveBinding } from '@fluixi/dom';
|
|
492
|
-
|
|
493
|
-
const cleanup = createReactiveBinding(
|
|
494
|
-
() => mySignal(), // getter
|
|
495
|
-
(value) => {
|
|
496
|
-
// Update handler
|
|
497
|
-
console.log('Value changed:', value);
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
|
|
501
|
-
// Cleanup when done
|
|
502
|
-
cleanup();
|
|
503
|
-
```
|
|
504
|
-
|
|
505
382
|
### Memory Management
|
|
506
383
|
|
|
384
|
+
Bindings live and die with the owner they were created under, so tearing down a scope
|
|
385
|
+
removes its listeners and effects with it:
|
|
386
|
+
|
|
507
387
|
```typescript
|
|
508
|
-
import { createRoot, onCleanup } from '@fluixi/
|
|
388
|
+
import { createRoot, onCleanup } from '@fluixi/reactive';
|
|
389
|
+
import { insert } from '@fluixi/dom';
|
|
509
390
|
|
|
510
391
|
createRoot((dispose) => {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
// Register cleanup
|
|
517
|
-
onCleanup(() => {
|
|
518
|
-
effect();
|
|
519
|
-
console.log('Cleaned up!');
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
// Dispose when done
|
|
523
|
-
dispose();
|
|
392
|
+
insert(container, () => text());
|
|
393
|
+
onCleanup(() => console.log('bindings gone'));
|
|
394
|
+
|
|
395
|
+
dispose(); // runs the cleanups, drops the bindings
|
|
524
396
|
});
|
|
525
397
|
```
|
|
526
398
|
|
|
@@ -587,28 +459,11 @@ const mySignalSystem: SignalSystem = {
|
|
|
587
459
|
|
|
588
460
|
## Debugging
|
|
589
461
|
|
|
590
|
-
### Check Integration Status
|
|
591
|
-
|
|
592
462
|
```typescript
|
|
593
|
-
import {
|
|
594
|
-
|
|
595
|
-
// Get status object
|
|
596
|
-
const status = getIntegrationStatus();
|
|
597
|
-
console.log(status);
|
|
463
|
+
import { isIntegrationInitialized } from '@fluixi/dom';
|
|
598
464
|
|
|
599
|
-
//
|
|
600
|
-
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
### Development Mode
|
|
604
|
-
|
|
605
|
-
Set the `development` flag when initializing:
|
|
606
|
-
|
|
607
|
-
```typescript
|
|
608
|
-
initializeIntegration({
|
|
609
|
-
signalSystem: mySignalSystem,
|
|
610
|
-
development: true, // Enables additional checks and warnings
|
|
611
|
-
});
|
|
465
|
+
// A component rendering as a bare function usually means nothing claimed the seam
|
|
466
|
+
isIntegrationInitialized();
|
|
612
467
|
```
|
|
613
468
|
|
|
614
469
|
## Comparison with Other Libraries
|
|
@@ -617,9 +472,8 @@ initializeIntegration({
|
|
|
617
472
|
|
|
618
473
|
This package is heavily inspired by SolidJS's dom-expressions but:
|
|
619
474
|
- Works as a standalone library
|
|
620
|
-
-
|
|
621
|
-
-
|
|
622
|
-
- Supports both lit-html and native JSX
|
|
475
|
+
- Can be driven by another reactive system through `registerCreateComponent`
|
|
476
|
+
- Serves both JSX and `` html`` `` templates, which compile to the same calls
|
|
623
477
|
|
|
624
478
|
### vs React
|
|
625
479
|
|
|
@@ -629,13 +483,6 @@ This package is heavily inspired by SolidJS's dom-expressions but:
|
|
|
629
483
|
- Smaller runtime size
|
|
630
484
|
- Better performance for many use cases
|
|
631
485
|
|
|
632
|
-
### vs Lit
|
|
633
|
-
|
|
634
|
-
- Works with lit-html templates
|
|
635
|
-
- Adds fine-grained reactivity on top
|
|
636
|
-
- Can be used standalone without Lit components
|
|
637
|
-
- More flexible control flow
|
|
638
|
-
|
|
639
486
|
## Contributing
|
|
640
487
|
|
|
641
488
|
Contributions are welcome! Please see the main repository for guidelines.
|
|
@@ -648,10 +495,10 @@ MIT
|
|
|
648
495
|
|
|
649
496
|
- `@fluixi/jsx` - JSX runtime using this DOM package
|
|
650
497
|
- `@fluixi/reactive` - Signal and store implementations
|
|
651
|
-
- `
|
|
498
|
+
- `@fluixi/compiler` - Compiles JSX and `` html`` `` into these calls
|
|
652
499
|
|
|
653
500
|
## Resources
|
|
654
501
|
|
|
655
|
-
- [SolidJS Documentation](https://www.solidjs.com/)
|
|
502
|
+
- [SolidJS Documentation](https://www.solidjs.com/) — dom-expressions is the closest prior art
|
|
656
503
|
- [dom-expressions](https://github.com/ryansolid/dom-expressions)
|
|
657
|
-
- [
|
|
504
|
+
- [Fluixi docs](https://docs.fluixi.com)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var q=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var qe=Object.prototype.hasOwnProperty;var Ge=(e,t)=>{for(var n in t)q(e,n,{get:t[n],enumerable:!0})},Xe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ze(t))!qe.call(e,i)&&i!==n&&q(e,i,{get:()=>t[i],enumerable:!(r=Be(t,i))||r.enumerable});return e};var Je=e=>Xe(q({},"__esModule",{value:!0}),e);var ht={};Ge(ht,{Dynamic:()=>fe,ErrorBoundary:()=>de,For:()=>ie,Index:()=>se,Match:()=>ce,Portal:()=>ue,Show:()=>oe,Switch:()=>le,batch:()=>d.batch,classMap:()=>pe,createComponent:()=>Fe,createComputed:()=>d.createComputed,createContext:()=>d.createContext,createEffect:()=>d.createEffect,createElement:()=>he,createMemo:()=>d.createMemo,createRenderEffect:()=>d.createRenderEffect,createResource:()=>d.createResource,createRoot:()=>d.createRoot,createSignal:()=>d.createSignal,delegateEvents:()=>ee,effect:()=>d.effect,hydrate:()=>re,indexArray:()=>S.indexArray,insert:()=>k,keyArray:()=>S.keyArray,mapArray:()=>S.mapArray,memo:()=>d.memo,onCleanup:()=>d.onCleanup,render:()=>$,setAttribute:()=>w,setClassName:()=>L,setProperty:()=>R,setStyle:()=>I,signal:()=>d.signal,spread:()=>Oe,store:()=>d.store,styleMap:()=>ye,untrack:()=>d.untrack,useContext:()=>d.useContext});module.exports=Je(ht);var me="http://www.w3.org/2000/svg";var G=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function w(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function Ye(e,t){Object.assign(e.style,t)}function he(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,a])=>{if(i==="class"||i==="className")r.className=a;else if(i==="style"&&typeof a=="object")Ye(r,a);else if(i.startsWith("on")&&typeof a=="function"){let c=i.slice(2).toLowerCase();r.addEventListener(c,a)}else w(r,i,a)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var gt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var b=require("@fluixi/reactive/signal");var xe="1.0.0-alpha.78";var ge=require("@fluixi/reactive/version"),g={dom:xe,reactive:ge.VERSION};function be(e){g.core&&e.setAttribute("fluixi",g.core),e.setAttribute("fx-dom",g.dom),e.setAttribute("fx-reactive",g.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=g)}function Te(){let e=[g.core,g.dom,g.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${g.core??"(absent)"}, dom ${g.dom}, reactive ${g.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function P(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var m=require("@fluixi/reactive/signal");var X=typeof document>"u";var J=Symbol.for("fluixi.server-node"),Ee=null;function we(){if(!Ee)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ee}function O(e){return e!=null&&e[J]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ne(e){return e!=null&&e[J]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Ae(e){return e!=null&&e[J]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},Se=null;function ve(e){Se=e}function Ce(){return Se}function Y(e,t){return u.active&&t.parentNode===e}function Z(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function _(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Z(t)}var Ze={};var Q=new Set,Le=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ee(e){if(!X)for(let t of e)Q.has(t)||Le.has(t)||(Q.add(t),document.addEventListener(t,Qe))}function Qe(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function et(e,t,n){if(e[`$$${t}`]=n,Le.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,i),e[r]=i}return}Q.has(t)||ee([t])}function Pe(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function v(e,t=!1){if(X)return we().createText(e);if(u.active&&!t){let n=Ce()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var A=0,tt=200;function nt(e,t,n,r,i){let a=r,c=new Map;return(0,m.createRenderEffect)(()=>{let s;if(P(e)&&!(0,b.isSignal)(e)){if(!c.has(e)){A++;try{let o=e();c.set(e,o)}finally{A--}}for(s=c.get(e);typeof s=="function"&&(0,b.isSignal)(s);)s=s()}else for(s=e();typeof s=="function"&&(0,b.isSignal)(s);)s=s();{let o=0;for(;typeof s=="function"&&o++<50;)if(P(s)){if(!c.has(s)){let l=s;A++;try{let f=l();c.set(l,f)}finally{A--}}s=c.get(s)}else if((0,b.isSignal)(s))s=s();else if(s=s(),typeof s!="function"||!(0,b.isSignal)(s)&&!P(s))break}A++;try{a=D(t,s,n,a,c),i(a)}finally{A--}})}function k(e,t,n,r){if(A>tt)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=v("",!0),e.appendChild(n));let i=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){A++;try{i=D(e,t,n,i)}finally{A--}return()=>i}let s=nt(c(t),e,n,i,o=>{i=o});return()=>(s?.(),i)}function D(e,t,n,r,i){if(t==null||typeof t=="boolean")return M(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return M(e,r,n);if(F(t)){let c=v("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),M(e,r.slice(1),n)):x(e,c,n):r?e.replaceChild(c,r):x(e,c,n),t.then(s=>{c.parentNode===e&&D(e,s,c.nextSibling,c)}).catch(s=>{console.error("Error resolving promise in insertExpression:",s)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let s=v(t);return x(e,s,n),s}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=M(e,r,n)}if(r&&Ae(r))return r.data=t,r;let c=v(t);return r&&r.parentNode===e?e.replaceChild(c,r):Y(e,c)||x(e,c,n),c}if(O(t))return Y(e,t)?(Z(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),M(e,r.slice(1),n)):x(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):x(e,t,n)):x(e,t,n),t);if(Array.isArray(t)){let c=[],s=Array.isArray(r)?r:r?[r]:[],o=[];N(t,c,e,n,!0,i,o);let l=rt(e,s,c,n);for(let f of o){let p=k(e,f.sig,f.marker);(0,m.onCleanup)(()=>{M(e,p()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let s=c;if(typeof s.type=="function"){let o=s.type(s.props||{});return D(e,o,n,r)}}}return M(e,r,n)}function N(e,t,n,r,i=!0,a,c){for(let s=0;s<e.length;s++){let o=e[s];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!F(o)&&!(0,b.isSignal)(o)&&!P(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(P(o)&&!(0,b.isSignal)(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!F(l)&&!(0,b.isSignal)(l)&&!P(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if((0,b.isSignal)(l)){if(c){let p=v("",!0);t.push(p),c.push({marker:p,sig:l});continue}let f=l();for(;typeof f=="function"&&(0,b.isSignal)(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?N(f,t,n,r,i,a):N([f],t,n,r,i,a);continue}continue}Array.isArray(l)?N(l,t,n,r,i,a,c):N([l],t,n,r,i,a,c);continue}if(F(o)){let l=v("",!0);t.push(l),o.then(f=>{if(l.parentNode){let p=[];if(N([f],p,l.parentNode,void 0,!1,a),p.length>0){l.parentNode.replaceChild(p[0],l);for(let y=1;y<p.length;y++)l.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){N(o,t,n,r,i,a,c);continue}if(O(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?N(f,t,n,r,!1,a):N([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(v(l));continue}t.push(v(String(o)))}}}}function rt(e,t,n,r){for(let p=0;p<n.length;p++){let y=n[p].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[p]=n[p].cloneNode(!0))}let i=n.length,a=t.length,c=i,s=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;s<a||o<c;){if(t[s]===n[o]){s++,o++;continue}for(;a>s&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===s){let p=c<i?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)x(e,n[o++],p)}else if(c===o)for(;s<a;)(!f||!f.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===n[c-1]&&n[o]===t[a-1]){let p=t[--a].nextSibling;x(e,n[o++],t[s++].nextSibling),x(e,n[--c],p),t[a]=t[s-1]}else{if(!f){f=new Map;let y=o;for(;y<c;)f.set(n[y],y++)}let p=f.get(t[s]);if(p!=null)if(o<p&&p<c){let y=s,z=1;for(;++y<a&&y<c&&!(!f.has(t[y])||f.get(t[y])!==p+z);)z++;if(z>p-o){let Ke=t[s];for(;o<p;)x(e,n[o++],Ke)}else t[s].parentNode===e?e.replaceChild(n[o++],t[s++]):(x(e,n[o++],l),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return n}function M(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function x(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function R(e,t,n){n==null?delete e[t]:e[t]=n}function ot(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function it(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function Me(e,t,n,r=!1){return typeof n!="function"?(w(e,t,n,r),()=>{}):(0,m.createRenderEffect)(()=>{let i=typeof n=="function"?n():n;w(e,t,i,r)})}function Re(e,t,n){return typeof n!="function"?(R(e,t,n),()=>{}):(0,m.createRenderEffect)(()=>{let r=typeof n=="function"?n():n;R(e,t,r)})}function st(e,t,n){return typeof n!="function"?(w(e,t,!!n),()=>{}):(0,m.createRenderEffect)(()=>{let r=n();w(e,t,!!r)})}function L(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,m.createRenderEffect)(()=>L(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function ke(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push((0,m.createRenderEffect)(()=>{let c=!!i();for(let s of a)e.classList.toggle(s,c)}));else{let c=!!(typeof i=="function"?i():i);for(let s of a)e.classList.toggle(s,c)}}}function I(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Oe(e){let{element:t,props:n,prevProps:r=Ze,isSVG:i=!1,skipChildren:a=!1}=e;if(!t||!Ne(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===me,s=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){te(l,t);continue}if(o==="use"){it(t,l);continue}if(o.startsWith("on:")){s.push(ot(t,o.slice(3),l));continue}if(o.startsWith("prop:")){s.push(Re(t,o.slice(5),l));continue}if(o.startsWith("attr:")){s.push(Me(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){s.push(st(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>L(t,l()))):L(t,l);continue}if(o==="classList"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>ke(t,l()))):ke(t,l,s);continue}if(o==="style"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>I(t,l()))):I(t,l);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();f&&Pe(t,y),l&&et(t,y,l);continue}let p=G.has(o)||!c&&o in t;typeof l=="function"?s.push(p?Re(t,o,l):Me(t,o,l,c)):s.push((0,m.createRenderEffect)(()=>p?R(t,o,n[o]):w(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();Pe(t,l)}else G.has(o)?R(t,o,null):t.removeAttribute(o);return()=>{s.forEach(o=>o())}}function te(e,t){if(e){if(O(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function F(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function $(e,t,n){if(!t)throw new Error("Container element is required");let r,i,a=[];return(0,m.createRoot)(c=>{(0,m.batch)(()=>{u.active||(t.textContent=""),be(t),Te(),k(t,e)}),i=c}),()=>{i?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}var at="__fx_dom_create_component__",_e=globalThis[at]??={fn:null};function Fe(e,t){return _e.fn?_e.fn(e,t):(()=>e(t))}var j=require("@fluixi/reactive/signal");var ct="__FX_DATA__";var ne;function De(){let e=globalThis.__FX_DATA__;if(e)return e;if(ne!==void 0)return ne;let t=null;if(typeof document<"u"){let n=document.getElementById(ct)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return ne=t}function H(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var lt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),V=typeof process<"u"&&process.env&&!1;function U(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function ft(e){H();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(lt.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(V&&t&&U(`<${e}>`,t),null)}function ut(e){H();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(V&&t&&U(`<${e}> (static)`,t),null)}function dt(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}H();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(V&&t&&U(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function pt(e){H();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(V&&t&&U(`marker <!--${e.slice(0,24)}-->`,t),null)}var Ie=!1;function yt(){Ie||(Ie=!0,ve({hydrateElement:ft,hydrateText:dt,hydrateMarker:pt,hydrateStatic:ut}))}function re(e,t,n){yt(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=De(),i=n?.resourceNamespace,a=0;(0,j.setResourceIdSource)(()=>i?`${i}:r${a++}`:`r${a++}`),(0,j.setServerDataGetter)(r?c=>c in r?{value:r[c]}:void 0:null);try{return $(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var h=require("@fluixi/reactive/signal");function $e(e){return typeof e=="function"?e:(()=>e)}function C(e){return()=>{let t=e();return typeof t=="function"?t():t}}function je(e){return e!=null&&e!==!1}function He(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function oe(e){let t=C(()=>e.when),n=(0,h.createMemo)(t,void 0),r=(0,h.createMemo)(n,void 0),i=(0,h.getOwner)(),a=null,c=null,s=o=>{o!==c&&(a&&(0,h.disposeScope)(a),a=(0,h.createChildOwner)(i),c=o)};return(0,h.createMemo)(()=>{let o=r();return s(o?"when":"fallback"),(0,h.runWithOwner)(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!He(l)?typeof n=="function"?(0,h.untrack)(()=>(0,h.untrack)(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var W=require("@fluixi/reactive/signal");function ie(e){let t=C(()=>e.each),n=()=>e.fallback??null,r=(i,a)=>{let c=e.children,s=Array.isArray(c)?c.map(o=>typeof o=="function"?o(i,a):o):typeof c=="function"?c(i,a):c;return _(s),s};return e.by?(0,W.keyArray)(t,e.by,(i,a)=>r(i,a),{fallback:n}):(0,W.mapArray)(t,(i,a)=>r(i,a),{fallback:n})}var Ve=require("@fluixi/reactive/signal");function se(e){let t=C(()=>e.each);return(0,Ve.indexArray)(t,(n,r)=>{let i=e.children(n,r);return _(i),i},{fallback:()=>e.fallback??null})}var S=require("@fluixi/reactive/signal");var T=require("@fluixi/reactive/signal");var ae=Symbol("match");function ce(e){return{[ae]:!0,when:C(()=>e.when),get children(){return e.children}}}function le(e){let t=Array.isArray(e.children)?e.children:[e.children],n=(0,T.getOwner)(),r=null,i=-1,a=c=>{c!==i&&(r&&(0,T.disposeScope)(r),r=(0,T.createChildOwner)(n),i=c)};return(0,T.createMemo)(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[ae]&&l++<10;)o=o();if(!o||typeof o!="object"||o[ae]!==!0)continue;let f=o.when();if(je(f))return a(c),(0,T.runWithOwner)(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),(0,T.runWithOwner)(r,()=>e.fallback??null)})}var E=require("@fluixi/reactive/signal");function fe(e){let t=$e(e.component),{component:n,...r}=e,i=(0,E.getOwner)(),a=null,c;return(0,E.createMemo)(()=>{let s=t();return s!==c&&(a&&(0,E.disposeScope)(a),a=(0,E.createChildOwner)(i),c=s),s==null?null:typeof s=="string"?{tag:s,props:r}:(0,E.runWithOwner)(a,()=>s(r))})}var K=require("@fluixi/reactive/signal");function ue(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return(0,K.createRoot)(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),k(r,e.children)&&te(e.ref,r)}),(0,K.onCleanup)(()=>{n(),r.remove()}),null}var B=require("@fluixi/reactive/signal");function de(e){let[t,n]=(0,B.createSignal)(null),r=()=>n(null);return(0,B.createMemo)(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}var Ue=require("@fluixi/reactive/signal");function pe(e){return(0,Ue.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}var We=require("@fluixi/reactive/signal");function mt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ye(e){return(0,We.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let a=typeof i=="function"?i():i;a!=null&&n.push(`${mt(r)}: ${a}`)}return n.join("; ")})}var d=require("@fluixi/reactive");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN entry: the browser half of the surface, without the SSR renderer.
|
|
3
|
+
*
|
|
4
|
+
* <script src="https://.../@fluixi/dom/dom-client.global.js"></script>
|
|
5
|
+
* const count = FluixiDOM.signal(0);
|
|
6
|
+
* FluixiDOM.render(() => App(), document.getElementById('root'));
|
|
7
|
+
*
|
|
8
|
+
* Same shape as `dom.global.js` and the same global name, minus the string renderer,
|
|
9
|
+
* node serialisation, template parsing and the request context. A `<script>` tag
|
|
10
|
+
* cannot tree-shake, so anything reachable from the entry ships — which makes the
|
|
11
|
+
* server half pure weight for a page that renders in a browser. Measured against the
|
|
12
|
+
* full build: 21.0 kB gzipped → 12.2 kB.
|
|
13
|
+
*
|
|
14
|
+
* `hydrate` stays: a page hydrating server-rendered HTML runs in the browser, and it
|
|
15
|
+
* is the one thing here that touches SSR output. Use `dom.global.js` if you actually
|
|
16
|
+
* render to a string in the browser, which is rare outside tests.
|
|
17
|
+
*/
|
|
18
|
+
export { render, hydrate, insert, spread, createElement, createComponent, setAttribute, setProperty, setClassName, setStyle, classMap, styleMap, delegateEvents, Show, For, Index, Switch, Match, Portal, Dynamic, ErrorBoundary, mapArray, indexArray, keyArray, } from '../lib/index.js';
|
|
19
|
+
export { signal, memo, effect, store, createSignal, createMemo, createEffect, createComputed, createRenderEffect, createRoot, createResource, createContext, useContext, onCleanup, batch, untrack, } from '@fluixi/reactive';
|
|
20
|
+
//# sourceMappingURL=dom-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-client.d.ts","sourceRoot":"","sources":["../../src/cdn/dom-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAEL,MAAM,EACN,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,EACb,eAAe,EAEf,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EAER,cAAc,EAEd,IAAI,EACJ,GAAG,EACH,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAa,EAEb,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,GACR,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var FluixiDOM=(()=>{var Pe=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var Rn=Object.getOwnPropertyNames;var Dn=Object.prototype.hasOwnProperty;var jn=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},In=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Rn(t))!Dn.call(e,i)&&i!==n&&Pe(e,i,{get:()=>t[i],enumerable:!(r=Mn(t,i))||r.enumerable});return e};var qn=e=>In(Pe({},"__esModule",{value:!0}),e);var eo={};jn(eo,{Dynamic:()=>Ge,ErrorBoundary:()=>Je,For:()=>Ue,Index:()=>We,Match:()=>Be,Portal:()=>Xe,Show:()=>He,Switch:()=>Ke,batch:()=>R,classMap:()=>Ye,createComponent:()=>Ut,createComputed:()=>wn,createContext:()=>Ne,createEffect:()=>_e,createElement:()=>ht,createMemo:()=>at,createRenderEffect:()=>xn,createResource:()=>vn,createRoot:()=>gn,createSignal:()=>D,delegateEvents:()=>Le,effect:()=>Tn,hydrate:()=>Ve,indexArray:()=>ne,insert:()=>K,keyArray:()=>te,mapArray:()=>ee,memo:()=>En,onCleanup:()=>st,render:()=>ge,setAttribute:()=>A,setClassName:()=>re,setProperty:()=>B,setStyle:()=>me,signal:()=>Sn,spread:()=>Vt,store:()=>kn,styleMap:()=>Ze,untrack:()=>Ee,useContext:()=>hn});var pt="http://www.w3.org/2000/svg";var Ce=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function A(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function Ln(e,t){Object.assign(e.style,t)}function ht(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,s])=>{if(i==="class"||i==="className")r.className=s;else if(i==="style"&&typeof s=="object")Ln(r,s);else if(i.startsWith("on")&&typeof s=="function"){let u=i.slice(2).toLowerCase();r.addEventListener(u,s)}else A(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var no=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var $n="__fluixi_signal_next_state__",Fn=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},d=globalThis[$n]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Fn,onSuspend:null,onError:null},yt=0,mt=1,Y=2,gt=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(d.untracked)return;let e=d.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Vn=class extends gt{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(Y);ke(this)}}peek(){return this._value}},bt=class extends gt{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Y,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(d.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===mt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Y)break}(this.state===Y||!this._initialized)&&this.recompute(),this.state=yt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=d.consumer,t=d.untracked;d.consumer=this,d.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{d.consumer=e,d.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(Y);ke(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===yt;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(mt);ke(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ke(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Hn=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Un(e){if(d.untracked)return e();d.untracked=!0;try{return e()}finally{d.untracked=!1}}function W(e){let t=ce(e);return e&&(e.owned??=[]).push(t),t}function z(e,t=!0){Z(e,t)}function ce(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function wt(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=d.owner,i=ce(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),d.owner=i;try{return n.children}finally{d.owner=r}}}}function xt(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Wn(e){d.onSuspend=e}function zn(e){return d.onSuspend?(d.onSuspend(e,d.owner),!0):!1}function Bn(e){d.onError=e}function q(){return d.owner}function N(e,t){let n=d.owner;d.owner=e;try{return t()}finally{d.owner=n}}function L(e){if(d.owner){if(d.owner.disposed){e();return}(d.owner.cleanups??=[]).push(e)}}function Z(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Z(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function $(e){let t=ce(d.owner);d.owner&&(d.owner.owned??=[]).push(t);let n=d.owner;d.owner=t;try{return e(()=>Z(t))}finally{d.owner=n}}function Kn(e){d.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Gn(e){e.queued||(e.queued=!0,d.queue.push(e),!d.scheduled&&d.batchDepth===0&&(d.scheduled=!0,d.hostSchedule(Oe)))}function Oe(){if(d.scheduled=!1,d.flushing)return;d.flushing=!0;let e=0;try{for(;d.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=d.queue;d.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{d.flushing=!1}}function Xn(){d.batchDepth===0&&Oe()}function Jn(e){d.batchDepth++;try{return e()}finally{--d.batchDepth===0&&Oe()}}var Yn=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=ce(d.owner),d.owner&&(d.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new bt(()=>{Z(this.owner,!1),N(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Hn(()=>Gn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&d.onSuspend){d.onSuspend(e,this.owner);return}if(d.onError&&d.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),Z(this.owner))}};function vt(e){let t=new Yn(e);return()=>t.dispose()}function Zn(e){return!!e&&typeof e.then=="function"}Kn(()=>{});var St=Symbol.for("signal"),Qn=Symbol.for("memo"),er=Symbol.for("signal-node");function C(e,t){let n=new Vn(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),Xn(),u});return Object.defineProperty(r,St,{value:!0,enumerable:!0}),Object.defineProperty(r,er,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function m(e,t,n){let r=t,i=q(),s=new bt(()=>N(i,()=>{try{return r=e(r)}catch(l){if(Zn(l))return zn(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,St,{value:!0,enumerable:!0}),Object.defineProperty(u,Qn,{value:!0,enumerable:!0}),u}function fe(e,t){let n=t;return vt(()=>{n=e(n)})}function S(e,t){let n=t;return vt(()=>{n=e(n)})}function Q(e){return Jn(e)}function k(e){return Un(e)}function ee(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let o of r)s.has(o.item)||s.set(o.item,o);let u=[],l=new Set;for(let o=0;o<i.length;o++){let a=i[o],p=s.get(a);if(p&&!l.has(p))p.setIndex(o),u.push(p),l.add(p);else{let c,y,g;$(b=>{g=b;let[H,X]=C(o);y=X,c=t(a,H)});let v={item:a,rendered:c,dispose:g,setIndex:y};u.push(v),l.add(v)}}for(let o of r)l.has(o)||o.dispose();return r=u,u.map(o=>o.rendered)})})}function te(e,t,n,r){let i=[],s=[];return L(()=>{for(let u of s)u.dispose();i=[],s=[]}),m(()=>{let u=e()||[];return k(()=>{if(u.length===0){for(let c of s)c.dispose();return i=[],s=[],r?.fallback?r.fallback():[]}let l=new Map;for(let c=0;c<i.length;c++)l.set(i[c],s[c]);let o=[],a=[],p=new Set;for(let c=0;c<u.length;c++){let y=t(u[c]),g=l.get(y);if(g&&!p.has(y))g.setIndex(c),o.push(g);else{let v,b,H;$(X=>{H=X;let[j,J]=C(c);b=J;let se=m(U=>(e()||[])[j()]??U,u[c]);v=n(se,j)}),o.push({rendered:v,dispose:H,setIndex:b})}a.push(y),p.add(y)}for(let[c,y]of l)p.has(c)||y.dispose();return i=a,s=o,o.map(c=>c.rendered)})})}function ne(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,u=i.length;for(let o=s;o<u;o++){let a,p,c,y=i[o];$(g=>{c=g;let[v,b]=C(y);p=b,a=t(v,o)}),r.push({rendered:a,setItem:p,dispose:c})}for(let o=u;o<s;o++)r[o].dispose();u<s&&(r=r.slice(0,u));let l=Math.min(s,u);for(let o=0;o<l;o++)r[o].setItem(i[o]);return r.map(o=>o.rendered)})})}var tr=Symbol.for("signal");function E(e){return typeof e=="function"&&e[tr]===!0}var nr=null;function Et(e){nr=e}var rr=null;function Tt(e){rr=e}var or=wt();Wn((e,t)=>{let n=xt(t,or);n&&(n.increment(),e.finally(()=>n.decrement()))});var ir=wt();Bn((e,t)=>{let n=xt(t,ir);return n?(n.setError(e),!0):!1});var Me=Symbol.for("fluixi-proxy");var At="1.0.0-alpha.78";var Nt="1.0.0-alpha.78";var T={dom:At,reactive:Nt};function _t(e){T.core&&e.setAttribute("fluixi",T.core),e.setAttribute("fx-dom",T.dom),e.setAttribute("fx-reactive",T.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=T)}function Pt(){let e=[T.core,T.dom,T.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${T.core??"(absent)"}, dom ${T.dom}, reactive ${T.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function F(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var Re=typeof document>"u";var De=Symbol.for("fluixi.server-node"),Ct=null;function kt(){if(!Ct)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ct}function de(e){return e!=null&&e[De]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ot(e){return e!=null&&e[De]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Mt(e){return e!=null&&e[De]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var h={active:!1,cursor:null,parents:[]},Rt=null;function Dt(e){Rt=e}function jt(){return Rt}function je(e,t){return h.active&&t.parentNode===e}function Ie(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function pe(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Ie(t)}var sr={};var qe=new Set,Ft=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Le(e){if(!Re)for(let t of e)qe.has(t)||Ft.has(t)||(qe.add(t),document.addEventListener(t,ur))}function ur(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function lr(e,t,n){if(e[`$$${t}`]=n,Ft.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}qe.has(t)||Le([t])}function It(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function O(e,t=!1){if(Re)return kt().createText(e);if(h.active&&!t){let n=jt()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var P=0,ar=200;function cr(e,t,n,r,i){let s=r,u=new Map;return S(()=>{let l;if(F(e)&&!E(e)){if(!u.has(e)){P++;try{let o=e();u.set(e,o)}finally{P--}}for(l=u.get(e);typeof l=="function"&&E(l);)l=l()}else for(l=e();typeof l=="function"&&E(l);)l=l();{let o=0;for(;typeof l=="function"&&o++<50;)if(F(l)){if(!u.has(l)){let a=l;P++;try{let p=a();u.set(a,p)}finally{P--}}l=u.get(l)}else if(E(l))l=l();else if(l=l(),typeof l!="function"||!E(l)&&!F(l))break}P++;try{s=ye(t,l,n,s,u),i(s)}finally{P--}})}function K(e,t,n,r){if(P>ar)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=O("",!0),e.appendChild(n));let i=r??null,s=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),u=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!s(t)){P++;try{i=ye(e,t,n,i)}finally{P--}return()=>i}let l=cr(u(t),e,n,i,o=>{i=o});return()=>(l?.(),i)}function ye(e,t,n,r,i){if(t==null||typeof t=="boolean")return V(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return V(e,r,n);if(he(t)){let u=O("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(u,r[0]),V(e,r.slice(1),n)):x(e,u,n):r?e.replaceChild(u,r):x(e,u,n),t.then(l=>{u.parentNode===e&&ye(e,l,u.nextSibling,u)}).catch(l=>{console.error("Error resolving promise in insertExpression:",l)}),u}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let l=O(t);return x(e,l,n),l}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=V(e,r,n)}if(r&&Mt(r))return r.data=t,r;let u=O(t);return r&&r.parentNode===e?e.replaceChild(u,r):je(e,u)||x(e,u,n),u}if(de(t))return je(e,t)?(Ie(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),V(e,r.slice(1),n)):x(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):x(e,t,n)):x(e,t,n),t);if(Array.isArray(t)){let u=[],l=Array.isArray(r)?r:r?[r]:[],o=[];_(t,u,e,n,!0,i,o);let a=fr(e,l,u,n);for(let p of o){let c=K(e,p.sig,p.marker);L(()=>{V(e,c()),p.marker.parentNode===e&&e.removeChild(p.marker)})}return a}if(s==="object"&&t!==null&&typeof t=="object"){let u=t;if("type"in u&&"props"in u){let l=u;if(typeof l.type=="function"){let o=l.type(l.props||{});return ye(e,o,n,r)}}}return V(e,r,n)}function _(e,t,n,r,i=!0,s,u){for(let l=0;l<e.length;l++){let o=e[l];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!he(o)&&!E(o)&&!F(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(F(o)&&!E(o)?(s||(s=new Map),s.has(o)||s.set(o,o()),a=s.get(o)):a=o();typeof a=="function"&&!he(a)&&!E(a)&&!F(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(E(a)){if(u){let c=O("",!0);t.push(c),u.push({marker:c,sig:a});continue}let p=a();for(;typeof p=="function"&&E(p);)p=p();if(p==null||typeof p=="boolean")continue;Array.isArray(p)?_(p,t,n,r,i,s):_([p],t,n,r,i,s);continue}continue}Array.isArray(a)?_(a,t,n,r,i,s,u):_([a],t,n,r,i,s,u);continue}if(he(o)){let a=O("",!0);t.push(a),o.then(p=>{if(a.parentNode){let c=[];if(_([p],c,a.parentNode,void 0,!1,s),c.length>0){a.parentNode.replaceChild(c[0],a);for(let y=1;y<c.length;y++)a.parentNode?.insertBefore(c[y],c[y-1].nextSibling)}}}).catch(p=>console.error("Error resolving promise in array:",p));continue}if(Array.isArray(o)){_(o,t,n,r,i,s,u);continue}if(de(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let p=a.type(a.props||{});Array.isArray(p)?_(p,t,n,r,!1,s):_([p],t,n,r,!1,s);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;t.push(O(a));continue}t.push(O(String(o)))}}}}function fr(e,t,n,r){for(let c=0;c<n.length;c++){let y=n[c].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let i=n.length,s=t.length,u=i,l=0,o=0,a=s>0?t[s-1].nextSibling??void 0:r,p=null;for(;l<s||o<u;){if(t[l]===n[o]){l++,o++;continue}for(;s>l&&u>o&&t[s-1]===n[u-1];)s--,u--;if(s===l){let c=u<i?o?n[o-1].nextSibling??void 0:n[u-o]:a;for(;o<u;)x(e,n[o++],c)}else if(u===o)for(;l<s;)(!p||!p.has(t[l]))&&t[l].parentNode===e&&e.removeChild(t[l]),l++;else if(t[l]===n[u-1]&&n[o]===t[s-1]){let c=t[--s].nextSibling;x(e,n[o++],t[l++].nextSibling),x(e,n[--u],c),t[s]=t[l-1]}else{if(!p){p=new Map;let y=o;for(;y<u;)p.set(n[y],y++)}let c=p.get(t[l]);if(c!=null)if(o<c&&c<u){let y=l,g=1;for(;++y<s&&y<u&&!(!p.has(t[y])||p.get(t[y])!==c+g);)g++;if(g>c-o){let v=t[l];for(;o<c;)x(e,n[o++],v)}else t[l].parentNode===e?e.replaceChild(n[o++],t[l++]):(x(e,n[o++],a),l++)}else l++;else t[l].parentNode===e&&e.removeChild(t[l]),l++}}return n}function V(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function x(e,t,n){h.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function B(e,t,n){n==null?delete e[t]:e[t]=n}function dr(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function pr(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function qt(e,t,n,r=!1){return typeof n!="function"?(A(e,t,n,r),()=>{}):S(()=>{let i=typeof n=="function"?n():n;A(e,t,i,r)})}function Lt(e,t,n){return typeof n!="function"?(B(e,t,n),()=>{}):S(()=>{let r=typeof n=="function"?n():n;B(e,t,r)})}function hr(e,t,n){return typeof n!="function"?(A(e,t,!!n),()=>{}):S(()=>{let r=n();A(e,t,!!r)})}function re(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){S(()=>re(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function $t(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(S(()=>{let u=!!i();for(let l of s)e.classList.toggle(l,u)}));else{let u=!!(typeof i=="function"?i():i);for(let l of s)e.classList.toggle(l,u)}}}function me(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Vt(e){let{element:t,props:n,prevProps:r=sr,isSVG:i=!1,skipChildren:s=!1}=e;if(!t||!Ot(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let u=i||t.namespaceURI===pt,l=[];for(let o in n){if(s&&o==="children")continue;let a=n[o],p=r[o];if(a===p)continue;if(o==="ref"){$e(a,t);continue}if(o==="use"){pr(t,a);continue}if(o.startsWith("on:")){l.push(dr(t,o.slice(3),a));continue}if(o.startsWith("prop:")){l.push(Lt(t,o.slice(5),a));continue}if(o.startsWith("attr:")){l.push(qt(t,o.slice(5),a,u));continue}if(o.startsWith("bool:")){l.push(hr(t,o.slice(5),a));continue}if(o==="class"||o==="className"){typeof a=="function"?l.push(S(()=>re(t,a()))):re(t,a);continue}if(o==="classList"){typeof a=="function"?l.push(S(()=>$t(t,a()))):$t(t,a,l);continue}if(o==="style"){typeof a=="function"?l.push(S(()=>me(t,a()))):me(t,a);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();p&&It(t,y),a&&lr(t,y,a);continue}let c=Ce.has(o)||!u&&o in t;typeof a=="function"?l.push(c?Lt(t,o,a):qt(t,o,a,u)):l.push(S(()=>c?B(t,o,n[o]):A(t,o,n[o],u)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let a=o.slice(2).toLowerCase();It(t,a)}else Ce.has(o)?B(t,o,null):t.removeAttribute(o);return()=>{l.forEach(o=>o())}}function $e(e,t){if(e){if(de(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function he(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ge(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return $(u=>{Q(()=>{h.active||(t.textContent=""),_t(t),Pt(),K(t,e)}),i=u}),()=>{i?.(),r?.(),s.forEach(u=>u()),t.textContent=""}}var yr="__fx_dom_create_component__",Ht=globalThis[yr]??={fn:null};function Ut(e,t){return Ht.fn?Ht.fn(e,t):(()=>e(t))}var mr="__FX_DATA__";var Fe;function Wt(){let e=globalThis.__FX_DATA__;if(e)return e;if(Fe!==void 0)return Fe;let t=null;if(typeof document<"u"){let n=document.getElementById(mr)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Fe=t}function be(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var gr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),we=typeof process<"u"&&process.env&&!1;function xe(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function br(e){be();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(gr.has(e.toLowerCase())?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(we&&t&&xe(`<${e}>`,t),null)}function wr(e){be();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(h.cursor=t.nextSibling,t):(we&&t&&xe(`<${e}> (static)`,t),null)}function xr(e){if(e===""){let n=h.cursor;return n&&n.nodeType===3&&n.data!==""?(h.cursor=n.nextSibling,n.data="",n):null}be();let t=h.cursor;return t&&t.nodeType===3?(h.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(we&&t&&xe(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function vr(e){be();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(we&&t&&xe(`marker <!--${e.slice(0,24)}-->`,t),null)}var zt=!1;function Sr(){zt||(zt=!0,Dt({hydrateElement:br,hydrateText:xr,hydrateMarker:vr,hydrateStatic:wr}))}function Ve(e,t,n){Sr(),h.active=!0,h.cursor=t.firstChild,h.parents=[];let r=Wt(),i=n?.resourceNamespace,s=0;Tt(()=>i?`${i}:r${s++}`:`r${s++}`),Et(r?u=>u in r?{value:r[u]}:void 0:null);try{return ge(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}function Bt(e){return typeof e=="function"?e:(()=>e)}function M(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Kt(e){return e!=null&&e!==!1}function Gt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function He(e){let t=M(()=>e.when),n=m(t,void 0),r=m(n,void 0),i=q(),s=null,u=null,l=o=>{o!==u&&(s&&z(s),s=W(i),u=o)};return m(()=>{let o=r();return l(o?"when":"fallback"),N(s,()=>{if(o){let a=e.children;return typeof a=="function"&&!Gt(a)?typeof n=="function"?k(()=>k(n)?a(n()):e.fallback):a(n):a}return e.fallback});return e.fallback??null},void 0,{name:"show"})}function Ue(e){let t=M(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let u=e.children,l=Array.isArray(u)?u.map(o=>typeof o=="function"?o(i,s):o):typeof u=="function"?u(i,s):u;return pe(l),l};return e.by?te(t,e.by,(i,s)=>r(i,s),{fallback:n}):ee(t,(i,s)=>r(i,s),{fallback:n})}function We(e){let t=M(()=>e.each);return ne(t,(n,r)=>{let i=e.children(n,r);return pe(i),i},{fallback:()=>e.fallback??null})}var ze=Symbol("match");function Be(e){return{[ze]:!0,when:M(()=>e.when),get children(){return e.children}}}function Ke(e){let t=Array.isArray(e.children)?e.children:[e.children],n=q(),r=null,i=-1,s=u=>{u!==i&&(r&&z(r),r=W(n),i=u)};return m(()=>{for(let u=0;u<t.length;u+=1){let o=t[u],a=0;for(;typeof o=="function"&&!o[ze]&&a++<10;)o=o();if(!o||typeof o!="object"||o[ze]!==!0)continue;let p=o.when();if(Kt(p))return s(u),N(r,()=>typeof o.children=="function"?o.children(p):o.children)}return s(-2),N(r,()=>e.fallback??null)})}function Ge(e){let t=Bt(e.component),{component:n,...r}=e,i=q(),s=null,u;return m(()=>{let l=t();return l!==u&&(s&&z(s),s=W(i),u=l),l==null?null:typeof l=="string"?{tag:l,props:r}:N(s,()=>l(r))})}function Xe(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return $(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),K(r,e.children)&&$e(e.ref,r)}),L(()=>{n(),r.remove()}),null}function Je(e){let[t,n]=C(null),r=()=>n(null);return m(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return n(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}function Ye(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}function Er(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ze(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let s=typeof i=="function"?i():i;s!=null&&n.push(`${Er(r)}: ${s}`)}return n.join("; ")})}var Tr="__fluixi_signal_next_state__",Ar=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},f=globalThis[Tr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Ar,onSuspend:null,onError:null},Xt=0,Jt=1,oe=2,dn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(f.untracked)return;let e=f.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Nr=class extends dn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(oe);tt(this)}}peek(){return this._value}},pn=class extends dn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=oe,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(f.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Jt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===oe)break}(this.state===oe||!this._initialized)&&this.recompute(),this.state=Xt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=f.consumer,t=f.untracked;f.consumer=this,f.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{f.consumer=e,f.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(oe);tt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Xt;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(Jt);tt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function tt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var _r=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Pr(e){if(f.untracked)return e();f.untracked=!0;try{return e()}finally{f.untracked=!1}}function it(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ne(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=f.owner,i=it(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),f.owner=i;try{return n.children}finally{f.owner=r}}}}function hn(e){let t=f.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function yn(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Cr(e){f.onSuspend=e}function kr(e){return f.onSuspend?(f.onSuspend(e,f.owner),!0):!1}function Or(e){f.onError=e}function Mr(){return f.owner}function mn(e,t){let n=f.owner;f.owner=e;try{return t()}finally{f.owner=n}}function st(e){if(f.owner){if(f.owner.disposed){e();return}(f.owner.cleanups??=[]).push(e)}}function Se(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Se(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function gn(e){let t=it(f.owner);f.owner&&(f.owner.owned??=[]).push(t);let n=f.owner;f.owner=t;try{return e(()=>Se(t))}finally{f.owner=n}}function Rr(e){f.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Dr(e){e.queued||(e.queued=!0,f.queue.push(e),!f.scheduled&&f.batchDepth===0&&(f.scheduled=!0,f.hostSchedule(ut)))}function ut(){if(f.scheduled=!1,f.flushing)return;f.flushing=!0;let e=0;try{for(;f.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=f.queue;f.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{f.flushing=!1}}function jr(){f.batchDepth===0&&ut()}function Ir(e){f.batchDepth++;try{return e()}finally{--f.batchDepth===0&&ut()}}var qr=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=it(f.owner),f.owner&&(f.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new pn(()=>{Se(this.owner,!1),mn(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new _r(()=>Dr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&f.onSuspend){f.onSuspend(e,this.owner);return}if(f.onError&&f.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),Se(this.owner))}};function lt(e){let t=new qr(e);return()=>t.dispose()}function Lr(e){return!!e&&typeof e.then=="function"}Rr(()=>{});var bn=Symbol.for("signal"),$r=Symbol.for("memo"),Fr=Symbol.for("signal-node");function D(e,t){let n=new Nr(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),jr(),u});return Object.defineProperty(r,bn,{value:!0,enumerable:!0}),Object.defineProperty(r,Fr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function at(e,t,n){let r=t,i=Mr(),s=new pn(()=>mn(i,()=>{try{return r=e(r)}catch(l){if(Lr(l))return kr(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,bn,{value:!0,enumerable:!0}),Object.defineProperty(u,$r,{value:!0,enumerable:!0}),u}function _e(e,t){let n=t;return lt(()=>{n=e(n)})}function wn(e,t){let n=t;lt(()=>{n=e(n)})}function xn(e,t){let n=t;return lt(()=>{n=e(n)})}function R(e){return Ir(e)}function Ee(e){return Pr(e)}var Yt=null;function Vr(e){Yt&&Yt(e)}var Zt=null;function Hr(e){return Zt?Zt(e):void 0}var Qt=null;function Ur(){return Qt?Qt():void 0}var en=null;function Wr(e,t){en&&en(e,t)}function zr(e){return!!e&&typeof e.then=="function"}var Qe=Symbol();function vn(e,t,n={}){let r,i;typeof t=="function"?(r=typeof e=="function"?e:()=>e,i=t):(r=()=>!0,i=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Ur(),u=s!==void 0?Hr(s):void 0,l=u!==void 0,[o,a]=D(u!==void 0?u.value:n.initialValue,{equals:!1}),[p,c]=D(void 0,{equals:!1}),[y,g]=D(u!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[v,b]=D(void 0,{equals:!1}),[H,X]=D(void 0,{equals:!1}),j=Qe,J=!1;_e(()=>{let w=r();if(H(),w===!1||w===null||w===void 0){j=Qe,R(()=>{g("unresolved"),b(void 0),c(void 0)});return}let ue=J;if(J=!1,j!==Qe&&w===j&&!ue)return;if(j=w,l){l=!1;return}let le=!1;st(()=>le=!0);let ft=Ee(y),On=Ee(o),dt=ft==="ready"||ft==="refreshing";R(()=>{g(dt?"refreshing":"pending"),c(void 0)});try{let I=i(w,{value:On,refetching:dt});zr(I)?(b(I),Vr(I),I.then(ae=>{le||(s!==void 0&&Wr(s,ae),R(()=>{a(()=>ae),g("ready"),b(void 0)}))},ae=>{le||R(()=>{c(ae),g("errored"),b(void 0)})})):R(()=>{a(()=>I),g("ready"),b(void 0)})}catch(I){if(le)return;R(()=>{c(I),g("errored"),b(void 0)})}});let se=()=>{let w=y();return w==="pending"||w==="refreshing"},U=(()=>{let w=p();if(w)throw w;if(se()){let ue=v();if(ue)throw ue}return o()});return Object.defineProperties(U,{state:{get:y},loading:{get:se},error:{get:p},latest:{get:o}}),Object.defineProperty(U,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(U,Symbol.for("signal"),{value:!0,enumerable:!0}),[U,{mutate:a,refetch:()=>{J=!0,X(void 0)}}]}var Br=Ne();Cr((e,t)=>{let n=yn(t,Br);n&&(n.increment(),e.finally(()=>n.decrement()))});var Kr=Ne();Or((e,t)=>{let n=yn(t,Kr);return n?(n.setError(e),!0):!1});function Sn(e,t){let[n,r]=D(e,t);return Object.assign(n,{set:r})}function En(e,t,n){return at(e,t,n)}function Tn(e,t){return _e(e,t)}var nt=Symbol("store-raw"),tn=Symbol("store-node"),nn=Symbol("store-has"),rn=Symbol("store-self"),on=Symbol("store-track");var sn=new WeakMap,un=new WeakMap;function An(e){let[t,n]=C(e),r=t;return r.$=n,r}function Te(e){let t=sn.get(e);return t||sn.set(e,t={keys:new Map}),t}function ln(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=An(n)),r}function an(e){let t=Te(e);(t.all||(t.all=An()))()}function cn(e,t){e.$(typeof t=="function"?()=>t:t)}function Nn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ve(e){if(!Nn(e))return e;let t=un.get(e);if(t)return t;let n=new Proxy(e,Gr);return un.set(e,n),n}var Gr={get(e,t,n){if(t===nt||t===tn)return e;if(t===Me)return n;if(t===nn)return u=>u in e;if(t==="__proxy")return!0;if(t===on||t===rn)return an(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(n);let s=ln(Te(e),t,r)();return Nn(s)?ve(s):s},set(){return!0},deleteProperty(e,t){return t in e&&ie(e,t,void 0),!0},has(e,t){return t===nt||t===Me||t===tn||t===nn||t===rn||t===on?!0:(ln(Te(e),t,e[t])(),t in e)},ownKeys(e){return an(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function ie(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let r=Array.isArray(e),i=r?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=Te(e),u=s.keys.get(t);if(u&&cn(u,n),r&&e.length!==i){let l=s.keys.get("length");l&&cn(l,e.length)}s.all&&s.all.$(void 0)}function fn(e,t){return typeof e=="function"?e(t):e}function rt(e,t){for(let n of Object.keys(t)){let r=t[n],i=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?rt(i,r):ie(e,n,r)}}function ct(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function _n(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let u=t[s];if(u==="*"){let o=t.slice(s+1);if(Array.isArray(e))for(let a=0;a<e.length;a++)_n(e[a],o,n);return}let l=e[u];(l==null||typeof l!="object")&&(l=/^\d+$/.test(t[s+1])?[]:{},ie(e,u,l)),e=l}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)ie(e,s,fn(n,e[s]));return}ie(e,i,fn(n,e[i]))}function et(e,t,n){_n(e,ct(t),n)}function Xr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&rt(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&et(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){rt(e,n);return}if(Array.isArray(t[1])&&t.length>=3){et(e,`${n}.${t[1].join(".")}`,t[2]);return}et(e,String(n),t[1])}function ot(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ot);let t={};for(let n of Object.keys(e))t[n]=ot(e[n]);return t}function G(e,t){let n=e;for(let r of ct(t)){if(n==null)return;n=n[r]}return n}var Pn=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>Q(()=>Xr(this.root,n)))}get state(){return ve(this.root)}get proxy(){return ve(this.root)}get accessor(){return(()=>ve(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return Ae(this.state);let t=this.state;for(let n of ct(e)){if(t==null)return;t=t[n]}return Ae(t)}select(e){return m(()=>e(this.state))}subscribe(e){return fe(()=>e(this.state))}watch(e,t){let n;return fe(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return m(()=>this.state[e])}produce(e){this.set((t=>{let n=ot(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=G(this.root,e);this.set(e,n.concat(t))}pop(e){let t=G(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=G(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=G(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=G(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=G(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}toObservable(){let[e]=C(this.state);return e.toObservable()}dispose(){}},Jr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function Yr(e,t){for(let n of Jr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Cn(e,t={immutable:!0}){let n=new Pn(e,t);return Yr(n.set,n),[n.proxy,n.set]}function Zr(e,t={}){return new Pn(e,{...t,immutable:!1})}function Ae(e){if(e==null||typeof e!="object")return e;let t=e[nt];return t!==void 0?t:e}function Qr(e){return k(()=>Ae(e))}var Fi=Object.freeze({createStore:Cn,createMutableStore:Zr,batch:Q,unwrap:Ae,untrackStore:Qr});function kn(e,t){let[n,r]=Cn(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}return qn(eo);})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN entry: the browser half of the surface, without the SSR renderer.
|
|
3
|
+
*
|
|
4
|
+
* <script src="https://.../@fluixi/dom/dom-client.global.js"></script>
|
|
5
|
+
* const count = FluixiDOM.signal(0);
|
|
6
|
+
* FluixiDOM.render(() => App(), document.getElementById('root'));
|
|
7
|
+
*
|
|
8
|
+
* Same shape as `dom.global.js` and the same global name, minus the string renderer,
|
|
9
|
+
* node serialisation, template parsing and the request context. A `<script>` tag
|
|
10
|
+
* cannot tree-shake, so anything reachable from the entry ships — which makes the
|
|
11
|
+
* server half pure weight for a page that renders in a browser. Measured against the
|
|
12
|
+
* full build: 21.0 kB gzipped → 12.2 kB.
|
|
13
|
+
*
|
|
14
|
+
* `hydrate` stays: a page hydrating server-rendered HTML runs in the browser, and it
|
|
15
|
+
* is the one thing here that touches SSR output. Use `dom.global.js` if you actually
|
|
16
|
+
* render to a string in the browser, which is rare outside tests.
|
|
17
|
+
*/
|
|
18
|
+
export {
|
|
19
|
+
// rendering
|
|
20
|
+
render, hydrate, insert, spread, createElement, createComponent,
|
|
21
|
+
// attributes and properties
|
|
22
|
+
setAttribute, setProperty, setClassName, setStyle, classMap, styleMap,
|
|
23
|
+
// events
|
|
24
|
+
delegateEvents,
|
|
25
|
+
// control flow
|
|
26
|
+
Show, For, Index, Switch, Match, Portal, Dynamic, ErrorBoundary,
|
|
27
|
+
// lists
|
|
28
|
+
mapArray, indexArray, keyArray, } from '../lib/index.js';
|
|
29
|
+
export {
|
|
30
|
+
// reactive primitives — the short API and the tuple form, as the full entry does
|
|
31
|
+
signal, memo, effect, store, createSignal, createMemo, createEffect, createComputed, createRenderEffect, createRoot, createResource, createContext, useContext, onCleanup, batch, untrack, } from '@fluixi/reactive';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var G="http://www.w3.org/2000/svg";var D=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function ke(e,t){Object.assign(e.style,t)}function Le(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([s,a])=>{if(s==="class"||s==="className")r.className=a;else if(s==="style"&&typeof a=="object")ke(r,a);else if(s.startsWith("on")&&typeof a=="function"){let c=s.slice(2).toLowerCase();r.addEventListener(c,a)}else T(r,s,a)}),n.forEach(s=>{typeof s=="string"?r.appendChild(document.createTextNode(s)):r.appendChild(s)}),r}var Rt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;import{isSignal as h}from"@fluixi/reactive/signal";var X="1.0.0-alpha.78";import{VERSION as Oe}from"@fluixi/reactive/version";var m={dom:X,reactive:Oe};function J(e){m.core&&e.setAttribute("fluixi",m.core),e.setAttribute("fx-dom",m.dom),e.setAttribute("fx-reactive",m.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=m)}function Y(){let e=[m.core,m.dom,m.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${m.core??"(absent)"}, dom ${m.dom}, reactive ${m.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as _e,createEffect as zt,createRenderEffect as x,createRoot as Fe,onCleanup as De,readChildren as qt}from"@fluixi/reactive/signal";var I=typeof document>"u";var $=Symbol.for("fluixi.server-node"),Z=null;function Q(){if(!Z)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Z}function C(e){return e!=null&&e[$]===!0?!0:typeof Node<"u"&&e instanceof Node}function ee(e){return e!=null&&e[$]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function te(e){return e!=null&&e[$]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},ne=null;function re(e){ne=e}function oe(){return ne}function j(e,t){return u.active&&t.parentNode===e}function H(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function P(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&H(t)}var Ie={};var V=new Set,le=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function fe(e){if(!I)for(let t of e)V.has(t)||le.has(t)||(V.add(t),document.addEventListener(t,$e))}function $e(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function je(e,t,n){if(e[`$$${t}`]=n,le.has(t)){let r=`__fx_${t}`;if(!e[r]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[r]=s}return}V.has(t)||fe([t])}function ie(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function E(e,t=!1){if(I)return Q().createText(e);if(u.active&&!t){let n=oe()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var b=0,He=200;function Ve(e,t,n,r,s){let a=r,c=new Map;return x(()=>{let i;if(N(e)&&!h(e)){if(!c.has(e)){b++;try{let o=e();c.set(e,o)}finally{b--}}for(i=c.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(N(i)){if(!c.has(i)){let l=i;b++;try{let f=l();c.set(l,f)}finally{b--}}i=c.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!N(i))break}b++;try{a=R(t,i,n,a,c),s(a)}finally{b--}})}function v(e,t,n,r){if(b>He)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=E("",!0),e.appendChild(n));let s=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){b++;try{s=R(e,t,n,s)}finally{b--}return()=>s}let i=Ve(c(t),e,n,s,o=>{s=o});return()=>(i?.(),s)}function R(e,t,n,r,s){if(t==null||typeof t=="boolean")return A(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return A(e,r,n);if(M(t)){let c=E("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),A(e,r.slice(1),n)):y(e,c,n):r?e.replaceChild(c,r):y(e,c,n),t.then(i=>{c.parentNode===e&&R(e,i,c.nextSibling,c)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let i=E(t);return y(e,i,n),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=A(e,r,n)}if(r&&te(r))return r.data=t,r;let c=E(t);return r&&r.parentNode===e?e.replaceChild(c,r):j(e,c)||y(e,c,n),c}if(C(t))return j(e,t)?(H(t),t):Array.isArray(r)?(r.length===0?y(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),A(e,r.slice(1),n)):y(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):y(e,t,n)):y(e,t,n),t);if(Array.isArray(t)){let c=[],i=Array.isArray(r)?r:r?[r]:[],o=[];g(t,c,e,n,!0,s,o);let l=Ue(e,i,c,n);for(let f of o){let d=v(e,f.sig,f.marker);De(()=>{A(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let i=c;if(typeof i.type=="function"){let o=i.type(i.props||{});return R(e,o,n,r)}}}return A(e,r,n)}function g(e,t,n,r,s=!0,a,c){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!M(o)&&!h(o)&&!N(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(N(o)&&!h(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!M(l)&&!h(l)&&!N(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(h(l)){if(c){let d=E("",!0);t.push(d),c.push({marker:d,sig:l});continue}let f=l();for(;typeof f=="function"&&h(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?g(f,t,n,r,s,a):g([f],t,n,r,s,a);continue}continue}Array.isArray(l)?g(l,t,n,r,s,a,c):g([l],t,n,r,s,a,c);continue}if(M(o)){let l=E("",!0);t.push(l),o.then(f=>{if(l.parentNode){let d=[];if(g([f],d,l.parentNode,void 0,!1,a),d.length>0){l.parentNode.replaceChild(d[0],l);for(let p=1;p<d.length;p++)l.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){g(o,t,n,r,s,a,c);continue}if(C(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?g(f,t,n,r,!1,a):g([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(E(l));continue}t.push(E(String(o)))}}}}function Ue(e,t,n,r){for(let d=0;d<n.length;d++){let p=n[d].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[d]=n[d].cloneNode(!0))}let s=n.length,a=t.length,c=s,i=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;i<a||o<c;){if(t[i]===n[o]){i++,o++;continue}for(;a>i&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===i){let d=c<s?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)y(e,n[o++],d)}else if(c===o)for(;i<a;)(!f||!f.has(t[i]))&&t[i].parentNode===e&&e.removeChild(t[i]),i++;else if(t[i]===n[c-1]&&n[o]===t[a-1]){let d=t[--a].nextSibling;y(e,n[o++],t[i++].nextSibling),y(e,n[--c],d),t[a]=t[i-1]}else{if(!f){f=new Map;let p=o;for(;p<c;)f.set(n[p],p++)}let d=f.get(t[i]);if(d!=null)if(o<d&&d<c){let p=i,F=1;for(;++p<a&&p<c&&!(!f.has(t[p])||f.get(t[p])!==d+F);)F++;if(F>d-o){let Re=t[i];for(;o<d;)y(e,n[o++],Re)}else t[i].parentNode===e?e.replaceChild(n[o++],t[i++]):(y(e,n[o++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}return n}function A(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function y(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function S(e,t,n){n==null?delete e[t]:e[t]=n}function We(e,t,n){let r=n,s;return Array.isArray(n)&&(r=n[0],s=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,s),()=>e.removeEventListener(t,r,s))}function Ke(e,t){let n=(r,s)=>{typeof r=="function"&&r(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function se(e,t,n,r=!1){return typeof n!="function"?(T(e,t,n,r),()=>{}):x(()=>{let s=typeof n=="function"?n():n;T(e,t,s,r)})}function ae(e,t,n){return typeof n!="function"?(S(e,t,n),()=>{}):x(()=>{let r=typeof n=="function"?n():n;S(e,t,r)})}function Be(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):x(()=>{let r=n();T(e,t,!!r)})}function k(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){x(()=>k(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let s=t[r];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function ce(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let s=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(x(()=>{let c=!!s();for(let i of a)e.classList.toggle(i,c)}));else{let c=!!(typeof s=="function"?s():s);for(let i of a)e.classList.toggle(i,c)}}}function U(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let s=n[r];s==null?e.style[r]="":e.style[r]=s}}function ze(e){let{element:t,props:n,prevProps:r=Ie,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!ee(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=s||t.namespaceURI===G,i=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){W(l,t);continue}if(o==="use"){Ke(t,l);continue}if(o.startsWith("on:")){i.push(We(t,o.slice(3),l));continue}if(o.startsWith("prop:")){i.push(ae(t,o.slice(5),l));continue}if(o.startsWith("attr:")){i.push(se(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){i.push(Be(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?i.push(x(()=>k(t,l()))):k(t,l);continue}if(o==="classList"){typeof l=="function"?i.push(x(()=>ce(t,l()))):ce(t,l,i);continue}if(o==="style"){typeof l=="function"?i.push(x(()=>U(t,l()))):U(t,l);continue}if(o.startsWith("on")){let p=o.slice(2).toLowerCase();f&&ie(t,p),l&&je(t,p,l);continue}let d=D.has(o)||!c&&o in t;typeof l=="function"?i.push(d?ae(t,o,l):se(t,o,l,c)):i.push(x(()=>d?S(t,o,n[o]):T(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();ie(t,l)}else D.has(o)?S(t,o,null):t.removeAttribute(o);return()=>{i.forEach(o=>o())}}function W(e,t){if(e){if(C(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function K(e,t,n){if(!t)throw new Error("Container element is required");let r,s,a=[];return Fe(c=>{_e(()=>{u.active||(t.textContent=""),J(t),Y(),v(t,e)}),s=c}),()=>{s?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}var qe="__fx_dom_create_component__",ue=globalThis[qe]??={fn:null};function Ge(e,t){return ue.fn?ue.fn(e,t):(()=>e(t))}import{setResourceIdSource as Je,setServerDataGetter as Ye}from"@fluixi/reactive/signal";var Xe="__FX_DATA__";var B;function de(){let e=globalThis.__FX_DATA__;if(e)return e;if(B!==void 0)return B;let t=null;if(typeof document<"u"){let n=document.getElementById(Xe)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return B=t}function L(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var Ze=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),O=typeof process<"u"&&process.env&&!1;function _(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function Qe(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Ze.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(O&&t&&_(`<${e}>`,t),null)}function et(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(O&&t&&_(`<${e}> (static)`,t),null)}function tt(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}L();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(O&&t&&_(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function nt(e){L();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(O&&t&&_(`marker <!--${e.slice(0,24)}-->`,t),null)}var pe=!1;function rt(){pe||(pe=!0,re({hydrateElement:Qe,hydrateText:tt,hydrateMarker:nt,hydrateStatic:et}))}function ye(e,t,n){rt(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=de(),s=n?.resourceNamespace,a=0;Je(()=>s?`${s}:r${a++}`:`r${a++}`),Ye(r?c=>c in r?{value:r[c]}:void 0:null);try{return K(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}import{createChildOwner as ot,createMemo as z,disposeScope as it,getOwner as st,runWithOwner as at,untrack as ge}from"@fluixi/reactive/signal";function me(e){return typeof e=="function"?e:(()=>e)}function w(e){return()=>{let t=e();return typeof t=="function"?t():t}}function he(e){return e!=null&&e!==!1}function xe(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function be(e){let t=w(()=>e.when),n=z(t,void 0),r=z(n,void 0),s=st(),a=null,c=null,i=o=>{o!==c&&(a&&it(a),a=ot(s),c=o)};return z(()=>{let o=r();return i(o?"when":"fallback"),at(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!xe(l)?typeof n=="function"?ge(()=>ge(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as ct,keyArray as lt}from"@fluixi/reactive/signal";function Te(e){let t=w(()=>e.each),n=()=>e.fallback??null,r=(s,a)=>{let c=e.children,i=Array.isArray(c)?c.map(o=>typeof o=="function"?o(s,a):o):typeof c=="function"?c(s,a):c;return P(i),i};return e.by?lt(t,e.by,(s,a)=>r(s,a),{fallback:n}):ct(t,(s,a)=>r(s,a),{fallback:n})}import{indexArray as ft}from"@fluixi/reactive/signal";function Ee(e){let t=w(()=>e.each);return ft(t,(n,r)=>{let s=e.children(n,r);return P(s),s},{fallback:()=>e.fallback??null})}import{mapArray as Ct,keyArray as Pt,indexArray as Mt}from"@fluixi/reactive/signal";import{createMemo as ut,createChildOwner as dt,disposeScope as pt,getOwner as yt,runWithOwner as we}from"@fluixi/reactive/signal";var q=Symbol("match");function Ne(e){return{[q]:!0,when:w(()=>e.when),get children(){return e.children}}}function Ae(e){let t=Array.isArray(e.children)?e.children:[e.children],n=yt(),r=null,s=-1,a=c=>{c!==s&&(r&&pt(r),r=dt(n),s=c)};return ut(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[q]&&l++<10;)o=o();if(!o||typeof o!="object"||o[q]!==!0)continue;let f=o.when();if(he(f))return a(c),we(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),we(r,()=>e.fallback??null)})}import{createMemo as mt,createChildOwner as ht,disposeScope as xt,getOwner as gt,runWithOwner as bt}from"@fluixi/reactive/signal";function Se(e){let t=me(e.component),{component:n,...r}=e,s=gt(),a=null,c;return mt(()=>{let i=t();return i!==c&&(a&&xt(a),a=ht(s),c=i),i==null?null:typeof i=="string"?{tag:i,props:r}:bt(a,()=>i(r))})}import{createRoot as Tt,onCleanup as Et}from"@fluixi/reactive/signal";function ve(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return Tt(s=>{n=s,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),v(r,e.children)&&W(e.ref,r)}),Et(()=>{n(),r.remove()}),null}import{createMemo as wt,createSignal as Nt}from"@fluixi/reactive/signal";function Ce(e){let[t,n]=Nt(null),r=()=>n(null);return wt(()=>{let s=t();if(s!==null)return typeof e.fallback=="function"?e.fallback(s,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}import{createMemo as At}from"@fluixi/reactive/signal";function Pe(e){return At(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;(typeof s=="function"?s():s)&&n.push(r)}return n.join(" ")})}import{createMemo as St}from"@fluixi/reactive/signal";function vt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Me(e){return St(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;let a=typeof s=="function"?s():s;a!=null&&n.push(`${vt(r)}: ${a}`)}return n.join("; ")})}import{signal as fr,memo as ur,effect as dr,store as pr,createSignal as yr,createMemo as mr,createEffect as hr,createComputed as xr,createRenderEffect as gr,createRoot as br,createResource as Tr,createContext as Er,useContext as wr,onCleanup as Nr,batch as Ar,untrack as Sr}from"@fluixi/reactive";export{Se as Dynamic,Ce as ErrorBoundary,Te as For,Ee as Index,Ne as Match,ve as Portal,be as Show,Ae as Switch,Ar as batch,Pe as classMap,Ge as createComponent,xr as createComputed,Er as createContext,hr as createEffect,Le as createElement,mr as createMemo,gr as createRenderEffect,Tr as createResource,br as createRoot,yr as createSignal,fe as delegateEvents,dr as effect,ye as hydrate,Mt as indexArray,v as insert,Pt as keyArray,Ct as mapArray,ur as memo,Nr as onCleanup,K as render,T as setAttribute,k as setClassName,S as setProperty,U as setStyle,fr as signal,ze as spread,pr as store,Me as styleMap,Sr as untrack,wr as useContext};
|