solid-js 2.0.0-experimental.0 → 2.0.0-experimental.10

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/dist/solid.js CHANGED
@@ -1,66 +1,15 @@
1
- import {
2
- createEffect,
3
- getContext,
4
- createMemo,
5
- flatten,
6
- setContext,
7
- untrack,
8
- createRoot,
9
- getOwner,
10
- onCleanup,
11
- createSignal,
12
- createAsync,
13
- mapArray,
14
- repeat,
15
- createErrorBoundary,
16
- createSuspense
17
- } from "@solidjs/signals";
18
- export {
19
- $PROXY,
20
- $RAW,
21
- $TRACK,
22
- catchError,
23
- createAsync,
24
- createEffect,
25
- createMemo,
26
- createProjection,
27
- createReaction,
28
- createRenderEffect,
29
- createRoot,
30
- createSignal,
31
- createStore,
32
- flatten,
33
- flushSync,
34
- getObserver,
35
- getOwner,
36
- isEqual,
37
- isStale,
38
- isWrappable,
39
- latest,
40
- mapArray,
41
- merge,
42
- omit,
43
- onCleanup,
44
- reconcile,
45
- repeat,
46
- resolve,
47
- runWithOwner,
48
- untrack,
49
- unwrap
50
- } from "@solidjs/signals";
1
+ import { createEffect, getContext, createMemo, flatten, createRoot, setContext, NotReadyError, getOwner, onCleanup, createSignal, createSuspense, flush, runWithOwner, createAsync as createAsync$1, untrack, mapArray, repeat, createErrorBoundary, createBoundary } from '@solidjs/signals';
2
+ export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithOwner, snapshot, transition, untrack, useTransition } from '@solidjs/signals';
51
3
 
52
4
  const $DEVCOMP = Symbol(0);
53
5
  function onMount(fn) {
54
6
  createEffect(() => null, fn);
55
7
  }
