@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
package/kit/state.js CHANGED
@@ -117,7 +117,15 @@
117
117
  const storageKey = options.storageKey || `gallery:${key}${scopeSuffix}`;
118
118
  const storage = storageFor(storageKey);
119
119
  if (!options.storageKey) carryOldState(storage, storageFor(`html-report-studio:${key}${scopeSuffix}`), matches, version);
120
- const restored = parseStored(storage.read(), matches, version) || embeddedState(matches, version) || {};
120
+ // What it was kept under before (`formerId`: a component's instance, by its markup until it had a
121
+ // block id), read when nothing is kept under its own name, and carried to it at once, so that the
122
+ // reader's choice outlives the name, and the carry is done once.
123
+ const former = typeof options.formerId === "string" && options.formerId && !options.storageKey && scoped(options.formerId) !== key ? scoped(options.formerId) : null;
124
+ const formerMatches = (other) => typeof other === "string" && scoped(other) === former;
125
+ const own = parseStored(storage.read(), matches, version);
126
+ const carried = own || !former ? null : parseStored(storageFor(`gallery:${former}${scopeSuffix}`).read(), formerMatches, version);
127
+ const embedded = own || carried ? null : embeddedState(matches, version) || (former ? embeddedState(formerMatches, version) : null);
128
+ const restored = own || carried || embedded || {};
121
129
  const state = Object.assign(Object.create(null), defaults);
122
130
  for (const [key, value] of Object.entries(restored)) {
123
131
  if (!transientKeys.has(key)) state[key] = clone(value);
@@ -140,6 +148,7 @@
140
148
  const snapshot = clone(state);
141
149
  for (const listener of listeners) listener(clone(snapshot), change);
142
150
  }
151
+ if (carried) persist();
143
152
 
144
153
  const api = {
145
154
  id,
package/kit/tables.js CHANGED
@@ -385,7 +385,7 @@
385
385
  }
386
386
 
387
387
  // src/shared/components/page.mjs
388
- var LOOK_ATTRIBUTES = Object.freeze({ font: "data-doc-font", size: "data-doc-size", spacing: "data-doc-spacing", width: "data-doc-measure" });
388
+ var LOOK_ATTRIBUTES = Object.freeze({ font: "data-doc-font", size: "data-doc-size", spacing: "data-doc-spacing", width: "data-doc-measure", full: "data-doc-width" });
389
389
  var page_default = {
390
390
  id: "page",
391
391
  match: "main.doc-page",
@@ -405,11 +405,34 @@
405
405
  classes: ["doc-page", "doc-header", "doc-kicker", "doc-title", "doc-button"],
406
406
  runtime: {
407
407
  generated: [".doc-display", "script[data-doc-state]"],
408
- root: { attrs: ["data-doc-ready", "data-doc-drawn", "data-doc-controls"] },
409
- // The reader's theme and width (ui.js), and the document's look (字体与布局: its doc.json's, put on by
410
- // the render, src/shared/document-look.mjs), which a copy of the view keeps; never written in doc.html.
411
- state: { html: ["data-doc-theme", "data-doc-width", ...Object.values(LOOK_ATTRIBUTES)] },
412
- internal: ["doc-display*", "data-doc-export-copy", "data-theme", "doc-export-id", "doc-reveal", "doc-kit-error"]
408
+ // data-doc-effective-theme: the theme the page shows now (ui.js), "light" or "dark", which a custom page's own colors go by.
409
+ // data-doc-platform: "mac" on an Apple platform (runtime/index.js sets it as the page opens), the text's color and smoothing go by it; a copy of the view lets it go, its reader's machine judges anew.
410
+ root: { attrs: ["data-doc-ready", "data-doc-drawn", "data-doc-controls", "data-doc-effective-theme", "data-doc-platform"] },
411
+ // The reader's theme (ui.js) and the document's look (字体与布局 and 全宽: its doc.json's, put on by
412
+ // the render, src/shared/document-look.mjs; the reader's own 全宽显示 is the same data-doc-width), which
413
+ // a copy of the view keeps; never written in doc.html.
414
+ state: { html: ["data-doc-theme", ...Object.values(LOOK_ATTRIBUTES)] },
415
+ internal: [
416
+ "doc-display*",
417
+ "data-doc-export-copy",
418
+ "data-theme",
419
+ "doc-export-id",
420
+ "doc-reveal",
421
+ "doc-kit-error",
422
+ "doc-net-consent*",
423
+ "data-doc-snapshot",
424
+ // A consent bar on a card under 240px of content (runtime/net.js), its line over its button.
425
+ "data-doc-net-narrow",
426
+ // The time an export's snapshot was made (its data-doc-snapshot tag's: render/net-snapshot.mjs), which context.workspace.query answers as `at`.
427
+ "data-at",
428
+ // A custom page's (no document's: src/render/page-html.mjs, the kit's board/): its cards' cells, the Agent's
429
+ // (data-x, data-y, data-w, data-h), and its boards' columns now (data-columns, board.js's).
430
+ "data-x",
431
+ "data-y",
432
+ "data-w",
433
+ "data-h",
434
+ "data-columns"
435
+ ]
413
436
  }
414
437
  };
