@heycys/gallery 0.0.0-stage → 0.1.1

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 (806) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/THIRD-PARTY-NOTICES.md +3303 -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 +64 -0
  11. package/browser/editor/components/code/index.mjs +327 -0
  12. package/browser/editor/components/code/page.mjs +561 -0
  13. package/browser/editor/components/colors.mjs +50 -0
  14. package/browser/editor/components/columns/index.mjs +104 -0
  15. package/browser/editor/components/columns/page.mjs +310 -0
  16. package/browser/editor/components/details/index.mjs +73 -0
  17. package/browser/editor/components/details/page.mjs +86 -0
  18. package/browser/editor/components/dialog/index.mjs +84 -0
  19. package/browser/editor/components/dialog/page.mjs +201 -0
  20. package/browser/editor/components/divider/index.mjs +48 -0
  21. package/browser/editor/components/embed/icons.mjs +11 -0
  22. package/browser/editor/components/embed/index.mjs +123 -0
  23. package/browser/editor/components/embed/page.mjs +309 -0
  24. package/browser/editor/components/figure/index.mjs +87 -0
  25. package/browser/editor/components/figure/page.mjs +42 -0
  26. package/browser/editor/components/file/icons.mjs +14 -0
  27. package/browser/editor/components/file/index.mjs +77 -0
  28. package/browser/editor/components/file/page.mjs +114 -0
  29. package/browser/editor/components/flowchart/add.mjs +123 -0
  30. package/browser/editor/components/flowchart/index.mjs +246 -0
  31. package/browser/editor/components/flowchart/page.mjs +453 -0
  32. package/browser/editor/components/heading/index.mjs +53 -0
  33. package/browser/editor/components/heading/page.mjs +6 -0
  34. package/browser/editor/components/highlight/index.mjs +63 -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 +48 -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 +179 -0
  43. package/browser/editor/components/installed/page.mjs +523 -0
  44. package/browser/editor/components/installed/served.mjs +35 -0
  45. package/browser/editor/components/kit.mjs +67 -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 +192 -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 +859 -0
  66. package/browser/editor/components/rows.mjs +16 -0
  67. package/browser/editor/components/section/index.mjs +42 -0
  68. package/browser/editor/components/section/page.mjs +141 -0
  69. package/browser/editor/components/set-apart.mjs +24 -0
  70. package/browser/editor/components/sheets/index.mjs +137 -0
  71. package/browser/editor/components/sheets/page.mjs +227 -0
  72. package/browser/editor/components/sheets/pills.mjs +226 -0
  73. package/browser/editor/components/table/grid.mjs +73 -0
  74. package/browser/editor/components/table/index.mjs +308 -0
  75. package/browser/editor/components/table/page.mjs +683 -0
  76. package/browser/editor/components/table/slots.mjs +41 -0
  77. package/browser/editor/components/widget/index.mjs +50 -0
  78. package/browser/editor/page/annotate/anchors.mjs +230 -0
  79. package/browser/editor/page/annotate/card.mjs +102 -0
  80. package/browser/editor/page/annotate/index.mjs +1656 -0
  81. package/browser/editor/page/at-menu/index.mjs +317 -0
  82. package/browser/editor/page/autosave.mjs +1023 -0
  83. package/browser/editor/page/beside.mjs +21 -0
  84. package/browser/editor/page/block-info.mjs +63 -0
  85. package/browser/editor/page/block-menu/colors.mjs +84 -0
  86. package/browser/editor/page/block-menu/index.mjs +217 -0
  87. package/browser/editor/page/blocks.mjs +255 -0
  88. package/browser/editor/page/caret.mjs +682 -0
  89. package/browser/editor/page/changes/bar.mjs +102 -0
  90. package/browser/editor/page/changes/ghost.mjs +206 -0
  91. package/browser/editor/page/changes/gone-words.mjs +94 -0
  92. package/browser/editor/page/changes/index.mjs +447 -0
  93. package/browser/editor/page/changes/words.mjs +27 -0
  94. package/browser/editor/page/chip-fills.mjs +126 -0
  95. package/browser/editor/page/clipboard/import/colors.mjs +192 -0
  96. package/browser/editor/page/clipboard/import/html.mjs +792 -0
  97. package/browser/editor/page/clipboard/import/inline.mjs +232 -0
  98. package/browser/editor/page/clipboard/import/languages.mjs +42 -0
  99. package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
  100. package/browser/editor/page/clipboard/import/math.mjs +100 -0
  101. package/browser/editor/page/clipboard/import/office.mjs +245 -0
  102. package/browser/editor/page/clipboard/import/read.mjs +120 -0
  103. package/browser/editor/page/clipboard/import/rich.mjs +29 -0
  104. package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
  105. package/browser/editor/page/clipboard/index.mjs +816 -0
  106. package/browser/editor/page/clipboard/own/blocks.mjs +211 -0
  107. package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
  108. package/browser/editor/page/clipboard/own/describe.mjs +124 -0
  109. package/browser/editor/page/clipboard/own/export.mjs +167 -0
  110. package/browser/editor/page/clipboard/own/ids.mjs +39 -0
  111. package/browser/editor/page/clipboard/own/index.mjs +13 -0
  112. package/browser/editor/page/clipboard/own/rules.mjs +44 -0
  113. package/browser/editor/page/clipboard/own/selection.mjs +159 -0
  114. package/browser/editor/page/clipboard/own/writers.mjs +315 -0
  115. package/browser/editor/page/columns/index.mjs +360 -0
  116. package/browser/editor/page/commit.mjs +1813 -0
  117. package/browser/editor/page/conflicts.mjs +249 -0
  118. package/browser/editor/page/convert.mjs +831 -0
  119. package/browser/editor/page/core.mjs +1693 -0
  120. package/browser/editor/page/drag/drop.mjs +307 -0
  121. package/browser/editor/page/drag/index.mjs +351 -0
  122. package/browser/editor/page/drag/preview.mjs +126 -0
  123. package/browser/editor/page/edge-scroll.mjs +50 -0
  124. package/browser/editor/page/editor.mjs +1780 -0
  125. package/browser/editor/page/emoji-picker/emoji-tab.mjs +287 -0
  126. package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
  127. package/browser/editor/page/emoji-picker/grid.mjs +81 -0
  128. package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
  129. package/browser/editor/page/emoji-picker/icons.mjs +31 -0
  130. package/browser/editor/page/emoji-picker/index.mjs +166 -0
  131. package/browser/editor/page/emoji-picker/styles.mjs +161 -0
  132. package/browser/editor/page/emoji-picker/support.mjs +204 -0
  133. package/browser/editor/page/emoji-picker/upload.mjs +236 -0
  134. package/browser/editor/page/export-report.mjs +23 -0
  135. package/browser/editor/page/fills.mjs +62 -0
  136. package/browser/editor/page/find/index.mjs +107 -0
  137. package/browser/editor/page/flags.mjs +70 -0
  138. package/browser/editor/page/fold/index.mjs +348 -0
  139. package/browser/editor/page/fold/rule.mjs +125 -0
  140. package/browser/editor/page/folded.mjs +23 -0
  141. package/browser/editor/page/format-bar/bar.mjs +449 -0
  142. package/browser/editor/page/format-bar/brush.mjs +77 -0
  143. package/browser/editor/page/format-bar/colors.mjs +46 -0
  144. package/browser/editor/page/format-bar/index.mjs +404 -0
  145. package/browser/editor/page/formula/index.mjs +236 -0
  146. package/browser/editor/page/formula/panel.mjs +336 -0
  147. package/browser/editor/page/formula/symbols.mjs +156 -0
  148. package/browser/editor/page/frame.mjs +74 -0
  149. package/browser/editor/page/frames.mjs +196 -0
  150. package/browser/editor/page/geometry.mjs +402 -0
  151. package/browser/editor/page/gesture.mjs +45 -0
  152. package/browser/editor/page/handle/index.mjs +650 -0
  153. package/browser/editor/page/handle-sizes.mjs +14 -0
  154. package/browser/editor/page/hints/index.mjs +84 -0
  155. package/browser/editor/page/history.mjs +401 -0
  156. package/browser/editor/page/insert/index.mjs +256 -0
  157. package/browser/editor/page/kept.mjs +38 -0
  158. package/browser/editor/page/links/address.mjs +40 -0
  159. package/browser/editor/page/links/index.mjs +866 -0
  160. package/browser/editor/page/links/pages.mjs +131 -0
  161. package/browser/editor/page/links/views.mjs +369 -0
  162. package/browser/editor/page/long-runs.mjs +75 -0
  163. package/browser/editor/page/look.mjs +77 -0
  164. package/browser/editor/page/made.mjs +24 -0
  165. package/browser/editor/page/margin.mjs +373 -0
  166. package/browser/editor/page/markdown/index.mjs +88 -0
  167. package/browser/editor/page/markdown/rules.mjs +33 -0
  168. package/browser/editor/page/marks.mjs +377 -0
  169. package/browser/editor/page/media-menu/index.mjs +158 -0
  170. package/browser/editor/page/menu.mjs +544 -0
  171. package/browser/editor/page/merge.mjs +124 -0
  172. package/browser/editor/page/notices.mjs +142 -0
  173. package/browser/editor/page/offered.mjs +32 -0
  174. package/browser/editor/page/outline/folds.mjs +53 -0
  175. package/browser/editor/page/outline/index.mjs +783 -0
  176. package/browser/editor/page/outline/list.mjs +184 -0
  177. package/browser/editor/page/outline/read.mjs +201 -0
  178. package/browser/editor/page/outline/strip.mjs +287 -0
  179. package/browser/editor/page/outline/tree.mjs +248 -0
  180. package/browser/editor/page/overlay-layer.mjs +227 -0
  181. package/browser/editor/page/overlays.mjs +205 -0
  182. package/browser/editor/page/own.mjs +28 -0
  183. package/browser/editor/page/pads.mjs +71 -0
  184. package/browser/editor/page/page-objects.mjs +105 -0
  185. package/browser/editor/page/panel.mjs +65 -0
  186. package/browser/editor/page/placement.mjs +58 -0
  187. package/browser/editor/page/post.mjs +41 -0
  188. package/browser/editor/page/present-links.mjs +50 -0
  189. package/browser/editor/page/quiet.mjs +48 -0
  190. package/browser/editor/page/resize/index.mjs +327 -0
  191. package/browser/editor/page/select-all/index.mjs +262 -0
  192. package/browser/editor/page/selection/delete.mjs +61 -0
  193. package/browser/editor/page/selection/index.mjs +164 -0
  194. package/browser/editor/page/selection/marquee.mjs +174 -0
  195. package/browser/editor/page/session.mjs +168 -0
  196. package/browser/editor/page/slash-menu/index.mjs +291 -0
  197. package/browser/editor/page/storage.mjs +48 -0
  198. package/browser/editor/page/sync-state.mjs +267 -0
  199. package/browser/editor/page/table/aligns.mjs +29 -0
  200. package/browser/editor/page/table/cell-bar.mjs +141 -0
  201. package/browser/editor/page/table/cells.mjs +527 -0
  202. package/browser/editor/page/table/icons.mjs +40 -0
  203. package/browser/editor/page/table/index.mjs +990 -0
  204. package/browser/editor/page/table/lists.mjs +187 -0
  205. package/browser/editor/page/table/widths.mjs +313 -0
  206. package/browser/editor/page/tex.mjs +32 -0
  207. package/browser/editor/page/text-select/index.mjs +671 -0
  208. package/browser/editor/page/tooltip.mjs +98 -0
  209. package/browser/editor/page/type-grid.mjs +83 -0
  210. package/browser/editor/page/typing/code-edges.mjs +274 -0
  211. package/browser/editor/page/typing/index.mjs +282 -0
  212. package/browser/editor/page/typing/leave.mjs +68 -0
  213. package/browser/editor/page/ui.mjs +160 -0
  214. package/browser/shared/annotations.mjs +569 -0
  215. package/browser/shared/code-folds.mjs +14 -0
  216. package/browser/shared/code-languages.mjs +70 -0
  217. package/browser/shared/code-lines.mjs +30 -0
  218. package/browser/shared/colors.mjs +30 -0
  219. package/browser/shared/component-catalog.mjs +573 -0
  220. package/browser/shared/components/bookmark.mjs +26 -0
  221. package/browser/shared/components/callout.mjs +9 -0
  222. package/browser/shared/components/chart.mjs +20 -0
  223. package/browser/shared/components/code.mjs +37 -0
  224. package/browser/shared/components/columns.mjs +16 -0
  225. package/browser/shared/components/details.mjs +15 -0
  226. package/browser/shared/components/dialog.mjs +28 -0
  227. package/browser/shared/components/diff.mjs +18 -0
  228. package/browser/shared/components/divider.mjs +6 -0
  229. package/browser/shared/components/embed.mjs +25 -0
  230. package/browser/shared/components/figure.mjs +14 -0
  231. package/browser/shared/components/file.mjs +23 -0
  232. package/browser/shared/components/heading.mjs +6 -0
  233. package/browser/shared/components/highlight.mjs +9 -0
  234. package/browser/shared/components/icon.mjs +18 -0
  235. package/browser/shared/components/image.mjs +39 -0
  236. package/browser/shared/components/index.mjs +396 -0
  237. package/browser/shared/components/installed.mjs +232 -0
  238. package/browser/shared/components/list.mjs +146 -0
  239. package/browser/shared/components/math.mjs +49 -0
  240. package/browser/shared/components/mention.mjs +33 -0
  241. package/browser/shared/components/page.mjs +46 -0
  242. package/browser/shared/components/paragraph.mjs +9 -0
  243. package/browser/shared/components/quote.mjs +6 -0
  244. package/browser/shared/components/section.mjs +8 -0
  245. package/browser/shared/components/sheets.mjs +80 -0
  246. package/browser/shared/components/state.mjs +20 -0
  247. package/browser/shared/components/table.mjs +49 -0
  248. package/browser/shared/components/text.mjs +14 -0
  249. package/browser/shared/components/widget.mjs +10 -0
  250. package/browser/shared/copy-ids.mjs +72 -0
  251. package/browser/shared/css-references.mjs +110 -0
  252. package/browser/shared/document-look.mjs +178 -0
  253. package/browser/shared/emoji/custom.mjs +91 -0
  254. package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
  255. package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
  256. package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
  257. package/browser/shared/emoji/data/README.md +28 -0
  258. package/browser/shared/emoji/data/categories.json +1 -0
  259. package/browser/shared/emoji/data/icons.json +1 -0
  260. package/browser/shared/emoji/data/keywords-en.json +1 -0
  261. package/browser/shared/emoji/data/keywords-zh.json +1 -0
  262. package/browser/shared/emoji/data/names.json +1 -0
  263. package/browser/shared/emoji/data/positions.json +1 -0
  264. package/browser/shared/emoji/data/twemoji-index.json +1 -0
  265. package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
  266. package/browser/shared/emoji/data.mjs +194 -0
  267. package/browser/shared/emoji/emoji.mjs +38 -0
  268. package/browser/shared/emoji/glyphs.mjs +134 -0
  269. package/browser/shared/emoji/icon-value.mjs +91 -0
  270. package/browser/shared/escape.mjs +20 -0
  271. package/browser/shared/export-wrap.mjs +89 -0
  272. package/browser/shared/files.mjs +33 -0
  273. package/browser/shared/html-tree.mjs +59 -0
  274. package/browser/shared/http.mjs +22 -0
  275. package/browser/shared/i18n/en.mjs +1223 -0
  276. package/browser/shared/i18n/index.mjs +132 -0
  277. package/browser/shared/ids.mjs +24 -0
  278. package/browser/shared/import-types.mjs +23 -0
  279. package/browser/shared/inline-spacing.mjs +97 -0
  280. package/browser/shared/layers.mjs +42 -0
  281. package/browser/shared/long-runs.mjs +39 -0
  282. package/browser/shared/media.mjs +162 -0
  283. package/browser/shared/new-names.mjs +67 -0
  284. package/browser/shared/number-reading.mjs +92 -0
  285. package/browser/shared/old-names.mjs +143 -0
  286. package/browser/shared/outline.mjs +194 -0
  287. package/browser/shared/page-address.mjs +140 -0
  288. package/browser/shared/page-links.mjs +86 -0
  289. package/browser/shared/paths.mjs +73 -0
  290. package/browser/shared/preferences.mjs +116 -0
  291. package/browser/shared/preview-server.mjs +247 -0
  292. package/browser/shared/qa-levels.mjs +93 -0
  293. package/browser/shared/reading-place.mjs +91 -0
  294. package/browser/shared/renamed-storage.mjs +220 -0
  295. package/browser/shared/reports.mjs +46 -0
  296. package/browser/shared/search.mjs +85 -0
  297. package/browser/shared/session.mjs +77 -0
  298. package/browser/shared/table-chart.mjs +113 -0
  299. package/browser/shared/table-hides.mjs +120 -0
  300. package/browser/shared/table-slots.mjs +75 -0
  301. package/browser/shared/words.mjs +23 -0
  302. package/browser/shared/workspace-look.mjs +91 -0
  303. package/browser/shared/workspace.mjs +535 -0
  304. package/browser/shared/writing-preferences.mjs +68 -0
  305. package/browser/shared/zoom.mjs +57 -0
  306. package/dist/chunk-2B5E4CDJ.mjs +2 -0
  307. package/dist/chunk-342HXE3Q.mjs +2 -0
  308. package/dist/chunk-3HIRPVLU.mjs +2 -0
  309. package/dist/chunk-43B75J5T.mjs +2 -0
  310. package/dist/chunk-4FS7Z7WR.mjs +2 -0
  311. package/dist/chunk-4K5KC6V2.mjs +2 -0
  312. package/dist/chunk-5L7RYZCL.mjs +2 -0
  313. package/dist/chunk-5MHMDLZD.mjs +4 -0
  314. package/dist/chunk-5ZKJ3H4P.mjs +8 -0
  315. package/dist/chunk-64K7IPLO.mjs +255 -0
  316. package/dist/chunk-6QXGZM36.mjs +8 -0
  317. package/dist/chunk-6RGJOMJP.mjs +16 -0
  318. package/dist/chunk-742D2WWJ.mjs +19 -0
  319. package/dist/chunk-7DTINW6U.mjs +48 -0
  320. package/dist/chunk-A55HN5OK.mjs +2 -0
  321. package/dist/chunk-AGDILNWB.mjs +2 -0
  322. package/dist/chunk-AJ73XJF3.mjs +2 -0
  323. package/dist/chunk-AUZGSZJH.mjs +13 -0
  324. package/dist/chunk-BFE45AKL.mjs +2 -0
  325. package/dist/chunk-BGGDRNYQ.mjs +10 -0
  326. package/dist/chunk-BXO2ZY5P.mjs +2 -0
  327. package/dist/chunk-C564NU2H.mjs +77 -0
  328. package/dist/chunk-CEH4MRCC.mjs +2 -0
  329. package/dist/chunk-CY2FNNAB.mjs +16 -0
  330. package/dist/chunk-DFUDV4LX.mjs +2 -0
  331. package/dist/chunk-DKXG4XDG.mjs +2 -0
  332. package/dist/chunk-E7LWZRXY.mjs +4 -0
  333. package/dist/chunk-EZQ34M3F.mjs +124 -0
  334. package/dist/chunk-EZY3WC6Z.mjs +15 -0
  335. package/dist/chunk-FDLXYYG4.mjs +4 -0
  336. package/dist/chunk-FUKQNOQS.mjs +9 -0
  337. package/dist/chunk-GB5SOYQJ.mjs +7 -0
  338. package/dist/chunk-GRAXKKG4.mjs +2 -0
  339. package/dist/chunk-HYMEEXKN.mjs +4 -0
  340. package/dist/chunk-IVDLMMBD.mjs +2 -0
  341. package/dist/chunk-JPOSLGOC.mjs +6 -0
  342. package/dist/chunk-JVHHHGEA.mjs +3 -0
  343. package/dist/chunk-L3QKH4OK.mjs +26 -0
  344. package/dist/chunk-LAE5NQ4B.mjs +2 -0
  345. package/dist/chunk-LCTHTZIL.mjs +960 -0
  346. package/dist/chunk-LEF6DRCK.mjs +59 -0
  347. package/dist/chunk-LKX55H76.mjs +2 -0
  348. package/dist/chunk-LS4F7JUM.mjs +2 -0
  349. package/dist/chunk-MAFIGVXY.mjs +2 -0
  350. package/dist/chunk-NO5NJCHO.mjs +2 -0
  351. package/dist/chunk-NQPVAU63.mjs +2 -0
  352. package/dist/chunk-NSKUTQ5J.mjs +5 -0
  353. package/dist/chunk-O35FIXRB.mjs +2 -0
  354. package/dist/chunk-P2CAZPDP.mjs +3 -0
  355. package/dist/chunk-PL6GHLGD.mjs +15 -0
  356. package/dist/chunk-QAIHRH3I.mjs +13 -0
  357. package/dist/chunk-QJIR2BLP.mjs +6 -0
  358. package/dist/chunk-QR6A54KJ.mjs +3 -0
  359. package/dist/chunk-QUPLVPB2.mjs +7 -0
  360. package/dist/chunk-R7BNENLY.mjs +4 -0
  361. package/dist/chunk-S6O4UHLC.mjs +2 -0
  362. package/dist/chunk-SGJWQKEI.mjs +2 -0
  363. package/dist/chunk-SYGN7GLU.mjs +2 -0
  364. package/dist/chunk-TMYZB6AV.mjs +2 -0
  365. package/dist/chunk-TX6JH7TR.mjs +2 -0
  366. package/dist/chunk-TYK6VNAB.mjs +10 -0
  367. package/dist/chunk-U3SSPL4K.mjs +8 -0
  368. package/dist/chunk-U6KNPJPR.mjs +2 -0
  369. package/dist/chunk-UALRNVSE.mjs +4 -0
  370. package/dist/chunk-UH4SIXTR.mjs +2 -0
  371. package/dist/chunk-UMHUSOPJ.mjs +2 -0
  372. package/dist/chunk-V3HXVQEM.mjs +2 -0
  373. package/dist/chunk-V5JTW2LH.mjs +27 -0
  374. package/dist/chunk-V5VXUJKG.mjs +2 -0
  375. package/dist/chunk-V6XZ4VIR.mjs +2 -0
  376. package/dist/chunk-VBXMADMP.mjs +2 -0
  377. package/dist/chunk-VNV55RUA.mjs +2 -0
  378. package/dist/chunk-VPD2PS35.mjs +2 -0
  379. package/dist/chunk-W3BGBJQW.mjs +2 -0
  380. package/dist/chunk-W4VKN3GF.mjs +7 -0
  381. package/dist/chunk-W5BXXPDJ.mjs +3 -0
  382. package/dist/chunk-W7XHE4CT.mjs +2 -0
  383. package/dist/chunk-XNROSH2T.mjs +4 -0
  384. package/dist/chunk-XUNHRCOG.mjs +6 -0
  385. package/dist/chunk-Y34NR5JL.mjs +2 -0
  386. package/dist/chunk-Y6RLRPG3.mjs +3 -0
  387. package/dist/chunk-YEY3RSFQ.mjs +2 -0
  388. package/dist/cli.mjs +2 -0
  389. package/dist/server.mjs +2 -0
  390. package/dist/worker.mjs +5 -0
  391. package/kit/charts.js +355 -0
  392. package/kit/code.js +164 -0
  393. package/kit/dialogs.js +157 -0
  394. package/kit/math.js +2004 -0
  395. package/kit/report.css +2932 -0
  396. package/kit/runtime.js +1782 -0
  397. package/kit/sheets.js +123 -0
  398. package/kit/state.js +217 -0
  399. package/kit/tables.js +1499 -0
  400. package/kit/tokens.js +29 -0
  401. package/kit/ui.js +658 -0
  402. package/package.json +41 -4
  403. package/release.json +25 -0
  404. package/sdk/column-widths.d.ts +56 -0
  405. package/sdk/doc-charts.d.ts +82 -0
  406. package/sdk/doc-code.d.ts +28 -0
  407. package/sdk/doc-dialogs.d.ts +4 -0
  408. package/sdk/doc-kit.d.ts +147 -0
  409. package/sdk/doc-math.d.ts +3 -0
  410. package/sdk/doc-sheets.d.ts +15 -0
  411. package/sdk/doc-state.d.ts +41 -0
  412. package/sdk/doc-tables.d.ts +24 -0
  413. package/sdk/doc-tokens.d.ts +22 -0
  414. package/sdk/index.d.ts +30 -0
  415. package/skill/SKILL.md +150 -0
  416. package/skill/agents/openai.yaml +5 -0
  417. package/skill/references/building-components.md +367 -0
  418. package/skill/references/example-report.html +356 -0
  419. package/skill/references/writing-html.md +187 -0
  420. package/skill/sdk/column-widths.d.ts +56 -0
  421. package/skill/sdk/doc-charts.d.ts +82 -0
  422. package/skill/sdk/doc-code.d.ts +28 -0
  423. package/skill/sdk/doc-dialogs.d.ts +4 -0
  424. package/skill/sdk/doc-kit.d.ts +147 -0
  425. package/skill/sdk/doc-math.d.ts +3 -0
  426. package/skill/sdk/doc-sheets.d.ts +15 -0
  427. package/skill/sdk/doc-state.d.ts +41 -0
  428. package/skill/sdk/doc-tables.d.ts +24 -0
  429. package/skill/sdk/doc-tokens.d.ts +22 -0
  430. package/skill/sdk/index.d.ts +30 -0
  431. package/starter/doc.html +21 -0
  432. package/starter/doc.json +5 -0
  433. package/vendor/d3.v7.9.0.min.js +2 -0
  434. package/vendor/katex/auto-render.min.js +1 -0
  435. package/vendor/katex/contrib/mhchem.min.js +1 -0
  436. package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  437. package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  438. package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  439. package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  440. package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  441. package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  442. package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  443. package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  444. package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  445. package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  446. package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  447. package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  448. package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  449. package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  450. package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  451. package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  452. package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  453. package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  454. package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  455. package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  456. package/vendor/katex/katex.min.css +1 -0
  457. package/vendor/katex/katex.min.js +1 -0
  458. package/vendor/pdfjs/LICENSE +177 -0
  459. package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  460. package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  461. package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  462. package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  463. package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  464. package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  465. package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  466. package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  467. package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  468. package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  469. package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  470. package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  471. package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  472. package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  473. package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  474. package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  475. package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  476. package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  477. package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  478. package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  479. package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  480. package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  481. package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  482. package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  483. package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  484. package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  485. package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  486. package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  487. package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  488. package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  489. package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  490. package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  491. package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  492. package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  493. package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  494. package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  495. package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  496. package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  497. package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  498. package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  499. package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  500. package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  501. package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  502. package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  503. package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  504. package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  505. package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  506. package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  507. package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  508. package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  509. package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  510. package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  511. package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  512. package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  513. package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  514. package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  515. package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  516. package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  517. package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  518. package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  519. package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  520. package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  521. package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  522. package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  523. package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  524. package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  525. package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  526. package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  527. package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  528. package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  529. package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  530. package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  531. package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  532. package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  533. package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  534. package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  535. package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  536. package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  537. package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  538. package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  539. package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  540. package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  541. package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  542. package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  543. package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  544. package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  545. package/vendor/pdfjs/cmaps/H.bcmap +0 -0
  546. package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  547. package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  548. package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  549. package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  550. package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  551. package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  552. package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  553. package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  554. package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  555. package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  556. package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  557. package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  558. package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  559. package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  560. package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  561. package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  562. package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  563. package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  564. package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  565. package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  566. package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  567. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  568. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  569. package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  570. package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  571. package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  572. package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  573. package/vendor/pdfjs/cmaps/LICENSE +36 -0
  574. package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  575. package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  576. package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  577. package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  578. package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  579. package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  580. package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  581. package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  582. package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  583. package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  584. package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  585. package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  586. package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  587. package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  588. package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  589. package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  590. package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  591. package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  592. package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  593. package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  594. package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  595. package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  596. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  597. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  598. package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  599. package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  600. package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  601. package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  602. package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  603. package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  604. package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  605. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  606. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  607. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  608. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  609. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  610. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  611. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  612. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  613. package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  614. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  615. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  616. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  617. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  618. package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  619. package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  620. package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  621. package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  622. package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  623. package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  624. package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  625. package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  626. package/vendor/pdfjs/cmaps/V.bcmap +0 -0
  627. package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  628. package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
  629. package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
  630. package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  631. package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  632. package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  633. package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  634. package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  635. package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  636. package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  637. package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  638. package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  639. package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  640. package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  641. package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  642. package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  643. package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  644. package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  645. package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  646. package/vendor/types/@types/d3/LICENSE +21 -0
  647. package/vendor/types/@types/d3/index.d.ts +39 -0
  648. package/vendor/types/@types/d3/package.json +81 -0
  649. package/vendor/types/@types/d3-array/LICENSE +21 -0
  650. package/vendor/types/@types/d3-array/index.d.ts +1118 -0
  651. package/vendor/types/@types/d3-array/package.json +56 -0
  652. package/vendor/types/@types/d3-axis/LICENSE +21 -0
  653. package/vendor/types/@types/d3-axis/index.d.ts +293 -0
  654. package/vendor/types/@types/d3-axis/package.json +47 -0
  655. package/vendor/types/@types/d3-brush/LICENSE +21 -0
  656. package/vendor/types/@types/d3-brush/index.d.ts +255 -0
  657. package/vendor/types/@types/d3-brush/package.json +42 -0
  658. package/vendor/types/@types/d3-chord/LICENSE +21 -0
  659. package/vendor/types/@types/d3-chord/index.d.ts +471 -0
  660. package/vendor/types/@types/d3-chord/package.json +40 -0
  661. package/vendor/types/@types/d3-color/LICENSE +21 -0
  662. package/vendor/types/@types/d3-color/index.d.ts +669 -0
  663. package/vendor/types/@types/d3-color/package.json +55 -0
  664. package/vendor/types/@types/d3-contour/LICENSE +21 -0
  665. package/vendor/types/@types/d3-contour/index.d.ts +222 -0
  666. package/vendor/types/@types/d3-contour/package.json +38 -0
  667. package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
  668. package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
  669. package/vendor/types/@types/d3-delaunay/package.json +30 -0
  670. package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
  671. package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
  672. package/vendor/types/@types/d3-dispatch/package.json +51 -0
  673. package/vendor/types/@types/d3-drag/LICENSE +21 -0
  674. package/vendor/types/@types/d3-drag/index.d.ts +395 -0
  675. package/vendor/types/@types/d3-drag/package.json +42 -0
  676. package/vendor/types/@types/d3-dsv/LICENSE +21 -0
  677. package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
  678. package/vendor/types/@types/d3-dsv/package.json +45 -0
  679. package/vendor/types/@types/d3-ease/LICENSE +21 -0
  680. package/vendor/types/@types/d3-ease/index.d.ts +316 -0
  681. package/vendor/types/@types/d3-ease/package.json +40 -0
  682. package/vendor/types/@types/d3-fetch/LICENSE +21 -0
  683. package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
  684. package/vendor/types/@types/d3-fetch/package.json +37 -0
  685. package/vendor/types/@types/d3-force/LICENSE +21 -0
  686. package/vendor/types/@types/d3-force/index.d.ts +899 -0
  687. package/vendor/types/@types/d3-force/package.json +45 -0
  688. package/vendor/types/@types/d3-format/LICENSE +21 -0
  689. package/vendor/types/@types/d3-format/index.d.ts +337 -0
  690. package/vendor/types/@types/d3-format/package.json +45 -0
  691. package/vendor/types/@types/d3-geo/LICENSE +21 -0
  692. package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
  693. package/vendor/types/@types/d3-geo/package.json +48 -0
  694. package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
  695. package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
  696. package/vendor/types/@types/d3-hierarchy/package.json +50 -0
  697. package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
  698. package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
  699. package/vendor/types/@types/d3-interpolate/package.json +47 -0
  700. package/vendor/types/@types/d3-path/LICENSE +21 -0
  701. package/vendor/types/@types/d3-path/index.d.ts +108 -0
  702. package/vendor/types/@types/d3-path/package.json +41 -0
  703. package/vendor/types/@types/d3-polygon/LICENSE +21 -0
  704. package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
  705. package/vendor/types/@types/d3-polygon/package.json +40 -0
  706. package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
  707. package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
  708. package/vendor/types/@types/d3-quadtree/package.json +45 -0
  709. package/vendor/types/@types/d3-random/LICENSE +21 -0
  710. package/vendor/types/@types/d3-random/index.d.ts +313 -0
  711. package/vendor/types/@types/d3-random/package.json +41 -0
  712. package/vendor/types/@types/d3-scale/LICENSE +21 -0
  713. package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
  714. package/vendor/types/@types/d3-scale/package.json +53 -0
  715. package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
  716. package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
  717. package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
  718. package/vendor/types/@types/d3-selection/LICENSE +21 -0
  719. package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
  720. package/vendor/types/@types/d3-selection/package.json +56 -0
  721. package/vendor/types/@types/d3-shape/LICENSE +21 -0
  722. package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
  723. package/vendor/types/@types/d3-shape/package.json +53 -0
  724. package/vendor/types/@types/d3-time/LICENSE +21 -0
  725. package/vendor/types/@types/d3-time/index.d.ts +697 -0
  726. package/vendor/types/@types/d3-time/package.json +46 -0
  727. package/vendor/types/@types/d3-time-format/LICENSE +21 -0
  728. package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
  729. package/vendor/types/@types/d3-time-format/package.json +40 -0
  730. package/vendor/types/@types/d3-timer/LICENSE +21 -0
  731. package/vendor/types/@types/d3-timer/index.d.ts +68 -0
  732. package/vendor/types/@types/d3-timer/package.json +45 -0
  733. package/vendor/types/@types/d3-transition/LICENSE +21 -0
  734. package/vendor/types/@types/d3-transition/index.d.ts +664 -0
  735. package/vendor/types/@types/d3-transition/package.json +47 -0
  736. package/vendor/types/@types/d3-zoom/LICENSE +21 -0
  737. package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
  738. package/vendor/types/@types/d3-zoom/package.json +48 -0
  739. package/vendor/types/@types/geojson/LICENSE +21 -0
  740. package/vendor/types/@types/geojson/index.d.ts +202 -0
  741. package/vendor/types/@types/geojson/package.json +46 -0
  742. package/vendor/typescript/LICENSE.txt +55 -0
  743. package/vendor/typescript/lib.decorators.d.ts +384 -0
  744. package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
  745. package/vendor/typescript/lib.dom.d.ts +39429 -0
  746. package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
  747. package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
  748. package/vendor/typescript/lib.es2015.core.d.ts +597 -0
  749. package/vendor/typescript/lib.es2015.d.ts +28 -0
  750. package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
  751. package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
  752. package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
  753. package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
  754. package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
  755. package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
  756. package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
  757. package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
  758. package/vendor/typescript/lib.es2016.d.ts +21 -0
  759. package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
  760. package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
  761. package/vendor/typescript/lib.es2017.d.ts +26 -0
  762. package/vendor/typescript/lib.es2017.date.d.ts +31 -0
  763. package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
  764. package/vendor/typescript/lib.es2017.object.d.ts +49 -0
  765. package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
  766. package/vendor/typescript/lib.es2017.string.d.ts +45 -0
  767. package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
  768. package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
  769. package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
  770. package/vendor/typescript/lib.es2018.d.ts +24 -0
  771. package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
  772. package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
  773. package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
  774. package/vendor/typescript/lib.es2019.array.d.ts +79 -0
  775. package/vendor/typescript/lib.es2019.d.ts +24 -0
  776. package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
  777. package/vendor/typescript/lib.es2019.object.d.ts +33 -0
  778. package/vendor/typescript/lib.es2019.string.d.ts +37 -0
  779. package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
  780. package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
  781. package/vendor/typescript/lib.es2020.d.ts +27 -0
  782. package/vendor/typescript/lib.es2020.date.d.ts +42 -0
  783. package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
  784. package/vendor/typescript/lib.es2020.number.d.ts +28 -0
  785. package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
  786. package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
  787. package/vendor/typescript/lib.es2020.string.d.ts +44 -0
  788. package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
  789. package/vendor/typescript/lib.es2021.d.ts +23 -0
  790. package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
  791. package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
  792. package/vendor/typescript/lib.es2021.string.d.ts +33 -0
  793. package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
  794. package/vendor/typescript/lib.es2022.array.d.ts +121 -0
  795. package/vendor/typescript/lib.es2022.d.ts +25 -0
  796. package/vendor/typescript/lib.es2022.error.d.ts +75 -0
  797. package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
  798. package/vendor/typescript/lib.es2022.object.d.ts +26 -0
  799. package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
  800. package/vendor/typescript/lib.es2022.string.d.ts +25 -0
  801. package/vendor/typescript/lib.es5.d.ts +4601 -0
  802. package/vendor/typescript/package.json +4 -0
  803. package/vendor/typescript/typescript.js +446 -0
  804. package/web/assets/index-Bh74DfsV.css +1 -0
  805. package/web/assets/index-UW0RyFFt.js +13 -0
  806. package/web/index.html +14 -0
