@praxisjs/decorators 0.8.0 → 1.0.0

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +139 -3
  2. package/dist/__tests__/lazy.test.js +74 -10
  3. package/dist/__tests__/lazy.test.js.map +1 -1
  4. package/dist/__tests__/properties.test.js +61 -3
  5. package/dist/__tests__/properties.test.js.map +1 -1
  6. package/dist/component/index.d.ts +0 -1
  7. package/dist/component/index.d.ts.map +1 -1
  8. package/dist/component/index.js +0 -1
  9. package/dist/component/index.js.map +1 -1
  10. package/dist/component/lazy.d.ts +15 -1
  11. package/dist/component/lazy.d.ts.map +1 -1
  12. package/dist/component/lazy.js +15 -9
  13. package/dist/component/lazy.js.map +1 -1
  14. package/dist/create-class-decorator.d.ts.map +1 -1
  15. package/dist/create-class-decorator.js +16 -3
  16. package/dist/create-class-decorator.js.map +1 -1
  17. package/dist/create-field-decorator.d.ts +1 -1
  18. package/dist/create-field-decorator.d.ts.map +1 -1
  19. package/dist/create-field-decorator.js.map +1 -1
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/properties/compose.d.ts +8 -1
  25. package/dist/properties/compose.d.ts.map +1 -1
  26. package/dist/properties/compose.js +18 -3
  27. package/dist/properties/compose.js.map +1 -1
  28. package/dist/properties/deep-state.d.ts +2 -1
  29. package/dist/properties/deep-state.d.ts.map +1 -1
  30. package/dist/properties/deep-state.js.map +1 -1
  31. package/dist/properties/history.d.ts +1 -1
  32. package/dist/properties/history.d.ts.map +1 -1
  33. package/dist/properties/index.d.ts +1 -1
  34. package/dist/properties/index.d.ts.map +1 -1
  35. package/dist/properties/index.js +1 -1
  36. package/dist/properties/index.js.map +1 -1
  37. package/dist/properties/persisted.d.ts +1 -1
  38. package/dist/properties/persisted.d.ts.map +1 -1
  39. package/dist/properties/prop.d.ts +1 -1
  40. package/dist/properties/prop.d.ts.map +1 -1
  41. package/dist/properties/resource.d.ts +1 -1
  42. package/dist/properties/resource.d.ts.map +1 -1
  43. package/dist/properties/slot.d.ts +1 -1
  44. package/dist/properties/slot.d.ts.map +1 -1
  45. package/dist/properties/state.d.ts +2 -1
  46. package/dist/properties/state.d.ts.map +1 -1
  47. package/dist/properties/state.js.map +1 -1
  48. package/dist/properties/synced.d.ts +1 -1
  49. package/dist/properties/synced.d.ts.map +1 -1
  50. package/dist/reactive-host.d.ts +4 -0
  51. package/dist/reactive-host.d.ts.map +1 -0
  52. package/dist/reactive-host.js +2 -0
  53. package/dist/reactive-host.js.map +1 -0
  54. package/package.json +1 -1
  55. package/src/__tests__/lazy.test.ts +88 -10
  56. package/src/__tests__/properties.test.ts +71 -3
  57. package/src/component/index.ts +0 -1
  58. package/src/component/lazy.ts +29 -7
  59. package/src/create-class-decorator.ts +16 -4
  60. package/src/create-field-decorator.ts +3 -3
  61. package/src/index.ts +3 -1
  62. package/src/properties/compose.ts +21 -8
  63. package/src/properties/deep-state.ts +3 -1
  64. package/src/properties/index.ts +1 -1
  65. package/src/properties/state.ts +3 -1
  66. package/src/reactive-host.ts +3 -0
  67. package/dist/__tests__/virtual.test.d.ts +0 -2
  68. package/dist/__tests__/virtual.test.d.ts.map +0 -1
  69. package/dist/__tests__/virtual.test.js +0 -352
  70. package/dist/__tests__/virtual.test.js.map +0 -1
  71. package/dist/component/virtual.d.ts +0 -3
  72. package/dist/component/virtual.d.ts.map +0 -1
  73. package/dist/component/virtual.js +0 -102
  74. package/dist/component/virtual.js.map +0 -1
  75. package/src/__tests__/virtual.test.ts +0 -371
  76. package/src/component/virtual.tsx +0 -163
