@supersoniks/concorde 2.0.7 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-infos.json +1 -0
- package/index.html +44 -0
- package/notes de migration.md +21 -0
- package/package.json +23 -290
- 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/concorde-core.bundle.js +0 -3427
- package/concorde-core.es.js +0 -14372
- 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
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import {html, LitElement, nothing} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {repeat} from "lit/directives/repeat.js";
|
|
4
|
+
import {animate} from "@lit-labs/motion";
|
|
5
|
+
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
6
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
7
|
+
import {ifDefined} from "lit/directives/if-defined.js";
|
|
8
|
+
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
9
|
+
import {styleMap, StyleInfo} from "lit/directives/style-map.js";
|
|
10
|
+
import "@supersoniks/concorde/core/components/ui/toast/toast-item";
|
|
11
|
+
import {Toast} from "@supersoniks/concorde/core/components/ui/toast/types";
|
|
12
|
+
import {ConcordeWindow} from "@supersoniks/concorde/core/_types/types";
|
|
13
|
+
import {Theme} from "@supersoniks/concorde/core/components/ui/theme/theme";
|
|
14
|
+
|
|
15
|
+
declare const window: ConcordeWindow;
|
|
16
|
+
|
|
17
|
+
const tagName = "sonic-toast";
|
|
18
|
+
|
|
19
|
+
@customElement(tagName)
|
|
20
|
+
export class SonicToast extends LitElement {
|
|
21
|
+
@property({type: Array}) toasts: Toast[] = [];
|
|
22
|
+
static delegateToasts = false;
|
|
23
|
+
|
|
24
|
+
createRenderRoot() {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
const isIframe = !(window.parent == window);
|
|
30
|
+
let styles: Readonly<StyleInfo> = {
|
|
31
|
+
pointerEvents: "none",
|
|
32
|
+
gap: "1rem",
|
|
33
|
+
display: "flex",
|
|
34
|
+
margin: "1rem",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (!isIframe) {
|
|
38
|
+
styles = {
|
|
39
|
+
...styles,
|
|
40
|
+
margin: "0",
|
|
41
|
+
width: "calc(100% - 2.5rem)",
|
|
42
|
+
position: "fixed",
|
|
43
|
+
bottom: "1.25rem",
|
|
44
|
+
right: "1.25rem",
|
|
45
|
+
zIndex: "10000",
|
|
46
|
+
maxWidth: "64ch",
|
|
47
|
+
flexDirection: "column-reverse",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ${window.parent == window ? "fixed-area" : ""}
|
|
52
|
+
SonicToast.handleExistingToastDelegation();
|
|
53
|
+
if (!this.toasts) return nothing;
|
|
54
|
+
|
|
55
|
+
return html`<div aria-live="polite" style=${styleMap(styles)}>
|
|
56
|
+
${repeat(
|
|
57
|
+
this.toasts,
|
|
58
|
+
(item) => item.id,
|
|
59
|
+
(item) => html`
|
|
60
|
+
<sonic-toast-item
|
|
61
|
+
maxHeight=${isIframe ? "none" : "10rem"}
|
|
62
|
+
status=${ifDefined(item.status)}
|
|
63
|
+
title=${ifDefined(item.title)}
|
|
64
|
+
?ghost=${item.ghost}
|
|
65
|
+
?dismissForever=${item.dismissForever}
|
|
66
|
+
?preserve=${item.preserve}
|
|
67
|
+
id=${ifDefined(item.id)}
|
|
68
|
+
@hide=${() => this.removeItem(item)}
|
|
69
|
+
${animate({
|
|
70
|
+
keyframeOptions: {
|
|
71
|
+
duration: 250,
|
|
72
|
+
easing: `cubic-bezier(0.250, 0.250, 0.420, 1.225)`,
|
|
73
|
+
},
|
|
74
|
+
in: [{transform: "translateY(0) scale(1.25)", boxShadow: "0 0 0 rgba(0,0,0,0)", opacity: 0}],
|
|
75
|
+
out: [
|
|
76
|
+
{
|
|
77
|
+
transform: "scale(.90) ",
|
|
78
|
+
opacity: 0,
|
|
79
|
+
duration: 3000,
|
|
80
|
+
easing: `ease-in-out`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
stabilizeOut: true,
|
|
84
|
+
})}
|
|
85
|
+
>
|
|
86
|
+
<!-- Le texte est passé dans le slot et non pas en propriété pour contrer des problèmatiques de shadow-dom et d'appel exterieur (exemple: fancybox) -->
|
|
87
|
+
${item.text ? unsafeHTML(item.text) : ""}
|
|
88
|
+
</sonic-toast-item>
|
|
89
|
+
`
|
|
90
|
+
)}
|
|
91
|
+
</div>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static removeAll() {
|
|
95
|
+
if (SonicToast.delegateToasts) {
|
|
96
|
+
SonicToast.handleExistingToastDelegation();
|
|
97
|
+
window.parent.postMessage({type: "removeAllToasts"}, "*");
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const toastComponent: SonicToast = SonicToast.getInstance();
|
|
101
|
+
if (!toastComponent) return;
|
|
102
|
+
|
|
103
|
+
toastComponent.toasts = toastComponent.toasts.filter((item) => item.ghost);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ADD TOAST
|
|
107
|
+
static instance?: SonicToast;
|
|
108
|
+
static getInstance() {
|
|
109
|
+
if (SonicToast.instance) return SonicToast.instance;
|
|
110
|
+
SonicToast.instance = document.createElement("sonic-toast") as SonicToast;
|
|
111
|
+
Theme.getPopContainer().prepend(SonicToast.instance);
|
|
112
|
+
return SonicToast.instance;
|
|
113
|
+
}
|
|
114
|
+
static add(conf: Toast) {
|
|
115
|
+
if (SonicToast.delegateToasts) {
|
|
116
|
+
SonicToast.handleExistingToastDelegation();
|
|
117
|
+
window.parent.postMessage({type: "addToast", toast: conf}, "*");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Init toast area si absente (au <sonic-theme> ou <body< à défaut)
|
|
121
|
+
const toastComponent = SonicToast.getInstance();
|
|
122
|
+
|
|
123
|
+
// Ajoute le toast à la liste
|
|
124
|
+
const nextId = conf.id ?? new Date().valueOf();
|
|
125
|
+
|
|
126
|
+
const interactiveRegExp = new RegExp("</a>|</.*?button>|</.*?input>|</.*?textarea>|</.*?select>");
|
|
127
|
+
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
128
|
+
|
|
129
|
+
const currentToast = {
|
|
130
|
+
id: nextId,
|
|
131
|
+
text: conf.text,
|
|
132
|
+
title: conf.title,
|
|
133
|
+
status: conf.status,
|
|
134
|
+
preserve: hasInteractive ? true : conf.preserve,
|
|
135
|
+
ghost: conf.ghost,
|
|
136
|
+
dismissForever: conf.dismissForever,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// check if the toast is dismissed
|
|
140
|
+
if (conf.dismissForever && conf.id) {
|
|
141
|
+
const dismissed = localStorage.getItem("sonic-toast-dismissed") || "{}";
|
|
142
|
+
const dismissedObj = JSON.parse(dismissed);
|
|
143
|
+
if (dismissedObj[conf.id]) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (toastComponent?.toasts.length) {
|
|
149
|
+
const toastA = {...currentToast};
|
|
150
|
+
for (const toast of toastComponent.toasts) {
|
|
151
|
+
const toastB = {...toast};
|
|
152
|
+
toastA.id = toastB.id = 0;
|
|
153
|
+
if (/*!currentToast.preserve && */ Objects.shallowEqual(toastA, toastB)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (toastComponent) {
|
|
159
|
+
toastComponent.toasts = [...toastComponent.toasts, currentToast];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return currentToast;
|
|
163
|
+
}
|
|
164
|
+
static handleExistingToastDelegation() {
|
|
165
|
+
if (!this.delegateToasts) return;
|
|
166
|
+
const toastComponent: SonicToast = SonicToast.getInstance();
|
|
167
|
+
window.parent.postMessage({type: "addToasts", toasts: toastComponent.toasts}, "*");
|
|
168
|
+
toastComponent.toasts = [];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static removeItem(toastToRemove?: Toast) {
|
|
172
|
+
if (SonicToast.delegateToasts) {
|
|
173
|
+
SonicToast.handleExistingToastDelegation();
|
|
174
|
+
window.parent.postMessage({type: "removeToast", toast: toastToRemove}, "*");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const toastComponent: SonicToast = SonicToast.getInstance();
|
|
178
|
+
if (!toastComponent) return;
|
|
179
|
+
toastComponent.removeItem(toastToRemove);
|
|
180
|
+
}
|
|
181
|
+
// Remove Toast
|
|
182
|
+
removeItem(toastToRemove?: Toast) {
|
|
183
|
+
if (!toastToRemove) return;
|
|
184
|
+
this.toasts = this.toasts.filter((toast) => {
|
|
185
|
+
toast = {...toast};
|
|
186
|
+
delete toast.id;
|
|
187
|
+
return !Objects.shallowEqual(toast, toastToRemove, false);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (typeof window !== "undefined") {
|
|
193
|
+
window.SonicToast = SonicToast;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Handles the context of iframes and performs necessary actions based on received messages.
|
|
198
|
+
*/
|
|
199
|
+
function handleIframeContexts() {
|
|
200
|
+
const onPostMessage = (e: MessageEvent) => {
|
|
201
|
+
if (e.data.type == "querySonicToastAvailability") {
|
|
202
|
+
(e.source as Window).postMessage({type: "sonicToastAvailable"}, "*");
|
|
203
|
+
}
|
|
204
|
+
if (e.data.type == "sonicToastAvailable") {
|
|
205
|
+
SonicToast.delegateToasts = true;
|
|
206
|
+
SonicToast.handleExistingToastDelegation();
|
|
207
|
+
}
|
|
208
|
+
if (e.data.type == "addToasts") {
|
|
209
|
+
SonicToast.getInstance().toasts = [...SonicToast.getInstance().toasts, ...e.data.toasts];
|
|
210
|
+
}
|
|
211
|
+
if (e.data.type == "removeAllToasts") {
|
|
212
|
+
SonicToast.removeAll();
|
|
213
|
+
}
|
|
214
|
+
if (e.data.type == "removeToast") {
|
|
215
|
+
SonicToast.removeItem(e.data.toast);
|
|
216
|
+
}
|
|
217
|
+
if (e.data.type == "addToast") {
|
|
218
|
+
SonicToast.add(e.data.toast);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const isIframe = !(window.parent == window);
|
|
223
|
+
window.addEventListener("message", onPostMessage, false);
|
|
224
|
+
|
|
225
|
+
if (isIframe) {
|
|
226
|
+
window.parent.postMessage({type: "querySonicToastAvailability"}, "*");
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// tell iframes that sonic-toast is available
|
|
230
|
+
|
|
231
|
+
if (!isIframe) {
|
|
232
|
+
for (const iframe of document.querySelectorAll("iframe")) {
|
|
233
|
+
iframe.contentWindow?.postMessage({type: "sonicToastAvailable"}, "*");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
handleIframeContexts();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Message } from "@supersoniks/concorde/core/_types/types";
|
|
2
|
+
|
|
3
|
+
export type ToastStatus = Message["status"] | "" | "success";
|
|
4
|
+
|
|
5
|
+
// Toast
|
|
6
|
+
export type Toast = {
|
|
7
|
+
id?: string | number;
|
|
8
|
+
text: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
status?: ToastStatus;
|
|
11
|
+
preserve?: boolean;
|
|
12
|
+
ghost?: boolean;
|
|
13
|
+
dismissForever?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
<sonic-code>
|
|
4
|
+
<template>
|
|
5
|
+
<sonic-tooltip label="Tada : Text appears">hover me</sonic-tooltip>
|
|
6
|
+
</template>
|
|
7
|
+
</sonic-code>
|
|
8
|
+
|
|
9
|
+
## Placement
|
|
10
|
+
|
|
11
|
+
<sonic-code>
|
|
12
|
+
<template>
|
|
13
|
+
<sonic-tooltip placement="top" label="Top text">
|
|
14
|
+
<sonic-button>Top</sonic-button>
|
|
15
|
+
</sonic-tooltip>
|
|
16
|
+
<sonic-tooltip placement="bottom" label="Bottom text">
|
|
17
|
+
<sonic-button>Bottom</sonic-button>
|
|
18
|
+
</sonic-tooltip>
|
|
19
|
+
<sonic-tooltip placement="right" label="Right text">
|
|
20
|
+
<sonic-button>Right</sonic-button>
|
|
21
|
+
</sonic-tooltip>
|
|
22
|
+
<sonic-tooltip placement="left" label="Left text">
|
|
23
|
+
<sonic-button>Left</sonic-button>
|
|
24
|
+
</sonic-tooltip>
|
|
25
|
+
</template>
|
|
26
|
+
</sonic-code>
|
|
27
|
+
|
|
28
|
+
## Disabled
|
|
29
|
+
|
|
30
|
+
<sonic-code>
|
|
31
|
+
<template>
|
|
32
|
+
<sonic-tooltip disabled label="Disabled text">
|
|
33
|
+
<sonic-button>Tooltip disabled</sonic-button>
|
|
34
|
+
</sonic-tooltip>
|
|
35
|
+
</template>
|
|
36
|
+
</sonic-code>
|
|
37
|
+
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { html, LitElement, css } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
1
|
+
import {html, LitElement, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
9
3
|
const tagName = "sonic-tooltip";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.disabled = false;
|
|
15
|
-
this.focusable = false;
|
|
16
|
-
}
|
|
17
|
-
connectedCallback() {
|
|
18
|
-
if (this.focusable) {
|
|
19
|
-
this.setAttribute("tabindex", "0");
|
|
20
|
-
}
|
|
21
|
-
super.connectedCallback();
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
const disabledClass = this.disabled || this.label == "" ? "disabled" : "";
|
|
25
|
-
return html `<div data-tooltip-text="${this.label.trim().replace(" ", " ")}" class="tooltip ${disabledClass}">
|
|
26
|
-
<slot></slot>
|
|
27
|
-
</div>`;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
Tooltip.styles = [
|
|
31
|
-
css `
|
|
4
|
+
@customElement(tagName)
|
|
5
|
+
export class Tooltip extends LitElement {
|
|
6
|
+
static styles = [
|
|
7
|
+
css`
|
|
32
8
|
:host {
|
|
33
9
|
position: relative;
|
|
34
10
|
display: inline-flex;
|
|
@@ -98,20 +74,23 @@ Tooltip.styles = [
|
|
|
98
74
|
left: calc(100% + 0.25rem);
|
|
99
75
|
}
|
|
100
76
|
`,
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
@property({type: String}) label = "";
|
|
80
|
+
@property({type: String, reflect: true}) placement?: "top" | "top-start" | "top-end" | "bottom" | "left" | "right";
|
|
81
|
+
@property({type: Boolean}) disabled = false;
|
|
82
|
+
@property({type: Boolean}) focusable = false;
|
|
83
|
+
|
|
84
|
+
connectedCallback(): void {
|
|
85
|
+
if (this.focusable) {
|
|
86
|
+
this.setAttribute("tabindex", "0");
|
|
87
|
+
}
|
|
88
|
+
super.connectedCallback();
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
const disabledClass = this.disabled || this.label == "" ? "disabled" : "";
|
|
92
|
+
return html`<div data-tooltip-text="${this.label.trim().replace(" ", " ")}" class="tooltip ${disabledClass}">
|
|
93
|
+
<slot></slot>
|
|
94
|
+
</div>`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -19,12 +19,14 @@ import "./form/fieldset/legend";
|
|
|
19
19
|
import "./form/form-layout/form-layout";
|
|
20
20
|
import "./form/form-actions/form-actions";
|
|
21
21
|
import "./group/group";
|
|
22
|
+
|
|
22
23
|
// MISC
|
|
23
24
|
import "./icon/icon";
|
|
24
25
|
import "./image/image";
|
|
25
26
|
import "./loader/loader";
|
|
26
27
|
//Menu
|
|
27
28
|
import "./menu/menu";
|
|
29
|
+
|
|
28
30
|
// Misc
|
|
29
31
|
import "./modal/modal";
|
|
30
32
|
import "./alert/alert";
|
package/src/core/core.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./components/functional/functional";
|
|
2
|
+
import "./components/ui/ui";
|
|
3
|
+
import "./mixins/mixins";
|
|
4
|
+
import "./utils/url-pattern";
|
|
5
|
+
import {PublisherManager} from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
6
|
+
import DataBindObserver from "./utils/DataBindObserver";
|
|
7
|
+
import {ConcordeWindow} from "./_types/types";
|
|
8
|
+
|
|
9
|
+
declare const window: ConcordeWindow;
|
|
10
|
+
if (!window.SonicPublisherManager) window.SonicPublisherManager = PublisherManager;
|
|
11
|
+
if (!window.SonicDataBindObserver) window.SonicDataBindObserver = DataBindObserver;
|
|
12
|
+
window.queueMicrotask =
|
|
13
|
+
window.queueMicrotask ||
|
|
14
|
+
function (callback) {
|
|
15
|
+
Promise.resolve()
|
|
16
|
+
.then(callback)
|
|
17
|
+
.catch((e) =>
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
throw e;
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {Objects} from "@supersoniks/concorde/utils";
|
|
2
|
+
import {PublisherProxy, PublisherManager} from "../utils/PublisherProxy";
|
|
3
|
+
|
|
4
|
+
type Callback = (...values: unknown[]) => void;
|
|
5
|
+
type ConnectedComponent = Record<string, unknown> & {
|
|
6
|
+
__onConnected__: (callback: (component: ConnectedComponent) => void) => void;
|
|
7
|
+
__onDisconnected__: (callback: (component: ConnectedComponent) => void) => void;
|
|
8
|
+
__connectedCallbackCalls__?: Set<(component: ConnectedComponent) => void>;
|
|
9
|
+
__disconnectedCallbackCalls__?: Set<(component: ConnectedComponent) => void>;
|
|
10
|
+
};
|
|
11
|
+
type Configuration = {
|
|
12
|
+
callbacks: Set<Callback>;
|
|
13
|
+
publisher: PublisherProxy;
|
|
14
|
+
onAssign: (value: unknown) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function onConnected(this: ConnectedComponent, callback: (component: ConnectedComponent) => void) {
|
|
18
|
+
if (!this.__connectedCallbackCalls__) this.__connectedCallbackCalls__ = new Set();
|
|
19
|
+
this.__connectedCallbackCalls__.add(callback);
|
|
20
|
+
}
|
|
21
|
+
function __onDisconnected__(this: ConnectedComponent, callback: (component: ConnectedComponent) => void) {
|
|
22
|
+
if (!this.__disconnectedCallbackCalls__) this.__disconnectedCallbackCalls__ = new Set();
|
|
23
|
+
this.__disconnectedCallbackCalls__.add(callback);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function setSubscribable(target: any) {
|
|
27
|
+
if (target.__is__setSubscribable__) return;
|
|
28
|
+
target.__is__setSubscribable__ = true;
|
|
29
|
+
|
|
30
|
+
target.__onConnected__ = onConnected;
|
|
31
|
+
target.__onDisconnected__ = __onDisconnected__;
|
|
32
|
+
// target.offConnected = onConnected;
|
|
33
|
+
// target.offDisconnected = __onDisconnected__;
|
|
34
|
+
|
|
35
|
+
const originalConnectedCallback = target.connectedCallback;
|
|
36
|
+
target.connectedCallback = function (this: any) {
|
|
37
|
+
originalConnectedCallback.call(this);
|
|
38
|
+
if (this.__connectedCallbackCalls__) {
|
|
39
|
+
this.__connectedCallbackCalls__.forEach((callback: (component: any) => void) => callback(this));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const originalDisconnectedCallback = target.disconnectedCallback;
|
|
43
|
+
target.disconnectedCallback = function (this: any) {
|
|
44
|
+
originalDisconnectedCallback.call(this);
|
|
45
|
+
if (this.__disconnectedCallbackCalls__) {
|
|
46
|
+
this.__disconnectedCallbackCalls__.forEach((callback: (component: any) => void) => callback(this));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function bind(path: string) {
|
|
52
|
+
const split = path.split(".");
|
|
53
|
+
if (split.length == 0) {
|
|
54
|
+
return function () {
|
|
55
|
+
//Empty def function
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const dataProvider: string = split.shift() || "";
|
|
59
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
60
|
+
publisher = Objects.traverse(publisher, split);
|
|
61
|
+
return function (target: unknown, propertyKey: string) {
|
|
62
|
+
if (!target) return;
|
|
63
|
+
let onAssign: (value: unknown) => void;
|
|
64
|
+
setSubscribable(target);
|
|
65
|
+
|
|
66
|
+
(target as ConnectedComponent).__onConnected__((component) => {
|
|
67
|
+
onAssign = (value: unknown) => {
|
|
68
|
+
component[propertyKey] = value;
|
|
69
|
+
};
|
|
70
|
+
publisher.onAssign(onAssign);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
(target as ConnectedComponent).__onDisconnected__(() => {
|
|
74
|
+
publisher.offAssign(onAssign);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function onAssign(...values: Array<string>) {
|
|
80
|
+
const onAssignValues: unknown[] = [];
|
|
81
|
+
const confs: Configuration[] = [];
|
|
82
|
+
for (let i = 0; i < values.length; i++) {
|
|
83
|
+
const value = values[i];
|
|
84
|
+
const split = value.split(".");
|
|
85
|
+
if (split.length == 0) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const dataProvider: string = split.shift() || "";
|
|
89
|
+
|
|
90
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
91
|
+
|
|
92
|
+
publisher = Objects.traverse(publisher, split);
|
|
93
|
+
const callbacks: Set<Callback> = new Set();
|
|
94
|
+
const onAssign = (value: unknown) => {
|
|
95
|
+
onAssignValues[i] = value;
|
|
96
|
+
if (onAssignValues.filter((v) => v !== null).length == values.length) callbacks.forEach((callback) => callback(...onAssignValues));
|
|
97
|
+
};
|
|
98
|
+
confs.push({publisher, onAssign, callbacks});
|
|
99
|
+
}
|
|
100
|
+
return function (target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) {
|
|
101
|
+
setSubscribable(target);
|
|
102
|
+
let callback: Callback;
|
|
103
|
+
|
|
104
|
+
(target as ConnectedComponent).__onConnected__((component) => {
|
|
105
|
+
for (const conf of confs) {
|
|
106
|
+
callback = descriptor.value.bind(component);
|
|
107
|
+
conf.callbacks.add(callback);
|
|
108
|
+
conf.publisher.onAssign(conf.onAssign);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
(target as ConnectedComponent).__onDisconnected__(() => {
|
|
113
|
+
for (const conf of confs) {
|
|
114
|
+
conf.callbacks.delete(callback);
|
|
115
|
+
conf.publisher.offAssign(conf.onAssign);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function autoSubscribe() {
|
|
122
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
123
|
+
let renderId = 0;
|
|
124
|
+
|
|
125
|
+
const originalMethod = descriptor.value;
|
|
126
|
+
const originalDC = target.constructor.prototype.disconnectedCallback;
|
|
127
|
+
target.constructor.prototype.disconnectedCallback = function () {
|
|
128
|
+
originalDC.apply(this);
|
|
129
|
+
this.__removeAutoSubscribe__();
|
|
130
|
+
};
|
|
131
|
+
const originalConnectedCallback = target.connectedCallback;
|
|
132
|
+
target.connectedCallback = function (this: any) {
|
|
133
|
+
originalConnectedCallback?.call(this);
|
|
134
|
+
this[propertyKey]();
|
|
135
|
+
};
|
|
136
|
+
descriptor.value = function (...args: unknown[]) {
|
|
137
|
+
let publishers: Set<PublisherProxy> = new Set();
|
|
138
|
+
const onAssign = () => {
|
|
139
|
+
renderId++;
|
|
140
|
+
const id = renderId;
|
|
141
|
+
window.queueMicrotask(() => {
|
|
142
|
+
if (id !== renderId) return;
|
|
143
|
+
(this as any)[propertyKey]();
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
//on désabone les publishers du rendu précédant
|
|
147
|
+
publishers.forEach((publisher: PublisherProxy) => {
|
|
148
|
+
publisher.offAssign(onAssign);
|
|
149
|
+
});
|
|
150
|
+
//on collecte les publisher modifiés pour s'abonner pour la prochaine modification
|
|
151
|
+
PublisherManager.collectModifiedPublisher();
|
|
152
|
+
const result = originalMethod.apply(this, args);
|
|
153
|
+
publishers = PublisherManager.getModifiedPublishers() || new Set<PublisherProxy>();
|
|
154
|
+
publishers.forEach((publisher: PublisherProxy) => {
|
|
155
|
+
publisher.onAssign(onAssign, false);
|
|
156
|
+
});
|
|
157
|
+
(this as typeof target.constructor.prototype.disconnectedCallback).__removeAutoSubscribe__ = () => {
|
|
158
|
+
publishers.forEach((publisher: PublisherProxy) => {
|
|
159
|
+
publisher.offAssign(onAssign);
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
return result;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export function autoFill(values: string[]) {
|
|
167
|
+
return function (target: unknown) {
|
|
168
|
+
setSubscribable(target);
|
|
169
|
+
for (const value of values) {
|
|
170
|
+
const split = value.split(".");
|
|
171
|
+
if (split.length == 0) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const dataProvider: string = split.shift() || "";
|
|
175
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
176
|
+
publisher = Objects.traverse(publisher, split);
|
|
177
|
+
(target as ConnectedComponent).__onConnected__((component: unknown) => {
|
|
178
|
+
publisher.startTemplateFilling(component);
|
|
179
|
+
});
|
|
180
|
+
(target as ConnectedComponent).__onDisconnected__(() => {
|
|
181
|
+
(component: unknown) => {
|
|
182
|
+
publisher.stopTemplateFilling(component);
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|