@heycys/gallery 0.1.1 → 0.2.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 (473) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/browser/editor/components/align.mjs +58 -0
  3. package/browser/editor/components/code/index.mjs +1 -1
  4. package/browser/editor/components/columns/page.mjs +4 -4
  5. package/browser/editor/components/embed/index.mjs +2 -2
  6. package/browser/editor/components/embed/page.mjs +1 -1
  7. package/browser/editor/components/file/page.mjs +4 -4
  8. package/browser/editor/components/flowchart/add.mjs +7 -6
  9. package/browser/editor/components/flowchart/page.mjs +1 -1
  10. package/browser/editor/components/heading/index.mjs +7 -6
  11. package/browser/editor/components/icons.mjs +11 -0
  12. package/browser/editor/components/image/crop.mjs +6 -9
  13. package/browser/editor/components/image/index.mjs +2 -0
  14. package/browser/editor/components/image/page.mjs +172 -90
  15. package/browser/editor/components/installed/index.mjs +15 -4
  16. package/browser/editor/components/installed/page.mjs +103 -25
  17. package/browser/editor/components/installed/served.mjs +6 -5
  18. package/browser/editor/components/instances.mjs +18 -0
  19. package/browser/editor/components/list/page.mjs +3 -6
  20. package/browser/editor/components/media/icons.mjs +13 -8
  21. package/browser/editor/components/media/page.mjs +5 -3
  22. package/browser/editor/components/media/toolbar.mjs +12 -3
  23. package/browser/editor/components/paragraph/index.mjs +4 -3
  24. package/browser/editor/components/registry.mjs +30 -9
  25. package/browser/editor/components/table/index.mjs +61 -2
  26. package/browser/editor/components/table/page.mjs +1 -1
  27. package/browser/editor/page/after/index.mjs +288 -0
  28. package/browser/editor/page/align.mjs +91 -0
  29. package/browser/editor/page/annotate/card.mjs +3 -6
  30. package/browser/editor/page/autosave.mjs +310 -37
  31. package/browser/editor/page/beside.mjs +5 -6
  32. package/browser/editor/page/block-menu/index.mjs +6 -3
  33. package/browser/editor/page/blocks.mjs +3 -1
  34. package/browser/editor/page/board/client.mjs +57 -0
  35. package/browser/editor/page/board/hint.mjs +182 -0
  36. package/browser/editor/page/board/history.mjs +119 -0
  37. package/browser/editor/page/board/index.mjs +1059 -0
  38. package/browser/editor/page/board/motion.mjs +177 -0
  39. package/browser/editor/page/board/settings.mjs +210 -0
  40. package/browser/editor/page/caret.mjs +1 -1
  41. package/browser/editor/page/changes/bar.mjs +6 -14
  42. package/browser/editor/page/changes/index.mjs +2 -2
  43. package/browser/editor/page/clipboard/import/html.mjs +29 -6
  44. package/browser/editor/page/clipboard/import/inline.mjs +32 -0
  45. package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
  46. package/browser/editor/page/clipboard/import/read.mjs +6 -1
  47. package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
  48. package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
  49. package/browser/editor/page/clipboard/index.mjs +133 -15
  50. package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
  51. package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
  52. package/browser/editor/page/clipboard/own/describe.mjs +6 -2
  53. package/browser/editor/page/clipboard/own/selection.mjs +1 -1
  54. package/browser/editor/page/columns/index.mjs +48 -46
  55. package/browser/editor/page/commit.mjs +80 -22
  56. package/browser/editor/page/conflicts.mjs +7 -7
  57. package/browser/editor/page/core.mjs +34 -16
  58. package/browser/editor/page/custom-page.mjs +110 -0
  59. package/browser/editor/page/editor.mjs +71 -17
  60. package/browser/editor/page/emoji-picker/styles.mjs +7 -12
  61. package/browser/editor/page/emoji-picker/upload.mjs +2 -2
  62. package/browser/editor/page/handle/index.mjs +5 -8
  63. package/browser/editor/page/history.mjs +41 -6
  64. package/browser/editor/page/insert/index.mjs +20 -22
  65. package/browser/editor/page/links/index.mjs +5 -3
  66. package/browser/editor/page/links/pages.mjs +27 -9
  67. package/browser/editor/page/look.mjs +54 -3
  68. package/browser/editor/page/margin.mjs +18 -3
  69. package/browser/editor/page/media-menu/index.mjs +6 -7
  70. package/browser/editor/page/menu.mjs +33 -14
  71. package/browser/editor/page/notices.mjs +2 -2
  72. package/browser/editor/page/page-objects.mjs +9 -2
  73. package/browser/editor/page/panel.mjs +4 -9
  74. package/browser/editor/page/present-links.mjs +15 -5
  75. package/browser/editor/page/present-shell.mjs +63 -0
  76. package/browser/editor/page/resize/index.mjs +42 -29
  77. package/browser/editor/page/selection/index.mjs +10 -2
  78. package/browser/editor/page/served.mjs +14 -0
  79. package/browser/editor/page/session.mjs +48 -4
  80. package/browser/editor/page/slash-menu/index.mjs +3 -3
  81. package/browser/editor/page/table/binding.mjs +87 -0
  82. package/browser/editor/page/table/cells.mjs +102 -46
  83. package/browser/editor/page/table/index.mjs +24 -9
  84. package/browser/editor/page/table/pictures.mjs +299 -0
  85. package/browser/editor/page/table/views.mjs +103 -0
  86. package/browser/editor/page/table/widths.mjs +82 -10
  87. package/browser/editor/page/text-select/index.mjs +26 -12
  88. package/browser/editor/page/todo-writes.mjs +75 -0
  89. package/browser/editor/page/typing/index.mjs +97 -15
  90. package/browser/editor/page/typing/leave.mjs +19 -5
  91. package/browser/editor/page/ui.mjs +13 -0
  92. package/browser/shared/block-packs.mjs +419 -0
  93. package/browser/shared/board-places.mjs +224 -0
  94. package/browser/shared/card-size.mjs +59 -0
  95. package/browser/shared/colors.mjs +3 -2
  96. package/browser/shared/component-catalog.mjs +330 -46
  97. package/browser/shared/component-source.mjs +39 -0
  98. package/browser/shared/components/heading.mjs +2 -1
  99. package/browser/shared/components/index.mjs +12 -3
  100. package/browser/shared/components/installed.mjs +35 -3
  101. package/browser/shared/components/page.mjs +20 -8
  102. package/browser/shared/components/paragraph.mjs +8 -1
  103. package/browser/shared/components/state.mjs +5 -1
  104. package/browser/shared/components/table.mjs +1 -0
  105. package/browser/shared/document-look.mjs +10 -5
  106. package/browser/shared/drafts.mjs +432 -0
  107. package/browser/shared/emoji/line-icons.mjs +37 -0
  108. package/browser/shared/extension-sidebar.mjs +126 -0
  109. package/browser/shared/extensions.mjs +79 -0
  110. package/browser/shared/file-table.mjs +101 -0
  111. package/browser/shared/http.mjs +9 -0
  112. package/browser/shared/i18n/en.mjs +330 -27
  113. package/browser/shared/json-layout.mjs +47 -0
  114. package/browser/shared/net-cache.mjs +133 -0
  115. package/browser/shared/net-keys.mjs +32 -0
  116. package/browser/shared/net-policy.mjs +177 -0
  117. package/browser/shared/outline-shape.mjs +128 -0
  118. package/browser/shared/outline.mjs +359 -67
  119. package/browser/shared/pack-manifest.mjs +88 -0
  120. package/browser/shared/page-address.mjs +6 -3
  121. package/browser/shared/page-cards.mjs +308 -0
  122. package/browser/shared/page-links.mjs +69 -6
  123. package/browser/shared/pages.mjs +500 -0
  124. package/browser/shared/paths.mjs +6 -0
  125. package/browser/shared/pinyin.mjs +92 -0
  126. package/browser/shared/present-step.mjs +17 -0
  127. package/browser/shared/preview-server.mjs +3 -7
  128. package/browser/shared/session.mjs +8 -1
  129. package/browser/shared/shipped-blocks.mjs +299 -0
  130. package/browser/shared/sidebar-head.mjs +70 -0
  131. package/browser/shared/table-chart.mjs +33 -1
  132. package/browser/shared/todos.mjs +83 -0
  133. package/browser/shared/user-directory.mjs +24 -0
  134. package/browser/shared/versions.mjs +14 -0
  135. package/browser/shared/web-links.mjs +139 -0
  136. package/browser/shared/workspace-columns.mjs +120 -0
  137. package/browser/shared/workspace-name.mjs +154 -0
  138. package/browser/shared/workspace-query.mjs +125 -0
  139. package/browser/shared/workspace-registry.mjs +272 -0
  140. package/browser/shared/workspace.mjs +171 -20
  141. package/dist/chunk-2OHANJ6Q.mjs +2 -0
  142. package/dist/chunk-3MBRL2PM.mjs +16 -0
  143. package/dist/chunk-4OKWZY5E.mjs +2 -0
  144. package/dist/chunk-4OZWXZE5.mjs +5 -0
  145. package/dist/chunk-5K44HLTZ.mjs +2 -0
  146. package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
  147. package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
  148. package/dist/chunk-6KBYRA2C.mjs +2 -0
  149. package/dist/chunk-6N3PX4XX.mjs +8 -0
  150. package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
  151. package/dist/chunk-7JDX4E65.mjs +13 -0
  152. package/dist/chunk-7M2BQQGZ.mjs +2 -0
  153. package/dist/chunk-7OG26PGF.mjs +2 -0
  154. package/dist/chunk-AHN3NFKJ.mjs +3 -0
  155. package/dist/chunk-ALZ6ZENZ.mjs +3 -0
  156. package/dist/chunk-AR5D57ZD.mjs +170 -0
  157. package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
  158. package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
  159. package/dist/chunk-CMA72MAG.mjs +2 -0
  160. package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
  161. package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
  162. package/dist/chunk-DR73Y2UJ.mjs +3 -0
  163. package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
  164. package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
  165. package/dist/chunk-EP25HDAJ.mjs +2 -0
  166. package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
  167. package/dist/chunk-EURLTOTZ.mjs +4 -0
  168. package/dist/chunk-F4ZA6JRZ.mjs +3 -0
  169. package/dist/chunk-F6HVDZR4.mjs +2 -0
  170. package/dist/chunk-FDMAXMQA.mjs +2 -0
  171. package/dist/chunk-FETSREUN.mjs +5 -0
  172. package/dist/chunk-GHOYKMQ3.mjs +4 -0
  173. package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
  174. package/dist/chunk-HDWTZ763.mjs +12 -0
  175. package/dist/chunk-HPOI4ZX7.mjs +6 -0
  176. package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
  177. package/dist/chunk-IA4PSIMD.mjs +2 -0
  178. package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
  179. package/dist/chunk-IV64FFI4.mjs +2 -0
  180. package/dist/chunk-J43Z6LSS.mjs +2 -0
  181. package/dist/chunk-J5PUIV3Y.mjs +4 -0
  182. package/dist/chunk-JA7G53PC.mjs +2 -0
  183. package/dist/chunk-JEUK3ZO7.mjs +2 -0
  184. package/dist/chunk-JLTZF4LA.mjs +2 -0
  185. package/dist/chunk-JZT7I2OJ.mjs +2 -0
  186. package/dist/chunk-K5XATEOO.mjs +2 -0
  187. package/dist/chunk-L2SUIS5S.mjs +2 -0
  188. package/dist/chunk-L7UP52JO.mjs +2 -0
  189. package/dist/chunk-LM4XFQHZ.mjs +2 -0
  190. package/dist/chunk-MN7BZL4R.mjs +2 -0
  191. package/dist/chunk-MTYYHM2G.mjs +15 -0
  192. package/dist/chunk-MXUBKDRO.mjs +15 -0
  193. package/dist/chunk-NAMN3RAF.mjs +2 -0
  194. package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
  195. package/dist/chunk-OFHXGWOX.mjs +2 -0
  196. package/dist/chunk-ORID3AE7.mjs +166 -0
  197. package/dist/chunk-PAREWQGB.mjs +4 -0
  198. package/dist/chunk-PGDE24N5.mjs +2 -0
  199. package/dist/chunk-POTA2FV4.mjs +2 -0
  200. package/dist/chunk-PUOQ65NC.mjs +2 -0
  201. package/dist/chunk-Q4UEPUWF.mjs +2 -0
  202. package/dist/chunk-QE5RG76S.mjs +549 -0
  203. package/dist/chunk-R2ZDLJYT.mjs +10 -0
  204. package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
  205. package/dist/chunk-SWUTTZCN.mjs +2 -0
  206. package/dist/chunk-TANZRINB.mjs +2 -0
  207. package/dist/chunk-TR7TWGHB.mjs +2 -0
  208. package/dist/chunk-U5XL7D6A.mjs +3 -0
  209. package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
  210. package/dist/chunk-UGWMMEJ5.mjs +15 -0
  211. package/dist/chunk-UJQJKNGK.mjs +2 -0
  212. package/dist/chunk-UYVCQK3H.mjs +22 -0
  213. package/dist/chunk-VFX2KNHP.mjs +4 -0
  214. package/dist/chunk-VS7JIGJW.mjs +24 -0
  215. package/dist/chunk-W7665ZEC.mjs +6 -0
  216. package/dist/chunk-WQDQWCX5.mjs +2 -0
  217. package/dist/chunk-YI43RG4P.mjs +2 -0
  218. package/dist/chunk-YLPSMDIS.mjs +5 -0
  219. package/dist/chunk-YNAWBAYN.mjs +3 -0
  220. package/dist/chunk-YROX2O22.mjs +2 -0
  221. package/dist/chunk-ZDLPUOAG.mjs +6 -0
  222. package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
  223. package/dist/chunk-ZQS6H473.mjs +16 -0
  224. package/dist/chunk-ZTHICSSF.mjs +2 -0
  225. package/dist/chunk-ZWWC4KLF.mjs +20 -0
  226. package/dist/cli.mjs +1 -1
  227. package/dist/server.mjs +1 -1
  228. package/dist/{chunk-U6KNPJPR.mjs → update-fetch.mjs} +1 -1
  229. package/dist/worker.mjs +1 -1
  230. package/kit/board.css +95 -0
  231. package/kit/board.js +250 -0
  232. package/kit/charts.js +5 -71
  233. package/kit/code.js +17 -17
  234. package/kit/report.css +335 -18
  235. package/kit/runtime.js +1638 -125
  236. package/kit/state.js +10 -1
  237. package/kit/tables.js +130 -43
  238. package/kit/ui.js +79 -35
  239. package/package.json +2 -1
  240. package/packs/gallery/card/component.json +14 -0
  241. package/packs/gallery/card/example.html +10 -0
  242. package/packs/gallery/card/preview.svg +1 -0
  243. package/packs/gallery/card/style.css +6 -0
  244. package/packs/gallery/card/template.html +6 -0
  245. package/packs/gallery/card/writing.md +14 -0
  246. package/packs/gallery/chart-card/component.json +15 -0
  247. package/packs/gallery/chart-card/example.html +14 -0
  248. package/packs/gallery/chart-card/kit.js +130 -0
  249. package/packs/gallery/chart-card/preview.svg +1 -0
  250. package/packs/gallery/chart-card/style.css +42 -0
  251. package/packs/gallery/chart-card/template.html +13 -0
  252. package/packs/gallery/chart-card/writing.md +20 -0
  253. package/packs/gallery/chart-view/component.json +20 -0
  254. package/packs/gallery/chart-view/example.html +13 -0
  255. package/packs/gallery/chart-view/kit.js +355 -0
  256. package/packs/gallery/chart-view/preview.svg +1 -0
  257. package/packs/gallery/chart-view/style.css +94 -0
  258. package/packs/gallery/chart-view/template.html +3 -0
  259. package/packs/gallery/chart-view/writing.md +22 -0
  260. package/packs/gallery/countdown/component.json +18 -0
  261. package/packs/gallery/countdown/example.html +3 -0
  262. package/packs/gallery/countdown/kit.js +216 -0
  263. package/packs/gallery/countdown/preview.svg +1 -0
  264. package/packs/gallery/countdown/style.css +118 -0
  265. package/packs/gallery/countdown/template.html +3 -0
  266. package/packs/gallery/countdown/writing.md +22 -0
  267. package/packs/gallery/habit/component.json +14 -0
  268. package/packs/gallery/habit/example.html +3 -0
  269. package/packs/gallery/habit/kit.js +334 -0
  270. package/packs/gallery/habit/preview.svg +1 -0
  271. package/packs/gallery/habit/style.css +174 -0
  272. package/packs/gallery/habit/template.html +3 -0
  273. package/packs/gallery/habit/writing.md +21 -0
  274. package/packs/gallery/heatmap/component.json +18 -0
  275. package/packs/gallery/heatmap/example.html +3 -0
  276. package/packs/gallery/heatmap/kit.js +513 -0
  277. package/packs/gallery/heatmap/preview.svg +1 -0
  278. package/packs/gallery/heatmap/style.css +189 -0
  279. package/packs/gallery/heatmap/template.html +3 -0
  280. package/packs/gallery/heatmap/writing.md +21 -0
  281. package/packs/gallery/kanban/component.json +18 -0
  282. package/packs/gallery/kanban/example.html +12 -0
  283. package/packs/gallery/kanban/kit.js +540 -0
  284. package/packs/gallery/kanban/preview.svg +1 -0
  285. package/packs/gallery/kanban/style.css +212 -0
  286. package/packs/gallery/kanban/template.html +3 -0
  287. package/packs/gallery/kanban/writing.md +20 -0
  288. package/packs/gallery/metric/component.json +22 -0
  289. package/packs/gallery/metric/example.html +15 -0
  290. package/packs/gallery/metric/kit.js +248 -0
  291. package/packs/gallery/metric/preview.svg +1 -0
  292. package/packs/gallery/metric/style.css +92 -0
  293. package/packs/gallery/metric/template.html +3 -0
  294. package/packs/gallery/metric/writing.md +23 -0
  295. package/packs/gallery/note/component.json +14 -0
  296. package/packs/gallery/note/example.html +3 -0
  297. package/packs/gallery/note/kit.js +129 -0
  298. package/packs/gallery/note/preview.svg +1 -0
  299. package/packs/gallery/note/style.css +97 -0
  300. package/packs/gallery/note/template.html +3 -0
  301. package/packs/gallery/note/writing.md +18 -0
  302. package/packs/gallery/pack.json +8 -0
  303. package/packs/gallery/recent/component.json +13 -0
  304. package/packs/gallery/recent/example.html +1 -0
  305. package/packs/gallery/recent/kit.js +293 -0
  306. package/packs/gallery/recent/preview.svg +1 -0
  307. package/packs/gallery/recent/style.css +85 -0
  308. package/packs/gallery/recent/template.html +1 -0
  309. package/packs/gallery/recent/writing.md +15 -0
  310. package/packs/gallery/static/component.json +13 -0
  311. package/packs/gallery/static/example.html +11 -0
  312. package/packs/gallery/static/preview.svg +1 -0
  313. package/packs/gallery/static/style.css +171 -0
  314. package/packs/gallery/static/template.html +1 -0
  315. package/packs/gallery/static/writing.md +18 -0
  316. package/packs/gallery/stats/component.json +13 -0
  317. package/packs/gallery/stats/example.html +1 -0
  318. package/packs/gallery/stats/kit.js +347 -0
  319. package/packs/gallery/stats/preview.svg +1 -0
  320. package/packs/gallery/stats/style.css +73 -0
  321. package/packs/gallery/stats/template.html +1 -0
  322. package/packs/gallery/stats/writing.md +11 -0
  323. package/packs/gallery/today/component.json +12 -0
  324. package/packs/gallery/today/example.html +1 -0
  325. package/packs/gallery/today/kit.js +220 -0
  326. package/packs/gallery/today/preview.svg +1 -0
  327. package/packs/gallery/today/style.css +149 -0
  328. package/packs/gallery/today/template.html +1 -0
  329. package/packs/gallery/today/writing.md +14 -0
  330. package/packs/gallery/todos/component.json +19 -0
  331. package/packs/gallery/todos/example.html +3 -0
  332. package/packs/gallery/todos/kit.js +489 -0
  333. package/packs/gallery/todos/preview.svg +1 -0
  334. package/packs/gallery/todos/style.css +214 -0
  335. package/packs/gallery/todos/template.html +3 -0
  336. package/packs/gallery/todos/writing.md +30 -0
  337. package/packs/gallery/weather/component.json +19 -0
  338. package/packs/gallery/weather/example.html +3 -0
  339. package/packs/gallery/weather/kit.js +387 -0
  340. package/packs/gallery/weather/preview.svg +1 -0
  341. package/packs/gallery/weather/style.css +140 -0
  342. package/packs/gallery/weather/template.html +3 -0
  343. package/packs/gallery/weather/writing.md +26 -0
  344. package/packs/gallery-soft/countdown/component.json +18 -0
  345. package/packs/gallery-soft/countdown/example.html +3 -0
  346. package/packs/gallery-soft/countdown/kit.js +206 -0
  347. package/packs/gallery-soft/countdown/preview.svg +1 -0
  348. package/packs/gallery-soft/countdown/style.css +211 -0
  349. package/packs/gallery-soft/countdown/template.html +3 -0
  350. package/packs/gallery-soft/countdown/writing.md +24 -0
  351. package/packs/gallery-soft/habit/component.json +14 -0
  352. package/packs/gallery-soft/habit/example.html +3 -0
  353. package/packs/gallery-soft/habit/kit.js +366 -0
  354. package/packs/gallery-soft/habit/preview.svg +1 -0
  355. package/packs/gallery-soft/habit/style.css +251 -0
  356. package/packs/gallery-soft/habit/template.html +3 -0
  357. package/packs/gallery-soft/habit/writing.md +23 -0
  358. package/packs/gallery-soft/heatmap/component.json +18 -0
  359. package/packs/gallery-soft/heatmap/example.html +3 -0
  360. package/packs/gallery-soft/heatmap/kit.js +498 -0
  361. package/packs/gallery-soft/heatmap/preview.svg +1 -0
  362. package/packs/gallery-soft/heatmap/style.css +181 -0
  363. package/packs/gallery-soft/heatmap/template.html +3 -0
  364. package/packs/gallery-soft/heatmap/writing.md +23 -0
  365. package/packs/gallery-soft/note/component.json +14 -0
  366. package/packs/gallery-soft/note/example.html +3 -0
  367. package/packs/gallery-soft/note/kit.js +162 -0
  368. package/packs/gallery-soft/note/preview.svg +1 -0
  369. package/packs/gallery-soft/note/style.css +148 -0
  370. package/packs/gallery-soft/note/template.html +3 -0
  371. package/packs/gallery-soft/note/writing.md +20 -0
  372. package/packs/gallery-soft/pack.json +8 -0
  373. package/packs/gallery-soft/recent/component.json +13 -0
  374. package/packs/gallery-soft/recent/example.html +1 -0
  375. package/packs/gallery-soft/recent/kit.js +335 -0
  376. package/packs/gallery-soft/recent/preview.svg +1 -0
  377. package/packs/gallery-soft/recent/style.css +160 -0
  378. package/packs/gallery-soft/recent/template.html +1 -0
  379. package/packs/gallery-soft/recent/writing.md +17 -0
  380. package/packs/gallery-soft/static/component.json +13 -0
  381. package/packs/gallery-soft/static/example.html +12 -0
  382. package/packs/gallery-soft/static/preview.svg +1 -0
  383. package/packs/gallery-soft/static/style.css +186 -0
  384. package/packs/gallery-soft/static/template.html +1 -0
  385. package/packs/gallery-soft/static/writing.md +20 -0
  386. package/packs/gallery-soft/stats/component.json +13 -0
  387. package/packs/gallery-soft/stats/example.html +1 -0
  388. package/packs/gallery-soft/stats/kit.js +341 -0
  389. package/packs/gallery-soft/stats/preview.svg +1 -0
  390. package/packs/gallery-soft/stats/style.css +119 -0
  391. package/packs/gallery-soft/stats/template.html +1 -0
  392. package/packs/gallery-soft/stats/writing.md +13 -0
  393. package/packs/gallery-soft/today/component.json +12 -0
  394. package/packs/gallery-soft/today/example.html +1 -0
  395. package/packs/gallery-soft/today/kit.js +222 -0
  396. package/packs/gallery-soft/today/preview.svg +1 -0
  397. package/packs/gallery-soft/today/style.css +178 -0
  398. package/packs/gallery-soft/today/template.html +1 -0
  399. package/packs/gallery-soft/today/writing.md +16 -0
  400. package/packs/gallery-soft/todos/component.json +19 -0
  401. package/packs/gallery-soft/todos/example.html +3 -0
  402. package/packs/gallery-soft/todos/kit.js +527 -0
  403. package/packs/gallery-soft/todos/preview.svg +1 -0
  404. package/packs/gallery-soft/todos/style.css +212 -0
  405. package/packs/gallery-soft/todos/template.html +3 -0
  406. package/packs/gallery-soft/todos/writing.md +32 -0
  407. package/packs/gallery-soft/weather/component.json +19 -0
  408. package/packs/gallery-soft/weather/example.html +3 -0
  409. package/packs/gallery-soft/weather/kit.js +411 -0
  410. package/packs/gallery-soft/weather/preview.svg +1 -0
  411. package/packs/gallery-soft/weather/style.css +185 -0
  412. package/packs/gallery-soft/weather/template.html +3 -0
  413. package/packs/gallery-soft/weather/writing.md +28 -0
  414. package/release.json +12 -10
  415. package/sdk/doc-kit.d.ts +396 -5
  416. package/sdk/doc-state.d.ts +2 -0
  417. package/skill/SKILL.md +56 -23
  418. package/skill/references/block-script.md +140 -0
  419. package/skill/references/building-blocks.md +257 -0
  420. package/skill/references/extensions.md +59 -0
  421. package/skill/references/pages-and-data.md +225 -0
  422. package/skill/references/writing-html.md +8 -4
  423. package/skill/sdk/doc-kit.d.ts +396 -5
  424. package/skill/sdk/doc-state.d.ts +2 -0
  425. package/web/assets/index-BM_K-Auu.css +1 -0
  426. package/web/assets/index-DRslOBiv.js +15 -0
  427. package/web/index.html +2 -2
  428. package/dist/chunk-3HIRPVLU.mjs +0 -2
  429. package/dist/chunk-5MHMDLZD.mjs +0 -4
  430. package/dist/chunk-64K7IPLO.mjs +0 -255
  431. package/dist/chunk-6QXGZM36.mjs +0 -8
  432. package/dist/chunk-6RGJOMJP.mjs +0 -16
  433. package/dist/chunk-AJ73XJF3.mjs +0 -2
  434. package/dist/chunk-AUZGSZJH.mjs +0 -13
  435. package/dist/chunk-BFE45AKL.mjs +0 -2
  436. package/dist/chunk-BXO2ZY5P.mjs +0 -2
  437. package/dist/chunk-CEH4MRCC.mjs +0 -2
  438. package/dist/chunk-CY2FNNAB.mjs +0 -16
  439. package/dist/chunk-DFUDV4LX.mjs +0 -2
  440. package/dist/chunk-DKXG4XDG.mjs +0 -2
  441. package/dist/chunk-EZQ34M3F.mjs +0 -124
  442. package/dist/chunk-EZY3WC6Z.mjs +0 -15
  443. package/dist/chunk-FUKQNOQS.mjs +0 -9
  444. package/dist/chunk-JPOSLGOC.mjs +0 -6
  445. package/dist/chunk-JVHHHGEA.mjs +0 -3
  446. package/dist/chunk-L3QKH4OK.mjs +0 -26
  447. package/dist/chunk-LAE5NQ4B.mjs +0 -2
  448. package/dist/chunk-LEF6DRCK.mjs +0 -59
  449. package/dist/chunk-NO5NJCHO.mjs +0 -2
  450. package/dist/chunk-NQPVAU63.mjs +0 -2
  451. package/dist/chunk-NSKUTQ5J.mjs +0 -5
  452. package/dist/chunk-O35FIXRB.mjs +0 -2
  453. package/dist/chunk-P2CAZPDP.mjs +0 -3
  454. package/dist/chunk-PL6GHLGD.mjs +0 -15
  455. package/dist/chunk-QJIR2BLP.mjs +0 -6
  456. package/dist/chunk-QUPLVPB2.mjs +0 -7
  457. package/dist/chunk-R7BNENLY.mjs +0 -4
  458. package/dist/chunk-S6O4UHLC.mjs +0 -2
  459. package/dist/chunk-SGJWQKEI.mjs +0 -2
  460. package/dist/chunk-TX6JH7TR.mjs +0 -2
  461. package/dist/chunk-TYK6VNAB.mjs +0 -10
  462. package/dist/chunk-UALRNVSE.mjs +0 -4
  463. package/dist/chunk-V3HXVQEM.mjs +0 -2
  464. package/dist/chunk-V5VXUJKG.mjs +0 -2
  465. package/dist/chunk-VBXMADMP.mjs +0 -2
  466. package/dist/chunk-VNV55RUA.mjs +0 -2
  467. package/dist/chunk-VPD2PS35.mjs +0 -2
  468. package/dist/chunk-W4VKN3GF.mjs +0 -7
  469. package/dist/chunk-W5BXXPDJ.mjs +0 -3
  470. package/dist/chunk-XUNHRCOG.mjs +0 -6
  471. package/skill/references/building-components.md +0 -367
  472. package/web/assets/index-Bh74DfsV.css +0 -1
  473. package/web/assets/index-UW0RyFFt.js +0 -13
