@fluixi/reactive 1.0.0-alpha.83 → 1.0.0-alpha.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/cdn/reactive.cjs +2673 -1
  2. package/dist/cdn/reactive.global.js +2 -1
  3. package/dist/cdn/reactive.mjs +2657 -1
  4. package/dist/cdn/signal.cjs +299 -1
  5. package/dist/cdn/signal.d.ts +1 -1
  6. package/dist/cdn/signal.global.js +2 -1
  7. package/dist/cdn/signal.js +1 -1
  8. package/dist/cdn/signal.mjs +276 -1
  9. package/dist/index.cjs +2673 -1
  10. package/dist/index.mjs +2657 -1
  11. package/dist/lib/index.cjs +2674 -1
  12. package/dist/lib/index.js +1 -1
  13. package/dist/lib/index.mjs +2659 -1
  14. package/dist/lib/observable/index.cjs +386 -1
  15. package/dist/lib/observable/index.mjs +364 -1
  16. package/dist/lib/observable/observable.cjs +384 -1
  17. package/dist/lib/observable/observable.d.ts +0 -137
  18. package/dist/lib/observable/observable.d.ts.map +1 -1
  19. package/dist/lib/observable/observable.js +0 -71
  20. package/dist/lib/observable/observable.mjs +361 -1
  21. package/dist/lib/observable/subscription.cjs +180 -1
  22. package/dist/lib/observable/subscription.d.ts +0 -12
  23. package/dist/lib/observable/subscription.d.ts.map +1 -1
  24. package/dist/lib/observable/subscription.js +0 -12
  25. package/dist/lib/observable/subscription.mjs +157 -1
  26. package/dist/lib/observable/types.cjs +18 -1
  27. package/dist/lib/observable/types.d.ts.map +1 -1
  28. package/dist/lib/predicates.cjs +44 -1
  29. package/dist/lib/predicates.d.ts +2 -2
  30. package/dist/lib/predicates.js +2 -2
  31. package/dist/lib/predicates.mjs +23 -1
  32. package/dist/lib/signal/api.cjs +571 -1
  33. package/dist/lib/signal/api.d.ts +211 -1
  34. package/dist/lib/signal/api.d.ts.map +1 -1
  35. package/dist/lib/signal/api.js +207 -12
  36. package/dist/lib/signal/api.mjs +548 -1
  37. package/dist/lib/signal/cached-resource.cjs +672 -1
  38. package/dist/lib/signal/cached-resource.d.ts +28 -16
  39. package/dist/lib/signal/cached-resource.d.ts.map +1 -1
  40. package/dist/lib/signal/cached-resource.js +35 -29
  41. package/dist/lib/signal/cached-resource.mjs +650 -1
  42. package/dist/lib/signal/graph/children.cjs +325 -1
  43. package/dist/lib/signal/graph/children.js +1 -1
  44. package/dist/lib/signal/graph/children.mjs +302 -1
  45. package/dist/lib/signal/graph/compat.cjs +578 -1
  46. package/dist/lib/signal/graph/compat.d.ts +13 -13
  47. package/dist/lib/signal/graph/compat.d.ts.map +1 -1
  48. package/dist/lib/signal/graph/compat.js +33 -31
  49. package/dist/lib/signal/graph/compat.mjs +556 -1
  50. package/dist/lib/signal/graph/core.cjs +295 -1
  51. package/dist/lib/signal/graph/core.d.ts +28 -24
  52. package/dist/lib/signal/graph/core.d.ts.map +1 -1
  53. package/dist/lib/signal/graph/core.js +38 -31
  54. package/dist/lib/signal/graph/core.mjs +273 -1
  55. package/dist/lib/signal/graph/debounced.cjs +668 -1
  56. package/dist/lib/signal/graph/debounced.d.ts +5 -5
  57. package/dist/lib/signal/graph/debounced.d.ts.map +1 -1
  58. package/dist/lib/signal/graph/debounced.js +5 -5
  59. package/dist/lib/signal/graph/debounced.mjs +645 -1
  60. package/dist/lib/signal/graph/derived.cjs +496 -1
  61. package/dist/lib/signal/graph/derived.d.ts +1 -1
  62. package/dist/lib/signal/graph/derived.js +1 -1
  63. package/dist/lib/signal/graph/derived.mjs +473 -1
  64. package/dist/lib/signal/graph/detect.cjs +66 -1
  65. package/dist/lib/signal/graph/detect.mjs +45 -1
  66. package/dist/lib/signal/graph/error-boundary.cjs +301 -1
  67. package/dist/lib/signal/graph/error-boundary.js +3 -3
  68. package/dist/lib/signal/graph/error-boundary.mjs +278 -1
  69. package/dist/lib/signal/graph/index.cjs +305 -1
  70. package/dist/lib/signal/graph/index.d.ts +7 -6
  71. package/dist/lib/signal/graph/index.d.ts.map +1 -1
  72. package/dist/lib/signal/graph/index.js +7 -6
  73. package/dist/lib/signal/graph/index.mjs +283 -1
  74. package/dist/lib/signal/graph/observe.cjs +163 -1
  75. package/dist/lib/signal/graph/observe.d.ts +8 -8
  76. package/dist/lib/signal/graph/observe.js +5 -5
  77. package/dist/lib/signal/graph/observe.mjs +140 -1
  78. package/dist/lib/signal/graph/resource.cjs +620 -1
  79. package/dist/lib/signal/graph/resource.d.ts +1 -1
  80. package/dist/lib/signal/graph/resource.js +7 -8
  81. package/dist/lib/signal/graph/resource.mjs +597 -1
  82. package/dist/lib/signal/graph/runtime.cjs +501 -1
  83. package/dist/lib/signal/graph/runtime.d.ts +7 -7
  84. package/dist/lib/signal/graph/runtime.d.ts.map +1 -1
  85. package/dist/lib/signal/graph/runtime.js +34 -30
  86. package/dist/lib/signal/graph/runtime.mjs +478 -1
  87. package/dist/lib/signal/graph/signal-next.cjs +1208 -1
  88. package/dist/lib/signal/graph/signal-next.d.ts +5 -5
  89. package/dist/lib/signal/graph/signal-next.d.ts.map +1 -1
  90. package/dist/lib/signal/graph/signal-next.js +14 -12
  91. package/dist/lib/signal/graph/signal-next.mjs +1186 -1
  92. package/dist/lib/signal/graph/ssr-hooks.cjs +60 -1
  93. package/dist/lib/signal/graph/ssr-hooks.d.ts +6 -7
  94. package/dist/lib/signal/graph/ssr-hooks.d.ts.map +1 -1
  95. package/dist/lib/signal/graph/ssr-hooks.js +6 -7
  96. package/dist/lib/signal/graph/ssr-hooks.mjs +39 -1
  97. package/dist/lib/signal/graph/state.cjs +72 -1
  98. package/dist/lib/signal/graph/state.d.ts +41 -10
  99. package/dist/lib/signal/graph/state.d.ts.map +1 -1
  100. package/dist/lib/signal/graph/state.js +83 -22
  101. package/dist/lib/signal/graph/state.mjs +49 -1
  102. package/dist/lib/signal/graph/suspense.cjs +301 -1
  103. package/dist/lib/signal/graph/suspense.js +4 -4
  104. package/dist/lib/signal/graph/suspense.mjs +278 -1
  105. package/dist/lib/signal/index-legacy.cjs +2540 -1
  106. package/dist/lib/signal/index-legacy.d.ts +1 -1
  107. package/dist/lib/signal/index-legacy.js +1 -1
  108. package/dist/lib/signal/index-legacy.mjs +2518 -1
  109. package/dist/lib/signal/index.cjs +1275 -1
  110. package/dist/lib/signal/index.d.ts +3 -2
  111. package/dist/lib/signal/index.d.ts.map +1 -1
  112. package/dist/lib/signal/index.js +7 -4
  113. package/dist/lib/signal/index.mjs +1253 -1
  114. package/dist/lib/signal/list.cjs +549 -1
  115. package/dist/lib/signal/list.d.ts +5 -5
  116. package/dist/lib/signal/list.js +5 -5
  117. package/dist/lib/signal/list.mjs +526 -1
  118. package/dist/lib/signal/resource-api.cjs +626 -1
  119. package/dist/lib/signal/resource-api.d.ts +5 -5
  120. package/dist/lib/signal/resource-api.js +5 -5
  121. package/dist/lib/signal/resource-api.mjs +603 -1
  122. package/dist/lib/signal/signal.cjs +2023 -1
  123. package/dist/lib/signal/signal.d.ts +4 -4
  124. package/dist/lib/signal/signal.d.ts.map +1 -1
  125. package/dist/lib/signal/signal.js +22 -23
  126. package/dist/lib/signal/signal.mjs +2000 -1
  127. package/dist/lib/signal/types.cjs +38 -1
  128. package/dist/lib/signal/types.d.ts.map +1 -1
  129. package/dist/lib/signal/types.js +2 -2
  130. package/dist/lib/signal/types.mjs +17 -1
  131. package/dist/lib/signal/utilities.cjs +1012 -1
  132. package/dist/lib/signal/utilities.d.ts +0 -108
  133. package/dist/lib/signal/utilities.d.ts.map +1 -1
  134. package/dist/lib/signal/utilities.js +0 -158
  135. package/dist/lib/signal/utilities.mjs +990 -1
  136. package/dist/lib/store/api.cjs +612 -1
  137. package/dist/lib/store/api.d.ts +33 -0
  138. package/dist/lib/store/api.d.ts.map +1 -1
  139. package/dist/lib/store/api.js +41 -8
  140. package/dist/lib/store/api.mjs +596 -1
  141. package/dist/lib/store/index.cjs +691 -1
  142. package/dist/lib/store/index.js +1 -1
  143. package/dist/lib/store/index.mjs +676 -1
  144. package/dist/lib/store/setter.types.cjs +18 -1
  145. package/dist/lib/store/setter.types.d.ts +43 -3
  146. package/dist/lib/store/setter.types.d.ts.map +1 -1
  147. package/dist/lib/store/store.cjs +658 -1
  148. package/dist/lib/store/store.d.ts +72 -0
  149. package/dist/lib/store/store.d.ts.map +1 -1
  150. package/dist/lib/store/store.js +148 -5
  151. package/dist/lib/store/store.mjs +644 -1
  152. package/dist/lib/store/types.cjs +18 -1
  153. package/dist/lib/store/types.d.ts +1 -1
  154. package/dist/lib/store/types.d.ts.map +1 -1
  155. package/dist/lib/store/utils.cjs +43 -1
  156. package/dist/lib/store/utils.d.ts +1 -1
  157. package/dist/lib/store/utils.js +1 -1
  158. package/dist/lib/store/utils.mjs +22 -1
  159. package/dist/lib/subject.cjs +450 -1
  160. package/dist/lib/subject.js +3 -91
  161. package/dist/lib/subject.mjs +427 -1
  162. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  163. package/dist/version.generated.cjs +27 -1
  164. package/dist/version.generated.d.ts +1 -1
  165. package/dist/version.generated.js +2 -2
  166. package/dist/version.generated.mjs +7 -1
  167. package/package.json +5 -4
