@supersoniks/concorde 2.0.7 → 3.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 (406) hide show
  1. package/build-infos.json +1 -0
  2. package/index.html +44 -0
  3. package/notes de migration.md +21 -0
  4. package/package.json +23 -290
  5. package/scripts/prebuild.mjs +22 -0
  6. package/{components.js → src/components.ts} +5 -2
  7. package/src/concorde-loaded.ts +3 -0
  8. package/src/core/_types/types.ts +55 -0
  9. package/src/core/components/functional/date/date.md +290 -0
  10. package/src/core/components/functional/date/date.ts +206 -0
  11. package/src/core/components/functional/example/example.ts +11 -0
  12. package/src/core/components/functional/fetch/fetch.md +117 -0
  13. package/{core/components/functional/fetch/fetch.js → src/core/components/functional/fetch/fetch.ts} +33 -37
  14. package/src/core/components/functional/if/if.md +16 -0
  15. package/src/core/components/functional/if/if.test.ts +40 -0
  16. package/src/core/components/functional/if/if.ts +23 -0
  17. package/src/core/components/functional/list/list.md +194 -0
  18. package/src/core/components/functional/list/list.ts +236 -0
  19. package/src/core/components/functional/mix/mix.md +41 -0
  20. package/src/core/components/functional/mix/mix.ts +95 -0
  21. package/src/core/components/functional/queue/queue.md +87 -0
  22. package/src/core/components/functional/queue/queue.ts +279 -0
  23. package/src/core/components/functional/router/redirect.ts +44 -0
  24. package/src/core/components/functional/router/router.md +112 -0
  25. package/src/core/components/functional/router/router.ts +108 -0
  26. package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +229 -0
  27. package/{core → src/core}/components/functional/sdui/default-library.json +13 -13
  28. package/src/core/components/functional/sdui/example.json +99 -0
  29. package/src/core/components/functional/sdui/sdui-utils.ts +62 -0
  30. package/src/core/components/functional/sdui/sdui.md +356 -0
  31. package/src/core/components/functional/sdui/sdui.ts +230 -0
  32. package/src/core/components/functional/sdui/types.ts +34 -0
  33. package/src/core/components/functional/sonic-scope/sonic-scope.ts +13 -0
  34. package/src/core/components/functional/states/states.md +87 -0
  35. package/src/core/components/functional/states/states.ts +121 -0
  36. package/src/core/components/functional/submit/submit.md +48 -0
  37. package/src/core/components/functional/submit/submit.ts +265 -0
  38. package/src/core/components/functional/subscriber/subscriber.md +91 -0
  39. package/src/core/components/functional/subscriber/subscriber.ts +28 -0
  40. package/src/core/components/functional/value/value.md +35 -0
  41. package/src/core/components/functional/value/value.ts +18 -0
  42. package/{core/components/ui/_css/scroll.js → src/core/components/ui/_css/scroll.ts} +3 -2
  43. package/{core/components/ui/_css/size.js → src/core/components/ui/_css/size.ts} +5 -2
  44. package/{core/components/ui/_css/type.js → src/core/components/ui/_css/type.ts} +5 -3
  45. package/src/core/components/ui/alert/alert.md +121 -0
  46. package/src/core/components/ui/alert/alert.ts +177 -0
  47. package/src/core/components/ui/badge/badge.md +102 -0
  48. package/{core/components/ui/badge/badge.js → src/core/components/ui/badge/badge.ts} +36 -51
  49. package/src/core/components/ui/button/button.md +184 -0
  50. package/{core/components/ui/button/button.js → src/core/components/ui/button/button.ts} +258 -302
  51. package/src/core/components/ui/captcha/captcha.md +12 -0
  52. package/src/core/components/ui/captcha/captcha.ts +88 -0
  53. package/src/core/components/ui/card/card-footer.ts +19 -0
  54. package/src/core/components/ui/card/card-header-descripton.ts +24 -0
  55. package/{core/components/ui/card/card-header.js → src/core/components/ui/card/card-header.ts} +28 -38
  56. package/src/core/components/ui/card/card-main.ts +24 -0
  57. package/src/core/components/ui/card/card.md +96 -0
  58. package/{core/components/ui/card/card.js → src/core/components/ui/card/card.ts} +23 -34
  59. package/src/core/components/ui/divider/divider.md +35 -0
  60. package/{core/components/ui/divider/divider.js → src/core/components/ui/divider/divider.ts} +35 -65
  61. package/src/core/components/ui/form/checkbox/checkbox.md +96 -0
  62. package/{core/components/ui/form/checkbox/checkbox.js → src/core/components/ui/form/checkbox/checkbox.ts} +79 -98
  63. package/{core/components/ui/form/css/form-control.js → src/core/components/ui/form/css/form-control.ts} +9 -5
  64. package/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  65. package/src/core/components/ui/form/fieldset/fieldset.ts +96 -0
  66. package/src/core/components/ui/form/fieldset/legend-description.ts +23 -0
  67. package/src/core/components/ui/form/fieldset/legend.ts +90 -0
  68. package/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  69. package/src/core/components/ui/form/form-actions/form-actions.ts +32 -0
  70. package/src/core/components/ui/form/form-layout/form-layout.md +43 -0
  71. package/src/core/components/ui/form/form-layout/form-layout.ts +71 -0
  72. package/src/core/components/ui/form/input/input.md +168 -0
  73. package/src/core/components/ui/form/input/input.ts +227 -0
  74. package/src/core/components/ui/form/input/password-helper.ts +68 -0
  75. package/src/core/components/ui/form/input/same-value-helper.ts +48 -0
  76. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
  77. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +285 -0
  78. package/src/core/components/ui/form/radio/radio.md +86 -0
  79. package/src/core/components/ui/form/radio/radio.ts +44 -0
  80. package/src/core/components/ui/form/select/select.md +99 -0
  81. package/src/core/components/ui/form/select/select.ts +310 -0
  82. package/src/core/components/ui/form/textarea/textarea.md +66 -0
  83. package/src/core/components/ui/form/textarea/textarea.ts +119 -0
  84. package/src/core/components/ui/group/group.md +75 -0
  85. package/src/core/components/ui/group/group.ts +101 -0
  86. package/src/core/components/ui/icon/icon.md +125 -0
  87. package/src/core/components/ui/icon/icon.stories.ts +100 -0
  88. package/src/core/components/ui/icon/icon.ts +106 -0
  89. package/src/core/components/ui/icon/icons.json +1 -0
  90. package/src/core/components/ui/icon/icons.ts +130 -0
  91. package/src/core/components/ui/icon/svgs/cancel.svg +3 -0
  92. package/src/core/components/ui/icon/svgs/check-circled-outline.svg +4 -0
  93. package/src/core/components/ui/icon/svgs/check.svg +3 -0
  94. package/src/core/components/ui/icon/svgs/emoji-puzzled.svg +1 -0
  95. package/src/core/components/ui/icon/svgs/info-empty.svg +5 -0
  96. package/src/core/components/ui/icon/svgs/loader.svg +1 -0
  97. package/src/core/components/ui/icon/svgs/minus-small.svg +3 -0
  98. package/src/core/components/ui/icon/svgs/more-horiz.svg +5 -0
  99. package/src/core/components/ui/icon/svgs/more-vert.svg +5 -0
  100. package/src/core/components/ui/icon/svgs/nav-arrow-down.svg +3 -0
  101. package/src/core/components/ui/icon/svgs/warning-circled-outline.svg +5 -0
  102. package/src/core/components/ui/image/image.md +107 -0
  103. package/src/core/components/ui/image/image.ts +117 -0
  104. package/src/core/components/ui/link/link.md +43 -0
  105. package/src/core/components/ui/link/link.ts +108 -0
  106. package/src/core/components/ui/loader/loader.md +37 -0
  107. package/src/core/components/ui/loader/loader.stories.ts +25 -0
  108. package/src/core/components/ui/loader/loader.ts +81 -0
  109. package/{core/components/ui/loader/styles/fixed.js → src/core/components/ui/loader/styles/fixed.ts} +2 -1
  110. package/{core/components/ui/loader/styles/inline.js → src/core/components/ui/loader/styles/inline.ts} +3 -2
  111. package/src/core/components/ui/menu/menu-item.ts +30 -0
  112. package/src/core/components/ui/menu/menu.md +288 -0
  113. package/src/core/components/ui/menu/menu.ts +292 -0
  114. package/src/core/components/ui/modal/modal-actions.ts +35 -0
  115. package/src/core/components/ui/modal/modal-close.ts +36 -0
  116. package/src/core/components/ui/modal/modal-content.ts +19 -0
  117. package/src/core/components/ui/modal/modal-subtitle.ts +23 -0
  118. package/src/core/components/ui/modal/modal-title.ts +22 -0
  119. package/src/core/components/ui/modal/modal.md +123 -0
  120. package/src/core/components/ui/modal/modal.stories.ts +140 -0
  121. package/src/core/components/ui/modal/modal.ts +386 -0
  122. package/src/core/components/ui/pop/pop.md +79 -0
  123. package/src/core/components/ui/pop/pop.ts +291 -0
  124. package/src/core/components/ui/progress/progress.md +65 -0
  125. package/{core/components/ui/progress/progress.js → src/core/components/ui/progress/progress.ts} +31 -50
  126. package/src/core/components/ui/table/table-caption.ts +21 -0
  127. package/src/core/components/ui/table/table-tbody.ts +32 -0
  128. package/src/core/components/ui/table/table-td.ts +47 -0
  129. package/src/core/components/ui/table/table-tfoot.ts +20 -0
  130. package/src/core/components/ui/table/table-th.ts +56 -0
  131. package/src/core/components/ui/table/table-thead.ts +18 -0
  132. package/src/core/components/ui/table/table-tr.ts +48 -0
  133. package/src/core/components/ui/table/table.md +467 -0
  134. package/{core/components/ui/table/table.js → src/core/components/ui/table/table.ts} +32 -53
  135. package/{core/components/ui/theme/theme-collection/core-variables.js → src/core/components/ui/theme/theme-collection/core-variables.ts} +3 -2
  136. package/{core/components/ui/theme/theme-collection/dark.js → src/core/components/ui/theme/theme-collection/dark.ts} +5 -3
  137. package/{core/components/ui/theme/theme-collection/light.js → src/core/components/ui/theme/theme-collection/light.ts} +3 -2
  138. package/src/core/components/ui/theme/theme.ts +118 -0
  139. package/src/core/components/ui/toast/message-subscriber.stories.ts +43 -0
  140. package/src/core/components/ui/toast/message-subscriber.ts +37 -0
  141. package/{core/components/ui/toast/toast-item.js → src/core/components/ui/toast/toast-item.ts} +86 -113
  142. package/src/core/components/ui/toast/toast.ts +237 -0
  143. package/src/core/components/ui/toast/types.ts +14 -0
  144. package/src/core/components/ui/tooltip/tooltip.md +37 -0
  145. package/{core/components/ui/tooltip/tooltip.js → src/core/components/ui/tooltip/tooltip.ts} +26 -47
  146. package/{core/components/ui/ui.js → src/core/components/ui/ui.ts} +2 -0
  147. package/src/core/core.ts +22 -0
  148. package/src/core/decorators/Subscriber.ts +187 -0
  149. package/src/core/directives/DataProvider.ts +113 -0
  150. package/src/core/directives/Wording.ts +220 -0
  151. package/src/core/mixins/Fetcher.ts +258 -0
  152. package/src/core/mixins/FormCheckable.ts +287 -0
  153. package/src/core/mixins/FormElement.ts +275 -0
  154. package/src/core/mixins/FormInput.ts +135 -0
  155. package/src/core/mixins/Subscriber.ts +352 -0
  156. package/src/core/mixins/TemplatesContainer.ts +70 -0
  157. package/{core/mixins/mixins.d.ts → src/core/mixins/mixins.ts} +1 -1
  158. package/src/core/utils/Arrays.ts +161 -0
  159. package/src/core/utils/DataBindObserver.ts +286 -0
  160. package/src/core/utils/Electron.ts +15 -0
  161. package/src/core/utils/Format.ts +58 -0
  162. package/src/core/utils/HTML.ts +126 -0
  163. package/src/core/utils/LocationHandler.ts +139 -0
  164. package/src/core/utils/Objects.ts +103 -0
  165. package/src/core/utils/PublisherProxy.ts +786 -0
  166. package/src/core/utils/Utils.ts +12 -0
  167. package/src/core/utils/api.ts +456 -0
  168. package/{core/utils/url-pattern.d.ts → src/core/utils/url-pattern.ts} +1 -0
  169. package/{decorators.js → src/decorators.ts} +6 -2
  170. package/{directives.js → src/directives.ts} +11 -6
  171. package/src/docs/_core-concept/overview.md +57 -0
  172. package/src/docs/_core-concept/subscriber.md +76 -0
  173. package/src/docs/_getting-started/concorde-outside.md +141 -0
  174. package/src/docs/_getting-started/create-a-component.md +137 -0
  175. package/src/docs/_getting-started/pubsub.md +150 -0
  176. package/src/docs/_getting-started/start.md +37 -0
  177. package/src/docs/_getting-started/theming.md +91 -0
  178. package/src/docs/code.ts +281 -0
  179. package/src/docs/docs.ts +6 -0
  180. package/src/docs/example/users.ts +64 -0
  181. package/src/docs/navigation/navigation.ts +101 -0
  182. package/src/docs/prism/index.ts +6 -0
  183. package/src/docs/prism/prism.css +158 -0
  184. package/src/docs/prism/prism.js +1022 -0
  185. package/src/docs/search/docs-search.json +3767 -0
  186. package/src/docs/search/markdown-renderer.ts +40 -0
  187. package/src/docs/search/page.ts +40 -0
  188. package/src/docs/search/search.ts +184 -0
  189. package/src/docs.ts +2 -0
  190. package/src/index.ts +7 -0
  191. package/{mixins.js → src/mixins.ts} +10 -6
  192. package/src/tag-list.json +1 -0
  193. package/src/test-utils/TestUtils.ts +13 -0
  194. package/src/tsconfig.json +113 -0
  195. package/{utils.js → src/utils.ts} +15 -11
  196. package/test-utils/TestUtils.ts +13 -0
  197. package/vite/config.js +136 -0
  198. package/vite.config.mts +87 -0
  199. package/README.md +0 -27
  200. package/cli.js +0 -75
  201. package/components.d.ts +0 -4
  202. package/concorde-core.bundle.js +0 -3427
  203. package/concorde-core.es.js +0 -14372
  204. package/core/_types/types.d.ts +0 -28
  205. package/core/_types/types.js +0 -2
  206. package/core/components/functional/date/date.d.ts +0 -45
  207. package/core/components/functional/date/date.js +0 -243
  208. package/core/components/functional/example/example.d.ts +0 -7
  209. package/core/components/functional/example/example.js +0 -26
  210. package/core/components/functional/fetch/fetch.d.ts +0 -93
  211. package/core/components/functional/functional.js +0 -15
  212. package/core/components/functional/if/if.d.ts +0 -12
  213. package/core/components/functional/if/if.js +0 -38
  214. package/core/components/functional/if/if.test.d.ts +0 -1
  215. package/core/components/functional/if/if.test.js +0 -35
  216. package/core/components/functional/list/list.d.ts +0 -117
  217. package/core/components/functional/list/list.js +0 -214
  218. package/core/components/functional/mix/mix.d.ts +0 -22
  219. package/core/components/functional/mix/mix.js +0 -102
  220. package/core/components/functional/queue/queue.d.ts +0 -67
  221. package/core/components/functional/queue/queue.js +0 -310
  222. package/core/components/functional/router/redirect.d.ts +0 -18
  223. package/core/components/functional/router/redirect.js +0 -53
  224. package/core/components/functional/router/router.d.ts +0 -27
  225. package/core/components/functional/router/router.js +0 -119
  226. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -58
  227. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +0 -215
  228. package/core/components/functional/sdui/sdui-utils.d.ts +0 -5
  229. package/core/components/functional/sdui/sdui-utils.js +0 -63
  230. package/core/components/functional/sdui/sdui.d.ts +0 -136
  231. package/core/components/functional/sdui/sdui.js +0 -254
  232. package/core/components/functional/sdui/types.d.ts +0 -37
  233. package/core/components/functional/sdui/types.js +0 -1
  234. package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -5
  235. package/core/components/functional/sonic-scope/sonic-scope.js +0 -21
  236. package/core/components/functional/states/states.d.ts +0 -29
  237. package/core/components/functional/states/states.js +0 -134
  238. package/core/components/functional/submit/submit.d.ts +0 -30
  239. package/core/components/functional/submit/submit.js +0 -236
  240. package/core/components/functional/subscriber/subscriber.d.ts +0 -12
  241. package/core/components/functional/subscriber/subscriber.js +0 -38
  242. package/core/components/functional/value/value.d.ts +0 -7
  243. package/core/components/functional/value/value.js +0 -27
  244. package/core/components/ui/_css/scroll.d.ts +0 -1
  245. package/core/components/ui/_css/size.d.ts +0 -2
  246. package/core/components/ui/_css/type.d.ts +0 -2
  247. package/core/components/ui/alert/alert.d.ts +0 -34
  248. package/core/components/ui/alert/alert.js +0 -202
  249. package/core/components/ui/badge/badge.d.ts +0 -26
  250. package/core/components/ui/button/button.d.ts +0 -171
  251. package/core/components/ui/captcha/captcha.d.ts +0 -30
  252. package/core/components/ui/captcha/captcha.js +0 -93
  253. package/core/components/ui/card/card-footer.d.ts +0 -4
  254. package/core/components/ui/card/card-footer.js +0 -24
  255. package/core/components/ui/card/card-header-descripton.d.ts +0 -5
  256. package/core/components/ui/card/card-header-descripton.js +0 -32
  257. package/core/components/ui/card/card-header.d.ts +0 -8
  258. package/core/components/ui/card/card-main.d.ts +0 -4
  259. package/core/components/ui/card/card-main.js +0 -28
  260. package/core/components/ui/card/card.d.ts +0 -12
  261. package/core/components/ui/divider/divider.d.ts +0 -15
  262. package/core/components/ui/form/checkbox/checkbox.d.ts +0 -181
  263. package/core/components/ui/form/css/form-control.d.ts +0 -4
  264. package/core/components/ui/form/fieldset/fieldset.d.ts +0 -23
  265. package/core/components/ui/form/fieldset/fieldset.js +0 -118
  266. package/core/components/ui/form/fieldset/legend-description.d.ts +0 -5
  267. package/core/components/ui/form/fieldset/legend-description.js +0 -30
  268. package/core/components/ui/form/fieldset/legend.d.ts +0 -16
  269. package/core/components/ui/form/fieldset/legend.js +0 -112
  270. package/core/components/ui/form/form-actions/form-actions.d.ts +0 -7
  271. package/core/components/ui/form/form-actions/form-actions.js +0 -46
  272. package/core/components/ui/form/form-layout/form-layout.d.ts +0 -12
  273. package/core/components/ui/form/form-layout/form-layout.js +0 -83
  274. package/core/components/ui/form/input/input.d.ts +0 -106
  275. package/core/components/ui/form/input/input.js +0 -268
  276. package/core/components/ui/form/input/password-helper.d.ts +0 -25
  277. package/core/components/ui/form/input/password-helper.js +0 -119
  278. package/core/components/ui/form/input/same-value-helper.d.ts +0 -16
  279. package/core/components/ui/form/input/same-value-helper.js +0 -77
  280. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +0 -136
  281. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +0 -296
  282. package/core/components/ui/form/radio/radio.d.ts +0 -12
  283. package/core/components/ui/form/radio/radio.js +0 -50
  284. package/core/components/ui/form/select/select.d.ts +0 -58
  285. package/core/components/ui/form/select/select.js +0 -298
  286. package/core/components/ui/form/textarea/textarea.d.ts +0 -84
  287. package/core/components/ui/form/textarea/textarea.js +0 -150
  288. package/core/components/ui/group/group.d.ts +0 -16
  289. package/core/components/ui/group/group.js +0 -118
  290. package/core/components/ui/icon/icon.d.ts +0 -26
  291. package/core/components/ui/icon/icon.js +0 -113
  292. package/core/components/ui/icon/icons.d.ts +0 -10
  293. package/core/components/ui/icon/icons.js +0 -126
  294. package/core/components/ui/icon/icons.json +0 -1
  295. package/core/components/ui/image/image.d.ts +0 -15
  296. package/core/components/ui/image/image.js +0 -153
  297. package/core/components/ui/link/link.d.ts +0 -29
  298. package/core/components/ui/link/link.js +0 -124
  299. package/core/components/ui/loader/loader.d.ts +0 -23
  300. package/core/components/ui/loader/loader.js +0 -97
  301. package/core/components/ui/loader/styles/fixed.d.ts +0 -1
  302. package/core/components/ui/loader/styles/inline.d.ts +0 -1
  303. package/core/components/ui/menu/menu-item.d.ts +0 -5
  304. package/core/components/ui/menu/menu-item.js +0 -34
  305. package/core/components/ui/menu/menu.d.ts +0 -41
  306. package/core/components/ui/menu/menu.js +0 -313
  307. package/core/components/ui/modal/modal-actions.d.ts +0 -7
  308. package/core/components/ui/modal/modal-actions.js +0 -42
  309. package/core/components/ui/modal/modal-close.d.ts +0 -7
  310. package/core/components/ui/modal/modal-close.js +0 -43
  311. package/core/components/ui/modal/modal-content.d.ts +0 -5
  312. package/core/components/ui/modal/modal-content.js +0 -26
  313. package/core/components/ui/modal/modal-subtitle.d.ts +0 -5
  314. package/core/components/ui/modal/modal-subtitle.js +0 -30
  315. package/core/components/ui/modal/modal-title.d.ts +0 -5
  316. package/core/components/ui/modal/modal-title.js +0 -29
  317. package/core/components/ui/modal/modal.d.ts +0 -58
  318. package/core/components/ui/modal/modal.js +0 -401
  319. package/core/components/ui/pop/pop.d.ts +0 -37
  320. package/core/components/ui/pop/pop.js +0 -299
  321. package/core/components/ui/progress/progress.d.ts +0 -10
  322. package/core/components/ui/table/table-caption.d.ts +0 -5
  323. package/core/components/ui/table/table-caption.js +0 -28
  324. package/core/components/ui/table/table-tbody.d.ts +0 -5
  325. package/core/components/ui/table/table-tbody.js +0 -39
  326. package/core/components/ui/table/table-td.d.ts +0 -12
  327. package/core/components/ui/table/table-td.js +0 -68
  328. package/core/components/ui/table/table-tfoot.d.ts +0 -5
  329. package/core/components/ui/table/table-tfoot.js +0 -27
  330. package/core/components/ui/table/table-th.d.ts +0 -11
  331. package/core/components/ui/table/table-th.js +0 -73
  332. package/core/components/ui/table/table-thead.d.ts +0 -5
  333. package/core/components/ui/table/table-thead.js +0 -25
  334. package/core/components/ui/table/table-tr.d.ts +0 -13
  335. package/core/components/ui/table/table-tr.js +0 -66
  336. package/core/components/ui/table/table.d.ts +0 -17
  337. package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -1
  338. package/core/components/ui/theme/theme-collection/dark.d.ts +0 -1
  339. package/core/components/ui/theme/theme-collection/light.d.ts +0 -1
  340. package/core/components/ui/theme/theme.d.ts +0 -19
  341. package/core/components/ui/theme/theme.js +0 -124
  342. package/core/components/ui/toast/message-subscriber.d.ts +0 -18
  343. package/core/components/ui/toast/message-subscriber.js +0 -40
  344. package/core/components/ui/toast/toast-item.d.ts +0 -19
  345. package/core/components/ui/toast/toast.d.ts +0 -25
  346. package/core/components/ui/toast/toast.js +0 -226
  347. package/core/components/ui/toast/types.d.ts +0 -11
  348. package/core/components/ui/toast/types.js +0 -1
  349. package/core/components/ui/tooltip/tooltip.d.ts +0 -10
  350. package/core/components/ui/ui.d.ts +0 -32
  351. package/core/core.d.ts +0 -4
  352. package/core/core.js +0 -19
  353. package/core/decorators/Subscriber.d.ts +0 -4
  354. package/core/decorators/Subscriber.js +0 -166
  355. package/core/directives/DataProvider.d.ts +0 -23
  356. package/core/directives/DataProvider.js +0 -102
  357. package/core/directives/Wording.d.ts +0 -42
  358. package/core/directives/Wording.js +0 -202
  359. package/core/mixins/Fetcher.d.ts +0 -90
  360. package/core/mixins/Fetcher.js +0 -242
  361. package/core/mixins/FormCheckable.d.ts +0 -88
  362. package/core/mixins/FormCheckable.js +0 -306
  363. package/core/mixins/FormElement.d.ts +0 -32
  364. package/core/mixins/FormElement.js +0 -272
  365. package/core/mixins/FormInput.d.ts +0 -70
  366. package/core/mixins/FormInput.js +0 -81
  367. package/core/mixins/Subscriber.d.ts +0 -36
  368. package/core/mixins/Subscriber.js +0 -333
  369. package/core/mixins/TemplatesContainer.d.ts +0 -13
  370. package/core/mixins/TemplatesContainer.js +0 -69
  371. package/core/mixins/mixins.js +0 -6
  372. package/core/utils/Arrays.d.ts +0 -97
  373. package/core/utils/Arrays.js +0 -140
  374. package/core/utils/DataBindObserver.d.ts +0 -83
  375. package/core/utils/DataBindObserver.js +0 -264
  376. package/core/utils/Electron.d.ts +0 -7
  377. package/core/utils/Electron.js +0 -11
  378. package/core/utils/Format.d.ts +0 -12
  379. package/core/utils/Format.js +0 -38
  380. package/core/utils/HTML.d.ts +0 -42
  381. package/core/utils/HTML.js +0 -119
  382. package/core/utils/LocationHandler.d.ts +0 -46
  383. package/core/utils/LocationHandler.js +0 -133
  384. package/core/utils/Objects.d.ts +0 -28
  385. package/core/utils/Objects.js +0 -102
  386. package/core/utils/PublisherProxy.d.ts +0 -176
  387. package/core/utils/PublisherProxy.js +0 -709
  388. package/core/utils/Utils.d.ts +0 -4
  389. package/core/utils/Utils.js +0 -12
  390. package/core/utils/api.d.ts +0 -139
  391. package/core/utils/api.js +0 -391
  392. package/core/utils/url-pattern.js +0 -2
  393. package/decorators.d.ts +0 -3
  394. package/directives.d.ts +0 -40
  395. package/img/concorde-logo.svg +0 -1
  396. package/img/concorde.png +0 -0
  397. package/img/concorde_def.png +0 -0
  398. package/mixins.d.ts +0 -181
  399. package/svg/regular/plane.svg +0 -1
  400. package/svg/solid/plane.svg +0 -1
  401. package/test-utils/TestUtils.d.ts +0 -4
  402. package/test-utils/TestUtils.js +0 -12
  403. package/utils.d.ts +0 -20
  404. /package/{core/components/functional/functional.d.ts → src/core/components/functional/functional.ts} +0 -0
  405. /package/{core → src/core}/components/ui/theme/css/tailwind.css +0 -0
  406. /package/{core → src/core}/components/ui/theme/css/tailwind.d.ts +0 -0
