@praxisjs/decorators 1.7.0 → 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 (266) hide show
  1. package/CHANGELOG.md +33 -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/log.d.ts +2 -1
  55. package/dist/functions/log.d.ts.map +1 -1
  56. package/dist/functions/log.js +38 -40
  57. package/dist/functions/log.js.map +1 -1
  58. package/dist/functions/memo.d.ts +2 -1
  59. package/dist/functions/memo.d.ts.map +1 -1
  60. package/dist/functions/memo.js +41 -40
  61. package/dist/functions/memo.js.map +1 -1
  62. package/dist/functions/once.d.ts +2 -1
  63. package/dist/functions/once.d.ts.map +1 -1
  64. package/dist/functions/once.js +10 -14
  65. package/dist/functions/once.js.map +1 -1
  66. package/dist/functions/retry.d.ts +2 -1
  67. package/dist/functions/retry.d.ts.map +1 -1
  68. package/dist/functions/retry.js +21 -23
  69. package/dist/functions/retry.js.map +1 -1
  70. package/dist/functions/throttle.d.ts +2 -1
  71. package/dist/functions/throttle.d.ts.map +1 -1
  72. package/dist/functions/throttle.js +12 -14
  73. package/dist/functions/throttle.js.map +1 -1
  74. package/dist/functions/until.d.ts +2 -1
  75. package/dist/functions/until.d.ts.map +1 -1
  76. package/dist/functions/until.js +13 -14
  77. package/dist/functions/until.js.map +1 -1
  78. package/dist/functions/watch.d.ts +1 -1
  79. package/dist/functions/watch.d.ts.map +1 -1
  80. package/dist/functions/watch.js +36 -34
  81. package/dist/functions/watch.js.map +1 -1
  82. package/dist/functions/when.d.ts +1 -1
  83. package/dist/functions/when.d.ts.map +1 -1
  84. package/dist/functions/when.js +19 -21
  85. package/dist/functions/when.js.map +1 -1
  86. package/dist/index.d.ts +5 -5
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +2 -2
  89. package/dist/index.js.map +1 -1
  90. package/dist/lifecycle.d.ts +24 -0
  91. package/dist/lifecycle.d.ts.map +1 -0
  92. package/dist/lifecycle.js +55 -0
  93. package/dist/lifecycle.js.map +1 -0
  94. package/dist/properties/compose.d.ts +3 -2
  95. package/dist/properties/compose.d.ts.map +1 -1
  96. package/dist/properties/compose.js +33 -19
  97. package/dist/properties/compose.js.map +1 -1
  98. package/dist/properties/computed.d.ts +12 -10
  99. package/dist/properties/computed.d.ts.map +1 -1
  100. package/dist/properties/computed.js +26 -21
  101. package/dist/properties/computed.js.map +1 -1
  102. package/dist/properties/deep-state.d.ts +2 -1
  103. package/dist/properties/deep-state.d.ts.map +1 -1
  104. package/dist/properties/deep-state.js +66 -60
  105. package/dist/properties/deep-state.js.map +1 -1
  106. package/dist/properties/function-prop.d.ts +2 -1
  107. package/dist/properties/function-prop.d.ts.map +1 -1
  108. package/dist/properties/function-prop.js +20 -22
  109. package/dist/properties/function-prop.js.map +1 -1
  110. package/dist/properties/history.d.ts +2 -2
  111. package/dist/properties/history.d.ts.map +1 -1
  112. package/dist/properties/history.js +34 -33
  113. package/dist/properties/history.js.map +1 -1
  114. package/dist/properties/index.d.ts +1 -0
  115. package/dist/properties/index.d.ts.map +1 -1
  116. package/dist/properties/index.js +1 -0
  117. package/dist/properties/index.js.map +1 -1
  118. package/dist/properties/persisted.d.ts +2 -1
  119. package/dist/properties/persisted.d.ts.map +1 -1
  120. package/dist/properties/persisted.js +24 -18
  121. package/dist/properties/persisted.js.map +1 -1
  122. package/dist/properties/prop.d.ts +2 -1
  123. package/dist/properties/prop.d.ts.map +1 -1
  124. package/dist/properties/prop.js +26 -22
  125. package/dist/properties/prop.js.map +1 -1
  126. package/dist/properties/ref.d.ts +2 -1
  127. package/dist/properties/ref.d.ts.map +1 -1
  128. package/dist/properties/ref.js +11 -8
  129. package/dist/properties/ref.js.map +1 -1
  130. package/dist/properties/resource.d.ts.map +1 -1
  131. package/dist/properties/resource.js +21 -16
  132. package/dist/properties/resource.js.map +1 -1
  133. package/dist/properties/selector.d.ts +12 -0
  134. package/dist/properties/selector.d.ts.map +1 -0
  135. package/dist/properties/selector.js +25 -0
  136. package/dist/properties/selector.js.map +1 -0
  137. package/dist/properties/slot.d.ts +2 -1
  138. package/dist/properties/slot.d.ts.map +1 -1
  139. package/dist/properties/slot.js +22 -20
  140. package/dist/properties/slot.js.map +1 -1
  141. package/dist/properties/state.d.ts.map +1 -1
  142. package/dist/properties/state.js +27 -16
  143. package/dist/properties/state.js.map +1 -1
  144. package/dist/properties/synced.d.ts +2 -1
  145. package/dist/properties/synced.d.ts.map +1 -1
  146. package/dist/properties/synced.js +27 -19
  147. package/dist/properties/synced.js.map +1 -1
  148. package/dist/shared-method.d.ts +14 -0
  149. package/dist/shared-method.d.ts.map +1 -0
  150. package/dist/shared-method.js +87 -0
  151. package/dist/shared-method.js.map +1 -0
  152. package/package.json +14 -5
  153. package/src/component/component.ts +8 -27
  154. package/src/component/lazy.ts +51 -41
  155. package/src/create-class-decorator.ts +90 -31
  156. package/src/create-field-decorator.ts +120 -43
  157. package/src/create-getter-decorator.ts +263 -66
  158. package/src/create-lifecycle-method-decorator.ts +50 -28
  159. package/src/create-method-decorator.ts +119 -13
  160. package/src/events/command.ts +11 -9
  161. package/src/events/emit.ts +16 -22
  162. package/src/events/on-command.ts +17 -18
  163. package/src/field.ts +116 -0
  164. package/src/functions/bind.ts +4 -4
  165. package/src/functions/debounce.ts +25 -23
  166. package/src/functions/log.ts +44 -46
  167. package/src/functions/memo.ts +39 -37
  168. package/src/functions/once.ts +10 -13
  169. package/src/functions/retry.ts +19 -21
  170. package/src/functions/throttle.ts +12 -13
  171. package/src/functions/until.ts +14 -14
  172. package/src/functions/watch.ts +37 -36
  173. package/src/functions/when.ts +18 -20
  174. package/src/index.ts +12 -5
  175. package/src/lifecycle.ts +74 -0
  176. package/src/properties/compose.ts +33 -20
  177. package/src/properties/computed.ts +35 -45
  178. package/src/properties/deep-state.ts +66 -64
  179. package/src/properties/function-prop.ts +25 -27
  180. package/src/properties/history.ts +34 -35
  181. package/src/properties/index.ts +1 -0
  182. package/src/properties/persisted.ts +30 -20
  183. package/src/properties/prop.ts +30 -22
  184. package/src/properties/ref.ts +12 -10
  185. package/src/properties/resource.ts +22 -17
  186. package/src/properties/selector.ts +45 -0
  187. package/src/properties/slot.ts +28 -22
  188. package/src/properties/state.ts +32 -16
  189. package/src/properties/synced.ts +31 -19
  190. package/src/shared-method.ts +101 -0
  191. package/dist/__tests__/component.test.d.ts +0 -2
  192. package/dist/__tests__/component.test.d.ts.map +0 -1
  193. package/dist/__tests__/component.test.js +0 -147
  194. package/dist/__tests__/component.test.js.map +0 -1
  195. package/dist/__tests__/compose.test.d.ts +0 -2
  196. package/dist/__tests__/compose.test.d.ts.map +0 -1
  197. package/dist/__tests__/compose.test.js +0 -164
  198. package/dist/__tests__/compose.test.js.map +0 -1
  199. package/dist/__tests__/deep-state.test.d.ts +0 -2
  200. package/dist/__tests__/deep-state.test.d.ts.map +0 -1
  201. package/dist/__tests__/deep-state.test.js +0 -221
  202. package/dist/__tests__/deep-state.test.js.map +0 -1
  203. package/dist/__tests__/events.test.d.ts +0 -2
  204. package/dist/__tests__/events.test.d.ts.map +0 -1
  205. package/dist/__tests__/events.test.js +0 -295
  206. package/dist/__tests__/events.test.js.map +0 -1
  207. package/dist/__tests__/functions.test.d.ts +0 -2
  208. package/dist/__tests__/functions.test.d.ts.map +0 -1
  209. package/dist/__tests__/functions.test.js +0 -618
  210. package/dist/__tests__/functions.test.js.map +0 -1
  211. package/dist/__tests__/lazy.test.d.ts +0 -2
  212. package/dist/__tests__/lazy.test.d.ts.map +0 -1
  213. package/dist/__tests__/lazy.test.js +0 -227
  214. package/dist/__tests__/lazy.test.js.map +0 -1
  215. package/dist/__tests__/memo.test.d.ts +0 -2
  216. package/dist/__tests__/memo.test.d.ts.map +0 -1
  217. package/dist/__tests__/memo.test.js +0 -249
  218. package/dist/__tests__/memo.test.js.map +0 -1
  219. package/dist/__tests__/properties-browser.test.d.ts +0 -2
  220. package/dist/__tests__/properties-browser.test.d.ts.map +0 -1
  221. package/dist/__tests__/properties-browser.test.js +0 -227
  222. package/dist/__tests__/properties-browser.test.js.map +0 -1
  223. package/dist/__tests__/properties.test.d.ts +0 -2
  224. package/dist/__tests__/properties.test.d.ts.map +0 -1
  225. package/dist/__tests__/properties.test.js +0 -1253
  226. package/dist/__tests__/properties.test.js.map +0 -1
  227. package/dist/__tests__/ref.test.d.ts +0 -2
  228. package/dist/__tests__/ref.test.d.ts.map +0 -1
  229. package/dist/__tests__/ref.test.js +0 -106
  230. package/dist/__tests__/ref.test.js.map +0 -1
  231. package/dist/__tests__/resource.test.d.ts +0 -2
  232. package/dist/__tests__/resource.test.d.ts.map +0 -1
  233. package/dist/__tests__/resource.test.js +0 -217
  234. package/dist/__tests__/resource.test.js.map +0 -1
  235. package/dist/__tests__/slot.test.d.ts +0 -2
  236. package/dist/__tests__/slot.test.d.ts.map +0 -1
  237. package/dist/__tests__/slot.test.js +0 -147
  238. package/dist/__tests__/slot.test.js.map +0 -1
  239. package/dist/__tests__/synced.test.d.ts +0 -2
  240. package/dist/__tests__/synced.test.d.ts.map +0 -1
  241. package/dist/__tests__/synced.test.js +0 -161
  242. package/dist/__tests__/synced.test.js.map +0 -1
  243. package/dist/__tests__/until.test.d.ts +0 -2
  244. package/dist/__tests__/until.test.d.ts.map +0 -1
  245. package/dist/__tests__/until.test.js +0 -88
  246. package/dist/__tests__/until.test.js.map +0 -1
  247. package/dist/create-accessor-decorator.d.ts +0 -14
  248. package/dist/create-accessor-decorator.d.ts.map +0 -1
  249. package/dist/create-accessor-decorator.js +0 -27
  250. package/dist/create-accessor-decorator.js.map +0 -1
  251. package/src/__tests__/component.test.ts +0 -167
  252. package/src/__tests__/compose.test.ts +0 -202
  253. package/src/__tests__/deep-state.test.ts +0 -265
  254. package/src/__tests__/events.test.ts +0 -366
  255. package/src/__tests__/functions.test.ts +0 -803
  256. package/src/__tests__/lazy.test.ts +0 -296
  257. package/src/__tests__/memo.test.ts +0 -293
  258. package/src/__tests__/properties-browser.test.ts +0 -288
  259. package/src/__tests__/properties.test.ts +0 -1556
  260. package/src/__tests__/ref.test.ts +0 -131
  261. package/src/__tests__/resource.test.ts +0 -246
  262. package/src/__tests__/slot.test.ts +0 -179
  263. package/src/__tests__/synced.test.ts +0 -193
  264. package/src/__tests__/until.test.ts +0 -113
  265. package/src/create-accessor-decorator.ts +0 -45
  266. package/tsconfig.json +0 -9
