Comparing version 1.6.11 to 1.7.0-beta.0
124
dist/dev.js
@@ -155,3 +155,6 @@ let taskIdCounter = 1, | ||
let ExecCount = 0; | ||
let rootCount = 0; | ||
const DevHooks = { | ||
afterUpdate: null, | ||
afterCreateOwner: null | ||
}; | ||
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false); | ||
@@ -176,6 +179,3 @@ function createRoot(fn, detachedOwner) { | ||
}) : () => fn(() => untrack(() => cleanNode(root))); | ||
{ | ||
if (owner) root.name = `${owner.name}-r${rootCount++}`; | ||
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root); | ||
} | ||
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root); | ||
Owner = root; | ||
@@ -198,3 +198,6 @@ Listener = null; | ||
}; | ||
if (!options.internal) s.name = registerGraph(options.name || hashValue(value), s); | ||
if (!options.internal) { | ||
if (options.name) s.name = options.name; | ||
registerGraph(s); | ||
} | ||
const setter = value => { | ||
@@ -540,42 +543,7 @@ if (typeof value === "function") { | ||
} | ||
function hashValue(v) { | ||
const s = new Set(); | ||
return `s${typeof v === "string" ? hash(v) : hash(untrack(() => JSON.stringify(v, (k, v) => { | ||
if (typeof v === "object" && v != null) { | ||
if (s.has(v)) return; | ||
s.add(v); | ||
const keys = Object.keys(v); | ||
const desc = Object.getOwnPropertyDescriptors(v); | ||
const newDesc = keys.reduce((memo, key) => { | ||
const value = desc[key]; | ||
if (!value.get) memo[key] = value; | ||
return memo; | ||
}, {}); | ||
v = Object.create({}, newDesc); | ||
} | ||
if (typeof v === "bigint") { | ||
return `${v.toString()}n`; | ||
} | ||
return v; | ||
}) || ""))}`; | ||
function registerGraph(value) { | ||
if (!Owner) return; | ||
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value]; | ||
value.graph = Owner; | ||
} | ||
function registerGraph(name, value) { | ||
let tryName = name; | ||
if (Owner) { | ||
let i = 0; | ||
Owner.sourceMap || (Owner.sourceMap = {}); | ||
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`; | ||
Owner.sourceMap[tryName] = value; | ||
value.graph = Owner; | ||
} | ||
return tryName; | ||
} | ||
function serializeGraph(owner) { | ||
owner || (owner = Owner); | ||
if (!owner) return {}; | ||
return { | ||
...serializeValues(owner.sourceMap), | ||
...(owner.owned ? serializeChildren(owner) : {}) | ||
}; | ||
} | ||
function createContext(defaultValue, options) { | ||
@@ -762,4 +730,4 @@ const id = Symbol("context"); | ||
} | ||
c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`; | ||
} | ||
if (options && options.name) c.name = options.name; | ||
if (ExternalSourceFactory) { | ||
@@ -778,2 +746,3 @@ const [track, trigger] = createSignal(undefined, { | ||
} | ||
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c); | ||
return c; | ||
@@ -868,3 +837,3 @@ } | ||
Effects = null; | ||
if (e.length) runUpdates(() => runEffects(e), false);else globalThis._$afterUpdate && globalThis._$afterUpdate(); | ||
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate(); | ||
if (res) res(); | ||
@@ -971,4 +940,6 @@ } | ||
function castError(err) { | ||
if (err instanceof Error || typeof err === "string") return err; | ||
return new Error("Unknown error"); | ||
if (err instanceof Error) return err; | ||
return new Error(typeof err === "string" ? err : "Unknown error", { | ||
cause: err | ||
}); | ||
} | ||
@@ -979,11 +950,11 @@ function runErrors(fns, err) { | ||
function handleError(err) { | ||
err = castError(err); | ||
const fns = ERROR && lookup(Owner, ERROR); | ||
if (!fns) throw err; | ||
const error = castError(err); | ||
if (Effects) Effects.push({ | ||
fn() { | ||
runErrors(fns, err); | ||
runErrors(fns, error); | ||
}, | ||
state: STALE | ||
});else runErrors(fns, err); | ||
});else runErrors(fns, error); | ||
} | ||
@@ -1017,26 +988,2 @@ function lookup(owner, key) { | ||
} | ||
function hash(s) { | ||
for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9); | ||
return `${h ^ h >>> 9}`; | ||
} | ||
function serializeValues(sources = {}) { | ||
const k = Object.keys(sources); | ||
const result = {}; | ||
for (let i = 0; i < k.length; i++) { | ||
const key = k[i]; | ||
result[key] = sources[key].value; | ||
} | ||
return result; | ||
} | ||
function serializeChildren(root) { | ||
const result = {}; | ||
for (let i = 0, len = root.owned.length; i < len; i++) { | ||
const node = root.owned[i]; | ||
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = { | ||
...serializeValues(node.sourceMap), | ||
...(node.owned ? serializeChildren(node) : {}) | ||
}; | ||
} | ||
return result; | ||
} | ||
@@ -1461,6 +1408,5 @@ function observable(input) { | ||
function Show(props) { | ||
let strictEqual = false; | ||
const keyed = props.keyed; | ||
const condition = createMemo(() => props.when, undefined, { | ||
equals: (a, b) => strictEqual ? a === b : !a === !b, | ||
equals: (a, b) => keyed ? a === b : !a === !b, | ||
name: "condition" | ||
@@ -1473,4 +1419,3 @@ } ); | ||
const fn = typeof child === "function" && child.length > 0; | ||
strictEqual = keyed || fn; | ||
return fn ? untrack(() => child(c)) : child; | ||
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child; | ||
} | ||
@@ -1483,5 +1428,4 @@ return props.fallback; | ||
function Switch(props) { | ||
let strictEqual = false; | ||
let keyed = false; | ||
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]; | ||
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]; | ||
const conditions = children(() => props.children), | ||
@@ -1508,4 +1452,3 @@ evalConditions = createMemo(() => { | ||
const fn = typeof c === "function" && c.length > 0; | ||
strictEqual = keyed || fn; | ||
return fn ? untrack(() => c(when)) : c; | ||
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c; | ||
}, undefined, { | ||
@@ -1715,10 +1658,7 @@ name: "value" | ||
let DEV; | ||
{ | ||
DEV = { | ||
writeSignal, | ||
serializeGraph, | ||
registerGraph, | ||
hashValue | ||
}; | ||
} | ||
DEV = { | ||
hooks: DevHooks, | ||
writeSignal, | ||
registerGraph | ||
}; | ||
if (globalThis) { | ||
@@ -1725,0 +1665,0 @@ if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior."); |
@@ -5,14 +5,16 @@ const equalFn = (a, b) => a === b; | ||
const $DEVCOMP = Symbol("solid-dev-component"); | ||
const DEV = {}; | ||
const DEV = undefined; | ||
const ERROR = Symbol("error"); | ||
const BRANCH = Symbol("branch"); | ||
function castError(err) { | ||
if (err instanceof Error || typeof err === "string") return err; | ||
return new Error("Unknown error"); | ||
if (err instanceof Error) return err; | ||
return new Error(typeof err === "string" ? err : "Unknown error", { | ||
cause: err | ||
}); | ||
} | ||
function handleError(err) { | ||
err = castError(err); | ||
const error = castError(err); | ||
const fns = lookup(Owner, ERROR); | ||
if (!fns) throw err; | ||
for (const f of fns) f(err); | ||
if (!fns) throw error; | ||
for (const f of fns) f(error); | ||
} | ||
@@ -19,0 +21,0 @@ const UNOWNED = { |
@@ -893,4 +893,6 @@ let taskIdCounter = 1, | ||
function castError(err) { | ||
if (err instanceof Error || typeof err === "string") return err; | ||
return new Error("Unknown error"); | ||
if (err instanceof Error) return err; | ||
return new Error(typeof err === "string" ? err : "Unknown error", { | ||
cause: err | ||
}); | ||
} | ||
@@ -901,11 +903,11 @@ function runErrors(fns, err) { | ||
function handleError(err) { | ||
err = castError(err); | ||
const fns = ERROR && lookup(Owner, ERROR); | ||
if (!fns) throw err; | ||
const error = castError(err); | ||
if (Effects) Effects.push({ | ||
fn() { | ||
runErrors(fns, err); | ||
runErrors(fns, error); | ||
}, | ||
state: STALE | ||
});else runErrors(fns, err); | ||
});else runErrors(fns, error); | ||
} | ||
@@ -1348,6 +1350,5 @@ function lookup(owner, key) { | ||
function Show(props) { | ||
let strictEqual = false; | ||
const keyed = props.keyed; | ||
const condition = createMemo(() => props.when, undefined, { | ||
equals: (a, b) => strictEqual ? a === b : !a === !b | ||
equals: (a, b) => keyed ? a === b : !a === !b | ||
}); | ||
@@ -1359,4 +1360,3 @@ return createMemo(() => { | ||
const fn = typeof child === "function" && child.length > 0; | ||
strictEqual = keyed || fn; | ||
return fn ? untrack(() => child(c)) : child; | ||
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child; | ||
} | ||
@@ -1367,5 +1367,4 @@ return props.fallback; | ||
function Switch(props) { | ||
let strictEqual = false; | ||
let keyed = false; | ||
const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]; | ||
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2]; | ||
const conditions = children(() => props.children), | ||
@@ -1391,4 +1390,3 @@ evalConditions = createMemo(() => { | ||
const fn = typeof c === "function" && c.length > 0; | ||
strictEqual = keyed || fn; | ||
return fn ? untrack(() => c(when)) : c; | ||
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c; | ||
}, undefined, undefined); | ||
@@ -1395,0 +1393,0 @@ } |
{ | ||
"name": "solid-js", | ||
"description": "A declarative JavaScript library for building user interfaces.", | ||
"version": "1.6.11", | ||
"version": "1.7.0-beta.0", | ||
"author": "Ryan Carniato", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
import { $PROXY, DEV as DEV$1, $TRACK, getListener, batch, createSignal } from 'solid-js'; | ||
const $RAW = Symbol("store-raw"), | ||
$NODE = Symbol("store-node"), | ||
$NAME = Symbol("store-name"); | ||
function wrap$1(value, name) { | ||
$NODE = Symbol("store-node"); | ||
const DevHooks = { | ||
onStoreNodeUpdate: null | ||
}; | ||
function wrap$1(value) { | ||
let p = value[$PROXY]; | ||
@@ -25,5 +27,2 @@ if (!p) { | ||
} | ||
if (name) Object.defineProperty(value, $NAME, { | ||
value: name | ||
}); | ||
} | ||
@@ -71,3 +70,3 @@ return p; | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc; | ||
delete desc.value; | ||
@@ -112,3 +111,3 @@ delete desc.writable; | ||
} | ||
return isWrappable(value) ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value; | ||
return isWrappable(value) ? wrap$1(value) : value; | ||
}, | ||
@@ -135,3 +134,3 @@ has(target, property) { | ||
len = state.length; | ||
if (globalThis._$onStoreNodeUpdate) globalThis._$onStoreNodeUpdate(state, property, value, prev); | ||
DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev); | ||
if (value === undefined) delete state[property];else state[property] = value; | ||
@@ -214,9 +213,7 @@ let nodes = getDataNodes(state), | ||
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`); | ||
const wrappedStore = wrap$1(unwrappedStore, (options && options.name || DEV$1.hashValue(unwrappedStore))); | ||
{ | ||
const name = options && options.name || DEV$1.hashValue(unwrappedStore); | ||
DEV$1.registerGraph(name, { | ||
value: unwrappedStore | ||
}); | ||
} | ||
const wrappedStore = wrap$1(unwrappedStore); | ||
DEV$1.registerGraph({ | ||
value: unwrappedStore, | ||
name: options && options.name | ||
}); | ||
function setStore(...args) { | ||
@@ -232,3 +229,3 @@ batch(() => { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc; | ||
delete desc.value; | ||
@@ -259,3 +256,3 @@ delete desc.writable; | ||
} | ||
return isWrappable(value) ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value; | ||
return isWrappable(value) ? wrap(value) : value; | ||
}, | ||
@@ -278,3 +275,3 @@ has(target, property) { | ||
}; | ||
function wrap(value, name) { | ||
function wrap(value) { | ||
let p = value[$PROXY]; | ||
@@ -303,5 +300,2 @@ if (!p) { | ||
} | ||
if (name) Object.defineProperty(value, $NAME, { | ||
value: name | ||
}); | ||
} | ||
@@ -313,9 +307,7 @@ return p; | ||
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`); | ||
const wrappedStore = wrap(unwrappedStore, (options && options.name || DEV$1.hashValue(unwrappedStore))); | ||
{ | ||
const name = options && options.name || DEV$1.hashValue(unwrappedStore); | ||
DEV$1.registerGraph(name, { | ||
value: unwrappedStore | ||
}); | ||
} | ||
const wrappedStore = wrap(unwrappedStore); | ||
DEV$1.registerGraph({ | ||
value: unwrappedStore, | ||
name: options && options.name | ||
}); | ||
return wrappedStore; | ||
@@ -443,8 +435,9 @@ } | ||
const DEV = { | ||
$NAME, | ||
let DEV; | ||
DEV = { | ||
$NODE, | ||
isWrappable | ||
} ; | ||
isWrappable, | ||
hooks: DevHooks | ||
}; | ||
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap }; |
import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js'; | ||
const $RAW = Symbol("store-raw"), | ||
$NODE = Symbol("store-node"), | ||
$NAME = Symbol("store-name"); | ||
function wrap$1(value, name) { | ||
$NODE = Symbol("store-node"); | ||
function wrap$1(value) { | ||
let p = value[$PROXY]; | ||
@@ -67,3 +66,3 @@ if (!p) { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc; | ||
delete desc.value; | ||
@@ -215,3 +214,3 @@ delete desc.writable; | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc; | ||
delete desc.value; | ||
@@ -260,3 +259,3 @@ delete desc.writable; | ||
}; | ||
function wrap(value, name) { | ||
function wrap(value) { | ||
let p = value[$PROXY]; | ||
@@ -413,4 +412,4 @@ if (!p) { | ||
const DEV = undefined; | ||
let DEV; | ||
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap }; |
@@ -1,10 +0,11 @@ | ||
export { createStore, unwrap, $RAW } from "./store.js"; | ||
export type { Store, SetStoreFunction, NotWrappable, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store.js"; | ||
export { $RAW, createStore, unwrap } from "./store.js"; | ||
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js"; | ||
export * from "./mutable.js"; | ||
export * from "./modifiers.js"; | ||
import { $NAME, $NODE, isWrappable } from "./store.js"; | ||
export declare const DEV: { | ||
readonly $NAME: typeof $NAME; | ||
readonly $NODE: typeof $NODE; | ||
readonly isWrappable: typeof isWrappable; | ||
import { $NODE, isWrappable, DevHooks } from "./store.js"; | ||
declare let DEV: { | ||
$NODE: typeof $NODE; | ||
isWrappable: typeof isWrappable; | ||
hooks: typeof DevHooks; | ||
} | undefined; | ||
export { DEV }; |
@@ -1,5 +0,5 @@ | ||
export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique symbol; | ||
declare global { | ||
var _$onStoreNodeUpdate: OnStoreNodeUpdate | undefined; | ||
} | ||
export declare const $RAW: unique symbol, $NODE: unique symbol; | ||
export declare const DevHooks: { | ||
onStoreNodeUpdate: OnStoreNodeUpdate | null; | ||
}; | ||
type DataNode = { | ||
@@ -12,3 +12,2 @@ (): any; | ||
export interface StoreNode { | ||
[$NAME]?: string; | ||
[$NODE]?: DataNodes; | ||
@@ -72,3 +71,5 @@ [key: PropertyKey]: any; | ||
type W<T> = Exclude<T, NotWrappable>; | ||
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [readonly unknown[]] ? number : [T] extends [never] ? never : keyof T : keyof T; | ||
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [ | ||
T | ||
] extends [readonly unknown[]] ? number : keyof T : keyof T; | ||
type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>; | ||
@@ -75,0 +76,0 @@ type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never] ? never : K extends MutableKeyOf<T> ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>] : K extends KeyOf<T> ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>] : never; |
@@ -10,9 +10,8 @@ export { $DEVCOMP, $PROXY, $TRACK, batch, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js"; | ||
export type { JSXElement, JSX }; | ||
import { hashValue, registerGraph, serializeGraph, writeSignal } from "./reactive/signal.js"; | ||
import { registerGraph, writeSignal, DevHooks } from "./reactive/signal.js"; | ||
declare let DEV: { | ||
writeSignal: typeof writeSignal; | ||
serializeGraph: typeof serializeGraph; | ||
registerGraph: typeof registerGraph; | ||
hashValue: typeof hashValue; | ||
}; | ||
readonly hooks: typeof DevHooks; | ||
readonly writeSignal: typeof writeSignal; | ||
readonly registerGraph: typeof registerGraph; | ||
} | undefined; | ||
export { DEV }; | ||
@@ -19,0 +18,0 @@ declare global { |
@@ -11,9 +11,11 @@ import { requestCallback } from "./scheduler.js"; | ||
declare let ExternalSourceFactory: ExternalSourceFactory | null; | ||
declare global { | ||
var _$afterUpdate: (() => void) | undefined; | ||
var _$afterCreateRoot: ((root: Owner) => void) | undefined; | ||
} | ||
/** Object storing callbacks for debugging during development */ | ||
export declare const DevHooks: { | ||
afterUpdate: (() => void) | null; | ||
afterCreateOwner: ((owner: Owner) => void) | null; | ||
}; | ||
export type ComputationState = 0 | 1 | 2; | ||
export interface SourceMapValue { | ||
value: unknown; | ||
name?: string; | ||
graph?: Owner; | ||
@@ -27,3 +29,2 @@ } | ||
comparator?: (prev: T, next: T) => boolean; | ||
name?: string; | ||
} | ||
@@ -35,5 +36,4 @@ export interface Owner { | ||
context: any | null; | ||
sourceMap?: Record<string, SourceMapValue>; | ||
sourceMap?: SourceMapValue[]; | ||
name?: string; | ||
componentName?: string; | ||
} | ||
@@ -431,3 +431,3 @@ export interface Computation<Init, Next extends Init = Init> extends Owner { | ||
*/ | ||
export declare function onError(fn: (err: any) => void): void; | ||
export declare function onError(fn: (err: Error) => void): void; | ||
export declare function getListener(): Computation<any, any> | null; | ||
@@ -457,13 +457,8 @@ export declare function getOwner(): Owner | null; | ||
export declare function resumeEffects(e: Computation<any>[]): void; | ||
export interface DevComponent<T> extends Memo<JSX.Element> { | ||
export interface DevComponent<T> extends Memo<unknown> { | ||
props: T; | ||
componentName: string; | ||
} | ||
export declare function devComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element; | ||
export declare function hashValue(v: any): string; | ||
export declare function registerGraph(name: string, value: SourceMapValue): string; | ||
interface GraphRecord { | ||
[k: string]: GraphRecord | unknown; | ||
} | ||
export declare function serializeGraph(owner?: Owner | null): GraphRecord; | ||
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V; | ||
export declare function registerGraph(value: SourceMapValue): void; | ||
export type ContextProviderComponent<T> = FlowComponent<{ | ||
@@ -507,3 +502,3 @@ value: T; | ||
export declare function useContext<T>(context: Context<T>): T; | ||
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement | JSX.FunctionElement>; | ||
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>; | ||
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[]; | ||
@@ -510,0 +505,0 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & { |
@@ -20,3 +20,3 @@ import { Accessor } from "../reactive/signal.js"; | ||
children: (item: T[number], index: Accessor<number>) => U; | ||
}): Accessor<U[]>; | ||
}): JSX.Element; | ||
/** | ||
@@ -39,3 +39,3 @@ * Non-keyed iteration over a list creating elements from its items | ||
children: (item: Accessor<T[number]>, index: number) => U; | ||
}): Accessor<U[]>; | ||
}): JSX.Element; | ||
/** | ||
@@ -50,3 +50,3 @@ * Conditionally render its children or an optional fallback component | ||
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element); | ||
}): () => JSX.Element; | ||
}): JSX.Element; | ||
export declare function Show<T>(props: { | ||
@@ -56,4 +56,4 @@ when: T | undefined | null | false; | ||
fallback?: JSX.Element; | ||
children: JSX.Element; | ||
}): () => JSX.Element; | ||
children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element); | ||
}): JSX.Element; | ||
/** | ||
@@ -76,3 +76,3 @@ * switches between content based on mutually exclusive conditions | ||
children: JSX.Element; | ||
}): Accessor<JSX.Element>; | ||
}): JSX.Element; | ||
export type MatchProps<T> = { | ||
@@ -121,2 +121,2 @@ when: T | undefined | null | false; | ||
children: JSX.Element; | ||
}): Accessor<JSX.Element>; | ||
}): JSX.Element; |
@@ -5,3 +5,3 @@ export declare const equalFn: <T>(a: T, b: T) => boolean; | ||
export declare const $DEVCOMP: unique symbol; | ||
export declare const DEV: {}; | ||
export declare const DEV: undefined; | ||
export type Accessor<T> = () => T; | ||
@@ -11,3 +11,3 @@ export type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U; | ||
export declare const BRANCH: unique symbol; | ||
export declare function castError(err: any): string | Error; | ||
export declare function castError(err: unknown): Error; | ||
export declare let Owner: Owner | null; | ||
@@ -40,3 +40,3 @@ interface Owner { | ||
}): void; | ||
export declare function onError(fn: (err: any) => void): void; | ||
export declare function onError(fn: (err: Error) => void): void; | ||
export declare function getListener(): null; | ||
@@ -43,0 +43,0 @@ export interface Context<T> { |
@@ -149,5 +149,5 @@ import { Setter, Signal } from "./reactive.js"; | ||
children: string; | ||
}): string | number | boolean | Node | JSX.ArrayElement | JSX.FunctionElement | { | ||
}): string | number | boolean | Node | JSX.ArrayElement | { | ||
t: string; | ||
} | null | undefined; | ||
export {}; |
import { hydrate as hydrateCore } from "./client.js"; | ||
import { JSX, Accessor, ComponentProps, ValidComponent } from "solid-js"; | ||
import { JSX, ComponentProps, ValidComponent } from "solid-js"; | ||
export * from "./client.js"; | ||
@@ -36,2 +36,2 @@ export { For, Show, Suspense, SuspenseList, Switch, Match, Index, ErrorBoundary, mergeProps } from "solid-js"; | ||
*/ | ||
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): Accessor<JSX.Element>; | ||
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
787213
21964
1