415
438
 
@@ -421,8 +444,11 @@
421
444
  // 字体大小: 小号, 默认, 大号
422
445
  spacing: Object.freeze(["default", "compact", "loose"]),
423
446
  // 正文间距: 紧凑, 默认, 宽松
424
- width: Object.freeze(["default", "narrow", "wide"])
447
+ width: Object.freeze(["default", "narrow", "wide"]),
425
448
  // 正文宽度: 偏窄, 默认, 偏宽
449
+ // 全宽 (the 更多 menu's switch under 目录): the page at the full width of its area, whatever its 正文宽度 is; its attribute is
450
+ // the kit's own data-doc-width="full", the reader's display menu's 全宽显示 too (components/page.mjs LOOK_ATTRIBUTES)
451
+ full: Object.freeze(["default", "full"])
426
452
  });
427
453
  var SIZE_FACTOR = Object.freeze({ default: 1, small: 15 / 16, large: 18 / 16 });
428
454
  var SPACING = Object.freeze({
@@ -546,6 +572,7 @@
546
572
  frame.className = "doc-scrollbars-frame";
547
573
  node.prepend(frame);
548
574
  }
575
+ frame.style.removeProperty("width");
549
576
  const bars = { node, table, frame, y: node.querySelector(".doc-scrollbar--y"), x: node.querySelector(".doc-scrollbar--x"), timer: 0, axes: {}, noted: "", reach: 0 };
550
577
  scrollbars.set(wrapper, bars);
551
578
  wrapper.addEventListener("scroll", () => {
@@ -563,10 +590,10 @@
563
590
  const bars = scrollbars.get(wrapper);
564
591
  if (!bars) return;
565
592
  const { table } = bars;
566
- const { clientWidth: width, clientHeight: height, offsetWidth, offsetHeight } = wrapper;
593
+ const { clientWidth: width, clientHeight: height } = wrapper;
594
+ const style = getComputedStyle(wrapper);
567
595
  const content = { width: Math.max(width, table.offsetWidth), height: Math.max(height, table.offsetHeight) };
568
- setStyle(bars.frame, "width", `${offsetWidth}px`);
569
- setStyle(bars.frame, "height", `${offsetHeight}px`);
596
+ setStyle(bars.frame, "height", `${outerHeight(wrapper, style)}px`);
570
597
  const x = content.width - width > 1, y = content.height - height > 1;
571
598
  const sizes = `${width}x${height}:${content.width}x${content.height}`;
572
599
  if (width > 0 && (renote || sizes !== bars.noted)) {
@@ -574,7 +601,6 @@
574
601
  bars.reach = noteHidden(wrapper, table);
575
602
  }
576
603
  bars.node.toggleAttribute("data-more", x && wrapper.scrollLeft + width < bars.reach - 1);
577
- const style = getComputedStyle(wrapper);
578
604
  const corner = (radius, border) => Math.max(0, (parseFloat(style[radius]) || 0) - (parseFloat(style[border]) || 0));
579
605
  const header = table.tHead?.getBoundingClientRect().height || 0;
580
606
  const first = fixedFirstCell(table)?.getBoundingClientRect().width || 0;
@@ -604,6 +630,12 @@
604
630
  bars.axes.x = place(bars.x, start, end, first, width, content.width, wrapper.scrollLeft);
605
631
  }
606
632
  }
633
+ function outerHeight(element, style) {
634
+ const height = parseFloat(style.height);
635
+ if (!Number.isFinite(height)) return element.offsetHeight;
636
+ if (style.boxSizing === "border-box") return height;
637
+ return height + ["paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"].reduce((sum, name) => sum + (parseFloat(style[name]) || 0), 0);
638
+ }
607
639
  function noteHidden(wrapper, table) {
608
640
  const notes = [];
609
641
  const hides = tableHides(wrapper, table);
@@ -671,6 +703,7 @@
671
703
  var CODE_RUN_MAX = 320;
672
704
  var WIDE = "\u2014\u3000-\u30FF\u3400-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF";
673
705
  var NATIVE_BREAKS = new RegExp(`(?<=-)|(?<=[${WIDE}])|(?=[${WIDE}])`, "u");
706
+ var SUBPIXEL = 0.5;
674
707
  var layouts = /* @__PURE__ */ new WeakMap();
675
708
  var layoutObservers = /* @__PURE__ */ new WeakMap();
676
709
  var pendingLayouts = /* @__PURE__ */ new Set();
@@ -882,13 +915,32 @@
882
915
  const wrapper = wrapperOf(table);
883
916
  const sized = Boolean(wrapper) && getComputedStyle(wrapper).getPropertyValue("--doc-span-width").trim() !== "";
884
917
  const wider = sized ? Math.max(1, parseFloat(getComputedStyle(wrapper).getPropertyValue("--doc-span")) || 1) : 1;
885
- return { wrapper, sized, wider, previousWidth: wrapper?.style.width };
918
+ return { wrapper, sized, wider };
919
+ }
920
+ function innerWidth(element) {
921
+ const style = getComputedStyle(element);
922
+ const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
923
+ const border = (parseFloat(style.borderLeftWidth) || 0) + (parseFloat(style.borderRightWidth) || 0);
924
+ if (element.getClientRects?.().length > 0 && /px$/.test(style.width)) {
925
+ const width = parseFloat(style.width);
926
+ return style.boxSizing === "border-box" ? width - padding - border : width;
927
+ }
928
+ return (element.clientWidth || element.getBoundingClientRect().width - border) - padding;
929
+ }
930
+ function roomOf(element, width = null) {
931
+ const before = element.style.width;
932
+ if (width === null || before === width) return innerWidth(element);
933
+ element.style.width = width;
934
+ try {
935
+ return innerWidth(element);
936
+ } finally {
937
+ element.style.width = before;
938
+ }
886
939
  }
887
940
  function sizedInside({ wrapper, sized, wider }) {
888
941
  if (!sized) return null;
889
- wrapper.style.width = "";
890
- const style = getComputedStyle(wrapper);
891
- const inner = wrapper.clientWidth - (parseFloat(style.paddingLeft) || 0) - (parseFloat(style.paddingRight) || 0);
942
+ if (wrapper.style.width) wrapper.style.width = "";
943
+ const inner = innerWidth(wrapper);
892
944
  return inner > 0 ? { wider, inner } : null;
893
945
  }
894
946
  function frameEdges(wrapper) {
@@ -962,19 +1014,19 @@
962
1014
  table.classList.add("doc-table--auto");
963
1015
  table.style.width = `${total2}px`;
964
1016
  clearColumnMarks(table);
1017
+ let room = frameSize?.inner ?? null;
965
1018
  if (wrapper) {
966
1019
  const edges = frameEdges(wrapper);
967
1020
  setAttribute(wrapper, "data-doc-min-width", String(Math.min(total2, COLUMN_FLOOR) + edges));
968
1021
  if (!frameSize) {
969
- wrapper.style.width = "100%";
970
- const style = getComputedStyle(wrapper);
971
- const available = wrapper.clientWidth - (parseFloat(style.paddingLeft) || 0) - (parseFloat(style.paddingRight) || 0);
972
- wrapper.style.width = total2 < available ? `${total2 + edges}px` : "100%";
1022
+ room = roomOf(wrapper, "100%");
1023
+ setStyle(wrapper, "width", total2 < room ? `${total2 + edges}px` : "100%");
973
1024
  }
974
1025
  }
975
1026
  writeColgroup(table, sizes.map((width, index) => ({ width: `${width}px`, key: String(index) })));
976
1027
  layouts.set(table, sizes.map((width, index) => ({ key: String(index), kind: "compact", preferredWidth: width, softMinWidth: width, hardMinWidth: width, width, ratio: width / total2 })));
977
1028
  for (const [cell, { c, cols }] of slots?.places ?? []) markRunWrap(cell, sizes.slice(c, c + cols).reduce((sum, width) => sum + width, 0), measureCell);
1029
+ return room;
978
1030
  }
979
1031
  function raiseNarrow(widths, room, floor) {
980
1032
  const low = widths.filter((width) => width < floor).sort((a, b) => a - b);
@@ -989,12 +1041,15 @@
989
1041
  }
990
1042
  return widths.map((width) => Math.max(width, Math.min(level, floor)));
991
1043
  }
