@alwatr/flux 9.27.0 → 9.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +261 -7
- package/dist/main.d.ts +2 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +3 -3
- package/package.json +13 -12
- package/src/main.ts +2 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Born from years of building production PWAs and inspired by the best ideas from
|
|
|
18
18
|
- **Fine-grained reactivity** via Signals (no Virtual DOM overhead)
|
|
19
19
|
- **Global event delegation** for O(1) boot time (inspired by Qwik's Resumability)
|
|
20
20
|
- **Declarative DOM directives** for clean, maintainable UI code
|
|
21
|
+
- **Declarative reactive DOM data binding** via Bind (surgical view model updates)
|
|
21
22
|
- **Type-safe action bus** with zero runtime overhead
|
|
22
23
|
- **Persistent state management** with automatic localStorage/sessionStorage sync
|
|
23
24
|
|
|
@@ -377,11 +378,129 @@ createEffect({
|
|
|
377
378
|
});
|
|
378
379
|
```
|
|
379
380
|
|
|
381
|
+
### 🔗 **Declarative DOM Data Binding (Bind)**
|
|
382
|
+
|
|
383
|
+
Flux aggregates `@alwatr/bind` to provide a declarative, low-overhead way to bind elements directly to reactive view models. This enables surgical updates to text, values, and attributes without virtual DOM diffing or full-component re-renders.
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
import {service_binding, createStateSignal} from '@alwatr/flux';
|
|
387
|
+
|
|
388
|
+
// 1. Create domain state signal
|
|
389
|
+
const userSignal = createStateSignal({
|
|
390
|
+
name: 'user',
|
|
391
|
+
initialValue: {firstName: 'Ali', lastName: 'Mihandoost', cart: []},
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// 2. Project domain state to flat view model representation
|
|
395
|
+
service_binding.createViewModel('user', userSignal, (u) => ({
|
|
396
|
+
firstName: u.firstName,
|
|
397
|
+
fullName: `${u.firstName} ${u.lastName}`,
|
|
398
|
+
cartIsEmpty: u.cart.length === 0,
|
|
399
|
+
}));
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
In your HTML, bind properties using declarative attributes:
|
|
403
|
+
|
|
404
|
+
```html
|
|
405
|
+
<!-- Text Content Binding -->
|
|
406
|
+
<h2 bind-text="user.fullName">Loading...</h2>
|
|
407
|
+
|
|
408
|
+
<!-- Value Binding with active cursor position preservation guard -->
|
|
409
|
+
<input
|
|
410
|
+
type="text"
|
|
411
|
+
bind-value="user.firstName"
|
|
412
|
+
on-input="ui_edit_name:$value"
|
|
413
|
+
/>
|
|
414
|
+
|
|
415
|
+
<!-- Attribute Binding (boolean presence toggling / nullish removal) -->
|
|
416
|
+
<button bind-attrib="disabled=user.cartIsEmpty">Checkout</button>
|
|
417
|
+
|
|
418
|
+
<!-- Lazy Binding (evaluated only when element enters viewport) -->
|
|
419
|
+
<div
|
|
420
|
+
bind-text="user.fullName"
|
|
421
|
+
lazy-bind
|
|
422
|
+
></div>
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### 🌟 Key Advantages of Bind
|
|
426
|
+
|
|
427
|
+
- **Cursor Preservation**: Writing to input values directly in other frameworks often resets the cursor caret to the end of the text. `@alwatr/bind` compares values and only writes to the DOM if the value changed, preserving typing cursor position perfectly.
|
|
428
|
+
- **Presence-Aware Attributes**: Binds attributes intelligently. A `boolean` value toggles attribute presence, a `nullish` value removes the attribute, and any other value sets the attribute as a string.
|
|
429
|
+
- **Lazy Initialization**: Placing `lazy-bind` on elements defers signal subscription and DOM updates until the element physically intersects the viewport, optimizing rendering performance on large pages.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
### 🤖 **Finite State Machine (FSM) & Actor Model**
|
|
434
|
+
|
|
435
|
+
Flux natively aggregates `@alwatr/fsm` to eliminate ad-hoc state variables, boolean flags, and race conditions. Instead of writing unpredictable, disjointed spaghetti code, you model your application's lifecycle as a **declarative, type-safe statechart**.
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
import {createFsmService} from '@alwatr/flux';
|
|
439
|
+
import type {StateMachineConfig} from '@alwatr/flux';
|
|
440
|
+
|
|
441
|
+
// 1. Define strict Union Types for compile-time safety
|
|
442
|
+
type FetchState = 'idle' | 'loading' | 'success' | 'failed';
|
|
443
|
+
type FetchEvent = {type: 'FETCH'} | {type: 'SUCCESS'} | {type: 'ERROR'};
|
|
444
|
+
interface FetchContext {
|
|
445
|
+
retries: number;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// 2. Configure the machine declaratively
|
|
449
|
+
const fetchConfig: StateMachineConfig<FetchState, FetchEvent, FetchContext> = {
|
|
450
|
+
name: 'api-fetch-lifecycle',
|
|
451
|
+
initial: 'idle',
|
|
452
|
+
context: {retries: 0},
|
|
453
|
+
states: {
|
|
454
|
+
idle: {
|
|
455
|
+
on: {FETCH: {target: 'loading'}},
|
|
456
|
+
},
|
|
457
|
+
loading: {
|
|
458
|
+
on: {
|
|
459
|
+
SUCCESS: {target: 'success', assigners: [({context}) => ({...context, retries: 0})]},
|
|
460
|
+
ERROR: [
|
|
461
|
+
// Guard evaluates condition; first matching transition branch is chosen
|
|
462
|
+
{
|
|
463
|
+
target: 'loading',
|
|
464
|
+
guard: ({context}) => context.retries < 3,
|
|
465
|
+
assigners: [({context}) => ({...context, retries: context.retries + 1})],
|
|
466
|
+
},
|
|
467
|
+
{target: 'failed'},
|
|
468
|
+
],
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
success: {},
|
|
472
|
+
failed: {
|
|
473
|
+
on: {FETCH: {target: 'loading', assigners: [({context}) => ({...context, retries: 0})]}},
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// 3. Create the reactive service (FSM Service instance)
|
|
479
|
+
export const fetchService = createFsmService(fetchConfig);
|
|
480
|
+
|
|
481
|
+
// 4. Surgical Reactivity: Subscribe to state changes in the view layer
|
|
482
|
+
fetchService.stateSignal.subscribe((state) => {
|
|
483
|
+
console.log(`Current State: ${state.name}, Retries: ${state.context.retries}`);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
// 5. Dispatch events to trigger atomic transitions
|
|
487
|
+
fetchService.dispatch({type: 'FETCH'});
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
#### 🛡️ Why is Flux FSM a Game-Changer?
|
|
491
|
+
|
|
492
|
+
- **Eliminates Race Conditions (Run-to-Completion)**: FSM events are queued and processed sequentially. Async callbacks from concurrent network fetches never overwrite or corrupt the state.
|
|
493
|
+
- **Prevents State Explosion**: Ad-hoc booleans (like `isLoading`, `isError`, `hasFetched`) scale exponentially (e.g., 5 booleans = 32 states). FSM forces you to define a finite set of **valid states and transitions** (e.g., exactly 4 states).
|
|
494
|
+
- **Embedded Actor Architecture**: Statecharts can spawn long-running, asynchronous, isolated lifecycles called **Actors** on state entry, complete with auto-cleanup on exit.
|
|
495
|
+
- **Declarative Synergy**: The FSM's internal `stateSignal` integrates flawlessly with the `@alwatr/flux` unidirectional loop, feeding directly into your rendering template.
|
|
496
|
+
|
|
380
497
|
---
|
|
381
498
|
|
|
382
499
|
## 🏗️ Architecture Overview
|
|
383
500
|
|
|
384
|
-
Flux implements a **strict layered architecture** where each layer has a single responsibility
|
|
501
|
+
Flux implements a **strict layered architecture** where each layer has a single responsibility. It supports both standard Unidirectional Data Flow (UDF) and the decentralized **Actor Model** (where components/features behave as isolated micro-services powered by FSMs).
|
|
502
|
+
|
|
503
|
+
### 1. Unidirectional Data Flow (UDF) Layering
|
|
385
504
|
|
|
386
505
|
```
|
|
387
506
|
┌───────────────────────────────────────────────────────────┐
|
|
@@ -439,13 +558,68 @@ Flux implements a **strict layered architecture** where each layer has a single
|
|
|
439
558
|
└───────────────────────────────────────────────────────────┘
|
|
440
559
|
```
|
|
441
560
|
|
|
561
|
+
### 2. Decoupled Actor Model Flow
|
|
562
|
+
|
|
563
|
+
In complex applications, you can structure features as **Actors** using `@alwatr/fsm` + `@alwatr/action`. An Actor maintains private local state, receives inbound event packets from the global action bus, and broadcasts changes asynchronously back to the ecosystem.
|
|
564
|
+
|
|
565
|
+
```mermaid
|
|
566
|
+
graph TD
|
|
567
|
+
%% Styling
|
|
568
|
+
classDef view fill:#E1F5FE,stroke:#03A9F4,stroke-width:2px,color:#01579B;
|
|
569
|
+
classDef action fill:#FFF3E0,stroke:#FF9800,stroke-width:2px,color:#E65100;
|
|
570
|
+
classDef fsm fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px,color:#1B5E20;
|
|
571
|
+
classDef actor fill:#F3E5F5,stroke:#9C27B0,stroke-width:2px,color:#4A148C;
|
|
572
|
+
classDef global fill:#ECEFF1,stroke:#607D8B,stroke-width:2px,color:#263238;
|
|
573
|
+
|
|
574
|
+
subgraph View ["View Layer (lit-html & Directives)"]
|
|
575
|
+
V[DOM / UI Elements]
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
subgraph Actions ["Action Bus (Global Delegation)"]
|
|
579
|
+
AB[actionService.dispatch]
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
subgraph Controllers ["Actor Controller Layer"]
|
|
583
|
+
C[Input Controller / Message Router]
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
subgraph ActorDomain ["Decoupled Actor (FSM Brain)"]
|
|
587
|
+
direction TB
|
|
588
|
+
FSM[FsmService]
|
|
589
|
+
Ctx[(Extended Context)]
|
|
590
|
+
Actors[Spawning State Actors]
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
subgraph State ["Reactive State Layer (Signals)"]
|
|
594
|
+
SS[stateSignal]
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
%% Flow
|
|
598
|
+
V -->|on-click / on-input| AB
|
|
599
|
+
AB -->|Global AFSA Message| C
|
|
600
|
+
C -->|dispatch Event| FSM
|
|
601
|
+
FSM -->|1. Run-to-Completion| Ctx
|
|
602
|
+
FSM -->|2. Entry/Exit Effects| Actors
|
|
603
|
+
FSM -->|3. Update State| SS
|
|
604
|
+
SS -->|Re-render / Update UI| V
|
|
605
|
+
Actors -.->|Asynchronous Events| AB
|
|
606
|
+
|
|
607
|
+
%% Apply Classes
|
|
608
|
+
class V view;
|
|
609
|
+
class AB action;
|
|
610
|
+
class C global;
|
|
611
|
+
class FSM,Ctx fsm;
|
|
612
|
+
class Actors actor;
|
|
613
|
+
class SS view;
|
|
614
|
+
```
|
|
615
|
+
|
|
442
616
|
**Key architectural benefits:**
|
|
443
617
|
|
|
444
|
-
- **Zero coupling** — layers communicate only through
|
|
445
|
-
- **
|
|
446
|
-
- **
|
|
447
|
-
- **
|
|
448
|
-
- **
|
|
618
|
+
- **Zero coupling** — layers and actors communicate only through events, guaranteeing that features can be refactored, extended, or replaced without side effects.
|
|
619
|
+
- **Run-to-Completion (RTC)** — State machines evaluate transitions atomically in a synchronous queue. Race conditions are mathematically impossible.
|
|
620
|
+
- **High Testability** — Since business logic is isolated inside declarative statecharts (`StateMachineConfig`), you can test all transitions and side-effects in node/bun without mounting a DOM.
|
|
621
|
+
- **Surgical Reactivity** — Only the DOM elements bound to the FSM's `stateSignal` or Context properties re-render, keeping CPU usage and memory footprints exceptionally low.
|
|
622
|
+
- **AI-Agent and Developer Friendly** — The explicit separation of routing, transition, and effect layers provides clean boundaries that humans and AI agents can navigate with zero ambiguity.
|
|
449
623
|
|
|
450
624
|
---
|
|
451
625
|
|
|
@@ -732,6 +906,30 @@ const mapped = createMappedSignal(source, {
|
|
|
732
906
|
});
|
|
733
907
|
```
|
|
734
908
|
|
|
909
|
+
#### `createFsmService(config)`
|
|
910
|
+
|
|
911
|
+
Instantiates a Finite State Machine service using the given configuration:
|
|
912
|
+
|
|
913
|
+
```typescript
|
|
914
|
+
import {createFsmService} from '@alwatr/flux';
|
|
915
|
+
|
|
916
|
+
const myService = createFsmService({
|
|
917
|
+
name: 'my-fsm',
|
|
918
|
+
initial: 'idle',
|
|
919
|
+
context: {retries: 0},
|
|
920
|
+
states: {
|
|
921
|
+
idle: {
|
|
922
|
+
on: {START: {target: 'working'}},
|
|
923
|
+
},
|
|
924
|
+
working: {
|
|
925
|
+
on: {SUCCESS: {target: 'idle'}},
|
|
926
|
+
},
|
|
927
|
+
},
|
|
928
|
+
});
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
See the complete [FSM Package README](https://github.com/Alwatr/alwatr/tree/next/pkg/fsm#readme) for advanced FSM configuration details (Persistence, Guards, Actors, etc.).
|
|
932
|
+
|
|
735
933
|
---
|
|
736
934
|
|
|
737
935
|
### Actions
|
|
@@ -920,6 +1118,62 @@ class FormDirective extends Directive {
|
|
|
920
1118
|
|
|
921
1119
|
---
|
|
922
1120
|
|
|
1121
|
+
### Bind (Declarative Data Binding)
|
|
1122
|
+
|
|
1123
|
+
#### `setupBindDirectives()`
|
|
1124
|
+
|
|
1125
|
+
Registers and bootstraps all `@alwatr/bind` attribute directives on application boot.
|
|
1126
|
+
|
|
1127
|
+
```typescript
|
|
1128
|
+
import {setupBindDirectives} from '@alwatr/flux';
|
|
1129
|
+
|
|
1130
|
+
setupBindDirectives();
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
#### `service_binding`
|
|
1134
|
+
|
|
1135
|
+
The registry singleton managing presentation view models and mapping subscriptions.
|
|
1136
|
+
|
|
1137
|
+
##### `service_binding.createViewModel(namespace, sourceSignal, project)`
|
|
1138
|
+
|
|
1139
|
+
Registers a ViewModel namespaces mapping a domain signal state `S` to a flat presentation record `T`.
|
|
1140
|
+
|
|
1141
|
+
```typescript
|
|
1142
|
+
import {service_binding} from '@alwatr/flux';
|
|
1143
|
+
|
|
1144
|
+
service_binding.createViewModel('user', userSignal, (u) => ({
|
|
1145
|
+
fullName: `${u.firstName} ${u.lastName}`,
|
|
1146
|
+
cartIsEmpty: u.cart.length === 0,
|
|
1147
|
+
}));
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
##### `service_binding.getViewModel(namespace)`
|
|
1151
|
+
|
|
1152
|
+
Retrieves a registered ViewModel's computed signal. Returns `null` if the namespace is not registered.
|
|
1153
|
+
|
|
1154
|
+
##### `service_binding.removeViewModel(namespace)`
|
|
1155
|
+
|
|
1156
|
+
Destroys the ViewModel's computed signal and removes the namespace from the active registry.
|
|
1157
|
+
|
|
1158
|
+
#### Directives HTML Syntax
|
|
1159
|
+
|
|
1160
|
+
- **`bind-text="namespace.prop"`**
|
|
1161
|
+
Updates the element's `textContent` to the property value. Maps nullish values (`null`/`undefined`) to `''`.
|
|
1162
|
+
|
|
1163
|
+
- **`bind-value="namespace.prop"`**
|
|
1164
|
+
Updates input element values safely. Skips DOM writing if the element's value is already equal to the bound value to prevent caret cursor jumping in active text inputs.
|
|
1165
|
+
|
|
1166
|
+
- **`bind-attrib="attr1=namespace.prop1; attr2=namespace.prop2"`**
|
|
1167
|
+
Updates target DOM attributes.
|
|
1168
|
+
- A boolean value toggles the attribute's presence.
|
|
1169
|
+
- A nullish value (`null` or `undefined`) removes the attribute.
|
|
1170
|
+
- All other values are coerced to strings.
|
|
1171
|
+
|
|
1172
|
+
- **`lazy-bind`**
|
|
1173
|
+
When added to any element with the above bindings, defers initialization and signal subscription until the element physically intersects the viewport.
|
|
1174
|
+
|
|
1175
|
+
---
|
|
1176
|
+
|
|
923
1177
|
### Page Ready
|
|
924
1178
|
|
|
925
1179
|
#### `onPageReady(pageId, handler)`
|
|
@@ -1311,7 +1565,7 @@ todosSignal.subscribe((todos) => {
|
|
|
1311
1565
|
- **[@alwatr/action](https://github.com/Alwatr/alwatr/tree/next/pkg/nanolib/action)** — Global event delegation action bus (part of Flux)
|
|
1312
1566
|
- **[@alwatr/directive](https://github.com/Alwatr/alwatr/tree/next/pkg/nanolib/directive)** — Attribute-based DOM directives (part of Flux)
|
|
1313
1567
|
- **[@alwatr/embedded-data](https://github.com/Alwatr/alwatr/tree/next/pkg/nanolib/embedded-data)** — Extract and validate embedded JSON from DOM script tags for SSR hydration (part of Flux)
|
|
1314
|
-
- **[@alwatr/fsm](https://github.com/Alwatr/alwatr/tree/next/pkg/fsm)** — Type-safe Finite State Machine
|
|
1568
|
+
- **[@alwatr/fsm](https://github.com/Alwatr/alwatr/tree/next/pkg/fsm)** — Type-safe Finite State Machine (part of Flux)
|
|
1315
1569
|
- **[@alwatr/nanotron](https://github.com/Alwatr/alwatr/tree/next/pkg/nanotron)** — Lightweight API server framework
|
|
1316
1570
|
- **[@alwatr/nitrobase](https://github.com/Alwatr/alwatr/tree/next/pkg/nitrobase)** — In-memory JSON database
|
|
1317
1571
|
- **[@alwatr/fetch](https://github.com/Alwatr/alwatr/tree/next/pkg/nanolib/fetch)** — Enhanced fetch with retry, cache, deduplication
|
package/dist/main.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from '@alwatr/signal';
|
|
2
2
|
export * from '@alwatr/action';
|
|
3
|
+
export * from '@alwatr/bind';
|
|
3
4
|
export * from '@alwatr/directive';
|
|
4
5
|
export * from '@alwatr/embedded-data';
|
|
6
|
+
export * from '@alwatr/fsm';
|
|
5
7
|
export * from '@alwatr/keyboard-shortcut';
|
|
6
8
|
export * from '@alwatr/render-state';
|
|
7
9
|
export * from '@alwatr/local-storage';
|
|
8
10
|
export * from '@alwatr/session-storage';
|
|
9
11
|
export * from '@alwatr/page-ready';
|
|
10
12
|
export * from './lit-html.js';
|
|
11
|
-
export type * from '@alwatr/type-helper';
|
|
12
13
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 📦 @alwatr/flux v9.
|
|
2
|
-
export*from"@alwatr/signal";export*from"@alwatr/action";export*from"@alwatr/directive";export*from"@alwatr/embedded-data";export*from"@alwatr/keyboard-shortcut";export*from"@alwatr/render-state";export*from"@alwatr/local-storage";export*from"@alwatr/session-storage";export*from"@alwatr/page-ready";import{html as e,svg as
|
|
1
|
+
/* 📦 @alwatr/flux v9.29.0 */
|
|
2
|
+
export*from"@alwatr/signal";export*from"@alwatr/action";export*from"@alwatr/bind";export*from"@alwatr/directive";export*from"@alwatr/embedded-data";export*from"@alwatr/fsm";export*from"@alwatr/keyboard-shortcut";export*from"@alwatr/render-state";export*from"@alwatr/local-storage";export*from"@alwatr/session-storage";export*from"@alwatr/page-ready";import{html as e,svg as f,mathml as p,render as x,noChange as a,nothing as n}from"lit-html";import{unsafeSVG as m}from"lit-html/directives/unsafe-svg.js";import{ifDefined as i}from"lit-html/directives/if-defined.js";import{cache as b}from"lit-html/directives/cache.js";import{classMap as d}from"lit-html/directives/class-map.js";import{when as I}from"lit-html/directives/when.js";import{repeat as k}from"lit-html/directives/repeat.js";export{I as when,m as unsafeSVG,f as svg,k as repeat,x as render,n as nothing,a as noChange,p as mathml,i as ifDefined,e as html,d as classMap,b as cache};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=09E68C2A4C1329DF64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts", "../src/lit-html.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"// UI and reactive bundle — signals, actions, directives, and client-side storage.\n// This package aggregates all UI-layer nanolibs for convenient single-import usage.\n\nexport * from '@alwatr/signal';\nexport * from '@alwatr/action';\nexport * from '@alwatr/directive';\nexport * from '@alwatr/embedded-data';\nexport * from '@alwatr/keyboard-shortcut';\nexport * from '@alwatr/render-state';\nexport * from '@alwatr/local-storage';\nexport * from '@alwatr/session-storage';\nexport * from '@alwatr/page-ready';\nexport * from './lit-html.js';\
|
|
5
|
+
"// UI and reactive bundle — signals, actions, directives, and client-side storage.\n// This package aggregates all UI-layer nanolibs for convenient single-import usage.\n\nexport * from '@alwatr/signal';\nexport * from '@alwatr/action';\nexport * from '@alwatr/bind';\nexport * from '@alwatr/directive';\nexport * from '@alwatr/embedded-data';\nexport * from '@alwatr/fsm';\nexport * from '@alwatr/keyboard-shortcut';\nexport * from '@alwatr/render-state';\nexport * from '@alwatr/local-storage';\nexport * from '@alwatr/session-storage';\nexport * from '@alwatr/page-ready';\nexport * from './lit-html.js';\n",
|
|
6
6
|
"/**\n * Curated re-exports from `lit-html` for use within `@alwatr/flux`.\n *\n * Only the subset of `lit-html` APIs that are commonly needed in a Flux-based\n * application is exported here. This keeps the public surface minimal and\n * avoids pulling in advanced directive utilities that most consumers never use.\n *\n * **Exported APIs:**\n * - `html` — tagged template literal that produces a `TemplateResult`\n * - `render` — renders a `TemplateResult` into a DOM container\n * - `noChange` — sentinel that tells lit-html to leave the current part value unchanged\n * - `nothing` — sentinel that renders nothing (removes the node/attribute)\n * - `ifDefined` — renders a value only when it is not `undefined`\n * - `cache` — caches rendered templates to avoid re-parsing on state changes\n * - `classMap` — efficiently sets/removes CSS classes from an object map\n * - `when` — conditional rendering helper (`when(condition, trueCase, falseCase)`)\n *\n * @example\n * ```typescript\n * import {html, render, classMap, when} from '@alwatr/flux';\n *\n * const template = (isActive: boolean) => html`\n * <div class=${classMap({active: isActive, hidden: !isActive})}>\n * ${when(isActive, () => html`<span>Active</span>`, () => html`<span>Inactive</span>`)}\n * </div>\n * `;\n *\n * render(template(true), document.getElementById('app')!);\n * ```\n */\nexport {\n html,\n svg,\n mathml,\n render,\n noChange,\n nothing,\n type TemplateResult,\n type HTMLTemplateResult,\n type SVGTemplateResult,\n type MathMLTemplateResult,\n} from 'lit-html';\nexport {unsafeSVG} from 'lit-html/directives/unsafe-svg.js';\nexport {ifDefined} from 'lit-html/directives/if-defined.js';\nexport {cache} from 'lit-html/directives/cache.js';\nexport {classMap, type ClassInfo} from 'lit-html/directives/class-map.js';\nexport {when} from 'lit-html/directives/when.js';\nexport {repeat, type RepeatDirectiveFn, type KeyFn, type ItemTemplate} from 'lit-html/directives/repeat.js';\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";AAGA,4BACA,4BACA,+BACA,mCACA,uCACA,kCACA,mCACA,qCACA,
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AAGA,4BACA,4BACA,0BACA,+BACA,mCACA,yBACA,uCACA,kCACA,mCACA,qCACA,gCCiBA,eACE,SACA,YACA,YACA,cACA,aACA,iBAMF,oBAAQ,0CACR,oBAAQ,0CACR,gBAAQ,qCACR,mBAAQ,yCACR,eAAQ,oCACR,iBAAQ",
|
|
9
|
+
"debugId": "09E68C2A4C1329DF64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/flux",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.29.0",
|
|
4
4
|
"description": "UI and reactive library bundle for ECMAScript (JavaScript/TypeScript) projects — signals, actions, directives, and storage.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@alwatr/action": "9.
|
|
25
|
-
"@alwatr/
|
|
26
|
-
"@alwatr/
|
|
27
|
-
"@alwatr/
|
|
28
|
-
"@alwatr/
|
|
29
|
-
"@alwatr/
|
|
30
|
-
"@alwatr/
|
|
31
|
-
"@alwatr/
|
|
32
|
-
"@alwatr/
|
|
33
|
-
"@alwatr/
|
|
24
|
+
"@alwatr/action": "9.29.0",
|
|
25
|
+
"@alwatr/bind": "9.29.0",
|
|
26
|
+
"@alwatr/directive": "9.29.0",
|
|
27
|
+
"@alwatr/embedded-data": "9.29.0",
|
|
28
|
+
"@alwatr/fsm": "9.29.0",
|
|
29
|
+
"@alwatr/keyboard-shortcut": "9.29.0",
|
|
30
|
+
"@alwatr/local-storage": "9.29.0",
|
|
31
|
+
"@alwatr/page-ready": "9.29.0",
|
|
32
|
+
"@alwatr/render-state": "9.29.0",
|
|
33
|
+
"@alwatr/session-storage": "9.29.0",
|
|
34
|
+
"@alwatr/signal": "9.29.0",
|
|
34
35
|
"lit-html": "^3.3.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"ui",
|
|
85
86
|
"unidirectional-data-flow"
|
|
86
87
|
],
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "2f80c615d90e038dca634a2dfba8d900d3df6248"
|
|
88
89
|
}
|
package/src/main.ts
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
export * from '@alwatr/signal';
|
|
5
5
|
export * from '@alwatr/action';
|
|
6
|
+
export * from '@alwatr/bind';
|
|
6
7
|
export * from '@alwatr/directive';
|
|
7
8
|
export * from '@alwatr/embedded-data';
|
|
9
|
+
export * from '@alwatr/fsm';
|
|
8
10
|
export * from '@alwatr/keyboard-shortcut';
|
|
9
11
|
export * from '@alwatr/render-state';
|
|
10
12
|
export * from '@alwatr/local-storage';
|
|
11
13
|
export * from '@alwatr/session-storage';
|
|
12
14
|
export * from '@alwatr/page-ready';
|
|
13
15
|
export * from './lit-html.js';
|
|
14
|
-
export type * from '@alwatr/type-helper';
|