@@ -0,0 +1,859 @@
1
+ import bookmark from "./bookmark/index.mjs";
2
+ import callout from "./callout/index.mjs";
3
+ import code from "./code/index.mjs";
4
+ import columns from "./columns/index.mjs";
5
+ import details from "./details/index.mjs";
6
+ import dialog from "./dialog/index.mjs";
7
+ import divider from "./divider/index.mjs";
8
+ import embed from "./embed/index.mjs";
9
+ import figure from "./figure/index.mjs";
10
+ import file from "./file/index.mjs";
11
+ import flowchart from "./flowchart/index.mjs";
12
+ import heading from "./heading/index.mjs";
13
+ import highlight from "./highlight/index.mjs";
14
+ import icon from "./icon/index.mjs";
15
+ import image from "./image/index.mjs";
16
+ import installed from "./installed/index.mjs";
17
+ import list from "./list/index.mjs";
18
+ import math from "./math/index.mjs";
19
+ import paragraph from "./paragraph/index.mjs";
20
+ import quote from "./quote/index.mjs";
21
+ import section from "./section/index.mjs";
22
+ import sheets from "./sheets/index.mjs";
23
+ import table from "./table/index.mjs";
24
+ import widget from "./widget/index.mjs";
25
+ import { CATEGORIES, componentOf } from "../../shared/components/index.mjs";
26
+ import { slotAround } from "../../shared/components/installed.mjs";
27
+ import { COLOR_CLASSES } from "./colors.mjs";
28
+ import { MEDIA_HOSTS } from "./media/parts.mjs";
29
+ import { t } from "../../shared/i18n/index.mjs";
30
+
31
+ // The kit's components as the editor sees them, gathered from their folders (src/editor/components/
32
+ // <name>/index.mjs), shared by the page and the server (src/editor/source/). Each is the editor's
33
+ // side of the kit's component of the same name (src/shared/components/), or of the one it names
34
+ // (`description`: the flowchart's is the list's, ol.doc-flow being a kind of list for the kit),
35
+ // whose category it takes: a basic block, a container, a card or a whole block (CATEGORIES there).
36
+ // Each describes itself:
37
+ //
38
+ // listed what 设置 › 组件列表 calls it (a function, as the server says it in both languages), for a
39
+ // component the reader meets in the "/" menu or as a block of its own; every component
40
+ // with a type in that menu says it. Its line there shows the icon of its first row in the
41
+ // "/" menu (basic before advanced, by place), or, for a component with no type there (分区),
42
+ // its first unit's `icon`; a listed component with neither throws. hideable: false, it stays offered whatever gallery.json
43
+ // says, its switch there off and locked (文本, 标题, 列表, 分区): what a page cannot do
44
+ // without. What is hidden goes from "/", 在下方新建 and the handle's grid and nothing else
45
+ // (page/offered.mjs); its blocks, its Markdown shortcut and "Blocks at a glance" stay.
46
+ // units the unit kinds it defines (blocks the reader selects, moves and deletes):
47
+ // { [kind]: { name, icon?, match, chapter?, fixed?, block?, handle?, below?, boxed?, beside?, inRow?, sharesHeight?, entersAfter?, resizable?, copy?, clipboard?, sizes?, toggles?, colors?, colorDefaults?, removedEmpty?, turnsEmpty?, leadsChapter?, canHaveChildren?, emptyIsNothing?, fromWords?, attributes? } }
48
+ // match: rules an element matches by its tag (one of `tag`), its class and its
49
+ // attribute, and by the element it stands in (`parent`: { tag?, class? }, a flowchart's
50
+ // step being an li whose parent is an ol.doc-flow), whichever are given; every
51
+ // component's rules are tried in `rank` order and the first match wins (anything left is
52
+ // "block", a report's own widget).
53
+ // chapter: stands in the page or a Sheet panel besides body text; fixed: never
54
+ // inside a flow; block: false, no block of its own for the reader (a column: a box
55
+ // selection and 选中外层 pass over it to the blocks in it, or the row); handle: where its
56
+ // handle stands, "line" (the default: at its first line), "bar" (a bar along its right
57
+ // side: a section), "none" (none of its own: the blocks it holds have theirs) or "outer"
58
+ // (its container's: a tab's, the Sheet area's, on the tab row); below: false, its menu
59
+ // offers no new block below it (a tab, a Sheet area); boxed: a block with a frame of its
60
+ // own, no text flowing beside it: a double click between two of them makes a paragraph,
61
+ // a click to its right selects it, Enter on it selected puts a paragraph after it unless
62
+ // it is a text block (beside.mjs), and it is a block of its own to Ctrl+A; beside: the
63
+ // same click and Enter without being boxed (a row of columns); inRow(element): whether
64
+ // this one stands beside another now, as a row of columns always does and a flowchart's
65
+ // node when a node shares its line (standsBeside: what stands so keeps the handle across
66
+ // its width, with no 批注 button, its right half being no margin); sharesHeight: its height
67
+ // the tallest's beside it (a column, a flowchart's step), so that a block growing in it may
68
+ // change no height outside it, and what stands beside the page follows such a block's size
69
+ // (annotate/); entersAfter: that Enter alone (a Sheet area); resizable: the elements of
70
+ // it whose edges resize (a selector: resize/ knows how each is dragged, and takes one of
71
+ // this kind that matches); copy:
72
+ // "itself", copied as itself (as a card is) although no card; clipboard: how an element of
73
+ // this kind is written out, where the first type of the kind does not say it (below).
74
+ // sizes: custom properties in its style attribute ("Sizes" in
75
+ // src/render/kit/styles/sizes.css) and the values each takes (a share, a length in px, none),
76
+ // the one that says `height` being what its bottom edge sets (resize/);
77
+ // toggles: classes it may switch on the page, besides its colors (`colors`: the families of
78
+ // colors it takes, components/colors.mjs: ["text", "background"] for a text block (body text,
79
+ // headings, list items), ["background"] for a block of other blocks or of code (a highlight
80
+ // block, a disclosure, a code block); none without; `colorDefaults`: the color of a family it
81
+ // shows with none of it, when that is one of the nine (a callout's background: blue), which
82
+ // 颜色 › marks for it in place of 默认, a pick of it taking the class away); attributes: attributes it may set on
83
+ // the page, each with the test of its values. icon: what its handle shows, for a
84
+ // kind no block type stands for (a type's own icon is its `types` entry's). removedEmpty:
85
+ // Backspace on the one empty block in it deletes it whole (a code block, a highlight block,
86
+ // a callout, a quote, a disclosure: typing/). turnsEmpty: it holds nothing to carry, so what it is
87
+ // turned into is an empty block of the type, in its place (a divider line: convert.mjs).
88
+ // leadsChapter: it may stand first in a chapter as the line above its heading, so a
89
+ // folded heading with only such blocks before it covers the chapter (a divider: fold/rule.mjs).
90
+ // canHaveChildren: notion-lite's, a block right after it goes under it by Tab, so the
91
+ // keys of a block stand after it as they stand in what it is in (a list: under its last item).
92
+ // emptyIsNothing: a block of it left empty counts as nothing written, in a container
93
+ // that says `removedEmpty`. fromWords: a block of it can be made again from its words alone.
94
+ // boxes the box kinds it defines (containers whose children are units): { [kind]: { role,
95
+ // name?, classes?, find?, owner?, takenBy?, also?, leaveByEnter?, endIsPadding?, lead?, firstLineActs?, firstBlock?, groups?, holdsOne?, emptyIsNothing?, outer?, selectAll? } }, classes being the kit's classes that make an element one
96
+ // (rank order, as above); the others the server knows by their tag (findUnits). find: where
97
+ // a unit's box of this kind is (a list item's lists, a disclosure's content, a Sheet area's
98
+ // panels, an instance's slots by their name: `find(unit, key)`); owner: the element of its unit that takes the box along (a Sheet panel's tab:
99
+ // boxOwner); takenBy: whether a unit's element is that one, for a box of this key, told from
100
+ // the element alone, which may be off the page with the box (takesBox);
101
+ // also: the unit kinds it takes besides what its role takes (a highlight block's icon);
102
+ // leaveByEnter: Enter on its empty last block moves that block out after it (typing/leave.mjs);
103
+ // endIsPadding: what is under its last block is its own padding (a highlight block, a
104
+ // callout, a disclosure's content): a click there makes no block, it is a gap like any other
105
+ // (geometry.mjs endOf, insert/ clickBlank);
106
+ // lead: the kind of unit it opens with as its fixed head, which is no block to fall
107
+ // between (a highlight block's icon: a box selection passes over it, a place before it is
108
+ // the place after it); firstLineActs: its first block shows the container's handle, not a
109
+ // handle of its own (Notion's disableFirstItemHoverMenu: a highlight block's, a callout's, a quote's);
110
+ // firstBlock: the type its first block (after its lead) always is, its first line (a
111
+ // flowchart's node: "paragraph", its title), which is turned into no other type (no
112
+ // 转换为, no Markdown shortcut there) and has nothing made, dropped or pasted before it;
113
+ // Enter splits it, what follows the caret a plain paragraph below it (core.mjs firstLineOf);
114
+ // firstSays: what that first line says empty, under the caret;
115
+ // groups: a plain <div> with no class in it is a group of blocks, not a block of its own (the
116
+ // same boxes as the shared descriptions' GROUPING_FLOWS: tests/unit/components.mjs);
117
+ // holdsOne: a change that leaves it empty puts an empty paragraph in it, so there is always a
118
+ // block to write in (a disclosure's content, a highlight block, a callout: core.mjs tidyEmptied);
119
+ // emptyIsNothing: as on a unit, of a box that is an element of its own, by its `classes`;
120
+ // outer: false, a block straight in it has no block around it for the reader, whatever
121
+ // stands around its element: no 选中外层 (a detail card's content: block-info.mjs outerOf);
122
+ // selectAll: the steps of Ctrl+A it is (select-all/): { content?, whole?, top? }, content:
123
+ // its blocks are a step, called what the text says (true: "{its name}里的全部内容");
124
+ // whole: the block it belongs to is a step, whole (a row of columns, a Sheet area); top:
125
+ // no step above it, what is behind it not being its own (a detail card's content)
126
+ // components classes of elements that are one block: nothing goes in or out, their text is the
127
+ // kit's UI or a field of theirs, and all that stands in one is its component's, whatever
128
+ // its tag (ownerOf); attributes, the same by attribute
129
+ // sealed a selector: what stands in such an element is no text of a text block around it, as
130
+ // a list item holding it (caret.mjs editable): its own text blocks are the only hosts in it
131
+ // readOnly why an element of it stays read-only, on hover and on a click (hints/): rules
132
+ // { rank, at, says }, at a selector found from the element (closest), or a function
133
+ // of the element saying whether the rule is its (an instance's own region, heldBy, which
134
+ // no selector tells from its slots), says the reason
135
+ // in the reader's words, or null for an element that needs none, having a tool of its
136
+ // own. Every component's rules are tried in `rank` order, with the page's (PAGE below),
137
+ // and the first match wins: a rule ranked below the page's 80 goes before any control's,
138
+ // and is the one that can claim a button as its own.
139
+ // hosts the kinds of text block it defines (data-ge-kind): { [kind]: { name, caps, tex?, wrapped?, parts?, opensBefore?, textFilters?, formula?, closed?, inner?, blankSays?, placeholder? } }, caps
140
+ // ({ bound, blockLevel }) giving what such a text block can do (source/); opensBefore:
141
+ // Enter at its very start, with words in it, puts an empty paragraph before its block
142
+ // where it does not split, as one that splits does (typing/); textFilters: false, what
143
+ // is typed in it is taken as it is, no inline code, no space set by itself (notion-lite's);
144
+ // formula: false, no inline formula is offered in it or pasted as one, the kit drawing
145
+ // none there (takesFormula);
146
+ // closed: the page holds no text block for it until the reader opens it (a code block);
147
+ // inner(element): the text a save takes of one, as markup, where that is not what its
148
+ // nodes say (a code block's code);
149
+ // parts: the parts of components ([component id, part name]: a part of its shared
150
+ // description edited as text, src/shared/components/) whose elements are text blocks
151
+ // of this kind, found so by the server's scan; tex: its text is a formula's TeX alone; wrapped: the page makes the text block a
152
+ // span inside the element, which keeps its own behaviour (a Sheet tab's button);
153
+ // blankSays: what the status line says of one left blank that must hold words, as a
154
+ // type's says of a block of it (blankSaysOf); placeholder: what one says while it
155
+ // is empty under the caret, whatever part it is (placeholderOf)
156
+ // placeholders what an empty text block says while the caret is in it: { [part]: text }, part
157
+ // being a part of its shared description (src/shared/components/) whose element it is
158
+ // (placeholderOf); a heading's own is its type's `placeholder`, and a type's `placeholder:
159
+ // false` says nothing where a block of it would (a list item)
160
+ // types the blocks the reader can make on the page or turn a block into (the "/" menu,
161
+ // Markdown shortcuts, the block menu), written by the server in the kit's plain markup:
162
+ // { [type]: { tag, className?, kind, box?, leaf?, wraps?, container?, part?, text?, inside?, tex?,
163
+ // empty?, resettable?, bare?, placeholder?, bar?, label?, icon?, hint?, markdown?, words?, turn?, menu?, fresh?,
164
+ // corner?, preload?, onSplit?, create?, takesAsIs?, holder?, nests?, joins?, leadIcon?, fromSelection?, clipboard?, glance? } } and, for the blocks the page
165
+ // and the server write apart from text, title?, content?, keyed?, written?,
166
+ // extras?, textHost?, blanks?, blankSays? (what each says is at its component). Leaves hold
167
+ // inline text; containers (`box`: the kind of box they are) hold blocks; bare: a block that
168
+ // holds no text of its own (a divider, a media block); bar: the gray bar a media block left empty shows (a function
169
+ // giving its markup, its words in the language t() says them in: components/placeholder.mjs
170
+ // mediaBar); resettable: an empty block of the type
171
+ // turns into body text on Enter, and the first of its container on Backspace at its start (a
172
+ // quote's paragraph, a list item: notion-lite's `resettable`, typing/leave.mjs). leaf: the text block a block turned
173
+ // into the type becomes; wraps: such a text block sits in a container of the type, found
174
+ // by `container` (a selector); text: a plain text leaf; empty: a leaf written with no
175
+ // text too (a paragraph, a heading, a list item, a code block: an empty
176
+ // one stays, as Notion's; the page's core.mjs and the server's source/checks.mjs read
177
+ // this and nothing else); inside: the element its text is written in, as plain text
178
+ // (a code block's code element); tex: its text is a formula's TeX alone (a display
179
+ // formula; a host's `tex` says the same of a text block); label, icon,
180
+ // hint (its Markdown) and words (search words): its menu row; markdown: what typed at
181
+ // a block's start turns it into a type, [{ match, type?, props?, alone? }] (notion-lite's
182
+ // `markdown`): match, a RegExp the whole text before the caret must be; type: the type
183
+ // it makes, the one it stands on without; props(match): what the shortcut sets on
184
+ // the block it makes, which its page object's `setProps` does, or null for not this
185
+ // time; alone: no text may stand after it, the block holding nothing else;
186
+ // rules are tried in the order of the definitions, a type a block cannot become passed
187
+ // over (page/markdown/rules.mjs); turn: its place among
188
+ // the types a text block is turned into; fresh: its place among the types made as an
189
+ // empty block that stands for an empty one; menu: [group, place], its place in the "/"
190
+ // menu (group "basic" or "advanced"), which the block menu's 在下方新建 shows too; corner: the
191
+ // type in whose cell of a type grid it sits, as a gray corner, when the grid has both
192
+ // (type-grid.mjs); preload: true, it needs something on the page as soon as a type grid
193
+ // offers it, and before a block with text is turned into it, which its page object's
194
+ // `preload` brings; onSplit(whole, tail): what the part split off a container of the type
195
+ // keeps of the whole (core.mjs newTail); create(what): how a type that is no text block is
196
+ // made (convert.mjs convertBlock), here when it is DOM alone, as `create` of the page
197
+ // object otherwise. Unlike notion-lite's `create`, which gives the data of a new block,
198
+ // this one makes the node and places it, there being no model to place it from, and it
199
+ // also runs when a block with text is turned into the type. `what` is { type, doc, text,
200
+ // put, stand, paragraph }: the type, the document, the text of the block it stands for,
201
+ // put(node) putting a node at that block's place, stand(node) making a node stand for
202
+ // that block (the save turns the unit it was into this), and paragraph() a new empty
203
+ // paragraph. It returns the node the caret or the choice goes to (null: none); a type
204
+ // without is a text block, made by convert.mjs standIn.
205
+ // takesAsIs: a block turned into it goes into it as it is, each keeping its type (a
206
+ // highlight block, a callout, a disclosure); holder: its place among the containers that turn into
207
+ // one another, what they hold carried along; nests: false, none inside another of its
208
+ // kind; joins: false, a block turned into it never joins the one beside it; leadIcon: the
209
+ // icon a new one opens with; fromSelection: { label, icon }, its row of the format bar's
210
+ // 更多, which makes a block of it from the selected text (its page object's `fromSelection`).
211
+ // entry a chip in the text that opens something of it (a link to a detail card): { at, removed },
212
+ // at a selector, removed what the page says when Backspace or Delete beside it took it
213
+ // away whole (typing/code-edges.mjs), edged as inline code is
214
+ // clipboard how a block is copied and written out, on a type (for its description) and, where a unit
215
+ // kind needs its own, on a unit (for an element of it, over what the first type of the kind
216
+ // says): { kind?, level?, html?, of?, read?, apart?, headed?, claims?, describe?, data?, keeps?,
217
+ // piece?, across?, endsIn?, lead?, run?, pastedIn?, check?, holds?, build?, text?, grid?, blocks? }
218
+ // (docs/editor.md, "Copying blocks").
219
+ // kind: how it is written out, in notion-lite's meaning: the writer of that name in
220
+ // page/clipboard/own/writers.mjs, which the copy and the page export both use; one that
221
+ // says none is a paragraph. level: a heading's. html: the writer of its text/html when that
222
+ // is not its kind's (notion-lite's clipboard.html). of(element): the clipboard of this very
223
+ // element, on a unit whose elements are not all written alike. read(element, how): what
224
+ // the page export's writer needs of an element, whose markup it does not know; `how` is
225
+ // the writer's own. apart: on a unit that is no block of the page's flow (a detail
226
+ // card), the selector of its elements, which a page export writes after that flow, in
227
+ // file order, and which show what they hold only when opened (APART, writtenApart);
228
+ // reached(element): on such a unit, whether anything on the page leads to the element,
229
+ // which the page export leaves out when nothing does.
230
+ // headed: an entry of a list that holds blocks, its first text block its line (a
231
+ // flowchart's node).
232
+ // The hooks after these are there because Gallery has no block model: notion-lite copies
233
+ // a block's record as it is, here a block is an element, so what is carried for one and
234
+ // how it is made again are its component's to say. An element goes by the unit it is, and
235
+ // a hook that says undefined leaves it to the kind its tag gives it, then to the types
236
+ // whose mark it carries (askClipboard), an element having another component's class or
237
+ // attribute besides its own; an hr is a divider whatever its class. claims: that mark, a
238
+ // selector (a highlight block's class).
239
+ // describe(node, what): the clipboard's JSON for an element, undefined when the element
240
+ // is not its own, null when it is and cannot be copied; a text block, a list and a quote
241
+ // need none. data(node, what): what a copy carries to be made anew where its unit
242
+ // is not (COPIED_AS_ITSELF below), `what` being { serializeInner, copyOf, clipboardOf, page };
243
+ // keeps: the editor's marks a pasted copy keeps;
244
+ // unsaid: what in the markup of a copy is none of its words, a selector (UNSAID below).
245
+ // piece(host, html, what): a text block selected in part. across(unit, what): what a
246
+ // selection across blocks takes of a block it goes through, undefined when the block is
247
+ // not its own; endsIn(unit, what): the same of a block it ends in (clipboard/own/
248
+ // selection.mjs). lead: it opens the blocks it stands with and is no block of their text
249
+ // (an icon). run: the type a run of them copied on their own makes (rules.mjs groupItems).
250
+ // pastedIn: a box that takes it from the clipboard though accepts() does not.
251
+ // check(block, what): whether the clipboard's JSON, which is not trusted, is such a block; a
252
+ // type that is no `text` type and has no hook is never pasted. holds(block): the
253
+ // blocks it holds where those are no `blocks`. build(what): the block made again, `what`
254
+ // being { doc, block, host(type?), box(type?), inline(html), inner(blocks), one(block),
255
+ // colored(element), pending(figure, src) }; a text type needs none, and a container
256
+ // with no hook is filled with its blocks. Where it needs the page's modules it
257
+ // is the `build` of its page.mjs, listed in builders.mjs: it runs with no editor too
258
+ // (the transfer worker, the unit tests), so it is on no page object.
259
+ // text(block, lines): its lines of text for a place that cannot split (clipboard/own/
260
+ // blocks.mjs joinedHtml). grid(data, columns, cell): a table's rows as a Markdown table's.
261
+ // blocks(unit, how): what a `flatten` writes when that is not the units it holds.
262
+ // glance its part of a row of "Blocks at a glance" (references/writing-html.md, whose table
263
+ // src/cli/glance-table.mjs writes from these), on a type, and on a component (one or a list)
264
+ // for what no type stands for; the colors, no component's, are the page's (PAGE below):
265
+ // { row, name, write, after?, before?, rule }. A type that says none has no row.
266
+ // row: its place among the rows; the parts of one place are one row, in the order
267
+ // of the definitions, a type's before its component's own. name: the block as the
268
+ // user calls it, on a type its menu row's `label` as the source writes it, for these are
269
+ // words for an Agent in whatever language the UI speaks: tests/unit/skill-docs.mjs holds
270
+ // the two together. write: what an Agent writes; after: what the file holds after an
271
+ // export, where that differs; before: what stands between its `write` and the one
272
+ // before it in the row, where that is no comma; rule: the section of that file that
273
+ // holds its rule.
274
+ //
275
+ // A component's behaviour on the page is its page.mjs, how the server writes it its file.mjs. Of
276
+ // the fields an engine reads, those that need the page are on the page object: create (above);
277
+ // preload(type), what a type that says `preload` needs brought, a promise while it comes and null
278
+ // once it is there; redraw(units), the blocks of a group turned while that was coming drawn again;
279
+ // menuVariants(), other entries of its type in the menus (notion-lite's, on the page object where
280
+ // they come from what the page holds: an instance's, one for each package), each { label, icon, words,
281
+ // preview?, create(what) } by its name, its key in a menu "type:name" (page-objects.mjs menuEntry);
282
+ // onCreated(block, type), what follows a new block of its type (by "/", Markdown, 在下方新建, or a
283
+ // block with no text turned from its menu: notion-lite's moment), true when what comes next is its
284
+ // own, so that no caret goes in it; activate(unit), what Enter on a selected block does, every page
285
+ // object being asked and each testing the element itself, true when it was its own (notion-lite's
286
+ // activate); setProps(block, props), what a Markdown shortcut's `props` set on the block it made, in
287
+ // its undo step, returning the containers that made (no model to set them on, as notion-lite's
288
+ // setField does); press(event), what a press does on what is its component's (ownerOf: the nearest
289
+ // element around it that is of a component), before anything else hears of it, true when it was its
290
+ // own; keys: the keys of a text block of the component (ownerOf), notion-lite's field, each given the
291
+ // one `ctx` (docs/editor.md, "The order of keys") and true when the key was its: enter(ctx),
292
+ // shiftEnter, commandEnter, tab(ctx, back), escape, backspace, delete; around: { [key](ctx) }, the same
293
+ // keys for a block of another component that stands in it (a node's for what it holds, Esc in an open
294
+ // card, a list's for what an item holds) or right after it (`canHaveChildren`), asked of what stands
295
+ // around the block, nearest first, after the block's own component; mergeRefused(block), what it says
296
+ // of a block of it holding blocks that Backspace could not join to the line above; menuItems(target), the rows of the block
297
+ // menu that a block of the component has (notion-lite's), by the kind of unit it is, each row as
298
+ // menu.mjs takes it; nameOf(target), what the reader calls this block where that is no kind's name (an
299
+ // instance, its package's), iconOf(target), the mark at the head of its menu;
300
+ // menu(target, { rect, reason, remove }), a menu in place of the block menu ({ items,
301
+ // label, width }, or null; reason: why the block may not go, remove(): delete it); rowBeside(target),
302
+ // a row for a block of another component, beside its color, every page object being asked and each
303
+ // testing the block itself; acceptsFile(file), whether a file pasted makes a block of it, and
304
+ // fromFiles(put, files), that block made and handed to `put(block)`, the paste's, which puts it where a
305
+ // block pasted at the caret goes (one undo step) and says whether it could (notion-lite's
306
+ // createFromFiles(files, width, place), whose fromFiles gives the data of a new block and whose place
307
+ // the paste gives; the first page object that takes a file in their order); fromLink(figure,
308
+ // url, options), a block of the component filled from an address (notion-lite's, here the figure
309
+ // is there first: one pasted with its address, `{ pasted: true }`, a bookmark in an embed's place).
310
+ // What the rest of the editor asks of a component that does something of its own where every block
311
+ // does something: click(event), as `press`; key(event), a key on what is its own, asked of the
312
+ // component of what it came down on before any text block is looked for, true when it was its own
313
+ // (a tab's F2); undoHere(node), whether Ctrl+Z with the focus on a node of it is the page's (a tab,
314
+ // where no text block hears it); field, a text field of it that is no text block of the page's
315
+ // being edited (a tab's name), before which the block tools stand back; typed(host) and afterText(host),
316
+ // what was typed in a text block of it and what a step of its text undone or redone asks of it;
317
+ // type(host, text), text put in a text block of it that takes it as it is (`textFilters`: pasted, a
318
+ // line break that came with no key); shortcut(host, data), what `data` just typed in a text block of it
319
+ // makes before any type's `markdown` is read, true when it made something (a list in a cell);
320
+ // fromSelection(), a block of its type made from the selected text; fromPage(page), one made from what
321
+ // a web page says of itself (a link turned into a bookmark); pageIcon(), the page's own icon as it
322
+ // shows, or nothing; columnOps, sectionOps, rowOps, what the block tools do with rows of columns and
323
+ // with sections, and what the gaps in a row resize, read of whichever page object says them as
324
+ // notion-lite's drag reads `columnOps`, which keeps the name in one place; modalOps, in the same way,
325
+ // what stands open over the page as a modal: open(), the ones open, the one on top last,
326
+ // listen(listener), told when that may have changed, closeTop(), the one on top closed, show(node),
327
+ // what holds `node` shown for what lands in it, returning where it is, and kept() and reopen(kept),
328
+ // for a page shown again; keepsKeys(node, event), whether what happens on a node is its own: its keys, the
329
+ // clipboard and a drag there, the editor letting go (keptByComponent, page-objects.mjs), `event` the key
330
+ // where one is asked about; dataOf(unit), what of a block its component writes, by part, as the file is to
331
+ // hold it (nothing where it writes nothing), what core.mjs dataChanges compares, dataIn(html), the same of
332
+ // the file's markup of one (a block a commit wrote whole), dataMost, what one commit carries of it in
333
+ // bytes, and definitionOf(unit), the stamp of what it was written by, which the commit carries;
334
+ // prepare(block, node), of a kind of text block that says `closed` or `tex`, as editing starts,
335
+ // returning its baseline where it has one; panel, an editor of it open over the page, which saving
336
+ // waits for and which a press elsewhere, or the page saved or left, ends (`dismiss()`), `holds(node)`
337
+ // saying what is no press elsewhere;
338
+ // nodes, the elements of it to keep in the top
339
+ // layer when a modal dialog opens; install(), called once the block tools are there; blockTools(tools),
340
+ // a part of it made with the block tools, { holds(node), hide(), nodes }; tidy(parents), what a
341
+ // structural step may leave untidy (history.mjs), each asked in turn; nestBlocks(units, delta),
342
+ // selected blocks indented or outdented; addNear(unit, before), the handle's "+" on a block of it,
343
+ // undefined to leave it to the page; openAt(pre, point), code closed opened (caret.mjs).
344
+ // A new kit component gets a folder of its own and a line below.
345
+ export const COMPONENTS = [paragraph, heading, list, flowchart, quote, callout, highlight, details, code, divider, section, sheets, table, figure, image, file, bookmark, embed, columns, math, dialog, widget, icon, installed];
346
+
347
+ // The "/" menu's groups, in order (MENU_GROUPS below says the same).
348
+ const MENU_GROUP_ORDER = ["basic", "advanced"];
349
+ const menuRank = ({ menu }) => MENU_GROUP_ORDER.indexOf(menu[0]) * 1000 + menu[1];
350
+ // The mark of a component's line in 设置 › 组件列表: the icon of its first row in the "/" menu, the
351
+ // same drawing; one with no type there (分区) shows its first unit's (`icon`, a kind no type stands for).
352
+ const listedIcon = ({ types = {}, units = {} }) => Object.values(types).filter((spec) => spec.menu && spec.icon).sort((a, b) => menuRank(a) - menuRank(b))[0]?.icon
353
+ ?? Object.values(units).find((unit) => unit.icon)?.icon ?? null;
354
+
355
+ /** The built-in components 设置 › 组件列表 lists: { id, name() (in the language t() says it in), icon (svg markup), hideable }, by the order above. */
356
+ export const LISTED_BLOCKS = COMPONENTS.filter((component) => component.listed).map((component) => ({ id: component.name, name: component.listed, icon: listedIcon(component), hideable: component.hideable ?? true }));
357
+ for (const { id, icon } of LISTED_BLOCKS) if (!icon) throw new Error(`component ${id} has a line in the settings (listed), so it needs an icon: a type in the "/" menu, or a unit's icon`);
358
+
359
+ /** The names of those the reader may hide. */
360
+ export const HIDEABLE = new Set(LISTED_BLOCKS.filter(({ hideable }) => hideable).map(({ id }) => id));
361
+
362
+ /** The built-in components `names`, gallery.json's `hidden`, hide: a package's id there says no block, and a hand's `paragraph` hides none. */
363
+ export const blocksHidden = (names) => names.filter((name) => HIDEABLE.has(name));
364
+
365
+ /** The shared description (src/shared/components/) a component edits: its own name's, or the one it names (`description`). */
366
+ export const descriptionOf = (component) => component.description ?? component.name;
367
+
368
+ // A block's identity: an opaque, meaningless id that the page's edits and merges find it by,
369
+ // wherever it moved and however it changed. Only units carry one (paragraphs, headings, list items,
370
+ // cards, tables, disclosures, sections...), never cells or inline elements.
371
+ // It binds nothing: a block with it still changes type, splits and merges like one without.
372
+ export const IDENTITY = "data-block-id";
373
+
374
+ // What is no component's: the page and its header, plain grouping divs, the text blocks every
375
+ // flow has (paragraphs, headings and list items, the report's title), and the caption of the media
376
+ // blocks, which stays with whichever of them there are.
377
+ const PAGE = {
378
+ glance: { row: 19, name: "颜色", write: "`doc-text-<color>`, `doc-highlight-<color>` on the block", rule: "Kit blocks" },
379
+ boxes: { main: { role: "root", name: t("页面") }, plain: { role: "flow", name: t("分组") }, header: { role: "lines", name: t("页眉"), also: ["icon"] } }, // the page's icon stands in the header
380
+ hosts: {
381
+ // A free text block may be left empty (Notion's): written as an empty element, one line high.
382
+ flow: { opensBefore: true, caps: ({ bound }) => bound ? ["split", "merge", "links"] : ["split", "merge", "remove", "empty", "links"] },
383
+ title: { name: t("文档主标题"), caps: () => ["plain"], blankSays: t("文档主标题还空着:写上标题后才会保存。") },
384
+ ...MEDIA_HOSTS,
385
+ },
386
+ readOnly: [
387
+ { rank: 80, at: "button, label, input, select, textarea", says: t("交互控件暂不能在页面上修改。") },
388
+ { rank: 110, at: "figure, svg, canvas", says: t("图是页面画出来的;要改它的数据或画法,请让 AI 修改。") },
389
+ ],
390
+ };
391
+
392
+ const all = (part) => Object.assign({}, ...[PAGE, ...COMPONENTS].map((component) => component[part] ?? {}));
393
+ const UNITS = all("units");
394
+ const BOXES = all("boxes");
395
+ const flagged = (flag) => new Set(Object.keys(UNITS).filter((kind) => UNITS[kind][flag]));
396
+ const byRank = (rows) => rows.sort((a, b) => a.rank - b.rank).map(({ rank, ...row }) => row);
397
+
398
+ /** Unit kinds by element, first match wins (source/ unitKind). */
399
+ export const UNIT_KINDS = byRank(Object.entries(UNITS).flatMap(([kind, unit]) => (unit.match ?? []).map((rule) => ({ ...rule, kind }))));
400
+
401
+ /** The kit's containers whose children are units, by class, and the kind of box each is (first match). */
402
+ export const BOX_CLASSES = byRank(Object.entries(BOXES).flatMap(([kind, box]) => (box.classes ?? []).map((rule) => ({ rank: rule.rank, row: [rule.class, kind] })))).map(({ row }) => row);
403
+
404
+ /** The component that defines each block type, by name: its page object in components/pages.mjs. */
405
+ export const TYPE_COMPONENT = Object.fromEntries(COMPONENTS.flatMap((component) => Object.keys(component.types ?? {}).map((type) => [type, component.name])));
406
+
407
+ /** The component that defines each kind of unit, by name. */
408
+ export const UNIT_COMPONENT = Object.fromEntries(COMPONENTS.flatMap((component) => Object.keys(component.units ?? {}).map((kind) => [kind, component.name])));
409
+
410
+ /** Elements that are one block, by class or by attribute. */
411
+ export const COMPONENT_CLASSES = COMPONENTS.flatMap((component) => component.components ?? []);
412
+ export const COMPONENT_ATTRIBUTES = COMPONENTS.flatMap((component) => component.attributes ?? []);
413
+
414
+ /** The category of each unit kind: its component's (src/shared/components/), "block", "container", "card" or "whole". */
415
+ export const UNIT_CATEGORY = Object.fromEntries(COMPONENTS.flatMap((component) => Object.keys(component.units ?? {}).map((kind) => [kind, componentOf(descriptionOf(component))?.category ?? null])));
416
+
417
+ /** The unit kinds of the basic blocks: their text blocks are their own lines, where a container's or a card's are blocks in it. */
418
+ export const BASIC_UNITS = new Set(Object.keys(UNIT_CATEGORY).filter((kind) => UNIT_CATEGORY[kind] === "block"));
419
+
420
+ /** What the reader calls each category. */
421
+ export const CATEGORY_NAMES = Object.fromEntries(Object.entries(CATEGORIES).map(([category, { name }]) => [category, name]));
422
+
423
+ /**
424
+ * The unit kinds copied as themselves (clipboard/own/, source/commit.mjs): a card, and a table or a
425
+ * row of columns (copy: "itself"), which the page can make but which keep all their own markup
426
+ * within the report.
427
+ */
428
+ export const COPIED_AS_ITSELF = new Set(Object.entries(UNITS).filter(([kind, unit]) => UNIT_CATEGORY[kind] === "card" || unit.copy === "itself").map(([kind]) => kind));
429
+
430
+ /** What the reader calls each kind of unit (block labels while dragging, the block menu). */
431
+ export const KIND_NAMES = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.name).map(([kind, unit]) => [kind, unit.name]));
432
+
433
+ /** The icons of unit kinds no block type stands for (the block menu's 分区与分栏 row shows the columns'). */
434
+ export const KIND_ICONS = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.icon).map(([kind, unit]) => [kind, unit.icon]));
435
+
436
+ /** What the reader calls each kind of box (the container a drop goes into). */
437
+ export const BOX_NAMES = Object.fromEntries(Object.entries(BOXES).filter(([, box]) => box.name).map(([kind, box]) => [kind, box.name]));
438
+
439
+ /** Why an element stays read-only, the first rule that finds it, in rank order: { at, says } (`readOnly`; hints/). */
440
+ export const READ_ONLY_HINTS = byRank([PAGE, ...COMPONENTS].flatMap((component) => component.readOnly ?? []));
441
+
442
+ /** The kinds of text block: what the reader calls each (refusals) and what each can do (source/). */
443
+ export const HOSTS = all("hosts");
444
+
445
+ /** What a text block left blank says: its kind's or its type's (`blankSays`), or null. */
446
+ export const blankSaysOf = (node) => HOSTS[node.getAttribute("data-ge-kind")]?.blankSays ?? BLOCK_TYPES[blockTypeOf(node)]?.blankSays ?? BLOCK_TYPES[textTypeOf(node)]?.blankSays ?? null;
447
+
448
+ /** Whether what is typed in a text block is read as text (`textFilters`: not in code, nor in a tab's name). */
449
+ export const textFilters = (host) => HOSTS[host.getAttribute("data-ge-kind")]?.textFilters !== false;
450
+
451
+ /** Whether a text block takes an inline formula (`formula`: not an instance's text part, where the kit draws none). */
452
+ export const takesFormula = (host) => HOSTS[host.getAttribute("data-ge-kind")]?.formula !== false;
453
+
454
+ /** Whether a text block's text is a formula's TeX alone (`tex`: a formula block's), which changes in the formula editor alone. */
455
+ export const texOnly = (host) => Boolean(HOSTS[host?.getAttribute("data-ge-kind")]?.tex);
456
+ export const HOST_NAMES = Object.fromEntries(Object.entries(HOSTS).filter(([, host]) => host.name).map(([kind, host]) => [kind, host.name]));
457
+
458
+ /**
459
+ * What a text block of `kind` can do, as the text of its data-ge-caps attribute: how the page makes
460
+ * one (nothing refers to it), which is what the server finds in the file for the same block unless
461
+ * that is bound (`bound`).
462
+ */
463
+ export const capsFor = (kind, { bound = false } = {}) => HOSTS[kind].caps({ bound, blockLevel: true }).join(" ");
464
+
465
+ const HINTS = COMPONENTS.flatMap((component) => Object.entries(component.placeholders ?? {})
466
+ .map(([part, text]) => ({ match: componentOf(descriptionOf(component)).match, at: componentOf(descriptionOf(component)).parts[part].at, text })));
467
+
468
+ /**
469
+ * What an empty text block says while the caret is in it, when its kind says (`placeholder` of
470
+ * `hosts`) or it is the part of a component that says (`placeholders` above), or null. Whatever the
471
+ * block's source: a part of the file says the same as one made on the page.
472
+ */
473
+ export const placeholderOf = (host) => HOSTS[host.getAttribute("data-ge-kind")]?.placeholder ?? HINTS.find(({ match, at }) => host.closest(match)?.querySelector(at) === host)?.text ?? null;
474
+
475
+ // ---------- block types ----------
476
+
477
+ /** The blocks the reader can make or turn a block into, by type (see `types` above). */
478
+ export const BLOCK_TYPES = all("types");
479
+
480
+ /** Whether a type (its entry in BLOCK_TYPES) is a container whose blocks stand straight in its element: no title, no content region of its own. */
481
+ export const holdsStraight = (spec) => Boolean(spec?.box) && !spec.content && !spec.title;
482
+
483
+ // What each type says of where it shows (`types` above): turn, its place among the types a text
484
+ // block is turned into; fresh, its place among the types made as an empty block that stands for an
485
+ // empty one (a divider, a media block, a table...); menu, [group, place] in the "/" menu. A type that
486
+ // is either must be in the menu, which the block menu's 在下方新建 shows too.
487
+ const inOrder = (rank) => {
488
+ const found = Object.entries(BLOCK_TYPES).map(([type, spec]) => [type, rank(spec)]).filter(([, place]) => place !== undefined).sort((a, b) => a[1] - b[1]);
489
+ for (let index = 1; index < found.length; index++) if (found[index][1] === found[index - 1][1]) throw new Error(`two block types share a place: ${found[index - 1][0]}, ${found[index][0]}`);
490
+ return found.map(([type]) => type);
491
+ };
492
+ for (const [type, spec] of Object.entries(BLOCK_TYPES)) {
493
+ if ((spec.turn !== undefined || spec.fresh !== undefined) && !spec.menu) throw new Error(`block type ${type} is made or turned into, so it needs a menu place`);
494
+ if (spec.menu && !LISTED_BLOCKS.some(({ id }) => id === TYPE_COMPONENT[type])) throw new Error(`block type ${type} has a menu place, so its component needs a line in the settings (listed)`);
495
+ }
496
+
497
+ /** The types a text block can be turned into, in menu order. */
498
+ export const TURN_INTO = inOrder((spec) => spec.turn);
499
+
500
+ /** The types made as an empty block standing for an empty one: no text is carried into them. */
501
+ export const FRESH = inOrder((spec) => spec.fresh);
502
+
503
+ /** The containers that turn into one another, what they hold carried along, in menu order (`holder`). */
504
+ export const HOLDERS = inOrder((spec) => spec.holder);
505
+
506
+ /** The "/" menu's groups of block types, in order: { basic, advanced } (the menu says their names). */
507
+ export const MENU_GROUPS = Object.fromEntries(MENU_GROUP_ORDER.map((group) => [group, inOrder((spec) => (spec.menu?.[0] === group ? spec.menu[1] : undefined))]));
508
+
509
+ /** The types a block is made of from selected text, each with its row of the format bar's 更多 (`fromSelection`). */
510
+ export const FROM_SELECTION = Object.entries(BLOCK_TYPES).filter(([, spec]) => spec.fromSelection).map(([type, spec]) => ({ type, ...spec.fromSelection }));
511
+
512
+ /** The Markdown shortcuts at a block's start, in the order of the definitions: each rule with its type (`markdown` above). */
513
+ export const MARKDOWN = Object.entries(BLOCK_TYPES).flatMap(([type, spec]) => (spec.markdown ?? []).map((rule) => ({ type, ...rule })));
514
+
515
+ const GLANCE_PARTS = [PAGE, ...COMPONENTS].flatMap((component) => [...Object.values(component.types ?? {}).map((spec) => spec.glance), component.glance].flat().filter(Boolean));
516
+
517
+ /** The rows of "Blocks at a glance", in their places: each the parts that say that place (`glance`). */
518
+ export const GLANCE = [...new Set(GLANCE_PARTS.map(({ row }) => row))].sort((a, b) => a - b).map((row) => GLANCE_PARTS.filter((part) => part.row === row));
519
+
520
+ /** Names, icons, Markdown shortcuts and search words of the block types, as menu rows show them. */
521
+ export const TYPE_INFO = Object.fromEntries(Object.entries(BLOCK_TYPES).filter(([, spec]) => spec.label)
522
+ .map(([type, { label, icon, hint, words }]) => [type, { label, icon, ...(hint ? { hint } : {}), words }]));
523
+
524
+ /**
525
+ * The type of block an element is, as its components describe it: its data-ge-type when it has
526
+ * one (made on the page), else the type whose tag and class it has. Null when none.
527
+ */
528
+ export function blockTypeOf(element) {
529
+ const marked = element.getAttribute?.("data-ge-type");
530
+ if (BLOCK_TYPES[marked]) return marked;
531
+ return CLASSED.find(([, spec]) => element.localName === spec.tag && element.classList.contains(spec.className))?.[0] ?? null;
532
+ }
533
+ const CLASSED = Object.entries(BLOCK_TYPES).filter(([, spec]) => spec.className);
534
+
535
+ /**
536
+ * The type of a text block's element: its own (blockTypeOf), else the plain type of its tag, which
537
+ * has no class to tell it by (a paragraph, a heading, a list item). Null when none.
538
+ */
539
+ export function textTypeOf(element) {
540
+ return blockTypeOf(element) ?? PLAIN[element.localName] ?? null;
541
+ }
542
+ const PLAIN = {};
543
+ for (const [type, spec] of Object.entries(BLOCK_TYPES)) {
544
+ if (spec.className || !["paragraph", "heading", "item"].includes(spec.kind)) continue;
545
+ if (PLAIN[spec.tag]) throw new Error(`two plain text types share <${spec.tag}>: ${PLAIN[spec.tag]}, ${type}`);
546
+ PLAIN[spec.tag] = type;
547
+ }
548
+
549
+ /** The component that defines each kind of text block, by name. */
550
+ export const HOST_COMPONENT = Object.fromEntries(COMPONENTS.flatMap((component) => Object.keys(component.hosts ?? {}).map((kind) => [kind, component.name])));
551
+
552
+ // The elements that are one block (`components`, `attributes`), with the component of each.
553
+ const ONE_BLOCK = COMPONENTS.flatMap((component) => [...(component.components ?? []).map((name) => `.${name}`), ...(component.attributes ?? []).map((name) => `[${name}]`)].map((at) => ({ at, name: component.name })));
554
+ const ONE_BLOCK_AT = ONE_BLOCK.map(({ at }) => at).join(", ");
555
+ /** What no text block around it reaches into (`sealed`), a selector, "" where no component says. */
556
+ export const SEALED = COMPONENTS.map((component) => component.sealed).filter(Boolean).join(", ");
557
+
558
+ // What is one block is found inside the slot whose inside is the document's region an element stands
559
+ // in, where it does (an instance's slot holds blocks of their own: installed.mjs slotAround).
560
+ const oneBlockOf = (element) => {
561
+ const region = slotAround(element);
562
+ let whole = null;
563
+ for (let around = element.closest(ONE_BLOCK_AT); around && (!region || region.contains(around)); around = around.parentElement?.closest(ONE_BLOCK_AT)) whole = around;
564
+ return whole && ONE_BLOCK.find(({ at }) => whole.matches(at)).name;
565
+ };
566
+
567
+ // The parts its description edits as text, with the component of each: a figure's title, a heading
568
+ // by its tag alone.
569
+ const TEXT_PARTS = COMPONENTS.flatMap((component) => {
570
+ const { match, parts = {} } = componentOf(descriptionOf(component)) ?? {};
571
+ return Object.values(parts).filter((part) => part.edit === "text").map(({ at }) => ({ name: component.name, match, at }));
572
+ });
573
+ const textPartOf = (element) => TEXT_PARTS.find(({ match, at }) => [...(element.closest(match)?.querySelectorAll(at) ?? [])].includes(element))?.name;
574
+
575
+ /**
576
+ * The component an element is of, by name, or null. Nothing inside an element that is one block is
577
+ * anyone else's, whatever its tag or class (a cell's list, a Sheet's tab), but what an instance's slot
578
+ * holds, the document's blocks, each its own. Else that of its kind of text
579
+ * block, where a component defines the kind (a cell, a tab's name), that of the text part of a
580
+ * component it is, that of the unit it is (a flowchart's node, though an li) and last that of its type
581
+ * (a list's item made on the page). What stands in a container is its own component's, not the
582
+ * container's, as notion-lite's ctx.def is the block the caret is in.
583
+ */
584
+ export const ownerOf = (element) => oneBlockOf(element) ?? HOST_COMPONENT[element.getAttribute("data-ge-kind")] ?? textPartOf(element) ?? UNIT_COMPONENT[element.getAttribute("data-ge-unit-kind")] ?? TYPE_COMPONENT[textTypeOf(element)] ?? null;
585
+
586
+ /** The chips in a text that open something of a component and go whole by Backspace or Delete (`entry`), with what the page says then. */
587
+ export const ENTRIES = COMPONENTS.map((component) => component.entry).filter(Boolean);
588
+
589
+ /** Whether a block right after this element goes under it by Tab (`canHaveChildren`). */
590
+ export const canHaveChildren = (element) => Boolean(UNITS[element.getAttribute("data-ge-unit-kind")]?.canHaveChildren);
591
+
592
+ /**
593
+ * The elements a new block's text blocks may be part of rather than blocks of their own (a new
594
+ * disclosure's summary, a new code block's pre), as their components declare them (`part`).
595
+ */
596
+ export const PART_SELECTOR = Object.values(BLOCK_TYPES).map((spec) => spec.part).filter(Boolean).join(", ");
597
+
598
+ /**
599
+ * The box of kind `kind` (and `key`) of a unit's element: where its component's description says
600
+ * (`find`: a list item's lists, a disclosure's content region, a Sheet area's panels), else the
601
+ * element itself when it is a box of that kind.
602
+ */
603
+ export function boxIn(unit, kind, key = null) {
604
+ const find = BOXES[kind]?.find;
605
+ if (find) return find(unit, key) ?? null;
606
+ return unit.getAttribute("data-ge-box-kind") === kind ? unit : null;
607
+ }
608
+
609
+ /**
610
+ * The element of the unit that takes the box `element` along (its component's `owner`: a Sheet
611
+ * panel's tab), or null. What changes in such a box changes that unit too: its hash covers it.
612
+ */
613
+ export const boxOwner = (element) => BOXES[element.getAttribute("data-ge-box-kind")]?.owner?.(element) ?? null;
614
+
615
+ /** Whether the unit `element` takes the box `{ kind, key }` along (its component's `takenBy`), the two on the page or not. */
616
+ export const takesBox = (element, { kind, key }) => Boolean(element && BOXES[kind]?.takenBy?.(element, key));
617
+
618
+ /** The text blocks that can be made again as new blocks, from their words alone (paragraphs, small text, headings). */
619
+ const FROM_WORDS = flagged("fromWords");
620
+ export const PLAIN_TEXT = new Set(Object.keys(BLOCK_TYPES).filter((type) => FROM_WORDS.has(BLOCK_TYPES[type].kind)));
621
+
622
+ /** Plain text leaves (paragraphs, small text, headings). */
623
+ export const TEXT_TYPES = new Set(Object.keys(BLOCK_TYPES).filter((type) => BLOCK_TYPES[type].text));
624
+
625
+ /** The heading type of each heading tag (H1 -> heading1). */
626
+ export const HEADING_TYPES = Object.fromEntries(Object.entries(BLOCK_TYPES).filter(([, spec]) => spec.kind === "heading").map(([type, spec]) => [spec.tag.toUpperCase(), type]));
627
+
628
+ // ---------- how a block is copied and written out ----------
629
+
630
+ const PARAGRAPH = { kind: "paragraph" };
631
+
632
+ /** The `clipboard` of a block type; one that says no kind is a paragraph (notion-lite's). */
633
+ export const clipboardOf = (type) => ({ ...PARAGRAPH, ...BLOCK_TYPES[type]?.clipboard });
634
+
635
+ // The type a unit kind goes by, when it says nothing itself: the first of that kind.
636
+ const TYPE_OF_KIND = {};
637
+ for (const [type, spec] of Object.entries(BLOCK_TYPES)) TYPE_OF_KIND[spec.kind] ??= type;
638
+
639
+ // The `clipboard` of an element as a unit of `kind`: what the unit says over what the first type of the
640
+ // kind does, its own where that says `of`. A kind that is none goes as a whole block, as anything no
641
+ // rule matches does.
642
+ function kindClipboard(kind, element) {
643
+ const said = UNITS[kind] ? { ...BLOCK_TYPES[TYPE_OF_KIND[kind]]?.clipboard, ...UNITS[kind].clipboard } : UNITS.block?.clipboard;
644
+ return { ...PARAGRAPH, ...said, ...said?.of?.(element) };
645
+ }
646
+
647
+ /** The `clipboard` of an element of the page, as the unit it is. */
648
+ export const unitClipboard = (element) => kindClipboard(element.getAttribute("data-ge-unit-kind"), element);
649
+
650
+ // The kind an element's tag gives it (`match` rules that name one, with what they say of its class,
651
+ // attribute and parent): a class of another component may have given it another.
652
+ const TAG_RULES = UNIT_KINDS.filter((rule) => rule.tag);
653
+ const isOf = (element, tag, name) => (!tag || [tag].flat().includes(element?.localName)) && (!name || Boolean(element?.classList.contains(name)));
654
+ export const tagKind = (element) => TAG_RULES.find(({ tag, class: name, attr, parent }) => isOf(element, tag, name) && (!attr || element.hasAttribute(attr)) && (!parent || isOf(element.parentElement, parent.tag, parent.class)))?.kind;
655
+
656
+ const CLAIMING = Object.values(BLOCK_TYPES).map((spec) => spec.clipboard).filter((clipboard) => clipboard?.claims);
657
+
658
+ /**
659
+ * What the hook `name` of the `clipboard` says of an element, which goes first of all by the unit it
660
+ * is. A hook that says undefined leaves it to the kind its tag gives it, then to the block whose mark
661
+ * it carries (`claims`): an element may have the class or the attribute of a component besides its
662
+ * own. A tag whose block holds nothing (`bare`: an hr) comes before the unit: no class makes that a
663
+ * block of another kind.
664
+ */
665
+ export function askClipboard(name, element, ...question) {
666
+ const kind = tagKind(element);
667
+ const owners = [unitClipboard(element), kindClipboard(kind, element)];
668
+ if (BLOCK_TYPES[TYPE_OF_KIND[kind]]?.bare) owners.reverse();
669
+ for (const clipboard of [...owners, ...CLAIMING.filter(({ claims }) => element.matches(claims))]) {
670
+ const answer = clipboard[name]?.(element, ...question);
671
+ if (answer !== undefined) return answer;
672
+ }
673
+ return undefined;
674
+ }
675
+
676
+ const WRITTEN_APART = Object.values(UNITS).map((unit) => unit.clipboard).filter((clipboard) => clipboard?.apart);
677
+
678
+ /** The elements that are no block of the page's flow (`apart`), as a selector. */
679
+ export const APART = WRITTEN_APART.map((clipboard) => clipboard.apart).join(", ");
680
+
681
+ /** What a page export writes after the page's flow: those elements of `document` that are reached, each with its `clipboard`. */
682
+ export const writtenApart = (document) => WRITTEN_APART.flatMap((clipboard) => [...document.querySelectorAll(clipboard.apart)].filter((element) => clipboard.reached?.(element) ?? true).map((element) => ({ element, clipboard })));
683
+
684
+ /** The `clipboard` hook `name` of each type that has it. */
685
+ export const clipboardHooks = (name) => Object.values(BLOCK_TYPES).map((spec) => spec.clipboard?.[name]).filter(Boolean);
686
+
687
+ /** The editor's marks a pasted copy keeps (`keeps`). */
688
+ export const COPY_KEEPS = new Set(Object.values(BLOCK_TYPES).flatMap((spec) => spec.clipboard?.keeps ?? []));
689
+
690
+ /** What in the markup of a block copied as itself is none of its words: what only a browser reads, and what a unit says (`unsaid`). */
691
+ export const UNSAID = ["script, style, template", ...Object.values(UNITS).flatMap((unit) => unit.clipboard?.unsaid ?? [])].join(", ");
692
+
693
+ // ---------- where blocks may go ----------
694
+ // The report is one document of chapters (sections and Sheet areas), each a flow of blocks. Every
695
+ // box (findUnits) has a role; the page and the server both check a move against it. Flows are
696
+ // the content of sections, panels, disclosures, dialogs, columns and plain grouping divs: body
697
+ // text and components read the same in all of them (see "body text in flows" in
698
+ // src/render/kit/styles/flow.css), so a block may go into any flow; a column takes any block but
699
+ // another row of columns. The report's header takes paragraphs (the lines under its title), a
700
+ // quote paragraphs, a row of columns its columns, a list its items, a tab row its own tabs. The
701
+ // opening summary is a highlight panel like any other.
702
+ const ROLES = Object.fromEntries(Object.entries(BOXES).map(([kind, box]) => [kind, box.role]));
703
+ /** What a chapter is: the page and Sheet panels hold these besides body text. */
704
+ export const CHAPTER = flagged("chapter");
705
+ const FIXED = flagged("fixed"); // never inside a flow
706
+ /** What may stand first in a chapter as the line above its heading (`leadsChapter`: a divider, fold/). */
707
+ export const LEADS_CHAPTER = flagged("leadsChapter");
708
+
709
+ /** The kinds of box a plain <div> without a class is a group of blocks in (`groups`; source/units.mjs boxKind). */
710
+ export const GROUPING = new Set(Object.keys(BOXES).filter((kind) => BOXES[kind].groups));
711
+
712
+ /** The role of a box of this kind. */
713
+ export const boxRole = (kind) => ROLES[kind] ?? "flow";
714
+
715
+ /** The box kinds that always hold a block: one a change leaves empty gets an empty paragraph (`holdsOne`). */
716
+ export const HOLDS_ONE = new Set(Object.keys(BOXES).filter((kind) => BOXES[kind].holdsOne));
717
+
718
+ /** The box kinds whose empty last block Enter moves out after the box (`leaveByEnter`). */
719
+ export const LEAVES_BY_ENTER = new Set(Object.keys(BOXES).filter((kind) => BOXES[kind].leaveByEnter));
720
+
721
+ /** Whether what is under the last block of a box of this kind is its own padding (`endIsPadding`): a click there makes no block (geometry.mjs endOf). */
722
+ export const endIsPadding = (boxKind) => Boolean(BOXES[boxKind]?.endIsPadding);
723
+
724
+ /** The unit kinds Backspace deletes whole once nothing is written in them (`removedEmpty`). */
725
+ export const REMOVED_EMPTY = Object.keys(UNITS).filter((kind) => UNITS[kind].removedEmpty);
726
+
727
+ /** Whether Backspace in any of the text blocks of a unit of this kind deletes it (`removedEmpty: "anywhere"`), not only in its first. */
728
+ export const removedFromAnywhere = (kind) => UNITS[kind]?.removedEmpty === "anywhere";
729
+
730
+ /**
731
+ * What may stand in a container Backspace deletes whole, nothing being written in it (`emptyIsNothing`:
732
+ * the tags of the text blocks and of what holds them, and the classes of a box that holds them, a
733
+ * disclosure's content): a block of any other kind is something there.
734
+ */
735
+ const NOTHING_EMPTY = flagged("emptyIsNothing");
736
+ export const TEXT_BLOCKS = [...new Set(Object.values(BLOCK_TYPES).filter((spec) => NOTHING_EMPTY.has(spec.kind)).map((spec) => spec.tag)), ...Object.values(BOXES).filter((box) => box.emptyIsNothing).flatMap((box) => box.classes.map((rule) => `.${rule.class}`))].join(", ");
737
+
738
+ /** Whether what a unit of this kind is turned into is an empty block in its place (`turnsEmpty`). */
739
+ export const turnsEmpty = (kind) => Boolean(UNITS[kind]?.turnsEmpty);
740
+
741
+ const ALSO = Object.fromEntries(Object.entries(BOXES).filter(([, box]) => box.also).map(([kind, box]) => [kind, new Set(box.also)]));
742
+
743
+ /** The kind of unit a box of this kind opens with as its fixed head (`lead`), or null. */
744
+ export const leadOf = (boxKind) => BOXES[boxKind]?.lead ?? null;
745
+ /** Whether a unit of `kind` is the lead of a box of `boxKind` (false for a box with none, whatever the kind: null is no lead). */
746
+ export const isLead = (boxKind, kind) => {
747
+ const lead = leadOf(boxKind);
748
+ return lead !== null && kind === lead;
749
+ };
750
+
751
+ /** Whether the first block of a box of this kind shows the box's handle (`firstLineActs`). */
752
+ export const firstLineActs = (boxKind) => Boolean(BOXES[boxKind]?.firstLineActs);
753
+
754
+ /** The type the first block of a box of this kind always is (`firstBlock`: a flowchart node's title, "paragraph"), or null. */
755
+ export const firstBlockOf = (boxKind) => BOXES[boxKind]?.firstBlock ?? null;
756
+
757
+ /** What that first line says empty (`firstSays`), or null. */
758
+ export const firstSaysOf = (boxKind) => BOXES[boxKind]?.firstSays ?? null;
759
+
760
+ // ---------- what the reader sees of a unit ----------
761
+
762
+ /** Whether a unit of this kind is a block of its own for the reader (`block`: no column is). */
763
+ export const isBlock = (kind) => UNITS[kind]?.block !== false;
764
+
765
+ /** Whether a block straight in a box of this kind may have a block around it (`outer`: none in a detail card's content). */
766
+ export const hasOuter = (boxKind) => BOXES[boxKind]?.outer !== false;
767
+
768
+ /** The unit kinds with a frame of their own (`boxed`): a double click between two makes a paragraph (insert/). */
769
+ export const BOXED = flagged("boxed");
770
+
771
+ /** The unit kinds a click to the right of one, past the text area it stands in, selects: the boxed ones and those that say `beside` (beside.mjs). */
772
+ export const BESIDE = new Set([...BOXED, ...flagged("beside")]);
773
+
774
+ /** Whether a unit of this kind stands beside another now, `element` being that unit (`beside`, `inRow`). */
775
+ export const standsBeside = (kind, element) => Boolean(UNITS[kind]?.beside || UNITS[kind]?.inRow?.(element));
776
+
777
+ /** The unit kinds whose height is the tallest's beside them (`sharesHeight`: annotate/). */
778
+ export const SHARES_HEIGHT = flagged("sharesHeight");
779
+
780
+ /** Whether `node` is a picture standing as a block, a block's first line before any words (its caption's): where the handle and a marker stand. */
781
+ export const standsAsPicture = (node) => node.matches("img") && getComputedStyle(node).display === "block";
782
+
783
+ /** The unit kinds Enter on one selected puts a paragraph after, unless it is a text block: those and the ones that say `entersAfter` (beside.mjs). */
784
+ export const ENTERS_AFTER = new Set([...BESIDE, ...flagged("entersAfter")]);
785
+
786
+ /** The unit kinds whose edges resize (`resizable`: resize/). */
787
+ export const RESIZABLE = flagged("resizable");
788
+
789
+ /** The elements those edges may belong to: their `resizable` selectors, as one. */
790
+ export const RESIZABLE_AT = Object.values(UNITS).map((unit) => unit.resizable).filter(Boolean).join(", ");
791
+
792
+ /** The steps of Ctrl+A a box of this kind is (`selectAll`), or null when it is none. */
793
+ export const selectAllOf = (boxKind) => BOXES[boxKind]?.selectAll ?? null;
794
+
795
+ /** Whether a block menu offers a new block below a unit of this kind (`below`: none for a tab or a Sheet area). */
796
+ export const takesBelow = (kind) => UNITS[kind]?.below !== false;
797
+
798
+ /** Where the handle of a unit of this kind stands: "line", "bar", "none" or "outer" (`handle`). */
799
+ export const handleOf = (kind) => UNITS[kind]?.handle ?? "line";
800
+
801
+ /** Whether a box of this kind takes a unit of this kind. */
802
+ export function accepts(boxKind, unitKind) {
803
+ if (ALSO[boxKind]?.has(unitKind)) return true; // a highlight block's icon, the page's icon in the header (it comes first: source/apply.mjs)
804
+ switch (boxRole(boxKind)) {
805
+ case "root": return CHAPTER.has(unitKind) || !FIXED.has(unitKind); // chapters, and body text as a flow takes it
806
+ case "flow": return !FIXED.has(unitKind);
807
+ case "lines": return unitKind === "paragraph"; // the header: its lines (and the page's icon: `also`)
808
+ case "quote": return unitKind === "paragraph";
809
+ case "column": return !FIXED.has(unitKind) && unitKind !== "columns"; // no row of columns in a column
810
+ case "columns": return unitKind === "column";
811
+ case "list": return unitKind === "item";
812
+ case "nest": return !FIXED.has(unitKind) && unitKind !== "columns"; // a list item holds blocks after its text (no row of columns)
813
+ case "steps": return unitKind === "step"; // a flowchart: its steps (nodes) alone
814
+ case "tabs": return unitKind === "tab";
815
+ default: return false;
816
+ }
817
+ }
818
+
819
+ // ---------- sizes, class switches and attributes ----------
820
+
821
+ /** The families of colors a unit kind takes (颜色 in the block menu), by kind: those that say `colors`. */
822
+ export const COLOR_FAMILIES = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.colors?.length > 0).map(([kind, unit]) => [kind, unit.colors]));
823
+
824
+ /** The color of each family a unit kind shows with none of it, when that is one of the nine, by kind: those that say `colorDefaults` ({ background: "blue" }). */
825
+ export const COLOR_DEFAULTS = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.colorDefaults).map(([kind, unit]) => [kind, unit.colorDefaults]));
826
+
827
+ /** Classes a block may switch on the page, by unit kind: its own, then its colors' (the server allows the same). */
828
+ export const TOGGLES = Object.fromEntries(Object.entries(UNITS).map(([kind, unit]) => [kind, [...(unit.toggles ?? []), ...(COLOR_FAMILIES[kind] ?? []).flatMap((family) => COLOR_CLASSES[family])]]).filter(([, names]) => names.length > 0));
829
+
830
+ /**
831
+ * Sizes a block may carry, by unit kind: custom properties in its style attribute ("Sizes" in
832
+ * src/render/kit/styles/sizes.css) and the values each takes: a share (a number), a length in px, or none.
833
+ */
834
+ export const SIZES = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.sizes).map(([kind, unit]) => [kind, unit.sizes]));
835
+
836
+ // The last digit of arithmetic: a share worked out to the least or the most a size takes (1/24 less a
837
+ // rounding error) is that, not out of range.
838
+ const EDGE = 1e-9;
839
+
840
+ /** The text a size is written as (a share to three places, a length to a whole px), or null when the kind does not take it. */
841
+ export function sizeValue(kind, name, value) {
842
+ const rule = SIZES[kind]?.[name];
843
+ if (!rule || typeof value !== "string") return null;
844
+ const text = value.trim();
845
+ if (rule.none && text === "none") return text;
846
+ const match = (rule.px ? /^(\d+(?:\.\d+)?)px$/ : /^(\d*\.?\d+)$/).exec(text);
847
+ const number = match ? Number(match[1]) : NaN;
848
+ if (!(number >= rule.min - EDGE && number <= rule.max + EDGE)) return null;
849
+ return rule.px ? `${Math.round(number)}px` : String(Math.round(number * 1000) / 1000);
850
+ }
851
+
852
+ /**
853
+ * Attributes a block may set on the page, by unit kind (a code block's language): each with the
854
+ * test of the values it takes. Set or removed in its start tag, as classes are switched.
855
+ */
856
+ export const ATTRIBUTES = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.attributes).map(([kind, unit]) => [kind, unit.attributes]));
857
+
858
+ /** Whether a kind takes this value of this attribute (null: the attribute removed). */
859
+ export const attributeValue = (kind, name, value) => Boolean(ATTRIBUTES[kind]?.[name]) && (value === null || (typeof value === "string" && ATTRIBUTES[kind][name](value)));