@praxisjs/decorators 1.6.1 → 2.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 (270) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/component/component.d.ts +1 -1
  3. package/dist/component/component.d.ts.map +1 -1
  4. package/dist/component/component.js +8 -15
  5. package/dist/component/component.js.map +1 -1
  6. package/dist/component/lazy.d.ts +1 -1
  7. package/dist/component/lazy.d.ts.map +1 -1
  8. package/dist/component/lazy.js +44 -36
  9. package/dist/component/lazy.js.map +1 -1
  10. package/dist/create-class-decorator.d.ts +27 -5
  11. package/dist/create-class-decorator.d.ts.map +1 -1
  12. package/dist/create-class-decorator.js +53 -18
  13. package/dist/create-class-decorator.js.map +1 -1
  14. package/dist/create-field-decorator.d.ts +42 -3
  15. package/dist/create-field-decorator.d.ts.map +1 -1
  16. package/dist/create-field-decorator.js +63 -27
  17. package/dist/create-field-decorator.js.map +1 -1
  18. package/dist/create-getter-decorator.d.ts +81 -16
  19. package/dist/create-getter-decorator.d.ts.map +1 -1
  20. package/dist/create-getter-decorator.js +127 -15
  21. package/dist/create-getter-decorator.js.map +1 -1
  22. package/dist/create-lifecycle-method-decorator.d.ts +21 -3
  23. package/dist/create-lifecycle-method-decorator.d.ts.map +1 -1
  24. package/dist/create-lifecycle-method-decorator.js +25 -18
  25. package/dist/create-lifecycle-method-decorator.js.map +1 -1
  26. package/dist/create-method-decorator.d.ts +43 -3
  27. package/dist/create-method-decorator.d.ts.map +1 -1
  28. package/dist/create-method-decorator.js +49 -8
  29. package/dist/create-method-decorator.js.map +1 -1
  30. package/dist/events/command.d.ts +2 -1
  31. package/dist/events/command.d.ts.map +1 -1
  32. package/dist/events/command.js +10 -8
  33. package/dist/events/command.js.map +1 -1
  34. package/dist/events/emit.d.ts +2 -2
  35. package/dist/events/emit.d.ts.map +1 -1
  36. package/dist/events/emit.js +18 -24
  37. package/dist/events/emit.js.map +1 -1
  38. package/dist/events/on-command.d.ts +2 -1
  39. package/dist/events/on-command.d.ts.map +1 -1
  40. package/dist/events/on-command.js +12 -14
  41. package/dist/events/on-command.js.map +1 -1
  42. package/dist/field.d.ts +51 -0
  43. package/dist/field.d.ts.map +1 -0
  44. package/dist/field.js +82 -0
  45. package/dist/field.js.map +1 -0
  46. package/dist/functions/bind.d.ts +2 -1
  47. package/dist/functions/bind.d.ts.map +1 -1
  48. package/dist/functions/bind.js +4 -4
  49. package/dist/functions/bind.js.map +1 -1
  50. package/dist/functions/debounce.d.ts +2 -2
  51. package/dist/functions/debounce.d.ts.map +1 -1
  52. package/dist/functions/debounce.js +25 -23
  53. package/dist/functions/debounce.js.map +1 -1
  54. package/dist/functions/index.d.ts +1 -1
  55. package/dist/functions/index.d.ts.map +1 -1
  56. package/dist/functions/index.js.map +1 -1
  57. package/dist/functions/log.d.ts +2 -1
  58. package/dist/functions/log.d.ts.map +1 -1
  59. package/dist/functions/log.js +38 -40
  60. package/dist/functions/log.js.map +1 -1
  61. package/dist/functions/memo.d.ts +9 -1
  62. package/dist/functions/memo.d.ts.map +1 -1
  63. package/dist/functions/memo.js +44 -30
  64. package/dist/functions/memo.js.map +1 -1
  65. package/dist/functions/once.d.ts +2 -1
  66. package/dist/functions/once.d.ts.map +1 -1
  67. package/dist/functions/once.js +10 -14
  68. package/dist/functions/once.js.map +1 -1
  69. package/dist/functions/retry.d.ts +2 -1
  70. package/dist/functions/retry.d.ts.map +1 -1
  71. package/dist/functions/retry.js +21 -23
  72. package/dist/functions/retry.js.map +1 -1
  73. package/dist/functions/throttle.d.ts +2 -1
  74. package/dist/functions/throttle.d.ts.map +1 -1
  75. package/dist/functions/throttle.js +12 -14
  76. package/dist/functions/throttle.js.map +1 -1
  77. package/dist/functions/until.d.ts +2 -1
  78. package/dist/functions/until.d.ts.map +1 -1
  79. package/dist/functions/until.js +13 -14
  80. package/dist/functions/until.js.map +1 -1
  81. package/dist/functions/watch.d.ts +1 -1
  82. package/dist/functions/watch.d.ts.map +1 -1
  83. package/dist/functions/watch.js +36 -34
  84. package/dist/functions/watch.js.map +1 -1
  85. package/dist/functions/when.d.ts +1 -1
  86. package/dist/functions/when.d.ts.map +1 -1
  87. package/dist/functions/when.js +19 -21
  88. package/dist/functions/when.js.map +1 -1
  89. package/dist/index.d.ts +6 -6
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +2 -2
  92. package/dist/index.js.map +1 -1
  93. package/dist/lifecycle.d.ts +24 -0
  94. package/dist/lifecycle.d.ts.map +1 -0
  95. package/dist/lifecycle.js +55 -0
  96. package/dist/lifecycle.js.map +1 -0
  97. package/dist/properties/compose.d.ts +3 -2
  98. package/dist/properties/compose.d.ts.map +1 -1
  99. package/dist/properties/compose.js +33 -19
  100. package/dist/properties/compose.js.map +1 -1
  101. package/dist/properties/computed.d.ts +12 -10
  102. package/dist/properties/computed.d.ts.map +1 -1
  103. package/dist/properties/computed.js +26 -21
  104. package/dist/properties/computed.js.map +1 -1
  105. package/dist/properties/deep-state.d.ts +2 -1
  106. package/dist/properties/deep-state.d.ts.map +1 -1
  107. package/dist/properties/deep-state.js +66 -49
  108. package/dist/properties/deep-state.js.map +1 -1
  109. package/dist/properties/function-prop.d.ts +2 -1
  110. package/dist/properties/function-prop.d.ts.map +1 -1
  111. package/dist/properties/function-prop.js +20 -22
  112. package/dist/properties/function-prop.js.map +1 -1
  113. package/dist/properties/history.d.ts +2 -2
  114. package/dist/properties/history.d.ts.map +1 -1
  115. package/dist/properties/history.js +34 -31
  116. package/dist/properties/history.js.map +1 -1
  117. package/dist/properties/index.d.ts +1 -0
  118. package/dist/properties/index.d.ts.map +1 -1
  119. package/dist/properties/index.js +1 -0
  120. package/dist/properties/index.js.map +1 -1
  121. package/dist/properties/persisted.d.ts +2 -1
  122. package/dist/properties/persisted.d.ts.map +1 -1
  123. package/dist/properties/persisted.js +30 -19
  124. package/dist/properties/persisted.js.map +1 -1
  125. package/dist/properties/prop.d.ts +2 -1
  126. package/dist/properties/prop.d.ts.map +1 -1
  127. package/dist/properties/prop.js +26 -22
  128. package/dist/properties/prop.js.map +1 -1
  129. package/dist/properties/ref.d.ts +2 -1
  130. package/dist/properties/ref.d.ts.map +1 -1
  131. package/dist/properties/ref.js +11 -8
  132. package/dist/properties/ref.js.map +1 -1
  133. package/dist/properties/resource.d.ts.map +1 -1
  134. package/dist/properties/resource.js +21 -16
  135. package/dist/properties/resource.js.map +1 -1
  136. package/dist/properties/selector.d.ts +12 -0
  137. package/dist/properties/selector.d.ts.map +1 -0
  138. package/dist/properties/selector.js +25 -0
  139. package/dist/properties/selector.js.map +1 -0
  140. package/dist/properties/slot.d.ts +2 -1
  141. package/dist/properties/slot.d.ts.map +1 -1
  142. package/dist/properties/slot.js +22 -20
  143. package/dist/properties/slot.js.map +1 -1
  144. package/dist/properties/state.d.ts.map +1 -1
  145. package/dist/properties/state.js +27 -16
  146. package/dist/properties/state.js.map +1 -1
  147. package/dist/properties/synced.d.ts +2 -1
  148. package/dist/properties/synced.d.ts.map +1 -1
  149. package/dist/properties/synced.js +27 -19
  150. package/dist/properties/synced.js.map +1 -1
  151. package/dist/shared-method.d.ts +14 -0
  152. package/dist/shared-method.d.ts.map +1 -0
  153. package/dist/shared-method.js +87 -0
  154. package/dist/shared-method.js.map +1 -0
  155. package/package.json +14 -5
  156. package/src/component/component.ts +8 -27
  157. package/src/component/lazy.ts +51 -41
  158. package/src/create-class-decorator.ts +90 -31
  159. package/src/create-field-decorator.ts +120 -43
  160. package/src/create-getter-decorator.ts +263 -66
  161. package/src/create-lifecycle-method-decorator.ts +50 -28
  162. package/src/create-method-decorator.ts +119 -13
  163. package/src/events/command.ts +11 -9
  164. package/src/events/emit.ts +16 -22
  165. package/src/events/on-command.ts +17 -18
  166. package/src/field.ts +116 -0
  167. package/src/functions/bind.ts +4 -4
  168. package/src/functions/debounce.ts +25 -23
  169. package/src/functions/index.ts +1 -1
  170. package/src/functions/log.ts +44 -46
  171. package/src/functions/memo.ts +54 -28
  172. package/src/functions/once.ts +10 -13
  173. package/src/functions/retry.ts +19 -21
  174. package/src/functions/throttle.ts +12 -13
  175. package/src/functions/until.ts +14 -14
  176. package/src/functions/watch.ts +37 -36
  177. package/src/functions/when.ts +18 -20
  178. package/src/index.ts +13 -5
  179. package/src/lifecycle.ts +74 -0
  180. package/src/properties/compose.ts +33 -20
  181. package/src/properties/computed.ts +35 -45
  182. package/src/properties/deep-state.ts +68 -53
  183. package/src/properties/function-prop.ts +25 -27
  184. package/src/properties/history.ts +34 -33
  185. package/src/properties/index.ts +1 -0
  186. package/src/properties/persisted.ts +41 -27
  187. package/src/properties/prop.ts +30 -22
  188. package/src/properties/ref.ts +12 -10
  189. package/src/properties/resource.ts +22 -17
  190. package/src/properties/selector.ts +45 -0
  191. package/src/properties/slot.ts +28 -22
  192. package/src/properties/state.ts +32 -16
  193. package/src/properties/synced.ts +31 -19
  194. package/src/shared-method.ts +101 -0
  195. package/dist/__tests__/component.test.d.ts +0 -2
  196. package/dist/__tests__/component.test.d.ts.map +0 -1
  197. package/dist/__tests__/component.test.js +0 -147
  198. package/dist/__tests__/component.test.js.map +0 -1
  199. package/dist/__tests__/compose.test.d.ts +0 -2
  200. package/dist/__tests__/compose.test.d.ts.map +0 -1
  201. package/dist/__tests__/compose.test.js +0 -164
  202. package/dist/__tests__/compose.test.js.map +0 -1
  203. package/dist/__tests__/deep-state.test.d.ts +0 -2
  204. package/dist/__tests__/deep-state.test.d.ts.map +0 -1
  205. package/dist/__tests__/deep-state.test.js +0 -150
  206. package/dist/__tests__/deep-state.test.js.map +0 -1
  207. package/dist/__tests__/events.test.d.ts +0 -2
  208. package/dist/__tests__/events.test.d.ts.map +0 -1
  209. package/dist/__tests__/events.test.js +0 -295
  210. package/dist/__tests__/events.test.js.map +0 -1
  211. package/dist/__tests__/functions.test.d.ts +0 -2
  212. package/dist/__tests__/functions.test.d.ts.map +0 -1
  213. package/dist/__tests__/functions.test.js +0 -618
  214. package/dist/__tests__/functions.test.js.map +0 -1
  215. package/dist/__tests__/lazy.test.d.ts +0 -2
  216. package/dist/__tests__/lazy.test.d.ts.map +0 -1
  217. package/dist/__tests__/lazy.test.js +0 -227
  218. package/dist/__tests__/lazy.test.js.map +0 -1
  219. package/dist/__tests__/memo.test.d.ts +0 -2
  220. package/dist/__tests__/memo.test.d.ts.map +0 -1
  221. package/dist/__tests__/memo.test.js +0 -168
  222. package/dist/__tests__/memo.test.js.map +0 -1
  223. package/dist/__tests__/properties-browser.test.d.ts +0 -2
  224. package/dist/__tests__/properties-browser.test.d.ts.map +0 -1
  225. package/dist/__tests__/properties-browser.test.js +0 -178
  226. package/dist/__tests__/properties-browser.test.js.map +0 -1
  227. package/dist/__tests__/properties.test.d.ts +0 -2
  228. package/dist/__tests__/properties.test.d.ts.map +0 -1
  229. package/dist/__tests__/properties.test.js +0 -1226
  230. package/dist/__tests__/properties.test.js.map +0 -1
  231. package/dist/__tests__/ref.test.d.ts +0 -2
  232. package/dist/__tests__/ref.test.d.ts.map +0 -1
  233. package/dist/__tests__/ref.test.js +0 -106
  234. package/dist/__tests__/ref.test.js.map +0 -1
  235. package/dist/__tests__/resource.test.d.ts +0 -2
  236. package/dist/__tests__/resource.test.d.ts.map +0 -1
  237. package/dist/__tests__/resource.test.js +0 -217
  238. package/dist/__tests__/resource.test.js.map +0 -1
  239. package/dist/__tests__/slot.test.d.ts +0 -2
  240. package/dist/__tests__/slot.test.d.ts.map +0 -1
  241. package/dist/__tests__/slot.test.js +0 -147
  242. package/dist/__tests__/slot.test.js.map +0 -1
  243. package/dist/__tests__/synced.test.d.ts +0 -2
  244. package/dist/__tests__/synced.test.d.ts.map +0 -1
  245. package/dist/__tests__/synced.test.js +0 -161
  246. package/dist/__tests__/synced.test.js.map +0 -1
  247. package/dist/__tests__/until.test.d.ts +0 -2
  248. package/dist/__tests__/until.test.d.ts.map +0 -1
  249. package/dist/__tests__/until.test.js +0 -88
  250. package/dist/__tests__/until.test.js.map +0 -1
  251. package/dist/create-accessor-decorator.d.ts +0 -14
  252. package/dist/create-accessor-decorator.d.ts.map +0 -1
  253. package/dist/create-accessor-decorator.js +0 -27
  254. package/dist/create-accessor-decorator.js.map +0 -1
  255. package/src/__tests__/component.test.ts +0 -167
  256. package/src/__tests__/compose.test.ts +0 -202
  257. package/src/__tests__/deep-state.test.ts +0 -185
  258. package/src/__tests__/events.test.ts +0 -366
  259. package/src/__tests__/functions.test.ts +0 -803
  260. package/src/__tests__/lazy.test.ts +0 -296
  261. package/src/__tests__/memo.test.ts +0 -208
  262. package/src/__tests__/properties-browser.test.ts +0 -234
  263. package/src/__tests__/properties.test.ts +0 -1526
  264. package/src/__tests__/ref.test.ts +0 -131
  265. package/src/__tests__/resource.test.ts +0 -246
  266. package/src/__tests__/slot.test.ts +0 -179
  267. package/src/__tests__/synced.test.ts +0 -193
  268. package/src/__tests__/until.test.ts +0 -113
  269. package/src/create-accessor-decorator.ts +0 -45
  270. package/tsconfig.json +0 -9
