@tstdl/base 0.86.0-beta2 → 0.86.0-beta3

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 (872) hide show
  1. package/.eslintrc.json +1 -0
  2. package/__container/decorators.d.ts +2 -0
  3. package/__container/decorators.js +34 -0
  4. package/__container/index.d.ts +3 -0
  5. package/__container/index.js +20 -0
  6. package/__container/interfaces.d.ts +2 -0
  7. package/__container/interfaces.js +25 -0
  8. package/__container/token.d.ts +2 -0
  9. package/__container/token.js +26 -0
  10. package/_container/container.js +443 -0
  11. package/_container/decorators.js +110 -0
  12. package/_container/index.js +27 -0
  13. package/_container/interfaces.js +26 -0
  14. package/_container/provider.js +60 -0
  15. package/_container/resolve-chain.js +105 -0
  16. package/_container/resolve.error.js +36 -0
  17. package/_container/token.js +41 -0
  18. package/_container/type-info.js +16 -0
  19. package/_container/types.js +16 -0
  20. package/_container/utils.js +44 -0
  21. package/api/client/client.d.ts +2 -2
  22. package/api/client/client.js +127 -109
  23. package/api/client/index.js +18 -1
  24. package/api/default-error-handlers.js +44 -18
  25. package/api/index.js +20 -14
  26. package/api/response.js +123 -99
  27. package/api/server/api-controller.d.ts +2 -2
  28. package/api/server/api-controller.js +71 -42
  29. package/api/server/api-request-token.provider.js +40 -12
  30. package/api/server/error-handler.js +46 -25
  31. package/api/server/gateway.d.ts +5 -6
  32. package/api/server/gateway.js +226 -207
  33. package/api/server/index.js +22 -5
  34. package/api/server/middlewares/allowed-methods.middleware.js +40 -17
  35. package/api/server/middlewares/catch-error.middleware.js +33 -12
  36. package/api/server/middlewares/cors.middleware.js +69 -49
  37. package/api/server/middlewares/index.js +21 -4
  38. package/api/server/middlewares/response-time.middleware.js +31 -8
  39. package/api/server/module.js +42 -18
  40. package/api/server/tokens.d.ts +4 -1
  41. package/api/server/tokens.js +31 -2
  42. package/api/types.js +40 -14
  43. package/api/utils.js +36 -13
  44. package/application/application.d.ts +7 -8
  45. package/application/application.js +163 -155
  46. package/application/index.js +18 -1
  47. package/async-iterator-symbol.js +28 -5
  48. package/authentication/authentication.api.js +113 -89
  49. package/authentication/client/api.client.js +57 -28
  50. package/authentication/client/authentication.service.d.ts +4 -4
  51. package/authentication/client/authentication.service.js +249 -223
  52. package/authentication/client/http-client.middleware.d.ts +3 -5
  53. package/authentication/client/http-client.middleware.js +35 -21
  54. package/authentication/client/index.js +22 -5
  55. package/authentication/client/module.d.ts +2 -1
  56. package/authentication/client/module.js +46 -15
  57. package/authentication/client/tokens.d.ts +2 -2
  58. package/authentication/client/tokens.js +30 -5
  59. package/authentication/errors/index.js +18 -1
  60. package/authentication/errors/secret-requirements.error.js +29 -6
  61. package/authentication/index.js +19 -2
  62. package/authentication/models/authentication-credentials.model.js +66 -37
  63. package/authentication/models/authentication-session.model.js +80 -51
  64. package/authentication/models/index.js +23 -6
  65. package/authentication/models/init-secret-reset-data.model.js +44 -16
  66. package/authentication/models/secret-check-result.model.js +36 -9
  67. package/authentication/models/token-payload-base.model.js +59 -31
  68. package/authentication/models/token.model.js +16 -1
  69. package/authentication/server/authentication-api-request-token.provider.js +52 -24
  70. package/authentication/server/authentication-credentials.repository.js +24 -1
  71. package/authentication/server/authentication-secret-requirements.validator.d.ts +11 -2
  72. package/authentication/server/authentication-secret-requirements.validator.js +58 -23
  73. package/authentication/server/authentication-secret-reset.handler.js +24 -1
  74. package/authentication/server/authentication-session.repository.js +24 -1
  75. package/authentication/server/authentication-subject.resolver.js +24 -5
  76. package/authentication/server/authentication-token-payload.provider.js +29 -5
  77. package/authentication/server/authentication.api-controller.js +114 -88
  78. package/authentication/server/authentication.service.d.ts +10 -3
  79. package/authentication/server/authentication.service.js +308 -264
  80. package/authentication/server/helper.js +87 -66
  81. package/authentication/server/index.js +28 -11
  82. package/authentication/server/module.d.ts +2 -1
  83. package/authentication/server/module.js +48 -25
  84. package/authentication/server/mongo/index.js +19 -2
  85. package/authentication/server/mongo/mongo-authentication-credentials.repository.d.ts +3 -3
  86. package/authentication/server/mongo/mongo-authentication-credentials.repository.js +84 -52
  87. package/authentication/server/mongo/mongo-authentication-session.repository.d.ts +3 -3
  88. package/authentication/server/mongo/mongo-authentication-session.repository.js +81 -49
  89. package/browser/browser-context-controller.d.ts +4 -4
  90. package/browser/browser-context-controller.js +106 -72
  91. package/browser/browser-controller.d.ts +12 -5
  92. package/browser/browser-controller.js +115 -74
  93. package/browser/browser.service.d.ts +12 -6
  94. package/browser/browser.service.js +117 -83
  95. package/browser/document-controller.js +81 -48
  96. package/browser/element-controller.d.ts +24 -0
  97. package/browser/element-controller.js +217 -139
  98. package/browser/frame-controller.js +50 -27
  99. package/browser/index.js +27 -10
  100. package/browser/locator-controller.js +59 -36
  101. package/browser/module.js +47 -23
  102. package/browser/page-controller.js +108 -89
  103. package/browser/pdf-options.js +103 -73
  104. package/browser/types.js +16 -1
  105. package/browser/utils.d.ts +2 -0
  106. package/browser/utils.js +116 -77
  107. package/collections/awaitable/awaitable-list.js +122 -99
  108. package/collections/awaitable/awaitable-map.js +116 -93
  109. package/collections/awaitable/awaitable-set.js +86 -63
  110. package/collections/awaitable/index.js +20 -3
  111. package/collections/collection.js +16 -1
  112. package/collections/index.js +23 -6
  113. package/collections/keyed-set.js +77 -53
  114. package/collections/list.js +16 -1
  115. package/collections/observable/index.js +25 -8
  116. package/collections/observable/observable-array.js +118 -95
  117. package/collections/observable/observable-collection-base.js +83 -60
  118. package/collections/observable/observable-collection.js +16 -1
  119. package/collections/observable/observable-list-base.js +78 -55
  120. package/collections/observable/observable-list.js +16 -1
  121. package/collections/observable/observable-map.js +79 -56
  122. package/collections/observable/observable-set.js +98 -75
  123. package/collections/observable/observable-sorted-array-list.js +188 -165
  124. package/collections/sorted-array-list.js +179 -156
  125. package/collections/sorted-list.js +16 -1
  126. package/collections/sorted-map.js +93 -70
  127. package/cookie/cookie.js +71 -49
  128. package/cookie/index.js +18 -1
  129. package/core.d.ts +4 -2
  130. package/core.js +82 -46
  131. package/data-structures/array-dictionary.js +110 -89
  132. package/data-structures/array-list.d.ts +1 -1
  133. package/data-structures/array-list.js +128 -105
  134. package/data-structures/cache.js +64 -41
  135. package/data-structures/circular-buffer.js +219 -195
  136. package/data-structures/collection.js +109 -86
  137. package/data-structures/dictionary.js +75 -51
  138. package/data-structures/distinct-collection.d.ts +24 -0
  139. package/data-structures/distinct-collection.js +77 -0
  140. package/data-structures/index-out-of-bounds.error.js +31 -8
  141. package/data-structures/index.d.ts +2 -1
  142. package/data-structures/index.js +33 -15
  143. package/data-structures/iterable-weak-map.js +149 -129
  144. package/data-structures/linked-list.js +385 -367
  145. package/data-structures/list.js +109 -78
  146. package/data-structures/map-dictionary.js +78 -55
  147. package/data-structures/multi-key-map.d.ts +1 -1
  148. package/data-structures/multi-key-map.js +163 -138
  149. package/data-structures/multi-key-set.d.ts +19 -0
  150. package/data-structures/multi-key-set.js +81 -0
  151. package/data-structures/{set.d.ts → set-collection.d.ts} +3 -3
  152. package/data-structures/set-collection.js +79 -0
  153. package/data-structures/sorted-array-list.d.ts +1 -1
  154. package/data-structures/sorted-array-list.js +166 -142
  155. package/data-structures/weak-ref-map.js +146 -123
  156. package/database/entity-repository.js +26 -2
  157. package/database/entity.js +16 -1
  158. package/database/id.js +29 -8
  159. package/database/index.js +23 -6
  160. package/database/module.js +33 -9
  161. package/database/mongo/classes.d.ts +5 -5
  162. package/database/mongo/classes.js +43 -13
  163. package/database/mongo/index.js +27 -10
  164. package/database/mongo/model/document.js +93 -62
  165. package/database/mongo/model/index.js +18 -1
  166. package/database/mongo/module.js +79 -51
  167. package/database/mongo/mongo-base.repository.js +283 -259
  168. package/database/mongo/mongo-bulk.js +110 -87
  169. package/database/mongo/mongo-entity-repository.d.ts +5 -5
  170. package/database/mongo/mongo-entity-repository.js +296 -270
  171. package/database/mongo/operations.js +76 -48
  172. package/database/mongo/query-converter.js +96 -73
  173. package/database/mongo/simple-entity-repository.js +28 -5
  174. package/database/mongo/types.js +25 -2
  175. package/database/query.js +36 -7
  176. package/database/utils.js +25 -2
  177. package/decorators/index.d.ts +1 -0
  178. package/decorators/index.js +18 -0
  179. package/decorators/log.d.ts +2 -0
  180. package/decorators/log.js +56 -0
  181. package/disposable/async-disposer.d.ts +4 -4
  182. package/disposable/async-disposer.js +105 -93
  183. package/disposable/disposable.js +33 -7
  184. package/disposable/index.js +20 -3
  185. package/disposable/using.js +37 -15
  186. package/distributed-loop/controller.js +16 -1
  187. package/distributed-loop/distributed-loop.d.ts +3 -3
  188. package/distributed-loop/distributed-loop.js +105 -78
  189. package/distributed-loop/index.js +20 -3
  190. package/distributed-loop/provider.js +48 -20
  191. package/enumerable/async-enumerable.js +261 -238
  192. package/enumerable/enumerable-methods.js +16 -1
  193. package/enumerable/enumerable.js +200 -177
  194. package/enumerable/index.js +19 -2
  195. package/environment.js +57 -25
  196. package/error/api.error.js +33 -10
  197. package/error/assertion.error.js +29 -6
  198. package/error/bad-request.error.js +29 -6
  199. package/error/custom.error.js +47 -25
  200. package/error/details.error.js +31 -8
  201. package/error/forbidden.error.js +29 -6
  202. package/error/index.js +33 -16
  203. package/error/invalid-token.error.js +29 -6
  204. package/error/max-bytes-exceeded.error.js +32 -9
  205. package/error/method-not-allowed.error.js +29 -6
  206. package/error/multi.error.js +31 -8
  207. package/error/not-found.error.js +29 -6
  208. package/error/not-implemented.error.js +29 -6
  209. package/error/not-supported.error.js +34 -11
  210. package/error/timeout.error.js +29 -6
  211. package/error/unauthorized.error.js +29 -6
  212. package/error/unsupported-media-type.error.js +29 -6
  213. package/examples/api/authentication.js +49 -42
  214. package/examples/api/basic-overview.js +85 -81
  215. package/examples/api/custom-authentication.js +69 -61
  216. package/examples/api/streaming.js +95 -90
  217. package/examples/browser/basic.js +21 -20
  218. package/examples/http/client.js +16 -13
  219. package/examples/mail/basic.js +42 -36
  220. package/examples/mail/templates/hello-name.js +33 -10
  221. package/examples/pdf/basic.js +49 -44
  222. package/examples/pdf/templates/hello-name.js +58 -35
  223. package/examples/reflection/basic.js +84 -52
  224. package/examples/template/basic.js +33 -30
  225. package/examples/template/templates/hello-jsx.js +32 -8
  226. package/examples/template/templates/hello-name.js +41 -18
  227. package/function/index.d.ts +1 -0
  228. package/function/index.js +18 -0
  229. package/function/log.d.ts +6 -0
  230. package/function/log.js +37 -0
  231. package/global-this.js +36 -17
  232. package/http/client/adapters/undici-http-client.adapter.js +111 -90
  233. package/http/client/http-client-options.d.ts +0 -5
  234. package/http/client/http-client-options.js +33 -14
  235. package/http/client/http-client-request.js +171 -149
  236. package/http/client/http-client-response.js +56 -33
  237. package/http/client/http-client.adapter.js +24 -1
  238. package/http/client/http-client.d.ts +5 -8
  239. package/http/client/http-client.js +325 -301
  240. package/http/client/index.js +23 -6
  241. package/http/client/middleware.d.ts +6 -0
  242. package/http/client/middleware.js +16 -0
  243. package/http/client/module.d.ts +6 -1
  244. package/http/client/module.js +42 -14
  245. package/http/client/tokens.d.ts +2 -0
  246. package/http/client/tokens.js +25 -0
  247. package/http/cookie-parser.js +42 -19
  248. package/http/http-body.js +75 -52
  249. package/http/http-form.js +37 -14
  250. package/http/http-headers.js +109 -86
  251. package/http/http-query.js +37 -14
  252. package/http/http-url-parameters.js +31 -8
  253. package/http/http-value-map.js +133 -110
  254. package/http/http.error.js +82 -60
  255. package/http/index.js +28 -11
  256. package/http/server/http-server-request.js +47 -24
  257. package/http/server/http-server-response.js +45 -22
  258. package/http/server/http-server.js +25 -2
  259. package/http/server/index.js +20 -3
  260. package/http/server/node/index.js +19 -2
  261. package/http/server/node/module.js +28 -8
  262. package/http/server/node/node-http-server.d.ts +1 -4
  263. package/http/server/node/node-http-server.js +230 -208
  264. package/http/types.js +47 -21
  265. package/http/utils.js +108 -92
  266. package/image-service/image-service.js +91 -59
  267. package/image-service/imgproxy/imgproxy-image-service.d.ts +6 -8
  268. package/image-service/imgproxy/imgproxy-image-service.js +125 -86
  269. package/image-service/imgproxy/index.js +18 -1
  270. package/image-service/index.js +18 -1
  271. package/import.js +25 -2
  272. package/index.js +18 -1
  273. package/injector/decorators.d.ts +81 -0
  274. package/injector/decorators.js +126 -0
  275. package/{container/index.js → injector/index.d.ts} +3 -2
  276. package/injector/index.js +28 -0
  277. package/injector/inject.d.ts +85 -0
  278. package/injector/inject.js +106 -0
  279. package/injector/injector.d.ts +91 -0
  280. package/injector/injector.js +497 -0
  281. package/injector/interfaces.d.ts +16 -0
  282. package/injector/interfaces.js +26 -0
  283. package/injector/provider.d.ts +49 -0
  284. package/injector/provider.js +64 -0
  285. package/injector/resolve-chain.d.ts +31 -0
  286. package/injector/resolve-chain.js +113 -0
  287. package/injector/resolve.error.d.ts +5 -0
  288. package/injector/resolve.error.js +36 -0
  289. package/injector/symbols.d.ts +2 -0
  290. package/injector/symbols.js +26 -0
  291. package/injector/token.d.ts +25 -0
  292. package/injector/token.js +41 -0
  293. package/injector/type-info.d.ts +20 -0
  294. package/injector/type-info.js +16 -0
  295. package/injector/types.d.ts +49 -0
  296. package/injector/types.js +16 -0
  297. package/interfaces.js +16 -1
  298. package/json-path/index.js +18 -1
  299. package/json-path/json-path.js +138 -138
  300. package/key-value-store/index.js +19 -2
  301. package/key-value-store/key-value-store.provider.js +24 -1
  302. package/key-value-store/key-value.store.d.ts +3 -3
  303. package/key-value-store/key-value.store.js +29 -6
  304. package/key-value-store/mongo/index.js +23 -6
  305. package/key-value-store/mongo/module.js +35 -17
  306. package/key-value-store/mongo/mongo-key-value-store.provider.js +48 -20
  307. package/key-value-store/mongo/mongo-key-value.model.js +16 -1
  308. package/key-value-store/mongo/mongo-key-value.repository.d.ts +3 -3
  309. package/key-value-store/mongo/mongo-key-value.repository.js +52 -22
  310. package/key-value-store/mongo/mongo-key-value.store.js +89 -59
  311. package/key-value-store/mongo/tokens.d.ts +1 -1
  312. package/key-value-store/mongo/tokens.js +25 -2
  313. package/lock/index.js +19 -2
  314. package/lock/lock.d.ts +3 -2
  315. package/lock/lock.js +29 -5
  316. package/lock/mongo/index.js +22 -5
  317. package/lock/mongo/lock.js +135 -111
  318. package/lock/mongo/model.js +16 -1
  319. package/lock/mongo/module.js +37 -18
  320. package/lock/mongo/mongo-lock-repository.d.ts +3 -3
  321. package/lock/mongo/mongo-lock-repository.js +85 -56
  322. package/lock/mongo/provider.js +68 -38
  323. package/lock/provider.d.ts +3 -2
  324. package/lock/provider.js +25 -1
  325. package/lock/web/index.js +20 -3
  326. package/lock/web/module.js +31 -11
  327. package/lock/web/web-lock.js +105 -80
  328. package/lock/web/web-lock.provider.js +57 -27
  329. package/logger/console/index.js +18 -1
  330. package/logger/console/logger.js +80 -53
  331. package/logger/index.js +19 -2
  332. package/logger/level.js +31 -8
  333. package/logger/logger.d.ts +3 -2
  334. package/logger/logger.js +61 -37
  335. package/logger/noop/index.js +18 -1
  336. package/logger/noop/logger.js +42 -20
  337. package/mail/clients/nodemailer.mail-client.js +91 -62
  338. package/mail/index.js +22 -5
  339. package/mail/mail-log.repository.js +25 -2
  340. package/mail/mail.client.d.ts +3 -2
  341. package/mail/mail.client.js +63 -34
  342. package/mail/mail.service.js +106 -73
  343. package/mail/models/index.js +23 -6
  344. package/mail/models/mail-address.model.js +16 -1
  345. package/mail/models/mail-content.model.js +16 -1
  346. package/mail/models/mail-data.model.js +16 -1
  347. package/mail/models/mail-log.model.js +16 -1
  348. package/mail/models/mail-send-result.model.js +16 -1
  349. package/mail/models/mail-template.model.js +28 -5
  350. package/mail/module.js +41 -21
  351. package/mail/repositories/mongo-mail-log.repository.d.ts +3 -3
  352. package/mail/repositories/mongo-mail-log.repository.js +56 -24
  353. package/mail/tokens.d.ts +1 -1
  354. package/mail/tokens.js +25 -2
  355. package/memory/finalization.js +60 -36
  356. package/memory/index.js +19 -2
  357. package/memory/observable-finalization-registry.js +32 -9
  358. package/message-bus/broadcast-channel/broadcast-channel-message-bus-provider.js +53 -23
  359. package/message-bus/broadcast-channel/broadcast-channel-message-bus.d.ts +1 -1
  360. package/message-bus/broadcast-channel/broadcast-channel-message-bus.js +74 -46
  361. package/message-bus/broadcast-channel/index.js +20 -3
  362. package/message-bus/broadcast-channel/module.js +31 -11
  363. package/message-bus/index.js +20 -3
  364. package/message-bus/local/index.js +20 -3
  365. package/message-bus/local/local-message-bus-provider.js +65 -35
  366. package/message-bus/local/local-message-bus.d.ts +1 -1
  367. package/message-bus/local/local-message-bus.js +66 -38
  368. package/message-bus/local/module.js +31 -11
  369. package/message-bus/local/types.js +16 -1
  370. package/message-bus/message-bus-base.js +63 -41
  371. package/message-bus/message-bus-provider.js +24 -1
  372. package/message-bus/message-bus.d.ts +3 -3
  373. package/message-bus/message-bus.js +29 -5
  374. package/migration/index.d.ts +1 -1
  375. package/migration/index.js +20 -3
  376. package/migration/migration-state-repository.js +25 -2
  377. package/migration/migration-state.js +16 -1
  378. package/migration/migrator.js +108 -80
  379. package/migration/mongo/index.js +19 -2
  380. package/migration/mongo/migration-state-repository.d.ts +3 -3
  381. package/migration/mongo/migration-state-repository.js +53 -23
  382. package/migration/mongo/module.js +34 -15
  383. package/module/index.js +21 -4
  384. package/module/module-base.js +60 -37
  385. package/module/module-metric-reporter.js +77 -58
  386. package/module/module.js +34 -10
  387. package/module/modules/function.module.js +34 -11
  388. package/module/modules/index.js +19 -2
  389. package/module/modules/web-server.module.d.ts +5 -10
  390. package/module/modules/web-server.module.js +83 -67
  391. package/module/utils.js +43 -19
  392. package/notification/api.js +50 -21
  393. package/notification/models/index.js +19 -2
  394. package/notification/models/notification-channel-job.model.js +16 -1
  395. package/notification/models/notification.model.js +103 -74
  396. package/notification/module.js +28 -8
  397. package/notification/notification-channel.service.js +24 -1
  398. package/notification/notification.repository.js +24 -1
  399. package/notification/notification.service.js +58 -30
  400. package/object-storage/index.js +20 -3
  401. package/object-storage/object-storage-provider.js +24 -1
  402. package/object-storage/object-storage.d.ts +3 -3
  403. package/object-storage/object-storage.js +30 -6
  404. package/object-storage/object.js +30 -7
  405. package/object-storage/s3/index.js +20 -3
  406. package/object-storage/s3/s3.object-storage-provider.js +109 -82
  407. package/object-storage/s3/s3.object-storage.d.ts +2 -2
  408. package/object-storage/s3/s3.object-storage.js +157 -130
  409. package/object-storage/s3/s3.object.js +62 -39
  410. package/openid-connect/cached-oidc-configuration.service.js +65 -35
  411. package/openid-connect/index.d.ts +1 -1
  412. package/openid-connect/index.js +28 -11
  413. package/openid-connect/mongo-oidc-state.repository.d.ts +3 -3
  414. package/openid-connect/mongo-oidc-state.repository.js +65 -38
  415. package/openid-connect/oidc-configuration.service.js +66 -38
  416. package/openid-connect/oidc-state.model.js +16 -1
  417. package/openid-connect/oidc-state.repository.js +25 -2
  418. package/openid-connect/oidc.service-model.js +16 -1
  419. package/openid-connect/oidc.service.js +187 -157
  420. package/package.json +18 -18
  421. package/password/have-i-been-pwned.js +39 -21
  422. package/password/index.js +21 -4
  423. package/password/password-check-result.model.js +63 -34
  424. package/password/password-check.js +76 -46
  425. package/password/password-check.localization.js +111 -86
  426. package/pdf/index.js +18 -1
  427. package/pdf/pdf.service.d.ts +3 -3
  428. package/pdf/pdf.service.js +206 -171
  429. package/pool/index.js +18 -1
  430. package/pool/pool.js +133 -116
  431. package/process-shutdown.d.ts +2 -2
  432. package/process-shutdown.js +75 -54
  433. package/promise/cancelable-promise.js +41 -23
  434. package/promise/deferred-promise.js +92 -68
  435. package/promise/index.js +20 -3
  436. package/promise/lazy-promise.js +47 -24
  437. package/queue/enqueue-batch.js +41 -18
  438. package/queue/index.js +20 -3
  439. package/queue/mongo/index.js +21 -4
  440. package/queue/mongo/job.js +16 -1
  441. package/queue/mongo/mongo-job.repository.d.ts +3 -3
  442. package/queue/mongo/mongo-job.repository.js +70 -44
  443. package/queue/mongo/queue.js +265 -242
  444. package/queue/mongo/queue.provider.d.ts +3 -3
  445. package/queue/mongo/queue.provider.js +72 -44
  446. package/queue/provider.js +24 -1
  447. package/queue/queue.d.ts +3 -3
  448. package/queue/queue.js +41 -15
  449. package/random/index.js +19 -2
  450. package/random/number-generator/index.js +20 -3
  451. package/random/number-generator/mulberry32.js +51 -34
  452. package/random/number-generator/random-number-generator-function.js +24 -1
  453. package/random/number-generator/random-number-generator.js +31 -8
  454. package/random/number-generator/seeded-random-number-generator.js +28 -5
  455. package/random/number-generator/sfc32.js +64 -41
  456. package/random/number-generator/utils.js +25 -2
  457. package/random/series.js +43 -41
  458. package/reflection/decorator-data.js +80 -63
  459. package/reflection/decorators.js +69 -39
  460. package/reflection/index.js +22 -5
  461. package/reflection/reflection-data-map.js +55 -32
  462. package/reflection/registry.d.ts +0 -1
  463. package/reflection/registry.js +130 -111
  464. package/reflection/types.js +16 -1
  465. package/reflection/utils.js +124 -96
  466. package/require.js +26 -3
  467. package/rpc/endpoints/message-port.rpc-endpoint.js +48 -29
  468. package/rpc/index.js +21 -4
  469. package/rpc/model.js +30 -7
  470. package/rpc/rpc-endpoint.js +40 -17
  471. package/rpc/rpc-error.js +40 -17
  472. package/rpc/rpc.js +235 -223
  473. package/rxjs/cast.js +28 -4
  474. package/rxjs/index.d.ts +1 -0
  475. package/rxjs/index.js +30 -12
  476. package/rxjs/intersection-observer.js +48 -25
  477. package/rxjs/media-query.js +27 -8
  478. package/rxjs/mutation-observer.js +50 -28
  479. package/rxjs/noop.js +28 -4
  480. package/rxjs/performance-observer.js +60 -37
  481. package/rxjs/resize-observer.js +50 -28
  482. package/rxjs/retry-backoff.js +47 -23
  483. package/rxjs/slow-array.js +36 -22
  484. package/rxjs/start-with-provider.d.ts +2 -0
  485. package/rxjs/start-with-provider.js +29 -0
  486. package/rxjs/teardown.js +44 -21
  487. package/rxjs/timing.js +57 -26
  488. package/rxjs/touch.js +30 -11
  489. package/schema/array-constraints/index.js +19 -2
  490. package/schema/array-constraints/maximum-length.js +42 -19
  491. package/schema/array-constraints/minimum-length.js +42 -19
  492. package/schema/coercers/boolean.coercer.js +49 -25
  493. package/schema/coercers/date.coercer.js +38 -14
  494. package/schema/coercers/index.js +23 -6
  495. package/schema/coercers/number.coercer.js +36 -12
  496. package/schema/coercers/regexp.coercer.js +41 -18
  497. package/schema/coercers/string.coercer.js +36 -12
  498. package/schema/coercers/uint8-array.coercer.js +44 -20
  499. package/schema/constraints/enumeration.js +49 -27
  500. package/schema/constraints/generic.js +41 -21
  501. package/schema/constraints/index.js +29 -12
  502. package/schema/constraints/integer.js +44 -20
  503. package/schema/constraints/length.js +36 -14
  504. package/schema/constraints/literal.js +44 -22
  505. package/schema/constraints/maximum-date.js +46 -23
  506. package/schema/constraints/maximum-length.js +45 -22
  507. package/schema/constraints/maximum.js +44 -21
  508. package/schema/constraints/minimum-date.js +46 -23
  509. package/schema/constraints/minimum-length.js +45 -22
  510. package/schema/constraints/minimum.js +44 -21
  511. package/schema/constraints/pattern.js +46 -23
  512. package/schema/decorators/class.js +26 -4
  513. package/schema/decorators/coerce.js +26 -4
  514. package/schema/decorators/constraint.js +28 -6
  515. package/schema/decorators/index.js +23 -6
  516. package/schema/decorators/property.js +38 -16
  517. package/schema/decorators/types.js +16 -1
  518. package/schema/decorators/utils.js +73 -45
  519. package/schema/index.js +27 -10
  520. package/schema/schema.error.js +72 -59
  521. package/schema/schema.js +274 -256
  522. package/schema/schemas/any.js +30 -7
  523. package/schema/schemas/array.js +44 -21
  524. package/schema/schemas/assign.js +46 -23
  525. package/schema/schemas/boolean.js +30 -7
  526. package/schema/schemas/constraint.js +29 -6
  527. package/schema/schemas/date.js +43 -20
  528. package/schema/schemas/defaulted.js +31 -8
  529. package/schema/schemas/enumeration.js +38 -15
  530. package/schema/schemas/index.js +43 -26
  531. package/schema/schemas/instance.js +26 -4
  532. package/schema/schemas/literal.js +38 -15
  533. package/schema/schemas/nullable.js +30 -7
  534. package/schema/schemas/number.js +48 -25
  535. package/schema/schemas/object.js +34 -10
  536. package/schema/schemas/omit.js +37 -14
  537. package/schema/schemas/one-or-many.js +35 -13
  538. package/schema/schemas/optional.js +30 -6
  539. package/schema/schemas/partial.js +39 -16
  540. package/schema/schemas/pick.js +37 -14
  541. package/schema/schemas/readable-stream.js +30 -7
  542. package/schema/schemas/record.js +31 -9
  543. package/schema/schemas/regexp.js +30 -7
  544. package/schema/schemas/string.js +59 -36
  545. package/schema/schemas/transform.js +29 -6
  546. package/schema/schemas/uint8-array.js +50 -27
  547. package/schema/schemas/union.js +34 -11
  548. package/schema/schemas/unknown.js +30 -7
  549. package/schema/transformers/generic.js +39 -16
  550. package/schema/transformers/index.js +21 -4
  551. package/schema/transformers/lowercase.js +33 -10
  552. package/schema/transformers/trim.js +33 -10
  553. package/schema/transformers/uppercase.js +33 -10
  554. package/schema/types/index.js +22 -5
  555. package/schema/types/schema-array-constraint.js +24 -1
  556. package/schema/types/schema-value-coercer.js +24 -1
  557. package/schema/types/schema-value-constraint.js +24 -1
  558. package/schema/types/schema-value-transformer.js +24 -1
  559. package/schema/types/types.js +191 -161
  560. package/schema/utils/index.js +19 -2
  561. package/schema/utils/schema.js +142 -120
  562. package/schema/utils/value-type.js +74 -51
  563. package/search-index/elastic/config.d.ts +3 -3
  564. package/search-index/elastic/config.js +50 -19
  565. package/search-index/elastic/index.js +23 -6
  566. package/search-index/elastic/keyword-rewriter.js +40 -17
  567. package/search-index/elastic/model/elastic-query.js +16 -1
  568. package/search-index/elastic/model/index-mapping.js +26 -4
  569. package/search-index/elastic/model/index.js +20 -3
  570. package/search-index/elastic/model/sort.js +16 -1
  571. package/search-index/elastic/module.d.ts +1 -1
  572. package/search-index/elastic/module.js +72 -39
  573. package/search-index/elastic/query-builder/boolean-query-builder.js +69 -46
  574. package/search-index/elastic/query-builder/index.js +18 -1
  575. package/search-index/elastic/query-converter.js +192 -174
  576. package/search-index/elastic/search-index.d.ts +2 -2
  577. package/search-index/elastic/search-index.js +153 -132
  578. package/search-index/elastic/sort-converter.js +34 -12
  579. package/search-index/elastic/types.js +16 -1
  580. package/search-index/error.js +35 -12
  581. package/search-index/index.js +20 -3
  582. package/search-index/memory/index.js +18 -1
  583. package/search-index/memory/memory-search-index.js +152 -130
  584. package/search-index/search-index.js +53 -30
  585. package/search-index/search-result.js +16 -1
  586. package/serializer/handlers/binary.js +47 -19
  587. package/serializer/handlers/date.js +28 -4
  588. package/serializer/handlers/error.js +31 -7
  589. package/serializer/handlers/index.js +24 -7
  590. package/serializer/handlers/map.js +40 -16
  591. package/serializer/handlers/regex.js +31 -7
  592. package/serializer/handlers/register.js +59 -36
  593. package/serializer/handlers/set.js +37 -13
  594. package/serializer/index.js +30 -3
  595. package/serializer/serializable.js +68 -43
  596. package/serializer/serializer.js +264 -244
  597. package/serializer/types.js +34 -6
  598. package/signals/api.d.ts +1 -1
  599. package/signals/api.js +48 -17
  600. package/signals/computed-with-dependencies.js +31 -8
  601. package/signals/effect-with-dependencies.js +31 -8
  602. package/signals/implementation/api.js +33 -33
  603. package/signals/implementation/computed.js +104 -125
  604. package/signals/implementation/configure.js +41 -18
  605. package/signals/implementation/effect.js +66 -48
  606. package/signals/implementation/errors.js +29 -5
  607. package/signals/implementation/graph.js +136 -164
  608. package/signals/implementation/index.js +27 -10
  609. package/signals/implementation/signal.js +101 -91
  610. package/signals/implementation/to-observable.js +38 -21
  611. package/signals/implementation/to-signal.js +60 -44
  612. package/signals/implementation/untracked.js +31 -15
  613. package/signals/implementation/watch.js +73 -58
  614. package/signals/index.d.ts +2 -0
  615. package/signals/index.js +26 -7
  616. package/signals/lazylize.d.ts +2 -0
  617. package/signals/lazylize.js +28 -0
  618. package/signals/pipe.d.ts +1 -1
  619. package/signals/pipe.js +33 -7
  620. package/signals/switch-map.js +27 -4
  621. package/signals/to-signal-2.d.ts +14 -0
  622. package/signals/to-signal-2.js +67 -0
  623. package/signals/types.js +16 -1
  624. package/signals/untracked-operator.js +33 -11
  625. package/sse/index.js +19 -2
  626. package/sse/model.js +16 -1
  627. package/sse/server-sent-events-source.js +76 -54
  628. package/sse/server-sent-events.js +72 -48
  629. package/supports.js +32 -5
  630. package/templates/index.js +26 -9
  631. package/templates/module.d.ts +2 -2
  632. package/templates/module.js +47 -40
  633. package/templates/providers/file.template-provider.d.ts +3 -3
  634. package/templates/providers/file.template-provider.js +82 -39
  635. package/templates/providers/memory.template-provider.js +55 -27
  636. package/templates/renderers/handlebars.template-renderer.js +122 -84
  637. package/templates/renderers/jsx.template-renderer.js +56 -28
  638. package/templates/renderers/mjml.template-renderer.js +82 -42
  639. package/templates/renderers/string.template-renderer.js +52 -24
  640. package/templates/resolvers/file.template-resolver.d.ts +3 -3
  641. package/templates/resolvers/file.template-resolver.js +90 -45
  642. package/templates/resolvers/jsx.template-resolver.js +59 -29
  643. package/templates/resolvers/string.template-resolver.js +59 -29
  644. package/templates/template-renderer.provider.js +66 -36
  645. package/templates/template-resolver.provider.js +66 -36
  646. package/templates/template.model.js +69 -39
  647. package/templates/template.provider.js +24 -1
  648. package/templates/template.renderer.js +34 -11
  649. package/templates/template.resolver.js +24 -1
  650. package/templates/template.service.js +82 -49
  651. package/templates/tokens.d.ts +2 -2
  652. package/templates/tokens.js +27 -3
  653. package/templates/types/jsx.intrinsic-elements.js +16 -1
  654. package/text/dynamic-text.model.js +69 -41
  655. package/text/index.js +20 -3
  656. package/text/localizable-text.model.js +16 -1
  657. package/text/localization.service.js +229 -196
  658. package/theme/adapters/css-adapter.js +46 -23
  659. package/theme/adapters/tailwind-adapter.js +52 -29
  660. package/theme/index.js +18 -1
  661. package/theme/theme-service.d.ts +1 -1
  662. package/theme/theme-service.js +147 -107
  663. package/threading/index.js +19 -2
  664. package/threading/thread-pool.js +70 -48
  665. package/threading/thread-worker.js +26 -3
  666. package/tokens.d.ts +1 -1
  667. package/tokens.js +25 -2
  668. package/types/geo-json.js +16 -1
  669. package/types.js +16 -2
  670. package/utils/alphabet.js +35 -12
  671. package/utils/any-iterable-iterator.js +27 -4
  672. package/utils/array/array-backtracker.js +65 -42
  673. package/utils/array/array.js +79 -76
  674. package/utils/array/index.js +19 -2
  675. package/utils/async-iterable-helpers/all.js +46 -25
  676. package/utils/async-iterable-helpers/any.js +46 -25
  677. package/utils/async-iterable-helpers/assert.js +43 -22
  678. package/utils/async-iterable-helpers/batch.js +46 -26
  679. package/utils/async-iterable-helpers/buffer.js +64 -47
  680. package/utils/async-iterable-helpers/concat.js +27 -5
  681. package/utils/async-iterable-helpers/default-if-empty.js +32 -9
  682. package/utils/async-iterable-helpers/deferred.js +26 -3
  683. package/utils/async-iterable-helpers/difference.js +48 -24
  684. package/utils/async-iterable-helpers/distinct.js +44 -23
  685. package/utils/async-iterable-helpers/drain.js +26 -4
  686. package/utils/async-iterable-helpers/filter.js +44 -23
  687. package/utils/async-iterable-helpers/first-or-default.js +30 -8
  688. package/utils/async-iterable-helpers/first.js +30 -8
  689. package/utils/async-iterable-helpers/for-each.js +38 -18
  690. package/utils/async-iterable-helpers/group-single.js +26 -3
  691. package/utils/async-iterable-helpers/group-to-map.js +41 -20
  692. package/utils/async-iterable-helpers/group-to-single-map.js +44 -23
  693. package/utils/async-iterable-helpers/group.js +26 -3
  694. package/utils/async-iterable-helpers/includes.js +28 -7
  695. package/utils/async-iterable-helpers/index.js +65 -48
  696. package/utils/async-iterable-helpers/interrupt.js +43 -19
  697. package/utils/async-iterable-helpers/is-async-iterable.js +29 -5
  698. package/utils/async-iterable-helpers/last-or-default.js +36 -13
  699. package/utils/async-iterable-helpers/last.js +36 -13
  700. package/utils/async-iterable-helpers/map-many.js +40 -19
  701. package/utils/async-iterable-helpers/map.js +40 -19
  702. package/utils/async-iterable-helpers/materialize.js +42 -21
  703. package/utils/async-iterable-helpers/metadata.js +58 -38
  704. package/utils/async-iterable-helpers/multiplex.js +44 -23
  705. package/utils/async-iterable-helpers/observable-iterable.js +53 -31
  706. package/utils/async-iterable-helpers/pairwise.js +44 -26
  707. package/utils/async-iterable-helpers/parallel/feed.js +45 -24
  708. package/utils/async-iterable-helpers/parallel/filter.js +31 -8
  709. package/utils/async-iterable-helpers/parallel/for-each.js +44 -21
  710. package/utils/async-iterable-helpers/parallel/group.js +32 -9
  711. package/utils/async-iterable-helpers/parallel/index.js +24 -7
  712. package/utils/async-iterable-helpers/parallel/map.js +29 -6
  713. package/utils/async-iterable-helpers/parallel/tap.js +29 -6
  714. package/utils/async-iterable-helpers/parallel/types.js +16 -1
  715. package/utils/async-iterable-helpers/reduce.js +46 -31
  716. package/utils/async-iterable-helpers/retry.js +58 -43
  717. package/utils/async-iterable-helpers/single-or-default.js +40 -17
  718. package/utils/async-iterable-helpers/single.js +42 -19
  719. package/utils/async-iterable-helpers/skip.js +26 -3
  720. package/utils/async-iterable-helpers/sort.js +29 -6
  721. package/utils/async-iterable-helpers/take-until.js +49 -32
  722. package/utils/async-iterable-helpers/take-while.js +46 -29
  723. package/utils/async-iterable-helpers/take.js +33 -10
  724. package/utils/async-iterable-helpers/tap.js +40 -19
  725. package/utils/async-iterable-helpers/throttle.js +30 -9
  726. package/utils/async-iterable-helpers/to-array.js +33 -10
  727. package/utils/async-iterable-helpers/to-async-iterable-iterator.js +59 -40
  728. package/utils/async-iterable-helpers/to-async-iterator.js +54 -32
  729. package/utils/async-iterable-helpers/to-set.js +33 -10
  730. package/utils/async-iterable-helpers/to-sync-iterable.js +27 -6
  731. package/utils/async-iterable-helpers/types.js +16 -1
  732. package/utils/async-iterable-helpers/while.js +46 -25
  733. package/utils/async-iterator-iterable-iterator.js +62 -41
  734. package/utils/backoff.js +109 -109
  735. package/utils/base64.js +140 -153
  736. package/utils/benchmark.js +107 -114
  737. package/utils/binary-search.js +87 -70
  738. package/utils/binary.js +61 -50
  739. package/utils/cancellation-token.js +140 -120
  740. package/utils/clone.js +64 -43
  741. package/utils/comparison.js +98 -76
  742. package/utils/compression.js +118 -107
  743. package/utils/config-parser.js +48 -21
  744. package/utils/crc32.js +42 -20
  745. package/utils/cryptography.js +121 -163
  746. package/utils/date-time.js +138 -102
  747. package/utils/encoding.js +60 -62
  748. package/utils/enum.js +53 -27
  749. package/utils/equals.js +119 -103
  750. package/utils/event-loop.js +39 -19
  751. package/utils/factory-map.js +75 -53
  752. package/utils/feedable-async-iterable.js +70 -47
  753. package/utils/file-reader.js +41 -15
  754. package/utils/format-error.js +57 -36
  755. package/utils/format.js +53 -32
  756. package/utils/function/index.js +19 -2
  757. package/utils/function/memoize.js +53 -38
  758. package/utils/function/throttle.js +48 -26
  759. package/utils/helpers.js +102 -93
  760. package/utils/image.js +88 -62
  761. package/utils/index.js +65 -48
  762. package/utils/iterable-helpers/all.js +31 -8
  763. package/utils/iterable-helpers/any.js +31 -8
  764. package/utils/iterable-helpers/assert.js +30 -7
  765. package/utils/iterable-helpers/batch.js +34 -11
  766. package/utils/iterable-helpers/concat.js +27 -4
  767. package/utils/iterable-helpers/default-if-empty.js +32 -9
  768. package/utils/iterable-helpers/deferred.js +25 -2
  769. package/utils/iterable-helpers/difference.js +45 -21
  770. package/utils/iterable-helpers/distinct.js +32 -9
  771. package/utils/iterable-helpers/drain.js +26 -4
  772. package/utils/iterable-helpers/filter.js +30 -7
  773. package/utils/iterable-helpers/first-or-default.js +30 -8
  774. package/utils/iterable-helpers/first.js +30 -8
  775. package/utils/iterable-helpers/for-each.js +28 -5
  776. package/utils/iterable-helpers/group-single.js +26 -3
  777. package/utils/iterable-helpers/group-to-map.js +32 -9
  778. package/utils/iterable-helpers/group-to-single-map.js +33 -10
  779. package/utils/iterable-helpers/group.js +26 -3
  780. package/utils/iterable-helpers/includes.js +26 -3
  781. package/utils/iterable-helpers/index.js +56 -39
  782. package/utils/iterable-helpers/is-iterable.js +29 -5
  783. package/utils/iterable-helpers/last-or-default.js +36 -13
  784. package/utils/iterable-helpers/last.js +36 -13
  785. package/utils/iterable-helpers/map-many.js +29 -6
  786. package/utils/iterable-helpers/map.js +29 -6
  787. package/utils/iterable-helpers/materialize.js +25 -2
  788. package/utils/iterable-helpers/metadata.js +38 -16
  789. package/utils/iterable-helpers/pairwise.js +33 -11
  790. package/utils/iterable-helpers/range.js +27 -4
  791. package/utils/iterable-helpers/reduce.js +33 -11
  792. package/utils/iterable-helpers/single-or-default.js +37 -14
  793. package/utils/iterable-helpers/single.js +40 -17
  794. package/utils/iterable-helpers/skip.js +29 -6
  795. package/utils/iterable-helpers/sort.js +27 -4
  796. package/utils/iterable-helpers/take-until.js +31 -8
  797. package/utils/iterable-helpers/take-while.js +33 -10
  798. package/utils/iterable-helpers/take.js +33 -10
  799. package/utils/iterable-helpers/tap.js +29 -6
  800. package/utils/iterable-helpers/types.js +16 -1
  801. package/utils/iterable-helpers/while.js +31 -8
  802. package/utils/jwt.js +100 -77
  803. package/utils/map.js +62 -35
  804. package/utils/math.js +64 -102
  805. package/utils/merge.js +45 -26
  806. package/utils/middleware.js +60 -36
  807. package/utils/moving-metric.js +188 -155
  808. package/utils/noop.js +27 -4
  809. package/utils/object/decycle.js +78 -57
  810. package/utils/object/dereference.js +44 -46
  811. package/utils/object/forward-ref.js +73 -57
  812. package/utils/object/index.js +24 -7
  813. package/utils/object/lazy-property.js +96 -81
  814. package/utils/object/merge.js +70 -48
  815. package/utils/object/object.js +136 -106
  816. package/utils/object/property-name.js +72 -69
  817. package/utils/ordered-feedable-async-iterable.js +65 -42
  818. package/utils/patch-worker.js +90 -69
  819. package/utils/patterns.js +29 -7
  820. package/utils/periodic-reporter.js +82 -60
  821. package/utils/periodic-sampler.js +91 -67
  822. package/utils/provider-function-iterable.js +48 -26
  823. package/utils/proxy.js +42 -17
  824. package/utils/random.js +50 -40
  825. package/utils/reflection.js +41 -13
  826. package/utils/repl.js +33 -14
  827. package/utils/set.js +62 -36
  828. package/utils/singleton.js +41 -18
  829. package/utils/sort.js +77 -53
  830. package/utils/stream/finalize-stream.js +62 -43
  831. package/utils/stream/index.js +23 -6
  832. package/utils/stream/readable-stream-adapter.js +57 -35
  833. package/utils/stream/readable-stream-from-promise.js +28 -7
  834. package/utils/stream/size-limited-stream.js +35 -12
  835. package/utils/stream/stream-helper-types.js +16 -1
  836. package/utils/stream/stream-reader.js +52 -30
  837. package/utils/string/hypenate.js +25 -2
  838. package/utils/string/index.js +20 -3
  839. package/utils/string/title-case.js +26 -6
  840. package/utils/string/trim.js +32 -9
  841. package/utils/throw.js +30 -7
  842. package/utils/timer.js +91 -70
  843. package/utils/timing.js +80 -52
  844. package/utils/type-guards.js +1076 -253
  845. package/utils/type-of.js +43 -25
  846. package/utils/units.js +124 -53
  847. package/utils/url-builder.js +68 -47
  848. package/utils/value-or-provider.js +29 -6
  849. package/utils/z-base32.js +63 -42
  850. package/web-types.js +16 -1
  851. package/container/container.js +0 -428
  852. package/container/decorators.js +0 -126
  853. package/container/interfaces.js +0 -2
  854. package/container/provider.js +0 -29
  855. package/container/resolve-chain.js +0 -80
  856. package/container/resolve.error.js +0 -11
  857. package/container/token.js +0 -20
  858. package/container/type-info.js +0 -1
  859. package/container/types.js +0 -1
  860. package/container/utils.js +0 -20
  861. package/data-structures/set.js +0 -56
  862. /package/{container → _container}/container.d.ts +0 -0
  863. /package/{container → _container}/decorators.d.ts +0 -0
  864. /package/{container → _container}/index.d.ts +0 -0
  865. /package/{container → _container}/interfaces.d.ts +0 -0
  866. /package/{container → _container}/provider.d.ts +0 -0
  867. /package/{container → _container}/resolve-chain.d.ts +0 -0
  868. /package/{container → _container}/resolve.error.d.ts +0 -0
  869. /package/{container → _container}/token.d.ts +0 -0
  870. /package/{container → _container}/type-info.d.ts +0 -0
  871. /package/{container → _container}/types.d.ts +0 -0
  872. /package/{container → _container}/utils.d.ts +0 -0