992
- function refreshLayout(table) {
1044
+ function refreshLayout(table, { observed = false } = {}) {
993
1045
  idleLayouts.delete(table);
994
1046
  const measure = createCellMeasurer(table);
995
- layOut(table, measure);
1047
+ const room = layOut(table, measure);
996
1048
  measure.done();
997
1049
  markWhole(table);
1050
+ followChain(table, room, observed);
1051
+ const watched = observedOf.get(table);
1052
+ if (watched) leftAt.set(table, new Map(watched.map((element) => [element, innerWidth(element)])));
998
1053
  const wrapper = wrapperOf(table);
999
1054
  if (wrapper) placeScrollbars(wrapper, { renote: true });
1000
1055
  }
@@ -1007,7 +1062,36 @@
1007
1062
  if (manual) return manualLayout(table, frame, manual, measure);
1008
1063
  const count = headers.length || rows[0]?.cells.length || 0;
1009
1064
  if (!count || table.tHead && table.tHead.rows.length !== 1 || spanned) return nativeLayout(table, frame);
1010
- allocatedLayout(table, frame, headers, rows, count, measure);
1065
+ return allocatedLayout(table, frame, headers, rows, count, measure);
1066
+ }
1067
+ var observedOf = /* @__PURE__ */ new WeakMap();
1068
+ var leftAt = /* @__PURE__ */ new WeakMap();
1069
+ var CHAIN_GAP = 100;
1070
+ var RETURNS_MAX = 3;
1071
+ var HOLD = 1e3;
1072
+ var chains = /* @__PURE__ */ new WeakMap();
1073
+ function followChain(table, room, observed) {
1074
+ const now = performance.now();
1075
+ const chain = chains.get(table);
1076
+ if (!observed || !chain || now - chain.at > CHAIN_GAP) {
1077
+ if (chain?.timer) clearTimeout(chain.timer);
1078
+ chains.set(table, { at: now, rooms: [room], returns: 0, held: false, timer: 0 });
1079
+ return;
1080
+ }
1081
+ const near = (other) => typeof room === "number" && typeof other === "number" && Math.abs(room - other) < SUBPIXEL;
1082
+ if (!near(chain.rooms.at(-1)) && near(chain.rooms.at(-2))) chain.returns++;
1083
+ chain.rooms = [...chain.rooms.slice(-2), room];
1084
+ chain.at = now;
1085
+ chain.held = chain.returns >= RETURNS_MAX;
1086
+ }
1087
+ function held(table) {
1088
+ const chain = chains.get(table);
1089
+ if (!chain?.held) return false;
1090
+ chain.timer ||= setTimeout(() => {
1091
+ chains.delete(table);
1092
+ queueLayout(table);
1093
+ }, Math.max(0, chain.at + HOLD - performance.now()));
1094
+ return true;
1011
1095
  }