@@ -1 +1,60 @@
1
- "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var f=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of c(n))!v.call(e,r)&&r!==t&&i(e,r,{get:()=>n[r],enumerable:!(d=s(n,r))||d.enumerable});return e};var g=e=>p(i({},"__esModule",{value:!0}),e);var _={};f(_,{getServerData:()=>R,nextResourceId:()=>k,reportResourceData:()=>P,setResourceDataSink:()=>m,setResourceIdSource:()=>S,setResourceTracker:()=>x,setServerDataGetter:()=>D,trackResourcePromise:()=>y});module.exports=g(_);var u=null;function x(e){u=e}function y(e){u&&u(e)}var o=null;function D(e){o=e}function R(e){return o?o(e):void 0}var l=null;function S(e){l=e}function k(){return l?l():void 0}var a=null;function m(e){a=e}function P(e,n){a&&a(e,n)}
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/signal/graph/ssr-hooks.ts
21
+ var ssr_hooks_exports = {};
22
+ __export(ssr_hooks_exports, {
23
+ getServerData: () => getServerData,
24
+ nextResourceId: () => nextResourceId,
25
+ reportResourceData: () => reportResourceData,
26
+ setResourceDataSink: () => setResourceDataSink,
27
+ setResourceIdSource: () => setResourceIdSource,
28
+ setResourceTracker: () => setResourceTracker,
29
+ setServerDataGetter: () => setServerDataGetter,
30
+ trackResourcePromise: () => trackResourcePromise
31
+ });
32
+ module.exports = __toCommonJS(ssr_hooks_exports);
33
+ var _resourceTracker = null;
34
+ function setResourceTracker(fn) {
35
+ _resourceTracker = fn;
36
+ }
37
+ function trackResourcePromise(p) {
38
+ if (_resourceTracker) _resourceTracker(p);
39
+ }
40
+ var _serverDataGetter = null;
41
+ function setServerDataGetter(fn) {
42
+ _serverDataGetter = fn;
43
+ }
44
+ function getServerData(id) {
45
+ return _serverDataGetter ? _serverDataGetter(id) : void 0;
46
+ }
47
+ var _resourceIdSource = null;
48
+ function setResourceIdSource(fn) {
49
+ _resourceIdSource = fn;
50
+ }
51
+ function nextResourceId() {
52
+ return _resourceIdSource ? _resourceIdSource() : void 0;
53
+ }
54
+ var _resourceDataSink = null;
55
+ function setResourceDataSink(fn) {
56
+ _resourceDataSink = fn;
57
+ }
58
+ function reportResourceData(id, value) {
59
+ if (_resourceDataSink) _resourceDataSink(id, value);
60
+ }
@@ -1,28 +1,27 @@
1
1
  /**
2
- * SSR resource injectables graph-agnostic module state. The server (@fluixi/server
2
+ * SSR resource injectables: graph-agnostic module state. The server (@fluixi/server
3
3
  * via @fluixi/dom) injects these so async SSR can await in-flight resource fetches and
4
- * seed resources from server-serialized data on the client. All no-ops when unset
5
- * zero client/runtime impact. Used by both the TC39 resource core and the legacy graph,
4
+ * seed resources from server-serialized data on the client. All no-ops when unset -> * zero client/runtime impact. Used by both the TC39 resource core and the legacy graph,
6
5
  * so they live in a TC39-owned module (not signal.ts, which is being retired).
7
6
  */
