@heycys/gallery 0.1.1 → 0.1.2

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 (370) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/editor/components/columns/page.mjs +4 -4
  3. package/browser/editor/components/embed/index.mjs +2 -2
  4. package/browser/editor/components/flowchart/add.mjs +7 -6
  5. package/browser/editor/components/flowchart/page.mjs +1 -1
  6. package/browser/editor/components/icons.mjs +8 -0
  7. package/browser/editor/components/image/crop.mjs +6 -9
  8. package/browser/editor/components/installed/index.mjs +11 -4
  9. package/browser/editor/components/installed/page.mjs +27 -16
  10. package/browser/editor/components/installed/served.mjs +6 -5
  11. package/browser/editor/components/instances.mjs +18 -0
  12. package/browser/editor/components/list/page.mjs +3 -6
  13. package/browser/editor/components/registry.mjs +13 -4
  14. package/browser/editor/components/table/index.mjs +59 -2
  15. package/browser/editor/components/table/page.mjs +1 -1
  16. package/browser/editor/page/annotate/card.mjs +3 -6
  17. package/browser/editor/page/autosave.mjs +310 -37
  18. package/browser/editor/page/board/client.mjs +57 -0
  19. package/browser/editor/page/board/hint.mjs +145 -0
  20. package/browser/editor/page/board/history.mjs +119 -0
  21. package/browser/editor/page/board/index.mjs +970 -0
  22. package/browser/editor/page/board/settings.mjs +209 -0
  23. package/browser/editor/page/caret.mjs +1 -1
  24. package/browser/editor/page/changes/bar.mjs +6 -14
  25. package/browser/editor/page/changes/index.mjs +2 -2
  26. package/browser/editor/page/clipboard/import/html.mjs +29 -6
  27. package/browser/editor/page/clipboard/import/inline.mjs +32 -0
  28. package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
  29. package/browser/editor/page/clipboard/import/read.mjs +6 -1
  30. package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
  31. package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
  32. package/browser/editor/page/clipboard/index.mjs +124 -13
  33. package/browser/editor/page/clipboard/own/blocks.mjs +11 -11
  34. package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
  35. package/browser/editor/page/clipboard/own/selection.mjs +1 -1
  36. package/browser/editor/page/columns/index.mjs +48 -46
  37. package/browser/editor/page/commit.mjs +80 -22
  38. package/browser/editor/page/conflicts.mjs +7 -7
  39. package/browser/editor/page/core.mjs +31 -15
  40. package/browser/editor/page/custom-page.mjs +106 -0
  41. package/browser/editor/page/editor.mjs +51 -14
  42. package/browser/editor/page/emoji-picker/styles.mjs +7 -12
  43. package/browser/editor/page/emoji-picker/upload.mjs +2 -2
  44. package/browser/editor/page/handle/index.mjs +5 -8
  45. package/browser/editor/page/history.mjs +24 -4
  46. package/browser/editor/page/links/index.mjs +5 -3
  47. package/browser/editor/page/links/pages.mjs +27 -9
  48. package/browser/editor/page/look.mjs +54 -3
  49. package/browser/editor/page/margin.mjs +18 -3
  50. package/browser/editor/page/media-menu/index.mjs +6 -7
  51. package/browser/editor/page/menu.mjs +18 -7
  52. package/browser/editor/page/notices.mjs +2 -2
  53. package/browser/editor/page/page-objects.mjs +13 -2
  54. package/browser/editor/page/panel.mjs +4 -9
  55. package/browser/editor/page/present-links.mjs +11 -2
  56. package/browser/editor/page/resize/index.mjs +42 -29
  57. package/browser/editor/page/served.mjs +14 -0
  58. package/browser/editor/page/session.mjs +48 -4
  59. package/browser/editor/page/slash-menu/index.mjs +3 -3
  60. package/browser/editor/page/table/cells.mjs +102 -46
  61. package/browser/editor/page/table/icons.mjs +2 -0
  62. package/browser/editor/page/table/index.mjs +29 -10
  63. package/browser/editor/page/table/pictures.mjs +299 -0
  64. package/browser/editor/page/table/views.mjs +150 -0
  65. package/browser/editor/page/text-select/index.mjs +26 -12
  66. package/browser/editor/page/todo-writes.mjs +75 -0
  67. package/browser/editor/page/typing/index.mjs +53 -3
  68. package/browser/editor/page/ui.mjs +13 -0
  69. package/browser/shared/block-packs.mjs +404 -0
  70. package/browser/shared/board-places.mjs +224 -0
  71. package/browser/shared/card-size.mjs +59 -0
  72. package/browser/shared/colors.mjs +3 -2
  73. package/browser/shared/component-catalog.mjs +323 -46
  74. package/browser/shared/component-source.mjs +37 -0
  75. package/browser/shared/components/index.mjs +12 -3
  76. package/browser/shared/components/installed.mjs +35 -3
  77. package/browser/shared/components/page.mjs +18 -8
  78. package/browser/shared/components/state.mjs +5 -1
  79. package/browser/shared/document-look.mjs +10 -5
  80. package/browser/shared/drafts.mjs +432 -0
  81. package/browser/shared/extension-sidebar.mjs +126 -0
  82. package/browser/shared/extensions.mjs +79 -0
  83. package/browser/shared/file-table.mjs +101 -0
  84. package/browser/shared/i18n/en.mjs +307 -27
  85. package/browser/shared/json-layout.mjs +47 -0
  86. package/browser/shared/net-cache.mjs +133 -0
  87. package/browser/shared/net-keys.mjs +32 -0
  88. package/browser/shared/net-policy.mjs +177 -0
  89. package/browser/shared/outline-shape.mjs +128 -0
  90. package/browser/shared/outline.mjs +331 -67
  91. package/browser/shared/pack-manifest.mjs +77 -0
  92. package/browser/shared/page-address.mjs +6 -3
  93. package/browser/shared/page-cards.mjs +308 -0
  94. package/browser/shared/page-links.mjs +69 -6
  95. package/browser/shared/pages.mjs +388 -0
  96. package/browser/shared/paths.mjs +6 -0
  97. package/browser/shared/preview-server.mjs +3 -7
  98. package/browser/shared/session.mjs +8 -1
  99. package/browser/shared/shipped-blocks.mjs +299 -0
  100. package/browser/shared/table-chart.mjs +33 -1
  101. package/browser/shared/todos.mjs +83 -0
  102. package/browser/shared/user-directory.mjs +24 -0
  103. package/browser/shared/versions.mjs +14 -0
  104. package/browser/shared/web-links.mjs +134 -0
  105. package/browser/shared/workspace-columns.mjs +120 -0
  106. package/browser/shared/workspace-name.mjs +154 -0
  107. package/browser/shared/workspace-query.mjs +125 -0
  108. package/browser/shared/workspace-registry.mjs +272 -0
  109. package/browser/shared/workspace.mjs +171 -20
  110. package/dist/chunk-2NRBY6AJ.mjs +2 -0
  111. package/dist/chunk-32ZUEFZ7.mjs +2 -0
  112. package/dist/chunk-35NQ4PLQ.mjs +2 -0
  113. package/dist/chunk-3KJHLHUO.mjs +2 -0
  114. package/dist/chunk-3NJACR4W.mjs +2 -0
  115. package/dist/chunk-4AV456RQ.mjs +2 -0
  116. package/dist/chunk-4OZWXZE5.mjs +5 -0
  117. package/dist/chunk-5XYHDBJ5.mjs +2 -0
  118. package/dist/chunk-5ZJA7CXT.mjs +2 -0
  119. package/dist/chunk-6A53MZYZ.mjs +2 -0
  120. package/dist/chunk-6EXH3ORZ.mjs +166 -0
  121. package/dist/chunk-6EZ7FNIK.mjs +3 -0
  122. package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
  123. package/dist/{chunk-Y6RLRPG3.mjs → chunk-6VTU6KEO.mjs} +1 -1
  124. package/dist/chunk-B4P2CM2J.mjs +3 -0
  125. package/dist/{chunk-FDLXYYG4.mjs → chunk-BPL64HGA.mjs} +1 -1
  126. package/dist/chunk-BVEFGE4B.mjs +2 -0
  127. package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
  128. package/dist/chunk-CRJEG7MT.mjs +2 -0
  129. package/dist/{chunk-LCTHTZIL.mjs → chunk-D4CKRD3V.mjs} +91 -91
  130. package/dist/chunk-D4EURAX4.mjs +4 -0
  131. package/dist/chunk-DQCE7TJY.mjs +5 -0
  132. package/dist/chunk-DR73Y2UJ.mjs +3 -0
  133. package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
  134. package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
  135. package/dist/chunk-EURLTOTZ.mjs +4 -0
  136. package/dist/chunk-FJYN7RTH.mjs +4 -0
  137. package/dist/chunk-FWNRPMCJ.mjs +12 -0
  138. package/dist/chunk-FWW4CSAZ.mjs +2 -0
  139. package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
  140. package/dist/chunk-GY3FAUVM.mjs +2 -0
  141. package/dist/chunk-HLYV7RIH.mjs +2 -0
  142. package/dist/chunk-HMYTM3GT.mjs +15 -0
  143. package/dist/chunk-IA4PSIMD.mjs +2 -0
  144. package/dist/chunk-JEUK3ZO7.mjs +2 -0
  145. package/dist/chunk-KTKHRC6H.mjs +2 -0
  146. package/dist/chunk-L7UP52JO.mjs +2 -0
  147. package/dist/{chunk-SYGN7GLU.mjs → chunk-MHW7ZKOU.mjs} +1 -1
  148. package/dist/chunk-N76HWBA3.mjs +10 -0
  149. package/dist/chunk-N7AZZLGT.mjs +548 -0
  150. package/dist/chunk-NAMN3RAF.mjs +2 -0
  151. package/dist/{chunk-5ZKJ3H4P.mjs → chunk-NFMCP2HI.mjs} +3 -3
  152. package/dist/chunk-NG375ILQ.mjs +2 -0
  153. package/dist/chunk-NVRNLK25.mjs +6 -0
  154. package/dist/chunk-NWFBE2YA.mjs +2 -0
  155. package/dist/chunk-NWR2LT5B.mjs +2 -0
  156. package/dist/chunk-OJKMINIU.mjs +20 -0
  157. package/dist/{chunk-4FS7Z7WR.mjs → chunk-OUUP3WKT.mjs} +1 -1
  158. package/dist/{chunk-BGGDRNYQ.mjs → chunk-OW5NWPOJ.mjs} +1 -1
  159. package/dist/chunk-PAREWQGB.mjs +4 -0
  160. package/dist/chunk-POQSE4C2.mjs +2 -0
  161. package/dist/chunk-PUOQ65NC.mjs +2 -0
  162. package/dist/{chunk-XNROSH2T.mjs → chunk-PVER7LSC.mjs} +2 -2
  163. package/dist/chunk-PZDLJJTJ.mjs +3 -0
  164. package/dist/chunk-Q47PLKIJ.mjs +15 -0
  165. package/dist/chunk-Q4UEPUWF.mjs +2 -0
  166. package/dist/chunk-QKXMPUXC.mjs +2 -0
  167. package/dist/chunk-QOUEFUCH.mjs +16 -0
  168. package/dist/chunk-RFDZXFJF.mjs +13 -0
  169. package/dist/chunk-RKPWLGZ3.mjs +4 -0
  170. package/dist/chunk-RMECZA2K.mjs +2 -0
  171. package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
  172. package/dist/chunk-SX4LJYT6.mjs +8 -0
  173. package/dist/chunk-SXHBYZST.mjs +16 -0
  174. package/dist/chunk-TANZRINB.mjs +2 -0
  175. package/dist/chunk-TEZAWDSQ.mjs +2 -0
  176. package/dist/chunk-UBBRTJ2R.mjs +24 -0
  177. package/dist/chunk-UFNYFFKO.mjs +20 -0
  178. package/dist/chunk-UGWYKHBL.mjs +170 -0
  179. package/dist/chunk-UKSHDZZ6.mjs +2 -0
  180. package/dist/chunk-UNOYVIYR.mjs +2 -0
  181. package/dist/{chunk-E7LWZRXY.mjs → chunk-V6RIYQZZ.mjs} +1 -1
  182. package/dist/chunk-VJPFVNNW.mjs +15 -0
  183. package/dist/chunk-VS3ZMVGX.mjs +5 -0
  184. package/dist/chunk-VTKNEYT3.mjs +6 -0
  185. package/dist/chunk-VXACTLO3.mjs +3 -0
  186. package/dist/chunk-YI43RG4P.mjs +2 -0
  187. package/dist/chunk-YQGT4AB2.mjs +6 -0
  188. package/dist/chunk-ZB4H7ZN4.mjs +2 -0
  189. package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
  190. package/dist/chunk-ZTHICSSF.mjs +2 -0
  191. package/dist/chunk-ZUNVAXLH.mjs +2 -0
  192. package/dist/chunk-ZWPMCK7P.mjs +2 -0
  193. package/dist/cli.mjs +1 -1
  194. package/dist/server.mjs +1 -1
  195. package/dist/{chunk-U6KNPJPR.mjs → update-fetch.mjs} +1 -1
  196. package/dist/worker.mjs +1 -1
  197. package/kit/board.css +95 -0
  198. package/kit/board.js +250 -0
  199. package/kit/charts.js +5 -71
  200. package/kit/code.js +14 -14
  201. package/kit/report.css +255 -17
  202. package/kit/runtime.js +1600 -125
  203. package/kit/state.js +10 -1
  204. package/kit/tables.js +128 -43
  205. package/kit/ui.js +77 -35
  206. package/package.json +2 -1
  207. package/packs/gallery/card/component.json +14 -0
  208. package/packs/gallery/card/example.html +10 -0
  209. package/packs/gallery/card/preview.svg +1 -0
  210. package/packs/gallery/card/style.css +6 -0
  211. package/packs/gallery/card/template.html +6 -0
  212. package/packs/gallery/card/writing.md +14 -0
  213. package/packs/gallery/chart-card/component.json +15 -0
  214. package/packs/gallery/chart-card/example.html +14 -0
  215. package/packs/gallery/chart-card/kit.js +130 -0
  216. package/packs/gallery/chart-card/preview.svg +1 -0
  217. package/packs/gallery/chart-card/style.css +42 -0
  218. package/packs/gallery/chart-card/template.html +13 -0
  219. package/packs/gallery/chart-card/writing.md +20 -0
  220. package/packs/gallery/chart-view/component.json +20 -0
  221. package/packs/gallery/chart-view/example.html +13 -0
  222. package/packs/gallery/chart-view/kit.js +355 -0
  223. package/packs/gallery/chart-view/preview.svg +1 -0
  224. package/packs/gallery/chart-view/style.css +94 -0
  225. package/packs/gallery/chart-view/template.html +3 -0
  226. package/packs/gallery/chart-view/writing.md +22 -0
  227. package/packs/gallery/countdown/component.json +18 -0
  228. package/packs/gallery/countdown/example.html +3 -0
  229. package/packs/gallery/countdown/kit.js +156 -0
  230. package/packs/gallery/countdown/preview.svg +1 -0
  231. package/packs/gallery/countdown/style.css +130 -0
  232. package/packs/gallery/countdown/template.html +3 -0
  233. package/packs/gallery/countdown/writing.md +22 -0
  234. package/packs/gallery/habit/component.json +14 -0
  235. package/packs/gallery/habit/example.html +3 -0
  236. package/packs/gallery/habit/kit.js +295 -0
  237. package/packs/gallery/habit/preview.svg +1 -0
  238. package/packs/gallery/habit/style.css +246 -0
  239. package/packs/gallery/habit/template.html +3 -0
  240. package/packs/gallery/habit/writing.md +21 -0
  241. package/packs/gallery/heatmap/component.json +18 -0
  242. package/packs/gallery/heatmap/example.html +3 -0
  243. package/packs/gallery/heatmap/kit.js +351 -0
  244. package/packs/gallery/heatmap/preview.svg +1 -0
  245. package/packs/gallery/heatmap/style.css +201 -0
  246. package/packs/gallery/heatmap/template.html +3 -0
  247. package/packs/gallery/heatmap/writing.md +21 -0
  248. package/packs/gallery/kanban/component.json +18 -0
  249. package/packs/gallery/kanban/example.html +12 -0
  250. package/packs/gallery/kanban/kit.js +540 -0
  251. package/packs/gallery/kanban/preview.svg +1 -0
  252. package/packs/gallery/kanban/style.css +212 -0
  253. package/packs/gallery/kanban/template.html +3 -0
  254. package/packs/gallery/kanban/writing.md +20 -0
  255. package/packs/gallery/metric/component.json +22 -0
  256. package/packs/gallery/metric/example.html +15 -0
  257. package/packs/gallery/metric/kit.js +248 -0
  258. package/packs/gallery/metric/preview.svg +1 -0
  259. package/packs/gallery/metric/style.css +92 -0
  260. package/packs/gallery/metric/template.html +3 -0
  261. package/packs/gallery/metric/writing.md +23 -0
  262. package/packs/gallery/note/component.json +14 -0
  263. package/packs/gallery/note/example.html +3 -0
  264. package/packs/gallery/note/kit.js +102 -0
  265. package/packs/gallery/note/preview.svg +1 -0
  266. package/packs/gallery/note/style.css +76 -0
  267. package/packs/gallery/note/template.html +3 -0
  268. package/packs/gallery/note/writing.md +18 -0
  269. package/packs/gallery/pack.json +8 -0
  270. package/packs/gallery/recent/component.json +13 -0
  271. package/packs/gallery/recent/example.html +1 -0
  272. package/packs/gallery/recent/kit.js +238 -0
  273. package/packs/gallery/recent/preview.svg +1 -0
  274. package/packs/gallery/recent/style.css +158 -0
  275. package/packs/gallery/recent/template.html +1 -0
  276. package/packs/gallery/recent/writing.md +15 -0
  277. package/packs/gallery/static/component.json +13 -0
  278. package/packs/gallery/static/example.html +11 -0
  279. package/packs/gallery/static/preview.svg +1 -0
  280. package/packs/gallery/static/style.css +138 -0
  281. package/packs/gallery/static/template.html +1 -0
  282. package/packs/gallery/static/writing.md +18 -0
  283. package/packs/gallery/stats/component.json +13 -0
  284. package/packs/gallery/stats/example.html +1 -0
  285. package/packs/gallery/stats/kit.js +166 -0
  286. package/packs/gallery/stats/preview.svg +1 -0
  287. package/packs/gallery/stats/style.css +151 -0
  288. package/packs/gallery/stats/template.html +1 -0
  289. package/packs/gallery/stats/writing.md +11 -0
  290. package/packs/gallery/today/component.json +12 -0
  291. package/packs/gallery/today/example.html +1 -0
  292. package/packs/gallery/today/kit.js +185 -0
  293. package/packs/gallery/today/preview.svg +1 -0
  294. package/packs/gallery/today/style.css +120 -0
  295. package/packs/gallery/today/template.html +1 -0
  296. package/packs/gallery/today/writing.md +14 -0
  297. package/packs/gallery/todos/component.json +19 -0
  298. package/packs/gallery/todos/example.html +3 -0
  299. package/packs/gallery/todos/kit.js +342 -0
  300. package/packs/gallery/todos/preview.svg +1 -0
  301. package/packs/gallery/todos/style.css +267 -0
  302. package/packs/gallery/todos/template.html +3 -0
  303. package/packs/gallery/todos/writing.md +30 -0
  304. package/packs/gallery/weather/component.json +19 -0
  305. package/packs/gallery/weather/example.html +3 -0
  306. package/packs/gallery/weather/kit.js +312 -0
  307. package/packs/gallery/weather/preview.svg +1 -0
  308. package/packs/gallery/weather/style.css +258 -0
  309. package/packs/gallery/weather/template.html +3 -0
  310. package/packs/gallery/weather/writing.md +26 -0
  311. package/packs/gallery-soft/pack.json +8 -0
  312. package/release.json +12 -10
  313. package/sdk/doc-kit.d.ts +396 -5
  314. package/sdk/doc-state.d.ts +2 -0
  315. package/skill/SKILL.md +56 -23
  316. package/skill/references/block-script.md +140 -0
  317. package/skill/references/building-blocks.md +257 -0
  318. package/skill/references/extensions.md +59 -0
  319. package/skill/references/pages-and-data.md +221 -0
  320. package/skill/references/writing-html.md +6 -4
  321. package/skill/sdk/doc-kit.d.ts +396 -5
  322. package/skill/sdk/doc-state.d.ts +2 -0
  323. package/web/assets/index-BK2e_07w.js +13 -0
  324. package/web/assets/index-CWFI83mF.css +1 -0
  325. package/web/index.html +2 -2
  326. package/dist/chunk-3HIRPVLU.mjs +0 -2
  327. package/dist/chunk-5MHMDLZD.mjs +0 -4
  328. package/dist/chunk-64K7IPLO.mjs +0 -255
  329. package/dist/chunk-6QXGZM36.mjs +0 -8
  330. package/dist/chunk-6RGJOMJP.mjs +0 -16
  331. package/dist/chunk-AJ73XJF3.mjs +0 -2
  332. package/dist/chunk-AUZGSZJH.mjs +0 -13
  333. package/dist/chunk-BFE45AKL.mjs +0 -2
  334. package/dist/chunk-BXO2ZY5P.mjs +0 -2
  335. package/dist/chunk-CEH4MRCC.mjs +0 -2
  336. package/dist/chunk-CY2FNNAB.mjs +0 -16
  337. package/dist/chunk-DFUDV4LX.mjs +0 -2
  338. package/dist/chunk-DKXG4XDG.mjs +0 -2
  339. package/dist/chunk-EZQ34M3F.mjs +0 -124
  340. package/dist/chunk-EZY3WC6Z.mjs +0 -15
  341. package/dist/chunk-FUKQNOQS.mjs +0 -9
  342. package/dist/chunk-JPOSLGOC.mjs +0 -6
  343. package/dist/chunk-L3QKH4OK.mjs +0 -26
  344. package/dist/chunk-LAE5NQ4B.mjs +0 -2
  345. package/dist/chunk-LEF6DRCK.mjs +0 -59
  346. package/dist/chunk-NO5NJCHO.mjs +0 -2
  347. package/dist/chunk-NQPVAU63.mjs +0 -2
  348. package/dist/chunk-NSKUTQ5J.mjs +0 -5
  349. package/dist/chunk-O35FIXRB.mjs +0 -2
  350. package/dist/chunk-P2CAZPDP.mjs +0 -3
  351. package/dist/chunk-PL6GHLGD.mjs +0 -15
  352. package/dist/chunk-QJIR2BLP.mjs +0 -6
  353. package/dist/chunk-QUPLVPB2.mjs +0 -7
  354. package/dist/chunk-R7BNENLY.mjs +0 -4
  355. package/dist/chunk-S6O4UHLC.mjs +0 -2
  356. package/dist/chunk-SGJWQKEI.mjs +0 -2
  357. package/dist/chunk-TX6JH7TR.mjs +0 -2
  358. package/dist/chunk-TYK6VNAB.mjs +0 -10
  359. package/dist/chunk-UALRNVSE.mjs +0 -4
  360. package/dist/chunk-V3HXVQEM.mjs +0 -2
  361. package/dist/chunk-V5VXUJKG.mjs +0 -2
  362. package/dist/chunk-VBXMADMP.mjs +0 -2
  363. package/dist/chunk-VNV55RUA.mjs +0 -2
  364. package/dist/chunk-VPD2PS35.mjs +0 -2
  365. package/dist/chunk-W4VKN3GF.mjs +0 -7
  366. package/dist/chunk-W5BXXPDJ.mjs +0 -3
  367. package/dist/chunk-XUNHRCOG.mjs +0 -6
  368. package/skill/references/building-components.md +0 -367
  369. package/web/assets/index-Bh74DfsV.css +0 -1
  370. 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,32 @@
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
+ // 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`.
425
+ "data-at",
426
+ // A custom page's (no document's: src/render/page-html.mjs, the kit's board/): its cards' cells, the Agent's
427
+ // (data-x, data-y, data-w, data-h), and its boards' columns now (data-columns, board.js's).
428
+ "data-x",
429
+ "data-y",
430
+ "data-w",
431
+ "data-h",
432
+ "data-columns"
433
+ ]
413
434
  }
