@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,291 @@
1
+ import { MENU_GROUPS, takesFormula, textFilters } from "../../components/registry.mjs";
2
+ import { FORMULA_ICON, LINK_ICON, PAGE_ICON } from "../../components/icons.mjs";
3
+ import { caretRect, hostOf } from "../caret.mjs";
4
+ import { can, isFirstLine } from "../core.mjs";
5
+ import { belowTargets, convertible, typeOf, typedTargets } from "../convert.mjs";
6
+ import { rangeAt, rangeOffsets } from "../marks.mjs";
7
+ import { createMenu } from "../menu.mjs";
8
+ import { offered } from "../offered.mjs";
9
+ import { menuRow, variantKeys } from "../page-objects.mjs";
10
+ import { recentList } from "../storage.mjs";
11
+ import { t } from "../../../shared/i18n/index.mjs";
12
+
13
+ // The "/" menu (docs/editor.md, "New blocks and conversions"), Notion's (notion-lite
14
+ // editor/menus/slash-menu.js): "/" (or "、", "/", the same key with a Chinese input method) typed in
15
+ // a text block opens a menu of blocks at the caret, filtered by what follows it (label, pinyin,
16
+ // initials; while composing too). In a block holding nothing else, a block chosen is what the block
17
+ // turns into; in one with text, a new block of the type goes below it (insertBelow), and so it does
18
+ // below a flowchart node's first line (its title, which turns into nothing: core.mjs firstLineOf); 公式,
19
+ // 链接 and 页面 go where the "/" was. In text no block can come of (a table's cell, a caption, a card's
20
+ // title: what takes links, as the "@" menu goes by) it holds those three alone, where notion-lite opens
21
+ // no menu. Unfiltered, the menu shows 建议 (the four blocks used last, kept on
22
+ // this computer) and the blocks by group, the workspace's component packages the last of those
23
+ // (组件: notion-lite's variants, "installed:<id>", each named as the reader reads and found by its
24
+ // words, offered where a block of its own stands: convert.mjs); filtered, one list. 240px wide, at most min(448px, 40vh)
25
+ // high (its rows scroll), below the caret or above it where there is more room; ↑/↓, Enter or Tab
26
+ // and Esc work while it is open. It closes when the "/" goes, the caret leaves for another block or
27
+ // before the "/", what follows starts with a space or ends with two, or three more characters are
28
+ // typed after nothing matched (a "、" in the middle of text, a Chinese list's comma most often, at
29
+ // once), none of it while an input method composes. The block handle's "+" opens it with no "/" (in
30
+ // the empty block it made: `add`, notion-lite's openAddMenu), filtered by what is typed there. The card
31
+ // is menu.mjs; markdown/ tells it what is typed.
32
+
33
+ /** The characters that open the menu: "/", and what the same key types with a Chinese input method. */
34
+ export const SLASH = new Set(["/", "、", "/"]);
35
+
36
+ // The rows not blocks of their own, where the "/" was (notion-lite's inline section).
37
+ const INLINE = {
38
+ // 公式 is the format bar's (an inline formula; a formula block of its own would be 公式块).
39
+ "inline:formula": { label: t("公式"), icon: FORMULA_ICON, words: "公式 行内公式 gongshi hangneigongshi gs hngs equation inline math latex tex $" },
40
+ "inline:link": { label: t("链接"), icon: LINK_ICON, words: "链接 超链接 lianjie chaolianjie lj link url href" },
41
+ "inline:page": { label: t("页面"), icon: PAGE_ICON, words: "页面 页面块 子页面 yemian yemiankuai ziyemian ym zym page subpage mention" },
42
+ };
43
+
44
+ // Groups of the unfiltered menu: 基本区块, 高级区块 (media, code, tabs and formula blocks: what
45
+ // holds more than text; the types' own `menu`, registry.mjs MENU_GROUPS), 组件 (what the variants
46
+ // are now: the workspace's), and what is no block under 内联.
47
+ const SECTIONS = [
48
+ { title: t("基本区块"), types: () => MENU_GROUPS.basic },
49
+ { title: t("高级区块"), types: () => MENU_GROUPS.advanced },
50
+ { title: t("组件@group"), types: variantKeys },
51
+ ];
52
+
53
+ const infoOf = (key) => INLINE[key] ?? menuRow(key);
54
+
55
+ /**
56
+ * How well a row (a block type, or 公式 / 链接 / 页面) matches what the reader typed after "/": 0 when
57
+ * its name is just that, 1 when one of its words (pinyin, initials, English) is, 2 when one starts
58
+ * with it, 3 when one has it inside; null when none (Notion's order: "gl" is 高亮块 before 折叠列表's
59
+ * "toggle", "链接" the link before 网页书签, which has the word).
60
+ */
61
+ export function matchScore(type, query) {
62
+ const text = query.trim().toLowerCase().replace(/\s/g, "");
63
+ if (!text) return 0;
64
+ const { label, words } = infoOf(type);
65
+ const names = [label.replace(/\s/g, "").toLowerCase(), ...words.split(" ")];
66
+ if (names[0] === text) return 0;
67
+ if (names.includes(text)) return 1;
68
+ if (names.some((name) => name.startsWith(text))) return 2;
69
+ if (names[0].includes(text) || (text.length > 1 && names.some((name) => name.includes(text)))) return 3;
70
+ return null;
71
+ }
72
+
73
+ /** Whether a row matches what the reader typed after "/". */
74
+ export const typeMatches = (type, query) => matchScore(type, query) !== null;
75
+
76
+ // ---------- the blocks used last (建议) ----------
77
+
78
+ const recent = recentList("gallery-edit:recent-types", { max: 8, valid: (key) => typeof key === "string" && Boolean(infoOf(key)) });
79
+
80
+ /** The rows chosen last, newest first. */
81
+ export const recentTypes = () => recent.read();
82
+
83
+ /** A row chosen: first among the recent ones. */
84
+ export const rememberType = (key) => recent.use(key);
85
+
86
+ /**
87
+ * The menu's items for `those` (block types, and 公式 / 链接 / 页面 as "inline:formula" / "inline:link" / "inline:page"),
88
+ * but what the reader hid (offered.mjs) and a package's row that went while a card stood open, run(key) choosing one: filtered by `query`, one list; else
89
+ * 建议 and the groups. The block menu's 在下方新建 shows the same (block-menu/). `blocks`: in a block
90
+ * holding nothing but the "/…", whose type it would become — the blocks that match come before what
91
+ * goes in the text (/gs: 公式块, then 公式), as in text the best match comes first (公式, then 公式块).
92
+ */
93
+ export function typeItems(those, run, query = "", { blocks = false } = {}) {
94
+ const keys = offered(those).filter(infoOf);
95
+ const rowOf = (key) => ({ ...infoOf(key), run: () => run(key) });
96
+ if (query) {
97
+ // Best match first, the menu's order within each (sort is stable).
98
+ const rank = (key, score) => (blocks && INLINE[key] ? 10 : 0) + score;
99
+ return keys.map((key) => [key, matchScore(key, query)]).filter(([, score]) => score !== null).sort((a, b) => rank(a[0], a[1]) - rank(b[0], b[1])).map(([key]) => rowOf(key));
100
+ }
101
+ const items = [];
102
+ const recent = recentTypes().filter((key) => keys.includes(key)).slice(0, 4);
103
+ if (recent.length > 0) items.push({ title: t("建议") }, ...recent.map(rowOf));
104
+ for (const { title, types } of SECTIONS) {
105
+ const shown = types().filter((key) => keys.includes(key));
106
+ if (shown.length > 0) items.push({ title }, ...shown.map(rowOf));
107
+ }
108
+ const inline = keys.filter((key) => INLINE[key]);
109
+ if (inline.length > 0) items.push({ title: t("内联") }, ...inline.map(rowOf));
110
+ return items;
111
+ }
112
+
113
+ /**
114
+ * convert(host, type, typed): the block, holding nothing but the "/…" typed (`typed`, a range of it),
115
+ * turned into the type (editor.mjs convertHost); insertBelow(host, type, typed): a new block of the
116
+ * type below the block, the typed "/…" taken away; inline.formula(host, typed), inline.link(host,
117
+ * typed) and inline.page(host, typed): a formula, a link or a page block where the "/…" was, its field
118
+ * open. composing():
119
+ * whether an input method is composing (editor.mjs). closed(host): the menu the "+" opened in `host`
120
+ * closed (its hint, 输入以筛选…, goes: typing/ updatePlaceholder).
121
+ */
122
+ export function createSlashMenu({ convert, insertBelow, inline, composing = () => false, closed = () => {} }) {
123
+ const menu = createMenu();
124
+ let slash = null; // { host, at, char, quiet, missed }: the block, where the "/" is (a character offset), which
125
+
126
+ const caretOffset = (host) => {
127
+ const selection = getSelection();
128
+ return selection.rangeCount && selection.isCollapsed && host.contains(selection.anchorNode) ? rangeOffsets(host, selection.getRangeAt(0))[1] : null;
129
+ };
130
+
131
+ function rect(host) {
132
+ const selection = getSelection();
133
+ const caret = selection.rangeCount && host.contains(selection.anchorNode) ? caretRect(selection.getRangeAt(0)) : null;
134
+ const box = host.getBoundingClientRect();
135
+ return caret ? { left: caret.left - 4, top: caret.top, bottom: caret.bottom } : { left: box.left, top: box.top, bottom: box.bottom };
136
+ }
137
+
138
+ // The "/…" typed (`state`: where the menu opened), as a range of the block, or null when it is not
139
+ // there any more (deleted, or the caret before it). Opened by the handle's "+" (`char` null: no
140
+ // "/"), what is typed from where it opened, nothing at first.
141
+ function typedRange(state) {
142
+ const caret = caretOffset(state.host);
143
+ if (caret === null || caret < state.at || (state.char && caret === state.at)) return null;
144
+ const range = rangeAt(state.host, [state.at, caret]);
145
+ return !state.char || range.toString()[0] === state.char ? range : null;
146
+ }
147
+
148
+ // Whether a block can come of a "/" typed in it: what it turns into, or a block below it.
149
+ const takesBlocks = (host) => convertible(host) || can(host, "split");
150
+
151
+ // Whether the block holds nothing but the "/…": then a block chosen is what it turns into (a node's
152
+ // title never: what is chosen goes below it).
153
+ const alone = (host, typed) => !isFirstLine(host) && host.textContent.replace(/\s/g, "") === typed.toString().replace(/\s/g, "") && !host.querySelector("[data-ge-atom]");
154
+
155
+ // The rows for what follows the "/"; null closes the menu. While a Chinese input method composes
156
+ // pinyin there, it shows it with its syllables apart ("gs" as "g's" or "g s"): what is looked for is
157
+ // its letters, as Enter puts them in (the menu staying open for a second Enter to choose).
158
+ function rows() {
159
+ const state = slash;
160
+ const { host } = state;
161
+ const typed = typedRange(state);
162
+ if (!typed) return null;
163
+ const written = typed.toString().slice(state.char ? 1 : 0).replace(/ /g, " ");
164
+ const query = composing() ? written.replace(/['\s]/g, "") : written;
165
+ if (/^\s/.test(query) || /\s\s$/.test(query) || (query.length > 16 && !composing())) return null;
166
+ const empty = alone(host, typed);
167
+ const blocks = !takesBlocks(host) ? [] : empty ? typedTargets(host, true) : belowTargets(host);
168
+ const keys = [...blocks, ...(can(host, "links") ? Object.keys(INLINE).filter((key) => key !== "inline:formula" || takesFormula(host)) : [])];
169
+ const found = typeItems(keys, (key) => choose(state, key), query, { blocks: empty }); // the menu closes before a row runs
170
+ if (found.length > 0) {
171
+ slash.missed = null;
172
+ return found;
173
+ }
174
+ // Letters being composed are no text yet: what they turn into is looked for once they do, a
175
+ // package's name that its words do not spell in pinyin among it.
176
+ if (composing()) return found;
177
+ if (slash.quiet) return null; // "甲、乙": a comma, not a menu
178
+ slash.missed ??= query.length;
179
+ return query.length - slash.missed >= 3 ? null : found;
180
+ }
181
+
182
+ function open() {
183
+ const found = rows();
184
+ if (!found) {
185
+ slash = null;
186
+ return;
187
+ }
188
+ menu.open(found, rect(slash.host), {
189
+ label: t("插入块"),
190
+ empty: t("没有结果"),
191
+ width: 240,
192
+ height: Math.min(448, Math.round(innerHeight * 0.4)),
193
+ gap: 8,
194
+ onClose: () => {
195
+ const added = slash && !slash.char ? slash.host : null;
196
+ slash = null;
197
+ if (added) closed(added);
198
+ },
199
+ });
200
+ }
201
+
202
+ // The rows follow what is typed after the "/", and the menu its block.
203
+ function update() {
204
+ const found = slash?.host.isConnected ? rows() : null;
205
+ if (found) menu.update(found, rect(slash.host));
206
+ else menu.close();
207
+ }
208
+
209
+ // The typed "/…" goes, then: the block turns into the type (it held nothing else), a block of the
210
+ // type goes below it, or a formula or link goes where the "/" was.
211
+ function choose(state, key) {
212
+ const { host } = state;
213
+ const typed = typedRange(state);
214
+ menu.close();
215
+ if (!typed || !infoOf(key)) return; // (a package's row, its package gone while the menu stood)
216
+ rememberType(key);
217
+ // Opened by the "+" and nothing typed: the empty block's own type chosen changes nothing (no
218
+ // undo step that does nothing).
219
+ if (!state.char && typed.collapsed && typeOf(host) === key && alone(host, typed)) return;
220
+ if (key === "inline:formula") return inline.formula(host, typed);
221
+ if (key === "inline:link") return inline.link(host, typed);
222
+ if (key === "inline:page") return inline.page(host, typed);
223
+ if (alone(host, typed)) return convert(host, key, typed);
224
+ // At the block's end, the spaces typed before the "/" go with it (they were for the menu).
225
+ const [start, end] = rangeOffsets(host, typed);
226
+ const rest = document.createRange();
227
+ rest.selectNodeContents(host);
228
+ rest.setStart(typed.endContainer, typed.endOffset);
229
+ let from = start;
230
+ if (!rest.toString().trim()) while (from > 0 && /^\s$/.test(rangeAt(host, [from - 1, from]).toString())) from--;
231
+ insertBelow(host, key, from < start ? rangeAt(host, [from, end]) : typed);
232
+ }
233
+
234
+ return {
235
+ /**
236
+ * Text typed in `host`, `before` the caret: the menu opens when it ends with a "/" standing at the
237
+ * block's start, after a space, a whole in the text or a character no Latin word or address has
238
+ * ("and/or" and "https:/" open nothing; "、" anywhere), in a text block a block can be made from, or
239
+ * that takes links. `whole`: the block's text. Returns whether it opened.
240
+ */
241
+ typed(host, before, whole) {
242
+ const char = before.at(-1);
243
+ if (!SLASH.has(char) || !textFilters(host) || can(host, "plain") || !(takesBlocks(host) || can(host, "links"))) return false;
244
+ const caret = caretOffset(host);
245
+ if (caret === null) return false;
246
+ const previous = before.at(-2);
247
+ const word = previous !== undefined && !/\s/.test(previous) && /[\x21-\x7e]/.test(previous);
248
+ if (char !== "、" && word && !rangeAt(host, [caret - 2, caret - 1]).cloneContents().querySelector("[data-ge-atom]")) return false;
249
+ slash = { host, at: caret - 1, char, quiet: char === "、" && whole !== char, missed: null };
250
+ open();
251
+ return Boolean(slash);
252
+ },
253
+ /**
254
+ * The menu opened with no "/" typed, at the caret in `host` (an empty block the block handle's
255
+ * "+" made: notion-lite's openAddMenu): unfiltered, then filtered by what is typed from there, the
256
+ * rest as after a "/" (a block chosen is what the empty block turns into). Returns whether it opened.
257
+ */
258
+ add(host) {
259
+ const caret = caretOffset(host);
260
+ if (caret === null) return false;
261
+ slash = { host, at: caret, char: null, quiet: false, missed: null };
262
+ open();
263
+ return Boolean(slash);
264
+ },
265
+ /** The block the menu is open in, opened by the "+" (`add`), or null. */
266
+ get adding() { return slash && !slash.char && menu.isOpen ? slash.host : null; },
267
+ update,
268
+ close: () => menu.close(),
269
+ /**
270
+ * Keys while the menu is open, in its block (the caret's: a block a list item holds is edited in
271
+ * the item's element, which the keys go to, hostOf). Returns true when handled.
272
+ */
273
+ key(event) {
274
+ if (!menu.isOpen || hostOf(event) !== slash?.host || event.isComposing || event.keyCode === 229) return false;
275
+ if (!menu.arrow(event)) {
276
+ if ((event.key === "Enter" || event.key === "Tab") && menu.hasChoice) menu.choose();
277
+ else if (event.key === "Escape") menu.close();
278
+ else {
279
+ if (event.key === "Enter") menu.close();
280
+ return false;
281
+ }
282
+ }
283
+ event.preventDefault();
284
+ return true;
285
+ },
286
+ /** The block the menu is open for, or null. */
287
+ get host() { return slash?.host ?? null; },
288
+ contains: (node) => menu.contains(node),
289
+ get nodes() { return menu.nodes; },
290
+ };
291
+ }
@@ -0,0 +1,48 @@
1
+ // What the editor keeps in the browser's storage: its crash buffer and tab (autosave.mjs, as strings),
2
+ // the format brush, the colors, formulas and blocks used lately (JSON). Every call is safe where the
3
+ // storage is not: a private window, blocked site data or a full quota store nothing and read nothing,
4
+ // and the page works without (a list used lately is then kept for the page's life only).
5
+
6
+ /** A storage area (`area()`: localStorage or sessionStorage) whose calls never throw. */
7
+ export const storageOf = (area) => ({
8
+ get(key) { try { return area().getItem(key); } catch { return null; } },
9
+ set(key, value) { try { area().setItem(key, value); return true; } catch { return false; } },
10
+ remove(key) { try { area().removeItem(key); } catch {} },
11
+ keys() { try { return Object.keys(area()); } catch { return []; } },
12
+ });
13
+
14
+ /** localStorage, safe. */
15
+ export const local = storageOf(() => localStorage);
16
+
17
+ /** What `key` holds as JSON when `valid` says it is fit (by default: when there is something), else `fallback`. */
18
+ export function stored(key, fallback, valid = (value) => value !== null) {
19
+ try {
20
+ const saved = JSON.parse(local.get(key) ?? "null");
21
+ if (valid(saved)) return saved;
22
+ } catch {}
23
+ return fallback;
24
+ }
25
+
26
+ /** `value` stored as JSON under `key`. */
27
+ export const keep = (key, value) => local.set(key, JSON.stringify(value));
28
+
29
+ /**
30
+ * A list of what was used lately, newest first, kept under `key`: { read(), use(entry) }. At most
31
+ * `max` entries, those `valid` says are fit (`fallback` when none are); an entry used again moves to
32
+ * the front (`same(a, b)`: whether two are one).
33
+ */
34
+ export function recentList(key, { max, valid = () => true, same = (a, b) => a === b, fallback = [] }) {
35
+ let list = stored(key, [], Array.isArray);
36
+ const fits = (entry) => { try { return valid(entry); } catch { return false; } }; // an entry that is no object
37
+ const read = () => {
38
+ const fit = list.filter(fits).slice(0, max);
39
+ return fit.length > 0 ? fit : fallback;
40
+ };
41
+ return {
42
+ read,
43
+ use(entry) {
44
+ list = [entry, ...read().filter((other) => !same(other, entry))].slice(0, max);
45
+ keep(key, list);
46
+ },
47
+ };
48
+ }
@@ -0,0 +1,267 @@
1
+ import { ELEMENT_ID, atomSources, knowAtoms } from "./core.mjs";
2
+ import { BLOCK_TYPES, blockTypeOf, boxRole } from "../components/registry.mjs";
3
+ import { COPY_KEYS } from "../components/figure/index.mjs";
4
+ import { ownTypeOf } from "./convert.mjs";
5
+ import { pageOfUnit } from "./page-objects.mjs";
6
+
7
+ // The page's sync state, as the marks the editor reads (docs/editor.md, "Sync state"). What of
8
+ // the file each element is lives in the commits' table (commit.mjs), under the element's identity
9
+ // (core.mjs ELEMENT_ID), which never changes; the marks are written from that table here, and
10
+ // nowhere else once the page is edited:
11
+ //
12
+ // data-ge-unit, data-block-id the unit it is, and the unit's id in the file
13
+ // data-ge-block the text block it is (not while its unit is turned into another type)
14
+ // data-ge-box the box it is (an empty value: a box made on the page)
15
+ // data-ge-new made on the page: what the file does not have (yet)
16
+ // data-ge-part a text block of a block made on the page whose words the file writes
17
+ // from elsewhere (components/installed/page.mjs), until the answer names it
18
+ // data-ge-convert, data-ge-type turned into another type than its unit showed as when last
19
+ // committed: the next commit converts the unit (the type it goes as)
20
+ // data-ge-keep, data-ge-keep-own what the file says keeps it
21
+ // data-ge-grid the file's table is one the table tools are for (a table made on the
22
+ // page has it until the file says: components/table/page.mjs newTable)
23
+ //
24
+ // So undo, which brings elements back as they were, never brings back what the file had: an
25
+ // element it puts back is marked from the table like every other (the element a block was turned
26
+ // from is that unit again, of the type it shows, and turns the unit back). An element whose unit
27
+ // the file dropped while the page still showed it (emptied, or a list going with its last item)
28
+ // is marked as made on the page (asMade), as is everything of the file it was.
29
+
30
+ const set = (node, name, value) => {
31
+ if (node.getAttribute(name) !== value) node.setAttribute(name, value);
32
+ };
33
+
34
+ /**
35
+ * Write the marks of `nodes` (elements with an identity) from the commits' table, `view`:
36
+ * entry(identity) { unit, block, box }: what of the file it is (undefined: made on the page)
37
+ * dropped(identity) { unit, block, box }: what of the file it was, which the file dropped
38
+ * keyed(identity) a keyed block (a detail card) made on the page that the file has
39
+ * proposal(identity) the id a block made on the page proposes, once it proposes one
40
+ * units, blocks, boxes the map's entries
41
+ * shown(unit) the type a unit showed as when last committed (convert.mjs ownTypeOf), if known
42
+ * element(unit) the element standing for a unit on the page, if any
43
+ */
44
+ export function project(nodes, view) {
45
+ // A unit whose element on the page is of another type than it showed: converted, until committed.
46
+ const turnedOn = (unit, node) => {
47
+ const shown = view.shown(unit);
48
+ return shown !== undefined && Boolean(node) && ownTypeOf(node) !== shown;
49
+ };
50
+ const turned = new Map();
51
+ const turnedUnit = (unit) => {
52
+ if (!turned.has(unit)) turned.set(unit, turnedOn(unit, view.element(unit)));
53
+ return turned.get(unit);
54
+ };
55
+ for (const node of nodes) {
56
+ const key = node.getAttribute(ELEMENT_ID);
57
+ const gone = view.dropped(key);
58
+ if (gone) {
59
+ asMade(node, gone);
60
+ continue;
61
+ }
62
+ if (view.keyed(key)) for (const name of ["data-ge-new", "data-ge-type", "data-ge-unit-kind"]) node.removeAttribute(name);
63
+ const entry = view.entry(key);
64
+ if (entry?.unit === undefined && view.proposal(key)) set(node, "data-block-id", view.proposal(key));
65
+ if (!entry) continue;
66
+ const { unit, block, box } = entry;
67
+ let other = false;
68
+ if (unit === undefined) {
69
+ node.removeAttribute("data-ge-unit");
70
+ node.removeAttribute("data-ge-convert");
71
+ } else {
72
+ const info = view.units[unit];
73
+ other = turnedOn(unit, node);
74
+ set(node, "data-ge-unit", String(unit));
75
+ if (info.blockId) set(node, "data-block-id", info.blockId);
76
+ if (info.keep) set(node, "data-ge-keep", info.keep.reason);
77
+ else node.removeAttribute("data-ge-keep");
78
+ node.toggleAttribute("data-ge-keep-own", Boolean(info.keep?.own));
79
+ node.toggleAttribute("data-ge-grid", Boolean(info.grid));
80
+ if (node.hasAttribute("data-ge-copy")) { // a copy, a unit of the file now
81
+ node.removeAttribute("data-ge-copy");
82
+ node.removeAttribute("data-ge-type");
83
+ node.removeAttribute(COPY_KEYS); // its charts' keys, written
84
+ }
85
+ if (other) {
86
+ set(node, "data-ge-convert", String(unit));
87
+ set(node, "data-ge-type", ownTypeOf(node));
88
+ set(node, "data-ge-new", "");
89
+ } else {
90
+ node.removeAttribute("data-ge-convert");
91
+ node.removeAttribute("data-ge-new");
92
+ if (info.kind) set(node, "data-ge-unit-kind", info.kind);
93
+ }
94
+ }
95
+ if (block === undefined) node.removeAttribute("data-ge-block");
96
+ else {
97
+ const info = view.blocks[block];
98
+ const owner = info?.unit;
99
+ // The text of a unit turned into another type goes with the conversion: a text block made
100
+ // on the page until it is committed.
101
+ const off = !info || info.gone || (owner !== null && owner !== undefined && (owner === unit ? other : turnedUnit(owner)));
102
+ if (off) {
103
+ node.removeAttribute("data-ge-block");
104
+ if (node.getAttribute("contenteditable") === "true") set(node, "data-ge-new", "");
105
+ } else {
106
+ set(node, "data-ge-block", String(block));
107
+ node.removeAttribute("data-ge-part");
108
+ if (unit === undefined) node.removeAttribute("data-ge-new");
109
+ }
110
+ }
111
+ if (box !== undefined) {
112
+ set(node, "data-ge-box", String(box));
113
+ if (view.boxes[box]?.kind) set(node, "data-ge-box-kind", view.boxes[box].kind);
114
+ if (unit === undefined && block === undefined) node.removeAttribute("data-ge-new");
115
+ }
116
+ }
117
+ }
118
+
119
+ /**
120
+ * The marks of an element the file dropped while the page still showed it (`what`: the unit, text
121
+ * block or box it was): made on the page from now on, written as a new block where it stands
122
+ * once it has something to write, never named as what the file dropped (that would be a conflict,
123
+ * or text lost). A container whose blocks went elsewhere is a new one of its type (undo putting it
124
+ * back makes it again around the blocks it held); a block its component writes from what it holds
125
+ * says so (`renew`: what the page shows of it is the reader's, and it is known by no tag or class); a
126
+ * text block a new one; a box a box made on the page.
127
+ */
128
+ export function asMade(element, what) {
129
+ if (what.unit !== undefined) {
130
+ const type = pageOfUnit(element)?.renew?.(element) ? null : containerTypeOf(element);
131
+ if (type) reviveMarks(element, type);
132
+ else renewMarks(element);
133
+ } else if (what.block !== undefined) {
134
+ element.removeAttribute("data-ge-block");
135
+ set(element, "data-ge-new", "");
136
+ } else if (what.box !== undefined && boxRole(element.getAttribute("data-ge-box-kind")) !== "nest") {
137
+ set(element, "data-ge-box", "");
138
+ }
139
+ }
140
+
141
+ // A text block's or other unit's marks, as made on the page: of its own type (a quote's paragraph
142
+ // as a paragraph, a divider as a divider, a highlight block's icon as an icon: the type its class
143
+ // tells before the first of its tag); an item's box for lists went with it (a new item's lists are
144
+ // written with it).
145
+ function renewMarks(element) {
146
+ if (!element.hasAttribute("data-ge-type")) {
147
+ const own = ownTypeOf(element);
148
+ const type = BLOCK_TYPES[own] ? own : blockTypeOf(element) ?? Object.keys(BLOCK_TYPES).find((each) => !BLOCK_TYPES[each].box && BLOCK_TYPES[each].tag === element.localName) ?? "paragraph";
149
+ element.setAttribute("data-ge-type", type);
150
+ }
151
+ for (const name of ["data-ge-block", "data-ge-unit", "data-ge-convert", "data-block-id"]) element.removeAttribute(name);
152
+ set(element, "data-ge-new", "");
153
+ if (boxRole(element.getAttribute("data-ge-box-kind")) === "nest") {
154
+ element.removeAttribute("data-ge-box");
155
+ element.removeAttribute("data-ge-box-kind");
156
+ }
157
+ }
158
+
159
+ // A container's marks, as one made on the page (core.mjs newContainer): a section, a list, quote,
160
+ // panel or disclosure, a row of columns or a column.
161
+ function reviveMarks(element, type) {
162
+ const spec = BLOCK_TYPES[type];
163
+ for (const [name, value] of [["data-ge-new", ""], ["data-ge-type", type], ["data-ge-unit-kind", spec.kind], ["data-ge-pure", ""]]) set(element, name, value);
164
+ for (const name of ["data-ge-unit", "data-block-id", "data-ge-convert"]) element.removeAttribute(name);
165
+ const box = spec.content?.(element) ?? element;
166
+ if (box) {
167
+ set(box, "data-ge-box", "");
168
+ set(box, "data-ge-box-kind", spec.box);
169
+ }
170
+ const title = spec.title?.(element) ?? null;
171
+ if (title) {
172
+ title.removeAttribute("data-ge-block");
173
+ set(title, "data-ge-new", "");
174
+ }
175
+ }
176
+
177
+ /** The type of container a unit's element is (a section, a list, quote, panel or disclosure, a row of columns or a column: a type with a box), or null. */
178
+ export function containerTypeOf(element) {
179
+ const own = ownTypeOf(element);
180
+ const type = BLOCK_TYPES[own]?.box ? own : blockTypeOf(element);
181
+ return BLOCK_TYPES[type]?.box && !BLOCK_TYPES[type].keyed ? type : null;
182
+ }
183
+
184
+ // ---------- kept for the next page ----------
185
+ // What the commits know goes to the crash buffer with the page as it is (autosave.mjs), so that a
186
+ // page opening once this one is gone takes up exactly where it was: the commit whose answer it
187
+ // never learned taken in on the answer, the next one found against what that left (recover).
188
+
189
+ const REF = "data-ge-ref";
190
+
191
+ /**
192
+ * `value` (the commits' save()) as JSON: its Maps and Sets, and the elements it names as marks in
193
+ * `document`'s body (as it is, the editor's own UI left out) or, off the page, in the trees they are
194
+ * in, with the sources of the chips there, which this page alone knows (core.mjs atomSources).
195
+ * { html, detached: [html], data, atoms }
196
+ */
197
+ export function pack(document, value) {
198
+ const refs = new Map();
199
+ const encode = (item) => {
200
+ if (item === null || typeof item !== "object") return item;
201
+ if (item.nodeType === 9) return { $doc: 1 };
202
+ if (item.nodeType === 1) {
203
+ if (!refs.has(item)) refs.set(item, refs.size);
204
+ return { $el: refs.get(item) };
205
+ }
206
+ if (item instanceof Map) return { $map: [...item].map(([key, entry]) => [encode(key), encode(entry)]) };
207
+ if (item instanceof Set) return { $set: [...item].map(encode) };
208
+ if (Array.isArray(item)) return item.map(encode);
209
+ return Object.fromEntries(Object.entries(item).map(([key, entry]) => [key, encode(entry)]));
210
+ };
211
+ const data = encode(value);
212
+ const roots = new Set();
213
+ for (const [element, index] of refs) {
214
+ element.setAttribute(REF, String(index));
215
+ if (element.isConnected) continue;
216
+ let top = element;
217
+ while (top.parentElement) top = top.parentElement;
218
+ roots.add(top);
219
+ }
220
+ try {
221
+ const body = document.body.cloneNode(true);
222
+ body.querySelectorAll("[data-doc-dev]").forEach((node) => node.remove());
223
+ return { html: body.innerHTML, detached: [...roots].map((root) => root.outerHTML), data, atoms: atomSources([body, ...roots]) };
224
+ } finally {
225
+ for (const element of refs.keys()) element.removeAttribute(REF);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * What pack() kept, back as values, its elements in a document of their own (`parse`: html -> a
231
+ * document), its chips known to this page (knowAtoms); one that cannot be found stands as an element
232
+ * off the page. { document, value }
233
+ */
234
+ export function unpack({ html, detached = [], data, atoms = {} }, parse) {
235
+ knowAtoms(atoms);
236
+ const document = parse(`<!doctype html><html><head></head><body>${html}</body></html>`);
237
+ const found = new Map();
238
+ const take = (root) => {
239
+ for (const node of [root, ...root.querySelectorAll(`[${REF}]`)]) {
240
+ if (!node.hasAttribute(REF)) continue;
241
+ found.set(Number(node.getAttribute(REF)), node);
242
+ node.removeAttribute(REF);
243
+ }
244
+ };
245
+ take(document.documentElement);
246
+ for (const tree of detached) {
247
+ const template = document.createElement("template");
248
+ template.innerHTML = tree;
249
+ const root = template.content.firstElementChild;
250
+ if (!root) continue;
251
+ take(document.adoptNode(root));
252
+ }
253
+ const elementOf = (index) => {
254
+ if (!found.has(index)) found.set(index, document.createElement("div"));
255
+ return found.get(index);
256
+ };
257
+ const decode = (item) => {
258
+ if (item === null || typeof item !== "object") return item;
259
+ if (Array.isArray(item)) return item.map(decode);
260
+ if ("$doc" in item) return document;
261
+ if ("$el" in item) return elementOf(item.$el);
262
+ if ("$map" in item) return new Map(item.$map.map(([key, entry]) => [decode(key), decode(entry)]));
263
+ if ("$set" in item) return new Set(item.$set.map(decode));
264
+ return Object.fromEntries(Object.entries(item).map(([key, entry]) => [key, decode(entry)]));
265
+ };
266
+ return { document, value: decode(data) };
267
+ }
@@ -0,0 +1,29 @@
1
+ import { CELL_ALIGNS, CELL_VALIGNS } from "../../components/table/index.mjs";
2
+ import { TABLE_ICONS } from "./icons.mjs";
3
+
4
+ // The alignments a cell may have (components/table/index.mjs CELL_ALIGNS, CELL_VALIGNS), as the
5
+ // cells' bar and a column's menu offer them: the three, then the three vertical ones.
6
+
7
+ /** What all of `cells` have of one group of alignments: the class's name, null when they have none (the kit's own), undefined when they differ. */
8
+ export function sharedAlign(cells, group) {
9
+ const of = (cell) => group.find(([name]) => cell.classList.contains(name))?.[0] ?? null;
10
+ return cells.every((cell) => of(cell) === of(cells[0])) ? of(cells[0]) : undefined;
11
+ }
12
+
13
+ /** The look that gives cells the alignment `name`: its class on, the others of its group off. */
14
+ export function alignLook(name) {
15
+ const group = CELL_VALIGNS.some(([each]) => each === name) ? CELL_VALIGNS : CELL_ALIGNS;
16
+ return { classes: Object.fromEntries(group.map(([each]) => [each, each === name])) };
17
+ }
18
+
19
+ /**
20
+ * The alignments to offer for `cells`: [{ name, label, icon, vertical, current, run }], each
21
+ * `current` when all the cells have it (cells with none have the first of its group, the kit's
22
+ * own, but differing cells have none), `run` (when `apply` is given) calling `apply(name)`.
23
+ */
24
+ export function alignItems(cells, apply = null) {
25
+ return [CELL_ALIGNS, CELL_VALIGNS].flatMap((group, index) => {
26
+ const shared = cells.length > 0 ? sharedAlign(cells, group) : undefined;
27
+ return group.map(([name, label]) => ({ name, label, icon: TABLE_ICONS[name], vertical: index === 1, current: shared !== undefined && (shared ?? group[0][0]) === name, run: () => apply?.(name) }));
28
+ });
29
+ }