@@ -0,0 +1,28 @@
1
+ # 天气 (gallery-soft/weather)
2
+
3
+ A card for a custom page (its places are `page`): a city's weather now (the sky's picture and words, the temperature, today's highest and lowest, how it feels, the humidity and the wind) and, on a tall card, the next five days. The data comes from Open-Meteo (open-meteo.com), which needs no key. Use it when the user asks for the weather on a page, its home page among them.
4
+
5
+ It is 柔光风格's (the pack `gallery-soft`, off until the user turns it on in 设置 › 组件列表): the same card as Gallery 风格's `gallery/weather`, its settings, its data and what the user does on it the same, in the soft look of design A (a faint wash of blue from the card's top, rounded chips, big numbers). Write it only where the user asked for 柔光风格 or the page already holds its cards.
6
+
7
+ ## Settings
8
+
9
+ Its two settings are the card's form, which the user opens from the grip at the card's top right › 设置…:
10
+
11
+ | Key | Label | Type | What it is |
12
+ | --- | --- | --- | --- |
13
+ | `city` | 城市 | text | the city, as the user names it: 上海, 杭州, Berlin; looked up by that name, its first match taken |
14
+ | `unit` | 单位 | select | `℃` (the default) or `℉` |
15
+
16
+ They are kept in its data part `settings`, a `<script type="application/json">`, as example.html does: `{"city":"上海","unit":"℃"}` (on one line and compact, as the card's 设置… writes it back). The city is the one setting it cannot show anything without (`required` in its manifest): when the user did not say which, ask them, or take it from what the workspace says of where they live (写作偏好, the documents; a trip is not a home: ask when that is a guess), and tell them in the handoff which you did; never hand over a card with no city unsaid. `gallery page add <slug> gallery-soft/weather --set city=上海` writes it with the add (`--set unit=℉` the unit); for a card already there, write the city in its settings part. `{}` (template.html, what a menu adds) is a card with no city yet, which asks for one (右上角手柄 › 设置…), and `gallery page check` notes it. The block reads them and writes nothing.
17
+
18
+ ## Going online
19
+
20
+ Its needs name the two hosts it reaches, `net:api.open-meteo.com` (the weather) and `net:geocoding-api.open-meteo.com` (a city's name to its coordinates). Gallery fetches nothing for it until the user allows those: the card then shows 允许访问 api.open-meteo.com 等 2 个网站, a press of which opens Gallery's consent dialog, and the card fetches once the user says yes. Tell the user so when you put the card on a page ("点卡片上的「允许访问」"). They can take it back in 设置 › 组件列表 (允许联网). Never write the consent into gallery.json yourself: it is the user's to give.
21
+
22
+ ## How to write it
23
+
24
+ Put it on a custom page as a card of its board, `<section class="gallery-card" data-card-id="…" data-x data-y data-w data-h>`, holding one instance, after `gallery block add gallery-soft/weather`, the instance as template.html has it, then its settings as above (`gallery page add <slug> gallery-soft/weather` does the card for you). Sizes: 4 × 2 (the default: now, the range and how it feels, the humidity and the wind), 2 × 2 (the temperature and the sky alone) and 4 × 4 (and the next five days).
25
+
26
+ ## How it looks
27
+
28
+ The city beside a pin's chip and when the weather was fetched (更新于 14:05) at the top, the sky's picture in its own colors (the sun, a cloud and its shade, rain) and the temperature large beside it, the sky's words and the range beside them, the humidity and the wind under them after small pictures (on a 4 × 4 card how it feels too, and the next five days under a hairline, each its sky and its lowest and highest at the ends of a bar drawn against the whole five, warm toward the top, now ringed on today's); a 2 × 2 card the temperature beside the picture, the sky's words and the range under them; in 柔光风格's soft look (as every card of it: a faint wash of blue from the card's top, a head of a rounded tinted chip and a title, its end clear of the card's grip), light and dark. It is fetched again when its settings change and every 30 minutes. While there is nothing to show it says why on a soft disc: 写上一个城市 (no city), 找不到「…」 (a name Open-Meteo does not know), 允许联网之后显示天气 (waiting for the user's consent, the kit's button over it), 现在连不上网,取不到天气 (no network, and nothing fetched before), 网络设置把天气服务指向了本地地址 (this computer's network setup gives Open-Meteo's names an address of this computer or of a private network, which Gallery refuses). The script runs with the rights of the page's own scripts, as any block's does.
package/release.json CHANGED
@@ -1,25 +1,27 @@
1
1
  {
2
2
  "name": "@heycys/gallery",
3
- "version": "0.1.1",
4
- "built": "2026-11-07T19:54:21.173Z",
3
+ "version": "0.2.0",
4
+ "built": "2026-11-10T06:00:12.267Z",
5
5
  "stamps": {
6
- "editor": "7973798600a49543",
6
+ "editor": "730eb4fe396a3d82",
7
7
  "kit": {
8
- "styles": "352e294997d57222",
8
+ "styles": "90714ca047271da8",
9
9
  "katex-styles": "81d0a0b4dcb41846",
10
- "runtime": "5f0ec1aab5218879",
11
- "code": "0a5cdb6e4d87b122",
12
- "state": "48e779637984ca20",
10
+ "runtime": "ccf037942f0fee28",
11
+ "code": "f893c8b464096161",
12
+ "state": "d4a528bd33704119",
13
13
  "sheets": "fda7b7b754e01019",
14
14
  "tokens": "a218d5d5f9008530",
15
- "ui": "c2df5a6e42253acc",
15
+ "ui": "6ab6d809a853b59a",
16
16
  "dialogs": "42866e832540bf9f",
17
17
  "katex": "1b0a973a02ab84f0",
18
18
  "katex-auto-render": "63e7162ddec186d6",
19
19
  "math": "af1582414dca108c",
20
20
  "d3": "9f5a21b6070f8353",
21
- "charts": "ae38e5e52ab30cef",
22
- "tables": "5138346c9a693efb"
21
+ "charts": "22bde4e5900579fe",
22
+ "tables": "f776dc063389a916",
23
+ "board-styles": "338f6b6b6145b4dc",
24
+ "board": "15007a0cd8566621"
23
25
  }
24
26
  }
25
27
  }
package/sdk/doc-kit.d.ts CHANGED
@@ -4,15 +4,21 @@ import type { DocState } from "./doc-state.js";
4
4
  * What an instance can hear (`on`). `editable`: `context.canEdit()` has just become true, for one mounted before the page came to edit.
5
5
  * `content`: a change inside the instance, heard only with `owns: false`, as what a component owns the
6
6
  * kit does not watch; a change of what the file says of it is `source`, whatever it owns: of a part edited
7
- * as text or data, or of the blocks a slot holds (a part edited as flow), typed, moved in or out, undone.
7
+ * as text or data, or of the blocks a slot holds (a part edited as flow), typed, moved in or out, undone,
8
+ * an attribute that says something of the file among them (a to-do item checked, a cell's spans, a look
9
+ * class), none an instance among those blocks draws; told in the next frame, a frame's changes in one.
10
+ * `clock`: each whole minute of the reader's clock, its detail "minute", or "day" for the first of a day.
11
+ * `data`: what the workspace holds changed, its detail the kind (`"todos"`, `"recent"`, `"stats"`, `"activity"`):
12
+ * heard for the kinds this instance read with `context.workspace.query`; read it again then. For a view of a
13
+ * table (the manifest's needs hold `"tables"`) the detail is `"table"`: the rows of the table it reads changed.
8
14
  */
9
- export type DocComponentSignal = "source" | "resize" | "theme" | "layout" | "viewport" | "fonts" | "content" | "reveal" | "editable";
15
+ export type DocComponentSignal = "source" | "resize" | "theme" | "layout" | "viewport" | "fonts" | "content" | "reveal" | "editable" | "clock" | "data";
10
16
 
11
17
  /** What a component's `mount` returns, all of it optional. */
12
18
  export interface DocComponentHandle {
13
19
  /**
14
20
  * A signal it asked for (`on`). `detail`: the mutation records of `source` and `content`; the faces of a
15
- * later `fonts`. `options.quiet`: on `content`, a change that leaves the page looking as it was.
21
+ * later `fonts`; of `data`, the kind that changed ("table": the rows of the table a view reads). `options.quiet`: on `content`, a change that leaves the page looking as it was.
16
22
  */
17
23
  update?(reason: DocComponentSignal, detail?: unknown, options?: { quiet?: boolean }): void;
18
24
  /** The host left the page. What listens on `context.signal` goes by itself. */
@@ -28,6 +34,257 @@ export interface DocComponentStateOptions<T extends Record<string, unknown>> {
28
34
  transientKeys?: Array<keyof T & string>;
29
35
  }
30
36
 
37
+ /** A link a row's cells hold to a document of the workspace, or to a block of one. */
38
+ export interface DocRowLink {
39
+ /** The document's folder name: of this document for a link within it. */
40
+ slug: string;
41
+ /** The link's words. */
42
+ title: string;
43
+ /** The block's id, or null for the document. */
44
+ block: string | null;
45
+ }
46
+
47
+ /** A row of a table a part holds (`context.rows`), or of the table a view reads (`context.table()`), as it reads it when it is asked. */
48
+ export interface DocRow {
49
+ /** The row on the page: read it, never write it (a write is `add`, `move`, `remove`, and a view's `set`). */
50
+ readonly el: HTMLTableRowElement;
51
+ /** Its values by the header's words: a number where a cell writes one, its words, or null for none (as a chart drawn from a table reads them). */
52
+ readonly values: Readonly<Record<string, string | number | null>>;
53
+ /** The links its cells hold to documents. */
54
+ readonly links: readonly DocRowLink[];
55
+ }
56
+
57
+ /**
58
+ * The rows of the table a part is or holds, read when `context.rows` is called: its header's words and
59
+ * the rows of its body. Each write is one `context.edit` of the part, one undo step, false where it
60
+ * was not taken, as `edit`'s; a row added, moved or removed takes the blank before it along, so a table
61
+ * written a row a line stays so. Read the rows again after a write: on `source`.
62
+ */
63
+ export interface DocRowSet {
64
+ /** The header's words, in order. */
65
+ readonly columns: readonly string[];
66
+ readonly rows: readonly DocRow[];
67
+ /** A row of these values (by the header's words; a name the header does not have throws), after `at.after`, or last. */
68
+ add(values: Record<string, string>, at?: { after?: DocRow }): boolean;
69
+ /** `row` put before `to.before`, or after `to.after`, its cells of `to.values` set in the same write (a card dropped in another column: its status and its place); neither leaves it where it is. */
70
+ move(row: DocRow, to: { before?: DocRow; after?: DocRow; values?: Record<string, string> }): boolean;
71
+ /** `row` taken out. */
72
+ remove(row: DocRow): boolean;
73
+ }
74
+
75
+ /**
76
+ * The table of the document a view reads (`context.table()`, for a block whose manifest's needs hold
77
+ * "tables", bound to the table by the key on its instance, data-doc-from, which the table's frame carries
78
+ * as data-doc-chart-source), read when it is called, in the file's order (a reader's sort of the table
79
+ * leaves it): its header's words and its rows of data, as a chart drawn from the table reads them. A row
80
+ * is the same object until it, or the header, changes, so that a view keeps what it drew of a row while
81
+ * that row is the same. No write is a write of the view's: `set`, `add`, `move` and `remove` each ask
82
+ * the page editor, which changes the table as its own tools do (one undo step; a cell's words merged word
83
+ * by word with someone else's, a row moved, put in or taken out held back as a conflict where the table
84
+ * changed meanwhile), and answer whether it did: false in an export, in 演示视图, before the page edits,
85
+ * for a table the editor's tools do not manage (one with merged cells, or not written as the kit writes
86
+ * one), and for a row no longer in the table; a name the header does not have throws. Its own sort and
87
+ * filter a view keeps in `context.state`, never in the table.
88
+ */
89
+ export interface DocTableView extends DocRowSet {
90
+ /** Whether the page editor would take a change of this table now, asked with no change: false where every change answers false whatever it is (an export, 演示视图, before the page edits, a table the editor's tools do not manage: a `<tfoot>`, rows of other lengths), so that a view shows it read-only. */
91
+ canEdit(): boolean;
92
+ /** One cell's words: the cell of `column` (a name of the header) in `row`. */
93
+ set(row: DocRow, column: string, text: string): boolean;
94
+ /** `listener` called once a change of the page leaves the table's rows other than they were (a cell typed in, a row added, moved or taken out, the table or the view's key changed); the function returned takes it off, as the instance's end does. A view that hears `data` (detail "table") needs none. */
95
+ subscribe(listener: () => void): () => void;
96
+ }
97
+
98
+ /** A card's size on a custom page: in the grid's cells as the board draws it (1 to 12 wide, no more than the board's columns, 4 on a narrow window; 1 to 24 high), and in pixels, what the card holds inside its padding. */
99
+ export interface DocComponentSize {
100
+ w: number;
101
+ h: number;
102
+ width: number;
103
+ height: number;
104
+ }
105
+
106
+ /** Where a to-do stands, what names it to its document whether or not its item has a block id. */
107
+ export interface DocTodoRef {
108
+ /** Its document's folder name. */
109
+ slug: string;
110
+ /** Its item's block id (data-block-id), or null for one written with none yet. */
111
+ block: string | null;
112
+ /** Its words. */
113
+ text: string;
114
+ /** The headings it stands under, the outermost first. */
115
+ path: string[];
116
+ /** Which of the to-dos of the same words under the same path it is, 0 the first. */
117
+ nth: number;
118
+ /** The version of its document's file it was read from (a hash), by which a check finds it by its place while the file is still that one; null where none is known. */
119
+ version?: string | null;
120
+ }
121
+
122
+ /** A to-do of a document of the workspace (`workspace.query("todos")`): an item of a to-do list. */
123
+ export interface DocTodo {
124
+ ref: DocTodoRef;
125
+ /** Its words. */
126
+ text: string;
127
+ /** Checked. */
128
+ done: boolean;
129
+ /** Its document's folder name and title. */
130
+ slug: string;
131
+ title: string;
132
+ /** The headings it stands under, the outermost first. */
133
+ path: string[];
134
+ }
135
+
136
+ /** A document of the workspace as `workspace.query("recent")` lists it, the one edited last first. */
137
+ export interface DocRecentDocument {
138
+ slug: string;
139
+ title: string;
140
+ /** Its page icon as its doc.json writes it (an emoji, or an icon's or a picture's value), or null. */
141
+ icon: string | null;
142
+ /** When its file was last written, an ISO time. */
143
+ edited: string;
144
+ }
145
+
146
+ /** The workspace's counts (`workspace.query("stats")`). */
147
+ export interface DocWorkspaceStats {
148
+ /** Its documents (not the 写作偏好 page, nor a custom page). */
149
+ documents: number;
150
+ /** Its to-dos, checked and all. */
151
+ todos: { done: number; total: number };
152
+ /** The words of all its documents. */
153
+ words: number;
154
+ /** How many documents were written since this week's Monday, 0:00. */
155
+ editedThisWeek: number;
156
+ }
157
+
158
+ /** A day of the workspace's record of edits (`workspace.query("activity")`), of every document. */
159
+ export interface DocActivityDay {
160
+ /** YYYY-MM-DD, the server's local day. */
161
+ date: string;
162
+ /** The writes that changed a document that day. */
163
+ edits: number;
164
+ /** The net change of words that day (below 0 where more went than came). */
165
+ words: number;
166
+ /** Of those, the reader's own (their commits on the page) and the Agent's (any other write). */
167
+ reader: { edits: number; words: number };
168
+ agent: { edits: number; words: number };
169
+ }
170
+
171
+ /** A row of a table of a document as `workspace.query("table")` gives it: its values by the header's words, the links its cells hold to documents. */
172
+ export interface DocWorkspaceRow {
173
+ values: Record<string, string | number | null>;
174
+ links: { slug: string; title: string; block: string | null }[];
175
+ }
176
+
177
+ /** What `workspace.query("table")` gives: the header's words, the rows asked for (the first `limit`), and how many rows matched in all. */
178
+ export interface DocWorkspaceTable {
179
+ columns: string[];
180
+ rows: DocWorkspaceRow[];
181
+ total: number;
182
+ }
183
+
184
+ /** What `workspace.query` resolves to: its data, and when it was read (an ISO time; in an exported file, when the export was made). */
185
+ export interface DocWorkspaceAnswer<T> {
186
+ data: T;
187
+ at: string;
188
+ }
189
+
190
+ /**
191
+ * What a block reads of the workspace, where its manifest's `needs` hold `"workspace"` (no consent asked:
192
+ * it is the user's own). A query that cannot be answered rejects with an Error whose `code` says why, one
193
+ * of these and never another: "offline" (an exported file whose export kept none of it, or a server that does
194
+ * not answer: show that the data is Gallery's), "failed" (the server answered and could not read it: show
195
+ * that it could not be read), "missing" (`table`: no such document, no table of that key in it, or one with
196
+ * merged cells), "kind", "options", "unsupported" (which no server of this version says). In an exported
197
+ * file each kind is answered from what the export embedded (to-dos 200 at most, documents 50, the tables
198
+ * the document's blocks asked for), `at` the export's time: say "截至 …" with it.
199
+ */
200
+ export interface DocWorkspace {
201
+ /** The to-dos of the documents, of those edited last first, each in its document's order (`limit` default 200, at most 1000). */
202
+ query(kind: "todos", options?: { done?: boolean; slugs?: string[]; limit?: number }): Promise<DocWorkspaceAnswer<DocTodo[]>>;
203
+ /** The documents edited last (`limit` default 10, at most 50). */
204
+ query(kind: "recent", options?: { limit?: number }): Promise<DocWorkspaceAnswer<DocRecentDocument[]>>;
205
+ query(kind: "stats", options?: Record<string, never>): Promise<DocWorkspaceAnswer<DocWorkspaceStats>>;
206
+ /** The last `days` days to today (default 365, at most 371: 53 weeks, as long as the record is kept), a day of none 0, from the day the record started at the earliest. */
207
+ query(kind: "activity", options?: { days?: number }): Promise<DocWorkspaceAnswer<DocActivityDay[]>>;
208
+ /** A keyed table of a document (its frame's data-doc-chart-source), read-only: its rows whose cells hold the words `where` names (`limit` default 200, at most 1000). A column the table does not have rejects with "options". */
209
+ query(kind: "table", options: { slug: string; key: string; where?: Record<string, string>; limit?: number }): Promise<DocWorkspaceAnswer<DocWorkspaceTable>>;
210
+ /** Open a document (at a block of it) or a custom page where the page is shown: the workbench, else the page itself goes there; nothing in an exported file. */
211
+ open(target: { slug: string; block?: string | null } | { page: string }): void;
212
+ /**
213
+ * Check (`done` true) or clear a to-do of a document, by the ref `query("todos")` gave: the server writes that
214
+ * document as the reader's edit (an open page of it merges it; on a custom page, its undo checks it back).
215
+ * Resolves to whether it changed the document (false: it said so already). Rejects with `code`: "changed"
216
+ * (the item is not as read: its words changed, or it is gone; read again), "ambiguous" (several items alike
217
+ * and the file changed since), "locked" (the item is there, where the document's own page cannot check it: in a table cell, in a block of the document's own), "missing", "busy", "offline" (nothing on the page writes the workspace),
218
+ * "ref", "failed". Not there in an exported file: test `if (workspace.setTodo)` and draw the boxes read-only.
219
+ */
220
+ setTodo?(ref: DocTodoRef, done: boolean): Promise<boolean>;
221
+ }
222
+
223
+ /** Where a drag would drop: the element the marker goes in, and the child of it the marker goes before (null: its end). */
224
+ export interface DocDropSpot {
225
+ into: Element;
226
+ before: Node | null;
227
+ }
228
+
229
+ /** What `DocKit.input` takes. */
230
+ export interface DocInputOptions {
231
+ /** Hears each value the reader is done with, once: Enter, the field left, a select changed; never while an input method composes. */
232
+ commit(value: string): void;
233
+ /** Ends what it listens to (`context.signal`). */
234
+ signal?: AbortSignal;
235
+ }
236
+
237
+ /** What `DocKit.input` returns. */
238
+ export interface DocInputHandle {
239
+ /** The value the file holds now, drawn from a part: shown unless the reader is typing another there. */
240
+ set(value: string): void;
241
+ /** The value committed last, or set. */
242
+ readonly value: string;
243
+ }
244
+
245
+ /** What `DocKit.drag` takes. */
246
+ export interface DocDragOptions<S extends DocDropSpot> {
247
+ /** What a press starts a drag on, a selector inside the area. */
248
+ items: string;
249
+ /** Where in an item a press starts one, a selector (default: anywhere in it). */
250
+ handle?: string;
251
+ /** How far, in pixels, a press moves before it is a drag (default 4). */
252
+ threshold?: number;
253
+ /** Whether a drag may start now (default: always): `() => context.canEdit()`. */
254
+ enabled?: () => boolean;
255
+ /** An element of the component's that stands where a drop would go, while one would. */
256
+ marker?: Element | null;
257
+ /** Where a drop at (x, y), the pointer's place in the window, goes, or null for nowhere. */
258
+ over(x: number, y: number, item: HTMLElement): S | null;
259
+ /** The item released over a spot: the write, one `context.edit`. */
260
+ drop(item: HTMLElement, spot: S): void;
261
+ /** Ends what it listens to (`context.signal`). */
262
+ signal?: AbortSignal;
263
+ }
264
+
265
+ /** What `DocKit.drag` returns. */
266
+ export interface DocDragHandle {
267
+ /** Give up a drag going on, as Escape does: nothing dropped. */
268
+ cancel(): void;
269
+ /** Whether an item is being dragged. */
270
+ readonly dragging: boolean;
271
+ }
272
+
273
+ /** A row of `DocKit.choose`'s menu: `[value, words]`, `{ value, label?, disabled? }`, a bare string (its own value and words), or `{ group }`, a heading that is no row. */
274
+ export type DocChoice = [value: string, label: string] | { value: string; label?: string; disabled?: boolean } | { group: string } | string;
275
+
276
+ /** What `DocKit.choose` takes. */
277
+ export interface DocChooseOptions {
278
+ /** The rows of the menu, in order. */
279
+ options: DocChoice[];
280
+ /** The value checked (and lit first), if any. */
281
+ value?: string | null;
282
+ /** The menu's name for a screen reader. */
283
+ label?: string;
284
+ /** Closes the menu without a choice when it aborts (`context.signal`). */
285
+ signal?: AbortSignal;
286
+ }
287
+
31
288
  /** What `mount` is given for a package's instance. */
32
289
  export interface DocComponentContext {
33
290
  /** The instance's element. */
@@ -70,6 +327,92 @@ export interface DocComponentContext {
70
327
  * two that are one element, or one in the other, throw.
71
328
  */
72
329
  edit<P extends string | string[]>(part: P, change: (draft: P extends string[] ? Record<string, HTMLElement> : HTMLElement) => void): boolean;
330
+ /**
331
+ * What a part holds, parsed as JSON (a script of data's), JSON's null too; undefined where there is
332
+ * nothing to read: an optional part the instance does not hold, and one that holds no JSON, which
333
+ * fails the instance, as `fail` does.
334
+ */
335
+ readJSON(part: string): any;
336
+ /**
337
+ * `edit` of a part of JSON: `change` is handed what it holds, parsed, and changes it, or returns what is
338
+ * to stand there instead. Written back as it was laid out (on one line where it was on one, else a line
339
+ * an entry, but for an object or a list of values alone), so that a change of one value changes its
340
+ * line; a change that leaves the value as it was writes nothing. Returns what `edit` returns.
341
+ */
342
+ editJSON(part: string, change: (draft: any) => any): boolean;
343
+ /** The rows of the table a part is or holds, or null for none, or one with a cell spanning others. */
344
+ rows(part: string): DocRowSet | null;
345
+ /**
346
+ * The table of the document this instance is a view of (its data-doc-from), for a block whose
347
+ * manifest's needs hold "tables": null with none (no key, no table carries it, a cell spanning others),
348
+ * on a custom page, and for a block whose needs do not hold "tables" (the console says so once).
349
+ */
350
+ table(): DocTableView | null;
351
+ /** `setInterval`, cleared as the instance ends; what it runs is the instance's (its failure the instance's). */
352
+ interval(run: () => void, ms: number): number;
353
+ /** `setTimeout`, cleared as the instance ends; what it runs is the instance's. */
354
+ timeout(run: () => void, ms: number): number;
355
+ /** `addEventListener`, removed as the instance ends (or as `options.signal` aborts). */
356
+ listen<K extends keyof WindowEventMap>(target: Window, type: K, listener: (event: WindowEventMap[K]) => void, options?: AddEventListenerOptions | boolean): void;
357
+ listen<K extends keyof DocumentEventMap>(target: Document, type: K, listener: (event: DocumentEventMap[K]) => void, options?: AddEventListenerOptions | boolean): void;
358
+ listen<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (event: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions | boolean): void;
359
+ listen(target: EventTarget, type: string, listener: (event: Event) => void, options?: AddEventListenerOptions | boolean): void;
360
+ /** Where the instance is: a document as Gallery shows it, a custom page, or an exported file (where nothing writes). */
361
+ readonly place: "document" | "page" | "export";
362
+ /** Its card's size on a custom page, read when asked (`layout` says it changed); null anywhere else. */
363
+ readonly size: DocComponentSize | null;
364
+ /** What it reads of the workspace: there where its manifest's `needs` hold `"workspace"`, else undefined. `data` says what it read changed. */
365
+ readonly workspace?: DocWorkspace;
366
+ /**
367
+ * The web, for a block whose manifest's needs name the host ("net:<host>", "net:*.<host>" for the names
368
+ * under it): an absolute http or https address on it, asked of Gallery's server, which fetches it (a GET,
369
+ * no cookie, the answer JSON or text, 512 KB at most), keeps it a minute and keeps what it got for when
370
+ * the network is not there. `as`: "json" (the default: `data` is its JSON) or "text". `{key}` in the
371
+ * address is where the server writes the workspace's key for that host (gallery block key), which no
372
+ * page ever holds. Resolves with the answer and when it was fetched (`cached`: given from what was kept,
373
+ * which may be old where the network is not there). Rejects with a DocFetchError: "consent" until the
374
+ * reader allows it, on the card the kit then shows 允许访问 <host> on (draw your own state too, and the
375
+ * instance starts again once the reader says yes or takes it back). In an exported file nothing is
376
+ * fetched: what the export embedded of the address, or "offline", for the block to show a placeholder.
377
+ * Not there for a block whose needs name no host of the net (declared here as always there, so that a
378
+ * block that names one need not ask).
379
+ */
380
+ fetch(url: string, options?: { as?: "json" | "text" }): Promise<DocFetchAnswer>;
381
+ }
382
+
383
+ /** What `context.fetch` resolves with. */
384
+ export interface DocFetchAnswer {
385
+ /** The answer's JSON (as "json") or its text (as "text"). */
386
+ data: any;
387
+ /** When it was fetched, an ISO time. */
388
+ at: string;
389
+ /** Whether it was given from what was kept, not fetched now. */
390
+ cached: boolean;
391
+ }
392
+
393
+ /** Why `context.fetch` was refused: its `code`. */
394
+ export type DocFetchCode = "consent" | "host" | "url" | "private" | "key" | "rate" | "status" | "type" | "too-large" | "offline" | "missing";
395
+
396
+ /** What `context.fetch` rejects with. */
397
+ export interface DocFetchError extends Error {
398
+ /**
399
+ * consent: the reader has not allowed it yet; host: its needs do not name the address's host (or a
400
+ * redirect's); url: no address it may ask for (not http(s), another port, a user in it), its own or a
401
+ * redirect's (or a redirect to an address that does not parse); private: the host is this computer or
402
+ * a private network as this computer's resolver answered it, with no proxy of this computer to take
403
+ * its name (usually the reader's network setup, not the block: the message names the address); key:
404
+ * the address names `{key}` and the workspace has none for that host; rate: too many fetches a
405
+ * minute; status: the site answered an error (`status`);
406
+ * type: no JSON or text (or no JSON asked as JSON); too-large: more than 512 KB; offline: the network
407
+ * or the site not reached, and nothing kept (in an exported file: nothing embedded); missing: the block does not load.
408
+ */
409
+ code: DocFetchCode;
410
+ /** The hosts of its needs the reader has not allowed yet (consent). */
411
+ hosts?: string[];
412
+ /** The host refused (host, private, key). */
413
+ host?: string;
414
+ /** The site's status (status). */
415
+ status?: number;
73
416
  }
74
417
 
75
418
  /** What a package's kit.js registers. */
@@ -92,7 +435,7 @@ export interface DocComponent {
92
435
  */
93
436
  dehydrate?(host: HTMLElement): void;
94
437
  /**
95
- * A small edit, as a reader's gesture would make it, by `context.edit`: what `gallery component check`
438
+ * A small edit, as a reader's gesture would make it, by `context.edit`: what `gallery block check`
96
439
  * calls to try the way back to the file. Nothing else calls it.
97
440
  */
98
441
  example?(host: HTMLElement, context: DocComponentContext): void;
@@ -107,6 +450,30 @@ declare global {
107
450
  type DocComponentSignal = import("./doc-kit.js").DocComponentSignal;
108
451
  /** What kit.js registers. */
109
452
  type DocComponent = import("./doc-kit.js").DocComponent;
453
+ /** A row of a table a part holds (`context.rows`). */
454
+ type DocRow = import("./doc-kit.js").DocRow;
455
+ /** The rows of a table a part holds (`context.rows`). */
456
+ type DocRowSet = import("./doc-kit.js").DocRowSet;
457
+ /** The table of the document a view reads (`context.table()`). */
458
+ type DocTableView = import("./doc-kit.js").DocTableView;
459
+ /** A card's size on a custom page (`context.size`). */
460
+ type DocComponentSize = import("./doc-kit.js").DocComponentSize;
461
+ /** Where a drag would drop (`DocKit.drag`'s `over`). */
462
+ type DocDropSpot = import("./doc-kit.js").DocDropSpot;
463
+ /** What `context.fetch` resolves with. */
464
+ type DocFetchAnswer = import("./doc-kit.js").DocFetchAnswer;
465
+ /** What `context.fetch` rejects with: its `code` says why. */
466
+ type DocFetchError = import("./doc-kit.js").DocFetchError;
467
+ /** What a block reads of the workspace (`context.workspace`), and what it gives. */
468
+ type DocWorkspace = import("./doc-kit.js").DocWorkspace;
469
+ type DocTodo = import("./doc-kit.js").DocTodo;
470
+ type DocTodoRef = import("./doc-kit.js").DocTodoRef;
471
+ type DocWorkspaceRow = import("./doc-kit.js").DocWorkspaceRow;
472
+ type DocWorkspaceTable = import("./doc-kit.js").DocWorkspaceTable;
473
+ type DocRecentDocument = import("./doc-kit.js").DocRecentDocument;
474
+ type DocWorkspaceStats = import("./doc-kit.js").DocWorkspaceStats;
475
+ type DocActivityDay = import("./doc-kit.js").DocActivityDay;
476
+ type DocWorkspaceAnswer<T> = import("./doc-kit.js").DocWorkspaceAnswer<T>;
110
477
  }
111
478
 
112
479
  /** How much the kit runs now. */
@@ -135,13 +502,37 @@ export interface DocKitApi {
135
502
  quietly<T>(change: () => T): T;
136
503
  /** Take what the kit and its components left off `root`, a copy of the page. */
137
504
  dehydrate<T extends Element>(root: T): T;
138
- /** The component on `host` makes its `example` of an edit, as `gallery component check` asks it. Whether it has one. */
505
+ /** The component on `host` makes its `example` of an edit, as `gallery block check` asks it. Whether it has one. */
139
506
  example(host: Element): boolean;
140
507
  /** Open what hides an element, and bring it into view. */
141
508
  reveal(element: Element): void;
509
+ /**
510
+ * A field whose value goes to the file when the reader is done with it: `commit` hears it on Enter (in
511
+ * a textarea Ctrl+Enter), as the field is left or a select changes, never while an input method
512
+ * composes and never twice; Escape puts back the value committed last.
513
+ */
514
+ input(field: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement, options: DocInputOptions): DocInputHandle;
515
+ /**
516
+ * A drag of what `items` finds in `area`, by pointer events: past a threshold, a `marker` where a drop
517
+ * would go (`over`), `drop` on a release over a spot, nothing on Escape or a release elsewhere; the
518
+ * item carries the class `doc-dragging` while it moves.
519
+ */
520
+ drag<S extends DocDropSpot>(area: HTMLElement, options: DocDragOptions<S>): DocDragHandle;
521
+ /**
522
+ * The kit's menu of choices under `anchor`, a button of the block's own: the card every `<select>` of the
523
+ * page opens (flat, rounded, the chosen row checked, light and dark as the page is; ↑ ↓ Enter, a letter, Esc).
524
+ * Resolves with the value chosen, or null when it is dismissed (Esc, a press outside, `signal`, the anchor
525
+ * leaving the page); called again on the anchor of a menu that is open, it closes it. Never the browser's
526
+ * popup: a `<select>` needs no call (the kit opens this menu for it), and a menu a block draws itself is not
527
+ * to look like the browser's.
528
+ */
529
+ choose(anchor: Element, options: DocChooseOptions): Promise<string | null>;
530
+
142
531
  stats(): DocKitStats;
143
532
  /** The keys of the page's bound controls. */
144
533
  readonly bindings: unknown;
145
534
  /** The selectors of the elements blocks stand in. */
146
535
  readonly flows: readonly string[];
536
+ /** The tables of the page a key names, as the kit's charts drawn from a table and the views of one read them: the kit's own (a view reads its table by `context.table()`). */
537
+ readonly tables: unknown;
147
538
  }
@@ -27,6 +27,8 @@ export interface DocStateOptions<T extends Record<string, unknown>> {
27
27
  defaults: T;
28
28
  /** Overrides the browser storage key; normally left out. */
29
29
  storageKey?: string;
30
+ /** A name the state was kept under before (a component's instance before it had a block id): read when nothing is kept under `id`, and carried to it. */
31
+ formerId?: string;
30
32
  /** Default: []; excluded from browser restoration and exported snapshots. */
31
33
  transientKeys?: Array<keyof T & string>;
32
34
  }