@@ -1,231 +1,264 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
6
9
  };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
9
17
  };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var localization_service_exports = {};
20
+ __export(localization_service_exports, {
21
+ LocalizationService: () => LocalizationService,
22
+ autoEnumerationLocalization: () => autoEnumerationLocalization,
23
+ enumerationLocalization: () => enumerationLocalization,
24
+ getLocalizationKeys: () => getLocalizationKeys,
25
+ getProxyLocalizationKey: () => getProxyLocalizationKey,
26
+ isEnumLocalizationKey: () => isEnumLocalizationKey,
27
+ isLocalizationDataObject: () => isLocalizationDataObject,
28
+ isLocalizeItem: () => isLocalizeItem,
29
+ isProxyLocalizationKey: () => isProxyLocalizationKey,
30
+ localizationData: () => localizationData
31
+ });
32
+ module.exports = __toCommonJS(localization_service_exports);
33
+ var import_details_error = require("../error/details.error.js");
34
+ var import_decorators = require("../injector/decorators.js");
35
+ var import_logger = require("../logger/index.js");
36
+ var import_api = require("../signals/api.js");
37
+ var import_enum = require("../utils/enum.js");
38
+ var import_memoize = require("../utils/function/memoize.js");
39
+ var import_object = require("../utils/object/object.js");
40
+ var import_property_name = require("../utils/object/property-name.js");
41
+ var import_type_guards = require("../utils/type-guards.js");
42
+ var __decorate = function(decorators, target, key, desc) {
43
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
45
+ r = Reflect.decorate(decorators, target, key, desc);
46
+ else
47
+ for (var i = decorators.length - 1; i >= 0; i--)
48
+ if (d = decorators[i])
49
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
50
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
51
  };
