@solidjs/signals 2.0.0-rc.6 → 2.0.0-rc.8

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 (131) hide show
  1. package/dist/dev-shared.js +5243 -0
  2. package/dist/dev.attribution.js +2333 -0
  3. package/dist/dev.js +1758 -6621
  4. package/dist/observe/affects.js +127 -0
  5. package/dist/observe/attribution.js +1 -0
  6. package/dist/observe/boundaries.js +586 -0
  7. package/dist/observe/core/action.js +167 -0
  8. package/dist/observe/core/async.js +736 -0
  9. package/dist/observe/core/attribution-hooks.js +60 -0
  10. package/dist/observe/core/attribution.js +2318 -0
  11. package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +135 -71
  12. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  13. package/dist/observe/core/core.js +1289 -0
  14. package/dist/observe/core/dev.js +232 -0
  15. package/dist/observe/core/effect.js +179 -0
  16. package/dist/observe/core/error.js +80 -0
  17. package/dist/observe/core/external.js +98 -0
  18. package/dist/observe/core/graph.js +155 -0
  19. package/dist/observe/core/heap.js +147 -0
  20. package/dist/observe/core/invariants.js +43 -0
  21. package/dist/observe/core/lanes.js +168 -0
  22. package/dist/observe/core/optimistic.js +438 -0
  23. package/dist/observe/core/owner.js +308 -0
  24. package/dist/observe/core/scheduler.js +1190 -0
  25. package/dist/observe/core/verdict.js +551 -0
  26. package/dist/observe/index.js +55 -0
  27. package/dist/observe/map.js +482 -0
  28. package/dist/{types-cjs/signals.d.cts → observe/signals.js} +305 -317
  29. package/dist/observe/store/index.js +38 -0
  30. package/dist/observe/store/next/optimistic.js +651 -0
  31. package/dist/observe/store/next/projection.js +242 -0
  32. package/dist/observe/store/next/reconcile.js +373 -0
  33. package/dist/observe/store/next/store.js +2213 -0
  34. package/dist/observe/store/next/target.js +51 -0
  35. package/dist/observe/store/store.js +323 -0
  36. package/dist/observe/store/storePath.js +103 -0
  37. package/dist/observe/store/utils.js +210 -0
  38. package/dist/prod/attribution.js +32 -0
  39. package/dist/prod/boundaries.js +3 -1
  40. package/dist/prod/core/action.js +52 -32
  41. package/dist/prod/core/async.js +177 -128
  42. package/dist/prod/core/attribution-hooks.js +3 -0
  43. package/dist/prod/core/constants.js +32 -1
  44. package/dist/prod/core/context.js +10 -16
  45. package/dist/prod/core/core.js +505 -286
  46. package/dist/prod/core/dev.js +2 -0
  47. package/dist/prod/core/effect.js +72 -43
  48. package/dist/prod/core/external.js +2 -2
  49. package/dist/prod/core/graph.js +40 -36
  50. package/dist/prod/core/heap.js +50 -51
  51. package/dist/prod/core/lanes.js +43 -22
  52. package/dist/prod/core/optimistic.js +224 -80
  53. package/dist/prod/core/owner.js +43 -39
  54. package/dist/prod/core/scheduler.js +347 -232
  55. package/dist/prod/core/verdict.js +71 -74
  56. package/dist/prod/index.js +9 -5
  57. package/dist/prod/map.js +311 -150
  58. package/dist/prod/signals.js +52 -38
  59. package/dist/prod/store/next/optimistic.js +127 -131
  60. package/dist/prod/store/next/projection.js +3 -3
  61. package/dist/prod/store/next/reconcile.js +149 -294
  62. package/dist/prod/store/next/store.js +694 -380
  63. package/dist/prod/store/next/target.js +32 -10
  64. package/dist/prod/store/store.js +12 -14
  65. package/dist/prod/store/utils.js +36 -27
  66. package/dist/types/attribution.d.ts +15 -0
  67. package/dist/types/attribution.prod.d.ts +13 -0
  68. package/dist/types/core/async.d.ts +1 -1
  69. package/dist/types/core/attribution-hooks.d.ts +183 -6
  70. package/dist/types/core/attribution.d.ts +435 -24
  71. package/dist/types/core/constants.d.ts +31 -0
  72. package/dist/types/core/core.d.ts +19 -3
  73. package/dist/types/core/dev.d.ts +165 -26
  74. package/dist/types/core/effect.d.ts +8 -1
  75. package/dist/types/core/heap.d.ts +5 -3
  76. package/dist/types/core/index.d.ts +2 -1
  77. package/dist/types/core/invariants.d.ts +1 -1
  78. package/dist/types/core/lanes.d.ts +17 -0
  79. package/dist/types/core/scheduler.d.ts +69 -4
  80. package/dist/types/core/types.d.ts +29 -9
  81. package/dist/types/index.d.ts +9 -2
  82. package/dist/types/map.d.ts +2 -0
  83. package/dist/types/signals.d.ts +10 -0
  84. package/dist/types/store/index.d.ts +4 -6
  85. package/dist/types/store/next/optimistic.d.ts +4 -2
  86. package/dist/types/store/next/reconcile.d.ts +5 -12
  87. package/dist/types/store/next/store.d.ts +8 -9
  88. package/dist/types/store/next/target.d.ts +56 -55
  89. package/dist/types/store/store.d.ts +14 -9
  90. package/dist/types/store/utils.d.ts +7 -0
  91. package/package.json +21 -16
  92. package/dist/node.cjs +0 -11121
  93. package/dist/prod/store/next/patch-hooks.js +0 -13
  94. package/dist/prod/store/next/patch.js +0 -614
  95. package/dist/types/store/next/patch-hooks.d.ts +0 -41
  96. package/dist/types/store/next/patch.d.ts +0 -91
  97. package/dist/types-cjs/affects.d.cts +0 -47
  98. package/dist/types-cjs/boundaries.d.cts +0 -175
  99. package/dist/types-cjs/core/action.d.cts +0 -64
  100. package/dist/types-cjs/core/async.d.cts +0 -23
  101. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -63
  102. package/dist/types-cjs/core/attribution.d.cts +0 -239
  103. package/dist/types-cjs/core/core.d.cts +0 -176
  104. package/dist/types-cjs/core/dev.d.cts +0 -95
  105. package/dist/types-cjs/core/effect.d.cts +0 -30
  106. package/dist/types-cjs/core/error.d.cts +0 -56
  107. package/dist/types-cjs/core/external.d.cts +0 -15
  108. package/dist/types-cjs/core/graph.d.cts +0 -28
  109. package/dist/types-cjs/core/heap.d.cts +0 -22
  110. package/dist/types-cjs/core/index.d.cts +0 -13
  111. package/dist/types-cjs/core/invariants.d.cts +0 -59
  112. package/dist/types-cjs/core/lanes.d.cts +0 -44
  113. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  114. package/dist/types-cjs/core/owner.d.cts +0 -124
  115. package/dist/types-cjs/core/scheduler.d.cts +0 -231
  116. package/dist/types-cjs/core/types.d.cts +0 -204
  117. package/dist/types-cjs/core/verdict.d.cts +0 -2
  118. package/dist/types-cjs/index.d.cts +0 -10
  119. package/dist/types-cjs/map.d.cts +0 -69
  120. package/dist/types-cjs/package.json +0 -3
  121. package/dist/types-cjs/store/index.d.cts +0 -21
  122. package/dist/types-cjs/store/next/optimistic.d.cts +0 -23
  123. package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
  124. package/dist/types-cjs/store/next/patch.d.cts +0 -91
  125. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  126. package/dist/types-cjs/store/next/reconcile.d.cts +0 -17
  127. package/dist/types-cjs/store/next/store.d.cts +0 -127
  128. package/dist/types-cjs/store/next/target.d.cts +0 -192
  129. package/dist/types-cjs/store/store.d.cts +0 -138
  130. package/dist/types-cjs/store/storePath.d.cts +0 -58
  131. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -0,0 +1,127 @@
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 { NotReadyError } from "./core/error.js";
8
+
9
+ import { GlobalQueue, globalQueue, schedule, shiftAffectsMarks } from "./core/scheduler.js";
10
+
11
+ import "./core/verdict.js";
12
+
13
+ import "./core/effect.js";
14
+
15
+ import "./core/invariants.js";
16
+
17
+ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
18
+
19
+ /**
20
+ * The counting half of a mark, shared by direct registration and store-scope
21
+ * inheritance (a node created inside a live keyless mark's identity scope).
22
+ * A mark is ONLY this count: coverage of everything derived from the node is
23
+ * pull-derived by the verdict layer's `markWalk` (dep-graph reachability), so
24
+ * nothing is stored downstream and nothing can be stranded or stripped by
25
+ * mid-window recomputes.
26
+ */ function markAffects(e) {
27
+ ext(e).t = (e.o?.t || 0) + 1;
28
+ shiftAffectsMarks(1);
29
+ }
30
+
31
+ /**
32
+ * Boundary visual channel: within a transaction, a live mark holds Loading
33
+ * fallbacks / reveal ordering the way real in-flight async would — but the
34
+ * notification is tagged visibility-only at the source (`_markVisual`), so
35
+ * the root queue never registers reporters from it: marks are invisible to
36
+ * ALL completion and settlement accounting by construction. Boundaries hold
37
+ * the marked node in `_sources` while `_affectsCount` is live; the release
38
+ * sweep (finalizePureQueue re-checks boundary children after mark release)
39
+ * is the display-state update point. Ambient marks release inside the same
40
+ * flush that would surface them, before effects run — verdict-only, netting
41
+ * no visual change.
42
+ */ function notifyMarkBoundaries(e) {
43
+ if (!e.u && !e.o?.i) return;
44
+ const r = new NotReadyError(e);
45
+ r.l = true;
46
+ const t = new Set;
47
+ const visit = e => {
48
+ if (t.has(e)) return;
49
+ t.add(e);
50
+ // Display consumers (render effects, boundary computeds) act on the
51
+ // notification; descent stops there, exactly like the status rails.
52
+ const o = statusNotifierOf(e);
53
+ if (o) {
54
+ o.call(e, STATUS_PENDING, r);
55
+ return;
56
+ }
57
+ forEachDependent(e, visit);
58
+ };
59
+ forEachDependent(e, visit);
60
+ }
61
+
62
+ /**
63
+ * Registers one `affects()` mark on a node: counts it, records the
64
+ * registration with the current transaction (after initTransition the queue's
65
+ * batch IS the active transition, mirroring `_optimisticNodes`), re-derives
66
+ * every downstream verdict companion (the mark channel's only push — verdict
67
+ * pokes, not state), and notifies boundary display state. Both walks run on
68
+ * every registration (not just the first): subscribers gained since an
69
+ * earlier overlapping registration get covered, and dedup stops re-descent.
70
+ */ function registerAffectsMark(e) {
71
+ markAffects(e);
72
+ globalQueue.m.A.push(e);
73
+ // Companions only exist once the verdict layer (isPending/latest) loaded;
74
+ // without them there is no materialized verdict to poke.
75
+ GlobalQueue.k !== null && GlobalQueue.k(e);
76
+ notifyMarkBoundaries(e);
77
+ schedule();
78
+ }
79
+
80
+ /**
81
+ * Releases one registration. When the node's last mark drops, re-derives
82
+ * every downstream verdict through the settlement snap (committed, not
83
+ * transition-scoped — release runs inside queue finalization, where a
84
+ * setSignal would open a fresh override window that nothing settles).
85
+ */ function releaseAffectsMark(e) {
86
+ shiftAffectsMarks(-1);
87
+ e.o.t--;
88
+ if (!e.o.t) {
89
+ GlobalQueue.k !== null && GlobalQueue.k(e, true);
90
+ GlobalQueue.p?.(e);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Releases one batch of affects marks (a settling transaction's, or the
96
+ * ambient batch at a plain flush end).
97
+ */ function releaseAffectsMarks(e) {
98
+ for (let r = 0; r < e.length; r++) releaseAffectsMark(e[r]);
99
+ e.length = 0;
100
+ }
101
+
102
+ // Late installation (same pattern as `GlobalQueue._update`): the mark engine
103
+ // lives with the feature so graphs that never declare a mark never ship it.
104
+ // Each call site is gated by state only this module creates (a non-empty
105
+ // `_affectsNodes` batch, a live scope in the store's `affectsScopes`), so the
106
+ // hooks are installed before the first time any of them can fire.
107
+ GlobalQueue.G = releaseAffectsMarks;
108
+
109
+ GlobalQueue.M = markAffects;
110
+
111
+ GlobalQueue.N = releaseAffectsMark;
112
+
113
+ function affects(e, r) {
114
+ const t = e?.[$TARGET];
115
+ if (t) {
116
+ const e = getStoreAffectsNodes(t, r);
117
+ for (let r = 0; r < e.length; r++) registerAffectsMark(e[r]);
118
+ return;
119
+ }
120
+ const o = e?.[$REFRESH];
121
+ if (o) {
122
+ registerAffectsMark(o);
123
+ return;
124
+ }
125
+ }
126
+
127
+ export { affects };
@@ -0,0 +1 @@
1
+ export { attribution } from "./core/attribution.js";