@esportsplus/ui 0.59.1 → 0.61.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/.audit/audit.json +2810 -0
- package/.audit/check-scss.mjs +20 -0
- package/.audit/rules-audit.md +542 -0
- package/README.md +42 -31
- package/RULES.md +115 -0
- package/build/components/accordion/index.d.ts +12 -2175
- package/build/components/accordion/index.js +3 -4
- package/build/components/accordion/scss/index.scss +1 -1
- package/build/components/announcement/scss/index.scss +1 -1
- package/build/components/breadcrumb/index.js +47 -64
- package/build/components/breadcrumb/scss/index.scss +1 -1
- package/build/components/button/copy.d.ts +6 -4
- package/build/components/button/copy.js +24 -20
- package/build/components/button/faces.d.ts +0 -1
- package/build/components/button/faces.js +5 -6
- package/build/components/button/index.d.ts +3 -7
- package/build/components/button/index.js +3 -5
- package/build/components/button/kbd.d.ts +12 -8
- package/build/components/button/kbd.js +59 -74
- package/build/components/button/morph/index.d.ts +2169 -0
- package/build/components/button/morph/index.js +4 -0
- package/build/components/button/morph/save.d.ts +19 -0
- package/build/components/button/morph/save.js +57 -0
- package/build/components/button/morph/template.d.ts +22 -0
- package/build/components/button/morph/template.js +90 -0
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/button/sidebar.js +2 -2
- package/build/components/button/split.d.ts +1 -1
- package/build/components/button/split.js +11 -15
- package/build/components/capslock/index.js +6 -5
- package/build/components/capslock/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/cc/index.js +103 -111
- package/build/components/cc/scss/index.scss +1 -1
- package/build/components/chat/index.d.ts +6 -0
- package/build/components/chat/index.js +3 -0
- package/build/components/chat/minimap/index.d.ts +52 -0
- package/build/components/chat/minimap/index.js +248 -0
- package/build/components/{chat-minimap/range.js → chat/minimap/model.js} +1 -1
- package/build/components/{chat-minimap → chat/minimap}/spy.d.ts +1 -1
- package/build/components/{chat-minimap → chat/minimap}/spy.js +1 -1
- package/build/components/checkbox/index.d.ts +1 -0
- package/build/components/checkbox/index.js +1 -0
- package/build/components/checkbox/options.d.ts +0 -1
- package/build/components/checkbox/options.js +0 -1
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/clipboard/index.d.ts +3 -2181
- package/build/components/clipboard/index.js +2 -3
- package/build/components/color-picker/index.d.ts +21 -0
- package/build/components/color-picker/index.js +153 -138
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/index.d.ts +6 -93
- package/build/components/command/index.js +4 -601
- package/build/components/command/palette.d.ts +103 -0
- package/build/components/command/palette.js +595 -0
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/command/search.d.ts +37 -0
- package/build/components/command/search.js +67 -0
- package/build/components/counter/index.d.ts +15 -4
- package/build/components/counter/index.js +3 -2
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/datalist/scss/index.scss +1 -1
- package/build/components/dock/index.d.ts +24 -5
- package/build/components/dock/index.js +389 -51
- package/build/components/dock/scss/index.scss +1 -1
- package/build/components/editor/markdown/index.d.ts +3 -22
- package/build/components/editor/markdown/index.js +3 -30
- package/build/components/editor/markdown/render.js +3 -5
- package/build/components/editor/markdown/template.d.ts +22 -0
- package/build/components/editor/markdown/template.js +30 -0
- package/build/components/editor/tree/find.js +3 -3
- package/build/components/editor/tree/index.d.ts +3 -116
- package/build/components/editor/tree/index.js +3 -2225
- package/build/components/editor/tree/template.d.ts +116 -0
- package/build/components/editor/tree/template.js +2225 -0
- package/build/components/editor/viewer/index.d.ts +3 -26
- package/build/components/editor/viewer/index.js +3 -249
- package/build/components/editor/viewer/template.d.ts +26 -0
- package/build/components/editor/viewer/template.js +249 -0
- package/build/components/editor/workspace/index.d.ts +4 -65
- package/build/components/editor/workspace/index.js +4 -1228
- package/build/components/editor/workspace/model.d.ts +29 -37
- package/build/components/editor/workspace/model.js +186 -155
- package/build/components/editor/workspace/session.d.ts +3 -0
- package/build/components/editor/workspace/session.js +61 -34
- package/build/components/editor/workspace/shortcuts.d.ts +0 -2
- package/build/components/editor/workspace/shortcuts.js +0 -2
- package/build/components/editor/workspace/status.d.ts +4 -5
- package/build/components/editor/workspace/status.js +79 -61
- package/build/components/editor/workspace/statusbar.d.ts +5 -3
- package/build/components/editor/workspace/statusbar.js +66 -80
- package/build/components/editor/workspace/strip.d.ts +1 -2
- package/build/components/editor/workspace/strip.js +4 -3
- package/build/components/editor/workspace/tabs.d.ts +35 -3
- package/build/components/editor/workspace/tabs.js +75 -13
- package/build/components/editor/workspace/template.d.ts +65 -0
- package/build/components/editor/workspace/template.js +1145 -0
- package/build/components/error/scss/index.scss +1 -1
- package/build/components/filter/index.js +0 -3
- package/build/components/filter/scss/index.scss +1 -1
- package/build/components/form/index.d.ts +6 -32
- package/build/components/form/index.js +2 -1
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/grid/scss/index.scss +1 -1
- package/build/components/group/index.d.ts +12 -0
- package/build/components/group/index.js +15 -0
- package/build/components/group/scss/index.scss +2 -0
- package/build/components/heatmap/index.js +10 -32
- package/build/components/heatmap/scss/index.scss +1 -1
- package/build/components/highlight/index.d.ts +2 -3
- package/build/components/highlight/index.js +79 -78
- package/build/components/highlight/scss/index.scss +1 -1
- package/build/components/icon/index.d.ts +4 -3
- package/build/components/icon/index.js +2 -1
- package/build/components/icon/scss/index.scss +1 -1
- package/build/components/image/index.d.ts +3 -16
- package/build/components/image/index.js +2 -2
- package/build/components/image/scss/index.scss +1 -1
- package/build/components/index.d.ts +6 -4
- package/build/components/index.js +6 -4
- package/build/components/inline-edit/index.js +5 -4
- package/build/components/inline-edit/rich.js +79 -82
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/inline-edit/status.js +4 -3
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/input/tag.js +84 -67
- package/build/components/json/index.d.ts +4 -3
- package/build/components/json/index.js +2 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/loading/scss/index.scss +1 -1
- package/build/components/marquee/index.js +74 -71
- package/build/components/marquee/scss/index.scss +1 -1
- package/build/components/metric/flash.js +12 -11
- package/build/components/metric/scss/index.scss +1 -1
- package/build/components/nav/index.d.ts +1 -1
- package/build/components/nav/scss/index.scss +1 -1
- package/build/components/nav/toc.d.ts +8 -13
- package/build/components/nav/toc.js +9 -21
- package/build/components/nav/tree.d.ts +13 -14
- package/build/components/nav/tree.js +32 -19
- package/build/components/notification/index.d.ts +14 -3
- package/build/components/notification/index.js +4 -3
- package/build/components/notification/scss/index.scss +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/page/scss/index.scss +1 -1
- package/build/components/pagination/cards.d.ts +1 -0
- package/build/components/pagination/cards.js +4 -6
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/panels/dnd.d.ts +47 -0
- package/build/components/panels/dnd.js +106 -0
- package/build/components/panels/group.d.ts +35 -0
- package/build/components/panels/group.js +319 -0
- package/build/components/panels/index.d.ts +25 -0
- package/build/components/panels/index.js +520 -0
- package/build/components/panels/model.d.ts +64 -0
- package/build/components/panels/model.js +446 -0
- package/build/components/panels/resize.d.ts +9 -0
- package/build/components/panels/resize.js +87 -0
- package/build/components/panels/scss/index.scss +2 -0
- package/build/components/panels/subtree.d.ts +3 -0
- package/build/components/panels/subtree.js +43 -0
- package/build/components/preview/buttons.d.ts +20 -0
- package/build/components/preview/buttons.js +26 -0
- package/build/components/{copy/index.d.ts → preview/code.d.ts} +3 -9
- package/build/components/preview/code.js +18 -0
- package/build/components/preview/header.d.ts +16 -0
- package/build/components/preview/header.js +18 -0
- package/build/components/preview/index.d.ts +8704 -0
- package/build/components/preview/index.js +123 -0
- package/build/components/preview/scss/index.scss +2 -0
- package/build/components/preview/source.d.ts +21 -0
- package/build/components/preview/source.js +76 -0
- package/build/components/preview/stage.d.ts +16 -0
- package/build/components/preview/stage.js +24 -0
- package/build/components/progress/scss/index.scss +1 -1
- package/build/components/progress/text.js +9 -11
- package/build/components/radio/index.d.ts +3 -2
- package/build/components/radio/index.js +2 -2
- package/build/components/range/filter.js +8 -9
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/relative-time/index.js +4 -7
- package/build/components/relative-time/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/select/index.d.ts +1 -1
- package/build/components/select/index.js +72 -59
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/shell/index.d.ts +22 -0
- package/build/components/shell/index.js +272 -0
- package/build/components/shell/scss/index.scss +2 -0
- package/build/components/shortcut-recorder/index.d.ts +2 -3
- package/build/components/shortcut-recorder/index.js +3 -1
- package/build/components/shortcut-recorder/scss/index.scss +1 -1
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/sticky-header/scss/index.scss +1 -1
- package/build/components/story/index.d.ts +10 -6
- package/build/components/story/index.js +27 -47
- package/build/components/story/scss/index.scss +1 -1
- package/build/components/surface-field/index.js +13 -16
- package/build/components/surface-field/scss/index.scss +1 -1
- package/build/components/switch/index.d.ts +3 -2
- package/build/components/switch/index.js +2 -2
- package/build/components/tasklist/index.js +3 -1
- package/build/components/tasklist/scss/index.scss +1 -1
- package/build/components/textarea/scss/index.scss +1 -1
- package/build/components/theme/index.d.ts +6 -2
- package/build/components/theme/index.js +4 -3
- package/build/components/theme/scss/index.scss +1 -1
- package/build/components/theme-picker/cards.d.ts +13 -0
- package/build/components/theme-picker/cards.js +17 -0
- package/build/components/theme-picker/index.d.ts +9 -49
- package/build/components/theme-picker/index.js +5 -165
- package/build/components/theme-picker/scss/index.scss +1 -1
- package/build/components/theme-picker/shared.d.ts +26 -0
- package/build/components/theme-picker/shared.js +24 -0
- package/build/components/theme-picker/swatches.d.ts +13 -0
- package/build/components/theme-picker/swatches.js +17 -0
- package/build/components/theme-picker/toggle.d.ts +19 -0
- package/build/components/theme-picker/toggle.js +109 -0
- package/build/components/toast/index.js +10 -10
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/tooltip/menu.d.ts +2 -0
- package/build/components/tooltip/menu.js +88 -45
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/tooltip/shared.js +2 -2
- package/build/components/typewriter/rotate.js +7 -16
- package/build/components/typewriter/scss/index.scss +1 -1
- package/build/components/uptime/index.js +26 -33
- package/build/components/uptime/scss/index.scss +1 -1
- package/build/components/usage-meter/scss/index.scss +1 -1
- package/build/modifiers/background/scss/index.scss +2 -0
- package/build/modifiers/border/scss/index.scss +2 -0
- package/build/modifiers/box-shadow/scss/index.scss +2 -0
- package/build/modifiers/color/scss/index.scss +2 -0
- package/build/modifiers/scrollbar/scss/index.scss +1 -1
- package/build/shared/animation.js +1 -1
- package/build/shared/drag.d.ts +2 -1
- package/build/shared/drag.js +4 -3
- package/package.json +5 -5
- package/scripts/code-editor-services.test.mjs +1 -1
- package/scripts/code-editor-workspace.test.mjs +28 -18
- package/scripts/panels.test.mjs +262 -0
- package/scripts/workspace-keybindings.test.mjs +1 -1
- package/scripts/workspace-session.test.mjs +8 -6
- package/scripts/workspace-status.test.mjs +9 -1
- package/scripts/workspace-tabs.test.mjs +5 -5
- package/src/components/accordion/index.ts +11 -8
- package/src/components/accordion/scss/index.scss +15 -15
- package/src/components/accordion/scss/variables.scss +11 -7
- package/src/components/announcement/scss/index.scss +21 -24
- package/src/components/announcement/scss/variables.scss +13 -7
- package/src/components/breadcrumb/index.ts +8 -10
- package/src/components/breadcrumb/scss/index.scss +48 -122
- package/src/components/breadcrumb/scss/variables.scss +73 -55
- package/src/components/button/copy.ts +34 -27
- package/src/components/button/faces.ts +2 -4
- package/src/components/button/index.ts +3 -7
- package/src/components/button/kbd.ts +37 -95
- package/src/components/button/morph/index.ts +6 -0
- package/src/components/button/morph/save.ts +55 -0
- package/src/components/button/morph/template.ts +135 -0
- package/src/components/button/scss/index.scss +218 -99
- package/src/components/button/scss/variables.scss +160 -115
- package/src/components/button/sidebar.ts +6 -6
- package/src/components/button/split.ts +5 -6
- package/src/components/capslock/index.ts +9 -8
- package/src/components/capslock/scss/index.scss +21 -25
- package/src/components/capslock/scss/variables.scss +31 -12
- package/src/components/card/scss/index.scss +9 -24
- package/src/components/card/scss/variables.scss +29 -76
- package/src/components/cc/index.ts +15 -10
- package/src/components/cc/scss/index.scss +110 -153
- package/src/components/cc/scss/variables.scss +231 -44
- package/src/components/chat/index.ts +10 -0
- package/src/components/{chat-minimap → chat/minimap}/index.ts +66 -21
- package/src/components/{chat-minimap → chat/minimap}/scss/index.scss +26 -54
- package/src/components/chat/minimap/scss/variables.scss +178 -0
- package/src/components/{chat-minimap → chat/minimap}/spy.ts +1 -1
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/checkbox/options.ts +0 -1
- package/src/components/checkbox/scss/index.scss +25 -31
- package/src/components/checkbox/scss/variables.scss +50 -19
- package/src/components/clipboard/index.ts +4 -3
- package/src/components/color-picker/index.ts +131 -67
- package/src/components/color-picker/scss/index.scss +138 -221
- package/src/components/color-picker/scss/variables.scss +228 -81
- package/src/components/command/index.ts +5 -860
- package/src/components/command/palette.ts +879 -0
- package/src/components/command/scss/index.scss +82 -99
- package/src/components/command/scss/variables.scss +129 -50
- package/src/components/command/search.ts +67 -0
- package/src/components/counter/index.ts +90 -85
- package/src/components/counter/scss/index.scss +32 -41
- package/src/components/counter/scss/variables.scss +44 -16
- package/src/components/datalist/scss/index.scss +25 -25
- package/src/components/datalist/scss/variables.scss +21 -11
- package/src/components/dock/index.ts +505 -42
- package/src/components/dock/scss/index.scss +318 -73
- package/src/components/dock/scss/variables.scss +310 -39
- package/src/components/editor/code/features.ts +0 -1
- package/src/components/editor/code/find.ts +0 -1
- package/src/components/editor/code/keymap.ts +0 -1
- package/src/components/editor/code/scss/_editor.scss +12 -31
- package/src/components/editor/code/scss/_features.scss +12 -45
- package/src/components/editor/code/scss/_services.scss +15 -23
- package/src/components/editor/code/scss/index.scss +1 -1
- package/src/components/editor/code/scss/variables.scss +195 -42
- package/src/components/editor/code/view.ts +0 -1
- package/src/components/editor/diffs/scss/_diffs.scss +24 -77
- package/src/components/editor/diffs/scss/_merge.scss +5 -16
- package/src/components/editor/diffs/scss/index.scss +1 -1
- package/src/components/editor/diffs/scss/variables.scss +148 -11
- package/src/components/editor/markdown/index.ts +3 -67
- package/src/components/editor/markdown/render.ts +3 -6
- package/src/components/editor/markdown/scss/index.scss +30 -48
- package/src/components/editor/markdown/scss/variables.scss +117 -32
- package/src/components/editor/markdown/template.ts +69 -0
- package/src/components/editor/tree/drag.ts +5 -2
- package/src/components/editor/tree/find.ts +5 -4
- package/src/components/editor/tree/index.ts +3 -3434
- package/src/components/editor/tree/scss/index.scss +204 -262
- package/src/components/editor/tree/scss/variables.scss +198 -31
- package/src/components/editor/tree/template.ts +3436 -0
- package/src/components/editor/viewer/index.ts +3 -318
- package/src/components/editor/viewer/scss/_viewer.scss +15 -31
- package/src/components/editor/viewer/scss/index.scss +1 -1
- package/src/components/editor/viewer/scss/variables.scss +56 -14
- package/src/components/editor/viewer/template.ts +321 -0
- package/src/components/editor/workspace/index.ts +4 -1480
- package/src/components/editor/workspace/model.ts +225 -185
- package/src/components/editor/workspace/scss/_keybindings.scss +163 -0
- package/src/components/editor/workspace/scss/{status.scss → _status.scss} +11 -44
- package/src/components/editor/workspace/scss/_tabs.scss +57 -0
- package/src/components/editor/workspace/scss/index.scss +82 -312
- package/src/components/editor/workspace/scss/variables.scss +427 -0
- package/src/components/editor/workspace/session.ts +80 -44
- package/src/components/editor/workspace/shortcuts.ts +0 -2
- package/src/components/editor/workspace/status.ts +110 -80
- package/src/components/editor/workspace/statusbar.ts +38 -35
- package/src/components/editor/workspace/strip.ts +6 -5
- package/src/components/editor/workspace/tabs.ts +115 -15
- package/src/components/editor/workspace/template.ts +1486 -0
- package/src/components/error/index.ts +3 -0
- package/src/components/error/scss/index.scss +34 -65
- package/src/components/error/scss/variables.scss +28 -9
- package/src/components/filter/index.ts +2 -6
- package/src/components/filter/scss/index.scss +9 -2
- package/src/components/filter/scss/variables.scss +6 -6
- package/src/components/form/index.ts +4 -1
- package/src/components/frame/scss/index.scss +31 -42
- package/src/components/frame/scss/variables.scss +25 -18
- package/src/components/grid/scss/index.scss +2 -1
- package/src/components/group/index.ts +24 -0
- package/src/components/group/scss/index.scss +6 -0
- package/src/components/group/scss/variables.scss +4 -0
- package/src/components/heatmap/index.ts +14 -44
- package/src/components/heatmap/scss/index.scss +38 -44
- package/src/components/heatmap/scss/variables.scss +100 -59
- package/src/components/highlight/index.ts +133 -119
- package/src/components/highlight/scss/index.scss +49 -43
- package/src/components/highlight/scss/variables.scss +71 -30
- package/src/components/icon/index.ts +7 -5
- package/src/components/icon/scss/index.scss +7 -2
- package/src/components/icon/scss/variables.scss +2 -0
- package/src/components/image/index.ts +4 -2
- package/src/components/image/scss/index.scss +14 -22
- package/src/components/image/scss/variables.scss +30 -15
- package/src/components/index.ts +6 -4
- package/src/components/inline-edit/index.ts +3 -2
- package/src/components/inline-edit/rich.ts +17 -15
- package/src/components/inline-edit/scss/index.scss +165 -254
- package/src/components/inline-edit/scss/variables.scss +311 -83
- package/src/components/inline-edit/status.ts +2 -1
- package/src/components/input/scrub.ts +1 -1
- package/src/components/input/scss/_field.scss +1 -1
- package/src/components/input/scss/_scrub.scss +14 -25
- package/src/components/input/scss/_tag.scss +26 -46
- package/src/components/input/scss/variables.scss +167 -77
- package/src/components/input/tag.ts +59 -49
- package/src/components/json/index.ts +4 -1
- package/src/components/link/scss/index.scss +1 -4
- package/src/components/link/scss/variables.scss +5 -1
- package/src/components/loading/scss/index.scss +3 -23
- package/src/components/loading/scss/variables.scss +3 -6
- package/src/components/marquee/index.ts +33 -28
- package/src/components/marquee/scss/index.scss +32 -26
- package/src/components/marquee/scss/variables.scss +35 -23
- package/src/components/metric/flash.ts +2 -1
- package/src/components/metric/scss/_flash.scss +125 -145
- package/src/components/metric/scss/index.scss +31 -43
- package/src/components/metric/scss/variables.scss +192 -98
- package/src/components/nav/index.ts +1 -1
- package/src/components/nav/scss/index.scss +46 -49
- package/src/components/nav/scss/variables.scss +61 -64
- package/src/components/nav/spy.ts +2 -0
- package/src/components/nav/toc.ts +11 -31
- package/src/components/nav/tree.ts +56 -24
- package/src/components/notification/index.ts +94 -89
- package/src/components/notification/scss/index.scss +77 -76
- package/src/components/notification/scss/variables.scss +55 -38
- package/src/components/overlay/index.ts +3 -1
- package/src/components/overlay/scss/index.scss +94 -114
- package/src/components/overlay/scss/variables.scss +46 -18
- package/src/components/page/scss/variables.scss +1 -1
- package/src/components/pagination/cards.ts +2 -1
- package/src/components/pagination/scss/index.scss +191 -7
- package/src/components/pagination/scss/variables.scss +112 -36
- package/src/components/panels/dnd.ts +184 -0
- package/src/components/panels/group.ts +437 -0
- package/src/components/panels/index.ts +678 -0
- package/src/components/panels/model.ts +675 -0
- package/src/components/panels/resize.ts +131 -0
- package/src/components/panels/scss/index.scss +394 -0
- package/src/components/panels/scss/variables.scss +197 -0
- package/src/components/panels/subtree.ts +65 -0
- package/src/components/preview/buttons.ts +48 -0
- package/src/components/preview/code.ts +28 -0
- package/src/components/preview/header.ts +23 -0
- package/src/components/preview/index.ts +144 -0
- package/src/components/preview/scss/index.scss +143 -0
- package/src/components/preview/scss/variables.scss +127 -0
- package/src/components/preview/source.ts +73 -0
- package/src/components/preview/stage.ts +33 -0
- package/src/components/progress/scss/index.scss +117 -15
- package/src/components/progress/scss/variables.scss +140 -40
- package/src/components/progress/text.ts +5 -4
- package/src/components/radio/index.ts +2 -4
- package/src/components/range/filter.ts +7 -11
- package/src/components/range/scss/_filter.scss +301 -327
- package/src/components/range/scss/_slider.scss +31 -110
- package/src/components/range/scss/_vertical.scss +8 -20
- package/src/components/range/scss/index.scss +1 -4
- package/src/components/range/scss/variables.scss +374 -70
- package/src/components/relative-time/index.ts +9 -14
- package/src/components/relative-time/scss/index.scss +13 -21
- package/src/components/relative-time/scss/variables.scss +46 -29
- package/src/components/root/scss/index.scss +11 -20
- package/src/components/root/scss/variables.scss +17 -15
- package/src/components/select/index.ts +37 -15
- package/src/components/select/scss/index.scss +24 -51
- package/src/components/select/scss/variables.scss +77 -19
- package/src/components/shell/index.ts +321 -0
- package/src/components/shell/scss/index.scss +214 -0
- package/src/components/shell/scss/variables.scss +89 -0
- package/src/components/shortcut-recorder/index.ts +6 -3
- package/src/components/shortcut-recorder/scss/index.scss +71 -56
- package/src/components/shortcut-recorder/scss/variables.scss +47 -21
- package/src/components/sortable/index.ts +1 -0
- package/src/components/sortable/scss/index.scss +37 -42
- package/src/components/sortable/scss/variables.scss +76 -52
- package/src/components/sticky-header/scss/index.scss +11 -10
- package/src/components/sticky-header/scss/variables.scss +36 -4
- package/src/components/story/index.ts +1 -36
- package/src/components/story/scss/index.scss +22 -98
- package/src/components/story/scss/variables.scss +57 -15
- package/src/components/surface-field/index.ts +18 -20
- package/src/components/surface-field/scss/index.scss +32 -46
- package/src/components/surface-field/scss/variables.scss +92 -23
- package/src/components/switch/index.ts +2 -4
- package/src/components/tasklist/index.ts +8 -2
- package/src/components/tasklist/scss/index.scss +7 -7
- package/src/components/tasklist/scss/variables.scss +18 -13
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/scss/index.scss +9 -7
- package/src/components/textarea/scss/variables.scss +2 -2
- package/src/components/theme/index.ts +12 -4
- package/src/components/theme/scss/index.scss +13 -0
- package/src/components/theme/scss/variables.scss +5 -16
- package/src/components/theme-picker/cards.ts +19 -0
- package/src/components/theme-picker/index.ts +6 -225
- package/src/components/theme-picker/scss/index.scss +77 -167
- package/src/components/theme-picker/scss/variables.scss +220 -0
- package/src/components/theme-picker/shared.ts +54 -0
- package/src/components/theme-picker/swatches.ts +15 -0
- package/src/components/theme-picker/toggle.ts +150 -0
- package/src/components/toast/index.ts +14 -14
- package/src/components/toast/scss/index.scss +130 -155
- package/src/components/toast/scss/variables.scss +89 -52
- package/src/components/tooltip/menu.ts +77 -10
- package/src/components/tooltip/scss/_menu.scss +96 -138
- package/src/components/tooltip/scss/_shared.scss +93 -90
- package/src/components/tooltip/scss/index.scss +52 -54
- package/src/components/tooltip/scss/variables.scss +187 -67
- package/src/components/tooltip/shared.ts +8 -6
- package/src/components/typewriter/rotate.ts +15 -24
- package/src/components/typewriter/scss/index.scss +131 -3
- package/src/components/typewriter/scss/variables.scss +56 -44
- package/src/components/uptime/index.ts +1 -13
- package/src/components/uptime/scss/index.scss +28 -66
- package/src/components/uptime/scss/variables.scss +63 -48
- package/src/components/usage-meter/scss/index.scss +19 -19
- package/src/components/usage-meter/scss/variables.scss +80 -35
- package/src/css-utilities/absolute.scss +54 -52
- package/src/css-utilities/background.scss +22 -24
- package/src/css-utilities/border.scss +21 -21
- package/src/css-utilities/box-shadow.scss +32 -21
- package/src/css-utilities/color.scss +23 -21
- package/src/css-utilities/flex.scss +55 -53
- package/src/css-utilities/group.scss +7 -0
- package/src/css-utilities/hidden.scss +22 -20
- package/src/css-utilities/icon.scss +32 -30
- package/src/css-utilities/layer.scss +10 -10
- package/src/css-utilities/reset.scss +27 -16
- package/src/css-utilities/surface.scss +206 -128
- package/src/css-utilities/text.scss +114 -114
- package/src/modifiers/background/scss/index.scss +1 -0
- package/src/modifiers/background/scss/variables.scss +24 -0
- package/src/modifiers/border/scss/index.scss +1 -0
- package/src/modifiers/border/scss/variables.scss +21 -0
- package/src/modifiers/box-shadow/scss/index.scss +1 -0
- package/src/modifiers/box-shadow/scss/variables.scss +12 -0
- package/src/modifiers/color/scss/index.scss +1 -0
- package/src/modifiers/color/scss/variables.scss +10 -0
- package/src/modifiers/scrollbar/scss/index.scss +3 -2
- package/src/modifiers/scrollbar/scss/variables.scss +4 -3
- package/src/shared/animation.ts +3 -3
- package/src/shared/drag.ts +8 -3
- package/src/tokens/scss/color.scss +53 -37
- package/src/tokens/scss/index.scss +0 -1
- package/src/tokens/scss/state.scss +16 -1
- package/storage/svg/code.svg +1 -1
- package/storage/svg/collapse.svg +1 -0
- package/storage/svg/grid.svg +1 -0
- package/storage/svg/stack.svg +1 -0
- package/build/components/banner/scss/index.scss +0 -2
- package/build/components/button/fan.d.ts +0 -24
- package/build/components/button/fan.js +0 -118
- package/build/components/button/hold.d.ts +0 -31
- package/build/components/button/hold.js +0 -115
- package/build/components/button/icons.d.ts +0 -6
- package/build/components/button/icons.js +0 -35
- package/build/components/button/loading.d.ts +0 -22
- package/build/components/button/loading.js +0 -60
- package/build/components/button/morph.d.ts +0 -22
- package/build/components/button/morph.js +0 -115
- package/build/components/card/expand.d.ts +0 -22
- package/build/components/card/expand.js +0 -118
- package/build/components/card/index.d.ts +0 -6
- package/build/components/card/index.js +0 -4
- package/build/components/chat-minimap/index.d.ts +0 -28
- package/build/components/chat-minimap/index.js +0 -223
- package/build/components/chat-minimap/scss/index.scss +0 -2
- package/build/components/clipboard/copy.d.ts +0 -27
- package/build/components/clipboard/copy.js +0 -48
- package/build/components/copy/index.js +0 -61
- package/build/components/copy/scss/index.scss +0 -2
- package/build/components/highlight/easing.d.ts +0 -2
- package/build/components/highlight/easing.js +0 -19
- package/build/components/pull-to-refresh/index.d.ts +0 -18
- package/build/components/pull-to-refresh/index.js +0 -222
- package/build/components/pull-to-refresh/scss/index.scss +0 -2
- package/src/components/banner/scss/index.scss +0 -37
- package/src/components/banner/scss/variables.scss +0 -16
- package/src/components/button/fan.ts +0 -170
- package/src/components/button/hold.ts +0 -154
- package/src/components/button/icons.ts +0 -21
- package/src/components/button/loading.ts +0 -77
- package/src/components/button/morph.ts +0 -153
- package/src/components/button/scss/_fan.scss +0 -121
- package/src/components/button/scss/_kbd.scss +0 -11
- package/src/components/button/scss/_morph.scss +0 -107
- package/src/components/button/scss/_sidebar.scss +0 -61
- package/src/components/button/scss/_split.scss +0 -53
- package/src/components/card/expand.ts +0 -141
- package/src/components/card/index.ts +0 -8
- package/src/components/card/scss/_expand.scss +0 -234
- package/src/components/chat-minimap/scss/variables.scss +0 -97
- package/src/components/clipboard/copy.ts +0 -49
- package/src/components/copy/index.ts +0 -69
- package/src/components/copy/scss/index.scss +0 -52
- package/src/components/copy/scss/variables.scss +0 -19
- package/src/components/editor/workspace/scss/keybindings.scss +0 -190
- package/src/components/editor/workspace/scss/tabs.scss +0 -56
- package/src/components/highlight/easing.ts +0 -33
- package/src/components/pagination/scss/_arrows.scss +0 -69
- package/src/components/pagination/scss/_cards.scss +0 -121
- package/src/components/pagination/scss/_dots.scss +0 -64
- package/src/components/progress/scss/_text.scss +0 -135
- package/src/components/pull-to-refresh/index.ts +0 -316
- package/src/components/pull-to-refresh/scss/index.scss +0 -128
- package/src/components/pull-to-refresh/scss/variables.scss +0 -38
- package/src/components/typewriter/scss/_caret.scss +0 -34
- package/src/components/typewriter/scss/_retype.scss +0 -68
- package/src/components/typewriter/scss/_rotate.scss +0 -29
- package/src/tokens/scss/transition.scss +0 -21
- /package/build/components/{chat-minimap/range.d.ts → chat/minimap/model.d.ts} +0 -0
- /package/src/components/{chat-minimap/range.ts → chat/minimap/model.ts} +0 -0
|
@@ -1,95 +1,558 @@
|
|
|
1
|
+
import { effect, onCleanup, reactive, ReactiveArray, signal, write } from '@esportsplus/reactivity';
|
|
1
2
|
import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
2
|
-
import
|
|
3
|
+
import icon from '~/components/icon';
|
|
4
|
+
import input from '~/components/input';
|
|
5
|
+
import overlay from '~/components/overlay';
|
|
6
|
+
import sortable, { type SortableOptions } from '~/components/sortable';
|
|
3
7
|
import tooltip from '~/components/tooltip';
|
|
8
|
+
import { content as surface } from '~/components/tooltip/utilities';
|
|
9
|
+
import scrollbar from '~/modifiers/scrollbar';
|
|
10
|
+
import { observer } from '~/shared/resize';
|
|
11
|
+
import down from '@esportsplus/ui/svg/arrow-down.svg';
|
|
12
|
+
import left from '@esportsplus/ui/svg/arrow-left.svg';
|
|
13
|
+
import right from '@esportsplus/ui/svg/arrow-right.svg';
|
|
14
|
+
import up from '@esportsplus/ui/svg/arrow-up.svg';
|
|
15
|
+
import chevronDown from '@esportsplus/ui/svg/chevron-down.svg';
|
|
16
|
+
import chevronLeft from '@esportsplus/ui/svg/chevron-left.svg';
|
|
17
|
+
import chevronRight from '@esportsplus/ui/svg/chevron-right.svg';
|
|
18
|
+
import chevronUp from '@esportsplus/ui/svg/chevron-up.svg';
|
|
19
|
+
import enter from '@esportsplus/ui/svg/enter.svg';
|
|
20
|
+
import grid from '@esportsplus/ui/svg/grid.svg';
|
|
21
|
+
import magnifier from '@esportsplus/ui/svg/search.svg';
|
|
22
|
+
import '~/components/button/scss/index.scss';
|
|
4
23
|
import '~/components/card/scss/index.scss';
|
|
5
24
|
import './scss/index.scss';
|
|
6
25
|
|
|
7
26
|
|
|
8
27
|
type A = Attributes & {
|
|
9
28
|
[DOCK_BUTTON]?: Attributes;
|
|
10
|
-
|
|
11
|
-
|
|
29
|
+
[DOCK_LAUNCHER]?: Attributes;
|
|
30
|
+
// The apps kept out of the dock, in a launcher that opens from its last button; without them there is no
|
|
31
|
+
// launcher. Dragging between the dock and the launcher moves apps in and out of 'items'.
|
|
32
|
+
apps?: Item[] | ReactiveArray<Item>;
|
|
33
|
+
// Arrows either end page through the icons once they outgrow the shelf, which otherwise grows to fit them.
|
|
34
|
+
arrows?: boolean;
|
|
35
|
+
// The side the launcher and the labels open toward, and the way the icons swell; east and west stand the dock
|
|
36
|
+
// upright, for a screen's side edge.
|
|
37
|
+
direction?: Direction;
|
|
38
|
+
items: Item[] | ReactiveArray<Item>;
|
|
12
39
|
label?: string;
|
|
13
40
|
onlaunch?: (label: string) => void;
|
|
41
|
+
onsort?: SortableOptions<Item>['onsort'];
|
|
42
|
+
// Whether the launcher is open.
|
|
43
|
+
state?: { active: boolean };
|
|
14
44
|
};
|
|
15
45
|
|
|
46
|
+
type Direction = 'e' | 'n' | 's' | 'w';
|
|
47
|
+
|
|
16
48
|
type Item = {
|
|
17
|
-
icon: Renderable<unknown>;
|
|
18
49
|
label: string;
|
|
50
|
+
// Shapes this app's button whatever the dock's own shape: 'plain' drops its surface, leaving the icon alone.
|
|
51
|
+
modifier?: 'plain' | 'square' | 'squircle';
|
|
19
52
|
running?: boolean;
|
|
20
53
|
state?: { running: boolean };
|
|
21
|
-
}
|
|
54
|
+
} & (
|
|
55
|
+
// A sprite id, or a function rendering it: an app shows in the dock, its launcher and the copy being dragged at
|
|
56
|
+
// once, and rendered content can only stand in one place.
|
|
57
|
+
{ icon: string | (() => Renderable<unknown>), thumbnail?: never } |
|
|
58
|
+
// An image url, covering the whole button.
|
|
59
|
+
{ icon?: never, thumbnail: string }
|
|
60
|
+
);
|
|
22
61
|
|
|
23
62
|
type Slot = HTMLElement & { [LABEL]: string };
|
|
24
63
|
|
|
25
64
|
|
|
65
|
+
const ARROWS: Record<'horizontal' | 'vertical', [previous: string, next: string]> = {
|
|
66
|
+
horizontal: [chevronLeft, chevronRight],
|
|
67
|
+
vertical: [chevronUp, chevronDown]
|
|
68
|
+
};
|
|
69
|
+
|
|
26
70
|
const DOCK_BUTTON = Symbol.for('@esportsplus/ui/dock.button');
|
|
27
71
|
|
|
72
|
+
const DOCK_LAUNCHER = Symbol.for('@esportsplus/ui/dock.launcher');
|
|
73
|
+
|
|
28
74
|
const LABEL = Symbol();
|
|
29
75
|
|
|
30
76
|
// The first label waits so a cursor passing through doesn't flash one; neighbours then open at once.
|
|
31
77
|
const TOOLTIP_DELAY = 300;
|
|
32
78
|
|
|
33
79
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
80
|
+
let uid = 0;
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// The copy following the pointer: the dock's slot with a stand-in for the button, which keeps no controls.
|
|
84
|
+
function copy(item: Item) {
|
|
85
|
+
return html`
|
|
86
|
+
<div class='dock-item'>
|
|
87
|
+
<span class='card dock-button' ${face(item)}>${glyph(item)}</span>
|
|
88
|
+
</div>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function face(item: Item): Attributes {
|
|
93
|
+
return {
|
|
94
|
+
class: [item.modifier && `dock-button--${item.modifier}`, item.thumbnail !== undefined && 'dock-button--thumbnail'],
|
|
95
|
+
style: item.thumbnail !== undefined ? `--thumbnail: url(${JSON.stringify(thumbnail(item.thumbnail))})` : ''
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function glyph(item: Item) {
|
|
100
|
+
if (item.icon === undefined) {
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return typeof item.icon === 'string' ? sprite(item.icon) : item.icon();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function hint(keys: Renderable<unknown>[], label: string) {
|
|
108
|
+
return html`
|
|
109
|
+
<span class='dock-launcher-hint'>
|
|
110
|
+
<span aria-hidden='true' class='dock-launcher-keys'>
|
|
111
|
+
${keys.map((key) => html`<kbd class='button button--kbd'>${key}</kbd>`)}
|
|
112
|
+
</span>
|
|
113
|
+
${label}
|
|
114
|
+
</span>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Clicks anywhere in the launcher keep focus in its search, so typing and the arrow keys carry on after a stray click.
|
|
119
|
+
function keep(e: MouseEvent) {
|
|
120
|
+
if (!(e.target instanceof HTMLInputElement)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function name(trigger: HTMLElement) {
|
|
126
|
+
return (trigger as Slot)[LABEL];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function sprite(href: string, name = '') {
|
|
130
|
+
return icon({ 'aria-hidden': 'true', class: name }, href);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Absolute, since a 'url()' substituted from a custom property resolves against the stylesheet that reads it.
|
|
134
|
+
function thumbnail(src: string) {
|
|
135
|
+
return new URL(src, document.baseURI).href;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const dock = ({
|
|
140
|
+
apps,
|
|
141
|
+
arrows = false,
|
|
142
|
+
direction = 'n',
|
|
143
|
+
items,
|
|
144
|
+
label = 'Dock',
|
|
145
|
+
onlaunch,
|
|
146
|
+
onsort,
|
|
147
|
+
state = reactive({ active: false }),
|
|
148
|
+
...attributes
|
|
149
|
+
}: A) => {
|
|
150
|
+
let cells: HTMLElement | undefined,
|
|
151
|
+
docked = items instanceof ReactiveArray ? items : new ReactiveArray(items),
|
|
152
|
+
drawer = apps && (apps instanceof ReactiveArray ? apps : new ReactiveArray(apps)),
|
|
153
|
+
field: HTMLInputElement | undefined,
|
|
154
|
+
group = `dock-${++uid}`,
|
|
155
|
+
// The launcher's search, and the app the keys rest on among those it shows: none (-1) until an arrow picks one.
|
|
156
|
+
launch = reactive({ index: -1, query: '' }),
|
|
157
|
+
// Kept per app rather than per render, since moving between lists renders it afresh.
|
|
158
|
+
launching = new WeakMap<Item, { launching: boolean }>(),
|
|
159
|
+
popup = drawer && overlay.popup({ state, target: surface }),
|
|
160
|
+
running = new WeakMap<Item, { running: boolean }>(),
|
|
161
|
+
// The page of icons the shelf shows: the first, and how many fit (none while they all do). 'order' moves with
|
|
162
|
+
// every sort, which can reorder the dock without changing its length.
|
|
163
|
+
scroll = reactive({ count: 0, first: 0, order: 0 }),
|
|
164
|
+
shelf: HTMLElement | undefined,
|
|
165
|
+
track: HTMLElement | undefined,
|
|
166
|
+
vertical = direction === 'e' || direction === 'w',
|
|
167
|
+
viewport: HTMLElement | undefined;
|
|
168
|
+
|
|
169
|
+
// The dock's own buttons: one per app, and the last opening and closing the launcher.
|
|
170
|
+
function all() {
|
|
171
|
+
return html`
|
|
172
|
+
<div class='dock-item' ${{ onconnect: (element: Slot) => { element[LABEL] = 'All apps'; } }}>
|
|
173
|
+
<button
|
|
174
|
+
aria-controls='${group}-launcher'
|
|
175
|
+
aria-haspopup='dialog'
|
|
176
|
+
aria-label='All apps'
|
|
177
|
+
class='button dock-button'
|
|
178
|
+
type='button'
|
|
179
|
+
${{
|
|
180
|
+
'aria-expanded': () => state.active ? 'true' : 'false',
|
|
181
|
+
onclick: () => {
|
|
182
|
+
state.active = !state.active;
|
|
183
|
+
}
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
${sprite(grid)}
|
|
187
|
+
</button>
|
|
188
|
+
</div>
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function arrow(step: -1 | 1) {
|
|
193
|
+
return html`
|
|
194
|
+
<button
|
|
195
|
+
aria-label='${step < 0 ? 'Previous apps' : 'Next apps'}'
|
|
196
|
+
class='dock-arrow'
|
|
197
|
+
type='button'
|
|
198
|
+
${{
|
|
199
|
+
disabled: () => step < 0 ? scroll.first <= 0 : scroll.first + scroll.count >= docked.$length,
|
|
200
|
+
onclick: () => page(step)
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
${sprite(ARROWS[vertical ? 'vertical' : 'horizontal'][step < 0 ? 0 : 1])}
|
|
204
|
+
</button>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function button(item: Item) {
|
|
209
|
+
let app = status(item),
|
|
210
|
+
local = motion(item);
|
|
38
211
|
|
|
39
212
|
return html`
|
|
40
213
|
<button
|
|
41
214
|
class='card dock-button'
|
|
42
215
|
type='button'
|
|
216
|
+
${face(item)}
|
|
43
217
|
${attributes[DOCK_BUTTON]}
|
|
44
218
|
${{
|
|
45
|
-
'aria-label': () =>
|
|
219
|
+
'aria-label': () => app.running ? `${item.label}, running` : item.label,
|
|
46
220
|
class: () => local.launching && 'dock-button--launching',
|
|
47
221
|
onanimationend: () => {
|
|
48
222
|
local.launching = false;
|
|
49
223
|
},
|
|
50
|
-
onclick: () =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
224
|
+
onclick: () => open(item)
|
|
225
|
+
}}
|
|
226
|
+
>
|
|
227
|
+
${glyph(item)}
|
|
228
|
+
</button>
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
55
231
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
232
|
+
// Off the shelf's current page; hidden outright, so an icon swelling at either end grows the dock rather than
|
|
233
|
+
// being cut off by it.
|
|
234
|
+
function hidden(item: Item) {
|
|
235
|
+
if (!scroll.count) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
docked.$length;
|
|
240
|
+
scroll.order;
|
|
241
|
+
|
|
242
|
+
let index = docked.indexOf(item);
|
|
243
|
+
|
|
244
|
+
return index < scroll.first || index >= scroll.first + scroll.count;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Beside the dock, centred on it: a search, the apps, and the keys that drive them. The apps sort into the dock
|
|
248
|
+
// and back.
|
|
249
|
+
function launcher(apps: ReactiveArray<Item>) {
|
|
250
|
+
// The app the keys rest on, so a step only reaches the two apps it moves between.
|
|
251
|
+
let current = signal<Item | undefined>(undefined),
|
|
252
|
+
library = sortable(apps, (item, attributes) => html`
|
|
253
|
+
<div
|
|
254
|
+
class='dock-app'
|
|
255
|
+
${attributes}
|
|
256
|
+
${{ class: [() => !matches(item) && 'dock-app--hidden', () => signal.selector(current, item) && '--active'] }}
|
|
257
|
+
>
|
|
258
|
+
${button(item)}
|
|
259
|
+
<span class='dock-app-label'>${item.label}</span>
|
|
260
|
+
</div>
|
|
261
|
+
`, { group, onsort: sorted });
|
|
262
|
+
|
|
263
|
+
effect(() => {
|
|
264
|
+
write(current, shown()[selected()]);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// Every opening starts afresh, on all the apps, with the search taking the keys.
|
|
268
|
+
effect(() => state.active, (open) => {
|
|
269
|
+
if (!open) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
launch.index = -1;
|
|
274
|
+
launch.query = '';
|
|
275
|
+
|
|
276
|
+
// After the popup has put focus back where it was while opening.
|
|
277
|
+
requestAnimationFrame(() => {
|
|
278
|
+
field?.focus({ preventScroll: true });
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
return html`
|
|
283
|
+
<div
|
|
284
|
+
aria-label='All apps'
|
|
285
|
+
class='tooltip-content tooltip-content--${direction} dock-launcher'
|
|
286
|
+
id='${group}-launcher'
|
|
287
|
+
role='dialog'
|
|
288
|
+
${attributes[DOCK_LAUNCHER]}
|
|
289
|
+
${{ onmousedown: keep }}
|
|
290
|
+
>
|
|
291
|
+
<div class='dock-launcher-search'>
|
|
292
|
+
${sprite(magnifier)}
|
|
293
|
+
${input({
|
|
294
|
+
'aria-label': 'Search apps',
|
|
295
|
+
autocomplete: 'off',
|
|
296
|
+
class: 'dock-launcher-input',
|
|
297
|
+
oninput: (e: Event) => {
|
|
298
|
+
launch.index = -1;
|
|
299
|
+
launch.query = (e.target as HTMLInputElement).value;
|
|
300
|
+
},
|
|
301
|
+
onconnect: (element: HTMLInputElement) => {
|
|
302
|
+
field = element;
|
|
303
|
+
},
|
|
304
|
+
onkeydown: navigate,
|
|
305
|
+
placeholder: 'Search apps',
|
|
306
|
+
spellcheck: false,
|
|
307
|
+
value: () => launch.query
|
|
308
|
+
})}
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div class='dock-launcher-view' ${scrollbar({ fade: true })}>
|
|
312
|
+
<div
|
|
313
|
+
class='dock-launcher-apps'
|
|
314
|
+
${library.attributes}
|
|
315
|
+
${{
|
|
316
|
+
onconnect: (element: HTMLElement) => {
|
|
317
|
+
cells = element;
|
|
318
|
+
}
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
${library.render()}
|
|
322
|
+
</div>
|
|
323
|
+
${() => !shown().length && html`
|
|
324
|
+
<p class='dock-launcher-empty' role='status'>${launch.query.trim() ? 'No results' : 'No apps'}</p>
|
|
325
|
+
`}
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<div aria-hidden='true' class='dock-launcher-footer'>
|
|
329
|
+
${hint(['esc'], 'Close')}
|
|
330
|
+
${hint([left, right, up, down].map((href) => sprite(href, 'dock-launcher-key-icon')), 'Navigate')}
|
|
331
|
+
${hint([sprite(enter, 'dock-launcher-key-icon')], 'Open')}
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
`;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function matches(item: Item) {
|
|
338
|
+
let query = launch.query.trim().toLowerCase();
|
|
339
|
+
|
|
340
|
+
return !query || item.label.toLowerCase().includes(query);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Whether the icons outgrow the shelf, and if so how many whole ones a page holds. Read with every icon shown, at
|
|
344
|
+
// the length the shelf gives them; the page then keeps room for the swell, so the icons at its ends grow into it.
|
|
345
|
+
// Shown and hidden again here rather than through a binding, so the measure lands within one layout.
|
|
346
|
+
function measure() {
|
|
347
|
+
if (!arrows || !shelf || !track || !viewport) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
shelf.classList.add('dock--measuring');
|
|
352
|
+
|
|
353
|
+
let length: 'offsetHeight' | 'offsetWidth' = vertical ? 'offsetHeight' : 'offsetWidth',
|
|
354
|
+
pitch = rest(length),
|
|
355
|
+
room = vertical ? viewport.clientHeight : viewport.clientWidth,
|
|
356
|
+
span = track[length],
|
|
357
|
+
style = getComputedStyle(shelf),
|
|
358
|
+
// The hovered icon's growth plus its neighbours', two-thirds and one-third of it on each side.
|
|
359
|
+
swell = 3 * ((parseFloat(style.getPropertyValue('--size-peak')) - parseFloat(style.getPropertyValue('--size-rest'))) || 0);
|
|
360
|
+
|
|
361
|
+
shelf.classList.remove('dock--measuring');
|
|
362
|
+
|
|
363
|
+
if (span <= room) {
|
|
364
|
+
scroll.count = 0;
|
|
365
|
+
scroll.first = 0;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
scroll.count = Math.max(1, Math.floor((room - swell) / pitch));
|
|
370
|
+
scroll.first = Math.max(0, Math.min(scroll.first, docked.length - scroll.count));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function motion(item: Item) {
|
|
374
|
+
let current = launching.get(item);
|
|
375
|
+
|
|
376
|
+
if (!current) {
|
|
377
|
+
current = reactive({ launching: false });
|
|
378
|
+
launching.set(item, current);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return current;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// The first arrow picks the first app, later ones step through the shown apps as the grid lays them out; Enter
|
|
385
|
+
// opens the one they rest on, or the first shown before any is picked.
|
|
386
|
+
function navigate(e: KeyboardEvent) {
|
|
387
|
+
if (e.isComposing) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let list = shown(),
|
|
392
|
+
columns = cells ? getComputedStyle(cells).gridTemplateColumns.split(' ').length : 1,
|
|
393
|
+
step = ({ ArrowDown: columns, ArrowLeft: -1, ArrowRight: 1, ArrowUp: -columns } as Record<string, number>)[e.key];
|
|
394
|
+
|
|
395
|
+
if (step) {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
|
|
398
|
+
if (list.length) {
|
|
399
|
+
launch.index = launch.index < 0 ? 0 : Math.min(Math.max(selected() + step, 0), list.length - 1);
|
|
400
|
+
|
|
401
|
+
// Scrolling needs the element, which the rendered '--active' marks once the step has landed.
|
|
402
|
+
requestAnimationFrame(() => {
|
|
403
|
+
cells?.querySelector('.dock-app.--active')?.scrollIntoView({ block: 'nearest' });
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else if (e.key === 'Enter') {
|
|
408
|
+
let item = list[selected()] ?? list[0];
|
|
409
|
+
|
|
410
|
+
e.preventDefault();
|
|
411
|
+
|
|
412
|
+
if (item) {
|
|
413
|
+
open(item);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function open(item: Item) {
|
|
419
|
+
let app = status(item);
|
|
420
|
+
|
|
421
|
+
state.active = false;
|
|
422
|
+
|
|
423
|
+
// Already running: a click just brings it forward, no fanfare.
|
|
424
|
+
if (app.running) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
app.running = true;
|
|
429
|
+
motion(item).launching = true;
|
|
430
|
+
onlaunch?.(item.label);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function page(step: -1 | 1) {
|
|
434
|
+
scroll.first = Math.max(0, Math.min(scroll.first + step * scroll.count, docked.length - scroll.count));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// An icon's length along the shelf at rest, slot spacing included: the shortest, since the swell only grows the
|
|
438
|
+
// ones near the cursor. Measuring a swollen one would fit fewer each time, and in a parent sized by the dock,
|
|
439
|
+
// shrink it away.
|
|
440
|
+
function rest(length: 'offsetHeight' | 'offsetWidth') {
|
|
441
|
+
let children = track?.children ?? [],
|
|
442
|
+
min = Infinity;
|
|
443
|
+
|
|
444
|
+
for (let i = 0, n = children.length; i < n; i++) {
|
|
445
|
+
min = Math.min(min, (children[i] as HTMLElement)[length] || Infinity);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return min === Infinity ? 1 : min;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function selected() {
|
|
452
|
+
return launch.index < 0 ? -1 : Math.min(launch.index, shown().length - 1);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function shown() {
|
|
456
|
+
if (!drawer) {
|
|
457
|
+
return [];
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
drawer.$length;
|
|
461
|
+
|
|
462
|
+
return drawer.filter(matches);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function slot(item: Item, attributes: Attributes) {
|
|
466
|
+
return html`
|
|
467
|
+
<div
|
|
468
|
+
class='dock-item'
|
|
469
|
+
${attributes}
|
|
470
|
+
${{
|
|
471
|
+
class: () => hidden(item) && 'dock-item--hidden',
|
|
472
|
+
onconnect: (element: Slot) => {
|
|
473
|
+
element[LABEL] = item.label;
|
|
59
474
|
}
|
|
60
475
|
}}
|
|
61
476
|
>
|
|
62
|
-
${item
|
|
63
|
-
|
|
64
|
-
|
|
477
|
+
${button(item)}
|
|
478
|
+
<span aria-hidden='true' class='dock-light ${() => status(item).running && '--active'}'></span>
|
|
479
|
+
</div>
|
|
65
480
|
`;
|
|
66
|
-
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function sorted(item: Item, from: number, to: number, source: ReactiveArray<Item>, target: ReactiveArray<Item>) {
|
|
484
|
+
scroll.order++;
|
|
485
|
+
onsort?.(item, from, to, source, target);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function status(item: Item) {
|
|
489
|
+
let current = running.get(item);
|
|
490
|
+
|
|
491
|
+
if (!current) {
|
|
492
|
+
current = item.state ?? reactive({ running: item.running ?? false });
|
|
493
|
+
running.set(item, current);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
return current;
|
|
497
|
+
}
|
|
67
498
|
|
|
68
499
|
// One label glides between the icons; hidden from assistive tech, since each button is already named by it.
|
|
69
|
-
let
|
|
500
|
+
let list = sortable(docked, slot, { drag: copy, group, onsort: sorted }),
|
|
501
|
+
tip = tooltip.shared({ delay: { open: TOOLTIP_DELAY }, direction });
|
|
70
502
|
|
|
71
503
|
return html`
|
|
72
|
-
<nav
|
|
73
|
-
${
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
504
|
+
<nav
|
|
505
|
+
class='dock dock--${direction} ${drawer && 'tooltip'}'
|
|
506
|
+
${attributes}
|
|
507
|
+
${tip.delegate({ content: name, edge: true, selector: '.dock-item' })}
|
|
508
|
+
${popup}
|
|
509
|
+
${{
|
|
510
|
+
'aria-label': label,
|
|
511
|
+
'aria-orientation': vertical ? 'vertical' : 'horizontal',
|
|
512
|
+
class: [() => state.active && 'dock--open', () => scroll.count > 0 && 'dock--overflowing'],
|
|
513
|
+
// The icons are measured against the shelf whenever it, they, or the room around the dock change; the
|
|
514
|
+
// dock's parent can grow without the dock growing with it.
|
|
515
|
+
onconnect: (element: HTMLElement) => {
|
|
516
|
+
if (!arrows) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
let resize = observer(measure);
|
|
521
|
+
|
|
522
|
+
shelf = element;
|
|
523
|
+
|
|
524
|
+
for (let node of [element, element.parentElement, track, viewport]) {
|
|
525
|
+
if (node) {
|
|
526
|
+
resize.observe(node);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
onCleanup(resize.disconnect);
|
|
531
|
+
}
|
|
532
|
+
}}
|
|
533
|
+
>
|
|
534
|
+
${arrows && arrow(-1)}
|
|
535
|
+
<div
|
|
536
|
+
class='dock-viewport'
|
|
537
|
+
${{
|
|
538
|
+
// The track spreads the sortable's attributes, so it is reached from here; children connect
|
|
539
|
+
// before the shelf, which measures them.
|
|
540
|
+
onconnect: (element: HTMLElement) => {
|
|
541
|
+
track = element.firstElementChild as HTMLElement;
|
|
542
|
+
viewport = element;
|
|
543
|
+
}
|
|
544
|
+
}}
|
|
545
|
+
>
|
|
546
|
+
<div class='dock-items' ${list.attributes}>${list.render()}</div>
|
|
547
|
+
</div>
|
|
548
|
+
${arrows && arrow(1)}
|
|
549
|
+
${drawer && all()}
|
|
550
|
+
${tip.render({ 'aria-hidden': 'true', class: 'dock-label' })}
|
|
551
|
+
${drawer && launcher(drawer)}
|
|
89
552
|
</nav>
|
|
90
553
|
`;
|
|
91
554
|
};
|
|
92
555
|
|
|
93
556
|
|
|
94
|
-
export default component(dock, { button: DOCK_BUTTON });
|
|
95
|
-
export type { Item };
|
|
557
|
+
export default component(dock, { button: DOCK_BUTTON, launcher: DOCK_LAUNCHER });
|
|
558
|
+
export type { Direction, Item };
|