414
435
  };
415
436
 
@@ -421,8 +442,11 @@
421
442
  // 字体大小: 小号, 默认, 大号
422
443
  spacing: Object.freeze(["default", "compact", "loose"]),
423
444
  // 正文间距: 紧凑, 默认, 宽松
424
- width: Object.freeze(["default", "narrow", "wide"])
445
+ width: Object.freeze(["default", "narrow", "wide"]),
425
446
  // 正文宽度: 偏窄, 默认, 偏宽
447
+ // 全宽 (the 更多 menu's switch under 目录): the page at the full width of its area, whatever its 正文宽度 is; its attribute is
448
+ // the kit's own data-doc-width="full", the reader's display menu's 全宽显示 too (components/page.mjs LOOK_ATTRIBUTES)
449
+ full: Object.freeze(["default", "full"])
426
450
  });
427
451
  var SIZE_FACTOR = Object.freeze({ default: 1, small: 15 / 16, large: 18 / 16 });
428
452
  var SPACING = Object.freeze({
@@ -546,6 +570,7 @@
546
570
  frame.className = "doc-scrollbars-frame";
547
571
  node.prepend(frame);
548
572
  }
573
+ frame.style.removeProperty("width");
549
574
  const bars = { node, table, frame, y: node.querySelector(".doc-scrollbar--y"), x: node.querySelector(".doc-scrollbar--x"), timer: 0, axes: {}, noted: "", reach: 0 };
550
575
  scrollbars.set(wrapper, bars);
551
576
  wrapper.addEventListener("scroll", () => {
@@ -563,10 +588,10 @@
563
588
  const bars = scrollbars.get(wrapper);
564
589
  if (!bars) return;
565
590
  const { table } = bars;
566
- const { clientWidth: width, clientHeight: height, offsetWidth, offsetHeight } = wrapper;
591
+ const { clientWidth: width, clientHeight: height } = wrapper;
592
+ const style = getComputedStyle(wrapper);
567
593
  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`);
594
+ setStyle(bars.frame, "height", `${outerHeight(wrapper, style)}px`);
570
595
  const x = content.width - width > 1, y = content.height - height > 1;
571
596
  const sizes = `${width}x${height}:${content.width}x${content.height}`;
572
597
  if (width > 0 && (renote || sizes !== bars.noted)) {
@@ -574,7 +599,6 @@
574
599
  bars.reach = noteHidden(wrapper, table);
575
600
  }
576
601
  bars.node.toggleAttribute("data-more", x && wrapper.scrollLeft + width < bars.reach - 1);
577
- const style = getComputedStyle(wrapper);
578
602
  const corner = (radius, border) => Math.max(0, (parseFloat(style[radius]) || 0) - (parseFloat(style[border]) || 0));
579
603
  const header = table.tHead?.getBoundingClientRect().height || 0;
580
604
  const first = fixedFirstCell(table)?.getBoundingClientRect().width || 0;
@@ -604,6 +628,12 @@
604
628
  bars.axes.x = place(bars.x, start, end, first, width, content.width, wrapper.scrollLeft);
605
629
  }
606
630
  }
631
+ function outerHeight(element, style) {
632
+ const height = parseFloat(style.height);
633
+ if (!Number.isFinite(height)) return element.offsetHeight;
634
+ if (style.boxSizing === "border-box") return height;
635
+ return height + ["paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"].reduce((sum, name) => sum + (parseFloat(style[name]) || 0), 0);
636
+ }
607
637
  function noteHidden(wrapper, table) {
608
638
  const notes = [];
609
639
  const hides = tableHides(wrapper, table);
@@ -671,6 +701,7 @@
671
701
  var CODE_RUN_MAX = 320;
672
702
  var WIDE = "\u2014\u3000-\u30FF\u3400-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF";
673
703
  var NATIVE_BREAKS = new RegExp(`(?<=-)|(?<=[${WIDE}])|(?=[${WIDE}])`, "u");
704
+ var SUBPIXEL = 0.5;
674
705
  var layouts = /* @__PURE__ */ new WeakMap();
675
706
  var layoutObservers = /* @__PURE__ */ new WeakMap();
676
707
  var pendingLayouts = /* @__PURE__ */ new Set();
@@ -882,13 +913,32 @@
882
913
  const wrapper = wrapperOf(table);
883
914
  const sized = Boolean(wrapper) && getComputedStyle(wrapper).getPropertyValue("--doc-span-width").trim() !== "";
884
915
  const wider = sized ? Math.max(1, parseFloat(getComputedStyle(wrapper).getPropertyValue("--doc-span")) || 1) : 1;
885
- return { wrapper, sized, wider, previousWidth: wrapper?.style.width };
916
+ return { wrapper, sized, wider };
917
+ }
918
+ function innerWidth(element) {
919
+ const style = getComputedStyle(element);
920
+ const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
921
+ const border = (parseFloat(style.borderLeftWidth) || 0) + (parseFloat(style.borderRightWidth) || 0);
922
+ if (element.getClientRects?.().length > 0 && /px$/.test(style.width)) {
923
+ const width = parseFloat(style.width);
924
+ return style.boxSizing === "border-box" ? width - padding - border : width;
925
+ }
926
+ return (element.clientWidth || element.getBoundingClientRect().width - border) - padding;
927
+ }
928
+ function roomOf(element, width = null) {
929
+ const before = element.style.width;
930
+ if (width === null || before === width) return innerWidth(element);
931
+ element.style.width = width;
932
+ try {
933
+ return innerWidth(element);
934
+ } finally {
935
+ element.style.width = before;
936
+ }
886
937
  }
887
938
  function sizedInside({ wrapper, sized, wider }) {
888
939
  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);
940
+ if (wrapper.style.width) wrapper.style.width = "";
941
+ const inner = innerWidth(wrapper);
892
942
  return inner > 0 ? { wider, inner } : null;
893
943
  }
894
944
  function frameEdges(wrapper) {
@@ -962,19 +1012,19 @@
962
1012
  table.classList.add("doc-table--auto");
963
1013
  table.style.width = `${total2}px`;
964
1014
  clearColumnMarks(table);
1015
+ let room = frameSize?.inner ?? null;
965
1016
  if (wrapper) {
966
1017
  const edges = frameEdges(wrapper);
967
1018
  setAttribute(wrapper, "data-doc-min-width", String(Math.min(total2, COLUMN_FLOOR) + edges));
968
1019
  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%";
1020
+ room = roomOf(wrapper, "100%");
1021
+ setStyle(wrapper, "width", total2 < room ? `${total2 + edges}px` : "100%");
973
1022
  }
974
1023
  }
975
1024
  writeColgroup(table, sizes.map((width, index) => ({ width: `${width}px`, key: String(index) })));
976
1025
  layouts.set(table, sizes.map((width, index) => ({ key: String(index), kind: "compact", preferredWidth: width, softMinWidth: width, hardMinWidth: width, width, ratio: width / total2 })));
977
1026
  for (const [cell, { c, cols }] of slots?.places ?? []) markRunWrap(cell, sizes.slice(c, c + cols).reduce((sum, width) => sum + width, 0), measureCell);
1027
+ return room;
978
1028
  }
979
1029
  function raiseNarrow(widths, room, floor) {
980
1030
  const low = widths.filter((width) => width < floor).sort((a, b) => a - b);
@@ -989,12 +1039,15 @@
989
1039
  }
990
1040
  return widths.map((width) => Math.max(width, Math.min(level, floor)));
991
1041
  }
992
- function refreshLayout(table) {
1042
+ function refreshLayout(table, { observed = false } = {}) {
993
1043
  idleLayouts.delete(table);
994
1044
  const measure = createCellMeasurer(table);
995
- layOut(table, measure);
1045
+ const room = layOut(table, measure);
996
1046
  measure.done();
997
1047
  markWhole(table);
1048
+ followChain(table, room, observed);
1049
+ const watched = observedOf.get(table);
1050
+ if (watched) leftAt.set(table, new Map(watched.map((element) => [element, innerWidth(element)])));
998
1051
  const wrapper = wrapperOf(table);
999
1052
  if (wrapper) placeScrollbars(wrapper, { renote: true });
1000
1053
  }
@@ -1007,7 +1060,36 @@
1007
1060
  if (manual) return manualLayout(table, frame, manual, measure);
1008
1061
  const count = headers.length || rows[0]?.cells.length || 0;
1009
1062
  if (!count || table.tHead && table.tHead.rows.length !== 1 || spanned) return nativeLayout(table, frame);
1010
- allocatedLayout(table, frame, headers, rows, count, measure);
1063
+ return allocatedLayout(table, frame, headers, rows, count, measure);
1064
+ }
1065
+ var observedOf = /* @__PURE__ */ new WeakMap();
1066
+ var leftAt = /* @__PURE__ */ new WeakMap();
1067
+ var CHAIN_GAP = 100;
1068
+ var RETURNS_MAX = 3;
1069
+ var HOLD = 1e3;
1070
+ var chains = /* @__PURE__ */ new WeakMap();
1071
+ function followChain(table, room, observed) {
1072
+ const now = performance.now();
1073
+ const chain = chains.get(table);
1074
+ if (!observed || !chain || now - chain.at > CHAIN_GAP) {
1075
+ if (chain?.timer) clearTimeout(chain.timer);
1076
+ chains.set(table, { at: now, rooms: [room], returns: 0, held: false, timer: 0 });
1077
+ return;
1078
+ }
1079
+ const near = (other) => typeof room === "number" && typeof other === "number" && Math.abs(room - other) < SUBPIXEL;
1080
+ if (!near(chain.rooms.at(-1)) && near(chain.rooms.at(-2))) chain.returns++;
1081
+ chain.rooms = [...chain.rooms.slice(-2), room];
1082
+ chain.at = now;
1083
+ chain.held = chain.returns >= RETURNS_MAX;
1084
+ }
1085
+ function held(table) {
1086
+ const chain = chains.get(table);
1087
+ if (!chain?.held) return false;
1088
+ chain.timer ||= setTimeout(() => {
1089
+ chains.delete(table);
1090
+ queueLayout(table);
1091
+ }, Math.max(0, chain.at + HOLD - performance.now()));
1092
+ return true;
1011
1093
  }
1012
1094
  var wholeTexts = /* @__PURE__ */ new WeakMap();
1013
1095
  function markWhole(table) {
@@ -1064,21 +1146,19 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1064
1146
  table.removeAttribute("data-doc-filled");
1065
1147
  table.style.removeProperty("width");
1066
1148
  }
1149
+ return frameSize?.inner ?? null;
1067
1150
  }
1068
1151
  function allocatedLayout(table, frame, headers, rows, count, measureCell) {
1069
1152
  table.removeAttribute("data-doc-filled");
1070
- const { wrapper, sized, wider, previousWidth } = frame;
1153
+ const { wrapper, sized, wider } = frame;
1071
1154
  const parent = wrapper || table.parentElement;
1072
- if (!parent) return;
1073
- if (wrapper) wrapper.style.width = sized ? "" : "100%";
1155
+ if (!parent) return null;
1156
+ if (sized && wrapper.style.width) wrapper.style.width = "";
1074
1157
  const style = getComputedStyle(parent);
1075
1158
  const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
1076
1159
  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
- }
1160
+ const available = roomOf(parent, wrapper && !sized ? "100%" : null);
1161
+ if (!(available > 0)) return null;
1082
1162
  const font = fontFor(rows[0]?.cells[0] || table);
1083
1163
  const cellPadding = cellPaddingFor(getComputedStyle(rows[0]?.cells[0] || headers[0]));
1084
1164
  const measuredCells = /* @__PURE__ */ new Map();
@@ -1124,7 +1204,7 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1124
1204
  table.classList.add("doc-table--auto");
1125
1205
  table.style.width = sized && tableWidth <= available + 4 ? "100%" : `${tableWidth}px`;
1126
1206
  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`;
1207
+ if (wrapper && !sized) setStyle(wrapper, "width", tableWidth >= available - 0.01 ? "100%" : `${tableWidth + border + padding}px`);
1128
1208
  writeColgroup(table, result.map((column) => ({ width: `${column.ratio * 100}%`, key: column.key })));
1129
1209
  result.forEach((column, index) => {
1130
1210
  for (const cell of [headers[index], ...rows.map((row) => row.cells[index])].filter(Boolean)) {
@@ -1136,15 +1216,23 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1136
1216
  }
1137
1217
  });
1138
1218
  layouts.set(table, result.map((column) => ({ ...column, width: column.ratio * tableWidth })));
1219
+ return available;
1139
1220
  }
1140
- function queueLayout(table) {
1221
+ var observedOnly = /* @__PURE__ */ new WeakSet();
1222
+ function queueLayout(table, { observed = false } = {}) {
1223
+ if (!observed) observedOnly.delete(table);
1224
+ else if (!pendingLayouts.has(table)) observedOnly.add(table);
1141
1225
  pendingLayouts.add(table);
1142
1226
  if (layoutFrame) return;
1143
1227
  layoutFrame = requestAnimationFrame(() => {
1144
1228
  layoutFrame = 0;
1145
1229
  const tables = [...pendingLayouts];
1146
1230
  pendingLayouts.clear();
1147
- tables.filter((table2) => table2.isConnected).forEach(refreshLayout);
1231
+ for (const table2 of tables) {
1232
+ const observed2 = observedOnly.has(table2);
1233
+ observedOnly.delete(table2);
1234
+ if (table2.isConnected) refreshLayout(table2, { observed: observed2 });
1235
+ }
1148
1236
  });
1149
1237
  }
1150
1238
  var idleLayouts = /* @__PURE__ */ new Set();
@@ -1157,26 +1245,23 @@ ${columns.map((texts) => texts?.join("\n") ?? "").join("\f")}`;
1157
1245
  idleQueued = false;
1158
1246
  const tables = [...idleLayouts];
1159
1247
  idleLayouts.clear();
1160
- tables.forEach(queueLayout);
1248
+ tables.forEach((table2) => queueLayout(table2));
1161
1249
  };
1162
1250
  if (globalThis.requestIdleCallback) requestIdleCallback(run, { timeout: 1e3 });
1163
1251
  else setTimeout(run, 50);
1164
1252
  }
1165
1253
  function applyColumnWidths(table, { layout = true } = {}) {
1166
1254
  if (!layoutObservers.has(table)) {
1167
- const previous = /* @__PURE__ */ new WeakMap();
1168
1255
  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
- }
1256
+ const left = leftAt.get(table);
1257
+ const changed = entries.some(({ target, contentRect }) => !(Math.abs(contentRect.width - (left?.get(target) ?? NaN)) < SUBPIXEL));
1258
+ if (changed && !held(table)) queueLayout(table, { observed: true });
1175
1259
  });
1176
1260
  const wrapper = wrapperOf(table);
1177
1261
  const parent = wrapper ? wrapper.parentElement : table.parentElement;
1178
- if (parent) observer.observe(parent);
1179
- if (wrapper) observer.observe(wrapper);
1262
+ const watched = [parent, wrapper].filter(Boolean);
1263
+ watched.forEach((element) => observer.observe(element));
1264
+ observedOf.set(table, watched);
1180
1265
  layoutObservers.set(table, observer);
1181
1266
  if (wrapper) drawScrollbars(wrapper, table);
1182
1267
  }
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,32 @@ ${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
+ // 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`.
254
+ "data-at",
255
+ // A custom page's (no document's: src/render/page-html.mjs, the kit's board/): its cards' cells, the Agent's
256
+ // (data-x, data-y, data-w, data-h), and its boards' columns now (data-columns, board.js's).
257
+ "data-x",
258
+ "data-y",
259
+ "data-w",
260
+ "data-h",
261
+ "data-columns"
262
+ ]
236
263
  }
237
264
  };