1012
1096
  var wholeTexts = /* @__PURE__ */ new WeakMap();
1013
1097
  function markWhole(table) {
@@ -1064,21 +1148,19 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1064
1148
  table.removeAttribute("data-doc-filled");
1065
1149
  table.style.removeProperty("width");
1066
1150
  }
1151
+ return frameSize?.inner ?? null;
1067
1152
  }
1068
1153
  function allocatedLayout(table, frame, headers, rows, count, measureCell) {
1069
1154
  table.removeAttribute("data-doc-filled");
1070
- const { wrapper, sized, wider, previousWidth } = frame;
1155
+ const { wrapper, sized, wider } = frame;
1071
1156
  const parent = wrapper || table.parentElement;
1072
- if (!parent) return;
1073
- if (wrapper) wrapper.style.width = sized ? "" : "100%";
1157
+ if (!parent) return null;
1158
+ if (sized && wrapper.style.width) wrapper.style.width = "";
1074
1159
  const style = getComputedStyle(parent);
1075
1160
  const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
1076
1161
  const border = (parseFloat(style.borderLeftWidth) || 0) + (parseFloat(style.borderRightWidth) || 0);
1077
- const available = (parent.clientWidth || parent.getBoundingClientRect().width - border) - padding;
1078
- if (!(available > 0)) {
1079
- if (wrapper) wrapper.style.width = previousWidth;
1080
- return;
1081
- }
1162
+ const available = roomOf(parent, wrapper && !sized ? "100%" : null);
1163
+ if (!(available > 0)) return null;
1082
1164
  const font = fontFor(rows[0]?.cells[0] || table);
1083
1165
  const cellPadding = cellPaddingFor(getComputedStyle(rows[0]?.cells[0] || headers[0]));
1084
1166
  const measuredCells = /* @__PURE__ */ new Map();
@@ -1124,7 +1206,7 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1124
1206
  table.classList.add("doc-table--auto");
1125
1207
  table.style.width = sized && tableWidth <= available + 4 ? "100%" : `${tableWidth}px`;
1126
1208
  if (wrapper) setAttribute(wrapper, "data-doc-min-width", String(Math.ceil(result.reduce((value, column) => value + column.softMinWidth, 0) + border + padding)));
1127
- if (wrapper && !sized) wrapper.style.width = tableWidth >= available - 0.01 ? "100%" : `${tableWidth + border + padding}px`;
1209
+ if (wrapper && !sized) setStyle(wrapper, "width", tableWidth >= available - 0.01 ? "100%" : `${tableWidth + border + padding}px`);
1128
1210
  writeColgroup(table, result.map((column) => ({ width: `${column.ratio * 100}%`, key: column.key })));
1129
1211
  result.forEach((column, index) => {
1130
1212
  for (const cell of [headers[index], ...rows.map((row) => row.cells[index])].filter(Boolean)) {
@@ -1136,15 +1218,23 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1136
1218
  }
1137
1219
  });
1138
1220
  layouts.set(table, result.map((column) => ({ ...column, width: column.ratio * tableWidth })));
1221
+ return available;
1139
1222
  }