@@ -1,29 +1,23 @@
1
- import { createMethodDecorator } from "../create-method-decorator";
1
+ import { sharedMethod } from "../shared-method";
2
2
  import { readProp } from "./helper";
3
3
  export function Emit(propName) {
4
- return createMethodDecorator({
5
- wrap(original, instance) {
6
- const comp = instance;
7
- return (...args) => {
8
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
9
- const result = original.apply(instance, args);
10
- const callback = readProp(comp, propName);
11
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
12
- if (typeof callback !== "function")
13
- return result;
14
- if (result !== undefined) {
15
- callback(result);
16
- }
17
- else if (args.length > 0) {
18
- callback(...args);
19
- }
20
- else {
21
- callback();
22
- }
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
4
+ return function (value, context) {
5
+ return sharedMethod(context, value, function (...args) {
6
+ const result = value.apply(this, args);
7
+ const callback = readProp(this, propName);
8
+ if (typeof callback !== "function")
24
9
  return result;
25
- };
26
- },
27
- });
10
+ if (result !== undefined) {
11
+ callback(result);
12
+ }
13
+ else if (args.length > 0) {
14
+ callback(...args);
15
+ }
16
+ else {
17
+ callback();
18
+ }
19
+ return result;
20
+ });
21
+ };
28
22
  }
