@supersoniks/concorde 2.0.6 → 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 -287
  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 -74
  201. package/components.d.ts +0 -4
  202. package/concorde-core.bundle.js +0 -3427
  203. package/concorde-core.es.js +0 -14199
  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
@@ -0,0 +1,356 @@
1
+ # SDUI
2
+
3
+ ## What is SDUI?
4
+
5
+ SDUI stands for `Server Driven User Interfaces`.
6
+ Basically, it generates a user interface based on a JSON SDUI Descriptor.
7
+
8
+ ### Subscriber extension:
9
+
10
+ SDUI extends the mixin [Subscriber](#docs/_core-concept/subscriber.md/subscriber).
11
+ This means that you must set a dataProvider with an id pointing to the publisher that will hold your SDUI Descriptor.
12
+ This also means that it has a reactive property named `props` that you can set with the JSON SDUI Descriptor in order to configure it.
13
+
14
+ ### Fetcher extension:
15
+
16
+ SDUI extends the mixin Fetcher as [Fetch](#core/components/functional/fetch/fetch.md/fetch) and [List](#core/components/functional/list/list.md/list).
17
+
18
+ In this case, it will parse the JSON coming from the request.
19
+ The JSON must comply with the SDUI descriptor format.
20
+
21
+ As a fetcher, invalidating the publisher or updating the endpoint will trigger a new fetch and update accordingly.
22
+
23
+ ### Rendering:
24
+
25
+ It has no shadowdom, and its display style is set to `contents`, so an empty SDUI has the fewest impact on the layout.
26
+
27
+ ## SDUI descriptor
28
+
29
+ ### TypeScript definition:
30
+ <sonic-code language="typescript">
31
+ <template>
32
+ export type SDUIDescriptor = {
33
+ js?: Array&lt;string&gt;;
34
+ css?: Array&lt;string&gt;;
35
+ library?: Record&lt;string, SDUINode&gt;;
36
+ nodes?: Array&lt;SDUINode&gt;;
37
+ };
38
+ </template>
39
+ </sonic-code>
40
+
41
+ ### Meaning of the keys:
42
+
43
+ * **js**: An array of URLs pointing to JavaScript files to load.
44
+ * **css**: An array of URLs pointing to CSS files to load.
45
+ * **library**: A record of SDUINode definitions intended to be used as a model for other nodes. The keys of the record can be used as the libraryKey of the node. This node will then specialize the model with its own descriptor.
46
+ * **nodes**: An array of SDUINode descriptors. Each SDUINode will result in an HTMLElement added to the root of the component.
47
+
48
+ ## SDUINode
49
+
50
+ ### Descriptor
51
+
52
+ An SDUINode represents an HTMLElement.
53
+
54
+ TypeScript definition:
55
+
56
+ <sonic-code language="typescript">
57
+ <template>
58
+ export type SDUINode = {
59
+ markup?: string;
60
+ tagName?: string;
61
+ attributes?: Record&lt;string, string&gt;;
62
+ nodes?: Array&lt;SDUINode&gt;;
63
+ innerHTML?: string;
64
+ prefix?: string;
65
+ suffix?: string;
66
+ libraryKey?: string;
67
+ contentElementSelector?: string;
68
+ parentElementSelector?: string;
69
+ };
70
+ </template>
71
+ </sonic-code>
72
+
73
+ Summary of properties:
74
+ * **markup**: Use it if you prefer to define your node entirely using an HTML string.
75
+ * **tagName**: The tag name of the HTML element.
76
+ * **attributes**: A string key/value pair storing each attribute name/value of the HTML element created.
77
+ * **nodes**: An array of SDUINode descriptors. The children of the HTMLElement are created this way.
78
+ * **innerHTML**: The inner HTML of the current node is defined here if needed.
79
+ * **prefix**: Use it if you want to wrap the component with some HTML string in conjunction with the suffix.
80
+ * **suffix**: Use it if you want to wrap the component with some HTML string in conjunction with the prefix.
81
+ * **libraryKey**: An identifier that points to an SDUINode to be used as a model for this node.
82
+ * **contentElementSelector**: For SDUINodes defined in the library only. It is a CSS selector that defines where child nodes are added.
83
+ * **parentElementSelector**: If the current node, as a future child, has a `parentElementSelector` attribute, it is added to the node corresponding to the associated CSS selector rather than directly to the element.
84
+
85
+ ### Markup
86
+ Use it if you prefer to define your node entirely using an HTML string.
87
+
88
+ <sonic-code>
89
+ <template>
90
+ <sonic-sdui
91
+ dataProvider="sdui-markup-example"
92
+ props='{
93
+ "nodes":[
94
+ {
95
+ "markup":"keep shouting <sonic-badge>foo</sonic-badge> <sonic-badge>bar</sonic-badge> !"
96
+ }
97
+ ]}'
98
+ ></sonic-sdui>
99
+ </template>
100
+ </sonic-code>
101
+
102
+ ### Tag name
103
+ Here we use the field `tagName` of SDUINode to create an element with tag name `sonic-input`.
104
+
105
+ <sonic-code>
106
+ <template>
107
+ <sonic-sdui
108
+ dataProvider="sdui-tagName-example"
109
+ props='{
110
+ "nodes":[
111
+ {
112
+ "tagName":"sonic-input"
113
+ }
114
+ ]}'
115
+ ></sonic-sdui>
116
+ </template>
117
+ </sonic-code>
118
+
119
+ ### Attributes
120
+ A string key/value pair storing each attribute name/value of the HTML element created.
121
+ As no tag name is defined, a div element is created.
122
+ Here we define the style attribute to create a tiny red square.
123
+
124
+ <sonic-code>
125
+ <template>
126
+ <sonic-sdui
127
+ dataProvider="sdui-attributes-example"
128
+ props='{
129
+ "nodes":[{
130
+ "attributes":{
131
+ "style":"width:50px;height:10px;background:red;"
132
+ }
133
+ }]
134
+ }'
135
+ ></sonic-sdui>
136
+ </template>
137
+ </sonic-code>
138
+
139
+ ### Nodes
140
+ Children of the current node can be added using the field `nodes` recursively.
141
+
142
+ <sonic-code>
143
+ <template>
144
+ <sonic-sdui
145
+ dataProvider="sdui-nodes-example"
146
+ props='{
147
+ "nodes":[{
148
+ "nodes":[
149
+ {"innerHTML":"A"},
150
+ {
151
+ "prefix":"B",
152
+ "nodes":[
153
+ {"innerHTML":"👉 B.1"},
154
+ {"innerHTML":"👉 B.2"}
155
+ ]
156
+ }
157
+ ]
158
+ }]
159
+ }'
160
+ ></sonic-sdui>
161
+ </template>
162
+ </sonic-code>
163
+
164
+ ### InnerHTML
165
+ As no tag name is defined, a div element is created, and then we use `innerHTML` to add content to it.
166
+
167
+ <sonic-code>
168
+ <template>
169
+ <sonic-sdui
170
+ dataProvider="sdui-html-example"
171
+ props='{
172
+ "nodes":[{
173
+ "innerHTML":"keep shouting <sonic-badge>foo</sonic-badge> <sonic-badge>bar</sonic-badge> !"
174
+ }]
175
+ }'
176
+ ></sonic-sdui>
177
+ </template>
178
+ </sonic-code>
179
+
180
+ ### Prefix and suffix
181
+ Use them if you want to wrap the component with some HTML string.
182
+
183
+ <sonic-code>
184
+ <template>
185
+ <sonic-sdui
186
+ dataProvider="sdui-prefixSuffix-example"
187
+ props='{
188
+ "nodes":[{
189
+ "prefix":"👇",
190
+ "suffix":"☝️",
191
+ "innerHTML":"The node content"
192
+ }]
193
+ }'
194
+ ></sonic-sdui>
195
+ </template>
196
+ </sonic-code>
197
+
198
+ ### Library key and contentElementSelector
199
+ The libraryKey of SDUINode is an identifier that points to an SDUINode description in the library to be used as a model for this node.
200
+
201
+ Note that the SDUI has a default library containing some basic component definitions useful for form declaration (see default-library.json).
202
+
203
+ This example uses the library key `submit` which points to a `sonic-submit` containing a button also coming from the library.
204
+
205
+ The element named `button` in the library is a `sonic-button` of type `success` containing a check icon as a prefix.
206
+
207
+ Since the `submit` library element contains an attribute `contentElementSelector` with the value `sonic-button`, the "injected content" is put inside the button.
208
+
209
+ We used `innerHTML` for the sake of simplicity, but you can use nodes to add any complex content.
210
+
211
+ <sonic-code>
212
+ <template>
213
+ <sonic-sdui dataProvider="sdui-library-example" props='
214
+ {
215
+ "nodes":[
216
+ {
217
+ "libraryKey":"submit",
218
+ "innerHTML":"Injected content"
219
+ }
220
+ ]
221
+ }
222
+ '></sonic-sdui>
223
+ </template>
224
+ </sonic-code>
225
+
226
+ ### parentElementSelector
227
+
228
+ This special field lets you inject the content at any place in the HTML flow already set inside the parent SDUI component by using a CSS selector.
229
+
230
+ ⚠️ Note that it doesn't work with top-level nodes.
231
+
232
+ <sonic-code>
233
+ <template>
234
+ <sonic-sdui dataProvider="sdui-parentElementSelector-example" props='
235
+ {
236
+ "nodes":[
237
+ {
238
+ "nodes":[
239
+ {
240
+ "prefix":"👇 Selected parent element",
241
+ "suffix":"☝️ End of selected parent element",
242
+ "tagName":"span"
243
+ },
244
+ {
245
+ "parentElementSelector":"span",
246
+ "innerHTML":"Content having a parentElementSelector attribute"
247
+ }
248
+ ]
249
+ }
250
+ ]
251
+ }
252
+ '></sonic-sdui>
253
+ </template>
254
+ </sonic-code>
255
+
256
+ ### Fetch example:
257
+
258
+ <sonic-code>
259
+ <template>
260
+ <sonic-sdui dataProvider="sdui-fetch-example" endPoint="/src/core/components/functional/sdui/example.json"></sonic-sdui>
261
+ </template>
262
+ </sonic-code>
263
+
264
+ ## Transformers:
265
+
266
+ The transformers let you transform the structure of the SDUI Descriptor into a new one before parsing and rendering it.
267
+
268
+ To enable it, you must fill the `transformation` attribute of the component with a URL pointing to a Transform descriptor.
269
+
270
+ <sonic-code language="typescript">
271
+ <template>
272
+ export type SDUITransformDescription = {
273
+ library?: Record&lt;string, SDUINode&gt;;
274
+ transforms: Array&lt;SDUITransformAction&gt;;
275
+ };
276
+ </template>
277
+ </sonic-code>
278
+
279
+ ### The library:
280
+
281
+ Each key of the library will be merged with the current library in the SDUI Descriptor, by replacing or creating items library key by key.
282
+
283
+ ### The transform actions:
284
+
285
+ Each transform represents an action that will be done on the SDUI descriptor before the creation of the entire UI.
286
+
287
+ <sonic-code language="typescript">
288
+ <template>
289
+ export type SDUITransformAction = {
290
+ action: SDUITransformActionName;
291
+ patterns?: Array&lt;SDUINode&gt;;
292
+ after?: SDUINode;
293
+ before?: SDUINode;
294
+ in?: SDUINode;
295
+ ui?: SDUINode;
296
+ };
297
+ </template>
298
+ </sonic-code>
299
+
300
+ The action that will be done is a verb:
301
+
302
+ <sonic-code language="typescript">
303
+ <template>
304
+ export type SDUITransformActionName = "remap" | "unwrap" | "wrap" | "delete" | "insert" | "move";
305
+ </template>
306
+ </sonic-code>
307
+
308
+ * **remap**: The properties (tagName, innerHTML, etc.) of the targeted SDUINode will be created/changed according to their presence in the `ui` (SDUINode) property of the transformAction.
309
+ * **unwrap**: Replaces the targeted SDUINode in place with its children.
310
+ * **wrap**: Groups all SDUINodes targeted by the patterns into the new SDUINode described in the `ui` prop of the transformAction.
311
+ * **delete**: Deletes the targeted item.
312
+ * **insert**: Inserts a new SDUINode described by the `ui` prop into the flow. The position of insertion depends on the presence of the attributes `before`, `after`, `in`, which is a pattern to target an existing SDUINode.
313
+
314
+ ## Misc Tricks:
315
+
316
+ ### sduiKey
317
+
318
+ This is an HTML attribute to set on the component if needed. In this case, the component will not treat its props value directly as an SDUI descriptor. Internally, it will basically extract the SDUIDescriptor by doing something like this: `const sduiDescriptor = this.props[this.sduikey]`.
319
+
320
+ ### messageKey
321
+
322
+ This is an HTML attribute to set on the component if needed. In this case, the component will automatically create a `sonic-toast-message-subscriber` component. The data found in `props[messageKey]` will be treated as the data expected by the `sonic-toast-message-subscriber`. So, by respecting the format of data supported by this component, you will be able to show multiple toasts in the result of a request.
323
+
324
+ Example of JSON with `messageKey`=`messages`:
325
+ <sonic-code language="typescript">
326
+ <template>
327
+ {
328
+ "messages": [{
329
+ "content": "The product has been added to your cart",
330
+ "status": "success",
331
+ "type": "public"
332
+ }]
333
+ }
334
+ </template>
335
+ </sonic-code>
336
+
337
+ ### library
338
+
339
+ This is an HTML attribute to set on the component if needed. You can set a URL pointing to a JSON describing a library with the same structure as the library in the SDUIDescriptor. The component will simply override its library with the given one.
340
+
341
+ ## Playground
342
+
343
+ Here is a little playground to let you test some simple tricks.
344
+
345
+ <sonic-code>
346
+ <template>
347
+ <sonic-textarea
348
+ rows="10"
349
+ onChange="SonicPublisherManager.get('sdui-playground').set(JSON.parse(this.value))"
350
+ value='{"nodes":[{"tagName":"div", "innerHTML":"test"}]}'
351
+ >
352
+ </sonic-textarea>
353
+ <sonic-sdui dataProvider="sdui-playground" props='{"nodes":[{"tagName":"div", "innerHTML":"test"}]}'>
354
+ </sonic-sdui>
355
+ </template>
356
+ </sonic-code>
@@ -0,0 +1,230 @@
1
+ import default_library from "@supersoniks/concorde/core/components/functional/sdui/default-library.json";
2
+ import SDUIDescriptorTransformer from "@supersoniks/concorde/core/components/functional/sdui/SDUIDescriptorTransformer";
3
+ import {
4
+ SDUIDescriptor,
5
+ SDUINode,
6
+ SDUITransformDescription,
7
+ } from "@supersoniks/concorde/core/components/functional/sdui/types";
8
+ import {Fetcher, Subscriber} from "@supersoniks/concorde/mixins";
9
+
10
+ import {HTML, Objects} from "@supersoniks/concorde/utils";
11
+ import {LitElement, PropertyValues} from "lit";
12
+ import {customElement, property} from "lit/decorators.js";
13
+ const tagName = "sonic-sdui"; // For Astro.build
14
+ /**
15
+ * ### sonic-sdui (Server Driven User Interface) est un fetcher chargant un JSON décrivant une interface utilisateur
16
+ *
17
+ * Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
18
+ *
19
+ * * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
20
+ * Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
21
+ * * Le format du JSON est décrit par le type SDUIDescriptor
22
+ * * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la génération de l'interface utilisateur<br>
23
+ * Son format est décrit par le type SDUITransformDescription
24
+ *
25
+ * * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
26
+ * *
27
+ */
28
+ @customElement(tagName)
29
+ export class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
30
+ connectedCallback(): void {
31
+ this.noShadowDom = "";
32
+ this.displayContents = true;
33
+ this.isFetchEnabled = this.hasAttribute("fetch");
34
+ super.connectedCallback();
35
+ }
36
+
37
+ @property() sduiKey?: string;
38
+ @property() messagesKey?: string;
39
+ private sduiDescriptor: SDUIDescriptor = {};
40
+
41
+ /**
42
+ * On peut passer la description sous form de props, sinon il faut utiliser l'attribut fetch
43
+ */
44
+
45
+ willUpdate(changedProperties: PropertyValues): void {
46
+ if (this.props == null) {
47
+ this.sduiDescriptor = {};
48
+ }
49
+ {
50
+ const newSduiDescriptor = this.sduiKey
51
+ ? (this.props as Record<string, SDUIDescriptor>)[this.sduiKey]
52
+ : (this.props as SDUIDescriptor);
53
+ if (this.sduiDescriptor == newSduiDescriptor) return;
54
+ this.sduiDescriptor = newSduiDescriptor;
55
+ this.updateContents();
56
+ }
57
+ super.willUpdate(changedProperties);
58
+ }
59
+
60
+ /**
61
+ * updateContents est déclenché quand les sduiDescriptor sont renseignées
62
+ * Le contenu du composant est regénéré en fonction du descripteur fourni
63
+ */
64
+ async updateContents() {
65
+ if (!this.sduiDescriptor) return;
66
+ const library: Record<string, SDUINode> = {};
67
+ Object.assign(library, default_library, this.sduiDescriptor.library);
68
+ this.sduiDescriptor.library = library;
69
+ this.loadAssets();
70
+ await this.loadLibrary();
71
+ await this.transformSDUIDescriptor();
72
+ this.parseRootNodes();
73
+ }
74
+ /**
75
+ * Suppressiond du contenu du composant avant le génération de la nouvelle ui
76
+ */
77
+ private removeChildren() {
78
+ while ([...this.children].filter((elt) => elt.nodeName != "SLOT").length > 0) {
79
+ this.removeChild(this.children[0]);
80
+ }
81
+ }
82
+ /**
83
+ * Chargement de fichiers js et css associés si besoin
84
+ **/
85
+ private loadAssets() {
86
+ if (!this.sduiDescriptor) return;
87
+ if (this.sduiDescriptor.js) {
88
+ for (const src of this.sduiDescriptor.js) HTML.loadJS(src);
89
+ }
90
+ if (this.sduiDescriptor.css) {
91
+ for (const src of this.sduiDescriptor.css) HTML.loadCSS(src);
92
+ }
93
+ }
94
+ /**
95
+ * Transformation de la data fournie via sduiDescriptor si il y a un attribut transformation
96
+ * */
97
+ private async transformSDUIDescriptor() {
98
+ if (!this.hasAttribute("transformation")) return;
99
+ const result = await fetch(this.getAttribute("transformation"));
100
+ const json: SDUITransformDescription = await result.json();
101
+ const transformer = new SDUIDescriptorTransformer();
102
+ await transformer.transform(this.sduiDescriptor, json);
103
+ }
104
+ /**
105
+ * Charge la library à utiliser
106
+ * */
107
+ private async loadLibrary() {
108
+ if (!this.hasAttribute("library")) return;
109
+ const result = await fetch(this.getAttribute("library"));
110
+ const json: Record<string, SDUINode> = await result.json();
111
+ this.sduiDescriptor.library = json;
112
+ }
113
+ /**
114
+ * Point d'entrée : transformation des noeuds fournis en éléments graphiques
115
+ **/
116
+ private parseRootNodes() {
117
+ this.removeChildren();
118
+ if (!this.sduiDescriptor) return;
119
+ let nodes = this.sduiDescriptor.nodes;
120
+ if (!nodes) nodes = [];
121
+ const messageProvider = {tagName: "sonic-toast-message-subscriber", attributes: {}};
122
+ if (this.messagesKey) {
123
+ messageProvider.attributes = {subDataProvider: this.messagesKey};
124
+ }
125
+ nodes.push(messageProvider);
126
+ nodes.forEach((node) => this.appendChild(this.parseChild(node)));
127
+ }
128
+ /**
129
+ * On parse un noeud ce qui crée un éléments graphique et ses enfants par recursivité via `handleChildNodes`
130
+ */
131
+ private parseChild(node: SDUINode) {
132
+ const tagName = node.tagName || "div";
133
+ let {element, contentElement} = this.handleLibrary(node, tagName);
134
+ this.handleAttributes(node, element);
135
+ element = this.handleMarkup(node, element);
136
+ if (!contentElement) contentElement = element;
137
+ this.handleChildNodes(node, contentElement, element);
138
+ this.handleInnerHTML(node, contentElement);
139
+ if (node.prefix || node.suffix) {
140
+ const container = this.handlePrefixSuffix(node, element);
141
+ return container;
142
+ }
143
+ return element;
144
+ }
145
+ /**
146
+ * Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces sduiDescriptor.
147
+ * Le tout est inclu dans une div en display contents
148
+ */
149
+ private handlePrefixSuffix(node: SDUINode, element: HTMLElement) {
150
+ const container = document.createElement("div");
151
+ container.innerHTML = (node.prefix || "") + element.outerHTML + (node.suffix || "");
152
+ container.style.display = "contents";
153
+ return container;
154
+ }
155
+ /**
156
+ * Création des enfants du noeud courant
157
+ * Si l'enfant à un attribut parentElementSelector, il est ajouté dans le noeud correspondant au sélecteur css associé et non pas dans l'élément directement.
158
+ */
159
+ private handleChildNodes(node: SDUINode, contentElement: HTMLElement, element: HTMLElement) {
160
+ if (node.nodes) {
161
+ const children: Array<SDUINode> = node.nodes;
162
+ for (const child of children) {
163
+ const childElement = this.parseChild(child);
164
+ let nodeToAppendOn = contentElement;
165
+ if (child.parentElementSelector) {
166
+ nodeToAppendOn = element.querySelector(child.parentElementSelector) || contentElement;
167
+ }
168
+ if (nodeToAppendOn.shadowRoot) nodeToAppendOn.shadowRoot.appendChild(childElement);
169
+ else if (nodeToAppendOn.tagName.toLocaleLowerCase() == "template") {
170
+ const template: HTMLTemplateElement = nodeToAppendOn as HTMLTemplateElement;
171
+ template.content.appendChild(childElement);
172
+ } else nodeToAppendOn.appendChild(childElement);
173
+ }
174
+ }
175
+ }
176
+ /**
177
+ * Gestion de librarie :
178
+ * * Si l'élément référence un élément de la librairie, on se sert de cet élément comme model pour créer le composant graphique.
179
+ * * Sa propriété contentElement retournée vaut element par défaut.
180
+ * * Si contentElementSelector est definit, alors contentElement correspond à l'élément obtenu par selection css d'après la valeurs de contentElementSelector
181
+ * * Les éléments enfants seront ensuite ajoutés dans contentElement
182
+ */
183
+ private handleLibrary(node: SDUINode, tagName: string) {
184
+ let element: HTMLElement;
185
+ let contentElement: HTMLElement | undefined;
186
+ if (node.libraryKey && this.sduiDescriptor.library) {
187
+ element = this.parseChild(this.sduiDescriptor.library[node.libraryKey] || {tagName: "div"});
188
+ const selector = (this.sduiDescriptor.library[node.libraryKey] || {}).contentElementSelector;
189
+ if (selector) contentElement = element.querySelector(selector) as HTMLElement;
190
+ } else element = document.createElement(tagName) as HTMLElement;
191
+ return {element, contentElement};
192
+ }
193
+ /**
194
+ * Remplissage des attributs html avec les attributs fournis dans le noeud
195
+ */
196
+ private handleAttributes(node: SDUINode, element: HTMLElement) {
197
+ const attributes = node.attributes;
198
+ for (const k in attributes) {
199
+ const attrData: object | string = attributes[k];
200
+ const attr: string = Objects.isObject(attrData) ? JSON.stringify(attrData) : attrData;
201
+ element.setAttribute(k, attr);
202
+ }
203
+ }
204
+ /**
205
+ * Si une propriété markup est fournie, l'élément est créé à partir de la chaine html fournie avant d'être configuré
206
+ */
207
+ private handleMarkup(node: SDUINode, element: HTMLElement) {
208
+ if (node.markup) {
209
+ element = document.createElement("div");
210
+ element.style.display = "contents";
211
+ element.innerHTML = node.markup;
212
+ }
213
+ return element;
214
+ }
215
+
216
+ /**
217
+ * si le noeud à une propriété innerHTML, on l'ajout ay innerHTML de l'élément html en cours de création
218
+ */
219
+ private handleInnerHTML(node: SDUINode, contentElement: HTMLElement | undefined) {
220
+ if (!node.innerHTML) return;
221
+ if (node.innerHTML.indexOf("wording_") != -1) {
222
+ const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
223
+ this.api?.post(wordingProvider, {labels: [node.innerHTML.substring(8)]}).then((value) => {
224
+ if (contentElement) contentElement.innerHTML += value;
225
+ });
226
+ } else if (contentElement) {
227
+ contentElement.innerHTML += node.innerHTML;
228
+ }
229
+ }
230
+ }
@@ -0,0 +1,34 @@
1
+ export type SDUIDescriptor = {
2
+ js?: Array<string>;
3
+ css?: Array<string>;
4
+ library?: Record<string, SDUINode>;
5
+ nodes?: Array<SDUINode>;
6
+ };
7
+ export type SDUINode = {
8
+ libraryKey?: string;
9
+ markup?: string;
10
+ tagName?: string;
11
+ attributes?: Record<string, string>;
12
+ nodes?: Array<SDUINode>;
13
+ innerHTML?: string;
14
+ prefix?: string;
15
+ suffix?: string;
16
+ contentElementSelector?: string;
17
+ parentElementSelector?: string;
18
+ };
19
+
20
+ export type SDUITransformDescription = {
21
+ library?: Record<string, SDUINode>;
22
+ transforms: Array<SDUITransformAction>;
23
+ };
24
+ export type SDUITransformActionName = "remap" | "unwrap" | "wrap" | "delete" | "insert" | "move";
25
+ export type SDUITransformActionFunction = (transformAction: SDUITransformAction, list: SDUITransformList) => void;
26
+ export type SDUITransformAction = {
27
+ action: SDUITransformActionName;
28
+ patterns?: Array<SDUINode>;
29
+ after?: SDUINode;
30
+ before?: SDUINode;
31
+ in?: SDUINode;
32
+ ui?: SDUINode;
33
+ };
34
+ export type SDUITransformList = Array<{parent: SDUINode; child: SDUINode; index: number}>;
@@ -0,0 +1,13 @@
1
+ import {html, LitElement} from "lit";
2
+ import {customElement} from "lit/decorators.js";
3
+ const tagName = "sonic-scope";
4
+
5
+ @customElement(tagName)
6
+ export class SonicScope extends LitElement {
7
+ protected createRenderRoot() {
8
+ return this;
9
+ }
10
+ render() {
11
+ return html`<slot></slot>`;
12
+ }
13
+ }