@esportsplus/ui 0.57.0 → 0.58.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/README.md +123 -39
- package/build/components/accordion/group.d.ts +14 -0
- package/build/components/accordion/group.js +21 -0
- package/build/components/accordion/index.d.ts +9 -0
- package/build/components/accordion/index.js +20 -3
- package/build/components/accordion/scss/index.scss +1 -1
- package/build/components/announcement/scss/index.scss +1 -1
- package/build/components/breadcrumb/scss/index.scss +1 -1
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/button/sidebar.d.ts +3 -0
- package/build/components/button/sidebar.js +40 -10
- package/build/components/capslock/index.js +1 -1
- package/build/components/capslock/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/cc/scss/index.scss +1 -1
- package/build/components/chat-minimap/scss/index.scss +1 -1
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/color-picker/index.d.ts +1 -0
- package/build/components/color-picker/index.js +166 -136
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/index.d.ts +0 -1
- package/build/components/command/index.js +3 -2
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/copy/scss/index.scss +1 -1
- package/build/components/counter/scss/index.scss +1 -1
- package/build/components/datalist/index.js +3 -3
- package/build/components/datalist/scss/index.scss +1 -1
- package/build/components/dock/scss/index.scss +1 -1
- package/build/components/editor/code/index.d.ts +0 -1
- package/build/components/editor/code/index.js +0 -1
- package/build/components/editor/code/minimap.d.ts +2 -1
- package/build/components/editor/code/minimap.js +5 -2
- package/build/components/editor/code/view.d.ts +3 -1
- package/build/components/editor/code/view.js +37 -26
- package/build/components/editor/diffs/index.d.ts +0 -1
- package/build/components/editor/diffs/index.js +0 -1
- package/build/components/editor/diffs/merge.js +7 -3
- package/build/components/editor/diffs/view.js +3 -1
- package/build/components/editor/index.d.ts +4 -1
- package/build/components/editor/index.js +2 -1
- package/build/components/editor/markdown/editing.js +22 -3
- package/build/components/editor/markdown/erase.d.ts +9 -0
- package/build/components/editor/markdown/erase.js +78 -0
- package/build/components/editor/markdown/index.d.ts +0 -1
- package/build/components/editor/markdown/index.js +0 -1
- package/build/components/editor/markdown/layout.d.ts +2 -9
- package/build/components/editor/markdown/layout.js +2 -7
- package/build/components/editor/markdown/render.d.ts +0 -1
- package/build/components/editor/markdown/render.js +287 -235
- package/build/components/editor/markdown/view.js +566 -667
- package/build/components/editor/viewer/index.d.ts +27 -0
- package/build/components/editor/viewer/index.js +250 -0
- package/build/components/editor/viewer/model.d.ts +15 -0
- package/build/components/editor/viewer/model.js +73 -0
- package/build/components/editor/workspace/index.d.ts +6 -2
- package/build/components/editor/workspace/index.js +243 -137
- package/build/components/editor/workspace/keybindings.d.ts +37 -0
- package/build/components/editor/workspace/keybindings.js +288 -0
- package/build/components/editor/workspace/model.d.ts +55 -2
- package/build/components/editor/workspace/model.js +141 -3
- package/build/components/editor/workspace/navigate.d.ts +19 -0
- package/build/components/editor/workspace/navigate.js +118 -0
- package/build/components/editor/workspace/session.d.ts +29 -0
- package/build/components/editor/workspace/session.js +373 -0
- package/build/components/editor/workspace/shortcuts.d.ts +19 -0
- package/build/components/editor/workspace/shortcuts.js +185 -0
- package/build/components/editor/workspace/status.d.ts +34 -0
- package/build/components/editor/workspace/status.js +193 -0
- package/build/components/editor/workspace/statusbar.d.ts +15 -0
- package/build/components/editor/workspace/statusbar.js +190 -0
- package/build/components/editor/workspace/strip.d.ts +27 -0
- package/build/components/editor/workspace/strip.js +239 -0
- package/build/components/editor/workspace/tabs.d.ts +15 -0
- package/build/components/editor/workspace/tabs.js +63 -0
- package/build/components/error/index.js +1 -1
- package/build/components/error/scss/index.scss +1 -1
- package/build/components/filter/index.js +5 -3
- package/build/components/filter/scss/index.scss +1 -1
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/heatmap/index.js +3 -3
- package/build/components/heatmap/scss/index.scss +1 -1
- 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 +2 -0
- package/build/components/index.js +2 -0
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/input/scss/index.scss +1 -1
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/loading/scss/index.scss +1 -1
- package/build/components/marquee/scss/index.scss +1 -1
- package/build/components/metric/scss/index.scss +1 -1
- package/build/components/nav/index.d.ts +1 -1
- package/build/components/nav/scss/index.scss +1 -1
- package/build/components/nav/tree.d.ts +3 -1
- package/build/components/nav/tree.js +30 -60
- package/build/components/notification/scss/index.scss +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/page/scss/index.scss +1 -1
- package/build/components/pagination/arrows.d.ts +15 -0
- package/build/components/pagination/arrows.js +65 -0
- package/build/components/pagination/cards.d.ts +23 -0
- package/build/components/pagination/cards.js +66 -0
- package/build/components/pagination/index.d.ts +5 -0
- package/build/components/pagination/index.js +3 -1
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/progress/scss/index.scss +1 -1
- package/build/components/pull-to-refresh/scss/index.scss +1 -1
- package/build/components/range/index.js +1 -1
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/relative-time/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/section/scss/index.scss +2 -0
- package/build/components/select/index.d.ts +1 -0
- package/build/components/select/index.js +16 -11
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/shortcut-recorder/scss/index.scss +1 -1
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/sticky-header/index.js +3 -3
- package/build/components/sticky-header/scss/index.scss +1 -1
- package/build/components/story/scss/index.scss +1 -1
- package/build/components/surface-field/scss/index.scss +1 -1
- package/build/components/tasklist/scss/index.scss +1 -1
- package/build/components/text/scss/index.scss +1 -1
- package/build/components/textarea/scss/index.scss +1 -1
- package/build/{css-utilities → components}/theme/index.d.ts +1 -1
- package/build/{css-utilities → components}/theme/index.js +15 -5
- package/build/components/theme/scss/index.scss +2 -0
- package/build/components/theme-picker/index.d.ts +52 -0
- package/build/components/theme-picker/index.js +167 -0
- package/build/components/theme-picker/scss/index.scss +2 -0
- package/build/components/toast/index.js +3 -5
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/tooltip/menu.js +3 -1
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/typewriter/scss/index.scss +1 -1
- package/build/components/uptime/scss/index.scss +1 -1
- package/build/components/usage-meter/scss/index.scss +1 -1
- package/build/{css-utilities → modifiers}/glass/index.d.ts +2 -2
- package/build/modifiers/glass/index.js +28 -0
- package/build/modifiers/glass/scss/index.scss +2 -0
- package/build/{css-utilities → modifiers}/index.d.ts +0 -1
- package/build/{css-utilities → modifiers}/index.js +0 -1
- package/build/modifiers/scrollbar/index.d.ts +72 -0
- package/build/{css-utilities → modifiers}/scrollbar/index.js +52 -19
- package/build/modifiers/scrollbar/scss/index.scss +2 -0
- package/build/normalize/scss/index.scss +1 -2
- package/layer.scss +1 -1
- package/package.json +11 -18
- package/scripts/code-editor-markdown.test.mjs +45 -14
- package/scripts/code-viewer.test.mjs +69 -0
- package/scripts/workspace-keybindings.test.mjs +273 -0
- package/scripts/workspace-session.test.mjs +349 -0
- package/scripts/workspace-status.test.mjs +229 -0
- package/scripts/workspace-tabs.test.mjs +142 -0
- package/src/components/accordion/group.ts +39 -0
- package/src/components/accordion/index.ts +32 -6
- package/src/components/accordion/scss/index.scss +12 -21
- package/src/components/accordion/scss/variables.scss +18 -3
- package/src/components/announcement/scss/index.scss +4 -4
- package/src/components/announcement/scss/variables.scss +6 -6
- package/src/components/banner/scss/index.scss +1 -1
- package/src/components/breadcrumb/scss/index.scss +35 -50
- package/src/components/breadcrumb/scss/variables.scss +23 -31
- package/src/components/button/scss/_fan.scss +39 -43
- package/src/components/button/scss/_morph.scss +66 -78
- package/src/components/button/scss/_sidebar.scss +41 -30
- package/src/components/button/scss/_split.scss +9 -9
- package/src/components/button/scss/index.scss +23 -19
- package/src/components/button/scss/variables.scss +94 -90
- package/src/components/button/sidebar.ts +36 -24
- package/src/components/capslock/index.ts +2 -2
- package/src/components/capslock/scss/index.scss +11 -6
- package/src/components/capslock/scss/variables.scss +3 -5
- package/src/components/card/scss/_expand.scss +58 -64
- package/src/components/card/scss/index.scss +40 -21
- package/src/components/card/scss/variables.scss +40 -31
- package/src/components/cc/scss/index.scss +68 -68
- package/src/components/cc/scss/variables.scss +13 -14
- package/src/components/chat-minimap/scss/index.scss +24 -16
- package/src/components/chat-minimap/scss/variables.scss +37 -37
- package/src/components/checkbox/scss/index.scss +54 -52
- package/src/components/checkbox/scss/variables.scss +37 -39
- package/src/components/color-picker/index.ts +157 -120
- package/src/components/color-picker/scss/index.scss +159 -96
- package/src/components/color-picker/scss/variables.scss +33 -15
- package/src/components/command/index.ts +3 -2
- package/src/components/command/scss/index.scss +10 -14
- package/src/components/command/scss/variables.scss +12 -35
- package/src/components/copy/scss/index.scss +6 -6
- package/src/components/copy/scss/variables.scss +12 -15
- package/src/components/counter/scss/index.scss +14 -14
- package/src/components/counter/scss/variables.scss +1 -1
- package/src/components/datalist/index.ts +3 -3
- package/src/components/datalist/scss/index.scss +7 -6
- package/src/components/datalist/scss/variables.scss +7 -3
- package/src/components/dock/scss/index.scss +10 -15
- package/src/components/dock/scss/variables.scss +29 -25
- package/src/components/editor/code/index.ts +0 -1
- package/src/components/editor/code/minimap.ts +13 -5
- package/src/components/editor/code/scss/_editor.scss +83 -81
- package/src/components/editor/code/scss/_features.scss +106 -97
- package/src/components/editor/code/scss/_services.scss +27 -25
- package/src/components/editor/code/scss/index.scss +0 -1
- package/src/components/editor/code/scss/variables.scss +30 -26
- package/src/components/editor/code/view.ts +14 -5
- package/src/components/editor/diffs/index.ts +0 -1
- package/src/components/editor/diffs/merge.ts +2 -1
- package/src/components/editor/diffs/scss/_diffs.scss +67 -57
- package/src/components/editor/diffs/scss/_merge.scss +17 -14
- package/src/components/editor/diffs/scss/index.scss +0 -1
- package/src/components/editor/diffs/scss/variables.scss +25 -18
- package/src/components/editor/diffs/view.ts +2 -1
- package/src/components/editor/index.ts +7 -1
- package/src/components/editor/markdown/editing.ts +38 -3
- package/src/components/editor/markdown/erase.ts +124 -0
- package/src/components/editor/markdown/index.ts +0 -1
- package/src/components/editor/markdown/layout.ts +3 -12
- package/src/components/editor/markdown/render.ts +65 -37
- package/src/components/editor/markdown/scss/index.scss +92 -124
- package/src/components/editor/markdown/scss/variables.scss +39 -19
- package/src/components/editor/markdown/view.ts +737 -786
- package/src/components/editor/tree/scss/index.scss +121 -110
- package/src/components/editor/tree/scss/variables.scss +48 -54
- package/src/components/editor/viewer/index.ts +321 -0
- package/src/components/editor/viewer/model.ts +130 -0
- package/src/components/editor/viewer/scss/_viewer.scss +302 -0
- package/src/components/editor/viewer/scss/index.scss +2 -0
- package/src/components/editor/viewer/scss/variables.scss +69 -0
- package/src/components/editor/workspace/index.ts +159 -31
- package/src/components/editor/workspace/keybindings.ts +447 -0
- package/src/components/editor/workspace/model.ts +233 -3
- package/src/components/editor/workspace/navigate.ts +194 -0
- package/src/components/editor/workspace/scss/index.scss +72 -59
- package/src/components/editor/workspace/scss/keybindings.scss +190 -0
- package/src/components/editor/workspace/scss/status.scss +122 -0
- package/src/components/editor/workspace/scss/tabs.scss +56 -0
- package/src/components/editor/workspace/session.ts +551 -0
- package/src/components/editor/workspace/shortcuts.ts +255 -0
- package/src/components/editor/workspace/status.ts +259 -0
- package/src/components/editor/workspace/statusbar.ts +255 -0
- package/src/components/editor/workspace/strip.ts +273 -0
- package/src/components/editor/workspace/tabs.ts +106 -0
- package/src/components/error/index.ts +1 -1
- package/src/components/error/scss/index.scss +19 -19
- package/src/components/error/scss/variables.scss +2 -2
- package/src/components/filter/index.ts +7 -2
- package/src/components/filter/scss/index.scss +1 -1
- package/src/components/filter/scss/variables.scss +11 -10
- package/src/components/frame/scss/index.scss +12 -12
- package/src/components/frame/scss/variables.scss +8 -8
- package/src/components/heatmap/index.ts +3 -3
- package/src/components/heatmap/scss/index.scss +28 -26
- package/src/components/heatmap/scss/variables.scss +18 -17
- package/src/components/highlight/scss/index.scss +17 -13
- package/src/components/highlight/scss/variables.scss +8 -10
- package/src/components/icon/scss/index.scss +10 -0
- package/src/components/icon/scss/variables.scss +5 -0
- package/src/components/image/scss/index.scss +9 -9
- package/src/components/image/scss/variables.scss +7 -2
- package/src/components/index.ts +2 -0
- package/src/components/inline-edit/scss/index.scss +99 -104
- package/src/components/inline-edit/scss/variables.scss +40 -39
- package/src/components/input/scss/_field.scss +6 -20
- package/src/components/input/scss/_scrub.scss +10 -8
- package/src/components/input/scss/_tag.scss +35 -37
- package/src/components/input/scss/variables.scss +100 -99
- package/src/components/link/scss/index.scss +4 -1
- package/src/components/loading/scss/index.scss +1 -1
- package/src/components/loading/scss/variables.scss +1 -1
- package/src/components/marquee/scss/index.scss +9 -5
- package/src/components/marquee/scss/variables.scss +3 -1
- package/src/components/metric/scss/_flash.scss +3 -1
- package/src/components/metric/scss/index.scss +8 -6
- package/src/components/metric/scss/variables.scss +26 -20
- package/src/components/nav/index.ts +1 -1
- package/src/components/nav/scss/index.scss +12 -40
- package/src/components/nav/scss/variables.scss +30 -11
- package/src/components/nav/tree.ts +19 -62
- package/src/components/notification/scss/index.scss +7 -7
- package/src/components/notification/scss/variables.scss +7 -9
- package/src/components/overlay/scss/index.scss +181 -170
- package/src/components/overlay/scss/variables.scss +26 -57
- package/src/components/page/scss/index.scss +12 -11
- package/src/components/page/scss/variables.scss +5 -0
- package/src/components/pagination/arrows.ts +58 -0
- package/src/components/pagination/cards.ts +57 -0
- package/src/components/pagination/index.ts +4 -1
- package/src/components/pagination/scss/_arrows.scss +69 -0
- package/src/components/pagination/scss/_cards.scss +121 -0
- package/src/components/pagination/scss/_dots.scss +2 -5
- package/src/components/pagination/scss/index.scss +8 -6
- package/src/components/pagination/scss/variables.scss +87 -37
- package/src/components/progress/scss/_text.scss +21 -18
- package/src/components/progress/scss/index.scss +1 -1
- package/src/components/progress/scss/variables.scss +12 -12
- package/src/components/pull-to-refresh/scss/index.scss +2 -1
- package/src/components/pull-to-refresh/scss/variables.scss +11 -6
- package/src/components/range/index.ts +1 -1
- package/src/components/range/scss/_filter.scss +62 -51
- package/src/components/range/scss/_slider.scss +78 -75
- package/src/components/range/scss/_vertical.scss +6 -6
- package/src/components/range/scss/index.scss +3 -2
- package/src/components/range/scss/variables.scss +26 -23
- package/src/components/relative-time/scss/index.scss +27 -27
- package/src/components/relative-time/scss/variables.scss +10 -12
- package/src/components/root/scss/index.scss +71 -43
- package/src/components/root/scss/variables.scss +35 -31
- package/src/components/section/scss/index.scss +31 -0
- package/src/components/section/scss/variables.scss +21 -0
- package/src/components/select/index.ts +11 -6
- package/src/components/select/scss/index.scss +21 -32
- package/src/components/select/scss/variables.scss +25 -18
- package/src/components/shortcut-recorder/scss/index.scss +13 -12
- package/src/components/shortcut-recorder/scss/variables.scss +12 -13
- package/src/components/sortable/scss/index.scss +47 -44
- package/src/components/sortable/scss/variables.scss +4 -5
- package/src/components/sticky-header/index.ts +4 -4
- package/src/components/sticky-header/scss/index.scss +14 -13
- package/src/components/sticky-header/scss/variables.scss +9 -9
- package/src/components/story/scss/index.scss +26 -30
- package/src/components/story/scss/variables.scss +16 -9
- package/src/components/surface-field/scss/index.scss +45 -40
- package/src/components/surface-field/scss/variables.scss +5 -6
- package/src/components/tasklist/scss/index.scss +19 -19
- package/src/components/tasklist/scss/variables.scss +26 -29
- package/src/components/text/scss/index.scss +2 -1
- package/src/components/textarea/scss/variables.scss +1 -1
- package/src/{css-utilities → components}/theme/index.ts +17 -3
- package/src/components/theme/scss/index.scss +1 -0
- package/src/components/theme/scss/variables.scss +78 -0
- package/src/components/theme-picker/index.ts +231 -0
- package/src/components/theme-picker/scss/index.scss +264 -0
- package/src/components/toast/index.ts +28 -30
- package/src/components/toast/scss/index.scss +87 -87
- package/src/components/toast/scss/variables.scss +39 -39
- package/src/components/tooltip/menu.ts +4 -1
- package/src/components/tooltip/scss/_east.scss +10 -10
- package/src/components/tooltip/scss/_menu.scss +284 -269
- package/src/components/tooltip/scss/_north.scss +10 -10
- package/src/components/tooltip/scss/_shared.scss +7 -7
- package/src/components/tooltip/scss/_south.scss +10 -10
- package/src/components/tooltip/scss/_west.scss +10 -10
- package/src/components/tooltip/scss/index.scss +21 -20
- package/src/components/tooltip/scss/variables.scss +104 -96
- package/src/components/typewriter/scss/_retype.scss +12 -11
- package/src/components/typewriter/scss/_rotate.scss +2 -1
- package/src/components/typewriter/scss/variables.scss +41 -39
- package/src/components/uptime/scss/index.scss +15 -15
- package/src/components/uptime/scss/variables.scss +8 -8
- package/src/components/usage-meter/scss/index.scss +3 -1
- package/src/components/usage-meter/scss/variables.scss +5 -5
- package/src/css-utilities/absolute.scss +64 -0
- package/src/css-utilities/background.scss +43 -0
- package/src/css-utilities/border.scss +45 -0
- package/src/css-utilities/box-shadow.scss +29 -0
- package/src/css-utilities/color.scss +41 -0
- package/src/css-utilities/flex.scss +64 -0
- package/src/css-utilities/font/geist/{scss/index.scss → index.scss} +12 -4
- package/src/css-utilities/font/montserrat/Montserrat-Italic-Variable.woff2 +0 -0
- package/src/css-utilities/font/montserrat/Montserrat-Variable.woff2 +0 -0
- package/src/css-utilities/font/montserrat/OFL.txt +93 -0
- package/src/css-utilities/font/montserrat/index.scss +38 -0
- package/src/{shared/scss → css-utilities}/icon.scss +1 -1
- package/src/css-utilities/{inline/scss/index.scss → inline.scss} +1 -1
- package/src/css-utilities/{skeleton/scss/index.scss → skeleton.scss} +11 -11
- package/src/css-utilities/surface.scss +266 -0
- package/src/css-utilities/text.scss +191 -0
- package/src/modifiers/glass/index.ts +44 -0
- package/src/{css-utilities → modifiers}/glass/scss/index.scss +6 -6
- package/src/{css-utilities → modifiers}/glass/scss/variables.scss +1 -1
- package/src/{css-utilities → modifiers}/index.ts +0 -1
- package/src/{css-utilities → modifiers}/scrollbar/index.ts +92 -17
- package/src/{css-utilities → modifiers}/scrollbar/scss/index.scss +178 -177
- package/src/{css-utilities → modifiers}/scrollbar/scss/variables.scss +28 -21
- package/src/normalize/scss/index.scss +4 -2
- package/src/shared/scss/color-weights.scss +19 -0
- package/src/shared/scss/index.scss +1 -12
- package/src/tokens/scss/blur.scss +5 -0
- package/src/tokens/scss/color.scss +74 -50
- package/src/tokens/scss/index.scss +1 -2
- package/src/tokens/scss/size.scss +0 -2
- package/src/tokens/scss/state.scss +3 -2
- package/src/tokens/scss/transition.scss +19 -2
- package/storage/svg/monitor.svg +1 -0
- package/storage/svg/moon.svg +1 -0
- package/storage/svg/pin.svg +1 -0
- package/storage/svg/sun.svg +1 -0
- package/vite.config.ts +33 -8
- package/build/css-utilities/background/scss/index.scss +0 -2
- package/build/css-utilities/border/scss/index.scss +0 -2
- package/build/css-utilities/color/scss/index.scss +0 -2
- package/build/css-utilities/flex/scss/index.scss +0 -2
- package/build/css-utilities/font/geist/index.d.ts +0 -1
- package/build/css-utilities/font/geist/index.js +0 -1
- package/build/css-utilities/font/geist/scss/index.scss +0 -2
- package/build/css-utilities/font/montserrat/index.d.ts +0 -1
- package/build/css-utilities/font/montserrat/index.js +0 -1
- package/build/css-utilities/font/montserrat/scss/Montserrat-Bold.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Bold.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Italic.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Italic.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Medium.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Medium.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Regular.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-Regular.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
- package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
- package/build/css-utilities/font/montserrat/scss/index.scss +0 -2
- package/build/css-utilities/glass/index.js +0 -26
- package/build/css-utilities/glass/scss/index.scss +0 -2
- package/build/css-utilities/index.scss +0 -2
- package/build/css-utilities/inline/scss/index.scss +0 -2
- package/build/css-utilities/scrollbar/index.d.ts +0 -42
- package/build/css-utilities/scrollbar/scss/index.scss +0 -2
- package/build/css-utilities/skeleton/scss/index.scss +0 -2
- package/build/css-utilities/text/scss/index.scss +0 -2
- package/build/themes/dark/index.d.ts +0 -3
- package/build/themes/dark/index.js +0 -3
- package/build/themes/dark/input.d.ts +0 -3
- package/build/themes/dark/input.js +0 -12
- package/build/themes/dark/select.d.ts +0 -3
- package/build/themes/dark/select.js +0 -23
- package/build/themes/dark/textarea.d.ts +0 -2186
- package/build/themes/dark/textarea.js +0 -11
- package/src/css-utilities/background/scss/index.scss +0 -1
- package/src/css-utilities/background/scss/variables.scss +0 -18
- package/src/css-utilities/border/scss/index.scss +0 -1
- package/src/css-utilities/border/scss/variables.scss +0 -23
- package/src/css-utilities/color/scss/index.scss +0 -1
- package/src/css-utilities/color/scss/variables.scss +0 -17
- package/src/css-utilities/flex/scss/index.scss +0 -57
- package/src/css-utilities/flex/scss/variables.scss +0 -16
- package/src/css-utilities/font/geist/index.ts +0 -1
- package/src/css-utilities/font/montserrat/index.ts +0 -1
- package/src/css-utilities/font/montserrat/scss/Montserrat-Bold.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Bold.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Italic.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Italic.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Medium.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Medium.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Regular.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-Regular.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
- package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
- package/src/css-utilities/font/montserrat/scss/index.scss +0 -94
- package/src/css-utilities/glass/index.ts +0 -42
- package/src/css-utilities/index.scss +0 -13
- package/src/css-utilities/skeleton/scss/variables.scss +0 -3
- package/src/css-utilities/text/scss/index.scss +0 -152
- package/src/css-utilities/text/scss/variables.scss +0 -22
- package/src/shared/scss/absolute.scss +0 -28
- package/src/shared/scss/background.scss +0 -21
- package/src/shared/scss/border.scss +0 -21
- package/src/shared/scss/color.scss +0 -21
- package/src/shared/scss/position.scss +0 -55
- package/src/shared/scss/text.scss +0 -31
- package/src/themes/dark/index.ts +0 -3
- package/src/themes/dark/input.ts +0 -16
- package/src/themes/dark/select.ts +0 -28
- package/src/themes/dark/textarea.ts +0 -13
- package/src/tokens/scss/box-shadow.scss +0 -23
- package/src/tokens/scss/font-family.scss +0 -5
- package/storage/code.md +0 -180
- package/storage/editor-features.md +0 -227
- package/build/css-utilities/font/geist/{scss/Geist-Italic-Variable.woff2 → Geist-Italic-Variable.woff2} +0 -0
- package/build/css-utilities/font/geist/{scss/Geist-Variable.woff2 → Geist-Variable.woff2} +0 -0
- package/build/css-utilities/font/geist/{scss/GeistMono-Italic-Variable.woff2 → GeistMono-Italic-Variable.woff2} +0 -0
- package/build/css-utilities/font/geist/{scss/GeistMono-Variable.woff2 → GeistMono-Variable.woff2} +0 -0
- package/src/{shared/scss → css-utilities}/anchor.scss +6 -6
- package/src/{shared/scss → css-utilities}/drag.scss +0 -0
- package/src/css-utilities/font/geist/{scss/Geist-Italic-Variable.woff2 → Geist-Italic-Variable.woff2} +0 -0
- package/src/css-utilities/font/geist/{scss/Geist-Variable.woff2 → Geist-Variable.woff2} +0 -0
- package/src/css-utilities/font/geist/{scss/GeistMono-Italic-Variable.woff2 → GeistMono-Italic-Variable.woff2} +0 -0
- package/src/css-utilities/font/geist/{scss/GeistMono-Variable.woff2 → GeistMono-Variable.woff2} +0 -0
- package/src/{shared/scss → css-utilities}/hidden.scss +11 -11
- /package/src/{shared/scss → css-utilities}/layer.scss +0 -0
- /package/src/{shared/scss → css-utilities}/reset.scss +0 -0
|
@@ -5,6 +5,7 @@ import './resolve.mjs';
|
|
|
5
5
|
|
|
6
6
|
const { EditorDocument } = await import('../src/components/editor/code/document.ts');
|
|
7
7
|
const { markdownCommand } = await import('../src/components/editor/markdown/editing.ts');
|
|
8
|
+
const { reach, widen } = await import('../src/components/editor/markdown/erase.ts');
|
|
8
9
|
const { sanitize } = await import('../src/components/editor/markdown/html.ts');
|
|
9
10
|
const { clipInline, parseInline, safeUrl } = await import('../src/components/editor/markdown/inline.ts');
|
|
10
11
|
const { arrange, cache, MarkdownLayout, SLICE_LINES, unitStart, WINDOW_LIMIT } = await import(
|
|
@@ -438,28 +439,23 @@ test('folds follow logical blocks; markers only look at neighbours', () => {
|
|
|
438
439
|
assert.equal(foldable(list, list.length - 1, nested.value), false);
|
|
439
440
|
});
|
|
440
441
|
|
|
441
|
-
test('units leave folded blocks out
|
|
442
|
+
test('units leave folded blocks out and keep identity', () => {
|
|
442
443
|
let source = '# A\n\ntext\n\n## B\n\nmore\n\n# C\nend',
|
|
443
444
|
document = new EditorDocument(source),
|
|
444
445
|
blocks = parseMarkdown(document),
|
|
445
446
|
store = cache(),
|
|
446
447
|
fold = foldAt(document, blocks, 0),
|
|
447
|
-
all = arrange(blocks, source, [], store, null
|
|
448
|
-
folded = arrange(blocks, source, [fold], store, null
|
|
448
|
+
all = arrange(blocks, source, [], store, null),
|
|
449
|
+
folded = arrange(blocks, source, [fold], store, null);
|
|
449
450
|
|
|
450
451
|
assert.equal(all.length, blocks.length);
|
|
451
452
|
assert.equal(folded[0].fold, fold);
|
|
452
453
|
assert.ok(folded.every((unit) => unitStart(unit) < fold.from || unitStart(unit) >= fold.to));
|
|
453
454
|
assert.equal(unitStart(folded[1]), source.indexOf('# C'));
|
|
454
455
|
|
|
455
|
-
|
|
456
|
-
active = arrange(blocks, source, [], store, { first: 2, last: 4, unit: field }, null);
|
|
456
|
+
assert.equal(arrange(blocks, source, [], store, null)[5], all[5]);
|
|
457
457
|
|
|
458
|
-
|
|
459
|
-
assert.equal(active[2], field);
|
|
460
|
-
assert.equal(arrange(blocks, source, [], store, null, null)[5], all[5]);
|
|
461
|
-
|
|
462
|
-
let raw = arrange(blocks, source, [], store, null, (index) => index === 2);
|
|
458
|
+
let raw = arrange(blocks, source, [], store, (index) => index === 2);
|
|
463
459
|
|
|
464
460
|
assert.equal(raw[2].raw, true);
|
|
465
461
|
assert.notEqual(raw[2], all[2]);
|
|
@@ -470,7 +466,7 @@ test('variable-height lookup and measurement stay bounded for ten thousand block
|
|
|
470
466
|
blocks = parseMarkdown(document),
|
|
471
467
|
layout = new MarkdownLayout();
|
|
472
468
|
|
|
473
|
-
layout.set(arrange(blocks, document.value, [], cache(), null
|
|
469
|
+
layout.set(arrange(blocks, document.value, [], cache(), null), document.value);
|
|
474
470
|
layout.configure({ charWidth: 8, fontSize: 13, lineHeight: 20, quoteIndent: 10, width: 600 });
|
|
475
471
|
|
|
476
472
|
assert.ok(blocks.length >= 10000);
|
|
@@ -504,7 +500,7 @@ test('large logical blocks draw as bounded slices that cover the whole source',
|
|
|
504
500
|
let source = '```ts\r\n' + Array.from({ length: 5000 }, (_, i) => `const x${i} = ${i};\r\n`).join('') + '```',
|
|
505
501
|
document = new EditorDocument(source),
|
|
506
502
|
blocks = parseMarkdown(document),
|
|
507
|
-
units = arrange(blocks, source, [], cache(), null
|
|
503
|
+
units = arrange(blocks, source, [], cache(), null);
|
|
508
504
|
|
|
509
505
|
assert.equal(blocks.length, 1);
|
|
510
506
|
assert.ok(units.length > 100);
|
|
@@ -515,13 +511,48 @@ test('large logical blocks draw as bounded slices that cover the whole source',
|
|
|
515
511
|
assert.deepEqual(blocksAt(blocks, { end: unitStart(units[90]), start: unitStart(units[90]) }), { first: 0, last: 1 });
|
|
516
512
|
|
|
517
513
|
let line = new EditorDocument('```\n' + 'x'.repeat(20000) + '\n```'),
|
|
518
|
-
lines = arrange(parseMarkdown(line), line.value, [], cache(), null
|
|
514
|
+
lines = arrange(parseMarkdown(line), line.value, [], cache(), null);
|
|
519
515
|
|
|
520
516
|
assert.equal(lines.length, 1);
|
|
521
517
|
|
|
522
518
|
let paragraph = new EditorDocument('y'.repeat(20000)),
|
|
523
|
-
pieces = arrange(parseMarkdown(paragraph), paragraph.value, [], cache(), null
|
|
519
|
+
pieces = arrange(parseMarkdown(paragraph), paragraph.value, [], cache(), null);
|
|
524
520
|
|
|
525
521
|
assert.ok(pieces.length >= 3);
|
|
526
522
|
assert.equal(pieces.map((unit) => unit.rows.map((row) => paragraph.value.slice(row.contentFrom, row.contentTo)).join('')).join(''), paragraph.value);
|
|
527
523
|
});
|
|
524
|
+
|
|
525
|
+
test('deletion takes the visible character past hidden markup, and a line break with the markup around it', () => {
|
|
526
|
+
let text = 'a **b** c',
|
|
527
|
+
spans = [{ from: 0, to: 2 }, { from: 4, to: 5 }, { from: 7, to: 9 }];
|
|
528
|
+
|
|
529
|
+
assert.deepEqual(reach(text, spans, 4, true), { from: 1, to: 2 });
|
|
530
|
+
assert.deepEqual(reach(text, spans, 5, true), { from: 4, to: 5 });
|
|
531
|
+
assert.deepEqual(reach(text, spans, 7, true), { from: 4, to: 5 });
|
|
532
|
+
assert.deepEqual(reach(text, spans, 5, false), { from: 7, to: 8 });
|
|
533
|
+
assert.deepEqual(reach(text, spans, 0, true), null);
|
|
534
|
+
assert.deepEqual(reach(text, spans, 9, false), null);
|
|
535
|
+
|
|
536
|
+
let quote = '> one\n> two',
|
|
537
|
+
rows = [{ from: 2, to: 5 }, { from: 8, to: 11 }];
|
|
538
|
+
|
|
539
|
+
assert.deepEqual(reach(quote, rows, 8, true), { from: 5, to: 8 });
|
|
540
|
+
assert.deepEqual(reach(quote, rows, 5, false), { from: 5, to: 8 });
|
|
541
|
+
assert.deepEqual(reach('x 👍🏽', [{ from: 0, to: 6 }], 6, true), { from: 2, to: 6 });
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
test('a deletion that empties emphasis or code takes its delimiters, outward through nesting', () => {
|
|
545
|
+
let text = 'a **b** c',
|
|
546
|
+
tokens = parseInline(text);
|
|
547
|
+
|
|
548
|
+
assert.deepEqual(widen(text, tokens, 0, { from: 4, to: 5 }), { from: 2, to: 7 });
|
|
549
|
+
assert.deepEqual(widen(text, tokens, 0, { from: 1, to: 2 }), { from: 1, to: 2 });
|
|
550
|
+
|
|
551
|
+
let nested = 'x ***y*** z';
|
|
552
|
+
|
|
553
|
+
assert.deepEqual(widen(nested, parseInline(nested), 0, { from: 5, to: 6 }), { from: 2, to: 9 });
|
|
554
|
+
|
|
555
|
+
let code = 'run ``a`` now';
|
|
556
|
+
|
|
557
|
+
assert.deepEqual(widen(code, parseInline(code), 0, { from: 6, to: 7 }), { from: 4, to: 9 });
|
|
558
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
import './resolve.mjs';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const { hidden, outline } = await import('../src/components/editor/viewer/model.ts');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const SOURCE = [
|
|
10
|
+
'export function apply(element) {',
|
|
11
|
+
' for (let key of keys) {',
|
|
12
|
+
" element.style.setProperty(key, '<b>');",
|
|
13
|
+
' }',
|
|
14
|
+
'}',
|
|
15
|
+
''
|
|
16
|
+
].join('\n');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
test('outline highlights each line and escapes markup', () => {
|
|
20
|
+
let lines = outline(SOURCE, 'typescript');
|
|
21
|
+
|
|
22
|
+
assert.equal(lines.length, 6);
|
|
23
|
+
assert.match(lines[0].html, /^<span class="code-viewer-token--keyword">export<\/span>/);
|
|
24
|
+
assert.match(lines[2].html, /<b>/);
|
|
25
|
+
assert.doesNotMatch(lines[2].html, /<b>/);
|
|
26
|
+
assert.equal(lines[5].html, '');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('outline leaves plain text unhighlighted', () => {
|
|
30
|
+
let lines = outline('pnpm add <pkg>', 'plain');
|
|
31
|
+
|
|
32
|
+
assert.deepEqual(lines, [{ end: -1, html: 'pnpm add <pkg>', text: 'pnpm add <pkg>', tokens: [] }]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('visible whitespace marks each space and tab, inside tokens too, keeping the characters', () => {
|
|
36
|
+
let [line] = outline("\tlet a = 'b c';", 'typescript', { whitespace: true });
|
|
37
|
+
|
|
38
|
+
assert.match(line.html, /^<span class="code-viewer-tab">\t<\/span>/);
|
|
39
|
+
assert.match(line.html, /'b<span class="code-viewer-space"> <\/span>c'/);
|
|
40
|
+
assert.equal(line.html.replace(/<[^>]+>/g, ''), "\tlet a = 'b c';");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('bracket folds hide the body and keep the closing line', () => {
|
|
44
|
+
let lines = outline(SOURCE, 'typescript');
|
|
45
|
+
|
|
46
|
+
assert.equal(lines[0].end, 4);
|
|
47
|
+
assert.equal(lines[1].end, 3);
|
|
48
|
+
assert.equal(lines[2].end, -1);
|
|
49
|
+
assert.deepEqual(hidden(lines, new Set([0])), [false, true, true, true, false, false]);
|
|
50
|
+
assert.deepEqual(hidden(lines, new Set([1])), [false, false, true, false, false, false]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('a fold inside a folded one stays hidden when the outer one opens', () => {
|
|
54
|
+
let lines = outline(SOURCE, 'typescript');
|
|
55
|
+
|
|
56
|
+
assert.deepEqual(hidden(lines, new Set([0, 1])), [false, true, true, true, false, false]);
|
|
57
|
+
assert.deepEqual(hidden(lines, new Set([1])), [false, false, true, false, false, false]);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('without folding no line starts a fold', () => {
|
|
61
|
+
assert.ok(outline(SOURCE, 'typescript', { fold: false }).every((line) => line.end === -1));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('a markdown section at the end hides through the last line', () => {
|
|
65
|
+
let lines = outline('# Title\n\ntext\nmore', 'markdown');
|
|
66
|
+
|
|
67
|
+
assert.equal(lines[0].end, 4);
|
|
68
|
+
assert.deepEqual(hidden(lines, new Set([0])), [false, true, true, true]);
|
|
69
|
+
});
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
import './resolve.mjs';
|
|
4
|
+
const { bind, conflict, declare, fromChord, fromRecorder, label, matches, merge, reset, rows, sanitize, sequence, unassign } =
|
|
5
|
+
await import('../src/components/editor/workspace/keybindings.ts');
|
|
6
|
+
const { COMMANDS, keymap } = await import('../src/components/editor/code/keymap.ts');
|
|
7
|
+
const { EditorWorkspaceModel } = await import('../src/components/editor/workspace/model.ts');
|
|
8
|
+
const { createMemoryWorkspaceHost } = await import('../docs/src/examples/code-editor/fixtures/workspace.ts');
|
|
9
|
+
const find = (list, id) => list.find((row) => row.id === id);
|
|
10
|
+
const key = (key, modifiers = {}) => {
|
|
11
|
+
const event = {
|
|
12
|
+
altKey: false,
|
|
13
|
+
code: '',
|
|
14
|
+
ctrlKey: false,
|
|
15
|
+
defaultPrevented: false,
|
|
16
|
+
isComposing: false,
|
|
17
|
+
key,
|
|
18
|
+
metaKey: false,
|
|
19
|
+
propagationStopped: false,
|
|
20
|
+
shiftKey: false,
|
|
21
|
+
target: null,
|
|
22
|
+
...modifiers,
|
|
23
|
+
preventDefault() {
|
|
24
|
+
event.defaultPrevented = true;
|
|
25
|
+
},
|
|
26
|
+
stopPropagation() {
|
|
27
|
+
event.propagationStopped = true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return event;
|
|
31
|
+
};
|
|
32
|
+
// What the editor's keymap runs for a keydown under these keybindings.
|
|
33
|
+
const runs = (keybindings, event) => keymap(false, keybindings)(event);
|
|
34
|
+
|
|
35
|
+
test('rows list every command with its default chords and source', () => {
|
|
36
|
+
const list = rows({}, false);
|
|
37
|
+
assert.equal(list.length, COMMANDS.length);
|
|
38
|
+
assert.deepEqual(find(list, 'undo'), { builtin: [], chords: ['Mod+z'], id: 'undo', label: 'Undo', user: false });
|
|
39
|
+
assert.deepEqual(find(list, 'selectAllOccurrences').chords, ['Mod+Shift+a', 'Mod+Shift+l']);
|
|
40
|
+
assert.ok(list.every((row) => !row.user));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('bind replaces a command\'s chords and the result drives the editor keymap', () => {
|
|
44
|
+
const next = bind({}, false, 'undo', 'Ctrl+Alt+u');
|
|
45
|
+
assert.deepEqual(next, { 'Mod+Alt+u': 'undo', 'Mod+z': null });
|
|
46
|
+
const row = find(rows(next, false), 'undo');
|
|
47
|
+
assert.deepEqual(row.chords, ['Mod+Alt+u']);
|
|
48
|
+
assert.equal(row.user, true);
|
|
49
|
+
assert.equal(runs(next, key('u', { altKey: true, ctrlKey: true })), 'undo');
|
|
50
|
+
assert.equal(runs(next, key('z', { ctrlKey: true })), null);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('binding a chord back to its default leaves no override behind', () => {
|
|
54
|
+
const moved = bind({}, false, 'undo', 'Mod+Alt+u');
|
|
55
|
+
assert.deepEqual(bind(moved, false, 'undo', 'Mod+z'), {});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('conflicts name the other owner; taking the chord unbinds it from that command only', () => {
|
|
59
|
+
assert.equal(conflict({}, false, 'undo', 'Mod+d'), 'nextOccurrence');
|
|
60
|
+
assert.equal(conflict({}, false, 'undo', 'Mod+z'), null);
|
|
61
|
+
assert.equal(conflict({}, false, 'undo', 'Mod+Alt+F12'), null);
|
|
62
|
+
const next = bind({}, false, 'undo', 'Mod+d');
|
|
63
|
+
assert.equal(find(rows(next, false), 'nextOccurrence').chords.length, 0);
|
|
64
|
+
assert.equal(find(rows(next, false), 'nextOccurrence').user, true);
|
|
65
|
+
assert.equal(runs(next, key('d', { ctrlKey: true })), 'undo');
|
|
66
|
+
const occurrences = bind({}, false, 'undo', 'Mod+Shift+l');
|
|
67
|
+
assert.deepEqual(find(rows(occurrences, false), 'selectAllOccurrences').chords, ['Mod+Shift+a']);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('unassign removes defaults and user chords; reset restores one command; others keep taken chords', () => {
|
|
71
|
+
const cleared = unassign(bind({}, false, 'redo', 'Mod+Alt+r'), false, 'redo');
|
|
72
|
+
assert.deepEqual(find(rows(cleared, false), 'redo').chords, []);
|
|
73
|
+
assert.deepEqual(cleared, { 'Mod+Shift+z': null, 'Mod+y': null });
|
|
74
|
+
assert.deepEqual(reset(cleared, false, 'redo'), {});
|
|
75
|
+
const taken = bind(bind({}, false, 'undo', 'Mod+d'), false, 'nextOccurrence', 'Mod+Alt+n');
|
|
76
|
+
const restored = reset(taken, false, 'nextOccurrence');
|
|
77
|
+
assert.deepEqual(restored, { 'Mod+d': 'undo', 'Mod+z': null });
|
|
78
|
+
assert.deepEqual(find(rows(restored, false), 'nextOccurrence').chords, []);
|
|
79
|
+
assert.deepEqual(reset(restored, false, 'undo'), {});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('bind leaves keybindings alone for a chord that does not parse', () => {
|
|
83
|
+
const keybindings = { 'Mod+z': null };
|
|
84
|
+
assert.equal(bind(keybindings, false, 'undo', 'Hyper+z'), keybindings);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('recorder values convert to keymap chords and back on both platforms', () => {
|
|
88
|
+
assert.equal(fromRecorder('Mod+Shift+K', false), 'Mod+Shift+k');
|
|
89
|
+
assert.equal(fromRecorder('Mod+Alt+↓', false), 'Mod+Alt+ArrowDown');
|
|
90
|
+
assert.equal(fromRecorder('Mod+↵', false), 'Mod+Enter');
|
|
91
|
+
assert.equal(fromRecorder('Mod+Shift+{', false), 'Mod+Shift+[');
|
|
92
|
+
assert.equal(fromRecorder('Mod++', false), 'Mod++');
|
|
93
|
+
assert.equal(fromRecorder('Ctrl+Alt+Shift+Mod+K', true), 'Mod+Ctrl+Alt+Shift+k');
|
|
94
|
+
assert.equal(fromRecorder('', false), null);
|
|
95
|
+
assert.equal(fromChord('Mod+Alt+ArrowDown', false), 'Mod+Alt+↓');
|
|
96
|
+
assert.equal(fromChord('Mod+Ctrl+Alt+Shift+k', true), 'Ctrl+Alt+Shift+Mod+K');
|
|
97
|
+
assert.equal(fromChord('Mod+Enter', false), 'Mod+↵');
|
|
98
|
+
for (const { keys } of COMMANDS)
|
|
99
|
+
for (const chord of keys)
|
|
100
|
+
for (const apple of [false, true]) {
|
|
101
|
+
const normalized = fromRecorder(fromChord(chord, apple), apple);
|
|
102
|
+
assert.equal(fromRecorder(fromChord(normalized, apple), apple), normalized, chord);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('labels read like the platform writes shortcuts', () => {
|
|
107
|
+
assert.equal(label('Mod+Shift+k', false), 'Ctrl+Shift+K');
|
|
108
|
+
assert.equal(label('Mod+Shift+k', true), '⇧⌘K');
|
|
109
|
+
assert.equal(label('Mod++', false), 'Ctrl++');
|
|
110
|
+
assert.equal(label('Alt+ArrowUp', true), '⌥↑');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('search matches label, command id or chord in any spelling', () => {
|
|
114
|
+
const undo = find(rows({}, false), 'undo');
|
|
115
|
+
for (const query of ['', 'und', 'UNDO', 'mod+z', 'ctrl+z', ' Undo '])
|
|
116
|
+
assert.ok(matches(undo, query, false), query);
|
|
117
|
+
assert.ok(matches(undo, '⌘Z', true));
|
|
118
|
+
assert.ok(!matches(undo, 'redo', false));
|
|
119
|
+
assert.ok(!matches(undo, 'ctrl+y', false));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('sanitize keeps parseable chords bound to known commands or null', () => {
|
|
123
|
+
assert.deepEqual(sanitize({ 'Mod+z': 'undo', 'Mod+q': null, 'Mod+x': 'explode', 'Hyper+z': 'undo', 'Mod+e': 4 }), {
|
|
124
|
+
'Mod+q': null,
|
|
125
|
+
'Mod+z': 'undo'
|
|
126
|
+
});
|
|
127
|
+
for (const value of [undefined, null, 'Mod+z', ['undo'], 4])
|
|
128
|
+
assert.deepEqual(sanitize(value), {});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('merge lays the user keybindings over the editor options and keeps identity when there are none', () => {
|
|
132
|
+
const user = { 'Mod+z': null };
|
|
133
|
+
assert.equal(merge(undefined, user), user);
|
|
134
|
+
assert.deepEqual(merge({ 'Mod+z': 'redo', F2: 'toggleComment' }, user), { 'Mod+z': null, F2: 'toggleComment' });
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('model validates keybindings on load and in setPreferences, keeping the other preferences', async (t) => {
|
|
138
|
+
const host = createMemoryWorkspaceHost({ 'a.ts': 'a' }),
|
|
139
|
+
written = [];
|
|
140
|
+
host.preferences = {
|
|
141
|
+
get: async () => ({ keybindings: { 'Mod+z': 'undo', 'Mod+x': 'bogus', F2: 'toggleComment' }, wrapText: true }),
|
|
142
|
+
set: async (value) => {
|
|
143
|
+
written.push(value);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const model = new EditorWorkspaceModel(host, '/project', { keybindings: { 'Mod+y': 'nope' } });
|
|
147
|
+
t.after(() => model.dispose());
|
|
148
|
+
assert.deepEqual(model.state.preferences.keybindings, {});
|
|
149
|
+
await model.start();
|
|
150
|
+
assert.deepEqual(model.state.preferences.keybindings, { 'Mod+z': 'undo', F2: 'toggleComment' });
|
|
151
|
+
assert.equal(model.state.preferences.wrapText, true);
|
|
152
|
+
const before = model.state.preferences.keybindings;
|
|
153
|
+
model.setPreferences({ showWhitespace: true });
|
|
154
|
+
assert.equal(model.state.preferences.keybindings, before);
|
|
155
|
+
model.setPreferences({ keybindings: { 'Mod+k': 'deleteLine', 'Mod+j': 'unknown' } });
|
|
156
|
+
assert.deepEqual(model.state.preferences.keybindings, { 'Mod+k': 'deleteLine' });
|
|
157
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
158
|
+
assert.deepEqual(written.at(-1).keybindings, { 'Mod+k': 'deleteLine' });
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('sequence waits for the second chord, consumes it, and times out', (t) => {
|
|
162
|
+
t.mock.timers.enable({ apis: ['setTimeout'] });
|
|
163
|
+
let opened = 0,
|
|
164
|
+
accepting = true;
|
|
165
|
+
const states = [],
|
|
166
|
+
chords = sequence({
|
|
167
|
+
accept: () => accepting,
|
|
168
|
+
actions: { 'Mod+s': () => opened++ },
|
|
169
|
+
apple: false,
|
|
170
|
+
onpending: (pending) => states.push(pending),
|
|
171
|
+
prefix: 'Mod+k'
|
|
172
|
+
});
|
|
173
|
+
const plain = key('s', { ctrlKey: true });
|
|
174
|
+
chords.keydown(plain);
|
|
175
|
+
assert.equal(plain.defaultPrevented, false);
|
|
176
|
+
const first = key('k', { ctrlKey: true });
|
|
177
|
+
chords.keydown(first);
|
|
178
|
+
assert.ok(first.defaultPrevented && first.propagationStopped);
|
|
179
|
+
assert.equal(chords.pending(), true);
|
|
180
|
+
chords.keydown(key('Control', { ctrlKey: true }));
|
|
181
|
+
assert.equal(chords.pending(), true);
|
|
182
|
+
const second = key('s', { ctrlKey: true });
|
|
183
|
+
chords.keydown(second);
|
|
184
|
+
assert.ok(second.defaultPrevented && second.propagationStopped);
|
|
185
|
+
assert.equal(opened, 1);
|
|
186
|
+
assert.deepEqual(states, [true, false]);
|
|
187
|
+
chords.keydown(key('k', { ctrlKey: true }));
|
|
188
|
+
const other = key('x');
|
|
189
|
+
chords.keydown(other);
|
|
190
|
+
assert.ok(other.defaultPrevented);
|
|
191
|
+
assert.equal(opened, 1);
|
|
192
|
+
chords.keydown(key('k', { ctrlKey: true }));
|
|
193
|
+
t.mock.timers.tick(1500);
|
|
194
|
+
assert.equal(chords.pending(), false);
|
|
195
|
+
assert.deepEqual(states, [true, false, true, false, true, false]);
|
|
196
|
+
accepting = false;
|
|
197
|
+
const outside = key('k', { ctrlKey: true });
|
|
198
|
+
chords.keydown(outside);
|
|
199
|
+
assert.equal(outside.defaultPrevented, false);
|
|
200
|
+
assert.equal(chords.pending(), false);
|
|
201
|
+
accepting = true;
|
|
202
|
+
chords.keydown(key('k', { metaKey: true }));
|
|
203
|
+
assert.equal(chords.pending(), false);
|
|
204
|
+
const apple = sequence({ accept: () => true, actions: { 'Mod+s': () => opened++ }, apple: true, prefix: 'Mod+k' });
|
|
205
|
+
apple.keydown(key('k', { metaKey: true }));
|
|
206
|
+
apple.keydown(key('s', { metaKey: true }));
|
|
207
|
+
assert.equal(opened, 2);
|
|
208
|
+
chords.keydown(key('k', { ctrlKey: true }));
|
|
209
|
+
chords.cancel();
|
|
210
|
+
assert.equal(chords.pending(), false);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('sequence leaves a prefix it does not accept, and the key after it, untouched', () => {
|
|
214
|
+
let opened = 0;
|
|
215
|
+
const seen = [],
|
|
216
|
+
chords = sequence({
|
|
217
|
+
accept: (event) => {
|
|
218
|
+
seen.push(event.target);
|
|
219
|
+
return event.target === 'inside';
|
|
220
|
+
},
|
|
221
|
+
actions: { 'Mod+s': () => opened++ },
|
|
222
|
+
apple: false,
|
|
223
|
+
onpending: () => assert.fail('no chord should be pending'),
|
|
224
|
+
prefix: 'Mod+k'
|
|
225
|
+
});
|
|
226
|
+
for (const event of [key('k', { ctrlKey: true, target: 'outside' }), key('s', { ctrlKey: true, target: 'outside' }), key('a', { target: 'outside' })]) {
|
|
227
|
+
chords.keydown(event);
|
|
228
|
+
assert.equal(event.defaultPrevented, false);
|
|
229
|
+
assert.equal(event.propagationStopped, false);
|
|
230
|
+
}
|
|
231
|
+
assert.deepEqual(seen, ['outside']);
|
|
232
|
+
assert.equal(chords.pending(), false);
|
|
233
|
+
assert.equal(opened, 0);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('built-in keys show read-only on commands the keymap leaves out, and count as conflicts', () => {
|
|
237
|
+
const list = rows({}, false);
|
|
238
|
+
for (const row of list)
|
|
239
|
+
assert.ok(row.chords.length || row.builtin.length || ['deleteLineEnd', 'splitLine', 'transpose'].includes(row.id), row.id);
|
|
240
|
+
assert.deepEqual(find(list, 'deleteCharacterBackward'), {
|
|
241
|
+
builtin: ['Backspace'],
|
|
242
|
+
chords: [],
|
|
243
|
+
id: 'deleteCharacterBackward',
|
|
244
|
+
label: 'Delete character before',
|
|
245
|
+
user: false
|
|
246
|
+
});
|
|
247
|
+
assert.deepEqual(find(list, 'deleteWordBackward').builtin, ['Mod+Backspace']);
|
|
248
|
+
assert.deepEqual(find(list, 'autocomplete').builtin, ['Mod+ ']);
|
|
249
|
+
assert.deepEqual(find(rows({}, true), 'deleteWordBackward').builtin, ['Alt+Backspace', 'Ctrl+Alt+h']);
|
|
250
|
+
assert.deepEqual(find(rows({}, true), 'deleteLineEnd').builtin, ['Ctrl+k']);
|
|
251
|
+
for (const row of rows({}, true))
|
|
252
|
+
assert.ok(row.chords.length || row.builtin.length, row.id);
|
|
253
|
+
assert.equal(label('Mod+ ', false), 'Ctrl+Space');
|
|
254
|
+
assert.ok(matches(find(list, 'deleteCharacterForward'), 'delete', false));
|
|
255
|
+
assert.ok(matches(find(list, 'autocomplete'), 'ctrl+space', false));
|
|
256
|
+
assert.equal(conflict({}, false, 'undo', 'Backspace'), 'deleteCharacterBackward');
|
|
257
|
+
assert.equal(conflict({}, false, 'deleteCharacterBackward', 'Backspace'), null);
|
|
258
|
+
const taken = bind({}, false, 'undo', 'Mod+Backspace');
|
|
259
|
+
assert.deepEqual(find(rows(taken, false), 'deleteWordBackward').builtin, []);
|
|
260
|
+
assert.equal(find(rows(taken, false), 'deleteWordBackward').user, false);
|
|
261
|
+
const added = bind({}, false, 'deleteCharacterBackward', 'Mod+Alt+b');
|
|
262
|
+
const row = find(rows(added, false), 'deleteCharacterBackward');
|
|
263
|
+
assert.deepEqual([row.chords, row.builtin, row.user], [['Mod+Alt+b'], ['Backspace'], true]);
|
|
264
|
+
assert.deepEqual(unassign(added, false, 'deleteCharacterBackward'), {});
|
|
265
|
+
assert.deepEqual(reset(added, false, 'deleteCharacterBackward'), {});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
test('declare adds both Mod+K forms to aria-keyshortcuts and keeps what is there', () => {
|
|
269
|
+
assert.equal(declare(null, 'Mod+k'), 'Control+K Meta+K');
|
|
270
|
+
assert.equal(declare('', 'Mod+k'), 'Control+K Meta+K');
|
|
271
|
+
assert.equal(declare('Alt+L control+k', 'Mod+k'), 'Alt+L control+k Meta+K');
|
|
272
|
+
assert.equal(declare(declare('F2', 'Mod+k'), 'Mod+k'), 'F2 Control+K Meta+K');
|
|
273
|
+
});
|