@@ -1,709 +0,0 @@
1
- import HTML from "./HTML";
2
- function isComplex(value) {
3
- return typeof value === "object" && value != null;
4
- }
5
- const queueTaskPromise = async () => {
6
- return new Promise((resolve) => {
7
- window.queueMicrotask(() => resolve(null));
8
- });
9
- };
10
- /**
11
- * Custom Proxy contient les méthodes des publishers retournés par PublisherManager.get(publisherId) qui seront utilisées couramment
12
- */
13
- export class PublisherProxy {
14
- constructor(target, parentProxPub) {
15
- this._proxies_ = new Map();
16
- this._is_savable_ = false;
17
- this._invalidateListeners_ = new Set();
18
- this._assignListeners_ = new Set();
19
- this._mutationListeners_ = new Set();
20
- this._fillListeners_ = new Set();
21
- this._templateFillListeners_ = new Set();
22
- this._lockInternalMutationPublishing_ = false;
23
- this._instanceCounter_ = 0;
24
- this._assignmentId_ = 0;
25
- this._value_ = target;
26
- this.parent = parentProxPub || null;
27
- this.root = this;
28
- this._instanceCounter_ = 0;
29
- while (this.root.parent) {
30
- this.root = this.root.parent;
31
- }
32
- }
33
- /**
34
- * Supprime le proxy et ses sous proxy
35
- * Supprime les écouteurs associés
36
- */
37
- delete() {
38
- for (const proxy of this._proxies_.values()) {
39
- proxy.delete();
40
- }
41
- this._invalidateListeners_.clear();
42
- this._assignListeners_.clear();
43
- this._mutationListeners_.clear();
44
- this._fillListeners_.clear();
45
- this._templateFillListeners_.clear();
46
- this._proxies_.clear();
47
- PublisherProxy.instances.delete(this._instanceCounter_);
48
- }
49
- /**
50
- * Utile pour savoir si quelque chose est en écoute d'une modification sur le proxy via une des methodes associées
51
- */
52
- hasListener() {
53
- return (this._templateFillListeners_.size > 0 ||
54
- this._assignListeners_.size > 0 ||
55
- this._invalidateListeners_.size > 0 ||
56
- this._mutationListeners_.size > 0 ||
57
- this._fillListeners_.size > 0);
58
- }
59
- _publishInternalMutation_(lockInternalMutationsTransmission = false) {
60
- this._mutationListeners_.forEach((handler) => handler());
61
- if (this._is_savable_ && !PublisherManager.changed) {
62
- PublisherManager.changed = true;
63
- PublisherManager.saveId++;
64
- const saveId = PublisherManager.saveId;
65
- setTimeout(() => PublisherManager.getInstance().saveToLocalStorage(saveId), 1000);
66
- }
67
- if (lockInternalMutationsTransmission)
68
- return;
69
- if (this.parent) {
70
- this.parent._publishInternalMutation_();
71
- }
72
- }
73
- async _publishAssignement_(lockInternalMutationsTransmission = false) {
74
- this._assignmentId_++;
75
- const currentId = this._assignmentId_;
76
- await queueTaskPromise();
77
- if (currentId !== this._assignmentId_)
78
- return;
79
- const newValue = this.get();
80
- this._assignListeners_.forEach((handler) => handler(newValue));
81
- this._publishInternalMutation_(lockInternalMutationsTransmission);
82
- }
83
- _publishInvalidation_() {
84
- this._invalidateListeners_.forEach((handler) => handler());
85
- }
86
- _publishDynamicFilling_(key, value) {
87
- this._fillListeners_.forEach((handler) => {
88
- if (handler[key] !== value)
89
- handler[key] = value;
90
- });
91
- this._publishTemplateFilling_(key, value);
92
- }
93
- _publishTemplateFilling_(key, value) {
94
- this._templateFillListeners_.forEach((handler) => {
95
- const desc = Object.getOwnPropertyDescriptor(handler, key);
96
- if (desc && !desc.set && !desc.writable)
97
- return;
98
- if (handler.propertyMap && handler.propertyMap[key]) {
99
- key = handler.propertyMap[key];
100
- }
101
- if (typeof handler[key] != "undefined" && handler[key] !== value) {
102
- handler[key] = value;
103
- }
104
- });
105
- }
106
- /**
107
- * Appel la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
108
- * hanlder reçois alors la nouvelle valeur interne du proxy en paramètre
109
- */
110
- onAssign(handler, directHandlerCall = true) {
111
- if (typeof handler != "function")
112
- return;
113
- if (this._assignListeners_.has(handler))
114
- return;
115
- this._assignListeners_.add(handler);
116
- if (directHandlerCall)
117
- handler(this.get());
118
- }
119
- /**
120
- * Stop les appels de la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
121
- */
122
- offAssign(handler) {
123
- this._assignListeners_.delete(handler);
124
- }
125
- /**
126
- * Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
127
- */
128
- onInvalidate(handler) {
129
- if (typeof handler != "function")
130
- return;
131
- this._invalidateListeners_.add(handler);
132
- }
133
- /**
134
- * Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
135
- */
136
- offInvalidate(handler) {
137
- if (typeof handler != "function")
138
- return;
139
- this._invalidateListeners_.delete(handler);
140
- }
141
- /**
142
- * Flag les données comme étant invalides
143
- */
144
- invalidate() {
145
- this._publishInvalidation_();
146
- }
147
- /**
148
- * Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
149
- *
150
- */
151
- onInternalMutation(handler) {
152
- if (typeof handler != "function")
153
- return;
154
- this._mutationListeners_.add(handler);
155
- handler();
156
- }
157
- /**
158
- * Stop les Appels de la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
159
- */
160
- offInternalMutation(handler) {
161
- if (typeof handler != "function")
162
- return;
163
- this._mutationListeners_.delete(handler);
164
- }
165
- /**
166
- * Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
167
- * Remplit uniquement les valeurs déjà présentes dans l'objet / tableau passé en paramètre
168
- */
169
- startTemplateFilling(handler) {
170
- this._templateFillListeners_.add(handler);
171
- if (typeof this._value_ != "object")
172
- return;
173
- for (const z in this._value_) {
174
- let valueKey = z;
175
- const value = this._value_[z];
176
- if (handler.propertyMap && handler.propertyMap[z]) {
177
- valueKey = handler.propertyMap[z];
178
- }
179
- if (typeof handler[z] != "undefined" && handler[z] !== value) {
180
- handler[valueKey] = value;
181
- }
182
- }
183
- }
184
- /**
185
- * Arrête de maintenir le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
186
- */
187
- stopTemplateFilling(handler) {
188
- this._templateFillListeners_.delete(handler);
189
- }
190
- /**
191
- * Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
192
- * Remplit toute valeur qu'elle soit présente ou pas initialement dans l'objet
193
- */
194
- startDynamicFilling(handler) {
195
- this._fillListeners_.add(handler);
196
- for (const z in this._value_) {
197
- const value = this._value_[z];
198
- if (handler[z] !== value)
199
- handler[z] = value;
200
- }
201
- }
202
- /*
203
- * Arrête de maintenir le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
204
- */
205
- stopDynamicFilling(handler) {
206
- this._fillListeners_.delete(handler);
207
- }
208
- /**
209
- * Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
210
- */
211
- async set(newValue, lockInternalMutationsTransmission = false) {
212
- /**
213
- * On retounre tout de suite si la valeur n'a pas changé
214
- */
215
- if (this._value_ === newValue)
216
- return true;
217
- if (this._value_ &&
218
- Object.prototype.hasOwnProperty.call(this._value_, "__value") &&
219
- Object.prototype.hasOwnProperty.call(newValue, "__value") &&
220
- this._value_.__value === newValue.__value) {
221
- return true;
222
- }
223
- /**
224
- * On assigne la nouvelle valeur
225
- */
226
- const prevValue = this._value_;
227
- this._value_ = isComplex(newValue) ? newValue : { __value: newValue };
228
- this._cachedGet_ = undefined;
229
- /**
230
- * Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
231
- * On publie juste et on sen va.
232
- */
233
- const isPrimitiveValue = Object.prototype.hasOwnProperty.call(this._value_, "__value");
234
- if (isPrimitiveValue) {
235
- await this._publishAssignement_(lockInternalMutationsTransmission);
236
- return true;
237
- }
238
- /**
239
- * On fait la diff sur l'existant.
240
- * On maintient les proxys à supprimer et ceux à ajouter.
241
- * On met à jour leur valeur interne
242
- * On publie les maj au fur et a mesure de modifications
243
- */
244
- for (const key in this._value_) {
245
- if (this._value_[key] === undefined)
246
- delete this._value_[key];
247
- }
248
- this._proxies_.forEach((_subProxy, key) => {
249
- /**
250
- * On supprime les proxys qui ne sont plus dans la nouvelle valeur si ils n'on pas d'écouteurs
251
- **/
252
- if (this._value_[key] === undefined) {
253
- // if (!_subProxy?.hasListener()) {
254
- // // this._proxies_.delete(key);
255
- // } else {
256
- if (key != "_parent_") {
257
- if (prevValue[key])
258
- this._value_[key] = null;
259
- }
260
- // }
261
- }
262
- });
263
- /**
264
- * On prévient les écouteurs que la valeur a changé
265
- */
266
- await this._publishAssignement_();
267
- /**
268
- * Si la donnée est complexe (objet, tableau)
269
- * on crée les proxys pour les sous-éléments qui n'en on pas
270
- * On renseigne les nouvelles valeurs internes des proxies
271
- */
272
- if (isComplex(this._value_)) {
273
- for (const key in this._value_) {
274
- const v = newValue[key];
275
- const isVComplex = isComplex(v);
276
- const valueV = isVComplex ? v : { __value: v };
277
- if (!this._proxies_.has(key)) {
278
- // A surveiller ancienne version
279
- // const newPublisher = new Publisher({}, this);
280
- // this._proxies_.set(key, newPublisher);
281
- // newPublisher._proxies_.set("_parent_", this);
282
- this._publishDynamicFilling_(key, v);
283
- continue;
284
- }
285
- await this._proxies_.get(key)?.set(valueV, true);
286
- this._publishDynamicFilling_(key, v);
287
- }
288
- }
289
- return true;
290
- }
291
- get() {
292
- if (this._cachedGet_ !== undefined)
293
- return this._cachedGet_;
294
- if (PublisherManager.modifiedCollectore.length > 0)
295
- PublisherManager.modifiedCollectore[0].add(this);
296
- if (Object.prototype.hasOwnProperty.call(this._value_, "__value")) {
297
- const v = this._value_.__value;
298
- return (this._cachedGet_ = (v != undefined ? v : null));
299
- }
300
- return (this._cachedGet_ = this._value_);
301
- }
302
- /**
303
- * retourner le webcomponent auquel le proxy est associé
304
- */
305
- get $tag() {
306
- if (!this._instanceCounter_) {
307
- PublisherProxy.instancesCounter++;
308
- this._instanceCounter_ = PublisherProxy.instancesCounter;
309
- }
310
- PublisherProxy.instances.set(this._instanceCounter_, this);
311
- const str = '<reactive-publisher-proxy publisher="' + this._instanceCounter_ + '"></reactive-publisher-proxy>';
312
- return str;
313
- }
314
- }
315
- PublisherProxy.instances = new Map();
316
- PublisherProxy.instancesCounter = 0;
317
- if (typeof __BUILD_DATE__ === "undefined") {
318
- window.__BUILD_DATE__ = "No build date";
319
- }
320
- export class PublisherManager {
321
- constructor() {
322
- this.enabledLocaStorageProxies = [];
323
- this.publishers = new Map();
324
- this.localStorageData = {};
325
- this.isLocalStrorageReady = null;
326
- this.initialisedData = [];
327
- if (PublisherManager.instance != null)
328
- throw "Singleton / use getInstance";
329
- PublisherManager.instance = this;
330
- this.isLocalStrorageReady = this.cleanStorageData();
331
- }
332
- async cleanStorageData() {
333
- return new Promise((resolve) => {
334
- const doiIt = async () => {
335
- try {
336
- let compressedData = localStorage.getItem("publisher-proxies-data");
337
- let localStorageJSON = null;
338
- if (compressedData)
339
- localStorageJSON = await this.decompress(compressedData, "gzip");
340
- if (localStorageJSON) {
341
- try {
342
- this.localStorageData = JSON.parse(localStorageJSON);
343
- }
344
- catch (e) {
345
- this.localStorageData = {};
346
- }
347
- }
348
- else {
349
- compressedData = await this.compress("{}", "gzip");
350
- localStorage.setItem("publisher-proxies-data", compressedData);
351
- this.localStorageData = {};
352
- }
353
- const expires = new Date().getTime() - 1000 * 60 * 60 * 12;
354
- for (const key in this.localStorageData) {
355
- const item = this.localStorageData[key];
356
- if (item.lastModifiationMS < expires) {
357
- delete this.localStorageData[key];
358
- }
359
- }
360
- resolve(true);
361
- // compressedData = await this.compress(JSON.stringify(this.localStorageData), "gzip");
362
- // localStorage.setItem("publisher-proxies-data", compressedData);
363
- }
364
- catch (e) {
365
- window.requestAnimationFrame(() => {
366
- resolve(false);
367
- });
368
- console.log("no publisher cache in this browser");
369
- }
370
- };
371
- doiIt();
372
- });
373
- }
374
- /**
375
- * PublisherManager est un singleton
376
- */
377
- static getInstance() {
378
- if (PublisherManager.instance == null)
379
- return new PublisherManager();
380
- return PublisherManager.instance;
381
- }
382
- /**
383
- * shortcut static pour obtenir un publisher vias sont id/adresse sans taper getInstance.
384
- * Si le publisher n'existe pas, il est créé.
385
- */
386
- static get(id, options) {
387
- return PublisherManager.getInstance().get(id, options);
388
- }
389
- static collectModifiedPublisher() {
390
- PublisherManager.modifiedCollectore.unshift(new Set());
391
- }
392
- static getModifiedPublishers() {
393
- return PublisherManager.modifiedCollectore.shift();
394
- }
395
- /**
396
- * shortcut static pour supprimer un publisher de la liste et appel également delete sur le publisher ce qui le supprime, de même que ses sous publishers
397
- */
398
- static delete(id) {
399
- if (!id)
400
- return false;
401
- return PublisherManager.getInstance().delete(id);
402
- }
403
- /**
404
- * Obtenir un publisher vias sont id/adresse
405
- * Si le publisher n'existe pas, il est créé.
406
- */
407
- async setLocalData(publisher, id) {
408
- await this.isLocalStrorageReady;
409
- publisher.set(this.localStorageData[id + "¤lang_" + HTML.getLanguage()]?.data || publisher.get());
410
- }
411
- get(id, options) {
412
- const hasLocalStorage = options?.localStorageMode === "enabled";
413
- if (!this.publishers.has(id)) {
414
- const data = {};
415
- const publisher = new Publisher(data);
416
- this.set(id, publisher);
417
- }
418
- const publisher = this.publishers.get(id);
419
- if (hasLocalStorage && this.initialisedData.indexOf(id) === -1) {
420
- publisher._is_savable_ = true;
421
- this.initialisedData.push(id);
422
- this.setLocalData(publisher, id);
423
- }
424
- return this.publishers.get(id);
425
- }
426
- /**
427
- * Remplace un publisher pour l'id fourni par un autre.
428
- * L'autre publisher n'est pas supprimé.
429
- */
430
- set(id, publisher) {
431
- this.publishers.set(id, publisher);
432
- }
433
- /**
434
- * @warning
435
- * !!!!! ATTENTION !!!!!
436
- * Il est fort à aprier que vous ne voulez pas utiliser cette methode
437
- * Il s'agit d'une supression complete
438
- * * du publisher de la liste
439
- * * des bindings
440
- * * de même que ses sous publishers
441
- *
442
- * UTILISEZ PLUTÔT la méthode publisher.set({}) pour réinitialiser un publisher sans perdre les ecouteurs
443
- */
444
- delete(id) {
445
- if (!this.publishers.has(id))
446
- return false;
447
- this.publishers.delete(id);
448
- return true;
449
- }
450
- async saveToLocalStorage(saveId = 0) {
451
- /**
452
- * si l'id a changé et que ce n'est pas un multiple de 10, on ne sauve pas
453
- * on sauvegarde quand même tous les 10 au cas ou on aurrait des changements en continue, par exemple à chaque frame
454
- */
455
- if (saveId !== PublisherManager.saveId && saveId % 10 != 0)
456
- return;
457
- try {
458
- if (!PublisherManager.changed || PublisherManager.saving)
459
- return;
460
- PublisherManager.saving = true;
461
- PublisherManager.changed = false;
462
- const keys = Array.from(this.publishers.keys());
463
- let hasChanged = false;
464
- for (const key of keys) {
465
- const publisher = this.publishers.get(key);
466
- if (!publisher?._is_savable_)
467
- continue;
468
- const data = publisher?.get();
469
- if (!data)
470
- continue;
471
- this.localStorageData[key + "¤lang_" + HTML.getLanguage()] = {
472
- lastModifiationMS: new Date().getTime(),
473
- data: data,
474
- };
475
- hasChanged = true;
476
- }
477
- // on enregistre les données
478
- if (hasChanged) {
479
- const compressedData = await this.compress(JSON.stringify(this.localStorageData), "gzip");
480
- localStorage.setItem("publisher-proxies-data", compressedData);
481
- }
482
- PublisherManager.saving = false;
483
- if (PublisherManager.changed) {
484
- PublisherManager.saveId++;
485
- const saveId = PublisherManager.saveId;
486
- setTimeout(() => this.saveToLocalStorage(saveId), 1000);
487
- }
488
- }
489
- catch (e) {
490
- PublisherManager.saving = false;
491
- }
492
- }
493
- async compress(string, encoding) {
494
- const byteArray = new TextEncoder().encode(string);
495
- const win = window;
496
- const cs = new win.CompressionStream(encoding);
497
- const writer = cs.writable.getWriter();
498
- writer.write(byteArray);
499
- writer.close();
500
- const result = await new Response(cs.readable).arrayBuffer();
501
- const arrayBufferView = new Uint8Array(result);
502
- let str = "";
503
- for (let i = 0; i < arrayBufferView.length; i++) {
504
- str += String.fromCharCode(arrayBufferView[i]);
505
- }
506
- return btoa(str);
507
- }
508
- async decompress(str, encoding) {
509
- const decodedString = atob(str);
510
- const arrayBufferViewFromLocalStorage = Uint8Array.from(decodedString, (c) => c.charCodeAt(0));
511
- const byteArray = arrayBufferViewFromLocalStorage.buffer;
512
- const win = window;
513
- const cs = new win.DecompressionStream(encoding);
514
- const writer = cs.writable.getWriter();
515
- writer.write(byteArray);
516
- writer.close();
517
- const result = await new Response(cs.readable).arrayBuffer();
518
- return new TextDecoder().decode(result);
519
- }
520
- }
521
- PublisherManager.buildDate = __BUILD_DATE__;
522
- PublisherManager.changed = false;
523
- PublisherManager.saving = false;
524
- PublisherManager.saveId = 0;
525
- PublisherManager.instance = null;
526
- PublisherManager.modifiedCollectore = [];
527
- const internalProps = new Set([
528
- "invalidate",
529
- "onInvalidate",
530
- "offInvalidate",
531
- "onAssign",
532
- "offAssign",
533
- "startDynamicFilling",
534
- "stopDynamicFilling",
535
- "startTemplateFilling",
536
- "stopTemplateFilling",
537
- "onInternalMutation",
538
- "offInternalMutation",
539
- "set",
540
- "get",
541
- "$tag",
542
- "_cachedGet_",
543
- "_templateFillListeners_",
544
- "_fillListeners_",
545
- "_assignListeners_",
546
- "_invalidateListeners_",
547
- "_publishInternalMutation_",
548
- "hasListener",
549
- "delete",
550
- "_mutationListeners_",
551
- "_publishDynamicFilling_",
552
- "_publishInvalidation_",
553
- "_publishTemplateFilling_",
554
- "_publishAssignement_",
555
- "_proxies_",
556
- "parent",
557
- "_value_",
558
- "_is_savable_",
559
- "_lockInternalMutationPublishing_",
560
- "_instanceCounter_",
561
- "_assignmentId_",
562
- ]);
563
- /**
564
- * Le Proxy Javascript
565
- */
566
- export default class Publisher extends PublisherProxy {
567
- constructor(target, parentProxPub = null) {
568
- super(target, parentProxPub);
569
- const thisProxy = new Proxy(this, {
570
- /**
571
- * Lorsque l'on écrit monConteneur = publisher.maClef ou monConteneur = publisher["maClef"] monConteneur contient :
572
- * Les methodes de PublisherProxy (onAssign... : voir liste dans kle tableaus si dessous), si la clef est une méthode de PublisherProxy,,
573
- * Sinon un autre proxy qui a comme valeur interne la valeur corespondante à la clef dans l'objet.
574
- */
575
- get: function (publisherInstance, sKey) {
576
- if (sKey == Symbol.toPrimitive) {
577
- return () => thisProxy.get();
578
- }
579
- if (internalProps.has(sKey))
580
- return publisherInstance[sKey];
581
- if (!publisherInstance._proxies_.has(sKey)) {
582
- const vValue = publisherInstance._value_[sKey];
583
- const newPublisher = new Publisher(isComplex(vValue) ? vValue : { __value: vValue }, publisherInstance);
584
- newPublisher._proxies_.set("_parent_", thisProxy);
585
- publisherInstance._proxies_.set(sKey, newPublisher);
586
- }
587
- return publisherInstance._proxies_.get(sKey);
588
- },
589
- /**
590
- * Lorsque l'on écrit publisher.maClef = value ou publisher["maClef"] = value, on assigne la valeur à la clef dans l'objet interne.
591
- * Les gestionnairs associés sopnt déclenchés en conséquence de manière profonde et remontante si nécessaire.
592
- */
593
- set: function (publisherInstance, sKey, vValue) {
594
- //Fonctionnement pour la donnée interne pas de dispatch;
595
- if (sKey == "_value_") {
596
- publisherInstance._value_ = vValue;
597
- return true;
598
- }
599
- if (sKey == "_cachedGet_") {
600
- publisherInstance._cachedGet_ = vValue;
601
- return true;
602
- }
603
- if (sKey == "_assignmentId_") {
604
- publisherInstance._assignmentId_ = vValue;
605
- return true;
606
- }
607
- if (sKey == "_is_savable_") {
608
- publisherInstance._is_savable_ = vValue;
609
- return true;
610
- }
611
- if (sKey == "_instanceCounter_") {
612
- publisherInstance._instanceCounter_ = vValue;
613
- return true;
614
- }
615
- //Création du publisher si il n'existe pas
616
- if (!publisherInstance._proxies_.has(sKey)) {
617
- const newPublisher = new Publisher({}, publisherInstance);
618
- newPublisher._proxies_.set("_parent_", thisProxy);
619
- publisherInstance._proxies_.set(sKey, newPublisher);
620
- }
621
- //mis à jour et publication de la donnée si elle a changé
622
- const prevValue = publisherInstance._value_[sKey];
623
- if (prevValue !== vValue) {
624
- publisherInstance._value_[sKey] = vValue;
625
- publisherInstance._publishDynamicFilling_(sKey, vValue);
626
- publisherInstance._proxies_.get(sKey)?.set(isComplex(vValue) ? vValue : { __value: vValue });
627
- }
628
- //on retourne le proxy pour pouvoir chainer les assignements
629
- // return publisherInstance._proxies_.get(sKey);
630
- return true;
631
- },
632
- /**
633
- * Autres propriétés classiques d'un objet implémentées par le proxy
634
- */
635
- deleteProperty: function (publisherInstance, sKey) {
636
- publisherInstance;
637
- publisherInstance._publishDynamicFilling_(sKey, null);
638
- // if (!publisherInstance._proxies_.get(sKey)?.hasListener()) {
639
- // publisherInstance._proxies_.delete(sKey);
640
- // } else {
641
- publisherInstance._proxies_.get(sKey)?.set(null);
642
- // }
643
- return delete publisherInstance._value_[sKey];
644
- },
645
- // enumerate: function (publisherInstance, sKey): CoreJSType {
646
- // return publisherInstance._value_.keys();
647
- // },
648
- has: function (publisherInstance, sKey) {
649
- publisherInstance;
650
- return sKey in publisherInstance._value_ && sKey != "_lockInternalMutationPublishing_";
651
- },
652
- defineProperty: function (publisherInstance, sKey, oDesc) {
653
- publisherInstance;
654
- if (oDesc && "value" in oDesc) {
655
- publisherInstance._value_[sKey] = oDesc.value;
656
- }
657
- return true;
658
- // return publisherInstance._value_;
659
- },
660
- getOwnPropertyDescriptor: function (publisherInstance, sKey) {
661
- publisherInstance;
662
- sKey;
663
- return {
664
- enumerable: true,
665
- configurable: true,
666
- };
667
- },
668
- ownKeys: function (publisherInstance) {
669
- if (publisherInstance._value_.__value)
670
- return Object.keys(publisherInstance._value_.__value);
671
- return Object.keys(publisherInstance._value_);
672
- },
673
- });
674
- return thisProxy;
675
- }
676
- toString() {
677
- return "hey";
678
- }
679
- valueOf() {
680
- return 2;
681
- }
682
- getProperty(o, propertyName) {
683
- return o[propertyName]; // o[propertyName] is of type T[K]
684
- }
685
- }
686
- if (typeof module != "undefined")
687
- module.exports = { Publisher: Publisher, PublisherManager: PublisherManager };
688
- // /**
689
- // * A custom webcomponent wich will be linked to a publisher via its attribute "publisher"
690
- // * the publisher will be found via PublisherManager.get(publisherId) and will be used to fill the component using the onAssign method
691
- // */
692
- class PublisherWebComponent extends HTMLElement {
693
- constructor() {
694
- super();
695
- this.publisherId = "";
696
- this.onAssign = (value) => {
697
- this.innerHTML = value.toString();
698
- };
699
- }
700
- connectedCallback() {
701
- this.publisherId = this.getAttribute("publisher") || "";
702
- this.publisher = PublisherProxy.instances.get(parseInt(this.publisherId));
703
- this.publisher?.onAssign(this.onAssign);
704
- }
705
- disconnectedCallback() {
706
- this.publisher?.offAssign(this.onAssign);
707
- }
708
- }
709
- customElements.define("reactive-publisher-proxy", PublisherWebComponent);