Comparing version 1.6.0-beta.0 to 1.6.0-beta.1
@@ -310,3 +310,3 @@ let taskIdCounter = 1, | ||
if (pr) { | ||
if (c.resolved && Transition && Transition.running) Transition.promises.add(pr);else if (!contexts.has(c)) { | ||
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) { | ||
c.increment(); | ||
@@ -564,7 +564,7 @@ contexts.add(c); | ||
} | ||
function createContext(defaultValue) { | ||
function createContext(defaultValue, options) { | ||
const id = Symbol("context"); | ||
return { | ||
id, | ||
Provider: createProvider(id), | ||
Provider: createProvider(id, options), | ||
defaultValue | ||
@@ -963,3 +963,3 @@ }; | ||
} | ||
function createProvider(id) { | ||
function createProvider(id, options) { | ||
return function provider(props) { | ||
@@ -972,3 +972,3 @@ let res; | ||
return children(() => props.children); | ||
})); | ||
}), undefined, options); | ||
return res; | ||
@@ -975,0 +975,0 @@ }; |
@@ -302,3 +302,3 @@ let taskIdCounter = 1, | ||
if (pr) { | ||
if (c.resolved && Transition && Transition.running) Transition.promises.add(pr);else if (!contexts.has(c)) { | ||
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) { | ||
c.increment(); | ||
@@ -503,3 +503,3 @@ contexts.add(c); | ||
} | ||
function createContext(defaultValue) { | ||
function createContext(defaultValue, options) { | ||
const id = Symbol("context"); | ||
@@ -900,3 +900,3 @@ return { | ||
} | ||
function createProvider(id) { | ||
function createProvider(id, options) { | ||
return function provider(props) { | ||
@@ -909,3 +909,3 @@ let res; | ||
return children(() => props.children); | ||
})); | ||
}), undefined); | ||
return res; | ||
@@ -912,0 +912,0 @@ }; |
{ | ||
"name": "solid-js", | ||
"description": "A declarative JavaScript library for building user interfaces.", | ||
"version": "1.6.0-beta.0", | ||
"version": "1.6.0-beta.1", | ||
"author": "Ryan Carniato", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -68,3 +68,3 @@ import { DEV, $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js'; | ||
} | ||
function proxyDescriptor(target, property) { | ||
function proxyDescriptor$1(target, property) { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
@@ -128,3 +128,3 @@ if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
ownKeys: ownKeys, | ||
getOwnPropertyDescriptor: proxyDescriptor | ||
getOwnPropertyDescriptor: proxyDescriptor$1 | ||
}; | ||
@@ -229,2 +229,11 @@ function setProperty(state, property, value, deleting = false) { | ||
function proxyDescriptor(target, property) { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
delete desc.value; | ||
delete desc.writable; | ||
desc.get = () => target[$PROXY][property]; | ||
desc.set = v => target[$PROXY][property] = v; | ||
return desc; | ||
} | ||
const proxyTraps = { | ||
@@ -231,0 +240,0 @@ get(target, property, receiver) { |
@@ -65,3 +65,3 @@ import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js'; | ||
} | ||
function proxyDescriptor(target, property) { | ||
function proxyDescriptor$1(target, property) { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
@@ -123,3 +123,3 @@ if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
ownKeys: ownKeys, | ||
getOwnPropertyDescriptor: proxyDescriptor | ||
getOwnPropertyDescriptor: proxyDescriptor$1 | ||
}; | ||
@@ -217,2 +217,11 @@ function setProperty(state, property, value, deleting = false) { | ||
function proxyDescriptor(target, property) { | ||
const desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME) return desc; | ||
delete desc.value; | ||
delete desc.writable; | ||
desc.get = () => target[$PROXY][property]; | ||
desc.set = v => target[$PROXY][property] = v; | ||
return desc; | ||
} | ||
const proxyTraps = { | ||
@@ -219,0 +228,0 @@ get(target, property, receiver) { |
@@ -476,5 +476,9 @@ import { requestCallback } from "./scheduler.js"; | ||
* } | ||
* export function createContext<T>(defaultValue?: T): Context<T | undefined>; | ||
* 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` | ||
@@ -484,4 +488,4 @@ * | ||
*/ | ||
export declare function createContext<T>(): Context<T | undefined>; | ||
export declare function createContext<T>(defaultValue: T): Context<T>; | ||
export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>; | ||
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>; | ||
/** | ||
@@ -488,0 +492,0 @@ * use a context to receive a scoped state from a parent's Context.Provider |
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
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
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
773910
21599