@cascateer/core 2.0.9 → 2.0.11
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/package.json +1 -1
- package/src/jsx-runtime.ts +15 -15
- package/src/observable/Signal.ts +6 -14
- package/src/store.ts +9 -7
package/package.json
CHANGED
package/src/jsx-runtime.ts
CHANGED
|
@@ -25,21 +25,6 @@ declare global {
|
|
|
25
25
|
namespace JSX {
|
|
26
26
|
type Element = MaybeObservable<Node | Primitive>;
|
|
27
27
|
|
|
28
|
-
export type CSSCustomPropertyDefinition = Omit<PropertyDefinition, "name">;
|
|
29
|
-
|
|
30
|
-
export type CSSCustomIntegerPropertyDefinition =
|
|
31
|
-
CSSCustomPropertyDefinition & { syntax: "<integer>" };
|
|
32
|
-
|
|
33
|
-
export interface CSSCustomPropertyDefinitions extends Record<
|
|
34
|
-
keyof {},
|
|
35
|
-
CSSCustomPropertyDefinition
|
|
36
|
-
> {}
|
|
37
|
-
|
|
38
|
-
type CSSCustomProperties = Record<
|
|
39
|
-
keyof CSSCustomPropertyDefinitions & `--${string}`,
|
|
40
|
-
string | number
|
|
41
|
-
>;
|
|
42
|
-
|
|
43
28
|
type Children = MaybeObservable<MaybeArray<Element>>;
|
|
44
29
|
|
|
45
30
|
interface IntrinsicAttributes {
|
|
@@ -72,6 +57,21 @@ declare global {
|
|
|
72
57
|
interface Component<P extends Props = Props> {
|
|
73
58
|
(props: IntrinsicAttributes & P): Element;
|
|
74
59
|
}
|
|
60
|
+
|
|
61
|
+
export type CSSCustomPropertyDefinition = Omit<PropertyDefinition, "name">;
|
|
62
|
+
|
|
63
|
+
export type CSSCustomIntegerPropertyDefinition =
|
|
64
|
+
CSSCustomPropertyDefinition & { syntax: "<integer>" };
|
|
65
|
+
|
|
66
|
+
export interface CSSCustomPropertyDefinitions extends Record<
|
|
67
|
+
keyof {},
|
|
68
|
+
CSSCustomPropertyDefinition
|
|
69
|
+
> {}
|
|
70
|
+
|
|
71
|
+
type CSSCustomProperties = Record<
|
|
72
|
+
keyof CSSCustomPropertyDefinitions & `--${string}`,
|
|
73
|
+
string | number
|
|
74
|
+
>;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
package/src/observable/Signal.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clone, isEqual, memoize } from "lodash";
|
|
1
|
+
import { clone, identity, isEqual, memoize } from "lodash";
|
|
2
2
|
import { distinctUntilChanged, map, Observable, of, UnaryFunction } from "rxjs";
|
|
3
3
|
import { TapObservable } from ".";
|
|
4
4
|
import {
|
|
@@ -22,23 +22,15 @@ class SignalEnumerator<T> {
|
|
|
22
22
|
|
|
23
23
|
class SignalReflector<T> {
|
|
24
24
|
constructor(
|
|
25
|
-
|
|
25
|
+
public predicate: (
|
|
26
26
|
transform: Transform<T>,
|
|
27
|
-
|
|
28
|
-
) => void = (transform, callback) => callback(transform),
|
|
27
|
+
) => Transform<unknown> = identity,
|
|
29
28
|
) {}
|
|
30
29
|
|
|
31
|
-
reflect =
|
|
32
|
-
new Promise<Transform<unknown>>((callback) =>
|
|
33
|
-
this.predicate(transform, callback),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
lift = <U>(
|
|
30
|
+
reflect = <U>(
|
|
37
31
|
lift: UnaryFunction<Transform<U>, Transform<T>>,
|
|
38
32
|
): SignalReflector<U> =>
|
|
39
|
-
new SignalReflector((transform
|
|
40
|
-
this.predicate(lift(transform), callback),
|
|
41
|
-
);
|
|
33
|
+
new SignalReflector((transform) => this.predicate(lift(transform)));
|
|
42
34
|
}
|
|
43
35
|
|
|
44
36
|
export class Signal<T> extends Observable<T> implements TapObservable<T> {
|
|
@@ -78,7 +70,7 @@ export class Signal<T> extends Observable<T> implements TapObservable<T> {
|
|
|
78
70
|
return new Signal({
|
|
79
71
|
value: this.pipe(map(project), distinctUntilChanged()),
|
|
80
72
|
enumerator: new SignalEnumerator(enumerate),
|
|
81
|
-
reflector: this.reflector.
|
|
73
|
+
reflector: this.reflector.reflect(lift),
|
|
82
74
|
});
|
|
83
75
|
}
|
|
84
76
|
|
package/src/store.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class ExtendableStoreAdapter<
|
|
|
73
73
|
},
|
|
74
74
|
void
|
|
75
75
|
>;
|
|
76
|
-
|
|
76
|
+
register: UnaryFunction<(args: any) => Transform<any>, void>;
|
|
77
77
|
}
|
|
78
78
|
>;
|
|
79
79
|
},
|
|
@@ -145,8 +145,8 @@ export class ExtendableStoreAdapter<
|
|
|
145
145
|
(signal) => ({
|
|
146
146
|
update: (predicate, config = {}) =>
|
|
147
147
|
thru(this.context.transform(key), (transform) => {
|
|
148
|
-
transform.
|
|
149
|
-
signal.reflector.
|
|
148
|
+
transform.register((args) =>
|
|
149
|
+
signal.reflector.predicate(predicate(args)),
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
return (args) =>
|
|
@@ -204,7 +204,7 @@ export class StoreProvider<Data> extends ExtendableStoreAdapter<
|
|
|
204
204
|
}
|
|
205
205
|
),
|
|
206
206
|
),
|
|
207
|
-
|
|
207
|
+
register: (transform) =>
|
|
208
208
|
actions
|
|
209
209
|
.pipe(
|
|
210
210
|
mergeMap(async (event) => {
|
|
@@ -212,11 +212,11 @@ export class StoreProvider<Data> extends ExtendableStoreAdapter<
|
|
|
212
212
|
event.type === "transformAction" &&
|
|
213
213
|
event.data.key === (await key)
|
|
214
214
|
) {
|
|
215
|
-
return
|
|
215
|
+
return {
|
|
216
216
|
...event,
|
|
217
|
-
predicate,
|
|
217
|
+
predicate: transform(event.data.args),
|
|
218
218
|
callback: callbacks.get(event.id),
|
|
219
|
-
}
|
|
219
|
+
};
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
return [];
|
|
@@ -231,6 +231,8 @@ export class StoreProvider<Data> extends ExtendableStoreAdapter<
|
|
|
231
231
|
value: merge(seedActions, transformActions).pipe(
|
|
232
232
|
sequence<MulticastAction<Data>, Data>(
|
|
233
233
|
([action, previousAction], [previousState]) => {
|
|
234
|
+
console.log(action);
|
|
235
|
+
|
|
234
236
|
if (action.type === "seedAction") {
|
|
235
237
|
return action.predicate();
|
|
236
238
|
}
|