@heycys/gallery 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (785) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/THIRD-PARTY-NOTICES.md +3253 -0
  4. package/assets/writing-preferences.md +107 -0
  5. package/bin/gallery.mjs +10 -0
  6. package/browser/editor/components/bookmark/icons.mjs +6 -0
  7. package/browser/editor/components/bookmark/index.mjs +80 -0
  8. package/browser/editor/components/bookmark/page.mjs +147 -0
  9. package/browser/editor/components/builders.mjs +19 -0
  10. package/browser/editor/components/callout/index.mjs +39 -0
  11. package/browser/editor/components/callout/page.mjs +13 -0
  12. package/browser/editor/components/code/index.mjs +327 -0
  13. package/browser/editor/components/code/page.mjs +561 -0
  14. package/browser/editor/components/colors.mjs +50 -0
  15. package/browser/editor/components/columns/index.mjs +104 -0
  16. package/browser/editor/components/columns/page.mjs +297 -0
  17. package/browser/editor/components/details/index.mjs +72 -0
  18. package/browser/editor/components/details/page.mjs +86 -0
  19. package/browser/editor/components/dialog/index.mjs +83 -0
  20. package/browser/editor/components/dialog/page.mjs +219 -0
  21. package/browser/editor/components/divider/index.mjs +48 -0
  22. package/browser/editor/components/embed/icons.mjs +11 -0
  23. package/browser/editor/components/embed/index.mjs +123 -0
  24. package/browser/editor/components/embed/page.mjs +309 -0
  25. package/browser/editor/components/figure/index.mjs +87 -0
  26. package/browser/editor/components/figure/page.mjs +33 -0
  27. package/browser/editor/components/file/icons.mjs +14 -0
  28. package/browser/editor/components/file/index.mjs +77 -0
  29. package/browser/editor/components/file/page.mjs +114 -0
  30. package/browser/editor/components/flowchart/add.mjs +123 -0
  31. package/browser/editor/components/flowchart/index.mjs +246 -0
  32. package/browser/editor/components/flowchart/page.mjs +453 -0
  33. package/browser/editor/components/heading/index.mjs +51 -0
  34. package/browser/editor/components/highlight/index.mjs +79 -0
  35. package/browser/editor/components/icon/index.mjs +57 -0
  36. package/browser/editor/components/icon/page.mjs +286 -0
  37. package/browser/editor/components/icons.mjs +45 -0
  38. package/browser/editor/components/image/crop.mjs +189 -0
  39. package/browser/editor/components/image/index.mjs +104 -0
  40. package/browser/editor/components/image/page.mjs +385 -0
  41. package/browser/editor/components/image/viewer.mjs +213 -0
  42. package/browser/editor/components/installed/index.mjs +133 -0
  43. package/browser/editor/components/installed/page.mjs +422 -0
  44. package/browser/editor/components/installed/served.mjs +35 -0
  45. package/browser/editor/components/kit.mjs +64 -0
  46. package/browser/editor/components/list/index.mjs +194 -0
  47. package/browser/editor/components/list/join.mjs +68 -0
  48. package/browser/editor/components/list/numbers.mjs +107 -0
  49. package/browser/editor/components/list/page.mjs +632 -0
  50. package/browser/editor/components/math/index.mjs +88 -0
  51. package/browser/editor/components/math/page.mjs +236 -0
  52. package/browser/editor/components/math/tex-logo.mjs +6 -0
  53. package/browser/editor/components/media/icons.mjs +19 -0
  54. package/browser/editor/components/media/page.mjs +162 -0
  55. package/browser/editor/components/media/parts.mjs +60 -0
  56. package/browser/editor/components/media/size.mjs +20 -0
  57. package/browser/editor/components/media/toolbar.mjs +37 -0
  58. package/browser/editor/components/media/write.mjs +7 -0
  59. package/browser/editor/components/pages.mjs +46 -0
  60. package/browser/editor/components/paragraph/index.mjs +43 -0
  61. package/browser/editor/components/paragraph/page.mjs +52 -0
  62. package/browser/editor/components/placeholder-bar.mjs +17 -0
  63. package/browser/editor/components/placeholder.mjs +128 -0
  64. package/browser/editor/components/quote/index.mjs +33 -0
  65. package/browser/editor/components/registry.mjs +833 -0
  66. package/browser/editor/components/rows.mjs +16 -0
  67. package/browser/editor/components/section/index.mjs +41 -0
  68. package/browser/editor/components/section/page.mjs +141 -0
  69. package/browser/editor/components/sheets/index.mjs +137 -0
  70. package/browser/editor/components/sheets/page.mjs +227 -0
  71. package/browser/editor/components/sheets/pills.mjs +226 -0
  72. package/browser/editor/components/table/grid.mjs +73 -0
  73. package/browser/editor/components/table/index.mjs +306 -0
  74. package/browser/editor/components/table/page.mjs +672 -0
  75. package/browser/editor/components/table/slots.mjs +41 -0
  76. package/browser/editor/components/widget/index.mjs +50 -0
  77. package/browser/editor/page/annotate/anchors.mjs +229 -0
  78. package/browser/editor/page/annotate/card.mjs +102 -0
  79. package/browser/editor/page/annotate/index.mjs +1629 -0
  80. package/browser/editor/page/at-menu/index.mjs +317 -0
  81. package/browser/editor/page/autosave.mjs +977 -0
  82. package/browser/editor/page/beside.mjs +21 -0
  83. package/browser/editor/page/block-info.mjs +63 -0
  84. package/browser/editor/page/block-menu/colors.mjs +82 -0
  85. package/browser/editor/page/block-menu/index.mjs +215 -0
  86. package/browser/editor/page/blocks.mjs +246 -0
  87. package/browser/editor/page/caret.mjs +679 -0
  88. package/browser/editor/page/chip-fills.mjs +126 -0
  89. package/browser/editor/page/clipboard/import/colors.mjs +192 -0
  90. package/browser/editor/page/clipboard/import/html.mjs +792 -0
  91. package/browser/editor/page/clipboard/import/inline.mjs +232 -0
  92. package/browser/editor/page/clipboard/import/languages.mjs +42 -0
  93. package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
  94. package/browser/editor/page/clipboard/import/math.mjs +100 -0
  95. package/browser/editor/page/clipboard/import/office.mjs +245 -0
  96. package/browser/editor/page/clipboard/import/read.mjs +120 -0
  97. package/browser/editor/page/clipboard/import/rich.mjs +29 -0
  98. package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
  99. package/browser/editor/page/clipboard/index.mjs +797 -0
  100. package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
  101. package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
  102. package/browser/editor/page/clipboard/own/describe.mjs +115 -0
  103. package/browser/editor/page/clipboard/own/export.mjs +167 -0
  104. package/browser/editor/page/clipboard/own/ids.mjs +39 -0
  105. package/browser/editor/page/clipboard/own/index.mjs +13 -0
  106. package/browser/editor/page/clipboard/own/rules.mjs +44 -0
  107. package/browser/editor/page/clipboard/own/selection.mjs +159 -0
  108. package/browser/editor/page/clipboard/own/writers.mjs +326 -0
  109. package/browser/editor/page/columns/index.mjs +360 -0
  110. package/browser/editor/page/commit.mjs +1798 -0
  111. package/browser/editor/page/conflicts.mjs +269 -0
  112. package/browser/editor/page/convert.mjs +830 -0
  113. package/browser/editor/page/core.mjs +1655 -0
  114. package/browser/editor/page/drag/drop.mjs +307 -0
  115. package/browser/editor/page/drag/index.mjs +335 -0
  116. package/browser/editor/page/drag/preview.mjs +121 -0
  117. package/browser/editor/page/edge-scroll.mjs +50 -0
  118. package/browser/editor/page/editor.mjs +1725 -0
  119. package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
  120. package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
  121. package/browser/editor/page/emoji-picker/grid.mjs +79 -0
  122. package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
  123. package/browser/editor/page/emoji-picker/icons.mjs +32 -0
  124. package/browser/editor/page/emoji-picker/index.mjs +164 -0
  125. package/browser/editor/page/emoji-picker/styles.mjs +2 -0
  126. package/browser/editor/page/emoji-picker/support.mjs +202 -0
  127. package/browser/editor/page/emoji-picker/upload.mjs +235 -0
  128. package/browser/editor/page/export-report.mjs +23 -0
  129. package/browser/editor/page/fills.mjs +60 -0
  130. package/browser/editor/page/find/index.mjs +107 -0
  131. package/browser/editor/page/flags.mjs +70 -0
  132. package/browser/editor/page/format-bar/bar.mjs +448 -0
  133. package/browser/editor/page/format-bar/brush.mjs +77 -0
  134. package/browser/editor/page/format-bar/colors.mjs +46 -0
  135. package/browser/editor/page/format-bar/index.mjs +404 -0
  136. package/browser/editor/page/formula/index.mjs +236 -0
  137. package/browser/editor/page/formula/panel.mjs +336 -0
  138. package/browser/editor/page/formula/symbols.mjs +156 -0
  139. package/browser/editor/page/frame.mjs +74 -0
  140. package/browser/editor/page/frames.mjs +196 -0
  141. package/browser/editor/page/geometry.mjs +400 -0
  142. package/browser/editor/page/gesture.mjs +45 -0
  143. package/browser/editor/page/handle/index.mjs +639 -0
  144. package/browser/editor/page/handle-sizes.mjs +14 -0
  145. package/browser/editor/page/hints/index.mjs +84 -0
  146. package/browser/editor/page/history.mjs +401 -0
  147. package/browser/editor/page/insert/index.mjs +243 -0
  148. package/browser/editor/page/kept.mjs +38 -0
  149. package/browser/editor/page/links/address.mjs +40 -0
  150. package/browser/editor/page/links/index.mjs +866 -0
  151. package/browser/editor/page/links/pages.mjs +131 -0
  152. package/browser/editor/page/links/views.mjs +369 -0
  153. package/browser/editor/page/look.mjs +65 -0
  154. package/browser/editor/page/made.mjs +24 -0
  155. package/browser/editor/page/margin.mjs +352 -0
  156. package/browser/editor/page/markdown/index.mjs +88 -0
  157. package/browser/editor/page/markdown/rules.mjs +33 -0
  158. package/browser/editor/page/marks.mjs +377 -0
  159. package/browser/editor/page/media-menu/index.mjs +158 -0
  160. package/browser/editor/page/menu.mjs +500 -0
  161. package/browser/editor/page/merge.mjs +100 -0
  162. package/browser/editor/page/notices.mjs +142 -0
  163. package/browser/editor/page/offered.mjs +32 -0
  164. package/browser/editor/page/outline/folds.mjs +52 -0
  165. package/browser/editor/page/outline/index.mjs +697 -0
  166. package/browser/editor/page/outline/list.mjs +172 -0
  167. package/browser/editor/page/outline/read.mjs +201 -0
  168. package/browser/editor/page/outline/strip.mjs +281 -0
  169. package/browser/editor/page/outline/tree.mjs +248 -0
  170. package/browser/editor/page/overlay-layer.mjs +227 -0
  171. package/browser/editor/page/overlays.mjs +205 -0
  172. package/browser/editor/page/own.mjs +28 -0
  173. package/browser/editor/page/pads.mjs +71 -0
  174. package/browser/editor/page/page-objects.mjs +105 -0
  175. package/browser/editor/page/panel.mjs +64 -0
  176. package/browser/editor/page/placement.mjs +58 -0
  177. package/browser/editor/page/post.mjs +41 -0
  178. package/browser/editor/page/present-links.mjs +50 -0
  179. package/browser/editor/page/quiet.mjs +48 -0
  180. package/browser/editor/page/resize/index.mjs +327 -0
  181. package/browser/editor/page/select-all/index.mjs +262 -0
  182. package/browser/editor/page/selection/delete.mjs +59 -0
  183. package/browser/editor/page/selection/index.mjs +157 -0
  184. package/browser/editor/page/selection/marquee.mjs +174 -0
  185. package/browser/editor/page/session.mjs +117 -0
  186. package/browser/editor/page/slash-menu/index.mjs +291 -0
  187. package/browser/editor/page/storage.mjs +48 -0
  188. package/browser/editor/page/sync-state.mjs +267 -0
  189. package/browser/editor/page/table/aligns.mjs +29 -0
  190. package/browser/editor/page/table/cell-bar.mjs +138 -0
  191. package/browser/editor/page/table/cells.mjs +527 -0
  192. package/browser/editor/page/table/icons.mjs +40 -0
  193. package/browser/editor/page/table/index.mjs +985 -0
  194. package/browser/editor/page/table/lists.mjs +187 -0
  195. package/browser/editor/page/table/widths.mjs +308 -0
  196. package/browser/editor/page/tex.mjs +32 -0
  197. package/browser/editor/page/text-select/index.mjs +656 -0
  198. package/browser/editor/page/tooltip.mjs +98 -0
  199. package/browser/editor/page/type-grid.mjs +82 -0
  200. package/browser/editor/page/typing/code-edges.mjs +228 -0
  201. package/browser/editor/page/typing/index.mjs +276 -0
  202. package/browser/editor/page/typing/leave.mjs +68 -0
  203. package/browser/editor/page/ui.mjs +160 -0
  204. package/browser/shared/annotations.mjs +571 -0
  205. package/browser/shared/code-folds.mjs +10 -0
  206. package/browser/shared/code-languages.mjs +70 -0
  207. package/browser/shared/code-lines.mjs +30 -0
  208. package/browser/shared/colors.mjs +28 -0
  209. package/browser/shared/component-catalog.mjs +559 -0
  210. package/browser/shared/components/bookmark.mjs +26 -0
  211. package/browser/shared/components/callout.mjs +7 -0
  212. package/browser/shared/components/chart.mjs +20 -0
  213. package/browser/shared/components/code.mjs +37 -0
  214. package/browser/shared/components/columns.mjs +16 -0
  215. package/browser/shared/components/details.mjs +15 -0
  216. package/browser/shared/components/dialog.mjs +28 -0
  217. package/browser/shared/components/diff.mjs +18 -0
  218. package/browser/shared/components/divider.mjs +6 -0
  219. package/browser/shared/components/embed.mjs +25 -0
  220. package/browser/shared/components/figure.mjs +14 -0
  221. package/browser/shared/components/file.mjs +23 -0
  222. package/browser/shared/components/heading.mjs +6 -0
  223. package/browser/shared/components/highlight.mjs +9 -0
  224. package/browser/shared/components/icon.mjs +18 -0
  225. package/browser/shared/components/image.mjs +39 -0
  226. package/browser/shared/components/index.mjs +342 -0
  227. package/browser/shared/components/installed.mjs +162 -0
  228. package/browser/shared/components/list.mjs +146 -0
  229. package/browser/shared/components/math.mjs +49 -0
  230. package/browser/shared/components/mention.mjs +33 -0
  231. package/browser/shared/components/page.mjs +37 -0
  232. package/browser/shared/components/paragraph.mjs +9 -0
  233. package/browser/shared/components/quote.mjs +6 -0
  234. package/browser/shared/components/section.mjs +8 -0
  235. package/browser/shared/components/sheets.mjs +80 -0
  236. package/browser/shared/components/state.mjs +20 -0
  237. package/browser/shared/components/table.mjs +49 -0
  238. package/browser/shared/components/text.mjs +14 -0
  239. package/browser/shared/components/widget.mjs +10 -0
  240. package/browser/shared/copy-ids.mjs +72 -0
  241. package/browser/shared/css-references.mjs +110 -0
  242. package/browser/shared/emoji/custom.mjs +91 -0
  243. package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
  244. package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
  245. package/browser/shared/emoji/data/README.md +26 -0
  246. package/browser/shared/emoji/data/categories.json +1 -0
  247. package/browser/shared/emoji/data/icons.json +1 -0
  248. package/browser/shared/emoji/data/keywords-en.json +1 -0
  249. package/browser/shared/emoji/data/keywords-zh.json +1 -0
  250. package/browser/shared/emoji/data/names.json +1 -0
  251. package/browser/shared/emoji/data/positions.json +1 -0
  252. package/browser/shared/emoji/data/twemoji-index.json +1 -0
  253. package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
  254. package/browser/shared/emoji/data.mjs +196 -0
  255. package/browser/shared/emoji/emoji.mjs +37 -0
  256. package/browser/shared/emoji/glyphs.mjs +134 -0
  257. package/browser/shared/emoji/icon-value.mjs +90 -0
  258. package/browser/shared/escape.mjs +20 -0
  259. package/browser/shared/export-wrap.mjs +89 -0
  260. package/browser/shared/files.mjs +33 -0
  261. package/browser/shared/html-tree.mjs +53 -0
  262. package/browser/shared/http.mjs +22 -0
  263. package/browser/shared/i18n/en.mjs +1164 -0
  264. package/browser/shared/i18n/index.mjs +132 -0
  265. package/browser/shared/ids.mjs +24 -0
  266. package/browser/shared/import-types.mjs +23 -0
  267. package/browser/shared/inline-spacing.mjs +97 -0
  268. package/browser/shared/layers.mjs +42 -0
  269. package/browser/shared/media.mjs +162 -0
  270. package/browser/shared/new-names.mjs +64 -0
  271. package/browser/shared/number-reading.mjs +92 -0
  272. package/browser/shared/old-names.mjs +143 -0
  273. package/browser/shared/page-address.mjs +140 -0
  274. package/browser/shared/page-links.mjs +86 -0
  275. package/browser/shared/paths.mjs +73 -0
  276. package/browser/shared/preferences.mjs +110 -0
  277. package/browser/shared/preview-server.mjs +247 -0
  278. package/browser/shared/qa-levels.mjs +93 -0
  279. package/browser/shared/reading-place.mjs +91 -0
  280. package/browser/shared/renamed-storage.mjs +220 -0
  281. package/browser/shared/reports.mjs +46 -0
  282. package/browser/shared/search.mjs +85 -0
  283. package/browser/shared/session.mjs +76 -0
  284. package/browser/shared/table-chart.mjs +113 -0
  285. package/browser/shared/table-hides.mjs +120 -0
  286. package/browser/shared/table-slots.mjs +75 -0
  287. package/browser/shared/words.mjs +23 -0
  288. package/browser/shared/workspace.mjs +535 -0
  289. package/browser/shared/writing-preferences.mjs +68 -0
  290. package/browser/shared/zoom.mjs +57 -0
  291. package/dist/chunk-2B5E4CDJ.mjs +2 -0
  292. package/dist/chunk-2PBALTR3.mjs +57 -0
  293. package/dist/chunk-342HXE3Q.mjs +2 -0
  294. package/dist/chunk-3LA3EMDE.mjs +15 -0
  295. package/dist/chunk-43B75J5T.mjs +2 -0
  296. package/dist/chunk-4K5KC6V2.mjs +2 -0
  297. package/dist/chunk-5FRMCDPY.mjs +16 -0
  298. package/dist/chunk-5L7RYZCL.mjs +2 -0
  299. package/dist/chunk-5LEK2CBS.mjs +2 -0
  300. package/dist/chunk-5OFN5AHC.mjs +2 -0
  301. package/dist/chunk-5SIYS5HN.mjs +2 -0
  302. package/dist/chunk-5TEK3RAD.mjs +2 -0
  303. package/dist/chunk-6CYG3Z4V.mjs +2 -0
  304. package/dist/chunk-6U2SLSDN.mjs +3 -0
  305. package/dist/chunk-742D2WWJ.mjs +19 -0
  306. package/dist/chunk-7GHT2UCA.mjs +15 -0
  307. package/dist/chunk-7QQBR7PB.mjs +2 -0
  308. package/dist/chunk-A55HN5OK.mjs +2 -0
  309. package/dist/chunk-ACOPDCNB.mjs +2 -0
  310. package/dist/chunk-AGDILNWB.mjs +2 -0
  311. package/dist/chunk-ATCJYAR4.mjs +2 -0
  312. package/dist/chunk-B3VTYBYR.mjs +960 -0
  313. package/dist/chunk-C564NU2H.mjs +77 -0
  314. package/dist/chunk-C7HWOBIF.mjs +2 -0
  315. package/dist/chunk-DB4WKGYF.mjs +7 -0
  316. package/dist/chunk-E7VYDG2X.mjs +2 -0
  317. package/dist/chunk-EUX7IC5J.mjs +48 -0
  318. package/dist/chunk-EVJ3BX3M.mjs +2 -0
  319. package/dist/chunk-EZY3WC6Z.mjs +15 -0
  320. package/dist/chunk-FQGQH4KM.mjs +2 -0
  321. package/dist/chunk-G7TOXONE.mjs +6 -0
  322. package/dist/chunk-GPF4YWWB.mjs +9 -0
  323. package/dist/chunk-GRAXKKG4.mjs +2 -0
  324. package/dist/chunk-GYQV7Y4J.mjs +120 -0
  325. package/dist/chunk-HMHK3EQ6.mjs +2 -0
  326. package/dist/chunk-HQQMJCQJ.mjs +10 -0
  327. package/dist/chunk-HYMEEXKN.mjs +4 -0
  328. package/dist/chunk-IERUOGC3.mjs +6 -0
  329. package/dist/chunk-ITNLYXXV.mjs +3 -0
  330. package/dist/chunk-L4DVONOG.mjs +2 -0
  331. package/dist/chunk-LAE5NQ4B.mjs +2 -0
  332. package/dist/chunk-LC7YNQFG.mjs +2 -0
  333. package/dist/chunk-LHTFLRB6.mjs +4 -0
  334. package/dist/chunk-LKX55H76.mjs +2 -0
  335. package/dist/chunk-MAFIGVXY.mjs +2 -0
  336. package/dist/chunk-NFIBI4IP.mjs +26 -0
  337. package/dist/chunk-NSKUTQ5J.mjs +5 -0
  338. package/dist/chunk-O52JMOCZ.mjs +2 -0
  339. package/dist/chunk-P2CAZPDP.mjs +3 -0
  340. package/dist/chunk-QAIHRH3I.mjs +13 -0
  341. package/dist/chunk-QMQUXTU4.mjs +12 -0
  342. package/dist/chunk-QR6A54KJ.mjs +3 -0
  343. package/dist/chunk-QVWVFC5K.mjs +6 -0
  344. package/dist/chunk-QYKCJ7FG.mjs +8 -0
  345. package/dist/chunk-QZY6Q64C.mjs +2 -0
  346. package/dist/chunk-TDQP3DKQ.mjs +10 -0
  347. package/dist/chunk-TMYZB6AV.mjs +2 -0
  348. package/dist/chunk-TX6JH7TR.mjs +2 -0
  349. package/dist/chunk-U3SSPL4K.mjs +8 -0
  350. package/dist/chunk-UH4SIXTR.mjs +2 -0
  351. package/dist/chunk-UNUEWH4S.mjs +2 -0
  352. package/dist/chunk-UXUK4PMC.mjs +27 -0
  353. package/dist/chunk-V4CPWKMZ.mjs +2 -0
  354. package/dist/chunk-V6XZ4VIR.mjs +2 -0
  355. package/dist/chunk-VACRB2NE.mjs +3 -0
  356. package/dist/chunk-W63L7367.mjs +7 -0
  357. package/dist/chunk-W7CXPCRV.mjs +6 -0
  358. package/dist/chunk-W7XHE4CT.mjs +2 -0
  359. package/dist/chunk-XINNG4F2.mjs +4 -0
  360. package/dist/chunk-Y34NR5JL.mjs +2 -0
  361. package/dist/chunk-YEY3RSFQ.mjs +2 -0
  362. package/dist/chunk-YL2DPWVS.mjs +4 -0
  363. package/dist/chunk-YXAUQPVK.mjs +8 -0
  364. package/dist/chunk-YZ5Z6H4W.mjs +4 -0
  365. package/dist/chunk-Z52HTUW7.mjs +4 -0
  366. package/dist/chunk-ZBIM6ARY.mjs +216 -0
  367. package/dist/cli.mjs +2 -0
  368. package/dist/server.mjs +2 -0
  369. package/dist/worker.mjs +5 -0
  370. package/kit/charts.js +355 -0
  371. package/kit/code.js +164 -0
  372. package/kit/dialogs.js +157 -0
  373. package/kit/math.js +1988 -0
  374. package/kit/report.css +2821 -0
  375. package/kit/runtime.js +1707 -0
  376. package/kit/sheets.js +123 -0
  377. package/kit/state.js +217 -0
  378. package/kit/tables.js +1449 -0
  379. package/kit/tokens.js +29 -0
  380. package/kit/ui.js +561 -0
  381. package/package.json +41 -4
  382. package/release.json +25 -0
  383. package/sdk/column-widths.d.ts +56 -0
  384. package/sdk/doc-charts.d.ts +82 -0
  385. package/sdk/doc-code.d.ts +28 -0
  386. package/sdk/doc-dialogs.d.ts +4 -0
  387. package/sdk/doc-kit.d.ts +141 -0
  388. package/sdk/doc-math.d.ts +3 -0
  389. package/sdk/doc-sheets.d.ts +15 -0
  390. package/sdk/doc-state.d.ts +41 -0
  391. package/sdk/doc-tables.d.ts +24 -0
  392. package/sdk/doc-tokens.d.ts +22 -0
  393. package/sdk/index.d.ts +30 -0
  394. package/skill/SKILL.md +138 -0
  395. package/skill/agents/openai.yaml +5 -0
  396. package/skill/references/building-components.md +327 -0
  397. package/skill/references/example-report.html +356 -0
  398. package/skill/references/writing-html.md +187 -0
  399. package/skill/sdk/column-widths.d.ts +56 -0
  400. package/skill/sdk/doc-charts.d.ts +82 -0
  401. package/skill/sdk/doc-code.d.ts +28 -0
  402. package/skill/sdk/doc-dialogs.d.ts +4 -0
  403. package/skill/sdk/doc-kit.d.ts +141 -0
  404. package/skill/sdk/doc-math.d.ts +3 -0
  405. package/skill/sdk/doc-sheets.d.ts +15 -0
  406. package/skill/sdk/doc-state.d.ts +41 -0
  407. package/skill/sdk/doc-tables.d.ts +24 -0
  408. package/skill/sdk/doc-tokens.d.ts +22 -0
  409. package/skill/sdk/index.d.ts +30 -0
  410. package/starter/doc.html +21 -0
  411. package/starter/doc.json +5 -0
  412. package/vendor/d3.v7.9.0.min.js +2 -0
  413. package/vendor/katex/auto-render.min.js +1 -0
  414. package/vendor/katex/contrib/mhchem.min.js +1 -0
  415. package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  416. package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  417. package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  418. package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  419. package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  420. package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  421. package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  422. package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  423. package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  424. package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  425. package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  426. package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  427. package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  428. package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  429. package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  430. package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  431. package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  432. package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  433. package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  434. package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  435. package/vendor/katex/katex.min.css +1 -0
  436. package/vendor/katex/katex.min.js +1 -0
  437. package/vendor/pdfjs/LICENSE +177 -0
  438. package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  439. package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  440. package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  441. package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  442. package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  443. package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  444. package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  445. package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  446. package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  447. package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  448. package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  449. package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  450. package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  451. package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  452. package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  453. package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  454. package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  455. package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  456. package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  457. package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  458. package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  459. package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  460. package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  461. package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  462. package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  463. package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  464. package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  465. package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  466. package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  467. package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  468. package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  469. package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  470. package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  471. package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  472. package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  473. package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  474. package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  475. package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  476. package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  477. package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  478. package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  479. package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  480. package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  481. package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  482. package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  483. package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  484. package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  485. package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  486. package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  487. package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  488. package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  489. package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  490. package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  491. package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  492. package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  493. package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  494. package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  495. package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  496. package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  497. package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  498. package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  499. package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  500. package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  501. package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  502. package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  503. package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  504. package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  505. package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  506. package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  507. package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  508. package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  509. package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  510. package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  511. package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  512. package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  513. package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  514. package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  515. package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  516. package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  517. package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  518. package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  519. package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  520. package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  521. package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  522. package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  523. package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  524. package/vendor/pdfjs/cmaps/H.bcmap +0 -0
  525. package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  526. package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  527. package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  528. package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  529. package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  530. package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  531. package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  532. package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  533. package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  534. package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  535. package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  536. package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  537. package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  538. package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  539. package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  540. package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  541. package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  542. package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  543. package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  544. package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  545. package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  546. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  547. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  548. package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  549. package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  550. package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  551. package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  552. package/vendor/pdfjs/cmaps/LICENSE +36 -0
  553. package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  554. package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  555. package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  556. package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  557. package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  558. package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  559. package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  560. package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  561. package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  562. package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  563. package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  564. package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  565. package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  566. package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  567. package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  568. package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  569. package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  570. package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  571. package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  572. package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  573. package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  574. package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  575. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  576. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  577. package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  578. package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  579. package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  580. package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  581. package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  582. package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  583. package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  584. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  585. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  586. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  587. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  588. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  589. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  590. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  591. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  592. package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  593. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  594. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  595. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  596. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  597. package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  598. package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  599. package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  600. package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  601. package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  602. package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  603. package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  604. package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  605. package/vendor/pdfjs/cmaps/V.bcmap +0 -0
  606. package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  607. package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
  608. package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
  609. package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  610. package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  611. package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  612. package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  613. package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  614. package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  615. package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  616. package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  617. package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  618. package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  619. package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  620. package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  621. package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  622. package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  623. package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  624. package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  625. package/vendor/types/@types/d3/LICENSE +21 -0
  626. package/vendor/types/@types/d3/index.d.ts +39 -0
  627. package/vendor/types/@types/d3/package.json +81 -0
  628. package/vendor/types/@types/d3-array/LICENSE +21 -0
  629. package/vendor/types/@types/d3-array/index.d.ts +1118 -0
  630. package/vendor/types/@types/d3-array/package.json +56 -0
  631. package/vendor/types/@types/d3-axis/LICENSE +21 -0
  632. package/vendor/types/@types/d3-axis/index.d.ts +293 -0
  633. package/vendor/types/@types/d3-axis/package.json +47 -0
  634. package/vendor/types/@types/d3-brush/LICENSE +21 -0
  635. package/vendor/types/@types/d3-brush/index.d.ts +255 -0
  636. package/vendor/types/@types/d3-brush/package.json +42 -0
  637. package/vendor/types/@types/d3-chord/LICENSE +21 -0
  638. package/vendor/types/@types/d3-chord/index.d.ts +471 -0
  639. package/vendor/types/@types/d3-chord/package.json +40 -0
  640. package/vendor/types/@types/d3-color/LICENSE +21 -0
  641. package/vendor/types/@types/d3-color/index.d.ts +669 -0
  642. package/vendor/types/@types/d3-color/package.json +55 -0
  643. package/vendor/types/@types/d3-contour/LICENSE +21 -0
  644. package/vendor/types/@types/d3-contour/index.d.ts +222 -0
  645. package/vendor/types/@types/d3-contour/package.json +38 -0
  646. package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
  647. package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
  648. package/vendor/types/@types/d3-delaunay/package.json +30 -0
  649. package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
  650. package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
  651. package/vendor/types/@types/d3-dispatch/package.json +51 -0
  652. package/vendor/types/@types/d3-drag/LICENSE +21 -0
  653. package/vendor/types/@types/d3-drag/index.d.ts +395 -0
  654. package/vendor/types/@types/d3-drag/package.json +42 -0
  655. package/vendor/types/@types/d3-dsv/LICENSE +21 -0
  656. package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
  657. package/vendor/types/@types/d3-dsv/package.json +45 -0
  658. package/vendor/types/@types/d3-ease/LICENSE +21 -0
  659. package/vendor/types/@types/d3-ease/index.d.ts +316 -0
  660. package/vendor/types/@types/d3-ease/package.json +40 -0
  661. package/vendor/types/@types/d3-fetch/LICENSE +21 -0
  662. package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
  663. package/vendor/types/@types/d3-fetch/package.json +37 -0
  664. package/vendor/types/@types/d3-force/LICENSE +21 -0
  665. package/vendor/types/@types/d3-force/index.d.ts +899 -0
  666. package/vendor/types/@types/d3-force/package.json +45 -0
  667. package/vendor/types/@types/d3-format/LICENSE +21 -0
  668. package/vendor/types/@types/d3-format/index.d.ts +337 -0
  669. package/vendor/types/@types/d3-format/package.json +45 -0
  670. package/vendor/types/@types/d3-geo/LICENSE +21 -0
  671. package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
  672. package/vendor/types/@types/d3-geo/package.json +48 -0
  673. package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
  674. package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
  675. package/vendor/types/@types/d3-hierarchy/package.json +50 -0
  676. package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
  677. package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
  678. package/vendor/types/@types/d3-interpolate/package.json +47 -0
  679. package/vendor/types/@types/d3-path/LICENSE +21 -0
  680. package/vendor/types/@types/d3-path/index.d.ts +108 -0
  681. package/vendor/types/@types/d3-path/package.json +41 -0
  682. package/vendor/types/@types/d3-polygon/LICENSE +21 -0
  683. package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
  684. package/vendor/types/@types/d3-polygon/package.json +40 -0
  685. package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
  686. package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
  687. package/vendor/types/@types/d3-quadtree/package.json +45 -0
  688. package/vendor/types/@types/d3-random/LICENSE +21 -0
  689. package/vendor/types/@types/d3-random/index.d.ts +313 -0
  690. package/vendor/types/@types/d3-random/package.json +41 -0
  691. package/vendor/types/@types/d3-scale/LICENSE +21 -0
  692. package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
  693. package/vendor/types/@types/d3-scale/package.json +53 -0
  694. package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
  695. package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
  696. package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
  697. package/vendor/types/@types/d3-selection/LICENSE +21 -0
  698. package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
  699. package/vendor/types/@types/d3-selection/package.json +56 -0
  700. package/vendor/types/@types/d3-shape/LICENSE +21 -0
  701. package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
  702. package/vendor/types/@types/d3-shape/package.json +53 -0
  703. package/vendor/types/@types/d3-time/LICENSE +21 -0
  704. package/vendor/types/@types/d3-time/index.d.ts +697 -0
  705. package/vendor/types/@types/d3-time/package.json +46 -0
  706. package/vendor/types/@types/d3-time-format/LICENSE +21 -0
  707. package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
  708. package/vendor/types/@types/d3-time-format/package.json +40 -0
  709. package/vendor/types/@types/d3-timer/LICENSE +21 -0
  710. package/vendor/types/@types/d3-timer/index.d.ts +68 -0
  711. package/vendor/types/@types/d3-timer/package.json +45 -0
  712. package/vendor/types/@types/d3-transition/LICENSE +21 -0
  713. package/vendor/types/@types/d3-transition/index.d.ts +664 -0
  714. package/vendor/types/@types/d3-transition/package.json +47 -0
  715. package/vendor/types/@types/d3-zoom/LICENSE +21 -0
  716. package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
  717. package/vendor/types/@types/d3-zoom/package.json +48 -0
  718. package/vendor/types/@types/geojson/LICENSE +21 -0
  719. package/vendor/types/@types/geojson/index.d.ts +202 -0
  720. package/vendor/types/@types/geojson/package.json +46 -0
  721. package/vendor/typescript/LICENSE.txt +55 -0
  722. package/vendor/typescript/lib.decorators.d.ts +384 -0
  723. package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
  724. package/vendor/typescript/lib.dom.d.ts +39429 -0
  725. package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
  726. package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
  727. package/vendor/typescript/lib.es2015.core.d.ts +597 -0
  728. package/vendor/typescript/lib.es2015.d.ts +28 -0
  729. package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
  730. package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
  731. package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
  732. package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
  733. package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
  734. package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
  735. package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
  736. package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
  737. package/vendor/typescript/lib.es2016.d.ts +21 -0
  738. package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
  739. package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
  740. package/vendor/typescript/lib.es2017.d.ts +26 -0
  741. package/vendor/typescript/lib.es2017.date.d.ts +31 -0
  742. package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
  743. package/vendor/typescript/lib.es2017.object.d.ts +49 -0
  744. package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
  745. package/vendor/typescript/lib.es2017.string.d.ts +45 -0
  746. package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
  747. package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
  748. package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
  749. package/vendor/typescript/lib.es2018.d.ts +24 -0
  750. package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
  751. package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
  752. package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
  753. package/vendor/typescript/lib.es2019.array.d.ts +79 -0
  754. package/vendor/typescript/lib.es2019.d.ts +24 -0
  755. package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
  756. package/vendor/typescript/lib.es2019.object.d.ts +33 -0
  757. package/vendor/typescript/lib.es2019.string.d.ts +37 -0
  758. package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
  759. package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
  760. package/vendor/typescript/lib.es2020.d.ts +27 -0
  761. package/vendor/typescript/lib.es2020.date.d.ts +42 -0
  762. package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
  763. package/vendor/typescript/lib.es2020.number.d.ts +28 -0
  764. package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
  765. package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
  766. package/vendor/typescript/lib.es2020.string.d.ts +44 -0
  767. package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
  768. package/vendor/typescript/lib.es2021.d.ts +23 -0
  769. package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
  770. package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
  771. package/vendor/typescript/lib.es2021.string.d.ts +33 -0
  772. package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
  773. package/vendor/typescript/lib.es2022.array.d.ts +121 -0
  774. package/vendor/typescript/lib.es2022.d.ts +25 -0
  775. package/vendor/typescript/lib.es2022.error.d.ts +75 -0
  776. package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
  777. package/vendor/typescript/lib.es2022.object.d.ts +26 -0
  778. package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
  779. package/vendor/typescript/lib.es2022.string.d.ts +25 -0
  780. package/vendor/typescript/lib.es5.d.ts +4601 -0
  781. package/vendor/typescript/package.json +4 -0
  782. package/vendor/typescript/typescript.js +446 -0
  783. package/web/assets/index-B6Ai3wsa.js +13 -0
  784. package/web/assets/index-SYPC3EZy.css +1 -0
  785. package/web/index.html +14 -0