56
8
  function createContext(defaultValue, options) {
57
- const id = Symbol((options && options.name) || "");
9
+ const id = Symbol(options && options.name || "");
58
10
  function provider(props) {
59
- return createMemo(() => {
60
- setContext(
61
- provider,
62
- untrack(() => props.value)
63
- );
11
+ return createRoot(() => {
12
+ setContext(provider, props.value);
64
13
  return children(() => props.children);
65
14
  });
66
15
  }
@@ -81,26 +30,43 @@ function children(fn) {
81
30
  return memo;
82
31
  }
83
32
 
33
+ function tryCatch(fn) {
34
+ try {
35
+ const v = fn();
36
+ if (v instanceof Promise) {
37
+ return v.then(v => [undefined, v], e => {
38
+ if (e instanceof NotReadyError) throw e;
39
+ return [e];
40
+ });
41
+ }
42
+ return [undefined, v];
43
+ } catch (e) {
44
+ if (e instanceof NotReadyError) throw e;
45
+ return [e];
46
+ }
47
+ }
48
+ function reducer(source, reducerFn) {
49
+ return [source[0], action => {
50
+ source[1](s => reducerFn(s, action));
51
+ }];
52
+ }
53
+
84
54
  function observable(input) {
85
55
  return {
86
56
  subscribe(observer) {
87
57
  if (!(observer instanceof Object) || observer == null) {
88
58
  throw new TypeError("Expected the observer to be an object.");
89
59
  }
90
- const handler =
91
- typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
60
+ const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
92
61
  if (!handler) {
93
62
  return {
94
63
  unsubscribe() {}
95
64
  };
96
65
  }
97
66
  const dispose = createRoot(disposer => {
98
- createEffect(
99
- () => input(),
100
- v => {
101
- handler(v);
102
- }
103
- );
67
+ createEffect(() => input(), v => {
68
+ handler(v);
69
+ });
104
70
  return disposer;
105
71
  });
106
72
  if (getOwner()) onCleanup(dispose);
@@ -115,13 +81,13 @@ function observable(input) {
115
81
  }
116
82
  };
117
83
  }
118
- function from(producer) {
119
- const [s, set] = createSignal(undefined, {
84
+ function from(producer, initialValue = undefined) {
85
+ const [s, set] = createSignal(() => initialValue, initialValue, {
120
86
  equals: false
121
87
  });
122
88
  if ("subscribe" in producer) {
123
89
  const unsub = producer.subscribe(v => set(() => v));
124
- onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
90
+ onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
125
91
  } else {
126
92
  const clean = producer(set);
127
93
  onCleanup(clean);
@@ -130,226 +96,208 @@ function from(producer) {
130
96
  }
131
97
 
132
98
  const sharedConfig = {
133
- context: undefined,
99
+ hydrating: false,
134
100
  registry: undefined,
135
101
  done: false,
136
- getContextId() {
137
- return getContextId(this.context.count);
138
- },
139
102
  getNextContextId() {
140
- return getContextId(this.context.count++);
103
+ const o = getOwner();
104
+ if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
105
+ return o.getNextChildId();
141
106
  }
142
107
  };
143
- function getContextId(count) {
144
- const num = String(count),
145
- len = num.length - 1;
146
- return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
108
+ function Suspense(props) {
109
+ if (!sharedConfig.hydrating) return createSuspense(() => props.children, () => props.fallback);
110
+ return createMemo(() => {
111
+ const o = getOwner();
112
+ const id = o.id;
113
+ if (sharedConfig.hydrating && sharedConfig.has(id)) {
114
+ let ref = sharedConfig.load(id);
115
+ let p;
116
+ if (ref) {
117
+ if (typeof ref !== "object" || ref.s !== "success") p = ref;else sharedConfig.gather(id);
118
+ }
119
+ if (p) {
120
+ const [s, set] = createSignal(undefined, {
121
+ equals: false
122
+ });
123
+ s();
124
+ if (p !== "$$f") {
125
+ p.then(() => {
126
+ sharedConfig.gather(id);
127
+ sharedConfig.hydrating = true;
128
+ set();
129
+ flush();
130
+ sharedConfig.hydrating = false;
131
+ }, err => runWithOwner(o, () => {
132
+ throw err;
133
+ }));
134
+ } else queueMicrotask(set);
135
+ return props.fallback;
136
+ }
137
+ }
138
+ return createSuspense(() => props.children, () => props.fallback);
139
+ });
147
140
  }
148
- function setHydrateContext(context) {
149
- sharedConfig.context = context;
141
+ function createAsync(compute, value, options) {
142
+ if (!sharedConfig.hydrating) return createAsync$1(compute, value, options);
143
+ return createAsync$1(prev => {
144
+ if (!sharedConfig.hydrating) return compute(prev);
145
+ const o = getOwner();
146
+ let initP;
147
+ if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
148
+ const init = initP?.value || initP;
149
+ return init ? (subFetch(compute, prev), init) : compute(prev);
150
+ }, value, options);
150
151
  }
151
- function nextHydrateContext() {
152
- return {
153
- ...sharedConfig.context,
154
- id: sharedConfig.getNextContextId(),
155
- count: 0
156
- };
152
+ class MockPromise {
153
+ static all() {
154
+ return new MockPromise();
155
+ }
156
+ static allSettled() {
157
+ return new MockPromise();
158
+ }
159
+ static any() {
160
+ return new MockPromise();
161
+ }
162
+ static race() {
163
+ return new MockPromise();
164
+ }
165
+ static reject() {
166
+ return new MockPromise();
167
+ }
168
+ static resolve() {
169
+ return new MockPromise();
170
+ }
171
+ catch() {
172
+ return new MockPromise();
173
+ }
174
+ then() {
175
+ return new MockPromise();
176
+ }
177
+ finally() {
178
+ return new MockPromise();
179
+ }
180
+ }
181
+ function subFetch(fn, prev) {
182
+ const ogFetch = fetch;
183
+ const ogPromise = Promise;
184
+ try {
185
+ window.fetch = () => new MockPromise();
186
+ Promise = MockPromise;
187
+ return fn(prev);
188
+ } finally {
189
+ window.fetch = ogFetch;
190
+ Promise = ogPromise;
191
+ }
157
192
  }
158
193
 
159
- let hydrationEnabled = false;
160
194
  function enableHydration() {
161
- hydrationEnabled = true;
162
195
  }
163
196
  function createComponent(Comp, props) {
164
- if (hydrationEnabled) {
165
- if (sharedConfig.context) {
166
- const c = sharedConfig.context;
167
- setHydrateContext(nextHydrateContext());
168
- const r = untrack(() => Comp(props || {}));
169
- setHydrateContext(c);
170
- return r;
171
- }
172
- }
173
197
  return untrack(() => Comp(props || {}));
174
198
  }
175
199
  function lazy(fn) {
176
200
  let comp;
177
201
  let p;
178
202
  const wrap = props => {
179
- const ctx = sharedConfig.context;
180
- if (ctx) {
181
- const [s, set] = createSignal();
182
- sharedConfig.count || (sharedConfig.count = 0);
183
- sharedConfig.count++;
184
- (p || (p = fn())).then(mod => {
185
- !sharedConfig.done && setHydrateContext(ctx);
186
- sharedConfig.count--;
187
- set(() => mod.default);
188
- setHydrateContext();
189
- });
190
- comp = s;
191
- } else if (!comp) {
192
- const s = createAsync(() => (p || (p = fn())).then(mod => mod.default));
203
+ if (!comp) {
204
+ const s = createAsync$1(() => (p || (p = fn())).then(mod => mod.default));
193
205
  comp = s;
194
206
  }
195
207
  let Comp;
196
- return createMemo(() =>
197
- (Comp = comp())
198
- ? untrack(() => {
199
- if (!ctx || sharedConfig.done) return Comp(props);
200
- const c = sharedConfig.context;
201
- setHydrateContext(ctx);
202
- const r = Comp(props);
203
- setHydrateContext(c);
204
- return r;
205
- })
206
- : ""
207
- );
208
+ return createMemo(() => (Comp = comp()) ? untrack(() => {
209
+ return Comp(props);
210
+ }) : "");
208
211
  };
209
- wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
212
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
210
213
  return wrap;
211
214
  }
212
215
  let counter = 0;
213
216
  function createUniqueId() {
214
- const ctx = sharedConfig.context;
215
- return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
217
+ return sharedConfig.hydrating ? sharedConfig.getNextContextId() : `cl-${counter++}`;
216
218
  }
217
219
 
218
220
  const narrowedError = name => `Stale read from <${name}>.`;
219
221
  function For(props) {
220
- const options =
221
- "fallback" in props
222
- ? {
223
- keyed: props.keyed,
224
- fallback: () => props.fallback
225
- }
226
- : {
227
- keyed: props.keyed
228
- };
222
+ const options = "fallback" in props ? {
223
+ keyed: props.keyed,
224
+ fallback: () => props.fallback
225
+ } : {
226
+ keyed: props.keyed
227
+ };
229
228
  return createMemo(mapArray(() => props.each, props.children, options));
230
229
  }
231
230
  function Repeat(props) {
232
- const options =
233
- "fallback" in props
234
- ? {
235
- fallback: () => props.fallback
236
- }
237
- : {};
238
- return createMemo(
239
- repeat(
240
- () => props.count,
241
- index => (typeof props.children === "function" ? props.children(index) : props.children),
242
- options
243
- )
244
- );
231
+ const options = "fallback" in props ? {
232
+ fallback: () => props.fallback
233
+ } : {};
234
+ options.from = () => props.from;
235
+ return createMemo(repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options));
245
236
  }
246
237
  function Show(props) {
247
238
  const keyed = props.keyed;
248
- const condition = createMemo(() => props.when, undefined, {
249
- equals: (a, b) => (keyed ? a === b : !a === !b)
239
+ const conditionValue = createMemo(() => props.when, undefined, undefined);
240
+ const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
241
+ equals: (a, b) => !a === !b
250
242
  });
251
- return createMemo(
252
- () => {
253
- const c = condition();
254
- if (c) {
255
- const child = props.children;
256
- const fn = typeof child === "function" && child.length > 0;
257
- return fn
258
- ? untrack(() =>
259
- child(() => {
260
- if (!untrack(condition)) throw narrowedError("Show");
261
- return props.when;
262
- })
263
- )
264
- : child;
265
- }
266
- return props.fallback;
267
- },
268
- undefined,
269
- undefined
270
- );
243
+ return createMemo(() => {
244
+ const c = condition();
245
+ if (c) {
246
+ const child = props.children;
247
+ const fn = typeof child === "function" && child.length > 0;
248
+ return fn ? untrack(() => child(() => {
249
+ if (!untrack(condition)) throw narrowedError("Show");
250
+ return conditionValue();
251
+ })) : child;
252
+ }
253
+ return props.fallback;
254
+ }, undefined, undefined);
271
255
  }
272
256
  function Switch(props) {
273
- let keyed = false;
274
- const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
275
- const conditions = children(() => props.children),
276
- evalConditions = createMemo(
277
- () => {
278
- let conds = conditions();
279
- if (!Array.isArray(conds)) conds = [conds];
280
- for (let i = 0; i < conds.length; i++) {
281
- const c = conds[i].when;
282
- if (c) {
283
- keyed = !!conds[i].keyed;
284
- return [i, c, conds[i]];
285
- }
286
- }
287
- return [-1];
288
- },
289
- undefined,
290
- {
291
- equals
292
- }
293
- );
294
- return createMemo(
295
- () => {
296
- const [index, when, cond] = evalConditions();
297
- if (index < 0) return props.fallback;
298
- const c = cond.children;
299
- const fn = typeof c === "function" && c.length > 0;
300
- return fn
301
- ? untrack(() =>
302
- c(() => {
303
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
304
- return cond.when;
305
- })
306
- )
307
- : c;
308
- },
309
- undefined,
310
- undefined
311
- );
257
+ const chs = children(() => props.children);
258
+ const switchFunc = createMemo(() => {
259
+ const ch = chs();
260
+ const mps = Array.isArray(ch) ? ch : [ch];
261
+ let func = () => undefined;
262
+ for (let i = 0; i < mps.length; i++) {
263
+ const index = i;
264
+ const mp = mps[i];
265
+ const prevFunc = func;
266
+ const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when, undefined, undefined);
267
+ const condition = mp.keyed ? conditionValue : createMemo(conditionValue, undefined, {
268
+ equals: (a, b) => !a === !b
269
+ });
270
+ func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
271
+ }
272
+ return func;
273
+ });
274
+ return createMemo(() => {
275
+ const sel = switchFunc()();
276
+ if (!sel) return props.fallback;
277
+ const [index, conditionValue, mp] = sel;
278
+ const child = mp.children;
279
+ const fn = typeof child === "function" && child.length > 0;
280
+ return fn ? untrack(() => child(() => {
281
+ if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
282
+ return conditionValue();
283
+ })) : child;
284
+ }, undefined, undefined);
312
285
  }
313
286
  function Match(props) {
314
287
  return props;
315
288
  }
316
289
  function ErrorBoundary(props) {
317
- return createErrorBoundary(
318
- () => props.children,
319
- (err, reset) => {
320
- const f = props.fallback;
321
- return typeof f === "function" && f.length ? f(err, reset) : f;
322
- }
323
- );
290
+ return createErrorBoundary(() => props.children, (err, reset) => {
291
+ const f = props.fallback;
292
+ return typeof f === "function" && f.length ? f(err, reset) : f;
293
+ });
324
294
  }
325
- function Suspense(props) {
326
- return createSuspense(
327
- () => props.children,
328
- () => props.fallback
329
- );
295
+ function Boundary(props) {
296
+ return createBoundary(() => props.children, () => props.mode);
330
297
  }
331
298
 
299
+ function ssrHandleError() {}
300
+ function ssrRunInScope() {}
332
301
  const DEV = undefined;
333
302
 
334
- export {
335
- $DEVCOMP,
336
- DEV,
337
- ErrorBoundary,
338
- For,
339
- Match,
340
- Repeat,
341
- Show,
342
- Suspense,
343
- Switch,
344
- children,
345
- createComponent,
346
- createContext,
347
- createUniqueId,
348
- enableHydration,
349
- from,
350
- lazy,
351
- observable,
352
- onMount,
353
- sharedConfig,
354
- useContext
355
- };
303
+ export { $DEVCOMP, Boundary, DEV, ErrorBoundary, For, Match, Repeat, Show, Suspense, Switch, children, createAsync, createComponent, createContext, createUniqueId, enableHydration, from, lazy, observable, onMount, reducer, sharedConfig, ssrHandleError, ssrRunInScope, tryCatch, useContext };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "2.0.0-experimental.0",
4
+ "version": "2.0.0-experimental.10",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -79,8 +79,10 @@
79
79
  "performance"
80
80
  ],
81
81
  "dependencies": {
82
- "@solidjs/signals": "^0.0.10",
83
- "csstype": "^3.1.0"
82
+ "@solidjs/signals": "^0.7.1",
83
+ "csstype": "^3.1.0",
84
+ "seroval": "~1.3.0",
85
+ "seroval-plugins": "~1.3.0"
84
86
  },
85
87
  "scripts": {
86
88
  "build": "npm-run-all -nl build:*",
@@ -11,7 +11,7 @@ export type Component<P extends Record<string, any> = {}> = (props: P) => JSX.El
11
11
  * would silently throw them away.
12
12
  */
13
13
  export type VoidProps<P extends Record<string, any> = {}> = P & {
14
- children?: never;
14
+ children?: never;
15
15
  };
16
16
  /**
17
17
  * `VoidComponent` forbids the `children` prop.
@@ -21,15 +21,15 @@ export type VoidProps<P extends Record<string, any> = {}> = P & {
21
21
  export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>;
22
22
  /**
23
23
  * Extend props to allow an optional `children` prop with the usual
24
- * type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
24
+ * type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
25
25
  * Use this for components that you want to accept children.
26
26
  */
27
27
  export type ParentProps<P extends Record<string, any> = {}> = P & {
28
- children?: JSX.Element;
28
+ children?: JSX.Element;
29
29
  };
30
30
  /**
31
31
  * `ParentComponent` allows an optional `children` prop with the usual
32
- * type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
32
+ * type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
33
33
  * Use this for components that you want to accept children.
34
34
  */
35
35
  export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>;
@@ -40,7 +40,7 @@ export type ParentComponent<P extends Record<string, any> = {}> = Component<Pare
40
40
  * Note that all JSX <Elements> are of the type `JSX.Element`.
41
41
  */
42
42
  export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & {
43
- children: C;
43
+ children: C;
44
44
  };
45
45
  /**
46
46
  * `FlowComponent` requires a `children` prop with the specified type.
@@ -48,9 +48,7 @@ export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P &
48
48
  * typically a function that receives specific argument types.
49
49
  * Note that all JSX <Elements> are of the type `JSX.Element`.
50
50
  */
51
- export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<
52
- FlowProps<P, C>
53
- >;
51
+ export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
54
52
  export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
55
53
  /**
56
54
  * Takes the props of the passed component and returns its type
@@ -59,28 +57,19 @@ export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (str
59
57
  * ComponentProps<typeof Portal> // { mount?: Node; useShadow?: boolean; children: JSX.Element }
60
58
  * ComponentProps<'div'> // JSX.HTMLAttributes<HTMLDivElement>
61
59
  */
62
- export type ComponentProps<T extends ValidComponent> = T extends Component<infer P>
63
- ? P
64
- : T extends keyof JSX.IntrinsicElements
65
- ? JSX.IntrinsicElements[T]
66
- : Record<string, unknown>;
60
+ export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
67
61
  /**
68
62
  * Type of `props.ref`, for use in `Component` or `props` typing.
69
63
  *
70
64
  * @example Component<{ref: Ref<Element>}>
71
65
  */
72
66
  export type Ref<T> = T | ((val: T) => void);
73
- export declare function createComponent<T extends Record<string, any>>(
74
- Comp: Component<T>,
75
- props: T
76
- ): JSX.Element;
77
- export declare function lazy<T extends Component<any>>(
78
- fn: () => Promise<{
67
+ export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
68
+ export declare function lazy<T extends Component<any>>(fn: () => Promise<{
79
69
  default: T;
80
- }>
81
- ): T & {
82
- preload: () => Promise<{
83
- default: T;
84
- }>;
70
+ }>): T & {
71
+ preload: () => Promise<{
72
+ default: T;
73
+ }>;
85
74
  };
86
75
  export declare function createUniqueId(): string;
@@ -12,11 +12,11 @@ export declare const $DEVCOMP: unique symbol;
12
12
  export declare function onMount(fn: () => void): void;
13
13
  export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
14
14
  export type ContextProviderComponent<T> = FlowComponent<{
15
- value: T;
15
+ value: T;
16
16
  }>;
17
17
  export interface Context<T> extends ContextProviderComponent<T> {
18
- id: symbol;
19
- defaultValue: T;
18
+ id: symbol;
19
+ defaultValue: T;
20
20
  }
21
21
  /**
22
22
  * Creates a Context to handle a state scoped for the children of a component
@@ -37,10 +37,7 @@ export interface Context<T> extends ContextProviderComponent<T> {
37
37
  *
38
38
  * @description https://docs.solidjs.com/reference/component-apis/create-context
39
39
  */
40
- export declare function createContext<T>(
41
- defaultValue?: undefined,
42
- options?: EffectOptions
43
- ): Context<T | undefined>;
40
+ export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>;
44
41
  export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
45
42
  /**
46
43
  * Uses a context to receive a scoped state from a parent's Context.Provider
@@ -54,7 +51,7 @@ export declare function useContext<T>(context: Context<T>): T;
54
51
  export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
55
52
  export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
56
53
  export type ChildrenReturn = Accessor<ResolvedChildren> & {
57
- toArray: () => ResolvedJSXElement[];
54
+ toArray: () => ResolvedJSXElement[];
58
55
  };
59
56
  /**
60
57
  * Resolves child elements to help interact with children
@@ -67,9 +64,9 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
67
64
  export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
68
65
  export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
69
66
  interface SourceMapValue {
70
- value: unknown;
71
- name?: string;
72
- graph?: Owner;
67
+ value: unknown;
68
+ name?: string;
69
+ graph?: Owner;
73
70
  }
74
71
  export declare function registerGraph(value: SourceMapValue): void;
75
72
  export {};