1140
- function queueLayout(table) {
1223
+ var observedOnly = /* @__PURE__ */ new WeakSet();
1224
+ function queueLayout(table, { observed = false } = {}) {
1225
+ if (!observed) observedOnly.delete(table);
1226
+ else if (!pendingLayouts.has(table)) observedOnly.add(table);
1141
1227
  pendingLayouts.add(table);
1142
1228
  if (layoutFrame) return;
1143
1229
  layoutFrame = requestAnimationFrame(() => {
1144
1230
  layoutFrame = 0;
1145
1231
  const tables = [...pendingLayouts];
1146
1232
  pendingLayouts.clear();
1147
- tables.filter((table2) => table2.isConnected).forEach(refreshLayout);
1233
+ for (const table2 of tables) {
1234
+ const observed2 = observedOnly.has(table2);
1235
+ observedOnly.delete(table2);
1236
+ if (table2.isConnected) refreshLayout(table2, { observed: observed2 });
1237
+ }
1148
1238
  });
1149
1239
  }
1150
1240
  var idleLayouts = /* @__PURE__ */ new Set();
@@ -1157,26 +1247,23 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1157
1247
  idleQueued = false;
1158
1248
  const tables = [...idleLayouts];
1159
1249
  idleLayouts.clear();
1160
- tables.forEach(queueLayout);
1250
+ tables.forEach((table2) => queueLayout(table2));
1161
1251
  };
1162
1252
  if (globalThis.requestIdleCallback) requestIdleCallback(run, { timeout: 1e3 });
1163
1253
  else setTimeout(run, 50);
1164
1254
  }
