@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,290 @@
|
|
|
1
|
+
# Date
|
|
2
|
+
|
|
3
|
+
## No attribute
|
|
4
|
+
|
|
5
|
+
**Nothing** is displayed.
|
|
6
|
+
|
|
7
|
+
<sonic-code>
|
|
8
|
+
<template>
|
|
9
|
+
<sonic-date></sonic-date>
|
|
10
|
+
</template>
|
|
11
|
+
</sonic-code>
|
|
12
|
+
|
|
13
|
+
## Now
|
|
14
|
+
|
|
15
|
+
Displays the **current date**.
|
|
16
|
+
|
|
17
|
+
<sonic-code>
|
|
18
|
+
<template>
|
|
19
|
+
<sonic-date now></sonic-date>
|
|
20
|
+
</template>
|
|
21
|
+
</sonic-code>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Date
|
|
25
|
+
|
|
26
|
+
Displays a date from a **timestamp**.
|
|
27
|
+
|
|
28
|
+
<sonic-code>
|
|
29
|
+
<template>
|
|
30
|
+
<sonic-date date= "1640265629"></sonic-date>
|
|
31
|
+
</template>
|
|
32
|
+
</sonic-code>
|
|
33
|
+
|
|
34
|
+
## Date_string
|
|
35
|
+
|
|
36
|
+
Displays a date from a **string**.
|
|
37
|
+
|
|
38
|
+
<sonic-code>
|
|
39
|
+
<template>
|
|
40
|
+
<sonic-date date_string="July 20, 69 20:17:40 GMT+00:00"></sonic-date>
|
|
41
|
+
</template>
|
|
42
|
+
</sonic-code>
|
|
43
|
+
|
|
44
|
+
## Start_date / end_date
|
|
45
|
+
|
|
46
|
+
Displays a period of time **from start_date to end_date**.
|
|
47
|
+
When by itself **start_date** will act as **date**
|
|
48
|
+
if a **start_date is not specified** it will be set by the **current date**.
|
|
49
|
+
if the **end_date is anterior** to start date date it will be **used as the start_date**.
|
|
50
|
+
|
|
51
|
+
<sonic-code>
|
|
52
|
+
<template>
|
|
53
|
+
<!-- from start_date to end_date -->
|
|
54
|
+
<sonic-date start_date="1640265629" end_date= "1640365629"></sonic-date>
|
|
55
|
+
<br>
|
|
56
|
+
<!-- start_date is not specified -->
|
|
57
|
+
<sonic-date end_date= "2640365629"></sonic-date>
|
|
58
|
+
<br>
|
|
59
|
+
<!-- end_date is anterior -->
|
|
60
|
+
<sonic-date end_date= "640365629"></sonic-date>
|
|
61
|
+
</template>
|
|
62
|
+
</sonic-code>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Start_date_string / end_date_string
|
|
66
|
+
|
|
67
|
+
<sonic-code>
|
|
68
|
+
<template>
|
|
69
|
+
<!-- from start_date to end_date -->
|
|
70
|
+
<sonic-date date_string="July 20, 90 20:17:40 GMT+00:00" end_date_string= "June 20, 94 20:17:40 GMT+00:00"></sonic-date>
|
|
71
|
+
<br>
|
|
72
|
+
<!-- start_date is not specified -->
|
|
73
|
+
<sonic-date end_date_string= "May 20, 34 20:17:40 GMT+00:00"></sonic-date>
|
|
74
|
+
<br>
|
|
75
|
+
<!-- end_date is anterior -->
|
|
76
|
+
<sonic-date end_date_string= "April 20, 06 20:17:40 GMT+00:00"></sonic-date>
|
|
77
|
+
</template>
|
|
78
|
+
</sonic-code>
|
|
79
|
+
|
|
80
|
+
## Wording_billet_periode_validite
|
|
81
|
+
|
|
82
|
+
<sonic-code>
|
|
83
|
+
<template>
|
|
84
|
+
<sonic-date wording_billet_periode_validite= "À partir du %s jusqu'au %s" start_date="1640265629" end_date= "1640365629"></sonic-date>
|
|
85
|
+
</template>
|
|
86
|
+
</sonic-code>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Weekday
|
|
90
|
+
|
|
91
|
+
<sonic-code>
|
|
92
|
+
<template>
|
|
93
|
+
<b>narrow : </b>
|
|
94
|
+
<sonic-date weekday="narrow" now></sonic-date>
|
|
95
|
+
<br>
|
|
96
|
+
<b>short (default) : </b>
|
|
97
|
+
<sonic-date weekday="short" now></sonic-date>
|
|
98
|
+
<br>
|
|
99
|
+
<b>long : </b>
|
|
100
|
+
<sonic-date weekday="long" now></sonic-date>
|
|
101
|
+
<br>
|
|
102
|
+
<b>hidden : </b>
|
|
103
|
+
<sonic-date weekday="hidden" now></sonic-date>
|
|
104
|
+
</template>
|
|
105
|
+
</sonic-code>
|
|
106
|
+
|
|
107
|
+
## Day
|
|
108
|
+
|
|
109
|
+
<sonic-code>
|
|
110
|
+
<template>
|
|
111
|
+
<b>numeric : </b>
|
|
112
|
+
<sonic-date day="numeric" date_string="July 01, 69"></sonic-date>
|
|
113
|
+
<br>
|
|
114
|
+
<b>2-digit (default) : </b>
|
|
115
|
+
<sonic-date day="2-digit" date_string="July 01, 69"></sonic-date>
|
|
116
|
+
</template>
|
|
117
|
+
</sonic-code>
|
|
118
|
+
|
|
119
|
+
## Month
|
|
120
|
+
|
|
121
|
+
<sonic-code>
|
|
122
|
+
<template>
|
|
123
|
+
<b>numeric : </b>
|
|
124
|
+
<sonic-date month="numeric" now></sonic-date>
|
|
125
|
+
<br>
|
|
126
|
+
<b>2-digit : </b>
|
|
127
|
+
<sonic-date month="2-digit" now></sonic-date>
|
|
128
|
+
<br>
|
|
129
|
+
<b>narrow : </b>
|
|
130
|
+
<sonic-date month="narrow" now></sonic-date>
|
|
131
|
+
<br>
|
|
132
|
+
<b>short (default) : </b>
|
|
133
|
+
<sonic-date month="short" now></sonic-date>
|
|
134
|
+
<br>
|
|
135
|
+
<b>long : </b>
|
|
136
|
+
<sonic-date month="long" now></sonic-date>
|
|
137
|
+
</template>
|
|
138
|
+
</sonic-code>
|
|
139
|
+
|
|
140
|
+
## Year
|
|
141
|
+
|
|
142
|
+
<sonic-code>
|
|
143
|
+
<template>
|
|
144
|
+
<b>numeric (default) : </b>
|
|
145
|
+
<sonic-date year="numeric" now></sonic-date>
|
|
146
|
+
<br>
|
|
147
|
+
<b>2-digit : </b>
|
|
148
|
+
<sonic-date year="2-digit" now></sonic-date>
|
|
149
|
+
</template>
|
|
150
|
+
</sonic-code>
|
|
151
|
+
|
|
152
|
+
## Hour
|
|
153
|
+
|
|
154
|
+
<sonic-code>
|
|
155
|
+
<template>
|
|
156
|
+
<b>numeric : </b>
|
|
157
|
+
<sonic-date hour="numeric" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
158
|
+
<br>
|
|
159
|
+
<b>2-digit (default) : </b>
|
|
160
|
+
<sonic-date hour="2-digit" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
161
|
+
<br>
|
|
162
|
+
<b>hidden : </b>
|
|
163
|
+
<sonic-date hour="hidden" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
164
|
+
</template>
|
|
165
|
+
</sonic-code>
|
|
166
|
+
|
|
167
|
+
## Minute
|
|
168
|
+
|
|
169
|
+
<sonic-code>
|
|
170
|
+
<template>
|
|
171
|
+
<b>numeric : </b>
|
|
172
|
+
<sonic-date minute="numeric" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
173
|
+
<br>
|
|
174
|
+
<b>2-digit (default) : </b>
|
|
175
|
+
<sonic-date minute="2-digit" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
176
|
+
<br>
|
|
177
|
+
<b>hidden : </b>
|
|
178
|
+
<sonic-date minute="hidden" date_string= "June 20, 04 02:06:02 GMT+00:00"></sonic-date>
|
|
179
|
+
</template>
|
|
180
|
+
</sonic-code>
|
|
181
|
+
|
|
182
|
+
## Language
|
|
183
|
+
|
|
184
|
+
<sonic-button href="https://www.w3schools.com/tags/ref_language_codes.asp" target="_blank" type="info" size="sm">ISO 639-1 Language Codes</sonic-button>
|
|
185
|
+
|
|
186
|
+
<sonic-code>
|
|
187
|
+
<template>
|
|
188
|
+
<b>fr : </b>
|
|
189
|
+
<sonic-date language="fr" now></sonic-date>
|
|
190
|
+
<br>
|
|
191
|
+
<b>en : </b>
|
|
192
|
+
<sonic-date language="en" now></sonic-date>
|
|
193
|
+
<br>
|
|
194
|
+
<b>zh : </b>
|
|
195
|
+
<sonic-date language="zh" now></sonic-date>
|
|
196
|
+
<br>
|
|
197
|
+
<b>ja : </b>
|
|
198
|
+
<sonic-date language="ja" now></sonic-date>
|
|
199
|
+
</template>
|
|
200
|
+
</sonic-code>
|
|
201
|
+
|
|
202
|
+
## Time_zone
|
|
203
|
+
|
|
204
|
+
For the list of supported timeZones, run <b class="text-info">Intl.supportedValuesOf('timeZone')</b> in the console
|
|
205
|
+
|
|
206
|
+
<sonic-code>
|
|
207
|
+
<template>
|
|
208
|
+
<b>Europe/London : </b>
|
|
209
|
+
<sonic-date time_zone="Europe/London" now></sonic-date>
|
|
210
|
+
<br>
|
|
211
|
+
<b>Europe/Paris : </b>
|
|
212
|
+
<sonic-date time_zone="Europe/Paris" now></sonic-date>
|
|
213
|
+
<br>
|
|
214
|
+
<b>America/Tijuana : </b>
|
|
215
|
+
<sonic-date time_zone="America/Tijuana" now></sonic-date>
|
|
216
|
+
</template>
|
|
217
|
+
</sonic-code>
|
|
218
|
+
|
|
219
|
+
## Era
|
|
220
|
+
|
|
221
|
+
<sonic-code>
|
|
222
|
+
<template>
|
|
223
|
+
<b>narrow : </b>
|
|
224
|
+
<sonic-date era="narrow" now></sonic-date>
|
|
225
|
+
<br>
|
|
226
|
+
<b>short : </b>
|
|
227
|
+
<sonic-date era="short" now></sonic-date>
|
|
228
|
+
<br>
|
|
229
|
+
<b>long : </b>
|
|
230
|
+
<sonic-date era="long" now></sonic-date>
|
|
231
|
+
</template>
|
|
232
|
+
</sonic-code>
|
|
233
|
+
|
|
234
|
+
## .renderIf
|
|
235
|
+
|
|
236
|
+
<sonic-alert status="error" background>Deprecated</sonic-alert>
|
|
237
|
+
|
|
238
|
+
<sonic-code>
|
|
239
|
+
<template>
|
|
240
|
+
<b>True statement : </b>
|
|
241
|
+
<sonic-date data-bind ::render-if="|10>2" now></sonic-date>
|
|
242
|
+
<br>
|
|
243
|
+
<b>False statement : </b>
|
|
244
|
+
<sonic-date data-bind ::render-if="|10<2" now></sonic-date>
|
|
245
|
+
</template>
|
|
246
|
+
</sonic-code>
|
|
247
|
+
|
|
248
|
+
## DesignMode
|
|
249
|
+
|
|
250
|
+
<sonic-code>
|
|
251
|
+
<template>
|
|
252
|
+
<div class="relative max-w-lg rounded-lg overflow-hidden">
|
|
253
|
+
<div class="absolute top-0 h-1/2 w-full bg-gradient-to-b from-[rgba(0,0,10,.2)] z-10 "></div>
|
|
254
|
+
<sonic-date
|
|
255
|
+
designMode
|
|
256
|
+
noShadowDom
|
|
257
|
+
start_date= "1640265629"
|
|
258
|
+
end_date= "1640365629"
|
|
259
|
+
language= "fr"
|
|
260
|
+
wording_billet_periode_validite= "Du %s au %s"
|
|
261
|
+
year= "numeric"
|
|
262
|
+
month= "short"
|
|
263
|
+
weekday= "short"
|
|
264
|
+
hour= "2-digit"
|
|
265
|
+
minute= "2-digit"
|
|
266
|
+
class="py-4 drop-shadow-lg text-contrast-content p-4 inline-block text-center absolute left-0 z-20 text-sm"
|
|
267
|
+
>
|
|
268
|
+
<template data-value="weekday">
|
|
269
|
+
<span class="hidden"></span>
|
|
270
|
+
</template>
|
|
271
|
+
<template data-value="day">
|
|
272
|
+
<span class="text-4xl block uppercase leading-none font-bold"></span>
|
|
273
|
+
</template>
|
|
274
|
+
<template data-value="month">
|
|
275
|
+
<span class="text-xl block uppercase leading-tight font-bold"></span>
|
|
276
|
+
</template>
|
|
277
|
+
<template data-value="year">
|
|
278
|
+
<span class="text-lg mb-1 font-bold block uppercase leading-tight "></span>
|
|
279
|
+
</template>
|
|
280
|
+
<template data-value="to">
|
|
281
|
+
<span class="font-medium block my-1 text-3xl leading-none">↓</span>
|
|
282
|
+
</template>
|
|
283
|
+
</sonic-date>
|
|
284
|
+
<sonic-image
|
|
285
|
+
ratio="1/1" src="https://picsum.photos/id/237/700/700">
|
|
286
|
+
</sonic-image>
|
|
287
|
+
</div>
|
|
288
|
+
</template>
|
|
289
|
+
</sonic-code>
|
|
290
|
+
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
2
|
+
import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
3
|
+
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
4
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
5
|
+
import { LitElement, nothing } from "lit";
|
|
6
|
+
import { customElement, property } from "lit/decorators.js";
|
|
7
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
8
|
+
|
|
9
|
+
const tagName = "sonic-date";
|
|
10
|
+
|
|
11
|
+
type DateTimeFormatPartExtended = {
|
|
12
|
+
hidden?: boolean;
|
|
13
|
+
source?: string;
|
|
14
|
+
type: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type DateTimeFormatExtened = Intl.DateTimeFormat & {
|
|
19
|
+
formatRangeToParts: (
|
|
20
|
+
startDate: Date,
|
|
21
|
+
endDate: Date
|
|
22
|
+
) => DateTimeFormatPartExtended[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
@customElement(tagName)
|
|
26
|
+
export class SonicDate extends Subscriber(TemplatesContainer(LitElement)) {
|
|
27
|
+
pageLanguage = "fr";
|
|
28
|
+
private duAu: string[] = [];
|
|
29
|
+
private _wording_billet_periode_validite = "";
|
|
30
|
+
@property() get wording_billet_periode_validite(): string {
|
|
31
|
+
return this._wording_billet_periode_validite;
|
|
32
|
+
}
|
|
33
|
+
set wording_billet_periode_validite(value: string) {
|
|
34
|
+
if (!value) value = "Du %s au %s";
|
|
35
|
+
this._wording_billet_periode_validite = value;
|
|
36
|
+
this.duAu = this.wording_billet_periode_validite
|
|
37
|
+
?.split("%s")
|
|
38
|
+
.map((str) => str.trim());
|
|
39
|
+
this.duAu.pop();
|
|
40
|
+
this.requestUpdate();
|
|
41
|
+
}
|
|
42
|
+
@property({ type: Boolean }) designMode: boolean | null = null;
|
|
43
|
+
@property({ type: String }) time_zone: string | null = null;
|
|
44
|
+
@property({ type: Number }) date: number | null = null;
|
|
45
|
+
@property({ type: String }) date_string: string | null = null;
|
|
46
|
+
@property({ type: String }) start_date_string: string | null = null;
|
|
47
|
+
@property({ type: String }) end_date_string: string | null = null;
|
|
48
|
+
@property({ type: Number }) start_date = 0;
|
|
49
|
+
@property({ type: Boolean }) hide_hours = false;
|
|
50
|
+
@property({ type: Number }) end_date = 0;
|
|
51
|
+
@property({ type: String }) era: "narrow" | "short" | "long" | "" = "";
|
|
52
|
+
@property({ type: String }) year: "numeric" | "2-digit" = "numeric";
|
|
53
|
+
@property({ type: String }) month:
|
|
54
|
+
| "numeric"
|
|
55
|
+
| "2-digit"
|
|
56
|
+
| "narrow"
|
|
57
|
+
| "short"
|
|
58
|
+
| "long" = "short";
|
|
59
|
+
@property({ type: String }) day: "numeric" | "2-digit" = "2-digit";
|
|
60
|
+
@property({ type: String }) weekday: "narrow" | "short" | "long" | "hidden" =
|
|
61
|
+
"short";
|
|
62
|
+
@property({ type: String }) hour: "numeric" | "2-digit" | "hidden" =
|
|
63
|
+
"2-digit";
|
|
64
|
+
@property({ type: Boolean }) hour12 = false;
|
|
65
|
+
@property({ type: String }) minute: "numeric" | "2-digit" | "hidden" =
|
|
66
|
+
"2-digit";
|
|
67
|
+
@property({ type: String }) language = "";
|
|
68
|
+
@property({ type: Boolean }) renderIf = true;
|
|
69
|
+
@property({ type: Boolean }) now = false;
|
|
70
|
+
// @property({type:String}) second: 'numeric' | '2-digit'= "2-digit"
|
|
71
|
+
// @property({ type: String }) hour12: boolean = false;
|
|
72
|
+
private startDateObject = new Date();
|
|
73
|
+
private endDateObject = new Date();
|
|
74
|
+
connectedCallback(): void {
|
|
75
|
+
if (!this.hasAttribute("wording_billet_periode_validite"))
|
|
76
|
+
this.wording_billet_periode_validite = "Du %s au %s";
|
|
77
|
+
this.pageLanguage = HTML.getLanguage();
|
|
78
|
+
super.connectedCallback();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
|
|
82
|
+
*/
|
|
83
|
+
getDatesParts(
|
|
84
|
+
start_date: number,
|
|
85
|
+
end_date: number,
|
|
86
|
+
options: Intl.DateTimeFormatOptions
|
|
87
|
+
) {
|
|
88
|
+
const start = this.startDateObject;
|
|
89
|
+
start.setTime(start_date * 1000);
|
|
90
|
+
|
|
91
|
+
let parts: DateTimeFormatPartExtended[] = [];
|
|
92
|
+
if (end_date > 0) {
|
|
93
|
+
const end = this.endDateObject;
|
|
94
|
+
end.setTime(end_date * 1000);
|
|
95
|
+
//
|
|
96
|
+
//on affiche pas l'heure si les dates sont les mêmes
|
|
97
|
+
const isSameDay = start.toDateString() == end.toDateString();
|
|
98
|
+
if (!isSameDay || this.hide_hours) {
|
|
99
|
+
delete options.hour;
|
|
100
|
+
delete options.minute;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const format: DateTimeFormatExtened = new Intl.DateTimeFormat(
|
|
104
|
+
this.language || this.pageLanguage,
|
|
105
|
+
options
|
|
106
|
+
) as DateTimeFormatExtened;
|
|
107
|
+
parts = format.formatRangeToParts(start, end);
|
|
108
|
+
//on affiche du au uniquement si on a deux dates différentes
|
|
109
|
+
if (!isSameDay) {
|
|
110
|
+
const to = parts.find(
|
|
111
|
+
(part) =>
|
|
112
|
+
part.type == "literal" &&
|
|
113
|
+
part.source == "shared" &&
|
|
114
|
+
part.value.trim().length > 0
|
|
115
|
+
);
|
|
116
|
+
if (to) {
|
|
117
|
+
to.value = " " + this.duAu[1] + " ";
|
|
118
|
+
to.type = "to";
|
|
119
|
+
}
|
|
120
|
+
if (!this.designMode)
|
|
121
|
+
parts.unshift({
|
|
122
|
+
type: "from",
|
|
123
|
+
value: this.duAu[0] + " ",
|
|
124
|
+
source: "shared",
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
const format: Intl.DateTimeFormat = new Intl.DateTimeFormat(
|
|
129
|
+
this.language || this.pageLanguage,
|
|
130
|
+
options
|
|
131
|
+
);
|
|
132
|
+
parts = format.formatToParts(start);
|
|
133
|
+
}
|
|
134
|
+
//En mode design on cache les ","
|
|
135
|
+
if (this.designMode) {
|
|
136
|
+
// parts.forEach((part) => (part.hidden = part.value.trim() == ","));
|
|
137
|
+
// replace all "," by " "
|
|
138
|
+
parts.forEach((part) => (part.value = part.value.replace(/,/g, " ")));
|
|
139
|
+
}
|
|
140
|
+
parts[0].value = Format.ucFirst(parts[0].value);
|
|
141
|
+
return parts.filter((p: DateTimeFormatPartExtended) => p.hidden !== true);
|
|
142
|
+
}
|
|
143
|
+
dateStringToSeconds(dateString: string) {
|
|
144
|
+
return new Date(dateString).getTime() / 1000;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render() {
|
|
148
|
+
if (!this.renderIf) return nothing;
|
|
149
|
+
/* *
|
|
150
|
+
* Normalisation en fonction des valeurs de dates passées *
|
|
151
|
+
* */
|
|
152
|
+
if (this.date_string)
|
|
153
|
+
this.date = this.dateStringToSeconds(this.date_string);
|
|
154
|
+
if (this.date) this.start_date = this.date;
|
|
155
|
+
if (this.start_date_string)
|
|
156
|
+
this.start_date = this.dateStringToSeconds(this.start_date_string);
|
|
157
|
+
if (this.end_date_string)
|
|
158
|
+
this.end_date = this.dateStringToSeconds(this.end_date_string);
|
|
159
|
+
|
|
160
|
+
if (!this.start_date && !this.now && !this.end_date) return nothing;
|
|
161
|
+
if (!this.start_date) this.start_date = Date.now() / 1000;
|
|
162
|
+
if (this.end_date > 0 && this.end_date < this.start_date) {
|
|
163
|
+
const copy = this.start_date;
|
|
164
|
+
this.start_date = this.end_date;
|
|
165
|
+
this.end_date = copy;
|
|
166
|
+
}
|
|
167
|
+
/* *
|
|
168
|
+
* gestion des options d'affichage des dates
|
|
169
|
+
* */
|
|
170
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
171
|
+
year: this.year,
|
|
172
|
+
month: this.month,
|
|
173
|
+
day: this.day,
|
|
174
|
+
hour12: this.hour12,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (this.weekday !== "hidden") options.weekday = this.weekday;
|
|
178
|
+
if (this.hour !== "hidden") options.hour = this.hour;
|
|
179
|
+
if (this.minute !== "hidden") options.minute = this.minute;
|
|
180
|
+
if (this.era) options.era = this.era;
|
|
181
|
+
if (this.time_zone) options.timeZone = this.time_zone;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* On récupère les différentes partie affichées en vu de l'injection dans le template
|
|
185
|
+
*/
|
|
186
|
+
const parts = this.getDatesParts(this.start_date, this.end_date, options);
|
|
187
|
+
|
|
188
|
+
return unsafeHTML(
|
|
189
|
+
`${parts
|
|
190
|
+
.map((part: DateTimeFormatPartExtended) => {
|
|
191
|
+
const template = this.templateParts[part.type];
|
|
192
|
+
if (template) {
|
|
193
|
+
const clone = document.importNode(template.content, true);
|
|
194
|
+
const child: HTMLElement = clone.children[0] as HTMLElement;
|
|
195
|
+
if (child.innerText.trim() == "") child.innerText = part.value;
|
|
196
|
+
return child.outerHTML;
|
|
197
|
+
}
|
|
198
|
+
const span = document.createElement("span");
|
|
199
|
+
span.innerText = part.value;
|
|
200
|
+
span.className = part.type;
|
|
201
|
+
return `<span class="${part.type}">${part.value}</span>`;
|
|
202
|
+
})
|
|
203
|
+
.join("")}`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {html, LitElement} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
4
|
+
const tagName = "sonic-example"; // For Astro.build
|
|
5
|
+
@customElement(tagName)
|
|
6
|
+
export class SonicComponent extends Subscriber(LitElement) {
|
|
7
|
+
@property() text = "Example";
|
|
8
|
+
render() {
|
|
9
|
+
return html`<div>${this.text}</div>`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Fetch
|
|
2
|
+
The **sonic-fetch** component is used to request and store data from an API.
|
|
3
|
+
Fetch extends the mixins Fetcher and [Subscriber](#docs/_core-concept/subscriber.md/subscriber)
|
|
4
|
+
|
|
5
|
+
## Basic usage
|
|
6
|
+
In order to work properly the <b>sonic-fetch</b> component needs at least the following attributes.
|
|
7
|
+
- **serviceURL** : A base service url. This attribute can be inherited from an ancestor.
|
|
8
|
+
*ex : https://reqres.in*
|
|
9
|
+
- **endPoint** : the specific location where requests for information are sent (see the api docs).
|
|
10
|
+
*ex : api/users | api/users?page=2 | api/users/2*
|
|
11
|
+
- **dataProvider *(Required)*** : An ID that is used as a reference to the object storing the data returned by the API.
|
|
12
|
+
This attribute can be inherited from an ancestor.
|
|
13
|
+
|
|
14
|
+
<sonic-code>
|
|
15
|
+
<template>
|
|
16
|
+
<sonic-fetch serviceURL="https://reqres.in" endPoint="api/users?page=2" dataProvider="myDataObj"></sonic-fetch>
|
|
17
|
+
<sonic-button dataProvider="myDataObj" debug>Hover to see the data</sonic-button>
|
|
18
|
+
</template>
|
|
19
|
+
</sonic-code>
|
|
20
|
+
|
|
21
|
+
## DataProvider as an endPoint
|
|
22
|
+
If no **endPoint** is specified it will be filled by the **dataProvider ID** instead
|
|
23
|
+
|
|
24
|
+
<sonic-code>
|
|
25
|
+
<template>
|
|
26
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="api/users?page=2" ></sonic-fetch>
|
|
27
|
+
<sonic-button dataProvider="api/users?page=2" debug>Hover to see the data</sonic-button>
|
|
28
|
+
</template>
|
|
29
|
+
</sonic-code>
|
|
30
|
+
|
|
31
|
+
## HeadersDataProvider
|
|
32
|
+
|
|
33
|
+
<sonic-alert status="error" background>Deprecated</sonic-alert>
|
|
34
|
+
|
|
35
|
+
## Key
|
|
36
|
+
When the **key** attribute is present, only a sub-part of the data received is injected into the **dataProvider**.
|
|
37
|
+
We can use the dot syntax to target what we want to keep.
|
|
38
|
+
|
|
39
|
+
For example if the data is `{my:{data:{a:1,b:2}}}` and the key is `key="my.data"`, the data available in the **dataProvider** will be `{a:1 , b:2}`
|
|
40
|
+
|
|
41
|
+
<sonic-code>
|
|
42
|
+
<template>
|
|
43
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="api/users/2" ></sonic-fetch>
|
|
44
|
+
<sonic-button dataProvider="api/users/2" debug>dataProvider object</sonic-button>
|
|
45
|
+
<!-- Get the user ID -->
|
|
46
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="id" endPoint="api/users/2" key="data.id"></sonic-fetch>
|
|
47
|
+
<sonic-button dataProvider="id" debug>data.id</sonic-button>
|
|
48
|
+
<!-- Get the user First name -->
|
|
49
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="first_name" endPoint="api/users/2" key="data.first_name"></sonic-fetch>
|
|
50
|
+
<sonic-button dataProvider="first_name" debug>data.first_name</sonic-button>
|
|
51
|
+
<!-- Get the user Last name -->
|
|
52
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="last_name" endPoint="api/users/2" key="data.last_name"></sonic-fetch>
|
|
53
|
+
<sonic-button dataProvider="last_name" debug>data.last_name</sonic-button>
|
|
54
|
+
<!-- Get the user email -->
|
|
55
|
+
<sonic-fetch serviceURL="https://reqres.in" dataProvider="email" endPoint="api/users/2" key="data.email"></sonic-fetch>
|
|
56
|
+
<sonic-button dataProvider="email" debug>data.email</sonic-button>
|
|
57
|
+
</template>
|
|
58
|
+
</sonic-code>
|
|
59
|
+
|
|
60
|
+
## Text mode
|
|
61
|
+
|
|
62
|
+
if the mime type of the content returned by the service begins with **text/**, then the dataProvider has a key named "text" which contains the text returned by the service.
|
|
63
|
+
|
|
64
|
+
<sonic-code>
|
|
65
|
+
<template>
|
|
66
|
+
<sonic-fetch endPoint="README.md" dataProvider="fetchText"></sonic-fetch>
|
|
67
|
+
<sonic-button dataProvider="fetchText" debug>Hover to see the data</sonic-button>
|
|
68
|
+
</template>
|
|
69
|
+
</sonic-code>
|
|
70
|
+
|
|
71
|
+
## NoLoader
|
|
72
|
+
|
|
73
|
+
The noLoader attribute disables display of the default loader
|
|
74
|
+
|
|
75
|
+
<sonic-code>
|
|
76
|
+
<template>
|
|
77
|
+
<sonic-fetch noLoader serviceURL="https://reqres.in" endPoint="api/users?page=2" dataProvider="myDataObj"></sonic-fetch>
|
|
78
|
+
<sonic-button dataProvider="myDataObj" debug>Basic fetch with noLoader attribute</sonic-button>
|
|
79
|
+
</template>
|
|
80
|
+
</sonic-code>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<!--
|
|
86
|
+
## Summary
|
|
87
|
+
Extends mixins : Fetcher, [Subscriber](#core/components/functional/subscriber/subscriber.md/subscriber)
|
|
88
|
+
|
|
89
|
+
### Configuration via les attributs
|
|
90
|
+
|
|
91
|
+
| nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
|
|
92
|
+
|-----|-----|---|---|---|
|
|
93
|
+
| serviceURL |Fetcher ou un de ses parents | URL de base des services. | http://la-billetterie.net/api/v2 | domain du site |
|
|
94
|
+
| endpoint |Fetcher | point d'accès d'un service | user/2 | valeur de l'attribut dataProvider |
|
|
95
|
+
| dataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données, voir [subscriber](#core/components/functional/subscriber/subscriber.md/subscriber). | billetterie/user/2 | *REQUIS* |
|
|
96
|
+
| headersDataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données destinées à être envoyées en entêtes de la requetes | MyCoockieHEaders | null |
|
|
97
|
+
| key |Fetcher | extrait une sous propriété de la donnée chargée avant de l'assignée à son publisher | ma.data | null |
|
|
98
|
+
|
|
99
|
+
*Si la données est `{ma:{data:{a:1,b:2}}}` et `key="ma.data"`, la données disponible dans le composant sera `{a:1, b:2}`*
|
|
100
|
+
|
|
101
|
+
### Intégration auto de basic auth (pour tester une api qui nécessite une authentification)
|
|
102
|
+
|
|
103
|
+
Fetch utilise le service pour générer le token et l'ajoute au header de l'appel qui récupère les données.
|
|
104
|
+
|
|
105
|
+
| nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
|
|
106
|
+
|-----|-----|---|---|---|
|
|
107
|
+
| userName | Fetcher ou un de ses parents | Nom de l'utilisateur | DjuDju | null |
|
|
108
|
+
| password | Fetcher ou un de ses parents | mot de passe | pom_549 | null |
|
|
109
|
+
| tokenProvider | Fetcher ou un de ses parents | point d'accès du service fournissant le token | auth | null |
|
|
110
|
+
| token | Fetcher ou un de ses parents | A fournir à la place des autres attributs si on le possède | q<d34gb | null |
|
|
111
|
+
|
|
112
|
+
### Autres choses utiles
|
|
113
|
+
L'attribut *noLoader* du composant permet de désactiver l'affichage du loader par défaut.
|
|
114
|
+
On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
|
|
115
|
+
endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
|
|
116
|
+
-->
|
|
117
|
+
|