@cascateer/core 2.0.10 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascateer/core",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cascateer/core.git"
@@ -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
 
@@ -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
- private predicate: (
25
+ public predicate: (
26
26
  transform: Transform<T>,
27
- callback: UnaryFunction<Transform<any>, void>,
28
- ) => void = (transform, callback) => callback(transform),
27
+ ) => Transform<unknown> = identity,
29
28
  ) {}
30
29
 
31
- reflect = (transform: Transform<T>) =>
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, callback) =>
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.lift(lift),
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
- reflect: UnaryFunction<(args: any) => Promise<Transform<any>>, void>;
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.reflect((args) =>
149
- signal.reflector.reflect(predicate(args)),
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
- reflect: (transform) =>
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 transform(event.data.args).then((predicate) => ({
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 [];