@heycys/gallery 0.0.0-stage → 0.1.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 (785) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/THIRD-PARTY-NOTICES.md +3253 -0
  4. package/assets/writing-preferences.md +107 -0
  5. package/bin/gallery.mjs +10 -0
  6. package/browser/editor/components/bookmark/icons.mjs +6 -0
  7. package/browser/editor/components/bookmark/index.mjs +80 -0
  8. package/browser/editor/components/bookmark/page.mjs +147 -0
  9. package/browser/editor/components/builders.mjs +19 -0
  10. package/browser/editor/components/callout/index.mjs +39 -0
  11. package/browser/editor/components/callout/page.mjs +13 -0
  12. package/browser/editor/components/code/index.mjs +327 -0
  13. package/browser/editor/components/code/page.mjs +561 -0
  14. package/browser/editor/components/colors.mjs +50 -0
  15. package/browser/editor/components/columns/index.mjs +104 -0
  16. package/browser/editor/components/columns/page.mjs +297 -0
  17. package/browser/editor/components/details/index.mjs +72 -0
  18. package/browser/editor/components/details/page.mjs +86 -0
  19. package/browser/editor/components/dialog/index.mjs +83 -0
  20. package/browser/editor/components/dialog/page.mjs +219 -0
  21. package/browser/editor/components/divider/index.mjs +48 -0
  22. package/browser/editor/components/embed/icons.mjs +11 -0
  23. package/browser/editor/components/embed/index.mjs +123 -0
  24. package/browser/editor/components/embed/page.mjs +309 -0
  25. package/browser/editor/components/figure/index.mjs +87 -0
  26. package/browser/editor/components/figure/page.mjs +33 -0
  27. package/browser/editor/components/file/icons.mjs +14 -0
  28. package/browser/editor/components/file/index.mjs +77 -0
  29. package/browser/editor/components/file/page.mjs +114 -0
  30. package/browser/editor/components/flowchart/add.mjs +123 -0
  31. package/browser/editor/components/flowchart/index.mjs +246 -0
  32. package/browser/editor/components/flowchart/page.mjs +453 -0
  33. package/browser/editor/components/heading/index.mjs +51 -0
  34. package/browser/editor/components/highlight/index.mjs +79 -0
  35. package/browser/editor/components/icon/index.mjs +57 -0
  36. package/browser/editor/components/icon/page.mjs +286 -0
  37. package/browser/editor/components/icons.mjs +45 -0
  38. package/browser/editor/components/image/crop.mjs +189 -0
  39. package/browser/editor/components/image/index.mjs +104 -0
  40. package/browser/editor/components/image/page.mjs +385 -0
  41. package/browser/editor/components/image/viewer.mjs +213 -0
  42. package/browser/editor/components/installed/index.mjs +133 -0
  43. package/browser/editor/components/installed/page.mjs +422 -0
  44. package/browser/editor/components/installed/served.mjs +35 -0
  45. package/browser/editor/components/kit.mjs +64 -0
  46. package/browser/editor/components/list/index.mjs +194 -0
  47. package/browser/editor/components/list/join.mjs +68 -0
  48. package/browser/editor/components/list/numbers.mjs +107 -0
  49. package/browser/editor/components/list/page.mjs +632 -0
  50. package/browser/editor/components/math/index.mjs +88 -0
  51. package/browser/editor/components/math/page.mjs +236 -0
  52. package/browser/editor/components/math/tex-logo.mjs +6 -0
  53. package/browser/editor/components/media/icons.mjs +19 -0
  54. package/browser/editor/components/media/page.mjs +162 -0
  55. package/browser/editor/components/media/parts.mjs +60 -0
  56. package/browser/editor/components/media/size.mjs +20 -0
  57. package/browser/editor/components/media/toolbar.mjs +37 -0
  58. package/browser/editor/components/media/write.mjs +7 -0
  59. package/browser/editor/components/pages.mjs +46 -0
  60. package/browser/editor/components/paragraph/index.mjs +43 -0
  61. package/browser/editor/components/paragraph/page.mjs +52 -0
  62. package/browser/editor/components/placeholder-bar.mjs +17 -0
  63. package/browser/editor/components/placeholder.mjs +128 -0
  64. package/browser/editor/components/quote/index.mjs +33 -0
  65. package/browser/editor/components/registry.mjs +833 -0
  66. package/browser/editor/components/rows.mjs +16 -0
  67. package/browser/editor/components/section/index.mjs +41 -0
  68. package/browser/editor/components/section/page.mjs +141 -0
  69. package/browser/editor/components/sheets/index.mjs +137 -0
  70. package/browser/editor/components/sheets/page.mjs +227 -0
  71. package/browser/editor/components/sheets/pills.mjs +226 -0
  72. package/browser/editor/components/table/grid.mjs +73 -0
  73. package/browser/editor/components/table/index.mjs +306 -0
  74. package/browser/editor/components/table/page.mjs +672 -0
  75. package/browser/editor/components/table/slots.mjs +41 -0
  76. package/browser/editor/components/widget/index.mjs +50 -0
  77. package/browser/editor/page/annotate/anchors.mjs +229 -0
  78. package/browser/editor/page/annotate/card.mjs +102 -0
  79. package/browser/editor/page/annotate/index.mjs +1629 -0
  80. package/browser/editor/page/at-menu/index.mjs +317 -0
  81. package/browser/editor/page/autosave.mjs +977 -0
  82. package/browser/editor/page/beside.mjs +21 -0
  83. package/browser/editor/page/block-info.mjs +63 -0
  84. package/browser/editor/page/block-menu/colors.mjs +82 -0
  85. package/browser/editor/page/block-menu/index.mjs +215 -0
  86. package/browser/editor/page/blocks.mjs +246 -0
  87. package/browser/editor/page/caret.mjs +679 -0
  88. package/browser/editor/page/chip-fills.mjs +126 -0
  89. package/browser/editor/page/clipboard/import/colors.mjs +192 -0
  90. package/browser/editor/page/clipboard/import/html.mjs +792 -0
  91. package/browser/editor/page/clipboard/import/inline.mjs +232 -0
  92. package/browser/editor/page/clipboard/import/languages.mjs +42 -0
  93. package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
  94. package/browser/editor/page/clipboard/import/math.mjs +100 -0
  95. package/browser/editor/page/clipboard/import/office.mjs +245 -0
  96. package/browser/editor/page/clipboard/import/read.mjs +120 -0
  97. package/browser/editor/page/clipboard/import/rich.mjs +29 -0
  98. package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
  99. package/browser/editor/page/clipboard/index.mjs +797 -0
  100. package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
  101. package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
  102. package/browser/editor/page/clipboard/own/describe.mjs +115 -0
  103. package/browser/editor/page/clipboard/own/export.mjs +167 -0
  104. package/browser/editor/page/clipboard/own/ids.mjs +39 -0
  105. package/browser/editor/page/clipboard/own/index.mjs +13 -0
  106. package/browser/editor/page/clipboard/own/rules.mjs +44 -0
  107. package/browser/editor/page/clipboard/own/selection.mjs +159 -0
  108. package/browser/editor/page/clipboard/own/writers.mjs +326 -0
  109. package/browser/editor/page/columns/index.mjs +360 -0
  110. package/browser/editor/page/commit.mjs +1798 -0
  111. package/browser/editor/page/conflicts.mjs +269 -0
  112. package/browser/editor/page/convert.mjs +830 -0
  113. package/browser/editor/page/core.mjs +1655 -0
  114. package/browser/editor/page/drag/drop.mjs +307 -0
  115. package/browser/editor/page/drag/index.mjs +335 -0
  116. package/browser/editor/page/drag/preview.mjs +121 -0
  117. package/browser/editor/page/edge-scroll.mjs +50 -0
  118. package/browser/editor/page/editor.mjs +1725 -0
  119. package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
  120. package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
  121. package/browser/editor/page/emoji-picker/grid.mjs +79 -0
  122. package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
  123. package/browser/editor/page/emoji-picker/icons.mjs +32 -0
  124. package/browser/editor/page/emoji-picker/index.mjs +164 -0
  125. package/browser/editor/page/emoji-picker/styles.mjs +2 -0
  126. package/browser/editor/page/emoji-picker/support.mjs +202 -0
  127. package/browser/editor/page/emoji-picker/upload.mjs +235 -0
  128. package/browser/editor/page/export-report.mjs +23 -0
  129. package/browser/editor/page/fills.mjs +60 -0
  130. package/browser/editor/page/find/index.mjs +107 -0
  131. package/browser/editor/page/flags.mjs +70 -0
  132. package/browser/editor/page/format-bar/bar.mjs +448 -0
  133. package/browser/editor/page/format-bar/brush.mjs +77 -0
  134. package/browser/editor/page/format-bar/colors.mjs +46 -0
  135. package/browser/editor/page/format-bar/index.mjs +404 -0
  136. package/browser/editor/page/formula/index.mjs +236 -0
  137. package/browser/editor/page/formula/panel.mjs +336 -0
  138. package/browser/editor/page/formula/symbols.mjs +156 -0
  139. package/browser/editor/page/frame.mjs +74 -0
  140. package/browser/editor/page/frames.mjs +196 -0
  141. package/browser/editor/page/geometry.mjs +400 -0
  142. package/browser/editor/page/gesture.mjs +45 -0
  143. package/browser/editor/page/handle/index.mjs +639 -0
  144. package/browser/editor/page/handle-sizes.mjs +14 -0
  145. package/browser/editor/page/hints/index.mjs +84 -0
  146. package/browser/editor/page/history.mjs +401 -0
  147. package/browser/editor/page/insert/index.mjs +243 -0
  148. package/browser/editor/page/kept.mjs +38 -0
  149. package/browser/editor/page/links/address.mjs +40 -0
  150. package/browser/editor/page/links/index.mjs +866 -0
  151. package/browser/editor/page/links/pages.mjs +131 -0
  152. package/browser/editor/page/links/views.mjs +369 -0
  153. package/browser/editor/page/look.mjs +65 -0
  154. package/browser/editor/page/made.mjs +24 -0
  155. package/browser/editor/page/margin.mjs +352 -0
  156. package/browser/editor/page/markdown/index.mjs +88 -0
  157. package/browser/editor/page/markdown/rules.mjs +33 -0
  158. package/browser/editor/page/marks.mjs +377 -0
  159. package/browser/editor/page/media-menu/index.mjs +158 -0
  160. package/browser/editor/page/menu.mjs +500 -0
  161. package/browser/editor/page/merge.mjs +100 -0
  162. package/browser/editor/page/notices.mjs +142 -0
  163. package/browser/editor/page/offered.mjs +32 -0
  164. package/browser/editor/page/outline/folds.mjs +52 -0
  165. package/browser/editor/page/outline/index.mjs +697 -0
  166. package/browser/editor/page/outline/list.mjs +172 -0
  167. package/browser/editor/page/outline/read.mjs +201 -0
  168. package/browser/editor/page/outline/strip.mjs +281 -0
  169. package/browser/editor/page/outline/tree.mjs +248 -0
  170. package/browser/editor/page/overlay-layer.mjs +227 -0
  171. package/browser/editor/page/overlays.mjs +205 -0
  172. package/browser/editor/page/own.mjs +28 -0
  173. package/browser/editor/page/pads.mjs +71 -0
  174. package/browser/editor/page/page-objects.mjs +105 -0
  175. package/browser/editor/page/panel.mjs +64 -0
  176. package/browser/editor/page/placement.mjs +58 -0
  177. package/browser/editor/page/post.mjs +41 -0
  178. package/browser/editor/page/present-links.mjs +50 -0
  179. package/browser/editor/page/quiet.mjs +48 -0
  180. package/browser/editor/page/resize/index.mjs +327 -0
  181. package/browser/editor/page/select-all/index.mjs +262 -0
  182. package/browser/editor/page/selection/delete.mjs +59 -0
  183. package/browser/editor/page/selection/index.mjs +157 -0
  184. package/browser/editor/page/selection/marquee.mjs +174 -0
  185. package/browser/editor/page/session.mjs +117 -0
  186. package/browser/editor/page/slash-menu/index.mjs +291 -0
  187. package/browser/editor/page/storage.mjs +48 -0
  188. package/browser/editor/page/sync-state.mjs +267 -0
  189. package/browser/editor/page/table/aligns.mjs +29 -0
  190. package/browser/editor/page/table/cell-bar.mjs +138 -0
  191. package/browser/editor/page/table/cells.mjs +527 -0
  192. package/browser/editor/page/table/icons.mjs +40 -0
  193. package/browser/editor/page/table/index.mjs +985 -0
  194. package/browser/editor/page/table/lists.mjs +187 -0
  195. package/browser/editor/page/table/widths.mjs +308 -0
  196. package/browser/editor/page/tex.mjs +32 -0
  197. package/browser/editor/page/text-select/index.mjs +656 -0
  198. package/browser/editor/page/tooltip.mjs +98 -0
  199. package/browser/editor/page/type-grid.mjs +82 -0
  200. package/browser/editor/page/typing/code-edges.mjs +228 -0
  201. package/browser/editor/page/typing/index.mjs +276 -0
  202. package/browser/editor/page/typing/leave.mjs +68 -0
  203. package/browser/editor/page/ui.mjs +160 -0
  204. package/browser/shared/annotations.mjs +571 -0
  205. package/browser/shared/code-folds.mjs +10 -0
  206. package/browser/shared/code-languages.mjs +70 -0
  207. package/browser/shared/code-lines.mjs +30 -0
  208. package/browser/shared/colors.mjs +28 -0
  209. package/browser/shared/component-catalog.mjs +559 -0
  210. package/browser/shared/components/bookmark.mjs +26 -0
  211. package/browser/shared/components/callout.mjs +7 -0
  212. package/browser/shared/components/chart.mjs +20 -0
  213. package/browser/shared/components/code.mjs +37 -0
  214. package/browser/shared/components/columns.mjs +16 -0
  215. package/browser/shared/components/details.mjs +15 -0
  216. package/browser/shared/components/dialog.mjs +28 -0
  217. package/browser/shared/components/diff.mjs +18 -0
  218. package/browser/shared/components/divider.mjs +6 -0
  219. package/browser/shared/components/embed.mjs +25 -0
  220. package/browser/shared/components/figure.mjs +14 -0
  221. package/browser/shared/components/file.mjs +23 -0
  222. package/browser/shared/components/heading.mjs +6 -0
  223. package/browser/shared/components/highlight.mjs +9 -0
  224. package/browser/shared/components/icon.mjs +18 -0
  225. package/browser/shared/components/image.mjs +39 -0
  226. package/browser/shared/components/index.mjs +342 -0
  227. package/browser/shared/components/installed.mjs +162 -0
  228. package/browser/shared/components/list.mjs +146 -0
  229. package/browser/shared/components/math.mjs +49 -0
  230. package/browser/shared/components/mention.mjs +33 -0
  231. package/browser/shared/components/page.mjs +37 -0
  232. package/browser/shared/components/paragraph.mjs +9 -0
  233. package/browser/shared/components/quote.mjs +6 -0
  234. package/browser/shared/components/section.mjs +8 -0
  235. package/browser/shared/components/sheets.mjs +80 -0
  236. package/browser/shared/components/state.mjs +20 -0
  237. package/browser/shared/components/table.mjs +49 -0
  238. package/browser/shared/components/text.mjs +14 -0
  239. package/browser/shared/components/widget.mjs +10 -0
  240. package/browser/shared/copy-ids.mjs +72 -0
  241. package/browser/shared/css-references.mjs +110 -0
  242. package/browser/shared/emoji/custom.mjs +91 -0
  243. package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
  244. package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
  245. package/browser/shared/emoji/data/README.md +26 -0
  246. package/browser/shared/emoji/data/categories.json +1 -0
  247. package/browser/shared/emoji/data/icons.json +1 -0
  248. package/browser/shared/emoji/data/keywords-en.json +1 -0
  249. package/browser/shared/emoji/data/keywords-zh.json +1 -0
  250. package/browser/shared/emoji/data/names.json +1 -0
  251. package/browser/shared/emoji/data/positions.json +1 -0
  252. package/browser/shared/emoji/data/twemoji-index.json +1 -0
  253. package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
  254. package/browser/shared/emoji/data.mjs +196 -0
  255. package/browser/shared/emoji/emoji.mjs +37 -0
  256. package/browser/shared/emoji/glyphs.mjs +134 -0
  257. package/browser/shared/emoji/icon-value.mjs +90 -0
  258. package/browser/shared/escape.mjs +20 -0
  259. package/browser/shared/export-wrap.mjs +89 -0
  260. package/browser/shared/files.mjs +33 -0
  261. package/browser/shared/html-tree.mjs +53 -0
  262. package/browser/shared/http.mjs +22 -0
  263. package/browser/shared/i18n/en.mjs +1164 -0
  264. package/browser/shared/i18n/index.mjs +132 -0
  265. package/browser/shared/ids.mjs +24 -0
  266. package/browser/shared/import-types.mjs +23 -0
  267. package/browser/shared/inline-spacing.mjs +97 -0
  268. package/browser/shared/layers.mjs +42 -0
  269. package/browser/shared/media.mjs +162 -0
  270. package/browser/shared/new-names.mjs +64 -0
  271. package/browser/shared/number-reading.mjs +92 -0
  272. package/browser/shared/old-names.mjs +143 -0
  273. package/browser/shared/page-address.mjs +140 -0
  274. package/browser/shared/page-links.mjs +86 -0
  275. package/browser/shared/paths.mjs +73 -0
  276. package/browser/shared/preferences.mjs +110 -0
  277. package/browser/shared/preview-server.mjs +247 -0
  278. package/browser/shared/qa-levels.mjs +93 -0
  279. package/browser/shared/reading-place.mjs +91 -0
  280. package/browser/shared/renamed-storage.mjs +220 -0
  281. package/browser/shared/reports.mjs +46 -0
  282. package/browser/shared/search.mjs +85 -0
  283. package/browser/shared/session.mjs +76 -0
  284. package/browser/shared/table-chart.mjs +113 -0
  285. package/browser/shared/table-hides.mjs +120 -0
  286. package/browser/shared/table-slots.mjs +75 -0
  287. package/browser/shared/words.mjs +23 -0
  288. package/browser/shared/workspace.mjs +535 -0
  289. package/browser/shared/writing-preferences.mjs +68 -0
  290. package/browser/shared/zoom.mjs +57 -0
  291. package/dist/chunk-2B5E4CDJ.mjs +2 -0
  292. package/dist/chunk-2PBALTR3.mjs +57 -0
  293. package/dist/chunk-342HXE3Q.mjs +2 -0
  294. package/dist/chunk-3LA3EMDE.mjs +15 -0
  295. package/dist/chunk-43B75J5T.mjs +2 -0
  296. package/dist/chunk-4K5KC6V2.mjs +2 -0
  297. package/dist/chunk-5FRMCDPY.mjs +16 -0
  298. package/dist/chunk-5L7RYZCL.mjs +2 -0
  299. package/dist/chunk-5LEK2CBS.mjs +2 -0
  300. package/dist/chunk-5OFN5AHC.mjs +2 -0
  301. package/dist/chunk-5SIYS5HN.mjs +2 -0
  302. package/dist/chunk-5TEK3RAD.mjs +2 -0
  303. package/dist/chunk-6CYG3Z4V.mjs +2 -0
  304. package/dist/chunk-6U2SLSDN.mjs +3 -0
  305. package/dist/chunk-742D2WWJ.mjs +19 -0
  306. package/dist/chunk-7GHT2UCA.mjs +15 -0
  307. package/dist/chunk-7QQBR7PB.mjs +2 -0
  308. package/dist/chunk-A55HN5OK.mjs +2 -0
  309. package/dist/chunk-ACOPDCNB.mjs +2 -0
  310. package/dist/chunk-AGDILNWB.mjs +2 -0
  311. package/dist/chunk-ATCJYAR4.mjs +2 -0
  312. package/dist/chunk-B3VTYBYR.mjs +960 -0
  313. package/dist/chunk-C564NU2H.mjs +77 -0
  314. package/dist/chunk-C7HWOBIF.mjs +2 -0
  315. package/dist/chunk-DB4WKGYF.mjs +7 -0
  316. package/dist/chunk-E7VYDG2X.mjs +2 -0
  317. package/dist/chunk-EUX7IC5J.mjs +48 -0
  318. package/dist/chunk-EVJ3BX3M.mjs +2 -0
  319. package/dist/chunk-EZY3WC6Z.mjs +15 -0
  320. package/dist/chunk-FQGQH4KM.mjs +2 -0
  321. package/dist/chunk-G7TOXONE.mjs +6 -0
  322. package/dist/chunk-GPF4YWWB.mjs +9 -0
  323. package/dist/chunk-GRAXKKG4.mjs +2 -0
  324. package/dist/chunk-GYQV7Y4J.mjs +120 -0
  325. package/dist/chunk-HMHK3EQ6.mjs +2 -0
  326. package/dist/chunk-HQQMJCQJ.mjs +10 -0
  327. package/dist/chunk-HYMEEXKN.mjs +4 -0
  328. package/dist/chunk-IERUOGC3.mjs +6 -0
  329. package/dist/chunk-ITNLYXXV.mjs +3 -0
  330. package/dist/chunk-L4DVONOG.mjs +2 -0
  331. package/dist/chunk-LAE5NQ4B.mjs +2 -0
  332. package/dist/chunk-LC7YNQFG.mjs +2 -0
  333. package/dist/chunk-LHTFLRB6.mjs +4 -0
  334. package/dist/chunk-LKX55H76.mjs +2 -0
  335. package/dist/chunk-MAFIGVXY.mjs +2 -0
  336. package/dist/chunk-NFIBI4IP.mjs +26 -0
  337. package/dist/chunk-NSKUTQ5J.mjs +5 -0
  338. package/dist/chunk-O52JMOCZ.mjs +2 -0
  339. package/dist/chunk-P2CAZPDP.mjs +3 -0
  340. package/dist/chunk-QAIHRH3I.mjs +13 -0
  341. package/dist/chunk-QMQUXTU4.mjs +12 -0
  342. package/dist/chunk-QR6A54KJ.mjs +3 -0
  343. package/dist/chunk-QVWVFC5K.mjs +6 -0
  344. package/dist/chunk-QYKCJ7FG.mjs +8 -0
  345. package/dist/chunk-QZY6Q64C.mjs +2 -0
  346. package/dist/chunk-TDQP3DKQ.mjs +10 -0
  347. package/dist/chunk-TMYZB6AV.mjs +2 -0
  348. package/dist/chunk-TX6JH7TR.mjs +2 -0
  349. package/dist/chunk-U3SSPL4K.mjs +8 -0
  350. package/dist/chunk-UH4SIXTR.mjs +2 -0
  351. package/dist/chunk-UNUEWH4S.mjs +2 -0
  352. package/dist/chunk-UXUK4PMC.mjs +27 -0
  353. package/dist/chunk-V4CPWKMZ.mjs +2 -0
  354. package/dist/chunk-V6XZ4VIR.mjs +2 -0
  355. package/dist/chunk-VACRB2NE.mjs +3 -0
  356. package/dist/chunk-W63L7367.mjs +7 -0
  357. package/dist/chunk-W7CXPCRV.mjs +6 -0
  358. package/dist/chunk-W7XHE4CT.mjs +2 -0
  359. package/dist/chunk-XINNG4F2.mjs +4 -0
  360. package/dist/chunk-Y34NR5JL.mjs +2 -0
  361. package/dist/chunk-YEY3RSFQ.mjs +2 -0
  362. package/dist/chunk-YL2DPWVS.mjs +4 -0
  363. package/dist/chunk-YXAUQPVK.mjs +8 -0
  364. package/dist/chunk-YZ5Z6H4W.mjs +4 -0
  365. package/dist/chunk-Z52HTUW7.mjs +4 -0
  366. package/dist/chunk-ZBIM6ARY.mjs +216 -0
  367. package/dist/cli.mjs +2 -0
  368. package/dist/server.mjs +2 -0
  369. package/dist/worker.mjs +5 -0
  370. package/kit/charts.js +355 -0
  371. package/kit/code.js +164 -0
  372. package/kit/dialogs.js +157 -0
  373. package/kit/math.js +1988 -0
  374. package/kit/report.css +2821 -0
  375. package/kit/runtime.js +1707 -0
  376. package/kit/sheets.js +123 -0
  377. package/kit/state.js +217 -0
  378. package/kit/tables.js +1449 -0
  379. package/kit/tokens.js +29 -0
  380. package/kit/ui.js +561 -0
  381. package/package.json +41 -4
  382. package/release.json +25 -0
  383. package/sdk/column-widths.d.ts +56 -0
  384. package/sdk/doc-charts.d.ts +82 -0
  385. package/sdk/doc-code.d.ts +28 -0
  386. package/sdk/doc-dialogs.d.ts +4 -0
  387. package/sdk/doc-kit.d.ts +141 -0
  388. package/sdk/doc-math.d.ts +3 -0
  389. package/sdk/doc-sheets.d.ts +15 -0
  390. package/sdk/doc-state.d.ts +41 -0
  391. package/sdk/doc-tables.d.ts +24 -0
  392. package/sdk/doc-tokens.d.ts +22 -0
  393. package/sdk/index.d.ts +30 -0
  394. package/skill/SKILL.md +138 -0
  395. package/skill/agents/openai.yaml +5 -0
  396. package/skill/references/building-components.md +327 -0
  397. package/skill/references/example-report.html +356 -0
  398. package/skill/references/writing-html.md +187 -0
  399. package/skill/sdk/column-widths.d.ts +56 -0
  400. package/skill/sdk/doc-charts.d.ts +82 -0
  401. package/skill/sdk/doc-code.d.ts +28 -0
  402. package/skill/sdk/doc-dialogs.d.ts +4 -0
  403. package/skill/sdk/doc-kit.d.ts +141 -0
  404. package/skill/sdk/doc-math.d.ts +3 -0
  405. package/skill/sdk/doc-sheets.d.ts +15 -0
  406. package/skill/sdk/doc-state.d.ts +41 -0
  407. package/skill/sdk/doc-tables.d.ts +24 -0
  408. package/skill/sdk/doc-tokens.d.ts +22 -0
  409. package/skill/sdk/index.d.ts +30 -0
  410. package/starter/doc.html +21 -0
  411. package/starter/doc.json +5 -0
  412. package/vendor/d3.v7.9.0.min.js +2 -0
  413. package/vendor/katex/auto-render.min.js +1 -0
  414. package/vendor/katex/contrib/mhchem.min.js +1 -0
  415. package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  416. package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  417. package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  418. package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  419. package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  420. package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  421. package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  422. package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  423. package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  424. package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  425. package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  426. package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  427. package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  428. package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  429. package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  430. package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  431. package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  432. package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  433. package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  434. package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  435. package/vendor/katex/katex.min.css +1 -0
  436. package/vendor/katex/katex.min.js +1 -0
  437. package/vendor/pdfjs/LICENSE +177 -0
  438. package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  439. package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  440. package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  441. package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  442. package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  443. package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  444. package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  445. package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  446. package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  447. package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  448. package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  449. package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  450. package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  451. package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  452. package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  453. package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  454. package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  455. package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  456. package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  457. package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  458. package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  459. package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  460. package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  461. package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  462. package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  463. package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  464. package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  465. package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  466. package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  467. package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  468. package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  469. package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  470. package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  471. package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  472. package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  473. package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  474. package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  475. package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  476. package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  477. package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  478. package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  479. package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  480. package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  481. package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  482. package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  483. package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  484. package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  485. package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  486. package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  487. package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  488. package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  489. package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  490. package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  491. package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  492. package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  493. package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  494. package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  495. package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  496. package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  497. package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  498. package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  499. package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  500. package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  501. package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  502. package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  503. package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  504. package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  505. package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  506. package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  507. package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  508. package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  509. package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  510. package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  511. package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  512. package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  513. package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  514. package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  515. package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  516. package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  517. package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  518. package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  519. package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  520. package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  521. package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  522. package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  523. package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  524. package/vendor/pdfjs/cmaps/H.bcmap +0 -0
  525. package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  526. package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  527. package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  528. package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  529. package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  530. package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  531. package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  532. package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  533. package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  534. package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  535. package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  536. package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  537. package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  538. package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  539. package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  540. package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  541. package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  542. package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  543. package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  544. package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  545. package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  546. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  547. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  548. package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  549. package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  550. package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  551. package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  552. package/vendor/pdfjs/cmaps/LICENSE +36 -0
  553. package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  554. package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  555. package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  556. package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  557. package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  558. package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  559. package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  560. package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  561. package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  562. package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  563. package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  564. package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  565. package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  566. package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  567. package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  568. package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  569. package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  570. package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  571. package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  572. package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  573. package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  574. package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  575. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  576. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  577. package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  578. package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  579. package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  580. package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  581. package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  582. package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  583. package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  584. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  585. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  586. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  587. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  588. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  589. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  590. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  591. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  592. package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  593. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  594. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  595. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  596. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  597. package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  598. package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  599. package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  600. package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  601. package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  602. package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  603. package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  604. package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  605. package/vendor/pdfjs/cmaps/V.bcmap +0 -0
  606. package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  607. package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
  608. package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
  609. package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  610. package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  611. package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  612. package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  613. package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  614. package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  615. package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  616. package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  617. package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  618. package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  619. package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  620. package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  621. package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  622. package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  623. package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  624. package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  625. package/vendor/types/@types/d3/LICENSE +21 -0
  626. package/vendor/types/@types/d3/index.d.ts +39 -0
  627. package/vendor/types/@types/d3/package.json +81 -0
  628. package/vendor/types/@types/d3-array/LICENSE +21 -0
  629. package/vendor/types/@types/d3-array/index.d.ts +1118 -0
  630. package/vendor/types/@types/d3-array/package.json +56 -0
  631. package/vendor/types/@types/d3-axis/LICENSE +21 -0
  632. package/vendor/types/@types/d3-axis/index.d.ts +293 -0
  633. package/vendor/types/@types/d3-axis/package.json +47 -0
  634. package/vendor/types/@types/d3-brush/LICENSE +21 -0
  635. package/vendor/types/@types/d3-brush/index.d.ts +255 -0
  636. package/vendor/types/@types/d3-brush/package.json +42 -0
  637. package/vendor/types/@types/d3-chord/LICENSE +21 -0
  638. package/vendor/types/@types/d3-chord/index.d.ts +471 -0
  639. package/vendor/types/@types/d3-chord/package.json +40 -0
  640. package/vendor/types/@types/d3-color/LICENSE +21 -0
  641. package/vendor/types/@types/d3-color/index.d.ts +669 -0
  642. package/vendor/types/@types/d3-color/package.json +55 -0
  643. package/vendor/types/@types/d3-contour/LICENSE +21 -0
  644. package/vendor/types/@types/d3-contour/index.d.ts +222 -0
  645. package/vendor/types/@types/d3-contour/package.json +38 -0
  646. package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
  647. package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
  648. package/vendor/types/@types/d3-delaunay/package.json +30 -0
  649. package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
  650. package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
  651. package/vendor/types/@types/d3-dispatch/package.json +51 -0
  652. package/vendor/types/@types/d3-drag/LICENSE +21 -0
  653. package/vendor/types/@types/d3-drag/index.d.ts +395 -0
  654. package/vendor/types/@types/d3-drag/package.json +42 -0
  655. package/vendor/types/@types/d3-dsv/LICENSE +21 -0
  656. package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
  657. package/vendor/types/@types/d3-dsv/package.json +45 -0
  658. package/vendor/types/@types/d3-ease/LICENSE +21 -0
  659. package/vendor/types/@types/d3-ease/index.d.ts +316 -0
  660. package/vendor/types/@types/d3-ease/package.json +40 -0
  661. package/vendor/types/@types/d3-fetch/LICENSE +21 -0
  662. package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
  663. package/vendor/types/@types/d3-fetch/package.json +37 -0
  664. package/vendor/types/@types/d3-force/LICENSE +21 -0
  665. package/vendor/types/@types/d3-force/index.d.ts +899 -0
  666. package/vendor/types/@types/d3-force/package.json +45 -0
  667. package/vendor/types/@types/d3-format/LICENSE +21 -0
  668. package/vendor/types/@types/d3-format/index.d.ts +337 -0
  669. package/vendor/types/@types/d3-format/package.json +45 -0
  670. package/vendor/types/@types/d3-geo/LICENSE +21 -0
  671. package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
  672. package/vendor/types/@types/d3-geo/package.json +48 -0
  673. package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
  674. package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
  675. package/vendor/types/@types/d3-hierarchy/package.json +50 -0
  676. package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
  677. package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
  678. package/vendor/types/@types/d3-interpolate/package.json +47 -0
  679. package/vendor/types/@types/d3-path/LICENSE +21 -0
  680. package/vendor/types/@types/d3-path/index.d.ts +108 -0
  681. package/vendor/types/@types/d3-path/package.json +41 -0
  682. package/vendor/types/@types/d3-polygon/LICENSE +21 -0
  683. package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
  684. package/vendor/types/@types/d3-polygon/package.json +40 -0
  685. package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
  686. package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
  687. package/vendor/types/@types/d3-quadtree/package.json +45 -0
  688. package/vendor/types/@types/d3-random/LICENSE +21 -0
  689. package/vendor/types/@types/d3-random/index.d.ts +313 -0
  690. package/vendor/types/@types/d3-random/package.json +41 -0
  691. package/vendor/types/@types/d3-scale/LICENSE +21 -0
  692. package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
  693. package/vendor/types/@types/d3-scale/package.json +53 -0
  694. package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
  695. package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
  696. package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
  697. package/vendor/types/@types/d3-selection/LICENSE +21 -0
  698. package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
  699. package/vendor/types/@types/d3-selection/package.json +56 -0
  700. package/vendor/types/@types/d3-shape/LICENSE +21 -0
  701. package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
  702. package/vendor/types/@types/d3-shape/package.json +53 -0
  703. package/vendor/types/@types/d3-time/LICENSE +21 -0
  704. package/vendor/types/@types/d3-time/index.d.ts +697 -0
  705. package/vendor/types/@types/d3-time/package.json +46 -0
  706. package/vendor/types/@types/d3-time-format/LICENSE +21 -0
  707. package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
  708. package/vendor/types/@types/d3-time-format/package.json +40 -0
  709. package/vendor/types/@types/d3-timer/LICENSE +21 -0
  710. package/vendor/types/@types/d3-timer/index.d.ts +68 -0
  711. package/vendor/types/@types/d3-timer/package.json +45 -0
  712. package/vendor/types/@types/d3-transition/LICENSE +21 -0
  713. package/vendor/types/@types/d3-transition/index.d.ts +664 -0
  714. package/vendor/types/@types/d3-transition/package.json +47 -0
  715. package/vendor/types/@types/d3-zoom/LICENSE +21 -0
  716. package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
  717. package/vendor/types/@types/d3-zoom/package.json +48 -0
  718. package/vendor/types/@types/geojson/LICENSE +21 -0
  719. package/vendor/types/@types/geojson/index.d.ts +202 -0
  720. package/vendor/types/@types/geojson/package.json +46 -0
  721. package/vendor/typescript/LICENSE.txt +55 -0
  722. package/vendor/typescript/lib.decorators.d.ts +384 -0
  723. package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
  724. package/vendor/typescript/lib.dom.d.ts +39429 -0
  725. package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
  726. package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
  727. package/vendor/typescript/lib.es2015.core.d.ts +597 -0
  728. package/vendor/typescript/lib.es2015.d.ts +28 -0
  729. package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
  730. package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
  731. package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
  732. package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
  733. package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
  734. package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
  735. package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
  736. package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
  737. package/vendor/typescript/lib.es2016.d.ts +21 -0
  738. package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
  739. package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
  740. package/vendor/typescript/lib.es2017.d.ts +26 -0
  741. package/vendor/typescript/lib.es2017.date.d.ts +31 -0
  742. package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
  743. package/vendor/typescript/lib.es2017.object.d.ts +49 -0
  744. package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
  745. package/vendor/typescript/lib.es2017.string.d.ts +45 -0
  746. package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
  747. package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
  748. package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
  749. package/vendor/typescript/lib.es2018.d.ts +24 -0
  750. package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
  751. package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
  752. package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
  753. package/vendor/typescript/lib.es2019.array.d.ts +79 -0
  754. package/vendor/typescript/lib.es2019.d.ts +24 -0
  755. package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
  756. package/vendor/typescript/lib.es2019.object.d.ts +33 -0
  757. package/vendor/typescript/lib.es2019.string.d.ts +37 -0
  758. package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
  759. package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
  760. package/vendor/typescript/lib.es2020.d.ts +27 -0
  761. package/vendor/typescript/lib.es2020.date.d.ts +42 -0
  762. package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
  763. package/vendor/typescript/lib.es2020.number.d.ts +28 -0
  764. package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
  765. package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
  766. package/vendor/typescript/lib.es2020.string.d.ts +44 -0
  767. package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
  768. package/vendor/typescript/lib.es2021.d.ts +23 -0
  769. package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
  770. package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
  771. package/vendor/typescript/lib.es2021.string.d.ts +33 -0
  772. package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
  773. package/vendor/typescript/lib.es2022.array.d.ts +121 -0
  774. package/vendor/typescript/lib.es2022.d.ts +25 -0
  775. package/vendor/typescript/lib.es2022.error.d.ts +75 -0
  776. package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
  777. package/vendor/typescript/lib.es2022.object.d.ts +26 -0
  778. package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
  779. package/vendor/typescript/lib.es2022.string.d.ts +25 -0
  780. package/vendor/typescript/lib.es5.d.ts +4601 -0
  781. package/vendor/typescript/package.json +4 -0
  782. package/vendor/typescript/typescript.js +446 -0
  783. package/web/assets/index-B6Ai3wsa.js +13 -0
  784. package/web/assets/index-SYPC3EZy.css +1 -0
  785. package/web/index.html +14 -0
