@alwatr/flux 9.24.0 → 9.26.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 CHANGED
@@ -308,7 +308,7 @@ import {createStateSignal} from '@alwatr/flux';
308
308
 
309
309
  const userSignal = createStateSignal<UserProfile | null>({
310
310
  name: 'user',
311
- initialValue: userProfile.value, // hydrated from DOM, no API call needed
311
+ initialValue: userProfile.instance, // hydrated from DOM, no API call needed
312
312
  });
313
313
  ```
314
314
 
@@ -752,16 +752,23 @@ setupActionDelegation([...DEFAULT_DELEGATED_EVENTS, 'keydown', 'focus']);
752
752
 
753
753
  #### `onAction<K>(type, handler)`
754
754
 
755
- Subscribes to a typed action. The handler receives the full `Action<K>` object.
755
+ Subscribes to a single typed action or an array of actions. The handler receives the full `Action<K>` object.
756
756
 
757
757
  ```typescript
758
+ // Subscribe to a single action
758
759
  const sub = onAction('ui_add_to_cart', (action) => {
759
760
  cartService.add(action.payload.productId, action.payload.qty);
760
761
  console.log(action.context); // e.g. 'product-list' or undefined
761
762
  console.log(action.meta); // any metadata set by modifiers
762
763
  });
763
764
 
765
+ // Subscribe to multiple actions with a single handler
766
+ const multiSub = onAction(['ui_increment', 'ui_decrement'], (action) => {
767
+ console.log('Action triggered:', action.type);
768
+ });
769
+
764
770
  sub.unsubscribe(); // Clean up when done
771
+ multiSub.unsubscribe();
765
772
  ```
766
773
 
767
774
  #### `dispatchAction<K>(action)`
@@ -1031,13 +1038,13 @@ const cartSignal = createStateSignal<CartState>({
1031
1038
  import {lazy} from '@alwatr/lazy';
1032
1039
  import {EmbeddedDataCollector} from '@alwatr/flux';
1033
1040
 
1034
- // Extraction is deferred until .value is first accessed
1041
+ // Extraction is deferred until .instance is first accessed
1035
1042
  export const serverConfig = lazy(() =>
1036
1043
  new EmbeddedDataCollector<ServerConfig>('data-server-config', isServerConfig).collect(),
1037
1044
  );
1038
1045
 
1039
1046
  // Somewhere in your bootstrap code:
1040
- const config = serverConfig.value; // extracted here, cached forever
1047
+ const config = serverConfig.instance; // extracted here, cached forever
1041
1048
  ```
1042
1049
 
1043
1050
  ---
package/dist/main.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from '@alwatr/signal';
2
2
  export * from '@alwatr/action';
3
3
  export * from '@alwatr/directive';
4
4
  export * from '@alwatr/embedded-data';
5
+ export * from '@alwatr/keyboard-shortcut';
5
6
  export * from '@alwatr/render-state';
6
7
  export * from '@alwatr/local-storage';
7
8
  export * from '@alwatr/session-storage';
@@ -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,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,mBAAmB,qBAAqB,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,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;AAC9B,mBAAmB,qBAAqB,CAAC"}
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
- /* 📦 @alwatr/flux v9.24.0 */
2
- export*from"@alwatr/signal";export*from"@alwatr/action";export*from"@alwatr/directive";export*from"@alwatr/embedded-data";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 a,mathml as p,render as f,noChange as n,nothing as t}from"lit-html";import{unsafeSVG as g}from"lit-html/directives/unsafe-svg.js";import{ifDefined as i}from"lit-html/directives/if-defined.js";import{cache as s}from"lit-html/directives/cache.js";import{classMap as b}from"lit-html/directives/class-map.js";import{when as d}from"lit-html/directives/when.js";import{repeat as I}from"lit-html/directives/repeat.js";export{d as when,g as unsafeSVG,a as svg,I as repeat,f as render,t as nothing,n as noChange,p as mathml,i as ifDefined,e as html,b as classMap,s as cache};
1
+ /* 📦 @alwatr/flux v9.26.0 */
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 p,mathml as a,render as f,noChange as t,nothing as n}from"lit-html";import{unsafeSVG as g}from"lit-html/directives/unsafe-svg.js";import{ifDefined as i}from"lit-html/directives/if-defined.js";import{cache as s}from"lit-html/directives/cache.js";import{classMap as b}from"lit-html/directives/class-map.js";import{when as d}from"lit-html/directives/when.js";import{repeat as I}from"lit-html/directives/repeat.js";export{d as when,g as unsafeSVG,p as svg,I as repeat,f as render,n as nothing,t as noChange,a as mathml,i as ifDefined,e as html,b as classMap,s as cache};
3
3
 