8
7
  /** Register a sink that receives every resource fetch promise (server: collect & await). */
9
8
  export declare function setResourceTracker(fn: ((p: Promise<any>) => void) | null): void;
10
- /** @internal resources report their fetch promise here. */
9
+ /** @internal: resources report their fetch promise here. */
11
10
  export declare function trackResourcePromise(p: Promise<any>): void;
12
11
  /** Inject server-serialized resource data (client hydration: seed without refetch). */
13
12
  export declare function setServerDataGetter(fn: ((id: string) => {
14
13
  value: any;
15
14
  } | undefined) | null): void;
16
- /** @internal resources look up seeded data by their SSR id. */
15
+ /** @internal: resources look up seeded data by their SSR id. */
17
16
  export declare function getServerData(id: string): {
18
17
  value: any;
19
18
  } | undefined;
20
19
  /** Inject a stable per-resource id source (server render order / hydration order). */
21
20
  export declare function setResourceIdSource(fn: (() => string) | null): void;
22
- /** @internal a resource asks for its SSR id at creation; undefined on a plain client. */
21
+ /** @internal, a resource asks for its SSR id at creation; undefined on a plain client. */
23
22
  export declare function nextResourceId(): string | undefined;
24
23
  /** Inject a sink for resolved resource values (server: collect for serialization). */
