@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
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
@use 'css-utilities/background';
|
|
2
|
+
@use 'css-utilities/border';
|
|
3
|
+
@use 'css-utilities/font/geist';
|
|
4
|
+
@use 'css-utilities/surface';
|
|
5
|
+
|
|
6
|
+
|
|
1
7
|
// Shared by the viewer and the merge editor, whose sides reuse the viewer's numbers, code and buttons.
|
|
2
8
|
.diffs,
|
|
3
9
|
.diffs-merge {
|
|
10
|
+
@extend %background-state, %border-state, %font-geist-mono, %surface-raised-level;
|
|
4
11
|
--accent: var(--color-blue-400);
|
|
5
12
|
--accent-color: var(--color-white-300);
|
|
6
13
|
--action-background: var(--background);
|
|
7
14
|
--action-hover-background: var(--hover-background);
|
|
8
15
|
--active-outline: oklch(from var(--color-blue-400) l c h / 0.6);
|
|
9
|
-
--background: var(--
|
|
10
|
-
--bar-background: var(--color-white-400);
|
|
16
|
+
--background-default: var(--surface-background-default);
|
|
11
17
|
--bar-gap: var(--size-200);
|
|
12
18
|
--bar-padding: var(--size-100) var(--size-200);
|
|
13
|
-
--border-color: var(--
|
|
19
|
+
--border-color-default: var(--surface-border-default);
|
|
14
20
|
--border-radius: var(--border-radius-300);
|
|
15
21
|
--border-width: var(--border-width-400);
|
|
16
22
|
--button-icon-size: var(--size-300);
|
|
@@ -25,36 +31,37 @@
|
|
|
25
31
|
--delete-word-background: oklch(from var(--color-red-400) l c h / 0.28);
|
|
26
32
|
--digits: 2;
|
|
27
33
|
--disabled-opacity: 0.45;
|
|
28
|
-
--empty-background: repeating-linear-gradient(-45deg, transparent 0 4px, oklch(from var(--color-
|
|
34
|
+
--empty-background: repeating-linear-gradient(-45deg, transparent 0 4px, oklch(from var(--color-primary-500) l c h / 0.05) 4px 8px);
|
|
29
35
|
--focus-color: var(--color-blue-400);
|
|
30
36
|
--focus-width: var(--border-width-500);
|
|
31
|
-
--font-family: var(--font-family-mono);
|
|
32
37
|
--font-size: var(--font-size-300);
|
|
33
|
-
--function-color: var(--color-purple-300);
|
|
38
|
+
--function-color: light-dark(var(--color-purple-300), oklch(from var(--color-purple-300) 0.8 0.13 h));
|
|
34
39
|
--gap-background: oklch(from var(--color-blue-400) l c h / 0.06);
|
|
35
|
-
--gap-color: var(--color-
|
|
40
|
+
--gap-color: var(--color-primary-300);
|
|
36
41
|
--gap-hover-background: oklch(from var(--color-blue-400) l c h / 0.12);
|
|
37
42
|
--height: 420px;
|
|
38
|
-
--hover-background:
|
|
43
|
+
--hover-background: var(--surface-background-hover);
|
|
44
|
+
// Read where the element's own '--color' is stepping, so its hover can still reach the viewer's text color.
|
|
45
|
+
--hover-color: var(--color);
|
|
39
46
|
--insert-background: oklch(from var(--color-green-500) 60% c h / 0.12);
|
|
40
|
-
--insert-color: oklch(from var(--color-green-500) 50% c h);
|
|
47
|
+
--insert-color: light-dark(oklch(from var(--color-green-500) 50% c h), oklch(from var(--color-green-500) 0.78 0.17 h));
|
|
41
48
|
--insert-word-background: oklch(from var(--color-green-500) 60% c h / 0.3);
|
|
42
|
-
--keyword-color: var(--color-purple-400);
|
|
49
|
+
--keyword-color: light-dark(var(--color-purple-400), oklch(from var(--color-purple-400) 0.75 0.15 h));
|
|
43
50
|
--label-font-size: var(--font-size-200);
|
|
44
51
|
--line-height: var(--size-600);
|
|
45
52
|
--literal-color: var(--number-color);
|
|
46
|
-
--min-height:
|
|
53
|
+
--min-height: var(--spacer-400);
|
|
47
54
|
--muted-color: var(--color-text-300);
|
|
48
|
-
--number-color: var(--color-blue-400);
|
|
55
|
+
--number-color: light-dark(var(--color-blue-400), oklch(from var(--color-blue-400) 0.78 0.12 h));
|
|
49
56
|
--number-width: calc(max(2, var(--digits)) * 1ch + var(--size-200));
|
|
50
57
|
--operator-color: var(--color-text-400);
|
|
51
|
-
--property-color: var(--color-blue-500);
|
|
52
|
-
--regexp-color: var(--color-red-500);
|
|
53
|
-
--selector-color: var(--color-purple-500);
|
|
58
|
+
--property-color: light-dark(var(--color-blue-500), oklch(from var(--color-blue-500) 0.8 0.1 h));
|
|
59
|
+
--regexp-color: light-dark(var(--color-red-500), oklch(from var(--color-red-500) 0.75 0.14 h));
|
|
60
|
+
--selector-color: light-dark(var(--color-purple-500), oklch(from var(--color-purple-500) 0.78 0.13 h));
|
|
54
61
|
--sign-width: 2ch;
|
|
55
|
-
--string-color: oklch(from var(--color-green-500) 45% c h);
|
|
56
|
-
--tag-color: var(--color-red-400);
|
|
57
|
-
--type-color: var(--color-blue-300);
|
|
62
|
+
--string-color: light-dark(oklch(from var(--color-green-500) 45% c h), oklch(from var(--color-green-500) 0.8 0.15 h));
|
|
63
|
+
--tag-color: light-dark(var(--color-red-400), oklch(from var(--color-red-400) 0.72 0.16 h));
|
|
64
|
+
--type-color: light-dark(var(--color-blue-300), oklch(from var(--color-blue-300) 0.76 0.13 h));
|
|
58
65
|
--variable-color: var(--color);
|
|
59
66
|
|
|
60
67
|
@media (forced-colors: active) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { reactive, untrack } from '@esportsplus/reactivity';
|
|
2
2
|
import { component, html, type Attributes, type VirtualSlot } from '@esportsplus/template';
|
|
3
3
|
import icon from '~/components/icon';
|
|
4
|
+
import scrollbar from '~/modifiers/scrollbar';
|
|
4
5
|
import { languageFor, type Language, type Token } from '../code/syntax';
|
|
5
6
|
import { diffTexts, hunks, type Diff, type DiffChange } from './hunks';
|
|
6
7
|
import { highlighter, markup } from './render';
|
|
@@ -454,7 +455,7 @@ export default component(
|
|
|
454
455
|
</button>
|
|
455
456
|
</div>
|
|
456
457
|
</div>
|
|
457
|
-
<div class='diffs-scroller
|
|
458
|
+
<div class='diffs-scroller' tabindex='0' ${scrollbar()}>
|
|
458
459
|
${slot.fragment}
|
|
459
460
|
</div>
|
|
460
461
|
</div>
|
|
@@ -2,6 +2,7 @@ import code from './code';
|
|
|
2
2
|
import diffs from './diffs';
|
|
3
3
|
import markdown from './markdown';
|
|
4
4
|
import tree from './tree';
|
|
5
|
+
import viewer from './viewer';
|
|
5
6
|
import workspace from './workspace';
|
|
6
7
|
|
|
7
8
|
|
|
@@ -10,8 +11,9 @@ const editor: {
|
|
|
10
11
|
diffs: typeof diffs,
|
|
11
12
|
markdown: typeof markdown,
|
|
12
13
|
tree: typeof tree,
|
|
14
|
+
viewer: typeof viewer,
|
|
13
15
|
workspace: typeof workspace
|
|
14
|
-
} = { code, diffs, markdown, tree, workspace };
|
|
16
|
+
} = { code, diffs, markdown, tree, viewer, workspace };
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
export default editor;
|
|
@@ -41,10 +43,12 @@ export type {
|
|
|
41
43
|
} from './diffs';
|
|
42
44
|
export type { MarkdownController, MarkdownEditorAttributes, MarkdownOptions } from './markdown';
|
|
43
45
|
export type * from './tree';
|
|
46
|
+
export type { CodeViewerAttributes } from './viewer';
|
|
44
47
|
export type {
|
|
45
48
|
CodeEditorWorkspaceAttributes,
|
|
46
49
|
CodeEditorWorkspaceController,
|
|
47
50
|
WorkspaceAction,
|
|
51
|
+
WorkspaceCompare,
|
|
48
52
|
WorkspaceConfirmation,
|
|
49
53
|
WorkspaceDecision,
|
|
50
54
|
WorkspaceEditor,
|
|
@@ -54,6 +58,8 @@ export type {
|
|
|
54
58
|
WorkspaceEntry,
|
|
55
59
|
WorkspaceHost,
|
|
56
60
|
WorkspacePreferences,
|
|
61
|
+
WorkspaceSession,
|
|
62
|
+
WorkspaceSessionTab,
|
|
57
63
|
WorkspaceTab,
|
|
58
64
|
WorkspaceTarget
|
|
59
65
|
} from './workspace';
|
|
@@ -9,6 +9,37 @@ type Command = 'backspace' | 'bold' | 'enter' | 'italic';
|
|
|
9
9
|
type KindAt = (offset: number) => Kind | undefined;
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
const FENCE = /^((?: {0,3}>[ \t]?)*) {0,3}(`{3,}|~{3,})[^`]*$/;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Enter at the end of a fence's opening line, when nothing after it closes the fence, adds the closing line too.
|
|
16
|
+
function fence(document: EditorDocument) {
|
|
17
|
+
let { end, start } = document.selection,
|
|
18
|
+
index = document.lineAt(start),
|
|
19
|
+
line = document.lineText(index),
|
|
20
|
+
open = FENCE.exec(line);
|
|
21
|
+
|
|
22
|
+
if (!open || start !== end || start !== document.lineStart(index) + line.length) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let marker = open[2],
|
|
27
|
+
close = new RegExp(`^${open[1]} {0,3}${marker[0] === '`' ? '`' : '~'}{${marker.length},}[ \\t]*$`);
|
|
28
|
+
|
|
29
|
+
for (let i = index + 1, n = document.lineCount; i < n; i++) {
|
|
30
|
+
if (close.test(document.lineText(i))) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let eol = document.eol;
|
|
36
|
+
|
|
37
|
+
return document.replace(start, start, eol + open[1] + eol + open[1] + marker, {
|
|
38
|
+
selection: { start: start + eol.length + open[1].length },
|
|
39
|
+
source: 'markdown-enter'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
12
43
|
function run(document: EditorDocument, command: Command, kind?: KindAt) {
|
|
13
44
|
if (command === 'bold' || command === 'italic') {
|
|
14
45
|
return toggleMarkdown(document, command === 'bold' ? '**' : '*');
|
|
@@ -18,14 +49,18 @@ function run(document: EditorDocument, command: Command, kind?: KindAt) {
|
|
|
18
49
|
return markdownBackspace(document) || deleteCharacter(document, true);
|
|
19
50
|
}
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
let at = kind?.(document.selection.start);
|
|
53
|
+
|
|
54
|
+
if (markdownEnter(document, at) || fence(document)) {
|
|
22
55
|
return true;
|
|
23
56
|
}
|
|
24
57
|
|
|
25
58
|
let { end, start } = document.selection,
|
|
26
|
-
eol = document.eol
|
|
59
|
+
eol = document.eol,
|
|
60
|
+
// A paragraph's line with text ends in a new paragraph; elsewhere Enter breaks the line.
|
|
61
|
+
insert = at === 'paragraph' && document.lineText(document.lineAt(start)).trim() ? eol + eol : eol;
|
|
27
62
|
|
|
28
|
-
return document.replace(start, end,
|
|
63
|
+
return document.replace(start, end, insert, { selection: { start: start + insert.length }, source: 'markdown-enter' });
|
|
29
64
|
}
|
|
30
65
|
|
|
31
66
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Inline } from './inline';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type Span = { from: number; to: number };
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const LINE_BREAK = /[\r\n]/;
|
|
8
|
+
|
|
9
|
+
const WIDTHS: Partial<Record<Inline['kind'], number>> = { em: 1, strike: 2, strong: 2 };
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
let graphemes: Intl.Segmenter | undefined;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Length of the grapheme ending at 'offset' (backward) or starting there, without crossing 'limit'.
|
|
16
|
+
function grapheme(text: string, offset: number, limit: number, backward: boolean) {
|
|
17
|
+
graphemes ??= new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
18
|
+
|
|
19
|
+
let window = backward ? text.slice(Math.max(limit, offset - 16), offset) : text.slice(offset, Math.min(limit, offset + 16)),
|
|
20
|
+
length = 0;
|
|
21
|
+
|
|
22
|
+
for (let { segment } of graphemes.segment(window)) {
|
|
23
|
+
if (!backward) {
|
|
24
|
+
return segment.length;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
length = segment.length;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return length;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// The source a Backspace or Delete at 'offset' removes, from the visible runs of text around it, sorted and absolute.
|
|
35
|
+
// Markup between runs is never deleted alone: the visible character past it goes instead, or for a line break, the
|
|
36
|
+
// break and the markup with it. Null when no run lies on that side.
|
|
37
|
+
const reach = (text: string, spans: readonly Span[], offset: number, backward: boolean): Span | null => {
|
|
38
|
+
let next: Span | null = null,
|
|
39
|
+
previous: Span | null = null;
|
|
40
|
+
|
|
41
|
+
for (let i = 0, n = spans.length; i < n; i++) {
|
|
42
|
+
let span = spans[i];
|
|
43
|
+
|
|
44
|
+
if (span.from === span.to) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (backward ? span.from < offset && offset <= span.to : span.from <= offset && offset < span.to) {
|
|
49
|
+
return backward
|
|
50
|
+
? { from: offset - grapheme(text, offset, span.from, true), to: offset }
|
|
51
|
+
: { from: offset, to: offset + grapheme(text, offset, span.to, false) };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (span.to <= offset) {
|
|
55
|
+
previous = span;
|
|
56
|
+
}
|
|
57
|
+
else if (!next && span.from >= offset) {
|
|
58
|
+
next = span;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (backward) {
|
|
63
|
+
if (!previous) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return LINE_BREAK.test(text.slice(previous.to, offset))
|
|
68
|
+
? { from: previous.to, to: offset }
|
|
69
|
+
: { from: previous.to - grapheme(text, previous.to, previous.from, true), to: previous.to };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!next) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return LINE_BREAK.test(text.slice(offset, next.from))
|
|
77
|
+
? { from: offset, to: next.from }
|
|
78
|
+
: { from: next.from, to: next.from + grapheme(text, next.from, next.to, false) };
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Widens a deletion that empties emphasis, strikethrough or code to take its delimiters, outward through nesting,
|
|
82
|
+
// so none are left behind as text. Token offsets are relative to 'base'.
|
|
83
|
+
const widen = (text: string, tokens: readonly Inline[], base: number, span: Span): Span => {
|
|
84
|
+
let found = true;
|
|
85
|
+
|
|
86
|
+
while (found) {
|
|
87
|
+
found = false;
|
|
88
|
+
|
|
89
|
+
let visit = (list: readonly Inline[]) => {
|
|
90
|
+
for (let i = 0, n = list.length; i < n && !found; i++) {
|
|
91
|
+
let token = list[i];
|
|
92
|
+
|
|
93
|
+
if (base + token.from === span.from && base + token.to === span.to) {
|
|
94
|
+
let width = WIDTHS[token.kind] ?? 0;
|
|
95
|
+
|
|
96
|
+
if (token.kind === 'code') {
|
|
97
|
+
while (text[span.from - width - 1] === '`') {
|
|
98
|
+
width++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (width && span.from - width >= 0) {
|
|
103
|
+
span = { from: span.from - width, to: span.to + width };
|
|
104
|
+
found = true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (token.children && base + token.from <= span.from && span.to <= base + token.to) {
|
|
111
|
+
visit(token.children);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
visit(tokens);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return span;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
export { reach, widen };
|
|
124
|
+
export type { Span };
|
|
@@ -3,7 +3,6 @@ import { component, type Attributes } from '@esportsplus/template';
|
|
|
3
3
|
import { EditorDocument } from '../code/document';
|
|
4
4
|
import { view, type MarkdownController, type MarkdownOptions } from './view';
|
|
5
5
|
import type { Callbacks } from '../code/view';
|
|
6
|
-
import '~/css-utilities/scrollbar/scss/index.scss';
|
|
7
6
|
import '../code/scss/index.scss';
|
|
8
7
|
import './scss/index.scss';
|
|
9
8
|
|
|
@@ -20,8 +20,6 @@ type Metrics = {
|
|
|
20
20
|
// What the surface draws for a block, or a slice of a large one. Units keep their block's identity while its text
|
|
21
21
|
// is unchanged, so their DOM and measured height survive edits elsewhere.
|
|
22
22
|
type Unit = {
|
|
23
|
-
// The editing field, standing in for the blocks under the primary selection.
|
|
24
|
-
active?: boolean;
|
|
25
23
|
block: MarkdownBlock;
|
|
26
24
|
continuation: boolean;
|
|
27
25
|
continues: boolean;
|
|
@@ -166,26 +164,19 @@ function slice(block: MarkdownBlock, text: string, raw: boolean): Unit[] {
|
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
|
|
169
|
-
// The units the surface shows, in order: blocks under a fold are left out and its header stands for it, blocks
|
|
170
|
-
//
|
|
167
|
+
// The units the surface shows, in order: blocks under a fold are left out and its header stands for it, and blocks
|
|
168
|
+
// 'raw' picks show their source.
|
|
171
169
|
const arrange = (
|
|
172
170
|
blocks: readonly MarkdownBlock[],
|
|
173
171
|
text: string,
|
|
174
172
|
folds: readonly FoldRange[],
|
|
175
173
|
cache: Cache,
|
|
176
|
-
active: { first: number; last: number; unit: Unit } | null,
|
|
177
174
|
raw: ((index: number) => boolean) | null
|
|
178
175
|
) => {
|
|
179
176
|
let f = 0,
|
|
180
177
|
out: Unit[] = [];
|
|
181
178
|
|
|
182
179
|
for (let i = 0, n = blocks.length; i < n; i++) {
|
|
183
|
-
if (active && i === active.first) {
|
|
184
|
-
out.push(active.unit);
|
|
185
|
-
i = active.last - 1;
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
180
|
let block = blocks[i];
|
|
190
181
|
|
|
191
182
|
while (f < folds.length && folds[f].to <= block.from) {
|
|
@@ -442,5 +433,5 @@ class MarkdownLayout {
|
|
|
442
433
|
}
|
|
443
434
|
|
|
444
435
|
|
|
445
|
-
export { arrange, cache,
|
|
436
|
+
export { arrange, cache, MarkdownLayout, SLICE_LINES, unitStart, WINDOW_LIMIT };
|
|
446
437
|
export type { Unit };
|
|
@@ -22,8 +22,6 @@ type Host = {
|
|
|
22
22
|
foldable: (unit: Unit) => boolean;
|
|
23
23
|
// Inline markup of a block, offsets relative to its start.
|
|
24
24
|
inline: (block: MarkdownBlock) => readonly Inline[];
|
|
25
|
-
// A press on a unit's text, before the native one does anything.
|
|
26
|
-
press: (e: MouseEvent, unit: Unit) => void;
|
|
27
25
|
readonly: () => boolean;
|
|
28
26
|
// The unit's element connected or left.
|
|
29
27
|
shown: (element: HTMLElement, unit: Unit | null) => void;
|
|
@@ -34,7 +32,10 @@ type Host = {
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
|
|
37
|
-
const
|
|
35
|
+
const CARRIAGE_RETURN = /\r$/;
|
|
36
|
+
|
|
37
|
+
// A fence's opening line: everything up to its info string, which shows and edits as the block's label.
|
|
38
|
+
const FENCE_OPEN = /^[ \t>]*(?:`{3,}|~{3,})/;
|
|
38
39
|
|
|
39
40
|
const ORDERED = /^\d/;
|
|
40
41
|
|
|
@@ -211,6 +212,7 @@ const renderer = (host: Host) => {
|
|
|
211
212
|
<button
|
|
212
213
|
aria-label='Unfold block'
|
|
213
214
|
class='markdown-editor-chip'
|
|
215
|
+
contenteditable='false'
|
|
214
216
|
type='button'
|
|
215
217
|
${{ onclick: () => host.unfold(unit), onmousedown: prevent }}
|
|
216
218
|
>
|
|
@@ -225,20 +227,22 @@ const renderer = (host: Host) => {
|
|
|
225
227
|
case 'blank':
|
|
226
228
|
return html`<br>`;
|
|
227
229
|
case 'code':
|
|
228
|
-
case 'fence':
|
|
229
230
|
return html`
|
|
230
231
|
<pre class='markdown-editor-pre'><code class='markdown-editor-code markdown-editor-code--block'>${plain(block, unit.rows ?? relative(block), view, true)}</code></pre>
|
|
231
232
|
`;
|
|
233
|
+
case 'fence':
|
|
234
|
+
return html`
|
|
235
|
+
<pre class='markdown-editor-pre'>${unit.continuation ? '' : info(block, view)}<code class='markdown-editor-code markdown-editor-code--block'>${plain(block, unit.rows ?? relative(block), view, true)}</code></pre>
|
|
236
|
+
`;
|
|
232
237
|
case 'frontmatter':
|
|
233
238
|
return html`
|
|
234
|
-
<
|
|
235
|
-
frontmatter · ${source.slice(block.contentFrom, block.contentTo).split(EOL).length} lines
|
|
236
|
-
</span>
|
|
239
|
+
<pre class='markdown-editor-pre markdown-editor-frontmatter'><code class='markdown-editor-code markdown-editor-code--block'>${plain(block, lines(source, block.contentFrom, block.contentTo, block.from), view, true)}</code></pre>
|
|
237
240
|
`;
|
|
238
241
|
case 'html':
|
|
239
242
|
parser ??= new DOMParser();
|
|
240
243
|
|
|
241
|
-
|
|
244
|
+
// Rendered HTML has no source to type into; it selects and deletes as a whole.
|
|
245
|
+
return html`<div contenteditable='false'>${safe(sanitizeHtml(source.slice(block.contentFrom, block.contentTo), parser))}</div>`;
|
|
242
246
|
case 'list': {
|
|
243
247
|
let content = marked(block, unit.rows ?? block.lines?.map((row) => relativeRow(block, row)), view);
|
|
244
248
|
|
|
@@ -246,14 +250,17 @@ const renderer = (host: Host) => {
|
|
|
246
250
|
return content;
|
|
247
251
|
}
|
|
248
252
|
|
|
253
|
+
if (block.task) {
|
|
254
|
+
return task(block, block.task.checked, content);
|
|
255
|
+
}
|
|
256
|
+
|
|
249
257
|
return [
|
|
250
|
-
html`<span class='markdown-editor-marker'>${ORDERED.test(block.marker ?? '') ? block.marker : '•'}</span>`,
|
|
251
|
-
block.task ? task(block, block.task.checked) : '',
|
|
258
|
+
html`<span class='markdown-editor-marker' contenteditable='false'>${ORDERED.test(block.marker ?? '') ? block.marker : '•'}</span>`,
|
|
252
259
|
content
|
|
253
260
|
];
|
|
254
261
|
}
|
|
255
262
|
case 'rule':
|
|
256
|
-
return html`<hr class='markdown-editor-rule'>`;
|
|
263
|
+
return html`<hr class='markdown-editor-rule' contenteditable='false'>`;
|
|
257
264
|
default:
|
|
258
265
|
return marked(block, unit.rows ?? block.lines?.map((row) => relativeRow(block, row)), view);
|
|
259
266
|
}
|
|
@@ -294,10 +301,24 @@ const renderer = (host: Host) => {
|
|
|
294
301
|
return out;
|
|
295
302
|
}
|
|
296
303
|
|
|
297
|
-
//
|
|
304
|
+
// A fence's info string, the language label over its code.
|
|
305
|
+
function info(block: MarkdownBlock, view: View) {
|
|
306
|
+
let source = host.text(),
|
|
307
|
+
end = source.indexOf('\n', block.from),
|
|
308
|
+
line = source.slice(block.from, end < 0 ? source.length : end).replace(CARRIAGE_RETURN, ''),
|
|
309
|
+
from = FENCE_OPEN.exec(line)?.[0].length ?? line.length;
|
|
310
|
+
|
|
311
|
+
return html`<span class='markdown-editor-info'>${piece(line.slice(from), block, from, view)}</span>`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Inline markup of rows, joined by line breaks. Without any, a line break gives the caret a line to sit on.
|
|
298
315
|
function marked(block: MarkdownBlock, rows: readonly Row[] | undefined, view: View) {
|
|
299
316
|
let tokens = host.inline(block);
|
|
300
317
|
|
|
318
|
+
if (!tokens.length) {
|
|
319
|
+
return html`<br>`;
|
|
320
|
+
}
|
|
321
|
+
|
|
301
322
|
if (!rows) {
|
|
302
323
|
return inline(tokens, block, view);
|
|
303
324
|
}
|
|
@@ -361,35 +382,41 @@ const renderer = (host: Host) => {
|
|
|
361
382
|
return { contentFrom: row.contentFrom - base, contentTo: row.contentTo - base, from: row.from - base, to: row.to - base };
|
|
362
383
|
}
|
|
363
384
|
|
|
364
|
-
//
|
|
365
|
-
// own
|
|
366
|
-
function task(block: MarkdownBlock, checked: boolean) {
|
|
385
|
+
// A task's checkbox stands in for its bullet, and its label strikes the text through. Toggling redraws the block, so
|
|
386
|
+
// both paint the old state first and then flip, letting their own transitions play.
|
|
387
|
+
function task(block: MarkdownBlock, checked: boolean, content: Renderable<unknown>) {
|
|
367
388
|
let previous = flips.get(block.from),
|
|
368
|
-
animate = previous !== undefined && previous !== checked
|
|
389
|
+
animate = previous !== undefined && previous !== checked,
|
|
390
|
+
state = reactive({ done: animate ? !!previous : checked });
|
|
369
391
|
|
|
370
392
|
flips.delete(block.from);
|
|
371
393
|
|
|
372
|
-
return
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
checked: animate ? previous : checked,
|
|
384
|
-
disabled: () => host.readonly(),
|
|
385
|
-
onclick: (e: MouseEvent) => {
|
|
386
|
-
e.preventDefault();
|
|
387
|
-
flips.set(block.from, checked);
|
|
388
|
-
host.task(block);
|
|
394
|
+
return [
|
|
395
|
+
checkbox({
|
|
396
|
+
class: 'markdown-editor-task',
|
|
397
|
+
contenteditable: 'false',
|
|
398
|
+
onfirstpaint: (element: HTMLElement) => {
|
|
399
|
+
let input = element.querySelector('input');
|
|
400
|
+
|
|
401
|
+
if (animate && input) {
|
|
402
|
+
input.checked = checked;
|
|
403
|
+
state.done = checked;
|
|
404
|
+
}
|
|
389
405
|
},
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
406
|
+
[checkbox.input]: {
|
|
407
|
+
'aria-label': 'Toggle task',
|
|
408
|
+
checked: animate ? previous : checked,
|
|
409
|
+
disabled: () => host.readonly(),
|
|
410
|
+
onclick: (e: MouseEvent) => {
|
|
411
|
+
e.preventDefault();
|
|
412
|
+
flips.set(block.from, checked);
|
|
413
|
+
host.task(block);
|
|
414
|
+
},
|
|
415
|
+
onmousedown: prevent
|
|
416
|
+
}
|
|
417
|
+
}),
|
|
418
|
+
html`<span class='markdown-editor-label' ${{ class: () => state.done && 'markdown-editor-label--done' }}>${content}</span>`
|
|
419
|
+
];
|
|
393
420
|
}
|
|
394
421
|
|
|
395
422
|
return {
|
|
@@ -422,6 +449,7 @@ const renderer = (host: Host) => {
|
|
|
422
449
|
block.quoteDepth ? 'markdown-editor-block--quoted' : '',
|
|
423
450
|
unit.continuation ? 'markdown-editor-block--continuation' : '',
|
|
424
451
|
unit.continues ? 'markdown-editor-block--continues' : '',
|
|
452
|
+
block.task && !unit.continuation ? 'markdown-editor-block--task' : '',
|
|
425
453
|
unit.raw || unit.fold ? 'markdown-editor-block--raw' : ''
|
|
426
454
|
],
|
|
427
455
|
onconnect: (element: HTMLElement) => host.shown(element, unit),
|
|
@@ -432,13 +460,13 @@ const renderer = (host: Host) => {
|
|
|
432
460
|
|
|
433
461
|
host.shown(element, null);
|
|
434
462
|
},
|
|
435
|
-
onmousedown: (e: MouseEvent) => host.press(e, unit),
|
|
436
463
|
style: `--depth: ${block.quoteDepth}; --indent: ${unit.raw ? 0 : block.indent};`
|
|
437
464
|
}}
|
|
438
465
|
>
|
|
439
466
|
<button
|
|
440
467
|
aria-label='${unit.fold ? 'Unfold block' : 'Fold block'}'
|
|
441
468
|
class='markdown-editor-fold'
|
|
469
|
+
contenteditable='false'
|
|
442
470
|
tabindex='-1'
|
|
443
471
|
type='button'
|
|
444
472
|
${{
|