@solidjs/signals 2.0.0-rc.1 → 2.0.0-rc.11

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 (150) hide show
  1. package/dist/dev-shared.js +7155 -0
  2. package/dist/dev.attribution.js +3307 -0
  3. package/dist/dev.js +5765 -4496
  4. package/dist/observe/affects.js +129 -0
  5. package/dist/observe/attribution.js +7 -0
  6. package/dist/observe/boundaries.js +793 -0
  7. package/dist/observe/core/action.js +177 -0
  8. package/dist/observe/core/async.js +849 -0
  9. package/dist/observe/core/attribution-costs.js +66 -0
  10. package/dist/observe/core/attribution-feedback.js +280 -0
  11. package/dist/observe/core/attribution-hooks.js +83 -0
  12. package/dist/observe/core/attribution-queries.js +43 -0
  13. package/dist/observe/core/attribution.js +2904 -0
  14. package/dist/observe/core/constants.js +283 -0
  15. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  16. package/dist/observe/core/core.js +1999 -0
  17. package/dist/observe/core/dev.js +343 -0
  18. package/dist/observe/core/effect.js +200 -0
  19. package/dist/observe/core/error-hooks.js +71 -0
  20. package/dist/observe/core/error.js +80 -0
  21. package/dist/observe/core/external.js +98 -0
  22. package/dist/observe/core/graph.js +155 -0
  23. package/dist/observe/core/heap.js +147 -0
  24. package/dist/observe/core/invariants.js +45 -0
  25. package/dist/observe/core/lanes.js +205 -0
  26. package/dist/observe/core/optimistic.js +669 -0
  27. package/dist/observe/core/owner.js +353 -0
  28. package/dist/observe/core/scheduler.js +1561 -0
  29. package/dist/observe/core/verdict.js +674 -0
  30. package/dist/observe/index.js +59 -0
  31. package/dist/observe/map.js +507 -0
  32. package/dist/observe/signals.js +731 -0
  33. package/dist/observe/store/index.js +44 -0
  34. package/dist/observe/store/next/optimistic.js +717 -0
  35. package/dist/observe/store/next/projection.js +266 -0
  36. package/dist/observe/store/next/reconcile.js +375 -0
  37. package/dist/observe/store/next/store.js +2480 -0
  38. package/dist/observe/store/next/target.js +51 -0
  39. package/dist/observe/store/store.js +331 -0
  40. package/dist/observe/store/storePath.js +103 -0
  41. package/dist/observe/store/utils.js +1070 -0
  42. package/dist/prod/affects.js +10 -9
  43. package/dist/prod/attribution.js +45 -0
  44. package/dist/prod/boundaries.js +388 -178
  45. package/dist/prod/core/action.js +65 -37
  46. package/dist/prod/core/async.js +378 -163
  47. package/dist/prod/core/attribution-hooks.js +3 -0
  48. package/dist/prod/core/constants.js +186 -1
  49. package/dist/prod/core/context.js +10 -16
  50. package/dist/prod/core/core.js +1546 -416
  51. package/dist/prod/core/dev.js +18 -1
  52. package/dist/prod/core/effect.js +119 -79
  53. package/dist/prod/core/error-hooks.js +71 -0
  54. package/dist/prod/core/error.js +13 -1
  55. package/dist/prod/core/external.js +4 -4
  56. package/dist/prod/core/graph.js +105 -54
  57. package/dist/prod/core/heap.js +72 -65
  58. package/dist/prod/core/invariants.js +3 -2
  59. package/dist/prod/core/lanes.js +117 -52
  60. package/dist/prod/core/optimistic.js +500 -104
  61. package/dist/prod/core/owner.js +131 -84
  62. package/dist/prod/core/scheduler.js +1012 -241
  63. package/dist/prod/core/verdict.js +417 -112
  64. package/dist/prod/index.js +20 -8
  65. package/dist/prod/map.js +355 -171
  66. package/dist/prod/signals.js +363 -32
  67. package/dist/prod/store/index.js +2 -0
  68. package/dist/prod/store/next/optimistic.js +530 -197
  69. package/dist/prod/store/next/projection.js +142 -57
  70. package/dist/prod/store/next/reconcile.js +149 -103
  71. package/dist/prod/store/next/store.js +1470 -346
  72. package/dist/prod/store/next/target.js +40 -9
  73. package/dist/prod/store/store.js +23 -19
  74. package/dist/prod/store/utils.js +997 -130
  75. package/dist/types/attribution.d.ts +19 -0
  76. package/dist/types/attribution.prod.d.ts +22 -0
  77. package/dist/types/boundaries.d.ts +78 -5
  78. package/dist/types/core/action.d.ts +12 -5
  79. package/dist/types/core/async.d.ts +3 -1
  80. package/dist/types/core/attribution-costs.d.ts +35 -0
  81. package/dist/types/core/attribution-feedback.d.ts +133 -0
  82. package/dist/types/core/attribution-hooks.d.ts +304 -0
  83. package/dist/types/core/attribution-queries.d.ts +24 -0
  84. package/dist/types/core/attribution.d.ts +892 -0
  85. package/dist/types/core/constants.d.ts +179 -0
  86. package/dist/types/core/core.d.ts +299 -25
  87. package/dist/types/core/dev.d.ts +421 -8
  88. package/dist/types/core/effect.d.ts +8 -1
  89. package/dist/types/core/error-hooks.d.ts +71 -0
  90. package/dist/types/core/error.d.ts +9 -0
  91. package/dist/types/core/graph.d.ts +23 -0
  92. package/dist/types/core/heap.d.ts +5 -3
  93. package/dist/types/core/index.d.ts +6 -3
  94. package/dist/types/core/invariants.d.ts +5 -1
  95. package/dist/types/core/lanes.d.ts +51 -19
  96. package/dist/types/core/owner.d.ts +15 -3
  97. package/dist/types/core/scheduler.d.ts +252 -1
  98. package/dist/types/core/types.d.ts +124 -41
  99. package/dist/types/index.d.ts +18 -5
  100. package/dist/types/map.d.ts +2 -0
  101. package/dist/types/signals.d.ts +145 -13
  102. package/dist/types/store/index.d.ts +7 -6
  103. package/dist/types/store/next/optimistic.d.ts +18 -13
  104. package/dist/types/store/next/projection.d.ts +5 -2
  105. package/dist/types/store/next/reconcile.d.ts +7 -0
  106. package/dist/types/store/next/store.d.ts +83 -11
  107. package/dist/types/store/next/target.d.ts +108 -11
  108. package/dist/types/store/store.d.ts +20 -11
  109. package/dist/types/store/utils.d.ts +188 -0
  110. package/package.json +31 -26
  111. package/dist/node.cjs +0 -8137
  112. package/dist/types/store/optimistic.d.ts +0 -45
  113. package/dist/types/store/projection.d.ts +0 -70
  114. package/dist/types/store/reconcile.d.ts +0 -46
  115. package/dist/types-cjs/affects.d.cts +0 -47
  116. package/dist/types-cjs/boundaries.d.cts +0 -175
  117. package/dist/types-cjs/core/action.d.cts +0 -64
  118. package/dist/types-cjs/core/async.d.cts +0 -21
  119. package/dist/types-cjs/core/constants.d.cts +0 -71
  120. package/dist/types-cjs/core/core.d.cts +0 -156
  121. package/dist/types-cjs/core/dev.d.cts +0 -64
  122. package/dist/types-cjs/core/effect.d.cts +0 -30
  123. package/dist/types-cjs/core/error.d.cts +0 -47
  124. package/dist/types-cjs/core/external.d.cts +0 -15
  125. package/dist/types-cjs/core/graph.d.cts +0 -5
  126. package/dist/types-cjs/core/heap.d.cts +0 -22
  127. package/dist/types-cjs/core/index.d.cts +0 -13
  128. package/dist/types-cjs/core/invariants.d.cts +0 -59
  129. package/dist/types-cjs/core/lanes.d.cts +0 -56
  130. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  131. package/dist/types-cjs/core/owner.d.cts +0 -124
  132. package/dist/types-cjs/core/scheduler.d.cts +0 -172
  133. package/dist/types-cjs/core/types.d.cts +0 -148
  134. package/dist/types-cjs/core/verdict.d.cts +0 -2
  135. package/dist/types-cjs/index.d.cts +0 -10
  136. package/dist/types-cjs/map.d.cts +0 -69
  137. package/dist/types-cjs/package.json +0 -3
  138. package/dist/types-cjs/signals.d.cts +0 -624
  139. package/dist/types-cjs/store/index.d.cts +0 -19
  140. package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
  141. package/dist/types-cjs/store/next/projection.d.cts +0 -24
  142. package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
  143. package/dist/types-cjs/store/next/store.d.cts +0 -71
  144. package/dist/types-cjs/store/next/target.d.cts +0 -99
  145. package/dist/types-cjs/store/optimistic.d.cts +0 -45
  146. package/dist/types-cjs/store/projection.d.cts +0 -70
  147. package/dist/types-cjs/store/reconcile.d.cts +0 -46
  148. package/dist/types-cjs/store/store.d.cts +0 -138
  149. package/dist/types-cjs/store/storePath.d.cts +0 -58
  150. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -0,0 +1,129 @@