13
- import { resolveArg, singleton } from '../container/index.js';
14
- import { DetailsError } from '../error/details.error.js';
15
- import { Logger } from '../logger/index.js';
16
- import { computed, signal, toObservable } from '../signals/api.js';
17
- import { enumEntries, enumValueName } from '../utils/enum.js';
18
- import { memoize } from '../utils/function/memoize.js';
19
- import { deepObjectEntries, hasOwnProperty } from '../utils/object/object.js';
20
- import { getPropertyName, getPropertyNameProxy, isPropertyName, propertyName } from '../utils/object/property-name.js';
21
- import { assertDefinedPass, isArray, isDefined, isFunction, isNotNull, isNull, isNullOrUndefined, isObject, isString, isUndefined } from '../utils/type-guards.js';
22
- export function getProxyLocalizationKey(key) {
23
- return getPropertyName(key);
52
+ var __metadata = function(k, v) {
53
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
54
+ return Reflect.metadata(k, v);
55
+ };
56
+ var __param = function(paramIndex, decorator) {
57
+ return function(target, key) {
58
+ decorator(target, key, paramIndex);
59
+ };
60
+ };
61
+ function getProxyLocalizationKey(key) {
62
+ return (0, import_property_name.getPropertyName)(key);
24
63
  }
25
- export function isProxyLocalizationKey(value) {
26
- return isPropertyName(value);
64
+ function isProxyLocalizationKey(value) {
65
+ return (0, import_property_name.isPropertyName)(value);
27
66
  }
28
- export function isEnumLocalizationKey(key) {
29
- return isObject(key) && hasOwnProperty(key, 'enum');
67
+ function isEnumLocalizationKey(key) {
68
+ return (0, import_type_guards.isObject)(key) && (0, import_object.hasOwnProperty)(key, "enum");
30
69
  }
31
- export function isLocalizationDataObject(value) {
32
- return isObject(value) && hasOwnProperty(value, 'key');
70
+ function isLocalizationDataObject(value) {
71
+ return (0, import_type_guards.isObject)(value) && (0, import_object.hasOwnProperty)(value, "key");
33
72
  }
34
- export function localizationData(keyOrData, parameters) {
35
- if (isString(keyOrData) || isProxyLocalizationKey(keyOrData)) {
36
- return { key: keyOrData, parameters };
37
- }
38
- return keyOrData;
73
+ function localizationData(keyOrData, parameters) {
74
+ if ((0, import_type_guards.isString)(keyOrData) || isProxyLocalizationKey(keyOrData)) {
75
+ return { key: keyOrData, parameters };
76
+ }
77
+ return keyOrData;
39
78
  }
40
- /**
41
- * returns a Proxy which simply returns the key you accessed. Can be used to have typesafe localizations (in templates and the API) by not relying on plain strings
42
- * @param localization
43
- * @returns
44
- */
45
- export function getLocalizationKeys(_localization) {
46
- return getPropertyNameProxy();
79
+ function getLocalizationKeys(_localization) {
80
+ return (0, import_property_name.getPropertyNameProxy)();
47
81
  }
48
- export const autoEnumerationLocalization = memoize(_autoEnumerationLocalization);
82
+ const autoEnumerationLocalization = (0, import_memoize.memoize)(_autoEnumerationLocalization);
49
83
  const parametersPattern = /(?:\{\{\s*(?<parameter>\w+)\s*\}\})/ug;
50
- const warnedMissingKeys = new Set();
51
- export let LocalizationService = class LocalizationService {
52
- #logger;
53
- #localizations = new Map();
54
- #activeLanguage = signal(null);
55
- #availableLanguages = signal([]);
56
- #activeLocalization = computed(() => {
57
- const language = this.#activeLanguage();
58
- if (isNull(language)) {
59
- return null;
60
- }
61
- return this.#localizations.get(language.code);
62
- });
63
- activeLanguage = this.#activeLanguage.asReadonly();
64
- availableLanguages = this.#availableLanguages.asReadonly();
65
- activeLanguage$ = toObservable(this.activeLanguage);
66
- availableLanguages$ = toObservable(this.availableLanguages);
67
- constructor(logger) {
68
- this.#logger = logger;
69
- }
70
- registerLocalization(...localizations) {
71
- for (const localization of localizations) {
72
- const mappedLocalization = buildMappedLocalization(localization);
73
- if (this.#localizations.has(localization.language.code)) {
74
- const existing = this.#localizations.get(localization.language.code);
75
- const merged = mergeMappedLocalization(existing, mappedLocalization);
76
- this.#localizations.set(localization.language.code, merged);
77
- }
78
- else {
79
- this.#localizations.set(localization.language.code, mappedLocalization);
80
- }
81
- const availableLanguages = [...this.#localizations].map(([, loc]) => loc.language);
82
- this.#availableLanguages.set(availableLanguages);
83
- if (isNullOrUndefined(this.#activeLanguage())) {
84
- this.setLanguage(localization.language.code);
85
- }
86
- }
87
- }
88
- hasLanguage(languageCode) {
89
- return this.#localizations.has(languageCode);
90
- }
91
- getLanguage(languageCode) {
92
- return assertDefinedPass(this.#localizations.get(languageCode), 'language not available').language;
93
- }
94
- setLanguage(languageOrCode) {
95
- const language = isString(languageOrCode) ? this.#localizations.get(languageOrCode)?.language : languageOrCode;
96
- if (isUndefined(language) || !this.#localizations.has(language.code)) {
97
- throw new Error('Language not registered.');
98
- }
99
- this.#activeLanguage.set(language);
84
+ const warnedMissingKeys = /* @__PURE__ */ new Set();
85
+ let LocalizationService = class LocalizationService2 {
86
+ #logger;
87
+ #localizations = /* @__PURE__ */ new Map();
88
+ #activeLanguage = (0, import_api.signal)(null);
89
+ #availableLanguages = (0, import_api.signal)([]);
90
+ #activeLocalization = (0, import_api.computed)(() => {
91
+ const language = this.#activeLanguage();
92
+ if ((0, import_type_guards.isNull)(language)) {
93
+ return null;
100
94
  }
101
- setLocalization(localization) {
95
+ return this.#localizations.get(language.code);
96
+ });
97
+ activeLanguage = this.#activeLanguage.asReadonly();
98
+ availableLanguages = this.#availableLanguages.asReadonly();
99
+ activeLanguage$ = (0, import_api.toObservable)(this.activeLanguage);
100
+ availableLanguages$ = (0, import_api.toObservable)(this.availableLanguages);
101
+ constructor(logger) {
102
+ this.#logger = logger;
103
+ }
104
+ registerLocalization(...localizations) {
105
+ for (const localization of localizations) {
106
+ const mappedLocalization = buildMappedLocalization(localization);
107
+ if (this.#localizations.has(localization.language.code)) {
108
+ const existing = this.#localizations.get(localization.language.code);
109
+ const merged = mergeMappedLocalization(existing, mappedLocalization);
110
+ this.#localizations.set(localization.language.code, merged);
111
+ } else {
112
+ this.#localizations.set(localization.language.code, mappedLocalization);
113
+ }
114
+ const availableLanguages = [...this.#localizations].map(([, loc]) => loc.language);
115
+ this.#availableLanguages.set(availableLanguages);
116
+ if ((0, import_type_guards.isNullOrUndefined)(this.#activeLanguage())) {
102
117
  this.setLanguage(localization.language.code);
118
+ }
103
119
  }
104
- tryGetItem(keyOrData) {
105
- const activeLanguageCode = this.#activeLanguage()?.code;
106
- if (isUndefined(activeLanguageCode)) {
107
- return undefined;
108
- }
109
- if (isEnumLocalizationKey(keyOrData)) {
110
- const enumEntry = this.#localizations.get(activeLanguageCode)?.enums.get(keyOrData.enum);
111
- return isDefined(keyOrData.value) ? enumEntry?.values[keyOrData.value] : enumEntry?.name;
112
- }
113
- const actualKey = getStringKey(keyOrData);
114
- return this.#localizations.get(activeLanguageCode)?.keys.get(actualKey);
120
+ }
121
+ hasLanguage(languageCode) {
122
+ return this.#localizations.has(languageCode);
123
+ }
124
+ getLanguage(languageCode) {
125
+ return (0, import_type_guards.assertDefinedPass)(this.#localizations.get(languageCode), "language not available").language;
126
+ }
127
+ setLanguage(languageOrCode) {
128
+ const language = (0, import_type_guards.isString)(languageOrCode) ? this.#localizations.get(languageOrCode)?.language : languageOrCode;
129
+ if ((0, import_type_guards.isUndefined)(language) || !this.#localizations.has(language.code)) {
130
+ throw new Error("Language not registered.");
115
131
  }
116
- hasKey(key) {
117
- const item = this.tryGetItem(key);
118
- return isDefined(item);
132
+ this.#activeLanguage.set(language);
133
+ }
134
+ setLocalization(localization) {
135
+ this.setLanguage(localization.language.code);
136
+ }
137
+ tryGetItem(keyOrData) {
138
+ const activeLanguageCode = this.#activeLanguage()?.code;
139
+ if ((0, import_type_guards.isUndefined)(activeLanguageCode)) {
140
+ return void 0;
119
141
  }
120
- // eslint-disable-next-line max-statements
121
- localizeOnce(keyOrData) {
122
- if (isEnumLocalizationKey(keyOrData)) {
123
- return this.localizeEnumOnce(keyOrData.enum, keyOrData.value, keyOrData.parameters);
124
- }
125
- const key = getStringKey(keyOrData);
126
- const parameters = (isString(keyOrData) || isProxyLocalizationKey(keyOrData)) ? {} : keyOrData.parameters;
127
- const activeLanguageCode = this.#activeLanguage()?.code;
128
- const templateOrFunction = isDefined(activeLanguageCode) ? this.#localizations.get(activeLanguageCode)?.keys.get(key) : undefined;
129
- if (isUndefined(templateOrFunction)) {
130
- if (!warnedMissingKeys.has(key)) {
131
- this.#logger.warn(`Localization for ${key} not available.`);
132
- warnedMissingKeys.add(key);
133
- }
134
- }
135
- return this.localizeItem(key, templateOrFunction, parameters);
142
+ if (isEnumLocalizationKey(keyOrData)) {
143
+ const enumEntry = this.#localizations.get(activeLanguageCode)?.enums.get(keyOrData.enum);
144
+ return (0, import_type_guards.isDefined)(keyOrData.value) ? enumEntry?.values[keyOrData.value] : enumEntry?.name;
136
145
  }
137
- localizeEnumOnce(enumeration, value, parameters) {
138
- if (isUndefined(value)) {
139
- const name = this.#activeLocalization()?.enums.get(enumeration)?.name;
140
- return this.localizeItem('ENUM', name, parameters);
141
- }
142
- const key = isArray(enumeration) ? value : enumValueName(enumeration, value);
143
- const item = this.#activeLocalization()?.enums.get(enumeration)?.values[value];
144
- if (isUndefined(item)) {
145
- return autoEnumerationLocalization(enumeration)[2][value];
146
- }
147
- return this.localizeItem(key, item, parameters);
146
+ const actualKey = getStringKey(keyOrData);
147
+ return this.#localizations.get(activeLanguageCode)?.keys.get(actualKey);
148
+ }
149
+ hasKey(key) {
150
+ const item = this.tryGetItem(key);
151
+ return (0, import_type_guards.isDefined)(item);
152
+ }
153
+ // eslint-disable-next-line max-statements
154
+ localizeOnce(keyOrData) {
155
+ if (isEnumLocalizationKey(keyOrData)) {
156
+ return this.localizeEnumOnce(keyOrData.enum, keyOrData.value, keyOrData.parameters);
148
157
  }
149
- localize(data) {
150
- return computed(() => this.localizeOnce(data));
158
+ const key = getStringKey(keyOrData);
159
+ const parameters = (0, import_type_guards.isString)(keyOrData) || isProxyLocalizationKey(keyOrData) ? {} : keyOrData.parameters;
160
+ const activeLanguageCode = this.#activeLanguage()?.code;
161
+ const templateOrFunction = (0, import_type_guards.isDefined)(activeLanguageCode) ? this.#localizations.get(activeLanguageCode)?.keys.get(key) : void 0;
162
+ if ((0, import_type_guards.isUndefined)(templateOrFunction)) {
163
+ if (!warnedMissingKeys.has(key)) {
164
+ this.#logger.warn(`Localization for ${key} not available.`);
165
+ warnedMissingKeys.add(key);
166
+ }
151
167
  }
152
- localizeEnum(enumeration, value, parameters) {
153
- return computed(() => this.localizeEnumOnce(enumeration, value, parameters));
168
+ return this.localizeItem(key, templateOrFunction, parameters);
169
+ }
170
+ localizeEnumOnce(enumeration, value, parameters) {
171
+ if ((0, import_type_guards.isUndefined)(value)) {
172
+ const name = this.#activeLocalization()?.enums.get(enumeration)?.name;
173
+ return this.localizeItem("ENUM", name, parameters);
154
174
  }
155
- localize$(data) {
156
- return toObservable(this.localize(data));
175
+ const key = (0, import_type_guards.isArray)(enumeration) ? value : (0, import_enum.enumValueName)(enumeration, value);
176
+ const item = this.#activeLocalization()?.enums.get(enumeration)?.values[value];
177
+ if ((0, import_type_guards.isUndefined)(item)) {
178
+ return autoEnumerationLocalization(enumeration)[2][value];
157
179
  }
158
- localizeEnum$(enumeration, value, parameters) {
159
- return toObservable(this.localizeEnum(enumeration, value, parameters));
180
+ return this.localizeItem(key, item, parameters);
181
+ }
182
+ localize(data) {
183
+ return (0, import_api.computed)(() => this.localizeOnce(data));
184
+ }
185
+ localizeEnum(enumeration, value, parameters) {
186
+ return (0, import_api.computed)(() => this.localizeEnumOnce(enumeration, value, parameters));
187
+ }
188
+ localize$(data) {
189
+ return (0, import_api.toObservable)(this.localize(data));
190
+ }
191
+ localizeEnum$(enumeration, value, parameters) {
192
+ return (0, import_api.toObservable)(this.localizeEnum(enumeration, value, parameters));
193
+ }
194
+ localizeItem(key, templateOrFunction, parameters) {
195
+ if ((0, import_type_guards.isUndefined)(templateOrFunction)) {
196
+ return `__${key}__`;
160
197
  }
161
- localizeItem(key, templateOrFunction, parameters) {
162
- if (isUndefined(templateOrFunction)) {
163
- return `__${key}__`;
164
- }
165
- if (isFunction(templateOrFunction)) {
166
- return templateOrFunction(parameters);
167
- }
168
- const template = templateOrFunction;
169
- const templateParameters = ((isNotNull(parameters) && isObject(parameters)) ? parameters : {});
170
- const matches = template.matchAll(parametersPattern);
171
- let currentIndex = 0;
172
- let result = '';
173
- for (const { 0: match, index, groups } of matches) {
174
- const parameterName = groups['parameter'];
175
- result += template.slice(currentIndex, index);
176
- result += templateParameters[parameterName] ?? `__${parameterName}__`;
177
- currentIndex = index + match.length;
178
- }
179
- result += template.slice(currentIndex);
180
- return result;
198
+ if ((0, import_type_guards.isFunction)(templateOrFunction)) {
199
+ return templateOrFunction(parameters);
181
200
  }
201
+ const template = templateOrFunction;
202
+ const templateParameters = (0, import_type_guards.isNotNull)(parameters) && (0, import_type_guards.isObject)(parameters) ? parameters : {};
203
+ const matches = template.matchAll(parametersPattern);
204
+ let currentIndex = 0;
205
+ let result = "";
206
+ for (const { 0: match, index, groups } of matches) {
207
+ const parameterName = groups["parameter"];
208
+ result += template.slice(currentIndex, index);
209
+ result += templateParameters[parameterName] ?? `__${parameterName}__`;
210
+ currentIndex = index + match.length;
211
+ }
212
+ result += template.slice(currentIndex);
213
+ return result;
214
+ }
182
215
  };
183
216
  LocalizationService = __decorate([
184
- singleton(),
185
- __param(0, resolveArg('LocalizationService')),
186
- __metadata("design:paramtypes", [Logger])
217
+ (0, import_decorators.Singleton)(),
218
+ __param(0, (0, import_decorators.ResolveArg)("LocalizationService")),
219
+ __metadata("design:paramtypes", [import_logger.Logger])
187
220
  ], LocalizationService);
188
- export function enumerationLocalization(enumeration, nameOrLocalization, localizationOrNothing) {
189
- return [enumeration, isLocalizeItem(nameOrLocalization) ? nameOrLocalization : undefined, localizationOrNothing ?? nameOrLocalization];
221
+ function enumerationLocalization(enumeration, nameOrLocalization, localizationOrNothing) {
222
+ return [enumeration, isLocalizeItem(nameOrLocalization) ? nameOrLocalization : void 0, localizationOrNothing ?? nameOrLocalization];
190
223
  }
191
224
  function _autoEnumerationLocalization(enumeration, name) {
192
- if (isObject(enumeration)) {
193
- return [enumeration, name, Object.fromEntries(enumEntries(enumeration).map(([key, value]) => [value, key]))];
194
- }
195
- const arrayEntries = enumeration.map((value) => [value, value]);
196
- return [enumeration, name, Object.fromEntries(arrayEntries)];
225
+ if ((0, import_type_guards.isObject)(enumeration)) {
226
+ return [enumeration, name, Object.fromEntries((0, import_enum.enumEntries)(enumeration).map(([key, value]) => [value, key]))];
227
+ }
228
+ const arrayEntries = enumeration.map((value) => [value, value]);
229
+ return [enumeration, name, Object.fromEntries(arrayEntries)];
197
230
  }
198
231
  function buildMappedLocalization({ language, keys, enums }) {
199
- const enumsEntries = enums.map((entry) => [entry[0], { name: entry[1], values: entry[2] }]);
200
- const mappedLocalization = {
201
- language,
202
- keys: new Map(deepObjectEntries(keys)),
203
- enums: new Map(enumsEntries)
204
- };
205
- return mappedLocalization;
232
+ const enumsEntries = enums.map((entry) => [entry[0], { name: entry[1], values: entry[2] }]);
233
+ const mappedLocalization = {
234
+ language,
235
+ keys: new Map((0, import_object.deepObjectEntries)(keys)),
236
+ enums: new Map(enumsEntries)
237
+ };
238
+ return mappedLocalization;
206
239
  }
207
240
  function getStringKey(key, sourceKey = key) {
208
- if (isProxyLocalizationKey(key)) {
209
- return key[propertyName];
210
- }
211
- if (isString(key)) {
212
- return key;
213
- }
214
- if (isNullOrUndefined(key)) {
215
- throw new DetailsError('Invalid localization key', { sourceKey });
216
- }
217
- return getStringKey(key.key, sourceKey);
241
+ if (isProxyLocalizationKey(key)) {
242
+ return key[import_property_name.propertyName];
243
+ }
244
+ if ((0, import_type_guards.isString)(key)) {
245
+ return key;
246
+ }
247
+ if ((0, import_type_guards.isNullOrUndefined)(key)) {
248
+ throw new import_details_error.DetailsError("Invalid localization key", { sourceKey });
249
+ }
250
+ return getStringKey(key.key, sourceKey);
218
251
  }
219
252
  function mergeMappedLocalization(a, b, force = false) {
220
- if (!force && (a.language.code != b.language.code)) {
221
- throw new Error('Language code mismatch. Set force to true to force.');
222
- }
223
- return {
224
- language: b.language,
225
- keys: new Map([...a.keys, ...b.keys]),
226
- enums: new Map([...a.enums, ...b.enums])
227
- };
253
+ if (!force && a.language.code != b.language.code) {
254
+ throw new Error("Language code mismatch. Set force to true to force.");
255
+ }
256
+ return {
257
+ language: b.language,
258
+ keys: new Map([...a.keys, ...b.keys]),
259
+ enums: new Map([...a.enums, ...b.enums])
260
+ };
228
261
  }
229
- export function isLocalizeItem(value) {
230
- return isString(value) || isFunction(value);
262
+ function isLocalizeItem(value) {
263
+ return (0, import_type_guards.isString)(value) || (0, import_type_guards.isFunction)(value);
231
264
  }
@@ -1,29 +1,52 @@
1
- import { objectEntries } from '../../utils/object/object.js';
2
- import { hyphenate } from '../../utils/string/hypenate.js';
3
- import { themeColorTones } from '../theme-service.js';
4
- export function cssThemeAdapter(themeService) {
5
- const styleSheet = new CSSStyleSheet();
6
- document.adoptedStyleSheets.push(styleSheet);
7
- const rootRule = createCssRule(styleSheet, ':root {}');
8
- const subscription = themeService.calculatedTheme$.subscribe((theme) => setVariables(rootRule, theme.palette));
9
- return {
10
- destroy() {
11
- subscription.unsubscribe();
12
- }
13
- };
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var css_adapter_exports = {};
20
+ __export(css_adapter_exports, {
21
+ cssThemeAdapter: () => cssThemeAdapter
22
+ });
23
+ module.exports = __toCommonJS(css_adapter_exports);
24
+ var import_object = require("../../utils/object/object.js");
25
+ var import_hypenate = require("../../utils/string/hypenate.js");
26
+ var import_theme_service = require("../theme-service.js");
27
+ function cssThemeAdapter(themeService) {
28
+ const styleSheet = new CSSStyleSheet();
29
+ document.adoptedStyleSheets.push(styleSheet);
30
+ const rootRule = createCssRule(styleSheet, ":root {}");
31
+ const subscription = themeService.calculatedTheme$.subscribe((theme) => setVariables(rootRule, theme.palette));
32
+ return {
33
+ destroy() {
34
+ subscription.unsubscribe();
35
+ }
36
+ };
14
37
  }
15
38
  function setVariables(cssRule, palette) {
16
- for (const [color, tones] of objectEntries(palette)) {
17
- const colorVariable = hyphenate(color);
18
- for (const tone of themeColorTones) {
19
- cssRule.style.setProperty(`--theme-${colorVariable}`, tones.base);
20
- cssRule.style.setProperty(`--theme-${colorVariable}-rgb`, tones.baseRgb);
21
- cssRule.style.setProperty(`--theme-${colorVariable}-${tone}`, tones[tone]);
22
- cssRule.style.setProperty(`--theme-${colorVariable}-${tone}-rgb`, tones[`${tone}Rgb`]);
23
- }
39
+ for (const [color, tones] of (0, import_object.objectEntries)(palette)) {
40
+ const colorVariable = (0, import_hypenate.hyphenate)(color);
41
+ for (const tone of import_theme_service.themeColorTones) {
42
+ cssRule.style.setProperty(`--theme-${colorVariable}`, tones.base);
43
+ cssRule.style.setProperty(`--theme-${colorVariable}-rgb`, tones.baseRgb);
44
+ cssRule.style.setProperty(`--theme-${colorVariable}-${tone}`, tones[tone]);
45
+ cssRule.style.setProperty(`--theme-${colorVariable}-${tone}-rgb`, tones[`${tone}Rgb`]);
24
46
  }
47
+ }
25
48
  }
26
49
  function createCssRule(styleSheet, rule) {
27
- const index = styleSheet.insertRule(rule);
28
- return styleSheet.cssRules[index];
50
+ const index = styleSheet.insertRule(rule);
51
+ return styleSheet.cssRules[index];
29
52
  }
@@ -1,32 +1,55 @@
1
- import { fromEntries, objectKeys } from '../../utils/object/object.js';
2
- import { hyphenate } from '../../utils/string/hypenate.js';
3
- import { isDefined } from '../../utils/type-guards.js';
4
- export function generateTailwindColorsFromTheme(theme, tailwindNamePrefix) {
5
- const colors = objectKeys(theme.palette);
6
- return generateTailwindColorsFromThemeColors(colors, tailwindNamePrefix);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tailwind_adapter_exports = {};
20
+ __export(tailwind_adapter_exports, {
21
+ generateTailwindColorsFromTheme: () => generateTailwindColorsFromTheme,
22
+ generateTailwindColorsFromThemeColors: () => generateTailwindColorsFromThemeColors,
23
+ generateTailwindPalette: () => generateTailwindPalette
24
+ });
25
+ module.exports = __toCommonJS(tailwind_adapter_exports);
26
+ var import_object = require("../../utils/object/object.js");
27
+ var import_hypenate = require("../../utils/string/hypenate.js");
28
+ var import_type_guards = require("../../utils/type-guards.js");
29
+ function generateTailwindColorsFromTheme(theme, tailwindNamePrefix) {
30
+ const colors = (0, import_object.objectKeys)(theme.palette);
31
+ return generateTailwindColorsFromThemeColors(colors, tailwindNamePrefix);
7
32
  }
8
- export function generateTailwindColorsFromThemeColors(colors, tailwindNamePrefix) {
9
- const prefix = isDefined(tailwindNamePrefix) ? `${tailwindNamePrefix}-` : '';
10
- const entries = colors
11
- .map(hyphenate)
12
- .map((color) => [`${prefix}${color}`, generateTailwindPalette(color)]);
13
- return fromEntries(entries);
33
+ function generateTailwindColorsFromThemeColors(colors, tailwindNamePrefix) {
34
+ const prefix = (0, import_type_guards.isDefined)(tailwindNamePrefix) ? `${tailwindNamePrefix}-` : "";
35
+ const entries = colors.map(import_hypenate.hyphenate).map((color) => [`${prefix}${color}`, generateTailwindPalette(color)]);
36
+ return (0, import_object.fromEntries)(entries);
14
37
  }
15
- export function generateTailwindPalette(color) {
16
- return {
17
- /* eslint-disable @typescript-eslint/naming-convention */
18
- DEFAULT: `rgb(var(--theme-${color}-rgb) / <alpha-value>)`,
19
- 50: `rgb(var(--theme-${color}-50-rgb) / <alpha-value>)`,
20
- 100: `rgb(var(--theme-${color}-100-rgb) / <alpha-value>)`,
21
- 200: `rgb(var(--theme-${color}-200-rgb) / <alpha-value>)`,
22
- 300: `rgb(var(--theme-${color}-300-rgb) / <alpha-value>)`,
23
- 400: `rgb(var(--theme-${color}-400-rgb) / <alpha-value>)`,
24
- 500: `rgb(var(--theme-${color}-500-rgb) / <alpha-value>)`,
25
- 600: `rgb(var(--theme-${color}-600-rgb) / <alpha-value>)`,
26
- 700: `rgb(var(--theme-${color}-700-rgb) / <alpha-value>)`,
27
- 800: `rgb(var(--theme-${color}-800-rgb) / <alpha-value>)`,
28
- 900: `rgb(var(--theme-${color}-900-rgb) / <alpha-value>)`,
29
- 950: `rgb(var(--theme-${color}-950-rgb) / <alpha-value>)`
30
- /* eslint-enable @typescript-eslint/naming-convention */
31
- };
38
+ function generateTailwindPalette(color) {
39
+ return {
40
+ /* eslint-disable @typescript-eslint/naming-convention */
41
+ DEFAULT: `rgb(var(--theme-${color}-rgb) / <alpha-value>)`,
42
+ 50: `rgb(var(--theme-${color}-50-rgb) / <alpha-value>)`,
43
+ 100: `rgb(var(--theme-${color}-100-rgb) / <alpha-value>)`,
44
+ 200: `rgb(var(--theme-${color}-200-rgb) / <alpha-value>)`,
45
+ 300: `rgb(var(--theme-${color}-300-rgb) / <alpha-value>)`,
46
+ 400: `rgb(var(--theme-${color}-400-rgb) / <alpha-value>)`,
47
+ 500: `rgb(var(--theme-${color}-500-rgb) / <alpha-value>)`,
48
+ 600: `rgb(var(--theme-${color}-600-rgb) / <alpha-value>)`,
49
+ 700: `rgb(var(--theme-${color}-700-rgb) / <alpha-value>)`,
50
+ 800: `rgb(var(--theme-${color}-800-rgb) / <alpha-value>)`,
51
+ 900: `rgb(var(--theme-${color}-900-rgb) / <alpha-value>)`,
52
+ 950: `rgb(var(--theme-${color}-950-rgb) / <alpha-value>)`
53
+ /* eslint-enable @typescript-eslint/naming-convention */
54
+ };
32
55
  }
package/theme/index.js CHANGED
@@ -1 +1,18 @@
1
- export * from './theme-service.js';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var theme_exports = {};
17
+ module.exports = __toCommonJS(theme_exports);
18
+ __reExport(theme_exports, require("./theme-service.js"), module.exports);