@esportsplus/ui 0.51.7 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -9
- package/build/components/accordion/index.d.ts +6 -18
- package/build/components/accordion/index.js +10 -36
- package/build/components/accordion/scss/index.scss +1 -1
- package/build/components/anchor/scss/index.scss +1 -1
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/checkbox/index.d.ts +12 -12
- package/build/components/checkbox/index.js +63 -31
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/checkbox/svg/check.svg +1 -0
- package/build/components/clipboard/copy.d.ts +11 -0
- package/build/components/clipboard/copy.js +49 -0
- package/build/components/clipboard/index.d.ts +1437 -1228
- package/build/components/clipboard/index.js +3 -1
- package/build/components/clipboard/onclick.d.ts +4 -38
- package/build/components/clipboard/onclick.js +10 -10
- package/build/components/counter/index.js +58 -66
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/form/action.js +8 -8
- package/build/components/form/index.d.ts +4 -4
- package/build/components/form/input.d.ts +4 -4
- package/build/components/form/input.js +3 -3
- package/build/components/grid/scss/index.scss +1 -1
- package/build/components/icon/index.d.ts +2 -19
- package/build/components/icon/index.js +8 -8
- package/build/components/icon/scss/index.scss +1 -1
- package/build/components/index.d.ts +1 -11
- package/build/components/index.js +1 -11
- package/build/components/input/index.d.ts +1 -1
- package/build/components/input/index.js +11 -11
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/loading/index.js +5 -5
- package/build/components/modal/scss/index.scss +1 -1
- package/build/components/normalize/scss/index.scss +1 -1
- package/build/components/overlay/index.d.ts +2 -18
- package/build/components/overlay/index.js +11 -5
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/page/scss/index.scss +1 -1
- package/build/components/radio/index.d.ts +1436 -4
- package/build/components/radio/index.js +0 -1
- package/build/components/range/index.d.ts +1 -1
- package/build/components/range/index.js +13 -13
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/select/index.d.ts +7 -53
- package/build/components/select/index.js +82 -100
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/sidebar/index.d.ts +2 -18
- package/build/components/sidebar/index.js +11 -5
- package/build/components/sidebar/scss/index.scss +1 -1
- package/build/components/switch/index.d.ts +1436 -4
- package/build/components/switch/index.js +0 -1
- package/build/components/tabs/scss/index.scss +2 -0
- package/build/components/text/scss/index.scss +1 -1
- package/build/components/textarea/index.d.ts +719 -6
- package/build/components/textarea/index.js +37 -15
- package/build/components/textarea/scss/index.scss +1 -1
- package/build/components/toast/index.d.ts +9 -0
- package/build/components/toast/index.js +157 -0
- package/build/components/toast/manager.d.ts +60 -0
- package/build/components/toast/manager.js +203 -0
- package/build/components/toast/scss/index.scss +2 -0
- package/build/components/toast/svg/check.svg +1 -0
- package/build/components/toast/svg/chevron.svg +1 -0
- package/build/components/toast/svg/close.svg +1 -0
- package/build/components/toast/svg/copy.svg +1 -0
- package/build/components/toast/svg/error.svg +1 -0
- package/build/components/toast/svg/info.svg +1 -0
- package/build/components/toast/svg/loading.svg +1 -0
- package/build/components/toast/svg/success.svg +1 -0
- package/build/components/toast/svg/warning.svg +1 -0
- package/build/components/tooltip/index.d.ts +2151 -2544
- package/build/components/tooltip/menu.d.ts +2 -18
- package/build/components/tooltip/menu.js +38 -24
- package/build/components/tooltip/onclick.d.ts +717 -1229
- package/build/components/tooltip/onclick.js +18 -54
- package/build/components/tooltip/onhover.d.ts +713 -20
- package/build/components/tooltip/onhover.js +11 -11
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/typewriter/index.d.ts +2 -19
- package/build/components/typewriter/index.js +10 -10
- package/build/css-utilities/background/scss/index.scss +1 -1
- package/build/css-utilities/border/scss/index.scss +1 -1
- package/build/css-utilities/color/scss/index.scss +1 -1
- package/build/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
- package/build/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
- package/build/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
- package/build/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
- package/build/css-utilities/font/geist/scss/index.scss +2 -0
- package/build/css-utilities/font/montserrat/index.d.ts +1 -0
- package/build/css-utilities/font/montserrat/index.js +1 -0
- package/build/css-utilities/font/montserrat/scss/index.scss +2 -0
- package/build/css-utilities/index.scss +1 -1
- package/build/css-utilities/inline/scss/index.scss +1 -1
- package/build/css-utilities/scrollbar/scss/index.scss +2 -0
- package/build/css-utilities/tabular/scss/index.scss +2 -0
- package/build/css-utilities/text/scss/index.scss +1 -1
- package/build/themes/dark/index.d.ts +0 -2
- package/build/themes/dark/index.js +0 -2
- package/build/themes/dark/input.d.ts +708 -114
- package/build/themes/dark/select.d.ts +732 -1456
- package/build/themes/dark/select.js +7 -5
- package/build/themes/dark/textarea.d.ts +716 -119
- package/package.json +20 -20
- package/pnpm-workspace.yaml +12 -8
- package/scripts/css-variables.test.mjs +50 -0
- package/scripts/sort-scss.md +57 -0
- package/scripts/sort-scss.mjs +233 -0
- package/scripts/sort-scss.test.mjs +217 -0
- package/src/components/accordion/index.ts +7 -30
- package/src/components/accordion/scss/index.scss +9 -12
- package/src/components/anchor/scss/index.scss +2 -2
- package/src/components/button/scss/index.scss +23 -57
- package/src/components/button/scss/variables.scss +1 -19
- package/src/components/card/scss/index.scss +11 -46
- package/src/components/card/scss/variables.scss +1 -2
- package/src/components/checkbox/index.ts +27 -26
- package/src/components/checkbox/scss/index.scss +86 -28
- package/src/components/checkbox/scss/variables.scss +71 -30
- package/src/components/checkbox/svg/check.svg +1 -0
- package/src/components/clipboard/copy.ts +60 -0
- package/src/components/clipboard/index.ts +3 -1
- package/src/components/clipboard/onclick.ts +3 -4
- package/src/components/counter/index.ts +57 -57
- package/src/components/counter/scss/index.scss +4 -5
- package/src/components/counter/scss/variables.scss +0 -1
- package/src/components/form/input.ts +6 -5
- package/src/components/grid/scss/index.scss +1 -1
- package/src/components/icon/index.ts +2 -3
- package/src/components/icon/scss/variables.scss +0 -1
- package/src/components/index.ts +2 -12
- package/src/components/input/index.ts +1 -1
- package/src/components/input/scss/index.scss +8 -7
- package/src/components/input/scss/variables.scss +0 -1
- package/src/components/link/scss/index.scss +9 -34
- package/src/components/link/scss/variables.scss +0 -12
- package/src/components/modal/scss/index.scss +4 -4
- package/src/components/normalize/scss/index.scss +0 -1
- package/src/components/overlay/index.ts +9 -5
- package/src/components/overlay/scss/index.scss +0 -1
- package/src/components/page/scss/index.scss +1 -7
- package/src/components/page/scss/variables.scss +0 -2
- package/src/components/radio/index.ts +0 -1
- package/src/components/range/index.ts +1 -1
- package/src/components/range/scss/index.scss +5 -5
- package/src/components/root/scss/index.scss +44 -39
- package/src/components/root/scss/variables.scss +38 -69
- package/src/components/select/index.ts +80 -109
- package/src/components/select/scss/index.scss +10 -7
- package/src/components/select/scss/variables.scss +0 -1
- package/src/components/sidebar/index.ts +9 -5
- package/src/components/sidebar/scss/index.scss +3 -4
- package/src/components/switch/index.ts +1 -2
- package/src/components/tabs/scss/index.scss +62 -0
- package/src/components/tabs/scss/variables.scss +4 -0
- package/src/components/text/scss/index.scss +8 -1
- package/src/components/text/scss/variables.scss +5 -3
- package/src/components/textarea/index.ts +38 -5
- package/src/components/textarea/scss/index.scss +24 -13
- package/src/components/textarea/scss/variables.scss +0 -1
- package/src/components/toast/index.ts +188 -0
- package/src/components/toast/manager.ts +312 -0
- package/src/components/toast/scss/index.scss +276 -0
- package/src/components/toast/scss/variables.scss +19 -0
- package/src/components/toast/svg/check.svg +1 -0
- package/src/components/toast/svg/chevron.svg +1 -0
- package/src/components/toast/svg/close.svg +1 -0
- package/src/components/toast/svg/copy.svg +1 -0
- package/src/components/toast/svg/error.svg +1 -0
- package/src/components/toast/svg/info.svg +1 -0
- package/src/components/toast/svg/loading.svg +1 -0
- package/src/components/toast/svg/success.svg +1 -0
- package/src/components/toast/svg/warning.svg +1 -0
- package/src/components/tooltip/menu.ts +8 -4
- package/src/components/tooltip/onclick.ts +13 -70
- package/src/components/tooltip/onhover.ts +2 -3
- package/src/components/tooltip/scss/index.scss +2 -3
- package/src/components/typewriter/index.ts +2 -3
- package/src/css-utilities/background/scss/variables.scss +2 -2
- package/src/css-utilities/border/scss/index.scss +1 -27
- package/src/css-utilities/border/scss/variables.scss +3 -34
- package/src/css-utilities/color/scss/variables.scss +2 -6
- package/src/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
- package/src/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
- package/src/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
- package/src/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
- package/src/css-utilities/font/geist/scss/index.scss +55 -0
- package/src/css-utilities/font/montserrat/index.ts +1 -0
- package/src/{fonts → css-utilities/font}/montserrat/scss/index.scss +15 -0
- package/src/css-utilities/index.scss +7 -12
- package/src/css-utilities/inline/scss/index.scss +0 -1
- package/src/css-utilities/scrollbar/scss/index.scss +95 -0
- package/src/css-utilities/scrollbar/scss/variables.scss +5 -0
- package/src/css-utilities/tabular/scss/index.scss +3 -0
- package/src/css-utilities/text/scss/index.scss +30 -71
- package/src/lib/scss/css-variables.scss +29 -5
- package/src/themes/dark/index.ts +0 -2
- package/src/themes/dark/select.ts +7 -5
- package/src/tokens/index.scss +1 -3
- package/src/tokens/scss/border-radius.scss +1 -6
- package/src/tokens/scss/color.scss +14 -14
- package/src/tokens/scss/font-size.scss +12 -11
- package/src/tokens/scss/scale.scss +22 -0
- package/src/tokens/scss/size.scss +19 -9
- package/src/tokens/scss/spacer.scss +9 -9
- package/src/tokens/scss/transition.scss +4 -0
- package/storage/svg/arrow-left.svg +1 -0
- package/storage/svg/arrow-right.svg +1 -0
- package/storage/svg/bolt.svg +1 -0
- package/storage/svg/book.svg +1 -0
- package/storage/svg/cube.svg +1 -0
- package/storage/svg/github.svg +1 -0
- package/storage/svg/info.svg +1 -0
- package/storage/svg/palette.svg +1 -0
- package/storage/svg/search.svg +2 -0
- package/storage/svg/star.svg +1 -0
- package/storage/svg/type.svg +1 -0
- package/tsconfig.json +6 -2
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +78 -72
- package/build/components/alert/index.d.ts +0 -19
- package/build/components/alert/index.js +0 -151
- package/build/components/alert/scss/index.scss +0 -2
- package/build/components/alert/svg/check.svg +0 -11
- package/build/components/alert/svg/close.svg +0 -12
- package/build/components/alert/svg/error.svg +0 -18
- package/build/components/back/index.d.ts +0 -18
- package/build/components/back/index.js +0 -16
- package/build/components/back/scss/index.scss +0 -2
- package/build/components/back/svg/arrow.svg +0 -15
- package/build/components/bubble/scss/index.scss +0 -2
- package/build/components/button/index.d.ts +0 -103
- package/build/components/button/index.js +0 -60
- package/build/components/ellipsis/index.d.ts +0 -4
- package/build/components/ellipsis/index.js +0 -8
- package/build/components/ellipsis/scss/index.scss +0 -2
- package/build/components/frame/index.d.ts +0 -20
- package/build/components/frame/index.js +0 -7
- package/build/components/frame/scss/index.scss +0 -2
- package/build/components/highlight/index.d.ts +0 -22
- package/build/components/highlight/index.js +0 -56
- package/build/components/highlight/scss/index.scss +0 -2
- package/build/components/loader/index.d.ts +0 -22
- package/build/components/loader/index.js +0 -78
- package/build/components/loader/scss/index.scss +0 -2
- package/build/components/radio/scss/index.scss +0 -2
- package/build/components/root/index.d.ts +0 -7
- package/build/components/root/index.js +0 -4
- package/build/components/root/onclick.d.ts +0 -5
- package/build/components/root/onclick.js +0 -12
- package/build/components/scrollbar/index.d.ts +0 -27
- package/build/components/scrollbar/index.js +0 -56
- package/build/components/scrollbar/scss/index.scss +0 -2
- package/build/components/site/index.d.ts +0 -20
- package/build/components/site/index.js +0 -9
- package/build/components/site/scss/index.scss +0 -2
- package/build/components/switch/scss/index.scss +0 -2
- package/build/components/template/index.d.ts +0 -14
- package/build/components/template/index.js +0 -21
- package/build/css-utilities/[margin,padding]/scss/index.scss +0 -2
- package/build/css-utilities/error/scss/index.scss +0 -2
- package/build/css-utilities/flicker/scss/index.scss +0 -2
- package/build/css-utilities/focus/scss/index.scss +0 -2
- package/build/css-utilities/gap/scss/index.scss +0 -2
- package/build/css-utilities/line-height/scss/index.scss +0 -2
- package/build/css-utilities/pointer/scss/index.scss +0 -2
- package/build/css-utilities/scroller/scss/index.scss +0 -2
- package/build/css-utilities/size/scss/index.scss +0 -2
- package/build/css-utilities/viewport/scss/index.scss +0 -2
- package/build/css-utilities/width/scss/index.scss +0 -2
- package/build/fonts/index.d.ts +0 -1
- package/build/fonts/index.js +0 -1
- package/build/fonts/montserrat/scss/index.scss +0 -2
- package/build/themes/dark/alert.d.ts +0 -11
- package/build/themes/dark/alert.js +0 -20
- package/build/themes/dark/back.d.ts +0 -15
- package/build/themes/dark/back.js +0 -7
- package/build/themes/dark/button/scss/index.scss +0 -2
- package/build/themes/dark/link/scss/index.scss +0 -2
- package/src/components/accordion/scss/variables.scss +0 -9
- package/src/components/alert/index.ts +0 -165
- package/src/components/alert/scss/index.scss +0 -25
- package/src/components/alert/scss/variables.scss +0 -3
- package/src/components/alert/svg/check.svg +0 -11
- package/src/components/alert/svg/close.svg +0 -12
- package/src/components/alert/svg/error.svg +0 -18
- package/src/components/back/index.ts +0 -21
- package/src/components/back/scss/index.scss +0 -17
- package/src/components/back/svg/arrow.svg +0 -15
- package/src/components/bubble/scss/index.scss +0 -32
- package/src/components/bubble/scss/variables.scss +0 -20
- package/src/components/button/index.ts +0 -54
- package/src/components/ellipsis/index.ts +0 -11
- package/src/components/ellipsis/scss/index.scss +0 -30
- package/src/components/ellipsis/scss/variables.scss +0 -5
- package/src/components/frame/index.ts +0 -9
- package/src/components/frame/scss/index.scss +0 -39
- package/src/components/frame/scss/variables.scss +0 -4
- package/src/components/highlight/index.ts +0 -67
- package/src/components/highlight/scss/index.scss +0 -7
- package/src/components/highlight/scss/variables.scss +0 -4
- package/src/components/loader/index.ts +0 -81
- package/src/components/loader/scss/index.scss +0 -71
- package/src/components/loader/scss/variables.scss +0 -6
- package/src/components/radio/scss/index.scss +0 -50
- package/src/components/radio/scss/variables.scss +0 -67
- package/src/components/root/index.ts +0 -6
- package/src/components/root/onclick.ts +0 -20
- package/src/components/scrollbar/index.ts +0 -70
- package/src/components/scrollbar/scss/index.scss +0 -82
- package/src/components/scrollbar/scss/variables.scss +0 -6
- package/src/components/site/index.ts +0 -11
- package/src/components/site/scss/index.scss +0 -3
- package/src/components/switch/scss/index.scss +0 -48
- package/src/components/switch/scss/variables.scss +0 -74
- package/src/components/template/index.ts +0 -40
- package/src/css-utilities/[margin,padding]/scss/index.scss +0 -43
- package/src/css-utilities/[margin,padding]/scss/variables.scss +0 -54
- package/src/css-utilities/error/scss/index.scss +0 -24
- package/src/css-utilities/error/scss/variables.scss +0 -3
- package/src/css-utilities/flicker/scss/index.scss +0 -15
- package/src/css-utilities/flicker/scss/variables.scss +0 -5
- package/src/css-utilities/focus/scss/index.scss +0 -7
- package/src/css-utilities/focus/scss/variables.scss +0 -5
- package/src/css-utilities/gap/scss/index.scss +0 -13
- package/src/css-utilities/gap/scss/variables.scss +0 -39
- package/src/css-utilities/line-height/scss/index.scss +0 -1
- package/src/css-utilities/line-height/scss/variables.scss +0 -10
- package/src/css-utilities/pointer/scss/index.scss +0 -5
- package/src/css-utilities/scroller/scss/index.scss +0 -8
- package/src/css-utilities/scroller/scss/variables.scss +0 -4
- package/src/css-utilities/size/scss/index.scss +0 -1
- package/src/css-utilities/size/scss/variables.scss +0 -12
- package/src/css-utilities/text/scss/variables.scss +0 -31
- package/src/css-utilities/viewport/scss/index.scss +0 -5
- package/src/css-utilities/width/scss/index.scss +0 -5
- package/src/css-utilities/width/scss/variables.scss +0 -9
- package/src/fonts/index.ts +0 -1
- package/src/themes/dark/alert.ts +0 -23
- package/src/themes/dark/back.ts +0 -9
- package/src/themes/dark/button/scss/index.scss +0 -46
- package/src/themes/dark/link/scss/index.scss +0 -26
- package/src/tokens/scss/font-weight.scss +0 -6
- package/src/tokens/scss/line-height.scss +0 -6
- package/src/tokens/scss/transition-duration.scss +0 -1
- /package/build/{fonts/montserrat → css-utilities/font/geist}/index.d.ts +0 -0
- /package/build/{fonts/montserrat → css-utilities/font/geist}/index.js +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
- /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
- /package/src/{fonts/montserrat → css-utilities/font/geist}/index.ts +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
- /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as template_u0 from '@esportsplus/template';
|
|
2
|
+
import { component } from '@esportsplus/template';
|
|
2
3
|
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
3
4
|
import { omit } from '@esportsplus/utilities';
|
|
4
5
|
import form from '../form/index.js';
|
|
5
6
|
import './scss/index.scss';
|
|
6
|
-
const
|
|
7
|
+
const template_u22 = template_u0.template(`<textarea class='textarea' >`);
|
|
7
8
|
class ReactiveObject_1x5yfkx0 extends reactivity_u0.ReactiveObject {
|
|
8
9
|
#active = this[reactivity_u0.SIGNAL](false);
|
|
9
10
|
#error = this[reactivity_u0.SIGNAL]('');
|
|
@@ -23,23 +24,44 @@ class ReactiveObject_1x5yfkx0 extends reactivity_u0.ReactiveObject {
|
|
|
23
24
|
reactivity_u0.write(this.#error, _v1);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
const OMIT = ['state'];
|
|
27
|
-
|
|
27
|
+
const OMIT = ['autoresize', 'state'];
|
|
28
|
+
function autoresize({ height }) {
|
|
29
|
+
let attributes = {
|
|
30
|
+
class: 'textarea--autoresize',
|
|
31
|
+
style: `
|
|
32
|
+
--max-height: ${height.max};
|
|
33
|
+
--min-height: ${height.min};
|
|
34
|
+
`
|
|
35
|
+
};
|
|
36
|
+
if (CSS.supports('field-sizing', 'content')) {
|
|
37
|
+
return attributes;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...attributes,
|
|
41
|
+
class: `${attributes.class} textarea--autoresize-fallback`,
|
|
42
|
+
oninput: (e) => {
|
|
43
|
+
let element = e.target;
|
|
44
|
+
element.style.setProperty('--content-height', '0px');
|
|
45
|
+
element.style.setProperty('--content-height', `${element.scrollHeight}px`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export default component(function (attributes) {
|
|
28
50
|
let state = attributes.state || new ReactiveObject_1x5yfkx0();
|
|
29
51
|
return (() => {
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
let root_u21 = template_u22(), element_u23 = root_u21.firstChild;
|
|
53
|
+
template_u0.setProperties(element_u23, this?.attributes && omit(this.attributes, OMIT));
|
|
54
|
+
template_u0.setProperties(element_u23, omit(attributes, OMIT));
|
|
55
|
+
template_u0.setProperties(element_u23, attributes.autoresize && autoresize(attributes.autoresize));
|
|
56
|
+
template_u0.setList(element_u23, 'class', () => state.active && '--active');
|
|
57
|
+
template_u0.on(element_u23, 'focusin', () => {
|
|
35
58
|
state.active = true;
|
|
36
59
|
});
|
|
37
|
-
|
|
60
|
+
template_u0.on(element_u23, 'focusout', () => {
|
|
38
61
|
state.active = false;
|
|
39
62
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return
|
|
63
|
+
template_u0.onrender(element_u23, form.input.onrender(state));
|
|
64
|
+
template_u0.setProperty(element_u23, 'value', attributes?.value || '');
|
|
65
|
+
return root_u21;
|
|
43
66
|
})();
|
|
44
|
-
}
|
|
45
|
-
;
|
|
67
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@layer components {.textarea{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:var(--border-radius-400);--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--color:var(--color-default);--color-active:var(--color-default);--color-default:var(--color-text-400);--color-hover:var(--color-default);--color-pressed:var(--color-default);--font-size:var(--font-size-400);--
|
|
1
|
+
@layer components {.textarea{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:var(--border-radius-400);--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--color:var(--color-default);--color-active:var(--color-default);--color-default:var(--color-text-400);--color-hover:var(--color-default);--color-pressed:var(--color-default);--font-size:var(--font-size-400);--padding-horizontal:var(--size-400);--padding-vertical:var(--size-400);--size:var(--size-400)}.textarea:not(.--active):not(.--active):hover{--background:var(--background-hover);--border-color:var(--border-color-hover);--box-shadow:var(--box-shadow-hover);--color:var(--color-hover)}.textarea:not(.--active):not(.--active):active{--background:var(--background-pressed);--border-color:var(--border-color-pressed);--box-shadow:var(--box-shadow-pressed);--color:var(--color-pressed)}.textarea.--active{--background:var(--background-active);--border-color:var(--border-color-active);--box-shadow:var(--box-shadow-active);--color:var(--color-active)}.textarea{background:var(--background);border:var(--border-width) var(--border-style) var(--border-color);border-radius:var(--border-radius);color:var(--color);cursor:text;font-size:var(--font-size);min-width:0;padding:max(0px, var(--padding-vertical) - var(--border-width)) max(0px, var(--padding-horizontal) - var(--border-width));transition:background var(--transition-duration) var(--transition-timing-function), border-color var(--transition-duration) var(--transition-timing-function), box-shadow var(--transition-duration) var(--transition-timing-function), opacity var(--transition-duration) var(--transition-timing-function), transform var(--transition-duration) var(--transition-timing-function);flex:auto;width:100%;position:relative}.textarea:invalid,.textarea:required{box-shadow:none}.textarea--autoresize{field-sizing:content;height:auto;max-height:var(--max-height);min-height:var(--min-height);resize:none;overflow-y:auto}.textarea--autoresize-fallback{box-sizing:border-box;height:calc(var(--content-height,var(--min-height)) + 2 * var(--border-width))}}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { remove, toast } from './manager.js';
|
|
2
|
+
import './scss/index.scss';
|
|
3
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
|
|
4
|
+
declare const toaster: (options?: {
|
|
5
|
+
position?: Position;
|
|
6
|
+
}) => DocumentFragment | Text;
|
|
7
|
+
export default toaster;
|
|
8
|
+
export { remove, toast };
|
|
9
|
+
export type { Position };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as template_u0 from '@esportsplus/template';
|
|
2
|
+
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
3
|
+
import clipboard from '../clipboard/index.js';
|
|
4
|
+
import icon from '../icon/index.js';
|
|
5
|
+
import { buildVisibleToastLayout, remove, state, toast } from './manager.js';
|
|
6
|
+
import { toasts } from './manager.js';
|
|
7
|
+
import check from './svg/check.svg';
|
|
8
|
+
import close from './svg/close.svg';
|
|
9
|
+
import copy from './svg/copy.svg';
|
|
10
|
+
import error from './svg/error.svg';
|
|
11
|
+
import info from './svg/info.svg';
|
|
12
|
+
import loading from './svg/loading.svg';
|
|
13
|
+
import success from './svg/success.svg';
|
|
14
|
+
import warning from './svg/warning.svg';
|
|
15
|
+
import './scss/index.scss';
|
|
16
|
+
const template_u25 = template_u0.template(`<div class='toast-description '>`);
|
|
17
|
+
const template_u28 = template_u0.template(`<div class='toast-action button button--primary' >`);
|
|
18
|
+
const template_u2b = template_u0.template(`<button class='toast-close' aria-label='Dismiss' >`);
|
|
19
|
+
const template_u2e = template_u0.template(`<div ><div class='toast-content'><!--$--><div class='--flex-column --flex-fill'><div class='toast-title'></div></div><!--$-->`);
|
|
20
|
+
const template_u2m = template_u0.template(`<div class='toaster ' >`);
|
|
21
|
+
class ReactiveObject_1ali9cs0 extends reactivity_u0.ReactiveObject {
|
|
22
|
+
#direction = this[reactivity_u0.SIGNAL]('');
|
|
23
|
+
#x = this[reactivity_u0.SIGNAL](0);
|
|
24
|
+
#y = this[reactivity_u0.SIGNAL](0);
|
|
25
|
+
constructor() {
|
|
26
|
+
super(null);
|
|
27
|
+
}
|
|
28
|
+
get direction() {
|
|
29
|
+
return reactivity_u0.read(this.#direction);
|
|
30
|
+
}
|
|
31
|
+
set direction(_v0) {
|
|
32
|
+
reactivity_u0.write(this.#direction, _v0);
|
|
33
|
+
}
|
|
34
|
+
get x() {
|
|
35
|
+
return reactivity_u0.read(this.#x);
|
|
36
|
+
}
|
|
37
|
+
set x(_v1) {
|
|
38
|
+
reactivity_u0.write(this.#x, _v1);
|
|
39
|
+
}
|
|
40
|
+
get y() {
|
|
41
|
+
return reactivity_u0.read(this.#y);
|
|
42
|
+
}
|
|
43
|
+
set y(_v2) {
|
|
44
|
+
reactivity_u0.write(this.#y, _v2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const ICONS = { error, info, loading, success, warning };
|
|
48
|
+
const dismiss = toast.dismiss;
|
|
49
|
+
function row(toast, position) {
|
|
50
|
+
let swipe = new ReactiveObject_1ali9cs0(), horizontal = position.endsWith('left') || position.endsWith('right'), pointerId = -1, pressed = false, startX = 0, startY = 0, swiping = false, top = position.startsWith('top');
|
|
51
|
+
const finish = () => {
|
|
52
|
+
pressed = false;
|
|
53
|
+
if (!swiping) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
swiping = false;
|
|
57
|
+
if (Math.hypot(swipe.x, swipe.y) > 80) {
|
|
58
|
+
swipe.direction = Math.abs(swipe.x) > Math.abs(swipe.y)
|
|
59
|
+
? (swipe.x < 0 ? 'left' : 'right')
|
|
60
|
+
: (swipe.y < 0 ? 'up' : 'down');
|
|
61
|
+
dismiss(toast.id);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
swipe.direction = '';
|
|
65
|
+
swipe.x = 0;
|
|
66
|
+
swipe.y = 0;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return (() => {
|
|
70
|
+
let root_u2d = template_u2e(), element_u2f = root_u2d.firstChild, element_u2g = element_u2f.firstElementChild.firstChild, element_u2h = element_u2f.firstElementChild.firstElementChild.firstElementChild, element_u2i = element_u2f.firstElementChild.firstElementChild, element_u2j = element_u2g.nextSibling.nextSibling, element_u2k = element_u2f.firstElementChild;
|
|
71
|
+
template_u0.setList(element_u2f, 'class', () => `toast toast--${toast.type}${toast.status === 'starting' ? ' toast--starting' : toast.status === 'ending' ? ' toast--ending' : ''}${swipe.x !== 0 || swipe.y !== 0 ? ' toast--swiping' : ''}`);
|
|
72
|
+
template_u0.setList(element_u2f, 'style', () => {
|
|
73
|
+
let item = buildVisibleToastLayout([...toasts]).items.find((i) => i.toast === toast), visibleIndex = item?.visibleIndex ?? 0, offsetY = item?.offsetY ?? 0;
|
|
74
|
+
return `
|
|
75
|
+
--toast-index:${visibleIndex};
|
|
76
|
+
--toast-offset-y:${offsetY}px;
|
|
77
|
+
--toast-height:${toast.height}px;
|
|
78
|
+
--toast-swipe-x:${swipe.x}px;
|
|
79
|
+
--toast-swipe-y:${swipe.y}px;`;
|
|
80
|
+
});
|
|
81
|
+
template_u0.setProperty(element_u2f, 'data-swipe-direction', () => swipe.direction);
|
|
82
|
+
template_u0.onconnect(element_u2f, (el) => {
|
|
83
|
+
let observer = new ResizeObserver(() => { toast.height = el.offsetHeight; });
|
|
84
|
+
el.__toastObserver = observer;
|
|
85
|
+
observer.observe(el);
|
|
86
|
+
});
|
|
87
|
+
template_u0.ondisconnect(element_u2f, (el) => {
|
|
88
|
+
el.__toastObserver?.disconnect();
|
|
89
|
+
});
|
|
90
|
+
template_u0.delegate(element_u2f, 'pointerdown', (e) => {
|
|
91
|
+
pointerId = e.pointerId;
|
|
92
|
+
pressed = true;
|
|
93
|
+
startX = e.clientX;
|
|
94
|
+
startY = e.clientY;
|
|
95
|
+
});
|
|
96
|
+
template_u0.delegate(element_u2f, 'pointermove', (e) => {
|
|
97
|
+
if (!pressed) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let x = horizontal ? e.clientX - startX : 0, y = top ? Math.min(0, e.clientY - startY) : Math.max(0, e.clientY - startY);
|
|
101
|
+
if (!swiping) {
|
|
102
|
+
if (Math.hypot(x, y) < 6) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
swiping = true;
|
|
106
|
+
e.currentTarget.setPointerCapture(pointerId);
|
|
107
|
+
}
|
|
108
|
+
swipe.x = x;
|
|
109
|
+
swipe.y = y;
|
|
110
|
+
});
|
|
111
|
+
template_u0.delegate(element_u2f, 'pointerup', finish);
|
|
112
|
+
template_u0.delegate(element_u2f, 'pointercancel', finish);
|
|
113
|
+
template_u0.slot(element_u2g, toast.type !== 'message' ? icon({ class: 'toast-icon' }, ICONS[toast.type]) : '');
|
|
114
|
+
template_u0.slot(element_u2h, toast.title, 1);
|
|
115
|
+
template_u0.slot(element_u2i, toast.description && (() => {
|
|
116
|
+
let root_u24 = template_u25(), element_u26 = root_u24.firstChild;
|
|
117
|
+
template_u0.setList(element_u26, 'class', toast.type === 'error' && typeof toast.description === 'string' && toast.description.length > 180 && 'toast-description--clamp');
|
|
118
|
+
template_u0.slot(element_u26, toast.description, 1);
|
|
119
|
+
return root_u24;
|
|
120
|
+
})(), 2);
|
|
121
|
+
template_u0.slot(element_u2j, toast.type === 'error' && typeof toast.description === 'string' && clipboard.onclick({
|
|
122
|
+
class: 'toast-copy button',
|
|
123
|
+
value: String(toast.description)
|
|
124
|
+
}, (state) => icon(state.copied ? check : copy)));
|
|
125
|
+
template_u0.slot(element_u2k, toast.action && (() => {
|
|
126
|
+
let root_u27 = template_u28(), element_u29 = root_u27.firstChild;
|
|
127
|
+
template_u0.delegate(element_u29, 'click', () => {
|
|
128
|
+
toast.action?.onclick();
|
|
129
|
+
dismiss(toast.id);
|
|
130
|
+
});
|
|
131
|
+
template_u0.slot(element_u29, toast.action?.label, 1);
|
|
132
|
+
return root_u27;
|
|
133
|
+
})(), 2);
|
|
134
|
+
new template_u0.EffectSlot(element_u2f, () => toast.dismissible && (() => {
|
|
135
|
+
let root_u2a = template_u2b(), element_u2c = root_u2a.firstChild;
|
|
136
|
+
template_u0.delegate(element_u2c, 'click', () => dismiss(toast.id));
|
|
137
|
+
template_u0.slot(element_u2c, icon(close), 1);
|
|
138
|
+
return root_u2a;
|
|
139
|
+
})(), 2);
|
|
140
|
+
return root_u2d;
|
|
141
|
+
})();
|
|
142
|
+
}
|
|
143
|
+
const toaster = (options) => {
|
|
144
|
+
let position = options?.position ?? 'top-right';
|
|
145
|
+
return (() => {
|
|
146
|
+
let root_u2l = template_u2m(), element_u2n = root_u2l.firstChild;
|
|
147
|
+
template_u0.setList(element_u2n, 'class', () => state.active ? '--active' : '');
|
|
148
|
+
template_u0.setProperty(element_u2n, 'data-position', position);
|
|
149
|
+
template_u0.setList(element_u2n, 'style', () => `--toast-frontmost-height:${buildVisibleToastLayout([...toasts]).frontmostHeight}px;`);
|
|
150
|
+
template_u0.on(element_u2n, 'mouseenter', () => { state.active = true; });
|
|
151
|
+
template_u0.on(element_u2n, 'mouseleave', () => { state.active = false; });
|
|
152
|
+
element_u2n.appendChild(new template_u0.ArraySlot(toasts, (value) => row(value, position), true).fragment);
|
|
153
|
+
return root_u2l;
|
|
154
|
+
})();
|
|
155
|
+
};
|
|
156
|
+
export default toaster;
|
|
157
|
+
export { remove, toast };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
2
|
+
import { ReactiveArray } from '@esportsplus/reactivity';
|
|
3
|
+
import { type Renderable } from '@esportsplus/template';
|
|
4
|
+
declare class ReactiveObject_0ktzs5p0 extends reactivity_u0.ReactiveObject<any> {
|
|
5
|
+
#private;
|
|
6
|
+
constructor();
|
|
7
|
+
get active(): boolean;
|
|
8
|
+
set active(_v0: boolean);
|
|
9
|
+
}
|
|
10
|
+
type Action = {
|
|
11
|
+
label: string;
|
|
12
|
+
onclick: () => void;
|
|
13
|
+
};
|
|
14
|
+
type Options = {
|
|
15
|
+
action?: Action;
|
|
16
|
+
description?: Renderable<unknown> | string;
|
|
17
|
+
dismissible?: boolean;
|
|
18
|
+
duration?: number;
|
|
19
|
+
id?: string;
|
|
20
|
+
priority?: 'low' | 'high';
|
|
21
|
+
};
|
|
22
|
+
type Status = 'ending' | 'starting' | 'visible';
|
|
23
|
+
type Toast = {
|
|
24
|
+
action?: Action;
|
|
25
|
+
createdAt: number;
|
|
26
|
+
description?: Renderable<unknown> | string;
|
|
27
|
+
dismissible: boolean;
|
|
28
|
+
duration: number;
|
|
29
|
+
height: number;
|
|
30
|
+
id: string;
|
|
31
|
+
priority: 'low' | 'high';
|
|
32
|
+
status: Status;
|
|
33
|
+
title: Renderable<unknown> | string;
|
|
34
|
+
type: Type;
|
|
35
|
+
};
|
|
36
|
+
type Type = 'success' | 'error' | 'info' | 'warning' | 'loading' | 'message';
|
|
37
|
+
declare function buildVisibleToastLayout(toasts: Toast[]): {
|
|
38
|
+
frontmostHeight: number;
|
|
39
|
+
items: {
|
|
40
|
+
offsetY: number;
|
|
41
|
+
toast: Toast;
|
|
42
|
+
visibleIndex: number;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
declare function remove(id: string): void;
|
|
46
|
+
declare function update(id: string, options: Options): void;
|
|
47
|
+
declare const state: ReactiveObject_0ktzs5p0;
|
|
48
|
+
declare const toasts: ReactiveArray<Toast>;
|
|
49
|
+
declare const toast: {
|
|
50
|
+
dismiss: (id?: string) => void;
|
|
51
|
+
error: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
52
|
+
info: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
53
|
+
loading: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
54
|
+
message: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
55
|
+
success: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
56
|
+
update: typeof update;
|
|
57
|
+
warning: (title: Renderable<unknown> | string, options?: Options) => string;
|
|
58
|
+
};
|
|
59
|
+
export { buildVisibleToastLayout, remove, state, toast, toasts };
|
|
60
|
+
export type { Options, Toast, Type };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
2
|
+
import { ReactiveArray, effect } from '@esportsplus/reactivity';
|
|
3
|
+
class ReactiveObject_0ktzs5p0 extends reactivity_u0.ReactiveObject {
|
|
4
|
+
#active = this[reactivity_u0.SIGNAL](false);
|
|
5
|
+
constructor() {
|
|
6
|
+
super(null);
|
|
7
|
+
}
|
|
8
|
+
get active() {
|
|
9
|
+
return reactivity_u0.read(this.#active);
|
|
10
|
+
}
|
|
11
|
+
set active(_v0) {
|
|
12
|
+
reactivity_u0.write(this.#active, _v0);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const DURATIONS = {
|
|
16
|
+
error: 6000,
|
|
17
|
+
info: 4000,
|
|
18
|
+
loading: 0,
|
|
19
|
+
message: 4000,
|
|
20
|
+
success: 4000,
|
|
21
|
+
warning: 6000
|
|
22
|
+
};
|
|
23
|
+
const EXIT_DURATION = 300;
|
|
24
|
+
let counter = 0, paused = false, timers = new Map();
|
|
25
|
+
function buildVisibleToastLayout(toasts) {
|
|
26
|
+
let fullIndex = 0, fullOffsetY = 0, liveIndex = 0, liveOffsetY = 0, items = toasts.map((toast) => {
|
|
27
|
+
let height = normalizeToastHeight(toast.height), item;
|
|
28
|
+
if (toast.status === 'ending') {
|
|
29
|
+
item = {
|
|
30
|
+
offsetY: fullOffsetY,
|
|
31
|
+
toast,
|
|
32
|
+
visibleIndex: fullIndex
|
|
33
|
+
};
|
|
34
|
+
fullOffsetY += height;
|
|
35
|
+
fullIndex += 1;
|
|
36
|
+
return item;
|
|
37
|
+
}
|
|
38
|
+
item = {
|
|
39
|
+
offsetY: liveOffsetY,
|
|
40
|
+
toast,
|
|
41
|
+
visibleIndex: liveIndex
|
|
42
|
+
};
|
|
43
|
+
fullOffsetY += height;
|
|
44
|
+
fullIndex += 1;
|
|
45
|
+
liveOffsetY += height;
|
|
46
|
+
liveIndex += 1;
|
|
47
|
+
return item;
|
|
48
|
+
}), frontmostLiveToast = toasts.find((toast) => toast.status !== 'ending');
|
|
49
|
+
return {
|
|
50
|
+
frontmostHeight: normalizeToastHeight(frontmostLiveToast?.height),
|
|
51
|
+
items
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function clearTimer(id) {
|
|
55
|
+
let timer = timers.get(id);
|
|
56
|
+
if (!timer) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (timer.handle !== undefined) {
|
|
60
|
+
clearTimeout(timer.handle);
|
|
61
|
+
}
|
|
62
|
+
timers.delete(id);
|
|
63
|
+
}
|
|
64
|
+
function create(type, title, options = {}) {
|
|
65
|
+
let id = options.id ?? `toast-${++counter}`, toast = reactivity_u0.reactive({
|
|
66
|
+
action: options.action,
|
|
67
|
+
createdAt: Date.now(),
|
|
68
|
+
description: options.description,
|
|
69
|
+
dismissible: options.dismissible ?? true,
|
|
70
|
+
duration: options.duration ?? DURATIONS[type],
|
|
71
|
+
height: 0,
|
|
72
|
+
id,
|
|
73
|
+
priority: options.priority ?? 'low',
|
|
74
|
+
status: 'starting',
|
|
75
|
+
title,
|
|
76
|
+
type
|
|
77
|
+
});
|
|
78
|
+
toasts.push(toast);
|
|
79
|
+
queueMicrotask(() => {
|
|
80
|
+
if (toast.status === 'starting' && toasts.includes(toast)) {
|
|
81
|
+
toast.status = 'visible';
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (type !== 'loading' && toast.duration > 0) {
|
|
85
|
+
schedule(toast);
|
|
86
|
+
}
|
|
87
|
+
return id;
|
|
88
|
+
}
|
|
89
|
+
function dismiss(id) {
|
|
90
|
+
let toast = toasts.find((value) => value.id === id);
|
|
91
|
+
if (!toast || toast.status === 'ending') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
clearTimer(id);
|
|
95
|
+
toast.status = 'ending';
|
|
96
|
+
setTimeout(() => remove(id), EXIT_DURATION);
|
|
97
|
+
}
|
|
98
|
+
function normalizeToastHeight(height) {
|
|
99
|
+
return typeof height === 'number' && Number.isFinite(height) && height > 0 ? height : 0;
|
|
100
|
+
}
|
|
101
|
+
function pause() {
|
|
102
|
+
for (let timer of timers.values()) {
|
|
103
|
+
if (timer.handle === undefined) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
clearTimeout(timer.handle);
|
|
107
|
+
timer.remaining = Math.max(0, timer.remaining - (performance.now() - timer.started));
|
|
108
|
+
timer.handle = undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function remove(id) {
|
|
112
|
+
let index = toasts.findIndex((toast) => toast.id === id);
|
|
113
|
+
clearTimer(id);
|
|
114
|
+
if (index !== -1) {
|
|
115
|
+
toasts.splice(index, 1);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function resume() {
|
|
119
|
+
for (let [id, timer] of timers) {
|
|
120
|
+
if (timer.handle !== undefined) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
timer.started = performance.now();
|
|
124
|
+
timer.handle = setTimeout(() => dismiss(id), timer.remaining);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function schedule(toast) {
|
|
128
|
+
if (toast.duration <= 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (state.active) {
|
|
132
|
+
timers.set(toast.id, {
|
|
133
|
+
handle: undefined,
|
|
134
|
+
remaining: toast.duration,
|
|
135
|
+
started: 0
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
timers.set(toast.id, {
|
|
140
|
+
handle: setTimeout(() => dismiss(toast.id), toast.duration),
|
|
141
|
+
remaining: toast.duration,
|
|
142
|
+
started: performance.now()
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function update(id, options) {
|
|
146
|
+
let toast = toasts.find((value) => value.id === id);
|
|
147
|
+
if (!toast) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (options.action !== undefined) {
|
|
151
|
+
toast.action = options.action;
|
|
152
|
+
}
|
|
153
|
+
if (options.description !== undefined) {
|
|
154
|
+
toast.description = options.description;
|
|
155
|
+
}
|
|
156
|
+
if (options.dismissible !== undefined) {
|
|
157
|
+
toast.dismissible = options.dismissible;
|
|
158
|
+
}
|
|
159
|
+
if (options.priority !== undefined) {
|
|
160
|
+
toast.priority = options.priority;
|
|
161
|
+
}
|
|
162
|
+
if (options.duration !== undefined) {
|
|
163
|
+
toast.duration = options.duration;
|
|
164
|
+
clearTimer(id);
|
|
165
|
+
if (toast.type !== 'loading' && toast.duration > 0 && toast.status !== 'ending') {
|
|
166
|
+
schedule(toast);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const state = new ReactiveObject_0ktzs5p0();
|
|
171
|
+
const toasts = new ReactiveArray();
|
|
172
|
+
effect(() => {
|
|
173
|
+
let active = state.active;
|
|
174
|
+
if (active === paused) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
paused = active;
|
|
178
|
+
if (active) {
|
|
179
|
+
pause();
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
resume();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
const toast = {
|
|
186
|
+
dismiss: (id) => {
|
|
187
|
+
if (id === undefined) {
|
|
188
|
+
for (let value of [...toasts]) {
|
|
189
|
+
dismiss(value.id);
|
|
190
|
+
}
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
dismiss(id);
|
|
194
|
+
},
|
|
195
|
+
error: (title, options) => create('error', title, options),
|
|
196
|
+
info: (title, options) => create('info', title, options),
|
|
197
|
+
loading: (title, options) => create('loading', title, options),
|
|
198
|
+
message: (title, options) => create('message', title, options),
|
|
199
|
+
success: (title, options) => create('success', title, options),
|
|
200
|
+
update,
|
|
201
|
+
warning: (title, options) => create('warning', title, options)
|
|
202
|
+
};
|
|
203
|
+
export { buildVisibleToastLayout, remove, state, toast, toasts };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer components {.toaster{--toast-gap:var(--size-300);--toast-inset:var(--size-500);--toast-peek:var(--size-300)}.toast{--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height,0px)), var(--toast-height,0px));--toast-calc-offset-y:calc(var(--toast-offset-y,0px) + (var(--toast-index,0) * var(--toast-gap)) + var(--toast-swipe-y,0px));--toast-color:var(--color-text-300);--toast-height:0px;--toast-index:0;--toast-offset-y:0px;--toast-scale:max(0, 1 - (var(--toast-index,0) * .06));--toast-shrink:calc(1 - var(--toast-scale));--toast-swipe-x:0px;--toast-swipe-y:0px}.toaster{width:min(360px, 100% - var(--toast-inset) * 2);z-index:9999;position:fixed;inset:auto}.toaster[data-position^=top]{top:var(--toast-inset)}.toaster[data-position^=bottom]{bottom:var(--toast-inset)}.toaster[data-position$=left]{left:var(--toast-inset)}.toaster[data-position$=right]{right:var(--toast-inset)}.toaster[data-position$=center]{left:50%;transform:translate(-50%)}.toast{background:var(--background);border:1px solid var(--color-border-400);border-radius:var(--border-radius-500);box-shadow:var(--box-shadow-300);color:var(--color-text-400);transform:translateX(var(--toast-swipe-x)) translateY(calc(var(--toast-swipe-y) + var(--toast-index) * var(--toast-peek) + var(--toast-shrink) * var(--toast-calc-height))) scale(var(--toast-scale));-webkit-user-select:none;user-select:none;width:100%;z-index:calc(9999 - var(--toast-index,0));transition:transform .4s cubic-bezier(.22,1,.36,1),opacity .3s,height .2s;position:absolute;left:0;right:0;overflow:visible}[data-position*=top] .toast{transform-origin:top;top:0;bottom:auto}[data-position*=bottom] .toast{--toast-calc-offset-y:calc((var(--toast-offset-y,0px) * -1) + (var(--toast-index,0) * var(--toast-gap) * -1) + var(--toast-swipe-y,0px));transform:translateX(var(--toast-swipe-x)) translateY(calc(var(--toast-swipe-y) - var(--toast-index) * var(--toast-peek) - var(--toast-shrink) * var(--toast-calc-height))) scale(var(--toast-scale));transform-origin:bottom;top:auto;bottom:0}.toast:after{content:"";height:calc(var(--toast-gap) + 1px);width:100%;position:absolute;left:0}[data-position*=top] .toast:after{top:100%}[data-position*=bottom] .toast:after{bottom:100%}.toast-action{flex-shrink:0}.toast-close{background:var(--background);border:1px solid var(--color-border-400);color:var(--color-text-500);height:var(--size-500);right:calc(var(--size-200) * -1);top:calc(var(--size-200) * -1);width:var(--size-500);z-index:1;border-radius:100%;justify-content:center;align-items:center;display:flex;position:absolute}.toast-content{align-items:center;gap:var(--size-300);min-height:0;opacity:max(0, 1 - var(--toast-index,0));padding:var(--size-400);justify-content:space-between;transition:opacity .3s;display:flex;overflow:clip visible}.toast-copy{justify-content:center;align-items:center;display:inline-flex}.toast-description{color:var(--color-text-300);overflow-wrap:anywhere}.toast-description--clamp{-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.toast-details{margin-top:var(--size-200);max-height:160px;overflow-y:auto}.toast-details-toggle{cursor:pointer;align-items:center;gap:var(--size-200);display:flex}.toast-icon{color:var(--toast-color);flex-shrink:0;width:18px;height:18px}.toast-title{font-weight:var(--font-weight-400);overflow-wrap:anywhere}.toast--error{--toast-color:var(--color-red-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--warning{--toast-color:var(--color-yellow-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--success{--toast-color:var(--color-green-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--info{--toast-color:var(--color-blue-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--loading{--toast-color:var(--color-grey-500);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--loading .toast-icon{animation:1s linear infinite toast-spin}.toast--message{--toast-color:var(--color-text-300);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toaster.--active .toast{height:auto;transform:translateX(var(--toast-swipe-x)) translateY(var(--toast-calc-offset-y))}.toaster.--active .toast-content{opacity:1}.toaster .toast.toast--starting{opacity:0}.toaster[data-position*=top] .toast.toast--starting{transform:translateY(-120%)}.toaster[data-position*=bottom] .toast.toast--starting{transform:translateY(120%)}.toaster .toast.toast--ending{opacity:0}.toaster[data-position*=top] .toast.toast--ending{transform:translateY(calc(-100% - var(--toast-inset)))}.toaster[data-position*=bottom] .toast.toast--ending{transform:translateY(calc(100% + var(--toast-inset)))}.toaster .toast.toast--ending[data-swipe-direction=left]{transform:translateX(calc(var(--toast-swipe-x) - 100% - var(--toast-inset))) translateY(var(--toast-calc-offset-y))}.toaster .toast.toast--ending[data-swipe-direction=right]{transform:translateX(calc(var(--toast-swipe-x) + 100% + var(--toast-inset))) translateY(var(--toast-calc-offset-y))}.toaster .toast.toast--ending[data-swipe-direction=up]{transform:translateY(calc(var(--toast-swipe-y) - 100% - var(--toast-inset)))}.toaster .toast.toast--ending[data-swipe-direction=down]{transform:translateY(calc(var(--toast-swipe-y) + 100% + var(--toast-inset)))}.toast--swiping{transition:none}@keyframes toast-spin{to{transform:rotate(360deg)}}}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
|