@0001-labs/design-system-1 0.3.0-alpha.13 → 0.3.0-alpha.15
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/DS1/0-face/calendar.ts +194 -0
- package/DS1/0-face/carousel.ts +623 -0
- package/DS1/0-face/component-visibility.ts +14 -0
- package/DS1/0-face/copy-text.ts +96 -0
- package/DS1/0-face/device.ts +8 -58
- package/DS1/0-face/dialog-swipe.ts +249 -0
- package/DS1/0-face/dialogs.ts +208 -0
- package/DS1/0-face/drawer.ts +258 -0
- package/DS1/0-face/feedback-words.ts +36 -0
- package/DS1/0-face/feedback.ts +40 -0
- package/DS1/0-face/format.ts +700 -0
- package/DS1/0-face/generated/toast-assets.ts +18 -0
- package/DS1/0-face/grid-fit.ts +1 -1
- package/DS1/0-face/grid.ts +3 -2
- package/DS1/0-face/header.ts +78 -0
- package/DS1/0-face/i18n.ts +93 -18
- package/DS1/0-face/keys.ts +276 -0
- package/DS1/0-face/languages.ts +4 -4
- package/DS1/0-face/layout-inspector.ts +6 -6
- package/DS1/0-face/library-styles.ts +33 -0
- package/DS1/0-face/load-toaster.ts +7 -0
- package/DS1/0-face/preference-options.ts +29 -0
- package/DS1/0-face/preferences.ts +3 -11
- package/DS1/0-face/pricing.ts +98 -43
- package/DS1/0-face/scaling.ts +160 -4
- package/DS1/0-face/shared-words.ts +9 -4
- package/DS1/0-face/sidebar.ts +201 -0
- package/DS1/0-face/theme-bootstrap.js +184 -0
- package/DS1/0-face/theme.ts +89 -47
- package/DS1/0-face/toast-queue.ts +157 -0
- package/DS1/0-face/toaster.ts +384 -0
- package/DS1/0-face/tooltips.ts +157 -15
- package/DS1/0-face/translations/da.json +60 -1
- package/DS1/0-face/translations/de.json +60 -1
- package/DS1/0-face/translations/en.json +60 -1
- package/DS1/0-face/translations/es.json +60 -1
- package/DS1/0-face/translations/fi.json +60 -1
- package/DS1/0-face/translations/fr.json +60 -1
- package/DS1/0-face/translations/is.json +60 -1
- package/DS1/0-face/translations/it.json +60 -1
- package/DS1/0-face/translations/ja.json +60 -1
- package/DS1/0-face/translations/ko.json +60 -1
- package/DS1/0-face/translations/nb.json +60 -1
- package/DS1/0-face/translations/pt-BR.json +60 -1
- package/DS1/0-face/translations/pt.json +60 -1
- package/DS1/0-face/translations/sv.json +60 -1
- package/DS1/0-face/translations/zh.json +60 -1
- package/DS1/0-face/translations-format.ts +3 -4
- package/DS1/1-root/card.css +192 -0
- package/DS1/1-root/carousel.css +136 -0
- package/DS1/1-root/cjk.css +23 -0
- package/DS1/1-root/component-metrics.css +1 -0
- package/DS1/1-root/component-tokens.css +51 -8
- package/DS1/1-root/controls.css +891 -14
- package/DS1/1-root/dialog-placement.css +191 -0
- package/DS1/1-root/document.css +183 -0
- package/DS1/1-root/drawer.css +83 -0
- package/DS1/1-root/empty.css +83 -0
- package/DS1/1-root/figures.css +141 -0
- package/DS1/1-root/fonts/Iosevka-LICENSE.md +3 -1
- package/DS1/1-root/fonts/Iosevka-Regular.woff2 +0 -0
- package/DS1/1-root/fonts.css +69 -0
- package/DS1/1-root/footer.css +186 -0
- package/DS1/1-root/header.css +165 -0
- package/DS1/1-root/library-tokens.ts +91 -0
- package/DS1/1-root/measures.ts +53 -0
- package/DS1/1-root/notice.css +165 -0
- package/DS1/1-root/one.css +14 -84
- package/DS1/1-root/one.semantic.css +200 -148
- package/DS1/1-root/palette.css +58 -0
- package/DS1/1-root/palette.ts +19 -0
- package/DS1/1-root/progress.css +356 -0
- package/DS1/1-root/prose.css +202 -0
- package/DS1/1-root/row.css +300 -0
- package/DS1/1-root/table.css +111 -0
- package/DS1/1-root/text.css +70 -0
- package/DS1/2-core/button-split.ts +55 -0
- package/DS1/2-core/chart/chart.css +169 -0
- package/DS1/2-core/chart/grid-chart.ts +554 -0
- package/DS1/2-core/ds-avatar.ts +25 -6
- package/DS1/2-core/ds-badge.ts +10 -10
- package/DS1/2-core/ds-button.ts +111 -26
- package/DS1/2-core/ds-card.ts +135 -105
- package/DS1/2-core/ds-chart.ts +327 -0
- package/DS1/2-core/ds-composer.ts +8 -2
- package/DS1/2-core/ds-cycle.ts +97 -21
- package/DS1/2-core/ds-empty.ts +120 -0
- package/DS1/2-core/ds-icon.ts +11 -2
- package/DS1/2-core/ds-input.ts +165 -6
- package/DS1/2-core/ds-message.ts +218 -0
- package/DS1/2-core/ds-notice.ts +10 -0
- package/DS1/2-core/ds-progress.ts +380 -0
- package/DS1/2-core/ds-stat.ts +174 -0
- package/DS1/2-core/ds-switch.ts +1 -0
- package/DS1/2-core/ds-text.ts +15 -2
- package/DS1/2-core/ds-toast.ts +354 -0
- package/DS1/2-core/figures.ts +105 -0
- package/DS1/2-core/generated/ds-icon-map.ts +238 -128
- package/DS1/2-core/generated/icon-avatar.ts +2 -0
- package/DS1/2-core/generated/icons-extra.ts +120 -65
- package/DS1/2-core/generated/icons-immediate.ts +1 -1
- package/DS1/2-core/styles/ds-avatar.css +9 -8
- package/DS1/2-core/styles/ds-button-host.css +26 -3
- package/DS1/2-core/styles/ds-button-split.css +67 -0
- package/DS1/2-core/styles/ds-button.css +49 -15
- package/DS1/2-core/styles/ds-card.css +34 -0
- package/DS1/2-core/styles/ds-composer.css +13 -0
- package/DS1/2-core/styles/ds-cycle.css +10 -0
- package/DS1/2-core/styles/ds-empty.css +18 -0
- package/DS1/2-core/styles/ds-gap.css +1 -0
- package/DS1/2-core/styles/ds-icon.css +1 -0
- package/DS1/2-core/styles/ds-input.css +59 -6
- package/DS1/2-core/styles/ds-notice.css +32 -0
- package/DS1/2-core/styles/ds-progress.css +25 -0
- package/DS1/2-core/styles/ds-select.css +2 -2
- package/DS1/2-core/styles/ds-split.css +2 -62
- package/DS1/2-core/styles/ds-stat.css +34 -0
- package/DS1/2-core/styles/ds-switch.css +16 -1
- package/DS1/2-core/styles/ds-text.css +43 -12
- package/DS1/2-core/styles/ds-toast.css +182 -0
- package/DS1/2-core/styles/ds-tooltip.css +1 -0
- package/DS1/3-unit/calendar-base.ts +263 -0
- package/DS1/3-unit/ds-accordion.ts +9 -1
- package/DS1/3-unit/ds-avatar-group.ts +1 -0
- package/DS1/3-unit/ds-calendar-large.ts +349 -0
- package/DS1/3-unit/ds-calendar.ts +344 -0
- package/DS1/3-unit/ds-carousel.ts +368 -0
- package/DS1/3-unit/ds-date-picker.ts +540 -0
- package/DS1/3-unit/ds-form.ts +45 -37
- package/DS1/3-unit/ds-list.ts +48 -1
- package/DS1/3-unit/ds-matrix.ts +318 -0
- package/DS1/3-unit/ds-menu.ts +8 -4
- package/DS1/3-unit/ds-row.ts +84 -1
- package/DS1/3-unit/ds-sidebar.ts +366 -0
- package/DS1/3-unit/ds-table.ts +75 -34
- package/DS1/3-unit/styles/ds-accordion.css +1 -0
- package/DS1/3-unit/styles/ds-avatar-group.css +2 -4
- package/DS1/3-unit/styles/ds-calendar-large.css +165 -0
- package/DS1/3-unit/styles/ds-calendar.css +238 -0
- package/DS1/3-unit/styles/ds-carousel.css +30 -0
- package/DS1/3-unit/styles/ds-date-picker.css +124 -0
- package/DS1/3-unit/styles/ds-list.css +1 -0
- package/DS1/3-unit/styles/ds-matrix.css +203 -0
- package/DS1/3-unit/styles/ds-menu.css +31 -6
- package/DS1/3-unit/styles/ds-row.css +84 -2
- package/DS1/3-unit/styles/ds-sidebar.css +134 -0
- package/DS1/3-unit/styles/ds-table.css +3 -74
- package/DS1/4-page/ds-dialog.ts +40 -4
- package/DS1/4-page/ds-document.ts +240 -0
- package/DS1/4-page/ds-footer.ts +165 -0
- package/DS1/4-page/ds-grid.ts +39 -59
- package/DS1/4-page/ds-header.ts +171 -0
- package/DS1/4-page/ds-page.ts +184 -0
- package/DS1/4-page/email.ts +2 -3
- package/DS1/4-page/styles/ds-container.css +1 -0
- package/DS1/4-page/styles/ds-document.css +18 -0
- package/DS1/4-page/styles/ds-footer.css +29 -0
- package/DS1/4-page/styles/ds-grid.css +31 -85
- package/DS1/4-page/styles/ds-header.css +57 -0
- package/DS1/4-page/styles/ds-page.css +214 -0
- package/DS1/components.ts +7 -1
- package/DS1/index.ts +24 -6
- package/DS1/react/avatar.ts +4 -5
- package/DS1/react/button-split.ts +29 -0
- package/DS1/react/button.ts +32 -13
- package/DS1/react/carousel.ts +76 -0
- package/DS1/react/dialog.ts +36 -5
- package/DS1/react/document.ts +14 -0
- package/DS1/react/empty.ts +32 -0
- package/DS1/react/footer.ts +17 -0
- package/DS1/react/header.ts +15 -0
- package/DS1/react/input.ts +28 -17
- package/DS1/react/message.ts +73 -0
- package/DS1/react/notice.ts +59 -0
- package/DS1/react/page.ts +13 -0
- package/DS1/react/progress.ts +99 -0
- package/DS1/react/sidebar.ts +71 -0
- package/DS1/react/stat.ts +73 -0
- package/DS1/react/toast.ts +82 -0
- package/DS1/x-icon/Tabler-LICENSE.md +27 -0
- package/DS1/x-icon/airtable.svg +5 -0
- package/DS1/x-icon/attach.svg +3 -0
- package/DS1/x-icon/audio.svg +3 -0
- package/DS1/x-icon/bag-alt.svg +3 -0
- package/DS1/x-icon/bank.svg +3 -0
- package/DS1/x-icon/banknote.svg +3 -0
- package/DS1/x-icon/bolt.svg +3 -0
- package/DS1/x-icon/book-alt.svg +3 -0
- package/DS1/x-icon/book.svg +4 -0
- package/DS1/x-icon/box.svg +3 -0
- package/DS1/x-icon/briefcase.svg +3 -0
- package/DS1/x-icon/building.svg +4 -0
- package/DS1/x-icon/car.svg +3 -0
- package/DS1/x-icon/card.svg +3 -0
- package/DS1/x-icon/cart.svg +3 -0
- package/DS1/x-icon/{ezo-android-screen-stats.svg → chevron-down.svg} +1 -1
- package/DS1/x-icon/{ezo-item-button-start.svg → chevron-left.svg} +1 -1
- package/DS1/x-icon/{ezo-android-screen-lists.svg → chevron-right.svg} +1 -1
- package/DS1/x-icon/{ezo-item-button-reopen.svg → chevron-up.svg} +1 -1
- package/DS1/x-icon/cloud.svg +3 -0
- package/DS1/x-icon/coffee.svg +3 -0
- package/DS1/x-icon/coins.svg +3 -0
- package/DS1/x-icon/cursor.svg +3 -0
- package/DS1/x-icon/curve.svg +7 -0
- package/DS1/x-icon/dislike.svg +4 -0
- package/DS1/x-icon/dot-bank.svg +3 -0
- package/DS1/x-icon/dot-banknote.svg +3 -0
- package/DS1/x-icon/dot-banknotes.svg +3 -0
- package/DS1/x-icon/dot-card.svg +3 -0
- package/DS1/x-icon/dot-coin.svg +3 -0
- package/DS1/x-icon/dot-coins.svg +3 -0
- package/DS1/x-icon/dot-receipt.svg +3 -0
- package/DS1/x-icon/dot-safe.svg +3 -0
- package/DS1/x-icon/dot-transfer.svg +3 -0
- package/DS1/x-icon/dot-wallet.svg +3 -0
- package/DS1/x-icon/download.svg +4 -0
- package/DS1/x-icon/drive.svg +5 -0
- package/DS1/x-icon/drop.svg +3 -0
- package/DS1/x-icon/dropbox.svg +3 -0
- package/DS1/x-icon/dumbbell.svg +3 -0
- package/DS1/x-icon/eye-off.svg +3 -0
- package/DS1/x-icon/eye.svg +3 -0
- package/DS1/x-icon/facebook.svg +3 -0
- package/DS1/x-icon/figma.svg +5 -0
- package/DS1/x-icon/flame.svg +3 -0
- package/DS1/x-icon/flip.svg +5 -0
- package/DS1/x-icon/food.svg +3 -0
- package/DS1/x-icon/fuel.svg +3 -0
- package/DS1/x-icon/game.svg +3 -0
- package/DS1/x-icon/gift.svg +3 -0
- package/DS1/x-icon/github.svg +3 -0
- package/DS1/x-icon/heart.svg +3 -0
- package/DS1/x-icon/history.svg +3 -0
- package/DS1/x-icon/home-alt.svg +3 -0
- package/DS1/x-icon/income.svg +3 -0
- package/DS1/x-icon/info.svg +5 -0
- package/DS1/x-icon/instagram.svg +5 -0
- package/DS1/x-icon/jpbank.svg +3 -0
- package/DS1/x-icon/key.svg +4 -0
- package/DS1/x-icon/keyboard.svg +3 -0
- package/DS1/x-icon/like.svg +4 -0
- package/DS1/x-icon/linkedin.svg +7 -0
- package/DS1/x-icon/loom.svg +6 -0
- package/DS1/x-icon/map.svg +4 -0
- package/DS1/x-icon/medical.svg +3 -0
- package/DS1/x-icon/minus.svg +3 -0
- package/DS1/x-icon/moon.svg +3 -0
- package/DS1/x-icon/move.svg +3 -0
- package/DS1/x-icon/music-alt.svg +3 -0
- package/DS1/x-icon/music.svg +5 -0
- package/DS1/x-icon/notion.svg +6 -0
- package/DS1/x-icon/offline.svg +3 -0
- package/DS1/x-icon/pause.svg +4 -0
- package/DS1/x-icon/paw.svg +3 -0
- package/DS1/x-icon/pdf.svg +3 -0
- package/DS1/x-icon/people.svg +5 -0
- package/DS1/x-icon/percent.svg +3 -0
- package/DS1/x-icon/phone.svg +3 -0
- package/DS1/x-icon/pill.svg +3 -0
- package/DS1/x-icon/plane.svg +3 -0
- package/DS1/x-icon/postal.svg +3 -0
- package/DS1/x-icon/present.svg +4 -0
- package/DS1/x-icon/reaction.svg +5 -0
- package/DS1/x-icon/receipt.svg +3 -0
- package/DS1/x-icon/refresh.svg +3 -0
- package/DS1/x-icon/refund.svg +3 -0
- package/DS1/x-icon/repeat.svg +3 -0
- package/DS1/x-icon/rotate.svg +4 -0
- package/DS1/x-icon/safe.svg +3 -0
- package/DS1/x-icon/school-alt.svg +3 -0
- package/DS1/x-icon/shield-alt.svg +3 -0
- package/DS1/x-icon/shield.svg +4 -0
- package/DS1/x-icon/shirt.svg +3 -0
- package/DS1/x-icon/shop.svg +3 -0
- package/DS1/x-icon/sign-in.svg +3 -0
- package/DS1/x-icon/sign-out.svg +3 -0
- package/DS1/x-icon/slack.svg +6 -0
- package/DS1/x-icon/sparkle.svg +3 -0
- package/DS1/x-icon/start.svg +4 -0
- package/DS1/x-icon/stop.svg +3 -0
- package/DS1/x-icon/sun.svg +3 -0
- package/DS1/x-icon/system.svg +4 -0
- package/DS1/x-icon/tag.svg +3 -0
- package/DS1/x-icon/ticket.svg +3 -0
- package/DS1/x-icon/title-struck.svg +4 -0
- package/DS1/x-icon/train.svg +3 -0
- package/DS1/x-icon/transfer.svg +3 -0
- package/DS1/x-icon/tv.svg +3 -0
- package/DS1/x-icon/upload.svg +4 -0
- package/DS1/x-icon/video.svg +4 -0
- package/DS1/x-icon/vimeo.svg +3 -0
- package/DS1/x-icon/wallet.svg +3 -0
- package/DS1/x-icon/wifi.svg +3 -0
- package/DS1/x-icon/window.svg +4 -0
- package/DS1/x-icon/wrench.svg +3 -0
- package/DS1/x-icon/x-brand.svg +4 -0
- package/DS1/x-icon/youtube.svg +4 -0
- package/README.md +3 -3
- package/dist/0-face/calendar.d.ts +75 -0
- package/dist/0-face/calendar.d.ts.map +1 -0
- package/dist/0-face/calendar.js +149 -0
- package/dist/0-face/carousel.d.ts +174 -0
- package/dist/0-face/carousel.d.ts.map +1 -0
- package/dist/0-face/carousel.js +583 -0
- package/dist/0-face/component-visibility.d.ts +7 -0
- package/dist/0-face/component-visibility.d.ts.map +1 -0
- package/dist/0-face/component-visibility.js +11 -0
- package/dist/0-face/copy-text.d.ts +11 -0
- package/dist/0-face/copy-text.d.ts.map +1 -0
- package/dist/0-face/copy-text.js +97 -0
- package/dist/0-face/device.d.ts +3 -7
- package/dist/0-face/device.d.ts.map +1 -1
- package/dist/0-face/device.js +7 -41
- package/dist/0-face/dialog-swipe.d.ts +49 -0
- package/dist/0-face/dialog-swipe.d.ts.map +1 -0
- package/dist/0-face/dialog-swipe.js +239 -0
- package/dist/0-face/dialogs.d.ts +33 -0
- package/dist/0-face/dialogs.d.ts.map +1 -0
- package/dist/0-face/dialogs.js +173 -0
- package/dist/0-face/drawer.d.ts +64 -0
- package/dist/0-face/drawer.d.ts.map +1 -0
- package/dist/0-face/drawer.js +256 -0
- package/dist/0-face/feedback-words.d.ts +21 -0
- package/dist/0-face/feedback-words.d.ts.map +1 -0
- package/dist/0-face/feedback-words.js +30 -0
- package/dist/0-face/feedback.d.ts +41 -0
- package/dist/0-face/feedback.d.ts.map +1 -0
- package/dist/0-face/feedback.js +35 -0
- package/dist/0-face/format.d.ts +166 -0
- package/dist/0-face/format.d.ts.map +1 -0
- package/dist/0-face/format.js +445 -0
- package/dist/0-face/generated/toast-assets.d.ts +11 -0
- package/dist/0-face/generated/toast-assets.d.ts.map +1 -0
- package/dist/0-face/generated/toast-assets.js +14 -0
- package/dist/0-face/grid-fit.js +1 -1
- package/dist/0-face/grid.d.ts.map +1 -1
- package/dist/0-face/grid.js +2 -1
- package/dist/0-face/header.d.ts +38 -0
- package/dist/0-face/header.d.ts.map +1 -0
- package/dist/0-face/header.js +80 -0
- package/dist/0-face/i18n.d.ts +32 -2
- package/dist/0-face/i18n.d.ts.map +1 -1
- package/dist/0-face/i18n.js +65 -19
- package/dist/0-face/keys.d.ts +104 -0
- package/dist/0-face/keys.d.ts.map +1 -0
- package/dist/0-face/keys.js +253 -0
- package/dist/0-face/languages.d.ts +2 -2
- package/dist/0-face/languages.js +3 -3
- package/dist/0-face/layout-inspector.js +6 -6
- package/dist/0-face/library-styles.d.ts +7 -0
- package/dist/0-face/library-styles.d.ts.map +1 -0
- package/dist/0-face/library-styles.js +29 -0
- package/dist/0-face/load-toaster.d.ts +8 -0
- package/dist/0-face/load-toaster.d.ts.map +1 -0
- package/dist/0-face/load-toaster.js +7 -0
- package/dist/0-face/preference-options.d.ts +34 -0
- package/dist/0-face/preference-options.d.ts.map +1 -0
- package/dist/0-face/preference-options.js +1 -0
- package/dist/0-face/preferences.d.ts +3 -12
- package/dist/0-face/preferences.d.ts.map +1 -1
- package/dist/0-face/pricing.d.ts +19 -9
- package/dist/0-face/pricing.d.ts.map +1 -1
- package/dist/0-face/pricing.js +81 -40
- package/dist/0-face/scaling.d.ts +71 -1
- package/dist/0-face/scaling.d.ts.map +1 -1
- package/dist/0-face/scaling.js +108 -3
- package/dist/0-face/shared-words.d.ts +9 -4
- package/dist/0-face/shared-words.d.ts.map +1 -1
- package/dist/0-face/sidebar.d.ts +69 -0
- package/dist/0-face/sidebar.d.ts.map +1 -0
- package/dist/0-face/sidebar.js +191 -0
- package/dist/0-face/theme-bootstrap.d.ts +1 -0
- package/dist/0-face/theme-bootstrap.d.ts.map +1 -0
- package/dist/0-face/theme-bootstrap.js +214 -0
- package/dist/0-face/theme.d.ts +32 -0
- package/dist/0-face/theme.d.ts.map +1 -1
- package/dist/0-face/theme.js +69 -43
- package/dist/0-face/toast-queue.d.ts +110 -0
- package/dist/0-face/toast-queue.d.ts.map +1 -0
- package/dist/0-face/toast-queue.js +98 -0
- package/dist/0-face/toaster.d.ts +27 -0
- package/dist/0-face/toaster.d.ts.map +1 -0
- package/dist/0-face/toaster.js +373 -0
- package/dist/0-face/tooltips.d.ts +24 -1
- package/dist/0-face/tooltips.d.ts.map +1 -1
- package/dist/0-face/tooltips.js +155 -16
- package/dist/0-face/translations/da.json +60 -1
- package/dist/0-face/translations/de.json +60 -1
- package/dist/0-face/translations/en.json +60 -1
- package/dist/0-face/translations/es.json +60 -1
- package/dist/0-face/translations/fi.json +60 -1
- package/dist/0-face/translations/fr.json +60 -1
- package/dist/0-face/translations/is.json +60 -1
- package/dist/0-face/translations/it.json +60 -1
- package/dist/0-face/translations/ja.json +60 -1
- package/dist/0-face/translations/ko.json +60 -1
- package/dist/0-face/translations/nb.json +60 -1
- package/dist/0-face/translations/pt-BR.json +60 -1
- package/dist/0-face/translations/pt.json +60 -1
- package/dist/0-face/translations/sv.json +60 -1
- package/dist/0-face/translations/zh.json +60 -1
- package/dist/0-face/translations-format.d.ts.map +1 -1
- package/dist/0-face/translations-format.js +3 -4
- package/dist/1-root/library-tokens.d.ts +31 -0
- package/dist/1-root/library-tokens.d.ts.map +1 -0
- package/dist/1-root/library-tokens.js +84 -0
- package/dist/1-root/measures.d.ts +52 -0
- package/dist/1-root/measures.d.ts.map +1 -0
- package/dist/1-root/measures.js +49 -0
- package/dist/1-root/palette.d.ts +5 -0
- package/dist/1-root/palette.d.ts.map +1 -1
- package/dist/1-root/palette.js +18 -0
- package/dist/2-core/button-split.d.ts +21 -0
- package/dist/2-core/button-split.d.ts.map +1 -0
- package/dist/2-core/button-split.js +48 -0
- package/dist/2-core/chart/grid-chart.d.ts +113 -0
- package/dist/2-core/chart/grid-chart.d.ts.map +1 -0
- package/dist/2-core/chart/grid-chart.js +466 -0
- package/dist/2-core/ds-avatar.d.ts +20 -3
- package/dist/2-core/ds-avatar.d.ts.map +1 -1
- package/dist/2-core/ds-avatar.js +19 -5
- package/dist/2-core/ds-badge.js +10 -13
- package/dist/2-core/ds-button.d.ts +76 -0
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +101 -26
- package/dist/2-core/ds-card.d.ts +76 -11
- package/dist/2-core/ds-card.d.ts.map +1 -1
- package/dist/2-core/ds-card.js +129 -105
- package/dist/2-core/ds-chart.d.ts +105 -0
- package/dist/2-core/ds-chart.d.ts.map +1 -0
- package/dist/2-core/ds-chart.js +390 -0
- package/dist/2-core/ds-composer.d.ts +7 -0
- package/dist/2-core/ds-composer.d.ts.map +1 -1
- package/dist/2-core/ds-composer.js +1 -1
- package/dist/2-core/ds-cycle.d.ts +36 -2
- package/dist/2-core/ds-cycle.d.ts.map +1 -1
- package/dist/2-core/ds-cycle.js +95 -18
- package/dist/2-core/ds-empty.d.ts +74 -0
- package/dist/2-core/ds-empty.d.ts.map +1 -0
- package/dist/2-core/ds-empty.js +96 -0
- package/dist/2-core/ds-icon.d.ts +6 -0
- package/dist/2-core/ds-icon.d.ts.map +1 -1
- package/dist/2-core/ds-icon.js +12 -2
- package/dist/2-core/ds-input.d.ts +39 -1
- package/dist/2-core/ds-input.d.ts.map +1 -1
- package/dist/2-core/ds-input.js +150 -6
- package/dist/2-core/ds-message.d.ts +154 -0
- package/dist/2-core/ds-message.d.ts.map +1 -0
- package/dist/2-core/ds-message.js +177 -0
- package/dist/2-core/ds-notice.d.ts +13 -0
- package/dist/2-core/ds-notice.d.ts.map +1 -0
- package/dist/2-core/ds-notice.js +11 -0
- package/dist/2-core/ds-progress.d.ts +200 -0
- package/dist/2-core/ds-progress.d.ts.map +1 -0
- package/dist/2-core/ds-progress.js +319 -0
- package/dist/2-core/ds-stat.d.ts +126 -0
- package/dist/2-core/ds-stat.d.ts.map +1 -0
- package/dist/2-core/ds-stat.js +137 -0
- package/dist/2-core/ds-switch.d.ts +1 -0
- package/dist/2-core/ds-switch.d.ts.map +1 -1
- package/dist/2-core/ds-switch.js +1 -0
- package/dist/2-core/ds-text.d.ts +15 -2
- package/dist/2-core/ds-text.d.ts.map +1 -1
- package/dist/2-core/ds-text.js +13 -0
- package/dist/2-core/ds-toast.d.ts +139 -0
- package/dist/2-core/ds-toast.d.ts.map +1 -0
- package/dist/2-core/ds-toast.js +329 -0
- package/dist/2-core/figures.d.ts +56 -0
- package/dist/2-core/figures.d.ts.map +1 -0
- package/dist/2-core/figures.js +70 -0
- package/dist/2-core/generated/ds-icon-map.d.ts +120 -65
- package/dist/2-core/generated/ds-icon-map.d.ts.map +1 -1
- package/dist/2-core/generated/ds-icon-map.js +238 -128
- package/dist/2-core/generated/icon-avatar.d.ts +2 -0
- package/dist/2-core/generated/icon-avatar.d.ts.map +1 -0
- package/dist/2-core/generated/icon-avatar.js +2 -0
- package/dist/2-core/generated/icons-extra.d.ts.map +1 -1
- package/dist/2-core/generated/icons-extra.js +120 -65
- package/dist/2-core/generated/icons-immediate.d.ts +1 -1
- package/dist/2-core/generated/icons-immediate.d.ts.map +1 -1
- package/dist/2-core/generated/icons-immediate.js +1 -1
- package/dist/3-unit/calendar-base.d.ts +149 -0
- package/dist/3-unit/calendar-base.d.ts.map +1 -0
- package/dist/3-unit/calendar-base.js +172 -0
- package/dist/3-unit/ds-accordion.d.ts +9 -0
- package/dist/3-unit/ds-accordion.d.ts.map +1 -1
- package/dist/3-unit/ds-accordion.js +7 -1
- package/dist/3-unit/ds-avatar-group.d.ts +1 -0
- package/dist/3-unit/ds-avatar-group.d.ts.map +1 -1
- package/dist/3-unit/ds-calendar-large.d.ts +138 -0
- package/dist/3-unit/ds-calendar-large.d.ts.map +1 -0
- package/dist/3-unit/ds-calendar-large.js +305 -0
- package/dist/3-unit/ds-calendar.d.ts +175 -0
- package/dist/3-unit/ds-calendar.d.ts.map +1 -0
- package/dist/3-unit/ds-calendar.js +303 -0
- package/dist/3-unit/ds-carousel.d.ts +182 -0
- package/dist/3-unit/ds-carousel.d.ts.map +1 -0
- package/dist/3-unit/ds-carousel.js +327 -0
- package/dist/3-unit/ds-date-picker.d.ts +203 -0
- package/dist/3-unit/ds-date-picker.d.ts.map +1 -0
- package/dist/3-unit/ds-date-picker.js +499 -0
- package/dist/3-unit/ds-form.d.ts.map +1 -1
- package/dist/3-unit/ds-form.js +38 -28
- package/dist/3-unit/ds-list.d.ts +12 -0
- package/dist/3-unit/ds-list.d.ts.map +1 -1
- package/dist/3-unit/ds-list.js +52 -1
- package/dist/3-unit/ds-matrix.d.ts +146 -0
- package/dist/3-unit/ds-matrix.d.ts.map +1 -0
- package/dist/3-unit/ds-matrix.js +248 -0
- package/dist/3-unit/ds-menu.d.ts +1 -1
- package/dist/3-unit/ds-menu.d.ts.map +1 -1
- package/dist/3-unit/ds-menu.js +7 -4
- package/dist/3-unit/ds-row.d.ts +66 -0
- package/dist/3-unit/ds-row.d.ts.map +1 -1
- package/dist/3-unit/ds-row.js +80 -1
- package/dist/3-unit/ds-sidebar.d.ts +149 -0
- package/dist/3-unit/ds-sidebar.d.ts.map +1 -0
- package/dist/3-unit/ds-sidebar.js +342 -0
- package/dist/3-unit/ds-table.d.ts +28 -10
- package/dist/3-unit/ds-table.d.ts.map +1 -1
- package/dist/3-unit/ds-table.js +53 -25
- package/dist/4-page/ds-dialog.d.ts +16 -1
- package/dist/4-page/ds-dialog.d.ts.map +1 -1
- package/dist/4-page/ds-dialog.js +39 -3
- package/dist/4-page/ds-document.d.ts +98 -0
- package/dist/4-page/ds-document.d.ts.map +1 -0
- package/dist/4-page/ds-document.js +213 -0
- package/dist/4-page/ds-footer.d.ts +100 -0
- package/dist/4-page/ds-footer.d.ts.map +1 -0
- package/dist/4-page/ds-footer.js +119 -0
- package/dist/4-page/ds-grid.d.ts +32 -12
- package/dist/4-page/ds-grid.d.ts.map +1 -1
- package/dist/4-page/ds-grid.js +30 -39
- package/dist/4-page/ds-header.d.ts +84 -0
- package/dist/4-page/ds-header.d.ts.map +1 -0
- package/dist/4-page/ds-header.js +143 -0
- package/dist/4-page/ds-page.d.ts +110 -0
- package/dist/4-page/ds-page.d.ts.map +1 -0
- package/dist/4-page/ds-page.js +155 -0
- package/dist/4-page/email.d.ts +2 -3
- package/dist/4-page/email.d.ts.map +1 -1
- package/dist/4-page/email.js +2 -3
- package/dist/components.d.ts +4 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -1
- package/dist/design-system-1.bundle.js +12322 -5523
- package/dist/design-system-1.bundle.js.map +1 -1
- package/dist/design-system-1.bundle.min.js +8771 -4115
- package/dist/design-system-1.bundle.min.js.map +1 -1
- package/dist/design-system-1.css +1 -1
- package/dist/feedback.js +541 -0
- package/dist/feedback.js.map +1 -0
- package/dist/{icons-extra-BoAACA4X.js → icons-extra-CiDDs7_-.js} +404 -312
- package/dist/icons-extra-CiDDs7_-.js.map +1 -0
- package/dist/{icons-extra-DlxTo_Y4.js → icons-extra-hauwCx07.js} +121 -66
- package/dist/icons-extra-hauwCx07.js.map +1 -0
- package/dist/index.d.ts +21 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -6
- package/dist/react/avatar.d.ts +5 -9
- package/dist/react/avatar.d.ts.map +1 -1
- package/dist/react/avatar.js +2 -2
- package/dist/react/button-split.d.ts +19 -0
- package/dist/react/button-split.d.ts.map +1 -0
- package/dist/react/{split.js → button-split.js} +12 -9
- package/dist/react/button.d.ts +18 -7
- package/dist/react/button.d.ts.map +1 -1
- package/dist/react/button.js +13 -4
- package/dist/react/carousel.d.ts +63 -0
- package/dist/react/carousel.d.ts.map +1 -0
- package/dist/react/carousel.js +47 -0
- package/dist/react/choice.d.ts +1 -1
- package/dist/react/context-menu.d.ts +337 -337
- package/dist/react/dialog.d.ts +684 -678
- package/dist/react/dialog.d.ts.map +1 -1
- package/dist/react/dialog.js +29 -3
- package/dist/react/document.d.ts +11 -0
- package/dist/react/document.d.ts.map +1 -0
- package/dist/react/document.js +10 -0
- package/dist/react/empty.d.ts +34 -0
- package/dist/react/empty.d.ts.map +1 -0
- package/dist/react/empty.js +8 -0
- package/dist/react/file-picker.d.ts +1 -1
- package/dist/react/footer.d.ts +13 -0
- package/dist/react/footer.d.ts.map +1 -0
- package/dist/react/footer.js +12 -0
- package/dist/react/header.d.ts +12 -0
- package/dist/react/header.d.ts.map +1 -0
- package/dist/react/header.js +11 -0
- package/dist/react/input.d.ts +31 -9
- package/dist/react/input.d.ts.map +1 -1
- package/dist/react/input.js +94 -94
- package/dist/react/message.d.ts +66 -0
- package/dist/react/message.d.ts.map +1 -0
- package/dist/react/message.js +37 -0
- package/dist/react/notice.d.ts +45 -0
- package/dist/react/notice.d.ts.map +1 -0
- package/dist/react/notice.js +34 -0
- package/dist/react/page.d.ts +10 -0
- package/dist/react/page.d.ts.map +1 -0
- package/dist/react/page.js +9 -0
- package/dist/react/progress.d.ts +107 -0
- package/dist/react/progress.d.ts.map +1 -0
- package/dist/react/progress.js +47 -0
- package/dist/react/sidebar.d.ts +54 -0
- package/dist/react/sidebar.d.ts.map +1 -0
- package/dist/react/sidebar.js +48 -0
- package/dist/react/stat.d.ts +78 -0
- package/dist/react/stat.d.ts.map +1 -0
- package/dist/react/stat.js +25 -0
- package/dist/react/toast.d.ts +37 -0
- package/dist/react/toast.d.ts.map +1 -0
- package/dist/react/toast.js +55 -0
- package/dist/shared-words-CyZYc_De.js +1818 -0
- package/dist/shared-words-CyZYc_De.js.map +1 -0
- package/dist/shared-words-DAVSET4Z.js +1800 -0
- package/dist/shared-words-DAVSET4Z.js.map +1 -0
- package/package.json +19 -6
- package/DS1/2-core/ds-banner.ts +0 -122
- package/DS1/2-core/ds-date.ts +0 -24
- package/DS1/2-core/ds-language.ts +0 -94
- package/DS1/2-core/ds-pagedots.ts +0 -52
- package/DS1/2-core/ds-split.ts +0 -122
- package/DS1/2-core/ds-textarea.ts +0 -136
- package/DS1/2-core/styles/ds-banner.css +0 -77
- package/DS1/2-core/styles/ds-date.css +0 -9
- package/DS1/2-core/styles/ds-language.css +0 -78
- package/DS1/2-core/styles/ds-pagedots.css +0 -31
- package/DS1/2-core/styles/ds-textarea.css +0 -27
- package/DS1/4-page/ds-layout.ts +0 -949
- package/DS1/4-page/styles/ds-layout.css +0 -246
- package/DS1/react/split.ts +0 -42
- package/DS1/x-icon/ezo-accordion-chevron.svg +0 -11
- package/DS1/x-icon/ezo-account-close.svg +0 -1
- package/DS1/x-icon/ezo-android-screen-archive.svg +0 -4
- package/DS1/x-icon/ezo-android-screen-calendar.svg +0 -6
- package/DS1/x-icon/ezo-android-screen-camera.svg +0 -5
- package/DS1/x-icon/ezo-android-screen-check.svg +0 -3
- package/DS1/x-icon/ezo-android-screen-compose.svg +0 -4
- package/DS1/x-icon/ezo-android-screen-globe.svg +0 -1
- package/DS1/x-icon/ezo-android-screen-shared.svg +0 -5
- package/DS1/x-icon/ezo-android-screen-store.svg +0 -4
- package/DS1/x-icon/ezo-android-screen-views.svg +0 -4
- package/DS1/x-icon/ezo-android-screen-work.svg +0 -3
- package/DS1/x-icon/ezo-arrow-cursor.svg +0 -8
- package/DS1/x-icon/ezo-block-accordion.svg +0 -1
- package/DS1/x-icon/ezo-block-divider.svg +0 -1
- package/DS1/x-icon/ezo-block-group.svg +0 -1
- package/DS1/x-icon/ezo-block-image.svg +0 -1
- package/DS1/x-icon/ezo-block-section.svg +0 -1
- package/DS1/x-icon/ezo-block-table.svg +0 -1
- package/DS1/x-icon/ezo-code.svg +0 -14
- package/DS1/x-icon/ezo-down.svg +0 -3
- package/DS1/x-icon/ezo-figma-premium-star.svg +0 -5
- package/DS1/x-icon/ezo-item-button-complete.svg +0 -4
- package/DS1/x-icon/ezo-item-button-header.svg +0 -3
- package/DS1/x-icon/ezo-item-button-open.svg +0 -3
- package/DS1/x-icon/ezo-item-button-star.svg +0 -3
- package/DS1/x-icon/ezo-item-button-unheader.svg +0 -7
- package/DS1/x-icon/ezo-item-button-unstar.svg +0 -5
- package/DS1/x-icon/ezo-item-star.svg +0 -5
- package/DS1/x-icon/ezo-left.svg +0 -3
- package/DS1/x-icon/ezo-logo.svg +0 -1
- package/DS1/x-icon/ezo-mic.svg +0 -8
- package/DS1/x-icon/ezo-move-column.svg +0 -14
- package/DS1/x-icon/ezo-move-row.svg +0 -18
- package/DS1/x-icon/ezo-navigation-check.svg +0 -1
- package/DS1/x-icon/ezo-note-back.svg +0 -5
- package/DS1/x-icon/ezo-note-menu-complete.svg +0 -11
- package/DS1/x-icon/ezo-note-menu-delete.svg +0 -4
- package/DS1/x-icon/ezo-note-menu-duplicate.svg +0 -8
- package/DS1/x-icon/ezo-note-menu-note.svg +0 -5
- package/DS1/x-icon/ezo-note-menu-page.svg +0 -3
- package/DS1/x-icon/ezo-note-menu-star.svg +0 -5
- package/DS1/x-icon/ezo-note-menu-start.svg +0 -6
- package/DS1/x-icon/ezo-note-menu-stop.svg +0 -6
- package/DS1/x-icon/ezo-note-more.svg +0 -7
- package/DS1/x-icon/ezo-note-star.svg +0 -5
- package/DS1/x-icon/ezo-pattern-call-to-action.svg +0 -1
- package/DS1/x-icon/ezo-play.svg +0 -5
- package/DS1/x-icon/ezo-premium-star.svg +0 -5
- package/DS1/x-icon/ezo-setting-1xdots.svg +0 -13
- package/DS1/x-icon/ezo-setting-1xgrid.svg +0 -10
- package/DS1/x-icon/ezo-setting-1xlines.svg +0 -7
- package/DS1/x-icon/ezo-setting-2xdots.svg +0 -8
- package/DS1/x-icon/ezo-setting-2xgrid.svg +0 -8
- package/DS1/x-icon/ezo-setting-2xlines.svg +0 -6
- package/DS1/x-icon/ezo-setting-blank.svg +0 -5
- package/DS1/x-icon/ezo-store-chevron.svg +0 -1
- package/DS1/x-icon/ezo-upgrade-close.svg +0 -5
- package/DS1/x-icon/product-sources.json +0 -2557
- package/dist/2-core/ds-banner.d.ts +0 -68
- package/dist/2-core/ds-banner.d.ts.map +0 -1
- package/dist/2-core/ds-banner.js +0 -98
- package/dist/2-core/ds-date.d.ts +0 -16
- package/dist/2-core/ds-date.d.ts.map +0 -1
- package/dist/2-core/ds-date.js +0 -15
- package/dist/2-core/ds-language.d.ts +0 -75
- package/dist/2-core/ds-language.d.ts.map +0 -1
- package/dist/2-core/ds-language.js +0 -74
- package/dist/2-core/ds-pagedots.d.ts +0 -32
- package/dist/2-core/ds-pagedots.d.ts.map +0 -1
- package/dist/2-core/ds-pagedots.js +0 -36
- package/dist/2-core/ds-split.d.ts +0 -75
- package/dist/2-core/ds-split.d.ts.map +0 -1
- package/dist/2-core/ds-split.js +0 -101
- package/dist/2-core/ds-textarea.d.ts +0 -46
- package/dist/2-core/ds-textarea.d.ts.map +0 -1
- package/dist/2-core/ds-textarea.js +0 -121
- package/dist/4-page/ds-layout.d.ts +0 -31
- package/dist/4-page/ds-layout.d.ts.map +0 -1
- package/dist/4-page/ds-layout.js +0 -930
- package/dist/icons-extra-BoAACA4X.js.map +0 -1
- package/dist/icons-extra-DlxTo_Y4.js.map +0 -1
- package/dist/react/split.d.ts +0 -15
- package/dist/react/split.d.ts.map +0 -1
- package/dist/shared-words-Cg6Phtx0.js +0 -915
- package/dist/shared-words-Cg6Phtx0.js.map +0 -1
- package/dist/shared-words-Ddz0yUEF.js +0 -933
- package/dist/shared-words-Ddz0yUEF.js.map +0 -1
- /package/DS1/x-icon/{ezo-password-visibility-see.svg → password-see.svg} +0 -0
- /package/DS1/x-icon/{ezo-password-visibility-unsee.svg → password-unsee.svg} +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design system 1's theme, on before the first paint.
|
|
3
|
+
*
|
|
4
|
+
* A classic script for the <head>: inline it before the stylesheets, or load it
|
|
5
|
+
* there with a plain <script src> (not a module), which holds rendering until
|
|
6
|
+
* it has run. It needs nothing else and waits for nothing.
|
|
7
|
+
*
|
|
8
|
+
* It reads the stored choice, light, dark or system, and puts the theme on
|
|
9
|
+
* the root element at once (with nothing stored, `themeDefault`: system
|
|
10
|
+
* unless the product says light or dark):
|
|
11
|
+
* - the class `light-theme` or `dark-theme`, the canonical mark the
|
|
12
|
+
* stylesheets key on;
|
|
13
|
+
* - `data-theme="light"` or `"dark"`, the same, for pages that key on it;
|
|
14
|
+
* - `color-scheme`, so light-dark() tokens and the browser's controls follow;
|
|
15
|
+
* - `--lightningcss-light` and `--lightningcss-dark`, so CSS compiled with
|
|
16
|
+
* Lightning CSS's light-dark() fallback follows the choice, not the system;
|
|
17
|
+
* - the canvas behind the page and the theme-color meta, in the paper.
|
|
18
|
+
* It also sets `lang` from the language module's stored choice, or from the
|
|
19
|
+
* address when the product takes the language from there.
|
|
20
|
+
*
|
|
21
|
+
* Then it keeps the page right: in system mode it follows
|
|
22
|
+
* prefers-color-scheme as it changes, and it applies the choice again when
|
|
23
|
+
* another tab stores one and when a page returns from the back-forward cache.
|
|
24
|
+
* A change after the first paint crosses over in a view transition of the
|
|
25
|
+
* root, unless the reader asks for reduced motion.
|
|
26
|
+
*
|
|
27
|
+
* `window.DS_ONE_THEME` is the runtime: `mode()`, `theme()`, `set(mode)` and
|
|
28
|
+
* `apply()`; a change dispatches `theme-changed` on window with
|
|
29
|
+
* `{ theme, mode }`. `0-face/theme.ts` runs this same file, so the components
|
|
30
|
+
* and a page without them share one implementation, whichever loads first.
|
|
31
|
+
*
|
|
32
|
+
* Set options before it on `window.DS_ONE_PREFERENCES`: `themeStorageKey`
|
|
33
|
+
* (`"ds-one:theme"` by default), `themeDefault` (`"light"`, `"dark"` or
|
|
34
|
+
* `"system"`, the default) for a visitor who has chosen nothing yet,
|
|
35
|
+
* `themeMode: "system"` to follow the system and never read or write a stored
|
|
36
|
+
* choice, and `themePaper` as `{ light, dark }` colours for the canvas, or
|
|
37
|
+
* `false` to leave the background and theme-color to the page. The language
|
|
38
|
+
* follows `window.DS_ONE_I18N`: `storageKey` (`"language"`), `persist: false`,
|
|
39
|
+
* `languages`, `routing` with `languageFromAddress: true` (a prefix such as
|
|
40
|
+
* `/ja/…` wins over the stored choice), and `langTarget` (set, the root's
|
|
41
|
+
* `lang` is left alone).
|
|
42
|
+
*/
|
|
43
|
+
(function () {
|
|
44
|
+
if (typeof window === "undefined" || typeof document === "undefined" || window.DS_ONE_THEME)
|
|
45
|
+
return;
|
|
46
|
+
var root = document.documentElement;
|
|
47
|
+
var MODES = ["light", "dark", "system"];
|
|
48
|
+
// Design system 1's languages (0-face/languages.ts), the prefixes an address may carry by default.
|
|
49
|
+
var LANGUAGES = ["da", "de", "en", "es", "fi", "fr", "is", "it", "ja", "ko", "nb", "nn", "no", "pt", "pt-BR", "sv", "zh"];
|
|
50
|
+
var PAPER = { light: "#ffffff", dark: "#2a2a2a" };
|
|
51
|
+
// A choice that cannot be stored, or one made while the page follows the system, lasts for this page.
|
|
52
|
+
var session = null;
|
|
53
|
+
var shown = null;
|
|
54
|
+
var shownMode = null;
|
|
55
|
+
var crossing = null;
|
|
56
|
+
function options() { return window.DS_ONE_PREFERENCES || {}; }
|
|
57
|
+
function key() { return options().themeStorageKey || "ds-one:theme"; }
|
|
58
|
+
function query(media) {
|
|
59
|
+
try {
|
|
60
|
+
return window.matchMedia ? window.matchMedia(media) : null;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function mode() {
|
|
67
|
+
if (session)
|
|
68
|
+
return session;
|
|
69
|
+
if (options().themeMode === "system")
|
|
70
|
+
return "system";
|
|
71
|
+
try {
|
|
72
|
+
var stored = window.localStorage.getItem(key());
|
|
73
|
+
if (MODES.indexOf(stored) >= 0)
|
|
74
|
+
return stored;
|
|
75
|
+
}
|
|
76
|
+
catch { /* Storage can be blocked. */ }
|
|
77
|
+
var first = options().themeDefault;
|
|
78
|
+
return MODES.indexOf(first) >= 0 ? first : "system";
|
|
79
|
+
}
|
|
80
|
+
function resolve(choice) {
|
|
81
|
+
if (choice !== "system")
|
|
82
|
+
return choice;
|
|
83
|
+
var system = query("(prefers-color-scheme: dark)");
|
|
84
|
+
return system && system.matches ? "dark" : "light";
|
|
85
|
+
}
|
|
86
|
+
function paint(theme) {
|
|
87
|
+
root.classList.remove(theme === "dark" ? "light-theme" : "dark-theme");
|
|
88
|
+
root.classList.add(theme + "-theme");
|
|
89
|
+
root.setAttribute("data-theme", theme);
|
|
90
|
+
root.style.colorScheme = theme;
|
|
91
|
+
root.style.setProperty("--lightningcss-light", theme === "light" ? "initial" : " ");
|
|
92
|
+
root.style.setProperty("--lightningcss-dark", theme === "dark" ? "initial" : " ");
|
|
93
|
+
var paper = options().themePaper;
|
|
94
|
+
if (paper === false)
|
|
95
|
+
return;
|
|
96
|
+
var colour = (paper && paper[theme]) || PAPER[theme];
|
|
97
|
+
root.style.backgroundColor = colour;
|
|
98
|
+
var meta = document.querySelector('meta[name="theme-color"]:not([media])');
|
|
99
|
+
if (!meta && document.head) {
|
|
100
|
+
meta = document.createElement("meta");
|
|
101
|
+
meta.setAttribute("name", "theme-color");
|
|
102
|
+
document.head.appendChild(meta);
|
|
103
|
+
}
|
|
104
|
+
if (meta)
|
|
105
|
+
meta.setAttribute("content", colour);
|
|
106
|
+
}
|
|
107
|
+
// The two themes are two pictures of one page: cross from one to the other.
|
|
108
|
+
function cross(theme) {
|
|
109
|
+
var reduced = query("(prefers-reduced-motion: reduce)");
|
|
110
|
+
if (typeof document.startViewTransition !== "function" || (reduced && reduced.matches) || document.visibilityState === "hidden") {
|
|
111
|
+
paint(theme);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (crossing)
|
|
115
|
+
crossing.skipTransition();
|
|
116
|
+
var painted = false;
|
|
117
|
+
var once = function () { if (!painted) {
|
|
118
|
+
painted = true;
|
|
119
|
+
paint(theme);
|
|
120
|
+
} };
|
|
121
|
+
try {
|
|
122
|
+
var transition = document.startViewTransition(once);
|
|
123
|
+
crossing = transition;
|
|
124
|
+
// A skipped crossing rejects all three promises; none may swallow the change.
|
|
125
|
+
void transition.ready.catch(function () { });
|
|
126
|
+
void transition.updateCallbackDone.catch(once);
|
|
127
|
+
void transition.finished.catch(function () { }).then(function () { if (crossing === transition)
|
|
128
|
+
crossing = null; });
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
once();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function apply() {
|
|
135
|
+
var choice = mode();
|
|
136
|
+
var theme = resolve(choice);
|
|
137
|
+
var first = shown === null;
|
|
138
|
+
var moved = theme !== shown || choice !== shownMode;
|
|
139
|
+
if (!first && theme !== shown)
|
|
140
|
+
cross(theme);
|
|
141
|
+
else
|
|
142
|
+
paint(theme);
|
|
143
|
+
shown = theme;
|
|
144
|
+
shownMode = choice;
|
|
145
|
+
if (!first && moved)
|
|
146
|
+
window.dispatchEvent(new CustomEvent("theme-changed", { detail: { theme: theme, mode: choice } }));
|
|
147
|
+
}
|
|
148
|
+
function set(choice) {
|
|
149
|
+
if (MODES.indexOf(choice) < 0)
|
|
150
|
+
return;
|
|
151
|
+
session = null;
|
|
152
|
+
if (options().themeMode === "system") {
|
|
153
|
+
if (choice !== "system")
|
|
154
|
+
session = choice;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
try {
|
|
158
|
+
window.localStorage.setItem(key(), choice);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
session = choice;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
apply();
|
|
165
|
+
}
|
|
166
|
+
var i18n = window.DS_ONE_I18N || {};
|
|
167
|
+
// The language an address names in its first segment (`/pt-br/…` gives pt-BR), as the language module reads it.
|
|
168
|
+
function addressLanguage() {
|
|
169
|
+
if (!i18n.languageFromAddress)
|
|
170
|
+
return null;
|
|
171
|
+
var routing = i18n.routing || {};
|
|
172
|
+
var prefixed = (routing.languages && routing.languages.length ? routing.languages : null) || (i18n.languages && i18n.languages.length ? i18n.languages : null) || LANGUAGES;
|
|
173
|
+
var segment = String((window.location && window.location.pathname) || "").split("/")[1] || "";
|
|
174
|
+
var slug = segment.toLowerCase().replace(/_/g, "-");
|
|
175
|
+
if (!slug)
|
|
176
|
+
return null;
|
|
177
|
+
for (var index = 0; index < prefixed.length; index++) {
|
|
178
|
+
if (String(prefixed[index]).toLowerCase().replace(/_/g, "-") === slug)
|
|
179
|
+
return String(prefixed[index]);
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
function storedLanguage() {
|
|
184
|
+
if (i18n.persist === false)
|
|
185
|
+
return null;
|
|
186
|
+
try {
|
|
187
|
+
var language = window.localStorage.getItem(i18n.storageKey || "language");
|
|
188
|
+
if (language && (!i18n.languages || i18n.languages.indexOf(language) >= 0))
|
|
189
|
+
return language;
|
|
190
|
+
}
|
|
191
|
+
catch { /* Storage can be blocked. */ }
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
if (i18n.langTarget === undefined) {
|
|
195
|
+
var language = addressLanguage() || storedLanguage();
|
|
196
|
+
if (language && /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(language))
|
|
197
|
+
root.lang = language;
|
|
198
|
+
}
|
|
199
|
+
window.DS_ONE_THEME = {
|
|
200
|
+
mode: function () { return shownMode; },
|
|
201
|
+
theme: function () { return shown; },
|
|
202
|
+
set: set,
|
|
203
|
+
apply: function () { apply(); },
|
|
204
|
+
};
|
|
205
|
+
apply();
|
|
206
|
+
var system = query("(prefers-color-scheme: dark)");
|
|
207
|
+
if (system && system.addEventListener)
|
|
208
|
+
system.addEventListener("change", function () { apply(); });
|
|
209
|
+
else if (system && system.addListener)
|
|
210
|
+
system.addListener(function () { apply(); });
|
|
211
|
+
window.addEventListener("storage", function (event) { if (event.key === null || event.key === key())
|
|
212
|
+
apply(); });
|
|
213
|
+
window.addEventListener("pageshow", function () { apply(); });
|
|
214
|
+
})();
|
package/dist/0-face/theme.d.ts
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
+
import "./theme-bootstrap.js";
|
|
2
|
+
/** The theme on the page. */
|
|
1
3
|
export type ThemeType = "light" | "dark";
|
|
4
|
+
/** The stored choice: a theme, or the system's. */
|
|
5
|
+
export type ThemeMode = ThemeType | "system";
|
|
6
|
+
export declare const THEME_MODES: readonly ThemeMode[];
|
|
7
|
+
/** `window.DS_ONE_THEME`, installed by `theme-bootstrap.js`. */
|
|
8
|
+
export interface ThemeRuntime {
|
|
9
|
+
/** The choice in effect: light, dark or system. */
|
|
10
|
+
mode(): ThemeMode;
|
|
11
|
+
/** The theme on the page. */
|
|
12
|
+
theme(): ThemeType;
|
|
13
|
+
/** Choose and remember light, dark or system, and put it on the page. */
|
|
14
|
+
set(mode: ThemeMode): void;
|
|
15
|
+
/** Read the stored choice, the options and the system again, and put them on the page. */
|
|
16
|
+
apply(): void;
|
|
17
|
+
}
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
DS_ONE_THEME?: ThemeRuntime;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
2
23
|
export declare const currentTheme: import("@lit-labs/signals").Signal.State<ThemeType>;
|
|
24
|
+
export declare const currentThemeMode: import("@lit-labs/signals").Signal.State<ThemeMode>;
|
|
25
|
+
export declare function getThemeMode(): ThemeMode;
|
|
26
|
+
/** Choose light, dark or system, store it and put it on the page; `theme-changed` follows a change. */
|
|
27
|
+
export declare function setThemeMode(mode: ThemeMode): void;
|
|
28
|
+
/** Choose light or dark. `setThemeMode("system")` hands the choice back to the system. */
|
|
3
29
|
export declare function setTheme(theme: ThemeType): void;
|
|
30
|
+
/**
|
|
31
|
+
* Bind an automatic surface to system appearance, leaving stored choices
|
|
32
|
+
* intact: nothing is read from or written to storage until the returned
|
|
33
|
+
* function hands the page back to its stored choice.
|
|
34
|
+
*/
|
|
35
|
+
export declare function followSystemTheme(): () => void;
|
|
4
36
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../DS1/0-face/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../DS1/0-face/theme.ts"],"names":[],"mappings":"AAqBA,OAAO,sBAAsB,CAAC;AAG9B,6BAA6B;AAC7B,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AACzC,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC7C,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAAgC,CAAC;AAE7E,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,IAAI,IAAI,SAAS,CAAC;IAClB,6BAA6B;IAC7B,KAAK,IAAI,SAAS,CAAC;IACnB,yEAAyE;IACzE,GAAG,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,0FAA0F;IAC1F,KAAK,IAAI,IAAI,CAAC;CACf;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QAAG,YAAY,CAAC,EAAE,YAAY,CAAC;KAAE;CAClD;AASD,eAAO,MAAM,YAAY,qDAAmD,CAAC;AAC7E,eAAO,MAAM,gBAAgB,qDAAmD,CAAC;AAWjF,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAGlD;AAED,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAc9C"}
|
package/dist/0-face/theme.js
CHANGED
|
@@ -1,48 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light, dark or system, remembered in one stored choice.
|
|
3
|
+
*
|
|
4
|
+
* The runtime is `theme-bootstrap.js`, the classic script a page inlines in
|
|
5
|
+
* its <head> so the first paint is already in the chosen theme. Imported here
|
|
6
|
+
* as well, it installs itself when the page did not inline it, so the
|
|
7
|
+
* components and a page without them share one implementation. This module
|
|
8
|
+
* mirrors it in signals for the components.
|
|
9
|
+
*
|
|
10
|
+
* The theme is marked on the root element by the class `light-theme` or
|
|
11
|
+
* `dark-theme` (canonical), `data-theme="light|dark"` (for pages that key on
|
|
12
|
+
* the attribute) and `color-scheme`. In system mode it follows
|
|
13
|
+
* prefers-color-scheme as it changes. A visitor who has chosen nothing sees
|
|
14
|
+
* `themeDefault` from `window.DS_ONE_PREFERENCES` (system unless the product
|
|
15
|
+
* says light or dark).
|
|
16
|
+
*
|
|
17
|
+
* A page without the components copies it with Sync 1's `root` export,
|
|
18
|
+
* `"modules": ["theme"]` (this file, the head script and the options type);
|
|
19
|
+
* it needs `@lit-labs/signals`.
|
|
20
|
+
*/
|
|
1
21
|
import { signal } from "@lit-labs/signals";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
let storedTheme = null;
|
|
8
|
-
try {
|
|
9
|
-
storedTheme = window.localStorage?.getItem(preferenceStorageKey("theme"));
|
|
10
|
-
}
|
|
11
|
-
catch { /* Storage can be unavailable. */ }
|
|
12
|
-
if (storedTheme === "light" || storedTheme === "dark") {
|
|
13
|
-
return storedTheme;
|
|
14
|
-
}
|
|
15
|
-
// Check system preference
|
|
16
|
-
const prefersDark = window.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
17
|
-
return prefersDark ? "dark" : "light";
|
|
22
|
+
import "./theme-bootstrap.js";
|
|
23
|
+
export const THEME_MODES = ["light", "dark", "system"];
|
|
24
|
+
function runtime() {
|
|
25
|
+
return typeof window === "undefined" ? undefined : window.DS_ONE_THEME;
|
|
18
26
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
// Options set since the head script ran (a product's storage key, system mode) take effect now.
|
|
28
|
+
runtime()?.apply();
|
|
29
|
+
export const currentTheme = signal(runtime()?.theme() ?? "light");
|
|
30
|
+
export const currentThemeMode = signal(runtime()?.mode() ?? "system");
|
|
31
|
+
function sync() {
|
|
32
|
+
const theme = runtime();
|
|
33
|
+
if (!theme)
|
|
22
34
|
return;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
currentTheme.set(theme.theme());
|
|
36
|
+
currentThemeMode.set(theme.mode());
|
|
37
|
+
}
|
|
38
|
+
if (typeof window !== "undefined")
|
|
39
|
+
window.addEventListener("theme-changed", sync);
|
|
40
|
+
export function getThemeMode() {
|
|
41
|
+
return runtime()?.mode() ?? currentThemeMode.get();
|
|
42
|
+
}
|
|
43
|
+
/** Choose light, dark or system, store it and put it on the page; `theme-changed` follows a change. */
|
|
44
|
+
export function setThemeMode(mode) {
|
|
45
|
+
runtime()?.set(mode);
|
|
46
|
+
sync();
|
|
47
|
+
}
|
|
48
|
+
/** Choose light or dark. `setThemeMode("system")` hands the choice back to the system. */
|
|
49
|
+
export function setTheme(theme) {
|
|
50
|
+
setThemeMode(theme);
|
|
39
51
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Bind an automatic surface to system appearance, leaving stored choices
|
|
54
|
+
* intact: nothing is read from or written to storage until the returned
|
|
55
|
+
* function hands the page back to its stored choice.
|
|
56
|
+
*/
|
|
57
|
+
export function followSystemTheme() {
|
|
58
|
+
if (typeof window === "undefined")
|
|
59
|
+
return () => { };
|
|
60
|
+
const previous = window.DS_ONE_PREFERENCES?.themeMode;
|
|
61
|
+
const following = { ...window.DS_ONE_PREFERENCES, themeMode: "system" };
|
|
62
|
+
window.DS_ONE_PREFERENCES = following;
|
|
63
|
+
setThemeMode("system");
|
|
64
|
+
return () => {
|
|
65
|
+
const options = { ...window.DS_ONE_PREFERENCES };
|
|
66
|
+
if (previous)
|
|
67
|
+
options.themeMode = previous;
|
|
68
|
+
else
|
|
69
|
+
delete options.themeMode;
|
|
70
|
+
window.DS_ONE_PREFERENCES = options;
|
|
71
|
+
runtime()?.apply();
|
|
72
|
+
sync();
|
|
73
|
+
};
|
|
48
74
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toasts' queue: Sonner's `toast()` calls and the observer that carries
|
|
3
|
+
* them to whatever draws the stack, with no framework.
|
|
4
|
+
*
|
|
5
|
+
* BASED ON SONNER, the React toast library by Emil Kowalski
|
|
6
|
+
* (https://sonner.emilkowal.ski, https://github.com/emilkowalski/sonner, MIT
|
|
7
|
+
* licence). The calls, their options and their ids are Sonner's, so Sonner's
|
|
8
|
+
* documentation describes them.
|
|
9
|
+
*
|
|
10
|
+
* Two toasters draw what it sends, in the same look: `<ds-toast>`
|
|
11
|
+
* (`2-core/ds-toast.ts`, Lit) and the page toaster (`0-face/toaster.ts`, no
|
|
12
|
+
* framework). A page shows one stack whichever it loads: a `<ds-toast>` in the
|
|
13
|
+
* page takes every toast, the page toaster draws only when there is none, and
|
|
14
|
+
* `toast()` with no toaster listening adds a `<ds-toast>` when the element is
|
|
15
|
+
* registered and the page toaster otherwise.
|
|
16
|
+
*
|
|
17
|
+
* The queue lives on `globalThis`, so two copies of this module (a product
|
|
18
|
+
* that vendors Design system 1 in two folders) still feed one stack.
|
|
19
|
+
*
|
|
20
|
+
* Where it departs from Sonner: an error is announced assertively unless it
|
|
21
|
+
* says `important: false`.
|
|
22
|
+
*/
|
|
23
|
+
export type ToastId = string | number;
|
|
24
|
+
export type ToastType = "default" | "success" | "info" | "warning" | "error" | "loading";
|
|
25
|
+
export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
26
|
+
/**
|
|
27
|
+
* A button in a toast. Clicking it closes the toast unless `onClick` calls
|
|
28
|
+
* `preventDefault()`, as in Sonner. With `href` it is a link instead (not in
|
|
29
|
+
* Sonner), which still closes the toast as the page follows it.
|
|
30
|
+
*/
|
|
31
|
+
export interface ToastButton {
|
|
32
|
+
label: string;
|
|
33
|
+
onClick?: (event: MouseEvent) => void;
|
|
34
|
+
href?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ToastOptions {
|
|
37
|
+
/** Reuse an id to update a toast in place, as Sonner does. */
|
|
38
|
+
id?: ToastId;
|
|
39
|
+
description?: string;
|
|
40
|
+
/** Milliseconds; `Infinity` keeps the toast until it is dismissed. */
|
|
41
|
+
duration?: number;
|
|
42
|
+
/** A Design system 1 icon name, replacing the type's icon. */
|
|
43
|
+
icon?: string;
|
|
44
|
+
action?: ToastButton;
|
|
45
|
+
cancel?: ToastButton;
|
|
46
|
+
/** False keeps the toast from being swiped or closed by a person. */
|
|
47
|
+
dismissible?: boolean;
|
|
48
|
+
closeButton?: boolean;
|
|
49
|
+
/** Announced assertively instead of politely. Errors are, unless this is false. */
|
|
50
|
+
important?: boolean;
|
|
51
|
+
onDismiss?: (toast: ToastData) => void;
|
|
52
|
+
onAutoClose?: (toast: ToastData) => void;
|
|
53
|
+
}
|
|
54
|
+
export interface ToastData extends ToastOptions {
|
|
55
|
+
id: ToastId;
|
|
56
|
+
title: string;
|
|
57
|
+
type: ToastType;
|
|
58
|
+
}
|
|
59
|
+
type Message<T> = string | ((value: T) => string);
|
|
60
|
+
export interface ToastPromiseMessages<T> extends ToastOptions {
|
|
61
|
+
loading: string;
|
|
62
|
+
success: Message<T>;
|
|
63
|
+
error: Message<unknown>;
|
|
64
|
+
finally?: () => void;
|
|
65
|
+
}
|
|
66
|
+
/** What a toaster hears: a toast to show or update, or a dismissal (every toast when the id is undefined). */
|
|
67
|
+
export type ToastSignal = {
|
|
68
|
+
toast: ToastData;
|
|
69
|
+
} | {
|
|
70
|
+
dismiss: ToastId | undefined;
|
|
71
|
+
};
|
|
72
|
+
type Listener = (signal: ToastSignal) => void;
|
|
73
|
+
/** Sonner's constants, shared by both toasters; its gap and offset are rounded to squares in the stylesheet. */
|
|
74
|
+
export declare const TOAST_DURATION: number;
|
|
75
|
+
export declare const VISIBLE_TOASTS = 3;
|
|
76
|
+
export declare const TIME_BEFORE_UNMOUNT = 200;
|
|
77
|
+
export declare const SWIPE_THRESHOLD = 45;
|
|
78
|
+
export declare const SWIPE_VELOCITY = 0.11;
|
|
79
|
+
/** The Design system 1 icon each type shows. */
|
|
80
|
+
export declare const TOAST_ICONS: Partial<Record<ToastType, string>>;
|
|
81
|
+
/**
|
|
82
|
+
* Listen for toasts. A `<ds-toast>` listens as a toaster; the page toaster
|
|
83
|
+
* listens as the fallback, hearing new toasts only while no toaster listens.
|
|
84
|
+
* Returns the function that stops listening.
|
|
85
|
+
*/
|
|
86
|
+
export declare function listenForToasts(listener: Listener, { fallback }?: {
|
|
87
|
+
fallback?: boolean;
|
|
88
|
+
}): () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Whether a toast shown now is drawn: a toaster listens, the page toaster is
|
|
91
|
+
* loaded, or `<ds-toast>` is registered (and so is added to the page).
|
|
92
|
+
*/
|
|
93
|
+
export declare function toasterListening(): boolean;
|
|
94
|
+
/** How the page toaster mounts itself when a toast arrives and nothing draws it. */
|
|
95
|
+
export declare function setFallbackToaster(mount: () => void): void;
|
|
96
|
+
/** Show a toast, as Sonner's `toast()`. Returns its id. */
|
|
97
|
+
export declare const toast: ((title: string, options?: ToastOptions) => ToastId) & {
|
|
98
|
+
message: (title: string, options?: ToastOptions) => ToastId;
|
|
99
|
+
success: (title: string, options?: ToastOptions) => ToastId;
|
|
100
|
+
info: (title: string, options?: ToastOptions) => ToastId;
|
|
101
|
+
warning: (title: string, options?: ToastOptions) => ToastId;
|
|
102
|
+
error: (title: string, options?: ToastOptions) => ToastId;
|
|
103
|
+
loading: (title: string, options?: ToastOptions) => ToastId;
|
|
104
|
+
/** A loading toast that becomes a success or an error when the promise settles. */
|
|
105
|
+
promise<T>(promise: Promise<T> | (() => Promise<T>), messages: ToastPromiseMessages<T>): ToastId;
|
|
106
|
+
/** Dismiss one toast, or every toast without an id. */
|
|
107
|
+
dismiss(id?: ToastId): ToastId | undefined;
|
|
108
|
+
};
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=toast-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-queue.d.ts","sourceRoot":"","sources":["../../DS1/0-face/toast-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AACzF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AACvH;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AACpG,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AACD,MAAM,WAAW,SAAU,SAAQ,YAAY;IAAG,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE;AAC/F,KAAK,OAAO,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC;AAClD,MAAM,WAAW,oBAAoB,CAAC,CAAC,CAAE,SAAQ,YAAY;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,8GAA8G;AAC9G,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC;AAClF,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AAE9C,gHAAgH;AAChH,eAAO,MAAM,cAAc,QAAW,CAAC;AACvC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,gDAAgD;AAChD,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAqF,CAAC;AAkBjJ;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAgB,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,IAAI,CAIjH;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAG1C;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAE1D;AAgBD,2DAA2D;AAC3D,eAAO,MAAM,KAAK,WACR,MAAM,YAAY,YAAY,KAAG,OAAO;qBAE7B,MAAM,YAAY,YAAY,KAAG,OAAO;qBACxC,MAAM,YAAY,YAAY,KAAG,OAAO;kBAC3C,MAAM,YAAY,YAAY,KAAG,OAAO;qBACrC,MAAM,YAAY,YAAY,KAAG,OAAO;mBAC1C,MAAM,YAAY,YAAY,KAAG,OAAO;qBACtC,MAAM,YAAY,YAAY,KAAG,OAAO;IACzD,mFAAmF;YAC3E,CAAC,WAAW,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO;IAWhG,uDAAuD;iBAC1C,OAAO,GAAG,OAAO,GAAG,SAAS;CAM7C,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toasts' queue: Sonner's `toast()` calls and the observer that carries
|
|
3
|
+
* them to whatever draws the stack, with no framework.
|
|
4
|
+
*
|
|
5
|
+
* BASED ON SONNER, the React toast library by Emil Kowalski
|
|
6
|
+
* (https://sonner.emilkowal.ski, https://github.com/emilkowalski/sonner, MIT
|
|
7
|
+
* licence). The calls, their options and their ids are Sonner's, so Sonner's
|
|
8
|
+
* documentation describes them.
|
|
9
|
+
*
|
|
10
|
+
* Two toasters draw what it sends, in the same look: `<ds-toast>`
|
|
11
|
+
* (`2-core/ds-toast.ts`, Lit) and the page toaster (`0-face/toaster.ts`, no
|
|
12
|
+
* framework). A page shows one stack whichever it loads: a `<ds-toast>` in the
|
|
13
|
+
* page takes every toast, the page toaster draws only when there is none, and
|
|
14
|
+
* `toast()` with no toaster listening adds a `<ds-toast>` when the element is
|
|
15
|
+
* registered and the page toaster otherwise.
|
|
16
|
+
*
|
|
17
|
+
* The queue lives on `globalThis`, so two copies of this module (a product
|
|
18
|
+
* that vendors Design system 1 in two folders) still feed one stack.
|
|
19
|
+
*
|
|
20
|
+
* Where it departs from Sonner: an error is announced assertively unless it
|
|
21
|
+
* says `important: false`.
|
|
22
|
+
*/
|
|
23
|
+
/** Sonner's constants, shared by both toasters; its gap and offset are rounded to squares in the stylesheet. */
|
|
24
|
+
export const TOAST_DURATION = Infinity;
|
|
25
|
+
export const VISIBLE_TOASTS = 3;
|
|
26
|
+
export const TIME_BEFORE_UNMOUNT = 200;
|
|
27
|
+
export const SWIPE_THRESHOLD = 45;
|
|
28
|
+
export const SWIPE_VELOCITY = 0.11;
|
|
29
|
+
/** The Design system 1 icon each type shows. */
|
|
30
|
+
export const TOAST_ICONS = { success: "check", info: "notifications", warning: "warning", error: "warning" };
|
|
31
|
+
const QUEUE = Symbol.for("design-system-1.toasts");
|
|
32
|
+
function queue() {
|
|
33
|
+
const scope = globalThis;
|
|
34
|
+
return (scope[QUEUE] ?? (scope[QUEUE] = { toasters: new Set(), fallbacks: new Set(), lastId: 0 }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Listen for toasts. A `<ds-toast>` listens as a toaster; the page toaster
|
|
38
|
+
* listens as the fallback, hearing new toasts only while no toaster listens.
|
|
39
|
+
* Returns the function that stops listening.
|
|
40
|
+
*/
|
|
41
|
+
export function listenForToasts(listener, { fallback = false } = {}) {
|
|
42
|
+
const listeners = fallback ? queue().fallbacks : queue().toasters;
|
|
43
|
+
listeners.add(listener);
|
|
44
|
+
return () => { listeners.delete(listener); };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether a toast shown now is drawn: a toaster listens, the page toaster is
|
|
48
|
+
* loaded, or `<ds-toast>` is registered (and so is added to the page).
|
|
49
|
+
*/
|
|
50
|
+
export function toasterListening() {
|
|
51
|
+
const state = queue();
|
|
52
|
+
return state.toasters.size > 0 || state.fallbacks.size > 0 || !!state.mountFallback || (typeof customElements !== "undefined" && !!customElements.get("ds-toast"));
|
|
53
|
+
}
|
|
54
|
+
/** How the page toaster mounts itself when a toast arrives and nothing draws it. */
|
|
55
|
+
export function setFallbackToaster(mount) {
|
|
56
|
+
queue().mountFallback = mount;
|
|
57
|
+
}
|
|
58
|
+
function show(title, type, options = {}) {
|
|
59
|
+
const state = queue();
|
|
60
|
+
const id = options.id ?? ++state.lastId;
|
|
61
|
+
if (!state.toasters.size && typeof document !== "undefined" && document.body) {
|
|
62
|
+
if (typeof customElements !== "undefined" && customElements.get("ds-toast"))
|
|
63
|
+
document.body.appendChild(document.createElement("ds-toast"));
|
|
64
|
+
else if (!state.fallbacks.size)
|
|
65
|
+
state.mountFallback?.();
|
|
66
|
+
}
|
|
67
|
+
const important = options.important ?? (type === "error" ? true : undefined);
|
|
68
|
+
const data = { ...options, ...(important === undefined ? {} : { important }), id, title, type };
|
|
69
|
+
// A copy: a listener may add or remove listeners while it hears the toast.
|
|
70
|
+
for (const listener of Array.from(state.toasters.size ? state.toasters : state.fallbacks))
|
|
71
|
+
listener({ toast: data });
|
|
72
|
+
return id;
|
|
73
|
+
}
|
|
74
|
+
/** Show a toast, as Sonner's `toast()`. Returns its id. */
|
|
75
|
+
export const toast = Object.assign((title, options) => show(title, "default", options), {
|
|
76
|
+
message: (title, options) => show(title, "default", options),
|
|
77
|
+
success: (title, options) => show(title, "success", options),
|
|
78
|
+
info: (title, options) => show(title, "info", options),
|
|
79
|
+
warning: (title, options) => show(title, "warning", options),
|
|
80
|
+
error: (title, options) => show(title, "error", options),
|
|
81
|
+
loading: (title, options) => show(title, "loading", options),
|
|
82
|
+
/** A loading toast that becomes a success or an error when the promise settles. */
|
|
83
|
+
promise(promise, messages) {
|
|
84
|
+
const { loading, success, error, finally: done, ...options } = messages;
|
|
85
|
+
const id = show(loading, "loading", options);
|
|
86
|
+
Promise.resolve(typeof promise === "function" ? promise() : promise)
|
|
87
|
+
.then(value => { show(typeof success === "function" ? success(value) : success, "success", { ...options, id }); }, reason => { show(typeof error === "function" ? error(reason) : error, "error", { ...options, id }); })
|
|
88
|
+
.finally(() => done?.());
|
|
89
|
+
return id;
|
|
90
|
+
},
|
|
91
|
+
/** Dismiss one toast, or every toast without an id. */
|
|
92
|
+
dismiss(id) {
|
|
93
|
+
const state = queue();
|
|
94
|
+
for (const listener of [...state.toasters, ...state.fallbacks])
|
|
95
|
+
listener({ dismiss: id });
|
|
96
|
+
return id;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ToastPosition } from "./toast-queue";
|
|
2
|
+
export { toast } from "./toast-queue";
|
|
3
|
+
export type { ToastButton, ToastData, ToastId, ToastOptions, ToastPosition, ToastPromiseMessages, ToastType } from "./toast-queue";
|
|
4
|
+
/** Sonner's `<Toaster />` props, for the page toaster. */
|
|
5
|
+
export interface ToasterOptions {
|
|
6
|
+
/** `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center` or `bottom-right` (the default). */
|
|
7
|
+
position?: ToastPosition;
|
|
8
|
+
/** Keep the toasts spread out instead of stacked. */
|
|
9
|
+
expand?: boolean;
|
|
10
|
+
/** How many show at once; three by default. */
|
|
11
|
+
visibleToasts?: number;
|
|
12
|
+
/** Milliseconds each toast stays; Infinity by default, until dismissed. */
|
|
13
|
+
duration?: number;
|
|
14
|
+
/** A close button on every toast. */
|
|
15
|
+
closeButton?: boolean;
|
|
16
|
+
/** Fill success, info, warning and error toasts with their colour. */
|
|
17
|
+
richColors?: boolean;
|
|
18
|
+
/** The region's accessible name; the shared word "Notifications" by default. */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** The close button's accessible name; the shared word "Close" by default. */
|
|
21
|
+
closeLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Set the page toaster's options, as Sonner's `<Toaster />` props. Toasts already shown take them at once. */
|
|
24
|
+
export declare function configureToaster(options: ToasterOptions): void;
|
|
25
|
+
/** The page toaster, put in the page when it is first needed. */
|
|
26
|
+
export declare function pageToaster(): HTMLElement | undefined;
|
|
27
|
+
//# sourceMappingURL=toaster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../DS1/0-face/toaster.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAmC,aAAa,EAAe,MAAM,eAAe,CAAC;AAEjG,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEnI,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAeD,+GAA+G;AAC/G,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAG9D;AAiSD,iEAAiE;AACjE,wBAAgB,WAAW,IAAI,WAAW,GAAG,SAAS,CAKrD"}
|