@0001-labs/design-system-1 0.3.0-alpha.13 → 0.3.0-alpha.14
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 +13 -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 +887 -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/kbd.css +46 -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 +297 -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-kbd.ts +78 -0
- package/DS1/2-core/ds-loading.ts +72 -0
- package/DS1/2-core/ds-notice.ts +180 -0
- package/DS1/2-core/ds-progress.ts +380 -0
- package/DS1/2-core/ds-spacing-handle.ts +22 -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 +234 -128
- package/DS1/2-core/generated/icon-avatar.ts +2 -0
- package/DS1/2-core/generated/icons-extra.ts +118 -65
- package/DS1/2-core/generated/icons-immediate.ts +1 -1
- package/DS1/2-core/spacing-handle.ts +95 -0
- 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 +69 -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-kbd.css +12 -0
- package/DS1/2-core/styles/ds-loading.css +13 -0
- package/DS1/2-core/styles/ds-notice.css +30 -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-spacing-handle.css +8 -0
- 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 +280 -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 +117 -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 +26 -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/kbd.ts +21 -0
- package/DS1/react/loading.ts +18 -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 +60 -0
- package/DS1/react/spacing-handle.ts +21 -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-item-button-start.svg → chevron-left.svg} +1 -1
- package/DS1/x-icon/{ezo-android-screen-stats.svg → chevron-right.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/{ezo-android-screen-lists.svg → minus.svg} +1 -1
- 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/{ezo-item-button-reopen.svg → stop.svg} +1 -1
- 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 +10 -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/0-face/tree.d.ts +69 -0
- package/dist/0-face/tree.d.ts.map +1 -0
- package/dist/0-face/tree.js +191 -0
- 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-banner.d.ts +23 -7
- package/dist/2-core/ds-banner.d.ts.map +1 -1
- package/dist/2-core/ds-banner.js +48 -12
- 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-kbd.d.ts +48 -0
- package/dist/2-core/ds-kbd.d.ts.map +1 -0
- package/dist/2-core/ds-kbd.js +65 -0
- package/dist/2-core/ds-language.d.ts +8 -1
- package/dist/2-core/ds-language.d.ts.map +1 -1
- package/dist/2-core/ds-language.js +2 -2
- package/dist/2-core/ds-loading.d.ts +40 -0
- package/dist/2-core/ds-loading.d.ts.map +1 -0
- package/dist/2-core/ds-loading.js +63 -0
- package/dist/2-core/ds-meter.d.ts +103 -0
- package/dist/2-core/ds-meter.d.ts.map +1 -0
- package/dist/2-core/ds-meter.js +124 -0
- package/dist/2-core/ds-notice.d.ts +103 -0
- package/dist/2-core/ds-notice.d.ts.map +1 -0
- package/dist/2-core/ds-notice.js +152 -0
- package/dist/2-core/ds-pagedots.d.ts +64 -7
- package/dist/2-core/ds-pagedots.d.ts.map +1 -1
- package/dist/2-core/ds-pagedots.js +124 -18
- 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-spacing-handle.d.ts +25 -0
- package/dist/2-core/ds-spacing-handle.d.ts.map +1 -0
- package/dist/2-core/ds-spacing-handle.js +25 -0
- package/dist/2-core/ds-split.d.ts +4 -67
- package/dist/2-core/ds-split.d.ts.map +1 -1
- package/dist/2-core/ds-split.js +4 -98
- 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-steps.d.ts +72 -0
- package/dist/2-core/ds-steps.d.ts.map +1 -0
- package/dist/2-core/ds-steps.js +114 -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-textarea.d.ts.map +1 -1
- package/dist/2-core/ds-textarea.js +1 -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/ds-toggle.d.ts +11 -0
- package/dist/2-core/ds-toggle.d.ts.map +1 -0
- package/dist/2-core/ds-toggle.js +10 -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 +118 -65
- package/dist/2-core/generated/ds-icon-map.d.ts.map +1 -1
- package/dist/2-core/generated/ds-icon-map.js +234 -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 +118 -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/2-core/spacing-handle.d.ts +28 -0
- package/dist/2-core/spacing-handle.d.ts.map +1 -0
- package/dist/2-core/spacing-handle.js +146 -0
- 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 +108 -0
- package/dist/3-unit/ds-sidebar.d.ts.map +1 -0
- package/dist/3-unit/ds-sidebar.js +268 -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/3-unit/ds-tree.d.ts +69 -0
- package/dist/3-unit/ds-tree.d.ts.map +1 -0
- package/dist/3-unit/ds-tree.js +136 -0
- 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-layout.d.ts +1 -0
- package/dist/4-page/ds-layout.d.ts.map +1 -1
- package/dist/4-page/ds-layout.js +1 -1
- 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 +11304 -4322
- package/dist/design-system-1.bundle.js.map +1 -1
- package/dist/design-system-1.bundle.min.js +8867 -4132
- 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-B4Iotc7s.js +298 -0
- package/dist/icons-extra-B4Iotc7s.js.map +1 -0
- package/dist/icons-extra-C4sCgoUj.js +185 -0
- package/dist/icons-extra-C4sCgoUj.js.map +1 -0
- package/dist/icons-extra-DSav6uTU.js +300 -0
- package/dist/icons-extra-DSav6uTU.js.map +1 -0
- package/dist/icons-extra-Dc_yVWIz.js +1024 -0
- package/dist/icons-extra-Dc_yVWIz.js.map +1 -0
- package/dist/icons-extra-cfzoudMf.js +1030 -0
- package/dist/icons-extra-cfzoudMf.js.map +1 -0
- package/dist/icons-extra-g_xpwZhZ.js +631 -0
- package/dist/icons-extra-g_xpwZhZ.js.map +1 -0
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -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/button-split.js +35 -0
- 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/kbd.d.ts +26 -0
- package/dist/react/kbd.d.ts.map +1 -0
- package/dist/react/kbd.js +8 -0
- package/dist/react/loading.d.ts +14 -0
- package/dist/react/loading.d.ts.map +1 -0
- package/dist/react/loading.js +14 -0
- package/dist/react/meter.d.ts +64 -0
- package/dist/react/meter.d.ts.map +1 -0
- package/dist/react/meter.js +15 -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 +44 -0
- package/dist/react/sidebar.d.ts.map +1 -0
- package/dist/react/sidebar.js +41 -0
- package/dist/react/spacing-handle.d.ts +13 -0
- package/dist/react/spacing-handle.d.ts.map +1 -0
- package/dist/react/spacing-handle.js +18 -0
- package/dist/react/split.d.ts +6 -14
- package/dist/react/split.d.ts.map +1 -1
- package/dist/react/split.js +5 -31
- 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/steps.d.ts +36 -0
- package/dist/react/steps.d.ts.map +1 -0
- package/dist/react/steps.js +10 -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/react/tree.d.ts +31 -0
- package/dist/react/tree.d.ts.map +1 -0
- package/dist/react/tree.js +37 -0
- package/dist/shared-words-BfnT24Fe.js +1635 -0
- package/dist/shared-words-BfnT24Fe.js.map +1 -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/dist/shared-words-UCvnkctb.js +1653 -0
- package/dist/shared-words-UCvnkctb.js.map +1 -0
- package/package.json +16 -5
- 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/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,554 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid chart: a numeric chart drawn one pixel column at a time on the 20px grid.
|
|
3
|
+
*
|
|
4
|
+
* The API follows lightweight-charts (createChart → addSeries → setData,
|
|
5
|
+
* subscribeCrosshairMove), with pixel-aligned rendering:
|
|
6
|
+
* - every row line of the chart is a price level, chosen so the scale lands on the grid;
|
|
7
|
+
* - each pixel column holds the min/max of the points inside it, so a minute series
|
|
8
|
+
* and a five-year series draw with the same one-pixel stroke and never blur;
|
|
9
|
+
* - fills are one-pixel strokes at two-pixel intervals, for a patterned fill.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface DataPoint {
|
|
13
|
+
/** Unix seconds */
|
|
14
|
+
time: number;
|
|
15
|
+
value: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type SeriesKind = "area" | "line" | "baseline";
|
|
19
|
+
|
|
20
|
+
export interface SeriesOptions {
|
|
21
|
+
kind?: SeriesKind;
|
|
22
|
+
/** CSS color or palette name (e.g. "--ds-chart-up"). Area and line series. */
|
|
23
|
+
color?: string;
|
|
24
|
+
/** Baseline series: values above draw in the positive colour, below in the negative colour. */
|
|
25
|
+
baseValue?: number;
|
|
26
|
+
/** Hatch spacing in pixels; 0 turns the fill off. */
|
|
27
|
+
hatch?: number;
|
|
28
|
+
hatchOpacity?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Marker {
|
|
32
|
+
time: number;
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ChartOptions {
|
|
37
|
+
unit?: number;
|
|
38
|
+
/** Price labels on every nth row line, in a two-square gutter on the right. */
|
|
39
|
+
scaleLabels?: boolean;
|
|
40
|
+
labelEvery?: number;
|
|
41
|
+
/** High and low callouts on the visible range. */
|
|
42
|
+
extremes?: boolean;
|
|
43
|
+
grid?: "full" | "rows" | "none";
|
|
44
|
+
format?: (value: number) => string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CrosshairEvent {
|
|
48
|
+
point: DataPoint | null;
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface Column {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
first: number;
|
|
57
|
+
last: number;
|
|
58
|
+
index: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface Palette {
|
|
62
|
+
ink: string;
|
|
63
|
+
muted: string;
|
|
64
|
+
faint: string;
|
|
65
|
+
up: string;
|
|
66
|
+
down: string;
|
|
67
|
+
surface: string;
|
|
68
|
+
gridMinor: string;
|
|
69
|
+
gridMajor: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const STEPS: number[] = [];
|
|
73
|
+
for (let exp = -4; exp <= 9; exp++) {
|
|
74
|
+
for (const base of [1, 2, 2.5, 5]) STEPS.push(base * 10 ** exp);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class Series {
|
|
78
|
+
data: DataPoint[] = [];
|
|
79
|
+
markers: Marker[] = [];
|
|
80
|
+
constructor(
|
|
81
|
+
private chart: GridChart,
|
|
82
|
+
public options: SeriesOptions,
|
|
83
|
+
) {}
|
|
84
|
+
|
|
85
|
+
setData(data: DataPoint[]): void {
|
|
86
|
+
this.data = data;
|
|
87
|
+
this.chart.draw();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
update(point: DataPoint): void {
|
|
91
|
+
const last = this.data[this.data.length - 1];
|
|
92
|
+
if (last && last.time === point.time) this.data[this.data.length - 1] = point;
|
|
93
|
+
else this.data.push(point);
|
|
94
|
+
this.chart.draw();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setMarkers(markers: Marker[]): void {
|
|
98
|
+
this.markers = markers;
|
|
99
|
+
this.chart.draw();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
applyOptions(options: SeriesOptions): void {
|
|
103
|
+
this.options = { ...this.options, ...options };
|
|
104
|
+
this.chart.draw();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export class GridChart {
|
|
109
|
+
private ctx: CanvasRenderingContext2D;
|
|
110
|
+
private width = 0;
|
|
111
|
+
private height = 0;
|
|
112
|
+
private dpr = 1;
|
|
113
|
+
private series: Series[] = [];
|
|
114
|
+
private crosshairX: number | null = null;
|
|
115
|
+
private crosshair: CrosshairEvent = { point: null, x: -1, y: -1 };
|
|
116
|
+
private listeners = new Set<(event: CrosshairEvent) => void>();
|
|
117
|
+
private progress = 1;
|
|
118
|
+
private frame = 0;
|
|
119
|
+
private timeRange: [number, number] | null = null;
|
|
120
|
+
private palette: Palette;
|
|
121
|
+
private lastDrawn: { x: number; y: number } | null = null;
|
|
122
|
+
options: Required<ChartOptions>;
|
|
123
|
+
|
|
124
|
+
constructor(
|
|
125
|
+
private canvas: HTMLCanvasElement,
|
|
126
|
+
options: ChartOptions = {},
|
|
127
|
+
) {
|
|
128
|
+
const ctx = canvas.getContext("2d");
|
|
129
|
+
if (!ctx) throw new Error("Canvas 2D is not available");
|
|
130
|
+
this.ctx = ctx;
|
|
131
|
+
this.options = {
|
|
132
|
+
unit: 20,
|
|
133
|
+
scaleLabels: false,
|
|
134
|
+
labelEvery: 2,
|
|
135
|
+
extremes: false,
|
|
136
|
+
grid: "full",
|
|
137
|
+
format: (v) => v.toFixed(2),
|
|
138
|
+
...options,
|
|
139
|
+
};
|
|
140
|
+
this.palette = this.readPalette();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
addSeries(options: SeriesOptions = {}): Series {
|
|
144
|
+
const series = new Series(this, { kind: "area", hatch: 2, hatchOpacity: 0.28, ...options });
|
|
145
|
+
this.series.push(series);
|
|
146
|
+
return series;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
removeSeries(series: Series): void {
|
|
150
|
+
this.series = this.series.filter((s) => s !== series);
|
|
151
|
+
this.draw();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
applyOptions(options: ChartOptions): void {
|
|
155
|
+
this.options = { ...this.options, ...options };
|
|
156
|
+
this.draw();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Fixes the visible time range, e.g. a whole trading day while only the morning has data. */
|
|
160
|
+
setTimeRange(range: [number, number] | null): void {
|
|
161
|
+
this.timeRange = range;
|
|
162
|
+
this.draw();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
resize(width: number, height: number): void {
|
|
166
|
+
this.width = Math.floor(width);
|
|
167
|
+
this.height = Math.floor(height);
|
|
168
|
+
this.dpr = window.devicePixelRatio || 1;
|
|
169
|
+
this.canvas.width = Math.round(this.width * this.dpr);
|
|
170
|
+
this.canvas.height = Math.round(this.height * this.dpr);
|
|
171
|
+
this.canvas.style.width = `${this.width}px`;
|
|
172
|
+
this.canvas.style.height = `${this.height}px`;
|
|
173
|
+
this.draw();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
refreshTheme(): void {
|
|
177
|
+
this.palette = this.readPalette();
|
|
178
|
+
this.draw();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
subscribeCrosshairMove(listener: (event: CrosshairEvent) => void): void {
|
|
182
|
+
this.listeners.add(listener);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
unsubscribeCrosshairMove(listener: (event: CrosshairEvent) => void): void {
|
|
186
|
+
this.listeners.delete(listener);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Moves the crosshair to a pixel column (null hides it) and tells subscribers. */
|
|
190
|
+
setCrosshair(x: number | null): void {
|
|
191
|
+
this.crosshairX = x === null ? null : Math.max(0, Math.min(this.plotWidth() - 1, Math.round(x)));
|
|
192
|
+
this.draw();
|
|
193
|
+
for (const listener of this.listeners) listener(this.crosshair);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Draws the series in from the left. */
|
|
197
|
+
animateIn(duration = 520): void {
|
|
198
|
+
cancelAnimationFrame(this.frame);
|
|
199
|
+
if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
200
|
+
this.progress = 1;
|
|
201
|
+
this.draw();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const start = performance.now();
|
|
205
|
+
const step = (now: number) => {
|
|
206
|
+
const t = Math.min(1, (now - start) / duration);
|
|
207
|
+
this.progress = 1 - (1 - t) ** 3;
|
|
208
|
+
this.draw();
|
|
209
|
+
if (t < 1) this.frame = requestAnimationFrame(step);
|
|
210
|
+
};
|
|
211
|
+
this.progress = 0;
|
|
212
|
+
this.frame = requestAnimationFrame(step);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Position of the newest drawn value, for a live marker laid over the canvas. */
|
|
216
|
+
lastPoint(): { x: number; y: number } | null {
|
|
217
|
+
return this.progress === 1 ? this.lastDrawn : null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
destroy(): void {
|
|
221
|
+
cancelAnimationFrame(this.frame);
|
|
222
|
+
this.listeners.clear();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private plotWidth(): number {
|
|
226
|
+
return Math.max(0, Math.floor(this.width - (this.options.scaleLabels ? this.options.unit * 2 : 0)));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private readPalette(): Palette {
|
|
230
|
+
const probe = document.createElement("span");
|
|
231
|
+
probe.style.display = "none";
|
|
232
|
+
(this.canvas.parentNode ?? document.body).appendChild(probe);
|
|
233
|
+
const read = (name: string) => {
|
|
234
|
+
const fallback: Record<string, string> = { "--ds-chart-ink": "var(--text-color, #1e1e1e)", "--ds-chart-muted": "var(--base-darker-grey, #797979)", "--ds-chart-faint": "var(--slate-light, #e6e6e6)", "--ds-chart-up": "var(--apple-green, #99ff73)", "--ds-chart-down": "var(--tuned-red, #ff5f5f)", "--ds-chart-surface": "var(--background, #fff)", "--ds-chart-grid-minor": "var(--grid-color-light, #1e1e1e2b)", "--ds-chart-grid-major": "var(--grid-color-light, #1e1e1e2b)" };
|
|
235
|
+
probe.style.color = `var(${name}, ${fallback[name]})`;
|
|
236
|
+
return getComputedStyle(probe).color;
|
|
237
|
+
};
|
|
238
|
+
const palette = {
|
|
239
|
+
ink: read("--ds-chart-ink"),
|
|
240
|
+
muted: read("--ds-chart-muted"),
|
|
241
|
+
faint: read("--ds-chart-faint"),
|
|
242
|
+
up: read("--ds-chart-up"),
|
|
243
|
+
down: read("--ds-chart-down"),
|
|
244
|
+
surface: read("--ds-chart-surface"),
|
|
245
|
+
gridMinor: read("--ds-chart-grid-minor"),
|
|
246
|
+
gridMajor: read("--ds-chart-grid-major"),
|
|
247
|
+
};
|
|
248
|
+
probe.remove();
|
|
249
|
+
return palette;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private resolve(color: string | undefined, fallback: string): string {
|
|
253
|
+
if (!color) return fallback;
|
|
254
|
+
if (!color.startsWith("--")) return color;
|
|
255
|
+
const probe = document.createElement("span");
|
|
256
|
+
probe.style.color = `var(${color}, ${fallback})`;
|
|
257
|
+
probe.style.display = "none";
|
|
258
|
+
(this.canvas.parentNode ?? document.body).appendChild(probe);
|
|
259
|
+
const resolved = getComputedStyle(probe).color;
|
|
260
|
+
probe.remove();
|
|
261
|
+
return resolved;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Type at its size on a 20px square, scaled with the square. */
|
|
265
|
+
private font(size: number): string {
|
|
266
|
+
const family = getComputedStyle(this.canvas).getPropertyValue("--ds-chart-font").trim() || getComputedStyle(this.canvas).getPropertyValue("--typeface-regular").trim() || '"Inter Arrows", sans-serif';
|
|
267
|
+
return `${(size * this.options.unit) / 20}px ${family}`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private scale(min: number, max: number) {
|
|
271
|
+
const { unit, extremes } = this.options;
|
|
272
|
+
const rows = Math.max(1, Math.floor(this.height / unit));
|
|
273
|
+
const pad = extremes ? 1 : 0;
|
|
274
|
+
const usable = Math.max(1, rows - pad * 2);
|
|
275
|
+
if (max - min < 1e-9) {
|
|
276
|
+
const spread = Math.abs(max) * 0.01 || 1;
|
|
277
|
+
min -= spread;
|
|
278
|
+
max += spread;
|
|
279
|
+
}
|
|
280
|
+
let step = STEPS[STEPS.length - 1];
|
|
281
|
+
for (const candidate of STEPS) {
|
|
282
|
+
if (Math.ceil(max / candidate) - Math.floor(min / candidate) <= usable) {
|
|
283
|
+
step = candidate;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const low = Math.floor(min / step);
|
|
288
|
+
const used = Math.ceil(max / step) - low;
|
|
289
|
+
const bottom = low - Math.floor((usable - used) / 2) - pad;
|
|
290
|
+
const h = rows * unit;
|
|
291
|
+
return {
|
|
292
|
+
rows,
|
|
293
|
+
y: (v: number) => h - (v / step - bottom) * unit,
|
|
294
|
+
valueAtRow: (row: number) => (bottom + (rows - row)) * step,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private columns(data: DataPoint[], t0: number, t1: number, n: number): (Column | null)[] {
|
|
299
|
+
const cols: (Column | null)[] = new Array(n).fill(null);
|
|
300
|
+
const span = Math.max(1, t1 - t0);
|
|
301
|
+
data.forEach((p, index) => {
|
|
302
|
+
const c = Math.round(((p.time - t0) / span) * (n - 1));
|
|
303
|
+
if (c < 0 || c >= n) return;
|
|
304
|
+
const col = cols[c];
|
|
305
|
+
if (!col) cols[c] = { min: p.value, max: p.value, first: p.value, last: p.value, index };
|
|
306
|
+
else {
|
|
307
|
+
col.min = Math.min(col.min, p.value);
|
|
308
|
+
col.max = Math.max(col.max, p.value);
|
|
309
|
+
col.last = p.value;
|
|
310
|
+
col.index = index;
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
let prev = -1;
|
|
314
|
+
for (let c = 0; c < n; c++) {
|
|
315
|
+
if (!cols[c]) continue;
|
|
316
|
+
if (prev >= 0 && c - prev > 1) {
|
|
317
|
+
const a = cols[prev] as Column;
|
|
318
|
+
const b = cols[c] as Column;
|
|
319
|
+
for (let k = prev + 1; k < c; k++) {
|
|
320
|
+
const t = (k - prev) / (c - prev);
|
|
321
|
+
const v = a.last + (b.first - a.last) * t;
|
|
322
|
+
cols[k] = { min: v, max: v, first: v, last: v, index: t < 0.5 ? a.index : b.index };
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
prev = c;
|
|
326
|
+
}
|
|
327
|
+
return cols;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
draw(): void {
|
|
331
|
+
const { ctx, width, height, dpr, palette } = this;
|
|
332
|
+
if (!width || !height) return;
|
|
333
|
+
const { unit, grid } = this.options;
|
|
334
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
335
|
+
ctx.clearRect(0, 0, width, height);
|
|
336
|
+
|
|
337
|
+
if (grid !== "none") {
|
|
338
|
+
for (let row = 0; row * unit <= height + 0.01; row++) {
|
|
339
|
+
ctx.fillStyle = row % 4 === 0 ? palette.gridMajor : palette.gridMinor;
|
|
340
|
+
ctx.fillRect(0, Math.min(row * unit, height - 1), width, 1);
|
|
341
|
+
}
|
|
342
|
+
if (grid === "full") {
|
|
343
|
+
for (let col = 0; col * unit <= width + 0.01; col++) {
|
|
344
|
+
ctx.fillStyle = col % 4 === 0 ? palette.gridMajor : palette.gridMinor;
|
|
345
|
+
ctx.fillRect(Math.min(col * unit, width - 1), 0, 1, height);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
this.lastDrawn = null;
|
|
351
|
+
this.crosshair = { point: null, x: -1, y: -1 };
|
|
352
|
+
const all = this.series.flatMap((s) => s.data);
|
|
353
|
+
if (!all.length) return;
|
|
354
|
+
|
|
355
|
+
const plotW = this.plotWidth();
|
|
356
|
+
if (plotW < 1) return;
|
|
357
|
+
let t0 = Infinity;
|
|
358
|
+
let t1 = -Infinity;
|
|
359
|
+
let min = Infinity;
|
|
360
|
+
let max = -Infinity;
|
|
361
|
+
for (const p of all) {
|
|
362
|
+
t0 = Math.min(t0, p.time);
|
|
363
|
+
t1 = Math.max(t1, p.time);
|
|
364
|
+
min = Math.min(min, p.value);
|
|
365
|
+
max = Math.max(max, p.value);
|
|
366
|
+
}
|
|
367
|
+
if (this.timeRange) [t0, t1] = this.timeRange;
|
|
368
|
+
for (const s of this.series) {
|
|
369
|
+
if (s.options.kind === "baseline" && s.options.baseValue !== undefined) {
|
|
370
|
+
min = Math.min(min, s.options.baseValue);
|
|
371
|
+
max = Math.max(max, s.options.baseValue);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
const scale = this.scale(min, max);
|
|
375
|
+
const Y = (v: number) => Math.round(Math.max(0, Math.min(height - 1, scale.y(v))));
|
|
376
|
+
const drawn = Math.ceil(plotW * this.progress);
|
|
377
|
+
|
|
378
|
+
if (this.options.scaleLabels) {
|
|
379
|
+
ctx.font = this.font(10);
|
|
380
|
+
ctx.textAlign = "right";
|
|
381
|
+
ctx.textBaseline = "alphabetic";
|
|
382
|
+
ctx.fillStyle = palette.muted;
|
|
383
|
+
for (let row = 1; row < scale.rows; row++) {
|
|
384
|
+
if (row % this.options.labelEvery !== 0) continue;
|
|
385
|
+
ctx.fillText(this.options.format(scale.valueAtRow(row)), width - 2, row * unit - Math.round(unit / 4));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
for (const series of this.series) {
|
|
390
|
+
const cols = this.columns(series.data, t0, t1, plotW);
|
|
391
|
+
const { kind = "area", hatch = 2, hatchOpacity = 0.28, baseValue } = series.options;
|
|
392
|
+
const lineColor = this.resolve(series.options.color, palette.ink);
|
|
393
|
+
const isBaseline = kind === "baseline" && baseValue !== undefined;
|
|
394
|
+
const baseY = isBaseline ? Y(baseValue) : height - 1;
|
|
395
|
+
|
|
396
|
+
if (isBaseline) {
|
|
397
|
+
ctx.fillStyle = palette.muted;
|
|
398
|
+
for (let x = 0; x < plotW; x += 4) ctx.fillRect(x, baseY, 2, 1);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
for (const marker of series.markers) {
|
|
402
|
+
const x = Math.round(((marker.time - t0) / Math.max(1, t1 - t0)) * (plotW - 1));
|
|
403
|
+
if (x < 0 || x >= plotW) continue;
|
|
404
|
+
ctx.fillStyle = palette.faint;
|
|
405
|
+
for (let y = unit; y < height - unit; y += 2) ctx.fillRect(x, y, 1, 1);
|
|
406
|
+
const box = unit - 4;
|
|
407
|
+
const boxX = Math.max(0, Math.min(plotW - box, x - Math.floor(box / 2)));
|
|
408
|
+
const boxY = height - unit + 2;
|
|
409
|
+
ctx.fillStyle = palette.surface;
|
|
410
|
+
ctx.fillRect(boxX, boxY, box, box);
|
|
411
|
+
this.strokeBox(boxX, boxY, box, box, palette.muted);
|
|
412
|
+
ctx.fillStyle = palette.muted;
|
|
413
|
+
ctx.font = this.font(10);
|
|
414
|
+
ctx.textAlign = "center";
|
|
415
|
+
ctx.textBaseline = "middle";
|
|
416
|
+
ctx.fillText(marker.text, boxX + box / 2, boxY + box / 2 + 0.5);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
let prevY: number | null = null;
|
|
420
|
+
let hi: { x: number; v: number } | null = null;
|
|
421
|
+
let lo: { x: number; v: number } | null = null;
|
|
422
|
+
for (let x = 0; x < drawn; x++) {
|
|
423
|
+
const col = cols[x];
|
|
424
|
+
if (!col) {
|
|
425
|
+
prevY = null;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
const yFirst = prevY ?? Y(col.first);
|
|
429
|
+
const top = Math.min(Y(col.max), yFirst);
|
|
430
|
+
const bottom = Math.max(Y(col.min), yFirst);
|
|
431
|
+
const lineY = Y(col.last);
|
|
432
|
+
const color = isBaseline ? (col.last >= (baseValue as number) ? palette.up : palette.down) : lineColor;
|
|
433
|
+
|
|
434
|
+
if (hatch > 0 && kind !== "line" && x % hatch === 0) {
|
|
435
|
+
ctx.globalAlpha = hatchOpacity;
|
|
436
|
+
ctx.fillStyle = color;
|
|
437
|
+
if (lineY < baseY - 2) ctx.fillRect(x, lineY + 2, 1, baseY - lineY - 2);
|
|
438
|
+
else if (isBaseline && lineY > baseY + 2) ctx.fillRect(x, baseY + 1, 1, lineY - baseY - 2);
|
|
439
|
+
ctx.globalAlpha = 1;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
ctx.fillStyle = color;
|
|
443
|
+
ctx.fillRect(x, top, 1, bottom - top + 1);
|
|
444
|
+
prevY = lineY;
|
|
445
|
+
this.lastDrawn = { x, y: lineY };
|
|
446
|
+
|
|
447
|
+
if (!hi || col.max > hi.v) hi = { x, v: col.max };
|
|
448
|
+
if (!lo || col.min < lo.v) lo = { x, v: col.min };
|
|
449
|
+
|
|
450
|
+
if (this.crosshairX === x && series === this.series[0]) {
|
|
451
|
+
this.crosshair = { point: series.data[col.index] ?? null, x, y: lineY };
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (this.options.extremes && hi && lo && this.progress === 1 && this.crosshairX === null) {
|
|
456
|
+
this.callout(hi.x, Y(hi.v), this.options.format(hi.v), "above", plotW);
|
|
457
|
+
this.callout(lo.x, Y(lo.v), this.options.format(lo.v), "below", plotW);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (this.crosshair.point) {
|
|
462
|
+
const { x, y } = this.crosshair;
|
|
463
|
+
ctx.fillStyle = palette.ink;
|
|
464
|
+
ctx.fillRect(x, 0, 1, height);
|
|
465
|
+
ctx.fillStyle = palette.surface;
|
|
466
|
+
ctx.fillRect(x - 3, y - 3, 7, 7);
|
|
467
|
+
ctx.fillStyle = palette.ink;
|
|
468
|
+
ctx.fillRect(x - 2, y - 2, 5, 5);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
private strokeBox(x: number, y: number, w: number, h: number, color: string): void {
|
|
473
|
+
const { ctx } = this;
|
|
474
|
+
ctx.fillStyle = color;
|
|
475
|
+
ctx.fillRect(x, y, w, 1);
|
|
476
|
+
ctx.fillRect(x, y + h - 1, w, 1);
|
|
477
|
+
ctx.fillRect(x, y, 1, h);
|
|
478
|
+
ctx.fillRect(x + w - 1, y, 1, h);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private callout(x: number, y: number, text: string, side: "above" | "below", plotW: number): void {
|
|
482
|
+
const { ctx, palette, height } = this;
|
|
483
|
+
const { unit } = this.options;
|
|
484
|
+
ctx.font = this.font(10);
|
|
485
|
+
const w = Math.ceil(ctx.measureText(text).width) + 9;
|
|
486
|
+
const h = unit - 4;
|
|
487
|
+
const boxX = Math.max(0, Math.min(plotW - w, Math.round(x - w / 2)));
|
|
488
|
+
let row = side === "above" ? Math.floor(y / unit) - 1 : Math.ceil(y / unit);
|
|
489
|
+
row = Math.max(0, Math.min(Math.floor(height / unit) - 1, row));
|
|
490
|
+
const boxY = row * unit + 2;
|
|
491
|
+
ctx.fillStyle = palette.surface;
|
|
492
|
+
ctx.fillRect(boxX, boxY, w, h);
|
|
493
|
+
this.strokeBox(boxX, boxY, w, h, palette.ink);
|
|
494
|
+
const tickTop = side === "above" ? boxY + h : y + 3;
|
|
495
|
+
const tickBottom = side === "above" ? y - 3 : boxY;
|
|
496
|
+
if (tickBottom > tickTop) {
|
|
497
|
+
ctx.fillStyle = palette.ink;
|
|
498
|
+
ctx.fillRect(x, tickTop, 1, tickBottom - tickTop);
|
|
499
|
+
}
|
|
500
|
+
ctx.fillStyle = palette.ink;
|
|
501
|
+
ctx.textAlign = "center";
|
|
502
|
+
ctx.textBaseline = "middle";
|
|
503
|
+
ctx.fillText(text, boxX + w / 2, boxY + h / 2 + 0.5);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export function createChart(canvas: HTMLCanvasElement, options?: ChartOptions): GridChart {
|
|
508
|
+
return new GridChart(canvas, options);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** A one-row sparkline: the same column renderer, scaled to its cell. */
|
|
512
|
+
export function drawSparkline(
|
|
513
|
+
canvas: HTMLCanvasElement,
|
|
514
|
+
values: number[],
|
|
515
|
+
options: { width: number; height: number; color: string; base?: number; faint?: string },
|
|
516
|
+
): void {
|
|
517
|
+
const { width, height, color } = options;
|
|
518
|
+
const dpr = window.devicePixelRatio || 1;
|
|
519
|
+
canvas.width = Math.round(width * dpr);
|
|
520
|
+
canvas.height = Math.round(height * dpr);
|
|
521
|
+
canvas.style.width = `${width}px`;
|
|
522
|
+
canvas.style.height = `${height}px`;
|
|
523
|
+
const ctx = canvas.getContext("2d");
|
|
524
|
+
if (!ctx || values.length < 2) return;
|
|
525
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
526
|
+
ctx.clearRect(0, 0, width, height);
|
|
527
|
+
let min = Math.min(...values);
|
|
528
|
+
let max = Math.max(...values);
|
|
529
|
+
if (options.base !== undefined) {
|
|
530
|
+
min = Math.min(min, options.base);
|
|
531
|
+
max = Math.max(max, options.base);
|
|
532
|
+
}
|
|
533
|
+
const span = max - min || 1;
|
|
534
|
+
const usable = height - 5;
|
|
535
|
+
const Y = (v: number) => Math.round(2 + (1 - (v - min) / span) * usable);
|
|
536
|
+
if (options.base !== undefined && options.faint) {
|
|
537
|
+
ctx.fillStyle = options.faint;
|
|
538
|
+
const by = Y(options.base);
|
|
539
|
+
for (let x = 0; x < width; x += 4) ctx.fillRect(x, by, 2, 1);
|
|
540
|
+
}
|
|
541
|
+
ctx.fillStyle = color;
|
|
542
|
+
let prev: number | null = null;
|
|
543
|
+
for (let x = 0; x < width - 3; x++) {
|
|
544
|
+
const pos = (x / (width - 4)) * (values.length - 1);
|
|
545
|
+
const i = Math.floor(pos);
|
|
546
|
+
const next = values[Math.min(values.length - 1, i + 1)];
|
|
547
|
+
const v = values[i] + (next - values[i]) * (pos - i);
|
|
548
|
+
const y = Y(v);
|
|
549
|
+
const a = prev ?? y;
|
|
550
|
+
ctx.fillRect(x, Math.min(a, y), 1, Math.abs(a - y) + 1);
|
|
551
|
+
prev = y;
|
|
552
|
+
}
|
|
553
|
+
if (prev !== null) ctx.fillRect(width - 3, prev - 1, 3, 3);
|
|
554
|
+
}
|
package/DS1/2-core/ds-avatar.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { LitElement, html, nothing, unsafeCSS, type PropertyValues } from "lit";
|
|
|
2
2
|
import { styleMap } from "lit/directives/style-map.js";
|
|
3
3
|
import { keyed } from "lit/directives/keyed.js";
|
|
4
4
|
import { define } from "../0-face/define";
|
|
5
|
-
import "./ds-icon";
|
|
5
|
+
import { provideIcons } from "./ds-icon";
|
|
6
|
+
import { avatarIcon } from "./generated/icon-avatar";
|
|
6
7
|
import styles from "./styles/ds-avatar.css?inline";
|
|
7
8
|
|
|
9
|
+
// The person drawing (`icon="avatar"`) comes with the avatar, so it draws in
|
|
10
|
+
// the first frame instead of the initial while the deferred icons load.
|
|
11
|
+
provideIcons({ avatar: avatarIcon });
|
|
12
|
+
|
|
8
13
|
/** Saved identity colours are hex; their ink must stay legible in either theme. */
|
|
9
14
|
export function avatarInk(color: string): string | undefined {
|
|
10
15
|
const match = /^#([a-f\d]{6}|[a-f\d]{3})$/i.exec(color);
|
|
@@ -17,7 +22,14 @@ export function avatarInk(color: string): string | undefined {
|
|
|
17
22
|
return luminance > 0.22 ? "var(--ds-black)" : "var(--ds-white)";
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* A person's or workspace's mark, one control high and round by default;
|
|
27
|
+
* `shape="square"` gives it a picture's corners (`--ds-avatar-radius`, the
|
|
28
|
+
* shared corner by default). Two ways to colour it: `color` fills it, `ink`
|
|
29
|
+
* letters and outlines it on the neutral fill. Identity selection, which
|
|
30
|
+
* identities are square, and actions belong to the app. `logo` is a brand
|
|
31
|
+
* mark in its image area, unclipped and with no corners at all.
|
|
32
|
+
*/
|
|
21
33
|
export class Avatar extends LitElement {
|
|
22
34
|
static properties = {
|
|
23
35
|
label: { type: String },
|
|
@@ -25,6 +37,8 @@ export class Avatar extends LitElement {
|
|
|
25
37
|
src: { type: String },
|
|
26
38
|
icon: { type: String },
|
|
27
39
|
color: { type: String },
|
|
40
|
+
ink: { type: String },
|
|
41
|
+
logo: { type: Boolean, reflect: true },
|
|
28
42
|
shape: { type: String, reflect: true },
|
|
29
43
|
size: { type: String, reflect: true },
|
|
30
44
|
fit: { type: String, reflect: true },
|
|
@@ -40,7 +54,11 @@ export class Avatar extends LitElement {
|
|
|
40
54
|
declare src: string;
|
|
41
55
|
declare icon: string;
|
|
42
56
|
declare color: string;
|
|
43
|
-
declare
|
|
57
|
+
declare ink: string;
|
|
58
|
+
declare logo: boolean;
|
|
59
|
+
/** `round` is the default; `square` takes a picture's corners. */
|
|
60
|
+
declare shape: "round" | "square";
|
|
61
|
+
/** `compact` is the default size, kept for products that still name it. */
|
|
44
62
|
declare size: "default" | "compact" | "large" | "fill";
|
|
45
63
|
declare fit: "cover" | "contain";
|
|
46
64
|
declare mask: boolean;
|
|
@@ -57,10 +75,11 @@ export class Avatar extends LitElement {
|
|
|
57
75
|
this.src = "";
|
|
58
76
|
this.icon = "";
|
|
59
77
|
this.color = "";
|
|
60
|
-
this.
|
|
78
|
+
this.ink = "";
|
|
79
|
+
this.shape = "round";
|
|
61
80
|
this.size = "default";
|
|
62
81
|
this.fit = "cover";
|
|
63
|
-
this.mask = this.outlined = this.pending = this.plain = this.loaded = this.failed = false;
|
|
82
|
+
this.logo = this.mask = this.outlined = this.pending = this.plain = this.loaded = this.failed = false;
|
|
64
83
|
}
|
|
65
84
|
protected willUpdate(changed: PropertyValues<this>) {
|
|
66
85
|
if (changed.has("src")) {
|
|
@@ -81,7 +100,7 @@ export class Avatar extends LitElement {
|
|
|
81
100
|
>`;
|
|
82
101
|
return html`<span
|
|
83
102
|
class="frame"
|
|
84
|
-
style=${styleMap({ backgroundColor: !this.pending && !this.plain ? this.color || undefined : undefined, color: !this.pending ? avatarInk(this.color) : undefined })}
|
|
103
|
+
style=${styleMap({ backgroundColor: !this.pending && !this.plain ? this.color || undefined : undefined, color: !this.pending ? this.ink || avatarInk(this.color) : undefined })}
|
|
85
104
|
role=${this.label ? "img" : nothing}
|
|
86
105
|
aria-label=${this.label || nothing}
|
|
87
106
|
aria-hidden=${this.label ? nothing : "true"}
|
package/DS1/2-core/ds-badge.ts
CHANGED
|
@@ -20,7 +20,7 @@ export class Badge extends LitElement {
|
|
|
20
20
|
|
|
21
21
|
connectedCallback() {
|
|
22
22
|
super.connectedCallback();
|
|
23
|
-
this.updateComplete.then(() => {
|
|
23
|
+
void this.updateComplete.then(() => {
|
|
24
24
|
if (!this.isConnected) return;
|
|
25
25
|
this.contentObserver?.disconnect();
|
|
26
26
|
this.contentObserver = new MutationObserver(this.scheduleMeasure);
|
|
@@ -31,7 +31,7 @@ export class Badge extends LitElement {
|
|
|
31
31
|
this.observer.observe(this);
|
|
32
32
|
this.observer.observe(this.shadowRoot!.querySelector(".label")!);
|
|
33
33
|
}
|
|
34
|
-
document.fonts?.ready.then(this.scheduleMeasure);
|
|
34
|
+
void document.fonts?.ready.then(this.scheduleMeasure);
|
|
35
35
|
document.fonts?.addEventListener("loadingdone", this.scheduleMeasure);
|
|
36
36
|
this.scheduleMeasure();
|
|
37
37
|
});
|
|
@@ -52,16 +52,16 @@ export class Badge extends LitElement {
|
|
|
52
52
|
this.measureFrame = requestAnimationFrame(() => {
|
|
53
53
|
this.measureFrame = 0;
|
|
54
54
|
const frame = this.shadowRoot!.querySelector<HTMLElement>(".frame")!;
|
|
55
|
-
|
|
55
|
+
frame.style.removeProperty("width");
|
|
56
|
+
if (this.iconOnly && this.icon) return;
|
|
56
57
|
const unit = frame.getBoundingClientRect().height;
|
|
57
58
|
if (!unit) return;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (frame.style.width !== width) frame.style.width = width;
|
|
59
|
+
// Unset, the frame hugs its icon, words and padding at their fractional
|
|
60
|
+
// width, as the native class's max-content does; round that up to whole
|
|
61
|
+
// squares. (A label's scrollWidth is a whole pixel rounded to nearest:
|
|
62
|
+
// "Done" at 32.3px read as 32 and was cut short in a 40px badge.)
|
|
63
|
+
const natural = frame.getBoundingClientRect().width;
|
|
64
|
+
frame.style.width = `${Math.max(1, Math.ceil(natural / unit)) * unit}px`;
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
|