@esportsplus/ui 0.63.0 → 0.64.1
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 +2 -2
- package/.audit/rules-audit.md +2 -2
- 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 -6
- package/build/components/index.js +3 -6
- 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 +2 -5
- 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 -6
- 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 -75
- 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/NOTICE +0 -232
- 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/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,27 +1,34 @@
|
|
|
1
1
|
import { flush, onCleanup, reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
3
|
import highlight, { type A as HighlightAttributes } from '~/components/highlight';
|
|
4
|
+
import icon from '~/components/icon';
|
|
4
5
|
import overlay from '~/components/overlay';
|
|
6
|
+
import scrollbar from '~/modifiers/scrollbar';
|
|
5
7
|
import { finished } from '~/shared/animation';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { expand as cover, margin, place, type Corner, type Side } from '~/shared/placement';
|
|
9
|
+
import { viewport } from '~/shared/viewport';
|
|
10
|
+
import { morph, px } from './utilities';
|
|
11
|
+
import chevron from '@esportsplus/ui/svg/chevron.svg';
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
type A = Attributes & {
|
|
11
|
-
[MENU_TRIGGER]?: Attributes & { onclick?: never };
|
|
12
15
|
[MENU_ITEM]?: Attributes;
|
|
13
16
|
[MENU_PANEL]?: Attributes;
|
|
17
|
+
[MENU_TRIGGER]?: Attributes & { onclick?: never };
|
|
18
|
+
// Lines the menu up with the trigger's start or end edge; a context menu opens from the point.
|
|
19
|
+
align?: 'end' | 'start';
|
|
14
20
|
animate?: boolean;
|
|
15
21
|
controller?: (controller: Controller) => void;
|
|
16
|
-
|
|
22
|
+
// Grows out of the trigger over it rather than opening beside it, toward the corner with room.
|
|
23
|
+
expand?: boolean;
|
|
17
24
|
// A layer gliding between rows on hover and keyboard focus, in place of each item's own fill; an object configures
|
|
18
25
|
// the highlight.
|
|
19
26
|
highlight?: boolean | HighlightAttributes;
|
|
20
27
|
items: Item[];
|
|
21
|
-
openOn?: 'click' | 'hover';
|
|
22
28
|
ondocumentclick?: never;
|
|
23
29
|
onkeydown?: never;
|
|
24
30
|
onselect?: (item: Item) => void;
|
|
31
|
+
openOn?: 'click' | 'hover';
|
|
25
32
|
state?: { active: boolean };
|
|
26
33
|
};
|
|
27
34
|
|
|
@@ -36,8 +43,8 @@ type Controller = {
|
|
|
36
43
|
type Item = {
|
|
37
44
|
danger?: boolean;
|
|
38
45
|
disabled?: boolean;
|
|
39
|
-
hint?: string;
|
|
40
46
|
hidden?: Attributes['hidden'];
|
|
47
|
+
hint?: string;
|
|
41
48
|
href?: string;
|
|
42
49
|
// Factory because the icon renders twice for branches: in the row and in the panel header.
|
|
43
50
|
icon?: () => Renderable<unknown>;
|
|
@@ -53,20 +60,19 @@ type MenuNode = {
|
|
|
53
60
|
item?: Item;
|
|
54
61
|
panel?: HTMLElement;
|
|
55
62
|
parent?: MenuNode;
|
|
56
|
-
|
|
63
|
+
// A branch panel's place over its parent: 'top' in the parent's box, how far it is lifted above the row that opened
|
|
64
|
+
// it to stay on screen, and the height it scrolls past.
|
|
65
|
+
state: { height: number | undefined, lift: number, open: boolean, render: boolean, settled: boolean, top: number };
|
|
57
66
|
};
|
|
58
67
|
|
|
59
68
|
type Point = { x: number, y: number };
|
|
60
69
|
|
|
61
70
|
|
|
62
|
-
const MENU_TRIGGER = Symbol.for('@esportsplus/ui/tooltip.menu.trigger');
|
|
63
|
-
|
|
64
71
|
const MENU_ITEM = Symbol.for('@esportsplus/ui/tooltip.menu.item');
|
|
65
72
|
|
|
66
73
|
const MENU_PANEL = Symbol.for('@esportsplus/ui/tooltip.menu.panel');
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
const VIEWPORT_MARGIN = 8;
|
|
75
|
+
const MENU_TRIGGER = Symbol.for('@esportsplus/ui/tooltip.menu.trigger');
|
|
70
76
|
|
|
71
77
|
|
|
72
78
|
// Names each menu's anchor, which its layer is placed over.
|
|
@@ -83,52 +89,29 @@ function covered(node: MenuNode) {
|
|
|
83
89
|
return false;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
function enabled(node: MenuNode) {
|
|
87
|
-
let nodes: MenuNode[] = [];
|
|
88
|
-
|
|
89
|
-
for (let i = 0, n = node.children.length; i < n; i++) {
|
|
90
|
-
let child = node.children[i];
|
|
91
|
-
|
|
92
|
-
if (child.button && !child.button.hidden && !child.item?.disabled) {
|
|
93
|
-
nodes.push(child);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return nodes;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function tree(items: Item[], parent?: MenuNode) {
|
|
101
|
-
let nodes: MenuNode[] = [];
|
|
102
|
-
|
|
103
|
-
for (let i = 0, n = items.length; i < n; i++) {
|
|
104
|
-
let node: MenuNode = {
|
|
105
|
-
children: [],
|
|
106
|
-
item: items[i],
|
|
107
|
-
parent,
|
|
108
|
-
state: reactive({ open: false, render: false, settled: false })
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
node.children = tree(items[i].items ?? [], node);
|
|
112
|
-
nodes.push(node);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return nodes;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
92
|
function createMenu(context = false) {
|
|
120
93
|
return component(
|
|
121
|
-
({ animate = true, controller, expand: expansion = false, highlight: highlighted = false, items, onselect, openOn = 'click', state = reactive({ active: false }), ...attributes }: A, content) => {
|
|
122
|
-
let
|
|
123
|
-
stack: MenuNode[] = [root],
|
|
124
|
-
hiding = 0,
|
|
94
|
+
({ align = 'start', animate = true, controller, expand: expansion = false, highlight: highlighted = false, items, onselect, openOn = 'click', state = reactive({ active: false }), ...attributes }: A, content) => {
|
|
95
|
+
let hiding = 0,
|
|
125
96
|
host: HTMLElement | undefined,
|
|
97
|
+
// Where the root panel last opened, kept while it still fits there.
|
|
98
|
+
last: { corner?: Corner, side?: Side } = {},
|
|
126
99
|
layer: HTMLElement | undefined,
|
|
127
100
|
leaving: ReturnType<typeof setTimeout> | undefined,
|
|
128
101
|
name = `--tooltip-menu-${++anchors}`,
|
|
102
|
+
// Where a context menu was asked to open, as a viewport point.
|
|
103
|
+
origin: Point | undefined,
|
|
129
104
|
pending: VoidFunction | undefined,
|
|
130
|
-
// The root panel's place
|
|
131
|
-
|
|
105
|
+
// The root panel's place over the layer, the height it scrolls past, and the way an expanding one grows
|
|
106
|
+
// across, 1 rightward and -1 leftward.
|
|
107
|
+
placement = reactive({
|
|
108
|
+
direction: 1,
|
|
109
|
+
height: undefined as number | undefined,
|
|
110
|
+
x: undefined as number | undefined,
|
|
111
|
+
y: undefined as number | undefined
|
|
112
|
+
}),
|
|
113
|
+
root: MenuNode = { children: [], state: reactive({ height: undefined as number | undefined, lift: 0, open: true, render: true, settled: true, top: 0 }) },
|
|
114
|
+
stack: MenuNode[] = [root],
|
|
132
115
|
trigger: HTMLElement | undefined;
|
|
133
116
|
|
|
134
117
|
root.children = tree(items, root);
|
|
@@ -149,21 +132,16 @@ function createMenu(context = false) {
|
|
|
149
132
|
open();
|
|
150
133
|
}
|
|
151
134
|
else if (position) {
|
|
152
|
-
|
|
135
|
+
at(position);
|
|
153
136
|
}
|
|
154
137
|
else if (host) {
|
|
155
138
|
let focused = document.activeElement;
|
|
156
139
|
|
|
157
|
-
|
|
140
|
+
at(anchor(focused && host.contains(focused) && !root.panel?.contains(focused) ? focused : host));
|
|
158
141
|
}
|
|
159
142
|
}
|
|
160
143
|
});
|
|
161
144
|
|
|
162
|
-
function stay() {
|
|
163
|
-
clearTimeout(leaving);
|
|
164
|
-
leaving = undefined;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
145
|
// Below a focused element inside the host; over the host's own corner.
|
|
168
146
|
function anchor(element: Element): Point {
|
|
169
147
|
let bounds = element.getBoundingClientRect();
|
|
@@ -171,6 +149,78 @@ function createMenu(context = false) {
|
|
|
171
149
|
return { x: bounds.left, y: element === host ? bounds.top : bounds.bottom };
|
|
172
150
|
}
|
|
173
151
|
|
|
152
|
+
// Places the root panel beside its trigger, or a context menu's point, on the side it last opened on while it
|
|
153
|
+
// still fits there, else where there's room, capped to scroll past the room it has; an expanding panel
|
|
154
|
+
// covers its trigger and grows out of it toward the corner it last grew toward, or one with room. Measured at its
|
|
155
|
+
// natural size first; nothing paints in between.
|
|
156
|
+
function arrange() {
|
|
157
|
+
let element = root.panel;
|
|
158
|
+
|
|
159
|
+
if (!element || !host || !layer) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
placement.height = undefined;
|
|
164
|
+
placement.x = undefined;
|
|
165
|
+
placement.y = undefined;
|
|
166
|
+
flush();
|
|
167
|
+
|
|
168
|
+
let bounds = host.getBoundingClientRect(),
|
|
169
|
+
box = layer.getBoundingClientRect(),
|
|
170
|
+
height = element.offsetHeight,
|
|
171
|
+
space = margin(element),
|
|
172
|
+
width = element.offsetWidth;
|
|
173
|
+
|
|
174
|
+
if (expansion) {
|
|
175
|
+
let grown = cover({ anchor: bounds, corner: last.corner, height, margin: space, width });
|
|
176
|
+
|
|
177
|
+
last.corner = grown.corner;
|
|
178
|
+
placement.direction = grown.corner[1] === 'e' ? 1 : -1;
|
|
179
|
+
placement.height = grown.maxHeight;
|
|
180
|
+
placement.x = grown.x - box.left;
|
|
181
|
+
placement.y = grown.y - box.top;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let { maxHeight, side, x, y } = place({
|
|
186
|
+
align,
|
|
187
|
+
anchor: context && origin ? new DOMRect(origin.x, origin.y, 0, 0) : bounds,
|
|
188
|
+
gap: context ? 0 : parseFloat(getComputedStyle(element).getPropertyValue('--offset')) || 0,
|
|
189
|
+
height,
|
|
190
|
+
margin: space,
|
|
191
|
+
side: last.side,
|
|
192
|
+
width
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
last.side = side;
|
|
196
|
+
placement.height = maxHeight;
|
|
197
|
+
placement.x = x - box.left;
|
|
198
|
+
placement.y = y - box.top;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Opens a context menu at 'point', or moves it there while open.
|
|
202
|
+
function at(point: Point) {
|
|
203
|
+
if (!host || !root.panel) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
let focused = document.activeElement;
|
|
208
|
+
|
|
209
|
+
// Kept while focus is already in the menu, so moving an open menu still returns to the original holder.
|
|
210
|
+
if (!root.panel.contains(focused)) {
|
|
211
|
+
trigger = focused instanceof HTMLElement && focused !== document.body ? focused : host;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
origin = point;
|
|
215
|
+
|
|
216
|
+
if (state.active || pending) {
|
|
217
|
+
reset();
|
|
218
|
+
arrange();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
open();
|
|
222
|
+
}
|
|
223
|
+
|
|
174
224
|
function close(focus: boolean) {
|
|
175
225
|
stay();
|
|
176
226
|
pending?.();
|
|
@@ -196,6 +246,27 @@ function createMenu(context = false) {
|
|
|
196
246
|
}
|
|
197
247
|
}
|
|
198
248
|
|
|
249
|
+
function connect(element: HTMLElement) {
|
|
250
|
+
host = element;
|
|
251
|
+
trigger = element;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function contextmenu(event: MouseEvent) {
|
|
255
|
+
if (!host || !root.panel || root.panel.contains(event.target as Node)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
|
|
261
|
+
// Synthetic events carry no point.
|
|
262
|
+
if (event.clientX === 0 && event.clientY === 0) {
|
|
263
|
+
at(anchor(event.target instanceof Element ? event.target : host));
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
at({ x: event.clientX, y: event.clientY });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
199
270
|
function drill(node: MenuNode) {
|
|
200
271
|
if (!node.children.length || node.item?.disabled) {
|
|
201
272
|
return;
|
|
@@ -215,17 +286,17 @@ function createMenu(context = false) {
|
|
|
215
286
|
|
|
216
287
|
function entry(node: MenuNode): Renderable<unknown> {
|
|
217
288
|
let branch = node.children.length > 0,
|
|
218
|
-
{ danger, disabled, hint, icon, items: _items, label, onselect: _onselect, ...itemAttributes } = node.item!,
|
|
289
|
+
{ danger, disabled, hint, icon: glyph, items: _items, label, onselect: _onselect, ...itemAttributes } = node.item!,
|
|
219
290
|
contents = html`
|
|
220
|
-
${
|
|
291
|
+
${glyph && html`<span class='tooltip-menu-icon'>${glyph()}</span>`}
|
|
221
292
|
<span class='tooltip-menu-label'>${label}</span>
|
|
222
293
|
${hint && html`<span class='tooltip-menu-hint'>${hint}</span>`}
|
|
223
|
-
${branch &&
|
|
294
|
+
${branch && icon({ 'aria-hidden': 'true', class: 'tooltip-menu-chevron icon--rotate' }, chevron)}
|
|
224
295
|
`,
|
|
225
296
|
bindings = {
|
|
297
|
+
'aria-disabled': disabled === true && 'true',
|
|
226
298
|
'aria-expanded': branch && (() => String(node.state.open)),
|
|
227
299
|
'aria-haspopup': branch && 'menu',
|
|
228
|
-
'aria-disabled': disabled === true && 'true',
|
|
229
300
|
onclick: (event: MouseEvent) => {
|
|
230
301
|
if (disabled) {
|
|
231
302
|
event.preventDefault();
|
|
@@ -246,7 +317,7 @@ function createMenu(context = false) {
|
|
|
246
317
|
};
|
|
247
318
|
|
|
248
319
|
return html`
|
|
249
|
-
<div class='tooltip-menu-entry ${disabled && '--disabled'}'
|
|
320
|
+
<div class='tooltip-menu-entry ${disabled && '--disabled'}'>
|
|
250
321
|
${itemAttributes.href ? html`<a
|
|
251
322
|
class='tooltip-menu-item ${danger && 'tooltip-menu-item--danger'}'
|
|
252
323
|
role='menuitem'
|
|
@@ -264,13 +335,13 @@ function createMenu(context = false) {
|
|
|
264
335
|
${bindings}
|
|
265
336
|
${{ disabled: disabled === true }}
|
|
266
337
|
>${contents}</button>`}
|
|
267
|
-
|
|
268
|
-
${() => branch && node.state.render && panel(node)}
|
|
269
338
|
</div>
|
|
270
339
|
`;
|
|
271
340
|
}
|
|
272
341
|
|
|
273
342
|
function expand(node: MenuNode) {
|
|
343
|
+
nest(node);
|
|
344
|
+
|
|
274
345
|
// No transitionend will settle it: either still open from a pending close, or motion is off
|
|
275
346
|
node.state.settled = node.state.open || instant();
|
|
276
347
|
node.state.open = true;
|
|
@@ -278,6 +349,10 @@ function createMenu(context = false) {
|
|
|
278
349
|
enabled(node)[0]?.button?.focus();
|
|
279
350
|
}
|
|
280
351
|
|
|
352
|
+
function inside(node: Node | null) {
|
|
353
|
+
return !!node && (!!host?.contains(node) || !!layer?.contains(node));
|
|
354
|
+
}
|
|
355
|
+
|
|
281
356
|
// Reduced motion keeps the fades, so '--open-duration' stays set while the reveal clips snap.
|
|
282
357
|
function instant() {
|
|
283
358
|
return !root.panel
|
|
@@ -285,6 +360,71 @@ function createMenu(context = false) {
|
|
|
285
360
|
|| matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
286
361
|
}
|
|
287
362
|
|
|
363
|
+
function keydown(e: KeyboardEvent) {
|
|
364
|
+
if (context && (e.key === 'ContextMenu' || (e.key === 'F10' && e.shiftKey))) {
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
|
|
367
|
+
if (!root.panel?.contains(e.target as Node)) {
|
|
368
|
+
at(anchor(e.target as Element));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (!state.active) {
|
|
375
|
+
if (e.key === 'ArrowDown' && e.target === trigger) {
|
|
376
|
+
e.preventDefault();
|
|
377
|
+
open();
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
let nodes = enabled(stack[stack.length - 1]),
|
|
384
|
+
index = nodes.findIndex((node) => node.button === document.activeElement),
|
|
385
|
+
n = nodes.length;
|
|
386
|
+
|
|
387
|
+
switch (e.key) {
|
|
388
|
+
case 'ArrowDown':
|
|
389
|
+
nodes[(index + 1) % n]?.button?.focus();
|
|
390
|
+
break;
|
|
391
|
+
case 'ArrowUp':
|
|
392
|
+
nodes[index < 1 ? n - 1 : index - 1]?.button?.focus();
|
|
393
|
+
break;
|
|
394
|
+
case 'ArrowLeft':
|
|
395
|
+
case 'Backspace':
|
|
396
|
+
pop();
|
|
397
|
+
break;
|
|
398
|
+
case 'ArrowRight':
|
|
399
|
+
if (index !== -1) {
|
|
400
|
+
drill(nodes[index]);
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
case 'End':
|
|
404
|
+
nodes[n - 1]?.button?.focus();
|
|
405
|
+
break;
|
|
406
|
+
case 'Escape':
|
|
407
|
+
if (stack.length > 1) {
|
|
408
|
+
pop();
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
close(true);
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
case 'Home':
|
|
415
|
+
nodes[0]?.button?.focus();
|
|
416
|
+
break;
|
|
417
|
+
case 'Tab':
|
|
418
|
+
close(true);
|
|
419
|
+
break;
|
|
420
|
+
// Enter and Space fall through to the native button click
|
|
421
|
+
default:
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
}
|
|
427
|
+
|
|
288
428
|
// Out of the top layer once the close has played out, unless it reopened meanwhile.
|
|
289
429
|
function lower() {
|
|
290
430
|
let current = ++hiding;
|
|
@@ -300,6 +440,33 @@ function createMenu(context = false) {
|
|
|
300
440
|
});
|
|
301
441
|
}
|
|
302
442
|
|
|
443
|
+
// Lays a branch's panel over its parent with its header on the row that opened it, lifted only as far as it
|
|
444
|
+
// must be to stay on screen and capped to scroll past what is left.
|
|
445
|
+
function nest(node: MenuNode) {
|
|
446
|
+
let button = node.button,
|
|
447
|
+
element = node.panel,
|
|
448
|
+
parent = node.parent?.panel;
|
|
449
|
+
|
|
450
|
+
if (!button || !element || !parent) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
node.state.height = undefined;
|
|
455
|
+
node.state.lift = 0;
|
|
456
|
+
flush();
|
|
457
|
+
|
|
458
|
+
let header = element.querySelector<HTMLElement>(':scope > .tooltip-menu-header'),
|
|
459
|
+
row = button.getBoundingClientRect(),
|
|
460
|
+
space = margin(element),
|
|
461
|
+
bottom = viewport().height - space,
|
|
462
|
+
top = row.top - (header?.offsetTop ?? 0),
|
|
463
|
+
lift = Math.max(0, Math.min(top + element.offsetHeight - bottom, top - space));
|
|
464
|
+
|
|
465
|
+
node.state.height = bottom - top + lift;
|
|
466
|
+
node.state.lift = lift;
|
|
467
|
+
node.state.top = top - lift - parent.getBoundingClientRect().top - parent.clientTop;
|
|
468
|
+
}
|
|
469
|
+
|
|
303
470
|
function open(focus = true) {
|
|
304
471
|
stay();
|
|
305
472
|
|
|
@@ -311,7 +478,7 @@ function createMenu(context = false) {
|
|
|
311
478
|
reset();
|
|
312
479
|
root.state.settled = !expansion || instant();
|
|
313
480
|
flush();
|
|
314
|
-
|
|
481
|
+
arrange();
|
|
315
482
|
|
|
316
483
|
function reveal() {
|
|
317
484
|
pending = undefined;
|
|
@@ -332,28 +499,14 @@ function createMenu(context = false) {
|
|
|
332
499
|
}
|
|
333
500
|
}
|
|
334
501
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
event.preventDefault();
|
|
341
|
-
|
|
342
|
-
// Synthetic events carry no point.
|
|
343
|
-
if (event.clientX === 0 && event.clientY === 0) {
|
|
344
|
-
place(anchor(event.target instanceof Element ? event.target : host));
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
place({ x: event.clientX, y: event.clientY });
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
502
|
+
// Items scroll inside the panel; a branch's panel sits over it, outside the scroller, so the scroller never
|
|
503
|
+
// clips it.
|
|
351
504
|
function panel(node: MenuNode): Renderable<unknown> {
|
|
352
505
|
let item = node.item;
|
|
353
506
|
|
|
354
507
|
return html`
|
|
355
508
|
<div
|
|
356
|
-
class='tooltip-menu-panel ${node === root && expansion &&
|
|
509
|
+
class='tooltip-menu-panel ${node === root && expansion && 'tooltip-menu-panel--expand'}'
|
|
357
510
|
role='menu'
|
|
358
511
|
${node === root && attributes[MENU_PANEL]}
|
|
359
512
|
${{
|
|
@@ -363,7 +516,18 @@ function createMenu(context = false) {
|
|
|
363
516
|
() => node.state.settled && 'tooltip-menu-panel--settled'
|
|
364
517
|
],
|
|
365
518
|
inert: () => node === root ? !state.active : !node.state.open,
|
|
366
|
-
style: node === root
|
|
519
|
+
style: node === root
|
|
520
|
+
? [attributes[MENU_PANEL]?.style, () => ({
|
|
521
|
+
'--expand-direction': expansion ? placement.direction : undefined,
|
|
522
|
+
'--max-height': px(placement.height),
|
|
523
|
+
left: px(placement.x),
|
|
524
|
+
top: px(placement.y)
|
|
525
|
+
})].flat()
|
|
526
|
+
: () => ({
|
|
527
|
+
'--lift': `${node.state.lift}px`,
|
|
528
|
+
'--max-height': px(node.state.height),
|
|
529
|
+
top: `${node.state.top}px`
|
|
530
|
+
}),
|
|
367
531
|
// A dimmed parent panel's scrim takes the click; return to that level
|
|
368
532
|
onclick: (event: MouseEvent) => {
|
|
369
533
|
if (event.target === node.panel && node !== stack[stack.length - 1]) {
|
|
@@ -378,6 +542,15 @@ function createMenu(context = false) {
|
|
|
378
542
|
expand(node);
|
|
379
543
|
}
|
|
380
544
|
},
|
|
545
|
+
// The scrim and a branch's header aren't focusable, so pressing them would hand focus to the
|
|
546
|
+
// page, and losing focus closes the menu before their click can go back a level.
|
|
547
|
+
onmousedown: (event: MouseEvent) => {
|
|
548
|
+
let target = event.target as Element;
|
|
549
|
+
|
|
550
|
+
if (target === node.panel || target.closest('.tooltip-menu-header')) {
|
|
551
|
+
event.preventDefault();
|
|
552
|
+
}
|
|
553
|
+
},
|
|
381
554
|
ontransitionend: (e: TransitionEvent) => {
|
|
382
555
|
if (e.target !== node.panel) {
|
|
383
556
|
return;
|
|
@@ -406,46 +579,20 @@ function createMenu(context = false) {
|
|
|
406
579
|
<span class='tooltip-menu-title-regular'>${item.label}</span>
|
|
407
580
|
<span aria-hidden='true' class='tooltip-menu-title-bold'>${item.label}</span>
|
|
408
581
|
</span>
|
|
409
|
-
|
|
582
|
+
${icon({ 'aria-hidden': 'true', class: 'tooltip-menu-chevron tooltip-menu-chevron--down icon--rotate' }, chevron)}
|
|
410
583
|
</div>
|
|
411
584
|
`}
|
|
412
585
|
|
|
413
|
-
${
|
|
414
|
-
|
|
586
|
+
<div class='tooltip-menu-scroller' ${scrollbar({ fade: true })}>
|
|
587
|
+
${node.children.map(entry)}
|
|
588
|
+
${highlighted && highlight({ ...(highlighted === true ? {} : highlighted), target: '.tooltip-menu-entry' })}
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
${node.children.map((child) => child.children.length > 0 && html`${() => child.state.render && panel(child)}`)}
|
|
415
592
|
</div>
|
|
416
593
|
`;
|
|
417
594
|
}
|
|
418
595
|
|
|
419
|
-
function place({ x, y }: Point) {
|
|
420
|
-
if (!host || !root.panel) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
let focused = document.activeElement;
|
|
425
|
-
|
|
426
|
-
// Kept while focus is already in the menu, so moving an open menu still returns to the original holder.
|
|
427
|
-
if (!root.panel.contains(focused)) {
|
|
428
|
-
trigger = focused instanceof HTMLElement && focused !== document.body ? focused : host;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
raise();
|
|
432
|
-
reset();
|
|
433
|
-
// Measured unshifted, so the bound shift is flushed back to none first.
|
|
434
|
-
placement.shift = 0;
|
|
435
|
-
flush();
|
|
436
|
-
|
|
437
|
-
let bounds = host.getBoundingClientRect(),
|
|
438
|
-
scale = bounds.width / host.offsetWidth || 1,
|
|
439
|
-
width = root.panel.offsetWidth * scale,
|
|
440
|
-
height = root.panel.offsetHeight * scale,
|
|
441
|
-
view = viewport();
|
|
442
|
-
|
|
443
|
-
x = flip(x, width, view.width, VIEWPORT_MARGIN);
|
|
444
|
-
y = flip(y, height, view.height, VIEWPORT_MARGIN);
|
|
445
|
-
placement.style = `left: ${(x - bounds.left) / scale - host.clientLeft + host.scrollLeft}px; top: ${(y - bounds.top) / scale - host.clientTop + host.scrollTop}px;`;
|
|
446
|
-
open();
|
|
447
|
-
}
|
|
448
|
-
|
|
449
596
|
function pop() {
|
|
450
597
|
if (stack.length < 2) {
|
|
451
598
|
return;
|
|
@@ -501,108 +648,9 @@ function createMenu(context = false) {
|
|
|
501
648
|
onselect?.(item);
|
|
502
649
|
}
|
|
503
650
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
let element = root.panel;
|
|
508
|
-
|
|
509
|
-
if (!element) {
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
// The rect is read against the shift the panel is drawn with.
|
|
514
|
-
flush();
|
|
515
|
-
|
|
516
|
-
let current = placement.shift,
|
|
517
|
-
rect = element.getBoundingClientRect(),
|
|
518
|
-
left = rect.left - current,
|
|
519
|
-
right = rect.right - current,
|
|
520
|
-
width = viewport().width,
|
|
521
|
-
x = 0;
|
|
522
|
-
|
|
523
|
-
if (right > width - VIEWPORT_MARGIN) {
|
|
524
|
-
x = width - VIEWPORT_MARGIN - right;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
if (left + x < VIEWPORT_MARGIN) {
|
|
528
|
-
x = VIEWPORT_MARGIN - left;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
placement.shift = x;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
function connect(element: HTMLElement) {
|
|
535
|
-
host = element;
|
|
536
|
-
trigger = element;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function inside(node: Node | null) {
|
|
540
|
-
return !!node && (!!host?.contains(node) || !!layer?.contains(node));
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function keydown(e: KeyboardEvent) {
|
|
544
|
-
if (context && (e.key === 'ContextMenu' || (e.key === 'F10' && e.shiftKey))) {
|
|
545
|
-
e.preventDefault();
|
|
546
|
-
|
|
547
|
-
if (!root.panel?.contains(e.target as Node)) {
|
|
548
|
-
place(anchor(e.target as Element));
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if (!state.active) {
|
|
555
|
-
if (e.key === 'ArrowDown' && e.target === trigger) {
|
|
556
|
-
e.preventDefault();
|
|
557
|
-
open();
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
let nodes = enabled(stack[stack.length - 1]),
|
|
564
|
-
index = nodes.findIndex((node) => node.button === document.activeElement),
|
|
565
|
-
n = nodes.length;
|
|
566
|
-
|
|
567
|
-
switch (e.key) {
|
|
568
|
-
case 'ArrowDown':
|
|
569
|
-
nodes[(index + 1) % n]?.button?.focus();
|
|
570
|
-
break;
|
|
571
|
-
case 'ArrowUp':
|
|
572
|
-
nodes[index < 1 ? n - 1 : index - 1]?.button?.focus();
|
|
573
|
-
break;
|
|
574
|
-
case 'ArrowLeft':
|
|
575
|
-
case 'Backspace':
|
|
576
|
-
pop();
|
|
577
|
-
break;
|
|
578
|
-
case 'ArrowRight':
|
|
579
|
-
if (index !== -1) {
|
|
580
|
-
drill(nodes[index]);
|
|
581
|
-
}
|
|
582
|
-
break;
|
|
583
|
-
case 'End':
|
|
584
|
-
nodes[n - 1]?.button?.focus();
|
|
585
|
-
break;
|
|
586
|
-
case 'Escape':
|
|
587
|
-
if (stack.length > 1) {
|
|
588
|
-
pop();
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
close(true);
|
|
592
|
-
}
|
|
593
|
-
break;
|
|
594
|
-
case 'Home':
|
|
595
|
-
nodes[0]?.button?.focus();
|
|
596
|
-
break;
|
|
597
|
-
case 'Tab':
|
|
598
|
-
close(true);
|
|
599
|
-
break;
|
|
600
|
-
// Enter and Space fall through to the native button click
|
|
601
|
-
default:
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
e.preventDefault();
|
|
651
|
+
function stay() {
|
|
652
|
+
clearTimeout(leaving);
|
|
653
|
+
leaving = undefined;
|
|
606
654
|
}
|
|
607
655
|
|
|
608
656
|
let hover = !context && openOn === 'hover',
|
|
@@ -673,7 +721,7 @@ function createMenu(context = false) {
|
|
|
673
721
|
onconnect: (element: HTMLElement) => {
|
|
674
722
|
layer = element;
|
|
675
723
|
},
|
|
676
|
-
onwindowresize: () => state.active &&
|
|
724
|
+
onwindowresize: () => state.active && arrange()
|
|
677
725
|
}}
|
|
678
726
|
${popup}
|
|
679
727
|
${spanning}
|
|
@@ -686,10 +734,43 @@ function createMenu(context = false) {
|
|
|
686
734
|
);
|
|
687
735
|
}
|
|
688
736
|
|
|
689
|
-
|
|
737
|
+
function enabled(node: MenuNode) {
|
|
738
|
+
let nodes: MenuNode[] = [];
|
|
739
|
+
|
|
740
|
+
for (let i = 0, n = node.children.length; i < n; i++) {
|
|
741
|
+
let child = node.children[i];
|
|
742
|
+
|
|
743
|
+
if (child.button && !child.button.hidden && !child.item?.disabled) {
|
|
744
|
+
nodes.push(child);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return nodes;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
function tree(items: Item[], parent?: MenuNode) {
|
|
752
|
+
let nodes: MenuNode[] = [];
|
|
753
|
+
|
|
754
|
+
for (let i = 0, n = items.length; i < n; i++) {
|
|
755
|
+
let node: MenuNode = {
|
|
756
|
+
children: [],
|
|
757
|
+
item: items[i],
|
|
758
|
+
parent,
|
|
759
|
+
state: reactive({ height: undefined as number | undefined, lift: 0, open: false, render: false, settled: false, top: 0 })
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
node.children = tree(items[i].items ?? [], node);
|
|
763
|
+
nodes.push(node);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
return nodes;
|
|
767
|
+
}
|
|
768
|
+
|
|
690
769
|
|
|
691
770
|
const context = createMenu(true);
|
|
692
771
|
|
|
772
|
+
const menu = createMenu();
|
|
773
|
+
|
|
693
774
|
export default menu;
|
|
694
775
|
export { context };
|
|
695
776
|
|