solid-ctrl-flow 1.0.50 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +11 -1
- package/dist/index.mjs +10 -0
- package/dist/index.umd.js +10 -0
- package/package.json +1 -1
- package/readMe.md +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,15 @@ export declare function createReactiveResource<R>(f: EffectFunction<R | undefine
|
|
|
127
127
|
/** Built-in {@link ReactiveContext} which allows you to display different things in debug mode */
|
|
128
128
|
export declare const debug: ReactiveContext<boolean>;
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Defines a reactive property on an object
|
|
132
|
+
* @param obj The object on which to define the property
|
|
133
|
+
* @param k The key of the property that will be defined
|
|
134
|
+
* @param param2 The {@link Signal} to use as the data store of the property
|
|
135
|
+
* @returns The same thing passed as {@link obj}
|
|
136
|
+
*/
|
|
137
|
+
export declare function defineSignalProperty<const T, K extends keyof T>(obj: T, k: K, [get, set]: Signal<T[K]>): T;
|
|
138
|
+
|
|
130
139
|
/**
|
|
131
140
|
* Eventually wraps its content into a template if a certain condition is met.
|
|
132
141
|
* If you set {@link Standard.recycled} to `true`, the content will be memoized in the beginning and will be recycled even if the wrapper changes.
|
|
@@ -278,7 +287,8 @@ export declare namespace Slot {
|
|
|
278
287
|
}
|
|
279
288
|
|
|
280
289
|
/**
|
|
281
|
-
* Executes {@link splitProps} and memoizes the first of the two returned objects using {@link memoProps}
|
|
290
|
+
* Executes {@link splitProps} and memoizes the first of the two returned objects using {@link memoProps}.
|
|
291
|
+
* Unlike {@link splitProps}, this doesn't support multiple key-sets out of the box
|
|
282
292
|
* @param obj Object to split and partially memoize
|
|
283
293
|
* @param keys The keys of the properties to memoize and to include in the first of the two objects
|
|
284
294
|
* @param equals The comparator function to use on the newly created memos
|
package/dist/index.mjs
CHANGED
|
@@ -67,6 +67,15 @@ function runWithContext(ctx2, value, f) {
|
|
|
67
67
|
function untrackCall(f, ...args) {
|
|
68
68
|
return untrack(() => f.apply(this, args));
|
|
69
69
|
}
|
|
70
|
+
function defineSignalProperty(obj, k, [get, set]) {
|
|
71
|
+
return Object.defineProperty(obj, k, {
|
|
72
|
+
get,
|
|
73
|
+
set,
|
|
74
|
+
enumerable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
configurable: true
|
|
77
|
+
});
|
|
78
|
+
}
|
|
70
79
|
function createReactiveResource(f) {
|
|
71
80
|
var refetch;
|
|
72
81
|
const memo = createMemo(f);
|
|
@@ -288,6 +297,7 @@ export {
|
|
|
288
297
|
createExtractor,
|
|
289
298
|
createReactiveResource,
|
|
290
299
|
debug,
|
|
300
|
+
defineSignalProperty,
|
|
291
301
|
memoProps,
|
|
292
302
|
runWithContext,
|
|
293
303
|
splitAndMemoProps,
|
package/dist/index.umd.js
CHANGED
|
@@ -69,6 +69,15 @@
|
|
|
69
69
|
function untrackCall(f, ...args) {
|
|
70
70
|
return solidJs.untrack(() => f.apply(this, args));
|
|
71
71
|
}
|
|
72
|
+
function defineSignalProperty(obj, k, [get, set]) {
|
|
73
|
+
return Object.defineProperty(obj, k, {
|
|
74
|
+
get,
|
|
75
|
+
set,
|
|
76
|
+
enumerable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
72
81
|
function createReactiveResource(f) {
|
|
73
82
|
var refetch;
|
|
74
83
|
const memo = solidJs.createMemo(f);
|
|
@@ -288,6 +297,7 @@
|
|
|
288
297
|
exports2.createExtractor = createExtractor;
|
|
289
298
|
exports2.createReactiveResource = createReactiveResource;
|
|
290
299
|
exports2.debug = debug;
|
|
300
|
+
exports2.defineSignalProperty = defineSignalProperty;
|
|
291
301
|
exports2.memoProps = memoProps;
|
|
292
302
|
exports2.runWithContext = runWithContext;
|
|
293
303
|
exports2.splitAndMemoProps = splitAndMemoProps;
|
package/package.json
CHANGED
package/readMe.md
CHANGED
|
@@ -43,7 +43,7 @@ If you are NOT wrapping the content with a context provider you can set the `rec
|
|
|
43
43
|
```tsx
|
|
44
44
|
return <>
|
|
45
45
|
<Enfold recycled when={value} template={c => <ctx.Provider value={2} children={c()} />}>
|
|
46
|
-
{/* This won't
|
|
46
|
+
{/* This won't be 2 */}
|
|
47
47
|
{useContext(ctx)}
|
|
48
48
|
</Enfold>
|
|
49
49
|
</>
|
|
@@ -215,6 +215,9 @@ return <>
|
|
|
215
215
|
### `untrackCall()`
|
|
216
216
|
Calls a function untracking what happens inside of it but not what gets passed as its argument
|
|
217
217
|
|
|
218
|
+
### `defineSignalProperty()`
|
|
219
|
+
Defines a reactive property on an object
|
|
220
|
+
|
|
218
221
|
### `createReactiveResource()`
|
|
219
222
|
Like `createResource()` but the provided function will be reactive
|
|
220
223
|
|