25
24
  export declare function setResourceDataSink(fn: ((id: string, value: any) => void) | null): void;
26
- /** @internal a resource reports its resolved value here. */
25
+ /** @internal, a resource reports its resolved value here. */
27
26
  export declare function reportResourceData(id: string, value: any): void;
28
27
  //# sourceMappingURL=ssr-hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ssr-hooks.d.ts","sourceRoot":"","sources":["../../../../src/lib/signal/graph/ssr-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAE/E;AACD,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAE1D;AAGD,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,CAEjG;AACD,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,GAAG,SAAS,CAEpE;AAGD,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAEnE;AACD,2FAA2F;AAC3F,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAGD,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAEvF;AACD,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAE/D"}
1
+ {"version":3,"file":"ssr-hooks.d.ts","sourceRoot":"","sources":["../../../../src/lib/signal/graph/ssr-hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAE/E;AACD,4DAA4D;AAC5D,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAE1D;AAGD,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,CAEjG;AACD,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,GAAG,CAAA;CAAE,GAAG,SAAS,CAEpE;AAGD,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAEnE;AACD,0FAA0F;AAC1F,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAGD,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAEvF;AACD,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAE/D"}
@@ -1,8 +1,7 @@
1
1
  /**
2
- * SSR resource injectables graph-agnostic module state. The server (@fluixi/server
2
+ * SSR resource injectables: graph-agnostic module state. The server (@fluixi/server
3
3
  * via @fluixi/dom) injects these so async SSR can await in-flight resource fetches and
4
- * seed resources from server-serialized data on the client. All no-ops when unset
5
- * zero client/runtime impact. Used by both the TC39 resource core and the legacy graph,
4
+ * seed resources from server-serialized data on the client. All no-ops when unset -> * zero client/runtime impact. Used by both the TC39 resource core and the legacy graph,
6
5
  * so they live in a TC39-owned module (not signal.ts, which is being retired).
7
6
  */
8
7
  let _resourceTracker = null;
@@ -10,7 +9,7 @@ let _resourceTracker = null;
10
9
  export function setResourceTracker(fn) {
11
10
  _resourceTracker = fn;
12
11
  }
13
- /** @internal resources report their fetch promise here. */
12
+ /** @internal: resources report their fetch promise here. */
14
13
  export function trackResourcePromise(p) {
15
14
  if (_resourceTracker)
16
15
  _resourceTracker(p);
@@ -20,7 +19,7 @@ let _serverDataGetter = null;
20
19
  export function setServerDataGetter(fn) {
21
20
  _serverDataGetter = fn;
22
21
  }
23
- /** @internal resources look up seeded data by their SSR id. */
22
+ /** @internal: resources look up seeded data by their SSR id. */
24
23
  export function getServerData(id) {
25
24
  return _serverDataGetter ? _serverDataGetter(id) : undefined;
26
25
  }
@@ -29,7 +28,7 @@ let _resourceIdSource = null;
29
28
  export function setResourceIdSource(fn) {
30
29
  _resourceIdSource = fn;
31
30
  }
32
- /** @internal a resource asks for its SSR id at creation; undefined on a plain client. */
31
+ /** @internal, a resource asks for its SSR id at creation; undefined on a plain client. */
33
32
  export function nextResourceId() {
34
33
  return _resourceIdSource ? _resourceIdSource() : undefined;
35
34
  }
@@ -38,7 +37,7 @@ let _resourceDataSink = null;
38
37
  export function setResourceDataSink(fn) {
39
38
  _resourceDataSink = fn;
40
39
  }
41
- /** @internal a resource reports its resolved value here. */
40
+ /** @internal, a resource reports its resolved value here. */
42
41
  export function reportResourceData(id, value) {
43
42
  if (_resourceDataSink)
44
43
  _resourceDataSink(id, value);
@@ -1 +1,39 @@
1
- var n=null;function o(e){n=e}function l(e){n&&n(e)}var r=null;function a(e){r=e}function d(e){return r?r(e):void 0}var t=null;function s(e){t=e}function c(){return t?t():void 0}var i=null;function v(e){i=e}function f(e,u){i&&i(e,u)}export{d as getServerData,c as nextResourceId,f as reportResourceData,v as setResourceDataSink,s as setResourceIdSource,o as setResourceTracker,a as setServerDataGetter,l as trackResourcePromise};
1
+ // src/lib/signal/graph/ssr-hooks.ts
2
+ var _resourceTracker = null;
3
+ function setResourceTracker(fn) {
4
+ _resourceTracker = fn;
5
+ }
6
+ function trackResourcePromise(p) {
7
+ if (_resourceTracker) _resourceTracker(p);
8
+ }
9
+ var _serverDataGetter = null;
10
+ function setServerDataGetter(fn) {
11
+ _serverDataGetter = fn;
12
+ }
13
+ function getServerData(id) {
14
+ return _serverDataGetter ? _serverDataGetter(id) : void 0;
15
+ }
16
+ var _resourceIdSource = null;
17
+ function setResourceIdSource(fn) {
18
+ _resourceIdSource = fn;
19
+ }
20
+ function nextResourceId() {
21
+ return _resourceIdSource ? _resourceIdSource() : void 0;
22
+ }
23
+ var _resourceDataSink = null;
24
+ function setResourceDataSink(fn) {
25
+ _resourceDataSink = fn;
26
+ }
27
+ function reportResourceData(id, value) {
28
+ if (_resourceDataSink) _resourceDataSink(id, value);
29
+ }
30
+ export {
31
+ getServerData,
32
+ nextResourceId,
33
+ reportResourceData,
34
+ setResourceDataSink,
35
+ setResourceIdSource,
36
+ setResourceTracker,
37
+ setServerDataGetter,
38
+ trackResourcePromise
39
+ };
@@ -1 +1,72 @@
1
- "use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var i=(e,o)=>{for(var l in o)r(e,l,{get:o[l],enumerable:!0})},d=(e,o,l,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of s(o))!t.call(e,n)&&n!==l&&r(e,n,{get:()=>o[n],enumerable:!(u=a(o,n))||u.enumerable});return e};var c=e=>d(r({},"__esModule",{value:!0}),e);var p={};i(p,{G:()=>f});module.exports=c(p);var h="__fluixi_signal_next_state__",b=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},f=globalThis[h]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:b,onSuspend:null,onError:null,observer:null};
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/signal/graph/state.ts
21
+ var state_exports = {};
22
+ __export(state_exports, {
23
+ G: () => G,
24
+ backfillState: () => backfillState,
25
+ joinedVersions: () => joinedVersions
26
+ });
27
+ module.exports = __toCommonJS(state_exports);
28
+
29
+ // src/version.generated.ts
30
+ var VERSION = "1.0.0-alpha.84";
31
+
32
+ // src/lib/signal/graph/state.ts
33
+ var MAJOR = VERSION.split(".")[0];
34
+ var KEY = `__fluixi_signal_state_v${MAJOR}__`;
35
+ var VERSIONS_KEY = `__fluixi_signal_builds_v${MAJOR}__`;
36
+ var defaultSchedule = (run) => {
37
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
38
+ else void Promise.resolve().then(run);
39
+ };
40
+ function defaults() {
41
+ return {
42
+ consumer: null,
43
+ untracked: false,
44
+ owner: null,
45
+ queue: [],
46
+ scheduled: false,
47
+ flushing: false,
48
+ batchDepth: 0,
49
+ hostSchedule: defaultSchedule,
50
+ onSuspend: null,
51
+ onError: null,
52
+ observer: null
53
+ };
54
+ }
55
+ var realm = globalThis;
56
+ function backfillState(existing) {
57
+ const fresh = defaults();
58
+ const target = existing;
59
+ for (const field of Object.keys(fresh)) {
60
+ if (!(field in existing)) target[field] = fresh[field];
61
+ }
62
+ return existing;
63
+ }
64
+ function claim() {
65
+ const existing = realm[KEY];
66
+ return existing ? backfillState(existing) : realm[KEY] = defaults();
67
+ }
68
+ var G = claim();
69
+ (realm[VERSIONS_KEY] ??= []).push(VERSION);
70
+ function joinedVersions() {
71
+ return [...new Set(realm[VERSIONS_KEY] ?? [])];
72
+ }
@@ -1,21 +1,32 @@
1
1
  /**
2
- * The reactive graph's mutable state, kept as a SINGLE object cached on globalThis.
2
+ * The reactive graph's mutable state, kept as a single object cached on globalThis.
3
3
  *
4
- * Why: tracking/scheduling reads module-global state ("who's the current consumer?",
4
+ * Why, tracking/scheduling reads module-global state ("who's the current consumer?",
5
5
  * "what owner are we under?", "the effect queue"). If a production bundle emits more
6
- * than one copy of this module (a common cross-package hazard see @fluixi/dom's
7
- * integration bridge), plain `let`s would be DUPLICATED: an effect would set copy A's
8
- * consumer while a signal read checks copy B's no subscription reactivity silently
6
+ * than one copy of this module (a common cross-package hazard: see @fluixi/dom's
7
+ * integration bridge), plain `let`s would be duplicated: an effect would set copy A's
8
+ * consumer while a signal read checks copy B's -> no subscription -> reactivity silently
9
9
  * lost (works in dev, breaks in prod). Caching the state on globalThis means every copy
10
- * of this module reads/writes the SAME object, so the graph stays unified no matter how
11
- * many times the module is bundled no integration bridge required.
10
+ * of this module reads/writes the same object, so the graph stays unified no matter how
11
+ * many times the module is bundled, no integration bridge required.
12
12
  *
13
13
  * This is strictly more robust than SolidJS, which keeps this state in module `let`s and
14
14
  * relies on dedup + a "multiple instances" warning. Node-ref fields are loosely typed
15
15
  * (`any`) to avoid import cycles with core.ts/runtime.ts; the public API stays fully typed.
16
+ *
17
+ * Sharing is deliberate, and a standalone web component makes it load-bearing: several
18
+ * independent bundles can land on one page, each carrying its own copy of this module, and they
19
+ * have to end up on one graph or an effect in one will not see a signal from another.
20
+ *
21
+ * Two consequences that the original `??=` got wrong once more than one version is in play.
22
+ * The first copy to run used to define the whole object, so a field added in a later
23
+ * release stayed absent for every copy, including the one that expected it. Fields are
24
+ * backfilled now instead. And nothing recorded which builds had joined, so a genuine
25
+ * mismatch was invisible; `joinedVersions()` reports it, and @fluixi/dom's version-skew
26
+ * warning is where that surfaces.
16
27
  */
17
28
  export interface GraphState {
18
- /** The computation currently evaluating reads inside it subscribe to it. */
29
+ /** The computation currently evaluating: reads inside it subscribe to it. */
19
30
  consumer: any;
20
31
  /** When true, reads don't subscribe (untrack / peek). */
21
32
  untracked: boolean;
@@ -27,13 +38,23 @@ export interface GraphState {
27
38
  disposed: boolean;
28
39
  run(): void;
29
40
  }>;
30
- /** A flush has been scheduled (microtask) but not yet run. */
41
+ /**
42
+ * Effects are queued and a flush is pending.
43
+ *
44
+ * Not a microtask on the shipped path: `compat.ts` installs a no-op host scheduler
45
+ * and flushes explicitly after a write, so this says a drain is owed rather than
46
+ * that one is booked.
47
+ */
31
48
  scheduled: boolean;
32
49
  /** A flush is in progress (re-entrancy guard). */
33
50
  flushing: boolean;
34
51
  /** Depth of active batch() calls; >0 defers flushing. */
35
52
  batchDepth: number;
36
- /** Host scheduler for the deferred flush (overridable: SSR/tests/compat). */
53
+ /**
54
+ * How a pending drain gets run. `compat.ts` sets it to a no-op because it owns the
55
+ * flush points itself; `setScheduler(null)` restores the microtask default. SSR and
56
+ * tests override it too.
57
+ */
37
58
  hostSchedule: (run: () => void) => void;
38
59
  /** Boundary hooks (injected by the Suspense / error-boundary layers). */
39
60
  onSuspend: ((promise: Promise<unknown>, owner: any) => void) | null;
@@ -41,5 +62,15 @@ export interface GraphState {
41
62
  /** A tool watching the graph (see observe.ts). Here for the same reason the rest is. */
42
63
  observer: any;
43
64
  }
65
+ /**
66
+ * Add any field this release reads that an earlier copy never created.
67
+ *
68
+ * `in` rather than `??`, so a field whose default is null is not rewritten every time
69
+ * another copy loads. Mutates and returns the object it was given, because the whole
70
+ * point is that every copy keeps pointing at the same one.
71
+ */
72
+ export declare function backfillState(existing: GraphState): GraphState;
44
73
  export declare const G: GraphState;
74
+ /** Every `@fluixi/reactive` build that has joined the shared graph, deduplicated. */
75
+ export declare function joinedVersions(): string[];
45
76
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/lib/signal/graph/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,UAAU;IACzB,8EAA8E;IAE9E,QAAQ,EAAE,GAAG,CAAC;IACd,yDAAyD;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAE5D,KAAK,EAAE,GAAG,CAAC;IACX,sCAAsC;IACtC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,GAAG,IAAI,IAAI,CAAA;KAAE,CAAC,CAAC;IAClE,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxC,yEAAyE;IAEzE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1D,wFAAwF;IAExF,QAAQ,EAAE,GAAG,CAAC;CACf;AASD,eAAO,MAAM,CAAC,EAAE,UAcS,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/lib/signal/graph/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAE7E,QAAQ,EAAE,GAAG,CAAC;IACd,yDAAyD;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAE5D,KAAK,EAAE,GAAG,CAAC;IACX,sCAAsC;IACtC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,GAAG,IAAI,IAAI,CAAA;KAAE,CAAC,CAAC;IAClE;;;;;;OAMG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxC,yEAAyE;IAEzE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1D,wFAAwF;IAExF,QAAQ,EAAE,GAAG,CAAC;CACf;AA6CD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU,CAO9D;AAOD,eAAO,MAAM,CAAC,EAAE,UAAoB,CAAC;AAQrC,qFAAqF;AACrF,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC"}
@@ -1,38 +1,99 @@
1
1
  /**
2
- * The reactive graph's mutable state, kept as a SINGLE object cached on globalThis.
2
+ * The reactive graph's mutable state, kept as a single object cached on globalThis.
3
3
  *
4
- * Why: tracking/scheduling reads module-global state ("who's the current consumer?",
4
+ * Why, tracking/scheduling reads module-global state ("who's the current consumer?",
5
5
  * "what owner are we under?", "the effect queue"). If a production bundle emits more
6
- * than one copy of this module (a common cross-package hazard see @fluixi/dom's
7
- * integration bridge), plain `let`s would be DUPLICATED: an effect would set copy A's
8
- * consumer while a signal read checks copy B's no subscription reactivity silently
6
+ * than one copy of this module (a common cross-package hazard: see @fluixi/dom's
7
+ * integration bridge), plain `let`s would be duplicated: an effect would set copy A's
8
+ * consumer while a signal read checks copy B's -> no subscription -> reactivity silently
9
9
  * lost (works in dev, breaks in prod). Caching the state on globalThis means every copy
10
- * of this module reads/writes the SAME object, so the graph stays unified no matter how
11
- * many times the module is bundled no integration bridge required.
10
+ * of this module reads/writes the same object, so the graph stays unified no matter how
11
+ * many times the module is bundled, no integration bridge required.
12
12
  *
13
13
  * This is strictly more robust than SolidJS, which keeps this state in module `let`s and
14
14
  * relies on dedup + a "multiple instances" warning. Node-ref fields are loosely typed
15
15
  * (`any`) to avoid import cycles with core.ts/runtime.ts; the public API stays fully typed.
16
+ *
17
+ * Sharing is deliberate, and a standalone web component makes it load-bearing: several
18
+ * independent bundles can land on one page, each carrying its own copy of this module, and they
19
+ * have to end up on one graph or an effect in one will not see a signal from another.
20
+ *
21
+ * Two consequences that the original `??=` got wrong once more than one version is in play.
22
+ * The first copy to run used to define the whole object, so a field added in a later
23
+ * release stayed absent for every copy, including the one that expected it. Fields are
24
+ * backfilled now instead. And nothing recorded which builds had joined, so a genuine
25
+ * mismatch was invisible; `joinedVersions()` reports it, and @fluixi/dom's version-skew
26
+ * warning is where that surfaces.
27
+ */
28
+ import { VERSION } from '../../../version.generated.js';
29
+ /**
30
+ * The graph is shared per major version.
31
+ *
32
+ * Copies of one major share it, which is the point: several bundles on a page each carry
33
+ * their own copy of this module, and an effect in one has to see a signal from another.
34
+ * Fields are backfilled below so a copy from a later release finds what it expects.
35
+ *
36
+ * A different major gets its own graph instead. Within a major the state shape only
37
+ * grows, so backfilling is enough; across one it can change meaning, and sharing then
38
+ * means the older copy's semantics silently win for everybody. Two isolated graphs on a
39
+ * page is a visible problem. One graph running two sets of rules is not.
40
+ *
41
+ * Derived from the package version rather than written by hand, so it cannot be
42
+ * forgotten at a major bump.
16
43
  */
17
- const KEY = '__fluixi_signal_next_state__';
44
+ const MAJOR = VERSION.split('.')[0];
45
+ const KEY = `__fluixi_signal_state_v${MAJOR}__`;
46
+ const VERSIONS_KEY = `__fluixi_signal_builds_v${MAJOR}__`;
18
47
  const defaultSchedule = (run) => {
19
48
  if (typeof queueMicrotask === 'function')
20
49
  queueMicrotask(run);
21
50
  else
22
51
  void Promise.resolve().then(run);
23
52
  };
24
- export const G =
53
+ function defaults() {
54
+ return {
55
+ consumer: null,
56
+ untracked: false,
57
+ owner: null,
58
+ queue: [],
59
+ scheduled: false,
60
+ flushing: false,
61
+ batchDepth: 0,
62
+ hostSchedule: defaultSchedule,
63
+ onSuspend: null,
64
+ onError: null,
65
+ observer: null,
66
+ };
67
+ }
25
68
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- (globalThis[KEY] ??= {
27
- consumer: null,
28
- untracked: false,
29
- owner: null,
30
- queue: [],
31
- scheduled: false,
32
- flushing: false,
33
- batchDepth: 0,
34
- hostSchedule: defaultSchedule,
35
- onSuspend: null,
36
- onError: null,
37
- observer: null,
38
- });
69
+ const realm = globalThis;
70
+ /**
71
+ * Add any field this release reads that an earlier copy never created.
72
+ *
73
+ * `in` rather than `??`, so a field whose default is null is not rewritten every time
74
+ * another copy loads. Mutates and returns the object it was given, because the whole
75
+ * point is that every copy keeps pointing at the same one.
76
+ */
77
+ export function backfillState(existing) {
78
+ const fresh = defaults();
79
+ const target = existing;
80
+ for (const field of Object.keys(fresh)) {
81
+ if (!(field in existing))
82
+ target[field] = fresh[field];
83
+ }
84
+ return existing;
85
+ }
86
+ function claim() {
87
+ const existing = realm[KEY];
88
+ return existing ? backfillState(existing) : (realm[KEY] = defaults());
89
+ }
90
+ export const G = claim();
91
+ // Which builds of this module reached the shared graph, in the order they loaded.
92
+ // One entry is the normal case. More than one distinct version means two releases are
93
+ // driving the same graph, which is worth saying out loud but not worth refusing: the
94
+ // alternative is a page where half the components are inert.
95
+ (realm[VERSIONS_KEY] ??= []).push(VERSION);
96
+ /** Every `@fluixi/reactive` build that has joined the shared graph, deduplicated. */
97
+ export function joinedVersions() {
98
+ return [...new Set((realm[VERSIONS_KEY] ?? []))];
99
+ }
@@ -1 +1,49 @@
1
- var o="__fluixi_signal_next_state__",n=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[o]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:n,onSuspend:null,onError:null,observer:null};export{l as G};
1
+ // src/version.generated.ts
2
+ var VERSION = "1.0.0-alpha.84";
3
+
4
+ // src/lib/signal/graph/state.ts
5
+ var MAJOR = VERSION.split(".")[0];
6
+ var KEY = `__fluixi_signal_state_v${MAJOR}__`;
7
+ var VERSIONS_KEY = `__fluixi_signal_builds_v${MAJOR}__`;
8
+ var defaultSchedule = (run) => {
9
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
10
+ else void Promise.resolve().then(run);
11
+ };
12
+ function defaults() {
13
+ return {
14
+ consumer: null,
15
+ untracked: false,
16
+ owner: null,
17
+ queue: [],
18
+ scheduled: false,
19
+ flushing: false,
20
+ batchDepth: 0,
21
+ hostSchedule: defaultSchedule,
22
+ onSuspend: null,
23
+ onError: null,
24
+ observer: null
25
+ };
26
+ }
27
+ var realm = globalThis;
28
+ function backfillState(existing) {
29
+ const fresh = defaults();
30
+ const target = existing;
31
+ for (const field of Object.keys(fresh)) {
32
+ if (!(field in existing)) target[field] = fresh[field];
33
+ }
34
+ return existing;
35
+ }
36
+ function claim() {
37
+ const existing = realm[KEY];
38
+ return existing ? backfillState(existing) : realm[KEY] = defaults();
39
+ }
40
+ var G = claim();
41
+ (realm[VERSIONS_KEY] ??= []).push(VERSION);
42
+ function joinedVersions() {
43
+ return [...new Set(realm[VERSIONS_KEY] ?? [])];
44
+ }
45
+ export {
46
+ G,
47
+ backfillState,
48
+ joinedVersions
49
+ };