@@ -0,0 +1,21 @@
1
+ import { BESIDE, ENTERS_AFTER } from "../components/registry.mjs";
2
+ import { isHost } from "./core.mjs";
3
+
4
+ // What a click beside a block and Enter on a selected block do with it, shared by the tools that
5
+ // place the caret or blocks (insert/), select blocks (blocks.mjs) and say what a selection takes
6
+ // (selection/).
7
+
8
+ /**
9
+ * Whether a click to the right of a block (outside it) selects it: a boxed block (a code block, a
10
+ * highlight block, a disclosure, a card, a table, a divider…) or a row of columns, as opposed to text
11
+ * and the boxes text flows in (a list, a quote, a section).
12
+ */
13
+ export const selectsBeside = (unit) => BESIDE.has(unit?.getAttribute?.("data-ge-unit-kind"));
14
+
15
+ /**
16
+ * Whether Enter on a block selected (the first of those selected) puts a new paragraph after them
17
+ * (blocks.mjs, insert.paragraphAfter): a block of no text of its own, those a click to their right
18
+ * selects and a 选项卡区块; not a text block among them (a callout, whose text Enter edits, a formula
19
+ * block, whose editor it opens).
20
+ */
21
+ export const entersAfter = (unit) => Boolean(unit) && !isHost(unit) && ENTERS_AFTER.has(unit.getAttribute("data-ge-unit-kind"));
@@ -0,0 +1,63 @@
1
+ import { SHEETS } from "../components/kit.mjs";
2
+ import { KIND_NAMES, hasOuter, isBlock } from "../components/registry.mjs";
3
+ import { OUTER, UNIT, boxKind } from "./core.mjs";
4
+ import { pageOfUnit } from "./page-objects.mjs";
5
+ import { t } from "../../shared/i18n/index.mjs";
6
+
7
+ // What the page knows of a block (a unit: a paragraph, a list, a card, a section, a Sheet tab...;
8
+ // findUnits in src/editor/source/), shared by the block tools (blocks.mjs wires them: handle/,
9
+ // selection/, drag/, block-menu/): its kind and name, the blocks of a container, and why a block may
10
+ // not go or move.
11
+
12
+ export const alive = (target) => Boolean(target?.isConnected);
13
+
14
+ /** Blocks in document order, none inside another. */
15
+ export const ordered = (nodes) => [...new Set(nodes)]
16
+ .filter((node, _, all) => !all.some((other) => other !== node && other.contains(node)))
17
+ .sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
18
+
19
+ /** The block around a block, or null: none past a box that has none (`outer`: a detail card's content). */
20
+ export const outerOf = (target) => {
21
+ if (!hasOuter(boxKind(target.parentElement))) return null;
22
+ const outer = target.parentElement?.closest(OUTER);
23
+ // A column is no block of its own: from a block in one, the row of columns.
24
+ return outer && !isBlock(outer.getAttribute("data-ge-unit-kind")) ? outer.parentElement?.closest(OUTER) ?? null : outer;
25
+ };
26
+
27
+ /** The other tabs of a tab's row still on the page. */
28
+ export const otherTabs = (tab) => [...tab.parentElement.children].filter((child) => child !== tab && child.matches(`:is(${UNIT})` + SHEETS.tab));
29
+
30
+ /** units: Map(id -> { kind, keep }) and boxes: Map(id -> { kind }) from the edit map. */
31
+ export function createBlockInfo({ units, boxes }) {
32
+ const info = (node) => units.get(Number(node.getAttribute("data-ge-unit")));
33
+ // Blocks made or converted on the page carry their kind; the others got it when the editor started.
34
+ const kindOf = (node) => node.getAttribute("data-ge-unit-kind") ?? info(node)?.kind;
35
+ const nameOf = (target) => pageOfUnit(target)?.nameOf?.(target) ?? KIND_NAMES[kindOf(target)] ?? t("整体块");
36
+
37
+ return {
38
+ kindOf,
39
+ nameOf,
40
+ /** What the reader calls one block, or several. */
41
+ named: (targets) => targets.length === 1 ? nameOf(targets[0]) : t("{0} 块", targets.length),
42
+ /** The kind of a container (a box). */
43
+ boxKindOf: (container) => container.getAttribute("data-ge-box-kind") ?? boxes.get(Number(container.getAttribute("data-ge-box")))?.kind,
44
+
45
+ /** Why a block cannot be deleted on the page (with the others of `group`), or null. */
46
+ keepText(target, group = [target]) {
47
+ if (kindOf(target) === "tab" && otherTabs(target).every((tab) => group.includes(tab))) return t("至少要保留一个选项卡。");
48
+ if (!target.hasAttribute("data-ge-keep")) return null;
49
+ const { keep } = info(target) ?? {};
50
+ const names = keep?.names ?? [];
51
+ const list = names.slice(0, 3).join(t("、")) + (names.length > 3 ? t(" 等") : "");
52
+ return keep?.reason === "ref"
53
+ ? t("页面其他地方引用了这块({0},例如链接或详情卡片、无障碍关联),删掉会让它们失效,请让 AI 删除。", list)
54
+ : t("这块被文档的脚本用到({0}),在页面上删掉会让脚本出错,请让 AI 删除。", list);
55
+ },
56
+
57
+ /** Why a block cannot move at all, or null. */
58
+ fixedText(target) {
59
+ if (!target.parentElement?.hasAttribute("data-ge-box")) return t("这个{0}不能移动。", nameOf(target));
60
+ return null;
61
+ },
62
+ };
63
+ }
@@ -0,0 +1,82 @@
1
+ import { COLORS, backgroundClass, blockColorsOf, textClass } from "../../components/colors.mjs";
2
+ import { svg } from "../../components/icons.mjs";
3
+ import { RINGS } from "../format-bar/colors.mjs";
4
+ import { tooltip } from "../tooltip.mjs";
5
+ import { addStyle, element } from "../ui.mjs";
6
+ import { t } from "../../../shared/i18n/index.mjs";
7
+
8
+ // The block menu's 颜色 › (Notion's, notion-lite's colorSections): 上次使用 (the color given last in
9
+ // this page, when there is one), 文本颜色 and 背景颜色, each 默认 and the nine colors, as swatches
10
+ // five to a line, as the format bar's colors are (format-bar/bar.mjs: the same swatches and rings);
11
+ // the block's own colors ringed, one of each family (默认 when it has none of it). When the blocks
12
+ // show one of the nine with none of a family (a callout's background is blue: `defaults`), that
13
+ // family has no 默认: that color is ringed for none, and picking it takes the class away. Each
14
+ // swatch names its color in a tooltip. The swatches are drawn with the kit's own classes, so they
15
+ // match the text in either theme. A pick gives every target that color of its family, the other family's staying (one
16
+ // undo step: look, history.mjs; a table cell's one color: table/). Only the families the targets take show.
17
+
18
+ const STYLE = `
19
+ .ge-pop .ge-color-grid { display: grid; grid-template-columns: repeat(5, 30px); gap: 4px; padding: 0 11px 4px; }
20
+ .ge-pop .ge-color-cell { display: block; width: 30px; height: 30px; padding: 2px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
21
+ .ge-pop .ge-color-cell > span { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 26px; height: 26px; border-radius: 6px;
22
+ font-size: 16px; font-weight: 500; line-height: 1; box-shadow: inset 0 0 0 1px var(--ge-ring); }
23
+ .ge-pop .ge-color-cell > span:not([class*="doc-text-"]) { color: var(--ge-tx); }
24
+ .ge-pop .ge-color-cell:hover > span, .ge-pop .ge-color-cell[data-active] > span { box-shadow: inset 0 0 0 2px var(--ge-ring); }
25
+ .ge-pop .ge-color-cell[aria-current="true"] > span { box-shadow: inset 0 0 0 2px var(--ge-ring-strong); }
26
+ ${Object.entries(RINGS).map(([name, [light, dark, strong, strongDark]]) => `.ge-pop .ge-color-cell[data-ring="${name}"] { --ge-ring: light-dark(${light}, ${dark}); --ge-ring-strong: light-dark(${strong}, ${strongDark}); }`).join("\n ")}
27
+ `;
28
+
29
+ /** The 颜色 row's icon (Notion's blockColor: a letter over a stroke). */
30
+ export const COLOR_ICON = svg('<path d="m6.25 12.75 3.75-9.5 3.75 9.5M7.6 9.25h4.8"/><path d="M4 16.25h12" stroke-width="2"/>');
31
+
32
+ /** How wide 颜色 › is: five swatches and their room. */
33
+ export const COLOR_WIDTH = 5 * 30 + 4 * 4 + 2 * 11;
34
+
35
+ let lastUsed = null; // { kind, color }: the color given last on this page (Notion keeps one per reader)
36
+
37
+ const NAMES = Object.fromEntries(COLORS);
38
+ const nameOf = (kind, color) => t("{0}{1}", color ? NAMES[color] : t("默认"), kind === "text" ? t("文本") : t("背景")); // two words: one in Chinese, two in English
39
+
40
+ /**
41
+ * The items of 颜色 › for `targets` (blocks that take a color): grids of swatches under their
42
+ * titles, for `families` ("text", "background"). `look(targets, color)` gives them that color of its
43
+ * family ({ kind, color }, color null for none of it); `close()` closes the menu (a swatch does its
44
+ * own work, as a grid's cells do: menu.mjs). `recent`: whether 上次使用 shows (a table's cells have
45
+ * none, as notion-lite's: table/). `defaults`: by family, the color the targets all show with none
46
+ * of it (a callout's background: "blue", registry.mjs COLOR_DEFAULTS), which stands for none.
47
+ */
48
+ export function colorItems(targets, look, close = () => {}, { recent = true, families = ["text", "background"], defaults = {} } = {}) {
49
+ addStyle(STYLE);
50
+ // Each family's color the targets share (null: none of it), or undefined when they differ; a
51
+ // target with none of a family that has a default shows that one.
52
+ const colors = targets.map(blockColorsOf).map((each) => Object.fromEntries(Object.entries(each).map(([kind, color]) => [kind, color ?? defaults[kind] ?? null])));
53
+ const shared = (kind) => (colors.every((each) => each[kind] === colors[0][kind]) ? colors[0][kind] : undefined);
54
+ const cell = (kind, color) => {
55
+ const value = { kind, color };
56
+ const current = shared(kind) === color;
57
+ const name = nameOf(kind, color);
58
+ const node = element("button", { type: "button", class: "ge-color-cell", "aria-label": name, "aria-current": String(current), "data-ring": color ?? "default" });
59
+ node.append(element("span", { class: color ? (kind === "text" ? textClass(color) : backgroundClass(color)) : "", text: kind === "text" ? "A" : "" }));
60
+ node.passed = current; // the keys pass over it (menu.mjs move), as they did a checked row
61
+ node.addEventListener("mousedown", (event) => event.preventDefault());
62
+ node.addEventListener("click", () => {
63
+ close();
64
+ if (current) return;
65
+ if (color) lastUsed = value;
66
+ look(targets, color && color === defaults[kind] ? { kind, color: null } : value);
67
+ });
68
+ tooltip(node, current ? t("{0}(当前)", name) : name);
69
+ return node;
70
+ };
71
+ const grid = (cells) => {
72
+ const node = element("div", { class: "ge-color-grid", role: "group" }, ...cells);
73
+ return { node, cells, columns: 5 };
74
+ };
75
+ const items = [];
76
+ if (recent && lastUsed && families.includes(lastUsed.kind)) items.push({ title: t("上次使用") }, grid([cell(lastUsed.kind, lastUsed.color)]));
77
+ // A family's 默认, unless one of the nine is its default.
78
+ const all = (kind) => [...(defaults[kind] ? [] : [cell(kind, null)]), ...COLORS.map(([color]) => cell(kind, color))];
79
+ if (families.includes("text")) items.push({ title: t("文本颜色") }, grid(all("text")));
80
+ if (families.includes("background")) items.push({ title: t("背景颜色") }, grid(all("background")));
81
+ return items;
82
+ }
@@ -0,0 +1,215 @@
1
+ import { colorLook } from "../../components/colors.mjs";
2
+ import { COLOR_DEFAULTS, COLOR_FAMILIES, KIND_ICONS, boxRole, takesBelow } from "../../components/registry.mjs";
3
+ import { COUNTS, columnsIcon } from "../../components/columns/index.mjs";
4
+ import { LINK_ICON } from "../../components/icons.mjs";
5
+ import { extentOf } from "../geometry.mjs";
6
+ import { outerOf } from "../block-info.mjs";
7
+ import { ICONS } from "../menu.mjs";
8
+ import { offeredTurn } from "../offered.mjs";
9
+ import { columnOps, menuRow, pageOfUnit, rowBeside, sectionOps } from "../page-objects.mjs";
10
+ import { MENU_COLUMNS, MENU_WIDTH, typeGrid } from "../type-grid.mjs";
11
+ import { rememberType, typeItems } from "../slash-menu/index.mjs";
12
+ import { COLOR_ICON, COLOR_WIDTH, colorItems } from "./colors.mjs";
13
+ import { t } from "../../../shared/i18n/index.mjs";
14
+
15
+ // The block menu (docs/editor.md, "Deleting blocks" and "New blocks and conversions"; the card is
16
+ // menu.mjs, as Notion's block menu without its search), opened by a click on a block's handle (or
17
+ // the right button) or on a section's bar (handle/). For one block: the types it can be turned
18
+ // into as icons side by side, five to a line (小字 the corner of 文本's), at the top (type-grid.mjs, as Feishu's; its own
19
+ // marked), or its name as the title when it turns into nothing; then its component's own rows (its page module's `menuItems`, a card's and a table's size among them),
20
+ // "在下方新建一块" (insert/, as Enter at its end would), "分区与分栏 ›" right above deleting (one row
21
+ // for both, the user's: 在下方新建分区 among chapters, 组成新分区, 解散分区 on a section and 解散所在分区
22
+ // on a block in one, components/section/page.mjs; then 分两栏, 分三栏, 分四栏, the block in the first column and empty ones beside it, as Feishu's
23
+ // columns; in a column, 在右侧新增一栏; components/columns/page.mjs; last, 选中外层, the block around
24
+ // it), 复制块链接 (notion-lite's: one block only, its address named by the click and not by the menu's
25
+ // opening), deleting it (disabled, with the reason, when something refers to it), right below which
26
+ // 选中外层 stands for a block with no such submenu. For several selected blocks, this one among
27
+ // them, what they can do together: below their number the types they can all be turned into, in the
28
+ // same grid (notion-lite's 转换成 for several blocks: only when every one of them can be turned, their
29
+ // type marked only when they all share it; editor.mjs convertAll turns them, one undo step), then
30
+ // "分区与分栏 ›" (组成新分区 for neighbours in the page or a Sheet panel, 解散所在分区 for blocks all in
31
+ // one section, 分成 n 栏 for neighbours side by side, a column each) and deleting them all. A block that
32
+ // takes a color (a paragraph, a heading: components/colors.mjs) has "颜色 ›" right below its types,
33
+ // as Notion's (colors.mjs); so do several selected ones that all take one. It keeps clear of the block, or stands right of a section's bar.
34
+ // A component whose block has a menu of its own gives it (`menu`): a Sheet tab's is Notion's tab
35
+ // menu, below the tab (components/sheets/page.mjs): 重命名, 编辑图标 and 删除. A block that turns into
36
+ // nothing has its name at the head (`nameOf`), with its mark where its component has one (`iconOf`:
37
+ // an instance's package, for a block of no type of the reader's).
38
+
39
+ const COLUMNS = MENU_COLUMNS; // types on a line of the grid: 文本 and the headings, then the rest
40
+ const WIDTH = MENU_WIDTH; // the menu, as wide as its grid (no room left beside it), for every block
41
+
42
+ /**
43
+ * info: block-info.mjs. menu: the menu card (menu.mjs createMenu). selection: selection/index.mjs.
44
+ * remove(targets): delete blocks (selection/delete.mjs). turnInto(unit): the types the block can be
45
+ * turned into, { current, types }, or null; convert(unit, type) turns it. turnIntoAll(units) and
46
+ * convertAll(units, type): the same for several selected blocks (convert.mjs groupTargets: { current,
47
+ * types }, current null for a mix). below(unit, type): a block of
48
+ * the type below it (the editor's insertBelow). add(unit, "section"): a new section right after it.
49
+ * The rows of 分区与分栏 are `sectionOps` and `columnOps`, of whichever page objects say them:
50
+ * wrap(units) and unwrap(section, from), a section dissolved (from: the blocks in it it is asked from,
51
+ * which stay selected), wrapCheck(units) and unwrapCheck(section), why they may not be, dissolvesFrom(unit),
52
+ * the section dissolving from it takes; split(units), 分栏, columnsCheck(units), why not, columnOf(unit),
53
+ * the column a block stands in. look(elements, change): the editor's undoable change of classes (the
54
+ * color rows). copyLink(target): the block's address on the clipboard, in the click on its row; null
55
+ * on a page no address leads to; linkAhead(): the menu opens with that row, what the click will want is read now.
56
+ */
57
+ export function createBlockMenu({ info, menu, selection, remove, turnInto, convert, turnIntoAll = () => null, convertAll = () => {}, below, belowTypes = () => [], add, look, copyLink = () => {}, linkAhead = () => {} }) {
58
+ const chapters = sectionOps();
59
+ const columns = columnOps();
60
+ const { kindOf, nameOf, keepText, boxKindOf } = info;
61
+
62
+ // A new section can go right after any block standing in the page or a Sheet panel.
63
+ const chapter = (target) => Boolean(target.parentElement?.hasAttribute("data-ge-box")) && boxRole(boxKindOf(target.parentElement)) === "root";
64
+ // Nothing goes below a Sheet tab, or a Sheet area, from its menu (`below: false` in their descriptions).
65
+ const addable = (target) => takesBelow(kindOf(target));
66
+
67
+ // "颜色 ›" for blocks that all take a color: the families they all take (a text block's text and
68
+ // background, a highlight block's or a code block's background: registry.mjs COLOR_FAMILIES), one
69
+ // undo step for them all; a family's color they all show with none of it (a callout's blue:
70
+ // COLOR_DEFAULTS) stands for none.
71
+ const familiesOf = (target) => COLOR_FAMILIES[kindOf(target)] ?? [];
72
+ const colorable = (target) => familiesOf(target).length > 0;
73
+ const defaultOf = (target, family) => COLOR_DEFAULTS[kindOf(target)]?.[family] ?? null;
74
+ const colorRow = (units) => {
75
+ const families = units.length > 0 ? familiesOf(units[0]).filter((family) => units.every((unit) => familiesOf(unit).includes(family))) : [];
76
+ const defaults = Object.fromEntries(families.map((family) => [family, defaultOf(units[0], family)]).filter(([family, color]) => color && units.every((unit) => defaultOf(unit, family) === color)));
77
+ return families.length > 0
78
+ ? [{ label: t("颜色"), icon: COLOR_ICON, width: COLOR_WIDTH, submenu: () => colorItems(units, (targets, color) => look(targets, colorLook(color)), () => menu.close(), { families, defaults }) }]
79
+ : [];
80
+ };
81
+
82
+ // The columns rows for blocks: none where they do not apply, disabled with the reason where they
83
+ // cannot be done. One block: 分两栏, 分三栏, 分四栏 (in a column: 在右侧新增一栏); several: a column each.
84
+ const splitRows = (units) => {
85
+ const reason = columns?.columnsCheck(units) ?? null;
86
+ if (reason === null) return [];
87
+ const state = { disabled: Boolean(reason), note: reason || undefined };
88
+ if (units.length > 1) return [{ label: COUNTS[units.length] ? t("分成{0}栏", COUNTS[units.length]) : t("并排分栏"), icon: columnsIcon(Math.min(units.length, 5)), ...state, run: () => columns.split(units) }];
89
+ if (columns.columnOf(units[0])) return [{ label: t("在右侧新增一栏"), icon: ICONS.plus, ...state, run: () => columns.split(units) }];
90
+ return [2, 3, 4].map((count) => ({ label: t("分{0}栏", COUNTS[count]), icon: columnsIcon(count), ...state, run: () => columns.split(units, count) }));
91
+ };
92
+
93
+ // 解散分区 on a section; on blocks all in one section, 解散所在分区, which is that section's own row
94
+ // said from inside it: its check, its undo step, its words, the blocks staying selected and the page
95
+ // where it is. What it holds comes out as it stands, so a block in a column keeps its column, the row
96
+ // of columns coming out whole, and one in a section in a Sheet panel ends in the panel. None for a
97
+ // block that has no 分区与分栏 › of its own (no columns row, in a section: a list item, a flowchart's
98
+ // node, a quote's later paragraph, a block an item holds).
99
+ const dissolveRow = (units) => {
100
+ const section = chapters?.dissolvesFrom(units[0]);
101
+ if (!section || units.some((unit) => chapters.dissolvesFrom(unit) !== section)) return [];
102
+ const own = units[0] === section;
103
+ if (!own && units.some((unit) => (columns?.columnsCheck([unit]) ?? null) === null)) return [];
104
+ const reason = chapters.unwrapCheck(section);
105
+ return [{ label: own ? t("解散分区") : t("解散所在分区"), icon: ICONS.dissolve, disabled: Boolean(reason), note: reason || undefined, run: () => chapters.unwrap(section, own ? null : units) }];
106
+ };
107
+
108
+ // 分区与分栏 ›: its groups of rows (the sections', the columns', the block around it), a line
109
+ // between them, in one submenu as wide as the menu; no row when none has any.
110
+ const groupRow = (...groups) => {
111
+ const rows = groups.filter((group) => group.length > 0).flatMap((group, at) => (at > 0 ? [{ separator: true }, ...group] : group));
112
+ return rows.length > 0 ? [{ label: t("分区与分栏"), icon: KIND_ICONS.columns, width: WIDTH, submenu: () => rows }] : [];
113
+ };
114
+
115
+ // 选中外层, for a block with a block around it (outerOf: the row of columns, from a column).
116
+ const outerRow = (target) => {
117
+ const outer = outerOf(target);
118
+ return outer?.closest("main") ? [{ label: t("选中外层"), icon: ICONS.outer, run: () => selection.select(outer) }] : [];
119
+ };
120
+
121
+ /**
122
+ * The menu of `target`, by `rect` (the handle), or `side` of it ("right": a section's bar); a
123
+ * tab's below it. onClose: when the menu closes.
124
+ */
125
+ function open(target, rect, side = null, { onClose } = {}) {
126
+ const special = pageOfUnit(target)?.menu?.(target, { rect, reason: keepText(target), remove: () => remove(target) });
127
+ if (special) {
128
+ menu.open(special.items, rect, { label: special.label, width: special.width, onClose });
129
+ return;
130
+ }
131
+ const picked = selection.picked;
132
+ // Several blocks selected, this one among them: what they can do together.
133
+ if (picked.length > 1 && picked.includes(target)) {
134
+ const group = [...picked];
135
+ const refused = group.map((node) => [node, keepText(node, group)]).find(([, reason]) => reason);
136
+ const note = refused ? t("其中的{0}不能删除:{1}", nameOf(refused[0]), refused[1]) : undefined;
137
+ const items = [{ title: t("已选中 {0} 块", group.length) }];
138
+ // The types they can all be turned into (notion-lite's 转换成 for several blocks: offered when
139
+ // every one of them can be turned, their type marked only when they share it), as the grid of
140
+ // one block's menu; a pick turns them all, one undo step, what they are now selected.
141
+ const turn = offeredTurn(turnIntoAll(group));
142
+ if (turn && turn.types.some((type) => type !== turn.current)) {
143
+ const grid = typeGrid(turn.types, turn.current, (type) => {
144
+ menu.close();
145
+ if (type !== turn.current) convertAll(group, type);
146
+ }, { columns: COLUMNS });
147
+ items.push({ node: grid, cells: [...grid.querySelectorAll(".ge-type")], columns: COLUMNS }, { separator: true });
148
+ }
149
+ const colors = colorRow(group);
150
+ items.push(...colors, ...(colors.length > 0 ? [{ separator: true }] : []));
151
+ // Blocks next to each other in the page or a Sheet panel become a section; a selection with gaps does not.
152
+ const wrap = chapters?.wrapCheck(group) ?? null;
153
+ const sections = [...(wrap !== null ? [{ label: t("组成新分区"), icon: ICONS.group, disabled: Boolean(wrap), note: wrap || undefined, run: () => chapters.wrap(group) }] : []), ...dissolveRow(group)];
154
+ // Neighbours in one container go side by side, a column each.
155
+ items.push(...groupRow(sections, splitRows(group)));
156
+ items.push({ label: t("删除"), icon: ICONS.trash, hint: "Del", disabled: Boolean(refused), note, run: () => remove(group) });
157
+ const label = t("{0} 块的操作", group.length);
158
+ menu.open(items, rect, side ? { label, highlight: false, width: WIDTH, side } : { label, highlight: false, width: WIDTH, around: extentOf(target) });
159
+ return;
160
+ }
161
+ const turn = offeredTurn(turnInto(target));
162
+ const items = turn && turn.types.length > 1 ? [] : [{ title: nameOf(target), icon: pageOfUnit(target)?.iconOf?.(target) }];
163
+ if (turn && turn.types.length > 1) {
164
+ const grid = typeGrid(turn.types, turn.current, (type) => {
165
+ menu.close();
166
+ if (type !== turn.current) convert(target, type);
167
+ }, { columns: COLUMNS });
168
+ items.push({ node: grid, cells: [...grid.querySelectorAll(".ge-type")], columns: COLUMNS }, { separator: true });
169
+ }
170
+ // A highlight block's icon (添加图标 / 更换图标: components/icon/page.mjs rowBeside) beside its color.
171
+ const icon = rowBeside(target);
172
+ if (colorable(target) || icon) items.push(...(colorable(target) ? colorRow([target]) : []), ...(icon ? [icon] : []), { separator: true });
173
+ // A component's own rows (an image's: components/image/page.mjs; a table's, with its size's
174
+ // 铺满正文宽度…; a card's, a code block's, a Sheet area's), one group, from its page module.
175
+ const own = pageOfUnit(target)?.menuItems?.(target) ?? [];
176
+ if (own.length > 0) items.push(...own, { separator: true });
177
+ // 在下方新建 (Notion's): resting on it opens the "/" menu's blocks (slash-menu/ typeItems, in a
178
+ // card as wide as this menu, a search field at its top that finds them as "/" does), one of which
179
+ // goes below the block (editor.mjs insertBelow); where the block's box takes none, the row makes
180
+ // a paragraph there.
181
+ if (addable(target)) {
182
+ const types = belowTypes(target);
183
+ const choose = (type) => {
184
+ menu.close();
185
+ if (!menuRow(type)) return; // a package's row, its package gone while the menu stood
186
+ selection.clear();
187
+ rememberType(type);
188
+ below(target, type);
189
+ };
190
+ items.push(types.length > 0
191
+ ? { label: t("在下方新建"), icon: ICONS.plus, width: WIDTH, submenu: () => typeItems(types, choose), search: { placeholder: t("搜索块…"), filter: (text) => typeItems(types, choose, text.trim()), empty: t("没有结果") } }
192
+ : { label: t("在下方新建"), icon: ICONS.plus, run: () => { selection.clear(); below(target, "paragraph"); } });
193
+ }
194
+ const sections = [];
195
+ if (chapter(target)) sections.push({ label: t("在下方新建分区"), icon: ICONS.section, run: () => add(target, "section") });
196
+ if (chapters?.wrapCheck([target]) === "") sections.push({ label: t("组成新分区"), icon: ICONS.group, run: () => chapters.wrap([target]) });
197
+ sections.push(...dissolveRow([target]));
198
+ const splits = splitRows([target]);
199
+ // 选中外层 joins 分区与分栏 › where the block has that submenu; a block with none gets none for it.
200
+ const outer = outerRow(target);
201
+ const grouped = sections.length > 0 || splits.length > 0;
202
+ items.push(...groupRow(sections, splits, grouped ? outer : []));
203
+ if (copyLink) {
204
+ linkAhead();
205
+ items.push({ label: t("复制块链接"), icon: LINK_ICON, run: () => copyLink(target) });
206
+ }
207
+ const reason = keepText(target);
208
+ items.push({ label: t("删除"), icon: ICONS.trash, hint: "Del", disabled: Boolean(reason), note: reason ?? undefined, run: () => remove(target) });
209
+ if (!grouped) items.push(...outer);
210
+ const label = t("{0}的操作", nameOf(target));
211
+ menu.open(items, rect, side ? { label, highlight: false, width: WIDTH, side } : { label, highlight: false, width: WIDTH, around: extentOf(target) });
212
+ }
213
+
214
+ return { open };
215
+ }
@@ -0,0 +1,246 @@
1
+ import { createBlockInfo } from "./block-info.mjs";
2
+ import { createBlockMenu } from "./block-menu/index.mjs";
3
+ import { createDrag } from "./drag/index.mjs";
4
+ import { createHandle } from "./handle/index.mjs";
5
+ import { createMenu } from "./menu.mjs";
6
+ import { createDelete } from "./selection/delete.mjs";
7
+ import { createSelection } from "./selection/index.mjs";
8
+ import { createMarquee } from "./selection/marquee.mjs";
9
+ import { FOLLOW, task } from "./frames.mjs";
10
+ import { entersAfter } from "./beside.mjs";
11
+ import { describe, onSettle, provide, report } from "./overlays.mjs";
12
+ import { pageObjects } from "./page-objects.mjs";
13
+
14
+ // The block tools (docs/editor.md, "Deleting blocks", "Moving blocks", "Selecting blocks"): what
15
+ // the reader does with whole blocks (units: paragraphs, lists, cards, tables, sections, Sheet
16
+ // tabs...; see findUnits in src/editor/source/), each in a folder of its own, wired here:
17
+ //
18
+ // handle/ the handle beside a block (its grip, the bar and "+" beside it), a section's bar; which block the pointer is at
19
+ // block-menu/ the menu a handle opens: turning a block into another type, layout, a new block below, columns, sections, deleting
20
+ // selection/ the selected blocks and their fills; box selection (marquee.mjs); deleting (delete.mjs)
21
+ // drag/ moving blocks: dragging a handle, where they would go (drop.mjs), Ctrl+Shift+arrows
22
+ //
23
+ // What they share: what the page knows of a block (block-info.mjs), the menu card (menu.mjs), one
24
+ // task of the editor's frames (frames.mjs) that keeps the handle, the bar and the fills where their
25
+ // blocks are (it runs only while something shows, and then only when their blocks may have moved),
26
+ // and the keys while the focus is not in text (onKeydown). In each frame every tool's step stands
27
+ // alone: one that throws takes down what that tool draws (a drag is cancelled, never dropped) and is
28
+ // said, and the others go on.
29
+
30
+ /**
31
+ * units: Map(id -> { kind, keep }) and boxes: Map(id -> { kind }) from the edit map. active(): whether block tools may show.
32
+ * struct(parents, touched, mutate): the editor's undoable structural change. look(element,
33
+ * { classes, sizes }, select): the editor's undoable change of classes and sizes (the block menu's colors).
34
+ * say(text, kind, hold): the status line. edit(unit): put the caret into the block's text, if any.
35
+ * turnInto(unit): the types the block can be turned into, { current, types }, or null;
36
+ * convert(unit, type) turns it; turnIntoAll(units) / convertAll(units, type): the same for several
37
+ * selected blocks together (convert.mjs groupTargets, editor.mjs convertAll); below(unit, type): a
38
+ * block of the type below it (the block menu; the editor's insertBelow); add(unit, "section"): a new
39
+ * section right after it, holding a paragraph with the caret. after(unit): a new paragraph right after
40
+ * it, with the caret (false when its box takes none: the editor's insert.paragraphAfter).
41
+ * blank(x, y, target): a click on empty space (the editor: a new
42
+ * paragraph below the last block). nest(units, delta): selected list items indented (Tab) or
43
+ * outdented (Shift+Tab) together (components/list/page.mjs); false when they are not all items.
44
+ * keepsHandle(node): whether a node is another tool's over a block (a table's grips and edges:
45
+ * table/), where the pointer keeps the handle as it is. addNear(unit, where): the handle's "+", an
46
+ * empty block "below" the block (or "above": Alt) with the "/" menu open in it (the editor's addNear).
47
+ * notes: 批注 on blocks (annotate/), for the button beside a block:
48
+ * notes.can(units) whether they can take one, notes.at(unit) where the button beside the block stands,
49
+ * notes.write(units) the annotation begun.
50
+ * copyLink(unit): 复制块链接, the block menu's (the editor's copyBlockLink), or null for no such row.
51
+ * linkAhead(): a block's menu opens with that row in it: what the click will want is read now.
52
+ */
53
+ export function createBlocks({ units, boxes, active, struct, look, say, edit, turnInto, convert, turnIntoAll = () => null, convertAll = () => null, below, belowTypes = () => [], add, after = () => false, blank, nest, keepsHandle = () => false, addNear = () => {}, copyLink = () => {}, linkAhead = () => {}, notes }) {
54
+ const info = createBlockInfo({ units, boxes });
55
+ const menu = createMenu();
56
+ const closeMenu = () => menu.close();
57
+ // What a failed frame takes down: what is drawn, and a drag (cancelled); the selection stays.
58
+ const frames = task("blocks", { run: tick, fail: () => takeDown() });
59
+ const schedule = () => frames.wake();
60
+
61
+ const selection = createSelection({ info, active, say, closeMenu, schedule });
62
+ const drag = createDrag({ info, selection, struct, say, closeMenu, schedule });
63
+ const blockMenu = createBlockMenu({ info, menu, selection, remove: (targets) => remove(targets), turnInto, convert, turnIntoAll, convertAll, below, belowTypes, add, look, copyLink, linkAhead });
64
+ const handle = createHandle({ info, active, selection, drag, menu, openMenu: blockMenu.open, drawing: () => marquee.drawing, schedule, keeps: keepsHandle, add: (target, where) => { selection.clear(); addNear(target, where); }, notes });
65
+ const remove = createDelete({ info, selection, struct, say, closeMenu, forget: () => handle.forget() });
66
+ // What a component makes with these tools (`blockTools`): a Sheet's tabs as Notion's pills, a click, a drag, their menu, + (components/sheets/pills.mjs).
67
+ const parts = pageObjects().flatMap((page) => page.blockTools?.({ active, drag, menu, openMenu: blockMenu.open, struct, say }) ?? []);
68
+ // A press on empty space: a box selection, or a click there (marquee.mjs clears the selection).
69
+ const marquee = createMarquee({
70
+ active: () => active() && !drag.active,
71
+ selection: { get: () => [...selection.picked], set: (list, options) => selection.select(list, options), clear: selection.clear },
72
+ click: blank,
73
+ });
74
+
75
+ // Positions follow scrolling, resizing and reflow: while the handle, the bar or the fills show, the
76
+ // task runs again whenever their blocks may have moved (FOLLOW, frames.mjs), not on every frame (the
77
+ // pointer resting on a paragraph cost 60–160ms a second for the same picture); on every frame only
78
+ // while blocks are dragged (the page scrolls by the window's edge under a still pointer).
79
+ function tick() {
80
+ if (!active()) {
81
+ hide();
82
+ return false;
83
+ }
84
+ step("handle", () => handle.track(), () => handle.hide());
85
+ step("selection", () => selection.prune(), () => selection.unpaint());
86
+ step("drag", () => drag.step(), () => drag.end(false));
87
+ step("selection", () => selection.paint(drag.active), () => selection.unpaint());
88
+ step("handle", () => handle.place(), () => handle.hide());
89
+ if (drag.active) return true;
90
+ return handle.showing || selection.picked.length > 0 ? FOLLOW : false;
91
+ }
92
+
93
+ // One tool's part of a frame; when it throws, what that tool draws goes, and it is said.
94
+ function step(name, run, fail) {
95
+ try {
96
+ run();
97
+ } catch (error) {
98
+ try {
99
+ fail();
100
+ } catch {}
101
+ report(`block tools: ${name}`, error);
102
+ }
103
+ }
104
+
105
+ // A press anywhere but on the block tools closes the menu; on a divider line it selects the line,
106
+ // on empty space it may start a box selection, elsewhere it clears the selection.
107
+ document.addEventListener("pointerdown", (event) => {
108
+ if (handle.holds(event.target) || menu.contains(event.target) || parts.some((part) => part.holds(event.target))) return;
109
+ closeMenu();
110
+ const line = event.button === 0 && active() ? handle.lineAt(event.target, event.clientX, event.clientY) : null;
111
+ if (line) {
112
+ event.preventDefault(); // no caret goes anywhere
113
+ handle.hover(line);
114
+ selection.select(line);
115
+ return;
116
+ }
117
+ if (marquee.begin(event)) return;
118
+ if (selection.picked.length > 0) selection.clear();
119
+ }, true);
120
+ addEventListener("scroll", (event) => { if (!menu.contains(event.target)) closeMenu(); }, { passive: true, capture: true });
121
+ addEventListener("resize", closeMenu);
122
+ addEventListener("blur", closeMenu);
123
+
124
+ /**
125
+ * Keys while the focus is not in editable text. Returns true when handled: with the menu open,
126
+ * ↑/↓ move through it (←/→ along its grid of types) and Enter runs a row; Delete/Backspace delete the selected blocks,
127
+ * Ctrl+Shift+arrows move them, Shift+↑/↓ widen or narrow the selection, Enter edits the first of
128
+ * them (notion-lite's: the caret at the end of its text; a formula block's editor opens) or, when that
129
+ * one is no text (a code block, a highlight block, a disclosure, a card, a table, a divider, a row of
130
+ * columns, a 选项卡区块: beside.mjs entersAfter), puts a new paragraph after the last, arrows select the
131
+ * neighbouring block, Esc cancels a drag, closes the menu or clears the selection.
132
+ */
133
+ function onKeydown(event) {
134
+ if (event.key === "Escape" && (drag.active || menu.isOpen)) {
135
+ event.preventDefault();
136
+ if (drag.active) drag.end(false);
137
+ else closeMenu();
138
+ return true;
139
+ }
140
+ if (drag.active) return true; // keys wait until the block is dropped
141
+ const key = event.key;
142
+ const plain = !event.ctrlKey && !event.metaKey && !event.altKey;
143
+ if (menu.isOpen && plain && menu.arrow(event)) {
144
+ event.preventDefault();
145
+ return true;
146
+ }
147
+ // A letter while 在下方新建's blocks are open: into their search field (menu.mjs type).
148
+ if (menu.isOpen && menu.type(event)) return true;
149
+ // ←/→ move along the menu's grid of types, when one of them is highlighted.
150
+ if (menu.isOpen && plain && (key === "ArrowLeft" || key === "ArrowRight") && menu.move(key === "ArrowRight" ? 1 : -1, true)) {
151
+ event.preventDefault();
152
+ return true;
153
+ }
154
+ if (menu.isOpen && plain && key === "Enter" && menu.hasChoice) {
155
+ event.preventDefault();
156
+ menu.choose();
157
+ return true;
158
+ }
159
+ const picked = selection.picked;
160
+ if (picked.length === 0) return false;
161
+ // Tab and Shift+Tab: selected list items indent or outdent together, staying selected.
162
+ if (key === "Tab" && !event.ctrlKey && !event.metaKey && !event.altKey) {
163
+ event.preventDefault();
164
+ if (nest(picked, event.shiftKey ? -1 : 1)) selection.select([...picked], { quiet: true });
165
+ return true;
166
+ }
167
+ const vertical = key === "ArrowUp" || key === "ArrowDown";
168
+ if ((event.ctrlKey || event.metaKey) && event.shiftKey && !event.altKey && /^Arrow(Up|Down|Left|Right)$/.test(key)) {
169
+ event.preventDefault();
170
+ drag.moveBy(picked, key === "ArrowUp" || key === "ArrowLeft" ? -1 : 1);
171
+ return true;
172
+ }
173
+ if (plain && event.shiftKey && vertical) {
174
+ event.preventDefault();
175
+ selection.extend(key === "ArrowDown" ? 1 : -1);
176
+ return true;
177
+ }
178
+ if (!plain) return false;
179
+ if (key === "Delete" || key === "Backspace") remove(picked);
180
+ else if (key === "Escape") selection.clear();
181
+ else if (key === "Enter") {
182
+ const [first] = picked;
183
+ closeMenu();
184
+ if (!entersAfter(first) || !after(picked.at(-1))) {
185
+ selection.clear();
186
+ edit(first);
187
+ }
188
+ } else if (vertical) {
189
+ // From the first selected block up, from the last down; the selection becomes that one block.
190
+ const from = key === "ArrowDown" ? picked.at(-1) : picked[0];
191
+ const next = selection.sibling(from, key === "ArrowDown") ?? (picked.length > 1 ? from : null);
192
+ if (next) selection.select(next, { quiet: true });
193
+ } else return false;
194
+ event.preventDefault();
195
+ return true;
196
+ }
197
+
198
+ function takeDown() {
199
+ drag.end(false);
200
+ marquee.cancel();
201
+ handle.hide();
202
+ selection.unpaint();
203
+ }
204
+
205
+ function hide() {
206
+ if (drag.active) drag.end(false);
207
+ marquee.cancel();
208
+ handle.hide();
209
+ parts.forEach((part) => part.hide());
210
+ selection.hide();
211
+ closeMenu();
212
+ }
213
+
214
+ // Blocks taken off the page by a structural change: out of the selection, the handle away from them.
215
+ onSettle(() => {
216
+ selection.prune();
217
+ handle.settle();
218
+ });
219
+ provide("blockTools", () => ({ active: active(), ...selection.state(), dragging: drag.active, drawingBox: marquee.drawing, handleShowing: handle.showing, handleTarget: describe(drag.target) }));
220
+
221
+ return {
222
+ onKeydown,
223
+ select: selection.select,
224
+ clear: selection.clear,
225
+ mark: selection.mark,
226
+ keepText: info.keepText,
227
+ moveBy: drag.moveBy,
228
+ remove,
229
+ closeMenu,
230
+ /** A block selected and its menu open by `rect` (a component's own button: an image's 更多). */
231
+ openMenu(target, rect) {
232
+ selection.select(target, { quiet: true });
233
+ blockMenu.open(target, rect);
234
+ },
235
+ /** The reader is typing: the handle steps aside until the pointer moves. */
236
+ typing() {
237
+ handle.typing();
238
+ schedule();
239
+ },
240
+ /** The selected blocks, in document order. */
241
+ get picked() { return [...selection.picked]; },
242
+ /** The editor's UI nodes to keep in the top layer when a modal dialog opens (those drawn over
243
+ * blocks go in the layer of their block's dialog by themselves, overlay-layer.mjs). */
244
+ get nodes() { return [...menu.nodes, ...marquee.nodes, ...drag.nodes, ...parts.flatMap((part) => part.nodes)].filter((node) => node?.isConnected); },
245
+ };
246
+ }