@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.
Files changed (490) hide show
  1. package/README.md +123 -39
  2. package/build/components/accordion/group.d.ts +14 -0
  3. package/build/components/accordion/group.js +21 -0
  4. package/build/components/accordion/index.d.ts +9 -0
  5. package/build/components/accordion/index.js +20 -3
  6. package/build/components/accordion/scss/index.scss +1 -1
  7. package/build/components/announcement/scss/index.scss +1 -1
  8. package/build/components/breadcrumb/scss/index.scss +1 -1
  9. package/build/components/button/scss/index.scss +1 -1
  10. package/build/components/button/sidebar.d.ts +3 -0
  11. package/build/components/button/sidebar.js +40 -10
  12. package/build/components/capslock/index.js +1 -1
  13. package/build/components/capslock/scss/index.scss +1 -1
  14. package/build/components/card/scss/index.scss +1 -1
  15. package/build/components/cc/scss/index.scss +1 -1
  16. package/build/components/chat-minimap/scss/index.scss +1 -1
  17. package/build/components/checkbox/scss/index.scss +1 -1
  18. package/build/components/color-picker/index.d.ts +1 -0
  19. package/build/components/color-picker/index.js +166 -136
  20. package/build/components/color-picker/scss/index.scss +1 -1
  21. package/build/components/command/index.d.ts +0 -1
  22. package/build/components/command/index.js +3 -2
  23. package/build/components/command/scss/index.scss +1 -1
  24. package/build/components/copy/scss/index.scss +1 -1
  25. package/build/components/counter/scss/index.scss +1 -1
  26. package/build/components/datalist/index.js +3 -3
  27. package/build/components/datalist/scss/index.scss +1 -1
  28. package/build/components/dock/scss/index.scss +1 -1
  29. package/build/components/editor/code/index.d.ts +0 -1
  30. package/build/components/editor/code/index.js +0 -1
  31. package/build/components/editor/code/minimap.d.ts +2 -1
  32. package/build/components/editor/code/minimap.js +5 -2
  33. package/build/components/editor/code/view.d.ts +3 -1
  34. package/build/components/editor/code/view.js +37 -26
  35. package/build/components/editor/diffs/index.d.ts +0 -1
  36. package/build/components/editor/diffs/index.js +0 -1
  37. package/build/components/editor/diffs/merge.js +7 -3
  38. package/build/components/editor/diffs/view.js +3 -1
  39. package/build/components/editor/index.d.ts +4 -1
  40. package/build/components/editor/index.js +2 -1
  41. package/build/components/editor/markdown/editing.js +22 -3
  42. package/build/components/editor/markdown/erase.d.ts +9 -0
  43. package/build/components/editor/markdown/erase.js +78 -0
  44. package/build/components/editor/markdown/index.d.ts +0 -1
  45. package/build/components/editor/markdown/index.js +0 -1
  46. package/build/components/editor/markdown/layout.d.ts +2 -9
  47. package/build/components/editor/markdown/layout.js +2 -7
  48. package/build/components/editor/markdown/render.d.ts +0 -1
  49. package/build/components/editor/markdown/render.js +287 -235
  50. package/build/components/editor/markdown/view.js +566 -667
  51. package/build/components/editor/viewer/index.d.ts +27 -0
  52. package/build/components/editor/viewer/index.js +250 -0
  53. package/build/components/editor/viewer/model.d.ts +15 -0
  54. package/build/components/editor/viewer/model.js +73 -0
  55. package/build/components/editor/workspace/index.d.ts +6 -2
  56. package/build/components/editor/workspace/index.js +243 -137
  57. package/build/components/editor/workspace/keybindings.d.ts +37 -0
  58. package/build/components/editor/workspace/keybindings.js +288 -0
  59. package/build/components/editor/workspace/model.d.ts +55 -2
  60. package/build/components/editor/workspace/model.js +141 -3
  61. package/build/components/editor/workspace/navigate.d.ts +19 -0
  62. package/build/components/editor/workspace/navigate.js +118 -0
  63. package/build/components/editor/workspace/session.d.ts +29 -0
  64. package/build/components/editor/workspace/session.js +373 -0
  65. package/build/components/editor/workspace/shortcuts.d.ts +19 -0
  66. package/build/components/editor/workspace/shortcuts.js +185 -0
  67. package/build/components/editor/workspace/status.d.ts +34 -0
  68. package/build/components/editor/workspace/status.js +193 -0
  69. package/build/components/editor/workspace/statusbar.d.ts +15 -0
  70. package/build/components/editor/workspace/statusbar.js +190 -0
  71. package/build/components/editor/workspace/strip.d.ts +27 -0
  72. package/build/components/editor/workspace/strip.js +239 -0
  73. package/build/components/editor/workspace/tabs.d.ts +15 -0
  74. package/build/components/editor/workspace/tabs.js +63 -0
  75. package/build/components/error/index.js +1 -1
  76. package/build/components/error/scss/index.scss +1 -1
  77. package/build/components/filter/index.js +5 -3
  78. package/build/components/filter/scss/index.scss +1 -1
  79. package/build/components/frame/scss/index.scss +1 -1
  80. package/build/components/heatmap/index.js +3 -3
  81. package/build/components/heatmap/scss/index.scss +1 -1
  82. package/build/components/highlight/scss/index.scss +1 -1
  83. package/build/components/icon/scss/index.scss +1 -1
  84. package/build/components/image/scss/index.scss +1 -1
  85. package/build/components/index.d.ts +2 -0
  86. package/build/components/index.js +2 -0
  87. package/build/components/inline-edit/scss/index.scss +1 -1
  88. package/build/components/input/scss/index.scss +1 -1
  89. package/build/components/link/scss/index.scss +1 -1
  90. package/build/components/loading/scss/index.scss +1 -1
  91. package/build/components/marquee/scss/index.scss +1 -1
  92. package/build/components/metric/scss/index.scss +1 -1
  93. package/build/components/nav/index.d.ts +1 -1
  94. package/build/components/nav/scss/index.scss +1 -1
  95. package/build/components/nav/tree.d.ts +3 -1
  96. package/build/components/nav/tree.js +30 -60
  97. package/build/components/notification/scss/index.scss +1 -1
  98. package/build/components/overlay/scss/index.scss +1 -1
  99. package/build/components/page/scss/index.scss +1 -1
  100. package/build/components/pagination/arrows.d.ts +15 -0
  101. package/build/components/pagination/arrows.js +65 -0
  102. package/build/components/pagination/cards.d.ts +23 -0
  103. package/build/components/pagination/cards.js +66 -0
  104. package/build/components/pagination/index.d.ts +5 -0
  105. package/build/components/pagination/index.js +3 -1
  106. package/build/components/pagination/scss/index.scss +1 -1
  107. package/build/components/progress/scss/index.scss +1 -1
  108. package/build/components/pull-to-refresh/scss/index.scss +1 -1
  109. package/build/components/range/index.js +1 -1
  110. package/build/components/range/scss/index.scss +1 -1
  111. package/build/components/relative-time/scss/index.scss +1 -1
  112. package/build/components/root/scss/index.scss +1 -1
  113. package/build/components/section/scss/index.scss +2 -0
  114. package/build/components/select/index.d.ts +1 -0
  115. package/build/components/select/index.js +16 -11
  116. package/build/components/select/scss/index.scss +1 -1
  117. package/build/components/shortcut-recorder/scss/index.scss +1 -1
  118. package/build/components/sortable/scss/index.scss +1 -1
  119. package/build/components/sticky-header/index.js +3 -3
  120. package/build/components/sticky-header/scss/index.scss +1 -1
  121. package/build/components/story/scss/index.scss +1 -1
  122. package/build/components/surface-field/scss/index.scss +1 -1
  123. package/build/components/tasklist/scss/index.scss +1 -1
  124. package/build/components/text/scss/index.scss +1 -1
  125. package/build/components/textarea/scss/index.scss +1 -1
  126. package/build/{css-utilities → components}/theme/index.d.ts +1 -1
  127. package/build/{css-utilities → components}/theme/index.js +15 -5
  128. package/build/components/theme/scss/index.scss +2 -0
  129. package/build/components/theme-picker/index.d.ts +52 -0
  130. package/build/components/theme-picker/index.js +167 -0
  131. package/build/components/theme-picker/scss/index.scss +2 -0
  132. package/build/components/toast/index.js +3 -5
  133. package/build/components/toast/scss/index.scss +1 -1
  134. package/build/components/tooltip/menu.js +3 -1
  135. package/build/components/tooltip/scss/index.scss +1 -1
  136. package/build/components/typewriter/scss/index.scss +1 -1
  137. package/build/components/uptime/scss/index.scss +1 -1
  138. package/build/components/usage-meter/scss/index.scss +1 -1
  139. package/build/{css-utilities → modifiers}/glass/index.d.ts +2 -2
  140. package/build/modifiers/glass/index.js +28 -0
  141. package/build/modifiers/glass/scss/index.scss +2 -0
  142. package/build/{css-utilities → modifiers}/index.d.ts +0 -1
  143. package/build/{css-utilities → modifiers}/index.js +0 -1
  144. package/build/modifiers/scrollbar/index.d.ts +72 -0
  145. package/build/{css-utilities → modifiers}/scrollbar/index.js +52 -19
  146. package/build/modifiers/scrollbar/scss/index.scss +2 -0
  147. package/build/normalize/scss/index.scss +1 -2
  148. package/layer.scss +1 -1
  149. package/package.json +11 -18
  150. package/scripts/code-editor-markdown.test.mjs +45 -14
  151. package/scripts/code-viewer.test.mjs +69 -0
  152. package/scripts/workspace-keybindings.test.mjs +273 -0
  153. package/scripts/workspace-session.test.mjs +349 -0
  154. package/scripts/workspace-status.test.mjs +229 -0
  155. package/scripts/workspace-tabs.test.mjs +142 -0
  156. package/src/components/accordion/group.ts +39 -0
  157. package/src/components/accordion/index.ts +32 -6
  158. package/src/components/accordion/scss/index.scss +12 -21
  159. package/src/components/accordion/scss/variables.scss +18 -3
  160. package/src/components/announcement/scss/index.scss +4 -4
  161. package/src/components/announcement/scss/variables.scss +6 -6
  162. package/src/components/banner/scss/index.scss +1 -1
  163. package/src/components/breadcrumb/scss/index.scss +35 -50
  164. package/src/components/breadcrumb/scss/variables.scss +23 -31
  165. package/src/components/button/scss/_fan.scss +39 -43
  166. package/src/components/button/scss/_morph.scss +66 -78
  167. package/src/components/button/scss/_sidebar.scss +41 -30
  168. package/src/components/button/scss/_split.scss +9 -9
  169. package/src/components/button/scss/index.scss +23 -19
  170. package/src/components/button/scss/variables.scss +94 -90
  171. package/src/components/button/sidebar.ts +36 -24
  172. package/src/components/capslock/index.ts +2 -2
  173. package/src/components/capslock/scss/index.scss +11 -6
  174. package/src/components/capslock/scss/variables.scss +3 -5
  175. package/src/components/card/scss/_expand.scss +58 -64
  176. package/src/components/card/scss/index.scss +40 -21
  177. package/src/components/card/scss/variables.scss +40 -31
  178. package/src/components/cc/scss/index.scss +68 -68
  179. package/src/components/cc/scss/variables.scss +13 -14
  180. package/src/components/chat-minimap/scss/index.scss +24 -16
  181. package/src/components/chat-minimap/scss/variables.scss +37 -37
  182. package/src/components/checkbox/scss/index.scss +54 -52
  183. package/src/components/checkbox/scss/variables.scss +37 -39
  184. package/src/components/color-picker/index.ts +157 -120
  185. package/src/components/color-picker/scss/index.scss +159 -96
  186. package/src/components/color-picker/scss/variables.scss +33 -15
  187. package/src/components/command/index.ts +3 -2
  188. package/src/components/command/scss/index.scss +10 -14
  189. package/src/components/command/scss/variables.scss +12 -35
  190. package/src/components/copy/scss/index.scss +6 -6
  191. package/src/components/copy/scss/variables.scss +12 -15
  192. package/src/components/counter/scss/index.scss +14 -14
  193. package/src/components/counter/scss/variables.scss +1 -1
  194. package/src/components/datalist/index.ts +3 -3
  195. package/src/components/datalist/scss/index.scss +7 -6
  196. package/src/components/datalist/scss/variables.scss +7 -3
  197. package/src/components/dock/scss/index.scss +10 -15
  198. package/src/components/dock/scss/variables.scss +29 -25
  199. package/src/components/editor/code/index.ts +0 -1
  200. package/src/components/editor/code/minimap.ts +13 -5
  201. package/src/components/editor/code/scss/_editor.scss +83 -81
  202. package/src/components/editor/code/scss/_features.scss +106 -97
  203. package/src/components/editor/code/scss/_services.scss +27 -25
  204. package/src/components/editor/code/scss/index.scss +0 -1
  205. package/src/components/editor/code/scss/variables.scss +30 -26
  206. package/src/components/editor/code/view.ts +14 -5
  207. package/src/components/editor/diffs/index.ts +0 -1
  208. package/src/components/editor/diffs/merge.ts +2 -1
  209. package/src/components/editor/diffs/scss/_diffs.scss +67 -57
  210. package/src/components/editor/diffs/scss/_merge.scss +17 -14
  211. package/src/components/editor/diffs/scss/index.scss +0 -1
  212. package/src/components/editor/diffs/scss/variables.scss +25 -18
  213. package/src/components/editor/diffs/view.ts +2 -1
  214. package/src/components/editor/index.ts +7 -1
  215. package/src/components/editor/markdown/editing.ts +38 -3
  216. package/src/components/editor/markdown/erase.ts +124 -0
  217. package/src/components/editor/markdown/index.ts +0 -1
  218. package/src/components/editor/markdown/layout.ts +3 -12
  219. package/src/components/editor/markdown/render.ts +65 -37
  220. package/src/components/editor/markdown/scss/index.scss +92 -124
  221. package/src/components/editor/markdown/scss/variables.scss +39 -19
  222. package/src/components/editor/markdown/view.ts +737 -786
  223. package/src/components/editor/tree/scss/index.scss +121 -110
  224. package/src/components/editor/tree/scss/variables.scss +48 -54
  225. package/src/components/editor/viewer/index.ts +321 -0
  226. package/src/components/editor/viewer/model.ts +130 -0
  227. package/src/components/editor/viewer/scss/_viewer.scss +302 -0
  228. package/src/components/editor/viewer/scss/index.scss +2 -0
  229. package/src/components/editor/viewer/scss/variables.scss +69 -0
  230. package/src/components/editor/workspace/index.ts +159 -31
  231. package/src/components/editor/workspace/keybindings.ts +447 -0
  232. package/src/components/editor/workspace/model.ts +233 -3
  233. package/src/components/editor/workspace/navigate.ts +194 -0
  234. package/src/components/editor/workspace/scss/index.scss +72 -59
  235. package/src/components/editor/workspace/scss/keybindings.scss +190 -0
  236. package/src/components/editor/workspace/scss/status.scss +122 -0
  237. package/src/components/editor/workspace/scss/tabs.scss +56 -0
  238. package/src/components/editor/workspace/session.ts +551 -0
  239. package/src/components/editor/workspace/shortcuts.ts +255 -0
  240. package/src/components/editor/workspace/status.ts +259 -0
  241. package/src/components/editor/workspace/statusbar.ts +255 -0
  242. package/src/components/editor/workspace/strip.ts +273 -0
  243. package/src/components/editor/workspace/tabs.ts +106 -0
  244. package/src/components/error/index.ts +1 -1
  245. package/src/components/error/scss/index.scss +19 -19
  246. package/src/components/error/scss/variables.scss +2 -2
  247. package/src/components/filter/index.ts +7 -2
  248. package/src/components/filter/scss/index.scss +1 -1
  249. package/src/components/filter/scss/variables.scss +11 -10
  250. package/src/components/frame/scss/index.scss +12 -12
  251. package/src/components/frame/scss/variables.scss +8 -8
  252. package/src/components/heatmap/index.ts +3 -3
  253. package/src/components/heatmap/scss/index.scss +28 -26
  254. package/src/components/heatmap/scss/variables.scss +18 -17
  255. package/src/components/highlight/scss/index.scss +17 -13
  256. package/src/components/highlight/scss/variables.scss +8 -10
  257. package/src/components/icon/scss/index.scss +10 -0
  258. package/src/components/icon/scss/variables.scss +5 -0
  259. package/src/components/image/scss/index.scss +9 -9
  260. package/src/components/image/scss/variables.scss +7 -2
  261. package/src/components/index.ts +2 -0
  262. package/src/components/inline-edit/scss/index.scss +99 -104
  263. package/src/components/inline-edit/scss/variables.scss +40 -39
  264. package/src/components/input/scss/_field.scss +6 -20
  265. package/src/components/input/scss/_scrub.scss +10 -8
  266. package/src/components/input/scss/_tag.scss +35 -37
  267. package/src/components/input/scss/variables.scss +100 -99
  268. package/src/components/link/scss/index.scss +4 -1
  269. package/src/components/loading/scss/index.scss +1 -1
  270. package/src/components/loading/scss/variables.scss +1 -1
  271. package/src/components/marquee/scss/index.scss +9 -5
  272. package/src/components/marquee/scss/variables.scss +3 -1
  273. package/src/components/metric/scss/_flash.scss +3 -1
  274. package/src/components/metric/scss/index.scss +8 -6
  275. package/src/components/metric/scss/variables.scss +26 -20
  276. package/src/components/nav/index.ts +1 -1
  277. package/src/components/nav/scss/index.scss +12 -40
  278. package/src/components/nav/scss/variables.scss +30 -11
  279. package/src/components/nav/tree.ts +19 -62
  280. package/src/components/notification/scss/index.scss +7 -7
  281. package/src/components/notification/scss/variables.scss +7 -9
  282. package/src/components/overlay/scss/index.scss +181 -170
  283. package/src/components/overlay/scss/variables.scss +26 -57
  284. package/src/components/page/scss/index.scss +12 -11
  285. package/src/components/page/scss/variables.scss +5 -0
  286. package/src/components/pagination/arrows.ts +58 -0
  287. package/src/components/pagination/cards.ts +57 -0
  288. package/src/components/pagination/index.ts +4 -1
  289. package/src/components/pagination/scss/_arrows.scss +69 -0
  290. package/src/components/pagination/scss/_cards.scss +121 -0
  291. package/src/components/pagination/scss/_dots.scss +2 -5
  292. package/src/components/pagination/scss/index.scss +8 -6
  293. package/src/components/pagination/scss/variables.scss +87 -37
  294. package/src/components/progress/scss/_text.scss +21 -18
  295. package/src/components/progress/scss/index.scss +1 -1
  296. package/src/components/progress/scss/variables.scss +12 -12
  297. package/src/components/pull-to-refresh/scss/index.scss +2 -1
  298. package/src/components/pull-to-refresh/scss/variables.scss +11 -6
  299. package/src/components/range/index.ts +1 -1
  300. package/src/components/range/scss/_filter.scss +62 -51
  301. package/src/components/range/scss/_slider.scss +78 -75
  302. package/src/components/range/scss/_vertical.scss +6 -6
  303. package/src/components/range/scss/index.scss +3 -2
  304. package/src/components/range/scss/variables.scss +26 -23
  305. package/src/components/relative-time/scss/index.scss +27 -27
  306. package/src/components/relative-time/scss/variables.scss +10 -12
  307. package/src/components/root/scss/index.scss +71 -43
  308. package/src/components/root/scss/variables.scss +35 -31
  309. package/src/components/section/scss/index.scss +31 -0
  310. package/src/components/section/scss/variables.scss +21 -0
  311. package/src/components/select/index.ts +11 -6
  312. package/src/components/select/scss/index.scss +21 -32
  313. package/src/components/select/scss/variables.scss +25 -18
  314. package/src/components/shortcut-recorder/scss/index.scss +13 -12
  315. package/src/components/shortcut-recorder/scss/variables.scss +12 -13
  316. package/src/components/sortable/scss/index.scss +47 -44
  317. package/src/components/sortable/scss/variables.scss +4 -5
  318. package/src/components/sticky-header/index.ts +4 -4
  319. package/src/components/sticky-header/scss/index.scss +14 -13
  320. package/src/components/sticky-header/scss/variables.scss +9 -9
  321. package/src/components/story/scss/index.scss +26 -30
  322. package/src/components/story/scss/variables.scss +16 -9
  323. package/src/components/surface-field/scss/index.scss +45 -40
  324. package/src/components/surface-field/scss/variables.scss +5 -6
  325. package/src/components/tasklist/scss/index.scss +19 -19
  326. package/src/components/tasklist/scss/variables.scss +26 -29
  327. package/src/components/text/scss/index.scss +2 -1
  328. package/src/components/textarea/scss/variables.scss +1 -1
  329. package/src/{css-utilities → components}/theme/index.ts +17 -3
  330. package/src/components/theme/scss/index.scss +1 -0
  331. package/src/components/theme/scss/variables.scss +78 -0
  332. package/src/components/theme-picker/index.ts +231 -0
  333. package/src/components/theme-picker/scss/index.scss +264 -0
  334. package/src/components/toast/index.ts +28 -30
  335. package/src/components/toast/scss/index.scss +87 -87
  336. package/src/components/toast/scss/variables.scss +39 -39
  337. package/src/components/tooltip/menu.ts +4 -1
  338. package/src/components/tooltip/scss/_east.scss +10 -10
  339. package/src/components/tooltip/scss/_menu.scss +284 -269
  340. package/src/components/tooltip/scss/_north.scss +10 -10
  341. package/src/components/tooltip/scss/_shared.scss +7 -7
  342. package/src/components/tooltip/scss/_south.scss +10 -10
  343. package/src/components/tooltip/scss/_west.scss +10 -10
  344. package/src/components/tooltip/scss/index.scss +21 -20
  345. package/src/components/tooltip/scss/variables.scss +104 -96
  346. package/src/components/typewriter/scss/_retype.scss +12 -11
  347. package/src/components/typewriter/scss/_rotate.scss +2 -1
  348. package/src/components/typewriter/scss/variables.scss +41 -39
  349. package/src/components/uptime/scss/index.scss +15 -15
  350. package/src/components/uptime/scss/variables.scss +8 -8
  351. package/src/components/usage-meter/scss/index.scss +3 -1
  352. package/src/components/usage-meter/scss/variables.scss +5 -5
  353. package/src/css-utilities/absolute.scss +64 -0
  354. package/src/css-utilities/background.scss +43 -0
  355. package/src/css-utilities/border.scss +45 -0
  356. package/src/css-utilities/box-shadow.scss +29 -0
  357. package/src/css-utilities/color.scss +41 -0
  358. package/src/css-utilities/flex.scss +64 -0
  359. package/src/css-utilities/font/geist/{scss/index.scss → index.scss} +12 -4
  360. package/src/css-utilities/font/montserrat/Montserrat-Italic-Variable.woff2 +0 -0
  361. package/src/css-utilities/font/montserrat/Montserrat-Variable.woff2 +0 -0
  362. package/src/css-utilities/font/montserrat/OFL.txt +93 -0
  363. package/src/css-utilities/font/montserrat/index.scss +38 -0
  364. package/src/{shared/scss → css-utilities}/icon.scss +1 -1
  365. package/src/css-utilities/{inline/scss/index.scss → inline.scss} +1 -1
  366. package/src/css-utilities/{skeleton/scss/index.scss → skeleton.scss} +11 -11
  367. package/src/css-utilities/surface.scss +266 -0
  368. package/src/css-utilities/text.scss +191 -0
  369. package/src/modifiers/glass/index.ts +44 -0
  370. package/src/{css-utilities → modifiers}/glass/scss/index.scss +6 -6
  371. package/src/{css-utilities → modifiers}/glass/scss/variables.scss +1 -1
  372. package/src/{css-utilities → modifiers}/index.ts +0 -1
  373. package/src/{css-utilities → modifiers}/scrollbar/index.ts +92 -17
  374. package/src/{css-utilities → modifiers}/scrollbar/scss/index.scss +178 -177
  375. package/src/{css-utilities → modifiers}/scrollbar/scss/variables.scss +28 -21
  376. package/src/normalize/scss/index.scss +4 -2
  377. package/src/shared/scss/color-weights.scss +19 -0
  378. package/src/shared/scss/index.scss +1 -12
  379. package/src/tokens/scss/blur.scss +5 -0
  380. package/src/tokens/scss/color.scss +74 -50
  381. package/src/tokens/scss/index.scss +1 -2
  382. package/src/tokens/scss/size.scss +0 -2
  383. package/src/tokens/scss/state.scss +3 -2
  384. package/src/tokens/scss/transition.scss +19 -2
  385. package/storage/svg/monitor.svg +1 -0
  386. package/storage/svg/moon.svg +1 -0
  387. package/storage/svg/pin.svg +1 -0
  388. package/storage/svg/sun.svg +1 -0
  389. package/vite.config.ts +33 -8
  390. package/build/css-utilities/background/scss/index.scss +0 -2
  391. package/build/css-utilities/border/scss/index.scss +0 -2
  392. package/build/css-utilities/color/scss/index.scss +0 -2
  393. package/build/css-utilities/flex/scss/index.scss +0 -2
  394. package/build/css-utilities/font/geist/index.d.ts +0 -1
  395. package/build/css-utilities/font/geist/index.js +0 -1
  396. package/build/css-utilities/font/geist/scss/index.scss +0 -2
  397. package/build/css-utilities/font/montserrat/index.d.ts +0 -1
  398. package/build/css-utilities/font/montserrat/index.js +0 -1
  399. package/build/css-utilities/font/montserrat/scss/Montserrat-Bold.woff +0 -0
  400. package/build/css-utilities/font/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  401. package/build/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  402. package/build/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  403. package/build/css-utilities/font/montserrat/scss/Montserrat-Italic.woff +0 -0
  404. package/build/css-utilities/font/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  405. package/build/css-utilities/font/montserrat/scss/Montserrat-Medium.woff +0 -0
  406. package/build/css-utilities/font/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  407. package/build/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  408. package/build/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  409. package/build/css-utilities/font/montserrat/scss/Montserrat-Regular.woff +0 -0
  410. package/build/css-utilities/font/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  411. package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  412. package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  413. package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  414. package/build/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
  415. package/build/css-utilities/font/montserrat/scss/index.scss +0 -2
  416. package/build/css-utilities/glass/index.js +0 -26
  417. package/build/css-utilities/glass/scss/index.scss +0 -2
  418. package/build/css-utilities/index.scss +0 -2
  419. package/build/css-utilities/inline/scss/index.scss +0 -2
  420. package/build/css-utilities/scrollbar/index.d.ts +0 -42
  421. package/build/css-utilities/scrollbar/scss/index.scss +0 -2
  422. package/build/css-utilities/skeleton/scss/index.scss +0 -2
  423. package/build/css-utilities/text/scss/index.scss +0 -2
  424. package/build/themes/dark/index.d.ts +0 -3
  425. package/build/themes/dark/index.js +0 -3
  426. package/build/themes/dark/input.d.ts +0 -3
  427. package/build/themes/dark/input.js +0 -12
  428. package/build/themes/dark/select.d.ts +0 -3
  429. package/build/themes/dark/select.js +0 -23
  430. package/build/themes/dark/textarea.d.ts +0 -2186
  431. package/build/themes/dark/textarea.js +0 -11
  432. package/src/css-utilities/background/scss/index.scss +0 -1
  433. package/src/css-utilities/background/scss/variables.scss +0 -18
  434. package/src/css-utilities/border/scss/index.scss +0 -1
  435. package/src/css-utilities/border/scss/variables.scss +0 -23
  436. package/src/css-utilities/color/scss/index.scss +0 -1
  437. package/src/css-utilities/color/scss/variables.scss +0 -17
  438. package/src/css-utilities/flex/scss/index.scss +0 -57
  439. package/src/css-utilities/flex/scss/variables.scss +0 -16
  440. package/src/css-utilities/font/geist/index.ts +0 -1
  441. package/src/css-utilities/font/montserrat/index.ts +0 -1
  442. package/src/css-utilities/font/montserrat/scss/Montserrat-Bold.woff +0 -0
  443. package/src/css-utilities/font/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  444. package/src/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  445. package/src/css-utilities/font/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  446. package/src/css-utilities/font/montserrat/scss/Montserrat-Italic.woff +0 -0
  447. package/src/css-utilities/font/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  448. package/src/css-utilities/font/montserrat/scss/Montserrat-Medium.woff +0 -0
  449. package/src/css-utilities/font/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  450. package/src/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  451. package/src/css-utilities/font/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  452. package/src/css-utilities/font/montserrat/scss/Montserrat-Regular.woff +0 -0
  453. package/src/css-utilities/font/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  454. package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  455. package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  456. package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  457. package/src/css-utilities/font/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
  458. package/src/css-utilities/font/montserrat/scss/index.scss +0 -94
  459. package/src/css-utilities/glass/index.ts +0 -42
  460. package/src/css-utilities/index.scss +0 -13
  461. package/src/css-utilities/skeleton/scss/variables.scss +0 -3
  462. package/src/css-utilities/text/scss/index.scss +0 -152
  463. package/src/css-utilities/text/scss/variables.scss +0 -22
  464. package/src/shared/scss/absolute.scss +0 -28
  465. package/src/shared/scss/background.scss +0 -21
  466. package/src/shared/scss/border.scss +0 -21
  467. package/src/shared/scss/color.scss +0 -21
  468. package/src/shared/scss/position.scss +0 -55
  469. package/src/shared/scss/text.scss +0 -31
  470. package/src/themes/dark/index.ts +0 -3
  471. package/src/themes/dark/input.ts +0 -16
  472. package/src/themes/dark/select.ts +0 -28
  473. package/src/themes/dark/textarea.ts +0 -13
  474. package/src/tokens/scss/box-shadow.scss +0 -23
  475. package/src/tokens/scss/font-family.scss +0 -5
  476. package/storage/code.md +0 -180
  477. package/storage/editor-features.md +0 -227
  478. package/build/css-utilities/font/geist/{scss/Geist-Italic-Variable.woff2 → Geist-Italic-Variable.woff2} +0 -0
  479. package/build/css-utilities/font/geist/{scss/Geist-Variable.woff2 → Geist-Variable.woff2} +0 -0
  480. package/build/css-utilities/font/geist/{scss/GeistMono-Italic-Variable.woff2 → GeistMono-Italic-Variable.woff2} +0 -0
  481. package/build/css-utilities/font/geist/{scss/GeistMono-Variable.woff2 → GeistMono-Variable.woff2} +0 -0
  482. package/src/{shared/scss → css-utilities}/anchor.scss +6 -6
  483. package/src/{shared/scss → css-utilities}/drag.scss +0 -0
  484. package/src/css-utilities/font/geist/{scss/Geist-Italic-Variable.woff2 → Geist-Italic-Variable.woff2} +0 -0
  485. package/src/css-utilities/font/geist/{scss/Geist-Variable.woff2 → Geist-Variable.woff2} +0 -0
  486. package/src/css-utilities/font/geist/{scss/GeistMono-Italic-Variable.woff2 → GeistMono-Italic-Variable.woff2} +0 -0
  487. package/src/css-utilities/font/geist/{scss/GeistMono-Variable.woff2 → GeistMono-Variable.woff2} +0 -0
  488. package/src/{shared/scss → css-utilities}/hidden.scss +11 -11
  489. /package/src/{shared/scss → css-utilities}/layer.scss +0 -0
  490. /package/src/{shared/scss → css-utilities}/reset.scss +0 -0