29
23
  //# sourceMappingURL=emit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/events/emit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,UAAU,IAAI,CAAC,QAAgB;IACnC,OAAO,qBAAqB,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE,QAAQ;YACrB,MAAM,IAAI,GAAG,QAA6B,CAAC;YAC3C,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;gBAC5B,mEAAmE;gBACnE,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBAE9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC1C,+DAA+D;gBAC/D,IAAI,OAAO,QAAQ,KAAK,UAAU;oBAAE,OAAO,MAAM,CAAC;gBAElD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACxB,QAAiC,CAAC,MAAM,CAAC,CAAC;gBAC7C,CAAC;qBAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC1B,QAAsC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACnD,CAAC;qBAAM,CAAC;oBACL,QAAuB,EAAE,CAAC;gBAC7B,CAAC;gBAED,+DAA+D;gBAC/D,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/events/emit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,UAAU,IAAI,CAAC,QAAgB;IACnC,OAAO,UAAU,KAAgB,EAAE,OAAsB;QACvD,OAAO,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,UAAmC,GAAG,IAAe;YACvF,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAY,CAAC;YAElD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC1C,IAAI,OAAO,QAAQ,KAAK,UAAU;gBAAE,OAAO,MAAM,CAAC;YAElD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACxB,QAAiC,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,QAAsC,CAAC,GAAG,IAAI,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACL,QAAuB,EAAE,CAAC;YAC7B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,2 +1,3 @@
