@esportsplus/ui 0.63.0 → 0.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.audit/audit.json +2 -2
- package/.audit/rules-audit.md +2 -2
- package/README.md +15 -18
- package/RULES.md +80 -9
- package/bin/agent-cli +300 -0
- package/build/components/accordion/index.d.ts +4 -0
- package/build/components/accordion/index.js +13 -10
- package/build/components/breadcrumb/index.d.ts +1 -0
- package/build/components/breadcrumb/index.js +43 -37
- package/build/components/breadcrumb/scss/index.scss +1 -1
- package/build/components/button/kbd.d.ts +1 -1
- package/build/components/button/kbd.js +17 -15
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/button/split.js +14 -16
- package/build/components/capslock/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/chat/minimap/index.js +4 -5
- package/build/components/checkbox/group.d.ts +1 -0
- package/build/components/checkbox/group.js +21 -20
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/color-picker/index.js +6 -6
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/index.d.ts +1 -1
- package/build/components/command/palette.d.ts +13 -9
- package/build/components/command/palette.js +143 -152
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/command/search.d.ts +5 -7
- package/build/components/command/search.js +6 -26
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/editor/code/commands.js +1 -1
- package/build/components/editor/code/document.d.ts +1 -3
- package/build/components/editor/code/document.js +1 -1
- package/build/components/editor/code/editor.d.ts +18 -6
- package/build/components/editor/code/editor.js +9 -7
- package/build/components/editor/code/features.js +27 -18
- package/build/components/editor/code/find.d.ts +1 -1
- package/build/components/editor/code/find.js +5 -6
- package/build/components/editor/code/folding.d.ts +3 -5
- package/build/components/editor/code/folding.js +2 -15
- package/build/components/editor/code/gutter.js +2 -2
- package/build/components/editor/code/index.d.ts +1 -0
- package/build/components/editor/code/index.js +1 -0
- package/build/components/editor/code/minimap.d.ts +3 -1
- package/build/components/editor/code/minimap.js +31 -5
- package/build/components/editor/code/services/model.js +2 -1
- package/build/components/editor/code/syntax.js +2 -1
- package/build/components/editor/code/view.d.ts +8 -2
- package/build/components/editor/code/view.js +37 -56
- package/build/components/editor/diffs/index.d.ts +1 -0
- package/build/components/editor/diffs/index.js +1 -0
- package/build/components/editor/diffs/merge.js +16 -17
- package/build/components/editor/diffs/view.js +10 -11
- package/build/components/editor/markdown/editing.d.ts +2 -1
- package/build/components/editor/markdown/editing.js +14 -5
- package/build/components/editor/markdown/format.d.ts +1 -1
- package/build/components/editor/markdown/format.js +116 -26
- package/build/components/editor/markdown/layout.js +2 -1
- package/build/components/editor/markdown/model.d.ts +1 -2
- package/build/components/editor/markdown/model.js +1 -29
- package/build/components/editor/markdown/render.js +1 -1
- package/build/components/editor/markdown/template.d.ts +3 -10
- package/build/components/editor/markdown/template.js +2 -29
- package/build/components/editor/markdown/toolbar.d.ts +2 -2
- package/build/components/editor/markdown/toolbar.js +90 -126
- package/build/components/editor/markdown/view.d.ts +1 -1
- package/build/components/editor/markdown/view.js +54 -87
- package/build/components/editor/tree/drag.js +1 -1
- package/build/components/editor/tree/find.js +70 -64
- package/build/components/editor/tree/template.js +8 -7
- package/build/components/editor/viewer/model.d.ts +1 -1
- package/build/components/editor/viewer/template.js +4 -26
- package/build/components/editor/workspace/keybindings.d.ts +1 -1
- package/build/components/editor/workspace/model.d.ts +12 -2
- package/build/components/editor/workspace/model.js +87 -31
- package/build/components/editor/workspace/session.d.ts +2 -6
- package/build/components/editor/workspace/session.js +99 -16
- package/build/components/editor/workspace/status.d.ts +1 -1
- package/build/components/editor/workspace/strip.d.ts +10 -9
- package/build/components/editor/workspace/strip.js +99 -141
- package/build/components/editor/workspace/tabs.d.ts +2 -4
- package/build/components/editor/workspace/tabs.js +1 -14
- package/build/components/editor/workspace/template.d.ts +1 -1
- package/build/components/editor/workspace/template.js +305 -435
- package/build/components/error/index.d.ts +4 -13
- package/build/components/error/index.js +53 -172
- package/build/components/error/scss/index.scss +1 -1
- package/build/components/form/action.d.ts +2 -2
- package/build/components/form/action.js +2 -2
- package/build/components/form/input.d.ts +3 -3
- package/build/components/form/input.js +32 -10
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/group/index.js +96 -9
- package/build/components/group/scss/index.scss +1 -1
- package/build/components/heatmap/scss/index.scss +1 -1
- package/build/components/highlight/index.js +55 -48
- package/build/components/highlight/scss/index.scss +1 -1
- package/build/components/icon/scss/index.scss +1 -1
- package/build/components/image/scss/index.scss +1 -1
- package/build/components/index.d.ts +3 -6
- package/build/components/index.js +3 -6
- package/build/components/inline-edit/index.d.ts +2 -2
- package/build/components/inline-edit/index.js +5 -5
- package/build/components/inline-edit/rich.js +4 -4
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/inline-edit/status.js +1 -0
- package/build/components/input/index.d.ts +4 -0
- package/build/components/input/index.js +3 -1
- package/build/components/input/otp.d.ts +18 -0
- package/build/components/input/otp.js +112 -0
- package/build/components/input/password.d.ts +15 -0
- package/build/components/input/password.js +163 -0
- package/build/components/input/scrub.d.ts +1 -0
- package/build/components/input/scrub.js +103 -89
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/input/tag.d.ts +5 -0
- package/build/components/input/tag.js +116 -69
- package/build/components/json/download.js +1 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/marquee/index.js +1 -1
- package/build/components/marquee/scss/index.scss +1 -1
- package/build/components/nav/scss/index.scss +1 -1
- package/build/components/nav/tree.d.ts +2 -1
- package/build/components/nav/tree.js +6 -5
- package/build/components/notification/index.js +3 -3
- package/build/components/notification/scss/index.scss +1 -1
- package/build/components/overlay/popup.d.ts +2 -2
- package/build/components/overlay/popup.js +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/pagination/arrows.js +2 -3
- package/build/components/pagination/cards.js +2 -3
- package/build/components/pagination/index.d.ts +2 -3
- package/build/components/pagination/index.js +18 -13
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/progress/index.js +1 -1
- package/build/components/progress/scss/index.scss +1 -1
- package/build/components/progress/text.js +3 -3
- package/build/components/range/filter.d.ts +7 -1
- package/build/components/range/filter.js +188 -171
- package/build/components/range/index.d.ts +14 -9
- package/build/components/range/index.js +11 -8
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/range/surface.d.ts +21 -0
- package/build/components/range/surface.js +144 -0
- package/build/components/relative-time/index.js +2 -2
- package/build/components/relative-time/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/{preview/header.d.ts → search/button.d.ts} +3 -3
- package/build/components/search/button.js +18 -0
- package/build/components/search/index.d.ts +8 -0
- package/build/components/search/index.js +5 -0
- package/build/components/search/input.d.ts +9 -0
- package/build/components/search/input.js +23 -0
- package/build/components/search/parts.d.ts +5 -0
- package/build/components/search/parts.js +17 -0
- package/build/components/search/scss/index.scss +2 -0
- package/build/components/select/expand.js +4 -5
- package/build/components/select/index.d.ts +7 -7
- package/build/components/select/index.js +127 -117
- package/build/components/select/placement.js +8 -1
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/{panels → shell}/group.d.ts +21 -5
- package/build/components/shell/group.js +336 -0
- package/build/components/shell/index.d.ts +15 -17
- package/build/components/shell/index.js +583 -238
- package/build/components/shell/model.d.ts +94 -0
- package/build/components/{panels → shell}/model.js +199 -73
- package/build/components/shell/resize.d.ts +5 -0
- package/build/components/{panels → shell}/resize.js +54 -30
- package/build/components/shell/scss/index.scss +1 -1
- package/build/components/shell/sidebar.d.ts +34 -0
- package/build/components/shell/sidebar.js +362 -0
- package/build/components/{panels → shell}/subtree.js +7 -8
- package/build/components/shortcut-recorder/index.d.ts +5 -4
- package/build/components/shortcut-recorder/index.js +69 -44
- package/build/components/shortcut-recorder/scss/index.scss +1 -1
- package/build/components/sortable/index.d.ts +16 -2
- package/build/components/sortable/index.js +237 -134
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/story/index.js +46 -34
- package/build/components/story/scss/index.scss +1 -1
- package/build/components/surface-field/engine.d.ts +2 -0
- package/build/components/surface-field/engine.js +86 -33
- package/build/components/surface-field/index.d.ts +26 -4
- package/build/components/surface-field/index.js +35 -4
- package/build/components/surface-field/scss/index.scss +1 -1
- package/build/components/surface-field/surface.d.ts +13 -1
- package/build/components/surface-field/surface.js +149 -58
- package/build/components/tasklist/index.d.ts +1 -4
- package/build/components/tasklist/index.js +36 -43
- package/build/components/tasklist/scss/index.scss +1 -1
- package/build/components/textarea/index.d.ts +1 -1
- package/build/components/textarea/index.js +14 -14
- package/build/components/theme/scss/index.scss +1 -1
- package/build/components/theme/shared.d.ts +1 -2
- package/build/components/theme/shared.js +2 -5
- package/build/components/toast/index.d.ts +3 -3
- package/build/components/toast/index.js +3 -3
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/toolbar/index.d.ts +91 -0
- package/build/components/toolbar/index.js +1281 -0
- package/build/components/toolbar/scss/index.scss +2 -0
- package/build/components/tooltip/menu.d.ts +9 -8
- package/build/components/tooltip/menu.js +397 -279
- package/build/components/tooltip/onclick.d.ts +2 -0
- package/build/components/tooltip/onclick.js +13 -4
- package/build/components/tooltip/onhover.d.ts +3 -1
- package/build/components/tooltip/onhover.js +10 -9
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/tooltip/shared.d.ts +4 -4
- package/build/components/tooltip/shared.js +27 -46
- package/build/components/tooltip/utilities.d.ts +5 -2
- package/build/components/tooltip/utilities.js +169 -9
- package/build/components/typewriter/rotate.js +6 -6
- package/build/components/typewriter/scss/index.scss +1 -1
- package/build/components/uptime/scss/index.scss +1 -1
- package/build/components/usage-meter/index.js +1 -1
- package/build/components/usage-meter/scss/index.scss +1 -1
- package/build/css-utilities/font/montserrat/OFL.txt +93 -0
- package/build/shared/drag.d.ts +15 -9
- package/build/shared/drag.js +41 -28
- package/build/shared/placement.d.ts +39 -0
- package/build/shared/placement.js +55 -0
- package/build/shared/transition.js +1 -1
- package/build/shared/viewport.d.ts +1 -2
- package/build/shared/viewport.js +1 -4
- package/package.json +2 -5
- package/src/components/accordion/index.ts +12 -5
- package/src/components/announcement/index.ts +1 -1
- package/src/components/breadcrumb/index.ts +13 -3
- package/src/components/breadcrumb/scss/index.scss +6 -6
- package/src/components/breadcrumb/scss/variables.scss +7 -0
- package/src/components/button/kbd.ts +22 -17
- package/src/components/button/scss/index.scss +69 -76
- package/src/components/button/scss/variables.scss +51 -18
- package/src/components/button/split.ts +12 -8
- package/src/components/capslock/index.ts +2 -0
- package/src/components/capslock/scss/index.scss +21 -21
- package/src/components/card/scss/index.scss +16 -0
- package/src/components/card/scss/variables.scss +25 -2
- package/src/components/chat/minimap/index.ts +5 -6
- package/src/components/chat/minimap/scss/index.scss +12 -11
- package/src/components/chat/minimap/scss/variables.scss +23 -17
- package/src/components/checkbox/group.ts +8 -7
- package/src/components/checkbox/scss/index.scss +59 -35
- package/src/components/checkbox/scss/variables.scss +24 -17
- package/src/components/color-picker/index.ts +6 -6
- package/src/components/color-picker/scss/index.scss +35 -22
- package/src/components/color-picker/scss/variables.scss +11 -3
- package/src/components/command/index.ts +1 -1
- package/src/components/command/palette.ts +174 -166
- package/src/components/command/scss/index.scss +18 -51
- package/src/components/command/scss/variables.scss +37 -71
- package/src/components/command/search.ts +9 -31
- package/src/components/counter/index.ts +22 -22
- package/src/components/counter/scss/variables.scss +10 -7
- package/src/components/editor/code/commands.ts +1 -1
- package/src/components/editor/code/document.ts +0 -2
- package/src/components/editor/code/editor.ts +31 -13
- package/src/components/editor/code/features.ts +39 -24
- package/src/components/editor/code/find.ts +5 -6
- package/src/components/editor/code/folding.ts +3 -21
- package/src/components/editor/code/gutter.ts +2 -2
- package/src/components/editor/code/index.ts +1 -0
- package/src/components/editor/code/minimap.ts +39 -5
- package/src/components/editor/code/scss/_editor.scss +28 -21
- package/src/components/editor/code/scss/_features.scss +19 -21
- package/src/components/editor/code/scss/_services.scss +14 -11
- package/src/components/editor/code/scss/variables.scss +31 -12
- package/src/components/editor/code/services/model.ts +2 -1
- package/src/components/editor/code/syntax.ts +2 -1
- package/src/components/editor/code/view.ts +22 -45
- package/src/components/editor/diffs/index.ts +1 -0
- package/src/components/editor/diffs/merge.ts +9 -10
- package/src/components/editor/diffs/scss/_diffs.scss +39 -63
- package/src/components/editor/diffs/scss/_merge.scss +10 -2
- package/src/components/editor/diffs/scss/index.scss +0 -1
- package/src/components/editor/diffs/scss/variables.scss +36 -17
- package/src/components/editor/diffs/view.ts +8 -9
- package/src/components/editor/markdown/editing.ts +18 -6
- package/src/components/editor/markdown/format.ts +180 -32
- package/src/components/editor/markdown/layout.ts +2 -1
- package/src/components/editor/markdown/model.ts +0 -38
- package/src/components/editor/markdown/render.ts +1 -1
- package/src/components/editor/markdown/scss/index.scss +38 -52
- package/src/components/editor/markdown/scss/variables.scss +24 -50
- package/src/components/editor/markdown/template.ts +3 -63
- package/src/components/editor/markdown/toolbar.ts +76 -127
- package/src/components/editor/markdown/view.ts +9 -32
- package/src/components/editor/tree/drag.ts +1 -1
- package/src/components/editor/tree/find.ts +61 -64
- package/src/components/editor/tree/scss/index.scss +29 -30
- package/src/components/editor/tree/scss/variables.scss +34 -15
- package/src/components/editor/tree/template.ts +9 -9
- package/src/components/editor/viewer/model.ts +1 -1
- package/src/components/editor/viewer/scss/_viewer.scss +4 -5
- package/src/components/editor/viewer/scss/variables.scss +3 -3
- package/src/components/editor/viewer/template.ts +4 -31
- package/src/components/editor/workspace/keybindings.ts +1 -1
- package/src/components/editor/workspace/model.ts +136 -37
- package/src/components/editor/workspace/scss/_keybindings.scss +3 -20
- package/src/components/editor/workspace/scss/_status.scss +0 -1
- package/src/components/editor/workspace/scss/_tabs.scss +2 -41
- package/src/components/editor/workspace/scss/index.scss +49 -71
- package/src/components/editor/workspace/scss/variables.scss +1 -135
- package/src/components/editor/workspace/session.ts +138 -18
- package/src/components/editor/workspace/status.ts +1 -1
- package/src/components/editor/workspace/strip.ts +96 -115
- package/src/components/editor/workspace/tabs.ts +2 -23
- package/src/components/editor/workspace/template.ts +323 -458
- package/src/components/error/index.ts +47 -183
- package/src/components/error/scss/index.scss +34 -35
- package/src/components/error/scss/variables.scss +14 -26
- package/src/components/filter/scss/index.scss +6 -5
- package/src/components/form/action.ts +7 -7
- package/src/components/form/input.ts +25 -12
- package/src/components/frame/scss/index.scss +5 -5
- package/src/components/group/index.ts +77 -2
- package/src/components/group/scss/index.scss +164 -0
- package/src/components/group/scss/variables.scss +110 -2
- package/src/components/heatmap/scss/variables.scss +13 -10
- package/src/components/highlight/index.ts +87 -79
- package/src/components/highlight/scss/index.scss +6 -16
- package/src/components/highlight/scss/variables.scss +33 -5
- package/src/components/icon/scss/index.scss +2 -2
- package/src/components/icon/scss/variables.scss +14 -1
- package/src/components/image/scss/index.scss +9 -9
- package/src/components/image/scss/variables.scss +1 -1
- package/src/components/index.ts +3 -6
- package/src/components/inline-edit/index.ts +8 -6
- package/src/components/inline-edit/rich.ts +8 -8
- package/src/components/inline-edit/scss/index.scss +50 -36
- package/src/components/inline-edit/scss/variables.scss +28 -18
- package/src/components/inline-edit/status.ts +2 -0
- package/src/components/input/index.ts +3 -1
- package/src/components/input/otp.ts +175 -0
- package/src/components/input/password.ts +178 -0
- package/src/components/input/scrub.ts +197 -178
- package/src/components/input/scss/index.scss +344 -4
- package/src/components/input/scss/variables.scss +234 -65
- package/src/components/input/tag.ts +98 -53
- package/src/components/json/download.ts +2 -5
- package/src/components/link/scss/index.scss +3 -5
- package/src/components/loading/scss/index.scss +1 -0
- package/src/components/loading/scss/variables.scss +1 -0
- package/src/components/marquee/index.ts +1 -1
- package/src/components/marquee/scss/index.scss +11 -4
- package/src/components/nav/scss/index.scss +10 -26
- package/src/components/nav/scss/variables.scss +13 -23
- package/src/components/nav/tree.ts +10 -8
- package/src/components/notification/index.ts +3 -3
- package/src/components/notification/scss/index.scss +7 -14
- package/src/components/notification/scss/variables.scss +10 -2
- package/src/components/number/index.ts +1 -1
- package/src/components/overlay/popup.ts +2 -2
- package/src/components/overlay/scss/index.scss +60 -51
- package/src/components/page/scss/variables.scss +1 -0
- package/src/components/pagination/arrows.ts +2 -3
- package/src/components/pagination/cards.ts +2 -3
- package/src/components/pagination/index.ts +11 -9
- package/src/components/pagination/scss/index.scss +38 -101
- package/src/components/pagination/scss/variables.scss +24 -75
- package/src/components/progress/index.ts +1 -1
- package/src/components/progress/scss/index.scss +22 -11
- package/src/components/progress/scss/variables.scss +13 -5
- package/src/components/progress/text.ts +3 -3
- package/src/components/range/filter.ts +249 -246
- package/src/components/range/index.ts +22 -7
- package/src/components/range/scss/index.scss +470 -15
- package/src/components/range/scss/variables.scss +402 -198
- package/src/components/range/surface.ts +135 -0
- package/src/components/relative-time/index.ts +2 -2
- package/src/components/relative-time/scss/index.scss +4 -2
- package/src/components/relative-time/scss/variables.scss +4 -5
- package/src/components/root/scss/index.scss +11 -11
- package/src/components/root/scss/variables.scss +4 -4
- package/src/components/search/button.ts +24 -0
- package/src/components/search/index.ts +12 -0
- package/src/components/search/input.ts +35 -0
- package/src/components/search/parts.ts +24 -0
- package/src/components/search/scss/index.scss +36 -0
- package/src/components/search/scss/variables.scss +67 -0
- package/src/components/section/scss/variables.scss +1 -0
- package/src/components/select/expand.ts +3 -4
- package/src/components/select/index.ts +55 -41
- package/src/components/select/placement.ts +17 -1
- package/src/components/select/scss/index.scss +57 -29
- package/src/components/select/scss/variables.scss +91 -53
- package/src/components/{panels → shell}/group.ts +151 -98
- package/src/components/shell/index.ts +805 -284
- package/src/components/{panels → shell}/model.ts +329 -102
- package/src/components/shell/resize.ts +176 -0
- package/src/components/shell/scss/index.scss +502 -89
- package/src/components/shell/scss/variables.scss +264 -39
- package/src/components/shell/sidebar.ts +325 -0
- package/src/components/{panels → shell}/subtree.ts +1 -2
- package/src/components/shortcut-recorder/index.ts +99 -61
- package/src/components/shortcut-recorder/scss/index.scss +76 -52
- package/src/components/shortcut-recorder/scss/variables.scss +25 -30
- package/src/components/sortable/index.ts +364 -63
- package/src/components/sortable/scss/index.scss +22 -2
- package/src/components/sortable/scss/variables.scss +16 -4
- package/src/components/story/index.ts +56 -33
- package/src/components/story/scss/index.scss +67 -16
- package/src/components/story/scss/variables.scss +59 -18
- package/src/components/surface-field/engine.ts +157 -61
- package/src/components/surface-field/index.ts +64 -9
- package/src/components/surface-field/scss/index.scss +88 -77
- package/src/components/surface-field/scss/variables.scss +84 -36
- package/src/components/surface-field/surface.ts +225 -76
- package/src/components/tasklist/index.ts +10 -14
- package/src/components/tasklist/scss/index.scss +25 -45
- package/src/components/tasklist/scss/variables.scss +12 -29
- package/src/components/textarea/index.ts +39 -42
- package/src/components/theme/reveal.ts +1 -0
- package/src/components/theme/scss/index.scss +20 -16
- package/src/components/theme/scss/variables.scss +11 -5
- package/src/components/theme/shared.ts +3 -7
- package/src/components/toast/index.ts +7 -8
- package/src/components/toast/scss/index.scss +44 -36
- package/src/components/toast/scss/variables.scss +36 -33
- package/src/components/toolbar/index.ts +1675 -0
- package/src/components/toolbar/scss/index.scss +759 -0
- package/src/components/toolbar/scss/variables.scss +555 -0
- package/src/components/tooltip/menu.ts +301 -220
- package/src/components/tooltip/onclick.ts +18 -3
- package/src/components/tooltip/onhover.ts +13 -9
- package/src/components/tooltip/scss/index.scss +155 -188
- package/src/components/tooltip/scss/variables.scss +151 -135
- package/src/components/tooltip/shared.ts +47 -74
- package/src/components/tooltip/utilities.ts +151 -10
- package/src/components/truncate/index.ts +1 -1
- package/src/components/typewriter/rotate.ts +6 -6
- package/src/components/typewriter/scss/index.scss +14 -5
- package/src/components/uptime/scss/index.scss +8 -15
- package/src/components/uptime/scss/variables.scss +12 -1
- package/src/components/usage-meter/index.ts +1 -1
- package/src/components/usage-meter/scss/index.scss +6 -4
- package/src/components/usage-meter/scss/variables.scss +11 -11
- package/src/css-utilities/box-shadow.scss +0 -1
- package/src/css-utilities/icon.scss +9 -9
- package/src/css-utilities/surface.scss +27 -17
- package/src/modifiers/glass/index.ts +2 -2
- package/src/modifiers/glass/scss/index.scss +2 -2
- package/src/normalize/scss/index.scss +1 -1
- package/src/shared/drag.ts +92 -53
- package/src/shared/placement.ts +145 -0
- package/src/shared/transition.ts +1 -1
- package/src/shared/viewport.ts +1 -7
- package/src/tokens/scss/color.scss +2 -2
- package/src/tokens/scss/scale.scss +5 -1
- package/src/tokens/scss/size.scss +0 -7
- package/storage/svg/angle.svg +1 -0
- package/storage/svg/{chevron-left.svg → arrow.svg} +1 -1
- package/storage/svg/calendar.svg +1 -0
- package/storage/svg/circle-filled.svg +1 -0
- package/storage/svg/cursor-arrow-left.svg +1 -0
- package/storage/svg/cursor-arrow-right.svg +1 -0
- package/storage/svg/fit.svg +1 -0
- package/storage/svg/grip.svg +1 -0
- package/storage/svg/mail.svg +1 -0
- package/storage/svg/{chevron-down.svg → minus.svg} +1 -1
- package/storage/svg/music.svg +1 -0
- package/storage/svg/{chevron-up.svg → rotate-ccw.svg} +1 -1
- package/vite.config.ts +9 -13
- package/NOTICE +0 -232
- package/build/components/dock/index.d.ts +0 -47
- package/build/components/dock/index.js +0 -469
- package/build/components/dock/scss/index.scss +0 -2
- package/build/components/metric/flash.d.ts +0 -12
- package/build/components/metric/flash.js +0 -117
- package/build/components/metric/index.d.ts +0 -44
- package/build/components/metric/index.js +0 -275
- package/build/components/metric/scss/index.scss +0 -2
- package/build/components/pagination/dots.d.ts +0 -23
- package/build/components/pagination/dots.js +0 -115
- package/build/components/panels/dnd.d.ts +0 -47
- package/build/components/panels/dnd.js +0 -114
- package/build/components/panels/group.js +0 -322
- package/build/components/panels/index.d.ts +0 -17
- package/build/components/panels/index.js +0 -524
- package/build/components/panels/model.d.ts +0 -64
- package/build/components/panels/resize.d.ts +0 -9
- package/build/components/panels/scss/index.scss +0 -2
- package/build/components/preview/buttons.d.ts +0 -12
- package/build/components/preview/buttons.js +0 -26
- package/build/components/preview/code.d.ts +0 -8
- package/build/components/preview/code.js +0 -18
- package/build/components/preview/header.js +0 -21
- package/build/components/preview/index.d.ts +0 -37
- package/build/components/preview/index.js +0 -123
- package/build/components/preview/scss/index.scss +0 -2
- package/build/components/preview/source.d.ts +0 -12
- package/build/components/preview/source.js +0 -79
- package/build/components/preview/stage.d.ts +0 -8
- package/build/components/preview/stage.js +0 -28
- package/build/components/textarea/scss/index.scss +0 -2
- package/src/components/dock/index.ts +0 -567
- package/src/components/dock/scss/index.scss +0 -346
- package/src/components/dock/scss/variables.scss +0 -357
- package/src/components/input/scss/_field.scss +0 -39
- package/src/components/input/scss/_scrub.scss +0 -89
- package/src/components/input/scss/_tag.scss +0 -142
- package/src/components/metric/flash.ts +0 -129
- package/src/components/metric/index.ts +0 -307
- package/src/components/metric/scss/_flash.scss +0 -150
- package/src/components/metric/scss/index.scss +0 -155
- package/src/components/metric/scss/variables.scss +0 -233
- package/src/components/pagination/dots.ts +0 -132
- package/src/components/panels/dnd.ts +0 -190
- package/src/components/panels/index.ts +0 -676
- package/src/components/panels/resize.ts +0 -157
- package/src/components/panels/scss/index.scss +0 -379
- package/src/components/panels/scss/variables.scss +0 -197
- package/src/components/preview/buttons.ts +0 -48
- package/src/components/preview/code.ts +0 -28
- package/src/components/preview/header.ts +0 -23
- package/src/components/preview/index.ts +0 -149
- package/src/components/preview/scss/index.scss +0 -158
- package/src/components/preview/scss/variables.scss +0 -149
- package/src/components/preview/source.ts +0 -73
- package/src/components/preview/stage.ts +0 -33
- package/src/components/range/scss/_filter.scss +0 -360
- package/src/components/range/scss/_slider.scss +0 -65
- package/src/components/range/scss/_vertical.scss +0 -10
- package/src/components/textarea/scss/index.scss +0 -72
- package/src/components/textarea/scss/variables.scss +0 -22
- package/storage/svg/amex.svg +0 -1
- package/storage/svg/arrow-down.svg +0 -1
- package/storage/svg/arrow-left.svg +0 -1
- package/storage/svg/arrow-right.svg +0 -1
- package/storage/svg/arrow-up.svg +0 -1
- package/storage/svg/card.svg +0 -1
- package/storage/svg/chip.svg +0 -1
- package/storage/svg/discover.svg +0 -1
- package/storage/svg/mastercard.svg +0 -1
- package/storage/svg/visa.svg +0 -1
- /package/build/components/{panels → shell}/subtree.d.ts +0 -0
- /package/storage/svg/{chevron-right.svg → chevron.svg} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
type Direction = 'column' | 'row';
|
|
2
|
+
type Dock = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
size: number | null;
|
|
5
|
+
};
|
|
6
|
+
type Group = {
|
|
7
|
+
active: string | null;
|
|
8
|
+
id: string;
|
|
9
|
+
kind: 'group';
|
|
10
|
+
placement?: Placement;
|
|
11
|
+
surfaces: Surface[];
|
|
12
|
+
};
|
|
13
|
+
type Layout = {
|
|
14
|
+
active: string | null;
|
|
15
|
+
bottom: Dock & {
|
|
16
|
+
maximized: boolean;
|
|
17
|
+
size: number;
|
|
18
|
+
};
|
|
19
|
+
left: Dock;
|
|
20
|
+
main: string | null;
|
|
21
|
+
maximized: string | null;
|
|
22
|
+
right: Dock;
|
|
23
|
+
root: Node | null;
|
|
24
|
+
zoom: Zoom[];
|
|
25
|
+
};
|
|
26
|
+
type Node = Group | Split;
|
|
27
|
+
type Options = {
|
|
28
|
+
closing?: (surfaces: Surface[]) => boolean | Promise<boolean>;
|
|
29
|
+
open?: Partial<Record<Placement, boolean>>;
|
|
30
|
+
root?: Node | null;
|
|
31
|
+
store?: Store;
|
|
32
|
+
};
|
|
33
|
+
type Placement = 'bottom' | 'left' | 'right';
|
|
34
|
+
type Saved = {
|
|
35
|
+
root: Node | null;
|
|
36
|
+
};
|
|
37
|
+
type Side = 'after' | 'before';
|
|
38
|
+
type Split = {
|
|
39
|
+
children: Node[];
|
|
40
|
+
direction: Direction;
|
|
41
|
+
id: string;
|
|
42
|
+
kind: 'split';
|
|
43
|
+
sizes: number[];
|
|
44
|
+
};
|
|
45
|
+
type Surface = {
|
|
46
|
+
id: string;
|
|
47
|
+
kind: string;
|
|
48
|
+
sortable?: boolean;
|
|
49
|
+
};
|
|
50
|
+
type Store = {
|
|
51
|
+
get(key: typeof KEY): Promise<unknown>;
|
|
52
|
+
set(key: typeof KEY, value: Saved): Promise<boolean>;
|
|
53
|
+
};
|
|
54
|
+
type Zoom = {
|
|
55
|
+
groups: string[];
|
|
56
|
+
maximized: string | null;
|
|
57
|
+
};
|
|
58
|
+
declare const KEY = "shell";
|
|
59
|
+
declare const MIN_FRACTION = 0.1;
|
|
60
|
+
declare function allGroups(node: Node | null): Group[];
|
|
61
|
+
declare function bounded(size: number): number;
|
|
62
|
+
declare function contains(node: Node, id: string): boolean;
|
|
63
|
+
declare function docked(group: Group, placement: Placement): boolean;
|
|
64
|
+
declare function findGroup(node: Node | null, id: string): Group | null;
|
|
65
|
+
declare function findSplit(node: Node | null, id: string): Split | null;
|
|
66
|
+
declare function findSurfaceGroup(node: Node | null, id: string): Group | null;
|
|
67
|
+
declare function fixed(group: Group): boolean;
|
|
68
|
+
declare function stationary(root: Node | null, placement: Placement): boolean;
|
|
69
|
+
declare const state: ({ closing, open, root, store }?: Options) => {
|
|
70
|
+
activate(surface: string): void;
|
|
71
|
+
back(): boolean;
|
|
72
|
+
close(surface: string): Promise<boolean>;
|
|
73
|
+
closeAll(): Promise<boolean>;
|
|
74
|
+
closeGroup(group: string): Promise<boolean>;
|
|
75
|
+
closeOthers(group: string, surface: string): Promise<boolean>;
|
|
76
|
+
closeRight(group: string, surface: string): Promise<boolean>;
|
|
77
|
+
dock(surface: string, placement?: Placement): void;
|
|
78
|
+
focus(group: string): void;
|
|
79
|
+
readonly layout: Layout;
|
|
80
|
+
load(root: Node | null): void;
|
|
81
|
+
maximize(group: string): void;
|
|
82
|
+
move(surface: string, group: string, index?: number): void;
|
|
83
|
+
open(surface: Surface, group?: string): void;
|
|
84
|
+
replace(previous: string, surface: Surface): void;
|
|
85
|
+
resize(split: string, sizes: number[], shown?: string[]): void;
|
|
86
|
+
resizeDock(placement: Placement, size: number): void;
|
|
87
|
+
split(surface: string, group: string, direction: Direction, side: Side): void;
|
|
88
|
+
toggle(placement: Placement, open?: boolean): void;
|
|
89
|
+
unzoom: () => void;
|
|
90
|
+
zoom(groups: string[]): void;
|
|
91
|
+
};
|
|
92
|
+
export default state;
|
|
93
|
+
export { allGroups, bounded, contains, docked, findGroup, findSplit, findSurfaceGroup, fixed, MIN_FRACTION, stationary };
|
|
94
|
+
export type { Direction, Dock, Group, Layout, Node, Placement, Saved, Side, Split, Store, Surface, Zoom };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { read, signal, write } from '@esportsplus/reactivity';
|
|
2
|
-
const MIN_FRACTION = 0.1;
|
|
3
2
|
const BOTTOM_SIZE = 0.25;
|
|
3
|
+
const KEY = 'shell';
|
|
4
|
+
const MIN_FRACTION = 0.1;
|
|
4
5
|
function allGroups(node) {
|
|
5
6
|
if (node === null) {
|
|
6
7
|
return [];
|
|
@@ -16,6 +17,12 @@ function bounded(size) {
|
|
|
16
17
|
function contains(node, id) {
|
|
17
18
|
return node.id === id || (node.kind === 'split' && node.children.some((child) => contains(child, id)));
|
|
18
19
|
}
|
|
20
|
+
function docked(group, placement) {
|
|
21
|
+
return group.placement === placement;
|
|
22
|
+
}
|
|
23
|
+
function emptyGroup(root, id) {
|
|
24
|
+
return updateGroup(root, id, (group) => ({ ...group, active: null, surfaces: [] }));
|
|
25
|
+
}
|
|
19
26
|
function equalSizes(count) {
|
|
20
27
|
return Array.from({ length: count }, () => 1 / count);
|
|
21
28
|
}
|
|
@@ -40,6 +47,9 @@ function findSplit(node, id) {
|
|
|
40
47
|
function findSurfaceGroup(node, id) {
|
|
41
48
|
return allGroups(node).find((group) => group.surfaces.some((surface) => surface.id === id)) ?? null;
|
|
42
49
|
}
|
|
50
|
+
function fixed(group) {
|
|
51
|
+
return group.surfaces.length === 1 && group.surfaces[0].sortable === false;
|
|
52
|
+
}
|
|
43
53
|
function insertRoot(root, direction, inserted, side, id) {
|
|
44
54
|
if (root.kind === 'split' && root.direction === direction) {
|
|
45
55
|
let at = side === 'before' ? 0 : root.children.length, children = [...root.children], sizes = normalizeSizes(root.sizes, root.children.length).map((size) => size * 0.75);
|
|
@@ -76,6 +86,10 @@ function insertSplit(node, target, direction, inserted, side, id) {
|
|
|
76
86
|
}
|
|
77
87
|
return { ...node, children: node.children.map((child) => insertSplit(child, target, direction, inserted, side, id)) };
|
|
78
88
|
}
|
|
89
|
+
function lastInSidebar(root, group) {
|
|
90
|
+
let placement = group.placement;
|
|
91
|
+
return (placement === 'left' || placement === 'right') && allGroups(root).filter((entry) => docked(entry, placement)).length === 1;
|
|
92
|
+
}
|
|
79
93
|
function normalize(node) {
|
|
80
94
|
if (node === null) {
|
|
81
95
|
return null;
|
|
@@ -107,14 +121,19 @@ function normalize(node) {
|
|
|
107
121
|
};
|
|
108
122
|
}
|
|
109
123
|
function normalizeLayout(layout) {
|
|
110
|
-
let root = normalize(layout.root), groups = allGroups(root);
|
|
124
|
+
let root = normalize(layout.root), groups = allGroups(root), main = groups.filter((group) => group.placement === undefined).map((group) => group.id);
|
|
111
125
|
return {
|
|
112
126
|
...layout,
|
|
113
127
|
active: groups.some((group) => group.id === layout.active) ? layout.active : (groups[0]?.id ?? null),
|
|
114
128
|
bottom: { ...layout.bottom, size: bounded(layout.bottom.size) },
|
|
129
|
+
main: main.find((id) => id === layout.active) ?? main.find((id) => id === layout.main) ?? main[0] ?? null,
|
|
115
130
|
root
|
|
116
131
|
};
|
|
117
132
|
}
|
|
133
|
+
function removed(previous, next) {
|
|
134
|
+
let kept = new Set(allGroups(next).flatMap((group) => group.surfaces.map((surface) => surface.id)));
|
|
135
|
+
return allGroups(previous).flatMap((group) => group.surfaces.filter((surface) => !kept.has(surface.id)));
|
|
136
|
+
}
|
|
118
137
|
function normalizeSizes(sizes, count) {
|
|
119
138
|
if (count === 0) {
|
|
120
139
|
return [];
|
|
@@ -126,6 +145,9 @@ function normalizeSizes(sizes, count) {
|
|
|
126
145
|
let remainder = 1 - minimum * count;
|
|
127
146
|
return values.map((value) => minimum + remainder * (total === 0 ? 1 / count : value / total));
|
|
128
147
|
}
|
|
148
|
+
function release(root, group) {
|
|
149
|
+
return lastInSidebar(root, group) ? emptyGroup(root, group.id) : removeLeaf(root, group.id);
|
|
150
|
+
}
|
|
129
151
|
function removeLeaf(node, id) {
|
|
130
152
|
if (node === null) {
|
|
131
153
|
return null;
|
|
@@ -141,10 +163,14 @@ function removeLeaf(node, id) {
|
|
|
141
163
|
})
|
|
142
164
|
});
|
|
143
165
|
}
|
|
166
|
+
function stationary(root, placement) {
|
|
167
|
+
let groups = allGroups(root).filter((group) => docked(group, placement));
|
|
168
|
+
return groups.length === 1 && fixed(groups[0]);
|
|
169
|
+
}
|
|
144
170
|
function take(root, source, id) {
|
|
145
171
|
let index = source.surfaces.findIndex((surface) => surface.id === id), surfaces = source.surfaces.filter((surface) => surface.id !== id);
|
|
146
172
|
if (surfaces.length === 0) {
|
|
147
|
-
return
|
|
173
|
+
return release(root, source);
|
|
148
174
|
}
|
|
149
175
|
return updateGroup(root, source.id, (group) => ({
|
|
150
176
|
...group,
|
|
@@ -152,12 +178,6 @@ function take(root, source, id) {
|
|
|
152
178
|
surfaces
|
|
153
179
|
}));
|
|
154
180
|
}
|
|
155
|
-
function zoomed(previous, next) {
|
|
156
|
-
let before = new Set(allGroups(previous.root).map((group) => group.id)), after = allGroups(next.root).map((group) => group.id), created = after.filter((id) => !before.has(id)), existing = new Set(after);
|
|
157
|
-
return next.zoom
|
|
158
|
-
.map((level) => [...level.filter((id) => existing.has(id)), ...created])
|
|
159
|
-
.filter((level) => level.length > 0);
|
|
160
|
-
}
|
|
161
181
|
function updateGroup(node, id, update) {
|
|
162
182
|
if (node === null) {
|
|
163
183
|
return null;
|
|
@@ -176,46 +196,86 @@ function updateSplit(node, id, sizes) {
|
|
|
176
196
|
}
|
|
177
197
|
return { ...node, children: node.children.map((child) => updateSplit(child, id, sizes) ?? child) };
|
|
178
198
|
}
|
|
179
|
-
|
|
180
|
-
let
|
|
199
|
+
function zoomed(previous, next) {
|
|
200
|
+
let before = new Set(allGroups(previous.root).map((group) => group.id)), after = allGroups(next.root).map((group) => group.id), created = after.filter((id) => !before.has(id)), existing = new Set(after);
|
|
201
|
+
return next.zoom
|
|
202
|
+
.map((level) => ({
|
|
203
|
+
groups: [...level.groups.filter((id) => existing.has(id)), ...created],
|
|
204
|
+
maximized: level.maximized !== null && existing.has(level.maximized) ? level.maximized : null
|
|
205
|
+
}))
|
|
206
|
+
.filter((level) => level.groups.length > 0);
|
|
207
|
+
}
|
|
208
|
+
const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
209
|
+
let counter = 1, touched = false, layout = signal(normalizeLayout({
|
|
181
210
|
active: null,
|
|
182
|
-
bottom: { maximized: false, open: true, size: BOTTOM_SIZE },
|
|
211
|
+
bottom: { maximized: false, open: open.bottom ?? true, size: BOTTOM_SIZE },
|
|
212
|
+
left: { open: open.left ?? true, size: null },
|
|
213
|
+
main: null,
|
|
183
214
|
maximized: null,
|
|
184
|
-
|
|
215
|
+
right: { open: open.right ?? true, size: null },
|
|
216
|
+
root,
|
|
185
217
|
zoom: []
|
|
186
218
|
}));
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
function load() {
|
|
194
|
-
if (!storage || typeof localStorage === 'undefined') {
|
|
195
|
-
return null;
|
|
219
|
+
advance(read(layout).root);
|
|
220
|
+
store?.get(KEY).then((value) => {
|
|
221
|
+
let saved = value?.root;
|
|
222
|
+
if (touched || !saved || (saved.kind !== 'group' && saved.kind !== 'split')) {
|
|
223
|
+
return;
|
|
196
224
|
}
|
|
197
|
-
|
|
198
|
-
|
|
225
|
+
advance(saved);
|
|
226
|
+
write(layout, normalizeLayout({ ...read(layout), root: saved }));
|
|
227
|
+
}, () => { });
|
|
228
|
+
function advance(node) {
|
|
229
|
+
for (let group of allGroups(node)) {
|
|
230
|
+
counter = Math.max(counter, Number(/-(\d+)$/.exec(group.id)?.[1] ?? 0) + 1);
|
|
199
231
|
}
|
|
200
|
-
|
|
201
|
-
|
|
232
|
+
}
|
|
233
|
+
function guarded(change) {
|
|
234
|
+
let surfaces = removed(read(layout).root, change(read(layout)).root), allowed = surfaces.length && closing ? closing(surfaces) : true;
|
|
235
|
+
if (typeof allowed === 'boolean') {
|
|
236
|
+
if (allowed) {
|
|
237
|
+
structural(change);
|
|
238
|
+
}
|
|
239
|
+
return Promise.resolve(allowed);
|
|
202
240
|
}
|
|
241
|
+
return allowed.then((value) => {
|
|
242
|
+
if (value) {
|
|
243
|
+
structural(change);
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
}, () => false);
|
|
247
|
+
}
|
|
248
|
+
function id(prefix) {
|
|
249
|
+
return `${prefix}-${counter++}`;
|
|
203
250
|
}
|
|
204
251
|
function structural(change) {
|
|
252
|
+
touched = true;
|
|
205
253
|
update((current) => change({ ...current, bottom: { ...current.bottom, maximized: false }, maximized: null }));
|
|
206
254
|
}
|
|
255
|
+
function unzoom() {
|
|
256
|
+
update((current) => {
|
|
257
|
+
let level = current.zoom.at(-1);
|
|
258
|
+
if (!level) {
|
|
259
|
+
return current;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
...current,
|
|
263
|
+
maximized: level.maximized !== null && findGroup(current.root, level.maximized) ? level.maximized : null,
|
|
264
|
+
zoom: current.zoom.slice(0, -1)
|
|
265
|
+
};
|
|
266
|
+
});
|
|
267
|
+
}
|
|
207
268
|
function update(change) {
|
|
208
269
|
let previous = read(layout), next = normalizeLayout(change(previous));
|
|
209
270
|
if (next.zoom.length) {
|
|
210
271
|
next = { ...next, zoom: zoomed(previous, next) };
|
|
211
272
|
}
|
|
212
273
|
write(layout, next);
|
|
213
|
-
|
|
214
|
-
localStorage.setItem(storage, JSON.stringify({ root: next.root }));
|
|
215
|
-
}
|
|
274
|
+
void store?.set(KEY, { root: next.root });
|
|
216
275
|
}
|
|
217
276
|
function visible(group, current) {
|
|
218
|
-
|
|
277
|
+
let placement = group.placement;
|
|
278
|
+
return placement ? { ...current, [placement]: { ...current[placement], open: true } } : current;
|
|
219
279
|
}
|
|
220
280
|
return {
|
|
221
281
|
activate(surface) {
|
|
@@ -231,20 +291,35 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
231
291
|
};
|
|
232
292
|
});
|
|
233
293
|
},
|
|
294
|
+
back() {
|
|
295
|
+
let current = read(layout);
|
|
296
|
+
if (current.maximized !== null || current.bottom.maximized) {
|
|
297
|
+
update((now) => ({ ...now, bottom: { ...now.bottom, maximized: false }, maximized: null }));
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
if (current.zoom.length) {
|
|
301
|
+
unzoom();
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
},
|
|
234
306
|
close(surface) {
|
|
235
|
-
|
|
307
|
+
return guarded((current) => {
|
|
236
308
|
let group = findSurfaceGroup(current.root, surface);
|
|
237
309
|
return group ? { ...current, root: take(current.root, group, surface) } : current;
|
|
238
310
|
});
|
|
239
311
|
},
|
|
240
312
|
closeAll() {
|
|
241
|
-
|
|
313
|
+
return guarded((current) => ({ ...current, root: null }));
|
|
242
314
|
},
|
|
243
315
|
closeGroup(group) {
|
|
244
|
-
|
|
316
|
+
return guarded((current) => {
|
|
317
|
+
let found = findGroup(current.root, group);
|
|
318
|
+
return found ? { ...current, root: release(current.root, found) } : current;
|
|
319
|
+
});
|
|
245
320
|
},
|
|
246
321
|
closeOthers(group, surface) {
|
|
247
|
-
|
|
322
|
+
return guarded((current) => ({
|
|
248
323
|
...current,
|
|
249
324
|
active: group,
|
|
250
325
|
root: updateGroup(current.root, group, (entry) => ({
|
|
@@ -255,7 +330,7 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
255
330
|
}));
|
|
256
331
|
},
|
|
257
332
|
closeRight(group, surface) {
|
|
258
|
-
|
|
333
|
+
return guarded((current) => ({
|
|
259
334
|
...current,
|
|
260
335
|
root: updateGroup(current.root, group, (entry) => {
|
|
261
336
|
let surfaces = entry.surfaces.slice(0, entry.surfaces.findIndex((item) => item.id === surface) + 1);
|
|
@@ -267,44 +342,63 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
267
342
|
})
|
|
268
343
|
}));
|
|
269
344
|
},
|
|
270
|
-
dock(surface,
|
|
345
|
+
dock(surface, placement = 'bottom') {
|
|
271
346
|
structural((current) => {
|
|
272
347
|
let source = findSurfaceGroup(current.root, surface), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
273
|
-
if (
|
|
348
|
+
if (source && fixed(source)) {
|
|
349
|
+
return source.placement === placement || allGroups(current.root).some((entry) => docked(entry, placement))
|
|
350
|
+
? current
|
|
351
|
+
: {
|
|
352
|
+
...current,
|
|
353
|
+
[placement]: { ...current[placement], open: true },
|
|
354
|
+
root: updateGroup(current.root, source.id, (entry) => ({ ...entry, placement }))
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
if (!source ||
|
|
358
|
+
!item ||
|
|
359
|
+
item.sortable === false ||
|
|
360
|
+
stationary(current.root, placement) ||
|
|
361
|
+
(current.root?.kind === 'group' && source.surfaces.length === 1)) {
|
|
274
362
|
return current;
|
|
275
363
|
}
|
|
276
|
-
let
|
|
364
|
+
let root = take(current.root, source, surface);
|
|
277
365
|
if (root === null) {
|
|
278
366
|
return current;
|
|
279
367
|
}
|
|
368
|
+
let groups = allGroups(root).filter((entry) => docked(entry, placement)), vacant = groups.find((entry) => entry.surfaces.length === 0);
|
|
369
|
+
if (vacant) {
|
|
370
|
+
return {
|
|
371
|
+
...current,
|
|
372
|
+
active: vacant.id,
|
|
373
|
+
[placement]: { ...current[placement], open: true },
|
|
374
|
+
root: updateGroup(root, vacant.id, (entry) => ({ ...entry, active: item.id, surfaces: [item] }))
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
let group = { active: item.id, id: id('group'), kind: 'group', placement, surfaces: [item] }, last = groups.at(-1), sidebar = placement !== 'bottom';
|
|
280
378
|
return {
|
|
281
379
|
...current,
|
|
282
380
|
active: group.id,
|
|
283
|
-
|
|
284
|
-
root:
|
|
381
|
+
[placement]: { ...current[placement], open: true },
|
|
382
|
+
root: last
|
|
383
|
+
? insertSplit(root, last.id, sidebar ? 'column' : 'row', group, 'after', id)
|
|
384
|
+
: insertRoot(root, sidebar ? 'row' : 'column', group, placement === 'left' ? 'before' : 'after', id)
|
|
285
385
|
};
|
|
286
386
|
});
|
|
287
387
|
},
|
|
288
388
|
focus(group) {
|
|
289
|
-
update((current) => {
|
|
290
|
-
let found = findGroup(current.root, group);
|
|
291
|
-
if (!found) {
|
|
292
|
-
return current;
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
...current,
|
|
296
|
-
active: group,
|
|
297
|
-
maximized: found.placement !== 'bottom' && current.maximized !== null ? group : current.maximized
|
|
298
|
-
};
|
|
299
|
-
});
|
|
389
|
+
update((current) => findGroup(current.root, group) ? { ...current, active: group } : current);
|
|
300
390
|
},
|
|
301
391
|
get layout() {
|
|
302
392
|
return read(layout);
|
|
303
393
|
},
|
|
394
|
+
load(root) {
|
|
395
|
+
advance(root);
|
|
396
|
+
structural((current) => ({ ...current, root }));
|
|
397
|
+
},
|
|
304
398
|
maximize(group) {
|
|
305
399
|
update((current) => {
|
|
306
400
|
let found = findGroup(current.root, group);
|
|
307
|
-
if (!found) {
|
|
401
|
+
if (!found || docked(found, 'left') || docked(found, 'right')) {
|
|
308
402
|
return current;
|
|
309
403
|
}
|
|
310
404
|
if (found.placement === 'bottom') {
|
|
@@ -321,7 +415,7 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
321
415
|
move(surface, group, index) {
|
|
322
416
|
structural((current) => {
|
|
323
417
|
let source = findSurfaceGroup(current.root, surface), target = findGroup(current.root, group), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
324
|
-
if (!source || !target || !item) {
|
|
418
|
+
if (!source || !target || !item || (source.id !== target.id && (item.sortable === false || fixed(target)))) {
|
|
325
419
|
return current;
|
|
326
420
|
}
|
|
327
421
|
let root = source.id === target.id ? current.root : take(current.root, source, surface);
|
|
@@ -347,8 +441,8 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
347
441
|
};
|
|
348
442
|
}
|
|
349
443
|
target ??= findGroup(current.root, current.active ?? '');
|
|
350
|
-
if (!group && target
|
|
351
|
-
target = allGroups(current.root).find((entry) => entry.placement
|
|
444
|
+
if (target && ((!group && target.placement !== undefined) || fixed(target))) {
|
|
445
|
+
target = allGroups(current.root).find((entry) => entry.placement === undefined && !fixed(entry)) ?? null;
|
|
352
446
|
}
|
|
353
447
|
if (!target) {
|
|
354
448
|
let created = { active: surface.id, id: id('group'), kind: 'group', surfaces: [surface] };
|
|
@@ -366,7 +460,25 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
366
460
|
};
|
|
367
461
|
});
|
|
368
462
|
},
|
|
463
|
+
replace(previous, surface) {
|
|
464
|
+
structural((current) => {
|
|
465
|
+
let target = findSurfaceGroup(current.root, previous);
|
|
466
|
+
if (!target) {
|
|
467
|
+
return current;
|
|
468
|
+
}
|
|
469
|
+
let existing = findSurfaceGroup(current.root, surface.id), root = existing ? take(current.root, existing, surface.id) : current.root;
|
|
470
|
+
return {
|
|
471
|
+
...current,
|
|
472
|
+
root: updateGroup(root, target.id, (entry) => ({
|
|
473
|
+
...entry,
|
|
474
|
+
active: entry.active === previous ? surface.id : entry.active,
|
|
475
|
+
surfaces: entry.surfaces.map((item) => item.id === previous ? surface : item)
|
|
476
|
+
}))
|
|
477
|
+
};
|
|
478
|
+
});
|
|
479
|
+
},
|
|
369
480
|
resize(split, sizes, shown) {
|
|
481
|
+
touched = true;
|
|
370
482
|
update((current) => {
|
|
371
483
|
let found = findSplit(current.root, split);
|
|
372
484
|
if (!found) {
|
|
@@ -389,42 +501,56 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
389
501
|
return { ...current, root: updateSplit(current.root, split, normalizeSizes(sizes, sizes.length)) };
|
|
390
502
|
});
|
|
391
503
|
},
|
|
392
|
-
|
|
393
|
-
update((current) => ({ ...current,
|
|
504
|
+
resizeDock(placement, size) {
|
|
505
|
+
update((current) => ({ ...current, [placement]: { ...current[placement], size } }));
|
|
394
506
|
},
|
|
395
507
|
split(surface, group, direction, side) {
|
|
396
508
|
structural((current) => {
|
|
397
|
-
let source = findSurfaceGroup(current.root, surface), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
398
|
-
if (!source ||
|
|
509
|
+
let source = findSurfaceGroup(current.root, surface), target = findGroup(current.root, group), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
510
|
+
if (!source ||
|
|
511
|
+
!item ||
|
|
512
|
+
!target ||
|
|
513
|
+
item.sortable === false ||
|
|
514
|
+
(source.id === group && source.surfaces.length === 1) ||
|
|
515
|
+
(target.placement !== undefined && stationary(current.root, target.placement))) {
|
|
399
516
|
return current;
|
|
400
517
|
}
|
|
401
|
-
let created = { active: item.id, id: id('group'), kind: 'group', surfaces: [item] }, root = take(current.root, source, surface);
|
|
518
|
+
let created = { active: item.id, id: id('group'), kind: 'group', placement: target.placement, surfaces: [item] }, root = take(current.root, source, surface);
|
|
402
519
|
if (root === null || !findGroup(root, group)) {
|
|
403
520
|
return current;
|
|
404
521
|
}
|
|
522
|
+
if (target.surfaces.length === 0) {
|
|
523
|
+
return { ...current, active: group, root: updateGroup(root, group, (entry) => ({ ...entry, active: item.id, surfaces: [item] })) };
|
|
524
|
+
}
|
|
405
525
|
return { ...current, active: created.id, root: insertSplit(root, group, direction, created, side, id) };
|
|
406
526
|
});
|
|
407
527
|
},
|
|
408
|
-
|
|
528
|
+
toggle(placement, open) {
|
|
409
529
|
update((current) => {
|
|
410
|
-
|
|
411
|
-
|
|
530
|
+
let has = allGroups(current.root).some((group) => docked(group, placement)), next = open ?? !(current[placement].open && has);
|
|
531
|
+
if (!next) {
|
|
532
|
+
if (!current[placement].open) {
|
|
533
|
+
return current;
|
|
534
|
+
}
|
|
535
|
+
return placement === 'bottom'
|
|
536
|
+
? { ...current, bottom: { ...current.bottom, maximized: false, open: false } }
|
|
537
|
+
: { ...current, [placement]: { ...current[placement], open: false } };
|
|
412
538
|
}
|
|
413
|
-
if (
|
|
414
|
-
return { ...current,
|
|
539
|
+
if (has) {
|
|
540
|
+
return current[placement].open ? current : { ...current, [placement]: { ...current[placement], open: true } };
|
|
415
541
|
}
|
|
416
|
-
let group = { active: null, id: id('group'), kind: 'group', placement
|
|
542
|
+
let group = { active: null, id: id('group'), kind: 'group', placement, surfaces: [] };
|
|
417
543
|
return {
|
|
418
544
|
...current,
|
|
419
545
|
active: group.id,
|
|
420
|
-
|
|
421
|
-
root: current.root === null
|
|
546
|
+
[placement]: { ...current[placement], open: true },
|
|
547
|
+
root: current.root === null
|
|
548
|
+
? group
|
|
549
|
+
: insertRoot(current.root, placement === 'bottom' ? 'column' : 'row', group, placement === 'left' ? 'before' : 'after', id)
|
|
422
550
|
};
|
|
423
551
|
});
|
|
424
552
|
},
|
|
425
|
-
unzoom
|
|
426
|
-
update((current) => current.zoom.length ? { ...current, maximized: null, zoom: current.zoom.slice(0, -1) } : current);
|
|
427
|
-
},
|
|
553
|
+
unzoom,
|
|
428
554
|
zoom(groups) {
|
|
429
555
|
update((current) => {
|
|
430
556
|
let existing = new Set(allGroups(current.root).map((group) => group.id)), level = groups.filter((id) => existing.has(id));
|
|
@@ -436,11 +562,11 @@ const state = ({ root = null, storage } = {}) => {
|
|
|
436
562
|
active: level.includes(current.active ?? '') ? current.active : level[0],
|
|
437
563
|
bottom: { ...current.bottom, maximized: false },
|
|
438
564
|
maximized: null,
|
|
439
|
-
zoom: [...current.zoom, level]
|
|
565
|
+
zoom: [...current.zoom, { groups: level, maximized: current.maximized }]
|
|
440
566
|
};
|
|
441
567
|
});
|
|
442
568
|
}
|
|
443
569
|
};
|
|
444
570
|
};
|
|
445
571
|
export default state;
|
|
446
|
-
export { allGroups, bounded, contains, findGroup, MIN_FRACTION };
|
|
572
|
+
export { allGroups, bounded, contains, docked, findGroup, findSplit, findSurfaceGroup, fixed, MIN_FRACTION, stationary };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Attributes, type Element as Bound } from '@esportsplus/template';
|
|
2
|
+
type Axis = 'x' | 'y';
|
|
3
|
+
declare const resized: (sizes: readonly number[], index: number, delta: number, length: number, minimum: number) => number[];
|
|
4
|
+
declare const separator: (axis: Axis, start: () => ((delta: number) => void) | null, attributes?: Attributes) => Bound;
|
|
5
|
+
export { resized, separator };
|