1
+ import { forEachDependent } from "./core/async.js";
2
+
3
+ import { ext, statusNotifierOf } from "./core/core.js";
4
+
5
+ import { $REFRESH, STATUS_PENDING } from "./core/constants.js";
6
+
7
+ import "./core/dev.js";
8
+
9
+ import { NotReadyError } from "./core/error.js";
10
+
11
+ import { GlobalQueue, globalQueue, schedule, shiftAffectsMarks } from "./core/scheduler.js";
12
+
13
+ import "./core/verdict.js";
14
+
15
+ import "./core/effect.js";
16
+
17
+ import "./core/invariants.js";
18
+
19
+ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
20
+
21
+ /**
22
+ * The counting half of a mark, shared by direct registration and store-scope
23
+ * inheritance (a node created inside a live keyless mark's identity scope).
24
+ * A mark is ONLY this count: coverage of everything derived from the node is
25
+ * pull-derived by the verdict layer's `markWalk` (dep-graph reachability), so
26
+ * nothing is stored downstream and nothing can be stranded or stripped by
27
+ * mid-window recomputes.
28
+ */ function markAffects(e) {
29
+ ext(e).t = (e.o?.t || 0) + 1;
30
+ shiftAffectsMarks(1);
31
+ }
32
+
33
+ /**
34
+ * Boundary visual channel: within a transaction, a live mark holds Loading
35
+ * fallbacks / reveal ordering the way real in-flight async would — but the
36
+ * notification is tagged visibility-only at the source (`_markVisual`), so
37
+ * the root queue never registers reporters from it: marks are invisible to
38
+ * ALL completion and settlement accounting by construction. Boundaries hold
39
+ * the marked node in `_sources` while `_affectsCount` is live; the release
40
+ * sweep (finalizePureQueue re-checks boundary children after mark release)
41
+ * is the display-state update point. Ambient marks release inside the same
42
+ * flush that would surface them, before effects run — verdict-only, netting
43
+ * no visual change.
44
+ */ function notifyMarkBoundaries(e) {
45
+ if (!e.u && !e.o?.i) return;
46
+ const r = new NotReadyError(e);
47
+ r.l = true;
48
+ const t = new Set;
49
+ const visit = e => {
50
+ if (t.has(e)) return;
51
+ t.add(e);
52
+ // Display consumers (render effects, boundary computeds) act on the
53
+ // notification; descent stops there, exactly like the status rails.
54
+ const o = statusNotifierOf(e);
55
+ if (o) {
56
+ o.call(e, STATUS_PENDING, r);
57
+ return;
58
+ }
59
+ forEachDependent(e, visit);
60
+ };
61
+ forEachDependent(e, visit);
62
+ }
63
+
64
+ /**
65
+ * Registers one `affects()` mark on a node: counts it, records the
66
+ * registration with the current transaction (after initTransition the queue's
67
+ * batch IS the active transition, mirroring `_optimisticNodes`), re-derives
68
+ * every downstream verdict companion (the mark channel's only push — verdict
69
+ * pokes, not state), and notifies boundary display state. Both walks run on
70
+ * every registration (not just the first): subscribers gained since an
71
+ * earlier overlapping registration get covered, and dedup stops re-descent.
72
+ */ function registerAffectsMark(e) {
73
+ markAffects(e);
74
+ globalQueue.m.A.push(e);
75
+ // Companions only exist once the verdict layer (isPending/latest) loaded;
76
+ // without them there is no materialized verdict to poke.
77
+ GlobalQueue.k !== null && GlobalQueue.k(e);
78
+ notifyMarkBoundaries(e);
79
+ schedule();
80
+ }
81
+
82
+ /**
83
+ * Releases one registration. When the node's last mark drops, re-derives
84
+ * every downstream verdict through the settlement snap (committed, not
85
+ * transition-scoped — release runs inside queue finalization, where a
86
+ * setSignal would open a fresh override window that nothing settles).
87
+ */ function releaseAffectsMark(e) {
88
+ shiftAffectsMarks(-1);
89
+ e.o.t--;
90
+ if (!e.o.t) {
91
+ GlobalQueue.k !== null && GlobalQueue.k(e, true);
92
+ GlobalQueue.p?.(e);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Releases one batch of affects marks (a settling transaction's, or the
98
+ * ambient batch at a plain flush end).
99
+ */ function releaseAffectsMarks(e) {
100
+ for (let r = 0; r < e.length; r++) releaseAffectsMark(e[r]);
101
+ e.length = 0;
102
+ }
103
+
104
+ // Late installation (same pattern as `GlobalQueue._update`): the mark engine
105
+ // lives with the feature so graphs that never declare a mark never ship it.
106
+ // Each call site is gated by state only this module creates (a non-empty
107
+ // `_affectsNodes` batch, a live scope in the store's `affectsScopes`), so the
108
+ // hooks are installed before the first time any of them can fire.
109
+ GlobalQueue.G = releaseAffectsMarks;
110
+
111
+ GlobalQueue.M = markAffects;
112
+
113
+ GlobalQueue.j = releaseAffectsMark;
114
+
115
+ function affects(e, r) {
116
+ const t = e?.[$TARGET];
117
+ if (t) {
118
+ const e = getStoreAffectsNodes(t, r);
119
+ for (let r = 0; r < e.length; r++) registerAffectsMark(e[r]);
120
+ return;
121
+ }
122
+ const o = e?.[$REFRESH];
123
+ if (o) {
124
+ registerAffectsMark(o);
125
+ return;
126
+ }
127
+ }
128
+
129
+ export { affects };
@@ -0,0 +1,7 @@
1
+ export { attribution, formatOrigin, formatRerun, graphSize } from "./core/attribution.js";
2
+
3
+ export { costs } from "./core/attribution-costs.js";
4
+
5
+ export { feedback } from "./core/attribution-feedback.js";
6
+
7
+ export { subscriptions, why } from "./core/attribution-queries.js";