@esportsplus/ui 0.63.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 +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/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,344 +1,865 @@
|
|
|
1
|
-
import { flush, reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html, type Renderable } from '@esportsplus/template';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import '~/
|
|
1
|
+
import { effect, flush, onCleanup, reactive, read, root, signal, untrack, write, type ReactiveArray } from '@esportsplus/reactivity';
|
|
2
|
+
import { component, html, render, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
|
+
import icon from '~/components/icon';
|
|
4
|
+
import tooltip from '~/components/tooltip';
|
|
5
|
+
import type { Controller, Item } from '~/components/tooltip/menu';
|
|
6
|
+
import { mac } from '~/shared/platform';
|
|
7
|
+
import { observe } from '~/shared/resize';
|
|
8
|
+
import { group, launcher, title, type Catalog, type Context, type Kind } from './group';
|
|
9
|
+
import state, { allGroups, bounded, contains, docked, findGroup, findSplit, findSurfaceGroup, MIN_FRACTION, stationary, type Group, type Layout, type Node, type Placement, type Saved, type Split, type Store, type Surface } from './model';
|
|
10
|
+
import { resized, separator } from './resize';
|
|
11
|
+
import { frame, grip, resizer, sidebar, toggle, type Edge, type Options, type Sidebars } from './sidebar';
|
|
12
|
+
import subtree from './subtree';
|
|
7
13
|
import './scss/index.scss';
|
|
8
14
|
|
|
9
15
|
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
sidebar
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}>;
|
|
24
|
-
|
|
25
|
-
// Which closed sidebars are showing for as long as the pointer stays over them.
|
|
26
|
-
type Peeking = Record<Edge, boolean>;
|
|
27
|
-
|
|
28
|
-
type Side = {
|
|
29
|
-
class?: string;
|
|
30
|
-
content?: Renderable<unknown>;
|
|
31
|
-
// A closed sidebar opens while the pointer rests on its edge and closes the moment the pointer leaves it; its toggle
|
|
32
|
-
// keeps it open.
|
|
33
|
-
hover?: boolean;
|
|
34
|
-
id: string;
|
|
35
|
-
label: string;
|
|
36
|
-
state: { active: boolean };
|
|
16
|
+
type A = Attributes & {
|
|
17
|
+
catalog: Catalog;
|
|
18
|
+
// What an empty group or main area shows in place of the launcher.
|
|
19
|
+
empty?: (group?: string) => Renderable<unknown>;
|
|
20
|
+
// Tabs show their kind's icon alone, closing from their menu.
|
|
21
|
+
icons?: boolean;
|
|
22
|
+
// At or below this width (px) of the layout, an open sidebar pushes the main area aside, one at a time, and the
|
|
23
|
+
// main area shows one group.
|
|
24
|
+
narrow?: number;
|
|
25
|
+
onconnect?: never;
|
|
26
|
+
// Each sidebar's label, whether it peeks while the pointer rests on its edge, and whether it resizes.
|
|
27
|
+
sidebars?: Partial<Record<Edge, Options>>;
|
|
28
|
+
state: ReturnType<typeof state>;
|
|
37
29
|
};
|
|
38
30
|
|
|
39
|
-
type
|
|
31
|
+
type Host = { dispose: VoidFunction; element: HTMLElement };
|
|
40
32
|
|
|
33
|
+
type Region = Placement | 'main';
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
const FIELDS = 'input, select, textarea, [contenteditable]';
|
|
35
|
+
type Shown = Record<Region, Node | null>;
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
const NARROW = '(max-width: 1024px)';
|
|
37
|
+
type Side = 'bottom' | 'left' | 'right' | 'top';
|
|
47
38
|
|
|
48
39
|
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
// A collapsed sibling of a maximized group keeps this much (px) to click back into.
|
|
41
|
+
const COLLAPSED = 80;
|
|
42
|
+
|
|
43
|
+
const NARROW = 1024;
|
|
44
|
+
|
|
45
|
+
// Where a tab dropped on a group's edge goes: beside it along the axis, before or after it.
|
|
46
|
+
const EDGES = {
|
|
47
|
+
bottom: ['column', 'after'],
|
|
48
|
+
left: ['row', 'before'],
|
|
49
|
+
right: ['row', 'after'],
|
|
50
|
+
top: ['column', 'before']
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// The group at a tree's top corner on 'edge': the first child down each split, but a row's last toward the right.
|
|
55
|
+
function corner(node: Node | null, edge: Edge): Group | null {
|
|
56
|
+
if (node === null || node.kind === 'group') {
|
|
57
|
+
return node;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
return corner((edge === 'right' && node.direction === 'row' ? node.children.at(-1) : node.children[0]) ?? null, edge);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
// The
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
// The groups of one dock or the main area, as their own tree: every split keeps its children there, resized to share what
|
|
64
|
+
// the dropped ones leave.
|
|
65
|
+
function filter(node: Node | null, keep: (group: Group) => boolean): Node | null {
|
|
66
|
+
if (node === null) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// on hover.
|
|
67
|
-
function grip(sides: Sides, peeking: Peeking, frame: Frame, edge: Edge) {
|
|
68
|
-
let side = sides[edge],
|
|
69
|
-
sign = direction(edge),
|
|
70
|
-
gesture = drag({
|
|
71
|
-
begin: (e) => e.button === 0 && !side.state.active ? [{ axis: 'x', sign }] : null,
|
|
72
|
-
capture: () => hold(frame, edge),
|
|
73
|
-
measure: (element) => frame[edge].sidebar ?? element,
|
|
74
|
-
move: (_, { x }) => {
|
|
75
|
-
let element = frame[edge].sidebar;
|
|
76
|
-
|
|
77
|
-
if (element) {
|
|
78
|
-
reveal(frame, edge, element.offsetWidth, x * sign);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
release: (_, __, dismiss) => {
|
|
82
|
-
settle(frame, edge);
|
|
70
|
+
if (node.kind === 'group') {
|
|
71
|
+
return keep(node) ? node : null;
|
|
72
|
+
}
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
74
|
+
let entries = node.children.flatMap((child, i) => {
|
|
75
|
+
let kept = filter(child, keep);
|
|
89
76
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
aria-hidden='true'
|
|
93
|
-
class='shell-edge shell-edge--${edge}'
|
|
94
|
-
id='${side.id}-edge'
|
|
95
|
-
${gesture}
|
|
96
|
-
${{
|
|
97
|
-
// A drag swallows the click it ends with, so this is a tap or a click: either opens the sidebar.
|
|
98
|
-
onclick: () => {
|
|
99
|
-
if (!side.state.active) {
|
|
100
|
-
open(sides, peeking, edge);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
onconnect: (element: HTMLElement) => {
|
|
104
|
-
frame[edge].edge = element;
|
|
105
|
-
},
|
|
106
|
-
onpointerenter: () => {
|
|
107
|
-
if (side.hover && !side.state.active) {
|
|
108
|
-
peeking[edge] = true;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
onpointerleave: (e: PointerEvent) => leave(side, peeking, frame, edge, e),
|
|
112
|
-
onpointermove: function(this: HTMLElement, e: PointerEvent) {
|
|
113
|
-
let bounds = this.getBoundingClientRect();
|
|
77
|
+
return kept === null ? [] : [{ node: kept, size: node.sizes[i] ?? 0 }];
|
|
78
|
+
});
|
|
114
79
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
80
|
+
if (entries.length === 0) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (entries.length === 1) {
|
|
85
|
+
return entries[0].node;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let total = entries.reduce((sum, entry) => sum + entry.size, 0);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
...node,
|
|
92
|
+
children: entries.map((entry) => entry.node),
|
|
93
|
+
sizes: entries.map((entry) => total > 0 ? entry.size / total : 1 / entries.length)
|
|
94
|
+
};
|
|
124
95
|
}
|
|
125
96
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
frame[edge].dragging = true;
|
|
129
|
-
flush();
|
|
97
|
+
function findSurface(node: Node | null, id: string) {
|
|
98
|
+
return findSurfaceGroup(node, id)?.surfaces.find((surface) => surface.id === id) ?? null;
|
|
130
99
|
}
|
|
131
100
|
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
function
|
|
135
|
-
let
|
|
101
|
+
// Every surface that should own a place on screen: the active surface of each group showing. A closed sidebar's
|
|
102
|
+
// groups stay mounted, so it slides out with its content in place.
|
|
103
|
+
function mounted(layout: Layout) {
|
|
104
|
+
let ids = new Set<string>();
|
|
136
105
|
|
|
137
|
-
|
|
138
|
-
|
|
106
|
+
for (let group of Object.values(shown(layout)).flatMap(allGroups)) {
|
|
107
|
+
if (group.active !== null) {
|
|
108
|
+
ids.add(group.active);
|
|
109
|
+
}
|
|
139
110
|
}
|
|
140
111
|
|
|
141
|
-
|
|
112
|
+
return ids;
|
|
142
113
|
}
|
|
143
114
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
115
|
+
// What the layout shows: under a zoom, its groups fill the main area together, docked or not; otherwise the main
|
|
116
|
+
// groups, the bottom dock's below them while it is open, and each sidebar's on its edge, open or not.
|
|
117
|
+
function shown(layout: Layout): Shown {
|
|
118
|
+
let zoom = layout.zoom.at(-1);
|
|
119
|
+
|
|
120
|
+
if (zoom) {
|
|
121
|
+
let ids = new Set(zoom.groups);
|
|
122
|
+
|
|
123
|
+
return { bottom: null, left: null, main: filter(layout.root, (group) => ids.has(group.id)), right: null };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
bottom: layout.bottom.open ? filter(layout.root, (group) => docked(group, 'bottom')) : null,
|
|
128
|
+
left: filter(layout.root, (group) => docked(group, 'left')),
|
|
129
|
+
main: filter(layout.root, (group) => group.placement === undefined),
|
|
130
|
+
right: filter(layout.root, (group) => docked(group, 'right'))
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// The parts of the tree a layout change rebuilds: kinds, ids and order, group membership and placement.
|
|
135
|
+
// Sizes, the active tab and group, maximizing and the dock's size bind in place instead.
|
|
136
|
+
function structure(node: Node | null): unknown {
|
|
137
|
+
if (node === null) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (node.kind === 'group') {
|
|
142
|
+
return [node.id, node.placement ?? '', node.surfaces.map((surface) => surface.id)];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return [node.id, node.direction, node.children.map(structure)];
|
|
153
146
|
}
|
|
154
147
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
// Outside every tab strip, what a dragged tab drops onto: a dock's strip along the layout's edge, or the half of a
|
|
149
|
+
// group toward its nearest edge, which splits the group there. A group's header outside its strip takes nothing.
|
|
150
|
+
function target(workspace: HTMLElement, x: number, y: number) {
|
|
151
|
+
let elements = document.elementsFromPoint(x, y).filter((element) => element.closest('.shell') === workspace),
|
|
152
|
+
dock = elements.find((element) => element.matches('.shell-dock-target')) as HTMLElement | undefined,
|
|
153
|
+
section = elements.find((element) => element.matches('.shell-group')) as HTMLElement | undefined;
|
|
154
|
+
|
|
155
|
+
if (dock) {
|
|
156
|
+
return dock;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!section || y <= (section.querySelector(':scope > .shell-header')?.getBoundingClientRect().bottom ?? -Infinity)) {
|
|
160
|
+
return null;
|
|
158
161
|
}
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
let { height, left, top, width } = section.getBoundingClientRect(),
|
|
164
|
+
across = width <= 0 ? 0.5 : (x - left) / width,
|
|
165
|
+
down = height <= 0 ? 0.5 : (y - top) / height,
|
|
166
|
+
side = ([['left', across], ['right', 1 - across], ['top', down], ['bottom', 1 - down]] as [Side, number][])
|
|
167
|
+
.reduce((nearest, candidate) => candidate[1] < nearest[1] ? candidate : nearest)[0];
|
|
168
|
+
|
|
169
|
+
return section.querySelector<HTMLElement>(`:scope > .shell-edge--${side}`);
|
|
162
170
|
}
|
|
163
171
|
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
// The id of this layout's innermost group under the point, skipping groups of layouts nested inside it.
|
|
173
|
+
function under(workspace: HTMLElement, x: number, y: number) {
|
|
174
|
+
let found = document.elementsFromPoint(x, y).find((element) => element.matches('.shell-group') && element.closest('.shell') === workspace);
|
|
175
|
+
|
|
176
|
+
return (found as HTMLElement | undefined)?.dataset.group;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
// The app frame: tabbed groups of surfaces in resizable splits, in a main area between a sidebar on either edge, above
|
|
181
|
+
// a bottom dock. Tabs drag to reorder, into another group, onto a group's edge to split beside it, or onto a strip
|
|
182
|
+
// along the layout's left, right or bottom edge to dock there; groups clicked or swept across with ⌘ (Ctrl elsewhere)
|
|
183
|
+
// held fill the main area together once it, or the sweep, is let go. A double click on a header steps back a view at
|
|
184
|
+
// a time, out of a maximized group and then each zoom, and maximizes its group once there is nothing left to step out
|
|
185
|
+
// of. An empty group offers the catalog. A surface's content is rendered once and moved, never rebuilt, so it keeps
|
|
186
|
+
// its state across every layout change until its tab closes.
|
|
187
|
+
//
|
|
188
|
+
// A sidebar slides over the main area's edge and makes room as it opens; in a narrow layout it pushes the main area
|
|
189
|
+
// aside, one at a time, and the main area shows one group, switched from its header. Its toggle sits in its top
|
|
190
|
+
// corner, and a closed sidebar's edge holds a handle to drag it out by. A sidebar holding a single unsortable surface
|
|
191
|
+
// is static: it shows the surface without tabs, takes no drops, and swipes closed toward its edge.
|
|
192
|
+
const shell = component(
|
|
193
|
+
function({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, ...attributes }: A) {
|
|
194
|
+
let adding: Controller | undefined,
|
|
195
|
+
apple = mac(),
|
|
196
|
+
// A tab is being dragged, which lights the docks and group halves it can drop onto.
|
|
197
|
+
carrying = signal(false),
|
|
198
|
+
controller: Controller | undefined,
|
|
199
|
+
frames = { left: frame(), right: frame() },
|
|
200
|
+
hosts = new Map<string, Host>(),
|
|
201
|
+
// What a dragged tab does to the layout once its copy lands.
|
|
202
|
+
landing: VoidFunction | null = null,
|
|
203
|
+
// Where hosts wait while their surface isn't showing, inside the layout so they stay connected.
|
|
204
|
+
parking: HTMLElement | undefined,
|
|
205
|
+
picks = signal<string[]>([]),
|
|
206
|
+
// Each region's element, so rebuilding one parks only the hosts inside it.
|
|
207
|
+
regions: Partial<Record<Region, HTMLElement>> = {},
|
|
208
|
+
size = reactive({ height: 0, width: 0 }),
|
|
209
|
+
slots = new Map<string, HTMLElement>(),
|
|
210
|
+
// Each tab strip's group, so a tab sorted into a strip moves into its group.
|
|
211
|
+
strips = new WeakMap<ReactiveArray<Surface>, string>(),
|
|
212
|
+
subject = reactive({ group: '', surface: '' }),
|
|
213
|
+
switching: Controller | undefined,
|
|
214
|
+
unobserve: VoidFunction | undefined,
|
|
215
|
+
workspace: HTMLElement | undefined;
|
|
216
|
+
|
|
217
|
+
let narrow = () => size.width > 0 && size.width <= breakpoint;
|
|
218
|
+
|
|
219
|
+
let edges: Sidebars = {
|
|
220
|
+
frames,
|
|
221
|
+
id: `shell-${crypto.randomUUID().slice(0, 8)}`,
|
|
222
|
+
narrow,
|
|
223
|
+
options,
|
|
224
|
+
stationary: (edge) => stationary(state.layout.root, edge),
|
|
225
|
+
state
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// A dragged tab changes the layout once its copy has landed, so the strips it moved through stay until then.
|
|
229
|
+
function drop(surface: Surface, element: HTMLElement) {
|
|
230
|
+
let placement = element.dataset.placement as Placement | undefined;
|
|
231
|
+
|
|
232
|
+
if (placement) {
|
|
233
|
+
state.dock(surface.id, placement);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
let group = element.closest<HTMLElement>('.shell-group')?.dataset.group,
|
|
238
|
+
[direction, side] = EDGES[element.dataset.side as Side];
|
|
239
|
+
|
|
240
|
+
if (group) {
|
|
241
|
+
state.split(surface.id, group, direction, side);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
let context: Context = {
|
|
246
|
+
add(kind: string, group?: string) {
|
|
247
|
+
let entry = catalog[kind];
|
|
248
|
+
|
|
249
|
+
if (!entry) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
let id = kind;
|
|
254
|
+
|
|
255
|
+
if (entry.multiple) {
|
|
256
|
+
let taken = new Set(allGroups(state.layout.root).flatMap((group) => group.surfaces.map((surface) => surface.id))),
|
|
257
|
+
n = 1;
|
|
258
|
+
|
|
259
|
+
while (taken.has(id = `${kind}-${n}`)) {
|
|
260
|
+
n++;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
state.open({ id, kind }, group);
|
|
265
|
+
},
|
|
266
|
+
addable: Object.entries(catalog).filter(([, entry]) => entry.addable !== false),
|
|
267
|
+
catalog,
|
|
268
|
+
choose(e: MouseEvent, group: string) {
|
|
269
|
+
if (!adding) {
|
|
270
|
+
return;
|
|
179
271
|
}
|
|
180
272
|
|
|
181
|
-
|
|
273
|
+
let { bottom, left } = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
274
|
+
|
|
275
|
+
subject.group = group;
|
|
276
|
+
flush();
|
|
277
|
+
adding.open({ x: left, y: bottom });
|
|
182
278
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
279
|
+
empty,
|
|
280
|
+
held: (e: MouseEvent) => apple ? e.metaKey : e.ctrlKey,
|
|
281
|
+
icons,
|
|
282
|
+
// The toggles cover the top corners: each sidebar's corner group clears its toggle, and the main area's
|
|
283
|
+
// while that sidebar is closed.
|
|
284
|
+
inset(group: string, edge: Edge) {
|
|
285
|
+
let layout = state.layout,
|
|
286
|
+
trees = shown(layout);
|
|
287
|
+
|
|
288
|
+
return trees[edge] !== null && (group === corner(trees[edge], edge)?.id || (group === corner(trees.main, edge)?.id && !layout[edge].open));
|
|
186
289
|
},
|
|
187
|
-
|
|
188
|
-
|
|
290
|
+
menu(e: MouseEvent, group: string, surface: string) {
|
|
291
|
+
if (!controller) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
189
294
|
|
|
190
|
-
|
|
191
|
-
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
subject.group = group;
|
|
297
|
+
subject.surface = surface;
|
|
298
|
+
flush();
|
|
299
|
+
controller.open(e.button === 2 ? { x: e.clientX, y: e.clientY } : undefined);
|
|
300
|
+
},
|
|
301
|
+
pick(group: string) {
|
|
302
|
+
let current = read(picks);
|
|
303
|
+
|
|
304
|
+
write(picks, current.includes(group) ? current.filter((id) => id !== group) : [...current, group]);
|
|
305
|
+
},
|
|
306
|
+
picked: (group: string) => read(picks).includes(group),
|
|
307
|
+
slot: (surface: string) => html`
|
|
308
|
+
<div
|
|
309
|
+
class='shell-slot'
|
|
310
|
+
${{
|
|
311
|
+
onconnect: (element: HTMLElement) => {
|
|
312
|
+
slots.set(surface, element);
|
|
313
|
+
attach(surface, element);
|
|
314
|
+
},
|
|
315
|
+
ondisconnect: () => {
|
|
316
|
+
if (slots.get(surface)?.isConnected === false) {
|
|
317
|
+
slots.delete(surface);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}}
|
|
321
|
+
></div>
|
|
322
|
+
`,
|
|
323
|
+
sorting(strip: ReactiveArray<Surface>, group: string) {
|
|
324
|
+
strips.set(strip, group);
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
disabled: (surface) => surface.sortable === false,
|
|
328
|
+
group: edges.id,
|
|
329
|
+
onland: () => {
|
|
330
|
+
let land = landing;
|
|
331
|
+
|
|
332
|
+
landing = null;
|
|
333
|
+
write(carrying, false);
|
|
334
|
+
land?.();
|
|
335
|
+
},
|
|
336
|
+
onlift: () => write(carrying, true),
|
|
337
|
+
onsort: (surface, _, to, __, target) => {
|
|
338
|
+
let group = strips.get(target);
|
|
339
|
+
|
|
340
|
+
landing = group ? () => state.move(surface.id, group, to) : null;
|
|
341
|
+
},
|
|
342
|
+
outside: {
|
|
343
|
+
ondrop: (surface, element) => {
|
|
344
|
+
landing = () => drop(surface, element);
|
|
345
|
+
},
|
|
346
|
+
over: (_, x, y) => workspace ? target(workspace, x, y) : null
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
},
|
|
350
|
+
state,
|
|
351
|
+
// Held down with the modifier, a press sweeps: every group the pointer crosses into is picked, and letting go
|
|
352
|
+
// after leaving the first zooms to every pick at once. A press that stays in its group is a click, which
|
|
353
|
+
// picks or unpicks it instead.
|
|
354
|
+
sweep(e: PointerEvent, group: string) {
|
|
355
|
+
let swept = [group];
|
|
356
|
+
|
|
357
|
+
function end(event: PointerEvent) {
|
|
358
|
+
document.documentElement.classList.remove('shell-sweeping');
|
|
359
|
+
window.removeEventListener('pointercancel', end);
|
|
360
|
+
window.removeEventListener('pointermove', move);
|
|
361
|
+
window.removeEventListener('pointerup', end);
|
|
362
|
+
|
|
363
|
+
if (swept.length < 2) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// The click the release ends with lands on whatever holds both groups; it picks nothing.
|
|
368
|
+
let swallow = (click: MouseEvent) => {
|
|
369
|
+
click.preventDefault();
|
|
370
|
+
click.stopPropagation();
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
window.addEventListener('click', swallow, { capture: true, once: true });
|
|
374
|
+
setTimeout(() => window.removeEventListener('click', swallow, { capture: true }));
|
|
375
|
+
|
|
376
|
+
if (event.type === 'pointerup') {
|
|
377
|
+
let chosen = read(picks);
|
|
378
|
+
|
|
379
|
+
write(picks, []);
|
|
380
|
+
state.zoom(chosen);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function move(event: PointerEvent) {
|
|
385
|
+
let id = workspace && under(workspace, event.clientX, event.clientY);
|
|
386
|
+
|
|
387
|
+
if (!id || swept.includes(id)) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
swept.push(id);
|
|
392
|
+
write(picks, [...new Set([...read(picks), ...swept])]);
|
|
192
393
|
}
|
|
394
|
+
|
|
395
|
+
if (e.button !== 0) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
document.documentElement.classList.add('shell-sweeping');
|
|
400
|
+
window.addEventListener('pointercancel', end);
|
|
401
|
+
window.addEventListener('pointermove', move);
|
|
402
|
+
window.addEventListener('pointerup', end);
|
|
403
|
+
},
|
|
404
|
+
switcher(e: MouseEvent) {
|
|
405
|
+
let { bottom, left } = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
406
|
+
|
|
407
|
+
switching?.open({ x: left, y: bottom });
|
|
408
|
+
},
|
|
409
|
+
switches: () => allGroups(shown(state.layout).main).length > 1
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
function attach(surface: string, slot: HTMLElement) {
|
|
413
|
+
let host = hosts.get(surface);
|
|
414
|
+
|
|
415
|
+
if (!host) {
|
|
416
|
+
return;
|
|
193
417
|
}
|
|
194
|
-
});
|
|
195
418
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
419
|
+
// A slot connects before the rebuilt tree is in the document; the host waits so it is moved, not removed.
|
|
420
|
+
if (!slot.isConnected) {
|
|
421
|
+
queueMicrotask(() => slot.isConnected && attach(surface, slot));
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
move(host.element, slot);
|
|
199
426
|
}
|
|
200
|
-
|
|
201
|
-
|
|
427
|
+
|
|
428
|
+
function ensure(surface: string) {
|
|
429
|
+
if (hosts.has(surface)) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let found = findSurface(state.layout.root, surface),
|
|
434
|
+
kind = found && catalog[found.kind];
|
|
435
|
+
|
|
436
|
+
if (!found || !kind) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let element = document.createElement('div'),
|
|
441
|
+
entry = found,
|
|
442
|
+
// Owned by no effect: the host outlives whichever layout pass created it.
|
|
443
|
+
release = untrack(() => root(() => render(element, { class: 'shell-host', 'data-surface': surface }, () => kind.render(entry))));
|
|
444
|
+
|
|
445
|
+
hosts.set(surface, { dispose: release, element });
|
|
202
446
|
}
|
|
203
|
-
}
|
|
204
447
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
448
|
+
// Moving a connected node keeps its focus, scroll and frames; appending would reload an iframe.
|
|
449
|
+
function move(element: HTMLElement, target: HTMLElement) {
|
|
450
|
+
if (element.parentElement === target) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if ('moveBefore' in target && element.isConnected && target.isConnected) {
|
|
455
|
+
(target as HTMLElement & { moveBefore: (node: ChildNode, child: null) => void }).moveBefore(element, null);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
let focused = document.activeElement;
|
|
460
|
+
|
|
461
|
+
target.append(element);
|
|
462
|
+
|
|
463
|
+
if (focused instanceof HTMLElement && element.contains(focused)) {
|
|
464
|
+
focused.focus({ preventScroll: true });
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function node(current: Node): Renderable<unknown> {
|
|
469
|
+
if (current.kind === 'group') {
|
|
470
|
+
let id = current.id;
|
|
471
|
+
|
|
472
|
+
return group(context, () => {
|
|
473
|
+
let layout = state.layout;
|
|
474
|
+
|
|
475
|
+
return { group: findGroup(layout.root, id) ?? current, layout };
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return split(current);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// A sidebar makes room while it is open and has groups to show, outside a zoom.
|
|
483
|
+
function open(edge: Edge) {
|
|
484
|
+
let layout = state.layout;
|
|
485
|
+
|
|
486
|
+
return layout.zoom.length === 0 && layout[edge].open && allGroups(layout.root).some((group) => docked(group, edge));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Every host, or those inside 'within', waits in the parking while what held it is rebuilt.
|
|
490
|
+
function park(within?: HTMLElement) {
|
|
491
|
+
if (!parking) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
for (let host of hosts.values()) {
|
|
496
|
+
if (!within || within.contains(host.element)) {
|
|
497
|
+
move(host.element, parking);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// One region's groups, rebuilt only when its own structure changes, so opening a tab in the main area leaves
|
|
503
|
+
// the sidebars' content where it is.
|
|
504
|
+
function region(name: Region) {
|
|
505
|
+
let last = '';
|
|
506
|
+
|
|
507
|
+
return subtree(
|
|
508
|
+
() => {
|
|
509
|
+
let key = JSON.stringify(structure(shown(state.layout)[name]));
|
|
510
|
+
|
|
511
|
+
if (key !== last && last !== '' && regions[name]) {
|
|
512
|
+
park(regions[name]);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
last = key;
|
|
516
|
+
|
|
517
|
+
return key;
|
|
228
518
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
519
|
+
() => {
|
|
520
|
+
let tree = shown(state.layout)[name];
|
|
521
|
+
|
|
522
|
+
if (name !== 'main') {
|
|
523
|
+
return tree ? node(tree) : '';
|
|
233
524
|
}
|
|
525
|
+
|
|
526
|
+
return tree ? html`${node(tree)}${switcher(tree)}` : launcher(context);
|
|
234
527
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
528
|
+
{
|
|
529
|
+
onconnect: (element: HTMLElement) => {
|
|
530
|
+
regions[name] = element;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
}
|
|
242
535
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
function reveal(frame: Frame, edge: Edge, width: number, shown: number) {
|
|
248
|
-
let clamped = Math.max(0, Math.min(width, shown)),
|
|
249
|
-
rest = `calc(var(--gap-horizontal) * ${width ? 1 - clamped / width : 1})`,
|
|
250
|
-
state = frame[edge];
|
|
251
|
-
|
|
252
|
-
state.translate = `${(clamped - width) * direction(edge)}px 0`;
|
|
253
|
-
|
|
254
|
-
if (matchMedia(NARROW).matches) {
|
|
255
|
-
state.gap = rest;
|
|
256
|
-
state.reach = undefined;
|
|
257
|
-
state.space = `${clamped}px`;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
state.gap = undefined;
|
|
261
|
-
state.reach = `calc(${clamped}px + ${rest})`;
|
|
262
|
-
state.space = undefined;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
536
|
+
function split(current: Split) {
|
|
537
|
+
let axis = current.direction === 'row' ? 'x' as const : 'y' as const,
|
|
538
|
+
box = reactive({ length: 0 }),
|
|
539
|
+
unobserve: VoidFunction | undefined;
|
|
265
540
|
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
state.dragging = false;
|
|
272
|
-
flush();
|
|
273
|
-
state.gap = undefined;
|
|
274
|
-
state.reach = undefined;
|
|
275
|
-
state.space = undefined;
|
|
276
|
-
state.translate = undefined;
|
|
277
|
-
}
|
|
541
|
+
// As shown: a zoom shows a split with only some of its children, sharing the space between them.
|
|
542
|
+
function sizes() {
|
|
543
|
+
for (let tree of Object.values(shown(state.layout))) {
|
|
544
|
+
let found = findSplit(tree, current.id);
|
|
278
545
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
546
|
+
if (found) {
|
|
547
|
+
return found.sizes;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
282
550
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
551
|
+
return current.sizes;
|
|
552
|
+
}
|
|
286
553
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
554
|
+
return html`
|
|
555
|
+
<div
|
|
556
|
+
class='shell-split shell-split--${current.direction}'
|
|
557
|
+
${{
|
|
558
|
+
onconnect: (element: HTMLElement) => {
|
|
559
|
+
unobserve = observe(element, ([entry]) => {
|
|
560
|
+
box.length = axis === 'x' ? entry.contentRect.width : entry.contentRect.height;
|
|
561
|
+
});
|
|
562
|
+
},
|
|
563
|
+
ondisconnect: () => unobserve?.()
|
|
564
|
+
}}
|
|
565
|
+
>
|
|
566
|
+
${current.children.map((child, index) => html`
|
|
567
|
+
<div
|
|
568
|
+
class='shell-pane'
|
|
569
|
+
${{
|
|
570
|
+
// Holding the main group a narrow layout shows alone.
|
|
571
|
+
class: () => state.layout.main !== null && contains(child, state.layout.main) && 'shell-pane--current',
|
|
572
|
+
style: () => {
|
|
573
|
+
let maximized = state.layout.maximized;
|
|
574
|
+
|
|
575
|
+
if (maximized === null || !contains(current, maximized)) {
|
|
576
|
+
return `--flex: 0 0 ${(sizes()[index] ?? 0) * 100}%;`;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return contains(current.children[index], maximized)
|
|
580
|
+
? `--flex: 0 0 calc(100% - ${(current.children.length - 1) * COLLAPSED}px);`
|
|
581
|
+
: `--flex: 0 0 ${COLLAPSED}px;`;
|
|
582
|
+
}
|
|
583
|
+
}}
|
|
584
|
+
>
|
|
585
|
+
${node(child)}
|
|
586
|
+
</div>
|
|
587
|
+
${index < current.children.length - 1 && separator(axis, () => {
|
|
588
|
+
let from = sizes(),
|
|
589
|
+
length = box.length;
|
|
590
|
+
|
|
591
|
+
return (delta) => state.resize(current.id, resized(from, index, delta, length, MIN_FRACTION), current.children.map((child) => child.id));
|
|
592
|
+
})}
|
|
593
|
+
`)}
|
|
594
|
+
</div>
|
|
595
|
+
`;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// The menu of main groups a narrow layout switches between.
|
|
599
|
+
function switcher(main: Node) {
|
|
600
|
+
let groups = allGroups(main);
|
|
601
|
+
|
|
602
|
+
return groups.length > 1 && tooltip.context(
|
|
603
|
+
{
|
|
604
|
+
class: 'shell-menu',
|
|
605
|
+
controller: (value: Controller) => {
|
|
606
|
+
switching = value;
|
|
607
|
+
},
|
|
608
|
+
items: groups.map((entry) => ({
|
|
609
|
+
label: () => {
|
|
610
|
+
let found = findGroup(state.layout.root, entry.id),
|
|
611
|
+
surface = found?.surfaces.find((item) => item.id === found.active);
|
|
612
|
+
|
|
613
|
+
return surface ? title(context, surface) : 'Empty group';
|
|
614
|
+
},
|
|
615
|
+
onselect: () => state.focus(entry.id)
|
|
616
|
+
})),
|
|
617
|
+
[tooltip.context.panel]: { 'aria-label': 'Switch group' }
|
|
618
|
+
},
|
|
619
|
+
''
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Hiding a surface or picking another tab keeps its host parked; only closing it releases its content.
|
|
624
|
+
function sync(layout: Layout, attaching: boolean) {
|
|
625
|
+
let shown = mounted(layout);
|
|
626
|
+
|
|
627
|
+
for (let [surface, host] of hosts) {
|
|
628
|
+
if (findSurface(layout.root, surface)) {
|
|
629
|
+
if (!shown.has(surface) && parking) {
|
|
630
|
+
move(host.element, parking);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
host.dispose();
|
|
637
|
+
host.element.remove();
|
|
638
|
+
hosts.delete(surface);
|
|
639
|
+
slots.delete(surface);
|
|
640
|
+
}
|
|
300
641
|
|
|
642
|
+
for (let surface of shown) {
|
|
643
|
+
ensure(surface);
|
|
301
644
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
645
|
+
let slot = slots.get(surface);
|
|
646
|
+
|
|
647
|
+
if (attaching && slot) {
|
|
648
|
+
attach(surface, slot);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// Strips along the layout's edges a dragged tab docks onto; a static sidebar has none.
|
|
654
|
+
function targets() {
|
|
655
|
+
return (['bottom', 'left', 'right'] as const)
|
|
656
|
+
.filter((placement) => placement === 'bottom' || !stationary(state.layout.root, placement))
|
|
657
|
+
.map((placement) => html`
|
|
658
|
+
<div
|
|
659
|
+
aria-hidden='true'
|
|
660
|
+
class='shell-dock-target shell-dock-target--${placement}'
|
|
661
|
+
data-placement='${placement}'
|
|
662
|
+
></div>
|
|
663
|
+
`);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Rebuilt when a region appears or goes, the bottom dock opens or closes or the zoom changes; each region
|
|
667
|
+
// rebuilds its own groups. A sidebar named in 'sidebars' shows even without groups, so it can always be opened.
|
|
668
|
+
function tree(): Renderable<unknown> {
|
|
669
|
+
let trees = shown(state.layout);
|
|
670
|
+
|
|
671
|
+
return html`
|
|
672
|
+
<div class='shell-frame'>
|
|
673
|
+
${(['left', 'right'] as const).map((edge) => (trees[edge] || options[edge]) && html`
|
|
674
|
+
${sidebar(edges, edge, region(edge))}
|
|
675
|
+
${grip(edges, edge)}
|
|
676
|
+
${options[edge]?.resizable && resizer(edges, edge)}
|
|
677
|
+
${toggle(edges, edge)}
|
|
678
|
+
`)}
|
|
679
|
+
<div class='shell-center'>
|
|
680
|
+
<div class='shell-main'>
|
|
681
|
+
${region('main')}
|
|
682
|
+
</div>
|
|
683
|
+
${trees.bottom && html`
|
|
684
|
+
${separator(
|
|
685
|
+
'y',
|
|
686
|
+
() => {
|
|
687
|
+
let share = bounded(state.layout.bottom.size),
|
|
688
|
+
length = size.height;
|
|
689
|
+
|
|
690
|
+
return (delta) => state.resizeDock('bottom', resized([1 - share, share], 0, delta, length, MIN_FRACTION)[1]);
|
|
691
|
+
},
|
|
692
|
+
{ hidden: () => state.layout.bottom.maximized }
|
|
693
|
+
)}
|
|
694
|
+
<div
|
|
695
|
+
class='shell-dock'
|
|
696
|
+
${{
|
|
697
|
+
class: () => state.layout.bottom.maximized && 'shell-dock--maximized',
|
|
698
|
+
style: () => `--flex: 0 0 ${bounded(state.layout.bottom.size) * 100}%;`
|
|
699
|
+
}}
|
|
700
|
+
>
|
|
701
|
+
${region('bottom')}
|
|
702
|
+
</div>
|
|
703
|
+
`}
|
|
704
|
+
</div>
|
|
705
|
+
</div>
|
|
706
|
+
${targets()}
|
|
707
|
+
`;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// The layout's own items, then each kind's: a kind with a menu of its own shows only that on its tabs.
|
|
711
|
+
let kind = () => findSurface(state.layout.root, subject.surface)?.kind ?? '',
|
|
712
|
+
own = () => !!catalog[kind()]?.menu,
|
|
713
|
+
items: Item[] = [
|
|
714
|
+
{ hidden: own, label: 'Close', onselect: () => void state.close(subject.surface) },
|
|
715
|
+
{
|
|
716
|
+
hidden: () => own() || (findGroup(state.layout.root, subject.group)?.surfaces.length ?? 0) <= 1,
|
|
717
|
+
label: 'Close Others',
|
|
718
|
+
onselect: () => void state.closeOthers(subject.group, subject.surface)
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
hidden: () => {
|
|
722
|
+
let surfaces = findGroup(state.layout.root, subject.group)?.surfaces ?? [];
|
|
723
|
+
|
|
724
|
+
return own() || surfaces.findIndex((surface) => surface.id === subject.surface) >= surfaces.length - 1;
|
|
725
|
+
},
|
|
726
|
+
label: 'Close to the Right',
|
|
727
|
+
onselect: () => void state.closeRight(subject.group, subject.surface)
|
|
728
|
+
},
|
|
729
|
+
{ hidden: own, label: 'Close All', onselect: () => void state.closeGroup(subject.group) },
|
|
730
|
+
...Object.entries(catalog).flatMap(([name, entry]) => (entry.menu?.(() => subject.surface) ?? []).map((item) => ({
|
|
731
|
+
...item,
|
|
732
|
+
hidden: () => kind() !== name || (typeof item.hidden === 'function' ? !!item.hidden() : !!item.hidden)
|
|
733
|
+
})))
|
|
734
|
+
],
|
|
735
|
+
last = '';
|
|
736
|
+
|
|
737
|
+
onCleanup(() => {
|
|
738
|
+
for (let host of hosts.values()) {
|
|
739
|
+
host.dispose();
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
hosts.clear();
|
|
743
|
+
slots.clear();
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
// Narrow, opening a sidebar closes the other, so both open on turning narrow leaves the left.
|
|
747
|
+
effect(() => {
|
|
748
|
+
if (narrow() && state.layout.left.open && state.layout.right.open) {
|
|
749
|
+
untrack(() => state.toggle('right', false));
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
return html`
|
|
754
|
+
<div
|
|
755
|
+
class='shell'
|
|
756
|
+
${attributes}
|
|
757
|
+
${{
|
|
758
|
+
class: [
|
|
759
|
+
() => read(carrying) && 'shell--dragging',
|
|
760
|
+
() => narrow() && 'shell--narrow',
|
|
761
|
+
() => (frames.left.dragging || frames.right.dragging) && 'shell--sliding',
|
|
762
|
+
() => open('left') && 'shell--left-open',
|
|
763
|
+
() => open('right') && 'shell--right-open'
|
|
764
|
+
],
|
|
765
|
+
onconnect: (element: HTMLElement) => {
|
|
766
|
+
workspace = element;
|
|
767
|
+
unobserve = observe(element, ([entry]) => {
|
|
768
|
+
size.height = entry.contentRect.height;
|
|
769
|
+
size.width = entry.contentRect.width;
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
ondisconnect: () => unobserve?.(),
|
|
773
|
+
onwindowblur: () => write(picks, []),
|
|
774
|
+
onwindowkeydown: (e: KeyboardEvent) => {
|
|
775
|
+
if (e.key === 'Escape' && read(picks).length) {
|
|
776
|
+
e.preventDefault();
|
|
777
|
+
write(picks, []);
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
onwindowkeyup: (e: KeyboardEvent) => {
|
|
781
|
+
let chosen = read(picks);
|
|
782
|
+
|
|
783
|
+
if (e.key !== (apple ? 'Meta' : 'Control') || chosen.length === 0) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
write(picks, []);
|
|
788
|
+
state.zoom(chosen);
|
|
789
|
+
},
|
|
790
|
+
style: () => {
|
|
791
|
+
let { left, right } = state.layout;
|
|
792
|
+
|
|
793
|
+
return {
|
|
794
|
+
'--left': frames.left.space,
|
|
795
|
+
'--left-size': left.size === null ? undefined : `${left.size}px`,
|
|
796
|
+
'--right': frames.right.space,
|
|
797
|
+
'--right-size': right.size === null ? undefined : `${right.size}px`
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
}}
|
|
801
|
+
>
|
|
802
|
+
<div
|
|
803
|
+
class='shell-parking'
|
|
804
|
+
${{
|
|
805
|
+
onconnect: (element: HTMLElement) => {
|
|
806
|
+
parking = element;
|
|
807
|
+
}
|
|
808
|
+
}}
|
|
809
|
+
></div>
|
|
810
|
+
${subtree(
|
|
811
|
+
() => {
|
|
812
|
+
let layout = state.layout,
|
|
813
|
+
trees = shown(layout),
|
|
814
|
+
key = JSON.stringify([layout.bottom.open, layout.zoom.at(-1)?.groups ?? null, ...Object.values(trees).map((tree) => tree !== null)]),
|
|
815
|
+
changed = key !== last;
|
|
816
|
+
|
|
817
|
+
if (changed) {
|
|
818
|
+
park();
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
sync(layout, !changed);
|
|
822
|
+
last = key;
|
|
823
|
+
|
|
824
|
+
return key;
|
|
825
|
+
},
|
|
826
|
+
tree,
|
|
827
|
+
{ class: 'shell-tree' }
|
|
828
|
+
)}
|
|
829
|
+
${tooltip.context(
|
|
830
|
+
{
|
|
831
|
+
class: 'shell-menu',
|
|
832
|
+
controller: (value: Controller) => {
|
|
833
|
+
adding = value;
|
|
834
|
+
},
|
|
835
|
+
items: context.addable.map(([kind, entry]) => ({
|
|
836
|
+
...(entry.icon ? { icon: () => icon({ 'aria-hidden': 'true' }, entry.icon!) } : {}),
|
|
837
|
+
label: typeof entry.title === 'function' ? entry.title({ id: '', kind }) : entry.title,
|
|
838
|
+
onselect: () => context.add(kind, subject.group)
|
|
839
|
+
})),
|
|
840
|
+
[tooltip.context.panel]: { 'aria-label': 'Add panel' }
|
|
841
|
+
},
|
|
842
|
+
''
|
|
843
|
+
)}
|
|
844
|
+
${tooltip.context(
|
|
845
|
+
{
|
|
846
|
+
class: 'shell-menu',
|
|
847
|
+
controller: (value: Controller) => {
|
|
848
|
+
controller = value;
|
|
849
|
+
},
|
|
850
|
+
items,
|
|
851
|
+
[tooltip.context.panel]: { 'aria-label': 'Tab actions' }
|
|
852
|
+
},
|
|
853
|
+
''
|
|
854
|
+
)}
|
|
334
855
|
</div>
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
856
|
+
`;
|
|
857
|
+
}
|
|
858
|
+
);
|
|
338
859
|
|
|
339
860
|
|
|
340
|
-
const layout: typeof shell & {
|
|
861
|
+
const layout: typeof shell & { state: typeof state } = Object.assign(shell, { state });
|
|
341
862
|
|
|
342
863
|
|
|
343
864
|
export default layout;
|
|
344
|
-
export type {
|
|
865
|
+
export type { Catalog, Kind, Layout, Node, Placement, Saved, Store, Surface };
|