@supersoniks/concorde 5.0.5 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/launch.json +15 -0
- package/.claude/vite.http.config.mjs +7 -0
- package/.taste-skill/after/desktop-fold.jpg +0 -0
- package/.taste-skill/after/desktop-page-01.jpg +0 -0
- package/.taste-skill/after/desktop-page-02.jpg +0 -0
- package/.taste-skill/after/desktop-page-03.jpg +0 -0
- package/.taste-skill/after/mobile-fold.jpg +0 -0
- package/.taste-skill/after/mobile-page-01.jpg +0 -0
- package/.taste-skill/after/report.json +4103 -0
- package/.taste-skill/after/tablet-fold.jpg +0 -0
- package/.taste-skill/after/tablet-page-01.jpg +0 -0
- package/.taste-skill/after/tablet-page-02.jpg +0 -0
- package/.taste-skill/before/desktop-fold.jpg +0 -0
- package/.taste-skill/before/desktop-page-01.jpg +0 -0
- package/.taste-skill/before/desktop-page-02.jpg +0 -0
- package/.taste-skill/before/mobile-fold.jpg +0 -0
- package/.taste-skill/before/mobile-page-01.jpg +0 -0
- package/.taste-skill/before/report.json +2556 -0
- package/.taste-skill/before/tablet-fold.jpg +0 -0
- package/.taste-skill/before/tablet-page-01.jpg +0 -0
- package/.taste-skill/direction.json +510 -0
- package/.taste-skill/notes.md +84 -0
- package/.taste-skill/prod/desktop-fold.jpg +0 -0
- package/.taste-skill/prod/desktop-page-01.jpg +0 -0
- package/.taste-skill/prod/desktop-page-02.jpg +0 -0
- package/.taste-skill/prod/desktop-page-03.jpg +0 -0
- package/.taste-skill/prod/mobile-fold.jpg +0 -0
- package/.taste-skill/prod/mobile-page-01.jpg +0 -0
- package/.taste-skill/prod/mobile-page-02.jpg +0 -0
- package/.taste-skill/prod/report.json +1973 -0
- package/.taste-skill/prod/tablet-fold.jpg +0 -0
- package/.taste-skill/prod/tablet-page-01.jpg +0 -0
- package/.taste-skill/prod/tablet-page-02.jpg +0 -0
- package/.tmp-cem/custom-elements.json +13705 -0
- package/AUDIT.md +228 -0
- package/PLAN-AMELIORATION.md +220 -0
- package/build-infos.json +1 -1
- package/concorde-core.bundle.js +196 -196
- package/concorde-core.es.js +3854 -3572
- package/custom-elements-manifest.config.mjs +14 -0
- package/dist/concorde-core.bundle.js +196 -196
- package/dist/concorde-core.es.js +3854 -3572
- package/dist/img/archive/concorde-001-2cv.webp +0 -0
- package/dist/img/archive/concorde-red-arrows-2002-poster.jpg +0 -0
- package/dist/img/archive/concorde-red-arrows-2002.webm +0 -0
- package/dist/img/archive/credits.json +28 -0
- package/docs/assets/index-Bb-_LRyY.js +12280 -0
- package/docs/index.html +1 -1
- package/index.html +27 -63
- package/package.json +44 -3
- package/public/img/archive/concorde-001-2cv.webp +0 -0
- package/public/img/archive/concorde-red-arrows-2002-poster.jpg +0 -0
- package/public/img/archive/concorde-red-arrows-2002.webm +0 -0
- package/public/img/archive/credits.json +28 -0
- package/scripts/generate-sdui-catalog.mjs +250 -0
- package/scripts/generate-sdui-catalog.spec.ts +91 -0
- package/scripts/pre-build.mjs +15 -0
- package/src/core/components/functional/fetch/fetch.md +2 -2
- package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +5 -5
- package/src/core/components/functional/sdui/__fixtures__/descriptors.ts +251 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-action.spec.ts.snap +73 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-incremental.spec.ts.snap +50 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-partial.spec.ts.snap +50 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui.regression.spec.ts.snap +461 -0
- package/src/core/components/functional/sdui/component-catalog.gaps.json +511 -0
- package/src/core/components/functional/sdui/component-catalog.json +3103 -0
- package/src/core/components/functional/sdui/component-catalog.spec.ts +23 -0
- package/src/core/components/functional/sdui/sdui-action.spec.ts +99 -0
- package/src/core/components/functional/sdui/sdui-dom-snapshot.ts +61 -0
- package/src/core/components/functional/sdui/sdui-extension-points.md +94 -0
- package/src/core/components/functional/sdui/sdui-incremental.spec.ts +137 -0
- package/src/core/components/functional/sdui/sdui-partial.spec.ts +83 -0
- package/src/core/components/functional/sdui/sdui-partial.ts +19 -0
- package/src/core/components/functional/sdui/sdui-safe.spec.ts +188 -0
- package/src/core/components/functional/sdui/sdui-safe.ts +100 -0
- package/src/core/components/functional/sdui/sdui.md +122 -0
- package/src/core/components/functional/sdui/sdui.regression.spec.ts +64 -0
- package/src/core/components/functional/sdui/sdui.ts +442 -34
- package/src/core/components/functional/sdui/types.ts +49 -0
- package/src/core/components/ui/modal/modal.ts +14 -11
- package/src/docs/_getting-started/components.md +5 -0
- package/src/docs/_getting-started/theming.md +2 -2
- package/src/docs/code.ts +88 -75
- package/src/docs/components/docs-demo-sources.ts +16 -8
- package/src/docs/components/docs-lit-demo.ts +19 -37
- package/src/docs/docs.ts +5 -0
- package/src/docs/example/docs-boarding-pass-demo.ts +134 -0
- package/src/docs/example/docs-provider-keys.ts +12 -0
- package/src/docs/header/header.ts +233 -69
- package/src/docs/home/catalog.ts +44 -0
- package/src/docs/home/home.ts +513 -0
- package/src/docs/home/mach-stage.ts +389 -0
- package/src/docs/layout.ts +3 -1
- package/src/docs/navigation/components-index.ts +56 -0
- package/src/docs/navigation/navigation.ts +240 -232
- package/src/docs/navigation/pager.ts +67 -0
- package/src/docs/navigation/toc.ts +98 -0
- package/src/docs/search/docs-search.json +330 -20
- package/src/docs/search/markdown-renderer.ts +11 -3
- package/src/docs/shiki/index.ts +109 -0
- package/src/docs/tailwind/css/base/scrollbar.css +22 -0
- package/src/docs/tailwind/css/base/theme.css +96 -0
- package/src/docs/tailwind/css/base/typography.css +4 -0
- package/src/docs/tailwind/css/docs/boarding-pass.css +65 -0
- package/src/docs/tailwind/css/docs/content.css +32 -0
- package/src/docs/tailwind/css/docs/page.css +10 -0
- package/src/docs/tailwind/css/docs.css +9 -0
- package/src/docs/tailwind/css/home/hero.css +210 -0
- package/src/docs/tailwind/css/home/motion.css +84 -0
- package/src/docs/tailwind/css/home/sections.css +416 -0
- package/src/docs/tailwind/css/tailwind.css +7 -185
- package/src/tsconfig.json +113 -2
- package/src/tsconfig.tsbuildinfo +1 -1
- package/tailwind.config.js +8 -4
- package/docs/assets/index-wVZpLVYW.js +0 -12122
- package/docs/crawl/core/components/functional/date/date.html +0 -190
- package/docs/crawl/core/components/functional/fetch/fetch.html +0 -109
- package/docs/crawl/core/components/functional/if/if.html +0 -27
- package/docs/crawl/core/components/functional/jsonata/jsonata.html +0 -79
- package/docs/crawl/core/components/functional/list/list.html +0 -70
- package/docs/crawl/core/components/functional/mix/mix.html +0 -45
- package/docs/crawl/core/components/functional/queue/queue.html +0 -96
- package/docs/crawl/core/components/functional/router/router.html +0 -106
- package/docs/crawl/core/components/functional/sdui/sdui.html +0 -269
- package/docs/crawl/core/components/functional/states/states.html +0 -66
- package/docs/crawl/core/components/functional/submit/submit.html +0 -160
- package/docs/crawl/core/components/functional/subscriber/subscriber.html +0 -67
- package/docs/crawl/core/components/functional/value/value.html +0 -51
- package/docs/crawl/core/components/ui/alert/alert.html +0 -211
- package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +0 -131
- package/docs/crawl/core/components/ui/badge/badge.html +0 -197
- package/docs/crawl/core/components/ui/button/button.html +0 -150
- package/docs/crawl/core/components/ui/captcha/captcha.html +0 -112
- package/docs/crawl/core/components/ui/card/card.html +0 -253
- package/docs/crawl/core/components/ui/divider/divider.html +0 -144
- package/docs/crawl/core/components/ui/form/checkbox/checkbox.html +0 -73
- package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +0 -266
- package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +0 -122
- package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +0 -121
- package/docs/crawl/core/components/ui/form/input/input.html +0 -109
- package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +0 -38
- package/docs/crawl/core/components/ui/form/radio/radio.html +0 -56
- package/docs/crawl/core/components/ui/form/select/select.html +0 -73
- package/docs/crawl/core/components/ui/form/switch/switch.html +0 -56
- package/docs/crawl/core/components/ui/form/textarea/textarea.html +0 -59
- package/docs/crawl/core/components/ui/group/group.html +0 -104
- package/docs/crawl/core/components/ui/icon/icon.html +0 -222
- package/docs/crawl/core/components/ui/image/image.html +0 -298
- package/docs/crawl/core/components/ui/link/link.html +0 -100
- package/docs/crawl/core/components/ui/loader/loader.html +0 -124
- package/docs/crawl/core/components/ui/menu/menu.html +0 -394
- package/docs/crawl/core/components/ui/modal/modal.html +0 -342
- package/docs/crawl/core/components/ui/pop/pop.html +0 -296
- package/docs/crawl/core/components/ui/progress/progress.html +0 -131
- package/docs/crawl/core/components/ui/table/table.html +0 -545
- package/docs/crawl/core/components/ui/theme/theme.html +0 -131
- package/docs/crawl/core/components/ui/toast/toast.html +0 -233
- package/docs/crawl/core/components/ui/tooltip/tooltip.html +0 -140
- package/docs/crawl/docs/_core-concept/dataFlow.html +0 -177
- package/docs/crawl/docs/_core-concept/overview.html +0 -66
- package/docs/crawl/docs/_core-concept/subscriber.html +0 -75
- package/docs/crawl/docs/_decorators/ancestor-attribute.html +0 -117
- package/docs/crawl/docs/_decorators/auto-subscribe.html +0 -202
- package/docs/crawl/docs/_decorators/bind.html +0 -141
- package/docs/crawl/docs/_decorators/get.html +0 -149
- package/docs/crawl/docs/_decorators/handle.html +0 -165
- package/docs/crawl/docs/_decorators/on-assign.html +0 -355
- package/docs/crawl/docs/_decorators/patch.html +0 -78
- package/docs/crawl/docs/_decorators/post.html +0 -139
- package/docs/crawl/docs/_decorators/publish.html +0 -61
- package/docs/crawl/docs/_decorators/put.html +0 -78
- package/docs/crawl/docs/_decorators/subscribe.html +0 -109
- package/docs/crawl/docs/_decorators/wait-for-ancestors.html +0 -137
- package/docs/crawl/docs/_directives/sub.html +0 -93
- package/docs/crawl/docs/_getting-started/ai-agents.html +0 -173
- package/docs/crawl/docs/_getting-started/concorde-manual-install.html +0 -100
- package/docs/crawl/docs/_getting-started/concorde-outside.html +0 -58
- package/docs/crawl/docs/_getting-started/create-a-component.html +0 -111
- package/docs/crawl/docs/_getting-started/my-first-component.html +0 -189
- package/docs/crawl/docs/_getting-started/my-first-subscriber.html +0 -110
- package/docs/crawl/docs/_getting-started/pubsub.html +0 -62
- package/docs/crawl/docs/_getting-started/start.html +0 -76
- package/docs/crawl/docs/_getting-started/theming.html +0 -333
- package/docs/crawl/docs/_misc/api-configuration.html +0 -149
- package/docs/crawl/docs/_misc/dataProviderKey.html +0 -135
- package/docs/crawl/docs/_misc/docs-mock-api.html +0 -158
- package/docs/crawl/docs/_misc/dynamic-path.html +0 -180
- package/docs/crawl/docs/_misc/endpoint.html +0 -50
- package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +0 -138
- package/docs/crawl/docs/_misc/html-integration.html +0 -48
- package/docs/crawl/hubs/decorators.html +0 -547
- package/docs/crawl/hubs/form-components.html +0 -381
- package/docs/crawl/hubs/remote-data.html +0 -452
- package/docs/crawl/index.html +0 -102
- package/docs/llms-full.txt +0 -7008
- package/docs/llms.txt +0 -97
- package/docs/sitemap.xml +0 -240
- package/docs/src/core/components/functional/date/date.md +0 -290
- package/docs/src/core/components/functional/fetch/fetch.md +0 -125
- package/docs/src/core/components/functional/if/if.md +0 -9
- package/docs/src/core/components/functional/jsonata/jsonata.md +0 -56
- package/docs/src/core/components/functional/list/list.md +0 -65
- package/docs/src/core/components/functional/mix/mix.md +0 -41
- package/docs/src/core/components/functional/queue/queue.md +0 -72
- package/docs/src/core/components/functional/router/router.md +0 -94
- package/docs/src/core/components/functional/sdui/default-library.json +0 -108
- package/docs/src/core/components/functional/sdui/example.json +0 -99
- package/docs/src/core/components/functional/sdui/sdui.md +0 -356
- package/docs/src/core/components/functional/states/states.md +0 -87
- package/docs/src/core/components/functional/submit/submit.md +0 -114
- package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
- package/docs/src/core/components/functional/value/value.md +0 -35
- package/docs/src/core/components/ui/alert/alert.md +0 -196
- package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -85
- package/docs/src/core/components/ui/badge/badge.md +0 -188
- package/docs/src/core/components/ui/button/button.md +0 -183
- package/docs/src/core/components/ui/captcha/captcha.md +0 -71
- package/docs/src/core/components/ui/card/card.md +0 -215
- package/docs/src/core/components/ui/divider/divider.md +0 -129
- package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
- package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -205
- package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -100
- package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -119
- package/docs/src/core/components/ui/form/input/input.md +0 -142
- package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -29
- package/docs/src/core/components/ui/form/radio/radio.md +0 -57
- package/docs/src/core/components/ui/form/select/select.md +0 -71
- package/docs/src/core/components/ui/form/switch/switch.md +0 -57
- package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
- package/docs/src/core/components/ui/group/group.md +0 -75
- package/docs/src/core/components/ui/icon/icon.md +0 -214
- package/docs/src/core/components/ui/icon/icons.json +0 -1
- package/docs/src/core/components/ui/image/image.md +0 -233
- package/docs/src/core/components/ui/link/link.md +0 -81
- package/docs/src/core/components/ui/loader/loader.md +0 -112
- package/docs/src/core/components/ui/menu/menu.md +0 -370
- package/docs/src/core/components/ui/modal/modal.md +0 -235
- package/docs/src/core/components/ui/pop/pop.md +0 -294
- package/docs/src/core/components/ui/progress/progress.md +0 -109
- package/docs/src/core/components/ui/table/table.md +0 -431
- package/docs/src/core/components/ui/theme/theme.md +0 -122
- package/docs/src/core/components/ui/toast/toast.md +0 -216
- package/docs/src/core/components/ui/tooltip/tooltip.md +0 -124
- package/docs/src/docs/_core-concept/dataFlow.md +0 -88
- package/docs/src/docs/_core-concept/overview.md +0 -57
- package/docs/src/docs/_core-concept/subscriber.md +0 -75
- package/docs/src/docs/_decorators/ancestor-attribute.md +0 -128
- package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
- package/docs/src/docs/_decorators/bind.md +0 -167
- package/docs/src/docs/_decorators/get.md +0 -162
- package/docs/src/docs/_decorators/handle.md +0 -175
- package/docs/src/docs/_decorators/on-assign.md +0 -390
- package/docs/src/docs/_decorators/patch.md +0 -70
- package/docs/src/docs/_decorators/post.md +0 -146
- package/docs/src/docs/_decorators/publish.md +0 -55
- package/docs/src/docs/_decorators/put.md +0 -70
- package/docs/src/docs/_decorators/subscribe.md +0 -100
- package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
- package/docs/src/docs/_directives/sub.md +0 -91
- package/docs/src/docs/_getting-started/ai-agents.md +0 -76
- package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
- package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
- package/docs/src/docs/_getting-started/create-a-component.md +0 -139
- package/docs/src/docs/_getting-started/my-first-component.md +0 -236
- package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
- package/docs/src/docs/_getting-started/pubsub.md +0 -37
- package/docs/src/docs/_getting-started/start.md +0 -47
- package/docs/src/docs/_getting-started/theming.md +0 -253
- package/docs/src/docs/_misc/api-configuration.md +0 -81
- package/docs/src/docs/_misc/dataProviderKey.md +0 -168
- package/docs/src/docs/_misc/docs-mock-api.md +0 -63
- package/docs/src/docs/_misc/dynamic-path.md +0 -71
- package/docs/src/docs/_misc/endpoint.md +0 -45
- package/docs/src/docs/_misc/formelement-subscriber-removal.md +0 -115
- package/docs/src/docs/_misc/html-integration.md +0 -15
- package/docs/src/docs/search/docs-search.json +0 -12242
- package/docs/src/tag-list.json +0 -1
- package/docs/src/tsconfig-model.json +0 -23
- package/docs/src/tsconfig.json +0 -1242
- package/src/docs/prism/index.ts +0 -6
- package/src/docs/prism/prism.css +0 -158
- package/src/docs/prism/prism.js +0 -1022
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
# Toast
|
|
2
|
-
|
|
3
|
-
Toasts surface **short-lived feedback** in a fixed stack (bottom-right in the main window). Queue messages with **`SonicToast.add()`** on the global **`SonicToast`** class—the host **`sonic-toast`** is created automatically. Prefer **`label`** for a heading; use **`preserve`** or interactive **`text`** when the user must read or act before dismiss.
|
|
4
|
-
|
|
5
|
-
## Basic example
|
|
6
|
-
|
|
7
|
-
Click the button to show a toast.
|
|
8
|
-
|
|
9
|
-
<sonic-code>
|
|
10
|
-
<template>
|
|
11
|
-
<sonic-button onclick="SonicToast.add({ text: 'Simple notification' })">
|
|
12
|
-
Show toast
|
|
13
|
-
</sonic-button>
|
|
14
|
-
</template>
|
|
15
|
-
</sonic-code>
|
|
16
|
-
|
|
17
|
-
## Status
|
|
18
|
-
|
|
19
|
-
**`status`** drives color, icon, and live-region behavior. Omit **`status`** or pass an empty string for a neutral toast.
|
|
20
|
-
|
|
21
|
-
<sonic-code>
|
|
22
|
-
<template>
|
|
23
|
-
<div class="flex flex-wrap gap-2">
|
|
24
|
-
<sonic-button onclick="SonicToast.add({ text: 'Default message', status: '' })">
|
|
25
|
-
Default
|
|
26
|
-
</sonic-button>
|
|
27
|
-
<sonic-button onclick="SonicToast.add({ text: 'Operation succeeded', status: 'success' })">
|
|
28
|
-
Success
|
|
29
|
-
</sonic-button>
|
|
30
|
-
<sonic-button onclick="SonicToast.add({ text: 'Something went wrong', status: 'error' })">
|
|
31
|
-
Error
|
|
32
|
-
</sonic-button>
|
|
33
|
-
<sonic-button onclick="SonicToast.add({ text: 'Check this detail', status: 'warning' })">
|
|
34
|
-
Warning
|
|
35
|
-
</sonic-button>
|
|
36
|
-
<sonic-button onclick="SonicToast.add({ text: 'Helpful context', status: 'info' })">
|
|
37
|
-
Info
|
|
38
|
-
</sonic-button>
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
|
41
|
-
</sonic-code>
|
|
42
|
-
|
|
43
|
-
## Label
|
|
44
|
-
|
|
45
|
-
Set **`label`** for a bold title above **`text`**. **`title`** still works but is deprecated—use **`label`** in new code.
|
|
46
|
-
|
|
47
|
-
<sonic-code>
|
|
48
|
-
<template>
|
|
49
|
-
<div class="flex flex-wrap gap-2">
|
|
50
|
-
<sonic-button
|
|
51
|
-
onclick="SonicToast.add({ label: 'Success', text: 'Your request was processed.', status: 'success' })"
|
|
52
|
-
>
|
|
53
|
-
Toast with label
|
|
54
|
-
</sonic-button>
|
|
55
|
-
<sonic-button
|
|
56
|
-
onclick="SonicToast.add({ label: 'Error', text: 'Processing failed. Try again.', status: 'error' })"
|
|
57
|
-
>
|
|
58
|
-
Error with label
|
|
59
|
-
</sonic-button>
|
|
60
|
-
</div>
|
|
61
|
-
</template>
|
|
62
|
-
</sonic-code>
|
|
63
|
-
|
|
64
|
-
## HTML in text
|
|
65
|
-
|
|
66
|
-
**`text`** (and **`label`**) can include HTML strings. Links and controls in **`text`** automatically enable **`preserve`** so the toast does not auto-hide while the user interacts.
|
|
67
|
-
|
|
68
|
-
<sonic-code>
|
|
69
|
-
<template>
|
|
70
|
-
<sonic-button
|
|
71
|
-
onclick="SonicToast.add({ text: 'Message with <strong>HTML</strong> and an <a href="#">action link</a>', status: 'info' })"
|
|
72
|
-
>
|
|
73
|
-
Toast with HTML
|
|
74
|
-
</sonic-button>
|
|
75
|
-
</template>
|
|
76
|
-
</sonic-code>
|
|
77
|
-
|
|
78
|
-
## Preserve
|
|
79
|
-
|
|
80
|
-
Without **`preserve`**, toasts auto-hide after about six seconds (timer pauses on hover or focus). Set **`preserve`** to keep the toast until the user closes it.
|
|
81
|
-
|
|
82
|
-
<sonic-code>
|
|
83
|
-
<template>
|
|
84
|
-
<sonic-button
|
|
85
|
-
onclick="SonicToast.add({ text: 'This toast stays until you dismiss it', status: 'info', preserve: true })"
|
|
86
|
-
>
|
|
87
|
-
Persistent toast
|
|
88
|
-
</sonic-button>
|
|
89
|
-
</template>
|
|
90
|
-
</sonic-code>
|
|
91
|
-
|
|
92
|
-
## Dismiss forever
|
|
93
|
-
|
|
94
|
-
With **`dismissForever`** and a stable **`id`**, closing the toast stores dismissal in **`localStorage`**—**`SonicToast.add`** skips it on later visits. Duplicate payloads (same fields, ignoring **`id`**) are not queued twice.
|
|
95
|
-
|
|
96
|
-
<sonic-code>
|
|
97
|
-
<template>
|
|
98
|
-
<sonic-button
|
|
99
|
-
onclick="SonicToast.add({ id: 'unique-toast-id', text: 'Dismiss forever hides this across reloads', status: 'info', dismissForever: true })"
|
|
100
|
-
>
|
|
101
|
-
Dismiss forever
|
|
102
|
-
</sonic-button>
|
|
103
|
-
</template>
|
|
104
|
-
</sonic-code>
|
|
105
|
-
|
|
106
|
-
## Ghost
|
|
107
|
-
|
|
108
|
-
**`ghost`** renders a semi-transparent, non-interactive toast—useful for loading or background states. **`SonicToast.removeAll`** leaves ghost toasts in place.
|
|
109
|
-
|
|
110
|
-
<sonic-code>
|
|
111
|
-
<template>
|
|
112
|
-
<sonic-button
|
|
113
|
-
onclick="SonicToast.add({ text: 'Ghost toast (non-interactive)', status: 'info', ghost: true })"
|
|
114
|
-
>
|
|
115
|
-
Ghost toast
|
|
116
|
-
</sonic-button>
|
|
117
|
-
</template>
|
|
118
|
-
</sonic-code>
|
|
119
|
-
|
|
120
|
-
## Dismissal
|
|
121
|
-
|
|
122
|
-
Use static helpers to clear the stack from app logic (for example after navigation).
|
|
123
|
-
|
|
124
|
-
### Remove all
|
|
125
|
-
|
|
126
|
-
Removes every toast except **`ghost`** items.
|
|
127
|
-
|
|
128
|
-
<sonic-code>
|
|
129
|
-
<template>
|
|
130
|
-
<div class="flex flex-wrap gap-2">
|
|
131
|
-
<sonic-button onclick="SonicToast.add({ text: 'Toast 1', status: 'info' })">Add toast 1</sonic-button>
|
|
132
|
-
<sonic-button onclick="SonicToast.add({ text: 'Toast 2', status: 'success' })">Add toast 2</sonic-button>
|
|
133
|
-
<sonic-button onclick="SonicToast.add({ text: 'Toast 3', status: 'warning' })">Add toast 3</sonic-button>
|
|
134
|
-
<sonic-button onclick="SonicToast.removeAll()">Remove all</sonic-button>
|
|
135
|
-
</div>
|
|
136
|
-
</template>
|
|
137
|
-
</sonic-code>
|
|
138
|
-
|
|
139
|
-
### Remove by status
|
|
140
|
-
|
|
141
|
-
<sonic-code>
|
|
142
|
-
<template>
|
|
143
|
-
<div class="flex flex-wrap gap-2">
|
|
144
|
-
<sonic-button onclick="SonicToast.add({ text: 'Success toast', status: 'success' })">Success</sonic-button>
|
|
145
|
-
<sonic-button onclick="SonicToast.add({ text: 'Error toast', status: 'error' })">Error</sonic-button>
|
|
146
|
-
<sonic-button onclick="SonicToast.add({ text: 'Warning toast', status: 'warning' })">Warning</sonic-button>
|
|
147
|
-
<sonic-button onclick="SonicToast.removeItemsByStatus('success')">Remove success</sonic-button>
|
|
148
|
-
<sonic-button onclick="SonicToast.removeItemsByStatus('error')">Remove error</sonic-button>
|
|
149
|
-
</div>
|
|
150
|
-
</template>
|
|
151
|
-
</sonic-code>
|
|
152
|
-
|
|
153
|
-
### Remove temporary items
|
|
154
|
-
|
|
155
|
-
Removes toasts that are not **`preserve`**.
|
|
156
|
-
|
|
157
|
-
<sonic-code>
|
|
158
|
-
<template>
|
|
159
|
-
<div class="flex flex-wrap gap-2">
|
|
160
|
-
<sonic-button onclick="SonicToast.add({ text: 'Temporary toast', status: 'info' })">Temporary</sonic-button>
|
|
161
|
-
<sonic-button onclick="SonicToast.add({ text: 'Persistent toast', status: 'success', preserve: true })">
|
|
162
|
-
Persistent
|
|
163
|
-
</sonic-button>
|
|
164
|
-
<sonic-button onclick="SonicToast.removeTemporaryItems()">Remove temporary</sonic-button>
|
|
165
|
-
</div>
|
|
166
|
-
</template>
|
|
167
|
-
</sonic-code>
|
|
168
|
-
|
|
169
|
-
## Combined options
|
|
170
|
-
|
|
171
|
-
<sonic-code>
|
|
172
|
-
<template>
|
|
173
|
-
<sonic-button
|
|
174
|
-
onclick="SonicToast.add({
|
|
175
|
-
id: 'welcome-toast',
|
|
176
|
-
label: 'Welcome',
|
|
177
|
-
text: 'Welcome to the platform. Explore the docs to get started.',
|
|
178
|
-
status: 'success',
|
|
179
|
-
dismissForever: true
|
|
180
|
-
})"
|
|
181
|
-
>
|
|
182
|
-
Full example
|
|
183
|
-
</sonic-button>
|
|
184
|
-
</template>
|
|
185
|
-
</sonic-code>
|
|
186
|
-
|
|
187
|
-
## Accessibility
|
|
188
|
-
|
|
189
|
-
Each toast uses **`role="alert"`** for **`error`** and **`role="status"`** otherwise (with **`aria-live="polite"`** when applicable). Status icons are decorative (**`aria-hidden`**). The close control has an i18n **`aria-label`**. When there is no **`label`**, a truncated string **`aria-label`** may be derived from plain **`text`**.
|
|
190
|
-
|
|
191
|
-
## API reference
|
|
192
|
-
|
|
193
|
-
Options passed to **`SonicToast.add(conf)`**:
|
|
194
|
-
|
|
195
|
-
| Option | Values | Description |
|
|
196
|
-
|----------|---------|-------------|
|
|
197
|
-
| `text` | string · Lit template | Main body; HTML strings are supported |
|
|
198
|
-
| `label` | string · Lit template | Optional heading above **`text`** |
|
|
199
|
-
| `title` | string · Lit template | Deprecated alias for **`label`** |
|
|
200
|
-
| `status` | `success` · `error` · `warning` · `info` · `` (empty) | Semantic styling and live region behavior |
|
|
201
|
-
| `id` | string · number | Stable id for deduplication and **`dismissForever`** (defaults to timestamp) |
|
|
202
|
-
| `preserve` | boolean | Skip auto-hide; forced when **`text`** contains interactive markup |
|
|
203
|
-
| `ghost` | boolean | Semi-transparent and non-interactive; kept by **`removeAll`** |
|
|
204
|
-
| `dismissForever` | boolean | Persist dismissal in **`localStorage`** when closed (requires stable **`id`**) |
|
|
205
|
-
| `styleSheet` | modal style input | Extra adopted styles on the toast item shadow root |
|
|
206
|
-
| `useSlot` | boolean | Legacy: project **`text`** into the light DOM slot |
|
|
207
|
-
|
|
208
|
-
| Method | Description |
|
|
209
|
-
|--------|-------------|
|
|
210
|
-
| `SonicToast.add(conf)` | Append a toast; returns the config or **`null`** if skipped (dismissed forever or duplicate) |
|
|
211
|
-
| `SonicToast.removeAll()` | Remove all non-**`ghost`** toasts |
|
|
212
|
-
| `SonicToast.removeItemsByStatus(status)` | Remove toasts matching **`status`** |
|
|
213
|
-
| `SonicToast.removeItemById(id)` | Remove a single toast by **`id`** |
|
|
214
|
-
| `SonicToast.removeTemporaryItems()` | Remove toasts without **`preserve`** |
|
|
215
|
-
|
|
216
|
-
**`sonic-toast`** is mounted automatically; **`sonic-toast-item`** is internal. In iframes, toasts can delegate to the parent window via **`postMessage`**.
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# Tooltip
|
|
2
|
-
|
|
3
|
-
Tooltip shows a short **`label`** on hover (and on focus when the trigger can receive focus). Wrap the trigger in the default slot—buttons, icons, or plain text. Default **`placement`** is **`top`** (center-aligned). An empty **`label`** hides the bubble the same way as **`disabled`**.
|
|
4
|
-
|
|
5
|
-
## Basic example
|
|
6
|
-
|
|
7
|
-
<sonic-code>
|
|
8
|
-
<template>
|
|
9
|
-
<sonic-tooltip label="Additional context on hover">
|
|
10
|
-
<sonic-button variant="outline">Hover me</sonic-button>
|
|
11
|
-
</sonic-tooltip>
|
|
12
|
-
</template>
|
|
13
|
-
</sonic-code>
|
|
14
|
-
|
|
15
|
-
## Placement
|
|
16
|
-
|
|
17
|
-
Use **`top`** · **`bottom`** · **`left`** · **`right`** for the main axis. Add **`-start`** or **`-end`** to align the bubble along the anchor edge.
|
|
18
|
-
|
|
19
|
-
<sonic-code>
|
|
20
|
-
<template>
|
|
21
|
-
<div class="flex flex-wrap gap-2">
|
|
22
|
-
<sonic-tooltip placement="top" label="Top">
|
|
23
|
-
<sonic-button>Top</sonic-button>
|
|
24
|
-
</sonic-tooltip>
|
|
25
|
-
<sonic-tooltip placement="bottom" label="Bottom">
|
|
26
|
-
<sonic-button>Bottom</sonic-button>
|
|
27
|
-
</sonic-tooltip>
|
|
28
|
-
<sonic-tooltip placement="right" label="Right">
|
|
29
|
-
<sonic-button>Right</sonic-button>
|
|
30
|
-
</sonic-tooltip>
|
|
31
|
-
<sonic-tooltip placement="left" label="Left">
|
|
32
|
-
<sonic-button>Left</sonic-button>
|
|
33
|
-
</sonic-tooltip>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
</sonic-code>
|
|
37
|
-
|
|
38
|
-
### Aligned placements
|
|
39
|
-
|
|
40
|
-
<sonic-code>
|
|
41
|
-
<template>
|
|
42
|
-
<div class="flex gap-3 flex-wrap">
|
|
43
|
-
<sonic-tooltip placement="top-start" label="Top start">
|
|
44
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Top start</sonic-button>
|
|
45
|
-
</sonic-tooltip>
|
|
46
|
-
<sonic-tooltip placement="top-end" label="Top end">
|
|
47
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Top end</sonic-button>
|
|
48
|
-
</sonic-tooltip>
|
|
49
|
-
<sonic-tooltip placement="bottom-start" label="Bottom start">
|
|
50
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Bottom start</sonic-button>
|
|
51
|
-
</sonic-tooltip>
|
|
52
|
-
<sonic-tooltip placement="bottom-end" label="Bottom end">
|
|
53
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Bottom end</sonic-button>
|
|
54
|
-
</sonic-tooltip>
|
|
55
|
-
<sonic-tooltip placement="right-start" label="Right start">
|
|
56
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Right start</sonic-button>
|
|
57
|
-
</sonic-tooltip>
|
|
58
|
-
<sonic-tooltip placement="right-end" label="Right end">
|
|
59
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Right end</sonic-button>
|
|
60
|
-
</sonic-tooltip>
|
|
61
|
-
<sonic-tooltip placement="left-start" label="Left start">
|
|
62
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Left start</sonic-button>
|
|
63
|
-
</sonic-tooltip>
|
|
64
|
-
<sonic-tooltip placement="left-end" label="Left end">
|
|
65
|
-
<sonic-button class="size-40 bg-neutral-200 rounded-lg">Left end</sonic-button>
|
|
66
|
-
</sonic-tooltip>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
</sonic-code>
|
|
70
|
-
|
|
71
|
-
## Label formatting
|
|
72
|
-
|
|
73
|
-
**`label`** supports line breaks (`\n` in markup or multiline text). Lines are trimmed; **` `** is normalized to spaces. **`white-space: pre-line`** preserves breaks in the bubble (max width **18rem**).
|
|
74
|
-
|
|
75
|
-
<sonic-code>
|
|
76
|
-
<template>
|
|
77
|
-
<sonic-tooltip label="First line Second line">
|
|
78
|
-
<sonic-button variant="outline">Multiline label</sonic-button>
|
|
79
|
-
</sonic-tooltip>
|
|
80
|
-
</template>
|
|
81
|
-
</sonic-code>
|
|
82
|
-
|
|
83
|
-
## Focusable
|
|
84
|
-
|
|
85
|
-
On non-interactive triggers, set **`focusable`** so the host gets **`tabindex="0"`** and the tooltip opens on keyboard focus as well as hover.
|
|
86
|
-
|
|
87
|
-
<sonic-code>
|
|
88
|
-
<template>
|
|
89
|
-
<sonic-tooltip
|
|
90
|
-
focusable
|
|
91
|
-
label="The Concorde made its first transatlantic crossing on September 26, 1973"
|
|
92
|
-
>
|
|
93
|
-
<sonic-icon library="iconoir" name="chat-bubble-question"></sonic-icon>
|
|
94
|
-
Focus or hover this text
|
|
95
|
-
</sonic-tooltip>
|
|
96
|
-
</template>
|
|
97
|
-
</sonic-code>
|
|
98
|
-
|
|
99
|
-
## Disabled
|
|
100
|
-
|
|
101
|
-
<sonic-code>
|
|
102
|
-
<template>
|
|
103
|
-
<sonic-tooltip disabled label="Not shown">
|
|
104
|
-
<sonic-button>Tooltip disabled</sonic-button>
|
|
105
|
-
</sonic-tooltip>
|
|
106
|
-
</template>
|
|
107
|
-
</sonic-code>
|
|
108
|
-
|
|
109
|
-
## Accessibility
|
|
110
|
-
|
|
111
|
-
The bubble uses **`popover="hint"`** (non-modal, no pointer capture). Prefer **`focusable`** when the slotted content is not already focusable. When the Popover API is unavailable, the host falls back to the native **`title`** attribute with a single-line label. Opacity transitions respect **`prefers-reduced-motion`**.
|
|
112
|
-
|
|
113
|
-
## API reference
|
|
114
|
-
|
|
115
|
-
| Attribute | Values | Description |
|
|
116
|
-
|----------|---------|-------------|
|
|
117
|
-
| `label` | string | Tooltip copy; whitespace-only values suppress the bubble |
|
|
118
|
-
| `placement` | `top` (default) · `bottom` · `left` · `right` · `top-start` · `top-end` · `bottom-start` · `bottom-end` · `left-start` · `left-end` · `right-start` · `right-end` | Position relative to the trigger; repositions while open |
|
|
119
|
-
| `disabled` | boolean | Suppress show/hide; sets **`tabindex="-1"`** on the host |
|
|
120
|
-
| `focusable` | boolean | Add **`tabindex="0"`** on the host for keyboard access |
|
|
121
|
-
|
|
122
|
-
| Slot | Description |
|
|
123
|
-
|------|-------------|
|
|
124
|
-
| *(default)* | Trigger content (hover target) |
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# Data flow
|
|
2
|
-
|
|
3
|
-
Recommended patterns for new Concorde apps (Lit + TypeScript). Under the hood, data lives in a **DataProvider** store (legacy **Publisher** API: [Legacy: Sharing data](#docs/_getting-started/pubsub.md/pubsub)).
|
|
4
|
-
|
|
5
|
-
## Quick map
|
|
6
|
-
|
|
7
|
-
| Need | Use |
|
|
8
|
-
|------|-----|
|
|
9
|
-
| Read/write in code | `get` / `set` / `dp` + `DataProviderKey` (static paths only) |
|
|
10
|
-
| Reactive Lit template | `sub(key)` or `@subscribe` |
|
|
11
|
-
| Read component state from store | `@subscribe` + `DataProviderKey<T, U>` + `@state` |
|
|
12
|
-
| Inherit ancestor attributes | `@ancestorAttribute` |
|
|
13
|
-
| Write from component state | `@publish` |
|
|
14
|
-
| React to assignments | `@handle` |
|
|
15
|
-
| HTTP GET | `@get` + `Endpoint`, or `sonic-list` / `sonic-queue` with `fetch` |
|
|
16
|
-
| HTTP POST (body from store) | `@post` + `Endpoint` + body `DataProviderKey` |
|
|
17
|
-
| HTTP PUT / PATCH (body from store) | `@put` / `@patch` — same model as `@post` |
|
|
18
|
-
| Forms | `formDataProvider` + `name` on fields (no Subscriber on form elements) |
|
|
19
|
-
| Derived / aggregate (JSONata) | `derive()` or `sonic-jsonata` — [Jsonata](#core/components/functional/jsonata/jsonata.md/jsonata) |
|
|
20
|
-
| Offline doc demos | `serviceURL="/docs-mock-api"` — [Local API demos](#docs/_misc/docs-mock-api.md/docs-mock-api) |
|
|
21
|
-
|
|
22
|
-
Skill: `concorde-get-set-dp` in the package `ai/` folder.
|
|
23
|
-
|
|
24
|
-
## DataProviderKey
|
|
25
|
-
|
|
26
|
-
<sonic-code language="typescript">
|
|
27
|
-
<template>
|
|
28
|
-
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
29
|
-
import { dp, get, set } from "@supersoniks/concorde/utils";
|
|
30
|
-
|
|
31
|
-
const cartKey = new DataProviderKey<{ items: string[] }>("cart");
|
|
32
|
-
|
|
33
|
-
set(cartKey, { items: [] });
|
|
34
|
-
dp(cartKey.items).set(["a", "b"]);
|
|
35
|
-
get(cartKey);
|
|
36
|
-
</template>
|
|
37
|
-
</sonic-code>
|
|
38
|
-
|
|
39
|
-
Dynamic paths (`users.${userId}`) → decorators or `sub()` — not `get("users.${id}")` in imperative code. Resolution rules: [Dynamic path placeholders](#docs/_misc/dynamic-path.md/dynamic-path).
|
|
40
|
-
|
|
41
|
-
[DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey)
|
|
42
|
-
|
|
43
|
-
## Decorators
|
|
44
|
-
|
|
45
|
-
| Decorator | Role |
|
|
46
|
-
|-----------|------|
|
|
47
|
-
| `@subscribe` | Read-only property from store — [data configuration](#docs/_getting-started/my-first-component.md/my-first-component) (type + key + scope) |
|
|
48
|
-
| `@publish` | Push property writes to store |
|
|
49
|
-
| `@handle` | Method called on assignment |
|
|
50
|
-
| `@ancestorAttribute` | Copy ancestor HTML attribute onto property |
|
|
51
|
-
| `@get` | HTTP GET into `ApiResult<T>` |
|
|
52
|
-
| `@post` | HTTP POST into `ApiResult<T>` (body from a publisher) |
|
|
53
|
-
| `@put` / `@patch` | HTTP PUT / PATCH into `ApiResult<T>` |
|
|
54
|
-
|
|
55
|
-
Walkthrough: [My first component](#docs/_getting-started/my-first-component.md/my-first-component)
|
|
56
|
-
|
|
57
|
-
## HTTP and lists
|
|
58
|
-
|
|
59
|
-
- [@get](#docs/_decorators/get.md/get) — single GET on a component
|
|
60
|
-
- [@post](#docs/_decorators/post.md/post) — POST with body read from a `DataProviderKey`
|
|
61
|
-
- [@put](#docs/_decorators/put.md/put) · [@patch](#docs/_decorators/patch.md/patch) — PUT / PATCH (same options as `@post`)
|
|
62
|
-
- [List](#core/components/functional/list/list.md/list) — `fetch` + `key="data"` + `/docs-mock-api/api/users`
|
|
63
|
-
- [Queue](#core/components/functional/queue/queue.md/queue) — lazy `offset=$offset&per_page=$limit` + optional `dataFilterProvider` (form → query)
|
|
64
|
-
|
|
65
|
-
## Starter kit
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npx @supersoniks/create-concorde-ts-starter my-app
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Interactive routes mirror these patterns (`/concepts/*`, `/demo/*`).
|
|
72
|
-
|
|
73
|
-
## Derived data (`derive` / `sonic-jsonata`)
|
|
74
|
-
|
|
75
|
-
Use when you need **client-side aggregations** (groupby, top N, chart shapes) from existing DataProviders — without inline app JS in SDUI.
|
|
76
|
-
|
|
77
|
-
- Primitive: `derive({ inputs, compute, output, variables? })` from `@supersoniks/concorde/utils` (read-only output, debounce, generation, cycle detection, `{output}/_state_`).
|
|
78
|
-
- SDUI adapter: [`sonic-jsonata`](#core/components/functional/jsonata/jsonata.md/jsonata) (`inputProvider` → `expression` → `outputProvider`, optional `formDataProvider`).
|
|
79
|
-
- vs [`sonic-mix`](#core/components/functional/mix/mix.md/mix): mix composes bidirectionally; jsonata **computes** unidirectionally.
|
|
80
|
-
|
|
81
|
-
## Legacy integration
|
|
82
|
-
|
|
83
|
-
| Topic | Page |
|
|
84
|
-
|-------|------|
|
|
85
|
-
| `Subscriber` / `Fetcher` mixins on app code | [Legacy: Subscriber mixin](#docs/_core-concept/subscriber.md/subscriber), [Legacy: My first subscriber](#docs/_getting-started/my-first-subscriber.md/my-first-subscriber) |
|
|
86
|
-
| `data-bind` HTML (plain HTML hosts) | [HTML integration](#docs/_misc/html-integration.md/html-integration) — doc demos use Lit in `src/docs/example/` |
|
|
87
|
-
| `@onAssign` | [@onAssign](#docs/_decorators/on-assign.md/on-assign) (prefer `@handle`) |
|
|
88
|
-
| `sonic-fetch` alone | [Fetch](#core/components/functional/fetch/fetch.md/fetch) |
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# lit + tailwind + vite
|
|
2
|
-
|
|
3
|
-
**Some notes for an overview of Concorde's functioning**
|
|
4
|
-
|
|
5
|
-
## Standard Web components
|
|
6
|
-
A web component is simply a **custom HTML element** created using web standards:
|
|
7
|
-
|
|
8
|
-
**web component** = [Custom Elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) + [shadowDom](https://developer.mozilla.org/fr/docs/Web/Web_Components/Using_shadow_DOM) + [HTML templates](https://developer.mozilla.org/fr/docs/Web/HTML/Element/template)
|
|
9
|
-
|
|
10
|
-
## Lit Library
|
|
11
|
-
|
|
12
|
-
Concorde components are written using the lightweight Lit library: https://lit.dev/.
|
|
13
|
-
|
|
14
|
-
A good portion of the elements documented on the Lit website are standard JavaScript concepts (e.g., [mixins](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#mix-ins), [tagged template literals](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Template_literals#gabarits_%C3%A9tiquet%C3%A9s)).
|
|
15
|
-
|
|
16
|
-
The **library simplifies the writing of web components** by automating certain tasks:
|
|
17
|
-
|
|
18
|
-
- Creation of an **open mode shadow DOM** (the component is accessible from the outside via its shadow root property).
|
|
19
|
-
- [Rendering function](https://lit.dev/docs/components/rendering/) based on [tagged template literals](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Template_literals#gabarits_%C3%A9tiquet%C3%A9s)
|
|
20
|
-
- [Reactive properties](https://lit.dev/docs/components/properties/) that trigger rendering when modified.
|
|
21
|
-
|
|
22
|
-
Our use of Lit rarely goes beyond this [hello world](https://lit.dev/playground/#sample=examples/hello-world)
|
|
23
|
-
|
|
24
|
-
## Typescript Language
|
|
25
|
-
|
|
26
|
-
We write the components in [TypeScript](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html), which is then compiled into JS.
|
|
27
|
-
|
|
28
|
-
Static and inferred typing provides stronger validation of the program's functioning during compilation.
|
|
29
|
-
However, we often use the "any" type due to time constraints.
|
|
30
|
-
|
|
31
|
-
Lit uses TypeScript to simplify development through metadata:
|
|
32
|
-
- Simplified declaration of `custom elements` via @customElement
|
|
33
|
-
- Generation of `reactive properties` via @property.
|
|
34
|
-
|
|
35
|
-
☢️**Warning**:
|
|
36
|
-
- During development, we operate in interpreted mode, which is faster but allows errors that won't pass during the build.
|
|
37
|
-
- It is important to **build a distribution before pushing the code** to ensure everything is fine.
|
|
38
|
-
|
|
39
|
-
## Compatibility with Classic JS Libraries
|
|
40
|
-
|
|
41
|
-
Compatibility issues may arise when using JS libraries, particularly regarding DOM traversal.
|
|
42
|
-
This is because these libraries are blocked from traversing the DOM due to the presence of the shadow DOM.
|
|
43
|
-
Here are some examples of things that may cause problems:
|
|
44
|
-
|
|
45
|
-
- Latest FontAwesome in SVG mode, icons are not replaced
|
|
46
|
-
- Libraries associated with jQuery
|
|
47
|
-
- document.getElementById
|
|
48
|
-
- ...
|
|
49
|
-
|
|
50
|
-
## Topics to Explore for Further Learning
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[🧱 Creating components](#docs/_getting-started/create-a-component.md/create-a-component)
|
|
54
|
-
|
|
55
|
-
[🎨 Adding styles](#docs/_getting-started/theming.md/theming)
|
|
56
|
-
|
|
57
|
-
[🥨 Sharing data](#docs/_getting-started/pubsub.md/pubsub)
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Legacy: Subscriber mixin
|
|
2
|
-
|
|
3
|
-
> **New app components:** [My first component](#docs/_getting-started/my-first-component.md/my-first-component) and [Data flow](#docs/_core-concept/dataFlow.md/dataFlow) — extend `LitElement` with decorators (`@subscribe`, `@ancestorAttribute`, …). This mixin remains in **core** components (`sonic-list`, `sonic-fetch`, …) and [legacy tutorials](#docs/_getting-started/my-first-subscriber.md/my-first-subscriber).
|
|
4
|
-
|
|
5
|
-
The Subscriber mixin was commonly extended by Concorde core components and older destination components. Pure UI components usually don't extend it, especially those outside of form components.
|
|
6
|
-
|
|
7
|
-
## DataProvider Attribute: Automatic Filling of Subscriber Properties
|
|
8
|
-
|
|
9
|
-
Upon being added to the DOM (connectedCallback), subscribers search for the first occurrence of the `dataProvider` attribute in their parent's HTML structure.
|
|
10
|
-
|
|
11
|
-
The value of this attribute is the DataProvider path (see [Data flow](#docs/_core-concept/dataFlow.md/dataFlow) and [DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey); legacy API: [Sharing Data](#docs/_getting-started/pubsub.md/pubsub)).
|
|
12
|
-
|
|
13
|
-
The subscriber then subscribes to the publisher as a data template to be filled.
|
|
14
|
-
|
|
15
|
-
The reactive properties of the component reflect in real-time the properties with the same name in the publisher.
|
|
16
|
-
|
|
17
|
-
This functionality is commonly used in the generic components [fetch](#core/components/functional/fetch/fetch.md/fetch), [queue](#core/components/functional/queue/queue.md/queue), and [list](#core/components/functional/list/list.md/list).
|
|
18
|
-
|
|
19
|
-
If the subscriber is inside another subscriber, it can subscribe to a data of its parent using the attribute `subDataProvider = 'address.of.my.data'` instead of the parent's data. This allows for dynamic behavior.
|
|
20
|
-
|
|
21
|
-
## Automated Translation
|
|
22
|
-
|
|
23
|
-
In a similar manner, searching for ancestor attributes can be used to configure automatic translation for any property starting with "wording" and ending with a label identifier recognized by the wordingProvider API.
|
|
24
|
-
|
|
25
|
-
Normally, this API is globally configured and not within the component. Therefore, remember to prefix translatable label identifiers present in the ticketing system, for example, with "wording".
|
|
26
|
-
|
|
27
|
-
## Reactive Property `props`
|
|
28
|
-
|
|
29
|
-
The value of this property can be provided as a JSON object or any other value. This value is then assigned to the associated publisher via the `dataProvider` attribute. As a result, the reactive properties of all subscribers associated with the same `dataProvider` are filled as mentioned above.
|
|
30
|
-
|
|
31
|
-
## Disabling Automatic Filling of Reactive Properties
|
|
32
|
-
|
|
33
|
-
It is possible to disable the automatic filling of reactive properties in a particular component. To do so, set the variable `noAutoFill = true` in the component's class. However, the reactive property `props` will still be updated.
|
|
34
|
-
|
|
35
|
-
For example, `sonic-subscriber` and `sonic-fetch` have this attribute because they do not have reactive properties.
|
|
36
|
-
|
|
37
|
-
**☢ CAUTION:** When creating an object of type Subscriber or Fetcher, make sure to use the mixins and not directly extend the concrete fetch component (`sonic-fetch`) and subscriber component (`sonic-subscriber`). This is because the `noAutofill = true` attribute is set in those components.
|
|
38
|
-
|
|
39
|
-
**TIPS:**
|
|
40
|
-
If you disable automatic filling, you will likely make the rendering dynamic by writing expressions like `this.props.my.subproperty`. If `props` is updated, the rendering will be triggered. However, if `this.props.my.subproperty` is directly modified, the rendering will not be triggered. To achieve more reactivity, you can enable rendering when any subproperty is modified. Simply set the variable `renderOnPropsInternalChange = true` in the class that implements the corresponding mixin.
|
|
41
|
-
|
|
42
|
-
## Data Binding
|
|
43
|
-
|
|
44
|
-
Suppose that:
|
|
45
|
-
|
|
46
|
-
- You have a subscriber subscribed to a publisher via its `dataProvider` attribute.
|
|
47
|
-
- The published data has the following structure:
|
|
48
|
-
|
|
49
|
-
<sonic-code language="javascript">
|
|
50
|
-
<template>
|
|
51
|
-
{"img": { "avatar": "my-avatar.jpg", "caption": "look at my smile" }, "email": "an.email@example.com" }
|
|
52
|
-
</template>
|
|
53
|
-
</sonic-code>
|
|
54
|
-
- We want to keep the display of an image and its `title` attribute up to date, as well as a "contact" button to email the person in the photo. The content of the subscriber could be as follows:
|
|
55
|
-
|
|
56
|
-
In a **Lit** app, use the same data with [data configuration](#docs/_getting-started/my-first-component.md/my-first-component) (`@subscribe` + `DataProviderKey`) on a small row component — see `docs-user` in `src/docs/example/users.ts`.
|
|
57
|
-
|
|
58
|
-
For **HTML-only** embedding (no Lit), attribute binding is described in [HTML integration](#docs/_misc/html-integration.md/html-integration) and in the Legacy [Subscriber mixin](#docs/_core-concept/subscriber.md/subscriber) pages.
|
|
59
|
-
|
|
60
|
-
This pattern also illustrates:
|
|
61
|
-
|
|
62
|
-
- Binding to subproperties using dot syntax, as done for the `src` attribute of the `img` tag.
|
|
63
|
-
- Using a simple expression to include the property within a string, as in creating a `mailto` link.
|
|
64
|
-
- Using formatting functions, as in the `title` attribute of the `img` tag. You can find (and add) formatting functions in the `core/utils/Format.ts` file.
|
|
65
|
-
- Writing for properties that are in camel case. Convert everything to lowercase and add hyphens. Note that `innerHTML` (or `outerHTML`) is a special case where no hyphens are added between each letter.
|
|
66
|
-
|
|
67
|
-
**Note:** Data binding implies that updating the `img.src` data via the publisher will change the photo without any additional calls.
|
|
68
|
-
|
|
69
|
-
**Special Variables:**
|
|
70
|
-
- `_self_` targets the root of the data. This is useful, for example, when the data is a pure string.
|
|
71
|
-
- `_parent_` targets the parent publisher of the current publisher, if any. For example, the subscribers of lists have the complete data of the list as their parent.
|
|
72
|
-
- `_metadata_` is only used in the case of *sonic-list* at the moment. In a simple list, `_metadata_` see the (list)[] component for further details
|
|
73
|
-
|
|
74
|
-
**Disabling this functionality:**
|
|
75
|
-
You can disable data binding if it is not needed by calling `DataBinding.disable()`.
|