solid-ctrl-flow 2.2.3 → 2.2.5
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 -9
- package/dist/index.mjs +14 -9
- package/dist/index.umd.js +14 -9
- package/package.json +1 -1
- package/bun.lockb +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { splitProps } from 'solid-js';
|
|
|
9
9
|
/** Like a {@link Match} but gets the value from the closest {@link On} ancestor */
|
|
10
10
|
export declare function Case(props: ParentProps<{
|
|
11
11
|
value: unknown;
|
|
12
|
-
}>): JSX;
|
|
12
|
+
}>): JSX.Element;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Eventually wraps its content into a template if a certain condition is met.
|
|
@@ -55,13 +55,13 @@ export declare class Extractor {
|
|
|
55
55
|
constructor(name?: string);
|
|
56
56
|
readonly ctx: Context<State | undefined>;
|
|
57
57
|
Joint: (props: {
|
|
58
|
-
children?: JSX;
|
|
59
|
-
}) => JSX;
|
|
60
|
-
Fallback: () => JSX;
|
|
58
|
+
children?: JSX.Element;
|
|
59
|
+
}) => JSX.Element;
|
|
60
|
+
Fallback: () => JSX.Element;
|
|
61
61
|
Dest: (props: {
|
|
62
62
|
hidden?: boolean | undefined;
|
|
63
|
-
}) => JSX;
|
|
64
|
-
Source: (props: Info) => JSX;
|
|
63
|
+
}) => JSX.Element;
|
|
64
|
+
Source: (props: Info) => JSX.Element;
|
|
65
65
|
/**
|
|
66
66
|
* Returns the number of destinations available for the current {@link Extractor}.
|
|
67
67
|
* It's a getter that returns a function that will be bound to the {@link Owner} in which the getter was called.
|
|
@@ -84,7 +84,8 @@ declare type Keyed<T> = Standard<T> & {
|
|
|
84
84
|
/**
|
|
85
85
|
* Memoizes some of the properties of {@link obj}.
|
|
86
86
|
* If {@link keys} is not provided, memoizes everything that get returned by {@link Reflect.ownKeys} when provided with {@link obj}.
|
|
87
|
-
* The {@link equals} parameter defaults to `false` to allow the specific reactive value to have control over when its dependant effects are triggered
|
|
87
|
+
* The {@link equals} parameter defaults to `false` to allow the specific reactive value to have control over when its dependant effects are triggered.
|
|
88
|
+
* The memoized properties have {@link NO_OP} as setter, this is needed because {@link Ref}s are assigned if they're not functions, so an `undefined` forwarded {@link Ref} would throw in that case (In strict contexts)
|
|
88
89
|
* @param obj Object to partially memoize
|
|
89
90
|
* @param keys The keys of the properties to memoize
|
|
90
91
|
* @param equals The comparator function to use on the newly created memos
|
|
@@ -120,7 +121,7 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
|
|
|
120
121
|
export declare function On<T>(props: ParentProps<{
|
|
121
122
|
value: T;
|
|
122
123
|
onCompare?(a: unknown, b: T): boolean;
|
|
123
|
-
}>): JSX;
|
|
124
|
+
}>): JSX.Element;
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* Ordered linked list that allows for:
|
|
@@ -133,7 +134,8 @@ export declare class OrderedLinkedList<T> {
|
|
|
133
134
|
/** Yields all the elements PAST the current */
|
|
134
135
|
[Symbol.iterator](): Generator<T>;
|
|
135
136
|
/**
|
|
136
|
-
* Adds a node to the list in order
|
|
137
|
+
* Adds a node to the list in order.
|
|
138
|
+
* If two nodes have the same order, it would have been more efficient to put the latest one first, but this would not have been ok, since we also want to order by insertion time
|
|
137
139
|
* @param node The node to add
|
|
138
140
|
* @param comp The comparison function to use
|
|
139
141
|
* @returns The same value as {@link node}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createMemo, splitProps, untrack, createRoot, getOwner, createComponent, Show, createContext, useContext, createRenderEffect, on, onCleanup, For, createSignal, createSelector, equalFn, Match } from "solid-js";
|
|
2
|
+
const NO_OP = () => {
|
|
3
|
+
};
|
|
2
4
|
function memoProps(obj, keys = Reflect.ownKeys(obj), equals = false) {
|
|
3
5
|
const out = {};
|
|
4
6
|
for (const elm of keys)
|
|
5
|
-
Object.defineProperty(out, elm, { enumerable: true, get: createMemo(() => obj[elm], void 0, { equals }) });
|
|
7
|
+
Object.defineProperty(out, elm, { enumerable: true, set: NO_OP, get: createMemo(() => obj[elm], void 0, { equals }) });
|
|
6
8
|
return out;
|
|
7
9
|
}
|
|
8
10
|
const splitAndMemoProps = (obj, ...keys) => {
|
|
@@ -59,14 +61,15 @@ class OrderedLinkedList {
|
|
|
59
61
|
yield* next;
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
* Adds a node to the list in order.
|
|
65
|
+
* If two nodes have the same order, it would have been more efficient to put the latest one first, but this would not have been ok, since we also want to order by insertion time
|
|
66
|
+
* @param node The node to add
|
|
67
|
+
* @param comp The comparison function to use
|
|
68
|
+
* @returns The same value as {@link node}
|
|
69
|
+
*/
|
|
67
70
|
add(node, comp) {
|
|
68
71
|
const { next } = this;
|
|
69
|
-
if (next && comp(node.value, next.value)
|
|
72
|
+
if (next && comp(node.value, next.value) >= 0)
|
|
70
73
|
return next.add(node, comp);
|
|
71
74
|
this.next = node;
|
|
72
75
|
node.prev = this;
|
|
@@ -120,7 +123,6 @@ class Extractor {
|
|
|
120
123
|
name
|
|
121
124
|
});
|
|
122
125
|
}
|
|
123
|
-
ctx;
|
|
124
126
|
Joint = Joint.bind(this);
|
|
125
127
|
Fallback = Fallback.bind(this);
|
|
126
128
|
Dest = Dest.bind(this);
|
|
@@ -193,7 +195,10 @@ function Source(props) {
|
|
|
193
195
|
};
|
|
194
196
|
const node = new OrderedLinkedListNode(info);
|
|
195
197
|
createRenderEffect(on(order, () => {
|
|
196
|
-
onCleanup(() =>
|
|
198
|
+
onCleanup(() => {
|
|
199
|
+
node.remove();
|
|
200
|
+
state.force();
|
|
201
|
+
});
|
|
197
202
|
sources.add(node, COMPARATOR);
|
|
198
203
|
state.force();
|
|
199
204
|
}));
|
package/dist/index.umd.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("solid-js")) : typeof define === "function" && define.amd ? define(["exports", "solid-js"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.solidCtrlFlow = {}, global.solidJs));
|
|
3
3
|
})(this, function(exports2, solidJs) {
|
|
4
4
|
"use strict";
|
|
5
|
+
const NO_OP = () => {
|
|
6
|
+
};
|
|
5
7
|
function memoProps(obj, keys = Reflect.ownKeys(obj), equals = false) {
|
|
6
8
|
const out = {};
|
|
7
9
|
for (const elm of keys)
|
|
8
|
-
Object.defineProperty(out, elm, { enumerable: true, get: solidJs.createMemo(() => obj[elm], void 0, { equals }) });
|
|
10
|
+
Object.defineProperty(out, elm, { enumerable: true, set: NO_OP, get: solidJs.createMemo(() => obj[elm], void 0, { equals }) });
|
|
9
11
|
return out;
|
|
10
12
|
}
|
|
11
13
|
const splitAndMemoProps = (obj, ...keys) => {
|
|
@@ -62,14 +64,15 @@
|
|
|
62
64
|
yield* next;
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
* Adds a node to the list in order.
|
|
68
|
+
* If two nodes have the same order, it would have been more efficient to put the latest one first, but this would not have been ok, since we also want to order by insertion time
|
|
69
|
+
* @param node The node to add
|
|
70
|
+
* @param comp The comparison function to use
|
|
71
|
+
* @returns The same value as {@link node}
|
|
72
|
+
*/
|
|
70
73
|
add(node, comp) {
|
|
71
74
|
const { next } = this;
|
|
72
|
-
if (next && comp(node.value, next.value)
|
|
75
|
+
if (next && comp(node.value, next.value) >= 0)
|
|
73
76
|
return next.add(node, comp);
|
|
74
77
|
this.next = node;
|
|
75
78
|
node.prev = this;
|
|
@@ -123,7 +126,6 @@
|
|
|
123
126
|
name
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
|
-
ctx;
|
|
127
129
|
Joint = Joint.bind(this);
|
|
128
130
|
Fallback = Fallback.bind(this);
|
|
129
131
|
Dest = Dest.bind(this);
|
|
@@ -196,7 +198,10 @@
|
|
|
196
198
|
};
|
|
197
199
|
const node = new OrderedLinkedListNode(info);
|
|
198
200
|
solidJs.createRenderEffect(solidJs.on(order, () => {
|
|
199
|
-
solidJs.onCleanup(() =>
|
|
201
|
+
solidJs.onCleanup(() => {
|
|
202
|
+
node.remove();
|
|
203
|
+
state.force();
|
|
204
|
+
});
|
|
200
205
|
sources.add(node, COMPARATOR);
|
|
201
206
|
state.force();
|
|
202
207
|
}));
|
package/package.json
CHANGED
package/bun.lockb
DELETED
|
Binary file
|