@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.15

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 (121) hide show
  1. package/dist/dev-shared.js +2059 -3768
  2. package/dist/dev.attribution.js +237 -101
  3. package/dist/dev.js +7466 -8497
  4. package/dist/observe/affects.js +128 -104
  5. package/dist/observe/boundaries.js +492 -665
  6. package/dist/observe/core/action.js +63 -66
  7. package/dist/observe/core/async.js +243 -379
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +394 -253
  10. package/dist/observe/core/constants.js +120 -187
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +874 -1440
  13. package/dist/observe/core/dev.js +3 -3
  14. package/dist/observe/core/effect.js +73 -84
  15. package/dist/observe/core/external.js +5 -5
  16. package/dist/observe/core/graph.js +62 -71
  17. package/dist/observe/core/heap.js +75 -98
  18. package/dist/observe/core/invariants.js +1 -34
  19. package/dist/observe/core/lanes.js +750 -181
  20. package/dist/observe/core/owner.js +80 -101
  21. package/dist/observe/core/scheduler.js +719 -1356
  22. package/dist/observe/core/verdict.js +314 -621
  23. package/dist/observe/flatten.js +79 -0
  24. package/dist/observe/index.js +15 -13
  25. package/dist/observe/map.js +232 -235
  26. package/dist/observe/reveal.js +212 -0
  27. package/dist/observe/signals.js +144 -216
  28. package/dist/observe/store/affects.js +142 -0
  29. package/dist/observe/store/hooks.js +13 -0
  30. package/dist/observe/store/index.js +27 -24
  31. package/dist/observe/store/optimistic.js +571 -0
  32. package/dist/observe/store/projection.js +308 -0
  33. package/dist/observe/store/reconcile.js +259 -0
  34. package/dist/observe/store/store.js +1988 -277
  35. package/dist/observe/store/storePath.js +1 -1
  36. package/dist/{prod/store/next → observe/store}/target.js +17 -18
  37. package/dist/observe/store/types.js +73 -0
  38. package/dist/observe/store/utils.js +1 -13
  39. package/dist/prod/affects.js +130 -106
  40. package/dist/prod/boundaries.js +476 -654
  41. package/dist/prod/core/action.js +71 -74
  42. package/dist/prod/core/async.js +306 -444
  43. package/dist/prod/core/constants.js +117 -186
  44. package/dist/prod/core/context.js +3 -3
  45. package/dist/prod/core/core.js +888 -1462
  46. package/dist/prod/core/effect.js +88 -99
  47. package/dist/prod/core/external.js +5 -5
  48. package/dist/prod/core/graph.js +62 -71
  49. package/dist/prod/core/heap.js +75 -98
  50. package/dist/prod/core/invariants.js +1 -32
  51. package/dist/prod/core/lanes.js +712 -181
  52. package/dist/prod/core/owner.js +75 -96
  53. package/dist/prod/core/scheduler.js +686 -1335
  54. package/dist/prod/core/verdict.js +309 -621
  55. package/dist/prod/flatten.js +77 -0
  56. package/dist/prod/index.js +15 -13
  57. package/dist/prod/map.js +142 -145
  58. package/dist/prod/reveal.js +212 -0
  59. package/dist/prod/signals.js +155 -227
  60. package/dist/prod/store/affects.js +142 -0
  61. package/dist/prod/store/hooks.js +13 -0
  62. package/dist/prod/store/index.js +26 -19
  63. package/dist/prod/store/optimistic.js +566 -0
  64. package/dist/prod/store/projection.js +301 -0
  65. package/dist/prod/store/reconcile.js +259 -0
  66. package/dist/prod/store/store.js +1883 -272
  67. package/dist/prod/store/storePath.js +1 -1
  68. package/dist/{observe/store/next → prod/store}/target.js +13 -17
  69. package/dist/prod/store/types.js +73 -0
  70. package/dist/prod/store/utils.js +1 -11
  71. package/dist/types/affects.d.ts +11 -30
  72. package/dist/types/boundaries.d.ts +66 -176
  73. package/dist/types/carved.d.ts +1 -0
  74. package/dist/types/core/action.d.ts +5 -6
  75. package/dist/types/core/async.d.ts +10 -5
  76. package/dist/types/core/attribution-hooks.d.ts +20 -1
  77. package/dist/types/core/attribution.d.ts +26 -11
  78. package/dist/types/core/constants.d.ts +130 -180
  79. package/dist/types/core/core.d.ts +134 -264
  80. package/dist/types/core/dev.d.ts +2 -2
  81. package/dist/types/core/effect.d.ts +0 -7
  82. package/dist/types/core/graph.d.ts +7 -1
  83. package/dist/types/core/heap.d.ts +5 -7
  84. package/dist/types/core/index.d.ts +5 -5
  85. package/dist/types/core/invariants.d.ts +0 -29
  86. package/dist/types/core/lanes.d.ts +74 -86
  87. package/dist/types/core/owner.d.ts +3 -3
  88. package/dist/types/core/scheduler.d.ts +255 -331
  89. package/dist/types/core/types.d.ts +45 -85
  90. package/dist/types/core/verdict.d.ts +3 -0
  91. package/dist/types/flatten.d.ts +8 -0
  92. package/dist/types/index.d.ts +6 -4
  93. package/dist/types/reveal.d.ts +19 -0
  94. package/dist/types/signals.d.ts +35 -91
  95. package/dist/types/store/affects.d.ts +12 -0
  96. package/dist/types/store/hooks.d.ts +48 -0
  97. package/dist/types/store/index.d.ts +34 -15
  98. package/dist/types/store/optimistic.d.ts +23 -0
  99. package/dist/types/store/projection.d.ts +18 -0
  100. package/dist/types/store/reconcile.d.ts +3 -0
  101. package/dist/types/store/store.d.ts +132 -145
  102. package/dist/types/store/storePath.d.ts +1 -1
  103. package/dist/types/store/target.d.ts +151 -0
  104. package/dist/types/store/types.d.ts +84 -0
  105. package/package.json +1 -1
  106. package/dist/observe/core/optimistic.js +0 -669
  107. package/dist/observe/store/next/optimistic.js +0 -717
  108. package/dist/observe/store/next/projection.js +0 -266
  109. package/dist/observe/store/next/reconcile.js +0 -375
  110. package/dist/observe/store/next/store.js +0 -2608
  111. package/dist/prod/core/optimistic.js +0 -658
  112. package/dist/prod/store/next/optimistic.js +0 -710
  113. package/dist/prod/store/next/projection.js +0 -257
  114. package/dist/prod/store/next/reconcile.js +0 -373
  115. package/dist/prod/store/next/store.js +0 -2484
  116. package/dist/types/core/optimistic.d.ts +0 -6
  117. package/dist/types/store/next/optimistic.d.ts +0 -25
  118. package/dist/types/store/next/projection.d.ts +0 -27
  119. package/dist/types/store/next/reconcile.d.ts +0 -10
  120. package/dist/types/store/next/store.d.ts +0 -145
  121. package/dist/types/store/next/target.d.ts +0 -196