1
- export declare function OnCommand(propName: string): (value: (this: import("@praxisjs/core").StatefulComponent, ...args: any[]) => void, _context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent, (this: import("@praxisjs/core").StatefulComponent, ...args: any) => any>) => void;
1
+ import type { StatefulComponent } from "@praxisjs/core";
2
+ export declare function OnCommand(propName: string): (value: (this: StatefulComponent, ...args: any[]) => void, context: ClassMethodDecoratorContext<StatefulComponent, (this: StatefulComponent, ...args: any) => any>) => void;
2
3
  //# sourceMappingURL=on-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"on-command.d.ts","sourceRoot":"","sources":["../../src/events/on-command.ts"],"names":[],"mappings":"AAMA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,2PAsBzC"}
1
+ {"version":3,"file":"on-command.d.ts","sourceRoot":"","sources":["../../src/events/on-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,+KAoBzC"}
@@ -1,19 +1,17 @@
1
- import { createLifecycleMethodDecorator } from "../create-lifecycle-method-decorator";
1
+ import { lifecycleMethodDecorator } from "../create-lifecycle-method-decorator";
2
2
  import { readProp } from "./helper";
3
3
  export function OnCommand(propName) {
4
- return createLifecycleMethodDecorator({
5
- register(callback, instance) {
6
- const command = readProp(instance, propName);
7
- if (!command) {
8
- console.warn(`[OnCommand] prop "${propName}" was not provided to ${instance.constructor.name ?? "unknown"}`);
9
- return;
10
- }
11
- if (typeof command.subscribe !== "function") {
12
- console.warn(`[OnCommand] prop "${propName}" is not a valid Command in ${instance.constructor.name ?? "unknown"}`);
13
- return;
14
- }
15
- return command.subscribe((...args) => { callback(...args); });
16
- },
4
+ return lifecycleMethodDecorator((instance, method) => {
5
+ const command = readProp(instance, propName);
6
+ if (!command) {
7
+ console.warn(`[OnCommand] prop "${propName}" was not provided to ${instance.constructor.name ?? "unknown"}`);
8
+ return;
9
+ }
10
+ if (typeof command.subscribe !== "function") {
11
+ console.warn(`[OnCommand] prop "${propName}" is not a valid Command in ${instance.constructor.name ?? "unknown"}`);
12
+ return;
13
+ }
14
+ return command.subscribe((...args) => { method.apply(instance, args); });
17
15
  });
18
16
  }
19
17
  //# sourceMappingURL=on-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"on-command.js","sourceRoot":"","sources":["../../src/events/on-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,OAAO,8BAA8B,CAAC;QACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ;YACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAiC,CAAC;YAE7E,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb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,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,IAAe,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { StatefulComponent } from "@praxisjs/core";
2
+ /**
3
+ * The signature of a field decorator: usable on fields of classes extending `Base` whose type is
4
+ * assignable to `Value`, so TypeScript rejects `@Clamp() name = ''` for a number-only decorator.
5
+ */
6
+ export type FieldDecorator<Base = StatefulComponent, Value = unknown> = <This extends Base, V extends Value = Value>(value: undefined, context: ClassFieldDecoratorContext<This, V>) => void;
7
+ export type FieldHost = Record<PropertyKey, unknown>;
8
+ export declare function describeValue(value: unknown): string;
9
+ /**
10
+ * Throws when a decorator built for one kind of member is applied to another, naming the member,
11
+ * e.g. `@Confirm() decorates methods only, not the field "title".`
12
+ */
13
+ export declare function assertMemberKind(context: {
14
+ readonly kind: DecoratorContext["kind"];
15
+ readonly name: string | symbol | undefined;
16
+ }, kind: DecoratorContext["kind"], decorator: string): void;
17
+ /**
18
+ * Throws when a field decorator is applied to anything but a plain class field. Above all an
19
+ * `accessor`: the decorator would install its property on the instance, shadowing the accessor,
20
+ * and decorators stacked on the same member would wrap the wrong thing.
21
+ */
22
+ export declare function assertFieldContext(context: DecoratorContext, decorator?: string): void;
23
+ /**
24
+ * Lets the decorator lowering of `@praxisjs/vite-plugin` define a decorated field through its
25
+ * innermost decorator: an initializer added with `addClaimableInitializer` carries a `claim`
26
+ * function under this key, which installs the decorator's property directly with the field's
27
+ * initial value. The field is then never defined as a data property first, which in V8 would turn
28
+ * every instance into a slow dictionary-mode object when the accessor replaces it. Without the
29
+ * plugin (or under another decorator in the innermost position), the field is defined as usual and
30
+ * the initializer runs as an ordinary one.
31
+ */
32
+ export declare const CLAIM: unique symbol;
33
+ /**
34
+ * Registers `claim` as the field's initializer: run as an ordinary extra initializer, it reads the
35
+ * value from the data property the field was defined with; the lowering can call it with the
36
+ * value instead (see CLAIM).
37
+ */
38
+ export declare function addClaimableInitializer<This, Value>(context: ClassFieldDecoratorContext<This, Value>, claim: (this: This, value: Value) => void): void;
39
+ export interface SharedField {
40
+ /** Installed on every instance in place of the field. */
41
+ descriptor: PropertyDescriptor;
42
+ /** Runs per instance before the descriptor is installed, with the field's initial value. */
43
+ init?: (instance: FieldHost, initialValue: unknown) => void;
44
+ }
45
+ /**
46
+ * Builds a field decorator whose accessors are created once per decorated field (by `setup`, at
47
+ * class definition) and shared by every instance, which keeps its own state in symbol slots: all
48
+ * instances share one hidden class and building one allocates no closures.
49
+ */
50
+ export declare function sharedField<Base = StatefulComponent>(setup: (name: string) => SharedField): FieldDecorator<Base>;
51
+ //# sourceMappingURL=field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,IAAI,GAAG,iBAAiB,EAAE,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,SAAS,IAAI,EAAE,CAAC,SAAS,KAAK,GAAG,KAAK,EACjH,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,KACzC,IAAI,CAAC;AAEV,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAWrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,EAChG,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC9B,SAAS,EAAE,MAAM,GAChB,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,EAAE,SAAS,SAAyB,GAAG,IAAI,CAQtG;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,eAAqC,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,KAAK,EACjD,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,EAChD,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,GACxC,IAAI,CAON;AAED,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,UAAU,EAAE,kBAAkB,CAAC;IAC/B,4FAA4F;IAC5F,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAG,iBAAiB,EAClD,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,GACnC,cAAc,CAAC,IAAI,CAAC,CAatB"}
package/dist/field.js ADDED
@@ -0,0 +1,82 @@
1
+ const KIND_NAMES = {
2
+ class: "classes",
3
+ method: "methods",
4
+ getter: "getters",
5
+ setter: "setters",
6
+ field: "class fields",
7
+ accessor: "accessors",
8
+ };
9
+ export function describeValue(value) {
10
+ if (typeof value === "function")
11
+ return "a function";
12
+ if (typeof value === "object" && value !== null)
13
+ return "an object";
14
+ return String(value);
15
+ }
16
+ /**
17
+ * Throws when a decorator built for one kind of member is applied to another, naming the member,
18
+ * e.g. `@Confirm() decorates methods only, not the field "title".`
19
+ */
20
+ export function assertMemberKind(context, kind, decorator) {
21
+ // A context without a kind was built by hand (decorators called directly in tests), not by a
22
+ // decorator application, which always has one.
23
+ if (context.kind === kind || context.kind === undefined)
24
+ return;
25
+ throw new TypeError(`${decorator} decorates ${KIND_NAMES[kind]} only, not the ${context.kind} "${String(context.name)}".`);
26
+ }
27
+ /**
28
+ * Throws when a field decorator is applied to anything but a plain class field. Above all an
29
+ * `accessor`: the decorator would install its property on the instance, shadowing the accessor,
30
+ * and decorators stacked on the same member would wrap the wrong thing.
31
+ */
32
+ export function assertFieldContext(context, decorator = "This field decorator") {
33
+ if (context.kind === "field")
34
+ return;
35
+ const member = String(context.name);
36
+ throw new TypeError(context.kind === "accessor"
37
+ ? `${decorator} decorates plain class fields only: remove \`accessor\` from "${member}".`
38
+ : `${decorator} decorates class fields only, not the ${context.kind} "${member}".`);
39
+ }
40
+ /**
41
+ * Lets the decorator lowering of `@praxisjs/vite-plugin` define a decorated field through its
42
+ * innermost decorator: an initializer added with `addClaimableInitializer` carries a `claim`
43
+ * function under this key, which installs the decorator's property directly with the field's
44
+ * initial value. The field is then never defined as a data property first, which in V8 would turn
45
+ * every instance into a slow dictionary-mode object when the accessor replaces it. Without the
46
+ * plugin (or under another decorator in the innermost position), the field is defined as usual and
47
+ * the initializer runs as an ordinary one.
48
+ */
49
+ export const CLAIM = Symbol.for("praxisjs.field.claim");
50
+ /**
51
+ * Registers `claim` as the field's initializer: run as an ordinary extra initializer, it reads the
52
+ * value from the data property the field was defined with; the lowering can call it with the
53
+ * value instead (see CLAIM).
54
+ */
55
+ export function addClaimableInitializer(context, claim) {
56
+ const name = context.name;
57
+ const init = function () {
58
+ claim.call(this, this[name]);
59
+ };
60
+ init[CLAIM] = claim;
61
+ context.addInitializer(init);
62
+ }
63
+ /**
64
+ * Builds a field decorator whose accessors are created once per decorated field (by `setup`, at
65
+ * class definition) and shared by every instance, which keeps its own state in symbol slots: all
66
+ * instances share one hidden class and building one allocates no closures.
67
+ */
68
+ export function sharedField(setup) {
69
+ return function (_value, context) {
70
+ assertFieldContext(context);
71
+ const name = context.name;
72
+ const { descriptor, init } = setup(name);
73
+ descriptor.enumerable ??= true;
74
+ descriptor.configurable ??= true;
75
+ addClaimableInitializer(context, function (value) {
76
+ const instance = this;
77
+ init?.(instance, value);
78
+ Object.defineProperty(instance, name, descriptor);
79
+ });
80
+ };
81
+ }
82
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.js","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,GAA6C;IAC3D,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,UAAU;QAAE,OAAO,YAAY,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC;IACpE,OAAO,MAAM,CAAC,KAAuE,CAAC,CAAC;AACzF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAgG,EAChG,IAA8B,EAC9B,SAAiB;IAEjB,6FAA6F;IAC7F,+CAA+C;IAC/C,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,IAAK,OAAO,CAAC,IAA2B,KAAK,SAAS;QAAE,OAAO;IACxF,MAAM,IAAI,SAAS,CACjB,GAAG,SAAS,cAAc,UAAU,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CACtG,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAyB,EAAE,SAAS,GAAG,sBAAsB;IAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,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AC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,2 +1,3 @@
1
- export declare function Bind(): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
1
+ import { type AnyMethod, type MethodContext } from "../shared-method";
2
+ export declare function Bind(): (value: AnyMethod, context: MethodContext) => AnyMethod;
2
3
  //# sourceMappingURL=bind.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,2BAKsT,GAAI,+GAD7U"}
1
+ {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAEpF,wBAAgB,IAAI,KACD,OAAO,SAAS,EAAE,SAAS,aAAa,KAAG,SAAS,CAGtE"}
@@ -1,7 +1,7 @@
1
- import { createMethodDecorator } from "../create-method-decorator";
1
+ import { sharedMethod } from "../shared-method";
2
2
  export function Bind() {
3
- return createMethodDecorator({
4
- wrap: (original, instance) => original.bind(instance),
5
- });
3
+ return function (value, context) {
4
+ return sharedMethod(context, value);
5
+ };
6
6
  }
7
7
  //# sourceMappingURL=bind.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,UAAU,IAAI;IAClB,OAAO,qBAAqB,CAAC;QAC3B,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;KACtD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/functions/bind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEpF,MAAM,UAAU,IAAI;IAClB,OAAO,UAAU,KAAgB,EAAE,OAAsB;QACvD,OAAO,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { StatefulComponent } from "@praxisjs/core";
2
- export declare function Debounce(ms: number): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<StatefulComponent>) => void;
1
+ import { type AnyMethod, type MethodContext } from "../shared-method";
2
+ export declare function Debounce(ms: number): (value: AnyMethod, context: MethodContext) => AnyMethod;
3
3
  //# sourceMappingURL=debounce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/functions/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,0BASN,GAAI,sFAehC"}
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/functions/debounce.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAIpF,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAChB,OAAO,SAAS,EAAE,SAAS,aAAa,KAAG,SAAS,CAwBtE"}
@@ -1,26 +1,28 @@
1
- import { createMethodDecorator } from "../create-method-decorator";
1
+ import { addLifecycleHooks } from "../lifecycle";
2
+ import { sharedMethod } from "../shared-method";
2
3
  export function Debounce(ms) {
3
- return createMethodDecorator({
4
- wrap(original, instance, _name) {
5
- let timer;
6
- const comp = instance;
7
- const prevUnmount = comp.onUnmount?.bind(comp);
8
- comp.onUnmount = function () {
9
- prevUnmount?.call(this);
10
- if (timer !== undefined) {
11
- clearTimeout(timer);
12
- timer = undefined;
13
- }
14
- };
15
- return (...args) => {
16
- if (timer !== undefined)
17
- clearTimeout(timer);
18
- timer = setTimeout(() => {
19
- timer = undefined;
20
- original.apply(instance, args);
21
- }, ms);
22
- };
23
- },
24
- });
4
+ return function (value, context) {
5
+ // undefined: never called. null: called, nothing pending.
6
+ const timer = Symbol(`praxis.debounce.${String(context.name)}`);
7
+ function cancel(instance) {
8
+ const pending = instance[timer];
9
+ if (pending != null) {
10
+ clearTimeout(pending);
11
+ instance[timer] = null;
12
+ }
13
+ }
14
+ return sharedMethod(context, value, function (...args) {
15
+ const pending = this[timer];
16
+ // Only an instance that has called the method can have a timer to cancel on unmount.
17
+ if (pending === undefined)
18
+ addLifecycleHooks(this, undefined, cancel);
19
+ else if (pending !== null)
20
+ clearTimeout(pending);
21
+ this[timer] = setTimeout(() => {
22
+ this[timer] = null;
23
+ value.apply(this, args);
24
+ }, ms);
25
+ });
26
+ };
25
27
  }
26
28
  //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/functions/debounce.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,UAAU,QAAQ,CAAC,EAAU;IACjC,OAAO,qBAAqB,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK;YAC5B,IAAI,KAAgD,CAAC;YAErD,MAAM,IAAI,GAAG,QAA6B,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,SAAS,GAAG;gBACf,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,YAAY,CAAC,KAAK,CAAC,CAAC;oBACpB,KAAK,GAAG,SAAS,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC;YAEF,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AAO,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;gBACnB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type AnyMethod, type MethodContext } from "../shared-method";
1
2
  export interface LogOptions {
2
3
  level?: "log" | "warn" | "error" | "debug";
3
4
  args?: boolean;
@@ -5,5 +6,5 @@ export interface LogOptions {
5
6
  time?: boolean;
6
7
  devOnly?: boolean;
7
8
  }
8
- export declare function Log(options?: LogOptions): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
9
+ export declare function Log(options?: LogOptions): (value: AnyMethod, context: MethodContext) => AnyMethod;
9
10
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,GAAG,CAAC,OAAO,GAAE,UAAe,0BAalC,GAAL,+GAyCJ"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAEpF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,GAAG,CAAC,OAAO,GAAE,UAAe,IASzB,OAAO,SAAS,EAAE,SAAS,aAAa,KAAG,SAAS,CA2CtE"}
@@ -1,44 +1,42 @@
1
- import { createMethodDecorator } from "../create-method-decorator";
1
+ import { sharedMethod } from "../shared-method";
2
2
  export function Log(options = {}) {
3
3
  const { level = "log", args: logArgs = true, result = true, time = false, devOnly = true, } = options;
4
- return createMethodDecorator({
5
- wrap(original, instance, name) {
6
- return (...args) => {
7
- if (devOnly &&
8
- typeof process !== "undefined" &&
9
- process.env.NODE_ENV === "production") {
10
- return original.apply(instance, args);
11
- }
12
- const className = instance.constructor.name ?? "Unknown";
13
- const label = `[${className}.${name}]`;
14
- const logger = console[level].bind(console);
15
- if (logArgs)
16
- logger(`${label} args:`, args);
17
- const start = time ? performance.now() : 0;
18
- const output = original.apply(instance, args);
19
- if (output instanceof Promise) {
20
- return output
21
- .then((resolved) => {
22
- const elapsed = time
23
- ? ` (${(performance.now() - start).toFixed(2)}ms)`
24
- : "";
25
- if (result)
26
- logger(`${label} resolved:`, resolved, elapsed);
27
- return resolved;
28
- })
29
- .catch((e) => {
30
- logger(`${label} rejected:`, e);
31
- throw e;
32
- });
33
- }
34
- const elapsed = time
35
- ? ` (${(performance.now() - start).toFixed(2)}ms)`
36
- : "";
37
- if (result)
38
- logger(`${label} returned:`, output, elapsed);
39
- return output;
40
- };
41
- },
42
- });
4
+ return function (value, context) {
5
+ const name = String(context.name);
6
+ return sharedMethod(context, value, function (...args) {
7
+ if (devOnly &&
8
+ typeof process !== "undefined" &&
9
+ process.env.NODE_ENV === "production") {
10
+ return value.apply(this, args);
11
+ }
12
+ const className = this.constructor.name ?? "Unknown";
13
+ const label = `[${className}.${name}]`;
14
+ if (logArgs)
15
+ console[level](`${label} args:`, args);
16
+ const start = time ? performance.now() : 0;
17
+ const output = value.apply(this, args);
18
+ if (output instanceof Promise) {
19
+ return output
20
+ .then((resolved) => {
21
+ const elapsed = time
22
+ ? ` (${(performance.now() - start).toFixed(2)}ms)`
23
+ : "";
24
+ if (result)
25
+ console[level](`${label} resolved:`, resolved, elapsed);
26
+ return resolved;
27
+ })
28
+ .catch((e) => {
29
+ console[level](`${label} rejected:`, e);
30
+ throw e;
31
+ });
32
+ }
33
+ const elapsed = time
34
+ ? ` (${(performance.now() - start).toFixed(2)}ms)`
35
+ : "";
36
+ if (result)
37
+ console[level](`${label} returned:`, output, elapsed);
38
+ return output;
39
+ });
40
+ };
43
41
  }
44
42
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAUnE,MAAM,UAAU,GAAG,CAAC,UAAsB,EAAE;IAC1C,MAAM,EACJ,KAAK,GAAG,KAAK,EACb,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,MAAM,GAAG,IAAI,EACb,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,IAAI,GACf,GAAG,OAAO,CAAC;IAEZ,OAAO,qBAAqB,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI;YAC3B,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;gBAC5B,IACE,OAAO;oBACP,OAAO,OAAO,KAAK,WAAW;oBAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EACrC,CAAC;oBACD,OAAO,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAY,CAAC;gBACnD,CAAC;gBAED,MAAM,SAAS,GACZ,QAAQ,CAAC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,CAAC,IAAI,EAAE,IAAI,CAAY,CAAC;YAE3D,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;gBAC9B,OAAQ,MAA2B;qBAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACjB,MAAM,OAAO,GAAG,IAAI;wBAClB,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;wBAClD,CAAC,CAAC,EAAE,CAAC;oBACP,IAAI,MAAM;wBAAE,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;oBACpE,OAAO,QAAQ,CAAC;gBAClB,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;oBACpB,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,YAAY,EAAE,CAAC,CAAC,CAAC;oBACxC,MAAM,CAAC,CAAC;gBACV,CAAC,CAAC,CAAC;YACP,CAAC;YAED,MAAM,OAAO,GAAG,IAAI;gBAClB,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;gBAClD,CAAC,CAAC,EAAE,CAAC;YACP,IAAI,MAAM;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAElE,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type AnyMethod, type MethodContext } from "../shared-method";
1
2
  export interface MemoOptions {
2
3
  /**
3
4
  * Maximum number of cached argument combinations. When exceeded, the least recently used entry
@@ -5,5 +6,5 @@ export interface MemoOptions {
5
6
  */
6
7
  max?: number;
7
8
  }
8
- export declare function Memo(options?: MemoOptions): (value: (this: object, ...args: any[]) => any, context: ClassMethodDecoratorContext<import("@praxisjs/core").StatefulComponent>) => void;
9
+ export declare function Memo(options?: MemoOptions): (value: AnyMethod, context: MethodContext) => AnyMethod;
9
10
  //# sourceMappingURL=memo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/functions/memo.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,0BA3B5C,GAAG,+GAsDJ"}
1
+ {"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/functions/memo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AA+BpF,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,IAG3B,OAAO,SAAS,EAAE,SAAS,aAAa,KAAG,SAAS,CAwBtE"}
@@ -1,5 +1,5 @@
1
1
  import { computed } from "@praxisjs/core/internal";
2
- import { createMethodDecorator } from "../create-method-decorator";
2
+ import { sharedMethod } from "../shared-method";
3
3
  const objectIdMap = new WeakMap();
4
4
  let objectIdCounter = 0;
5
5
  function objectIdentityKey(obj) {
@@ -8,52 +8,53 @@ function objectIdentityKey(obj) {
8
8
  }
9
9
  return `__obj_${String(objectIdMap.get(obj))}__`;
10
10
  }
11
+ function serializeArg(a) {
12
+ if (a === null || typeof a === "object") {
13
+ try {
14
+ return JSON.stringify(a);
15
+ }
16
+ catch {
17
+ return objectIdentityKey(a);
18
+ }
19
+ }
20
+ if (typeof a === "symbol")
21
+ return a.toString();
22
+ return String(a);
23
+ }
11
24
  function serializeArgs(args) {
12
25
  if (args.length === 0)
13
26
  return "__no_args__";
14
- return args
15
- .map((a) => {
16
- if (a === null || typeof a === "object") {
17
- try {
18
- return JSON.stringify(a);
19
- }
20
- catch {
21
- return objectIdentityKey(a);
22
- }
23
- }
24
- if (typeof a === "symbol")
25
- return a.toString();
26
- return String(a);
27
- })
28
- .join("|");
27
+ // The common single-argument call skips the intermediate array and join.
28
+ if (args.length === 1)
29
+ return serializeArg(args[0]);
30
+ return args.map(serializeArg).join("|");
29
31
  }
30
32
  const DEFAULT_MAX = 100;
31
33
  export function Memo(options = {}) {
32
34
  const { max = DEFAULT_MAX } = options;
33
- return createMethodDecorator({
34
- wrap(original, instance, _name) {
35
- const cache = new Map();
36
- return (...args) => {
37
- const key = serializeArgs(args);
38
- let memoized = cache.get(key);
39
- if (memoized) {
40
- // Re-insert so Map order tracks recency.
41
- cache.delete(key);
42
- cache.set(key, memoized);
43
- }
44
- else {
45
- memoized = computed(() => original.apply(instance, args));
46
- cache.set(key, memoized);
47
- if (cache.size > max) {
48
- const [oldestKey, oldest] = cache.entries().next().value;
49
- cache.delete(oldestKey);
50
- // Releases the entry's hold on the signals it read; a no-op if a binding still uses it.
51
- oldest.dispose();
52
- }
35
+ return function (value, context) {
36
+ const caches = Symbol(`praxis.memo.${String(context.name)}`);
37
+ return sharedMethod(context, value, function (...args) {
38
+ const cache = (this[caches] ??= new Map());
39
+ const key = serializeArgs(args);
40
+ let memoized = cache.get(key);
41
+ if (memoized) {
42
+ // Re-insert so Map order tracks recency.
43
+ cache.delete(key);
44
+ cache.set(key, memoized);
45
+ }
46
+ else {
47
+ memoized = computed(() => value.apply(this, args));
48
+ cache.set(key, memoized);
49
+ if (cache.size > max) {
50
+ const [oldestKey, oldest] = cache.entries().next().value;
51
+ cache.delete(oldestKey);
52
+ // Releases the entry's hold on the signals it read; a no-op if a binding still uses it.
53
+ oldest.dispose();
53
54
  }
54
- return memoized();
55
- };
56
- },
57
- });
55
+ }
56
+ return memoized();
57
+ });
58
+ };
58
59
  }
59
60
  //# sourceMappingURL=memo.js.map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