@esportsplus/ui 0.62.0 → 0.64.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 +4 -92
- package/.audit/rules-audit.md +4 -18
- package/README.md +15 -18
- package/RULES.md +80 -9
- package/bin/agent-cli +300 -0
- package/build/components/accordion/index.d.ts +4 -0
- package/build/components/accordion/index.js +13 -10
- package/build/components/breadcrumb/index.d.ts +1 -0
- package/build/components/breadcrumb/index.js +43 -37
- package/build/components/breadcrumb/scss/index.scss +1 -1
- package/build/components/button/kbd.d.ts +1 -1
- package/build/components/button/kbd.js +17 -15
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/button/split.js +14 -16
- package/build/components/capslock/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/chat/minimap/index.js +4 -5
- package/build/components/checkbox/group.d.ts +1 -0
- package/build/components/checkbox/group.js +21 -20
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/color-picker/index.js +6 -6
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/index.d.ts +1 -1
- package/build/components/command/palette.d.ts +13 -9
- package/build/components/command/palette.js +143 -152
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/command/search.d.ts +5 -7
- package/build/components/command/search.js +6 -26
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/editor/code/commands.js +1 -1
- package/build/components/editor/code/document.d.ts +1 -3
- package/build/components/editor/code/document.js +1 -1
- package/build/components/editor/code/editor.d.ts +18 -6
- package/build/components/editor/code/editor.js +9 -7
- package/build/components/editor/code/features.js +27 -18
- package/build/components/editor/code/find.d.ts +1 -1
- package/build/components/editor/code/find.js +5 -6
- package/build/components/editor/code/folding.d.ts +3 -5
- package/build/components/editor/code/folding.js +2 -15
- package/build/components/editor/code/gutter.js +2 -2
- package/build/components/editor/code/index.d.ts +1 -0
- package/build/components/editor/code/index.js +1 -0
- package/build/components/editor/code/minimap.d.ts +3 -1
- package/build/components/editor/code/minimap.js +31 -5
- package/build/components/editor/code/services/model.js +2 -1
- package/build/components/editor/code/syntax.js +2 -1
- package/build/components/editor/code/view.d.ts +8 -2
- package/build/components/editor/code/view.js +37 -56
- package/build/components/editor/diffs/index.d.ts +1 -0
- package/build/components/editor/diffs/index.js +1 -0
- package/build/components/editor/diffs/merge.js +16 -17
- package/build/components/editor/diffs/view.js +10 -11
- package/build/components/editor/markdown/editing.d.ts +2 -1
- package/build/components/editor/markdown/editing.js +14 -5
- package/build/components/editor/markdown/format.d.ts +1 -1
- package/build/components/editor/markdown/format.js +116 -26
- package/build/components/editor/markdown/layout.js +2 -1
- package/build/components/editor/markdown/model.d.ts +1 -2
- package/build/components/editor/markdown/model.js +1 -29
- package/build/components/editor/markdown/render.js +1 -1
- package/build/components/editor/markdown/template.d.ts +3 -10
- package/build/components/editor/markdown/template.js +2 -29
- package/build/components/editor/markdown/toolbar.d.ts +2 -2
- package/build/components/editor/markdown/toolbar.js +90 -126
- package/build/components/editor/markdown/view.d.ts +1 -1
- package/build/components/editor/markdown/view.js +54 -87
- package/build/components/editor/tree/drag.js +1 -1
- package/build/components/editor/tree/find.js +70 -64
- package/build/components/editor/tree/template.js +8 -7
- package/build/components/editor/viewer/model.d.ts +1 -1
- package/build/components/editor/viewer/template.js +4 -26
- package/build/components/editor/workspace/keybindings.d.ts +1 -1
- package/build/components/editor/workspace/model.d.ts +12 -2
- package/build/components/editor/workspace/model.js +87 -31
- package/build/components/editor/workspace/session.d.ts +2 -6
- package/build/components/editor/workspace/session.js +99 -16
- package/build/components/editor/workspace/status.d.ts +1 -1
- package/build/components/editor/workspace/strip.d.ts +10 -9
- package/build/components/editor/workspace/strip.js +99 -141
- package/build/components/editor/workspace/tabs.d.ts +2 -4
- package/build/components/editor/workspace/tabs.js +1 -14
- package/build/components/editor/workspace/template.d.ts +1 -1
- package/build/components/editor/workspace/template.js +305 -435
- package/build/components/error/index.d.ts +4 -13
- package/build/components/error/index.js +53 -172
- package/build/components/error/scss/index.scss +1 -1
- package/build/components/form/action.d.ts +2 -2
- package/build/components/form/action.js +2 -2
- package/build/components/form/input.d.ts +3 -3
- package/build/components/form/input.js +32 -10
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/group/index.js +96 -9
- package/build/components/group/scss/index.scss +1 -1
- package/build/components/heatmap/scss/index.scss +1 -1
- package/build/components/highlight/index.js +55 -48
- package/build/components/highlight/scss/index.scss +1 -1
- package/build/components/icon/scss/index.scss +1 -1
- package/build/components/image/scss/index.scss +1 -1
- package/build/components/index.d.ts +3 -7
- package/build/components/index.js +3 -7
- package/build/components/inline-edit/index.d.ts +2 -2
- package/build/components/inline-edit/index.js +5 -5
- package/build/components/inline-edit/rich.js +4 -4
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/inline-edit/status.js +1 -0
- package/build/components/input/index.d.ts +4 -0
- package/build/components/input/index.js +3 -1
- package/build/components/input/otp.d.ts +18 -0
- package/build/components/input/otp.js +112 -0
- package/build/components/input/password.d.ts +15 -0
- package/build/components/input/password.js +163 -0
- package/build/components/input/scrub.d.ts +1 -0
- package/build/components/input/scrub.js +103 -89
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/input/tag.d.ts +5 -0
- package/build/components/input/tag.js +116 -69
- package/build/components/json/download.js +1 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/marquee/index.js +1 -1
- package/build/components/marquee/scss/index.scss +1 -1
- package/build/components/nav/scss/index.scss +1 -1
- package/build/components/nav/tree.d.ts +2 -1
- package/build/components/nav/tree.js +6 -5
- package/build/components/notification/index.js +3 -3
- package/build/components/notification/scss/index.scss +1 -1
- package/build/components/overlay/popup.d.ts +2 -2
- package/build/components/overlay/popup.js +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/pagination/arrows.js +2 -3
- package/build/components/pagination/cards.js +2 -3
- package/build/components/pagination/index.d.ts +2 -3
- package/build/components/pagination/index.js +18 -13
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/progress/index.js +1 -1
- package/build/components/progress/scss/index.scss +1 -1
- package/build/components/progress/text.js +3 -3
- package/build/components/range/filter.d.ts +7 -1
- package/build/components/range/filter.js +188 -171
- package/build/components/range/index.d.ts +14 -9
- package/build/components/range/index.js +11 -8
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/range/surface.d.ts +21 -0
- package/build/components/range/surface.js +144 -0
- package/build/components/relative-time/index.js +2 -2
- package/build/components/relative-time/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/{preview/header.d.ts → search/button.d.ts} +3 -3
- package/build/components/search/button.js +18 -0
- package/build/components/search/index.d.ts +8 -0
- package/build/components/search/index.js +5 -0
- package/build/components/search/input.d.ts +9 -0
- package/build/components/search/input.js +23 -0
- package/build/components/search/parts.d.ts +5 -0
- package/build/components/search/parts.js +17 -0
- package/build/components/search/scss/index.scss +2 -0
- package/build/components/select/expand.js +4 -5
- package/build/components/select/index.d.ts +7 -7
- package/build/components/select/index.js +127 -117
- package/build/components/select/placement.js +8 -1
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/{panels → shell}/group.d.ts +21 -5
- package/build/components/shell/group.js +336 -0
- package/build/components/shell/index.d.ts +15 -17
- package/build/components/shell/index.js +583 -238
- package/build/components/shell/model.d.ts +94 -0
- package/build/components/{panels → shell}/model.js +199 -73
- package/build/components/shell/resize.d.ts +5 -0
- package/build/components/{panels → shell}/resize.js +54 -30
- package/build/components/shell/scss/index.scss +1 -1
- package/build/components/shell/sidebar.d.ts +34 -0
- package/build/components/shell/sidebar.js +362 -0
- package/build/components/{panels → shell}/subtree.js +7 -8
- package/build/components/shortcut-recorder/index.d.ts +5 -4
- package/build/components/shortcut-recorder/index.js +69 -44
- package/build/components/shortcut-recorder/scss/index.scss +1 -1
- package/build/components/sortable/index.d.ts +16 -2
- package/build/components/sortable/index.js +237 -134
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/story/index.js +46 -34
- package/build/components/story/scss/index.scss +1 -1
- package/build/components/surface-field/engine.d.ts +2 -0
- package/build/components/surface-field/engine.js +86 -33
- package/build/components/surface-field/index.d.ts +26 -4
- package/build/components/surface-field/index.js +35 -4
- package/build/components/surface-field/scss/index.scss +1 -1
- package/build/components/surface-field/surface.d.ts +13 -1
- package/build/components/surface-field/surface.js +149 -58
- package/build/components/tasklist/index.d.ts +1 -4
- package/build/components/tasklist/index.js +36 -43
- package/build/components/tasklist/scss/index.scss +1 -1
- package/build/components/textarea/index.d.ts +1 -1
- package/build/components/textarea/index.js +14 -14
- package/build/components/theme/scss/index.scss +1 -1
- package/build/components/theme/shared.d.ts +1 -2
- package/build/components/theme/shared.js +2 -5
- package/build/components/toast/index.d.ts +3 -3
- package/build/components/toast/index.js +3 -3
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/toolbar/index.d.ts +91 -0
- package/build/components/toolbar/index.js +1281 -0
- package/build/components/toolbar/scss/index.scss +2 -0
- package/build/components/tooltip/menu.d.ts +9 -8
- package/build/components/tooltip/menu.js +397 -279
- package/build/components/tooltip/onclick.d.ts +2 -0
- package/build/components/tooltip/onclick.js +13 -4
- package/build/components/tooltip/onhover.d.ts +3 -1
- package/build/components/tooltip/onhover.js +10 -9
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/tooltip/shared.d.ts +4 -4
- package/build/components/tooltip/shared.js +27 -46
- package/build/components/tooltip/utilities.d.ts +5 -2
- package/build/components/tooltip/utilities.js +169 -9
- package/build/components/typewriter/rotate.js +6 -6
- package/build/components/typewriter/scss/index.scss +1 -1
- package/build/components/uptime/scss/index.scss +1 -1
- package/build/components/usage-meter/index.js +1 -1
- package/build/components/usage-meter/scss/index.scss +1 -1
- package/build/css-utilities/font/montserrat/OFL.txt +93 -0
- package/build/shared/drag.d.ts +15 -9
- package/build/shared/drag.js +41 -28
- package/build/shared/placement.d.ts +39 -0
- package/build/shared/placement.js +55 -0
- package/build/shared/transition.js +1 -1
- package/build/shared/viewport.d.ts +1 -2
- package/build/shared/viewport.js +1 -4
- package/package.json +9 -12
- package/src/components/accordion/index.ts +12 -5
- package/src/components/announcement/index.ts +1 -1
- package/src/components/breadcrumb/index.ts +13 -3
- package/src/components/breadcrumb/scss/index.scss +6 -6
- package/src/components/breadcrumb/scss/variables.scss +7 -0
- package/src/components/button/kbd.ts +22 -17
- package/src/components/button/scss/index.scss +69 -76
- package/src/components/button/scss/variables.scss +51 -18
- package/src/components/button/split.ts +12 -8
- package/src/components/capslock/index.ts +2 -0
- package/src/components/capslock/scss/index.scss +21 -21
- package/src/components/card/scss/index.scss +16 -0
- package/src/components/card/scss/variables.scss +25 -2
- package/src/components/chat/minimap/index.ts +5 -6
- package/src/components/chat/minimap/scss/index.scss +12 -11
- package/src/components/chat/minimap/scss/variables.scss +23 -17
- package/src/components/checkbox/group.ts +8 -7
- package/src/components/checkbox/scss/index.scss +59 -35
- package/src/components/checkbox/scss/variables.scss +24 -17
- package/src/components/color-picker/index.ts +6 -6
- package/src/components/color-picker/scss/index.scss +35 -22
- package/src/components/color-picker/scss/variables.scss +11 -3
- package/src/components/command/index.ts +1 -1
- package/src/components/command/palette.ts +174 -166
- package/src/components/command/scss/index.scss +18 -51
- package/src/components/command/scss/variables.scss +37 -71
- package/src/components/command/search.ts +9 -31
- package/src/components/counter/index.ts +22 -22
- package/src/components/counter/scss/variables.scss +10 -7
- package/src/components/editor/code/commands.ts +1 -1
- package/src/components/editor/code/document.ts +0 -2
- package/src/components/editor/code/editor.ts +31 -13
- package/src/components/editor/code/features.ts +39 -24
- package/src/components/editor/code/find.ts +5 -6
- package/src/components/editor/code/folding.ts +3 -21
- package/src/components/editor/code/gutter.ts +2 -2
- package/src/components/editor/code/index.ts +1 -0
- package/src/components/editor/code/minimap.ts +39 -5
- package/src/components/editor/code/scss/_editor.scss +28 -21
- package/src/components/editor/code/scss/_features.scss +19 -21
- package/src/components/editor/code/scss/_services.scss +14 -11
- package/src/components/editor/code/scss/variables.scss +31 -12
- package/src/components/editor/code/services/model.ts +2 -1
- package/src/components/editor/code/syntax.ts +2 -1
- package/src/components/editor/code/view.ts +22 -45
- package/src/components/editor/diffs/index.ts +1 -0
- package/src/components/editor/diffs/merge.ts +9 -10
- package/src/components/editor/diffs/scss/_diffs.scss +39 -63
- package/src/components/editor/diffs/scss/_merge.scss +10 -2
- package/src/components/editor/diffs/scss/index.scss +0 -1
- package/src/components/editor/diffs/scss/variables.scss +36 -17
- package/src/components/editor/diffs/view.ts +8 -9
- package/src/components/editor/markdown/editing.ts +18 -6
- package/src/components/editor/markdown/format.ts +180 -32
- package/src/components/editor/markdown/layout.ts +2 -1
- package/src/components/editor/markdown/model.ts +0 -38
- package/src/components/editor/markdown/render.ts +1 -1
- package/src/components/editor/markdown/scss/index.scss +38 -52
- package/src/components/editor/markdown/scss/variables.scss +24 -50
- package/src/components/editor/markdown/template.ts +3 -63
- package/src/components/editor/markdown/toolbar.ts +76 -127
- package/src/components/editor/markdown/view.ts +9 -32
- package/src/components/editor/tree/drag.ts +1 -1
- package/src/components/editor/tree/find.ts +61 -64
- package/src/components/editor/tree/scss/index.scss +29 -30
- package/src/components/editor/tree/scss/variables.scss +34 -15
- package/src/components/editor/tree/template.ts +9 -9
- package/src/components/editor/viewer/model.ts +1 -1
- package/src/components/editor/viewer/scss/_viewer.scss +4 -5
- package/src/components/editor/viewer/scss/variables.scss +3 -3
- package/src/components/editor/viewer/template.ts +4 -31
- package/src/components/editor/workspace/keybindings.ts +1 -1
- package/src/components/editor/workspace/model.ts +136 -37
- package/src/components/editor/workspace/scss/_keybindings.scss +3 -20
- package/src/components/editor/workspace/scss/_status.scss +0 -1
- package/src/components/editor/workspace/scss/_tabs.scss +2 -41
- package/src/components/editor/workspace/scss/index.scss +49 -71
- package/src/components/editor/workspace/scss/variables.scss +1 -135
- package/src/components/editor/workspace/session.ts +138 -18
- package/src/components/editor/workspace/status.ts +1 -1
- package/src/components/editor/workspace/strip.ts +96 -115
- package/src/components/editor/workspace/tabs.ts +2 -23
- package/src/components/editor/workspace/template.ts +323 -458
- package/src/components/error/index.ts +47 -183
- package/src/components/error/scss/index.scss +34 -35
- package/src/components/error/scss/variables.scss +14 -26
- package/src/components/filter/scss/index.scss +6 -5
- package/src/components/form/action.ts +7 -7
- package/src/components/form/input.ts +25 -12
- package/src/components/frame/scss/index.scss +5 -5
- package/src/components/group/index.ts +77 -2
- package/src/components/group/scss/index.scss +164 -0
- package/src/components/group/scss/variables.scss +110 -2
- package/src/components/heatmap/scss/variables.scss +13 -10
- package/src/components/highlight/index.ts +87 -79
- package/src/components/highlight/scss/index.scss +6 -16
- package/src/components/highlight/scss/variables.scss +33 -5
- package/src/components/icon/scss/index.scss +2 -2
- package/src/components/icon/scss/variables.scss +14 -1
- package/src/components/image/scss/index.scss +9 -9
- package/src/components/image/scss/variables.scss +1 -1
- package/src/components/index.ts +3 -7
- package/src/components/inline-edit/index.ts +8 -6
- package/src/components/inline-edit/rich.ts +8 -8
- package/src/components/inline-edit/scss/index.scss +50 -36
- package/src/components/inline-edit/scss/variables.scss +28 -18
- package/src/components/inline-edit/status.ts +2 -0
- package/src/components/input/index.ts +3 -1
- package/src/components/input/otp.ts +175 -0
- package/src/components/input/password.ts +178 -0
- package/src/components/input/scrub.ts +197 -178
- package/src/components/input/scss/index.scss +344 -4
- package/src/components/input/scss/variables.scss +234 -65
- package/src/components/input/tag.ts +98 -53
- package/src/components/json/download.ts +2 -5
- package/src/components/link/scss/index.scss +3 -5
- package/src/components/loading/scss/index.scss +1 -0
- package/src/components/loading/scss/variables.scss +1 -0
- package/src/components/marquee/index.ts +1 -1
- package/src/components/marquee/scss/index.scss +11 -4
- package/src/components/nav/scss/index.scss +10 -26
- package/src/components/nav/scss/variables.scss +13 -23
- package/src/components/nav/tree.ts +10 -8
- package/src/components/notification/index.ts +3 -3
- package/src/components/notification/scss/index.scss +7 -14
- package/src/components/notification/scss/variables.scss +10 -2
- package/src/components/number/index.ts +1 -1
- package/src/components/overlay/popup.ts +2 -2
- package/src/components/overlay/scss/index.scss +60 -51
- package/src/components/page/scss/variables.scss +1 -0
- package/src/components/pagination/arrows.ts +2 -3
- package/src/components/pagination/cards.ts +2 -3
- package/src/components/pagination/index.ts +11 -9
- package/src/components/pagination/scss/index.scss +38 -101
- package/src/components/pagination/scss/variables.scss +24 -69
- package/src/components/progress/index.ts +1 -1
- package/src/components/progress/scss/index.scss +22 -11
- package/src/components/progress/scss/variables.scss +13 -5
- package/src/components/progress/text.ts +3 -3
- package/src/components/range/filter.ts +249 -246
- package/src/components/range/index.ts +22 -7
- package/src/components/range/scss/index.scss +470 -15
- package/src/components/range/scss/variables.scss +402 -198
- package/src/components/range/surface.ts +135 -0
- package/src/components/relative-time/index.ts +2 -2
- package/src/components/relative-time/scss/index.scss +4 -2
- package/src/components/relative-time/scss/variables.scss +4 -5
- package/src/components/root/scss/index.scss +11 -11
- package/src/components/root/scss/variables.scss +4 -4
- package/src/components/search/button.ts +24 -0
- package/src/components/search/index.ts +12 -0
- package/src/components/search/input.ts +35 -0
- package/src/components/search/parts.ts +24 -0
- package/src/components/search/scss/index.scss +36 -0
- package/src/components/search/scss/variables.scss +67 -0
- package/src/components/section/scss/variables.scss +1 -0
- package/src/components/select/expand.ts +3 -4
- package/src/components/select/index.ts +55 -41
- package/src/components/select/placement.ts +17 -1
- package/src/components/select/scss/index.scss +57 -29
- package/src/components/select/scss/variables.scss +91 -53
- package/src/components/{panels → shell}/group.ts +151 -98
- package/src/components/shell/index.ts +805 -284
- package/src/components/{panels → shell}/model.ts +329 -102
- package/src/components/shell/resize.ts +176 -0
- package/src/components/shell/scss/index.scss +502 -89
- package/src/components/shell/scss/variables.scss +264 -39
- package/src/components/shell/sidebar.ts +325 -0
- package/src/components/{panels → shell}/subtree.ts +1 -2
- package/src/components/shortcut-recorder/index.ts +99 -61
- package/src/components/shortcut-recorder/scss/index.scss +76 -52
- package/src/components/shortcut-recorder/scss/variables.scss +25 -30
- package/src/components/sortable/index.ts +364 -63
- package/src/components/sortable/scss/index.scss +22 -2
- package/src/components/sortable/scss/variables.scss +16 -4
- package/src/components/story/index.ts +56 -33
- package/src/components/story/scss/index.scss +67 -16
- package/src/components/story/scss/variables.scss +59 -18
- package/src/components/surface-field/engine.ts +157 -61
- package/src/components/surface-field/index.ts +64 -9
- package/src/components/surface-field/scss/index.scss +88 -77
- package/src/components/surface-field/scss/variables.scss +84 -36
- package/src/components/surface-field/surface.ts +225 -76
- package/src/components/tasklist/index.ts +10 -14
- package/src/components/tasklist/scss/index.scss +25 -45
- package/src/components/tasklist/scss/variables.scss +12 -29
- package/src/components/textarea/index.ts +39 -42
- package/src/components/theme/reveal.ts +1 -0
- package/src/components/theme/scss/index.scss +20 -16
- package/src/components/theme/scss/variables.scss +11 -5
- package/src/components/theme/shared.ts +3 -7
- package/src/components/toast/index.ts +7 -8
- package/src/components/toast/scss/index.scss +44 -36
- package/src/components/toast/scss/variables.scss +36 -33
- package/src/components/toolbar/index.ts +1675 -0
- package/src/components/toolbar/scss/index.scss +759 -0
- package/src/components/toolbar/scss/variables.scss +555 -0
- package/src/components/tooltip/menu.ts +301 -220
- package/src/components/tooltip/onclick.ts +18 -3
- package/src/components/tooltip/onhover.ts +13 -9
- package/src/components/tooltip/scss/index.scss +155 -188
- package/src/components/tooltip/scss/variables.scss +151 -135
- package/src/components/tooltip/shared.ts +47 -74
- package/src/components/tooltip/utilities.ts +151 -10
- package/src/components/truncate/index.ts +1 -1
- package/src/components/typewriter/rotate.ts +6 -6
- package/src/components/typewriter/scss/index.scss +14 -5
- package/src/components/uptime/scss/index.scss +8 -15
- package/src/components/uptime/scss/variables.scss +12 -1
- package/src/components/usage-meter/index.ts +1 -1
- package/src/components/usage-meter/scss/index.scss +6 -4
- package/src/components/usage-meter/scss/variables.scss +11 -11
- package/src/css-utilities/box-shadow.scss +0 -1
- package/src/css-utilities/icon.scss +9 -9
- package/src/css-utilities/surface.scss +27 -17
- package/src/modifiers/glass/index.ts +2 -2
- package/src/modifiers/glass/scss/index.scss +2 -2
- package/src/normalize/scss/index.scss +1 -1
- package/src/shared/drag.ts +92 -53
- package/src/shared/placement.ts +145 -0
- package/src/shared/transition.ts +1 -1
- package/src/shared/viewport.ts +1 -7
- package/src/tokens/scss/color.scss +2 -2
- package/src/tokens/scss/scale.scss +5 -1
- package/src/tokens/scss/size.scss +0 -7
- package/storage/svg/angle.svg +1 -0
- package/storage/svg/{chevron-left.svg → arrow.svg} +1 -1
- package/storage/svg/calendar.svg +1 -0
- package/storage/svg/circle-filled.svg +1 -0
- package/storage/svg/cursor-arrow-left.svg +1 -0
- package/storage/svg/cursor-arrow-right.svg +1 -0
- package/storage/svg/fit.svg +1 -0
- package/storage/svg/grip.svg +1 -0
- package/storage/svg/mail.svg +1 -0
- package/storage/svg/{chevron-down.svg → minus.svg} +1 -1
- package/storage/svg/music.svg +1 -0
- package/storage/svg/{chevron-up.svg → rotate-ccw.svg} +1 -1
- package/vite.config.ts +9 -13
- package/build/components/cc/index.d.ts +0 -33
- package/build/components/cc/index.js +0 -603
- package/build/components/cc/scss/index.scss +0 -2
- package/build/components/dock/index.d.ts +0 -47
- package/build/components/dock/index.js +0 -469
- package/build/components/dock/scss/index.scss +0 -2
- package/build/components/metric/flash.d.ts +0 -12
- package/build/components/metric/flash.js +0 -117
- package/build/components/metric/index.d.ts +0 -44
- package/build/components/metric/index.js +0 -275
- package/build/components/metric/scss/index.scss +0 -2
- package/build/components/pagination/dots.d.ts +0 -23
- package/build/components/pagination/dots.js +0 -115
- package/build/components/panels/dnd.d.ts +0 -47
- package/build/components/panels/dnd.js +0 -114
- package/build/components/panels/group.js +0 -322
- package/build/components/panels/index.d.ts +0 -17
- package/build/components/panels/index.js +0 -524
- package/build/components/panels/model.d.ts +0 -64
- package/build/components/panels/resize.d.ts +0 -9
- package/build/components/panels/scss/index.scss +0 -2
- package/build/components/preview/buttons.d.ts +0 -12
- package/build/components/preview/buttons.js +0 -26
- package/build/components/preview/code.d.ts +0 -8
- package/build/components/preview/code.js +0 -18
- package/build/components/preview/header.js +0 -21
- package/build/components/preview/index.d.ts +0 -37
- package/build/components/preview/index.js +0 -123
- package/build/components/preview/scss/index.scss +0 -2
- package/build/components/preview/source.d.ts +0 -12
- package/build/components/preview/source.js +0 -79
- package/build/components/preview/stage.d.ts +0 -8
- package/build/components/preview/stage.js +0 -28
- package/build/components/textarea/scss/index.scss +0 -2
- package/src/components/cc/index.ts +0 -562
- package/src/components/cc/scss/index.scss +0 -416
- package/src/components/cc/scss/variables.scss +0 -257
- package/src/components/dock/index.ts +0 -567
- package/src/components/dock/scss/index.scss +0 -346
- package/src/components/dock/scss/variables.scss +0 -357
- package/src/components/input/scss/_field.scss +0 -39
- package/src/components/input/scss/_scrub.scss +0 -89
- package/src/components/input/scss/_tag.scss +0 -142
- package/src/components/metric/flash.ts +0 -129
- package/src/components/metric/index.ts +0 -307
- package/src/components/metric/scss/_flash.scss +0 -150
- package/src/components/metric/scss/index.scss +0 -155
- package/src/components/metric/scss/variables.scss +0 -233
- package/src/components/pagination/dots.ts +0 -132
- package/src/components/panels/dnd.ts +0 -190
- package/src/components/panels/index.ts +0 -676
- package/src/components/panels/resize.ts +0 -157
- package/src/components/panels/scss/index.scss +0 -379
- package/src/components/panels/scss/variables.scss +0 -197
- package/src/components/preview/buttons.ts +0 -48
- package/src/components/preview/code.ts +0 -28
- package/src/components/preview/header.ts +0 -23
- package/src/components/preview/index.ts +0 -149
- package/src/components/preview/scss/index.scss +0 -158
- package/src/components/preview/scss/variables.scss +0 -149
- package/src/components/preview/source.ts +0 -73
- package/src/components/preview/stage.ts +0 -33
- package/src/components/range/scss/_filter.scss +0 -360
- package/src/components/range/scss/_slider.scss +0 -65
- package/src/components/range/scss/_vertical.scss +0 -10
- package/src/components/textarea/scss/index.scss +0 -72
- package/src/components/textarea/scss/variables.scss +0 -22
- package/storage/svg/amex.svg +0 -1
- package/storage/svg/arrow-down.svg +0 -1
- package/storage/svg/arrow-left.svg +0 -1
- package/storage/svg/arrow-right.svg +0 -1
- package/storage/svg/arrow-up.svg +0 -1
- package/storage/svg/card.svg +0 -1
- package/storage/svg/chip.svg +0 -1
- package/storage/svg/discover.svg +0 -1
- package/storage/svg/mastercard.svg +0 -1
- package/storage/svg/visa.svg +0 -1
- /package/build/components/{panels → shell}/subtree.d.ts +0 -0
- /package/storage/svg/{chevron-right.svg → chevron.svg} +0 -0
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { computed, effect, reactive, read, signal, write } from '@esportsplus/reactivity';
|
|
2
2
|
import { component, html, type Attributes, type On, type Renderable } from '@esportsplus/template';
|
|
3
|
-
import
|
|
3
|
+
import arrow from '@esportsplus/ui/svg/arrow.svg';
|
|
4
|
+
import enter from '@esportsplus/ui/svg/enter.svg';
|
|
5
|
+
import button from '~/components/button';
|
|
6
|
+
import group from '~/components/group';
|
|
4
7
|
import icon from '~/components/icon';
|
|
5
|
-
import input from '~/components/input';
|
|
6
8
|
import nav from '~/components/nav';
|
|
7
9
|
import overlay from '~/components/overlay';
|
|
10
|
+
import search from '~/components/search';
|
|
8
11
|
import scrollbar from '~/modifiers/scrollbar';
|
|
9
12
|
import { mac } from '~/shared/platform';
|
|
10
|
-
import down from '@esportsplus/ui/svg/arrow-down.svg';
|
|
11
|
-
import up from '@esportsplus/ui/svg/arrow-up.svg';
|
|
12
|
-
import cmd from '@esportsplus/ui/svg/command.svg';
|
|
13
|
-
import enter from '@esportsplus/ui/svg/enter.svg';
|
|
14
|
-
import magnifier from '@esportsplus/ui/svg/search.svg';
|
|
15
13
|
import '~/components/frame/scss/index.scss';
|
|
16
14
|
|
|
17
15
|
|
|
@@ -22,13 +20,13 @@ type A = Attributes & {
|
|
|
22
20
|
[COMMAND_LIST]?: Attributes;
|
|
23
21
|
[COMMAND_OPTION]?: Attributes;
|
|
24
22
|
[COMMAND_TAB]?: Attributes;
|
|
25
|
-
[COMMAND_TRIGGER]?:
|
|
23
|
+
[COMMAND_TRIGGER]?: Field;
|
|
26
24
|
// A getter re-lists whenever the reactive state it reads changes; group tabs come from the first list.
|
|
27
25
|
commands: Command[] | (() => Command[]);
|
|
28
26
|
// Toggles the palette from anywhere on the page, written like a shortcut's keys. Mod+K with the trigger, none
|
|
29
27
|
// without; an empty list turns it off.
|
|
30
28
|
hotkey?: string[];
|
|
31
|
-
label?:
|
|
29
|
+
label?: string;
|
|
32
30
|
// Caps each view's results, after ranking, so thousands of entries never render at once.
|
|
33
31
|
limit?: number;
|
|
34
32
|
// Replaces the built-in substring-then-subsequence matcher; results rank by score, highest first.
|
|
@@ -50,8 +48,7 @@ type A = Attributes & {
|
|
|
50
48
|
|
|
51
49
|
type Command = {
|
|
52
50
|
group: string;
|
|
53
|
-
|
|
54
|
-
icon?: string;
|
|
51
|
+
icon?: Sprite;
|
|
55
52
|
id: string;
|
|
56
53
|
label: string;
|
|
57
54
|
// 'Mod' is ⌘ on Apple platforms and Ctrl elsewhere.
|
|
@@ -75,9 +72,9 @@ type Dialog = Attributes<HTMLDialogElement> & {
|
|
|
75
72
|
type Entry = {
|
|
76
73
|
command?: Command;
|
|
77
74
|
group: string;
|
|
78
|
-
icon?:
|
|
75
|
+
icon?: Sprite;
|
|
79
76
|
id: string;
|
|
80
|
-
keys?:
|
|
77
|
+
keys?: string[];
|
|
81
78
|
label: string;
|
|
82
79
|
// 'label' lowercased once, for the built-in matcher.
|
|
83
80
|
lower: string;
|
|
@@ -119,14 +116,16 @@ type ResultGroup = {
|
|
|
119
116
|
|
|
120
117
|
type Shortcut = {
|
|
121
118
|
group: string;
|
|
122
|
-
|
|
123
|
-
icon?: string;
|
|
119
|
+
icon?: Sprite;
|
|
124
120
|
id: string;
|
|
125
121
|
// 'Mod' is ⌘ on Apple platforms and Ctrl elsewhere.
|
|
126
122
|
keys: string[];
|
|
127
123
|
label: string;
|
|
128
124
|
};
|
|
129
125
|
|
|
126
|
+
// A sprite id, as imported from '@esportsplus/ui/svg/*.svg', or one with a class to add, such as 'icon--left'.
|
|
127
|
+
type Sprite = string | { class: string; href: string };
|
|
128
|
+
|
|
130
129
|
type State = {
|
|
131
130
|
active: boolean;
|
|
132
131
|
// -1 until an arrow key selects the first result.
|
|
@@ -144,6 +143,8 @@ type Store = {
|
|
|
144
143
|
// A command group's name opens that group's tab.
|
|
145
144
|
type Tab = 'all' | 'shortcuts' | (string & {});
|
|
146
145
|
|
|
146
|
+
type Trigger = Parameters<typeof search.button>[0];
|
|
147
|
+
|
|
147
148
|
type View = {
|
|
148
149
|
empty: string;
|
|
149
150
|
entries: (query: string) => Entry[];
|
|
@@ -171,11 +172,6 @@ const COMMAND_TAB = Symbol.for('@esportsplus/ui/command.tab');
|
|
|
171
172
|
|
|
172
173
|
const COMMAND_TRIGGER = Symbol.for('@esportsplus/ui/command.trigger');
|
|
173
174
|
|
|
174
|
-
const GLYPHS: Record<string, string> = {
|
|
175
|
-
Alt: '⌥',
|
|
176
|
-
Shift: '⇧'
|
|
177
|
-
};
|
|
178
|
-
|
|
179
175
|
const RECENT_KEY = 'recent';
|
|
180
176
|
|
|
181
177
|
const RECENT_LIMIT = 8;
|
|
@@ -251,20 +247,10 @@ function filter(entries: Entry[], query: string, matcher?: Matcher, limit = Infi
|
|
|
251
247
|
return { flat, groups };
|
|
252
248
|
}
|
|
253
249
|
|
|
254
|
-
|
|
255
|
-
// since most fonts lack the glyph and fall back to one that sits wrong in the keycap.
|
|
256
|
-
function glyph(key: string, apple: boolean): Renderable<unknown> {
|
|
257
|
-
if (key === 'Mod') {
|
|
258
|
-
return apple ? sprite(cmd, 'command-kbd-icon') : 'Ctrl';
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return (apple && GLYPHS[key]) || key;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function hint(keys: Renderable<unknown>[], label: string) {
|
|
250
|
+
function hint(content: Renderable<unknown>[], label: string) {
|
|
265
251
|
return html`
|
|
266
252
|
<span class='command-footer-hint'>
|
|
267
|
-
${
|
|
253
|
+
${keycaps(content)}
|
|
268
254
|
${label}
|
|
269
255
|
</span>
|
|
270
256
|
`;
|
|
@@ -277,10 +263,15 @@ function keep(e: MouseEvent) {
|
|
|
277
263
|
}
|
|
278
264
|
}
|
|
279
265
|
|
|
280
|
-
|
|
266
|
+
// 'Mod' is ⌘ on Apple platforms and Ctrl elsewhere.
|
|
267
|
+
function kbd(keys: string[]) {
|
|
268
|
+
return keycaps(keys.map((key) => button.kbd({ key })));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function keycaps(content: Renderable<unknown>[]) {
|
|
281
272
|
return html`
|
|
282
273
|
<span aria-hidden='true' class='command-keys'>
|
|
283
|
-
${
|
|
274
|
+
${content}
|
|
284
275
|
</span>
|
|
285
276
|
`;
|
|
286
277
|
}
|
|
@@ -348,6 +339,21 @@ function match(hay: string, needle: string): [number, number][] | null {
|
|
|
348
339
|
return ranges;
|
|
349
340
|
}
|
|
350
341
|
|
|
342
|
+
// A 'search.button' standing in for the palette's field: pressing it opens the palette. The keycaps only show the
|
|
343
|
+
// hotkey; the palette binds it. 'command-trigger' marks it as declaring the hotkey on the palette's behalf.
|
|
344
|
+
function opener({ kbd: keys = [], label = 'Search', ...attributes }: Trigger, state: State, open: () => void) {
|
|
345
|
+
return search.button({
|
|
346
|
+
'aria-haspopup': 'dialog',
|
|
347
|
+
...(keys.length > 0 ? { 'aria-keyshortcuts': aria(keys, mac() ? 'Meta' : 'Control') } : {}),
|
|
348
|
+
...attributes,
|
|
349
|
+
'aria-expanded': () => state.active ? 'true' : 'false',
|
|
350
|
+
class: ['command-trigger', attributes.class].flat(),
|
|
351
|
+
kbd: keys,
|
|
352
|
+
label,
|
|
353
|
+
onclick: open
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
351
357
|
function spans(indices: number[]) {
|
|
352
358
|
let ranges: [number, number][] = [];
|
|
353
359
|
|
|
@@ -365,8 +371,12 @@ function spans(indices: number[]) {
|
|
|
365
371
|
return ranges;
|
|
366
372
|
}
|
|
367
373
|
|
|
368
|
-
function sprite(
|
|
369
|
-
|
|
374
|
+
function sprite(target: Sprite, name: Attributes['class'] = '') {
|
|
375
|
+
if (typeof target === 'string') {
|
|
376
|
+
return icon({ 'aria-hidden': 'true', class: name }, target);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return icon({ 'aria-hidden': 'true', class: [name, target.class].flat() }, target.href);
|
|
370
380
|
}
|
|
371
381
|
|
|
372
382
|
|
|
@@ -390,18 +400,13 @@ export default component(
|
|
|
390
400
|
...attributes
|
|
391
401
|
}: A
|
|
392
402
|
) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
keys = hotkey ?? (trigger ? ['Mod', 'K'] : []),
|
|
396
|
-
groupAttributes = this?.attributes?.[COMMAND_GROUP],
|
|
397
|
-
optionAttributes = this?.attributes?.[COMMAND_OPTION],
|
|
398
|
-
// The active option's id; options select on it, so moving it restyles two rows rather than every one.
|
|
399
|
-
active = signal<string | undefined>(undefined),
|
|
403
|
+
// The active option's id; options select on it, so moving it restyles two rows rather than every one.
|
|
404
|
+
let active = signal<string | undefined>(undefined),
|
|
400
405
|
bindings = (shortcuts ?? []).map((shortcut): Entry => ({
|
|
401
406
|
group: shortcut.group,
|
|
402
407
|
icon: shortcut.icon,
|
|
403
408
|
id: shortcut.id,
|
|
404
|
-
keys: shortcut.keys
|
|
409
|
+
keys: shortcut.keys,
|
|
405
410
|
label: shortcut.label,
|
|
406
411
|
lower: shortcut.label.toLowerCase()
|
|
407
412
|
})),
|
|
@@ -410,11 +415,15 @@ export default component(
|
|
|
410
415
|
group: command.group,
|
|
411
416
|
icon: command.icon,
|
|
412
417
|
id: command.id,
|
|
413
|
-
keys: command.shortcut
|
|
418
|
+
keys: command.shortcut,
|
|
414
419
|
label: command.label,
|
|
415
420
|
lower: command.label.toLowerCase()
|
|
416
421
|
}))),
|
|
422
|
+
groupAttributes = this?.attributes?.[COMMAND_GROUP],
|
|
423
|
+
id = `command-${++uid}`,
|
|
424
|
+
keys = hotkey ?? (trigger ? ['Mod', 'K'] : []),
|
|
417
425
|
lookup = computed(() => new Map(read(entries).map((entry) => [entry.id, entry]))),
|
|
426
|
+
optionAttributes = this?.attributes?.[COMMAND_OPTION],
|
|
418
427
|
// A Set keeps insertion order, most recent first, and replacing it is what re-runs the list.
|
|
419
428
|
ui = reactive({ moving: false, recent: new Set<string>() }),
|
|
420
429
|
views: View[] = ([
|
|
@@ -529,7 +538,6 @@ export default component(
|
|
|
529
538
|
function results(view: View) {
|
|
530
539
|
let groups = read(view.results).groups.map(({ group, items }, g): ResultGroup => ({
|
|
531
540
|
id: `${view.key}-group-${g}`,
|
|
532
|
-
label: group,
|
|
533
541
|
items: items.map(({ entry, index, ranges }) => {
|
|
534
542
|
let key = `${view.key}-${index}`;
|
|
535
543
|
|
|
@@ -537,8 +545,6 @@ export default component(
|
|
|
537
545
|
attributes: {
|
|
538
546
|
...optionAttributes,
|
|
539
547
|
...attributes[COMMAND_OPTION],
|
|
540
|
-
id: key,
|
|
541
|
-
role: 'option',
|
|
542
548
|
'aria-selected': () => signal.selector(active, key) ? 'true' : 'false',
|
|
543
549
|
class: [
|
|
544
550
|
optionAttributes?.class,
|
|
@@ -546,10 +552,12 @@ export default component(
|
|
|
546
552
|
!entry.command && 'command-option--inert',
|
|
547
553
|
() => signal.selector(active, key) && '--active'
|
|
548
554
|
].flat(),
|
|
555
|
+
id: key,
|
|
549
556
|
onclick: (event: Event) => {
|
|
550
557
|
event.preventDefault();
|
|
551
558
|
run(entry);
|
|
552
|
-
}
|
|
559
|
+
},
|
|
560
|
+
role: 'option'
|
|
553
561
|
},
|
|
554
562
|
command: entry.command,
|
|
555
563
|
content: html`
|
|
@@ -560,7 +568,8 @@ export default component(
|
|
|
560
568
|
id: entry.id,
|
|
561
569
|
label: entry.label
|
|
562
570
|
};
|
|
563
|
-
})
|
|
571
|
+
}),
|
|
572
|
+
label: group
|
|
564
573
|
}));
|
|
565
574
|
|
|
566
575
|
return render ? render(groups) : nav.tree({
|
|
@@ -576,7 +585,7 @@ export default component(
|
|
|
576
585
|
}],
|
|
577
586
|
label: group.label
|
|
578
587
|
})),
|
|
579
|
-
[nav.tree.highlight]:
|
|
588
|
+
[nav.tree.highlight]: true
|
|
580
589
|
});
|
|
581
590
|
}
|
|
582
591
|
|
|
@@ -607,7 +616,7 @@ export default component(
|
|
|
607
616
|
}
|
|
608
617
|
|
|
609
618
|
// Another palette on the page already claimed it; inert copies stay quiet. 'host' is the trigger, or the
|
|
610
|
-
//
|
|
619
|
+
// palette itself without one: never the panel, which the closed overlay holds inert.
|
|
611
620
|
if (e.defaultPrevented || host.closest('[inert]')) {
|
|
612
621
|
return;
|
|
613
622
|
}
|
|
@@ -659,26 +668,19 @@ export default component(
|
|
|
659
668
|
}
|
|
660
669
|
|
|
661
670
|
return html`
|
|
662
|
-
<div class='command' ${this?.attributes} ${attributes}>
|
|
663
|
-
${trigger &&
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}}
|
|
676
|
-
>
|
|
677
|
-
${sprite(magnifier, 'command-trigger-icon command-trigger-icon--search')}
|
|
678
|
-
<span class='command-trigger-label'>${label}</span>
|
|
679
|
-
${keys.length > 0 && kbd(keys.map((key) => glyph(key, apple)))}
|
|
680
|
-
</button>
|
|
681
|
-
`}
|
|
671
|
+
<div class='command' ${this?.attributes} ${attributes} ${!trigger && { onconnect: listen }}>
|
|
672
|
+
${trigger && opener(
|
|
673
|
+
{
|
|
674
|
+
kbd: keys,
|
|
675
|
+
label,
|
|
676
|
+
...this?.attributes?.[COMMAND_TRIGGER],
|
|
677
|
+
...attributes[COMMAND_TRIGGER],
|
|
678
|
+
class: [this?.attributes?.[COMMAND_TRIGGER]?.class, attributes[COMMAND_TRIGGER]?.class].flat(),
|
|
679
|
+
onconnect: listen
|
|
680
|
+
},
|
|
681
|
+
state,
|
|
682
|
+
show
|
|
683
|
+
)}
|
|
682
684
|
|
|
683
685
|
${overlay(
|
|
684
686
|
{
|
|
@@ -692,109 +694,112 @@ export default component(
|
|
|
692
694
|
<div
|
|
693
695
|
class='command-panel'
|
|
694
696
|
${{ onmousedown: keep }}
|
|
695
|
-
${!trigger && { onconnect: listen }}
|
|
696
697
|
>
|
|
697
698
|
<div class='command-body'>
|
|
698
699
|
<div class='command-search'>
|
|
699
|
-
${
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
700
|
+
${search.input(
|
|
701
|
+
{
|
|
702
|
+
'aria-activedescendant': () => read(active),
|
|
703
|
+
'aria-autocomplete': 'list',
|
|
704
|
+
'aria-controls': () => `${current().key}-listbox`,
|
|
705
|
+
'aria-expanded': 'true',
|
|
706
|
+
'aria-label': () => current().search,
|
|
707
|
+
autofocus: true,
|
|
708
|
+
kbd: keys,
|
|
709
|
+
oninput: (e: Event) => {
|
|
710
|
+
state.index = -1;
|
|
711
|
+
state.query = (e.target as HTMLInputElement).value;
|
|
712
|
+
},
|
|
713
|
+
onkeydown: (e: KeyboardEvent) => {
|
|
714
|
+
if (e.isComposing) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
716
717
|
|
|
717
|
-
|
|
718
|
-
|
|
718
|
+
let view = current(),
|
|
719
|
+
items = read(view.results).flat;
|
|
719
720
|
|
|
720
|
-
|
|
721
|
-
|
|
721
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
722
|
+
e.preventDefault();
|
|
722
723
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
724
|
+
if (!items.length) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
726
727
|
|
|
727
|
-
|
|
728
|
+
let index = selected();
|
|
728
729
|
|
|
729
|
-
|
|
730
|
+
state.index = index < 0 ? 0 : (index + (e.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length;
|
|
730
731
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
732
|
+
// 'nearest' only scrolls when the item is out of view.
|
|
733
|
+
document.getElementById(option(view, state.index) ?? '')?.scrollIntoView({ block: 'nearest' });
|
|
734
|
+
}
|
|
735
|
+
else if (e.key === 'Enter') {
|
|
736
|
+
e.preventDefault();
|
|
736
737
|
|
|
737
|
-
|
|
738
|
+
let item = items[selected()];
|
|
738
739
|
|
|
739
|
-
|
|
740
|
-
|
|
740
|
+
if (item) {
|
|
741
|
+
run(item.entry);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
else if (e.key === 'Escape') {
|
|
745
|
+
e.preventDefault();
|
|
746
|
+
close();
|
|
741
747
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
748
|
+
else if (e.key === 'Tab') {
|
|
749
|
+
// The input is the dialog's only tab stop, so Tab moves between views instead.
|
|
750
|
+
e.preventDefault();
|
|
751
|
+
step(e.shiftKey ? -1 : 1);
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
placeholder: () => current().placeholder,
|
|
755
|
+
role: 'combobox',
|
|
756
|
+
spellcheck: false,
|
|
757
|
+
value: () => state.query,
|
|
758
|
+
...this?.attributes?.[COMMAND_INPUT],
|
|
759
|
+
...attributes[COMMAND_INPUT],
|
|
760
|
+
class: ['command-input', this?.attributes?.[COMMAND_INPUT]?.class, attributes[COMMAND_INPUT]?.class].flat()
|
|
752
761
|
},
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
...this?.attributes?.[COMMAND_INPUT],
|
|
758
|
-
...attributes[COMMAND_INPUT],
|
|
759
|
-
class: ['command-input', this?.attributes?.[COMMAND_INPUT]?.class, attributes[COMMAND_INPUT]?.class].flat()
|
|
760
|
-
})}
|
|
761
|
-
${() => state.query.trim() && html`
|
|
762
|
-
<span aria-hidden='true' class='command-count'>
|
|
763
|
-
${() => {
|
|
764
|
-
let count = read(current().results).flat.length;
|
|
765
|
-
|
|
766
|
-
return `${count} ${count === 1 ? 'result' : 'results'}`;
|
|
767
|
-
}}
|
|
768
|
-
</span>
|
|
769
|
-
`}
|
|
770
|
-
</div>
|
|
762
|
+
() => state.query.trim() && html`
|
|
763
|
+
<span class='command-count'>
|
|
764
|
+
${() => {
|
|
765
|
+
let count = read(current().results).flat.length;
|
|
771
766
|
|
|
772
|
-
|
|
773
|
-
<div aria-label='Views' class='command-tabs' role='tablist'>
|
|
774
|
-
${highlight({ class: 'command-tabs-highlight' })}
|
|
775
|
-
${views.map((view) => html`
|
|
776
|
-
<button
|
|
777
|
-
aria-controls='${view.key}'
|
|
778
|
-
class='button command-tab'
|
|
779
|
-
id='${view.key}-tab'
|
|
780
|
-
role='tab'
|
|
781
|
-
tabindex='-1'
|
|
782
|
-
type='button'
|
|
783
|
-
${this?.attributes?.[COMMAND_TAB]}
|
|
784
|
-
${attributes[COMMAND_TAB]}
|
|
785
|
-
${{
|
|
786
|
-
'aria-selected': () => current() === view ? 'true' : 'false',
|
|
787
|
-
class: () => current() === view && '--active',
|
|
788
|
-
onclick: () => {
|
|
789
|
-
state.tab = view.id;
|
|
790
|
-
}
|
|
767
|
+
return `${count} ${count === 1 ? 'result' : 'results'}`;
|
|
791
768
|
}}
|
|
792
|
-
>
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
769
|
+
</span>
|
|
770
|
+
`
|
|
771
|
+
)}
|
|
772
|
+
</div>
|
|
773
|
+
|
|
774
|
+
${views.length > 1 && group(
|
|
775
|
+
{
|
|
776
|
+
[group.highlight]: { class: 'highlight--surface' },
|
|
777
|
+
'aria-label': 'Views',
|
|
778
|
+
class: 'group--surface command-tabs',
|
|
779
|
+
role: 'tablist'
|
|
780
|
+
},
|
|
781
|
+
views.map((view) => html`
|
|
782
|
+
<button
|
|
783
|
+
aria-controls='${view.key}'
|
|
784
|
+
class='button button--group command-tab'
|
|
785
|
+
id='${view.key}-tab'
|
|
786
|
+
role='tab'
|
|
787
|
+
tabindex='-1'
|
|
788
|
+
type='button'
|
|
789
|
+
${this?.attributes?.[COMMAND_TAB]}
|
|
790
|
+
${attributes[COMMAND_TAB]}
|
|
791
|
+
${{
|
|
792
|
+
'aria-selected': () => current() === view ? 'true' : 'false',
|
|
793
|
+
class: () => current() === view && '--active',
|
|
794
|
+
onclick: () => {
|
|
795
|
+
state.tab = view.id;
|
|
796
|
+
}
|
|
797
|
+
}}
|
|
798
|
+
>
|
|
799
|
+
${view.label}
|
|
800
|
+
</button>
|
|
801
|
+
`)
|
|
802
|
+
)}
|
|
798
803
|
|
|
799
804
|
<div
|
|
800
805
|
class='command-views'
|
|
@@ -840,10 +845,13 @@ export default component(
|
|
|
840
845
|
</div>
|
|
841
846
|
|
|
842
847
|
<div aria-hidden='true' class='command-footer'>
|
|
843
|
-
${hint(['
|
|
844
|
-
${views.length > 1 && hint(['tab'], 'Switch')}
|
|
845
|
-
${hint([
|
|
846
|
-
|
|
848
|
+
${hint([button.kbd({ key: 'escape' })], 'Close')}
|
|
849
|
+
${views.length > 1 && hint([button.kbd({ key: 'tab' })], 'Switch')}
|
|
850
|
+
${hint([
|
|
851
|
+
button.kbd({ key: 'up' }, sprite(arrow, 'button-kbd-icon icon--up')),
|
|
852
|
+
button.kbd({ key: 'down' }, sprite(arrow, 'button-kbd-icon icon--down'))
|
|
853
|
+
], 'Navigate')}
|
|
854
|
+
${hint([button.kbd({ key: 'enter' }, sprite(enter, 'button-kbd-icon'))], 'Select')}
|
|
847
855
|
</div>
|
|
848
856
|
</div>
|
|
849
857
|
`
|
|
@@ -861,5 +869,5 @@ export default component(
|
|
|
861
869
|
trigger: COMMAND_TRIGGER
|
|
862
870
|
}
|
|
863
871
|
);
|
|
864
|
-
export {
|
|
865
|
-
export type { Command, Matcher, Result, ResultGroup, Shortcut, State, Store, Tab };
|
|
872
|
+
export { opener };
|
|
873
|
+
export type { Command, Matcher, Result, ResultGroup, Shortcut, Sprite, State, Store, Tab };
|