@@ -1,10 +1,11 @@
1
- import type { StatefulComponent, Composable } from "@praxisjs/core";
1
+ import type { Composable } from "@praxisjs/core";
2
+ import { type FieldDecorator } from "../field";
2
3
  interface ComposeFactory {
3
4
  __isComposeFactory: true;
4
5
  resolve: (instance: object) => unknown;
5
6
  }
6
7
  /** Wraps a property as a live getter — passes `() => instance[propName]` to the composable. */
7
8
  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 declare function Compose(ComposableClass: new (...args: any[]) => Composable, ...ctorArgs: unknown[]): FieldDecorator;
9
10
  export {};
10
11
  //# 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;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
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/properties/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,UAAU,CAAC;AAG5E,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,GACrB,cAAc,CAgChB"}
@@ -1,4 +1,5 @@
1
- import { createFieldDecorator } from "../create-field-decorator";
1
+ import { sharedField } from "../field";
2
+ import { addLifecycleHooks } from "../lifecycle";
2
3
  /** Wraps a property as a live getter — passes `() => instance[propName]` to the composable. */
3
4
  export function getter(propName) {
4
5
  return {
@@ -32,24 +33,37 @@ function buildView(bindings) {
32
33
  export function Compose(
33
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
35
  ComposableClass, ...ctorArgs) {
35
- return createFieldDecorator({
36
- bind(instance, _name, _initialValue) {
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
- });
45
- const composable = new ComposableClass(...resolvedArgs);
46
- const view = buildView(composable.setup());
47
- return {
48
- descriptor: { get: () => view },
49
- onMount: composable.onMount?.bind(composable),
50
- onUnmount: composable.onUnmount?.bind(composable),
51
- };
52
- },
36
+ return sharedField((name) => {
37
+ const composableSlot = Symbol(`praxis.composable.${name}`);
38
+ const viewSlot = Symbol(`praxis.compose.${name}`);
39
+ const composableOf = (instance) => instance[composableSlot];
40
+ const mount = (instance) => { composableOf(instance).onMount?.(); };
41
+ const unmount = (instance) => { composableOf(instance).onUnmount?.(); };
42
+ return {
43
+ descriptor: {
44
+ get() {
45
+ return this[viewSlot];
46
+ },
47
+ },
48
+ init(instance) {
49
+ const resolvedArgs = ctorArgs.map((arg) => {
50
+ if (isFactory(arg))
51
+ return arg.resolve(instance);
52
+ if (typeof arg !== "string")
53
+ return arg;
54
+ const prop = instance[arg];
55
+ return prop !== undefined ? prop : arg;
56
+ });
57
+ const composable = new ComposableClass(...resolvedArgs);
58
+ instance[composableSlot] = composable;
59
+ instance[viewSlot] = buildView(composable.setup());
60
+ const hasMount = typeof composable.onMount === "function";
61
+ const hasUnmount = typeof composable.onUnmount === "function";
62
+ if (hasMount || hasUnmount) {
63
+ addLifecycleHooks(instance, hasMount ? mount : undefined, hasUnmount ? unmount : undefined);
64
+ }
65
+ },
66
+ };
53
67
  });
54
68
  }
55
69
  //# sourceMappingURL=compose.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/properties/compose.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,+FAA+F;AAC/F,MAAM,UAAU,MAAM,CAAC,QAAgB;IACrC,OAAO;QACL,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,CAAC,QAAQ,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AAG;oBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,CAAC;aACF;YACD,IAAI,CAAC,QAAQ;gBACX,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACxC,IAAI,SAAS,CAAC,GAAG,CAAC;wBAAE,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;oBACjD,IAAI,OAAO,GAAG,KAAK,QAAQ;wBAAE,OAAO,GAAG,CAAC;oBACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;oBAC3B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzC,CAAC,CAAC,CAAC;gBAEH,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,GAAG,YAAY,CAAC,CAAC;gBACxD,QAAQ,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC;gBACtC,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;gBACnD,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC;gBAC1D,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,SAAS,KAAK,UAAU,CAAC;gBAC9D,IAAI,QAAQ,IAAI,UAAU,EAAE,CAAC;oBAC3B,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;gBAC9F,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,12 +1,14 @@
1
- export interface ComputedOptions<T = unknown> {
2
- get?: (this: object) => T;
3
- set?: (this: object, value: T) => void;
1
+ import { type GetterDecorator } from "../create-getter-decorator";
2
+ export interface ComputedOptions {
3
+ /**
4
+ * Handles writes to the property. A `set` accessor declared next to the getter in the class
5
+ * does the same, and TypeScript sees it.
6
+ */
7
+ set?(this: object, value: unknown): void;
4
8
  }
5
- export declare function Computed<T, Owner extends object = object>(options: {
6
- get: (this: Owner) => T;
7
- set: (this: Owner, value: T) => void;
8
- }): <This extends object>(target: ClassAccessorDecoratorTarget<This, T>, context: ClassAccessorDecoratorContext<This, T>) => ClassAccessorDecoratorResult<This, T>;
9
- export declare function Computed(options?: {
10
- set?: (this: object, value: unknown) => void;
11
- }): <This, R>(target: (this: This) => R, context: ClassGetterDecoratorContext<This, R>) => (this: This) => R;
9
+ /**
10
+ * Caches a getter as a reactive computed. A `set` accessor declared next to the getter makes the
11
+ * property writable.
12
+ */
13
+ export declare function Computed(options?: ComputedOptions): GetterDecorator;
12
14
  //# sourceMappingURL=computed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/properties/computed.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;IAC1B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CACxC;AAKD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE;IAClE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;IACxB,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CACtC,GAAG,CAAC,IAAI,SAAS,MAAM,EACtB,MAAM,EAAE,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,EAC7C,OAAO,EAAE,6BAA6B,CAAC,IAAI,EAAE,CAAC,CAAC,KAC5C,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAG3C,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE;IACjC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,GAAG,CAAC,IAAI,EAAE,CAAC,EACV,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,EACzB,OAAO,EAAE,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC,KAC1C,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/properties/computed.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEzF,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1C;AASD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,eAAe,CAqBnE"}
@@ -1,26 +1,31 @@
1
- import { computed } from "@praxisjs/core/internal";
2
- import { createAccessorDecorator } from "../create-accessor-decorator";
3
- import { createWritableGetterDecorator } from "../create-getter-decorator";
1
+ import { ComputedNode, readComputed } from "@praxisjs/core/internal";
2
+ import { createGetterDecorator } from "../create-getter-decorator";
3
+ // Kept out of the getter: a closure created inside it would make every read allocate a context.
4
+ function computedFor(instance, getter) {
5
+ return new ComputedNode(() => getter.call(instance));
6
+ }
7
+ /**
8
+ * Caches a getter as a reactive computed. A `set` accessor declared next to the getter makes the
9
+ * property writable.
10
+ */
4
11
  export function Computed(options) {
5
- const optionsGet = options?.get;
6
- const optionsSet = options?.set;
7
- if (optionsGet) {
8
- return createAccessorDecorator({
9
- bind(instance, _name, _initialValue) {
10
- const c = computed(() => optionsGet.call(instance));
11
- return {
12
- get: c,
13
- set: optionsSet ? (value) => { optionsSet.call(instance, value); } : undefined,
14
- };
15
- },
16
- });
17
- }
18
- return createWritableGetterDecorator({
19
- bind(instance, _name, original) {
20
- const c = computed(() => original.call(instance));
12
+ // eslint-disable-next-line @typescript-eslint/unbound-method -- installed on the class, which calls it with the instance as `this`
13
+ const set = options?.set;
14
+ return createGetterDecorator({
15
+ label: "@Computed()",
16
+ setup(original, context) {
17
+ const node = Symbol(`praxis.computed.${String(context.name)}`);
21
18
  return {
22
- get: c,
23
- set: optionsSet ? (value) => { optionsSet.call(instance, value); } : undefined,
19
+ // Shared by every instance; the computed itself is only created the first time it is read,
20
+ // so a getter that a component never reads costs nothing beyond its slot.
21
+ get() {
22
+ return readComputed((this[node] ??= computedFor(this, original)));
23
+ },
24
+ set,
25
+ init(instance) {
26
+ // The slot is created up front so every instance keeps the same shape.
27
+ instance[node] = undefined;
28
+ },
24
29
  };
25
30
  },
26
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"computed.js","sourceRoot":"","sources":["../../src/properties/computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AA0B3E,MAAM,UAAU,QAAQ,CAAc,OAA4B;IAChE,MAAM,UAAU,GAAG,OAAO,EAAE,GAA8C,CAAC;IAC3E,MAAM,UAAU,GAAG,OAAO,EAAE,GAA2D,CAAC;IAExF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,uBAAuB,CAAC;YAC7B,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,aAAa;gBACjC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACpD,OAAO;oBACL,GAAG,EAAE,CAA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GAAG,MAAM,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC/D,OAAO;gBACL,2FAA2F;gBAC3F,0EAA0E;gBAC1E,GAAG;oBACD,OAAO,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACpE,CAAC;gBACD,GAAG;gBACH,IAAI,CAAC,QAAQ;oBACX,uEAAuE;oBACvE,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;gBAC7B,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAoB,CAAC;AACxB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type FieldDecorator } from "../field";
1
2
  import type { ReactiveHost } from "../reactive-host";
2
- export declare function DeepState(): <This extends ReactiveHost, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
3
+ export declare function DeepState(): FieldDecorator<ReactiveHost>;
3
4
  //# 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":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAwBrD,wBAAgB,SAAS,8HAiCxB"}
1
+ {"version":3,"file":"deep-state.d.ts","sourceRoot":"","sources":["../../src/properties/deep-state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,UAAU,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmDrD,wBAAgB,SAAS,IAAI,cAAc,CAAC,YAAY,CAAC,CAqBxD"}
@@ -1,55 +1,72 @@
1
- import { markStateDirty, signal } from "@praxisjs/core/internal";
2
- import { createFieldDecorator } from "../create-field-decorator";
3
- function deepProxy(target, notify) {
4
- return new Proxy(target, {
5
- get(obj, key, receiver) {
6
- const val = Reflect.get(obj, key, receiver);
7
- if (val !== null && typeof val === "object") {
8
- return deepProxy(val, notify);
9
- }
10
- return val;
11
- },
12
- set(obj, key, value) {
13
- const result = Reflect.set(obj, key, value);
14
- notify();
15
- return result;
16
- },
17
- deleteProperty(obj, key) {
18
- const result = Reflect.deleteProperty(obj, key);
19
- notify();
20
- return result;
21
- },
22
- });
1
+ import { markStateDirty, readSignal, SignalNode, writeSignal } from "@praxisjs/core/internal";
2
+ import { sharedField } from "../field";
3
+ // One per decorated field per instance. It is also the handler of every proxy it hands out, so
4
+ // proxying a nested object allocates only the Proxy itself.
5
+ class DeepStateCell {
6
+ host;
7
+ version = new SignalNode(0);
8
+ // One proxy per raw object: repeated reads return the same reference (so `a.b === a.b` and
9
+ // identity comparisons in effects hold) and don't allocate a new Proxy on every access.
10
+ proxies = undefined;
11
+ current;
12
+ constructor(host, value) {
13
+ this.host = host;
14
+ this.current = this.wrap(value);
15
+ }
16
+ wrap(value) {
17
+ if (value === null || typeof value !== "object")
18
+ return value;
19
+ const proxies = (this.proxies ??= new WeakMap());
20
+ let proxy = proxies.get(value);
21
+ if (proxy === undefined) {
22
+ proxy = new Proxy(value, this);
23
+ proxies.set(value, proxy);
24
+ }
25
+ return proxy;
26
+ }
27
+ changed() {
28
+ markStateDirty(this.host);
29
+ writeSignal(this.version, this.version.value + 1);
30
+ }
31
+ get(obj, key, receiver) {
32
+ return this.wrap(Reflect.get(obj, key, receiver));
33
+ }
34
+ set(obj, key, value) {
35
+ const had = Object.hasOwn(obj, key);
36
+ const prev = Reflect.get(obj, key);
37
+ const result = Reflect.set(obj, key, value);
38
+ if (!had || !Object.is(prev, value))
39
+ this.changed();
40
+ return result;
41
+ }
42
+ deleteProperty(obj, key) {
43
+ const had = Object.hasOwn(obj, key);
44
+ const result = Reflect.deleteProperty(obj, key);
45
+ if (had)
46
+ this.changed();
47
+ return result;
48
+ }
23
49
  }
24
50
  export function DeepState() {
25
- return createFieldDecorator({
26
- bind(instance, _name, initialValue) {
27
- const version = signal(0);
28
- let current = initialValue;
29
- let proxy = current !== null && typeof current === "object"
30
- ? deepProxy(current, notify)
31
- : current;
32
- function notify() {
33
- markStateDirty(instance);
34
- version.update((v) => v + 1);
35
- }
36
- return {
37
- descriptor: {
38
- get() {
39
- version();
40
- return proxy;
41
- },
42
- set(value) {
43
- current = value;
44
- proxy =
45
- value !== null && typeof value === "object"
46
- ? deepProxy(value, notify)
47
- : value;
48
- notify();
49
- },
51
+ return sharedField((name) => {
52
+ const slot = Symbol(`praxis.deepState.${name}`);
53
+ return {
54
+ descriptor: {
55
+ get() {
56
+ const cell = this[slot];
57
+ readSignal(cell.version);
58
+ return cell.current;
59
+ },
60
+ set(value) {
61
+ const cell = this[slot];
62
+ cell.current = cell.wrap(value);
63
+ cell.changed();
50
64
  },
51
- };
52
- },
65
+ },
66
+ init(instance, initialValue) {
67
+ instance[slot] = new DeepStateCell(instance, initialValue);
68
+ },
69
+ };
53
70
  });
54
71
  }
55
72
  //# sourceMappingURL=deep-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deep-state.js","sourceRoot":"","sources":["../../src/properties/deep-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,SAAS,SAAS,CAAmB,MAAS,EAAE,MAAkB;IAChE,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ;YACpB,MAAM,GAAG,GAAY,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5C,OAAO,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;YACD,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zC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACzB,OAAO,IAAI,CAAC,OAAO,CAAC;gBACtB,CAAC;gBACD,GAAG,CAAkB,KAAc;oBACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAkB,CAAC;oBACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAChC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,CAAC;aACF;YACD,IAAI,CAAC,QAAQ,EAAE,YAAY;gBACzB,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC7D,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +1,3 @@
1
- export declare function FunctionProp(): <This extends import("@praxisjs/core").StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
1
+ import { type FieldDecorator } from "../field";
2
+ export declare function FunctionProp(): FieldDecorator;
2
3
  //# sourceMappingURL=function-prop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function-prop.d.ts","sourceRoot":"","sources":["../../src/properties/function-prop.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,4JA4B3B"}
1
+ {"version":3,"file":"function-prop.d.ts","sourceRoot":"","sources":["../../src/properties/function-prop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,UAAU,CAAC;AAE5E,wBAAgB,YAAY,IAAI,cAAc,CA0B7C"}
@@ -1,28 +1,26 @@
1
1
  import { getComponentDefault, getComponentRawProp, setComponentDefault, } from "@praxisjs/core/internal";
2
- import { createFieldDecorator } from "../create-field-decorator";
2
+ import { sharedField } from "../field";
3
3
  export function FunctionProp() {
4
- return createFieldDecorator({
5
- bind(instance, name, initialValue) {
4
+ return sharedField((name) => ({
5
+ descriptor: {
6
+ get() {
7
+ const fromParent = getComponentRawProp(this, name);
8
+ if (fromParent !== undefined) {
9
+ if (process.env.NODE_ENV !== "production" &&
10
+ typeof fromParent !== "function") {
11
+ console.warn(`[FunctionProp] "${name}" received a non-function value (${typeof fromParent}). @FunctionProp() expects a function.`);
12
+ }
13
+ return fromParent;
14
+ }
15
+ return getComponentDefault(this, name);
16
+ },
17
+ set(value) {
18
+ setComponentDefault(this, name, value);
19
+ },
20
+ },
21
+ init(instance, initialValue) {
6
22
  setComponentDefault(instance, name, initialValue);
7
- return {
8
- descriptor: {
9
- get() {
10
- const fromParent = getComponentRawProp(instance, name);
11
- if (fromParent !== undefined) {
12
- if (process.env.NODE_ENV !== "production" &&
13
- typeof fromParent !== "function") {
14
- console.warn(`[FunctionProp] "${name}" received a non-function value (${typeof fromParent}). @FunctionProp() expects a function.`);
15
- }
16
- return fromParent;
17
- }
18
- return getComponentDefault(instance, name);
19
- },
20
- set(value) {
21
- setComponentDefault(instance, name, value);
22
- },
23
- },
24
- };
25
23
  },
26
- });
24
+ }));
27
25
  }
28
26
  //# sourceMappingURL=function-prop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"function-prop.js","sourceRoot":"","sources":["../../src/properties/function-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,UAAU,YAAY;IAC1B,OAAO,oBAAoB,CAAC;QAC1B,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY;YAC/B,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAClD,OAAO;gBACL,UAAU,EAAE;oBACV,GAAG;wBACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;wBACvD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;4BAC7B,IACE,O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AAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC;SACF;QACD,IAAI,CAAC,QAAQ,EAAE,YAAY;YACzB,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QACpD,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { StatefulComponent } from "@praxisjs/core";
2
1
  import { type HistoryElement } from "@praxisjs/core/internal";
2
+ import { type FieldDecorator } from "../field";
3
3
  export type HistoryOf<C, K extends keyof C> = HistoryElement<C[K]>;
4
- export declare function History(fieldName: string, limit?: number): <This extends StatefulComponent, Value = unknown>(_value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
4
+ export declare function History(fieldName: string, limit?: number): FieldDecorator;
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,kIAkCpD"}
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/properties/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,yBAAyB,CAAC;AAGvE,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,UAAU,CAAC;AAG5E,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAmBnE,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,cAAc,CAkBrE"}
@@ -1,37 +1,40 @@
1
1
  import { history } from "@praxisjs/core/internal";
2
- import { createFieldDecorator } from "../create-field-decorator";
2
+ import { sharedField } from "../field";
3
+ import { addLifecycleHooks } from "../lifecycle";
4
+ function createHistory(host, fieldName, limit) {
5
+ const h = history((() => host[fieldName]), limit);
6
+ const undo = h.undo.bind(h);
7
+ const redo = h.redo.bind(h);
8
+ h.undo = () => {
9
+ const prev = h.values()[h.values().length - 2];
10
+ if (prev === undefined)
11
+ return;
12
+ undo();
13
+ host[fieldName] = prev;
14
+ };
15
+ h.redo = () => {
16
+ redo();
17
+ host[fieldName] = h.current();
18
+ };
19
+ return h;
20
+ }
3
21
  export function History(fieldName, limit = 50) {
4
- return createFieldDecorator({
5
- bind(instance, _name) {
6
- const inst = instance;
7
- let h;
8
- const source = () => inst[fieldName];
9
- return {
10
- descriptor: {
11
- get() {
12
- if (!h) {
13
- const hInst = history(source, limit);
14
- const _undo = hInst.undo.bind(hInst);
15
- const _redo = hInst.redo.bind(hInst);
16
- hInst.undo = () => {
17
- const prev = hInst.values()[hInst.values().length - 2];
18
- if (prev === undefined)
19
- return;
20
- _undo();
21
- inst[fieldName] = prev;
22
- };
23
- hInst.redo = () => {
24
- _redo();
25
- inst[fieldName] = hInst.current();
26
- };
27
- h = hInst;
28
- }
29
- return h;
30
- },
31
- enumerable: false,
22
+ return sharedField((name) => {
23
+ const slot = Symbol(`praxis.history.${name}`);
24
+ // The tracking effect would otherwise keep recording a source that outlives the component.
25
+ const destroy = (instance) => { instance[slot]?.destroy(); };
26
+ return {
27
+ descriptor: {
28
+ enumerable: false,
29
+ // Created on first read, so an instance whose history is never read records nothing.
30
+ get() {
31
+ return (this[slot] ??= createHistory(this, fieldName, limit));
32
32
  },
33
- };
34
- },
33
+ },
34
+ init(instance) {
35
+ addLifecycleHooks(instance, undefined, destroy);
36
+ },
37
+ };
35
38
  });
36
39
  }
37
40
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/properties/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,MAAM,UAAU,OAAO,CAAC,SAAiB,EAAE,KAAK,GAAG,EAAE;IACnD,OAAO,oBAAoB,CAAC;QAC1B,IAAI,CAAC,QAA2B,EAAE,KAAa;YAC7C,MAAM,IAAI,GAAG,QAA8C,CAAC;YAC5D,IAAI,CAAsC,CAAC;YAE3C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAErC,OAAO;gBACL,UAAU,EAAE;oBACV,GAAG;wBACD,IAAI,CAAC,CAAC,EAAE,CAAC;4BACP,MAAM,KAAK,GAAG,OAAO,CAAC,MAAyB,EAAE,KAAK,CAAC,CAAC;4BACxD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BACrC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BACrC,KAAK,CAAC,IAAI,GAAG,GAAG,EAAE;gCAChB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gCACvD,IAAI,IAAI,KAAK,SAAS;oCAAE,OAAO;gCAC/B,KAAK,EAAE,CAAC;gCACR,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;4BACzB,CAAC,CAAC;4BACF,KAAK,CAAC,IAAI,GAAG,GAAG,EAAE;gCAChB,KAAK,EAAE,CAAC;gCACR,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC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AC,SAAiB,EAAE,KAAK,GAAG,EAAE;IACnD,OAAO,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;QAC9C,2FAA2F;QAC3F,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE,GAAK,QAAsB,CAAC,IAAI,CAAyC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7H,OAAO;YACL,UAAU,EAAE;gBACV,UAAU,EAAE,KAAK;gBACjB,qFAAqF;gBACrF,GAAG;oBACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;gBAChE,CAAC;aACF;YACD,IAAI,CAAC,QAAQ;gBACX,iBAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAClD,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -10,4 +10,5 @@ export { Resource, invalidateResource, type ResourceInstance, type ResourceOptio
10
10
  export { Synced } from "./synced";
11
11
  export { DeepState } from "./deep-state";
12
12
  export { Ref, createRef } from "./ref";
13
+ export { Selector, type SelectorOptions } from "./selector";
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -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,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,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,CAA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,4 +10,5 @@ export { Resource, invalidateResource } from "./resource";
10
10
  export { Synced } from "./synced";
11
11
  export { DeepState } from "./deep-state";
12
12
  export { Ref, createRef } from "./ref";
13
+ export { Selector } from "./selector";
13
14
  //# sourceMappingURL=index.js.map
@@ -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,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,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,EAAE,kBAAkB,EAA+C,MAAM,YAAY,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,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,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,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,EAAE,kBAAkB,EAA+C,MAAM,YAAY,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAwB,MAAM,YAAY,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { type PersistedSignalOptions } from "@praxisjs/core/internal";
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;
2
+ import { type FieldDecorator } from "../field";
3
+ export declare function Persisted<T>(key?: string, options?: PersistedSignalOptions<T>): FieldDecorator;
3
4
  //# 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,2JAgBxC"}
1
+ {"version":3,"file":"persisted.d.ts","sourceRoot":"","sources":["../../src/properties/persisted.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,UAAU,CAAC;AA0B5E,wBAAgB,SAAS,CAAC,CAAC,EACzB,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,GAAE,sBAAsB,CAAC,CAAC,CAAM,GACtC,cAAc,CAqBhB"}