1165
1255
  function applyColumnWidths(table, { layout = true } = {}) {
1166
1256
  if (!layoutObservers.has(table)) {
1167
- const previous = /* @__PURE__ */ new WeakMap();
1168
1257
  const observer = new ResizeObserver((entries) => {
1169
- for (const { target, contentRect } of entries) {
1170
- if (contentRect.width !== previous.get(target)) {
1171
- previous.set(target, contentRect.width);
1172
- queueLayout(table);
1173
- }
1174
- }
1258
+ const left = leftAt.get(table);
1259
+ const changed = entries.some(({ target, contentRect }) => !(Math.abs(contentRect.width - (left?.get(target) ?? NaN)) < SUBPIXEL));
1260
+ if (changed && !held(table)) queueLayout(table, { observed: true });
1175
1261
  });
1176
1262
  const wrapper = wrapperOf(table);
1177
1263
  const parent = wrapper ? wrapper.parentElement : table.parentElement;
1178
- if (parent) observer.observe(parent);
1179
- if (wrapper) observer.observe(wrapper);
1264
+ const watched = [parent, wrapper].filter(Boolean);
1265
+ watched.forEach((element) => observer.observe(element));
1266
+ observedOf.set(table, watched);
1180
1267
  layoutObservers.set(table, observer);
1181
1268
  if (wrapper) drawScrollbars(wrapper, table);
1182
1269
  }
package/kit/ui.js CHANGED
@@ -134,7 +134,8 @@ ${source}
134
134
  var OWN_METAS = new RegExp(`<head\\b[^>]*>\\s*<meta name="generator" content="(?:${GENERATORS.join("|")})">\\s*<meta http-equiv="Content-Security-Policy" content="[^"]*">\\s*<meta name="${SOURCE_META}" content="sha256:([0-9a-f]{64})">(?:\\s*<meta name="${PACKAGES_META}" content="([^"]*)">)?`, "i");
135
135
 
136
136
  // src/shared/page-links.mjs
137
- function pageId(slug) {
137
+ var DOC_SLUG = /^doc-([a-z][a-z0-9]{7})$/;
138
+ function hashId(slug) {
138
139
  let one = 3735928559;
139
140
  let two = 1103547991;
140
141
  for (let at = 0; at < slug.length; at++) {
@@ -146,10 +147,15 @@ ${source}
146
147
  const hash = (two >>> 0) % 2 ** 21 * 2 ** 32 + (one >>> 0);
147
148
  return String.fromCharCode(97 + hash % 26) + Math.floor(hash / 26).toString(36).padStart(7, "0").slice(-7);
148
149
  }
150
+ var pageId = (slug) => DOC_SLUG.exec(slug)?.[1] ?? hashId(slug);
151
+ var earlierId = (slug) => DOC_SLUG.test(slug) ? hashId(slug) : null;
152
+ var ID_FIRST = "abcdefghijklmnopqrstuvwxyz";
153
+ var ID_REST = `${ID_FIRST}0123456789`;
149
154
  function pageOfLink(links, value) {
150
155
  if (links.has(value)) return value;
151
156
  const id = value.slice(value.lastIndexOf("-") + 1);
152
157
  for (const slug of links.keys()) if (pageId(slug) === id) return slug;
158
+ for (const slug of links.keys()) if (earlierId(slug) === id) return slug;
153
159
  return null;
154
160
  }
155
161
 
@@ -208,7 +214,7 @@ ${source}
208
214
  }
209
215
 
210
216
  // src/shared/components/page.mjs
211
- var LOOK_ATTRIBUTES = Object.freeze({ font: "data-doc-font", size: "data-doc-size", spacing: "data-doc-spacing", width: "data-doc-measure" });
217
+ var LOOK_ATTRIBUTES = Object.freeze({ font: "data-doc-font", size: "data-doc-size", spacing: "data-doc-spacing", width: "data-doc-measure", full: "data-doc-width" });
212
218
  var page_default = {
213
219
  id: "page",
214
220
  match: "main.doc-page",
@@ -228,11 +234,34 @@ ${source}
228
234
  classes: ["doc-page", "doc-header", "doc-kicker", "doc-title", "doc-button"],
229
235
  runtime: {
230
236
  generated: [".doc-display", "script[data-doc-state]"],
231
- root: { attrs: ["data-doc-ready", "data-doc-drawn", "data-doc-controls"] },
232
- // The reader's theme and width (ui.js), and the document's look (字体与布局: its doc.json's, put on by
233
- // the render, src/shared/document-look.mjs), which a copy of the view keeps; never written in doc.html.
234
- state: { html: ["data-doc-theme", "data-doc-width", ...Object.values(LOOK_ATTRIBUTES)] },
235
- internal: ["doc-display*", "data-doc-export-copy", "data-theme", "doc-export-id", "doc-reveal", "doc-kit-error"]
237
+ // data-doc-effective-theme: the theme the page shows now (ui.js), "light" or "dark", which a custom page's own colors go by.
238
+ // data-doc-platform: "mac" on an Apple platform (runtime/index.js sets it as the page opens), the text's color and smoothing go by it; a copy of the view lets it go, its reader's machine judges anew.
239
+ root: { attrs: ["data-doc-ready", "data-doc-drawn", "data-doc-controls", "data-doc-effective-theme", "data-doc-platform"] },
240
+ // The reader's theme (ui.js) and the document's look (字体与布局 and 全宽: its doc.json's, put on by
241
+ // the render, src/shared/document-look.mjs; the reader's own 全宽显示 is the same data-doc-width), which
242
+ // a copy of the view keeps; never written in doc.html.
243
+ state: { html: ["data-doc-theme", ...Object.values(LOOK_ATTRIBUTES)] },
244
+ internal: [
245
+ "doc-display*",
246
+ "data-doc-export-copy",
247
+ "data-theme",
248
+ "doc-export-id",
249
+ "doc-reveal",
250
+ "doc-kit-error",
251
+ "doc-net-consent*",
252
+ "data-doc-snapshot",
253
+ // A consent bar on a card under 240px of content (runtime/net.js), its line over its button.
254
+ "data-doc-net-narrow",
255
+ // The time an export's snapshot was made (its data-doc-snapshot tag's: render/net-snapshot.mjs), which context.workspace.query answers as `at`.
256
+ "data-at",
257
+ // A custom page's (no document's: src/render/page-html.mjs, the kit's board/): its cards' cells, the Agent's
258
+ // (data-x, data-y, data-w, data-h), and its boards' columns now (data-columns, board.js's).
259
+ "data-x",
260
+ "data-y",
261
+ "data-w",
262
+ "data-h",
263
+ "data-columns"
264
+ ]
236
265
  }
237
266
  };
238
267
 
@@ -244,8 +273,11 @@ ${source}
244
273
  // 字体大小: 小号, 默认, 大号
245
274
  spacing: Object.freeze(["default", "compact", "loose"]),
246
275
  // 正文间距: 紧凑, 默认, 宽松
247
- width: Object.freeze(["default", "narrow", "wide"])
276
+ width: Object.freeze(["default", "narrow", "wide"]),
248
277
  // 正文宽度: 偏窄, 默认, 偏宽
278
+ // 全宽 (the 更多 menu's switch under 目录): the page at the full width of its area, whatever its 正文宽度 is; its attribute is
279
+ // the kit's own data-doc-width="full", the reader's display menu's 全宽显示 too (components/page.mjs LOOK_ATTRIBUTES)
280
+ full: Object.freeze(["default", "full"])
249
281
  });
250
282
  var SIZE_FACTOR = Object.freeze({ default: 1, small: 15 / 16, large: 18 / 16 });