@@ -0,0 +1,373 @@
1
+ import { effect, read, root, signal, untrack, write } from '@esportsplus/reactivity';
2
+ import Decorations from '../tree/decorations.js';
3
+ import { containsPath, dirty, workspacePath } from './model.js';
4
+ const DELAY = 500;
5
+ function code(controller) {
6
+ return 'folds' in controller && 'nextChange' in controller;
7
+ }
8
+ function message(error) {
9
+ return (error instanceof Error ? error.message : String(error)).replace(/^Workspace: /, '');
10
+ }
11
+ function numbers(value) {
12
+ return Array.isArray(value) ? value.filter((item) => Number.isFinite(item)) : [];
13
+ }
14
+ function offset(value, length) {
15
+ return Number.isFinite(value) ? Math.max(0, Math.min(length, Math.trunc(value))) : 0;
16
+ }
17
+ function parse(value) {
18
+ if (!value || typeof value !== 'object' || !Array.isArray(value.tabs)) {
19
+ return null;
20
+ }
21
+ let tabs = [];
22
+ for (let i = 0, n = value.tabs.length; i < n; i++) {
23
+ let tab = value.tabs[i];
24
+ if (!tab || typeof tab.path !== 'string') {
25
+ continue;
26
+ }
27
+ tabs.push({
28
+ ...(typeof tab.draft === 'string' ? { draft: tab.draft } : {}),
29
+ folds: numbers(tab.folds),
30
+ path: tab.path,
31
+ pinned: tab.pinned === true,
32
+ preview: tab.preview === true,
33
+ scroll: { left: Math.max(0, Number(tab.scroll?.left) || 0), top: Math.max(0, Number(tab.scroll?.top) || 0) },
34
+ selection: { anchor: Number(tab.selection?.anchor) || 0, head: Number(tab.selection?.head) || 0 }
35
+ });
36
+ }
37
+ return {
38
+ active: typeof value.active === 'string' ? value.active : null,
39
+ explorer: {
40
+ expanded: Array.isArray(value.explorer?.expanded) ? value.explorer.expanded.filter((id) => typeof id === 'string') : [],
41
+ scroll: Math.max(0, Number(value.explorer?.scroll) || 0)
42
+ },
43
+ tabs
44
+ };
45
+ }
46
+ function selection(tab) {
47
+ let { direction, end, start } = tab.document.selection;
48
+ return direction === 'backward' ? { anchor: end, head: start } : { anchor: start, head: end };
49
+ }
50
+ const hosted = (model, current, delay = DELAY) => {
51
+ let baselines = new Map(), disposed = false, documents = new Map(), explorer = {}, folded = new WeakMap(), host = model.host, last = '', marks = new Decorations(), pending = new WeakMap(), problems = new Map(), ready = signal(!host.session), restored = !host.session, restoring, stopProblems, timer, waiters = new Map();
52
+ function capture() {
53
+ let shown = current(), state = model.state, tabs = [];
54
+ for (let i = 0, n = state.tabs.length; i < n; i++) {
55
+ let tab = state.tabs[i];
56
+ if (tab.compare) {
57
+ continue;
58
+ }
59
+ let live = shown?.tab === tab && shown.controller.host?.isConnected ? shown.controller : undefined, item = {
60
+ folds: live && code(live) ? live.folds() : (folded.get(tab) ?? pending.get(tab) ?? []),
61
+ path: tab.path,
62
+ pinned: tab.pinned,
63
+ preview: tab.preview,
64
+ scroll: live ? { left: live.scroller.scrollLeft, top: live.scroller.scrollTop } : { ...tab.scroll },
65
+ selection: selection(tab)
66
+ };
67
+ if (dirty(tab) || tab.missing) {
68
+ item.draft = tab.document.value;
69
+ }
70
+ tabs.push(item);
71
+ }
72
+ return {
73
+ active: state.active && !state.active.compare ? state.active.path : null,
74
+ explorer: { expanded: [...(explorer.expanded ?? [])], scroll: explorer.scroll ?? 0 },
75
+ tabs
76
+ };
77
+ }
78
+ async function fetch(path, entry) {
79
+ let cwd = model.state.cwd, request = ++entry.request, text = null;
80
+ try {
81
+ text = await host.baseline(cwd, path);
82
+ }
83
+ catch (error) {
84
+ if (baselines.get(path) === entry) {
85
+ model.status(`Could not read the baseline of ${path}: ${message(error)}`, true);
86
+ }
87
+ }
88
+ if (!disposed && baselines.get(path) === entry && entry.request === request && cwd === model.state.cwd) {
89
+ write(entry.text, typeof text === 'string' ? text : null);
90
+ mark();
91
+ }
92
+ }
93
+ function flush() {
94
+ clearTimeout(timer);
95
+ timer = undefined;
96
+ mark();
97
+ if (!restored || !host.session) {
98
+ return;
99
+ }
100
+ let session = capture(), json = JSON.stringify(session);
101
+ if (json === last) {
102
+ return;
103
+ }
104
+ last = json;
105
+ host.session.set(session).catch((error) => {
106
+ last = '';
107
+ model.status(`Could not save the session: ${message(error)}`, true);
108
+ });
109
+ }
110
+ function mark() {
111
+ let entries = [], tabs = model.state.tabs;
112
+ for (let i = 0, n = tabs.length; i < n; i++) {
113
+ let tab = tabs[i], baseline = baselines.get(tab.path), counts = problems.get(tab), decoration = {}, text = baseline && untrack(() => read(baseline.text));
114
+ if (typeof text === 'string' && text !== tab.document.value) {
115
+ decoration.status = 'modified';
116
+ }
117
+ if (counts?.errors) {
118
+ decoration.errors = counts.errors;
119
+ }
120
+ if (counts?.warnings) {
121
+ decoration.warnings = counts.warnings;
122
+ }
123
+ if (decoration.errors || decoration.status || decoration.warnings) {
124
+ entries.push([tab.path, decoration]);
125
+ }
126
+ }
127
+ marks.replace(entries);
128
+ }
129
+ async function reopen(session) {
130
+ let cwd = model.state.cwd;
131
+ for (let i = 0, n = session.tabs.length; i < n; i++) {
132
+ let item = session.tabs[i], content, path;
133
+ try {
134
+ path = workspacePath(item.path, cwd);
135
+ }
136
+ catch {
137
+ continue;
138
+ }
139
+ try {
140
+ content = await host.read(cwd, path);
141
+ }
142
+ catch {
143
+ content = undefined;
144
+ }
145
+ if (disposed || cwd !== model.state.cwd) {
146
+ return;
147
+ }
148
+ if (content === undefined && item.draft === undefined) {
149
+ continue;
150
+ }
151
+ let tab = model.adopt(path, item.draft ?? content, content ?? '', content === undefined);
152
+ if (!tab) {
153
+ continue;
154
+ }
155
+ let length = tab.document.value.length, anchor = offset(item.selection.anchor, length), head = offset(item.selection.head, length);
156
+ if (item.pinned) {
157
+ model.pin(path);
158
+ }
159
+ else {
160
+ tab.preview = item.preview;
161
+ }
162
+ tab.scroll = { ...item.scroll };
163
+ tab.document.select({ direction: head < anchor ? 'backward' : 'forward', end: Math.max(anchor, head), start: Math.min(anchor, head) });
164
+ if (item.folds.length) {
165
+ pending.set(tab, item.folds);
166
+ }
167
+ }
168
+ if (session.active && !model.state.active && !model.state.opening.length) {
169
+ model.activate(session.active);
170
+ }
171
+ }
172
+ function schedule() {
173
+ clearTimeout(timer);
174
+ timer = setTimeout(flush, delay);
175
+ }
176
+ function settle(tab, controller) {
177
+ let list = waiters.get(tab);
178
+ waiters.delete(tab);
179
+ for (let i = 0, n = list?.length ?? 0; i < n; i++) {
180
+ list[i](controller);
181
+ }
182
+ }
183
+ function sync() {
184
+ let open = new Set(), tabs = model.state.tabs;
185
+ for (let i = 0, n = tabs.length; i < n; i++) {
186
+ let tab = tabs[i];
187
+ open.add(tab.path);
188
+ if (!documents.has(tab)) {
189
+ documents.set(tab, tab.document.subscribe((_, change) => {
190
+ if (change.selectionChanged || change.textChanged) {
191
+ schedule();
192
+ }
193
+ }));
194
+ }
195
+ if (!host.baseline) {
196
+ continue;
197
+ }
198
+ let entry = baselines.get(tab.path);
199
+ if (!entry) {
200
+ track(tab);
201
+ }
202
+ else if (entry.saved !== tab.saved) {
203
+ entry.saved = tab.saved;
204
+ entry.fetched = fetch(tab.path, entry);
205
+ }
206
+ }
207
+ for (let [tab, stop] of documents) {
208
+ if (!tabs.includes(tab)) {
209
+ stop();
210
+ documents.delete(tab);
211
+ problems.delete(tab);
212
+ settle(tab, undefined);
213
+ }
214
+ }
215
+ for (let path of [...baselines.keys()]) {
216
+ if (!open.has(path)) {
217
+ baselines.delete(path);
218
+ }
219
+ }
220
+ schedule();
221
+ }
222
+ function track(tab) {
223
+ let entry = { fetched: Promise.resolve(), request: 0, saved: tab.saved, text: signal(null) };
224
+ baselines.set(tab.path, entry);
225
+ entry.fetched = fetch(tab.path, entry);
226
+ return entry;
227
+ }
228
+ function watched(event) {
229
+ for (let [path, entry] of baselines) {
230
+ if (!event.paths || event.paths.some((changed) => containsPath(changed, path))) {
231
+ entry.fetched = fetch(path, entry);
232
+ }
233
+ }
234
+ }
235
+ return {
236
+ baseline(path) {
237
+ if (!host.baseline) {
238
+ return undefined;
239
+ }
240
+ let entry = baselines.get(path) ?? untrack(() => {
241
+ let tab = model.state.tabs.find((item) => item.path === path);
242
+ return tab && track(tab);
243
+ });
244
+ return entry ? read(entry.text) : null;
245
+ },
246
+ connect(element) {
247
+ let listening = new AbortController(), unsubscribe = model.subscribe(sync), unwatch = model.onWatch(watched);
248
+ element.addEventListener('keyup', schedule, { capture: true, passive: true, signal: listening.signal });
249
+ element.addEventListener('pointerup', schedule, { capture: true, passive: true, signal: listening.signal });
250
+ element.addEventListener('scroll', schedule, { capture: true, passive: true, signal: listening.signal });
251
+ element.ownerDocument.defaultView?.addEventListener('pagehide', flush, { signal: listening.signal });
252
+ sync();
253
+ return () => {
254
+ listening.abort();
255
+ unsubscribe();
256
+ unwatch();
257
+ flush();
258
+ stopProblems?.();
259
+ stopProblems = undefined;
260
+ for (let stop of documents.values()) {
261
+ stop();
262
+ }
263
+ documents.clear();
264
+ };
265
+ },
266
+ dispose() {
267
+ flush();
268
+ disposed = true;
269
+ },
270
+ explorer,
271
+ export: host.export && ((element) => host.export(model.state.cwd, element.id)),
272
+ flush,
273
+ import: host.import && (async (target, entries) => {
274
+ let folder = !target ? '' : target.type === 'file' ? target.id.slice(0, Math.max(0, target.id.lastIndexOf('/'))) : target.id;
275
+ try {
276
+ await host.import(model.state.cwd, folder, entries);
277
+ }
278
+ catch (error) {
279
+ model.status(`Import failed: ${message(error)}`, true);
280
+ return;
281
+ }
282
+ model.status(`Imported ${entries.length === 1 ? entries[0].path : `${entries.length} items`}`);
283
+ await model.refresh();
284
+ }),
285
+ async loaded(path) {
286
+ let entry = baselines.get(path);
287
+ while (entry && baselines.get(path) === entry) {
288
+ let fetched = entry.fetched;
289
+ await fetched;
290
+ if (fetched === entry.fetched) {
291
+ break;
292
+ }
293
+ }
294
+ return entry && baselines.get(path) === entry ? untrack(() => read(entry.text)) : null;
295
+ },
296
+ mark,
297
+ marks,
298
+ ready: () => read(ready),
299
+ remember(tab, controller) {
300
+ if (code(controller)) {
301
+ folded.set(tab, controller.folds());
302
+ }
303
+ },
304
+ restore() {
305
+ if (!host.session || restored) {
306
+ return model.start();
307
+ }
308
+ return restoring ??= (async () => {
309
+ let loading = model.start(), session = null;
310
+ try {
311
+ session = parse(await host.session.get());
312
+ }
313
+ catch (error) {
314
+ model.status(`Could not restore the session: ${message(error)}`, true);
315
+ }
316
+ await loading;
317
+ if (disposed) {
318
+ return;
319
+ }
320
+ if (session) {
321
+ explorer.expanded = session.explorer.expanded;
322
+ explorer.scroll = session.explorer.scroll;
323
+ last = JSON.stringify(session);
324
+ }
325
+ write(ready, true);
326
+ try {
327
+ if (session) {
328
+ await reopen(session);
329
+ }
330
+ }
331
+ finally {
332
+ restored = true;
333
+ }
334
+ })();
335
+ },
336
+ shown(tab, controller) {
337
+ let lines = pending.get(tab);
338
+ pending.delete(tab);
339
+ if (code(controller)) {
340
+ for (let i = 0, n = lines?.length ?? 0; i < n; i++) {
341
+ controller.fold(lines[i]);
342
+ }
343
+ stopProblems?.();
344
+ stopProblems = root((dispose) => {
345
+ effect(() => {
346
+ let { errors, warnings } = controller.state.problems;
347
+ untrack(() => {
348
+ if (current()?.tab === tab) {
349
+ problems.set(tab, { errors, warnings });
350
+ mark();
351
+ }
352
+ });
353
+ });
354
+ return dispose;
355
+ });
356
+ }
357
+ settle(tab, controller);
358
+ },
359
+ whenShown(tab) {
360
+ let shown = current();
361
+ if (shown?.tab === tab) {
362
+ return Promise.resolve(shown.controller);
363
+ }
364
+ return new Promise((resolve) => {
365
+ let list = waiters.get(tab) ?? [];
366
+ list.push(resolve);
367
+ waiters.set(tab, list);
368
+ });
369
+ }
370
+ };
371
+ };
372
+ export default hosted;
373
+ export { parse };
@@ -0,0 +1,19 @@
1
+ import * as template_u1 from '@esportsplus/template';
2
+ import type { Command as PaletteCommand } from '../../command/index.js';
3
+ import { type Keybindings } from './keybindings.js';
4
+ import '../../button/scss/index.scss';
5
+ import './scss/keybindings.scss';
6
+ type A = {
7
+ apple: boolean;
8
+ id: string;
9
+ keybindings: () => Keybindings;
10
+ onchange: (keybindings: Keybindings) => void;
11
+ state: {
12
+ active: boolean;
13
+ };
14
+ };
15
+ declare const OPEN: readonly ['Mod+k', 'Mod+s'];
16
+ declare const PALETTE: PaletteCommand;
17
+ declare const shortcuts: ({ apple, id, keybindings, onchange, state }: A) => template_u1.Renderable<any>;
18
+ export default shortcuts;
19
+ export { OPEN, PALETTE };
@@ -0,0 +1,185 @@
1
+ import * as reactivity_u0 from '@esportsplus/reactivity';
2
+ import { computed, effect, read, signal, untrack, write } from '@esportsplus/reactivity';
3
+ import * as template_u1 from '@esportsplus/template';
4
+ import input from '../../input/index.js';
5
+ import overlay from '../../overlay/index.js';
6
+ import shortcutRecorder from '../../shortcut-recorder/index.js';
7
+ import scrollbar from '../../../modifiers/scrollbar/index.js';
8
+ import { bind, conflict, fromChord, fromRecorder, label, matches, reset, rows, unassign } from './keybindings.js';
9
+ import keyboard from '@esportsplus/ui/svg/keyboard.svg';
10
+ import '../../button/scss/index.scss';
11
+ import './scss/keybindings.scss';
12
+ const template_1xp781n3 = template_u1.template(`<div class='code-workspace-keybindings-row' role='row'><div class='code-workspace-keybindings-command' role='cell'><span class='code-workspace-keybindings-label'></span><span class='code-workspace-keybindings-id'></span></div><div class='code-workspace-keybindings-keys' role='cell'><!--$--><!--$--><!--$--></div><div class='code-workspace-keybindings-source' role='cell'></div><div class='code-workspace-keybindings-actions' role='cell'><button class='button code-workspace-keybindings-button' type='button'> Reset `);
13
+ const template_1xp781ne = template_u1.template(`<kbd class='button button--kbd code-workspace-keybindings-key code-workspace-keybindings-key--builtin' title='Built into the editor and not removable here; a chord bound to another command takes it over'>`);
14
+ const template_1xp781nh = template_u1.template(`<kbd class='button button--kbd code-workspace-keybindings-key'>`);
15
+ const template_1xp781nk = template_u1.template(`<div class='code-workspace-keybindings-conflict' role='alert'><span class='code-workspace-keybindings-conflict-text'><!--$--> is bound to <!--$-->. </span><button class='button code-workspace-keybindings-button code-workspace-keybindings-button--primary' type='button'> Replace </button><button class='button code-workspace-keybindings-button' type='button'> Cancel `);
16
+ const template_1xp781nq = template_u1.template(`<div class='code-workspace-keybindings-header'><h2 class='code-workspace-keybindings-title'>Keyboard Shortcuts</h2><button class='button code-workspace-keybindings-button' type='button'> Reset all </button></div><!--$--><div aria-label='Keybindings' class='code-workspace-keybindings-table' role='table'><div class='code-workspace-keybindings-row code-workspace-keybindings-row--head' role='row'><span role='columnheader'>Command</span><span role='columnheader'>Keybinding</span><span role='columnheader'>Source</span><span role='columnheader'><span class='code-workspace-keybindings-hidden'>Reset</span></span></div><!--$-->`);
17
+ const template_1xp781nw = template_u1.template(`<div class='code-workspace-keybindings-empty' role='status'>No commands match`);
18
+ class ReactiveObject_1xp781n0 extends reactivity_u0.ReactiveObject {
19
+ #query = this[reactivity_u0.SIGNAL]('');
20
+ constructor() {
21
+ super(null);
22
+ }
23
+ get query() {
24
+ return reactivity_u0.read(this.#query);
25
+ }
26
+ set query(_v0) {
27
+ reactivity_u0.write(this.#query, _v0);
28
+ }
29
+ }
30
+ class ReactiveObject_1xp781n1 extends reactivity_u0.ReactiveObject {
31
+ #error = this[reactivity_u0.SIGNAL]('');
32
+ #value;
33
+ constructor(_p0) {
34
+ super(null);
35
+ this.#value = this[reactivity_u0.SIGNAL](_p0);
36
+ }
37
+ get error() {
38
+ return reactivity_u0.read(this.#error);
39
+ }
40
+ set error(_v0) {
41
+ reactivity_u0.write(this.#error, _v0);
42
+ }
43
+ get value() {
44
+ return reactivity_u0.read(this.#value);
45
+ }
46
+ set value(_v1) {
47
+ reactivity_u0.write(this.#value, _v1);
48
+ }
49
+ }
50
+ const OPEN = ['Mod+k', 'Mod+s'];
51
+ const PALETTE = {
52
+ group: 'Preferences',
53
+ icon: keyboard,
54
+ id: 'workspace.keybindings',
55
+ label: 'Open Keyboard Shortcuts'
56
+ };
57
+ const shortcuts = ({ apple, id, keybindings, onchange, state }) => {
58
+ let current = computed(() => rows(keybindings(), apple)), initial = untrack(() => read(current)), names = new Map(initial.map((row) => [row.id, row.label])), pending = signal(undefined), ui = new ReactiveObject_1xp781n0();
59
+ function apply(next) {
60
+ write(pending, undefined);
61
+ onchange(next);
62
+ }
63
+ function confirm() {
64
+ let held = read(pending);
65
+ if (held) {
66
+ onchange(bind(keybindings(), apple, held.command, held.keys));
67
+ }
68
+ write(pending, undefined);
69
+ }
70
+ function shown(row) {
71
+ return row.chords.length ? fromChord(row.chords[0], apple) : '';
72
+ }
73
+ function record(index, value) {
74
+ let row = read(current)[index];
75
+ if (value === shown(row)) {
76
+ return;
77
+ }
78
+ if (!value) {
79
+ apply(unassign(keybindings(), apple, row.id));
80
+ return;
81
+ }
82
+ let keys = fromRecorder(value, apple);
83
+ if (!keys) {
84
+ write(pending, undefined);
85
+ return;
86
+ }
87
+ let owner = conflict(keybindings(), apple, row.id, keys);
88
+ if (owner) {
89
+ write(pending, { command: row.id, keys, owner });
90
+ return;
91
+ }
92
+ apply(bind(keybindings(), apple, row.id, keys));
93
+ }
94
+ function row(info, index) {
95
+ let recorder = new ReactiveObject_1xp781n1(shown(info)), entry = () => read(current)[index], adding = () => !entry().chords.length && entry().builtin.length > 0;
96
+ effect(() => {
97
+ let held = read(pending)?.command === info.id, value = shown(entry());
98
+ if (!held) {
99
+ untrack(() => {
100
+ recorder.value = value;
101
+ });
102
+ }
103
+ });
104
+ effect(() => {
105
+ let value = recorder.value;
106
+ untrack(() => record(index, value));
107
+ });
108
+ return (() => {
109
+ let root_1xp781n2 = template_1xp781n3(), element_1xp781n4 = root_1xp781n2.firstChild, element_1xp781n5 = element_1xp781n4.firstElementChild.firstElementChild, element_1xp781n6 = element_1xp781n5.nextElementSibling, element_1xp781n7 = element_1xp781n4.firstElementChild.nextElementSibling.firstChild, element_1xp781n8 = element_1xp781n7.nextSibling, element_1xp781n9 = element_1xp781n8.nextSibling, element_1xp781na = element_1xp781n4.firstElementChild.nextElementSibling, element_1xp781nb = element_1xp781na.nextElementSibling, element_1xp781nc = element_1xp781nb.nextElementSibling.firstElementChild;
110
+ template_u1.slot(element_1xp781n5, info.label, 1);
111
+ template_u1.slot(element_1xp781n6, info.id, 1);
112
+ new template_u1.EffectSlot(element_1xp781n7, () => entry().builtin.map((keys) => {
113
+ let root_1xp781nd = template_1xp781ne(), element_1xp781nf = root_1xp781nd.firstChild;
114
+ template_u1.slot(element_1xp781nf, label(keys, apple), 1);
115
+ return root_1xp781nd;
116
+ }));
117
+ template_u1.slot(element_1xp781n8, shortcutRecorder({
118
+ 'aria-label': `Keybinding for ${info.label}`,
119
+ class: ['code-workspace-keybindings-recorder', () => adding() && 'code-workspace-keybindings-recorder--add'],
120
+ state: recorder,
121
+ taken: (shortcut) => (fromRecorder(shortcut, apple) === OPEN[0] ? 'the keyboard shortcuts chord' : null),
122
+ title: () => (adding() ? `Add a keybinding for ${info.label}` : undefined)
123
+ }));
124
+ new template_u1.EffectSlot(element_1xp781n9, () => entry().chords.slice(1).map((keys) => {
125
+ let root_1xp781ng = template_1xp781nh(), element_1xp781ni = root_1xp781ng.firstChild;
126
+ template_u1.slot(element_1xp781ni, label(keys, apple), 1);
127
+ return root_1xp781ng;
128
+ }));
129
+ new template_u1.EffectSlot(element_1xp781na, () => {
130
+ let held = read(pending);
131
+ if (held?.command !== info.id) {
132
+ return '';
133
+ }
134
+ return (() => {
135
+ let root_1xp781nj = template_1xp781nk(), element_1xp781nl = root_1xp781nj.firstChild.firstElementChild.firstChild, element_1xp781nm = element_1xp781nl.nextSibling.nextSibling, element_1xp781nn = root_1xp781nj.firstChild.firstElementChild.nextElementSibling, element_1xp781no = element_1xp781nn.nextElementSibling;
136
+ template_u1.slot(element_1xp781nl, label(held.keys, apple));
137
+ template_u1.slot(element_1xp781nm, names.get(held.owner));
138
+ template_u1.delegate(element_1xp781no, 'click', () => write(pending, undefined));
139
+ template_u1.delegate(element_1xp781nn, 'click', confirm);
140
+ return root_1xp781nj;
141
+ })();
142
+ }, 2);
143
+ new template_u1.EffectSlot(element_1xp781nb, () => (entry().user ? 'User' : 'Default'), 1);
144
+ template_u1.setProperty(element_1xp781nc, 'aria-label', `Reset ${info.label}`);
145
+ template_u1.setProperty(element_1xp781nc, 'disabled', () => !entry().user);
146
+ template_u1.delegate(element_1xp781nc, 'click', () => apply(reset(keybindings(), apple, info.id)));
147
+ template_u1.setProperty(element_1xp781n4, 'hidden', () => !matches(entry(), ui.query, apple));
148
+ return root_1xp781n2;
149
+ })();
150
+ }
151
+ effect(() => {
152
+ if (!state.active) {
153
+ untrack(() => write(pending, undefined));
154
+ }
155
+ });
156
+ return overlay({
157
+ 'aria-labelledby': `${id}-keybindings`,
158
+ class: 'card code-workspace-keybindings',
159
+ state
160
+ }, (() => {
161
+ let root_1xp781np = template_1xp781nq(), element_1xp781nr = root_1xp781np.firstChild.firstElementChild, element_1xp781ns = element_1xp781nr.nextElementSibling, element_1xp781nt = root_1xp781np.firstChild.nextSibling, element_1xp781nu = element_1xp781nt.nextSibling, element_1xp781nv = element_1xp781nu.firstChild.nextSibling;
162
+ template_u1.slot(element_1xp781nt, input({
163
+ 'aria-label': 'Search keybindings',
164
+ autocomplete: 'off',
165
+ autofocus: true,
166
+ class: 'code-workspace-keybindings-search',
167
+ oninput: (event) => {
168
+ ui.query = event.target.value;
169
+ },
170
+ placeholder: 'Search by command, id or key',
171
+ spellcheck: false,
172
+ type: 'search',
173
+ value: () => ui.query
174
+ }));
175
+ template_u1.slot(element_1xp781nv, initial.map(row));
176
+ new template_u1.EffectSlot(element_1xp781nu, () => read(current).every((entry) => !matches(entry, ui.query, apple)) && template_1xp781nw(), 2);
177
+ template_u1.setProperties(element_1xp781nu, scrollbar());
178
+ template_u1.setProperty(element_1xp781ns, 'disabled', () => !Object.keys(keybindings()).length);
179
+ template_u1.delegate(element_1xp781ns, 'click', () => apply({}));
180
+ template_u1.setProperty(element_1xp781nr, 'id', template_u1.interpolate([(id), "-keybindings"]));
181
+ return root_1xp781np;
182
+ })());
183
+ };
184
+ export default shortcuts;
185
+ export { OPEN, PALETTE };
@@ -0,0 +1,34 @@
1
+ import type { EditorDocument, Language, Options } from '../code/index.js';
2
+ import type { Status } from '../../inline-edit/status.js';
3
+ import { type EditorWorkspaceModel, type WorkspacePreferences } from './model.js';
4
+ type AutoSaveMode = WorkspacePreferences['autoSave'];
5
+ type Indentation = {
6
+ size: number;
7
+ tabs: boolean;
8
+ };
9
+ type LineEnding = 'crlf' | 'lf';
10
+ declare const AUTO_SAVE_MODES: Record<AutoSaveMode, string>;
11
+ declare const INDENT_SIZES: number[];
12
+ declare const LANGUAGES: Record<Language, string>;
13
+ declare function indentation({ size, tabs }: Indentation): Options;
14
+ declare function indentLabel({ size, tabs }: Indentation): string;
15
+ declare function lineEndings(document: EditorDocument, eol: LineEnding): boolean;
16
+ declare class AutoSave {
17
+ readonly model: EditorWorkspaceModel;
18
+ readonly status: Status;
19
+ private active;
20
+ private mode;
21
+ private pending;
22
+ private tabs;
23
+ private unsubscribe;
24
+ constructor(model: EditorWorkspaceModel);
25
+ private edited;
26
+ private phase;
27
+ private save;
28
+ private sync;
29
+ blur(all?: boolean): void;
30
+ connect(): () => void;
31
+ disconnect(): void;
32
+ }
33
+ export { AUTO_SAVE_MODES, AutoSave, INDENT_SIZES, indentation, indentLabel, LANGUAGES, lineEndings };
34
+ export type { AutoSaveMode, Indentation, LineEnding };