4
- //# debugId=AF2D31613C9029E164756E2164756E21
4
+ //# debugId=B53609D2635793FE64756E2164756E21
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/render-state';\nexport * from '@alwatr/local-storage';\nexport * from '@alwatr/session-storage';\nexport * from '@alwatr/page-ready';\nexport * from './lit-html.js';\nexport type * from '@alwatr/type-helper';\n",
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';\nexport type * from '@alwatr/type-helper';\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,kCACA,mCACA,qCACA,gCCoBA,eACE,SACA,YACA,YACA,cACA,aACA,iBAMF,oBAAQ,0CACR,oBAAQ,0CACR,gBAAQ,qCACR,mBAAQ,yCACR,eAAQ,oCACR,iBAAQ",
9
- "debugId": "AF2D31613C9029E164756E2164756E21",
8
+ "mappings": ";AAGA,4BACA,4BACA,+BACA,mCACA,uCACA,kCACA,mCACA,qCACA,gCCmBA,eACE,SACA,YACA,YACA,cACA,aACA,iBAMF,oBAAQ,0CACR,oBAAQ,0CACR,gBAAQ,qCACR,mBAAQ,yCACR,eAAQ,oCACR,iBAAQ",
9
+ "debugId": "B53609D2635793FE64756E2164756E21",
10
10
  "names": []
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwatr/flux",
3
- "version": "9.24.0",
3
+ "version": "9.26.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,19 +21,20 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@alwatr/action": "9.24.0",
25
- "@alwatr/directive": "9.24.0",
26
- "@alwatr/embedded-data": "9.24.0",
27
- "@alwatr/local-storage": "9.24.0",
28
- "@alwatr/page-ready": "9.24.0",
29
- "@alwatr/render-state": "9.24.0",
30
- "@alwatr/session-storage": "9.24.0",
31
- "@alwatr/signal": "9.24.0",
24
+ "@alwatr/action": "9.26.0",
25
+ "@alwatr/directive": "9.26.0",
26
+ "@alwatr/embedded-data": "9.25.0",
27
+ "@alwatr/keyboard-shortcut": "9.26.0",
28
+ "@alwatr/local-storage": "9.25.0",
29
+ "@alwatr/page-ready": "9.26.0",
30
+ "@alwatr/render-state": "9.25.0",
31
+ "@alwatr/session-storage": "9.25.0",
32
+ "@alwatr/signal": "9.26.0",
32
33
  "@alwatr/type-helper": "9.14.0",
33
34
  "lit-html": "^3.3.3"
34
35
  },
35
36
  "devDependencies": {
36
- "@alwatr/nano-build": "9.14.0",
37
+ "@alwatr/nano-build": "9.25.0",
37
38
  "@alwatr/standard": "9.16.0",
38
39
  "typescript": "^6.0.3"
39
40
  },
@@ -83,5 +84,5 @@
83
84
  "ui",
84
85
  "unidirectional-data-flow"
85
86
  ],
86
- "gitHead": "7953ae95627dcfcea72516a288560769c7d8fb06"
87
+ "gitHead": "ef62969b649929413c640e69d241f4e99d6062e8"
87
88
  }
package/src/main.ts CHANGED
@@ -5,6 +5,7 @@ export * from '@alwatr/signal';
5
5
  export * from '@alwatr/action';
6
6
  export * from '@alwatr/directive';
7
7
  export * from '@alwatr/embedded-data';
8
+ export * from '@alwatr/keyboard-shortcut';
8
9
  export * from '@alwatr/render-state';
9
10
  export * from '@alwatr/local-storage';
10
11
  export * from '@alwatr/session-storage';