solid-js 2.0.0-experimental.5 → 2.0.0-experimental.6

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.
@@ -1,5 +1,5 @@
1
- export { $PROXY, $TRACK, $RAW, tryCatch, flatten, isEqual, isWrappable } from "@solidjs/signals";
2
- export { createAsync, createEffect, createMemo, createRenderEffect, createRoot, createSignal, flushSync, getObserver, getOwner, isPending, latest, mapArray, onCleanup, repeat, resolve, runWithObserver, runWithOwner, untrack } from "./signals.js";
1
+ export { $PROXY, $TRACK, tryCatch, flatten, isEqual, isWrappable } from "@solidjs/signals";
2
+ export { createAsync, createEffect, createMemo, createRenderEffect, createRoot, createSignal, flush, getObserver, getOwner, isPending, latest, mapArray, onCleanup, repeat, resolve, runWithObserver, runWithOwner, untrack } from "./signals.js";
3
3
  export { observable, from, children, createContext, onMount, useContext, ssrRunInScope } from "./reactive.js";
4
4
  export { createProjection, createStore, unwrap, reconcile, merge, omit } from "./store.js";
5
5
  export { createComponent, For, Repeat, Show, Switch, Match, ErrorBoundary, Suspense, enableHydration, createUniqueId, lazy, sharedConfig, ssrHandleError } from "./rendering.js";
@@ -26,4 +26,5 @@ export declare function from<T>(producer: ((setter: Setter<T>) => () => void) |
26
26
  unsubscribe: () => void;
27
27
  };
28
28
  }): Accessor<T>;
29
- export declare function ssrRunInScope<T>(fn: () => T): () => T;
29
+ export declare function ssrRunInScope(fn: () => any): () => any;
30
+ export declare function ssrRunInScope(array: (() => any)[]): (() => any)[];
@@ -1,7 +1,7 @@
1
1
  import { type Accessor } from "@solidjs/signals";
2
2
  import type { JSX } from "../jsx.js";
3
3
  import type { Component } from "../index.js";
4
- export declare function ssrHandleError(err: any): true | undefined;
4
+ export declare function ssrHandleError(err: any): Promise<any> | undefined;
5
5
  type SharedConfig = {
6
6
  context?: HydrationContext;
7
7
  getNextContextId(): string;
@@ -13,7 +13,7 @@ export declare function For<T>(props: {
13
13
  each: T[];
14
14
  fallback?: string;
15
15
  children: (item: Accessor<T>, index: Accessor<number>) => string;
16
- }): () => string[];
16
+ }): Accessor<string[]>;
17
17
  export declare function Repeat(props: {
18
18
  count: number;
19
19
  from?: number | undefined;
@@ -43,9 +43,7 @@ export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
43
43
  export declare function ErrorBoundary(props: {
44
44
  fallback: string | ((err: any, reset: () => void) => string);
45
45
  children: string;
46
- }): Accessor<{
47
- t: string;
48
- }>;
46
+ }): Accessor<SSRTemplateObject>;
49
47
  export declare function lazy<T extends Component<any>>(fn: () => Promise<{
50
48
  default: T;
51
49
  }>): T & {
@@ -54,14 +52,20 @@ export declare function lazy<T extends Component<any>>(fn: () => Promise<{
54
52
  }>;
55
53
  };
56
54
  export declare function enableHydration(): void;
55
+ type SSRTemplateObject = {
56
+ t: string[];
57
+ h: Function[];
58
+ p: Promise<any>[];
59
+ };
57
60
  type HydrationContext = {
58
61
  id: string;
59
62
  count: number;
60
63
  serialize: (id: string, v: Promise<any> | any, deferStream?: boolean) => void;
61
- resolve(value: any): string;
64
+ resolve(value: any): SSRTemplateObject;
65
+ ssr(template: string[], ...values: any[]): SSRTemplateObject;
66
+ escape(value: any): string;
62
67
  replace: (id: string, replacement: () => any) => void;
63
68
  block: (p: Promise<any>) => void;
64
- resources: Record<string, any>;
65
69
  registerFragment: (v: string) => (v?: string, err?: any) => boolean;
66
70
  async?: boolean;
67
71
  noHydrate: boolean;
@@ -69,5 +73,5 @@ type HydrationContext = {
69
73
  export declare function Suspense(props: {
70
74
  fallback?: string;
71
75
  children: string;
72
- }): any;
76
+ }): string | SSRTemplateObject | undefined;
73
77
  export {};
@@ -1,5 +1,14 @@
1
+ import { Owner } from "@solidjs/signals";
1
2
  export { createRoot, runWithOwner, onCleanup, getOwner } from "@solidjs/signals";
2
- import type { Accessor, Computation, ComputeFunction, EffectFunction, EffectOptions, MemoOptions, Signal, SignalOptions } from "@solidjs/signals";
3
+ import type { Accessor, ComputeFunction, EffectFunction, EffectOptions, MemoOptions, Signal, SignalOptions } from "@solidjs/signals";
4
+ declare class Computation<T> extends Owner {
5
+ _value: T;
6
+ _compute: ComputeFunction<T>;
7
+ _error: unknown;
8
+ constructor(initialValue: T, compute: ComputeFunction<T>);
9
+ update(): void;
10
+ read(): T;
11
+ }
3
12
  export declare function createSignal<T>(): Signal<T | undefined>;
4
13
  export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
5
14
  export declare function createSignal<T>(fn: ComputeFunction<T>, initialValue?: T, options?: SignalOptions<T>): Signal<T>;
@@ -15,9 +24,9 @@ export declare function createAsync<T>(compute: (prev?: T) => Promise<T> | Async
15
24
  export declare function isPending(fn: () => any, fallback?: boolean): boolean;
16
25
  export declare function latest<T>(fn: () => T, fallback?: T): T | undefined;
17
26
  export declare function resolve(): void;
18
- export declare function flushSync(): void;
27
+ export declare function flush(): void;
19
28
  export declare function getObserver(): Computation<any> | null;
20
- export declare function runWithObserver<T>(o: Computation, fn: () => T): T | undefined;
29
+ export declare function runWithObserver<T>(o: Computation<any>, fn: () => T): T | undefined;
21
30
  export declare function untrack<T>(fn: () => T): T;
22
31
  export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: {
23
32
  fallback?: Accessor<any>;