238
265
 
@@ -244,8 +271,11 @@ ${source}
244
271
  // 字体大小: 小号, 默认, 大号
245
272
  spacing: Object.freeze(["default", "compact", "loose"]),
246
273
  // 正文间距: 紧凑, 默认, 宽松
247
- width: Object.freeze(["default", "narrow", "wide"])
274
+ width: Object.freeze(["default", "narrow", "wide"]),
248
275
  // 正文宽度: 偏窄, 默认, 偏宽
276
+ // 全宽 (the 更多 menu's switch under 目录): the page at the full width of its area, whatever its 正文宽度 is; its attribute is
277
+ // the kit's own data-doc-width="full", the reader's display menu's 全宽显示 too (components/page.mjs LOOK_ATTRIBUTES)
278
+ full: Object.freeze(["default", "full"])
249
279
  });
250
280
  var SIZE_FACTOR = Object.freeze({ default: 1, small: 15 / 16, large: 18 / 16 });
251
281
  var SPACING = Object.freeze({
@@ -311,17 +341,47 @@ ${source}
311
341
  "use strict";
312
342
  const root = document.documentElement;
313
343
  const page = document.querySelector(".doc-page");
314
- if (!page || document.querySelector(".doc-display")) return;
344
+ const custom = page ? null : document.querySelector(".gallery-page");
345
+ if (!(page || custom) || document.querySelector(".doc-display")) return;
315
346
  const systemTheme = matchMedia("(prefers-color-scheme: dark)");
316
347
  if (!globalThis.DocState) throw new Error("Report UI requires /kit/state.js to be loaded first.");
317
348
  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({
349
+ const reportId = page?.dataset.docId || location.pathname || "report";
350
+ const displayState = page ? DocState.create({
320
351
  id: "display",
321
352
  // this report's (DocState scopes it by data-doc-id)
322
353
  version: 1,
323
354
  defaults: { theme: null, width: "reading", exportVersion: 0 }
355
+ }) : null;
356
+ const chosenTheme = () => {
357
+ const theme = displayState?.get("theme");
358
+ return theme === "light" || theme === "dark" ? theme : null;
359
+ };
360
+ function effectiveTheme() {
361
+ return root.dataset.docTheme || (systemTheme.matches ? "dark" : "light");
362
+ }
363
+ const themeChanged = () => {
364
+ root.dataset.docEffectiveTheme = effectiveTheme();
365
+ for (const name of ["doc-theme-change", "report-theme-change"]) dispatchEvent(new CustomEvent(name, { detail: { theme: effectiveTheme() } }));
366
+ };
367
+ addEventListener("doc-theme-request", (event) => {
368
+ const theme = event.detail?.theme ?? chosenTheme();
369
+ if (theme === "light" || theme === "dark") root.dataset.docTheme = theme;
370
+ else delete root.dataset.docTheme;
371
+ updateThemeItems();
372
+ themeChanged();
324
373
  });
374
+ systemTheme.addEventListener?.("change", () => {
375
+ if (root.dataset.docTheme) return;
376
+ themeChanged();
377
+ });
378
+ const markReady = () => requestAnimationFrame(() => root.setAttribute("data-doc-ready", ""));
379
+ const ready = () => document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", markReady, { once: true }) : markReady();
380
+ if (custom) {
381
+ root.dataset.docEffectiveTheme = effectiveTheme();
382
+ ready();
383
+ return;
384
+ }
325
385
  const icons = {
326
386
  // Two sliders, their knobs open circles the lines stop at.
327
387
  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 +442,15 @@ ${source}
382
442
  display.append(menuButton, menu);
383
443
  document.body.prepend(display);
384
444
  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;
445
+ ready();
446
+ const storedTheme = chosenTheme();
447
+ if (storedTheme) root.dataset.docTheme = storedTheme;
448
+ root.dataset.docEffectiveTheme = effectiveTheme();
390
449
  const storedWidth = displayState.get("width");
391
450
  if (storedWidth === "full") root.dataset.docWidth = "full";
392
- function effectiveTheme() {
393
- return root.dataset.docTheme || (systemTheme.matches ? "dark" : "light");
394
- }
395
451
  function updateThemeItems() {
396
- const chosen = displayState.get("theme");
397
- const current = chosen === "light" || chosen === "dark" ? chosen : "system";
452
+ if (!displayState) return;
453
+ const current = chosenTheme() ?? "system";
398
454
  themeItems.forEach((item) => item.setAttribute("aria-checked", String(item.dataset.theme === current)));
399
455
  }
400
456
  function updateWidthItem() {
@@ -585,9 +641,6 @@ ${clone.outerHTML}`;
585
641
  event.preventDefault();
586
642
  list[next].focus();
587
643
  });
588
- const themeChanged = () => {
589
- for (const name of ["doc-theme-change", "report-theme-change"]) dispatchEvent(new CustomEvent(name, { detail: { theme: effectiveTheme() } }));
590
- };
591
644
  themeItems.forEach((item) => item.addEventListener("click", () => {
592
645
  const theme = item.dataset.theme;
593
646
  if (theme === "system") delete root.dataset.docTheme;
@@ -596,13 +649,6 @@ ${clone.outerHTML}`;
596
649
  updateThemeItems();
597
650
  themeChanged();
598
651
  }));
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
652
  const LOOK_HELD = 2e3;
607
653
  let held = null;
608
654
  const showLook = (look) => {
@@ -648,10 +694,6 @@ ${clone.outerHTML}`;
648
694
  }
649
695
  dispatchEvent(new CustomEvent("doc-export-copy-done", { detail: outcome }));
650
696
  });
651
- systemTheme.addEventListener?.("change", () => {
652
- if (root.dataset.docTheme) return;
653
- themeChanged();
654
- });
655
697
  updateThemeItems();
656
698
  updateWidthItem();
657
699
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycys/gallery",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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
+ }