@@ -1,12 +1,12 @@
1
1
  import { signal } from "@praxisjs/core/internal";
2
2
  import { ClassBehavior, createClassDecorator } from "../create-class-decorator";
3
3
  class LazyBehavior extends ClassBehavior {
4
- constructor(placeholder) {
4
+ constructor(options) {
5
5
  super();
6
- this.placeholder = placeholder;
6
+ this.options = options;
7
7
  }
8
8
  create(instance) {
9
- const placeholder = this.placeholder;
9
+ const { placeholder = 200, root, rootMargin = "100px" } = this.options;
10
10
  const visible = signal(false);
11
11
  let observer;
12
12
  return {
@@ -20,27 +20,33 @@ class LazyBehavior extends ClassBehavior {
20
20
  }
21
21
  if (!visible())
22
22
  el.style.minHeight = `${String(placeholder)}px`;
23
+ const rootEl = root === undefined || root === null ? null : root.current ?? null;
23
24
  observer = new IntersectionObserver((entries) => {
24
25
  if (entries[0]?.isIntersecting) {
25
26
  visible.set(true);
26
27
  el.style.minHeight = "";
27
28
  observer?.disconnect();
28
29
  }
29
- }, { rootMargin: "100px" });
30
+ }, { root: rootEl, rootMargin });
30
31
  observer.observe(el);
31
32
  },
32
33
  onUnmount() {
33
34
  observer?.disconnect();
34
35
  },
35
36
  render(originalRender) {
36
- if (!visible())
37
- return null;
38
- return originalRender();
37
+ return (() => {
38
+ if (!visible())
39
+ return null;
40
+ return originalRender();
41
+ });
39
42
  },
40
43
  };
41
44
  }
42
45
  }
