@esportsplus/ui 0.62.0 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.audit/audit.json +4 -92
- package/.audit/rules-audit.md +4 -18
- package/README.md +15 -18
- package/RULES.md +80 -9
- package/bin/agent-cli +300 -0
- package/build/components/accordion/index.d.ts +4 -0
- package/build/components/accordion/index.js +13 -10
- package/build/components/breadcrumb/index.d.ts +1 -0
- package/build/components/breadcrumb/index.js +43 -37
- package/build/components/breadcrumb/scss/index.scss +1 -1
- package/build/components/button/kbd.d.ts +1 -1
- package/build/components/button/kbd.js +17 -15
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/button/split.js +14 -16
- package/build/components/capslock/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/chat/minimap/index.js +4 -5
- package/build/components/checkbox/group.d.ts +1 -0
- package/build/components/checkbox/group.js +21 -20
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/color-picker/index.js +6 -6
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/index.d.ts +1 -1
- package/build/components/command/palette.d.ts +13 -9
- package/build/components/command/palette.js +143 -152
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/command/search.d.ts +5 -7
- package/build/components/command/search.js +6 -26
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/editor/code/commands.js +1 -1
- package/build/components/editor/code/document.d.ts +1 -3
- package/build/components/editor/code/document.js +1 -1
- package/build/components/editor/code/editor.d.ts +18 -6
- package/build/components/editor/code/editor.js +9 -7
- package/build/components/editor/code/features.js +27 -18
- package/build/components/editor/code/find.d.ts +1 -1
- package/build/components/editor/code/find.js +5 -6
- package/build/components/editor/code/folding.d.ts +3 -5
- package/build/components/editor/code/folding.js +2 -15
- package/build/components/editor/code/gutter.js +2 -2
- package/build/components/editor/code/index.d.ts +1 -0
- package/build/components/editor/code/index.js +1 -0
- package/build/components/editor/code/minimap.d.ts +3 -1
- package/build/components/editor/code/minimap.js +31 -5
- package/build/components/editor/code/services/model.js +2 -1
- package/build/components/editor/code/syntax.js +2 -1
- package/build/components/editor/code/view.d.ts +8 -2
- package/build/components/editor/code/view.js +37 -56
- package/build/components/editor/diffs/index.d.ts +1 -0
- package/build/components/editor/diffs/index.js +1 -0
- package/build/components/editor/diffs/merge.js +16 -17
- package/build/components/editor/diffs/view.js +10 -11
- package/build/components/editor/markdown/editing.d.ts +2 -1
- package/build/components/editor/markdown/editing.js +14 -5
- package/build/components/editor/markdown/format.d.ts +1 -1
- package/build/components/editor/markdown/format.js +116 -26
- package/build/components/editor/markdown/layout.js +2 -1
- package/build/components/editor/markdown/model.d.ts +1 -2
- package/build/components/editor/markdown/model.js +1 -29
- package/build/components/editor/markdown/render.js +1 -1
- package/build/components/editor/markdown/template.d.ts +3 -10
- package/build/components/editor/markdown/template.js +2 -29
- package/build/components/editor/markdown/toolbar.d.ts +2 -2
- package/build/components/editor/markdown/toolbar.js +90 -126
- package/build/components/editor/markdown/view.d.ts +1 -1
- package/build/components/editor/markdown/view.js +54 -87
- package/build/components/editor/tree/drag.js +1 -1
- package/build/components/editor/tree/find.js +70 -64
- package/build/components/editor/tree/template.js +8 -7
- package/build/components/editor/viewer/model.d.ts +1 -1
- package/build/components/editor/viewer/template.js +4 -26
- package/build/components/editor/workspace/keybindings.d.ts +1 -1
- package/build/components/editor/workspace/model.d.ts +12 -2
- package/build/components/editor/workspace/model.js +87 -31
- package/build/components/editor/workspace/session.d.ts +2 -6
- package/build/components/editor/workspace/session.js +99 -16
- package/build/components/editor/workspace/status.d.ts +1 -1
- package/build/components/editor/workspace/strip.d.ts +10 -9
- package/build/components/editor/workspace/strip.js +99 -141
- package/build/components/editor/workspace/tabs.d.ts +2 -4
- package/build/components/editor/workspace/tabs.js +1 -14
- package/build/components/editor/workspace/template.d.ts +1 -1
- package/build/components/editor/workspace/template.js +305 -435
- package/build/components/error/index.d.ts +4 -13
- package/build/components/error/index.js +53 -172
- package/build/components/error/scss/index.scss +1 -1
- package/build/components/form/action.d.ts +2 -2
- package/build/components/form/action.js +2 -2
- package/build/components/form/input.d.ts +3 -3
- package/build/components/form/input.js +32 -10
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/group/index.js +96 -9
- package/build/components/group/scss/index.scss +1 -1
- package/build/components/heatmap/scss/index.scss +1 -1
- package/build/components/highlight/index.js +55 -48
- package/build/components/highlight/scss/index.scss +1 -1
- package/build/components/icon/scss/index.scss +1 -1
- package/build/components/image/scss/index.scss +1 -1
- package/build/components/index.d.ts +3 -7
- package/build/components/index.js +3 -7
- package/build/components/inline-edit/index.d.ts +2 -2
- package/build/components/inline-edit/index.js +5 -5
- package/build/components/inline-edit/rich.js +4 -4
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/inline-edit/status.js +1 -0
- package/build/components/input/index.d.ts +4 -0
- package/build/components/input/index.js +3 -1
- package/build/components/input/otp.d.ts +18 -0
- package/build/components/input/otp.js +112 -0
- package/build/components/input/password.d.ts +15 -0
- package/build/components/input/password.js +163 -0
- package/build/components/input/scrub.d.ts +1 -0
- package/build/components/input/scrub.js +103 -89
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/input/tag.d.ts +5 -0
- package/build/components/input/tag.js +116 -69
- package/build/components/json/download.js +1 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/marquee/index.js +1 -1
- package/build/components/marquee/scss/index.scss +1 -1
- package/build/components/nav/scss/index.scss +1 -1
- package/build/components/nav/tree.d.ts +2 -1
- package/build/components/nav/tree.js +6 -5
- package/build/components/notification/index.js +3 -3
- package/build/components/notification/scss/index.scss +1 -1
- package/build/components/overlay/popup.d.ts +2 -2
- package/build/components/overlay/popup.js +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/pagination/arrows.js +2 -3
- package/build/components/pagination/cards.js +2 -3
- package/build/components/pagination/index.d.ts +2 -3
- package/build/components/pagination/index.js +18 -13
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/progress/index.js +1 -1
- package/build/components/progress/scss/index.scss +1 -1
- package/build/components/progress/text.js +3 -3
- package/build/components/range/filter.d.ts +7 -1
- package/build/components/range/filter.js +188 -171
- package/build/components/range/index.d.ts +14 -9
- package/build/components/range/index.js +11 -8
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/range/surface.d.ts +21 -0
- package/build/components/range/surface.js +144 -0
- package/build/components/relative-time/index.js +2 -2
- package/build/components/relative-time/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/{preview/header.d.ts → search/button.d.ts} +3 -3
- package/build/components/search/button.js +18 -0
- package/build/components/search/index.d.ts +8 -0
- package/build/components/search/index.js +5 -0
- package/build/components/search/input.d.ts +9 -0
- package/build/components/search/input.js +23 -0
- package/build/components/search/parts.d.ts +5 -0
- package/build/components/search/parts.js +17 -0
- package/build/components/search/scss/index.scss +2 -0
- package/build/components/select/expand.js +4 -5
- package/build/components/select/index.d.ts +7 -7
- package/build/components/select/index.js +127 -117
- package/build/components/select/placement.js +8 -1
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/{panels → shell}/group.d.ts +21 -5
- package/build/components/shell/group.js +336 -0
- package/build/components/shell/index.d.ts +15 -17
- package/build/components/shell/index.js +583 -238
- package/build/components/shell/model.d.ts +94 -0
- package/build/components/{panels → shell}/model.js +199 -73
- package/build/components/shell/resize.d.ts +5 -0
- package/build/components/{panels → shell}/resize.js +54 -30
- package/build/components/shell/scss/index.scss +1 -1
- package/build/components/shell/sidebar.d.ts +34 -0
- package/build/components/shell/sidebar.js +362 -0
- package/build/components/{panels → shell}/subtree.js +7 -8
- package/build/components/shortcut-recorder/index.d.ts +5 -4
- package/build/components/shortcut-recorder/index.js +69 -44
- package/build/components/shortcut-recorder/scss/index.scss +1 -1
- package/build/components/sortable/index.d.ts +16 -2
- package/build/components/sortable/index.js +237 -134
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/story/index.js +46 -34
- package/build/components/story/scss/index.scss +1 -1
- package/build/components/surface-field/engine.d.ts +2 -0
- package/build/components/surface-field/engine.js +86 -33
- package/build/components/surface-field/index.d.ts +26 -4
- package/build/components/surface-field/index.js +35 -4
- package/build/components/surface-field/scss/index.scss +1 -1
- package/build/components/surface-field/surface.d.ts +13 -1
- package/build/components/surface-field/surface.js +149 -58
- package/build/components/tasklist/index.d.ts +1 -4
- package/build/components/tasklist/index.js +36 -43
- package/build/components/tasklist/scss/index.scss +1 -1
- package/build/components/textarea/index.d.ts +1 -1
- package/build/components/textarea/index.js +14 -14
- package/build/components/theme/scss/index.scss +1 -1
- package/build/components/theme/shared.d.ts +1 -2
- package/build/components/theme/shared.js +2 -5
- package/build/components/toast/index.d.ts +3 -3
- package/build/components/toast/index.js +3 -3
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/toolbar/index.d.ts +91 -0
- package/build/components/toolbar/index.js +1281 -0
- package/build/components/toolbar/scss/index.scss +2 -0
- package/build/components/tooltip/menu.d.ts +9 -8
- package/build/components/tooltip/menu.js +397 -279
- package/build/components/tooltip/onclick.d.ts +2 -0
- package/build/components/tooltip/onclick.js +13 -4
- package/build/components/tooltip/onhover.d.ts +3 -1
- package/build/components/tooltip/onhover.js +10 -9
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/tooltip/shared.d.ts +4 -4
- package/build/components/tooltip/shared.js +27 -46
- package/build/components/tooltip/utilities.d.ts +5 -2
- package/build/components/tooltip/utilities.js +169 -9
- package/build/components/typewriter/rotate.js +6 -6
- package/build/components/typewriter/scss/index.scss +1 -1
- package/build/components/uptime/scss/index.scss +1 -1
- package/build/components/usage-meter/index.js +1 -1
- package/build/components/usage-meter/scss/index.scss +1 -1
- package/build/css-utilities/font/montserrat/OFL.txt +93 -0
- package/build/shared/drag.d.ts +15 -9
- package/build/shared/drag.js +41 -28
- package/build/shared/placement.d.ts +39 -0
- package/build/shared/placement.js +55 -0
- package/build/shared/transition.js +1 -1
- package/build/shared/viewport.d.ts +1 -2
- package/build/shared/viewport.js +1 -4
- package/package.json +9 -12
- package/src/components/accordion/index.ts +12 -5
- package/src/components/announcement/index.ts +1 -1
- package/src/components/breadcrumb/index.ts +13 -3
- package/src/components/breadcrumb/scss/index.scss +6 -6
- package/src/components/breadcrumb/scss/variables.scss +7 -0
- package/src/components/button/kbd.ts +22 -17
- package/src/components/button/scss/index.scss +69 -76
- package/src/components/button/scss/variables.scss +51 -18
- package/src/components/button/split.ts +12 -8
- package/src/components/capslock/index.ts +2 -0
- package/src/components/capslock/scss/index.scss +21 -21
- package/src/components/card/scss/index.scss +16 -0
- package/src/components/card/scss/variables.scss +25 -2
- package/src/components/chat/minimap/index.ts +5 -6
- package/src/components/chat/minimap/scss/index.scss +12 -11
- package/src/components/chat/minimap/scss/variables.scss +23 -17
- package/src/components/checkbox/group.ts +8 -7
- package/src/components/checkbox/scss/index.scss +59 -35
- package/src/components/checkbox/scss/variables.scss +24 -17
- package/src/components/color-picker/index.ts +6 -6
- package/src/components/color-picker/scss/index.scss +35 -22
- package/src/components/color-picker/scss/variables.scss +11 -3
- package/src/components/command/index.ts +1 -1
- package/src/components/command/palette.ts +174 -166
- package/src/components/command/scss/index.scss +18 -51
- package/src/components/command/scss/variables.scss +37 -71
- package/src/components/command/search.ts +9 -31
- package/src/components/counter/index.ts +22 -22
- package/src/components/counter/scss/variables.scss +10 -7
- package/src/components/editor/code/commands.ts +1 -1
- package/src/components/editor/code/document.ts +0 -2
- package/src/components/editor/code/editor.ts +31 -13
- package/src/components/editor/code/features.ts +39 -24
- package/src/components/editor/code/find.ts +5 -6
- package/src/components/editor/code/folding.ts +3 -21
- package/src/components/editor/code/gutter.ts +2 -2
- package/src/components/editor/code/index.ts +1 -0
- package/src/components/editor/code/minimap.ts +39 -5
- package/src/components/editor/code/scss/_editor.scss +28 -21
- package/src/components/editor/code/scss/_features.scss +19 -21
- package/src/components/editor/code/scss/_services.scss +14 -11
- package/src/components/editor/code/scss/variables.scss +31 -12
- package/src/components/editor/code/services/model.ts +2 -1
- package/src/components/editor/code/syntax.ts +2 -1
- package/src/components/editor/code/view.ts +22 -45
- package/src/components/editor/diffs/index.ts +1 -0
- package/src/components/editor/diffs/merge.ts +9 -10
- package/src/components/editor/diffs/scss/_diffs.scss +39 -63
- package/src/components/editor/diffs/scss/_merge.scss +10 -2
- package/src/components/editor/diffs/scss/index.scss +0 -1
- package/src/components/editor/diffs/scss/variables.scss +36 -17
- package/src/components/editor/diffs/view.ts +8 -9
- package/src/components/editor/markdown/editing.ts +18 -6
- package/src/components/editor/markdown/format.ts +180 -32
- package/src/components/editor/markdown/layout.ts +2 -1
- package/src/components/editor/markdown/model.ts +0 -38
- package/src/components/editor/markdown/render.ts +1 -1
- package/src/components/editor/markdown/scss/index.scss +38 -52
- package/src/components/editor/markdown/scss/variables.scss +24 -50
- package/src/components/editor/markdown/template.ts +3 -63
- package/src/components/editor/markdown/toolbar.ts +76 -127
- package/src/components/editor/markdown/view.ts +9 -32
- package/src/components/editor/tree/drag.ts +1 -1
- package/src/components/editor/tree/find.ts +61 -64
- package/src/components/editor/tree/scss/index.scss +29 -30
- package/src/components/editor/tree/scss/variables.scss +34 -15
- package/src/components/editor/tree/template.ts +9 -9
- package/src/components/editor/viewer/model.ts +1 -1
- package/src/components/editor/viewer/scss/_viewer.scss +4 -5
- package/src/components/editor/viewer/scss/variables.scss +3 -3
- package/src/components/editor/viewer/template.ts +4 -31
- package/src/components/editor/workspace/keybindings.ts +1 -1
- package/src/components/editor/workspace/model.ts +136 -37
- package/src/components/editor/workspace/scss/_keybindings.scss +3 -20
- package/src/components/editor/workspace/scss/_status.scss +0 -1
- package/src/components/editor/workspace/scss/_tabs.scss +2 -41
- package/src/components/editor/workspace/scss/index.scss +49 -71
- package/src/components/editor/workspace/scss/variables.scss +1 -135
- package/src/components/editor/workspace/session.ts +138 -18
- package/src/components/editor/workspace/status.ts +1 -1
- package/src/components/editor/workspace/strip.ts +96 -115
- package/src/components/editor/workspace/tabs.ts +2 -23
- package/src/components/editor/workspace/template.ts +323 -458
- package/src/components/error/index.ts +47 -183
- package/src/components/error/scss/index.scss +34 -35
- package/src/components/error/scss/variables.scss +14 -26
- package/src/components/filter/scss/index.scss +6 -5
- package/src/components/form/action.ts +7 -7
- package/src/components/form/input.ts +25 -12
- package/src/components/frame/scss/index.scss +5 -5
- package/src/components/group/index.ts +77 -2
- package/src/components/group/scss/index.scss +164 -0
- package/src/components/group/scss/variables.scss +110 -2
- package/src/components/heatmap/scss/variables.scss +13 -10
- package/src/components/highlight/index.ts +87 -79
- package/src/components/highlight/scss/index.scss +6 -16
- package/src/components/highlight/scss/variables.scss +33 -5
- package/src/components/icon/scss/index.scss +2 -2
- package/src/components/icon/scss/variables.scss +14 -1
- package/src/components/image/scss/index.scss +9 -9
- package/src/components/image/scss/variables.scss +1 -1
- package/src/components/index.ts +3 -7
- package/src/components/inline-edit/index.ts +8 -6
- package/src/components/inline-edit/rich.ts +8 -8
- package/src/components/inline-edit/scss/index.scss +50 -36
- package/src/components/inline-edit/scss/variables.scss +28 -18
- package/src/components/inline-edit/status.ts +2 -0
- package/src/components/input/index.ts +3 -1
- package/src/components/input/otp.ts +175 -0
- package/src/components/input/password.ts +178 -0
- package/src/components/input/scrub.ts +197 -178
- package/src/components/input/scss/index.scss +344 -4
- package/src/components/input/scss/variables.scss +234 -65
- package/src/components/input/tag.ts +98 -53
- package/src/components/json/download.ts +2 -5
- package/src/components/link/scss/index.scss +3 -5
- package/src/components/loading/scss/index.scss +1 -0
- package/src/components/loading/scss/variables.scss +1 -0
- package/src/components/marquee/index.ts +1 -1
- package/src/components/marquee/scss/index.scss +11 -4
- package/src/components/nav/scss/index.scss +10 -26
- package/src/components/nav/scss/variables.scss +13 -23
- package/src/components/nav/tree.ts +10 -8
- package/src/components/notification/index.ts +3 -3
- package/src/components/notification/scss/index.scss +7 -14
- package/src/components/notification/scss/variables.scss +10 -2
- package/src/components/number/index.ts +1 -1
- package/src/components/overlay/popup.ts +2 -2
- package/src/components/overlay/scss/index.scss +60 -51
- package/src/components/page/scss/variables.scss +1 -0
- package/src/components/pagination/arrows.ts +2 -3
- package/src/components/pagination/cards.ts +2 -3
- package/src/components/pagination/index.ts +11 -9
- package/src/components/pagination/scss/index.scss +38 -101
- package/src/components/pagination/scss/variables.scss +24 -69
- package/src/components/progress/index.ts +1 -1
- package/src/components/progress/scss/index.scss +22 -11
- package/src/components/progress/scss/variables.scss +13 -5
- package/src/components/progress/text.ts +3 -3
- package/src/components/range/filter.ts +249 -246
- package/src/components/range/index.ts +22 -7
- package/src/components/range/scss/index.scss +470 -15
- package/src/components/range/scss/variables.scss +402 -198
- package/src/components/range/surface.ts +135 -0
- package/src/components/relative-time/index.ts +2 -2
- package/src/components/relative-time/scss/index.scss +4 -2
- package/src/components/relative-time/scss/variables.scss +4 -5
- package/src/components/root/scss/index.scss +11 -11
- package/src/components/root/scss/variables.scss +4 -4
- package/src/components/search/button.ts +24 -0
- package/src/components/search/index.ts +12 -0
- package/src/components/search/input.ts +35 -0
- package/src/components/search/parts.ts +24 -0
- package/src/components/search/scss/index.scss +36 -0
- package/src/components/search/scss/variables.scss +67 -0
- package/src/components/section/scss/variables.scss +1 -0
- package/src/components/select/expand.ts +3 -4
- package/src/components/select/index.ts +55 -41
- package/src/components/select/placement.ts +17 -1
- package/src/components/select/scss/index.scss +57 -29
- package/src/components/select/scss/variables.scss +91 -53
- package/src/components/{panels → shell}/group.ts +151 -98
- package/src/components/shell/index.ts +805 -284
- package/src/components/{panels → shell}/model.ts +329 -102
- package/src/components/shell/resize.ts +176 -0
- package/src/components/shell/scss/index.scss +502 -89
- package/src/components/shell/scss/variables.scss +264 -39
- package/src/components/shell/sidebar.ts +325 -0
- package/src/components/{panels → shell}/subtree.ts +1 -2
- package/src/components/shortcut-recorder/index.ts +99 -61
- package/src/components/shortcut-recorder/scss/index.scss +76 -52
- package/src/components/shortcut-recorder/scss/variables.scss +25 -30
- package/src/components/sortable/index.ts +364 -63
- package/src/components/sortable/scss/index.scss +22 -2
- package/src/components/sortable/scss/variables.scss +16 -4
- package/src/components/story/index.ts +56 -33
- package/src/components/story/scss/index.scss +67 -16
- package/src/components/story/scss/variables.scss +59 -18
- package/src/components/surface-field/engine.ts +157 -61
- package/src/components/surface-field/index.ts +64 -9
- package/src/components/surface-field/scss/index.scss +88 -77
- package/src/components/surface-field/scss/variables.scss +84 -36
- package/src/components/surface-field/surface.ts +225 -76
- package/src/components/tasklist/index.ts +10 -14
- package/src/components/tasklist/scss/index.scss +25 -45
- package/src/components/tasklist/scss/variables.scss +12 -29
- package/src/components/textarea/index.ts +39 -42
- package/src/components/theme/reveal.ts +1 -0
- package/src/components/theme/scss/index.scss +20 -16
- package/src/components/theme/scss/variables.scss +11 -5
- package/src/components/theme/shared.ts +3 -7
- package/src/components/toast/index.ts +7 -8
- package/src/components/toast/scss/index.scss +44 -36
- package/src/components/toast/scss/variables.scss +36 -33
- package/src/components/toolbar/index.ts +1675 -0
- package/src/components/toolbar/scss/index.scss +759 -0
- package/src/components/toolbar/scss/variables.scss +555 -0
- package/src/components/tooltip/menu.ts +301 -220
- package/src/components/tooltip/onclick.ts +18 -3
- package/src/components/tooltip/onhover.ts +13 -9
- package/src/components/tooltip/scss/index.scss +155 -188
- package/src/components/tooltip/scss/variables.scss +151 -135
- package/src/components/tooltip/shared.ts +47 -74
- package/src/components/tooltip/utilities.ts +151 -10
- package/src/components/truncate/index.ts +1 -1
- package/src/components/typewriter/rotate.ts +6 -6
- package/src/components/typewriter/scss/index.scss +14 -5
- package/src/components/uptime/scss/index.scss +8 -15
- package/src/components/uptime/scss/variables.scss +12 -1
- package/src/components/usage-meter/index.ts +1 -1
- package/src/components/usage-meter/scss/index.scss +6 -4
- package/src/components/usage-meter/scss/variables.scss +11 -11
- package/src/css-utilities/box-shadow.scss +0 -1
- package/src/css-utilities/icon.scss +9 -9
- package/src/css-utilities/surface.scss +27 -17
- package/src/modifiers/glass/index.ts +2 -2
- package/src/modifiers/glass/scss/index.scss +2 -2
- package/src/normalize/scss/index.scss +1 -1
- package/src/shared/drag.ts +92 -53
- package/src/shared/placement.ts +145 -0
- package/src/shared/transition.ts +1 -1
- package/src/shared/viewport.ts +1 -7
- package/src/tokens/scss/color.scss +2 -2
- package/src/tokens/scss/scale.scss +5 -1
- package/src/tokens/scss/size.scss +0 -7
- package/storage/svg/angle.svg +1 -0
- package/storage/svg/{chevron-left.svg → arrow.svg} +1 -1
- package/storage/svg/calendar.svg +1 -0
- package/storage/svg/circle-filled.svg +1 -0
- package/storage/svg/cursor-arrow-left.svg +1 -0
- package/storage/svg/cursor-arrow-right.svg +1 -0
- package/storage/svg/fit.svg +1 -0
- package/storage/svg/grip.svg +1 -0
- package/storage/svg/mail.svg +1 -0
- package/storage/svg/{chevron-down.svg → minus.svg} +1 -1
- package/storage/svg/music.svg +1 -0
- package/storage/svg/{chevron-up.svg → rotate-ccw.svg} +1 -1
- package/vite.config.ts +9 -13
- package/build/components/cc/index.d.ts +0 -33
- package/build/components/cc/index.js +0 -603
- package/build/components/cc/scss/index.scss +0 -2
- package/build/components/dock/index.d.ts +0 -47
- package/build/components/dock/index.js +0 -469
- package/build/components/dock/scss/index.scss +0 -2
- package/build/components/metric/flash.d.ts +0 -12
- package/build/components/metric/flash.js +0 -117
- package/build/components/metric/index.d.ts +0 -44
- package/build/components/metric/index.js +0 -275
- package/build/components/metric/scss/index.scss +0 -2
- package/build/components/pagination/dots.d.ts +0 -23
- package/build/components/pagination/dots.js +0 -115
- package/build/components/panels/dnd.d.ts +0 -47
- package/build/components/panels/dnd.js +0 -114
- package/build/components/panels/group.js +0 -322
- package/build/components/panels/index.d.ts +0 -17
- package/build/components/panels/index.js +0 -524
- package/build/components/panels/model.d.ts +0 -64
- package/build/components/panels/resize.d.ts +0 -9
- package/build/components/panels/scss/index.scss +0 -2
- package/build/components/preview/buttons.d.ts +0 -12
- package/build/components/preview/buttons.js +0 -26
- package/build/components/preview/code.d.ts +0 -8
- package/build/components/preview/code.js +0 -18
- package/build/components/preview/header.js +0 -21
- package/build/components/preview/index.d.ts +0 -37
- package/build/components/preview/index.js +0 -123
- package/build/components/preview/scss/index.scss +0 -2
- package/build/components/preview/source.d.ts +0 -12
- package/build/components/preview/source.js +0 -79
- package/build/components/preview/stage.d.ts +0 -8
- package/build/components/preview/stage.js +0 -28
- package/build/components/textarea/scss/index.scss +0 -2
- package/src/components/cc/index.ts +0 -562
- package/src/components/cc/scss/index.scss +0 -416
- package/src/components/cc/scss/variables.scss +0 -257
- package/src/components/dock/index.ts +0 -567
- package/src/components/dock/scss/index.scss +0 -346
- package/src/components/dock/scss/variables.scss +0 -357
- package/src/components/input/scss/_field.scss +0 -39
- package/src/components/input/scss/_scrub.scss +0 -89
- package/src/components/input/scss/_tag.scss +0 -142
- package/src/components/metric/flash.ts +0 -129
- package/src/components/metric/index.ts +0 -307
- package/src/components/metric/scss/_flash.scss +0 -150
- package/src/components/metric/scss/index.scss +0 -155
- package/src/components/metric/scss/variables.scss +0 -233
- package/src/components/pagination/dots.ts +0 -132
- package/src/components/panels/dnd.ts +0 -190
- package/src/components/panels/index.ts +0 -676
- package/src/components/panels/resize.ts +0 -157
- package/src/components/panels/scss/index.scss +0 -379
- package/src/components/panels/scss/variables.scss +0 -197
- package/src/components/preview/buttons.ts +0 -48
- package/src/components/preview/code.ts +0 -28
- package/src/components/preview/header.ts +0 -23
- package/src/components/preview/index.ts +0 -149
- package/src/components/preview/scss/index.scss +0 -158
- package/src/components/preview/scss/variables.scss +0 -149
- package/src/components/preview/source.ts +0 -73
- package/src/components/preview/stage.ts +0 -33
- package/src/components/range/scss/_filter.scss +0 -360
- package/src/components/range/scss/_slider.scss +0 -65
- package/src/components/range/scss/_vertical.scss +0 -10
- package/src/components/textarea/scss/index.scss +0 -72
- package/src/components/textarea/scss/variables.scss +0 -22
- package/storage/svg/amex.svg +0 -1
- package/storage/svg/arrow-down.svg +0 -1
- package/storage/svg/arrow-left.svg +0 -1
- package/storage/svg/arrow-right.svg +0 -1
- package/storage/svg/arrow-up.svg +0 -1
- package/storage/svg/card.svg +0 -1
- package/storage/svg/chip.svg +0 -1
- package/storage/svg/discover.svg +0 -1
- package/storage/svg/mastercard.svg +0 -1
- package/storage/svg/visa.svg +0 -1
- /package/build/components/{panels → shell}/subtree.d.ts +0 -0
- /package/storage/svg/{chevron-right.svg → chevron.svg} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { effect, flush, onCleanup, reactive, read, root, signal, untrack, write, type Signal } from '@esportsplus/reactivity';
|
|
1
|
+
import { computed, effect, flush, onCleanup, reactive, read, root, signal, untrack, write, type Signal } from '@esportsplus/reactivity';
|
|
2
2
|
import { component, html, type Attributes, type On, type Renderable } from '@esportsplus/template';
|
|
3
3
|
import breadcrumb, { type Crumb } from '~/components/breadcrumb';
|
|
4
|
-
import
|
|
5
|
-
import command, { type Command, type ResultGroup, type Tab } from '~/components/command';
|
|
4
|
+
import command, { type Command, type ResultGroup, type Sprite, type Tab } from '~/components/command';
|
|
6
5
|
import fileTree, {
|
|
7
6
|
FileTreeDecorations,
|
|
8
7
|
FileTreeEditor,
|
|
@@ -11,17 +10,16 @@ import fileTree, {
|
|
|
11
10
|
type FileTreeController,
|
|
12
11
|
type FileTreeElement
|
|
13
12
|
} from '../tree';
|
|
14
|
-
import highlight from '~/components/highlight';
|
|
15
13
|
import icon from '~/components/icon';
|
|
16
14
|
import input from '~/components/input';
|
|
17
15
|
import nav from '~/components/nav';
|
|
18
16
|
import overlay from '~/components/overlay';
|
|
17
|
+
import shell, { type Catalog, type Surface } from '~/components/shell';
|
|
18
|
+
import { findSurfaceGroup } from '~/components/shell/model';
|
|
19
19
|
import tooltip from '~/components/tooltip';
|
|
20
20
|
import type { Controller as MenuController, Item } from '~/components/tooltip/menu';
|
|
21
|
-
import scrollbar from '~/modifiers/scrollbar';
|
|
22
21
|
import fuzzy from '~/shared/fuzzy';
|
|
23
22
|
import { mac } from '~/shared/platform';
|
|
24
|
-
import { observe } from '~/shared/resize';
|
|
25
23
|
import codeEditor, { type CodeEditorAttributes } from '../code/editor';
|
|
26
24
|
import type { Controller as EditorController, Options as EditorOptions } from '../code/view';
|
|
27
25
|
import { label as chordLabel, declare, merge, sequence } from './keybindings';
|
|
@@ -39,10 +37,8 @@ import hosted from './session';
|
|
|
39
37
|
import shortcuts, { OPEN, PALETTE } from './shortcuts';
|
|
40
38
|
import statusbar from './statusbar';
|
|
41
39
|
import tabStrip from './strip';
|
|
42
|
-
import
|
|
43
|
-
import right from '@esportsplus/ui/svg/arrow-right.svg';
|
|
40
|
+
import arrow from '@esportsplus/ui/svg/arrow.svg';
|
|
44
41
|
import collapse from '@esportsplus/ui/svg/chevrons-up-down.svg';
|
|
45
|
-
import close from '@esportsplus/ui/svg/close.svg';
|
|
46
42
|
import cmd from '@esportsplus/ui/svg/command.svg';
|
|
47
43
|
import wrap from '@esportsplus/ui/svg/corner-down-right.svg';
|
|
48
44
|
import whitespace from '@esportsplus/ui/svg/eye.svg';
|
|
@@ -58,8 +54,8 @@ type CodeEditorWorkspaceAttributes = Attributes & {
|
|
|
58
54
|
cwd?: string;
|
|
59
55
|
// The host's own marks, like git status and problems, which the explorer shows and next/previous step between.
|
|
60
56
|
decorations?: FileTreeDecorations | FileTreeDecorations[];
|
|
61
|
-
// The editor for a tab, such as 'editor.markdown', or undefined for the code editor.
|
|
62
|
-
//
|
|
57
|
+
// The editor for a tab, such as 'editor.markdown', or undefined for the code editor. Each tab's pane mounts its
|
|
58
|
+
// own while the tab shows in its group.
|
|
63
59
|
editor?: (tab: WorkspaceTab) => WorkspaceEditor | undefined;
|
|
64
60
|
editorOptions?: EditorOptions | ((tab: WorkspaceTab) => EditorOptions);
|
|
65
61
|
host?: WorkspaceHost;
|
|
@@ -98,14 +94,15 @@ type Confirmation = {
|
|
|
98
94
|
|
|
99
95
|
type Control = {
|
|
100
96
|
active?: () => boolean;
|
|
97
|
+
// A class turning the sprite, such as 'icon--left'.
|
|
98
|
+
direction?: () => string;
|
|
101
99
|
disabled?: () => boolean;
|
|
102
100
|
label: string | (() => string);
|
|
103
101
|
onclick: VoidFunction;
|
|
104
102
|
sprite: string | (() => string);
|
|
105
103
|
};
|
|
106
104
|
|
|
107
|
-
// The editor
|
|
108
|
-
// different one takes its place or the workspace goes.
|
|
105
|
+
// The editor a tab's pane shows while the tab is its group's active one, released once it isn't or the tab closes.
|
|
109
106
|
type Mount = {
|
|
110
107
|
addon?: void | VoidFunction;
|
|
111
108
|
controller?: WorkspaceEditorController;
|
|
@@ -136,20 +133,18 @@ type WorkspaceEditorContext = {
|
|
|
136
133
|
workspace: EditorWorkspaceModel;
|
|
137
134
|
};
|
|
138
135
|
|
|
139
|
-
// Shared by the code and markdown controllers; narrow with 'isWorkspaceCodeEditor' for code-only addons.
|
|
140
|
-
|
|
141
|
-
type WorkspaceEditorController = Pick<EditorController, 'dispose' | 'document' | 'focus' | 'host' | 'scroller' | 'select'> &
|
|
142
|
-
Partial<Pick<EditorController, 'setDocument'>>;
|
|
136
|
+
// Shared by the code and markdown controllers; narrow with 'isWorkspaceCodeEditor' for code-only addons.
|
|
137
|
+
type WorkspaceEditorController = Pick<EditorController, 'dispose' | 'document' | 'focus' | 'host' | 'scroller' | 'select'>;
|
|
143
138
|
|
|
144
139
|
|
|
145
|
-
// At or below this width the explorer
|
|
146
|
-
const
|
|
140
|
+
// At or below this width the explorer pushes the editors aside as it opens, rather than narrowing them.
|
|
141
|
+
const NARROW = 520;
|
|
147
142
|
|
|
148
143
|
|
|
149
144
|
let uid = 0;
|
|
150
145
|
|
|
151
146
|
|
|
152
|
-
function control({ active, disabled, label, onclick, sprite }: Control) {
|
|
147
|
+
function control({ active, direction, disabled, label, onclick, sprite }: Control) {
|
|
153
148
|
return html`
|
|
154
149
|
<button
|
|
155
150
|
class='button code-workspace-control'
|
|
@@ -163,11 +158,19 @@ function control({ active, disabled, label, onclick, sprite }: Control) {
|
|
|
163
158
|
title: label
|
|
164
159
|
}}
|
|
165
160
|
>
|
|
166
|
-
${() => icon({ 'aria-hidden': 'true', class: 'code-workspace-control-icon' }, typeof sprite === 'string' ? sprite : sprite())}
|
|
161
|
+
${() => icon({ 'aria-hidden': 'true', class: ['code-workspace-control-icon', direction?.() ?? ''] }, typeof sprite === 'string' ? sprite : sprite())}
|
|
167
162
|
</button>
|
|
168
163
|
`;
|
|
169
164
|
}
|
|
170
165
|
|
|
166
|
+
function glyph(sprite: Sprite) {
|
|
167
|
+
if (typeof sprite === 'string') {
|
|
168
|
+
return icon({ 'aria-hidden': 'true', class: 'code-workspace-command-icon' }, sprite);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return icon({ 'aria-hidden': 'true', class: ['code-workspace-command-icon', sprite.class] }, sprite.href);
|
|
172
|
+
}
|
|
173
|
+
|
|
171
174
|
// 'Mod' is ⌘ on Apple platforms and Ctrl elsewhere, as the command palette spells it. Text, for titles; keycaps swap
|
|
172
175
|
// the ⌘ for its icon, since most fonts lack the glyph.
|
|
173
176
|
function keys(names: string[]) {
|
|
@@ -244,8 +247,6 @@ const workspace = ({
|
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
let actions: MenuController | undefined,
|
|
247
|
-
// The tabs select by id, so switching tabs re-renders just the two whose state flips.
|
|
248
|
-
activeId = signal(0),
|
|
249
250
|
// The code editor keymap has no chord sequences, so the workspace runs Mod+K Mod+S itself.
|
|
250
251
|
chords = sequence({
|
|
251
252
|
// Focus inside only: the page's own Mod+K, like site search, still answers under a resting pointer.
|
|
@@ -270,29 +271,30 @@ const workspace = ({
|
|
|
270
271
|
decorated = new Map<string, boolean>(),
|
|
271
272
|
decorations = new FileTreeDecorations(),
|
|
272
273
|
dialog = reactive({ active: false }),
|
|
273
|
-
elements = new WeakMap<WorkspaceTab, HTMLElement>(),
|
|
274
274
|
files = signal<readonly string[]>([]),
|
|
275
|
-
|
|
275
|
+
// The tab whose editor takes focus once it mounts.
|
|
276
|
+
focusing: WorkspaceTab | undefined,
|
|
276
277
|
id = `code-workspace-${++uid}`,
|
|
277
278
|
keyboard = reactive({ active: false }),
|
|
278
279
|
model = supplied ?? new EditorWorkspaceModel(host!, cwd),
|
|
279
|
-
|
|
280
|
+
mounts = new Map<WorkspaceTab, Mount>(),
|
|
280
281
|
palette = reactive({ active: false, index: 0, query: '', tab: 'all' as Tab }),
|
|
281
282
|
release: VoidFunction | undefined,
|
|
282
283
|
request = signal<WorkspaceConfirmation | undefined>(undefined),
|
|
283
284
|
returnFocus: HTMLElement | undefined,
|
|
284
285
|
revealed = 0,
|
|
285
286
|
searchField: HTMLInputElement | undefined,
|
|
287
|
+
// Each pane's way to mount its editor again.
|
|
288
|
+
remounts = new Map<WorkspaceTab, VoidFunction>(),
|
|
286
289
|
// Runs once the open modal has closed and returned focus, to move it where the user went next.
|
|
287
290
|
settle: VoidFunction | undefined,
|
|
288
|
-
shown = signal<Mount | undefined>(undefined),
|
|
289
291
|
statusBar = statusbar(model, () => navigation.go('problem')),
|
|
290
292
|
strip = tabStrip({
|
|
291
293
|
isFile: (path) => treeStore.get(path)?.type === 'file',
|
|
292
294
|
model,
|
|
293
|
-
remount,
|
|
295
|
+
remount: (tab) => remounts.get(tab)?.(),
|
|
294
296
|
reveal: (path) => {
|
|
295
|
-
|
|
297
|
+
explore();
|
|
296
298
|
treeState.selected = '';
|
|
297
299
|
flush();
|
|
298
300
|
treeState.selected = path;
|
|
@@ -303,11 +305,16 @@ const workspace = ({
|
|
|
303
305
|
treeEditor = new FileTreeEditor(),
|
|
304
306
|
treeState = reactive({ selected: '', selection: new Set<string>() }),
|
|
305
307
|
treeStore = new FileTreeElements([]),
|
|
306
|
-
ui = reactive({
|
|
308
|
+
ui = reactive({ position: '', search: '' });
|
|
307
309
|
|
|
308
|
-
let
|
|
310
|
+
let active = computed(() => model.state.active),
|
|
311
|
+
hosting = hosted(model, (tab) => mounts.get(tab)?.controller),
|
|
309
312
|
navigation = navigate({
|
|
310
|
-
bindings: () =>
|
|
313
|
+
bindings: () => {
|
|
314
|
+
let tab = read(active);
|
|
315
|
+
|
|
316
|
+
return tab && mounts.has(tab) ? settings(tab, tab.path).keybindings : model.state.preferences.keybindings;
|
|
317
|
+
},
|
|
311
318
|
hosting,
|
|
312
319
|
model,
|
|
313
320
|
tree: () => tree
|
|
@@ -320,9 +327,6 @@ const workspace = ({
|
|
|
320
327
|
get canUndo() {
|
|
321
328
|
return model.state.canUndoFiles;
|
|
322
329
|
},
|
|
323
|
-
get collapsed() {
|
|
324
|
-
return model.state.tabs.length > 0 && !model.state.preferences.explorerOpen;
|
|
325
|
-
},
|
|
326
330
|
get cwd() {
|
|
327
331
|
return model.state.cwd;
|
|
328
332
|
},
|
|
@@ -339,7 +343,7 @@ const workspace = ({
|
|
|
339
343
|
return model.state.loaded;
|
|
340
344
|
},
|
|
341
345
|
get path() {
|
|
342
|
-
let tab =
|
|
346
|
+
let tab = read(active);
|
|
343
347
|
|
|
344
348
|
return tab && !tab.compare ? tab.path : '';
|
|
345
349
|
},
|
|
@@ -356,16 +360,13 @@ const workspace = ({
|
|
|
356
360
|
? 'Working…'
|
|
357
361
|
: state.loading
|
|
358
362
|
? 'Refreshing…'
|
|
359
|
-
:
|
|
363
|
+
: read(active)?.missing
|
|
360
364
|
? 'File removed from disk; draft retained'
|
|
361
365
|
: '');
|
|
362
366
|
},
|
|
363
367
|
get statusError() {
|
|
364
368
|
return !!model.state.status && model.state.statusKind === 'error';
|
|
365
369
|
},
|
|
366
|
-
get tabs() {
|
|
367
|
-
return model.state.tabs.length > 0;
|
|
368
|
-
},
|
|
369
370
|
get whitespace() {
|
|
370
371
|
return model.state.preferences.showWhitespace;
|
|
371
372
|
},
|
|
@@ -410,7 +411,6 @@ const workspace = ({
|
|
|
410
411
|
let controller = current.controller;
|
|
411
412
|
|
|
412
413
|
detach(current);
|
|
413
|
-
statusBar.attach(controller);
|
|
414
414
|
write(current.path, current.tab.path);
|
|
415
415
|
|
|
416
416
|
if (!addons || !controller) {
|
|
@@ -447,11 +447,6 @@ const workspace = ({
|
|
|
447
447
|
release?.();
|
|
448
448
|
container = element;
|
|
449
449
|
release = root((dispose) => {
|
|
450
|
-
// Measured, since a container query can't restyle the container's own grid into the stacked layout.
|
|
451
|
-
let unobserve = observe(element, ([entry]) => {
|
|
452
|
-
ui.compact = entry.contentRect.width <= COMPACT_WIDTH;
|
|
453
|
-
});
|
|
454
|
-
|
|
455
450
|
// Capture, so the second chord reaches neither the editor nor the workspace's own Mod+S.
|
|
456
451
|
onCleanup(on(element.ownerDocument, 'keydown', chords.keydown, { capture: true }));
|
|
457
452
|
// A closing modal hands focus back to whatever had it before, so ours moves only once it has closed;
|
|
@@ -469,13 +464,12 @@ const workspace = ({
|
|
|
469
464
|
onCleanup(statusBar.connect());
|
|
470
465
|
onCleanup(() => {
|
|
471
466
|
chords.cancel();
|
|
472
|
-
unobserve();
|
|
473
467
|
confirmation?.resolve('cancel');
|
|
474
468
|
model.setConfirmation(undefined);
|
|
475
469
|
model.stop();
|
|
476
470
|
|
|
477
|
-
|
|
478
|
-
unmount(
|
|
471
|
+
for (let current of [...mounts.values()]) {
|
|
472
|
+
unmount(current);
|
|
479
473
|
}
|
|
480
474
|
|
|
481
475
|
container = undefined;
|
|
@@ -502,10 +496,9 @@ const workspace = ({
|
|
|
502
496
|
});
|
|
503
497
|
|
|
504
498
|
effect(() => {
|
|
505
|
-
let tab =
|
|
499
|
+
let tab = read(active);
|
|
506
500
|
|
|
507
|
-
|
|
508
|
-
untrack(() => show(tab));
|
|
501
|
+
untrack(() => statusBar.attach(tab && mounts.get(tab)?.controller));
|
|
509
502
|
});
|
|
510
503
|
|
|
511
504
|
effect(() => {
|
|
@@ -513,19 +506,18 @@ const workspace = ({
|
|
|
513
506
|
|
|
514
507
|
untrack(() => {
|
|
515
508
|
treeState.selected = path;
|
|
516
|
-
|
|
517
|
-
// A rename keeps the tab and its editor; addons restart for the new path.
|
|
518
|
-
if (mount && mount.tab === model.state.active && read(mount.path) !== path) {
|
|
519
|
-
attach(mount);
|
|
520
|
-
}
|
|
521
509
|
});
|
|
522
510
|
});
|
|
523
511
|
|
|
512
|
+
// The layout's sidebar toggle shows and hides the explorer, which the preferences remember.
|
|
524
513
|
effect(() => {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
514
|
+
let open = model.layout.layout[untrack(() => model.state.preferences.explorerSide)].open;
|
|
515
|
+
|
|
516
|
+
untrack(() => {
|
|
517
|
+
if (open !== model.state.preferences.explorerOpen) {
|
|
518
|
+
model.setPreferences({ explorerOpen: open });
|
|
519
|
+
}
|
|
520
|
+
});
|
|
529
521
|
});
|
|
530
522
|
|
|
531
523
|
effect(() => {
|
|
@@ -535,14 +527,14 @@ const workspace = ({
|
|
|
535
527
|
});
|
|
536
528
|
|
|
537
529
|
effect(() => {
|
|
538
|
-
|
|
530
|
+
read(active);
|
|
539
531
|
model.state.reveal;
|
|
540
532
|
untrack(reveal);
|
|
541
533
|
});
|
|
542
534
|
|
|
543
535
|
// Line and column follow the active document alone, so typing in one tab never touches the others.
|
|
544
536
|
effect(() => {
|
|
545
|
-
let tab =
|
|
537
|
+
let tab = read(active);
|
|
546
538
|
|
|
547
539
|
if (!tab || tab.compare) {
|
|
548
540
|
ui.position = '';
|
|
@@ -569,7 +561,7 @@ const workspace = ({
|
|
|
569
561
|
|
|
570
562
|
if (path && treeStore.get(path)?.type === 'file') {
|
|
571
563
|
untrack(() => {
|
|
572
|
-
if (path !==
|
|
564
|
+
if (path !== read(active)?.path) {
|
|
573
565
|
void model.open(path, undefined, undefined, true);
|
|
574
566
|
}
|
|
575
567
|
});
|
|
@@ -599,13 +591,13 @@ const workspace = ({
|
|
|
599
591
|
});
|
|
600
592
|
}
|
|
601
593
|
|
|
602
|
-
function crumbs() {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
if (!path) {
|
|
594
|
+
function crumbs(tab: WorkspaceTab) {
|
|
595
|
+
if (tab.compare) {
|
|
606
596
|
return '';
|
|
607
597
|
}
|
|
608
598
|
|
|
599
|
+
let path = tab.path;
|
|
600
|
+
|
|
609
601
|
let parts = path.split('/'),
|
|
610
602
|
project = view.project,
|
|
611
603
|
items: Crumb[] = [];
|
|
@@ -622,7 +614,7 @@ const workspace = ({
|
|
|
622
614
|
class: 'code-workspace-breadcrumb',
|
|
623
615
|
items,
|
|
624
616
|
label: 'File path',
|
|
625
|
-
onnavigate: (item) => locate(item.href.slice(1)),
|
|
617
|
+
onnavigate: (item) => locate(item.href.slice(1), path),
|
|
626
618
|
separator: 'chevron'
|
|
627
619
|
});
|
|
628
620
|
}
|
|
@@ -663,23 +655,194 @@ const workspace = ({
|
|
|
663
655
|
}
|
|
664
656
|
}
|
|
665
657
|
|
|
658
|
+
// Opens the explorer, if it is closed, to show something in it.
|
|
659
|
+
function explore() {
|
|
660
|
+
if (!model.state.preferences.explorerOpen) {
|
|
661
|
+
model.setPreferences({ explorerOpen: true });
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// The explorer's whole body: its controls, the search and the tree, in the layout's static sidebar.
|
|
666
|
+
function explorer() {
|
|
667
|
+
return html`
|
|
668
|
+
<div class='code-workspace-explorer'>
|
|
669
|
+
<div class='code-workspace-explorer-header'>
|
|
670
|
+
${control({
|
|
671
|
+
direction: () => (view.left ? '' : 'icon--left'),
|
|
672
|
+
label: () => (view.left ? 'Move file explorer to right' : 'Move file explorer to left'),
|
|
673
|
+
onclick: () => api.toggleExplorerSide(),
|
|
674
|
+
sprite: arrow
|
|
675
|
+
})}
|
|
676
|
+
${control({ label: 'Collapse all folders', onclick: () => api.collapseAll(), sprite: collapse })}
|
|
677
|
+
${control({
|
|
678
|
+
disabled: () => !view.canUndo || view.busy,
|
|
679
|
+
label: 'Undo file operation',
|
|
680
|
+
onclick: () => {
|
|
681
|
+
void model.undoFiles();
|
|
682
|
+
},
|
|
683
|
+
sprite: undo
|
|
684
|
+
})}
|
|
685
|
+
${control({ label: label('Go to file', ['Mod', 'P']), onclick: () => quickOpen(), sprite: magnifier })}
|
|
686
|
+
${input({
|
|
687
|
+
'aria-label': 'Search files',
|
|
688
|
+
autocomplete: 'off',
|
|
689
|
+
class: 'code-workspace-search',
|
|
690
|
+
onconnect: (element: HTMLInputElement) => {
|
|
691
|
+
searchField = element;
|
|
692
|
+
},
|
|
693
|
+
oninput: (event: Event) => search((event.target as HTMLInputElement).value),
|
|
694
|
+
placeholder: 'Search files',
|
|
695
|
+
spellcheck: false,
|
|
696
|
+
type: 'search',
|
|
697
|
+
value: () => ui.search
|
|
698
|
+
})}
|
|
699
|
+
</div>
|
|
700
|
+
<div class='code-workspace-tree'>
|
|
701
|
+
${() => hosting.ready() && untrack(() => fileTree({
|
|
702
|
+
class: 'code-workspace-files',
|
|
703
|
+
compact: true,
|
|
704
|
+
controller: (value) => {
|
|
705
|
+
tree = value;
|
|
706
|
+
value.search(ui.search);
|
|
707
|
+
},
|
|
708
|
+
decorations: [hosting.marks, ...[provided ?? []].flat(), decorations],
|
|
709
|
+
editor: treeEditor,
|
|
710
|
+
elements: treeStore,
|
|
711
|
+
empty: () => html`<div class='code-workspace-notice'>No files in this workspace</div>`,
|
|
712
|
+
export: hosting.export,
|
|
713
|
+
find: 'filter',
|
|
714
|
+
menu: (elements, position) => {
|
|
715
|
+
if (!elements.length || !actions) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
write(target, { element: elements[0], paths: elements.map((element) => element.id) });
|
|
720
|
+
// Items hide by the target; the menu focuses its first visible one as it opens.
|
|
721
|
+
flush();
|
|
722
|
+
// The tree claims the right click; the context menu opens at the point it reports.
|
|
723
|
+
actions.open(position);
|
|
724
|
+
},
|
|
725
|
+
open: (element, open) => {
|
|
726
|
+
void model.open(element.id, undefined, undefined, open.mode === 'preview');
|
|
727
|
+
},
|
|
728
|
+
operations: {
|
|
729
|
+
delete: (elements) => {
|
|
730
|
+
void model.delete(elements.map((element) => element.id));
|
|
731
|
+
},
|
|
732
|
+
import: hosting.import
|
|
733
|
+
},
|
|
734
|
+
preview: 'immediate',
|
|
735
|
+
rename: async (element, value) => {
|
|
736
|
+
let parent = element.id.includes('/') ? element.id.slice(0, element.id.lastIndexOf('/') + 1) : '';
|
|
737
|
+
|
|
738
|
+
if (!(await model.rename(element.id, parent + value))) {
|
|
739
|
+
throw new Error(`Workspace: ${model.state.status}`);
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
searched: (query) => {
|
|
743
|
+
ui.search = query;
|
|
744
|
+
},
|
|
745
|
+
snapshot: hosting.explorer,
|
|
746
|
+
state: treeState,
|
|
747
|
+
typing: 'typeahead'
|
|
748
|
+
}))}
|
|
749
|
+
${() => {
|
|
750
|
+
if (view.error) {
|
|
751
|
+
return html`
|
|
752
|
+
<div class='code-workspace-notice code-workspace-notice--cover' role='alert'>
|
|
753
|
+
${view.error}
|
|
754
|
+
<button
|
|
755
|
+
class='button code-workspace-retry'
|
|
756
|
+
type='button'
|
|
757
|
+
onclick='${() => {
|
|
758
|
+
void model.refresh();
|
|
759
|
+
}}'
|
|
760
|
+
>
|
|
761
|
+
Retry
|
|
762
|
+
</button>
|
|
763
|
+
</div>
|
|
764
|
+
`;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return !view.loaded && html`<div class='code-workspace-notice code-workspace-notice--cover' role='status'>Loading…</div>`;
|
|
768
|
+
}}
|
|
769
|
+
</div>
|
|
770
|
+
</div>
|
|
771
|
+
`;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// A file's pane: its path and controls over its editor, which mounts while the tab shows in its group.
|
|
775
|
+
function file(surface: Surface) {
|
|
776
|
+
let tab = model.find(surface.id);
|
|
777
|
+
|
|
778
|
+
if (!tab) {
|
|
779
|
+
return '';
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
let again = signal(0),
|
|
783
|
+
owner = tab,
|
|
784
|
+
visible = computed(() => findSurfaceGroup(model.layout.layout.root, surface.id)?.active === surface.id);
|
|
785
|
+
|
|
786
|
+
remounts.set(owner, () => write(again, untrack(() => read(again)) + 1));
|
|
787
|
+
onCleanup(() => remounts.delete(owner));
|
|
788
|
+
|
|
789
|
+
return html`
|
|
790
|
+
<div class='code-workspace-pane'>
|
|
791
|
+
<div class='code-workspace-bar'>
|
|
792
|
+
${() => crumbs(owner)}
|
|
793
|
+
<div class='code-workspace-actions'>
|
|
794
|
+
${statusBar.save(() => control({
|
|
795
|
+
disabled: () => !!owner.compare || view.busy,
|
|
796
|
+
label: label('Save file', ['Mod', 'S']),
|
|
797
|
+
onclick: () => {
|
|
798
|
+
void model.save(owner);
|
|
799
|
+
},
|
|
800
|
+
sprite: save
|
|
801
|
+
}))}
|
|
802
|
+
${control({
|
|
803
|
+
active: () => view.wrap,
|
|
804
|
+
label: () => (view.wrap ? 'Disable wrap' : 'Wrap long lines'),
|
|
805
|
+
onclick: () => api.toggleWrap(),
|
|
806
|
+
sprite: wrap
|
|
807
|
+
})}
|
|
808
|
+
${control({
|
|
809
|
+
active: () => view.whitespace,
|
|
810
|
+
label: () => (view.whitespace ? 'Hide whitespace' : 'Show whitespace'),
|
|
811
|
+
onclick: () => api.toggleWhitespace(),
|
|
812
|
+
sprite: whitespace
|
|
813
|
+
})}
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
<div class='code-workspace-editor'>
|
|
817
|
+
${() => {
|
|
818
|
+
read(again);
|
|
819
|
+
|
|
820
|
+
return read(visible) && pane(owner);
|
|
821
|
+
}}
|
|
822
|
+
</div>
|
|
823
|
+
</div>
|
|
824
|
+
`;
|
|
825
|
+
}
|
|
826
|
+
|
|
666
827
|
// The active tab's editor may still be mounting; it takes focus as soon as its controller arrives.
|
|
667
828
|
function focusEditor() {
|
|
668
|
-
let tab =
|
|
829
|
+
let tab = untrack(() => read(active));
|
|
669
830
|
|
|
670
|
-
focusing =
|
|
831
|
+
focusing = undefined;
|
|
671
832
|
|
|
672
833
|
if (!tab) {
|
|
673
834
|
searchField?.focus();
|
|
674
835
|
return;
|
|
675
836
|
}
|
|
676
837
|
|
|
677
|
-
|
|
678
|
-
|
|
838
|
+
let controller = mounts.get(tab)?.controller;
|
|
839
|
+
|
|
840
|
+
if (controller) {
|
|
841
|
+
controller.focus();
|
|
679
842
|
return;
|
|
680
843
|
}
|
|
681
844
|
|
|
682
|
-
focusing =
|
|
845
|
+
focusing = tab;
|
|
683
846
|
}
|
|
684
847
|
|
|
685
848
|
function keydown(event: KeyboardEvent) {
|
|
@@ -714,23 +877,18 @@ const workspace = ({
|
|
|
714
877
|
event.preventDefault();
|
|
715
878
|
void model.undoFiles();
|
|
716
879
|
}
|
|
717
|
-
else if (key === 'escape' && ui.peek) {
|
|
718
|
-
event.preventDefault();
|
|
719
|
-
peek(false);
|
|
720
|
-
focusEditor();
|
|
721
|
-
}
|
|
722
880
|
}
|
|
723
881
|
|
|
724
882
|
// A breadcrumb leads back into the explorer: the project collapses the tree, a folder is revealed in it.
|
|
725
|
-
function locate(path: string) {
|
|
726
|
-
|
|
883
|
+
function locate(path: string, from: string) {
|
|
884
|
+
explore();
|
|
727
885
|
|
|
728
886
|
if (!path) {
|
|
729
887
|
tree?.collapseAll();
|
|
730
888
|
return;
|
|
731
889
|
}
|
|
732
890
|
|
|
733
|
-
if (path !==
|
|
891
|
+
if (path !== from) {
|
|
734
892
|
treeState.selected = path;
|
|
735
893
|
}
|
|
736
894
|
}
|
|
@@ -740,26 +898,8 @@ const workspace = ({
|
|
|
740
898
|
keyboard.active = true;
|
|
741
899
|
}
|
|
742
900
|
|
|
743
|
-
function pane() {
|
|
744
|
-
let
|
|
745
|
-
|
|
746
|
-
if (!next) {
|
|
747
|
-
return html`
|
|
748
|
-
<div class='code-workspace-empty'>
|
|
749
|
-
Open a file from the explorer or press
|
|
750
|
-
<span class='code-workspace-keys'>
|
|
751
|
-
${keys(['Mod', 'P']).map((key) => html`
|
|
752
|
-
<kbd class='button button--kbd'>
|
|
753
|
-
${key === '⌘' ? icon({ 'aria-hidden': 'true', class: 'button-kbd-icon' }, cmd) : key}
|
|
754
|
-
</kbd>
|
|
755
|
-
`)}
|
|
756
|
-
</span>
|
|
757
|
-
</div>
|
|
758
|
-
`;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
// A render that runs again has released the mount it made; the tab gets a fresh one.
|
|
762
|
-
let current: Mount = next.released ? { editor: next.editor, path: signal(next.tab.path), released: false, tab: next.tab } : next,
|
|
901
|
+
function pane(tab: WorkspaceTab) {
|
|
902
|
+
let current: Mount = { editor: strip.editor(tab) ?? editorFor?.(tab) ?? codeEditor, path: signal(tab.path), released: false, tab },
|
|
763
903
|
bound: WorkspaceEditorAttributes = {
|
|
764
904
|
class: 'code-workspace-document',
|
|
765
905
|
controller: (controller) => {
|
|
@@ -770,10 +910,14 @@ const workspace = ({
|
|
|
770
910
|
current.controller = controller;
|
|
771
911
|
restore(current);
|
|
772
912
|
attach(current);
|
|
773
|
-
reveal();
|
|
774
913
|
|
|
775
|
-
if (
|
|
776
|
-
|
|
914
|
+
if (untrack(() => read(active)) === tab) {
|
|
915
|
+
statusBar.attach(controller);
|
|
916
|
+
reveal();
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (focusing === tab) {
|
|
920
|
+
focusing = undefined;
|
|
777
921
|
// The controller can arrive mid-render; focusing may flush, which would render the pane again.
|
|
778
922
|
queueMicrotask(() => {
|
|
779
923
|
if (!current.released) {
|
|
@@ -782,36 +926,28 @@ const workspace = ({
|
|
|
782
926
|
});
|
|
783
927
|
}
|
|
784
928
|
},
|
|
785
|
-
document:
|
|
929
|
+
document: tab.document,
|
|
786
930
|
onSave: () => {
|
|
787
|
-
void model.save(
|
|
931
|
+
void model.save(tab);
|
|
788
932
|
},
|
|
789
|
-
options: () => settings(
|
|
933
|
+
options: () => settings(tab, read(current.path))
|
|
790
934
|
};
|
|
791
935
|
|
|
792
|
-
|
|
936
|
+
mounts.set(tab, current);
|
|
793
937
|
onCleanup(() => unmount(current));
|
|
794
938
|
|
|
795
|
-
|
|
796
|
-
|
|
939
|
+
// A rename keeps the tab and its editor; addons restart for the new path.
|
|
940
|
+
effect(() => {
|
|
941
|
+
let path = tab.path;
|
|
797
942
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
ui.peek = false;
|
|
805
|
-
ui.ready = false;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
ui.peek = true;
|
|
943
|
+
untrack(() => {
|
|
944
|
+
if (current.controller && read(current.path) !== path) {
|
|
945
|
+
attach(current);
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
});
|
|
810
949
|
|
|
811
|
-
|
|
812
|
-
if (keyboard || container?.ownerDocument.defaultView?.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
813
|
-
ui.ready = true;
|
|
814
|
-
}
|
|
950
|
+
return untrack(() => current.editor(bound));
|
|
815
951
|
}
|
|
816
952
|
|
|
817
953
|
function quickOpen(query = '') {
|
|
@@ -827,13 +963,6 @@ const workspace = ({
|
|
|
827
963
|
palette.query = query;
|
|
828
964
|
}
|
|
829
965
|
|
|
830
|
-
// The edge leaves once the drawer is open, so keyboard focus moves on into the explorer instead of being dropped.
|
|
831
|
-
function reach() {
|
|
832
|
-
peek(true, true);
|
|
833
|
-
flush();
|
|
834
|
-
searchField?.focus();
|
|
835
|
-
}
|
|
836
|
-
|
|
837
966
|
function results(groups: ResultGroup[]) {
|
|
838
967
|
return nav.tree({
|
|
839
968
|
current: 'command',
|
|
@@ -843,7 +972,7 @@ const workspace = ({
|
|
|
843
972
|
attributes: item.attributes,
|
|
844
973
|
content: html`
|
|
845
974
|
${item.command?.icon
|
|
846
|
-
?
|
|
975
|
+
? glyph(item.command.icon)
|
|
847
976
|
: fileTreeIcon({ name: name(item.id), type: 'file' }, false)}
|
|
848
977
|
${item.content}
|
|
849
978
|
`,
|
|
@@ -852,7 +981,7 @@ const workspace = ({
|
|
|
852
981
|
}],
|
|
853
982
|
label: group.label
|
|
854
983
|
})),
|
|
855
|
-
[nav.tree.highlight]:
|
|
984
|
+
[nav.tree.highlight]: true
|
|
856
985
|
});
|
|
857
986
|
}
|
|
858
987
|
|
|
@@ -864,15 +993,6 @@ const workspace = ({
|
|
|
864
993
|
hosting.remember(current.tab, current.controller!);
|
|
865
994
|
}
|
|
866
995
|
|
|
867
|
-
// A merge starting or ending on the shown tab swaps what the pane shows for it.
|
|
868
|
-
function remount() {
|
|
869
|
-
if (mount) {
|
|
870
|
-
unmount(mount);
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
show(model.state.active);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
996
|
function restore(current: Mount) {
|
|
877
997
|
hosting.shown(current.tab, current.controller!);
|
|
878
998
|
|
|
@@ -894,23 +1014,12 @@ const workspace = ({
|
|
|
894
1014
|
}
|
|
895
1015
|
}
|
|
896
1016
|
|
|
897
|
-
// Moves the mounted editor on to another tab's document, which costs far less than mounting it again.
|
|
898
|
-
function retarget(current: Mount, tab: WorkspaceTab) {
|
|
899
|
-
remember(current);
|
|
900
|
-
detach(current);
|
|
901
|
-
current.tab = tab;
|
|
902
|
-
current.controller!.setDocument!(tab.document, settings(tab, tab.path));
|
|
903
|
-
restore(current);
|
|
904
|
-
attach(current);
|
|
905
|
-
reveal();
|
|
906
|
-
}
|
|
907
|
-
|
|
908
1017
|
function reveal() {
|
|
909
|
-
let
|
|
910
|
-
|
|
911
|
-
next = state.reveal;
|
|
1018
|
+
let tab = read(active),
|
|
1019
|
+
controller = tab && mounts.get(tab)?.controller,
|
|
1020
|
+
next = model.state.reveal;
|
|
912
1021
|
|
|
913
|
-
if (!
|
|
1022
|
+
if (!tab || !controller || !next || next.request === revealed || controller.document !== tab.document || tab.id !== next.tabId) {
|
|
914
1023
|
return;
|
|
915
1024
|
}
|
|
916
1025
|
|
|
@@ -955,116 +1064,8 @@ const workspace = ({
|
|
|
955
1064
|
};
|
|
956
1065
|
}
|
|
957
1066
|
|
|
958
|
-
// Puts the tab in the editor pane: the mounted editor moves on to it when it can, or one is mounted for it.
|
|
959
|
-
function show(tab: WorkspaceTab | undefined) {
|
|
960
|
-
if (mount?.tab === tab) {
|
|
961
|
-
return;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
let editor = tab && (strip.editor(tab) ?? editorFor?.(tab) ?? codeEditor);
|
|
965
|
-
|
|
966
|
-
if (tab && mount?.controller?.setDocument && mount.editor === editor) {
|
|
967
|
-
retarget(mount, tab);
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
if (mount) {
|
|
972
|
-
unmount(mount);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
mount = tab && editor && { editor, path: signal(tab.path), released: false, tab };
|
|
976
|
-
write(shown, mount);
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
// A rename, pin or draft updates its own tab in place; only opening, closing or reordering tabs renders the strip.
|
|
980
|
-
function tab(entry: WorkspaceTab) {
|
|
981
|
-
let chosen = () => signal.selector(activeId, entry.id),
|
|
982
|
-
file = () => strip.label(entry);
|
|
983
|
-
|
|
984
|
-
return html`
|
|
985
|
-
<div
|
|
986
|
-
aria-controls='${id}-panel'
|
|
987
|
-
class='button code-workspace-tab'
|
|
988
|
-
id='${id}-tab-${entry.id}'
|
|
989
|
-
role='tab'
|
|
990
|
-
${{
|
|
991
|
-
'aria-selected': () => (chosen() ? 'true' : 'false'),
|
|
992
|
-
class: () => chosen() && '--active',
|
|
993
|
-
onauxclick: (event: MouseEvent) => {
|
|
994
|
-
if (event.button === 1) {
|
|
995
|
-
event.preventDefault();
|
|
996
|
-
void model.close(entry.path);
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
onclick: () => {
|
|
1000
|
-
model.activate(entry);
|
|
1001
|
-
focusEditor();
|
|
1002
|
-
},
|
|
1003
|
-
onconnect: (element: HTMLElement) => {
|
|
1004
|
-
elements.set(entry, element);
|
|
1005
|
-
},
|
|
1006
|
-
onkeydown: (event: KeyboardEvent) => {
|
|
1007
|
-
let list = untrack(() => model.state.tabs),
|
|
1008
|
-
at = list.indexOf(entry),
|
|
1009
|
-
next: WorkspaceTab | undefined;
|
|
1010
|
-
|
|
1011
|
-
if (event.key === 'ArrowRight') {
|
|
1012
|
-
next = list[(at + 1) % list.length];
|
|
1013
|
-
}
|
|
1014
|
-
else if (event.key === 'ArrowLeft') {
|
|
1015
|
-
next = list[(at - 1 + list.length) % list.length];
|
|
1016
|
-
}
|
|
1017
|
-
else if (event.key === 'Home') {
|
|
1018
|
-
next = list[0];
|
|
1019
|
-
}
|
|
1020
|
-
else if (event.key === 'End') {
|
|
1021
|
-
next = list.at(-1);
|
|
1022
|
-
}
|
|
1023
|
-
else if (event.key === 'Enter' || event.key === ' ') {
|
|
1024
|
-
event.preventDefault();
|
|
1025
|
-
model.activate(entry);
|
|
1026
|
-
focusEditor();
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
if (next) {
|
|
1031
|
-
event.preventDefault();
|
|
1032
|
-
model.activate(next);
|
|
1033
|
-
elements.get(next)?.focus();
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
tabindex: () => (chosen() ? 0 : -1),
|
|
1037
|
-
title: () => strip.title(entry)
|
|
1038
|
-
}}
|
|
1039
|
-
${strip.attributes(entry)}
|
|
1040
|
-
>
|
|
1041
|
-
${() => fileTreeIcon({ name: file(), type: 'file' }, false)}
|
|
1042
|
-
<span class='code-workspace-tab-name'>${file}</span>
|
|
1043
|
-
${() => strip.pin(entry)}
|
|
1044
|
-
${() => entry.dirty && html`<span aria-label='Unsaved changes' class='code-workspace-tab-dirty' role='img'></span>`}
|
|
1045
|
-
<button
|
|
1046
|
-
class='button code-workspace-tab-close'
|
|
1047
|
-
tabindex='-1'
|
|
1048
|
-
title='${label('Close', ['Mod', 'W'])}'
|
|
1049
|
-
type='button'
|
|
1050
|
-
${{
|
|
1051
|
-
'aria-label': () => `Close ${file()}`,
|
|
1052
|
-
onclick: (event: Event) => {
|
|
1053
|
-
event.stopPropagation();
|
|
1054
|
-
void model.close(entry.path);
|
|
1055
|
-
}
|
|
1056
|
-
}}
|
|
1057
|
-
>
|
|
1058
|
-
${icon({ 'aria-hidden': 'true', class: 'code-workspace-tab-close-icon' }, close)}
|
|
1059
|
-
</button>
|
|
1060
|
-
</div>
|
|
1061
|
-
`;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
1067
|
function toggle(key: 'explorerOpen' | 'showWhitespace' | 'wrapText') {
|
|
1065
1068
|
model.setPreferences({ [key]: !model.state.preferences[key] });
|
|
1066
|
-
ui.peek = false;
|
|
1067
|
-
ui.ready = false;
|
|
1068
1069
|
}
|
|
1069
1070
|
|
|
1070
1071
|
function unmount(current: Mount) {
|
|
@@ -1076,9 +1077,12 @@ const workspace = ({
|
|
|
1076
1077
|
|
|
1077
1078
|
current.released = true;
|
|
1078
1079
|
|
|
1079
|
-
if (
|
|
1080
|
-
|
|
1081
|
-
|
|
1080
|
+
if (mounts.get(current.tab) === current) {
|
|
1081
|
+
mounts.delete(current.tab);
|
|
1082
|
+
|
|
1083
|
+
if (untrack(() => read(active)) === current.tab) {
|
|
1084
|
+
statusBar.attach(undefined);
|
|
1085
|
+
}
|
|
1082
1086
|
}
|
|
1083
1087
|
|
|
1084
1088
|
if (controller?.host.isConnected) {
|
|
@@ -1098,7 +1102,9 @@ const workspace = ({
|
|
|
1098
1102
|
model.dispose();
|
|
1099
1103
|
},
|
|
1100
1104
|
get editor() {
|
|
1101
|
-
|
|
1105
|
+
let tab = untrack(() => read(active));
|
|
1106
|
+
|
|
1107
|
+
return tab && mounts.get(tab)?.controller;
|
|
1102
1108
|
},
|
|
1103
1109
|
focus: focusEditor,
|
|
1104
1110
|
keybindings: openKeybindings,
|
|
@@ -1113,8 +1119,6 @@ const workspace = ({
|
|
|
1113
1119
|
toggleExplorer: () => toggle('explorerOpen'),
|
|
1114
1120
|
toggleExplorerSide: () => {
|
|
1115
1121
|
model.setPreferences({ explorerSide: view.left ? 'right' : 'left' });
|
|
1116
|
-
ui.peek = false;
|
|
1117
|
-
ui.ready = false;
|
|
1118
1122
|
},
|
|
1119
1123
|
toggleWhitespace: () => toggle('showWhitespace'),
|
|
1120
1124
|
toggleWrap: () => toggle('wrapText'),
|
|
@@ -1163,6 +1167,30 @@ const workspace = ({
|
|
|
1163
1167
|
paths = () => read(target)?.paths ?? [],
|
|
1164
1168
|
single = () => paths().length === 1;
|
|
1165
1169
|
|
|
1170
|
+
let catalog: Catalog = {
|
|
1171
|
+
explorer: { addable: false, render: explorer, title: 'File explorer' },
|
|
1172
|
+
file: {
|
|
1173
|
+
addable: false,
|
|
1174
|
+
menu: strip.menu,
|
|
1175
|
+
render: file,
|
|
1176
|
+
tab: (surface) => {
|
|
1177
|
+
let tab = model.find(surface.id);
|
|
1178
|
+
|
|
1179
|
+
return tab ? strip.tab(tab) : {};
|
|
1180
|
+
},
|
|
1181
|
+
title: (surface) => {
|
|
1182
|
+
let tab = model.find(surface.id);
|
|
1183
|
+
|
|
1184
|
+
return tab ? strip.label(tab) : '';
|
|
1185
|
+
},
|
|
1186
|
+
tooltip: (surface) => {
|
|
1187
|
+
let tab = model.find(surface.id);
|
|
1188
|
+
|
|
1189
|
+
return tab ? strip.title(tab) : '';
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1166
1194
|
receive?.(api);
|
|
1167
1195
|
|
|
1168
1196
|
return html`
|
|
@@ -1176,194 +1204,32 @@ const workspace = ({
|
|
|
1176
1204
|
// A page-wide palette on Mod+K, like the site search, leaves the chord to a focused element that
|
|
1177
1205
|
// declares it.
|
|
1178
1206
|
'aria-keyshortcuts': declare(attributes['aria-keyshortcuts'] as string | undefined, OPEN[0]),
|
|
1179
|
-
class: [
|
|
1180
|
-
() => view.collapsed && 'code-workspace--collapsed',
|
|
1181
|
-
() => view.left && 'code-workspace--left',
|
|
1182
|
-
() => ui.peek && 'code-workspace--peek',
|
|
1183
|
-
// A narrow workspace stacks an open explorer under the editor; a hidden one still peeks from the edge.
|
|
1184
|
-
() => ui.compact && view.tabs && view.explorerOpen && 'code-workspace--stacked',
|
|
1185
|
-
() => view.tabs && 'code-workspace--tabs'
|
|
1186
|
-
],
|
|
1187
1207
|
onconnect: connect,
|
|
1188
1208
|
ondocumentkeydown: keydown
|
|
1189
1209
|
}}
|
|
1190
1210
|
>
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
class
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
ui.ready = ui.peek;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
}}
|
|
1208
|
-
>
|
|
1209
|
-
<div class='code-workspace-explorer-content' ${{ inert: () => view.collapsed && !ui.ready }}>
|
|
1210
|
-
<div class='code-workspace-explorer-header'>
|
|
1211
|
-
${control({
|
|
1212
|
-
label: () => (view.left ? 'Move file explorer to right' : 'Move file explorer to left'),
|
|
1213
|
-
onclick: api.toggleExplorerSide,
|
|
1214
|
-
sprite: () => (view.left ? right : left)
|
|
1215
|
-
})}
|
|
1216
|
-
${control({ label: 'Collapse all folders', onclick: api.collapseAll, sprite: collapse })}
|
|
1217
|
-
${control({
|
|
1218
|
-
disabled: () => !view.canUndo || view.busy,
|
|
1219
|
-
label: 'Undo file operation',
|
|
1220
|
-
onclick: () => {
|
|
1221
|
-
void model.undoFiles();
|
|
1222
|
-
},
|
|
1223
|
-
sprite: undo
|
|
1224
|
-
})}
|
|
1225
|
-
${control({ label: label('Go to file', ['Mod', 'P']), onclick: () => quickOpen(), sprite: magnifier })}
|
|
1226
|
-
${input({
|
|
1227
|
-
'aria-label': 'Search files',
|
|
1228
|
-
autocomplete: 'off',
|
|
1229
|
-
class: 'code-workspace-search',
|
|
1230
|
-
onconnect: (element: HTMLInputElement) => {
|
|
1231
|
-
searchField = element;
|
|
1232
|
-
},
|
|
1233
|
-
oninput: (event: Event) => search((event.target as HTMLInputElement).value),
|
|
1234
|
-
placeholder: 'Search files',
|
|
1235
|
-
spellcheck: false,
|
|
1236
|
-
type: 'search',
|
|
1237
|
-
value: () => ui.search
|
|
1238
|
-
})}
|
|
1239
|
-
</div>
|
|
1240
|
-
<div class='code-workspace-tree'>
|
|
1241
|
-
${() => hosting.ready() && untrack(() => fileTree({
|
|
1242
|
-
class: 'code-workspace-files',
|
|
1243
|
-
compact: true,
|
|
1244
|
-
controller: (value) => {
|
|
1245
|
-
tree = value;
|
|
1246
|
-
value.search(ui.search);
|
|
1247
|
-
},
|
|
1248
|
-
decorations: [hosting.marks, ...[provided ?? []].flat(), decorations],
|
|
1249
|
-
editor: treeEditor,
|
|
1250
|
-
elements: treeStore,
|
|
1251
|
-
empty: () => html`<div class='code-workspace-notice'>No files in this workspace</div>`,
|
|
1252
|
-
export: hosting.export,
|
|
1253
|
-
find: 'filter',
|
|
1254
|
-
menu: (elements, position) => {
|
|
1255
|
-
if (!elements.length || !actions) {
|
|
1256
|
-
return;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
write(target, { element: elements[0], paths: elements.map((element) => element.id) });
|
|
1260
|
-
// Items hide by the target; the menu focuses its first visible one as it opens.
|
|
1261
|
-
flush();
|
|
1262
|
-
// The tree claims the right click; the context menu opens at the point it reports.
|
|
1263
|
-
actions.open(position);
|
|
1264
|
-
},
|
|
1265
|
-
open: (element, open) => {
|
|
1266
|
-
void model.open(element.id, undefined, undefined, open.mode === 'preview');
|
|
1267
|
-
},
|
|
1268
|
-
operations: {
|
|
1269
|
-
delete: (elements) => {
|
|
1270
|
-
void model.delete(elements.map((element) => element.id));
|
|
1271
|
-
},
|
|
1272
|
-
import: hosting.import
|
|
1273
|
-
},
|
|
1274
|
-
preview: 'immediate',
|
|
1275
|
-
rename: async (element, value) => {
|
|
1276
|
-
let parent = element.id.includes('/') ? element.id.slice(0, element.id.lastIndexOf('/') + 1) : '';
|
|
1277
|
-
|
|
1278
|
-
if (!(await model.rename(element.id, parent + value))) {
|
|
1279
|
-
throw new Error(`Workspace: ${model.state.status}`);
|
|
1280
|
-
}
|
|
1281
|
-
},
|
|
1282
|
-
searched: (query) => {
|
|
1283
|
-
ui.search = query;
|
|
1284
|
-
},
|
|
1285
|
-
snapshot: hosting.explorer,
|
|
1286
|
-
state: treeState,
|
|
1287
|
-
typing: 'typeahead'
|
|
1288
|
-
}))}
|
|
1289
|
-
${() => {
|
|
1290
|
-
if (view.error) {
|
|
1291
|
-
return html`
|
|
1292
|
-
<div class='code-workspace-notice code-workspace-notice--cover' role='alert'>
|
|
1293
|
-
${view.error}
|
|
1294
|
-
<button
|
|
1295
|
-
class='button code-workspace-retry'
|
|
1296
|
-
type='button'
|
|
1297
|
-
onclick='${() => {
|
|
1298
|
-
void model.refresh();
|
|
1299
|
-
}}'
|
|
1300
|
-
>
|
|
1301
|
-
Retry
|
|
1302
|
-
</button>
|
|
1303
|
-
</div>
|
|
1304
|
-
`;
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
return !view.loaded && html`<div class='code-workspace-notice code-workspace-notice--cover' role='status'>Loading…</div>`;
|
|
1308
|
-
}}
|
|
1211
|
+
${shell({
|
|
1212
|
+
catalog,
|
|
1213
|
+
class: 'code-workspace-layout',
|
|
1214
|
+
empty: () => html`
|
|
1215
|
+
<div class='code-workspace-empty'>
|
|
1216
|
+
Open a file from the explorer or press
|
|
1217
|
+
<span class='code-workspace-keys'>
|
|
1218
|
+
${keys(['Mod', 'P']).map((key) => html`
|
|
1219
|
+
<kbd class='button button--kbd'>
|
|
1220
|
+
${key === '⌘' ? icon({ 'aria-hidden': 'true', class: 'button-kbd-icon' }, cmd) : key}
|
|
1221
|
+
</kbd>
|
|
1222
|
+
`)}
|
|
1223
|
+
</span>
|
|
1309
1224
|
</div>
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
`}
|
|
1319
|
-
</aside>
|
|
1320
|
-
<main class='code-workspace-main' ${{ onpointerenter: () => peek(false) }}>
|
|
1321
|
-
<div aria-label='Open files' class='code-workspace-tabs' role='tablist' ${scrollbar()}>
|
|
1322
|
-
${highlight({ border: 'bottom', class: 'code-workspace-tabs-highlight' })}
|
|
1323
|
-
${() => model.state.tabs.map(tab)}
|
|
1324
|
-
</div>
|
|
1325
|
-
<div class='code-workspace-bar'>
|
|
1326
|
-
${crumbs}
|
|
1327
|
-
<div class='code-workspace-actions'>
|
|
1328
|
-
${statusBar.save(() => control({
|
|
1329
|
-
disabled: () => !view.tabs || view.busy,
|
|
1330
|
-
label: label('Save file', ['Mod', 'S']),
|
|
1331
|
-
onclick: () => {
|
|
1332
|
-
void model.save();
|
|
1333
|
-
},
|
|
1334
|
-
sprite: save
|
|
1335
|
-
}))}
|
|
1336
|
-
${control({
|
|
1337
|
-
active: () => view.wrap,
|
|
1338
|
-
label: () => (view.wrap ? 'Disable wrap' : 'Wrap long lines'),
|
|
1339
|
-
onclick: api.toggleWrap,
|
|
1340
|
-
sprite: wrap
|
|
1341
|
-
})}
|
|
1342
|
-
${control({
|
|
1343
|
-
active: () => view.whitespace,
|
|
1344
|
-
label: () => (view.whitespace ? 'Hide whitespace' : 'Show whitespace'),
|
|
1345
|
-
onclick: api.toggleWhitespace,
|
|
1346
|
-
sprite: whitespace
|
|
1347
|
-
})}
|
|
1348
|
-
${sidebar({
|
|
1349
|
-
'aria-label': () => (view.explorerOpen ? 'Hide file explorer' : 'Show file explorer'),
|
|
1350
|
-
class: 'code-workspace-control',
|
|
1351
|
-
onclick: api.toggleExplorer,
|
|
1352
|
-
open: () => view.explorerOpen,
|
|
1353
|
-
side: () => (view.left ? 'left' : 'right'),
|
|
1354
|
-
title: () => (view.explorerOpen ? 'Hide file explorer' : 'Show file explorer')
|
|
1355
|
-
})}
|
|
1356
|
-
</div>
|
|
1357
|
-
</div>
|
|
1358
|
-
<div
|
|
1359
|
-
class='code-workspace-editor'
|
|
1360
|
-
id='${id}-panel'
|
|
1361
|
-
role='tabpanel'
|
|
1362
|
-
${{ 'aria-labelledby': () => (read(activeId) ? `${id}-tab-${read(activeId)}` : undefined) }}
|
|
1363
|
-
>
|
|
1364
|
-
${pane}
|
|
1365
|
-
</div>
|
|
1366
|
-
</main>
|
|
1225
|
+
`,
|
|
1226
|
+
narrow: NARROW,
|
|
1227
|
+
sidebars: {
|
|
1228
|
+
left: { hover: true, label: 'File explorer', resizable: true },
|
|
1229
|
+
right: { hover: true, label: 'File explorer', resizable: true }
|
|
1230
|
+
},
|
|
1231
|
+
state: model.layout
|
|
1232
|
+
})}
|
|
1367
1233
|
<footer class='code-workspace-status'>
|
|
1368
1234
|
<span class='code-workspace-status-path'>${() => view.cwd}</span>
|
|
1369
1235
|
<span class='code-workspace-status-position'>${() => ui.position}</span>
|
|
@@ -1398,7 +1264,6 @@ const workspace = ({
|
|
|
1398
1264
|
''
|
|
1399
1265
|
)}
|
|
1400
1266
|
${statusBar.menu}
|
|
1401
|
-
${strip.menu()}
|
|
1402
1267
|
</div>
|
|
1403
1268
|
${command({
|
|
1404
1269
|
commands: () => [PALETTE, ...read(files).map((path): Command => ({ group: 'Files', id: path, label: path }))],
|