@supersoniks/concorde 2.0.7 → 3.0.1
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.
- package/build-infos.json +1 -0
- package/concorde-core.bundle.js +387 -344
- package/concorde-core.es.js +8040 -11093
- package/index.html +44 -0
- package/notes de migration.md +21 -0
- package/package.json +23 -290
- package/scripts/postbuild.mjs +22 -0
- package/scripts/prebuild.mjs +22 -0
- package/{components.js → src/components.ts} +5 -2
- package/src/concorde-loaded.ts +3 -0
- package/src/core/_types/types.ts +55 -0
- package/src/core/components/functional/date/date.md +290 -0
- package/src/core/components/functional/date/date.ts +206 -0
- package/src/core/components/functional/example/example.ts +11 -0
- package/src/core/components/functional/fetch/fetch.md +117 -0
- package/{core/components/functional/fetch/fetch.js → src/core/components/functional/fetch/fetch.ts} +33 -37
- package/src/core/components/functional/if/if.md +16 -0
- package/src/core/components/functional/if/if.test.ts +40 -0
- package/src/core/components/functional/if/if.ts +23 -0
- package/src/core/components/functional/list/list.md +194 -0
- package/src/core/components/functional/list/list.ts +236 -0
- package/src/core/components/functional/mix/mix.md +41 -0
- package/src/core/components/functional/mix/mix.ts +95 -0
- package/src/core/components/functional/queue/queue.md +87 -0
- package/src/core/components/functional/queue/queue.ts +279 -0
- package/src/core/components/functional/router/redirect.ts +44 -0
- package/src/core/components/functional/router/router.md +112 -0
- package/src/core/components/functional/router/router.ts +108 -0
- package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +229 -0
- package/{core → src/core}/components/functional/sdui/default-library.json +13 -13
- package/src/core/components/functional/sdui/example.json +99 -0
- package/src/core/components/functional/sdui/sdui-utils.ts +62 -0
- package/src/core/components/functional/sdui/sdui.md +356 -0
- package/src/core/components/functional/sdui/sdui.ts +230 -0
- package/src/core/components/functional/sdui/types.ts +34 -0
- package/src/core/components/functional/sonic-scope/sonic-scope.ts +13 -0
- package/src/core/components/functional/states/states.md +87 -0
- package/src/core/components/functional/states/states.ts +121 -0
- package/src/core/components/functional/submit/submit.md +48 -0
- package/src/core/components/functional/submit/submit.ts +265 -0
- package/src/core/components/functional/subscriber/subscriber.md +91 -0
- package/src/core/components/functional/subscriber/subscriber.ts +28 -0
- package/src/core/components/functional/value/value.md +35 -0
- package/src/core/components/functional/value/value.ts +18 -0
- package/{core/components/ui/_css/scroll.js → src/core/components/ui/_css/scroll.ts} +3 -2
- package/{core/components/ui/_css/size.js → src/core/components/ui/_css/size.ts} +5 -2
- package/{core/components/ui/_css/type.js → src/core/components/ui/_css/type.ts} +5 -3
- package/src/core/components/ui/alert/alert.md +121 -0
- package/src/core/components/ui/alert/alert.ts +177 -0
- package/src/core/components/ui/badge/badge.md +102 -0
- package/{core/components/ui/badge/badge.js → src/core/components/ui/badge/badge.ts} +36 -51
- package/src/core/components/ui/button/button.md +184 -0
- package/{core/components/ui/button/button.js → src/core/components/ui/button/button.ts} +258 -302
- package/src/core/components/ui/captcha/captcha.md +12 -0
- package/src/core/components/ui/captcha/captcha.ts +88 -0
- package/src/core/components/ui/card/card-footer.ts +19 -0
- package/src/core/components/ui/card/card-header-descripton.ts +24 -0
- package/{core/components/ui/card/card-header.js → src/core/components/ui/card/card-header.ts} +28 -38
- package/src/core/components/ui/card/card-main.ts +24 -0
- package/src/core/components/ui/card/card.md +96 -0
- package/{core/components/ui/card/card.js → src/core/components/ui/card/card.ts} +23 -34
- package/src/core/components/ui/divider/divider.md +35 -0
- package/{core/components/ui/divider/divider.js → src/core/components/ui/divider/divider.ts} +35 -65
- package/src/core/components/ui/form/checkbox/checkbox.md +96 -0
- package/{core/components/ui/form/checkbox/checkbox.js → src/core/components/ui/form/checkbox/checkbox.ts} +79 -98
- package/{core/components/ui/form/css/form-control.js → src/core/components/ui/form/css/form-control.ts} +9 -5
- package/src/core/components/ui/form/fieldset/fieldset.md +129 -0
- package/src/core/components/ui/form/fieldset/fieldset.ts +96 -0
- package/src/core/components/ui/form/fieldset/legend-description.ts +23 -0
- package/src/core/components/ui/form/fieldset/legend.ts +90 -0
- package/src/core/components/ui/form/form-actions/form-actions.md +77 -0
- package/src/core/components/ui/form/form-actions/form-actions.ts +32 -0
- package/src/core/components/ui/form/form-layout/form-layout.md +43 -0
- package/src/core/components/ui/form/form-layout/form-layout.ts +71 -0
- package/src/core/components/ui/form/input/input.md +168 -0
- package/src/core/components/ui/form/input/input.ts +227 -0
- package/src/core/components/ui/form/input/password-helper.ts +68 -0
- package/src/core/components/ui/form/input/same-value-helper.ts +48 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +285 -0
- package/src/core/components/ui/form/radio/radio.md +86 -0
- package/src/core/components/ui/form/radio/radio.ts +44 -0
- package/src/core/components/ui/form/select/select.md +99 -0
- package/src/core/components/ui/form/select/select.ts +310 -0
- package/src/core/components/ui/form/textarea/textarea.md +66 -0
- package/src/core/components/ui/form/textarea/textarea.ts +119 -0
- package/src/core/components/ui/group/group.md +75 -0
- package/src/core/components/ui/group/group.ts +101 -0
- package/src/core/components/ui/icon/icon.md +125 -0
- package/src/core/components/ui/icon/icon.stories.ts +100 -0
- package/src/core/components/ui/icon/icon.ts +106 -0
- package/src/core/components/ui/icon/icons.json +1 -0
- package/src/core/components/ui/icon/icons.ts +130 -0
- package/src/core/components/ui/icon/svgs/cancel.svg +3 -0
- package/src/core/components/ui/icon/svgs/check-circled-outline.svg +4 -0
- package/src/core/components/ui/icon/svgs/check.svg +3 -0
- package/src/core/components/ui/icon/svgs/emoji-puzzled.svg +1 -0
- package/src/core/components/ui/icon/svgs/info-empty.svg +5 -0
- package/src/core/components/ui/icon/svgs/loader.svg +1 -0
- package/src/core/components/ui/icon/svgs/minus-small.svg +3 -0
- package/src/core/components/ui/icon/svgs/more-horiz.svg +5 -0
- package/src/core/components/ui/icon/svgs/more-vert.svg +5 -0
- package/src/core/components/ui/icon/svgs/nav-arrow-down.svg +3 -0
- package/src/core/components/ui/icon/svgs/warning-circled-outline.svg +5 -0
- package/src/core/components/ui/image/image.md +107 -0
- package/src/core/components/ui/image/image.ts +117 -0
- package/src/core/components/ui/link/link.md +43 -0
- package/src/core/components/ui/link/link.ts +108 -0
- package/src/core/components/ui/loader/loader.md +37 -0
- package/src/core/components/ui/loader/loader.stories.ts +25 -0
- package/src/core/components/ui/loader/loader.ts +81 -0
- package/{core/components/ui/loader/styles/fixed.js → src/core/components/ui/loader/styles/fixed.ts} +2 -1
- package/{core/components/ui/loader/styles/inline.js → src/core/components/ui/loader/styles/inline.ts} +3 -2
- package/src/core/components/ui/menu/menu-item.ts +30 -0
- package/src/core/components/ui/menu/menu.md +288 -0
- package/src/core/components/ui/menu/menu.ts +292 -0
- package/src/core/components/ui/modal/modal-actions.ts +35 -0
- package/src/core/components/ui/modal/modal-close.ts +36 -0
- package/src/core/components/ui/modal/modal-content.ts +19 -0
- package/src/core/components/ui/modal/modal-subtitle.ts +23 -0
- package/src/core/components/ui/modal/modal-title.ts +22 -0
- package/src/core/components/ui/modal/modal.md +123 -0
- package/src/core/components/ui/modal/modal.stories.ts +140 -0
- package/src/core/components/ui/modal/modal.ts +386 -0
- package/src/core/components/ui/pop/pop.md +79 -0
- package/src/core/components/ui/pop/pop.ts +291 -0
- package/src/core/components/ui/progress/progress.md +65 -0
- package/{core/components/ui/progress/progress.js → src/core/components/ui/progress/progress.ts} +31 -50
- package/src/core/components/ui/table/table-caption.ts +21 -0
- package/src/core/components/ui/table/table-tbody.ts +32 -0
- package/src/core/components/ui/table/table-td.ts +47 -0
- package/src/core/components/ui/table/table-tfoot.ts +20 -0
- package/src/core/components/ui/table/table-th.ts +56 -0
- package/src/core/components/ui/table/table-thead.ts +18 -0
- package/src/core/components/ui/table/table-tr.ts +48 -0
- package/src/core/components/ui/table/table.md +467 -0
- package/{core/components/ui/table/table.js → src/core/components/ui/table/table.ts} +32 -53
- package/{core/components/ui/theme/theme-collection/core-variables.js → src/core/components/ui/theme/theme-collection/core-variables.ts} +3 -2
- package/{core/components/ui/theme/theme-collection/dark.js → src/core/components/ui/theme/theme-collection/dark.ts} +5 -3
- package/{core/components/ui/theme/theme-collection/light.js → src/core/components/ui/theme/theme-collection/light.ts} +3 -2
- package/src/core/components/ui/theme/theme.ts +118 -0
- package/src/core/components/ui/toast/message-subscriber.stories.ts +43 -0
- package/src/core/components/ui/toast/message-subscriber.ts +37 -0
- package/{core/components/ui/toast/toast-item.js → src/core/components/ui/toast/toast-item.ts} +86 -113
- package/src/core/components/ui/toast/toast.ts +237 -0
- package/src/core/components/ui/toast/types.ts +14 -0
- package/src/core/components/ui/tooltip/tooltip.md +37 -0
- package/{core/components/ui/tooltip/tooltip.js → src/core/components/ui/tooltip/tooltip.ts} +26 -47
- package/{core/components/ui/ui.js → src/core/components/ui/ui.ts} +2 -0
- package/src/core/core.ts +22 -0
- package/src/core/decorators/Subscriber.ts +187 -0
- package/src/core/directives/DataProvider.ts +113 -0
- package/src/core/directives/Wording.ts +220 -0
- package/src/core/mixins/Fetcher.ts +258 -0
- package/src/core/mixins/FormCheckable.ts +287 -0
- package/src/core/mixins/FormElement.ts +275 -0
- package/src/core/mixins/FormInput.ts +135 -0
- package/src/core/mixins/Subscriber.ts +352 -0
- package/src/core/mixins/TemplatesContainer.ts +70 -0
- package/{core/mixins/mixins.d.ts → src/core/mixins/mixins.ts} +1 -1
- package/src/core/utils/Arrays.ts +161 -0
- package/src/core/utils/DataBindObserver.ts +286 -0
- package/src/core/utils/Electron.ts +15 -0
- package/src/core/utils/Format.ts +58 -0
- package/src/core/utils/HTML.ts +126 -0
- package/src/core/utils/LocationHandler.ts +139 -0
- package/src/core/utils/Objects.ts +103 -0
- package/src/core/utils/PublisherProxy.ts +786 -0
- package/src/core/utils/Utils.ts +12 -0
- package/src/core/utils/api.ts +456 -0
- package/{core/utils/url-pattern.d.ts → src/core/utils/url-pattern.ts} +1 -0
- package/{decorators.js → src/decorators.ts} +6 -2
- package/{directives.js → src/directives.ts} +11 -6
- package/src/docs/_core-concept/overview.md +57 -0
- package/src/docs/_core-concept/subscriber.md +76 -0
- package/src/docs/_getting-started/concorde-outside.md +141 -0
- package/src/docs/_getting-started/create-a-component.md +137 -0
- package/src/docs/_getting-started/pubsub.md +150 -0
- package/src/docs/_getting-started/start.md +37 -0
- package/src/docs/_getting-started/theming.md +91 -0
- package/src/docs/code.ts +281 -0
- package/src/docs/docs.ts +6 -0
- package/src/docs/example/users.ts +64 -0
- package/src/docs/navigation/navigation.ts +101 -0
- package/src/docs/prism/index.ts +6 -0
- package/src/docs/prism/prism.css +158 -0
- package/src/docs/prism/prism.js +1022 -0
- package/src/docs/search/docs-search.json +3767 -0
- package/src/docs/search/markdown-renderer.ts +40 -0
- package/src/docs/search/page.ts +40 -0
- package/src/docs/search/search.ts +184 -0
- package/src/docs.ts +2 -0
- package/src/index.ts +7 -0
- package/{mixins.js → src/mixins.ts} +10 -6
- package/src/tag-list.json +1 -0
- package/src/test-utils/TestUtils.ts +13 -0
- package/src/tsconfig.json +113 -0
- package/{utils.js → src/utils.ts} +15 -11
- package/test-utils/TestUtils.ts +13 -0
- package/vite/config.js +136 -0
- package/vite.config.mts +87 -0
- package/README.md +0 -27
- package/cli.js +0 -75
- package/components.d.ts +0 -4
- package/core/_types/types.d.ts +0 -28
- package/core/_types/types.js +0 -2
- package/core/components/functional/date/date.d.ts +0 -45
- package/core/components/functional/date/date.js +0 -243
- package/core/components/functional/example/example.d.ts +0 -7
- package/core/components/functional/example/example.js +0 -26
- package/core/components/functional/fetch/fetch.d.ts +0 -93
- package/core/components/functional/functional.js +0 -15
- package/core/components/functional/if/if.d.ts +0 -12
- package/core/components/functional/if/if.js +0 -38
- package/core/components/functional/if/if.test.d.ts +0 -1
- package/core/components/functional/if/if.test.js +0 -35
- package/core/components/functional/list/list.d.ts +0 -117
- package/core/components/functional/list/list.js +0 -214
- package/core/components/functional/mix/mix.d.ts +0 -22
- package/core/components/functional/mix/mix.js +0 -102
- package/core/components/functional/queue/queue.d.ts +0 -67
- package/core/components/functional/queue/queue.js +0 -310
- package/core/components/functional/router/redirect.d.ts +0 -18
- package/core/components/functional/router/redirect.js +0 -53
- package/core/components/functional/router/router.d.ts +0 -27
- package/core/components/functional/router/router.js +0 -119
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -58
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +0 -215
- package/core/components/functional/sdui/sdui-utils.d.ts +0 -5
- package/core/components/functional/sdui/sdui-utils.js +0 -63
- package/core/components/functional/sdui/sdui.d.ts +0 -136
- package/core/components/functional/sdui/sdui.js +0 -254
- package/core/components/functional/sdui/types.d.ts +0 -37
- package/core/components/functional/sdui/types.js +0 -1
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -5
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -21
- package/core/components/functional/states/states.d.ts +0 -29
- package/core/components/functional/states/states.js +0 -134
- package/core/components/functional/submit/submit.d.ts +0 -30
- package/core/components/functional/submit/submit.js +0 -236
- package/core/components/functional/subscriber/subscriber.d.ts +0 -12
- package/core/components/functional/subscriber/subscriber.js +0 -38
- package/core/components/functional/value/value.d.ts +0 -7
- package/core/components/functional/value/value.js +0 -27
- package/core/components/ui/_css/scroll.d.ts +0 -1
- package/core/components/ui/_css/size.d.ts +0 -2
- package/core/components/ui/_css/type.d.ts +0 -2
- package/core/components/ui/alert/alert.d.ts +0 -34
- package/core/components/ui/alert/alert.js +0 -202
- package/core/components/ui/badge/badge.d.ts +0 -26
- package/core/components/ui/button/button.d.ts +0 -171
- package/core/components/ui/captcha/captcha.d.ts +0 -30
- package/core/components/ui/captcha/captcha.js +0 -93
- package/core/components/ui/card/card-footer.d.ts +0 -4
- package/core/components/ui/card/card-footer.js +0 -24
- package/core/components/ui/card/card-header-descripton.d.ts +0 -5
- package/core/components/ui/card/card-header-descripton.js +0 -32
- package/core/components/ui/card/card-header.d.ts +0 -8
- package/core/components/ui/card/card-main.d.ts +0 -4
- package/core/components/ui/card/card-main.js +0 -28
- package/core/components/ui/card/card.d.ts +0 -12
- package/core/components/ui/divider/divider.d.ts +0 -15
- package/core/components/ui/form/checkbox/checkbox.d.ts +0 -181
- package/core/components/ui/form/css/form-control.d.ts +0 -4
- package/core/components/ui/form/fieldset/fieldset.d.ts +0 -23
- package/core/components/ui/form/fieldset/fieldset.js +0 -118
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -5
- package/core/components/ui/form/fieldset/legend-description.js +0 -30
- package/core/components/ui/form/fieldset/legend.d.ts +0 -16
- package/core/components/ui/form/fieldset/legend.js +0 -112
- package/core/components/ui/form/form-actions/form-actions.d.ts +0 -7
- package/core/components/ui/form/form-actions/form-actions.js +0 -46
- package/core/components/ui/form/form-layout/form-layout.d.ts +0 -12
- package/core/components/ui/form/form-layout/form-layout.js +0 -83
- package/core/components/ui/form/input/input.d.ts +0 -106
- package/core/components/ui/form/input/input.js +0 -268
- package/core/components/ui/form/input/password-helper.d.ts +0 -25
- package/core/components/ui/form/input/password-helper.js +0 -119
- package/core/components/ui/form/input/same-value-helper.d.ts +0 -16
- package/core/components/ui/form/input/same-value-helper.js +0 -77
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +0 -136
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +0 -296
- package/core/components/ui/form/radio/radio.d.ts +0 -12
- package/core/components/ui/form/radio/radio.js +0 -50
- package/core/components/ui/form/select/select.d.ts +0 -58
- package/core/components/ui/form/select/select.js +0 -298
- package/core/components/ui/form/textarea/textarea.d.ts +0 -84
- package/core/components/ui/form/textarea/textarea.js +0 -150
- package/core/components/ui/group/group.d.ts +0 -16
- package/core/components/ui/group/group.js +0 -118
- package/core/components/ui/icon/icon.d.ts +0 -26
- package/core/components/ui/icon/icon.js +0 -113
- package/core/components/ui/icon/icons.d.ts +0 -10
- package/core/components/ui/icon/icons.js +0 -126
- package/core/components/ui/icon/icons.json +0 -1
- package/core/components/ui/image/image.d.ts +0 -15
- package/core/components/ui/image/image.js +0 -153
- package/core/components/ui/link/link.d.ts +0 -29
- package/core/components/ui/link/link.js +0 -124
- package/core/components/ui/loader/loader.d.ts +0 -23
- package/core/components/ui/loader/loader.js +0 -97
- package/core/components/ui/loader/styles/fixed.d.ts +0 -1
- package/core/components/ui/loader/styles/inline.d.ts +0 -1
- package/core/components/ui/menu/menu-item.d.ts +0 -5
- package/core/components/ui/menu/menu-item.js +0 -34
- package/core/components/ui/menu/menu.d.ts +0 -41
- package/core/components/ui/menu/menu.js +0 -313
- package/core/components/ui/modal/modal-actions.d.ts +0 -7
- package/core/components/ui/modal/modal-actions.js +0 -42
- package/core/components/ui/modal/modal-close.d.ts +0 -7
- package/core/components/ui/modal/modal-close.js +0 -43
- package/core/components/ui/modal/modal-content.d.ts +0 -5
- package/core/components/ui/modal/modal-content.js +0 -26
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -5
- package/core/components/ui/modal/modal-subtitle.js +0 -30
- package/core/components/ui/modal/modal-title.d.ts +0 -5
- package/core/components/ui/modal/modal-title.js +0 -29
- package/core/components/ui/modal/modal.d.ts +0 -58
- package/core/components/ui/modal/modal.js +0 -401
- package/core/components/ui/pop/pop.d.ts +0 -37
- package/core/components/ui/pop/pop.js +0 -299
- package/core/components/ui/progress/progress.d.ts +0 -10
- package/core/components/ui/table/table-caption.d.ts +0 -5
- package/core/components/ui/table/table-caption.js +0 -28
- package/core/components/ui/table/table-tbody.d.ts +0 -5
- package/core/components/ui/table/table-tbody.js +0 -39
- package/core/components/ui/table/table-td.d.ts +0 -12
- package/core/components/ui/table/table-td.js +0 -68
- package/core/components/ui/table/table-tfoot.d.ts +0 -5
- package/core/components/ui/table/table-tfoot.js +0 -27
- package/core/components/ui/table/table-th.d.ts +0 -11
- package/core/components/ui/table/table-th.js +0 -73
- package/core/components/ui/table/table-thead.d.ts +0 -5
- package/core/components/ui/table/table-thead.js +0 -25
- package/core/components/ui/table/table-tr.d.ts +0 -13
- package/core/components/ui/table/table-tr.js +0 -66
- package/core/components/ui/table/table.d.ts +0 -17
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -1
- package/core/components/ui/theme/theme.d.ts +0 -19
- package/core/components/ui/theme/theme.js +0 -124
- package/core/components/ui/toast/message-subscriber.d.ts +0 -18
- package/core/components/ui/toast/message-subscriber.js +0 -40
- package/core/components/ui/toast/toast-item.d.ts +0 -19
- package/core/components/ui/toast/toast.d.ts +0 -25
- package/core/components/ui/toast/toast.js +0 -226
- package/core/components/ui/toast/types.d.ts +0 -11
- package/core/components/ui/toast/types.js +0 -1
- package/core/components/ui/tooltip/tooltip.d.ts +0 -10
- package/core/components/ui/ui.d.ts +0 -32
- package/core/core.d.ts +0 -4
- package/core/core.js +0 -19
- package/core/decorators/Subscriber.d.ts +0 -4
- package/core/decorators/Subscriber.js +0 -166
- package/core/directives/DataProvider.d.ts +0 -23
- package/core/directives/DataProvider.js +0 -102
- package/core/directives/Wording.d.ts +0 -42
- package/core/directives/Wording.js +0 -202
- package/core/mixins/Fetcher.d.ts +0 -90
- package/core/mixins/Fetcher.js +0 -242
- package/core/mixins/FormCheckable.d.ts +0 -88
- package/core/mixins/FormCheckable.js +0 -306
- package/core/mixins/FormElement.d.ts +0 -32
- package/core/mixins/FormElement.js +0 -272
- package/core/mixins/FormInput.d.ts +0 -70
- package/core/mixins/FormInput.js +0 -81
- package/core/mixins/Subscriber.d.ts +0 -36
- package/core/mixins/Subscriber.js +0 -333
- package/core/mixins/TemplatesContainer.d.ts +0 -13
- package/core/mixins/TemplatesContainer.js +0 -69
- package/core/mixins/mixins.js +0 -6
- package/core/utils/Arrays.d.ts +0 -97
- package/core/utils/Arrays.js +0 -140
- package/core/utils/DataBindObserver.d.ts +0 -83
- package/core/utils/DataBindObserver.js +0 -264
- package/core/utils/Electron.d.ts +0 -7
- package/core/utils/Electron.js +0 -11
- package/core/utils/Format.d.ts +0 -12
- package/core/utils/Format.js +0 -38
- package/core/utils/HTML.d.ts +0 -42
- package/core/utils/HTML.js +0 -119
- package/core/utils/LocationHandler.d.ts +0 -46
- package/core/utils/LocationHandler.js +0 -133
- package/core/utils/Objects.d.ts +0 -28
- package/core/utils/Objects.js +0 -102
- package/core/utils/PublisherProxy.d.ts +0 -176
- package/core/utils/PublisherProxy.js +0 -709
- package/core/utils/Utils.d.ts +0 -4
- package/core/utils/Utils.js +0 -12
- package/core/utils/api.d.ts +0 -139
- package/core/utils/api.js +0 -391
- package/core/utils/url-pattern.js +0 -2
- package/decorators.d.ts +0 -3
- package/directives.d.ts +0 -40
- package/img/concorde-logo.svg +0 -1
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +0 -181
- package/svg/regular/plane.svg +0 -1
- package/svg/solid/plane.svg +0 -1
- package/test-utils/TestUtils.d.ts +0 -4
- package/test-utils/TestUtils.js +0 -12
- package/utils.d.ts +0 -20
- /package/{core/components/functional/functional.d.ts → src/core/components/functional/functional.ts} +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.css +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.d.ts +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { PublisherInterface, PublisherContentType } from "@supersoniks/concorde/core/_types/types";
|
|
2
|
-
import { SearchableDomElement } from "@supersoniks/concorde/core/utils/HTML";
|
|
3
|
-
type BindedVariablesDescriptor = {
|
|
4
|
-
expression: string;
|
|
5
|
-
variables: Array<Array<string>>;
|
|
6
|
-
};
|
|
7
|
-
type DataBindItem = {
|
|
8
|
-
propertyToUpdate: string;
|
|
9
|
-
bindedVariablesDescriptor: BindedVariablesDescriptor;
|
|
10
|
-
};
|
|
11
|
-
type PublisherListenerConfig<ValueType extends PublisherContentType = PublisherContentType> = {
|
|
12
|
-
publisher: PublisherInterface<ValueType>;
|
|
13
|
-
onAssign: (value?: ValueType) => void;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* En appelant DataBindObserver.observe(HTMLElement) sun un élément html, tout les éléments peuvent être liés à au publisher a l'adresse déterminée parl'attribut dataProvider de l'un de ses ancêtres.
|
|
18
|
-
* Pour cela un MutationObserver est créé pour observer les changements d'attributs de l'élément.
|
|
19
|
-
* On peut alors ecrire ce genre de choses de manière a lier dynamiquement les données du publisher à l'élément html.
|
|
20
|
-
* <img data-bind ::src="$img.avatar" ::title="ucFirst|$img.caption" />
|
|
21
|
-
* <a data-bind ::href="mailto:$email" ::inner-html="$email"></a>
|
|
22
|
-
* Voir la doc de subscriber à ce sujet car il l'utilise par défaut.
|
|
23
|
-
*/
|
|
24
|
-
export default class DataBindObserver {
|
|
25
|
-
/**
|
|
26
|
-
* Maintient la liste des éléments observés de manière à pouvoir les désinscrire quand ils sont supprimés.
|
|
27
|
-
*/
|
|
28
|
-
static observedElements: Map<SearchableDomElement, MutationObserver>;
|
|
29
|
-
/**
|
|
30
|
-
* Commencer à observer un élément html.
|
|
31
|
-
*/
|
|
32
|
-
static enabled: boolean;
|
|
33
|
-
static disable(): void;
|
|
34
|
-
static observe(element: SearchableDomElement): void;
|
|
35
|
-
/**
|
|
36
|
-
* Arrêter à observer un élément html.
|
|
37
|
-
*/
|
|
38
|
-
static unObserve(element: SearchableDomElement): void;
|
|
39
|
-
static onAdded(elt: HTMLElement): void;
|
|
40
|
-
static onRemoved(elt: HTMLElement): void;
|
|
41
|
-
/**
|
|
42
|
-
* Callback appelé par le MutationObserver
|
|
43
|
-
*/
|
|
44
|
-
static onMutation(list: MutationRecord[]): void;
|
|
45
|
-
static publisherListeners: Map<SearchableDomElement, PublisherListenerConfig[]>;
|
|
46
|
-
/**
|
|
47
|
-
* La liaison avec le publisher supprimée ici.
|
|
48
|
-
*/
|
|
49
|
-
static removePublisherListeners(target: SearchableDomElement): void;
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* Cette fonction prend l'expression fournie et trouves toutes les occurences du type $.clef1.clef2.clef3 ou $a.b par exemple.
|
|
53
|
-
* Les occurences sont ensuite mises dans un table de la forme [["clef1", "clef2", "clef3"],["a", "b"],...]
|
|
54
|
-
* Note : si une clef contien un point, on peut l'échapper en écrivant par exemple "$a.b.c\.d\.e" pour cibler value dans {a:{b:{"c.d.e":value}}}
|
|
55
|
-
* Propriétés du retour (du type BindedVariablesDescriptor) :
|
|
56
|
-
* * expression : l'expression initiale sans les échappements
|
|
57
|
-
* * variables : le tableau d'"adresses" de variables décrit ci-dessus
|
|
58
|
-
*/
|
|
59
|
-
static getVariablesDescriptor(expression: string): BindedVariablesDescriptor;
|
|
60
|
-
/**
|
|
61
|
-
* Extrait des "DataBindItems" a partir d'un élément html.
|
|
62
|
-
* Pour chaque attribut dont le nom commence par ::, un dataBindItem est créé.
|
|
63
|
-
* * Proriété "propertyToUpdate" du DataBindItem :
|
|
64
|
-
* Le nom de l'attribut modifié en transformant La notation en hyphen ("-") en KamelCase.
|
|
65
|
-
* un cas spécial est créé pour *-html qui retourne *HTML par exemple inner-html devient innerHTML
|
|
66
|
-
* Cela représente la propriété à mettre à jour sur l'élément lors de la modification d'une des variables liées dans le publicheur.
|
|
67
|
-
* * Propriété "bindedVariablesDescriptor" du DataBindItem : voir la fonction getVariablesDescriptor
|
|
68
|
-
*/
|
|
69
|
-
static getDataBindItems(element: SearchableDomElement): DataBindItem[];
|
|
70
|
-
/**
|
|
71
|
-
* Cette fonction récuperer le (sous) publisher a l'adresse donnée.
|
|
72
|
-
* Si l'une des clef de l'adresse est _self_, on garde le publisher courant et on passe à la suite.
|
|
73
|
-
* Ceci est un cas spécial, c'est pour ça qu'on utilisa pes Objects.traverse.
|
|
74
|
-
* Il y a toujours un publisher quelque soit l'adresse ce qui permet de cibler des valeurs qui n'existent pas encore
|
|
75
|
-
*/
|
|
76
|
-
static getSubPublisher<T extends PublisherContentType>(pub: PublisherInterface<T>, pathArray?: string[]): PublisherInterface;
|
|
77
|
-
/**
|
|
78
|
-
* La liaison avec le publisher est faite ici.
|
|
79
|
-
* TODO Sans doute factoriser
|
|
80
|
-
*/
|
|
81
|
-
static addPublisherListeners(target: SearchableDomElement): void;
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
2
|
-
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
3
|
-
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* En appelant DataBindObserver.observe(HTMLElement) sun un élément html, tout les éléments peuvent être liés à au publisher a l'adresse déterminée parl'attribut dataProvider de l'un de ses ancêtres.
|
|
7
|
-
* Pour cela un MutationObserver est créé pour observer les changements d'attributs de l'élément.
|
|
8
|
-
* On peut alors ecrire ce genre de choses de manière a lier dynamiquement les données du publisher à l'élément html.
|
|
9
|
-
* <img data-bind ::src="$img.avatar" ::title="ucFirst|$img.caption" />
|
|
10
|
-
* <a data-bind ::href="mailto:$email" ::inner-html="$email"></a>
|
|
11
|
-
* Voir la doc de subscriber à ce sujet car il l'utilise par défaut.
|
|
12
|
-
*/
|
|
13
|
-
class DataBindObserver {
|
|
14
|
-
static disable() {
|
|
15
|
-
if (!this.enabled)
|
|
16
|
-
return;
|
|
17
|
-
this.enabled = false;
|
|
18
|
-
Array.from(DataBindObserver.observedElements.keys()).forEach((k) => DataBindObserver.unObserve(k));
|
|
19
|
-
}
|
|
20
|
-
static observe(element) {
|
|
21
|
-
if (!element)
|
|
22
|
-
return;
|
|
23
|
-
if (!DataBindObserver.enabled)
|
|
24
|
-
return;
|
|
25
|
-
if (DataBindObserver.observedElements.has(element))
|
|
26
|
-
return;
|
|
27
|
-
const obs = new MutationObserver(DataBindObserver.onMutation);
|
|
28
|
-
const opt = {};
|
|
29
|
-
opt.childList = true;
|
|
30
|
-
opt.subtree = true;
|
|
31
|
-
opt.attributes = true;
|
|
32
|
-
opt.attributeFilter = ["data-bind"];
|
|
33
|
-
obs.observe(element, opt);
|
|
34
|
-
element
|
|
35
|
-
.querySelectorAll("[data-bind]")
|
|
36
|
-
.forEach((e) => DataBindObserver.addPublisherListeners(e));
|
|
37
|
-
DataBindObserver.observedElements.set(element, obs);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Arrêter à observer un élément html.
|
|
41
|
-
*/
|
|
42
|
-
static unObserve(element) {
|
|
43
|
-
if (!element)
|
|
44
|
-
return;
|
|
45
|
-
const observer = this.observedElements.get(element);
|
|
46
|
-
if (!observer)
|
|
47
|
-
return;
|
|
48
|
-
observer.disconnect();
|
|
49
|
-
element.querySelectorAll("[data-bind]").forEach((e) => DataBindObserver.removePublisherListeners(e));
|
|
50
|
-
}
|
|
51
|
-
static onAdded(elt) {
|
|
52
|
-
if (elt.hasAttribute && elt.hasAttribute("data-bind"))
|
|
53
|
-
DataBindObserver.addPublisherListeners(elt);
|
|
54
|
-
if (elt.querySelectorAll)
|
|
55
|
-
elt.querySelectorAll("[data-bind]").forEach((e) => DataBindObserver.addPublisherListeners(e));
|
|
56
|
-
else
|
|
57
|
-
elt.childNodes.forEach((elt) => DataBindObserver.onAdded(elt));
|
|
58
|
-
}
|
|
59
|
-
static onRemoved(elt) {
|
|
60
|
-
if (elt.hasAttribute && elt.hasAttribute("data-bind"))
|
|
61
|
-
DataBindObserver.removePublisherListeners(elt);
|
|
62
|
-
if (elt.querySelectorAll)
|
|
63
|
-
elt.querySelectorAll("[data-bind]").forEach((e) => DataBindObserver.removePublisherListeners(e));
|
|
64
|
-
else
|
|
65
|
-
elt.childNodes.forEach((elt) => DataBindObserver.onRemoved(elt));
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Callback appelé par le MutationObserver
|
|
69
|
-
*/
|
|
70
|
-
static onMutation(list) {
|
|
71
|
-
for (const l of list) {
|
|
72
|
-
switch (l.type) {
|
|
73
|
-
case "attributes":
|
|
74
|
-
DataBindObserver.addPublisherListeners(l.target);
|
|
75
|
-
break;
|
|
76
|
-
case "childList":
|
|
77
|
-
l.addedNodes.forEach((elt) => {
|
|
78
|
-
DataBindObserver.onAdded(elt);
|
|
79
|
-
});
|
|
80
|
-
l.removedNodes.forEach((elt) => {
|
|
81
|
-
DataBindObserver.onRemoved(elt);
|
|
82
|
-
});
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* La liaison avec le publisher supprimée ici.
|
|
89
|
-
*/
|
|
90
|
-
static removePublisherListeners(target) {
|
|
91
|
-
const conf = DataBindObserver.publisherListeners.get(target);
|
|
92
|
-
if (!conf)
|
|
93
|
-
return;
|
|
94
|
-
DataBindObserver.publisherListeners.delete(target);
|
|
95
|
-
conf.forEach((currentConf) => {
|
|
96
|
-
currentConf.publisher?.offAssign(currentConf.onAssign);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* Cette fonction prend l'expression fournie et trouves toutes les occurences du type $.clef1.clef2.clef3 ou $a.b par exemple.
|
|
102
|
-
* Les occurences sont ensuite mises dans un table de la forme [["clef1", "clef2", "clef3"],["a", "b"],...]
|
|
103
|
-
* Note : si une clef contien un point, on peut l'échapper en écrivant par exemple "$a.b.c\.d\.e" pour cibler value dans {a:{b:{"c.d.e":value}}}
|
|
104
|
-
* Propriétés du retour (du type BindedVariablesDescriptor) :
|
|
105
|
-
* * expression : l'expression initiale sans les échappements
|
|
106
|
-
* * variables : le tableau d'"adresses" de variables décrit ci-dessus
|
|
107
|
-
*/
|
|
108
|
-
static getVariablesDescriptor(expression) {
|
|
109
|
-
let variables = expression.match(/(\$(?:\w+\\?\.?)+)/g);
|
|
110
|
-
if (!variables)
|
|
111
|
-
variables = [expression];
|
|
112
|
-
else
|
|
113
|
-
variables = variables.map((v) => v.replace("$", ""));
|
|
114
|
-
variables = variables.filter((v) => v.length > 0);
|
|
115
|
-
return {
|
|
116
|
-
expression: expression.replace("\\", ""),
|
|
117
|
-
variables: variables.map((v) => v.split(/\b\.\b/).map((e) => e.replace("\\", ""))),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Extrait des "DataBindItems" a partir d'un élément html.
|
|
122
|
-
* Pour chaque attribut dont le nom commence par ::, un dataBindItem est créé.
|
|
123
|
-
* * Proriété "propertyToUpdate" du DataBindItem :
|
|
124
|
-
* Le nom de l'attribut modifié en transformant La notation en hyphen ("-") en KamelCase.
|
|
125
|
-
* un cas spécial est créé pour *-html qui retourne *HTML par exemple inner-html devient innerHTML
|
|
126
|
-
* Cela représente la propriété à mettre à jour sur l'élément lors de la modification d'une des variables liées dans le publicheur.
|
|
127
|
-
* * Propriété "bindedVariablesDescriptor" du DataBindItem : voir la fonction getVariablesDescriptor
|
|
128
|
-
*/
|
|
129
|
-
static getDataBindItems(element) {
|
|
130
|
-
if (!("attributes" in element))
|
|
131
|
-
return [];
|
|
132
|
-
return Array.from(element.attributes)
|
|
133
|
-
.filter((attribute) => attribute.name.indexOf("::") == 0)
|
|
134
|
-
.map((e) => {
|
|
135
|
-
const name = e.name.substring(2);
|
|
136
|
-
return {
|
|
137
|
-
propertyToUpdate: name.replace(/-((html)|\w)/g, (match) => match.substring(1).toUpperCase()),
|
|
138
|
-
bindedVariablesDescriptor: DataBindObserver.getVariablesDescriptor(e.value),
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Cette fonction récuperer le (sous) publisher a l'adresse donnée.
|
|
144
|
-
* Si l'une des clef de l'adresse est _self_, on garde le publisher courant et on passe à la suite.
|
|
145
|
-
* Ceci est un cas spécial, c'est pour ça qu'on utilisa pes Objects.traverse.
|
|
146
|
-
* Il y a toujours un publisher quelque soit l'adresse ce qui permet de cibler des valeurs qui n'existent pas encore
|
|
147
|
-
*/
|
|
148
|
-
static getSubPublisher(pub, pathArray) {
|
|
149
|
-
if (!pathArray)
|
|
150
|
-
return pub;
|
|
151
|
-
for (const key of pathArray) {
|
|
152
|
-
if (key == "_self_")
|
|
153
|
-
continue;
|
|
154
|
-
if (!pub)
|
|
155
|
-
return null;
|
|
156
|
-
pub = pub[key];
|
|
157
|
-
}
|
|
158
|
-
return pub;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* La liaison avec le publisher est faite ici.
|
|
162
|
-
* TODO Sans doute factoriser
|
|
163
|
-
*/
|
|
164
|
-
static addPublisherListeners(target) {
|
|
165
|
-
DataBindObserver.removePublisherListeners(target);
|
|
166
|
-
/**
|
|
167
|
-
* On récupère le publisher viea le dataProvider d'un ancêtre de l'élément.
|
|
168
|
-
*/
|
|
169
|
-
const dataProviderId = HTML.getAncestorAttributeValue((target.parentNode || target.host || target), "dataProvider");
|
|
170
|
-
if (!dataProviderId)
|
|
171
|
-
return;
|
|
172
|
-
const publisher = PublisherManager.getInstance().get(dataProviderId);
|
|
173
|
-
const dataBindItems = DataBindObserver.getDataBindItems(target);
|
|
174
|
-
const conf = [];
|
|
175
|
-
/**
|
|
176
|
-
* Pour chaque attribut => dataBindItems on fait la liaison avec les (sous) publishers associés aux variables extraites
|
|
177
|
-
* Lorsqu'une assignation est faite sur un des publishers liés, on met à jour la propriété de target dont le nom est renseigne dans l'attribut "propertyToUpdate du databindItem".
|
|
178
|
-
* Cette mise à jour est effectuée dans la fonction onAssign.
|
|
179
|
-
* On peut utiliser les fonctions présentes dans Format.ts notamment Format.js qui permet par exemple d'interpréter des expressions js simples.
|
|
180
|
-
* Attentions, les Objets/tableaus sont rendus en chaine avant l'interprétation dans ce cas.
|
|
181
|
-
*/
|
|
182
|
-
dataBindItems.forEach((dataBindItem) => {
|
|
183
|
-
const bindedVariablesDescriptor = dataBindItem.bindedVariablesDescriptor;
|
|
184
|
-
const propertyToUpdate = dataBindItem.propertyToUpdate;
|
|
185
|
-
for (const value of bindedVariablesDescriptor.variables) {
|
|
186
|
-
const publisherPathArray = value;
|
|
187
|
-
let pub = publisher;
|
|
188
|
-
pub = DataBindObserver.getSubPublisher(publisher, publisherPathArray);
|
|
189
|
-
const rec = target;
|
|
190
|
-
const currentConf = {
|
|
191
|
-
publisher: pub,
|
|
192
|
-
onAssign: () => {
|
|
193
|
-
const values = bindedVariablesDescriptor.variables.map((dataPath) => {
|
|
194
|
-
return DataBindObserver.getSubPublisher(publisher, dataPath)?.get();
|
|
195
|
-
});
|
|
196
|
-
let expression = bindedVariablesDescriptor.expression;
|
|
197
|
-
let hasUndeterminatedValue = false;
|
|
198
|
-
/*
|
|
199
|
-
* Si il n'y a qu'une variable on injecte la variable brute ce qui permet d'utiliser des objets composites
|
|
200
|
-
* Dans le cas des des expressions complexes (plus bas, avec plusieurs variables) les objets deviennent des chaines de caractères.)
|
|
201
|
-
*/
|
|
202
|
-
if (values.length == 1 && bindedVariablesDescriptor.variables[0].join(".") == expression.substring(1)) {
|
|
203
|
-
let value = values[0];
|
|
204
|
-
if (value === null
|
|
205
|
-
// ||
|
|
206
|
-
// ( Objects.isObject(value) &&
|
|
207
|
-
// value.hasOwnProperty("__value") &&
|
|
208
|
-
// (Objects.isUndefindOrNull(value.__value) || value.__value === "") )
|
|
209
|
-
) {
|
|
210
|
-
value = "";
|
|
211
|
-
}
|
|
212
|
-
rec[propertyToUpdate] = value;
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Expressions avec plusieurs variables
|
|
217
|
-
*/
|
|
218
|
-
for (let i = 0; i < values.length; i++) {
|
|
219
|
-
let value = values[i];
|
|
220
|
-
const variable = bindedVariablesDescriptor.variables[i];
|
|
221
|
-
if (value === null) {
|
|
222
|
-
hasUndeterminatedValue = true;
|
|
223
|
-
value = undefined;
|
|
224
|
-
}
|
|
225
|
-
expression = expression.replace("$" + variable.join("."), value);
|
|
226
|
-
}
|
|
227
|
-
if (expression.indexOf("|") != -1) {
|
|
228
|
-
const funcDelimiterIdx = expression.indexOf("|");
|
|
229
|
-
if (funcDelimiterIdx == 0) {
|
|
230
|
-
expression = Format.js(expression.substring(1));
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
const funcName = expression.substring(0, funcDelimiterIdx);
|
|
234
|
-
const funcArgs = expression.substring(funcDelimiterIdx + 1);
|
|
235
|
-
const fmtFunc = Format[funcName];
|
|
236
|
-
expression = hasUndeterminatedValue ? "" : fmtFunc ? fmtFunc(funcArgs) : expression;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
expression = hasUndeterminatedValue ? "" : expression;
|
|
241
|
-
}
|
|
242
|
-
rec[propertyToUpdate] = expression;
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
pub?.onAssign(currentConf.onAssign);
|
|
246
|
-
conf.push(currentConf);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
DataBindObserver.publisherListeners.set(target, conf);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Maintient la liste des éléments observés de manière à pouvoir les désinscrire quand ils sont supprimés.
|
|
254
|
-
*/
|
|
255
|
-
DataBindObserver.observedElements = new Map();
|
|
256
|
-
/**
|
|
257
|
-
* Commencer à observer un élément html.
|
|
258
|
-
*/
|
|
259
|
-
DataBindObserver.enabled = true;
|
|
260
|
-
DataBindObserver.publisherListeners = new Map();
|
|
261
|
-
export default DataBindObserver;
|
|
262
|
-
DataBindObserver.observe(document.documentElement);
|
|
263
|
-
if (!window.SonicDataBindObserver)
|
|
264
|
-
window.SonicDataBindObserver = DataBindObserver;
|
package/core/utils/Electron.d.ts
DELETED
package/core/utils/Electron.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export default class Electron {
|
|
2
|
-
static fixBlankLink(link) {
|
|
3
|
-
const electronStr = "electron";
|
|
4
|
-
const electron = typeof require == "undefined" ? null : require(electronStr);
|
|
5
|
-
if (typeof electron && link.target == "_blank") {
|
|
6
|
-
link.addEventListener("click", () => {
|
|
7
|
-
electron?.shell.openExternal(link.href);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
package/core/utils/Format.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare class Format {
|
|
2
|
-
/**
|
|
3
|
-
* Passe le premier caractère de la chaine en majuscule
|
|
4
|
-
*/
|
|
5
|
-
static ucFirst(str: string): string;
|
|
6
|
-
static minutesDuration(minutes: number, locale?: string, unitDisplay?: "long" | "short" | "narrow" | undefined): string;
|
|
7
|
-
/**
|
|
8
|
-
* Retourne le résultat de l'évaluation de la chaine fournie
|
|
9
|
-
*/
|
|
10
|
-
static js(value: string): any;
|
|
11
|
-
}
|
|
12
|
-
export default Format;
|
package/core/utils/Format.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
2
|
-
class Format {
|
|
3
|
-
/**
|
|
4
|
-
* Passe le premier caractère de la chaine en majuscule
|
|
5
|
-
*/
|
|
6
|
-
static ucFirst(str) {
|
|
7
|
-
if (typeof str != "string")
|
|
8
|
-
return str;
|
|
9
|
-
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
10
|
-
}
|
|
11
|
-
static minutesDuration(minutes, locale = "", unitDisplay = "long") {
|
|
12
|
-
if (!locale)
|
|
13
|
-
locale = HTML.getLanguage();
|
|
14
|
-
const divMod = (n, m) => [Math.floor(n / m), n % m];
|
|
15
|
-
function timeUnitFormatter(locale, unit, unitDisplay) {
|
|
16
|
-
return Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay }).format;
|
|
17
|
-
}
|
|
18
|
-
const [hrs, mins] = divMod(minutes, 60);
|
|
19
|
-
const list = [];
|
|
20
|
-
if (hrs)
|
|
21
|
-
list.push(timeUnitFormatter(locale, "hour", unitDisplay)(hrs));
|
|
22
|
-
if (mins)
|
|
23
|
-
list.push(timeUnitFormatter(locale, "minute", unitDisplay)(mins));
|
|
24
|
-
return new Intl.ListFormat(locale, { style: "long", type: "conjunction" }).format(list);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Retourne le résultat de l'évaluation de la chaine fournie
|
|
28
|
-
*/
|
|
29
|
-
static js(value) {
|
|
30
|
-
try {
|
|
31
|
-
return Function("return " + value)();
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export default Format;
|
package/core/utils/HTML.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export type SearchableDomElement = HTMLElement | ShadowRoot;
|
|
2
|
-
import { APIConfiguration } from "./api";
|
|
3
|
-
declare class HTML {
|
|
4
|
-
/**
|
|
5
|
-
* retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
|
|
6
|
-
*/
|
|
7
|
-
static getLanguage(): string;
|
|
8
|
-
static getCookies(): Record<string, string>;
|
|
9
|
-
static everyAncestors(node: SearchableDomElement, callback: (node: SearchableDomElement) => boolean): void;
|
|
10
|
-
/**
|
|
11
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
12
|
-
* @param attributeName nom de l'attribut
|
|
13
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
14
|
-
*/
|
|
15
|
-
static getAncestorAttributeValue(node: SearchableDomElement | null, attributeName: string): string | null;
|
|
16
|
-
/**
|
|
17
|
-
* Petite fonction utilitaire pour retourner la configuration a passer à l'utilitaire API
|
|
18
|
-
* Utilisée pour la configuration du wording / de la traduction ainsi que par le mixin fetcher par exemple
|
|
19
|
-
*/
|
|
20
|
-
static getApiConfiguration(node: SearchableDomElement): APIConfiguration;
|
|
21
|
-
/**
|
|
22
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
23
|
-
* @param attributeName nom de l'attribut
|
|
24
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
25
|
-
*/
|
|
26
|
-
static getClosestElement(node: SearchableDomElement, selector: string): SearchableDomElement | null;
|
|
27
|
-
/**
|
|
28
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
29
|
-
* @param attributeName nom de l'attribut
|
|
30
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
31
|
-
*/
|
|
32
|
-
static getClosestForm(node: SearchableDomElement): SearchableDomElement | null;
|
|
33
|
-
/**
|
|
34
|
-
* Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
35
|
-
* */
|
|
36
|
-
static loadJS(src: string): Promise<unknown>;
|
|
37
|
-
/**
|
|
38
|
-
* Lance le chargement d'un css et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
39
|
-
* */
|
|
40
|
-
static loadCSS(src: string): Promise<unknown>;
|
|
41
|
-
}
|
|
42
|
-
export default HTML;
|
package/core/utils/HTML.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
class HTML {
|
|
2
|
-
/**
|
|
3
|
-
* retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
|
|
4
|
-
*/
|
|
5
|
-
static getLanguage() {
|
|
6
|
-
const documentLanguage = document.documentElement.lang;
|
|
7
|
-
const selectedLanguage = localStorage.getItem("SonicSelectedLanguage");
|
|
8
|
-
return selectedLanguage || documentLanguage;
|
|
9
|
-
}
|
|
10
|
-
static getCookies() {
|
|
11
|
-
return document.cookie.split(";").reduce((previous, current) => {
|
|
12
|
-
const eqIdx = current.indexOf("=");
|
|
13
|
-
previous[current.substring(0, eqIdx).trim()] = current.substring(eqIdx + 1);
|
|
14
|
-
return previous;
|
|
15
|
-
}, {});
|
|
16
|
-
}
|
|
17
|
-
static everyAncestors(node, callback) {
|
|
18
|
-
while (node) {
|
|
19
|
-
const result = callback(node);
|
|
20
|
-
if (!result)
|
|
21
|
-
return;
|
|
22
|
-
node = (node.parentNode || node.host);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
27
|
-
* @param attributeName nom de l'attribut
|
|
28
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
29
|
-
*/
|
|
30
|
-
static getAncestorAttributeValue(node, attributeName) {
|
|
31
|
-
if (!node)
|
|
32
|
-
return null;
|
|
33
|
-
while (!("hasAttribute" in node && node.hasAttribute(attributeName))) {
|
|
34
|
-
const newNode = node.parentNode || node.host;
|
|
35
|
-
if (!newNode)
|
|
36
|
-
break;
|
|
37
|
-
node = (node.parentNode || node.host);
|
|
38
|
-
}
|
|
39
|
-
if (!("hasAttribute" in node)) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return node.getAttribute(attributeName);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Petite fonction utilitaire pour retourner la configuration a passer à l'utilitaire API
|
|
46
|
-
* Utilisée pour la configuration du wording / de la traduction ainsi que par le mixin fetcher par exemple
|
|
47
|
-
*/
|
|
48
|
-
static getApiConfiguration(node) {
|
|
49
|
-
const token = HTML.getAncestorAttributeValue(node, "token");
|
|
50
|
-
const addHTTPResponse = HTML.getAncestorAttributeValue(node, "addHTTPResponse") != null;
|
|
51
|
-
const serviceURL = HTML.getAncestorAttributeValue(node, "serviceURL");
|
|
52
|
-
let userName = null;
|
|
53
|
-
let password = null;
|
|
54
|
-
const tokenProvider = HTML.getAncestorAttributeValue(node, "tokenProvider");
|
|
55
|
-
const authToken = HTML.getAncestorAttributeValue(node, "eventsApiToken");
|
|
56
|
-
if (!token) {
|
|
57
|
-
userName = HTML.getAncestorAttributeValue(node, "userName");
|
|
58
|
-
password = HTML.getAncestorAttributeValue(node, "password");
|
|
59
|
-
}
|
|
60
|
-
const credentials = HTML.getAncestorAttributeValue(node, "credentials") || undefined;
|
|
61
|
-
const cache = node.getAttribute("cache");
|
|
62
|
-
const blockUntilDone = node.hasAttribute("blockUntilDone");
|
|
63
|
-
return { serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache, blockUntilDone };
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
67
|
-
* @param attributeName nom de l'attribut
|
|
68
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
69
|
-
*/
|
|
70
|
-
static getClosestElement(node, selector) {
|
|
71
|
-
while (!(node.nodeName && node.nodeName.toLowerCase() === selector)) {
|
|
72
|
-
const newNode = node.parentNode || node.host;
|
|
73
|
-
if (!newNode)
|
|
74
|
-
break;
|
|
75
|
-
node = (node.parentNode || node.host);
|
|
76
|
-
}
|
|
77
|
-
if (!node.nodeName) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return node;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Va de parent en parent en partant de node pour trouver un attribut
|
|
84
|
-
* @param attributeName nom de l'attribut
|
|
85
|
-
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
86
|
-
*/
|
|
87
|
-
static getClosestForm(node) {
|
|
88
|
-
return HTML.getClosestElement(node, "form");
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
92
|
-
* */
|
|
93
|
-
static async loadJS(src) {
|
|
94
|
-
const p = new Promise(async (resolve) => {
|
|
95
|
-
const script = document.createElement("script");
|
|
96
|
-
script.src = src;
|
|
97
|
-
script.onload = () => resolve(true);
|
|
98
|
-
script.onerror = () => resolve(true);
|
|
99
|
-
document.head.appendChild(script);
|
|
100
|
-
});
|
|
101
|
-
return p;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Lance le chargement d'un css et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
105
|
-
* */
|
|
106
|
-
static async loadCSS(src) {
|
|
107
|
-
const p = new Promise(async (resolve) => {
|
|
108
|
-
const cssnode = document.createElement("link");
|
|
109
|
-
cssnode.type = "text/css";
|
|
110
|
-
cssnode.rel = "stylesheet";
|
|
111
|
-
cssnode.href = src;
|
|
112
|
-
cssnode.onload = () => resolve(true);
|
|
113
|
-
cssnode.onerror = () => resolve(true);
|
|
114
|
-
document.head.appendChild(cssnode);
|
|
115
|
-
});
|
|
116
|
-
return p;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
export default HTML;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
declare type Listener = {
|
|
2
|
-
location: string;
|
|
3
|
-
};
|
|
4
|
-
declare type ActivableLink = HTMLElement & {
|
|
5
|
-
location?: string;
|
|
6
|
-
href?: string;
|
|
7
|
-
goBack?: string | null;
|
|
8
|
-
autoActive?: "strict" | "partial" | "disabled";
|
|
9
|
-
setAttribute(name: string, value: string): void;
|
|
10
|
-
removeAttribute(name: string): void;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Gestionnaire d'écoute des modifications sur l'url courante.
|
|
14
|
-
* On peut s'y abonner via la methode statique onChange()
|
|
15
|
-
* Utilisé par sonic-bouton pour lm'affichage de l'état actif et par le router.
|
|
16
|
-
*/
|
|
17
|
-
export default class LocationHandler {
|
|
18
|
-
static listeners: Array<Listener>;
|
|
19
|
-
static listening: boolean;
|
|
20
|
-
static prevURL: string;
|
|
21
|
-
static listen(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Arrête l'écoute des changements de location pour le listener fournit
|
|
24
|
-
*/
|
|
25
|
-
static offChange(listener: Listener): void;
|
|
26
|
-
/**
|
|
27
|
-
* Ecoute les changements de location et l'assigne à la propriété location de chaque listener
|
|
28
|
-
*/
|
|
29
|
-
static onChange(listener: Listener): void;
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param component HTMLElement
|
|
33
|
-
* Recupère la proprité to ou href de l'élément et lance la navigation
|
|
34
|
-
* Si l'attribut pushState est présent la naviguation se fait via un pushState
|
|
35
|
-
* Si l'attribut replaceState est présent la naviguation se fait via un replaceState
|
|
36
|
-
* Voir link et button pour les exemples d'implémentation
|
|
37
|
-
**/
|
|
38
|
-
static changeFromComponent(component: ActivableLink): void;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param component ActivableLink
|
|
42
|
-
* Ajoute l'attribut "active" à l'élément si l'url correspond à la location en donction du mode d'activation
|
|
43
|
-
*/
|
|
44
|
-
static updateComponentActiveState(component: ActivableLink): void;
|
|
45
|
-
}
|
|
46
|
-
export {};
|