@praxisjs/decorators 0.8.0 → 0.8.1
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/CHANGELOG.md +12 -0
- package/dist/create-field-decorator.d.ts +1 -1
- package/dist/create-field-decorator.d.ts.map +1 -1
- package/dist/create-field-decorator.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/compose.d.ts +1 -1
- package/dist/properties/compose.d.ts.map +1 -1
- package/dist/properties/deep-state.d.ts +2 -1
- package/dist/properties/deep-state.d.ts.map +1 -1
- package/dist/properties/deep-state.js.map +1 -1
- package/dist/properties/history.d.ts +1 -1
- package/dist/properties/history.d.ts.map +1 -1
- package/dist/properties/persisted.d.ts +1 -1
- package/dist/properties/persisted.d.ts.map +1 -1
- package/dist/properties/prop.d.ts +1 -1
- package/dist/properties/prop.d.ts.map +1 -1
- package/dist/properties/resource.d.ts +1 -1
- package/dist/properties/resource.d.ts.map +1 -1
- package/dist/properties/slot.d.ts +1 -1
- package/dist/properties/slot.d.ts.map +1 -1
- package/dist/properties/state.d.ts +2 -1
- package/dist/properties/state.d.ts.map +1 -1
- package/dist/properties/state.js.map +1 -1
- package/dist/properties/synced.d.ts +1 -1
- package/dist/properties/synced.d.ts.map +1 -1
- package/dist/reactive-host.d.ts +4 -0
- package/dist/reactive-host.d.ts.map +1 -0
- package/dist/reactive-host.js +2 -0
- package/dist/reactive-host.js.map +1 -0
- package/package.json +1 -1
- package/src/create-field-decorator.ts +3 -3
- package/src/index.ts +1 -0
- package/src/properties/deep-state.ts +3 -1
- package/src/properties/state.ts +3 -1
- package/src/reactive-host.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @praxisjs/decorators
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9c7a165: fix: constrain `@State` and `@DeepState` to reactive classes only
|
|
8
|
+
|
|
9
|
+
Introduces `ReactiveHost` (`{ _stateDirty: boolean }`) exported from `@praxisjs/decorators`. `@State` and `@DeepState` now use `createFieldDecorator<ReactiveHost>` with a generic `<This extends ReactiveHost, Value>` constraint, producing a TS error when applied to plain classes.
|
|
10
|
+
|
|
11
|
+
`createFieldDecorator` now returns a generic function `<This extends T, Value>` so TypeScript infers the actual class type at the call site and checks the constraint against it instead of doing a fixed structural check.
|
|
12
|
+
|
|
13
|
+
`@Store` is simplified to a plain class decorator (no longer uses `createClassDecorator`). A new `ReactiveStore` base class is exported from `@praxisjs/store` — store classes must extend it to satisfy the `ReactiveHost` constraint required by `@State` and `@DeepState`. Template updated accordingly.
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -10,5 +10,5 @@ export interface FieldBinding {
|
|
|
10
10
|
export interface FieldBehavior<T = object> {
|
|
11
11
|
bind(instance: T, name: string, initialValue: unknown): FieldBinding;
|
|
12
12
|
}
|
|
13
|
-
export declare function createFieldDecorator<T = StatefulComponent>(behavior: FieldBehavior<T>): (_value: undefined, context: ClassFieldDecoratorContext<
|
|
13
|
+
export declare function createFieldDecorator<T = StatefulComponent>(behavior: FieldBehavior<T>): <This extends T, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
14
14
|
//# sourceMappingURL=create-field-decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-decorator.d.ts","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM;IACvC,IAAI,CACF,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB,YAAY,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"create-field-decorator.d.ts","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM;IACvC,IAAI,CACF,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB,YAAY,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,IACnE,IAAI,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,EAC9C,QAAQ,SAAS,EACjB,SAAS,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAC/C,IAAI,CA0CR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-decorator.js","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,oBAAoB,CAAwB,QAA0B;IACpF,OAAO,UACL,MAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"create-field-decorator.js","sourceRoot":"","sources":["../src/create-field-decorator.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,oBAAoB,CAAwB,QAA0B;IACpF,OAAO,UACL,MAAiB,EACjB,OAAgD;QAEhD,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,QAAQ,GAAG,IAA0D,CAAC;YAC5E,MAAM,IAAI,GAAG,OAAO,CAAC,IAAc,CAAC;YACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEpC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC,IAAI,CAClE,QAAa,EACb,IAAI,EACJ,YAAY,CACb,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBACvC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE;oBACpC,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;oBAClB,GAAG,UAAU;iBACd,CAAC,CAAC;YACL,CAAC;YAED,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC3D,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACnC,YAAY,EAAE,IAAI;oBAClB,GAAG,IAAI;iBACR,CAAC,CAAC;YACL,CAAC;YAED,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;gBACzB,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACnD,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACvD,QAAQ,CAAC,OAAO,GAAG,GAAG,EAAE;oBACtB,SAAS,EAAE,EAAE,CAAC;oBACd,OAAO,EAAE,EAAE,CAAC;gBACd,CAAC,CAAC;gBACF,QAAQ,CAAC,SAAS,GAAG,GAAG,EAAE;oBACxB,WAAW,EAAE,EAAE,CAAC;oBAChB,SAAS,EAAE,EAAE,CAAC;gBAChB,CAAC,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { Memo, Bind, Log, Once, Retry, Debounce, Throttle, When, Until, Watch, t
|
|
|
3
3
|
export { Prop, State, Computed, Persisted, Slot, initSlots, History, type HistoryOf, Compose, Resource, type ResourceInstance, type ResourceOptions, Synced, DeepState, } from "./properties";
|
|
4
4
|
export { type Command, createCommand, Emit, OnCommand } from "./events";
|
|
5
5
|
export { createFieldDecorator, type FieldBehavior, type FieldBinding, } from "./create-field-decorator";
|
|
6
|
+
export { type ReactiveHost } from "./reactive-host";
|
|
6
7
|
export { createClassDecorator, ClassBehavior, type ClassEnhancement, } from "./create-class-decorator";
|
|
7
8
|
export { createMethodDecorator, type MethodBehavior, } from "./create-method-decorator";
|
|
8
9
|
export { createLifecycleMethodDecorator, type LifecycleMethodBehavior, } from "./create-lifecycle-method-decorator";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,GAC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ACrB,KAAK,eAAe,EACpB,MAAM,EACN,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EACL,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,8BAA8B,EAC9B,KAAK,uBAAuB,GAC7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,6BAA6B,EAC7B,KAAK,sBAAsB,GAC5B,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,OAAO,EAEP,OAAO,EACP,QAAQ,EAGR,MAAM,EACN,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAgB,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,OAAO,EAEP,OAAO,EACP,QAAQ,EAGR,MAAM,EACN,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAgB,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,GAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,8BAA8B,GAE/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,qBAAqB,EAErB,6BAA6B,GAE9B,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StatefulComponent, Composable } from "@praxisjs/core";
|
|
2
|
-
export declare function Compose(ComposableClass: new (...args: any[]) => Composable, ...ctorArgs: unknown[]): (_value: undefined, context: ClassFieldDecoratorContext<
|
|
2
|
+
export declare function Compose(ComposableClass: new (...args: any[]) => Composable, ...ctorArgs: unknown[]): <This extends StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
3
3
|
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/properties/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6BpE,wBAAgB,OAAO,CAErB,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EACnD,GAAG,QAAQ,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/properties/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6BpE,wBAAgB,OAAO,CAErB,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EACnD,GAAG,QAAQ,EAAE,OAAO,EAAE,kIAoBvB"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactiveHost } from "../reactive-host";
|
|
2
|
+
export declare function DeepState(): <This extends ReactiveHost, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
2
3
|
//# sourceMappingURL=deep-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-state.d.ts","sourceRoot":"","sources":["../../src/properties/deep-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deep-state.d.ts","sourceRoot":"","sources":["../../src/properties/deep-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAwBrD,wBAAgB,SAAS,8HAiCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-state.js","sourceRoot":"","sources":["../../src/properties/deep-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
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O,KAAK,QAAQ;gBAC7C,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;gBAC5B,CAAC,CAAC,OAAO,CAAC;YAEd,SAAS,MAAM;gBACb,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC5B,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/B,CAAC;YAED,OAAO;gBACL,UAAU,EAAE;oBACV,GAAG;wBACD,OAAO,EAAE,CAAC;wBACV,OAAO,KAAK,CAAC;oBACf,CAAC;oBACD,GAAG,CAAC,KAAc;wBAChB,OAAO,GAAG,KAAK,CAAC;wBAChB,KAAK;4BACH,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;gCACzC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;gCAC1B,CAAC,CAAC,KAAK,CAAC;wBACZ,MAAM,EAAE,CAAC;oBACX,CAAC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StatefulComponent } from "@praxisjs/core";
|
|
2
2
|
import { type HistoryElement } from "@praxisjs/core/internal";
|
|
3
3
|
export type HistoryOf<C, K extends keyof C> = HistoryElement<C[K]>;
|
|
4
|
-
export declare function History(fieldName: string, limit?: number): (_value: undefined, context: ClassFieldDecoratorContext<
|
|
4
|
+
export declare function History(fieldName: string, limit?: number): <This extends StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
5
5
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/properties/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,yBAAyB,CAAC;AAKvE,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/properties/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,yBAAyB,CAAC;AAKvE,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,kIAkCpD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type PersistedSignalOptions } from "@praxisjs/core/internal";
|
|
2
|
-
export declare function Persisted<T>(key?: string, options?: PersistedSignalOptions<T>):
|
|
2
|
+
export declare function Persisted<T>(key?: string, options?: PersistedSignalOptions<T>): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
3
3
|
//# sourceMappingURL=persisted.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persisted.d.ts","sourceRoot":"","sources":["../../src/properties/persisted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAwBvF,wBAAgB,SAAS,CAAC,CAAC,EACzB,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,GAAE,sBAAsB,CAAC,CAAC,CAAM,
|
|
1
|
+
{"version":3,"file":"persisted.d.ts","sourceRoot":"","sources":["../../src/properties/persisted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAwBvF,wBAAgB,SAAS,CAAC,CAAC,EACzB,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,GAAE,sBAAsB,CAAC,CAAC,CAAM,2JAgBxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function Prop():
|
|
1
|
+
export declare function Prop(): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
2
2
|
//# sourceMappingURL=prop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../src/properties/prop.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../src/properties/prop.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,4JAsBnB"}
|
|
@@ -10,5 +10,5 @@ export type { ResourceInstance, ResourceOptions };
|
|
|
10
10
|
* // access: this.users.data(), this.users.pending(), this.users.refetch()
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
|
-
export declare function Resource<T>(fetcher: () => Promise<T>, options?: ResourceOptions<T>):
|
|
13
|
+
export declare function Resource<T>(fetcher: () => Promise<T>, options?: ResourceOptions<T>): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
14
14
|
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/properties/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAIjC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,eAAe,CAAC,CAAC,CAAM,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/properties/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAIjC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,eAAe,CAAC,CAAC,CAAM,2JAatF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function initSlots(instance: object, children: unknown): void;
|
|
2
2
|
export declare function getSlot(instance: object, name: string): unknown[];
|
|
3
|
-
export declare function Slot(name?: string):
|
|
3
|
+
export declare function Slot(name?: string): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
4
4
|
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/properties/slot.ts"],"names":[],"mappings":"AA+BA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAEnE;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAEjE;AAED,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/properties/slot.ts"],"names":[],"mappings":"AA+BA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAEnE;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAEjE;AAED,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,2JAkBjC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactiveHost } from "../reactive-host";
|
|
2
|
+
export declare function State(): <This extends ReactiveHost, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
2
3
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/properties/state.ts"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/properties/state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,KAAK,8HAepB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/properties/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/properties/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,MAAM,UAAU,KAAK;IACnB,OAAO,oBAAoB,CAAe;QACxC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY;YAChC,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;YACjC,OAAO;gBACL,UAAU,EAAE;oBACV,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE;oBAChB,GAAG,EAAE,CAAC,KAAc,EAAE,EAAE;wBACtB,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;wBAC5B,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACjB,CAAC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function Synced(channelName?: string):
|
|
1
|
+
export declare function Synced(channelName?: string): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
2
2
|
//# sourceMappingURL=synced.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synced.d.ts","sourceRoot":"","sources":["../../src/properties/synced.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"synced.d.ts","sourceRoot":"","sources":["../../src/properties/synced.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,2JAqB1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactive-host.d.ts","sourceRoot":"","sources":["../src/reactive-host.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactive-host.js","sourceRoot":"","sources":["../src/reactive-host.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -18,12 +18,12 @@ export interface FieldBehavior<T = object> {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function createFieldDecorator<T = StatefulComponent>(behavior: FieldBehavior<T>) {
|
|
21
|
-
return function (
|
|
21
|
+
return function <This extends T, Value = unknown>(
|
|
22
22
|
_value: undefined,
|
|
23
|
-
context: ClassFieldDecoratorContext<
|
|
23
|
+
context: ClassFieldDecoratorContext<This, Value>,
|
|
24
24
|
): void {
|
|
25
25
|
context.addInitializer(function (this: unknown) {
|
|
26
|
-
const instance = this as
|
|
26
|
+
const instance = this as This & StatefulComponent & Record<string, unknown>;
|
|
27
27
|
const name = context.name as string;
|
|
28
28
|
const initialValue = instance[name];
|
|
29
29
|
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { signal } from "@praxisjs/core/internal";
|
|
|
2
2
|
|
|
3
3
|
import { createFieldDecorator } from "../create-field-decorator";
|
|
4
4
|
|
|
5
|
+
import type { ReactiveHost } from "../reactive-host";
|
|
6
|
+
|
|
5
7
|
function deepProxy<T extends object>(target: T, notify: () => void): T {
|
|
6
8
|
return new Proxy(target, {
|
|
7
9
|
get(obj, key, receiver) {
|
|
@@ -25,7 +27,7 @@ function deepProxy<T extends object>(target: T, notify: () => void): T {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export function DeepState() {
|
|
28
|
-
return createFieldDecorator({
|
|
30
|
+
return createFieldDecorator<ReactiveHost>({
|
|
29
31
|
bind(instance, _name, initialValue) {
|
|
30
32
|
const version = signal(0);
|
|
31
33
|
let current = initialValue;
|
package/src/properties/state.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { signal } from "@praxisjs/core/internal";
|
|
|
2
2
|
|
|
3
3
|
import { createFieldDecorator } from "../create-field-decorator";
|
|
4
4
|
|
|
5
|
+
import type { ReactiveHost } from "../reactive-host";
|
|
6
|
+
|
|
5
7
|
export function State() {
|
|
6
|
-
return createFieldDecorator({
|
|
8
|
+
return createFieldDecorator<ReactiveHost>({
|
|
7
9
|
bind(instance, _name, initialValue) {
|
|
8
10
|
const sig = signal(initialValue);
|
|
9
11
|
return {
|