@@ -0,0 +1,79 @@
1
+ import { NotReadyError } from "./core/error.js";
2
+
3
+ import "./core/verdict.js";
4
+
5
+ import "./core/core.js";
6
+
7
+ import "./core/dev.js";
8
+
9
+ import "./core/scheduler.js";
10
+
11
+ import "./core/effect.js";
12
+
13
+ // CARVE 4: `flatten` lived in boundaries.ts but is the general children
14
+ // resolver the renderers (`web`, `universal`, `solid`'s `children()`) walk
15
+ // through — not a boundary feature. Moved verbatim so the boundary carve
16
+ // measures boundaries alone.
17
+ /**
18
+ * Resolves nested accessors and arrays in a children tree to their rendered
19
+ * values. See the `children()` helper in solid-js for the memoized form.
20
+ */
21
+ function flatten(r, t) {
22
+ if (typeof r === "function" && !r.length) {
23
+ if (t?.doNotUnwrap) return r;
24
+ do {
25
+ r = r();
26
+ } while (typeof r === "function" && !r.length);
27
+ }
28
+ if (t?.skipNonRendered && (r == null || r === true || r === false || r === "")) return;
29
+ if (Array.isArray(r)) {
30
+ let e = [];
31
+ if (flattenArray(r, e, t)) {
32
+ return () => {
33
+ let r = [];
34
+ flattenArray(e, r, {
35
+ ...t,
36
+ doNotUnwrap: false
37
+ });
38
+ return r;
39
+ };
40
+ }
41
+ return e;
42
+ }
43
+ return r;
44
+ }
45
+
46
+ function flattenArray(r, t = [], e) {
47
+ let o = null;
48
+ let f = false;
49
+ for (let n = 0; n < r.length; n++) {
50
+ try {
51
+ let o = r[n];
52
+ if (typeof o === "function" && !o.length) {
53
+ if (e?.doNotUnwrap) {
54
+ t.push(o);
55
+ f = true;
56
+ continue;
57
+ }
58
+ do {
59
+ o = o();
60
+ } while (typeof o === "function" && !o.length);
61
+ }
62
+ if (Array.isArray(o)) {
63
+ // OR, don't overwrite: an accessor already pushed under doNotUnwrap
64
+ // still needs the resolving wrapper even when a later sibling
65
+ // fragment contains no functions (#3133).
66
+ f = flattenArray(o, t, e) || f;
67
+ } else if (e?.skipNonRendered && (o == null || o === true || o === false || o === "")) {
68
+ // skip
69
+ } else t.push(o);
70
+ } catch (r) {
71
+ if (!(r instanceof NotReadyError)) throw r;
72
+ o = r;
73
+ }
74
+ }
75
+ if (o) throw o;
76
+ return f;
77
+ }
78
+
79
+ export { flatten };
@@ -1,5 +1,9 @@
1
1
  export { ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError } from "./core/error.js";
