@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,104 @@
1
+ import { svg } from "../icons.mjs";
2
+ import { componentOf } from "../../../shared/components/index.mjs";
3
+ import { t } from "../../../shared/i18n/index.mjs";
4
+
5
+ // 分栏: blocks side by side, as Feishu's columns (src/shared/components/columns.mjs). The row
6
+ // (.doc-columns) holds 2 to 5 columns (.doc-column), each a flow of any blocks but chapters
7
+ // and other rows. Neither gets a handle, as in Feishu: the blocks in the columns do, and "选中外层"
8
+ // from one of them selects the row (to move or delete it whole). A column's width is its share of
9
+ // the row (--doc-column-ratio). page.mjs: making a row (a block dropped beside another, 分栏 in
10
+ // the block menu), a column added, rows kept tidy (a column left empty goes, a row left with one
11
+ // column gives its blocks back), the ratios; file.mjs: a row and its columns in report.html.
12
+ //
13
+ // Where the engines reach it (src/editor/page/ unless named): drag/drop.mjs (a drop beside a block:
14
+ // `aside`), drag/ (making the row), block-menu/ (分栏), columns/ (the gaps: dragging one resizes the
15
+ // two columns beside it, its pin adds a column; the row's tint), history.mjs (a structural step
16
+ // leaves rows tidy: its page object's tidy, which editor.mjs gives it), geometry.mjs (box selection takes
17
+ // the blocks in the columns; a click below a short column writes in it), handle/ (no handle of
18
+ // their own), block-info.mjs (选中外层 passes over a column), commit.mjs (a column's ratio in its
19
+ // node), clipboard/own/ (`clipboard`: copied as itself, made of another program's), ../source/ (a row made on the page).
20
+ // Its look: the kit's styles/columns.css (src/render/kit/).
21
+ export const RATIO = "--doc-column-ratio";
22
+ // How many columns a row holds, and the least share of it a column takes: the shared description's.
23
+ const shared = componentOf("columns");
24
+ export const MIN_COLUMNS = shared.parts.columns.min;
25
+ export const MAX_COLUMNS = shared.parts.columns.max;
26
+ export const MIN_RATIO = shared.shares.min;
27
+
28
+ /** How many columns, as the menus say it (分两栏, 已分成三栏). */
29
+ export const COUNTS = ["", t("一"), t("两"), t("三"), t("四"), t("五")];
30
+
31
+ /** A row of `count` columns (the block menu's 分两栏, 分三栏…): a box split by count - 1 lines. */
32
+ export const columnsIcon = (count) => svg(`<rect x="2.75" y="4.75" width="14.5" height="10.5" rx="2"/><path d="${Array.from({ length: count - 1 }, (_, index) => `M${(2.75 + (14.5 * (index + 1)) / count).toFixed(2)} 4.75v10.5`).join("")}"/>`);
33
+
34
+ export default {
35
+ name: "columns",
36
+ glance: { row: 15, name: "分栏", write: "`div.doc-columns`", rule: "Kit blocks" },
37
+ units: {
38
+ columns: {
39
+ name: t("分栏"),
40
+ icon: columnsIcon(2),
41
+ match: [{ rank: 60, class: "doc-columns" }],
42
+ handle: "none", // the blocks in its columns have handles
43
+ beside: true,
44
+ copy: "itself",
45
+ },
46
+ column: {
47
+ name: t("栏"),
48
+ match: [{ rank: 70, class: "doc-column" }],
49
+ fixed: true, // only in its row
50
+ sharesHeight: true,
51
+ block: false, // no block of its own (Feishu's): the blocks in it, or its row, are selected
52
+ handle: "none",
53
+ sizes: { [RATIO]: { min: MIN_RATIO, max: 1 } },
54
+ },
55
+ },
56
+ boxes: {
57
+ columns: { role: "columns", name: t("分栏"), selectAll: { whole: true }, classes: [{ rank: 10, class: "doc-columns" }] },
58
+ column: { role: "column", name: t("分栏"), groups: true, selectAll: { content: t("这一栏里的全部内容") }, classes: [{ rank: 20, class: "doc-column" }] },
59
+ },
60
+ types: {
61
+ // A row is written once each of its columns has something to write (a new one, its first block:
62
+ // the empty paragraph it starts with counts, as an empty paragraph is written); a column with
63
+ // its share of the row.
64
+ columns: {
65
+ tag: "div", className: "doc-columns", kind: "columns", box: "columns",
66
+ // Copied as itself (`copy` above). Elsewhere it comes as this, from another program: its
67
+ // columns' blocks, each with its share of the row.
68
+ clipboard: {
69
+ kind: "flatten",
70
+ blocks: (unit, { unitsOf }) => unitsOf(unit).flatMap((column) => unitsOf(column)),
71
+ holds: (block) => (block.columns ?? []).flatMap((column) => column.blocks),
72
+ check: (block, { valid }) => Array.isArray(block.columns) && block.columns.length >= MIN_COLUMNS && block.columns.length <= MAX_COLUMNS
73
+ && block.columns.every((column) => column && (column.ratio === undefined || (typeof column.ratio === "number" && column.ratio > 0 && column.ratio <= 1)) && Array.isArray(column.blocks) && column.blocks.every((inner) => valid(inner, "column"))),
74
+ build({ block, box, inner }) {
75
+ const row = box();
76
+ for (const each of block.columns) {
77
+ const column = box("column");
78
+ if (each.ratio !== undefined) column.style.setProperty(RATIO, String(each.ratio));
79
+ column.append(...inner(each.blocks));
80
+ row.append(column);
81
+ }
82
+ return row;
83
+ },
84
+ text: (block, lines) => block.columns.flatMap((column) => lines(column.blocks)),
85
+ },
86
+ written: (element, children, { unitsOf }) => children.length >= MIN_COLUMNS && children.length === unitsOf(element).length,
87
+ // Until then, once one of its columns holds something, those that hold nothing are the
88
+ // reader's to fill: a block not finished (kept, and said so: the column's blankSays).
89
+ blanks: (element, { nodeOf, unitsOf }) => {
90
+ const columns = unitsOf(element);
91
+ const empty = columns.filter((column) => !nodeOf(column));
92
+ return empty.length > 0 && empty.length < columns.length ? empty : [];
93
+ },
94
+ },
95
+ column: {
96
+ tag: "div", className: "doc-column", kind: "column", box: "column", clipboard: { kind: "flatten" },
97
+ blankSays: t("新分栏里还有空着的一栏:每一栏都写上内容后才会保存。"),
98
+ extras: (element, { sizeValue }) => {
99
+ const ratio = sizeValue("column", RATIO, element.style.getPropertyValue(RATIO));
100
+ return ratio ? { ratio } : {};
101
+ },
102
+ },
103
+ },
104
+ };
@@ -0,0 +1,310 @@
1
+ import { boxKind, newContainer, newHost, placeBefore, unitsOf, withLeads } from "../../page/core.mjs";
2
+ import { begin, done, made } from "../../page/made.mjs";
3
+ import { caretAt } from "../../page/caret.mjs";
4
+ import { accepts, sizeValue } from "../registry.mjs";
5
+ import { COUNTS, MAX_COLUMNS, MIN_RATIO, RATIO } from "./index.mjs";
6
+ import { t } from "../../../shared/i18n/index.mjs";
7
+
8
+ // 分栏 on the page, as Feishu's grid (feishu-lite's model/grid.ts, commands/grid.ts): a row of
9
+ // 2 to 5 columns side by side, each a flow of blocks. A row is made by dropping blocks beside a
10
+ // block (the block in one column, they in another) or by 分栏 in a block's menu (the block and a
11
+ // new empty paragraph); a column is added by dropping blocks at a column's edge, by 分栏 on a block
12
+ // in a column, or by the pin above a gap (columns/). A column left empty goes, and a row left
13
+ // with one column gives its blocks back where it stood (settleRows, after every structural change:
14
+ // history.mjs). Widths: each column's share of the row (--doc-column-ratio), on every column of
15
+ // a row or on none (equal); a new column takes 1/n and the others make room in proportion, a
16
+ // column gone leaves its share to the others in proportion, and dragging a gap moves only the two
17
+ // columns beside it (ratiosAfterResize).
18
+
19
+ export const isRow = (node) => boxKind(node) === "columns";
20
+ export const isColumn = (node) => boxKind(node) === "column";
21
+ export const columnsOf = (row) => [...row.children].filter(isColumn);
22
+
23
+ /** The column a block stands in (directly), or null. */
24
+ export const columnOf = (unit) => (isColumn(unit?.parentElement) ? unit.parentElement : null);
25
+
26
+ // ---------- widths (Feishu's) ----------
27
+
28
+ /** n equal shares. */
29
+ export const equalRatios = (n) => Array.from({ length: n }, () => 1 / n);
30
+
31
+ /** A new column at `index` takes 1/(n+1); the others make room in proportion, none going below the least share. */
32
+ export function ratiosAfterAdd(ratios, index) {
33
+ const share = 1 / (ratios.length + 1);
34
+ const shrinkable = ratios.filter((ratio) => ratio * (1 - share) > MIN_RATIO);
35
+ const total = shrinkable.reduce((sum, ratio) => sum + ratio, 0);
36
+ const factor = total > 0 ? 1 - share / total : 1;
37
+ const out = ratios.map((ratio) => (ratio * (1 - share) > MIN_RATIO ? ratio * factor : ratio));
38
+ out.splice(index, 0, share);
39
+ return out;
40
+ }
41
+
42
+ /** The columns at `removed` gone: the others take their shares in proportion. */
43
+ export function ratiosAfterRemove(ratios, removed) {
44
+ const left = ratios.filter((_, index) => !removed.includes(index));
45
+ const rest = left.reduce((sum, ratio) => sum + ratio, 0);
46
+ return rest > 0 ? left.map((ratio) => ratio / rest) : equalRatios(left.length);
47
+ }
48
+
49
+ /**
50
+ * The gap after column `index` dragged by `fraction` of the row's width: only the two columns
51
+ * beside it change, snapping to their equal split or to a tenth of the row for the left one when
52
+ * within 1%, both keeping the least share (1/24, or more where `least` says so for a part: the
53
+ * share its content needs, a flowchart's node as narrow as the kit lets it be, page/columns/).
54
+ * `ratios` are those when the drag started.
55
+ */
56
+ export function ratiosAfterResize(ratios, index, fraction, least = []) {
57
+ const left = ratios[index];
58
+ const right = ratios[index + 1];
59
+ const low = Math.max(MIN_RATIO, least[index] ?? 0);
60
+ const high = Math.max(MIN_RATIO, least[index + 1] ?? 0);
61
+ if (left === undefined || right === undefined || left + right < low + high) return ratios;
62
+ let moved = fraction;
63
+ const equal = (left + right) / 2 - left;
64
+ const step = Math.round(10 * (left + moved)) / 10 - left;
65
+ if (Math.abs(equal - moved) < 0.01) moved = equal;
66
+ else if (Math.abs(step - moved) < 0.01) moved = step;
67
+ moved = Math.min(Math.max(moved, low - left), right - high);
68
+ const out = [...ratios];
69
+ out[index] = left + moved;
70
+ out[index + 1] = right - moved;
71
+ return out;
72
+ }
73
+
74
+ /** A row's shares: its columns' own when every one has one, else equal ones. */
75
+ export function ratiosOf(row) {
76
+ const columns = columnsOf(row);
77
+ const own = columns.map((column) => Number.parseFloat(column.style.getPropertyValue(RATIO)));
78
+ if (own.length > 0 && own.every((ratio) => ratio > 0)) {
79
+ const sum = own.reduce((total, ratio) => total + ratio, 0);
80
+ return own.map((ratio) => ratio / sum);
81
+ }
82
+ return equalRatios(columns.length);
83
+ }
84
+
85
+ /** Whether a row's columns have shares of their own (none: equal widths). */
86
+ export const sized = (row) => columnsOf(row).some((column) => column.style.getPropertyValue(RATIO).trim() !== "");
87
+
88
+ /** A row's columns given these shares (written as the file takes them: sizeValue, none below the least), or none (null: equal). */
89
+ export function setRatios(row, ratios) {
90
+ columnsOf(row).forEach((column, index) => {
91
+ if (ratios) column.style.setProperty(RATIO, sizeValue("column", RATIO, String(Math.min(1, Math.max(MIN_RATIO, ratios[index])))));
92
+ else column.style.removeProperty(RATIO);
93
+ if (column.getAttribute("style") === "") column.removeAttribute("style");
94
+ });
95
+ }
96
+
97
+ // ---------- making rows and columns ----------
98
+
99
+ /**
100
+ * A new row where `target` stands: `target` (a block, or blocks next to each other: a folded heading
101
+ * with what it hides) in one column, each of `groups` (lists of nodes: blocks with their leads) in a
102
+ * column of its own, `side` of it ("left" or "right"); equal widths. Returns { focus: the row, created }.
103
+ */
104
+ export function rowAround(target, groups, side = "right") {
105
+ begin();
106
+ const own = [target].flat();
107
+ const doc = own[0].ownerDocument;
108
+ const parts = own.flatMap(withLeads);
109
+ const row = made(newContainer(doc, "columns"));
110
+ parts[0].before(row);
111
+ const column = made(newContainer(doc, "column"));
112
+ placeBefore(column, parts, null);
113
+ const others = groups.map((nodes) => {
114
+ const other = made(newContainer(doc, "column"));
115
+ placeBefore(other, nodes, null);
116
+ return other;
117
+ });
118
+ row.append(...(side === "left" ? [...others, column] : [column, ...others]));
119
+ return done(row);
120
+ }
121
+
122
+ /**
123
+ * Blocks next to each other (with their leads), each in a column of its own of a new row where they
124
+ * stood; one may be a list of blocks (a folded heading with what it hides), a column for them all.
125
+ * Returns { focus: the row, created }.
126
+ */
127
+ export function rowOf(units) {
128
+ begin();
129
+ const groups = units.map((unit) => [unit].flat());
130
+ const doc = groups[0][0].ownerDocument;
131
+ const row = made(newContainer(doc, "columns"));
132
+ withLeads(groups[0][0])[0].before(row);
133
+ for (const group of groups) {
134
+ const column = made(newContainer(doc, "column"));
135
+ placeBefore(column, group.flatMap(withLeads), null);
136
+ row.append(column);
137
+ }
138
+ return done(row);
139
+ }
140
+
141
+ /**
142
+ * A new column at `index` of `row`, holding `nodes` (blocks with their leads), or an empty
143
+ * paragraph; when the row's columns have shares, the new one takes 1/n and the others make room.
144
+ * Returns { focus: the column's paragraph, or the column; created }.
145
+ */
146
+ export function addColumn(row, index, nodes = null) {
147
+ begin();
148
+ const doc = row.ownerDocument;
149
+ const ratios = sized(row) ? ratiosAfterAdd(ratiosOf(row), index) : null;
150
+ const column = made(newContainer(doc, "column"));
151
+ const paragraph = nodes ? null : newHost(doc, "paragraph");
152
+ if (nodes) placeBefore(column, nodes, null);
153
+ else column.append(paragraph);
154
+ row.insertBefore(column, columnsOf(row)[index] ?? null);
155
+ if (ratios) setRatios(row, ratios);
156
+ return done(paragraph ?? column);
157
+ }
158
+
159
+ /**
160
+ * 分两栏 (分三栏, 分四栏: `count` columns) with a block alone (or a folded heading with what it hides,
161
+ * `target` a list: rowAround): a new row, the block in the left column and a new empty paragraph in
162
+ * each of the others. Returns { focus: the first of them, created }.
163
+ */
164
+ export function splitBeside(target, count = 2) {
165
+ const paragraphs = Array.from({ length: count - 1 }, () => newHost([target].flat()[0].ownerDocument, "paragraph"));
166
+ const { created } = rowAround(target, paragraphs.map((paragraph) => [paragraph]), "right");
167
+ return { focus: paragraphs[0], created };
168
+ }
169
+
170
+ // ---------- what may be done ----------
171
+
172
+ const kindOf = (node) => node?.getAttribute?.("data-ge-unit-kind") ?? null;
173
+
174
+ /**
175
+ * Whether `units` (blocks) may go into a column: every one is a block a column takes (no chapter,
176
+ * no row of columns, no list item on its own).
177
+ */
178
+ export const fitColumn = (units) => units.length > 0 && units.every((unit) => accepts("column", kindOf(unit)));
179
+
180
+ /**
181
+ * "分栏" for blocks (in document order): null when it does not apply, otherwise why it cannot be
182
+ * done, or "". One block in a column adds a column right of its own; one block elsewhere becomes a
183
+ * row with a new empty column beside it; several next to each other in one container (not in a
184
+ * column), a row with a column each. `taken(unit)`: what goes into a unit's column with it (a folded
185
+ * heading's: it and what it hides, fold/ withHidden), each of which a column must take, and which
186
+ * stands between the units it joins as they are next to each other for the reader.
187
+ */
188
+ export function columnsCheck(units, taken = (unit) => [unit]) {
189
+ if (units.length === 0) return null;
190
+ const box = units[0].parentElement;
191
+ if (!box?.hasAttribute("data-ge-box") || units.some((unit) => unit.parentElement !== box)) return null;
192
+ const column = isColumn(box) ? box : null;
193
+ if (column) {
194
+ if (units.length > 1) return null;
195
+ return columnsOf(column.parentElement).length >= MAX_COLUMNS ? t("一行最多 {0} 栏", MAX_COLUMNS) : "";
196
+ }
197
+ const all = units.flatMap(taken);
198
+ if (!accepts(boxKind(box), "columns") || !fitColumn(all)) return null;
199
+ if (units.length > MAX_COLUMNS) return t("一行最多 {0} 栏", MAX_COLUMNS);
200
+ if (units.length === 1) return "";
201
+ const blocks = unitsOf(box);
202
+ const first = blocks.indexOf(all[0]);
203
+ return all.every((unit, index) => blocks[first + index] === unit) ? "" : t("只有相邻的块能并排分栏:中间还有没选中的块");
204
+ }
205
+
206
+ // ---------- the commands ----------
207
+
208
+ /**
209
+ * 分栏 in the block menu and a column added at a gap (columns/), with what the editor gives them:
210
+ * struct (a structural undo step), say, and blocks() (the block handles and selection, blocks.mjs).
211
+ */
212
+ export function create({ struct, say, blocks }) {
213
+ // What goes into a block's column with it: a folded heading's section goes with it (fold/ withHidden).
214
+ const taken = (unit) => blocks().folds?.withHidden(unit) ?? [unit];
215
+
216
+ // Blocks that pass columnsCheck: a block in a column gets a column right of its own; a block
217
+ // elsewhere becomes a row of `count` columns, it in the first and empty ones beside it (Feishu's
218
+ // two columns; the block menu's 分两栏, 分三栏, 分四栏); several, a row with a column each, a folded
219
+ // heading's with what it hides. The caret goes into the first new column's paragraph, or the row is selected.
220
+ function split(units, count = 2) {
221
+ blocks().clear();
222
+ const column = units.length === 1 ? columnOf(units[0]) : null;
223
+ if (column) {
224
+ add(column.parentElement, columnsOf(column.parentElement).indexOf(column) + 1);
225
+ return;
226
+ }
227
+ const result = struct([units[0].parentElement], [], () => {
228
+ const made = units.length === 1 ? splitBeside(taken(units[0]), count) : rowOf(units.map(taken));
229
+ return { touched: [], focus: made.focus, select: units, created: made.created };
230
+ });
231
+ if (units.length === 1) caretAt(result.focus, "start");
232
+ else blocks().select(result.created[0], { quiet: true });
233
+ say(t("{0} · 拖动栏间的竖线调宽度 · Ctrl+Z 撤销", units.length === 1 ? t("已分成{0}栏", COUNTS[count]) : t("已把 {0} 块并排分栏", units.length)));
234
+ }
235
+
236
+ // A new column at `index` of `row` holding an empty paragraph, the caret in it.
237
+ function add(row, index) {
238
+ if (columnsOf(row).length >= MAX_COLUMNS) {
239
+ say(t("一行最多 {0} 栏。", MAX_COLUMNS));
240
+ return;
241
+ }
242
+ blocks().clear();
243
+ const result = struct([row], [], () => {
244
+ const made = addColumn(row, index);
245
+ return { touched: [made.focus], focus: made.focus, created: made.created };
246
+ });
247
+ caretAt(result.focus, "start");
248
+ say(t("已新增一栏 · Ctrl+Z 撤销"));
249
+ }
250
+
251
+ return {
252
+ tidy: tidyRows,
253
+ // What the block tools and the gaps between columns read and do by themselves (block-menu/, drag/, page/columns/).
254
+ columnOps: { split, add, columnOf, columnsCheck: (units, take = taken) => columnsCheck(units, take), columnsOf, addColumn, rowAround, ratiosOf, ratiosAfterResize, setRatios, sized },
255
+ };
256
+ }
257
+
258
+ // ---------- keeping rows tidy ----------
259
+
260
+ /** The rows a structural change over these containers may leave untidy: those they are or stand in. */
261
+ export function rowsAround(parents) {
262
+ const rows = new Set();
263
+ for (const parent of parents) {
264
+ if (isRow(parent)) rows.add(parent);
265
+ else if (isColumn(parent) && isRow(parent.parentElement)) rows.add(parent.parentElement);
266
+ }
267
+ return [...rows];
268
+ }
269
+
270
+ /** What a structural change over `rows` touches besides: their columns and where each row stands. */
271
+ const rowParts = (rows) => rows.flatMap((row) => [row, ...columnsOf(row), ...(row.parentElement ? [row.parentElement] : [])]);
272
+
273
+ // A column holding nothing but the editor's own nodes is empty.
274
+ const emptyColumn = (column) => ![...column.children].some((child) => !child.hasAttribute("data-doc-dev"));
275
+
276
+ /**
277
+ * What a structural step (history.mjs) does around rows of columns, as a tidier: the rows the step
278
+ * may leave untidy are tidied after it (settleRows), so the rows, their columns and the containers
279
+ * they stand in are recorded with the step, and the columns' widths (their style) with them.
280
+ */
281
+ export function tidyRows(parents) {
282
+ const rows = rowsAround(parents);
283
+ return { parents: rowParts(rows), attributes: [...new Set(rowParts(rows).filter(isColumn))].map((column) => [column, ["style"]]), settle: () => settleRows(rows) };
284
+ }
285
+
286
+ /**
287
+ * After a structural change: a column left empty goes (its share to the others, in proportion), a
288
+ * row left with one column gives its blocks back where it stood, and one left with none goes.
289
+ * Returns whether anything changed.
290
+ */
291
+ export function settleRows(rows) {
292
+ let changed = false;
293
+ for (const row of rows) {
294
+ if (!row.isConnected || !isRow(row)) continue;
295
+ const columns = columnsOf(row);
296
+ const empty = columns.flatMap((column, index) => (emptyColumn(column) ? [index] : []));
297
+ if (empty.length > 0) {
298
+ const ratios = sized(row) ? ratiosAfterRemove(ratiosOf(row), empty) : null;
299
+ empty.forEach((index) => columns[index].remove());
300
+ if (ratios && columnsOf(row).length > 1) setRatios(row, ratios);
301
+ changed = true;
302
+ }
303
+ const left = columnsOf(row);
304
+ if (left.length > 1) continue;
305
+ if (left.length === 1) placeBefore(row.parentElement, [...left[0].childNodes].filter((node) => node.nodeType !== 1 || !node.hasAttribute("data-doc-dev")), row);
306
+ row.remove();
307
+ changed = true;
308
+ }
309
+ return changed;
310
+ }
@@ -0,0 +1,73 @@
1
+ import { svg } from "../icons.mjs";
2
+ import { DETAILS, classOf, stepOf } from "../kit.mjs";
3
+ import { t } from "../../../shared/i18n/index.mjs";
4
+
5
+ // 折叠列表: the kit's disclosure (details.doc-details). Its title (the summary's label) is a
6
+ // text block that only changes its text; its content region (.doc-details-content) is a box
7
+ // that takes what a section takes. A new one is open while edited; saved, it starts closed.
8
+ // page.mjs: a new one, Enter in its title; file.mjs: its markup in report.html.
9
+ //
10
+ // Where the engines reach it (src/editor/page/ unless named): typing/ (Enter in its title: page.mjs `keys`;
11
+ // its empty title's placeholder: `placeholders` below), editor.mjs (a click in its title does not toggle it: page.mjs `click`), convert.mjs
12
+ // (a block turned into one, one into plain blocks), core.mjs (its title and blocks in a save: nodeOf,
13
+ // an empty title holding the save), clipboard/own/ (copying it: `clipboard`, and `build` in page.mjs), commit.mjs (its content box),
14
+ // drag/ (a closed one opens while a block is dragged over its title), ../source/ (finding
15
+ // its title: the summary label).
16
+ // Its look: the kit's styles/details.css (src/render/kit/). Its title and content region are its
17
+ // description's parts, the label among them (required by the description: src/shared/components/details.mjs,
18
+ // through ../kit.mjs).
19
+ export default {
20
+ name: "details",
21
+ listed: () => t("折叠列表"),
22
+ units: {
23
+ // Its color (颜色 in the block menu, notion-lite's toggle): a background in place of its own, or
24
+ // its title's and its blocks' text.
25
+ details: { name: t("折叠列表"), match: [{ rank: 140, tag: "details" }], boxed: true, removedEmpty: true, colors: ["background"] },
26
+ },
27
+ boxes: {
28
+ // Its content always holds a block (holdsOne): emptied, it keeps an empty paragraph to write in.
29
+ // Under its last block is its padding: a click there makes no block (endIsPadding).
30
+ details: { role: "flow", name: t("折叠列表"), groups: true, holdsOne: true, endIsPadding: true, emptyIsNothing: true, selectAll: { content: true }, classes: [{ rank: 30, class: classOf(stepOf(DETAILS.content)) }], find: (unit) => detailsContent(unit) },
31
+ },
32
+ placeholders: { label: t("折叠列表标题") },
33
+ hosts: {
34
+ label: { name: t("折叠块标题"), opensBefore: true, caps: () => ["empty"], parts: [["details", "label"]] }, // empty, the kit shows nothing but its arrow
35
+ },
36
+ types: {
37
+ details: { // its box is the content region
38
+ turn: 10, menu: ["basic", 10],
39
+ tag: "details", className: "doc-details", kind: "details", box: "details", container: "details.doc-details",
40
+ takesAsIs: true, holder: 1,
41
+ // Copied with its title and its blocks. Its page.mjs makes it again.
42
+ clipboard: {
43
+ kind: "toggle",
44
+ read: (unit) => ({ title: detailsTitle(unit), content: detailsContent(unit) }),
45
+ describe(node, { holding, serializeInner }) {
46
+ if (!node.matches("details.doc-details")) return undefined;
47
+ const title = detailsTitle(node);
48
+ const blocks = holding(detailsContent(node));
49
+ return title && blocks ? { type: "details", html: serializeInner(title), blocks } : null;
50
+ },
51
+ endsIn(unit, { blocksIn, serializeInner }) {
52
+ const title = detailsTitle(unit);
53
+ return title ? [{ type: "details", html: serializeInner(title), blocks: blocksIn([detailsContent(unit)].filter(Boolean)) }] : undefined;
54
+ },
55
+ check: (block, { container, string }) => container(block) && string(block.html),
56
+ text: (block, lines) => [block.html, ...lines(block.blocks)],
57
+ },
58
+ // What the save engines need of it (core.mjs nodeOf, sync-state.mjs): its title (a text block
59
+ // of its own) and its content region; the summary is part of it. Written empty too (no title,
60
+ // no blocks: an empty one stays, as Notion's).
61
+ title: (element) => detailsTitle(element), content: (element) => detailsContent(element), part: "summary",
62
+ written: () => true,
63
+ label: t("折叠列表"),
64
+ icon: svg('<path d="M3.75 4.25 6.75 6l-3 1.75z" fill="currentColor" stroke="none"/><path d="M3.75 12.25l3 1.75-3 1.75z" fill="currentColor" stroke="none"/><path d="M8.75 6h7.75M8.75 14h7.75"/>'),
65
+ words: "折叠列表 折叠块 折叠 展开 zhedie zhankai zdlb zd toggle details disclosure",
66
+ glance: { row: 6, name: "折叠列表", write: "`<details><summary>`, never the kit's classes on it", after: "`details.doc-details`", rule: "Text and lists" },
67
+ },
68
+ },
69
+ };
70
+
71
+ /** A disclosure's title and content region. */
72
+ export const detailsTitle = (details) => details.querySelector(DETAILS.label);
73
+ export const detailsContent = (details) => details.querySelector(DETAILS.content);
@@ -0,0 +1,86 @@
1
+ import { firstHost, newHost } from "../../page/core.mjs";
2
+ import { caretAt, editable } from "../../page/caret.mjs";
3
+ import { addStyle } from "../../page/ui.mjs";
4
+ import { capsFor } from "../registry.mjs";
5
+ import { detailsContent, detailsTitle } from "./index.mjs";
6
+ import { t } from "../../../shared/i18n/index.mjs";
7
+
8
+ // 折叠列表 on the page. A block turned into one goes into its content, the title left empty with the
9
+ // caret in it (convert.mjs); a new one is open while edited, with a content region holding an empty
10
+ // paragraph. Enter in its title puts the caret into its content, opened. Clicking its title to type
11
+ // does not open or close it (`click`).
12
+
13
+ /** A disclosure made again from the clipboard's description (its type's `build`, builders.mjs). */
14
+ export function build({ doc, block, inline, inner }) {
15
+ const details = newDetails(doc);
16
+ detailsTitle(details).append(...inline(block.html));
17
+ if (block.blocks.length > 0) detailsContent(details).replaceChildren(...inner(block.blocks));
18
+ return details;
19
+ }
20
+
21
+ /** A new disclosure, open while edited: its title (a text block) and a content region holding an empty paragraph. */
22
+ export function newDetails(doc, title = "") {
23
+ const details = doc.createElement("details");
24
+ details.className = "doc-details";
25
+ details.open = true;
26
+ for (const [name, value] of [["data-ge-new", ""], ["data-ge-type", "details"], ["data-ge-unit-kind", "details"]]) details.setAttribute(name, value);
27
+ const summary = doc.createElement("summary");
28
+ const label = doc.createElement("span");
29
+ label.className = "doc-details-summary-label";
30
+ for (const [name, value] of [["contenteditable", "true"], ["data-ge-new", ""], ["data-ge-kind", "label"], ["data-ge-caps", capsFor("label")]]) label.setAttribute(name, value);
31
+ label.innerHTML = title;
32
+ summary.append(label);
33
+ const content = doc.createElement("div");
34
+ content.className = "doc-details-content";
35
+ for (const [name, value] of [["data-ge-box", ""], ["data-ge-box-kind", "details"], ["data-ge-pure", ""]]) content.setAttribute(name, value);
36
+ content.append(newHost(doc, "paragraph"));
37
+ details.append(summary, content);
38
+ return details;
39
+ }
40
+
41
+ // A content the file has empty (an Agent's: emptied on the page, it keeps an empty paragraph):
42
+ // notion-lite's placeholder, a click on it makes a paragraph there (insert/ clickBlank).
43
+ const EMPTY = `
44
+ [data-ge-editing] .doc-details-content[data-ge-box]:not(:has(> *))::before { content: ${JSON.stringify(t("空白折叠区块。点击或拖动区块到这里。"))}; display: block; padding: 3px 2px; border-radius: 4px; color: var(--ge-tx3); cursor: pointer; transition: background 20ms ease-in; }
45
+ [data-ge-editing] .doc-details-content[data-ge-box]:not(:has(> *)):hover::before { background: var(--ge-hover); }
46
+ `;
47
+
48
+ // A disclosure's title takes no fill under the pointer, hovered or edited: plain, as Notion's and Feishu's.
49
+ // It is text one edits, so the pointer over it is the text cursor, as over a code block's title
50
+ // (code/page.mjs); the summary's arrow keeps the kit's pointer (it opens and closes the block).
51
+ const STYLE = `
52
+ [data-ge-editing] .doc-details-summary-label[contenteditable="true"] { --ge-text-tint: none; cursor: text; }
53
+ `;
54
+
55
+ /** A disclosure's title, with what the editor gives it: struct (a structural undo step), say and limitText. */
56
+ export function create({ struct, say, limitText }) {
57
+ addStyle(STYLE);
58
+ addStyle(EMPTY);
59
+ // Enter in a disclosure's title: the caret goes into its content, opened. True when handled.
60
+ function enter(host) {
61
+ const details = host.getAttribute("data-ge-kind") === "label" ? host.closest("details") : null;
62
+ if (!details) return false;
63
+ details.open = true;
64
+ const content = detailsContent(details);
65
+ const first = content && firstHost(content);
66
+ if (first) caretAt(first, "start");
67
+ else if (content?.hasAttribute("data-ge-box")) {
68
+ const paragraph = newHost(document, "paragraph");
69
+ struct([content], [], () => {
70
+ content.prepend(paragraph);
71
+ return { touched: [paragraph], focus: paragraph };
72
+ });
73
+ caretAt(paragraph, "start");
74
+ } else say(limitText(host, "split"));
75
+ return true;
76
+ }
77
+
78
+ return {
79
+ keys: { enter: ({ host }) => enter(host) },
80
+ /** A click in its title, to type there, neither opens nor closes it. */
81
+ click(event) {
82
+ if (editable(event.target)?.closest("summary")) event.preventDefault();
83
+ return false;
84
+ },
85
+ };
86
+ }
@@ -0,0 +1,84 @@
1
+ // 详情卡片 (detail card): the kit's dialog.doc-dialog, opened by a link to it (#id) in the text.
2
+ // Its content region (.doc-dialog-content) is a box that takes what a section takes, an ordinary
3
+ // editing area: a heading first in it is a block like any other, and nothing binds one to the card.
4
+ // It is a chapter: it stands at the end of the page. page.mjs: a new one from the selected text;
5
+ // file.mjs: its markup in report.html.
6
+ //
7
+ // Where the engines reach it (src/editor/page/ unless named): typing/ (`keys.around`, page.mjs:
8
+ // Esc in an open one closes it), the workbench, undo, 搜索文档 and a page shown again (`modalOps`,
9
+ // page.mjs: the cards open, `show`, `kept`, `reopen`), format-bar/ (the card button), links/ (its entry's card, a click on the entry opening it), core.mjs (saved only while a link opens it: nodeOf; the trigger
10
+ // class on links: serializeNode), commit.mjs (a card has no block id; once written it is taken in as a card of the file: adoptKeyed, keyedAway),
11
+ // drag/, caret.mjs, resize/ (an open card's content stands for the page), ../source/
12
+ // (finding cards: dialog(); ids the file uses; what the file holds of a card a commit made:
13
+ // keyedFacts), src/transfer/ (a page's Markdown: `clipboard`; its charts' pictures: browser.mjs).
14
+ // Its look: the kit's styles/dialog.css, opened by dialogs.js (src/render/kit/). Its content region
15
+ // is its description's part (src/shared/components/dialog.mjs, through ../kit.mjs).
16
+ import { DIALOG, classOf, stepOf } from "../kit.mjs";
17
+ import { DIALOG_ICON } from "../icons.mjs";
18
+ import { t } from "../../../shared/i18n/index.mjs";
19
+
20
+ /** The class of a link that opens a detail card (dialogs.js). */
21
+ export const DIALOG_TRIGGER = "doc-dialog-trigger";
22
+
23
+ export default {
24
+ name: "dialog",
25
+ // A link in the text that opens a card, a chip as padded as code: Backspace right of it (Delete
26
+ // left of it) takes it whole, as a chip of the text goes; its words are edited from inside it.
27
+ entry: { at: `a.${DIALOG_TRIGGER}`, removed: t("入口已移除:页面上没有地方能打开这张详情卡片了 · Ctrl+Z 撤销") },
28
+ units: {
29
+ // The server finds detail cards by their element (findUnits). No block of the page's flow, a card
30
+ // is written after it, as a disclosure: a selection cannot take one, so no copy says a kind.
31
+ dialog: {
32
+ chapter: true, fixed: true, boxed: true,
33
+ clipboard: { kind: "toggle", read: cardInMarkdown, apart: DIALOG.match, reached: (unit) => entryOf(unit) !== null },
34
+ },
35
+ },
36
+ boxes: {
37
+ // Its content always holds a block (holdsOne): emptied, it keeps an empty paragraph to write in.
38
+ dialog: { role: "flow", name: t("详情卡片"), groups: true, outer: false, holdsOne: true, selectAll: { content: true, top: true }, classes: [{ rank: 40, class: classOf(stepOf(DIALOG.content)) }] },
39
+ },
40
+ types: {
41
+ dialog: { // its box is the content region
42
+ tag: "dialog", className: "doc-dialog", kind: "dialog", box: "dialog",
43
+ fromSelection: { label: t("详情卡片"), icon: DIALOG_ICON },
44
+ glance: { row: 16, name: "详情卡片", write: "`<a href=\"#x\">` in the text, `<dialog id=\"x\"><h3>…</h3>…</dialog>`", rule: "Kit blocks" },
45
+ // What the save engines need of it (core.mjs nodeOf, commit.mjs adoptKeyed): no unit but known
46
+ // by its id (`keyed`), its content region; written only while something opens it.
47
+ keyed: true, content: (element) => dialogContent(element),
48
+ written: (element) => entryOf(element) !== null,
49
+ },
50
+ },
51
+ };
52
+
53
+ /** A detail card's content region. */
54
+ export const dialogContent = (dialog) => dialog.querySelector(DIALOG.content);
55
+
56
+ /** The first heading with words among a detail card's blocks, or null: what the card goes by where it needs a name. */
57
+ export const dialogHeading = (dialog) => [...(dialogContent(dialog)?.children ?? [])].find((block) => block.matches(DIALOG.heading) && block.textContent.trim()) ?? null;
58
+
59
+ /** What opens a detail card from outside it: the first link to it, or element naming it by data-doc-dialog-open, or null. */
60
+ export function entryOf(dialog) {
61
+ const named = `#${dialog.id}`;
62
+ return [...dialog.ownerDocument.querySelectorAll("a[href], [data-doc-dialog-open]")]
63
+ .find((node) => (node.getAttribute("href") === named || node.getAttribute("data-doc-dialog-open") === named) && !dialog.contains(node)) ?? null;
64
+ }
65
+
66
+ // A detail card as a disclosure of a page's Markdown, when something opens it (`reached`): its first
67
+ // heading the title, which its body then leaves out, else the words of what opens it.
68
+ function cardInMarkdown(unit) {
69
+ const heading = dialogHeading(unit);
70
+ return { title: heading ?? entryOf(unit), content: dialogContent(unit), without: heading };
71
+ }
72
+
73
+ /** The detail card of `doc` an address in the page (#id) names, or null. */
74
+ export function cardNamed(doc, href) {
75
+ if (!/^#./.test(href ?? "")) return null;
76
+ let id = href.slice(1);
77
+ try {
78
+ id = decodeURIComponent(id);
79
+ } catch {
80
+ // kept as written
81
+ }
82
+ const card = doc.getElementById(id);
83
+ return card?.matches(DIALOG.match) ? card : null;
84
+ }