251
283
  var SPACING = Object.freeze({
@@ -311,17 +343,47 @@ ${source}
311
343
  "use strict";
312
344
  const root = document.documentElement;
313
345
  const page = document.querySelector(".doc-page");
314
- if (!page || document.querySelector(".doc-display")) return;
346
+ const custom = page ? null : document.querySelector(".gallery-page");
347
+ if (!(page || custom) || document.querySelector(".doc-display")) return;
315
348
  const systemTheme = matchMedia("(prefers-color-scheme: dark)");
316
349
  if (!globalThis.DocState) throw new Error("Report UI requires /kit/state.js to be loaded first.");
317
350
  if (!globalThis.DocKit) throw new Error("Report UI requires /kit/runtime.js to be loaded first.");
318
- const reportId = page.dataset.docId || location.pathname || "report";
319
- const displayState = DocState.create({
351
+ const reportId = page?.dataset.docId || location.pathname || "report";
352
+ const displayState = page ? DocState.create({
320
353
  id: "display",
321
354
  // this report's (DocState scopes it by data-doc-id)
322
355
  version: 1,
323
356
  defaults: { theme: null, width: "reading", exportVersion: 0 }
357
+ }) : null;
358
+ const chosenTheme = () => {
359
+ const theme = displayState?.get("theme");
360
+ return theme === "light" || theme === "dark" ? theme : null;
361
+ };
362
+ function effectiveTheme() {
363
+ return root.dataset.docTheme || (systemTheme.matches ? "dark" : "light");
364
+ }
365
+ const themeChanged = () => {
366
+ root.dataset.docEffectiveTheme = effectiveTheme();
367
+ for (const name of ["doc-theme-change", "report-theme-change"]) dispatchEvent(new CustomEvent(name, { detail: { theme: effectiveTheme() } }));
368
+ };
369
+ addEventListener("doc-theme-request", (event) => {
370
+ const theme = event.detail?.theme ?? chosenTheme();
371
+ if (theme === "light" || theme === "dark") root.dataset.docTheme = theme;
372
+ else delete root.dataset.docTheme;
373
+ updateThemeItems();
374
+ themeChanged();
324
375
  });
376
+ systemTheme.addEventListener?.("change", () => {
377
+ if (root.dataset.docTheme) return;
378
+ themeChanged();
379
+ });
380
+ const markReady = () => requestAnimationFrame(() => root.setAttribute("data-doc-ready", ""));
381
+ const ready = () => document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", markReady, { once: true }) : markReady();
382
+ if (custom) {
383
+ root.dataset.docEffectiveTheme = effectiveTheme();
384
+ ready();
385
+ return;
386
+ }
325
387
  const icons = {
326
388
  // Two sliders, their knobs open circles the lines stop at.
327
389
  settings: '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3.5 6.5h7.25M15.25 6.5h1.25M3.5 13.5h1.25M9.25 13.5h7.25"/><circle cx="13" cy="6.5" r="2.25"/><circle cx="7" cy="13.5" r="2.25"/></svg>',
@@ -382,19 +444,15 @@ ${source}
382
444
  display.append(menuButton, menu);
383
445
  document.body.prepend(display);
384
446
  root.dataset.docControls = "ready";
385
- const markReady = () => requestAnimationFrame(() => root.setAttribute("data-doc-ready", ""));
386
- if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", markReady, { once: true });
387
- else markReady();
388
- const storedTheme = displayState.get("theme");
389
- if (storedTheme === "light" || storedTheme === "dark") root.dataset.docTheme = storedTheme;
447
+ ready();
448
+ const storedTheme = chosenTheme();
449
+ if (storedTheme) root.dataset.docTheme = storedTheme;
450
+ root.dataset.docEffectiveTheme = effectiveTheme();
390
451
  const storedWidth = displayState.get("width");
391
452
  if (storedWidth === "full") root.dataset.docWidth = "full";
392
- function effectiveTheme() {
393
- return root.dataset.docTheme || (systemTheme.matches ? "dark" : "light");
394
- }
395
453
  function updateThemeItems() {
396
- const chosen = displayState.get("theme");
397
- const current = chosen === "light" || chosen === "dark" ? chosen : "system";
454
+ if (!displayState) return;
455
+ const current = chosenTheme() ?? "system";
398
456
  themeItems.forEach((item) => item.setAttribute("aria-checked", String(item.dataset.theme === current)));
399
457
  }
400
458
  function updateWidthItem() {
@@ -585,9 +643,6 @@ ${clone.outerHTML}`;
585
643
  event.preventDefault();
586
644
  list[next].focus();
587
645
  });
588
- const themeChanged = () => {
589
- for (const name of ["doc-theme-change", "report-theme-change"]) dispatchEvent(new CustomEvent(name, { detail: { theme: effectiveTheme() } }));
590
- };
591
646
  themeItems.forEach((item) => item.addEventListener("click", () => {
592
647
  const theme = item.dataset.theme;
593
648
  if (theme === "system") delete root.dataset.docTheme;
@@ -596,13 +651,6 @@ ${clone.outerHTML}`;
596
651
  updateThemeItems();
597
652
  themeChanged();
598
653
  }));
599
- addEventListener("doc-theme-request", (event) => {
600
- const theme = event.detail?.theme ?? displayState.get("theme");
601
- if (theme === "light" || theme === "dark") root.dataset.docTheme = theme;
602
- else delete root.dataset.docTheme;
603
- updateThemeItems();
604
- themeChanged();
605
- });
606
654
  const LOOK_HELD = 2e3;
607
655
  let held = null;
608
656
  const showLook = (look) => {
@@ -648,10 +696,6 @@ ${clone.outerHTML}`;
648
696
  }
649
697
  dispatchEvent(new CustomEvent("doc-export-copy-done", { detail: outcome }));
650
698
  });
651
- systemTheme.addEventListener?.("change", () => {
652
- if (root.dataset.docTheme) return;
653
- themeChanged();
654
- });
655
699
  updateThemeItems();
656
700
  updateWidthItem();
657
701
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycys/gallery",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Gallery: documents written as HTML by an AI agent, shown and edited in the browser, delivered as one offline file. The gallery command and its local server.",
5
5
  "keywords": [
6
6
  "gallery",
@@ -29,6 +29,7 @@
29
29
  "vendor/",
30
30
  "starter/",
31
31
  "assets/",
32
+ "packs/",
32
33
  "sdk/",
33
34
  "skill/",
34
35
  "release.json",
@@ -0,0 +1,14 @@
1
+ {
2
+ "id": "gallery/card",
3
+ "apiVersion": 1,
4
+ "version": "1.0.0",
5
+ "name": { "zh": "卡片", "en": "Card" },
6
+ "description": { "zh": "带标题的卡片,里面放任意内容", "en": "A card with a title, any blocks inside it" },
7
+ "words": "kapian card 卡片 框 frame box",
8
+ "parts": {
9
+ "title": { "at": ":scope > h3", "edit": "text" },
10
+ "body": { "edit": "flow" }
11
+ },
12
+ "places": ["document"],
13
+ "markdown": "parts"
14
+ }
@@ -0,0 +1,10 @@
1
+ <div data-doc-component="gallery/card">
2
+ <h3>这一周的要点</h3>
3
+ <div data-doc-slot="body">
4
+ <p>卡片里写文档自己的块:段落、列表、表格、公式、图表卡片都可以。</p>
5
+ <ul>
6
+ <li>标题写这张卡片说的是什么</li>
7
+ <li>内容照常写,读者照常编辑</li>
8
+ </ul>
9
+ </div>
10
+ </div>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><rect width="240" height="120" rx="8" fill="#f2f4f7"/><rect x="16" y="14" width="208" height="92" rx="8" fill="#ffffff" stroke="#d0d5dd"/><rect x="30" y="28" width="96" height="12" rx="4" fill="#667085"/><rect x="30" y="52" width="176" height="8" rx="4" fill="#d0d5dd"/><rect x="30" y="68" width="150" height="8" rx="4" fill="#d0d5dd"/><rect x="30" y="84" width="120" height="8" rx="4" fill="#d0d5dd"/></svg>
@@ -0,0 +1,6 @@
1
+ /* Every selector starts at the instance and goes down a step at a time (>), so that nothing here
2
+ reaches the rest of the page or the blocks in the slot, which read as the page's. The look is a
3
+ card's of the kit (.doc-figure): its border, its radius and its title's size, in the kit's colors,
4
+ which follow the theme. */
5
+ [data-doc-component="gallery/card"] { margin: var(--doc-component-gap) 0; padding: 20px 24px 8px; border: 1px solid var(--doc-border); border-radius: 10px; background: var(--doc-surface); }
6
+ [data-doc-component="gallery/card"] > h3 { margin: 0 0 4px; font-size: var(--doc-card-title-font-size); line-height: var(--doc-card-title-line-height); font-weight: 600; letter-spacing: -.025em; }
@@ -0,0 +1,6 @@
1
+ <div data-doc-component="gallery/card">
2
+ <h3>标题</h3>
3
+ <div data-doc-slot="body">
4
+ <p></p>
5
+ </div>
6
+ </div>
@@ -0,0 +1,14 @@
1
+ # 卡片 (gallery/card)
2
+
3
+ A card that frames a few blocks under a title: a summary beside the text, a set of points to keep together, a step of a guide. Use it where a framed group reads better than a heading; for a whole section, a heading is enough.
4
+
5
+ ## How to write it
6
+
7
+ Write the element as example.html does (`gallery block show gallery/card` prints it):
8
+
9
+ - the title, its `h3`: required, a few words.
10
+ - the body, its `<div data-doc-slot="body">`: required, the document's own blocks, written as anywhere in the document (paragraphs, lists, tables, formulas, a chart card). The reader edits them as any.
11
+
12
+ ## How it looks
13
+
14
+ A frame with rounded corners in the kit's border color, its title at the top. It draws nothing of its own and has no script: what the file says is what a reader sees.
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "gallery/chart-card",
3
+ "apiVersion": 1,
4
+ "version": "1.0.0",
5
+ "name": { "zh": "表格图表卡片", "en": "Chart from a table" },
6
+ "description": { "zh": "一个标题、一张表格和它画出的条形图,改表格里的数,图跟着重画", "en": "A title, a table and the bar chart drawn from it: edit a number and the chart draws again" },
7
+ "words": "biaogetubiaokapian tubiao chart bar table 图表 条形图 表格 画图",
8
+ "parts": {
9
+ "title": { "at": ":scope > h3", "edit": "text" },
10
+ "table": { "edit": "flow" }
11
+ },
12
+ "runtime": { "generated": [":scope > .gallery-chart-card-bars"] },
13
+ "places": ["document"],
14
+ "markdown": "parts"
15
+ }