@@ -0,0 +1,46 @@
1
+ import fs from "node:fs/promises";
2
+ import { namedLinks, pageLinks } from "./page-links.mjs";
3
+ import { reportsDirectory } from "./paths.mjs";
4
+ import { documentDirectory, documentFiles, listDocumentSlugs, listTrash, slugPattern } from "./workspace.mjs";
5
+
6
+ // The documents' layout, as every system reads it (./workspace.mjs): one folder a document,
7
+ // <workspace>/<slug>/ with doc.html and doc.json (report.html and report.json in one made before
8
+ // Gallery 0.1), its slug lowercase kebab-case. Dot names (.gallery/) and exports/ are never documents.
9
+
10
+ export { slugPattern };
11
+
12
+ // A workspace with no documents yet has none: gallery new makes the folder with its first one.
13
+ export async function listReportSlugs(directory = reportsDirectory) {
14
+ return listDocumentSlugs(directory);
15
+ }
16
+
17
+ /**
18
+ * The links of the documents of the workspace at `directory`, by their titles as they are now
19
+ * (./page-links.mjs): { links: a Map of slug to link of those of the sidebar, named: those and the
20
+ * trash's, what an address written for anyone goes by }. A doc.json that cannot be read now (an Agent
21
+ * writing it) names no title, and its document goes by its page id alone.
22
+ */
23
+ export async function documentLinks(directory = reportsDirectory) {
24
+ const page = async (slug) => ({ slug, title: await fs.readFile(documentFiles(documentDirectory(slug, directory)).json, "utf8").then((text) => JSON.parse(text).title).catch(() => null) });
25
+ const links = pageLinks(await Promise.all((await listDocumentSlugs(directory)).map(page)));
26
+ return { links, named: namedLinks(links, await listTrash(directory)) };
27
+ }
28
+
29
+ // The page of the user's writing preferences (写作偏好: `"instructions": true` in its doc.json, one at
30
+ // most, in <workspace>/.gallery/pages/<slug>/): a page like any other to edit, which the workbench
31
+ // opens from 设置 and lists apart from the documents, and writes as <workspace>/preferences.md for
32
+ // Agents to read before they write (src/shared/writing-preferences.mjs). Any other doc.json field names
33
+ // no role: an old one's "template" is read as nothing, the document an ordinary one.
34
+ export async function isInstructions(directory) {
35
+ return (await roleOf(directory)) === "instructions";
36
+ }
37
+
38
+ /** What a document is besides a document: "instructions", or null (an ordinary one). */
39
+ export async function roleOf(directory) {
40
+ try {
41
+ const metadata = JSON.parse(await fs.readFile(documentFiles(directory).json, "utf8"));
42
+ return metadata?.instructions === true ? "instructions" : null;
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
@@ -0,0 +1,85 @@
1
+ import { unescapeText } from "./escape.mjs";
2
+
3
+ // 搜索文档 in a report's text (the workbench's search: GET /__gallery/workspace/search). A report's text is
4
+ // read as its blocks' lines: the text of its main below the header (the title is matched apart), a
5
+ // line a block, no script, style or drawing, a formula its TeX. The words are found in a line as they
6
+ // are typed (one phrase, upper and lower case alike, runs of spaces as one), each hit shown as a
7
+ // snippet of its line around it; `before` (the text just before it in its line) and `index` (which
8
+ // time the words occur in the report) let the page find it again (editor/page/find/).
9
+
10
+ const SKIPPED = /<(script|style|template|noscript|svg)\b[\s\S]*?<\/\1>/gi;
11
+ const FORMULA = /\\\(([\s\S]*?)\\\)|\\\[([\s\S]*?)\\\]/g;
12
+ const BLOCK = /<\/?(p|li|ul|ol|h[1-6]|table|tr|td|th|caption|summary|details|figure|figcaption|pre|blockquote|div|section|article|aside|dl|dt|dd|hr|br)\b[^>]*>/gi;
13
+
14
+ /** Runs of spaces as one, the ends trimmed: a query as it is matched. */
15
+ export const tidyQuery = (text) => String(text).replace(/\s+/g, " ").trim().slice(0, 100);
16
+
17
+ /** The lines of report `html` (a whole report.html, or the inside of its main): its blocks' text. */
18
+ export function reportLines(html) {
19
+ let body = String(html);
20
+ const main = /<main\b[^>]*>([\s\S]*)<\/main>/i.exec(body);
21
+ if (main) body = main[1];
22
+ body = body.replace(/^\s*<header\b[^>]*>[\s\S]*?<\/header>/i, " "); // the page's header: its title and icon
23
+ const text = body
24
+ .replace(SKIPPED, " ")
25
+ .replace(FORMULA, (_, inline, display) => ` ${inline ?? display} `)
26
+ .replace(BLOCK, "\n")
27
+ .replace(/<[^>]*>/g, "")
28
+ .replace(/&nbsp;/g, " ")
29
+ .replace(/&#(\d+);/g, (_, code) => String.fromCodePoint(Number(code)))
30
+ .replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCodePoint(parseInt(code, 16)));
31
+ return unescapeText(text).replace(/\u200b/g, "").split("\n").map(tidyQuery).filter(Boolean);
32
+ }
33
+
34
+ /**
35
+ * Where `query` occurs in `lines`: { count, hits }, hits the first `most` lines it is in (once a
36
+ * line), each { text (the snippet), start, end (the words in it), before, index }.
37
+ */
38
+ export function findIn(lines, query, { most = 3, ahead = 16, length = 90 } = {}) {
39
+ const words = tidyQuery(query).toLowerCase();
40
+ const hits = [];
41
+ let count = 0;
42
+ if (!words) return { count, hits };
43
+ for (const line of lines) {
44
+ const lower = line.toLowerCase();
45
+ let shown = false;
46
+ for (let at = lower.indexOf(words); at >= 0; at = lower.indexOf(words, at + words.length)) {
47
+ if (!shown && hits.length < most) {
48
+ shown = true;
49
+ const from = at <= ahead ? 0 : at - ahead;
50
+ const to = Math.min(line.length, Math.max(from + length, at + words.length));
51
+ const head = from > 0 ? "…" : "";
52
+ hits.push({
53
+ text: `${head}${line.slice(from, to)}${to < line.length ? "…" : ""}`,
54
+ start: head.length + at - from,
55
+ end: head.length + at - from + words.length,
56
+ before: line.slice(Math.max(0, at - 16), at),
57
+ index: count,
58
+ });
59
+ }
60
+ count += 1;
61
+ }
62
+ }
63
+ return { count, hits };
64
+ }
65
+
66
+ /**
67
+ * gallery list's choice of the reports `words` name (src/cli/list.mjs): of `reports`
68
+ * ([{ slug, title, description, edited }]), those whose title, description or slug holds at least
69
+ * one of the words (upper and lower case alike; a word anywhere in them, as Chinese is written
70
+ * without spaces between words), the best first: those holding more of the words, then more of them
71
+ * in the title, then in the slug, then the one edited last. `words`: what was typed, split at spaces.
72
+ */
73
+ export function rankReports(reports, words) {
74
+ const wanted = [...new Set(tidyQuery(words).toLowerCase().split(" ").filter(Boolean))];
75
+ if (!wanted.length) return [...reports].sort((a, b) => b.edited - a.edited);
76
+ const scored = reports.map((report) => {
77
+ const [title, slug, description] = [report.title, report.slug, report.description].map((value) => String(value ?? "").toLowerCase());
78
+ const found = wanted.filter((word) => title.includes(word) || slug.includes(word) || description.includes(word));
79
+ return { report, found: found.length, title: wanted.filter((word) => title.includes(word)).length, slug: wanted.filter((word) => slug.includes(word)).length };
80
+ });
81
+ return scored
82
+ .filter(({ found }) => found > 0)
83
+ .sort((a, b) => b.found - a.found || b.title - a.title || b.slug - a.slug || b.report.edited - a.report.edited)
84
+ .map(({ report }) => report);
85
+ }
@@ -0,0 +1,76 @@
1
+ // The session between a report page and a workbench that shows it in an iframe of the same origin
2
+ // (docs/workbench.md): the page's side is src/editor/page/session.mjs, the workbench's
3
+ // src/workbench/app/session/. Every message is { protocol: PROTOCOL, v: VERSION, type, slug, ... },
4
+ // posted to the other window for this origin only.
5
+ //
6
+ // report -> workbench ready once the editor started: { commands, title, icon, state, annotations, card }
7
+ // state when the state, the title, the page's icon, how many 批注 it has or whether a
8
+ // detail card is open changed: { title, icon, state, annotations, card }
9
+ // (icon: the page's icon, an emoji, or null; card: a detail card is open)
10
+ // reply to a command, once it is done: { id, ok, ... }
11
+ // key a key combination the workbench registered, pressed in the page: { key }
12
+ // notice something to tell the reader, as the workbench's toast: { text, tone, hold,
13
+ // room }
14
+ // noticeRoom
15
+ // the room the page's bottom panels take changed: { room }, px above the
16
+ // frame's bottom (0: none), which the workbench's toasts stand above
17
+ // reload show the report again (the file changed): the workbench loads it in a
18
+ // hidden frame (data-pending) and swaps it in once that page is ready,
19
+ // so the reader never sees a page being reloaded; this page has
20
+ // stopped (it commits and stores nothing more)
21
+ // open go to another document (a link in the page): { target, block }
22
+ // (`target` its slug, as `slug` stays the sender's; `block` a block's id
23
+ // or null), or { hash } (a workbench's address, which the page cannot
24
+ // read without the titles); unsaved text is as for a click in the sidebar
25
+ // jump a link goes to a block of this page, sent before the page goes there:
26
+ // { block, place } (`place` where the reader is: x, y, top and tabs as
27
+ // reading-place.mjs's placeIn gives them, the caret's unit, self and
28
+ // offset, the detail cards open as modals): the workbench adds a history
29
+ // entry, the way back to it being the command show-place
30
+ // workspace a page was made under this one (a page block's box, the page itself
31
+ // staying as it is): the workbench reads the list of pages again and
32
+ // shows this page's row open
33
+ // annotations-removed
34
+ // a 批注 deleted from its card: { items }: the workbench says so, as
35
+ // it does for 全部删除, and its 撤销 puts them back
36
+ // workbench -> report command { id, name, ... }
37
+
38
+ export const PROTOCOL = "gallery/session";
39
+ // The protocol's id before the product's rename (2026-10-26). A workbench and a page of different
40
+ // versions meet when one was open before the server was updated and the other loaded after: each
41
+ // side takes either id. The page, until the workbench has spoken to it (its first command), sends
42
+ // every message under both ids, PROTOCOL first; once it has, only under the id the workbench used,
43
+ // and it answers a command under the id the command came in. The workbench sends a frame its
44
+ // commands under the id the frame last spoke, and takes an OLD_PROTOCOL message from a page that has
45
+ // spoken PROTOCOL as the copy it is (ignored). So an old workbench still hears a new page's reload
46
+ // and notices, and a new workbench drives an old page; nothing the page says is lost on either.
47
+ export const OLD_PROTOCOL = "html-report-studio/session";
48
+ /** The ids a message may carry: the new one first. */
49
+ export const PROTOCOLS = [PROTOCOL, OLD_PROTOCOL];
50
+ export const VERSION = 2;
51
+
52
+ /**
53
+ * Where a page finds, as it starts, where its reader was ({ x, y, top, unit, self, offset, modals,
54
+ * notice }, once: autosave.mjs takeView; `top` as reading-place.mjs's placeIn gives it, which the way
55
+ * back from another document keeps): sessionStorage, which a workbench and its frames share. A page
56
+ * puts it there before it is shown again; the workbench before the way back comes to it.
57
+ */
58
+ export const viewKey = (slug) => `gallery-edit:${slug}:view`;
59
+
60
+ /**
61
+ * What `state` reports, in this order: editing (the editor runs: the page edits from the start),
62
+ * pending (changes wait to be saved, or are on their way), saving (a commit is on its way), offline
63
+ * (commits do not get through; the changes wait in the browser), conflicts (how many the reader has
64
+ * to decide, a number), changed (someone else wrote the file; the page shows it once nothing waits).
65
+ */
66
+ export const STATE_FLAGS = ["editing", "pending", "saving", "offline", "conflicts", "changed"];
67
+
68
+ /**
69
+ * A key combination as the protocol names it: "Mod" (Ctrl, or ⌘ on a Mac), "Alt", "Shift", then
70
+ * the key (a letter upper-cased), joined by "+": "Mod+K", "Mod+\\", "Mod+Shift+P".
71
+ */
72
+ export function keyCombo(event, mac = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform ?? "")) {
73
+ const mod = mac ? event.metaKey : event.ctrlKey;
74
+ const key = event.key.length === 1 ? event.key.toUpperCase() : event.key;
75
+ return [mod && "Mod", event.altKey && "Alt", event.shiftKey && "Shift", key].filter(Boolean).join("+");
76
+ }
@@ -0,0 +1,113 @@
1
+ import { ZWSP } from "./inline-spacing.mjs";
2
+ import { isMissingValue, numberReading } from "./number-reading.mjs";
3
+
4
+ // A chart drawn from a table (docs/render.md, "Charts from a table"). An Agent writes an ordinary
5
+ // table with data-doc-chart="<type>", a type its report's script defines (DocCharts.define); the
6
+ // intake (src/editor/source/natural.mjs) makes it two blocks, the table's frame, which carries a key
7
+ // (CHART_SOURCE), and right after it a chart card whose host names the table by that key
8
+ // (CHART_DATA). The kit (src/render/kit/charts/from-table.js) reads the table as the page shows it and
9
+ // draws the chart again when the table changes; the checks (src/render/chart-declarations.mjs) read it
10
+ // from the file. Both take the rows a table gives a chart from here (tableRows): plain, predictable,
11
+ // d3.csvParse's shape, each value read as the table's own sort reads it (number-reading.mjs). The
12
+ // link is that pair of attributes alone, never an id or the blocks' order, so the reader may move,
13
+ // copy or delete either block (a copied pair takes a key of its own:
14
+ // src/editor/page/clipboard/own/chart-keys.mjs, and the commit makes sure of it against the file:
15
+ // src/editor/source/chart-keys.mjs).
16
+
17
+ /** On a chart's host: the key of the table it draws. */
18
+ export const CHART_DATA = "data-doc-chart-data";
19
+ /** On a table's frame (.doc-table-wrap): the key a chart reads it by. */
20
+ export const CHART_SOURCE = "data-doc-chart-source";
21
+ /** A key: a letter, then letters, digits, "_" or "-", 32 at most. */
22
+ export const CHART_KEY = /^[A-Za-z][\w-]{0,31}$/;
23
+
24
+ /** The first key of t1, t2 … that `taken` (a Set) does not hold. */
25
+ export function nextChartKey(taken) {
26
+ for (let index = 1; ; index++) if (!taken.has(`t${index}`)) return `t${index}`;
27
+ }
28
+
29
+ // A formula in a cell's text as the file writes it (and the page, before KaTeX draws it): its TeX
30
+ // between \( \), \[ \] or $$ $$.
31
+ const FORMULA = /\\\(([\s\S]*?)\\\)|\\\[([\s\S]*?)\\\]|\$\$([\s\S]*?)\$\$/g;
32
+
33
+ /**
34
+ * A cell's words as a chart reads them, from the file (the checks) and from the page (the kit) alike:
35
+ * `text` its text, where a formula is its TeX (written between its delimiters in the file; the kit
36
+ * reads one KaTeX drew by its TeX: charts/from-table.js), the editor's zero-width pads none, blanks
37
+ * one space, none at either end.
38
+ */
39
+ export const cellWords = (text) => text.replace(FORMULA, (_, inline, display, dollars) => inline ?? display ?? dollars).replaceAll(ZWSP, "").replace(/\s+/g, " ").trim();
40
+
41
+ // A header's data-sort-type that says its column holds no numbers: its values are its words.
42
+ const WORD_TYPES = new Set(["text", "date"]);
43
+
44
+ /**
45
+ * A cell's value for a chart (`cell`: { words, sort }, undefined where its row has none; `type`: its
46
+ * header's data-sort-type), as the table's sort reads it (number-reading.mjs, rawCellValue): its sort
47
+ * value when it has one, else its words; null for none (no cell, an empty one, a dash, n/a); its words
48
+ * in a column its header says holds words or dates; the number they write when they write one (12.5%
49
+ * 12.5, 3.6亿 360000000, 1,234 1234, (12) -12, 约 20 20, 120 ms 120); else its words (a range, 3–5 天,
50
+ * which a sort reads by its first number, is no one number: its words; so is 3 / 4).
51
+ */
52
+ export function cellValue(cell, type = null) {
53
+ if (!cell) return null;
54
+ const raw = cell.sort ?? cell.words;
55
+ if (isMissingValue(raw)) return null;
56
+ if (WORD_TYPES.has(type)) return cell.words;
57
+ const reading = numberReading(raw);
58
+ return reading && !reading.range ? reading.value : cell.words;
59
+ }
60
+
61
+ /**
62
+ * The rows a table gives a chart drawn from it: { data } or, when it gives none, { error, message }
63
+ * (`error` for a check and the host's layout note, `message` the card's line for its reader, as the
64
+ * kit's words name it: [key, ...values], said in the page's language by src/render/kit/words.js).
65
+ * `table`: { names, types, rows, merged }: its header row's words (its head's first row, else a first
66
+ * row of header cells alone; null when it has neither), its header cells' data-sort-type (null where
67
+ * none), its rows of data in the file's order (never a <tfoot>'s), each cell { words, sort } (its
68
+ * words, cellWords', and its data-sort-value, or null), and whether a cell of the header or the rows
69
+ * spans rows or columns (charts/from-table.js tableCells reads it from the page,
70
+ * chart-declarations.mjs tableCells from the file).
71
+ *
72
+ * `data` is what d3.csvParse gives: an object for each row of data, in their order, its values by
73
+ * the header's words (cellValue: a number, its words, or null; a row shorter than the header null
74
+ * where it has no cell, the cells past the header not read), and `data.columns` the header's words in
75
+ * order. With no header row the first row is the header, as csvParse takes it; a header cell with no
76
+ * words is the key "", and of two alike the later column's value is the one kept (the checks note
77
+ * both: rowsReading). Merged cells give nothing: a value has one cell.
78
+ */
79
+ export function tableRows(table) {
80
+ const fail = (error, ...message) => ({ error, message });
81
+ if (table.merged) return fail("has merged cells: write each value in its own cell, the category on every row", "merged-cells");
82
+ let { names, types, rows } = table;
83
+ if (!names) [names, types, rows] = rows.length > 0 ? [rows[0].map((cell) => cell?.words ?? ""), null, rows.slice(1)] : [[], null, []];
84
+ const data = rows.map((row) => {
85
+ const values = {};
86
+ names.forEach((name, column) => {
87
+ values[name] = cellValue(row[column], types?.[column] ?? null);
88
+ });
89
+ return values;
90
+ });
91
+ data.columns = [...names];
92
+ return { data };
93
+ }
94
+
95
+ /**
96
+ * What a table gave a chart (`table` as tableRows takes it, plus `foot`, its <tfoot>'s rows, which no
97
+ * chart reads; `data`: tableRows' rows), for the checks to say (chart-declarations.mjs
98
+ * tableChartReadings, chartDeclarationNotes): { rows: how many, columns: [{ name, numbers, words,
99
+ * empty }] how many of its values are numbers, words and null, column by column in the header's
100
+ * order (a name the header gives twice once: its later column's), blank: whether a header cell has no
101
+ * words, twice: the names the header gives twice, foot: how many <tfoot> rows were left out, extra:
102
+ * how many rows have cells past the header (not read) }.
103
+ */
104
+ export function rowsReading(table, data) {
105
+ const names = data.columns;
106
+ const twice = [...new Set(names.filter((name, at) => names.indexOf(name) !== at))];
107
+ const columns = [...new Set(names)].map((name) => {
108
+ const values = data.map((row) => row[name]);
109
+ return { name, numbers: values.filter((value) => typeof value === "number").length, words: values.filter((value) => typeof value === "string").length, empty: values.filter((value) => value === null).length };
110
+ });
111
+ const rows = table.names ? table.rows : table.rows.slice(1);
112
+ return { rows: data.length, columns, blank: names.includes(""), twice, foot: table.foot?.length ?? 0, extra: rows.filter((row) => row.length > names.length).length };
113
+ }
@@ -0,0 +1,120 @@
1
+ // What a table's frame hides at rest (scrolled to its start): the one measure of the kit's layout
2
+ // notes of a frame and of its fading right edge (render/kit/tables/scrollbars.js: columns-hidden,
3
+ // rows-hidden, data-more; docs/render.md, "Table layout internals") and of gallery qa's look at a
4
+ // table (src/cli/qa.mjs), which puts these functions in the page it looks at as their text
5
+ // (tableHidesScript): so they read nothing outside themselves but each other.
6
+ //
7
+ // A column hides what its words hide, never its cells' padding: the words of each of its cells (the
8
+ // header's and the body's, a merged cell's in the last column it covers) as the page draws them, so a
9
+ // table a few pixels wider than its frame hides nothing, and a long word deep in the body that
10
+ // reaches past the edge is a column cut though its header fits. A column is out of sight when none of
11
+ // its words starts before the frame's right edge, cut when some reach past it and some start before
12
+ // it. The first column that stays as the frame scrolls (a sticky first column, a header column:
13
+ // tables/sticky.js) never hides. A row (of the body's, those a filter hides aside) is shown when its
14
+ // words end above the frame's bottom edge.
15
+
16
+ /**
17
+ * The column each cell of `table` ends in, by the HTML table model's slots as src/shared/table-slots.mjs
18
+ * tiles them (tileSlots: a cell takes the first slot of its row no cell above covers, and covers its
19
+ * rowspan and colspan from there), read here on its own so that it can go into a page as its text,
20
+ * and so that a table that does not tile (a hole, a span past its section, a span of 0, read as 1)
21
+ * still gives each cell a column: { columnOf: Map(cell → its last column), columns: how many }.
22
+ * tests/unit/qa.mjs holds it to tileSlots on tables that tile.
23
+ */
24
+ export function cellColumns(table) {
25
+ const taken = [];
26
+ const columnOf = new Map();
27
+ let columns = 0;
28
+ [...table.rows].forEach((row, r) => {
29
+ let c = 0;
30
+ for (const cell of row.cells) {
31
+ while (taken[r]?.[c]) c++;
32
+ const across = Math.max(1, cell.colSpan);
33
+ for (let i = 0; i < Math.max(1, cell.rowSpan); i++) for (let j = 0; j < across; j++) (taken[r + i] ??= [])[c + j] = true;
34
+ columnOf.set(cell, c + across - 1);
35
+ c += across;
36
+ columns = Math.max(columns, c);
37
+ }
38
+ });
39
+ return { columnOf, columns };
40
+ }
41
+
42
+ /**
43
+ * Where the words of `cell` are drawn, as one box ({ left, right, top, bottom }, the page's): the
44
+ * boxes of its text's lines and of what it shows that is no text (a picture, a drawing, a control),
45
+ * never an element's own box (a list or a paragraph in a cell is as wide as the cell, its words are
46
+ * not; a formula's MathML, laid out unseen, is no words of it); null when it shows none.
47
+ */
48
+ export function wordsBox(cell) {
49
+ const boxes = [];
50
+ const range = document.createRange();
51
+ const walker = document.createTreeWalker(cell, NodeFilter.SHOW_TEXT);
52
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
53
+ if (!node.nodeValue.trim() || node.parentElement?.closest(".katex-mathml")) continue;
54
+ range.selectNodeContents(node);
55
+ boxes.push(...range.getClientRects());
56
+ }
57
+ for (const element of cell.querySelectorAll("img, svg, canvas, input, video")) boxes.push(element.getBoundingClientRect());
58
+ const drawn = boxes.filter((box) => box.width > 0 || box.height > 0);
59
+ if (drawn.length === 0) return null;
60
+ return {
61
+ left: Math.min(...drawn.map((box) => box.left)), right: Math.max(...drawn.map((box) => box.right)),
62
+ top: Math.min(...drawn.map((box) => box.top)), bottom: Math.max(...drawn.map((box) => box.bottom)),
63
+ };
64
+ }
65
+
66
+ /**
67
+ * What the frame `wrapper` (its client box) hides of its `table` at rest: { columns: how many, away
68
+ * and cut: the columns out of sight and cut, [{ column, name: its first words, the header's }], said:
69
+ * those columns in words ("of 6 columns, 1 cut at the frame's edge ("结论")", "" for none), reach:
70
+ * how far from the table's left edge the words past the frame's right edge end (px; 0 when none lies
71
+ * past it: what the fading edge shows while the frame is not scrolled to it), rows: the body's rows
72
+ * shown, shown: how many of them the frame shows }.
73
+ */
74
+ export function tableHides(wrapper, table) {
75
+ const width = wrapper.clientWidth;
76
+ const height = wrapper.clientHeight;
77
+ const box = table.getBoundingClientRect();
78
+ const holds = (cell) => Boolean((cell.textContent ?? "").trim() || cell.querySelector("img, svg, canvas, input, video"));
79
+ const { columnOf, columns } = cellColumns(table);
80
+ const fixed = table.classList.contains("doc-table--sticky-first") || Boolean(table.querySelector(':scope > tbody > tr > th[scope="row"]:first-child'));
81
+ const before = new Set(); // columns some of whose words start before the edge
82
+ const past = new Set(); // columns some of whose words reach past it
83
+ const names = [];
84
+ let reach = 0;
85
+ for (const row of table.rows) {
86
+ if (row.getClientRects().length === 0) continue;
87
+ for (const cell of row.cells) {
88
+ const column = columnOf.get(cell);
89
+ if (names[column] === undefined && cell.colSpan <= 1 && holds(cell)) names[column] = (cell.textContent ?? "").replace(/\s+/g, " ").trim();
90
+ if (fixed && column === 0) continue;
91
+ if (cell.getBoundingClientRect().right - box.left <= width + 1) {
92
+ if (holds(cell)) before.add(column);
93
+ continue;
94
+ }
95
+ const found = wordsBox(cell);
96
+ if (!found) continue;
97
+ if (found.left - box.left < width - 1) before.add(column);
98
+ if (found.right - box.left > width + 1) {
99
+ past.add(column);
100
+ reach = Math.max(reach, found.right - box.left);
101
+ }
102
+ }
103
+ }
104
+ const named = (column) => ({ column, name: names[column] ?? "" });
105
+ const away = [...past].filter((column) => !before.has(column)).sort((a, b) => a - b).map(named);
106
+ const cut = [...past].filter((column) => before.has(column)).sort((a, b) => a - b).map(named);
107
+ const quoted = (list) => `${list.slice(0, 4).map(({ column, name }) => (name ? `"${name.length > 16 ? `${name.slice(0, 15)}…` : name}"` : `column ${column + 1}`)).join(", ")}${list.length > 4 ? ", …" : ""}`;
108
+ const parts = [cut.length && `${cut.length} cut at the frame's edge (${quoted(cut)})`, away.length && `${away.length} out of sight (${quoted(away)})`].filter(Boolean);
109
+ const rows = [...table.tBodies].flatMap((body) => [...body.rows]).filter((row) => row.getClientRects().length > 0);
110
+ const shown = rows.filter((row) => {
111
+ const { top, bottom } = row.getBoundingClientRect();
112
+ if (bottom - box.top <= height + 1) return true;
113
+ if (top - box.top >= height - 1) return false;
114
+ return Math.max(-Infinity, ...[...row.cells].map(wordsBox).filter(Boolean).map((found) => found.bottom)) - box.top <= height + 1;
115
+ }).length;
116
+ return { columns, away, cut, said: parts.length ? `of ${columns} columns, ${parts.join(", ")}` : "", reach, rows: rows.length, shown };
117
+ }
118
+
119
+ /** tableHides as a script's text, with what it reads (an expression: the function), for a page to measure a table as the kit does. */
120
+ export const tableHidesScript = () => `(() => { ${cellColumns}; ${wordsBox}; return ${tableHides}; })()`;
@@ -0,0 +1,75 @@
1
+ // A table's slots (the HTML table model; docs/editor.md, "Tables"): each row has a slot in each
2
+ // column, and a cell covers a rectangle of them, one slot or more when it is merged (its rowspan and
3
+ // colspan). A cell is where its top left slot is ({ r, c }), the table's columns are its slots'
4
+ // columns. The one reading of a table's cells that the kit lays columns out by (render/kit/tables/),
5
+ // the page editor's table tools and operations (editor/components/table/, editor/page/table/) and the
6
+ // server's writing of a table (editor/source/table.mjs, components/table/file.mjs) share: tileSlots
7
+ // is the one tiling, slotsOf and tileSpans give it the cells of a DOM or the spans of an operation,
8
+ // and the cell that holds a column's width is the one columnCells / widthHolder say.
9
+
10
+ /**
11
+ * Where cells stand, from their spans alone: rows [{ section, cells: [{ ref, rowspan, colspan }] }]
12
+ * in order (`section`: what the row belongs to, a thead or a tbody; a cell never spans past it) →
13
+ * { matrix: per row, the ref covering each slot; places: Map(ref → { r, c, rows, cols }), in reading
14
+ * order; columns }, or null when the cells do not tile a rectangle (a hole, an overlap, a span past
15
+ * its section or the table, a span of 0).
16
+ */
17
+ export function tileSlots(rows) {
18
+ const matrix = rows.map(() => []);
19
+ const places = new Map();
20
+ for (let r = 0; r < rows.length; r++) {
21
+ let c = 0;
22
+ for (const { ref, rowspan, colspan } of rows[r].cells) {
23
+ while (matrix[r][c]) c++;
24
+ if (!(rowspan >= 1) || !(colspan >= 1)) return null;
25
+ for (let i = 0; i < rowspan; i++) {
26
+ if (rows[r + i]?.section !== rows[r].section) return null;
27
+ for (let j = 0; j < colspan; j++) {
28
+ if (matrix[r + i][c + j]) return null;
29
+ matrix[r + i][c + j] = ref;
30
+ }
31
+ }
32
+ places.set(ref, { r, c, rows: rowspan, cols: colspan });
33
+ c += colspan;
34
+ }
35
+ }
36
+ const columns = matrix[0]?.length ?? 0;
37
+ // Array holes count as undefined: a slot no cell covers.
38
+ if (columns === 0 || matrix.some((row) => row.length !== columns || row.includes(undefined))) return null;
39
+ return { matrix, places, columns };
40
+ }
41
+
42
+ /**
43
+ * The slots of a table's rows (tr elements, the thead's first): tileSlots with the cells themselves
44
+ * as refs, each row's section its parent.
45
+ */
46
+ export const slotsOf = (rows) => tileSlots(rows.map((row) => ({ section: row.parentElement, cells: [...row.cells].map((cell) => ({ ref: cell, rowspan: cell.rowSpan, colspan: cell.colSpan })) })));
47
+
48
+ /**
49
+ * Where cells given by their spans stand, without a DOM (the server's reading of an operation's rows
50
+ * and of a new table): rows [{ head, cells: [[rowspan, colspan]] }] (the head rows first) → tileSlots
51
+ * with each cell's "row:index" as its ref.
52
+ */
53
+ export const tileSpans = (rows) => tileSlots(rows.map((row, r) => ({ section: row.head, cells: row.cells.map(([rowspan, colspan], index) => ({ ref: `${r}:${index}`, rowspan, colspan })) })));
54
+
55
+ /** The refs of the cells of column `c` alone (beginning there, one column wide), top down. */
56
+ export const columnCells = (slots, c) => [...slots.places].filter(([, place]) => place.c === c && place.cols === 1).map(([ref]) => ref);
57
+
58
+ /**
59
+ * The cell that holds column `c`'s width where the table's tools write it (the page editor's
60
+ * COLUMN_WIDTH): the topmost cell of that column alone, or null (a merged cell holds none).
61
+ */
62
+ export const widthHolder = (slots, c) => columnCells(slots, c)[0] ?? null;
63
+
64
+ /**
65
+ * Each column's width as it is read (the kit lays the table out at them): the first cell of that
66
+ * column alone, top down, that has one (`widthOf(cell)`: a truthy width or null); null each where
67
+ * none has.
68
+ */
69
+ export const columnWidths = (slots, widthOf) => Array.from({ length: slots.columns }, (_, c) => {
70
+ for (const cell of columnCells(slots, c)) {
71
+ const width = widthOf(cell);
72
+ if (width) return width;
73
+ }
74
+ return null;
75
+ });
@@ -0,0 +1,23 @@
1
+ import { unescapeText } from "./escape.mjs";
2
+
3
+ // How many words a report holds, as Notion counts a page's (the workbench's menus say it: 129 个字):
4
+ // each Chinese, Japanese or Korean character one, each run of other letters and digits one. What is
5
+ // counted is the text of its main below the header (the title and the icon are not the body): no
6
+ // script, style or template, a formula one word (its TeX is no prose).
7
+
8
+ const SKIPPED = /<(script|style|template|noscript|svg)\b[\s\S]*?<\/\1>/gi;
9
+ const FORMULA = /\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/g;
10
+ const CJK = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu;
11
+ const WORD = /[\p{L}\p{N}]+(?:['’.-][\p{L}\p{N}]+)*/gu;
12
+
13
+ /** The words of report `html` (a whole report.html, or the inside of its main). */
14
+ export function countWords(html) {
15
+ let body = String(html);
16
+ const main = /<main\b[^>]*>([\s\S]*)<\/main>/i.exec(body);
17
+ if (main) body = main[1];
18
+ body = body.replace(/^\s*<header\b[^>]*>[\s\S]*?<\/header>/i, " "); // the page's header: its title and icon
19
+ const text = unescapeText(body.replace(SKIPPED, " ").replace(FORMULA, " 公式 ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&#(\d+);/g, (_, code) => String.fromCodePoint(Number(code))));
20
+ const formulas = (body.match(FORMULA) ?? []).length;
21
+ const cjk = (text.match(CJK) ?? []).length - formulas * 2; // "公式" stands for a formula: one word, not two characters
22
+ return cjk + formulas + (text.replace(CJK, " ").match(WORD) ?? []).length;
23
+ }