43
- export function Lazy(placeholder = 200) {
44
- return createClassDecorator(new LazyBehavior(placeholder));
46
+ export function Lazy(placeholderOrOptions = 200) {
47
+ const options = typeof placeholderOrOptions === "number"
48
+ ? { placeholder: placeholderOrOptions }
49
+ : placeholderOrOptions;
50
+ return createClassDecorator(new LazyBehavior(options));
45
51
  }
46
52
  //# sourceMappingURL=lazy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../src/component/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAyB,MAAM,2BAA2B,CAAC;AAEvG,MAAM,YAAa,SAAQ,aAAa;IACtC,YAA6B,WAAmB;QAC9C,KAAK,EAAE,CAAC;QADmB,gBAAW,GAAX,WAAW,CAAQ;IAEhD,CAAC;IAED,MAAM,CAAC,QAAuB;QAC5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,GAAG,CAAC,CAAC,EACpE,aAAa,CAAC,EAAE,UAAU,qBAAqB,KAAG,CAAC,CAyCtD"}
@@ -1,5 +1,10 @@
1
1
  export class ClassBehavior {
2
2
  }
3
+ // Tracks instances whose render is currently being called as `originalRender`
4
+ // from within an enhancement. When set, the Enhanced render skips the
5
+ // this._enh.render dispatch so stacked decorators (e.g. @Lazy + @Component)
6
+ // don't re-enter the outermost enhancement recursively.
7
+ const _originalRenderInProgress = new WeakSet();
3
8
  export function createClassDecorator(behavior) {
4
9
  return function (constructor, _context) {
5
10
  const Enhanced = class extends constructor {
@@ -16,11 +21,19 @@ export function createClassDecorator(behavior) {
16
21
  this._enh.onUnmount?.();
17
22
  }
18
23
  render(...args) {
19
- const originalRender = () => constructor.prototype.render.apply(this, args);
20
- if (this._enh.render) {
24
+ const originalRender = () => {
25
+ _originalRenderInProgress.add(this);
26
+ try {
27
+ return constructor.prototype.render.apply(this, args);
28
+ }
29
+ finally {
30
+ _originalRenderInProgress.delete(this);
31
+ }
32
+ };
33
+ if (this._enh.render && !_originalRenderInProgress.has(this)) {
21
34
  return this._enh.render(originalRender);
22
35
  }
23
- return originalRender();
36
+ return constructor.prototype.render.apply(this, args);
24
37
  }
25
38
  };
26
39
  // If the original class has no render, remove the wrapper so instances see `undefined`.
@@ -1 +1 @@
1
- {"version":3,"file":"create-class-decorator.js","sourceRoot":"","sources":["../src/create-class-decorator.ts"],"names":[],"mappings":"AAUA,MAAM,OAAgB,aAAa;CASlC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAuB;IAC1D,OAAO,UAGL,WAAc,EAAE,QAA+B;QAC/C,MAAM,QAAQ,GAAG,KAAM,SAAQ,WAAW;YAAzB;;gBACE,SAAI,GAAqB,QAAQ,CAAC,MAAM,CACvD,IAAgC,CACjC,CAAC;YAoBJ,CAAC;YAlBC,OAAO;gBACL,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAA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,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7C,OAAO,QAAwB,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC"}
@@ -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<T>) => void;
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,IAElF,QAAQ,SAAS,EACjB,SAAS,0BAA0B,CAAC,CAAC,CAAC,KACrC,IAAI,CA0CR"}
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,OAAsC;QAEtC,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAuD,CAAC;YACzE,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,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AAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export { Component, Lazy, Virtual } from "./component";
1
+ export { Component, Lazy } from "./component";
2
2
  export { Memo, Bind, Log, Once, Retry, Debounce, Throttle, When, Until, Watch, type WatchVal, type WatchVals, } from "./functions";
3
- export { Prop, State, Computed, Persisted, Slot, initSlots, History, type HistoryOf, Compose, Resource, type ResourceInstance, type ResourceOptions, Synced, DeepState, } from "./properties";
3
+ export { Prop, State, Computed, Persisted, Slot, initSlots, History, type HistoryOf, Compose, getter, 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";
@@ -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,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,OAAO,EACP,KAAK,SAAS,EACd,OAAO,EACP,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,MAAM,EACN,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO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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 CHANGED
@@ -1,6 +1,6 @@
1
- export { Component, Lazy, Virtual } from "./component";
1
+ export { Component, Lazy } from "./component";
2
2
  export { Memo, Bind, Log, Once, Retry, Debounce, Throttle, When, Until, Watch, } from "./functions";
3
- export { Prop, State, Computed, Persisted, Slot, initSlots, History, Compose, Resource, Synced, DeepState, } from "./properties";
3
+ export { Prop, State, Computed, Persisted, Slot, initSlots, History, Compose, getter, Resource, Synced, DeepState, } from "./properties";
4
4
  export { createCommand, Emit, OnCommand } from "./events";
5
5
  export { createFieldDecorator, } from "./create-field-decorator";
6
6
  export { createClassDecorator, ClassBehavior, } from "./create-class-decorator";
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,E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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<StatefulComponent, unknown>) => void;
2
+ interface ComposeFactory {
3
+ __isComposeFactory: true;
4
+ resolve: (instance: object) => unknown;
5
+ }
6
+ /** Wraps a property as a live getter — passes `() => instance[propName]` to the composable. */
7
+ export declare function getter(propName: string): ComposeFactory;
8
+ export declare function Compose(ComposableClass: new (...args: any[]) => Composable, ...ctorArgs: unknown[]): <This extends StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
9
+ export {};
3
10
  //# 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,gGAoBvB"}
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;AAIpE,UAAU,cAAc;IAAG,kBAAkB,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE;AAE7F,+FAA+F;AAC/F,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAKvD;AA6BD,wBAAgB,OAAO,CAErB,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EACnD,GAAG,QAAQ,EAAE,OAAO,EAAE,kIAqBvB"}
@@ -1,4 +1,14 @@
1
1
  import { createFieldDecorator } from "../create-field-decorator";
2
+ /** Wraps a property as a live getter — passes `() => instance[propName]` to the composable. */
3
+ export function getter(propName) {
4
+ return {
5
+ __isComposeFactory: true,
6
+ resolve: (instance) => () => instance[propName],
7
+ };
8
+ }
9
+ function isFactory(value) {
10
+ return typeof value === "object" && value !== null && "__isComposeFactory" in value;
11
+ }
2
12
  function isReactive(value) {
3
13
  return (typeof value === "function" &&
4
14
  ("__isSignal" in value || "__isComputed" in value));
@@ -24,9 +34,14 @@ export function Compose(
24
34
  ComposableClass, ...ctorArgs) {
25
35
  return createFieldDecorator({
26
36
  bind(instance, _name, _initialValue) {
27
- const resolvedArgs = ctorArgs.map((arg) => typeof arg === "string"
28
- ? instance[arg]
29
- : arg);
37
+ const resolvedArgs = ctorArgs.map((arg) => {
38
+ if (isFactory(arg))
39
+ return arg.resolve(instance);
40
+ if (typeof arg !== "string")
41
+ return arg;
42
+ const prop = instance[arg];
43
+ return prop !== undefined ? prop : arg;
44
+ });
30
45
  const composable = new ComposableClass(...resolvedArgs);
31
46
  const view = buildView(composable.setup());
32
47
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/properties/compose.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,SAAS,UAAU,CACjB,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,UAAU;QAC3B,CAAC,YAAY,IAAK,KAAgB,IAAI,cAAc,IAAK,KAAgB,CAAC,CAC3E,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,QAAiC;IAClD,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,c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,CAAC,QAAQ,CAAC,CAAC;gBACjD,IAAI,OAAO,GAAG,KAAK,QAAQ;oBAAE,OAAO,GAAG,CAAC;gBACxC,MAAM,IAAI,GAAI,QAA+C,CAAC,GAAG,CAAC,CAAC;gBACnE,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;YACzC,CAAC,CAAC,CAAC;YAEH,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,GAAG,YAAY,CAAC,CAAC;YACxD,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;YAE3C,OAAO;gBACL,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;gBAC/B,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;gBAC7C,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC;aAClD,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +1,3 @@
1
- export declare function DeepState(): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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":"AA0BA,wBAAgB,SAAS,0HAiCxB"}
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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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<StatefulComponent, unknown>) => void;
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,gGAkCpD"}
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"}
@@ -4,7 +4,7 @@ export { Computed } from "./computed";
4
4
  export { Persisted } from "./persisted";
5
5
  export { Slot, initSlots } from "./slot";
6
6
  export { History, type HistoryOf } from "./history";
7
- export { Compose } from "./compose";
7
+ export { Compose, getter } from "./compose";
8
8
  export { Resource, type ResourceInstance, type ResourceOptions } from "./resource";
9
9
  export { Synced } from "./synced";
10
10
  export { DeepState } from "./deep-state";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -4,7 +4,7 @@ export { Computed } from "./computed";
4
4
  export { Persisted } from "./persisted";
5
5
  export { Slot, initSlots } from "./slot";
6
6
  export { History } from "./history";
7
- export { Compose } from "./compose";
7
+ export { Compose, getter } from "./compose";
8
8
  export { Resource } from "./resource";
9
9
  export { Synced } from "./synced";
10
10
  export { DeepState } from "./deep-state";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAA+C,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/properties/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAA+C,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { type PersistedSignalOptions } from "@praxisjs/core/internal";
2
- export declare function Persisted<T>(key?: string, options?: PersistedSignalOptions<T>): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,yHAgBxC"}
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(): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,0HAsBnB"}
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>): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,yHAatF"}
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): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,yHAkBjC"}
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
- export declare function State(): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,0HAepB"}
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;AAEjE,MAAM,UAAU,KAAK;IACnB,OAAO,oBAAoB,CAAC;QAC1B,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
+ {"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): (_value: undefined, context: ClassFieldDecoratorContext<import("@praxisjs/core").StatefulComponent, unknown>) => void;
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,yHAqB1C"}
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,4 @@
1
+ export interface ReactiveHost {
2
+ _stateDirty: boolean;
3
+ }
4
+ //# sourceMappingURL=reactive-host.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reactive-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive-host.js","sourceRoot":"","sources":["../src/reactive-host.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisjs/decorators",
3
- "version": "0.8.0",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -3,13 +3,20 @@ import { beforeEach, afterEach, describe, it, expect, vi } from "vitest";
3
3
 
4
4
  import { StatefulComponent } from "@praxisjs/core";
5
5
  import { Lazy } from "../component/lazy";
6
+ import type { LazyOptions } from "../component/lazy";
6
7
 
7
8
  type AnyConstructor = new (...args: unknown[]) => StatefulComponent;
8
9
 
9
- function applyLazy<T extends AnyConstructor>(cls: T, placeholder?: number): T {
10
- return placeholder !== undefined
11
- ? Lazy(placeholder)(cls, {} as ClassDecoratorContext)
12
- : Lazy()(cls, {} as ClassDecoratorContext);
10
+ function applyLazy<T extends AnyConstructor>(cls: T, placeholderOrOptions?: number | LazyOptions): T {
11
+ if (placeholderOrOptions === undefined) return Lazy()(cls, {} as ClassDecoratorContext);
12
+ return Lazy(placeholderOrOptions)(cls, {} as ClassDecoratorContext);
13
+ }
14
+
15
+ /** render() now returns a reactive thunk — resolve it to get the actual DOM output. */
16
+ function resolveRender(instance: StatefulComponent): Node | Node[] | null {
17
+ const result = instance.render();
18
+ if (typeof result === "function") return (result as () => Node | Node[] | null)();
19
+ return result;
13
20
  }
14
21
 
15
22
  class BaseComp extends StatefulComponent {
@@ -45,7 +52,7 @@ describe("Lazy decorator", () => {
45
52
  it("returns null from render before visibility", () => {
46
53
  const Wrapped = applyLazy(BaseComp as AnyConstructor);
47
54
  const instance = new Wrapped();
48
- expect(instance.render()).toBeNull();
55
+ expect(resolveRender(instance)).toBeNull();
49
56
  });
50
57
 
51
58
  it("sets _lazyVisible to true when IntersectionObserver is not supported", () => {
@@ -95,7 +102,7 @@ describe("Lazy decorator", () => {
95
102
  (instance as unknown as { _anchor: Comment })._anchor = anchor;
96
103
 
97
104
  instance.onMount?.();
98
- expect(instance.render()).toBeNull();
105
+ expect(resolveRender(instance)).toBeNull();
99
106
 
100
107
  intersectionCallback(
101
108
  [{ isIntersecting: true } as IntersectionObserverEntry],
@@ -103,7 +110,7 @@ describe("Lazy decorator", () => {
103
110
  );
104
111
 
105
112
  expect(parent.style.minHeight).toBe("");
106
- expect(instance.render()).not.toBeNull(); // component became visible after intersection
113
+ expect(resolveRender(instance)).not.toBeNull(); // component became visible after intersection
107
114
  expect(mockDisconnect).toHaveBeenCalled();
108
115
  document.body.removeChild(parent);
109
116
  });
@@ -153,7 +160,7 @@ describe("Lazy decorator", () => {
153
160
  (instance as unknown as { _anchor: Comment })._anchor = anchor;
154
161
 
155
162
  instance.onMount?.();
156
- expect(instance.render()).toBeNull(); // not yet visible
163
+ expect(resolveRender(instance)).toBeNull(); // not yet visible
157
164
 
158
165
  intersectionCallback(
159
166
  [{ isIntersecting: true } as IntersectionObserverEntry],
@@ -161,7 +168,7 @@ describe("Lazy decorator", () => {
161
168
  );
162
169
 
163
170
  // Now visible: render() must delegate to the original render()
164
- const result = instance.render();
171
+ const result = resolveRender(instance);
165
172
  expect(result).not.toBeNull();
166
173
  document.body.removeChild(parent);
167
174
  });
@@ -184,12 +191,83 @@ describe("Lazy decorator", () => {
184
191
  null as unknown as IntersectionObserver,
185
192
  );
186
193
 
187
- expect(instance.render()).toBeNull();
194
+ expect(resolveRender(instance)).toBeNull();
188
195
  expect(mockDisconnect).not.toHaveBeenCalled();
189
196
  expect(parent.style.minHeight).toBe("200px");
190
197
  document.body.removeChild(parent);
191
198
  });
192
199
 
200
+ it("accepts a LazyOptions object instead of a number (line 74 false branch)", () => {
201
+ const Wrapped = applyLazy(BaseComp as AnyConstructor, { placeholder: 150, rootMargin: "50px" });
202
+ const instance = new Wrapped();
203
+
204
+ const parent = document.createElement("div");
205
+ document.body.appendChild(parent);
206
+ const anchor = document.createComment("end");
207
+ parent.appendChild(anchor);
208
+ (instance as unknown as { _anchor: Comment })._anchor = anchor;
209
+
210
+ instance.onMount?.();
211
+ expect(parent.style.minHeight).toBe("150px");
212
+ document.body.removeChild(parent);
213
+ });
214
+
215
+ it("uses root.current as the IntersectionObserver root when provided (line 42 false branch)", () => {
216
+ const rootEl = document.createElement("div");
217
+ document.body.appendChild(rootEl);
218
+
219
+ let capturedInit: IntersectionObserverInit | undefined;
220
+ globalThis.IntersectionObserver = class {
221
+ constructor(cb: IntersectionObserverCallback, init?: IntersectionObserverInit) {
222
+ intersectionCallback = cb;
223
+ capturedInit = init;
224
+ }
225
+ observe = mockObserve;
226
+ disconnect = mockDisconnect;
227
+ } as unknown as typeof IntersectionObserver;
228
+
229
+ const Wrapped = applyLazy(BaseComp as AnyConstructor, { root: { current: rootEl } });
230
+ const instance = new Wrapped();
231
+
232
+ const parent = document.createElement("div");
233
+ document.body.appendChild(parent);
234
+ const anchor = document.createComment("end");
235
+ parent.appendChild(anchor);
236
+ (instance as unknown as { _anchor: Comment })._anchor = anchor;
237
+
238
+ instance.onMount?.();
239
+ expect(capturedInit?.root).toBe(rootEl);
240
+
241
+ document.body.removeChild(parent);
242
+ document.body.removeChild(rootEl);
243
+ });
244
+
245
+ it("falls back to null root when root.current is null (line 42 ?? null branch)", () => {
246
+ let capturedInit: IntersectionObserverInit | undefined;
247
+ globalThis.IntersectionObserver = class {
248
+ constructor(cb: IntersectionObserverCallback, init?: IntersectionObserverInit) {
249
+ intersectionCallback = cb;
250
+ capturedInit = init;
251
+ }
252
+ observe = mockObserve;
253
+ disconnect = mockDisconnect;
254
+ } as unknown as typeof IntersectionObserver;
255
+
256
+ const Wrapped = applyLazy(BaseComp as AnyConstructor, { root: { current: null } });
257
+ const instance = new Wrapped();
258
+
259
+ const parent = document.createElement("div");
260
+ document.body.appendChild(parent);
261
+ const anchor = document.createComment("end");
262
+ parent.appendChild(anchor);
263
+ (instance as unknown as { _anchor: Comment })._anchor = anchor;
264
+
265
+ instance.onMount?.();
266
+ expect(capturedInit?.root).toBeNull();
267
+
268
+ document.body.removeChild(parent);
269
+ });
270
+
193
271
  it("does not re-apply minHeight on remount when already visible", () => {
194
272
  const Wrapped = applyLazy(BaseComp as AnyConstructor, 300);
195
273
  const instance = new Wrapped();