| import type { JSX } from "../jsx.cjs"; | ||
| /** | ||
| * A general `Component` has no implicit `children` prop. If desired, you can | ||
| * specify one as in `Component<{name: String, children: JSX.Element}>`. | ||
| */ | ||
| export type Component<P extends Record<string, any> = {}> = (props: P) => JSX.Element; | ||
| /** | ||
| * Extend props to forbid the `children` prop. | ||
| * Use this to prevent accidentally passing `children` to components that | ||
| * would silently throw them away. | ||
| */ | ||
| export type VoidProps<P extends Record<string, any> = {}> = P & { | ||
| children?: never; | ||
| }; | ||
| /** | ||
| * `VoidComponent` forbids the `children` prop. | ||
| * Use this to prevent accidentally passing `children` to components that | ||
| * would silently throw them away. | ||
| */ | ||
| export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>; | ||
| /** | ||
| * Extend props to allow an optional `children` prop with the usual | ||
| * type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.). | ||
| * Use this for components that you want to accept children. | ||
| */ | ||
| export type ParentProps<P extends Record<string, any> = {}> = P & { | ||
| children?: JSX.Element; | ||
| }; | ||
| /** | ||
| * `ParentComponent` allows an optional `children` prop with the usual | ||
| * type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.). | ||
| * Use this for components that you want to accept children. | ||
| */ | ||
| export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>; | ||
| /** | ||
| * Extend props to require a `children` prop with the specified type. | ||
| * Use this for components where you need a specific child type, | ||
| * typically a function that receives specific argument types. | ||
| * Note that all JSX <Elements> are of the type `JSX.Element`. | ||
| */ | ||
| export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & { | ||
| children: C; | ||
| }; | ||
| /** | ||
| * `FlowComponent` requires a `children` prop with the specified type. | ||
| * Use this for components where you need a specific child type, | ||
| * typically a function that receives specific argument types. | ||
| * Note that all JSX <Elements> are of the type `JSX.Element`. | ||
| */ | ||
| export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>; | ||
| export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {}); | ||
| /** | ||
| * Takes the props of the passed component and returns its type | ||
| * | ||
| * @example | ||
| * ComponentProps<typeof Portal> // { mount?: Node; useShadow?: boolean; children: JSX.Element } | ||
| * ComponentProps<'div'> // JSX.HTMLAttributes<HTMLDivElement> | ||
| */ | ||
| export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>; | ||
| /** | ||
| * Type of `props.ref`, for use in `Component` or `props` typing. | ||
| * | ||
| * @example Component<{ref: Ref<Element>}> | ||
| */ | ||
| export type Ref<T> = T | ((val: T) => void); | ||
| export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element; | ||
| export declare function lazy<T extends Component<any>>(fn: () => Promise<{ | ||
| default: T; | ||
| }>, moduleUrl?: string): T & { | ||
| preload: () => Promise<{ | ||
| default: T; | ||
| }>; | ||
| moduleUrl?: string; | ||
| }; | ||
| export declare function createUniqueId(): string; |
| import type { Accessor, EffectOptions } from "@solidjs/signals"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| import { FlowComponent } from "./component.cjs"; | ||
| export declare const IS_DEV: string | boolean; | ||
| export declare const $DEVCOMP: unique symbol; | ||
| export type NoInfer<T extends any> = [T][T extends any ? 0 : never]; | ||
| export type ContextProviderComponent<T> = FlowComponent<{ | ||
| value: T; | ||
| }>; | ||
| export interface Context<T> extends ContextProviderComponent<T> { | ||
| id: symbol; | ||
| defaultValue: T; | ||
| } | ||
| /** | ||
| * Creates a Context to handle a state scoped for the children of a component | ||
| * ```typescript | ||
| * interface Context<T> { | ||
| * id: symbol; | ||
| * Provider: FlowComponent<{ value: T }>; | ||
| * defaultValue: T; | ||
| * } | ||
| * export function createContext<T>( | ||
| * defaultValue?: T, | ||
| * options?: { name?: string } | ||
| * ): Context<T | undefined>; | ||
| * ``` | ||
| * @param defaultValue optional default to inject into context | ||
| * @param options allows to set a name in dev mode for debugging purposes | ||
| * @returns The context that contains the Provider Component and that can be used with `useContext` | ||
| * | ||
| * @description https://docs.solidjs.com/reference/component-apis/create-context | ||
| */ | ||
| export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>; | ||
| export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>; | ||
| /** | ||
| * Uses a context to receive a scoped state from a parent's Context.Provider | ||
| * | ||
| * @param context Context object made by `createContext` | ||
| * @returns the current or `defaultValue`, if present | ||
| * | ||
| * @description https://docs.solidjs.com/reference/component-apis/use-context | ||
| */ | ||
| export declare function useContext<T>(context: Context<T>): T; | ||
| export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>; | ||
| export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[]; | ||
| export type ChildrenReturn = Accessor<ResolvedChildren> & { | ||
| toArray: () => ResolvedJSXElement[]; | ||
| }; | ||
| /** | ||
| * Resolves child elements to help interact with children | ||
| * | ||
| * @param fn an accessor for the children | ||
| * @returns a accessor of the same children, but resolved | ||
| * | ||
| * @description https://docs.solidjs.com/reference/component-apis/children | ||
| */ | ||
| export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn; | ||
| export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V; |
| import type { Accessor } from "@solidjs/signals"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T; | ||
| type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element; | ||
| type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = JSX.Element | NonZeroParams<F>; | ||
| /** | ||
| * Creates a list of elements from a list | ||
| * | ||
| * it receives a map function as its child that receives list element and index accessors and returns a JSX-Element; if the list is empty, an optional fallback is returned: | ||
| * ```typescript | ||
| * <For each={items} fallback={<div>No items</div>}> | ||
| * {(item, index) => <div data-index={index()}>{item()}</div>} | ||
| * </For> | ||
| * ``` | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/for | ||
| */ | ||
| export declare function For<T extends readonly any[], U extends JSX.Element>(props: { | ||
| each: T | undefined | null | false; | ||
| fallback?: JSX.Element; | ||
| keyed?: boolean | ((item: T[number]) => any); | ||
| children: (item: Accessor<T[number]>, index: Accessor<number>) => U; | ||
| }): JSX.Element; | ||
| /** | ||
| * Creates a list elements from a count | ||
| * | ||
| * it receives a map function as its child that receives the index and returns a JSX-Element; if the list is empty, an optional fallback is returned: | ||
| * ```typescript | ||
| * <Repeat count={items.length} fallback={<div>No items</div>}> | ||
| * {(index) => <div data-index={index}>{items[index]}</div>} | ||
| * </Repeat> | ||
| * ``` | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/repeat | ||
| */ | ||
| export declare function Repeat<T extends JSX.Element>(props: { | ||
| count: number; | ||
| from?: number | undefined; | ||
| fallback?: JSX.Element; | ||
| children: ((index: number) => T) | T; | ||
| }): JSX.Element; | ||
| /** | ||
| * Conditionally render its children or an optional fallback component | ||
| * @description https://docs.solidjs.com/reference/components/show | ||
| */ | ||
| export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: { | ||
| when: T | undefined | null | false; | ||
| keyed?: boolean; | ||
| fallback?: JSX.Element; | ||
| children: ConditionalRenderChildren<T, F>; | ||
| }): JSX.Element; | ||
| /** | ||
| * Switches between content based on mutually exclusive conditions | ||
| * ```typescript | ||
| * <Switch fallback={<FourOhFour />}> | ||
| * <Match when={state.route === 'home'}> | ||
| * <Home /> | ||
| * </Match> | ||
| * <Match when={state.route === 'settings'}> | ||
| * <Settings /> | ||
| * </Match> | ||
| * </Switch> | ||
| * ``` | ||
| * @description https://docs.solidjs.com/reference/components/switch-and-match | ||
| */ | ||
| export declare function Switch(props: { | ||
| fallback?: JSX.Element; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = { | ||
| when: T | undefined | null | false; | ||
| keyed?: boolean; | ||
| children: ConditionalRenderChildren<T, F>; | ||
| }; | ||
| /** | ||
| * Selects a content based on condition when inside a `<Switch>` control flow | ||
| * ```typescript | ||
| * <Match when={condition()}> | ||
| * <Content/> | ||
| * </Match> | ||
| * ``` | ||
| * @description https://docs.solidjs.com/reference/components/switch-and-match | ||
| */ | ||
| export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element; | ||
| /** | ||
| * Catches uncaught errors inside components and renders a fallback content | ||
| * | ||
| * Also supports a callback form that passes the error and a reset function: | ||
| * ```typescript | ||
| * <Errored fallback={ | ||
| * (err, reset) => <div onClick={reset}>Error: {err.toString()}</div> | ||
| * }> | ||
| * <MyComp /> | ||
| * </Errored> | ||
| * ``` | ||
| * Errors thrown from the fallback can be caught by a parent Errored | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/error-boundary | ||
| */ | ||
| export declare function Errored(props: { | ||
| fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element); | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Tracks all resources inside a component and renders a fallback until they are all resolved | ||
| * ```typescript | ||
| * const AsyncComponent = lazy(() => import('./component')); | ||
| * | ||
| * <Loading fallback={<LoadingIndicator />}> | ||
| * <AsyncComponent /> | ||
| * </Loading> | ||
| * ``` | ||
| * @description https://docs.solidjs.com/reference/components/suspense | ||
| */ | ||
| export declare function Loading(props: { | ||
| fallback?: JSX.Element; | ||
| on?: any; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Coordinates the reveal timing of sibling `<Loading>` boundaries. | ||
| * | ||
| * - **Sequential** (default): boundaries reveal in DOM order as each resolves. | ||
| * - **Together** (`together`): all boundaries wait until the group is ready, then reveal at once. | ||
| * - **Collapsed** (`collapsed`, sequential only): only the frontier boundary shows its fallback; | ||
| * later boundaries produce nothing until their turn. | ||
| * | ||
| * ```typescript | ||
| * <Reveal> | ||
| * <Loading fallback={<Skeleton />}><ProfileHeader /></Loading> | ||
| * <Loading fallback={<Skeleton />}><Posts /></Loading> | ||
| * </Reveal> | ||
| * ``` | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/reveal | ||
| */ | ||
| export declare function Reveal(props: { | ||
| together?: boolean; | ||
| collapsed?: boolean; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| export {}; |
| import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type ProjectionOptions, type Store, type StoreSetter, type Context } from "@solidjs/signals"; | ||
| import { JSX } from "../jsx.cjs"; | ||
| type HydrationSsrFields = { | ||
| deferStream?: boolean; | ||
| ssrSource?: "server" | "hybrid" | "initial" | "client"; | ||
| }; | ||
| declare module "@solidjs/signals" { | ||
| interface MemoOptions<T> extends HydrationSsrFields { | ||
| } | ||
| interface SignalOptions<T> extends HydrationSsrFields { | ||
| } | ||
| interface EffectOptions extends HydrationSsrFields { | ||
| } | ||
| } | ||
| export type HydrationProjectionOptions = ProjectionOptions & { | ||
| ssrSource?: "server" | "hybrid" | "initial" | "client"; | ||
| }; | ||
| export type HydrationContext = {}; | ||
| export declare const NoHydrateContext: Context<boolean>; | ||
| type SharedConfig = { | ||
| hydrating: boolean; | ||
| resources?: { | ||
| [key: string]: any; | ||
| }; | ||
| load?: (id: string) => Promise<any> | any; | ||
| has?: (id: string) => boolean; | ||
| gather?: (key: string) => void; | ||
| cleanupFragment?: (id: string) => void; | ||
| loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined; | ||
| registry?: Map<string, Element>; | ||
| completed?: WeakSet<Element> | null; | ||
| events?: any[] | null; | ||
| verifyHydration?: () => void; | ||
| done: boolean; | ||
| getNextContextId(): string; | ||
| }; | ||
| export declare const sharedConfig: SharedConfig; | ||
| /** | ||
| * Registers a callback to run once when all hydration completes | ||
| * (all boundaries hydrated or cancelled). If hydration is already | ||
| * complete (or not hydrating), fires via queueMicrotask. | ||
| */ | ||
| export declare function onHydrationEnd(callback: () => void): void; | ||
| export declare function enableHydration(): void; | ||
| export declare const createMemo: typeof coreMemo; | ||
| export declare const createSignal: typeof coreSignal; | ||
| export declare const createErrorBoundary: typeof coreErrorBoundary; | ||
| export declare const createOptimistic: typeof coreOptimistic; | ||
| export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: HydrationProjectionOptions) => Store<T> & { | ||
| [$REFRESH]: any; | ||
| }; | ||
| type NoFn<T> = T extends Function ? never : T; | ||
| export declare const createStore: { | ||
| <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>]; | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| [$REFRESH]: any; | ||
| }, set: StoreSetter<T>]; | ||
| }; | ||
| export declare const createOptimisticStore: { | ||
| <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>]; | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| [$REFRESH]: any; | ||
| }, set: StoreSetter<T>]; | ||
| }; | ||
| export declare const createRenderEffect: typeof coreRenderEffect; | ||
| export declare const createEffect: typeof coreEffect; | ||
| /** | ||
| * Tracks all resources inside a component and renders a fallback until they are all resolved | ||
| * ```typescript | ||
| * const AsyncComponent = lazy(() => import('./component')); | ||
| * | ||
| * <Loading fallback={<LoadingIndicator />}> | ||
| * <AsyncComponent /> | ||
| * </Loading> | ||
| * ``` | ||
| * @description https://docs.solidjs.com/reference/components/suspense | ||
| */ | ||
| export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: { | ||
| on?: () => any; | ||
| }): () => unknown; | ||
| /** | ||
| * Disables hydration for its children on the client. | ||
| * During hydration, skips the subtree entirely (returns undefined so DOM is left untouched). | ||
| * After hydration, renders children fresh. | ||
| */ | ||
| export declare function NoHydration(props: { | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Re-enables hydration within a NoHydration zone (passthrough on client). | ||
| */ | ||
| export declare function Hydration(props: { | ||
| id?: string; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| export {}; |
| export { $PROXY, $REFRESH, $TRACK, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| export { $DEVCOMP, children, createContext, useContext } from "./client/core.cjs"; | ||
| export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.cjs"; | ||
| export * from "./client/component.cjs"; | ||
| export * from "./client/flow.cjs"; | ||
| export { sharedConfig, enableHydration, createErrorBoundary, createLoadingBoundary, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect, NoHydration, Hydration, NoHydrateContext } from "./client/hydration.cjs"; | ||
| export declare function ssrHandleError(): void; | ||
| export declare function ssrRunInScope(): void; | ||
| import type { JSX } from "./jsx.cjs"; | ||
| type JSXElement = JSX.Element; | ||
| export type { JSXElement, JSX }; | ||
| import { type Dev } from "@solidjs/signals"; | ||
| export declare const DEV: Dev | undefined; | ||
| declare global { | ||
| var Solid$$: boolean; | ||
| } |
| /** | ||
| * Shared type-level helpers used to derive `prop:*` attribute typings from | ||
| * DOM element interfaces (e.g. `HTMLInputElement`, `HTMLButtonElement`). | ||
| * | ||
| * The wrapping of each value (`FunctionMaybe<T>` in `jsx-h.d.ts` vs. the | ||
| * raw value in `jsx.d.ts`) is applied by each consumer when composing its | ||
| * own `Properties<T>` mapped type. That way this file stays identical in | ||
| * both reactive and non-reactive contexts and only needs to exist once. | ||
| * | ||
| * originally from | ||
| * @url https://github.com/potahtml/pota | ||
| */ | ||
| /** Base-class properties shared by all elements — skipped from `prop:*`. */ | ||
| export type SkipPropsFrom = HTMLUnknownElement & HTMLElement & Element & Node; | ||
| /** | ||
| * Value types allowed on a `prop:*`. Primitives plus the writable | ||
| * non-primitive DOM-object props worth exposing: | ||
| * | ||
| * - `HTMLMediaElement.srcObject` | ||
| * - `HTMLButtonElement.popoverTargetElement` / `commandForElement` (and the same via | ||
| * `PopoverTargetAttributes` mixin on `HTMLInputElement`) | ||
| */ | ||
| export type PropValue = | ||
| | string | ||
| | number | ||
| | boolean | ||
| | null | ||
| | MediaStream | ||
| | MediaSource | ||
| | Blob | ||
| | File | ||
| | Element; | ||
| /** | ||
| * Ergonomics widening for emitted `prop:*` value types: | ||
| * | ||
| * - general `string` → `string | number` (HTML coerces numbers) | ||
| * - string literal unions (`'on' | 'off'`) stay exact, so users still get autocomplete / | ||
| * narrowing | ||
| * - other types pass through unchanged | ||
| */ | ||
| export type WidenPropValue<V> = [V] extends [string] | ||
| ? string extends V | ||
| ? string | number | ||
| : V | ||
| : V; | ||
| /** | ||
| * Structurally identical → `Y`; distinct → `N`. Used by `IsReadonlyKey` to detect | ||
| * readonly keys by comparing `Pick<T, K>` with `Readonly<Pick<T, K>>`. | ||
| */ | ||
| export type IfEquals<A, B, Y = unknown, N = never> = | ||
| (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N; | ||
| /** | ||
| * True when `K` is readonly on `T`. Singleton-constant properties (e.g. | ||
| * `tagName: "INPUT"`, `nodeType: 1`) are always `readonly` in `lib.dom.d.ts`, so this | ||
| * single check covers both readonly and singleton-literal cases. | ||
| */ | ||
| export type IsReadonlyKey<T, K extends keyof T> = IfEquals< | ||
| Pick<T, K>, | ||
| Readonly<Pick<T, K>>, | ||
| true, | ||
| false | ||
| >; | ||
| /** | ||
| * Resolves to the `prop:K` string literal when `K` is a writable, element-specific | ||
| * property suitable for a `prop:*` attribute; otherwise resolves to `never` so the | ||
| * key is filtered out of the resulting mapped type. | ||
| * | ||
| * Filters out: | ||
| * | ||
| * - base-class keys (via `SkipPropsFrom`) | ||
| * - aria-* keys (already typed via `AriaAttributes`) | ||
| * - readonly keys | ||
| * - keys whose value types fall outside `PropValue` | ||
| * - the generic `string` index signature (e.g. `HTMLFormElement[name: string]: any`), | ||
| * which would otherwise shadow every key with an `any`-typed `prop:*` | ||
| */ | ||
| export type PropKey<T, K extends keyof T> = K extends keyof SkipPropsFrom | ||
| ? never | ||
| : K extends string | ||
| ? string extends K | ||
| ? never | ||
| : K extends `aria${string}` | ||
| ? never | ||
| : T[K] extends PropValue | ||
| ? IsReadonlyKey<T, K> extends true | ||
| ? never | ||
| : `prop:${K}` | ||
| : never | ||
| : never; |
Sorry, the diff of this file is too big to display
| { | ||
| "type": "commonjs" | ||
| } |
| import type { JSX } from "../jsx.cjs"; | ||
| export declare function enableHydration(): void; | ||
| /** | ||
| * A general `Component` has no implicit `children` prop. If desired, you can | ||
| * specify one as in `Component<{name: String, children: JSX.Element}>`. | ||
| */ | ||
| export type Component<P extends Record<string, any> = {}> = (props: P) => JSX.Element; | ||
| /** | ||
| * Extend props to forbid the `children` prop. | ||
| */ | ||
| export type VoidProps<P extends Record<string, any> = {}> = P & { | ||
| children?: never; | ||
| }; | ||
| /** | ||
| * `VoidComponent` forbids the `children` prop. | ||
| */ | ||
| export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>; | ||
| /** | ||
| * Extend props to allow an optional `children` prop with the usual type in JSX. | ||
| */ | ||
| export type ParentProps<P extends Record<string, any> = {}> = P & { | ||
| children?: JSX.Element; | ||
| }; | ||
| /** | ||
| * `ParentComponent` allows an optional `children` prop with the usual type in JSX. | ||
| */ | ||
| export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>; | ||
| /** | ||
| * Extend props to require a `children` prop with the specified type. | ||
| */ | ||
| export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & { | ||
| children: C; | ||
| }; | ||
| /** | ||
| * `FlowComponent` requires a `children` prop with the specified type. | ||
| */ | ||
| export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>; | ||
| export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {}); | ||
| /** | ||
| * Takes the props of the passed component and returns its type | ||
| */ | ||
| export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>; | ||
| /** | ||
| * Type of `props.ref`, for use in `Component` or `props` typing. | ||
| */ | ||
| export type Ref<T> = T | ((val: T) => void); | ||
| /** | ||
| * Creates a component. On server, just calls the function directly (no untrack needed). | ||
| */ | ||
| export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element; | ||
| /** | ||
| * Lazy load a function component asynchronously. | ||
| * On server, returns a createMemo that throws NotReadyError until the module resolves, | ||
| * allowing resolveSSRNode to capture it as a fine-grained hole. The memo naturally | ||
| * scopes the owner so hydration IDs align with the client's createMemo in lazy(). | ||
| * Requires `moduleUrl` for SSR — the bundler plugin injects the module specifier | ||
| * so the server can look up client chunk URLs from the asset manifest. | ||
| */ | ||
| export declare function lazy<T extends Component<any>>(fn: () => Promise<{ | ||
| default: T; | ||
| }>, moduleUrl?: string): T & { | ||
| preload: () => Promise<{ | ||
| default: T; | ||
| }>; | ||
| moduleUrl?: string; | ||
| }; | ||
| export declare function createUniqueId(): string; |
| import type { Accessor, EffectOptions } from "./signals.cjs"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| import type { FlowComponent } from "./component.cjs"; | ||
| export declare const $DEVCOMP: unique symbol; | ||
| export type NoInfer<T extends any> = [T][T extends any ? 0 : never]; | ||
| export type ContextProviderComponent<T> = FlowComponent<{ | ||
| value: T; | ||
| }>; | ||
| export interface Context<T> extends ContextProviderComponent<T> { | ||
| id: symbol; | ||
| defaultValue: T; | ||
| } | ||
| /** | ||
| * Creates a Context to handle a state scoped for the children of a component | ||
| * @param defaultValue optional default to inject into context | ||
| * @param options allows to set a name in dev mode for debugging purposes | ||
| * @returns The context that contains the Provider Component and that can be used with `useContext` | ||
| */ | ||
| export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>; | ||
| export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>; | ||
| /** | ||
| * Uses a context to receive a scoped state from a parent's Context.Provider | ||
| * @param context Context object made by `createContext` | ||
| * @returns the current or `defaultValue`, if present | ||
| */ | ||
| export declare function useContext<T>(context: Context<T>): T; | ||
| export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>; | ||
| export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[]; | ||
| export type ChildrenReturn = Accessor<ResolvedChildren> & { | ||
| toArray: () => ResolvedJSXElement[]; | ||
| }; | ||
| /** | ||
| * Resolves child elements to help interact with children | ||
| * @param fn an accessor for the children | ||
| * @returns a accessor of the same children, but resolved | ||
| */ | ||
| export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn; | ||
| /** | ||
| * Pass-through for SSR dynamic expressions. | ||
| * On the client, insert() render effects are transparent (0 owner slots), | ||
| * so the server doesn't need to create owners for these either. | ||
| */ | ||
| export declare function ssrRunInScope(fn: () => any): () => any; | ||
| export declare function ssrRunInScope(array: (() => any)[]): (() => any)[]; |
| import type { Accessor } from "./signals.cjs"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T; | ||
| type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element; | ||
| type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = JSX.Element | NonZeroParams<F>; | ||
| /** | ||
| * Creates a list of elements from a list | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/for | ||
| */ | ||
| export declare function For<T extends readonly any[], U extends JSX.Element>(props: { | ||
| each: T | undefined | null | false; | ||
| fallback?: JSX.Element; | ||
| keyed?: boolean | ((item: T[number]) => any); | ||
| children: (item: Accessor<T[number]>, index: Accessor<number>) => U; | ||
| }): JSX.Element; | ||
| /** | ||
| * Creates a list elements from a count | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/repeat | ||
| */ | ||
| export declare function Repeat<T extends JSX.Element>(props: { | ||
| count: number; | ||
| from?: number | undefined; | ||
| fallback?: JSX.Element; | ||
| children: ((index: number) => T) | T; | ||
| }): JSX.Element; | ||
| /** | ||
| * Conditionally render its children or an optional fallback component | ||
| * @description https://docs.solidjs.com/reference/components/show | ||
| */ | ||
| export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: { | ||
| when: T | undefined | null | false; | ||
| keyed?: boolean; | ||
| fallback?: JSX.Element; | ||
| children: ConditionalRenderChildren<T, F>; | ||
| }): JSX.Element; | ||
| /** | ||
| * Switches between content based on mutually exclusive conditions | ||
| * @description https://docs.solidjs.com/reference/components/switch-and-match | ||
| */ | ||
| export declare function Switch(props: { | ||
| fallback?: JSX.Element; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = { | ||
| when: T | undefined | null | false; | ||
| keyed?: boolean; | ||
| children: ConditionalRenderChildren<T, F>; | ||
| }; | ||
| /** | ||
| * Selects a content based on condition when inside a `<Switch>` control flow | ||
| * @description https://docs.solidjs.com/reference/components/switch-and-match | ||
| */ | ||
| export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element; | ||
| /** | ||
| * Catches uncaught errors inside components and renders a fallback content | ||
| * @description https://docs.solidjs.com/reference/components/error-boundary | ||
| */ | ||
| export declare function Errored(props: { | ||
| fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element); | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Tracks all resources inside a component and renders a fallback until they are all resolved | ||
| * @description https://docs.solidjs.com/reference/components/suspense | ||
| */ | ||
| export declare function Loading(props: { | ||
| fallback?: JSX.Element; | ||
| on?: any; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Coordinates the reveal timing of sibling `<Loading>` boundaries during SSR. | ||
| * @description https://docs.solidjs.com/reference/components/reveal | ||
| */ | ||
| export declare function Reveal(props: { | ||
| together?: boolean; | ||
| collapsed?: boolean; | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| export {}; |
| import type { Context } from "./signals.cjs"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| export { sharedConfig, NoHydrateContext } from "./shared.cjs"; | ||
| export type { HydrationContext, SSRTemplateObject } from "./shared.cjs"; | ||
| export type ServerRevealGroup = { | ||
| id: string; | ||
| register(key: string, options?: { | ||
| onActivate?: () => void; | ||
| }): boolean; | ||
| onResolved(key: string): void; | ||
| }; | ||
| export declare const RevealGroupContext: Context<ServerRevealGroup | null>; | ||
| /** | ||
| * Handles errors during SSR rendering. | ||
| * Returns the promise source for NotReadyError (for async handling), | ||
| * or delegates to the ErrorContext handler. | ||
| */ | ||
| export declare function ssrHandleError(err: any): Promise<any> | undefined; | ||
| /** | ||
| * Tracks all resources inside a component and renders a fallback until they are all resolved | ||
| * | ||
| * On the server, this is SSR-aware: it handles async mode (streaming) by registering | ||
| * fragments and resolving asynchronously, and sync mode by serializing fallback markers. | ||
| * | ||
| * @description https://docs.solidjs.com/reference/components/suspense | ||
| */ | ||
| export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: { | ||
| on?: () => any; | ||
| }): () => unknown; | ||
| /** | ||
| * Disables hydration for its children during SSR. | ||
| * Elements inside will not receive hydration keys (`_hk`) and signals will not be serialized. | ||
| * Use `Hydration` to re-enable hydration within a `NoHydration` zone. | ||
| */ | ||
| export declare function NoHydration(props: { | ||
| children: JSX.Element; | ||
| }): JSX.Element; | ||
| /** | ||
| * Re-enables hydration within a `NoHydration` zone, establishing a new ID namespace. | ||
| * Pass an `id` prop matching the client's `hydrate({ renderId })` to align hydration keys. | ||
| * Has no effect when not inside a `NoHydration` zone (passthrough). | ||
| */ | ||
| export declare function Hydration(props: { | ||
| id?: string; | ||
| children: JSX.Element; | ||
| }): JSX.Element; |
| export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createErrorBoundary, createOwner, createProjection, createReaction, createRenderEffect, createRevealOrder, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, enableExternalSource, enforceLoadingBoundary, untrack } from "./signals.cjs"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter, PatchOp } from "./signals.cjs"; | ||
| export { $DEVCOMP, children, createContext, useContext, ssrRunInScope } from "./core.cjs"; | ||
| export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./core.cjs"; | ||
| export * from "./component.cjs"; | ||
| export * from "./flow.cjs"; | ||
| export { sharedConfig, createLoadingBoundary, ssrHandleError, NoHydration, Hydration, NoHydrateContext } from "./hydration.cjs"; | ||
| export type { HydrationContext } from "./hydration.cjs"; | ||
| import type { JSX } from "../jsx.cjs"; | ||
| type JSXElement = JSX.Element; | ||
| export type { JSXElement, JSX }; | ||
| export declare const DEV: undefined; |
| import type { Context } from "@solidjs/signals"; | ||
| export type SSRTemplateObject = { | ||
| t: string[]; | ||
| h: Function[]; | ||
| p: Promise<any>[]; | ||
| }; | ||
| export type HydrationContext = { | ||
| id: string; | ||
| count: number; | ||
| /** | ||
| * Serialize a value for client hydration. | ||
| * In renderToStream (async: true), accepts promises and async iterables. | ||
| * In renderToString (async: false), only synchronous values are allowed — | ||
| * passing async values will throw. | ||
| */ | ||
| serialize: (id: string, v: any, deferStream?: boolean) => void; | ||
| resolve(value: any): SSRTemplateObject; | ||
| ssr(template: string[], ...values: any[]): SSRTemplateObject; | ||
| escape(value: any): string; | ||
| replace: (id: string, replacement: () => any) => void; | ||
| block: (p: Promise<any>) => void; | ||
| registerFragment: (v: string, options?: { | ||
| revealGroup?: string; | ||
| }) => (v?: string, err?: any) => boolean; | ||
| revealFragments?: (groupOrKeys: string | string[]) => void; | ||
| revealFallbacks?: (groupOrKeys: string | string[]) => void; | ||
| /** Register a client-side asset URL discovered during SSR (e.g. from lazy()). */ | ||
| registerAsset?: (type: "module" | "style", url: string) => void; | ||
| /** Register a moduleUrl-to-entryUrl mapping for the current boundary. */ | ||
| registerModule?: (moduleUrl: string, entryUrl: string) => void; | ||
| /** Resolve a module's JS and CSS assets from the asset manifest. Set by dom-expressions. */ | ||
| resolveAssets?: (moduleUrl: string) => { | ||
| js: string[]; | ||
| css: string[]; | ||
| } | null; | ||
| /** Retrieve the moduleUrl-to-entryUrl map for a boundary. */ | ||
| getBoundaryModules?: (id: string) => Record<string, string> | null; | ||
| /** @internal Tracks which Loading boundary is currently rendering. Set by dom-expressions via applyAssetTracking(). */ | ||
| _currentBoundaryId?: string | null; | ||
| assets: any[]; | ||
| /** True only in renderToStream — enables async data serialization and streaming. */ | ||
| async?: boolean; | ||
| }; | ||
| export declare const NoHydrateContext: Context<boolean>; | ||
| type SharedConfig = { | ||
| context?: HydrationContext; | ||
| getNextContextId(): string | undefined; | ||
| }; | ||
| export declare const sharedConfig: SharedConfig; | ||
| export {}; |
| export { createRoot, createOwner, runWithOwner, getOwner, isDisposed, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals"; | ||
| export { flatten } from "@solidjs/signals"; | ||
| export { snapshot, merge, omit, storePath, $PROXY, $REFRESH, $TRACK } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals"; | ||
| import { sharedConfig, NoHydrateContext } from "./shared.cjs"; | ||
| interface ServerComputation<T = any> { | ||
| owner: Owner; | ||
| value: T; | ||
| compute: ComputeFunction<any, T>; | ||
| error: unknown; | ||
| computed: boolean; | ||
| disposed: boolean; | ||
| } | ||
| export declare function getObserver(): ServerComputation<any> | null; | ||
| export declare function createSignal<T>(): Signal<T | undefined>; | ||
| export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: MemoOptions<T>): Accessor<T>; | ||
| export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1]; | ||
| export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T; | ||
| export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void; | ||
| export declare function createRenderEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effectFn: EffectFunction<NoInfer<T>, T>, options?: EffectOptions): void; | ||
| export declare function createTrackedEffect(compute: () => void | (() => void), options?: EffectOptions): void; | ||
| export declare function createReaction(effectFn: EffectFunction<undefined> | EffectBundle<undefined>, options?: EffectOptions): (tracking: () => void) => void; | ||
| export declare function createOptimistic<T>(): Signal<T | undefined>; | ||
| export declare function createOptimistic<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createOptimistic<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createStore<T extends object>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>]; | ||
| export declare function createStore<T extends object>(fn: (store: T) => void | T | Promise<void | T>, store: Partial<T> | Store<T>): [get: Store<T>, set: StoreSetter<T>]; | ||
| export declare const createOptimisticStore: typeof createStore; | ||
| export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: Partial<T>, options?: { | ||
| deferStream?: boolean; | ||
| ssrSource?: string; | ||
| }): Store<T>; | ||
| export declare function reconcile<T extends U, U extends object>(value: T): (state: U) => T; | ||
| export declare function deep<T extends object>(store: Store<T>): Store<T>; | ||
| export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: { | ||
| keyed?: boolean | ((item: T) => any); | ||
| fallback?: Accessor<any>; | ||
| }): () => U[]; | ||
| export declare function repeat<T>(count: Accessor<number>, mapFn: (i: number) => T, options?: { | ||
| fallback?: Accessor<any>; | ||
| from?: Accessor<number | undefined>; | ||
| }): () => T[]; | ||
| declare const ErrorContext: Context<((err: any) => void) | null>; | ||
| export { ErrorContext }; | ||
| export declare function runWithBoundaryErrorContext<T>(owner: Owner, render: () => T, onError: (err: any, parentHandler: ((err: any) => void) | null) => void, context?: NonNullable<typeof sharedConfig.context>, boundaryId?: string): T; | ||
| export { NoHydrateContext }; | ||
| export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): () => unknown; | ||
| export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: { | ||
| on?: () => any; | ||
| }): () => unknown; | ||
| export declare function createRevealOrder<T>(fn: () => T, _options?: { | ||
| together?: () => boolean; | ||
| collapsed?: () => boolean; | ||
| }): T; | ||
| export declare function untrack<T>(fn: () => T): T; | ||
| export declare function flush(): void; | ||
| export declare function resolve<T>(fn: () => T): Promise<T>; | ||
| export declare function isPending(fn: () => any, fallback?: boolean): boolean; | ||
| export declare function latest<T>(fn: () => T): T; | ||
| export declare function isRefreshing(): boolean; | ||
| export declare function refresh<T>(fn: () => T): T; | ||
| export declare function action<T extends (...args: any[]) => any>(fn: T): T; | ||
| export declare function onSettled(callback: () => void | (() => void)): void; | ||
| type NoInfer<T extends any> = [T][T extends any ? 0 : never]; |
| /** | ||
| * Shared type-level helpers used to derive `prop:*` attribute typings from | ||
| * DOM element interfaces (e.g. `HTMLInputElement`, `HTMLButtonElement`). | ||
| * | ||
| * The wrapping of each value (`FunctionMaybe<T>` in `jsx-h.d.ts` vs. the | ||
| * raw value in `jsx.d.ts`) is applied by each consumer when composing its | ||
| * own `Properties<T>` mapped type. That way this file stays identical in | ||
| * both reactive and non-reactive contexts and only needs to exist once. | ||
| * | ||
| * originally from | ||
| * @url https://github.com/potahtml/pota | ||
| */ | ||
| /** Base-class properties shared by all elements — skipped from `prop:*`. */ | ||
| export type SkipPropsFrom = HTMLUnknownElement & HTMLElement & Element & Node; | ||
| /** | ||
| * Value types allowed on a `prop:*`. Primitives plus the writable | ||
| * non-primitive DOM-object props worth exposing: | ||
| * | ||
| * - `HTMLMediaElement.srcObject` | ||
| * - `HTMLButtonElement.popoverTargetElement` / `commandForElement` (and the same via | ||
| * `PopoverTargetAttributes` mixin on `HTMLInputElement`) | ||
| */ | ||
| export type PropValue = | ||
| | string | ||
| | number | ||
| | boolean | ||
| | null | ||
| | MediaStream | ||
| | MediaSource | ||
| | Blob | ||
| | File | ||
| | Element; | ||
| /** | ||
| * Ergonomics widening for emitted `prop:*` value types: | ||
| * | ||
| * - general `string` → `string | number` (HTML coerces numbers) | ||
| * - string literal unions (`'on' | 'off'`) stay exact, so users still get autocomplete / | ||
| * narrowing | ||
| * - other types pass through unchanged | ||
| */ | ||
| export type WidenPropValue<V> = [V] extends [string] | ||
| ? string extends V | ||
| ? string | number | ||
| : V | ||
| : V; | ||
| /** | ||
| * Structurally identical → `Y`; distinct → `N`. Used by `IsReadonlyKey` to detect | ||
| * readonly keys by comparing `Pick<T, K>` with `Readonly<Pick<T, K>>`. | ||
| */ | ||
| export type IfEquals<A, B, Y = unknown, N = never> = | ||
| (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N; | ||
| /** | ||
| * True when `K` is readonly on `T`. Singleton-constant properties (e.g. | ||
| * `tagName: "INPUT"`, `nodeType: 1`) are always `readonly` in `lib.dom.d.ts`, so this | ||
| * single check covers both readonly and singleton-literal cases. | ||
| */ | ||
| export type IsReadonlyKey<T, K extends keyof T> = IfEquals< | ||
| Pick<T, K>, | ||
| Readonly<Pick<T, K>>, | ||
| true, | ||
| false | ||
| >; | ||
| /** | ||
| * Resolves to the `prop:K` string literal when `K` is a writable, element-specific | ||
| * property suitable for a `prop:*` attribute; otherwise resolves to `never` so the | ||
| * key is filtered out of the resulting mapped type. | ||
| * | ||
| * Filters out: | ||
| * | ||
| * - base-class keys (via `SkipPropsFrom`) | ||
| * - aria-* keys (already typed via `AriaAttributes`) | ||
| * - readonly keys | ||
| * - keys whose value types fall outside `PropValue` | ||
| * - the generic `string` index signature (e.g. `HTMLFormElement[name: string]: any`), | ||
| * which would otherwise shadow every key with an `any`-typed `prop:*` | ||
| */ | ||
| export type PropKey<T, K extends keyof T> = K extends keyof SkipPropsFrom | ||
| ? never | ||
| : K extends string | ||
| ? string extends K | ||
| ? never | ||
| : K extends `aria${string}` | ||
| ? never | ||
| : T[K] extends PropValue | ||
| ? IsReadonlyKey<T, K> extends true | ||
| ? never | ||
| : `prop:${K}` | ||
| : never | ||
| : never; |
+56
-74
@@ -22,6 +22,6 @@ 'use strict'; | ||
| function children(fn) { | ||
| const c = signals.createMemo(fn, undefined, { | ||
| const c = signals.createMemo(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = signals.createMemo(() => signals.flatten(c()), undefined, { | ||
| const memo = signals.createMemo(() => signals.flatten(c()), { | ||
| name: "children", | ||
@@ -286,3 +286,3 @@ lazy: true | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, options) { | ||
| const parent = signals.getOwner(); | ||
@@ -299,3 +299,3 @@ const expectedId = signals.peekNextChildId(parent); | ||
| }; | ||
| return coreFn(() => iterable, value, options); | ||
| return coreFn(() => iterable, options); | ||
| } | ||
@@ -375,5 +375,5 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) { | ||
| } | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| function hydratedCreateMemo(compute, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return signals.createMemo(compute, value, options); | ||
| return signals.createMemo(compute, options); | ||
| } | ||
@@ -384,8 +384,8 @@ markTopLevelSnapshotScope(); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const memo = signals.createMemo(prev => { | ||
| if (!hydrated()) return prev ?? value; | ||
| if (!hydrated()) return prev; | ||
| return compute(prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -398,21 +398,21 @@ return memo; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, value, options); | ||
| return prev; | ||
| }, options); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, value, options); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createMemo(prev => readSerializedOrCompute(compute, prev), value, options); | ||
| return signals.createMemo(prev => readSerializedOrCompute(compute, prev), options); | ||
| } | ||
| function hydratedCreateSignal(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second, third); | ||
| function hydratedCreateSignal(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = signals.createSignal(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -425,8 +425,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -453,14 +453,14 @@ function hydratedCreateErrorBoundary(fn, fallback) { | ||
| } | ||
| function hydratedCreateOptimistic(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second, third); | ||
| function hydratedCreateOptimistic(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = signals.createOptimistic(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -473,8 +473,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -487,3 +487,3 @@ function wrapStoreFn(fn) { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -499,3 +499,3 @@ const result = coreFn(draft => { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -530,3 +530,3 @@ const result = coreFn(draft => { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}); | ||
| return hydrateStoreLikeFn(signals.createStore, first, second ?? {}, third, ssrSource); | ||
@@ -538,3 +538,3 @@ } | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}); | ||
| return hydrateStoreLikeFn(signals.createOptimisticStore, first, second ?? {}, third, ssrSource); | ||
@@ -549,12 +549,12 @@ } | ||
| } | ||
| function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options); | ||
| function hydratedEffect(coreFn, compute, effectFn, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| let active = false; | ||
| coreFn(prev => { | ||
| if (!hydrated()) return value; | ||
| if (!hydrated()) return prev; | ||
| active = true; | ||
@@ -565,3 +565,3 @@ return compute(prev); | ||
| return effectFn(next, prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -574,14 +574,14 @@ return; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, effectFn, value, options); | ||
| return prev; | ||
| }, effectFn, options); | ||
| return; | ||
| } | ||
| markTopLevelSnapshotScope(); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, value, options); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options); | ||
| } | ||
| function hydratedCreateRenderEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options); | ||
| function hydratedCreateRenderEffect(compute, effectFn, options) { | ||
| return hydratedEffect(signals.createRenderEffect, compute, effectFn, options); | ||
| } | ||
| function hydratedCreateEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(signals.createEffect, compute, effectFn, value, options); | ||
| function hydratedCreateEffect(compute, effectFn, options) { | ||
| return hydratedEffect(signals.createEffect, compute, effectFn, options); | ||
| } | ||
@@ -645,20 +645,2 @@ function enableHydration() { | ||
| const createEffect = (...args) => (_createEffect || signals.createEffect)(...args); | ||
| function loadModuleAssets(mapping) { | ||
| const hy = globalThis._$HY; | ||
| if (!hy) return; | ||
| if (!hy.modules) hy.modules = {}; | ||
| if (!hy.loading) hy.loading = {}; | ||
| const pending = []; | ||
| for (const moduleUrl in mapping) { | ||
| if (hy.modules[moduleUrl]) continue; | ||
| const entryUrl = mapping[moduleUrl]; | ||
| if (!hy.loading[moduleUrl]) { | ||
| hy.loading[moduleUrl] = import(entryUrl).then(mod => { | ||
| hy.modules[moduleUrl] = mod; | ||
| }); | ||
| } | ||
| pending.push(hy.loading[moduleUrl]); | ||
| } | ||
| return pending.length ? Promise.all(pending).then(() => {}) : undefined; | ||
| } | ||
| function createBoundaryTrigger() { | ||
@@ -732,3 +714,3 @@ signals.setSnapshotCapture(false); | ||
| const mapping = sharedConfig.load(id + "_assets"); | ||
| if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping); | ||
| if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping); | ||
| } | ||
@@ -852,6 +834,6 @@ if (sharedConfig.hydrating && sharedConfig.has(id)) { | ||
| const keyed = props.keyed; | ||
| const conditionValue = signals.createMemo(() => props.when, undefined, { | ||
| const conditionValue = signals.createMemo(() => props.when, { | ||
| name: "condition value" | ||
| } ); | ||
| const condition = keyed ? conditionValue : signals.createMemo(conditionValue, undefined, { | ||
| const condition = keyed ? conditionValue : signals.createMemo(conditionValue, { | ||
| equals: (a, b) => !a === !b, | ||
@@ -871,3 +853,3 @@ name: "condition" | ||
| return props.fallback; | ||
| }, undefined, { | ||
| }, { | ||
| name: "value" | ||
@@ -885,6 +867,6 @@ } ); | ||
| const prevFunc = func; | ||
| const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined, { | ||
| const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, { | ||
| name: "condition value" | ||
| } ); | ||
| const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, undefined, { | ||
| const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, { | ||
| equals: (a, b) => !a === !b, | ||
@@ -907,3 +889,3 @@ name: "condition" | ||
| }), "<Match>") : child; | ||
| }, undefined, { | ||
| }, { | ||
| name: "eval conditions" | ||
@@ -910,0 +892,0 @@ } ); |
+56
-74
@@ -21,6 +21,6 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, getOwner, untrack, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, onCleanup, isDisposed, peekNextChildId, clearSnapshots, flush, markSnapshotScope, mapArray, repeat, createRevealOrder, DEV as DEV$1 } from '@solidjs/signals'; | ||
| function children(fn) { | ||
| const c = createMemo$1(fn, undefined, { | ||
| const c = createMemo$1(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = createMemo$1(() => flatten(c()), undefined, { | ||
| const memo = createMemo$1(() => flatten(c()), { | ||
| name: "children", | ||
@@ -285,3 +285,3 @@ lazy: true | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, options) { | ||
| const parent = getOwner(); | ||
@@ -298,3 +298,3 @@ const expectedId = peekNextChildId(parent); | ||
| }; | ||
| return coreFn(() => iterable, value, options); | ||
| return coreFn(() => iterable, options); | ||
| } | ||
@@ -374,5 +374,5 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) { | ||
| } | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| function hydratedCreateMemo(compute, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return createMemo$1(compute, value, options); | ||
| return createMemo$1(compute, options); | ||
| } | ||
@@ -383,8 +383,8 @@ markTopLevelSnapshotScope(); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const memo = createMemo$1(prev => { | ||
| if (!hydrated()) return prev ?? value; | ||
| if (!hydrated()) return prev; | ||
| return compute(prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -397,21 +397,21 @@ return memo; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, value, options); | ||
| return prev; | ||
| }, options); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, value, options); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return createMemo$1(prev => readSerializedOrCompute(compute, prev), value, options); | ||
| return createMemo$1(prev => readSerializedOrCompute(compute, prev), options); | ||
| } | ||
| function hydratedCreateSignal(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second, third); | ||
| function hydratedCreateSignal(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = createSignal$1(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -424,8 +424,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return createSignal$1(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return createSignal$1(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -452,14 +452,14 @@ function hydratedCreateErrorBoundary(fn, fallback) { | ||
| } | ||
| function hydratedCreateOptimistic(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second, third); | ||
| function hydratedCreateOptimistic(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = createOptimistic$1(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -472,8 +472,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -486,3 +486,3 @@ function wrapStoreFn(fn) { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -498,3 +498,3 @@ const result = coreFn(draft => { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -529,3 +529,3 @@ const result = coreFn(draft => { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}); | ||
| return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource); | ||
@@ -537,3 +537,3 @@ } | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}); | ||
| return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource); | ||
@@ -548,12 +548,12 @@ } | ||
| } | ||
| function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options); | ||
| function hydratedEffect(coreFn, compute, effectFn, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| let active = false; | ||
| coreFn(prev => { | ||
| if (!hydrated()) return value; | ||
| if (!hydrated()) return prev; | ||
| active = true; | ||
@@ -564,3 +564,3 @@ return compute(prev); | ||
| return effectFn(next, prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -573,14 +573,14 @@ return; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, effectFn, value, options); | ||
| return prev; | ||
| }, effectFn, options); | ||
| return; | ||
| } | ||
| markTopLevelSnapshotScope(); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, value, options); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options); | ||
| } | ||
| function hydratedCreateRenderEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(createRenderEffect$1, compute, effectFn, value, options); | ||
| function hydratedCreateRenderEffect(compute, effectFn, options) { | ||
| return hydratedEffect(createRenderEffect$1, compute, effectFn, options); | ||
| } | ||
| function hydratedCreateEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(createEffect$1, compute, effectFn, value, options); | ||
| function hydratedCreateEffect(compute, effectFn, options) { | ||
| return hydratedEffect(createEffect$1, compute, effectFn, options); | ||
| } | ||
@@ -644,20 +644,2 @@ function enableHydration() { | ||
| const createEffect = (...args) => (_createEffect || createEffect$1)(...args); | ||
| function loadModuleAssets(mapping) { | ||
| const hy = globalThis._$HY; | ||
| if (!hy) return; | ||
| if (!hy.modules) hy.modules = {}; | ||
| if (!hy.loading) hy.loading = {}; | ||
| const pending = []; | ||
| for (const moduleUrl in mapping) { | ||
| if (hy.modules[moduleUrl]) continue; | ||
| const entryUrl = mapping[moduleUrl]; | ||
| if (!hy.loading[moduleUrl]) { | ||
| hy.loading[moduleUrl] = import(entryUrl).then(mod => { | ||
| hy.modules[moduleUrl] = mod; | ||
| }); | ||
| } | ||
| pending.push(hy.loading[moduleUrl]); | ||
| } | ||
| return pending.length ? Promise.all(pending).then(() => {}) : undefined; | ||
| } | ||
| function createBoundaryTrigger() { | ||
@@ -731,3 +713,3 @@ setSnapshotCapture(false); | ||
| const mapping = sharedConfig.load(id + "_assets"); | ||
| if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping); | ||
| if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping); | ||
| } | ||
@@ -851,6 +833,6 @@ if (sharedConfig.hydrating && sharedConfig.has(id)) { | ||
| const keyed = props.keyed; | ||
| const conditionValue = createMemo$1(() => props.when, undefined, { | ||
| const conditionValue = createMemo$1(() => props.when, { | ||
| name: "condition value" | ||
| } ); | ||
| const condition = keyed ? conditionValue : createMemo$1(conditionValue, undefined, { | ||
| const condition = keyed ? conditionValue : createMemo$1(conditionValue, { | ||
| equals: (a, b) => !a === !b, | ||
@@ -870,3 +852,3 @@ name: "condition" | ||
| return props.fallback; | ||
| }, undefined, { | ||
| }, { | ||
| name: "value" | ||
@@ -884,6 +866,6 @@ } ); | ||
| const prevFunc = func; | ||
| const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined, { | ||
| const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, { | ||
| name: "condition value" | ||
| } ); | ||
| const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, undefined, { | ||
| const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, { | ||
| equals: (a, b) => !a === !b, | ||
@@ -906,3 +888,3 @@ name: "condition" | ||
| }), "<Match>") : child; | ||
| }, undefined, { | ||
| }, { | ||
| name: "eval conditions" | ||
@@ -909,0 +891,0 @@ } ); |
+209
-95
@@ -31,9 +31,66 @@ 'use strict'; | ||
| } | ||
| function createSignal(first, second, third) { | ||
| function createDeferredPromise() { | ||
| let settled = false; | ||
| let resolvePromise; | ||
| let rejectPromise; | ||
| const promise = new Promise((resolve, reject) => { | ||
| resolvePromise = resolve; | ||
| rejectPromise = reject; | ||
| }); | ||
| return { | ||
| promise, | ||
| resolve(value) { | ||
| if (settled) return; | ||
| settled = true; | ||
| promise.s = 1; | ||
| promise.v = value; | ||
| resolvePromise(value); | ||
| }, | ||
| reject(error) { | ||
| if (settled) return; | ||
| settled = true; | ||
| promise.s = 2; | ||
| promise.v = error; | ||
| rejectPromise(error); | ||
| } | ||
| }; | ||
| } | ||
| function subscribePendingRetry(error, retry) { | ||
| if (!(error instanceof signals.NotReadyError)) return false; | ||
| error.source?.then(() => retry(), () => retry()); | ||
| return true; | ||
| } | ||
| function settleServerAsync(initial, rerun, deferred, onSuccess, onError, isDisposed) { | ||
| let first = true; | ||
| const attempt = () => { | ||
| if (isDisposed()) return; | ||
| let current; | ||
| try { | ||
| current = first ? initial : rerun(); | ||
| first = false; | ||
| } catch (error) { | ||
| if (subscribePendingRetry(error, attempt)) return; | ||
| onError(error); | ||
| deferred.reject(error); | ||
| return; | ||
| } | ||
| Promise.resolve(current).then(value => { | ||
| if (isDisposed()) return; | ||
| deferred.resolve(onSuccess(value)); | ||
| }, error => { | ||
| if (isDisposed()) return; | ||
| if (subscribePendingRetry(error, attempt)) return; | ||
| onError(error); | ||
| deferred.reject(error); | ||
| }); | ||
| }; | ||
| attempt(); | ||
| } | ||
| function createSignal(first, second) { | ||
| if (typeof first === "function") { | ||
| const opts = third?.deferStream || third?.ssrSource ? { | ||
| deferStream: third?.deferStream, | ||
| ssrSource: third?.ssrSource | ||
| const opts = second?.deferStream || second?.ssrSource ? { | ||
| deferStream: second?.deferStream, | ||
| ssrSource: second?.ssrSource | ||
| } : undefined; | ||
| const memo = createMemo(prev => first(prev), second, opts); | ||
| const memo = createMemo(prev => first(prev), opts); | ||
| return [memo, () => undefined]; | ||
@@ -45,3 +102,3 @@ } | ||
| } | ||
| function createMemo(compute, value, options) { | ||
| function createMemo(compute, options) { | ||
| const ctx = sharedConfig.context; | ||
@@ -51,3 +108,3 @@ const owner = signals.createOwner(); | ||
| owner, | ||
| value: value, | ||
| value: undefined, | ||
| compute: compute, | ||
@@ -63,10 +120,11 @@ error: undefined, | ||
| if (comp.disposed) return; | ||
| const run = () => signals.runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value))); | ||
| try { | ||
| comp.error = undefined; | ||
| const result = signals.runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value))); | ||
| const result = run(); | ||
| comp.computed = true; | ||
| processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource); | ||
| processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource, run); | ||
| } catch (err) { | ||
| if (err instanceof signals.NotReadyError) { | ||
| err.source?.then(() => update(), () => update()); | ||
| subscribePendingRetry(err, update); | ||
| } | ||
@@ -153,3 +211,3 @@ comp.error = err; | ||
| } | ||
| function processResult(comp, result, owner, ctx, deferStream, ssrSource) { | ||
| function processResult(comp, result, owner, ctx, deferStream, ssrSource, rerun) { | ||
| if (comp.disposed) return; | ||
@@ -168,16 +226,16 @@ const id = owner.id; | ||
| } | ||
| result.then(v => { | ||
| const deferred = createDeferredPromise(); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| settleServerAsync(result, () => rerun ? rerun() : result, deferred, value => { | ||
| result.s = 1; | ||
| result.v = v; | ||
| if (comp.disposed) return; | ||
| comp.value = v; | ||
| result.v = value; | ||
| comp.value = value; | ||
| comp.error = undefined; | ||
| }, err => { | ||
| return value; | ||
| }, error => { | ||
| result.s = 2; | ||
| result.v = err; | ||
| if (comp.disposed) return; | ||
| comp.error = err; | ||
| }); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, result, deferStream); | ||
| comp.error = new signals.NotReadyError(result); | ||
| result.v = error; | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| comp.error = new signals.NotReadyError(deferred.promise); | ||
| return; | ||
@@ -187,25 +245,56 @@ } | ||
| if (typeof iterator === "function") { | ||
| const iter = iterator.call(result); | ||
| if (ssrSource === "hybrid") { | ||
| const promise = iter.next().then(v => { | ||
| promise.s = 1; | ||
| promise.v = v.value; | ||
| if (!v.done) closeAsyncIterator(iter); | ||
| if (comp.disposed) return v.value; | ||
| comp.value = v.value; | ||
| let currentResult = result; | ||
| let iter; | ||
| const deferred = createDeferredPromise(); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? (rerun ? rerun() : result); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createMemo"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| if (!value.done) closeAsyncIterator(iter); | ||
| return value.value; | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, value => { | ||
| comp.value = value; | ||
| comp.error = undefined; | ||
| return v.value; | ||
| }, () => {}); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, promise, deferStream); | ||
| comp.error = new signals.NotReadyError(promise); | ||
| return value; | ||
| }, error => { | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| comp.error = new signals.NotReadyError(deferred.promise); | ||
| } else { | ||
| const firstNext = iter.next(); | ||
| const firstReady = firstNext.then(r => { | ||
| if (comp.disposed) return; | ||
| if (!r.done) { | ||
| comp.value = r.value; | ||
| let currentResult = result; | ||
| let iter; | ||
| let firstResult; | ||
| const deferred = createDeferredPromise(); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? (rerun ? rerun() : result); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createMemo"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| firstResult = value; | ||
| return Promise.resolve(); | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, () => { | ||
| const resolved = firstResult; | ||
| if (resolved && !resolved.done) { | ||
| comp.value = resolved.value; | ||
| } | ||
| comp.error = undefined; | ||
| return Promise.resolve(); | ||
| }, () => {}); | ||
| return undefined; | ||
| }, error => { | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) { | ||
@@ -218,3 +307,6 @@ let tappedFirst = true; | ||
| tappedFirst = false; | ||
| return firstNext.then(r => r); | ||
| return deferred.promise.then(() => firstResult?.done ? { | ||
| done: true, | ||
| value: undefined | ||
| } : firstResult); | ||
| } | ||
@@ -230,3 +322,3 @@ return iter.next().then(r => r); | ||
| } | ||
| comp.error = new signals.NotReadyError(firstReady); | ||
| comp.error = new signals.NotReadyError(deferred.promise); | ||
| } | ||
@@ -243,3 +335,3 @@ return; | ||
| } | ||
| function serverEffect(compute, effectFn, value, options) { | ||
| function serverEffect(compute, effectFn, options) { | ||
| const ssrSource = options?.ssrSource; | ||
@@ -254,3 +346,3 @@ if (ssrSource === "client" || ssrSource === "initial") { | ||
| owner, | ||
| value: value, | ||
| value: undefined, | ||
| compute: compute, | ||
@@ -267,15 +359,15 @@ error: undefined, | ||
| try { | ||
| const result = signals.runWithOwner(owner, () => runWithObserver(comp, () => compute(value))); | ||
| const result = signals.runWithOwner(owner, () => runWithObserver(comp, () => compute(undefined))); | ||
| if (ssrSource) { | ||
| processResult(comp, result, owner, ctx, options?.deferStream, ssrSource); | ||
| } | ||
| effectFn?.(ssrSource ? comp.value ?? result : result, value); | ||
| effectFn?.(ssrSource ? comp.value ?? result : result, undefined); | ||
| } catch (err) { | ||
| } | ||
| } | ||
| function createEffect(compute, effect, value, options) { | ||
| serverEffect(compute, undefined, value, options); | ||
| function createEffect(compute, effect, options) { | ||
| serverEffect(compute, undefined, options); | ||
| } | ||
| function createRenderEffect(compute, effectFn, value, options) { | ||
| serverEffect(compute, effectFn, value, options); | ||
| function createRenderEffect(compute, effectFn, options) { | ||
| serverEffect(compute, effectFn, options); | ||
| } | ||
@@ -291,4 +383,4 @@ function createTrackedEffect(compute, options) { | ||
| } | ||
| function createOptimistic(first, second, third) { | ||
| return createSignal(first, second, third); | ||
| function createOptimistic(first, second) { | ||
| return createSignal(first, second); | ||
| } | ||
@@ -303,3 +395,3 @@ function setProperty(state, property, value) { | ||
| if (typeof first === "function") { | ||
| const store = createProjection(first, second ?? {}); | ||
| const store = createProjection(first, second); | ||
| return [store, fn => fn(store)]; | ||
@@ -327,3 +419,3 @@ } | ||
| } | ||
| function createProjection(fn, initialValue = {}, options) { | ||
| function createProjection(fn, initialValue, options) { | ||
| const ctx = sharedConfig.context; | ||
@@ -343,39 +435,65 @@ const owner = signals.createOwner(); | ||
| const draft = useProxy ? createDeepProxy(state, patches) : state; | ||
| const result = signals.runWithOwner(owner, () => fn(draft)); | ||
| const runProjection = () => signals.runWithOwner(owner, () => fn(draft)); | ||
| const result = runProjection(); | ||
| const iteratorFn = result?.[Symbol.asyncIterator]; | ||
| if (typeof iteratorFn === "function") { | ||
| const iter = iteratorFn.call(result); | ||
| if (ssrSource === "hybrid") { | ||
| const promise = iter.next().then(r => { | ||
| promise.s = 1; | ||
| if (!r.done) closeAsyncIterator(iter); | ||
| if (disposed) { | ||
| promise.v = state; | ||
| return state; | ||
| let currentResult = result; | ||
| let iter; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? runProjection(); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createProjection"); | ||
| } | ||
| if (r.value !== undefined && r.value !== state) { | ||
| Object.assign(state, r.value); | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(r => { | ||
| if (!r.done) closeAsyncIterator(iter); | ||
| return r.value; | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, value => { | ||
| if (value !== undefined && value !== state) { | ||
| Object.assign(state, value); | ||
| } | ||
| promise.v = state; | ||
| markReady(); | ||
| return state; | ||
| }, () => {}); | ||
| if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, promise, options?.deferStream); | ||
| const [pending, markReady] = createPendingProxy(state, promise); | ||
| }, error => { | ||
| markReady(); | ||
| }, () => disposed); | ||
| if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream); | ||
| return pending; | ||
| } else { | ||
| const firstNext = iter.next(); | ||
| const firstReady = firstNext.then(r => { | ||
| if (disposed) return; | ||
| let currentResult = result; | ||
| let iter; | ||
| let firstResult; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? runProjection(); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createProjection"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| firstResult = value; | ||
| return Promise.resolve(); | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, () => { | ||
| patches.length = 0; | ||
| if (!r.done) { | ||
| if (r.value !== undefined && r.value !== draft) { | ||
| Object.assign(state, r.value); | ||
| } | ||
| const resolved = firstResult; | ||
| if (resolved && !resolved.done && resolved.value !== undefined && resolved.value !== draft) { | ||
| Object.assign(state, resolved.value); | ||
| } | ||
| markReady(JSON.parse(JSON.stringify(state))); | ||
| return Promise.resolve(); | ||
| }, () => { | ||
| return undefined; | ||
| }, error => { | ||
| markReady(); | ||
| }); | ||
| }, () => disposed); | ||
| if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) { | ||
@@ -388,4 +506,4 @@ let tappedFirst = true; | ||
| tappedFirst = false; | ||
| return firstNext.then(r => { | ||
| if (r.done) return { | ||
| return deferred.promise.then(() => { | ||
| if (firstResult?.done) return { | ||
| done: true, | ||
@@ -428,3 +546,2 @@ value: undefined | ||
| } | ||
| const [pending, markReady] = createPendingProxy(state, firstReady); | ||
| return pending; | ||
@@ -434,17 +551,14 @@ } | ||
| if (result instanceof Promise) { | ||
| const promise = result.then(v => { | ||
| promise.s = 1; | ||
| if (disposed) { | ||
| promise.v = state; | ||
| return state; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| settleServerAsync(result, () => runProjection(), deferred, value => { | ||
| if (value !== undefined && value !== state) { | ||
| Object.assign(state, value); | ||
| } | ||
| if (v !== undefined && v !== state) { | ||
| Object.assign(state, v); | ||
| } | ||
| promise.v = state; | ||
| markReady(); | ||
| return state; | ||
| }, () => {}); | ||
| if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, promise, options?.deferStream); | ||
| const [pending, markReady] = createPendingProxy(state, promise); | ||
| }, error => { | ||
| markReady(); | ||
| }, () => disposed); | ||
| if (ctx?.async && !signals.getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream); | ||
| return pending; | ||
@@ -647,6 +761,6 @@ } | ||
| function children(fn) { | ||
| const c = createMemo(fn, undefined, { | ||
| const c = createMemo(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = createMemo(() => signals.flatten(c()), undefined, { | ||
| const memo = createMemo(() => signals.flatten(c()), { | ||
| lazy: true | ||
@@ -653,0 +767,0 @@ }); |
+209
-95
@@ -30,9 +30,66 @@ import { getOwner, getContext, getNextChildId, createOwner, NotReadyError, runWithOwner, onCleanup, isWrappable, setContext, flatten, createRoot } from '@solidjs/signals'; | ||
| } | ||
| function createSignal(first, second, third) { | ||
| function createDeferredPromise() { | ||
| let settled = false; | ||
| let resolvePromise; | ||
| let rejectPromise; | ||
| const promise = new Promise((resolve, reject) => { | ||
| resolvePromise = resolve; | ||
| rejectPromise = reject; | ||
| }); | ||
| return { | ||
| promise, | ||
| resolve(value) { | ||
| if (settled) return; | ||
| settled = true; | ||
| promise.s = 1; | ||
| promise.v = value; | ||
| resolvePromise(value); | ||
| }, | ||
| reject(error) { | ||
| if (settled) return; | ||
| settled = true; | ||
| promise.s = 2; | ||
| promise.v = error; | ||
| rejectPromise(error); | ||
| } | ||
| }; | ||
| } | ||
| function subscribePendingRetry(error, retry) { | ||
| if (!(error instanceof NotReadyError)) return false; | ||
| error.source?.then(() => retry(), () => retry()); | ||
| return true; | ||
| } | ||
| function settleServerAsync(initial, rerun, deferred, onSuccess, onError, isDisposed) { | ||
| let first = true; | ||
| const attempt = () => { | ||
| if (isDisposed()) return; | ||
| let current; | ||
| try { | ||
| current = first ? initial : rerun(); | ||
| first = false; | ||
| } catch (error) { | ||
| if (subscribePendingRetry(error, attempt)) return; | ||
| onError(error); | ||
| deferred.reject(error); | ||
| return; | ||
| } | ||
| Promise.resolve(current).then(value => { | ||
| if (isDisposed()) return; | ||
| deferred.resolve(onSuccess(value)); | ||
| }, error => { | ||
| if (isDisposed()) return; | ||
| if (subscribePendingRetry(error, attempt)) return; | ||
| onError(error); | ||
| deferred.reject(error); | ||
| }); | ||
| }; | ||
| attempt(); | ||
| } | ||
| function createSignal(first, second) { | ||
| if (typeof first === "function") { | ||
| const opts = third?.deferStream || third?.ssrSource ? { | ||
| deferStream: third?.deferStream, | ||
| ssrSource: third?.ssrSource | ||
| const opts = second?.deferStream || second?.ssrSource ? { | ||
| deferStream: second?.deferStream, | ||
| ssrSource: second?.ssrSource | ||
| } : undefined; | ||
| const memo = createMemo(prev => first(prev), second, opts); | ||
| const memo = createMemo(prev => first(prev), opts); | ||
| return [memo, () => undefined]; | ||
@@ -44,3 +101,3 @@ } | ||
| } | ||
| function createMemo(compute, value, options) { | ||
| function createMemo(compute, options) { | ||
| const ctx = sharedConfig.context; | ||
@@ -50,3 +107,3 @@ const owner = createOwner(); | ||
| owner, | ||
| value: value, | ||
| value: undefined, | ||
| compute: compute, | ||
@@ -62,10 +119,11 @@ error: undefined, | ||
| if (comp.disposed) return; | ||
| const run = () => runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value))); | ||
| try { | ||
| comp.error = undefined; | ||
| const result = runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value))); | ||
| const result = run(); | ||
| comp.computed = true; | ||
| processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource); | ||
| processResult(comp, result, owner, ctx, options?.deferStream, options?.ssrSource, run); | ||
| } catch (err) { | ||
| if (err instanceof NotReadyError) { | ||
| err.source?.then(() => update(), () => update()); | ||
| subscribePendingRetry(err, update); | ||
| } | ||
@@ -152,3 +210,3 @@ comp.error = err; | ||
| } | ||
| function processResult(comp, result, owner, ctx, deferStream, ssrSource) { | ||
| function processResult(comp, result, owner, ctx, deferStream, ssrSource, rerun) { | ||
| if (comp.disposed) return; | ||
@@ -167,16 +225,16 @@ const id = owner.id; | ||
| } | ||
| result.then(v => { | ||
| const deferred = createDeferredPromise(); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| settleServerAsync(result, () => rerun ? rerun() : result, deferred, value => { | ||
| result.s = 1; | ||
| result.v = v; | ||
| if (comp.disposed) return; | ||
| comp.value = v; | ||
| result.v = value; | ||
| comp.value = value; | ||
| comp.error = undefined; | ||
| }, err => { | ||
| return value; | ||
| }, error => { | ||
| result.s = 2; | ||
| result.v = err; | ||
| if (comp.disposed) return; | ||
| comp.error = err; | ||
| }); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, result, deferStream); | ||
| comp.error = new NotReadyError(result); | ||
| result.v = error; | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| comp.error = new NotReadyError(deferred.promise); | ||
| return; | ||
@@ -186,25 +244,56 @@ } | ||
| if (typeof iterator === "function") { | ||
| const iter = iterator.call(result); | ||
| if (ssrSource === "hybrid") { | ||
| const promise = iter.next().then(v => { | ||
| promise.s = 1; | ||
| promise.v = v.value; | ||
| if (!v.done) closeAsyncIterator(iter); | ||
| if (comp.disposed) return v.value; | ||
| comp.value = v.value; | ||
| let currentResult = result; | ||
| let iter; | ||
| const deferred = createDeferredPromise(); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? (rerun ? rerun() : result); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createMemo"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| if (!value.done) closeAsyncIterator(iter); | ||
| return value.value; | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, value => { | ||
| comp.value = value; | ||
| comp.error = undefined; | ||
| return v.value; | ||
| }, () => {}); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, promise, deferStream); | ||
| comp.error = new NotReadyError(promise); | ||
| return value; | ||
| }, error => { | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| comp.error = new NotReadyError(deferred.promise); | ||
| } else { | ||
| const firstNext = iter.next(); | ||
| const firstReady = firstNext.then(r => { | ||
| if (comp.disposed) return; | ||
| if (!r.done) { | ||
| comp.value = r.value; | ||
| let currentResult = result; | ||
| let iter; | ||
| let firstResult; | ||
| const deferred = createDeferredPromise(); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? (rerun ? rerun() : result); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createMemo"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| firstResult = value; | ||
| return Promise.resolve(); | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, () => { | ||
| const resolved = firstResult; | ||
| if (resolved && !resolved.done) { | ||
| comp.value = resolved.value; | ||
| } | ||
| comp.error = undefined; | ||
| return Promise.resolve(); | ||
| }, () => {}); | ||
| return undefined; | ||
| }, error => { | ||
| comp.error = error; | ||
| }, () => comp.disposed); | ||
| if (ctx?.async && ctx.serialize && id && !noHydrate) { | ||
@@ -217,3 +306,6 @@ let tappedFirst = true; | ||
| tappedFirst = false; | ||
| return firstNext.then(r => r); | ||
| return deferred.promise.then(() => firstResult?.done ? { | ||
| done: true, | ||
| value: undefined | ||
| } : firstResult); | ||
| } | ||
@@ -229,3 +321,3 @@ return iter.next().then(r => r); | ||
| } | ||
| comp.error = new NotReadyError(firstReady); | ||
| comp.error = new NotReadyError(deferred.promise); | ||
| } | ||
@@ -242,3 +334,3 @@ return; | ||
| } | ||
| function serverEffect(compute, effectFn, value, options) { | ||
| function serverEffect(compute, effectFn, options) { | ||
| const ssrSource = options?.ssrSource; | ||
@@ -253,3 +345,3 @@ if (ssrSource === "client" || ssrSource === "initial") { | ||
| owner, | ||
| value: value, | ||
| value: undefined, | ||
| compute: compute, | ||
@@ -266,15 +358,15 @@ error: undefined, | ||
| try { | ||
| const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(value))); | ||
| const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(undefined))); | ||
| if (ssrSource) { | ||
| processResult(comp, result, owner, ctx, options?.deferStream, ssrSource); | ||
| } | ||
| effectFn?.(ssrSource ? comp.value ?? result : result, value); | ||
| effectFn?.(ssrSource ? comp.value ?? result : result, undefined); | ||
| } catch (err) { | ||
| } | ||
| } | ||
| function createEffect(compute, effect, value, options) { | ||
| serverEffect(compute, undefined, value, options); | ||
| function createEffect(compute, effect, options) { | ||
| serverEffect(compute, undefined, options); | ||
| } | ||
| function createRenderEffect(compute, effectFn, value, options) { | ||
| serverEffect(compute, effectFn, value, options); | ||
| function createRenderEffect(compute, effectFn, options) { | ||
| serverEffect(compute, effectFn, options); | ||
| } | ||
@@ -290,4 +382,4 @@ function createTrackedEffect(compute, options) { | ||
| } | ||
| function createOptimistic(first, second, third) { | ||
| return createSignal(first, second, third); | ||
| function createOptimistic(first, second) { | ||
| return createSignal(first, second); | ||
| } | ||
@@ -302,3 +394,3 @@ function setProperty(state, property, value) { | ||
| if (typeof first === "function") { | ||
| const store = createProjection(first, second ?? {}); | ||
| const store = createProjection(first, second); | ||
| return [store, fn => fn(store)]; | ||
@@ -326,3 +418,3 @@ } | ||
| } | ||
| function createProjection(fn, initialValue = {}, options) { | ||
| function createProjection(fn, initialValue, options) { | ||
| const ctx = sharedConfig.context; | ||
@@ -342,39 +434,65 @@ const owner = createOwner(); | ||
| const draft = useProxy ? createDeepProxy(state, patches) : state; | ||
| const result = runWithOwner(owner, () => fn(draft)); | ||
| const runProjection = () => runWithOwner(owner, () => fn(draft)); | ||
| const result = runProjection(); | ||
| const iteratorFn = result?.[Symbol.asyncIterator]; | ||
| if (typeof iteratorFn === "function") { | ||
| const iter = iteratorFn.call(result); | ||
| if (ssrSource === "hybrid") { | ||
| const promise = iter.next().then(r => { | ||
| promise.s = 1; | ||
| if (!r.done) closeAsyncIterator(iter); | ||
| if (disposed) { | ||
| promise.v = state; | ||
| return state; | ||
| let currentResult = result; | ||
| let iter; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? runProjection(); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createProjection"); | ||
| } | ||
| if (r.value !== undefined && r.value !== state) { | ||
| Object.assign(state, r.value); | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(r => { | ||
| if (!r.done) closeAsyncIterator(iter); | ||
| return r.value; | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, value => { | ||
| if (value !== undefined && value !== state) { | ||
| Object.assign(state, value); | ||
| } | ||
| promise.v = state; | ||
| markReady(); | ||
| return state; | ||
| }, () => {}); | ||
| if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, promise, options?.deferStream); | ||
| const [pending, markReady] = createPendingProxy(state, promise); | ||
| }, error => { | ||
| markReady(); | ||
| }, () => disposed); | ||
| if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream); | ||
| return pending; | ||
| } else { | ||
| const firstNext = iter.next(); | ||
| const firstReady = firstNext.then(r => { | ||
| if (disposed) return; | ||
| let currentResult = result; | ||
| let iter; | ||
| let firstResult; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| const runFirst = () => { | ||
| const source = currentResult ?? runProjection(); | ||
| currentResult = undefined; | ||
| const nextIterator = source?.[Symbol.asyncIterator]; | ||
| if (typeof nextIterator !== "function") { | ||
| throw new Error("Expected async iterator while retrying server createProjection"); | ||
| } | ||
| iter = nextIterator.call(source); | ||
| return iter.next().then(value => { | ||
| firstResult = value; | ||
| return Promise.resolve(); | ||
| }); | ||
| }; | ||
| settleServerAsync(runFirst(), runFirst, deferred, () => { | ||
| patches.length = 0; | ||
| if (!r.done) { | ||
| if (r.value !== undefined && r.value !== draft) { | ||
| Object.assign(state, r.value); | ||
| } | ||
| const resolved = firstResult; | ||
| if (resolved && !resolved.done && resolved.value !== undefined && resolved.value !== draft) { | ||
| Object.assign(state, resolved.value); | ||
| } | ||
| markReady(JSON.parse(JSON.stringify(state))); | ||
| return Promise.resolve(); | ||
| }, () => { | ||
| return undefined; | ||
| }, error => { | ||
| markReady(); | ||
| }); | ||
| }, () => disposed); | ||
| if (ctx?.async && !getContext(NoHydrateContext) && owner.id) { | ||
@@ -387,4 +505,4 @@ let tappedFirst = true; | ||
| tappedFirst = false; | ||
| return firstNext.then(r => { | ||
| if (r.done) return { | ||
| return deferred.promise.then(() => { | ||
| if (firstResult?.done) return { | ||
| done: true, | ||
@@ -427,3 +545,2 @@ value: undefined | ||
| } | ||
| const [pending, markReady] = createPendingProxy(state, firstReady); | ||
| return pending; | ||
@@ -433,17 +550,14 @@ } | ||
| if (result instanceof Promise) { | ||
| const promise = result.then(v => { | ||
| promise.s = 1; | ||
| if (disposed) { | ||
| promise.v = state; | ||
| return state; | ||
| const deferred = createDeferredPromise(); | ||
| const [pending, markReady] = createPendingProxy(state, deferred.promise); | ||
| settleServerAsync(result, () => runProjection(), deferred, value => { | ||
| if (value !== undefined && value !== state) { | ||
| Object.assign(state, value); | ||
| } | ||
| if (v !== undefined && v !== state) { | ||
| Object.assign(state, v); | ||
| } | ||
| promise.v = state; | ||
| markReady(); | ||
| return state; | ||
| }, () => {}); | ||
| if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, promise, options?.deferStream); | ||
| const [pending, markReady] = createPendingProxy(state, promise); | ||
| }, error => { | ||
| markReady(); | ||
| }, () => disposed); | ||
| if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, deferred.promise, options?.deferStream); | ||
| return pending; | ||
@@ -646,6 +760,6 @@ } | ||
| function children(fn) { | ||
| const c = createMemo(fn, undefined, { | ||
| const c = createMemo(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = createMemo(() => flatten(c()), undefined, { | ||
| const memo = createMemo(() => flatten(c()), { | ||
| lazy: true | ||
@@ -652,0 +766,0 @@ }); |
+56
-74
@@ -23,6 +23,6 @@ 'use strict'; | ||
| function children(fn) { | ||
| const c = signals.createMemo(fn, undefined, { | ||
| const c = signals.createMemo(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = signals.createMemo(() => signals.flatten(c()), undefined, { | ||
| const memo = signals.createMemo(() => signals.flatten(c()), { | ||
| lazy: true | ||
@@ -269,3 +269,3 @@ }); | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, options) { | ||
| const parent = signals.getOwner(); | ||
@@ -282,3 +282,3 @@ const expectedId = signals.peekNextChildId(parent); | ||
| }; | ||
| return coreFn(() => iterable, value, options); | ||
| return coreFn(() => iterable, options); | ||
| } | ||
@@ -358,5 +358,5 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) { | ||
| } | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| function hydratedCreateMemo(compute, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return signals.createMemo(compute, value, options); | ||
| return signals.createMemo(compute, options); | ||
| } | ||
@@ -367,8 +367,8 @@ markTopLevelSnapshotScope(); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const memo = signals.createMemo(prev => { | ||
| if (!hydrated()) return prev ?? value; | ||
| if (!hydrated()) return prev; | ||
| return compute(prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -381,21 +381,21 @@ return memo; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, value, options); | ||
| return prev; | ||
| }, options); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, value, options); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createMemo(prev => readSerializedOrCompute(compute, prev), value, options); | ||
| return signals.createMemo(prev => readSerializedOrCompute(compute, prev), options); | ||
| } | ||
| function hydratedCreateSignal(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second, third); | ||
| function hydratedCreateSignal(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = signals.createSignal(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -408,8 +408,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -436,14 +436,14 @@ function hydratedCreateErrorBoundary(fn, fallback) { | ||
| } | ||
| function hydratedCreateOptimistic(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second, third); | ||
| function hydratedCreateOptimistic(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = signals.createOptimistic(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -456,8 +456,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -470,3 +470,3 @@ function wrapStoreFn(fn) { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -482,3 +482,3 @@ const result = coreFn(draft => { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -513,3 +513,3 @@ const result = coreFn(draft => { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}); | ||
| return hydrateStoreLikeFn(signals.createStore, first, second ?? {}, third, ssrSource); | ||
@@ -521,3 +521,3 @@ } | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}); | ||
| return hydrateStoreLikeFn(signals.createOptimisticStore, first, second ?? {}, third, ssrSource); | ||
@@ -532,12 +532,12 @@ } | ||
| } | ||
| function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options); | ||
| function hydratedEffect(coreFn, compute, effectFn, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| let active = false; | ||
| coreFn(prev => { | ||
| if (!hydrated()) return value; | ||
| if (!hydrated()) return prev; | ||
| active = true; | ||
@@ -548,3 +548,3 @@ return compute(prev); | ||
| return effectFn(next, prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -557,14 +557,14 @@ return; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, effectFn, value, options); | ||
| return prev; | ||
| }, effectFn, options); | ||
| return; | ||
| } | ||
| markTopLevelSnapshotScope(); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, value, options); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options); | ||
| } | ||
| function hydratedCreateRenderEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options); | ||
| function hydratedCreateRenderEffect(compute, effectFn, options) { | ||
| return hydratedEffect(signals.createRenderEffect, compute, effectFn, options); | ||
| } | ||
| function hydratedCreateEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(signals.createEffect, compute, effectFn, value, options); | ||
| function hydratedCreateEffect(compute, effectFn, options) { | ||
| return hydratedEffect(signals.createEffect, compute, effectFn, options); | ||
| } | ||
@@ -628,20 +628,2 @@ function enableHydration() { | ||
| const createEffect = (...args) => (_createEffect || signals.createEffect)(...args); | ||
| function loadModuleAssets(mapping) { | ||
| const hy = globalThis._$HY; | ||
| if (!hy) return; | ||
| if (!hy.modules) hy.modules = {}; | ||
| if (!hy.loading) hy.loading = {}; | ||
| const pending = []; | ||
| for (const moduleUrl in mapping) { | ||
| if (hy.modules[moduleUrl]) continue; | ||
| const entryUrl = mapping[moduleUrl]; | ||
| if (!hy.loading[moduleUrl]) { | ||
| hy.loading[moduleUrl] = import(entryUrl).then(mod => { | ||
| hy.modules[moduleUrl] = mod; | ||
| }); | ||
| } | ||
| pending.push(hy.loading[moduleUrl]); | ||
| } | ||
| return pending.length ? Promise.all(pending).then(() => {}) : undefined; | ||
| } | ||
| function createBoundaryTrigger() { | ||
@@ -715,3 +697,3 @@ signals.setSnapshotCapture(false); | ||
| const mapping = sharedConfig.load(id + "_assets"); | ||
| if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping); | ||
| if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping); | ||
| } | ||
@@ -830,4 +812,4 @@ if (sharedConfig.hydrating && sharedConfig.has(id)) { | ||
| const keyed = props.keyed; | ||
| const conditionValue = signals.createMemo(() => props.when, undefined, undefined); | ||
| const condition = keyed ? conditionValue : signals.createMemo(conditionValue, undefined, { | ||
| const conditionValue = signals.createMemo(() => props.when, undefined); | ||
| const condition = keyed ? conditionValue : signals.createMemo(conditionValue, { | ||
| equals: (a, b) => !a === !b | ||
@@ -846,3 +828,3 @@ }); | ||
| return props.fallback; | ||
| }, undefined, undefined); | ||
| }, undefined); | ||
| } | ||
@@ -858,4 +840,4 @@ function Switch(props) { | ||
| const prevFunc = func; | ||
| const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined, undefined); | ||
| const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, undefined, { | ||
| const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined); | ||
| const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, { | ||
| equals: (a, b) => !a === !b | ||
@@ -877,3 +859,3 @@ }); | ||
| }), IS_DEV) : child; | ||
| }, undefined, undefined); | ||
| }, undefined); | ||
| } | ||
@@ -880,0 +862,0 @@ function Match(props) { |
+56
-74
@@ -22,6 +22,6 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, getOwner, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, onCleanup, isDisposed, peekNextChildId, clearSnapshots, flush, markSnapshotScope, untrack, mapArray, repeat, createRevealOrder } from '@solidjs/signals'; | ||
| function children(fn) { | ||
| const c = createMemo$1(fn, undefined, { | ||
| const c = createMemo$1(fn, { | ||
| lazy: true | ||
| }); | ||
| const memo = createMemo$1(() => flatten(c()), undefined, { | ||
| const memo = createMemo$1(() => flatten(c()), { | ||
| lazy: true | ||
@@ -268,3 +268,3 @@ }); | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, options) { | ||
| const parent = getOwner(); | ||
@@ -281,3 +281,3 @@ const expectedId = peekNextChildId(parent); | ||
| }; | ||
| return coreFn(() => iterable, value, options); | ||
| return coreFn(() => iterable, options); | ||
| } | ||
@@ -357,5 +357,5 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) { | ||
| } | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| function hydratedCreateMemo(compute, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return createMemo$1(compute, value, options); | ||
| return createMemo$1(compute, options); | ||
| } | ||
@@ -366,8 +366,8 @@ markTopLevelSnapshotScope(); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const memo = createMemo$1(prev => { | ||
| if (!hydrated()) return prev ?? value; | ||
| if (!hydrated()) return prev; | ||
| return compute(prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -380,21 +380,21 @@ return memo; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, value, options); | ||
| return prev; | ||
| }, options); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, value, options); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return createMemo$1(prev => readSerializedOrCompute(compute, prev), value, options); | ||
| return createMemo$1(prev => readSerializedOrCompute(compute, prev), options); | ||
| } | ||
| function hydratedCreateSignal(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second, third); | ||
| function hydratedCreateSignal(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = createSignal$1(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -407,8 +407,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return createSignal$1(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return createSignal$1(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -435,14 +435,14 @@ function hydratedCreateErrorBoundary(fn, fallback) { | ||
| } | ||
| function hydratedCreateOptimistic(fn, second, third) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second, third); | ||
| function hydratedCreateOptimistic(fn, second) { | ||
| if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = third?.ssrSource; | ||
| const ssrSource = second?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| const sig = createOptimistic$1(prev => { | ||
| if (!hydrated()) return prev ?? second; | ||
| if (!hydrated()) return prev; | ||
| return fn(prev); | ||
| }, second, third); | ||
| }, second); | ||
| setHydrated(true); | ||
@@ -455,8 +455,8 @@ return sig; | ||
| subFetch(fn, prev); | ||
| return prev ?? second; | ||
| }, second, third); | ||
| return prev; | ||
| }, second); | ||
| } | ||
| const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second, third); | ||
| const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second); | ||
| if (aiResult !== null) return aiResult; | ||
| return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second, third); | ||
| return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second); | ||
| } | ||
@@ -469,3 +469,3 @@ function wrapStoreFn(fn) { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -481,3 +481,3 @@ const result = coreFn(draft => { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
@@ -512,3 +512,3 @@ const result = coreFn(draft => { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}); | ||
| return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource); | ||
@@ -520,3 +520,3 @@ } | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}); | ||
| return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource); | ||
@@ -531,12 +531,12 @@ } | ||
| } | ||
| function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options); | ||
| function hydratedEffect(coreFn, compute, effectFn, options) { | ||
| if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| ownedWrite: true | ||
| }); | ||
| let active = false; | ||
| coreFn(prev => { | ||
| if (!hydrated()) return value; | ||
| if (!hydrated()) return prev; | ||
| active = true; | ||
@@ -547,3 +547,3 @@ return compute(prev); | ||
| return effectFn(next, prev); | ||
| }, value, options); | ||
| }, options); | ||
| setHydrated(true); | ||
@@ -556,14 +556,14 @@ return; | ||
| subFetch(compute, prev); | ||
| return prev ?? value; | ||
| }, effectFn, value, options); | ||
| return prev; | ||
| }, effectFn, options); | ||
| return; | ||
| } | ||
| markTopLevelSnapshotScope(); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, value, options); | ||
| coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options); | ||
| } | ||
| function hydratedCreateRenderEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(createRenderEffect$1, compute, effectFn, value, options); | ||
| function hydratedCreateRenderEffect(compute, effectFn, options) { | ||
| return hydratedEffect(createRenderEffect$1, compute, effectFn, options); | ||
| } | ||
| function hydratedCreateEffect(compute, effectFn, value, options) { | ||
| return hydratedEffect(createEffect$1, compute, effectFn, value, options); | ||
| function hydratedCreateEffect(compute, effectFn, options) { | ||
| return hydratedEffect(createEffect$1, compute, effectFn, options); | ||
| } | ||
@@ -627,20 +627,2 @@ function enableHydration() { | ||
| const createEffect = (...args) => (_createEffect || createEffect$1)(...args); | ||
| function loadModuleAssets(mapping) { | ||
| const hy = globalThis._$HY; | ||
| if (!hy) return; | ||
| if (!hy.modules) hy.modules = {}; | ||
| if (!hy.loading) hy.loading = {}; | ||
| const pending = []; | ||
| for (const moduleUrl in mapping) { | ||
| if (hy.modules[moduleUrl]) continue; | ||
| const entryUrl = mapping[moduleUrl]; | ||
| if (!hy.loading[moduleUrl]) { | ||
| hy.loading[moduleUrl] = import(entryUrl).then(mod => { | ||
| hy.modules[moduleUrl] = mod; | ||
| }); | ||
| } | ||
| pending.push(hy.loading[moduleUrl]); | ||
| } | ||
| return pending.length ? Promise.all(pending).then(() => {}) : undefined; | ||
| } | ||
| function createBoundaryTrigger() { | ||
@@ -714,3 +696,3 @@ setSnapshotCapture(false); | ||
| const mapping = sharedConfig.load(id + "_assets"); | ||
| if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping); | ||
| if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping); | ||
| } | ||
@@ -829,4 +811,4 @@ if (sharedConfig.hydrating && sharedConfig.has(id)) { | ||
| const keyed = props.keyed; | ||
| const conditionValue = createMemo$1(() => props.when, undefined, undefined); | ||
| const condition = keyed ? conditionValue : createMemo$1(conditionValue, undefined, { | ||
| const conditionValue = createMemo$1(() => props.when, undefined); | ||
| const condition = keyed ? conditionValue : createMemo$1(conditionValue, { | ||
| equals: (a, b) => !a === !b | ||
@@ -845,3 +827,3 @@ }); | ||
| return props.fallback; | ||
| }, undefined, undefined); | ||
| }, undefined); | ||
| } | ||
@@ -857,4 +839,4 @@ function Switch(props) { | ||
| const prevFunc = func; | ||
| const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined, undefined); | ||
| const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, undefined, { | ||
| const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined); | ||
| const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, { | ||
| equals: (a, b) => !a === !b | ||
@@ -876,3 +858,3 @@ }); | ||
| }), IS_DEV) : child; | ||
| }, undefined, undefined); | ||
| }, undefined); | ||
| } | ||
@@ -879,0 +861,0 @@ function Match(props) { |
+78
-30
| { | ||
| "name": "solid-js", | ||
| "description": "A declarative JavaScript library for building user interfaces.", | ||
| "version": "2.0.0-beta.6", | ||
| "version": "2.0.0-beta.7", | ||
| "author": "Ryan Carniato", | ||
@@ -21,2 +21,3 @@ "license": "MIT", | ||
| "types", | ||
| "types-cjs", | ||
| "jsx-runtime.d.ts", | ||
@@ -28,44 +29,90 @@ "package.json" | ||
| "worker": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/server.js", | ||
| "require": "./dist/server.cjs" | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "default": "./dist/server.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/server.cjs" | ||
| } | ||
| }, | ||
| "browser": { | ||
| "development": { | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "default": "./dist/dev.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/dev.cjs" | ||
| } | ||
| }, | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/dev.js", | ||
| "require": "./dist/dev.cjs" | ||
| "default": "./dist/solid.js" | ||
| }, | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/solid.js", | ||
| "require": "./dist/solid.cjs" | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/solid.cjs" | ||
| } | ||
| }, | ||
| "deno": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/server.js", | ||
| "require": "./dist/server.cjs" | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "default": "./dist/server.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/server.cjs" | ||
| } | ||
| }, | ||
| "node": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/server.js", | ||
| "require": "./dist/server.cjs" | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "default": "./dist/server.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/server.cjs" | ||
| } | ||
| }, | ||
| "development": { | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "default": "./dist/dev.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/dev.cjs" | ||
| } | ||
| }, | ||
| "import": { | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/dev.js", | ||
| "require": "./dist/dev.cjs" | ||
| "default": "./dist/solid.js" | ||
| }, | ||
| "types": "./types/index.d.ts", | ||
| "import": "./dist/solid.js", | ||
| "require": "./dist/solid.cjs" | ||
| "require": { | ||
| "types": "./types-cjs/index.d.cts", | ||
| "default": "./dist/solid.cjs" | ||
| } | ||
| }, | ||
| "./dist/*": "./dist/*", | ||
| "./types/*": "./types/*", | ||
| "./jsx-runtime": { | ||
| "types": "./types/jsx.d.ts", | ||
| "default": "./dist/solid.js" | ||
| "import": { | ||
| "types": "./types/jsx.d.ts", | ||
| "default": "./dist/solid.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/jsx.d.cts", | ||
| "default": "./dist/solid.cjs" | ||
| } | ||
| }, | ||
| "./jsx-dev-runtime": { | ||
| "types": "./types/jsx.d.ts", | ||
| "default": "./dist/solid.js" | ||
| "import": { | ||
| "types": "./types/jsx.d.ts", | ||
| "default": "./dist/solid.js" | ||
| }, | ||
| "require": { | ||
| "types": "./types-cjs/jsx.d.cts", | ||
| "default": "./dist/solid.cjs" | ||
| } | ||
| }, | ||
@@ -84,3 +131,3 @@ "./package.json": "./package.json" | ||
| "dependencies": { | ||
| "@solidjs/signals": "^0.13.11", | ||
| "@solidjs/signals": "^2.0.0-beta.7", | ||
| "csstype": "^3.1.0", | ||
@@ -94,6 +141,7 @@ "seroval": "~1.5.0", | ||
| "build:js": "rollup -c", | ||
| "types": "npm-run-all -nl types:*", | ||
| "types:clean": "rimraf types/", | ||
| "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts", | ||
| "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts", | ||
| "types": "npm-run-all -nl types:clean types:copy types:src types:cjs", | ||
| "types:clean": "rimraf types/ types-cjs/", | ||
| "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-properties.d.ts ./src/jsx-properties.d.ts", | ||
| "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-properties.d.ts ./types/jsx-properties.d.ts", | ||
| "types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs", | ||
| "test": "vitest run", | ||
@@ -100,0 +148,0 @@ "coverage": "vitest run --coverage", |
@@ -29,2 +29,3 @@ import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type ProjectionOptions, type Store, type StoreSetter, type Context } from "@solidjs/signals"; | ||
| cleanupFragment?: (id: string) => void; | ||
| loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined; | ||
| registry?: Map<string, Element>; | ||
@@ -49,3 +50,3 @@ completed?: WeakSet<Element> | null; | ||
| export declare const createOptimistic: typeof coreOptimistic; | ||
| export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue?: T, options?: HydrationProjectionOptions) => Store<T> & { | ||
| export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: HydrationProjectionOptions) => Store<T> & { | ||
| [$REFRESH]: any; | ||
@@ -56,3 +57,3 @@ }; | ||
| <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>]; | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store?: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| [$REFRESH]: any; | ||
@@ -63,3 +64,3 @@ }, set: StoreSetter<T>]; | ||
| <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>]; | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store?: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| <T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & { | ||
| [$REFRESH]: any; | ||
@@ -66,0 +67,0 @@ }, set: StoreSetter<T>]; |
@@ -18,11 +18,8 @@ export { createRoot, createOwner, runWithOwner, getOwner, isDisposed, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals"; | ||
| export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createSignal<T>(fn: ComputeFunction<T>, initialValue?: T, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createMemo<Next extends Prev, Prev = Next>(compute: ComputeFunction<undefined | NoInfer<Prev>, Next>): Accessor<Next>; | ||
| export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(compute: ComputeFunction<Init | Prev, Next>, value: Init, options?: MemoOptions<Next>): Accessor<Next>; | ||
| export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: MemoOptions<T>): Accessor<T>; | ||
| export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1]; | ||
| export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T; | ||
| export declare function createEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effectFn: EffectFunction<NoInfer<Next>, Next> | EffectBundle<NoInfer<Next>, Next>): void; | ||
| export declare function createEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effect: EffectFunction<Next, Next> | EffectBundle<Next, Next>, value: Init, options?: EffectOptions): void; | ||
| export declare function createRenderEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effectFn: EffectFunction<NoInfer<Next>, Next>): void; | ||
| export declare function createRenderEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effectFn: EffectFunction<Next, Next>, value: Init, options?: EffectOptions): void; | ||
| export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void; | ||
| export declare function createRenderEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effectFn: EffectFunction<NoInfer<T>, T>, options?: EffectOptions): void; | ||
| export declare function createTrackedEffect(compute: () => void | (() => void), options?: EffectOptions): void; | ||
@@ -32,6 +29,7 @@ export declare function createReaction(effectFn: EffectFunction<undefined> | EffectBundle<undefined>, options?: EffectOptions): (tracking: () => void) => void; | ||
| export declare function createOptimistic<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createOptimistic<T>(fn: ComputeFunction<T>, initialValue?: T, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createStore<T extends object>(first: T | Store<T> | ((store: T) => void | T | Promise<void | T>), second?: T | Store<T>): [get: Store<T>, set: StoreSetter<T>]; | ||
| export declare function createOptimistic<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>; | ||
| export declare function createStore<T extends object>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>]; | ||
| export declare function createStore<T extends object>(fn: (store: T) => void | T | Promise<void | T>, store: Partial<T> | Store<T>): [get: Store<T>, set: StoreSetter<T>]; | ||
| export declare const createOptimisticStore: typeof createStore; | ||
| export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue?: T, options?: { | ||
| export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: Partial<T>, options?: { | ||
| deferStream?: boolean; | ||
@@ -38,0 +36,0 @@ ssrSource?: string; |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
644700
55.39%39
69.57%11210
2.63%33
37.5%14
7.69%+ Added
- Removed