2
2
 
3
+ export { isPending, latest } from "./core/verdict.js";
4
+
5
+ export { action } from "./core/action.js";
6
+
3
7
  export { clearSnapshots, isEqual, markSnapshotScope, releaseSnapshotScope, runWithOwner, setSnapshotCapture, untrack } from "./core/core.js";
4
8
 
5
9
  export { enableExternalSource } from "./core/external.js";
@@ -10,41 +14,39 @@ export { createContext, getContext, setContext } from "./core/context.js";
10
14
 
11
15
  export { $REFRESH, SUPPORTS_PROXY } from "./core/constants.js";
12
16
 
13
- import "./core/invariants.js";
14
-
15
17
  import { OBSERVE as OBSERVE$1 } from "./core/dev.js";
16
18
 
17
19
  export { setConsoleFooter } from "./core/dev.js";
18
20
 
19
21
  export { ROOT_ERROR_HOOK, enforceLoadingBoundary, flush, resetErrorHalt } from "./core/scheduler.js";
20
22
 
21
- export { isPending, latest } from "./core/verdict.js";
22
-
23
23
  import "./core/effect.js";
24
24
 
25
- export { action } from "./core/action.js";
26
-
27
25
  export { configureClientErrors } from "./core/error-hooks.js";
28
26
 
29
27
  export { createEffect, createMemo, createOptimistic, createReaction, createRenderEffect, createSignal, createTrackedEffect, onCleanup, onSettled, refresh, resolve, until } from "./signals.js";
30
28
 
31
- export { affects } from "./affects.js";
32
-
33
29
  export { mapArray, repeat } from "./map.js";
34
30
 
35
31
  export { createStore, deep, reconcile, snapshot } from "./store/index.js";
36
32
 
37
- export { createErrorBoundary, createLoadingBoundary, createRevealOrder, flatten } from "./boundaries.js";
33
+ export { affects } from "./affects.js";
34
+
35
+ export { flatten } from "./flatten.js";
36
+
37
+ export { createErrorBoundary, createLoadingBoundary } from "./boundaries.js";
38
+
39
+ export { createRevealOrder } from "./reveal.js";
38
40
 
39
- export { $PROXY, $RECORD, $TARGET, $TRACK, isWrappable } from "./store/store.js";
41
+ export { $PROXY, $RECORD, $TARGET, $TRACK, isWrappable, markRaw } from "./store/types.js";
40
42
 
41
43
  export { MergeView, OmitView, SOURCE_MEMO, SOURCE_MERGE, SOURCE_OMIT, SOURCE_PLAIN, SOURCE_PROXY, hasStaticKeys, isStatic, merge, mergeSources, mergeView, omit, omitView, resolvedTable, sourceGet, sourceHas, sourceKeys, sourceOwners, viewOf } from "./store/utils.js";
42
44
 
43
- export { createOptimisticStoreNext as createOptimisticStore } from "./store/next/optimistic.js";
45
+ export { createOptimisticStore } from "./store/optimistic.js";
44
46
 
45
- export { createProjectionNext as createProjection } from "./store/next/projection.js";
47
+ export { createProjection } from "./store/projection.js";
46
48
 
47
- export { storeHasFamily, storeHasOptimisticFamily, storeIsShallow } from "./store/next/store.js";
49
+ export { storeHasFamily, storeHasOptimisticFamily, storeIsShallow } from "./store/store.js";
48
50
 
49
51
  export { storePath } from "./store/storePath.js";
50
52