@heycys/gallery 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/THIRD-PARTY-NOTICES.md +2 -2
  2. package/browser/editor/components/align.mjs +58 -0
  3. package/browser/editor/components/code/index.mjs +1 -1
  4. package/browser/editor/components/columns/page.mjs +4 -4
  5. package/browser/editor/components/embed/index.mjs +2 -2
  6. package/browser/editor/components/embed/page.mjs +1 -1
  7. package/browser/editor/components/file/page.mjs +4 -4
  8. package/browser/editor/components/flowchart/add.mjs +7 -6
  9. package/browser/editor/components/flowchart/page.mjs +1 -1
  10. package/browser/editor/components/heading/index.mjs +7 -6
  11. package/browser/editor/components/icons.mjs +11 -0
  12. package/browser/editor/components/image/crop.mjs +6 -9
  13. package/browser/editor/components/image/index.mjs +2 -0
  14. package/browser/editor/components/image/page.mjs +172 -90
  15. package/browser/editor/components/installed/index.mjs +15 -4
  16. package/browser/editor/components/installed/page.mjs +103 -25
  17. package/browser/editor/components/installed/served.mjs +6 -5
  18. package/browser/editor/components/instances.mjs +18 -0
  19. package/browser/editor/components/list/page.mjs +3 -6
  20. package/browser/editor/components/media/icons.mjs +13 -8
  21. package/browser/editor/components/media/page.mjs +5 -3
  22. package/browser/editor/components/media/toolbar.mjs +12 -3
  23. package/browser/editor/components/paragraph/index.mjs +4 -3
  24. package/browser/editor/components/registry.mjs +30 -9
  25. package/browser/editor/components/table/index.mjs +61 -2
  26. package/browser/editor/components/table/page.mjs +1 -1
  27. package/browser/editor/page/after/index.mjs +288 -0
  28. package/browser/editor/page/align.mjs +91 -0
  29. package/browser/editor/page/annotate/card.mjs +3 -6
  30. package/browser/editor/page/autosave.mjs +310 -37
  31. package/browser/editor/page/beside.mjs +5 -6
  32. package/browser/editor/page/block-menu/index.mjs +6 -3
  33. package/browser/editor/page/blocks.mjs +3 -1
  34. package/browser/editor/page/board/client.mjs +57 -0
  35. package/browser/editor/page/board/hint.mjs +182 -0
  36. package/browser/editor/page/board/history.mjs +119 -0
  37. package/browser/editor/page/board/index.mjs +1059 -0
  38. package/browser/editor/page/board/motion.mjs +177 -0
  39. package/browser/editor/page/board/settings.mjs +210 -0
  40. package/browser/editor/page/caret.mjs +1 -1
  41. package/browser/editor/page/changes/bar.mjs +6 -14
  42. package/browser/editor/page/changes/index.mjs +2 -2
  43. package/browser/editor/page/clipboard/import/html.mjs +29 -6
  44. package/browser/editor/page/clipboard/import/inline.mjs +32 -0
  45. package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
  46. package/browser/editor/page/clipboard/import/read.mjs +6 -1
  47. package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
  48. package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
  49. package/browser/editor/page/clipboard/index.mjs +133 -15
  50. package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
  51. package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
  52. package/browser/editor/page/clipboard/own/describe.mjs +6 -2
  53. package/browser/editor/page/clipboard/own/selection.mjs +1 -1
  54. package/browser/editor/page/columns/index.mjs +48 -46
  55. package/browser/editor/page/commit.mjs +80 -22
  56. package/browser/editor/page/conflicts.mjs +7 -7
  57. package/browser/editor/page/core.mjs +34 -16
  58. package/browser/editor/page/custom-page.mjs +110 -0
  59. package/browser/editor/page/editor.mjs +71 -17
  60. package/browser/editor/page/emoji-picker/styles.mjs +7 -12
  61. package/browser/editor/page/emoji-picker/upload.mjs +2 -2
  62. package/browser/editor/page/handle/index.mjs +5 -8
  63. package/browser/editor/page/history.mjs +41 -6
  64. package/browser/editor/page/insert/index.mjs +20 -22
  65. package/browser/editor/page/links/index.mjs +5 -3
  66. package/browser/editor/page/links/pages.mjs +27 -9
  67. package/browser/editor/page/look.mjs +54 -3
  68. package/browser/editor/page/margin.mjs +18 -3
  69. package/browser/editor/page/media-menu/index.mjs +6 -7
  70. package/browser/editor/page/menu.mjs +33 -14
  71. package/browser/editor/page/notices.mjs +2 -2
  72. package/browser/editor/page/page-objects.mjs +9 -2
  73. package/browser/editor/page/panel.mjs +4 -9
  74. package/browser/editor/page/present-links.mjs +15 -5
  75. package/browser/editor/page/present-shell.mjs +63 -0
  76. package/browser/editor/page/resize/index.mjs +42 -29
  77. package/browser/editor/page/selection/index.mjs +10 -2
  78. package/browser/editor/page/served.mjs +14 -0
  79. package/browser/editor/page/session.mjs +48 -4
  80. package/browser/editor/page/slash-menu/index.mjs +3 -3
  81. package/browser/editor/page/table/binding.mjs +87 -0
  82. package/browser/editor/page/table/cells.mjs +102 -46
  83. package/browser/editor/page/table/index.mjs +24 -9
  84. package/browser/editor/page/table/pictures.mjs +299 -0
  85. package/browser/editor/page/table/views.mjs +103 -0
  86. package/browser/editor/page/table/widths.mjs +82 -10
  87. package/browser/editor/page/text-select/index.mjs +26 -12
  88. package/browser/editor/page/todo-writes.mjs +75 -0
  89. package/browser/editor/page/typing/index.mjs +97 -15
  90. package/browser/editor/page/typing/leave.mjs +19 -5
  91. package/browser/editor/page/ui.mjs +13 -0
  92. package/browser/shared/block-packs.mjs +419 -0
  93. package/browser/shared/board-places.mjs +224 -0
  94. package/browser/shared/card-size.mjs +59 -0
  95. package/browser/shared/colors.mjs +3 -2
  96. package/browser/shared/component-catalog.mjs +330 -46
  97. package/browser/shared/component-source.mjs +39 -0
  98. package/browser/shared/components/heading.mjs +2 -1
  99. package/browser/shared/components/index.mjs +12 -3
  100. package/browser/shared/components/installed.mjs +35 -3
  101. package/browser/shared/components/page.mjs +20 -8
  102. package/browser/shared/components/paragraph.mjs +8 -1
  103. package/browser/shared/components/state.mjs +5 -1
  104. package/browser/shared/components/table.mjs +1 -0
  105. package/browser/shared/document-look.mjs +10 -5
  106. package/browser/shared/drafts.mjs +432 -0
  107. package/browser/shared/emoji/line-icons.mjs +37 -0
  108. package/browser/shared/extension-sidebar.mjs +126 -0
  109. package/browser/shared/extensions.mjs +79 -0
  110. package/browser/shared/file-table.mjs +101 -0
  111. package/browser/shared/http.mjs +9 -0
  112. package/browser/shared/i18n/en.mjs +330 -27
  113. package/browser/shared/json-layout.mjs +47 -0
  114. package/browser/shared/net-cache.mjs +133 -0
  115. package/browser/shared/net-keys.mjs +32 -0
  116. package/browser/shared/net-policy.mjs +177 -0
  117. package/browser/shared/outline-shape.mjs +128 -0
  118. package/browser/shared/outline.mjs +359 -67
  119. package/browser/shared/pack-manifest.mjs +88 -0
  120. package/browser/shared/page-address.mjs +6 -3
  121. package/browser/shared/page-cards.mjs +308 -0
  122. package/browser/shared/page-links.mjs +69 -6
  123. package/browser/shared/pages.mjs +500 -0
  124. package/browser/shared/paths.mjs +6 -0
  125. package/browser/shared/pinyin.mjs +92 -0
  126. package/browser/shared/present-step.mjs +17 -0
  127. package/browser/shared/preview-server.mjs +3 -7
  128. package/browser/shared/session.mjs +8 -1
  129. package/browser/shared/shipped-blocks.mjs +299 -0
  130. package/browser/shared/sidebar-head.mjs +70 -0
  131. package/browser/shared/table-chart.mjs +33 -1
  132. package/browser/shared/todos.mjs +83 -0
  133. package/browser/shared/user-directory.mjs +24 -0
  134. package/browser/shared/versions.mjs +14 -0
  135. package/browser/shared/web-links.mjs +139 -0
  136. package/browser/shared/workspace-columns.mjs +120 -0
  137. package/browser/shared/workspace-name.mjs +154 -0
  138. package/browser/shared/workspace-query.mjs +125 -0
  139. package/browser/shared/workspace-registry.mjs +272 -0
  140. package/browser/shared/workspace.mjs +171 -20
  141. package/dist/chunk-2OHANJ6Q.mjs +2 -0
  142. package/dist/chunk-3MBRL2PM.mjs +16 -0
  143. package/dist/chunk-4OKWZY5E.mjs +2 -0
  144. package/dist/chunk-4OZWXZE5.mjs +5 -0
  145. package/dist/chunk-5K44HLTZ.mjs +2 -0
  146. package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
  147. package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
  148. package/dist/chunk-6KBYRA2C.mjs +2 -0
  149. package/dist/chunk-6N3PX4XX.mjs +8 -0
  150. package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
  151. package/dist/chunk-7JDX4E65.mjs +13 -0
  152. package/dist/chunk-7M2BQQGZ.mjs +2 -0
  153. package/dist/chunk-7OG26PGF.mjs +2 -0
  154. package/dist/chunk-AHN3NFKJ.mjs +3 -0
  155. package/dist/chunk-ALZ6ZENZ.mjs +3 -0
  156. package/dist/chunk-AR5D57ZD.mjs +170 -0
  157. package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
  158. package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
  159. package/dist/chunk-CMA72MAG.mjs +2 -0
  160. package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
  161. package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
  162. package/dist/chunk-DR73Y2UJ.mjs +3 -0
  163. package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
  164. package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
  165. package/dist/chunk-EP25HDAJ.mjs +2 -0
  166. package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
  167. package/dist/chunk-EURLTOTZ.mjs +4 -0
  168. package/dist/chunk-F4ZA6JRZ.mjs +3 -0
  169. package/dist/chunk-F6HVDZR4.mjs +2 -0
  170. package/dist/chunk-FDMAXMQA.mjs +2 -0
  171. package/dist/chunk-FETSREUN.mjs +5 -0
  172. package/dist/chunk-GHOYKMQ3.mjs +4 -0
  173. package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
  174. package/dist/chunk-HDWTZ763.mjs +12 -0
  175. package/dist/chunk-HPOI4ZX7.mjs +6 -0
  176. package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
  177. package/dist/chunk-IA4PSIMD.mjs +2 -0
  178. package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
  179. package/dist/chunk-IV64FFI4.mjs +2 -0
  180. package/dist/chunk-J43Z6LSS.mjs +2 -0
  181. package/dist/chunk-J5PUIV3Y.mjs +4 -0
  182. package/dist/chunk-JA7G53PC.mjs +2 -0
  183. package/dist/chunk-JEUK3ZO7.mjs +2 -0
  184. package/dist/chunk-JLTZF4LA.mjs +2 -0
  185. package/dist/chunk-JZT7I2OJ.mjs +2 -0
  186. package/dist/chunk-K5XATEOO.mjs +2 -0
  187. package/dist/chunk-L2SUIS5S.mjs +2 -0
  188. package/dist/chunk-L7UP52JO.mjs +2 -0
  189. package/dist/chunk-LM4XFQHZ.mjs +2 -0
  190. package/dist/chunk-MN7BZL4R.mjs +2 -0
  191. package/dist/chunk-MTYYHM2G.mjs +15 -0
  192. package/dist/chunk-MXUBKDRO.mjs +15 -0
  193. package/dist/chunk-NAMN3RAF.mjs +2 -0
  194. package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
  195. package/dist/chunk-OFHXGWOX.mjs +2 -0
  196. package/dist/chunk-ORID3AE7.mjs +166 -0
  197. package/dist/chunk-PAREWQGB.mjs +4 -0
  198. package/dist/chunk-PGDE24N5.mjs +2 -0
  199. package/dist/chunk-POTA2FV4.mjs +2 -0
  200. package/dist/chunk-PUOQ65NC.mjs +2 -0
  201. package/dist/chunk-Q4UEPUWF.mjs +2 -0
  202. package/dist/chunk-QE5RG76S.mjs +549 -0
  203. package/dist/chunk-R2ZDLJYT.mjs +10 -0
  204. package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
  205. package/dist/chunk-SWUTTZCN.mjs +2 -0
  206. package/dist/chunk-TANZRINB.mjs +2 -0
  207. package/dist/chunk-TR7TWGHB.mjs +2 -0
  208. package/dist/chunk-U5XL7D6A.mjs +3 -0
  209. package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
  210. package/dist/chunk-UGWMMEJ5.mjs +15 -0
  211. package/dist/chunk-UJQJKNGK.mjs +2 -0
  212. package/dist/chunk-UYVCQK3H.mjs +22 -0
  213. package/dist/chunk-VFX2KNHP.mjs +4 -0
  214. package/dist/chunk-VS7JIGJW.mjs +24 -0
  215. package/dist/chunk-W7665ZEC.mjs +6 -0
  216. package/dist/chunk-WQDQWCX5.mjs +2 -0
  217. package/dist/chunk-YI43RG4P.mjs +2 -0
  218. package/dist/chunk-YLPSMDIS.mjs +5 -0
  219. package/dist/chunk-YNAWBAYN.mjs +3 -0
  220. package/dist/chunk-YROX2O22.mjs +2 -0
  221. package/dist/chunk-ZDLPUOAG.mjs +6 -0
  222. package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
  223. package/dist/chunk-ZQS6H473.mjs +16 -0
  224. package/dist/chunk-ZTHICSSF.mjs +2 -0
  225. package/dist/chunk-ZWWC4KLF.mjs +20 -0
  226. package/dist/cli.mjs +1 -1
  227. package/dist/server.mjs +1 -1
  228. package/dist/{chunk-U6KNPJPR.mjs → update-fetch.mjs} +1 -1
  229. package/dist/worker.mjs +1 -1
  230. package/kit/board.css +95 -0
  231. package/kit/board.js +250 -0
  232. package/kit/charts.js +5 -71
  233. package/kit/code.js +17 -17
  234. package/kit/report.css +335 -18
  235. package/kit/runtime.js +1638 -125
  236. package/kit/state.js +10 -1
  237. package/kit/tables.js +130 -43
  238. package/kit/ui.js +79 -35
  239. package/package.json +2 -1
  240. package/packs/gallery/card/component.json +14 -0
  241. package/packs/gallery/card/example.html +10 -0
  242. package/packs/gallery/card/preview.svg +1 -0
  243. package/packs/gallery/card/style.css +6 -0
  244. package/packs/gallery/card/template.html +6 -0
  245. package/packs/gallery/card/writing.md +14 -0
  246. package/packs/gallery/chart-card/component.json +15 -0
  247. package/packs/gallery/chart-card/example.html +14 -0
  248. package/packs/gallery/chart-card/kit.js +130 -0
  249. package/packs/gallery/chart-card/preview.svg +1 -0
  250. package/packs/gallery/chart-card/style.css +42 -0
  251. package/packs/gallery/chart-card/template.html +13 -0
  252. package/packs/gallery/chart-card/writing.md +20 -0
  253. package/packs/gallery/chart-view/component.json +20 -0
  254. package/packs/gallery/chart-view/example.html +13 -0
  255. package/packs/gallery/chart-view/kit.js +355 -0
  256. package/packs/gallery/chart-view/preview.svg +1 -0
  257. package/packs/gallery/chart-view/style.css +94 -0
  258. package/packs/gallery/chart-view/template.html +3 -0
  259. package/packs/gallery/chart-view/writing.md +22 -0
  260. package/packs/gallery/countdown/component.json +18 -0
  261. package/packs/gallery/countdown/example.html +3 -0
  262. package/packs/gallery/countdown/kit.js +216 -0
  263. package/packs/gallery/countdown/preview.svg +1 -0
  264. package/packs/gallery/countdown/style.css +118 -0
  265. package/packs/gallery/countdown/template.html +3 -0
  266. package/packs/gallery/countdown/writing.md +22 -0
  267. package/packs/gallery/habit/component.json +14 -0
  268. package/packs/gallery/habit/example.html +3 -0
  269. package/packs/gallery/habit/kit.js +334 -0
  270. package/packs/gallery/habit/preview.svg +1 -0
  271. package/packs/gallery/habit/style.css +174 -0
  272. package/packs/gallery/habit/template.html +3 -0
  273. package/packs/gallery/habit/writing.md +21 -0
  274. package/packs/gallery/heatmap/component.json +18 -0
  275. package/packs/gallery/heatmap/example.html +3 -0
  276. package/packs/gallery/heatmap/kit.js +513 -0
  277. package/packs/gallery/heatmap/preview.svg +1 -0
  278. package/packs/gallery/heatmap/style.css +189 -0
  279. package/packs/gallery/heatmap/template.html +3 -0
  280. package/packs/gallery/heatmap/writing.md +21 -0
  281. package/packs/gallery/kanban/component.json +18 -0
  282. package/packs/gallery/kanban/example.html +12 -0
  283. package/packs/gallery/kanban/kit.js +540 -0
  284. package/packs/gallery/kanban/preview.svg +1 -0
  285. package/packs/gallery/kanban/style.css +212 -0
  286. package/packs/gallery/kanban/template.html +3 -0
  287. package/packs/gallery/kanban/writing.md +20 -0
  288. package/packs/gallery/metric/component.json +22 -0
  289. package/packs/gallery/metric/example.html +15 -0
  290. package/packs/gallery/metric/kit.js +248 -0
  291. package/packs/gallery/metric/preview.svg +1 -0
  292. package/packs/gallery/metric/style.css +92 -0
  293. package/packs/gallery/metric/template.html +3 -0
  294. package/packs/gallery/metric/writing.md +23 -0
  295. package/packs/gallery/note/component.json +14 -0
  296. package/packs/gallery/note/example.html +3 -0
  297. package/packs/gallery/note/kit.js +129 -0
  298. package/packs/gallery/note/preview.svg +1 -0
  299. package/packs/gallery/note/style.css +97 -0
  300. package/packs/gallery/note/template.html +3 -0
  301. package/packs/gallery/note/writing.md +18 -0
  302. package/packs/gallery/pack.json +8 -0
  303. package/packs/gallery/recent/component.json +13 -0
  304. package/packs/gallery/recent/example.html +1 -0
  305. package/packs/gallery/recent/kit.js +293 -0
  306. package/packs/gallery/recent/preview.svg +1 -0
  307. package/packs/gallery/recent/style.css +85 -0
  308. package/packs/gallery/recent/template.html +1 -0
  309. package/packs/gallery/recent/writing.md +15 -0
  310. package/packs/gallery/static/component.json +13 -0
  311. package/packs/gallery/static/example.html +11 -0
  312. package/packs/gallery/static/preview.svg +1 -0
  313. package/packs/gallery/static/style.css +171 -0
  314. package/packs/gallery/static/template.html +1 -0
  315. package/packs/gallery/static/writing.md +18 -0
  316. package/packs/gallery/stats/component.json +13 -0
  317. package/packs/gallery/stats/example.html +1 -0
  318. package/packs/gallery/stats/kit.js +347 -0
  319. package/packs/gallery/stats/preview.svg +1 -0
  320. package/packs/gallery/stats/style.css +73 -0
  321. package/packs/gallery/stats/template.html +1 -0
  322. package/packs/gallery/stats/writing.md +11 -0
  323. package/packs/gallery/today/component.json +12 -0
  324. package/packs/gallery/today/example.html +1 -0
  325. package/packs/gallery/today/kit.js +220 -0
  326. package/packs/gallery/today/preview.svg +1 -0
  327. package/packs/gallery/today/style.css +149 -0
  328. package/packs/gallery/today/template.html +1 -0
  329. package/packs/gallery/today/writing.md +14 -0
  330. package/packs/gallery/todos/component.json +19 -0
  331. package/packs/gallery/todos/example.html +3 -0
  332. package/packs/gallery/todos/kit.js +489 -0
  333. package/packs/gallery/todos/preview.svg +1 -0
  334. package/packs/gallery/todos/style.css +214 -0
  335. package/packs/gallery/todos/template.html +3 -0
  336. package/packs/gallery/todos/writing.md +30 -0
  337. package/packs/gallery/weather/component.json +19 -0
  338. package/packs/gallery/weather/example.html +3 -0
  339. package/packs/gallery/weather/kit.js +387 -0
  340. package/packs/gallery/weather/preview.svg +1 -0
  341. package/packs/gallery/weather/style.css +140 -0
  342. package/packs/gallery/weather/template.html +3 -0
  343. package/packs/gallery/weather/writing.md +26 -0
  344. package/packs/gallery-soft/countdown/component.json +18 -0
  345. package/packs/gallery-soft/countdown/example.html +3 -0
  346. package/packs/gallery-soft/countdown/kit.js +206 -0
  347. package/packs/gallery-soft/countdown/preview.svg +1 -0
  348. package/packs/gallery-soft/countdown/style.css +211 -0
  349. package/packs/gallery-soft/countdown/template.html +3 -0
  350. package/packs/gallery-soft/countdown/writing.md +24 -0
  351. package/packs/gallery-soft/habit/component.json +14 -0
  352. package/packs/gallery-soft/habit/example.html +3 -0
  353. package/packs/gallery-soft/habit/kit.js +366 -0
  354. package/packs/gallery-soft/habit/preview.svg +1 -0
  355. package/packs/gallery-soft/habit/style.css +251 -0
  356. package/packs/gallery-soft/habit/template.html +3 -0
  357. package/packs/gallery-soft/habit/writing.md +23 -0
  358. package/packs/gallery-soft/heatmap/component.json +18 -0
  359. package/packs/gallery-soft/heatmap/example.html +3 -0
  360. package/packs/gallery-soft/heatmap/kit.js +498 -0
  361. package/packs/gallery-soft/heatmap/preview.svg +1 -0
  362. package/packs/gallery-soft/heatmap/style.css +181 -0
  363. package/packs/gallery-soft/heatmap/template.html +3 -0
  364. package/packs/gallery-soft/heatmap/writing.md +23 -0
  365. package/packs/gallery-soft/note/component.json +14 -0
  366. package/packs/gallery-soft/note/example.html +3 -0
  367. package/packs/gallery-soft/note/kit.js +162 -0
  368. package/packs/gallery-soft/note/preview.svg +1 -0
  369. package/packs/gallery-soft/note/style.css +148 -0
  370. package/packs/gallery-soft/note/template.html +3 -0
  371. package/packs/gallery-soft/note/writing.md +20 -0
  372. package/packs/gallery-soft/pack.json +8 -0
  373. package/packs/gallery-soft/recent/component.json +13 -0
  374. package/packs/gallery-soft/recent/example.html +1 -0
  375. package/packs/gallery-soft/recent/kit.js +335 -0
  376. package/packs/gallery-soft/recent/preview.svg +1 -0
  377. package/packs/gallery-soft/recent/style.css +160 -0
  378. package/packs/gallery-soft/recent/template.html +1 -0
  379. package/packs/gallery-soft/recent/writing.md +17 -0
  380. package/packs/gallery-soft/static/component.json +13 -0
  381. package/packs/gallery-soft/static/example.html +12 -0
  382. package/packs/gallery-soft/static/preview.svg +1 -0
  383. package/packs/gallery-soft/static/style.css +186 -0
  384. package/packs/gallery-soft/static/template.html +1 -0
  385. package/packs/gallery-soft/static/writing.md +20 -0
  386. package/packs/gallery-soft/stats/component.json +13 -0
  387. package/packs/gallery-soft/stats/example.html +1 -0
  388. package/packs/gallery-soft/stats/kit.js +341 -0
  389. package/packs/gallery-soft/stats/preview.svg +1 -0
  390. package/packs/gallery-soft/stats/style.css +119 -0
  391. package/packs/gallery-soft/stats/template.html +1 -0
  392. package/packs/gallery-soft/stats/writing.md +13 -0
  393. package/packs/gallery-soft/today/component.json +12 -0
  394. package/packs/gallery-soft/today/example.html +1 -0
  395. package/packs/gallery-soft/today/kit.js +222 -0
  396. package/packs/gallery-soft/today/preview.svg +1 -0
  397. package/packs/gallery-soft/today/style.css +178 -0
  398. package/packs/gallery-soft/today/template.html +1 -0
  399. package/packs/gallery-soft/today/writing.md +16 -0
  400. package/packs/gallery-soft/todos/component.json +19 -0
  401. package/packs/gallery-soft/todos/example.html +3 -0
  402. package/packs/gallery-soft/todos/kit.js +527 -0
  403. package/packs/gallery-soft/todos/preview.svg +1 -0
  404. package/packs/gallery-soft/todos/style.css +212 -0
  405. package/packs/gallery-soft/todos/template.html +3 -0
  406. package/packs/gallery-soft/todos/writing.md +32 -0
  407. package/packs/gallery-soft/weather/component.json +19 -0
  408. package/packs/gallery-soft/weather/example.html +3 -0
  409. package/packs/gallery-soft/weather/kit.js +411 -0
  410. package/packs/gallery-soft/weather/preview.svg +1 -0
  411. package/packs/gallery-soft/weather/style.css +185 -0
  412. package/packs/gallery-soft/weather/template.html +3 -0
  413. package/packs/gallery-soft/weather/writing.md +28 -0
  414. package/release.json +12 -10
  415. package/sdk/doc-kit.d.ts +396 -5
  416. package/sdk/doc-state.d.ts +2 -0
  417. package/skill/SKILL.md +56 -23
  418. package/skill/references/block-script.md +140 -0
  419. package/skill/references/building-blocks.md +257 -0
  420. package/skill/references/extensions.md +59 -0
  421. package/skill/references/pages-and-data.md +225 -0
  422. package/skill/references/writing-html.md +8 -4
  423. package/skill/sdk/doc-kit.d.ts +396 -5
  424. package/skill/sdk/doc-state.d.ts +2 -0
  425. package/web/assets/index-BM_K-Auu.css +1 -0
  426. package/web/assets/index-DRslOBiv.js +15 -0
  427. package/web/index.html +2 -2
  428. package/dist/chunk-3HIRPVLU.mjs +0 -2
  429. package/dist/chunk-5MHMDLZD.mjs +0 -4
  430. package/dist/chunk-64K7IPLO.mjs +0 -255
  431. package/dist/chunk-6QXGZM36.mjs +0 -8
  432. package/dist/chunk-6RGJOMJP.mjs +0 -16
  433. package/dist/chunk-AJ73XJF3.mjs +0 -2
  434. package/dist/chunk-AUZGSZJH.mjs +0 -13
  435. package/dist/chunk-BFE45AKL.mjs +0 -2
  436. package/dist/chunk-BXO2ZY5P.mjs +0 -2
  437. package/dist/chunk-CEH4MRCC.mjs +0 -2
  438. package/dist/chunk-CY2FNNAB.mjs +0 -16
  439. package/dist/chunk-DFUDV4LX.mjs +0 -2
  440. package/dist/chunk-DKXG4XDG.mjs +0 -2
  441. package/dist/chunk-EZQ34M3F.mjs +0 -124
  442. package/dist/chunk-EZY3WC6Z.mjs +0 -15
  443. package/dist/chunk-FUKQNOQS.mjs +0 -9
  444. package/dist/chunk-JPOSLGOC.mjs +0 -6
  445. package/dist/chunk-JVHHHGEA.mjs +0 -3
  446. package/dist/chunk-L3QKH4OK.mjs +0 -26
  447. package/dist/chunk-LAE5NQ4B.mjs +0 -2
  448. package/dist/chunk-LEF6DRCK.mjs +0 -59
  449. package/dist/chunk-NO5NJCHO.mjs +0 -2
  450. package/dist/chunk-NQPVAU63.mjs +0 -2
  451. package/dist/chunk-NSKUTQ5J.mjs +0 -5
  452. package/dist/chunk-O35FIXRB.mjs +0 -2
  453. package/dist/chunk-P2CAZPDP.mjs +0 -3
  454. package/dist/chunk-PL6GHLGD.mjs +0 -15
  455. package/dist/chunk-QJIR2BLP.mjs +0 -6
  456. package/dist/chunk-QUPLVPB2.mjs +0 -7
  457. package/dist/chunk-R7BNENLY.mjs +0 -4
  458. package/dist/chunk-S6O4UHLC.mjs +0 -2
  459. package/dist/chunk-SGJWQKEI.mjs +0 -2
  460. package/dist/chunk-TX6JH7TR.mjs +0 -2
  461. package/dist/chunk-TYK6VNAB.mjs +0 -10
  462. package/dist/chunk-UALRNVSE.mjs +0 -4
  463. package/dist/chunk-V3HXVQEM.mjs +0 -2
  464. package/dist/chunk-V5VXUJKG.mjs +0 -2
  465. package/dist/chunk-VBXMADMP.mjs +0 -2
  466. package/dist/chunk-VNV55RUA.mjs +0 -2
  467. package/dist/chunk-VPD2PS35.mjs +0 -2
  468. package/dist/chunk-W4VKN3GF.mjs +0 -7
  469. package/dist/chunk-W5BXXPDJ.mjs +0 -3
  470. package/dist/chunk-XUNHRCOG.mjs +0 -6
  471. package/skill/references/building-components.md +0 -367
  472. package/web/assets/index-Bh74DfsV.css +0 -1
  473. package/web/assets/index-UW0RyFFt.js +0 -13
@@ -0,0 +1,94 @@
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. A framed card of the kit's (gallery/chart-card's look): its title, the
3
+ settings (⚙) at the right of its head while the page edits and the strip they open under it, then
4
+ horizontal bars from zero, each its name at its left and its value at its end, in the kit's first
5
+ series color, which follows the theme; laid out in percents of the card's width, so that a width
6
+ draws nothing again. A muted line where there is nothing to draw or more than it draws. */
7
+ [data-doc-component="gallery/chart-view"] {
8
+ margin: var(--doc-component-gap) 0;
9
+ padding: 16px 20px 12px;
10
+ border: 1px solid var(--doc-border);
11
+ border-radius: 10px;
12
+ background: var(--doc-surface);
13
+ > .gallery-chart-view-face { color: var(--doc-text); }
14
+ > .gallery-chart-view-face > .gallery-chart-view-head {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 8px;
18
+ min-height: 26px;
19
+ margin: 0 0 10px;
20
+ > .gallery-chart-view-title { flex: 1 1 auto; min-width: 0; font-size: var(--doc-card-title-font-size); line-height: var(--doc-card-title-line-height); font-weight: 600; letter-spacing: -.025em; }
21
+ > .gallery-chart-view-gear {
22
+ display: none;
23
+ flex: none;
24
+ align-items: center;
25
+ justify-content: center;
26
+ width: 26px;
27
+ height: 26px;
28
+ margin: 0 -8px 0 0;
29
+ padding: 0;
30
+ border: 0;
31
+ border-radius: 6px;
32
+ background: transparent;
33
+ color: var(--doc-muted);
34
+ cursor: pointer;
35
+ opacity: 0;
36
+ transition: opacity .12s;
37
+ }
38
+ > .gallery-chart-view-gear > svg { width: 16px; height: 16px; }
39
+ > .gallery-chart-view-gear:hover { background: var(--doc-hover); color: var(--doc-text); }
40
+ > .gallery-chart-view-gear[aria-expanded="true"] { background: var(--doc-press); color: var(--doc-text); opacity: 1; }
41
+ }
42
+ > .gallery-chart-view-face > .gallery-chart-view-head.gallery-chart-view-untitled { margin-bottom: 2px; }
43
+ > .gallery-chart-view-face > .gallery-chart-view-head[hidden] { display: none; }
44
+ > .gallery-chart-view-face[data-writes] > .gallery-chart-view-head > .gallery-chart-view-gear { display: inline-flex; }
45
+ > .gallery-chart-view-face[data-writes]:hover > .gallery-chart-view-head > .gallery-chart-view-gear,
46
+ > .gallery-chart-view-face[data-writes]:focus-within > .gallery-chart-view-head > .gallery-chart-view-gear { opacity: 1; }
47
+ > .gallery-chart-view-face > .gallery-chart-view-strip {
48
+ display: flex;
49
+ flex-wrap: wrap;
50
+ gap: 6px 14px;
51
+ margin: -4px 0 12px;
52
+ padding: 8px 10px;
53
+ border-radius: 8px;
54
+ background: var(--doc-hover);
55
+ font-size: 12px;
56
+ > .gallery-chart-view-setting { display: inline-flex; align-items: center; gap: 6px; color: var(--doc-muted); }
57
+ > .gallery-chart-view-setting[hidden] { display: none; }
58
+ > .gallery-chart-view-setting > select,
59
+ > .gallery-chart-view-setting > input {
60
+ box-sizing: border-box;
61
+ max-width: 180px;
62
+ height: 24px;
63
+ padding: 2px 6px;
64
+ border: 1px solid var(--doc-border);
65
+ border-radius: 6px;
66
+ background: var(--doc-surface);
67
+ color: var(--doc-text);
68
+ font: inherit;
69
+ }
70
+ /* A select is a button that opens the kit's menu (DocKit's choices): no line, as every button. */
71
+ > .gallery-chart-view-setting > select { border: 0; cursor: pointer; }
72
+ > .gallery-chart-view-setting > input { width: 160px; }
73
+ }
74
+ > .gallery-chart-view-face > .gallery-chart-view-strip[hidden] { display: none; }
75
+ > .gallery-chart-view-face > .gallery-chart-view-bars {
76
+ display: grid;
77
+ grid-template-columns: fit-content(40%) minmax(0, 1fr);
78
+ gap: 8px 12px;
79
+ align-items: center;
80
+ margin: 0 0 4px;
81
+ font-size: 13px;
82
+ line-height: 1.4;
83
+ > .gallery-chart-view-row { display: contents; }
84
+ > .gallery-chart-view-row > .gallery-chart-view-label { text-align: right; overflow-wrap: anywhere; color: var(--doc-text); }
85
+ > .gallery-chart-view-row > .gallery-chart-view-lane { position: relative; height: 18px; margin-right: 4.5em; }
86
+ > .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-bar { position: absolute; top: 0; bottom: 0; min-width: 1px; border-radius: 3px; background: var(--doc-series-1); }
87
+ > .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-bar[hidden] { display: none; }
88
+ > .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-value { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; line-height: 1; color: var(--doc-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
89
+ &.gallery-chart-view-below > .gallery-chart-view-row > .gallery-chart-view-lane { margin-left: 4.5em; background: linear-gradient(var(--doc-grid), var(--doc-grid)) var(--gallery-chart-view-zero) 0 / 1px 100% no-repeat; }
90
+ }
91
+ > .gallery-chart-view-face > .gallery-chart-view-bars[hidden] { display: none; }
92
+ > .gallery-chart-view-face > .gallery-chart-view-line { margin: 6px 0 2px; font-size: 13px; line-height: 1.5; color: var(--doc-muted); }
93
+ > .gallery-chart-view-face > .gallery-chart-view-line[hidden] { display: none; }
94
+ }
@@ -0,0 +1,3 @@
1
+ <div data-doc-component="gallery/chart-view">
2
+ <script type="application/json">{}</script>
3
+ </div>
@@ -0,0 +1,22 @@
1
+ # 图表 (gallery/chart-view)
2
+
3
+ A bar chart of a table of the document: the rows counted, summed or averaged by a column (tasks by status, sales by region), or a bar for each row's number. It is a view of the table, drawn again as the table is typed in: the table holds the data, the chart never writes it. Use it beside a 看板 or a few 指标 over the same table. For a chart of numbers written for the chart alone, use 表格图表卡片 (gallery/chart-card), whose table is its own; for any other kind of chart, a chart of the document's (references/writing-html.md, "Figures and charts").
4
+
5
+ ## How to write it
6
+
7
+ Write a table, then the chart, as example.html does (`gallery block show gallery/chart-view` prints it):
8
+
9
+ - the table: an ordinary table of the document whose `<table>` carries `data-doc-chart-source="<key>"`, a key of the document's own (a letter, then letters, digits, `_` or `-`; 32 at most), its header row naming the columns, the first column naming each row. No merged cells.
10
+ - the chart: `<div data-doc-component="gallery/chart-view" data-doc-from="<key>">`, the same key, holding its settings, one `<script type="application/json">` on one line, each optional:
11
+ - `by`: the column whose values are the bars, the rows grouped by it in the order they first say them. Left out, a column named like a status (状态, 阶段, status), else one whose words repeat; with none, a bar for each row (its first cell its name; at most 50);
12
+ - `op`: `"count"`, `"sum"` or `"average"` of each group's rows. Left out: `"sum"` where the table has a column of numbers, else `"count"`;
13
+ - `value`: the column of numbers summed, averaged, or drawn a bar a row. Left out: the first column of numbers;
14
+ - `title`: what it shows, with its unit. Left out, one is made (各状态的行数, 各区域的金额合计).
15
+
16
+ One table may have several views (a 看板, 指标, another chart), each with the same key.
17
+
18
+ The reader adds a chart in Gallery from "/" (图表): it reads the nearest table above it, the key written on both; its menu's 设置… picks another table and changes its settings (so does its ⚙, where the page edits).
19
+
20
+ ## How it looks
21
+
22
+ A framed card: its title, then horizontal bars from zero, each with its name and its value, in the kit's series color, which follows the theme. The bars are drawn by the block's script and are not in the file: where the block is not, and in a Markdown export, a reader has the table.
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "gallery/countdown",
3
+ "apiVersion": 1,
4
+ "version": "2.0.0",
5
+ "name": { "zh": "倒计时", "en": "Countdown" },
6
+ "description": { "zh": "离某一天还有几天,到了那天说今天,过了说已经几天", "en": "How many days until a date: today on the day, and the days since after it" },
7
+ "words": "daojishi daoshu countdown days until 倒计时 倒数日 纪念日 日子",
8
+ "parts": {
9
+ "settings": { "at": ":scope > script", "edit": "data" }
10
+ },
11
+ "runtime": { "generated": [":scope > .gallery-countdown-face"] },
12
+ "places": ["page"],
13
+ "card": { "sizes": [[2, 2], [4, 2]], "resize": true },
14
+ "settings": [
15
+ { "key": "title", "label": { "zh": "名称", "en": "Name" }, "type": "text", "default": "" },
16
+ { "key": "date", "label": { "zh": "日期", "en": "Date" }, "type": "date", "required": true }
17
+ ]
18
+ }
@@ -0,0 +1,3 @@
1
+ <div data-doc-component="gallery/countdown">
2
+ <script type="application/json">{"title":"春节","date":"2027-02-06"}</script>
3
+ </div>
@@ -0,0 +1,216 @@
1
+ // gallery/countdown (倒计时): the days between today, by the reader's clock, and the date its settings
2
+ // name: how many are left before it, 就是今天 on the day itself, how many have gone since after it. Its two
3
+ // settings, `title` (the name of the day) and `date` (YYYY-MM-DD), are the card's form (on a custom page
4
+ // the grip at the card's top right › 设置…), kept in the data part `settings`, a script of JSON, which the
5
+ // board writes and this block only reads: it writes nothing. Drawn from that part on every `source` (the
6
+ // form, an Agent's write, an undo) and again as a day begins (the kit's `clock`, "day"), so that the count
7
+ // moves at midnight. The words are the page's language (the UI's where Gallery says it, else the page's
8
+ // lang). Its face (the pack's design B, in the kit's card tokens): a head of the chip, an hourglass, and
9
+ // the day's name alone (春节, or 倒计时 where it has none), on one line; at the bottom the count's label
10
+ // (还有, 已经过去) over the count, the hero, and its unit, and the date under them, faint (2027年2月6日 周六);
11
+ // on the day, 就是今天 in the accent where the count stands. A card four cells wide (`data-layout` "wide",
12
+ // by context.size, read again on `layout`) sets the month of the date beside it, a small calendar, Monday
13
+ // first, the day itself the one solid square of the accent (`monthOf`). A date it cannot read, or none,
14
+ // is the cards' empty face under the head: 选一个日子, and where to set one. Its face says by `data-kind`
15
+ // which of left, today, since or none it shows.
16
+
17
+ const WORDS = {
18
+ zh: {
19
+ left: "还有",
20
+ since: "已经过去",
21
+ today: "就是今天",
22
+ days: (/** @type {number} */ count) => `${count}`,
23
+ unit: () => "天",
24
+ countdown: "倒计时",
25
+ pick: "选一个日子",
26
+ where: "在卡片右上角的 设置… 里填日期",
27
+ whereShort: "在 设置… 里填日期",
28
+ weekdays: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
29
+ initials: ["一", "二", "三", "四", "五", "六", "日"],
30
+ date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${year}年${month}月${day}日`, weekday],
31
+ },
32
+ en: {
33
+ left: "Days left",
34
+ since: "Days since",
35
+ today: "Today",
36
+ days: (/** @type {number} */ count) => `${count}`,
37
+ unit: (/** @type {number} */ count) => (count === 1 ? "day" : "days"),
38
+ countdown: "Countdown",
39
+ pick: "Pick a day",
40
+ where: "Set its date in Settings… at the card's top right",
41
+ whereShort: "Set its date in Settings…",
42
+ weekdays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
43
+ initials: ["M", "T", "W", "T", "F", "S", "S"],
44
+ date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${weekday},`, `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][month - 1]} ${day}, ${year}`],
45
+ },
46
+ };
47
+
48
+ /** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
49
+ function languageOf(/** @type {HTMLElement} */ root) {
50
+ const ui = root.getAttribute("data-ge-language");
51
+ return (ui !== null ? ui === "en" : /^en(?:-|$)/i.test(root.lang)) ? "en" : "zh";
52
+ }
53
+
54
+ /**
55
+ * A date written YYYY-MM-DD as { year, month, day }, or null for anything else (no such day too:
56
+ * 2027-02-30).
57
+ * @param {unknown} written
58
+ */
59
+ function dateOf(written) {
60
+ const found = typeof written === "string" ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(written) : null;
61
+ if (!found) return null;
62
+ const [year, month, day] = found.slice(1).map(Number);
63
+ const date = new Date(Date.UTC(year, month - 1, day));
64
+ return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day ? { year, month, day } : null;
65
+ }
66
+
67
+ /**
68
+ * Where `now` (the reader's clock) stands to the date `written` (YYYY-MM-DD): { kind: "left", days }
69
+ * before it, { kind: "today", days: 0 } on it, { kind: "since", days } after it, by whole days of the
70
+ * calendar (counted in UTC from each day's date, so that a change of the clocks in between changes
71
+ * nothing); { kind: "none" } for a date it cannot read.
72
+ * @param {unknown} written
73
+ * @param {Date} now
74
+ * @returns {{ kind: "left" | "since" | "today", days: number } | { kind: "none" }}
75
+ */
76
+ function countdownOf(written, now) {
77
+ const date = dateOf(written);
78
+ if (!date) return { kind: "none" };
79
+ const days = Math.round((Date.UTC(date.year, date.month - 1, date.day) - Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())) / 86_400_000);
80
+ if (days === 0) return { kind: "today", days: 0 };
81
+ return days > 0 ? { kind: "left", days } : { kind: "since", days: -days };
82
+ }
83
+
84
+ /**
85
+ * What the card says, in `language`, of its `settings` (context.readJSON's, {} where none is set yet)
86
+ * at `now`: its head (the day's name, or 倒计时), the count's label (还有, 已经过去; "" with no count), its
87
+ * count (null on the day and with no date; `big`, the words standing there instead: 就是今天), the count's
88
+ * unit, its foot, a list of words a line breaks between and never inside (the date, its weekday), and,
89
+ * with no date it can read, `empty`: what the empty face says (选一个日子, where to set one on a wide card
90
+ * and on a narrow one).
91
+ * @param {any} settings
92
+ * @param {Date} now
93
+ * @param {"zh" | "en"} language
94
+ */
95
+ function faceOf(settings, now, language) {
96
+ const words = WORDS[language];
97
+ const date = dateOf(settings?.date);
98
+ const named = typeof settings?.title === "string" ? settings.title.trim() : "";
99
+ const count = countdownOf(settings?.date, now);
100
+ const head = named || words.countdown;
101
+ if (!date || count.kind === "none") return { head, label: "", count: null, unit: "", big: "", foot: [], empty: { title: words.pick, where: words.where, whereShort: words.whereShort } };
102
+ const weekday = words.weekdays[new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay()];
103
+ const foot = words.date(date.year, date.month, date.day, weekday);
104
+ if (count.kind === "today") return { head, label: "", count: null, unit: "", big: words.today, foot, empty: null };
105
+ return { head, label: count.kind === "left" ? words.left : words.since, count: words.days(count.days), unit: words.unit(count.days), big: "", foot, empty: null };
106
+ }
107
+
108
+ /**
109
+ * The month of `date` ({ year, month, day }) as the small calendar draws it, Monday first: its weeks, each
110
+ * seven days of the month (a number) or none before its first and after its last (null).
111
+ * @param {{ year: number, month: number }} date
112
+ */
113
+ function monthOf(date) {
114
+ const first = (new Date(Date.UTC(date.year, date.month - 1, 1)).getUTCDay() + 6) % 7;
115
+ const length = new Date(Date.UTC(date.year, date.month, 0)).getUTCDate();
116
+ const cells = [...Array(first).fill(null), ...Array.from({ length }, (_, index) => index + 1)];
117
+ while (cells.length % 7) cells.push(null);
118
+ return Array.from({ length: cells.length / 7 }, (_, week) => cells.slice(week * 7, week * 7 + 7));
119
+ }
120
+
121
+ /**
122
+ * An element of the face, of `kind` (its class).
123
+ * @template {keyof HTMLElementTagNameMap} K
124
+ * @param {K} tag
125
+ * @param {string} kind
126
+ */
127
+ function made(tag, kind) {
128
+ const node = document.createElement(tag);
129
+ node.className = `gallery-countdown-${kind}`;
130
+ return node;
131
+ }
132
+
133
+ DocKit.component({
134
+ id: "gallery/countdown",
135
+ on: ["source", "clock", "layout"],
136
+ mount(host, context) {
137
+ const language = languageOf(document.documentElement);
138
+ const words = WORDS[language];
139
+ const face = made("div", "face");
140
+ const main = made("div", "main");
141
+ const head = made("p", "head");
142
+ const chip = made("span", "chip");
143
+ chip.setAttribute("aria-hidden", "true");
144
+ chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 3.5h11M6.5 20.5h11M7.5 3.5v2.2c0 2 1.3 3.6 3.2 4.4l1.3.6 1.3-.6c1.9-.8 3.2-2.4 3.2-4.4V3.5M7.5 20.5v-2.2c0-2 1.3-3.6 3.2-4.4l1.3-.6 1.3.6c1.9.8 3.2 2.4 3.2 4.4v2.2"/></svg>';
145
+ const named = made("span", "name");
146
+ head.append(chip, named);
147
+ const core = made("div", "core");
148
+ const label = made("p", "label");
149
+ const middle = made("p", "count");
150
+ const foot = made("p", "foot");
151
+ core.append(label, middle, foot);
152
+ // No date: the cards' empty face, what to do and where.
153
+ const empty = made("div", "empty");
154
+ const emptyTitle = made("p", "empty-title");
155
+ const emptyWhere = made("p", "empty-where");
156
+ empty.append(emptyTitle, emptyWhere);
157
+ main.append(head, core, empty);
158
+ // A wide card's month, beside the count: the calendar of the date, the day itself marked.
159
+ const month = made("div", "month");
160
+ month.setAttribute("aria-hidden", "true");
161
+ face.append(main, month);
162
+ host.append(face);
163
+ const draw = (/** @type {string} */ reason = "", /** @type {unknown} */ detail = null) => {
164
+ if (reason === "clock" && detail !== "day") return; // a minute moves no count
165
+ const settings = context.readJSON("settings");
166
+ if (settings === undefined) return; // no JSON: the instance has failed, and Gallery shows what it holds
167
+ if (settings === null || typeof settings !== "object" || Array.isArray(settings)) return context.fail(new Error("its settings are no object: { \"title\": \"…\", \"date\": \"YYYY-MM-DD\" }"));
168
+ const at = new Date();
169
+ const now = faceOf(settings, at, language);
170
+ const layout = context.size && context.size.w >= 4 ? "wide" : "narrow";
171
+ face.dataset.layout = layout;
172
+ face.dataset.kind = countdownOf(settings.date, at).kind;
173
+ named.textContent = now.head;
174
+ named.title = now.head;
175
+ label.textContent = now.label;
176
+ if (now.count === null) {
177
+ middle.classList.add("gallery-countdown-words");
178
+ middle.textContent = now.big;
179
+ } else {
180
+ middle.classList.remove("gallery-countdown-words");
181
+ const number = made("span", "number");
182
+ number.textContent = now.count;
183
+ const unit = made("span", "unit");
184
+ unit.textContent = now.unit;
185
+ middle.replaceChildren(number, unit);
186
+ }
187
+ foot.replaceChildren(...now.foot.flatMap((piece, index) => {
188
+ const node = made("span", "piece");
189
+ node.textContent = piece;
190
+ return index === 0 ? [node] : [" ", node];
191
+ }));
192
+ emptyTitle.textContent = now.empty?.title ?? "";
193
+ emptyWhere.textContent = now.empty ? (layout === "wide" ? now.empty.where : now.empty.whereShort) : "";
194
+ const date = dateOf(settings.date);
195
+ if (!date) return void month.replaceChildren();
196
+ const head = words.initials.map((initial, index) => {
197
+ const cell = made("span", "initial");
198
+ cell.classList.toggle("gallery-countdown-weekend", index >= 5);
199
+ cell.textContent = initial;
200
+ return cell;
201
+ });
202
+ const weeks = monthOf(date);
203
+ month.dataset.weeks = String(weeks.length);
204
+ month.replaceChildren(...head, ...weeks.flatMap((week) => week.map((day, index) => {
205
+ const cell = made("span", "day");
206
+ if (day === null) return cell;
207
+ cell.textContent = String(day);
208
+ cell.classList.toggle("gallery-countdown-weekend", index >= 5);
209
+ cell.classList.toggle("gallery-countdown-on", day === date.day);
210
+ return cell;
211
+ })));
212
+ };
213
+ draw();
214
+ return { update: draw };
215
+ },
216
+ });
@@ -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="#f3f3f1"/><rect x="72.5" y="12.5" width="95" height="95" rx="8" fill="#ffffff" stroke="#e6e6e3"/><rect x="82" y="22" width="10" height="10" rx="3" fill="#efefed"/><rect x="96" y="24.5" width="22" height="5" rx="2.5" fill="#37352f"/><rect x="82" y="44" width="14" height="4" rx="2" fill="#a6a5a1"/><rect x="82" y="54" width="30" height="24" rx="3" fill="#1d1d1b"/><rect x="115" y="72" width="7" height="6" rx="3" fill="#a6a5a1"/><rect x="82" y="88" width="52" height="4" rx="2" fill="#d4d3cf"/></svg>
@@ -0,0 +1,118 @@
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. The pack's design B, in the kit's card tokens: the head (the chip, an
3
+ hourglass, and the day's name, one line cut with an ellipsis, its end clear of the card's grip); at the
4
+ bottom the count's label (还有, 已经过去) over the count, the card's hero (44px, 48px on a wide card) and
5
+ its unit, and the date under them, faint; on the day, 就是今天 in the accent's ink where the count stands.
6
+ A wide card (data-layout "wide", four cells) sets the month of the date at its right, 126px, seven
7
+ columns Monday first, the weekend fainter, the day itself the one solid square of the accent (a month of
8
+ six weeks a little closer, so that it fits the card). No date: the cards' empty face under the head.
9
+ Light and dark. */
10
+ [data-doc-component="gallery/countdown"] {
11
+ font-family: var(--gallery-font);
12
+ font-size: 13px;
13
+ line-height: 1.5;
14
+ color: var(--gallery-text);
15
+ > .gallery-countdown-face { display: flex; gap: 16px; box-sizing: border-box; min-height: 0; }
16
+ > .gallery-countdown-face > .gallery-countdown-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
17
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head {
18
+ display: flex;
19
+ align-items: center;
20
+ gap: 8px;
21
+ height: 20px;
22
+ min-width: 0;
23
+ margin: 0;
24
+ padding-inline-end: var(--gallery-grip-room, 0px);
25
+ }
26
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-chip {
27
+ flex: none;
28
+ display: grid;
29
+ place-items: center;
30
+ width: var(--gallery-chip-size);
31
+ height: var(--gallery-chip-size);
32
+ border-radius: var(--gallery-chip-radius);
33
+ background: var(--gallery-fill);
34
+ color: var(--gallery-muted);
35
+ }
36
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-chip > svg { display: block; width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
37
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-name {
38
+ min-width: 0;
39
+ overflow: hidden;
40
+ white-space: nowrap;
41
+ text-overflow: ellipsis;
42
+ font-size: var(--gallery-title-size);
43
+ line-height: var(--gallery-title-line);
44
+ font-weight: 600;
45
+ color: var(--gallery-text);
46
+ }
47
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core { margin-top: auto; }
48
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > p { margin: 0; }
49
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-label { font-size: 12px; line-height: 16px; color: var(--gallery-muted); }
50
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-label:empty { display: none; }
51
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count { display: flex; align-items: baseline; margin: 3px 0 7px; }
52
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-number {
53
+ font-size: 44px;
54
+ line-height: 1;
55
+ font-weight: var(--gallery-numeral-weight);
56
+ letter-spacing: var(--gallery-numeral-tracking);
57
+ font-variant-numeric: lining-nums;
58
+ color: var(--gallery-text-strong);
59
+ }
60
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-unit { margin-left: 3px; font-size: var(--gallery-unit); font-weight: 500; color: var(--gallery-muted); }
61
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-words {
62
+ display: block;
63
+ margin: 2px 0 6px;
64
+ font-size: 24px;
65
+ line-height: 30px;
66
+ font-weight: 600;
67
+ letter-spacing: .02em;
68
+ color: var(--gallery-accent-ink);
69
+ }
70
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-foot { font-size: 11.5px; line-height: 16px; color: var(--gallery-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
71
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty { display: none; }
72
+ > .gallery-countdown-face[data-layout="wide"] > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-number { font-size: 48px; }
73
+
74
+ /* No date: the cards' empty face, under the head. */
75
+ > .gallery-countdown-face[data-kind="none"] > .gallery-countdown-main > .gallery-countdown-core,
76
+ > .gallery-countdown-face[data-kind="none"] > .gallery-countdown-month,
77
+ > .gallery-countdown-face[data-layout="wide"][data-kind="none"] > .gallery-countdown-month { display: none; }
78
+ > .gallery-countdown-face[data-kind="none"] > .gallery-countdown-main > .gallery-countdown-empty {
79
+ flex: 1;
80
+ display: flex;
81
+ flex-direction: column;
82
+ justify-content: center;
83
+ gap: 4px;
84
+ min-height: 0;
85
+ }
86
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > p { margin: 0; }
87
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > .gallery-countdown-empty-title { font-size: 13.5px; line-height: 20px; font-weight: 600; color: var(--gallery-text); }
88
+ > .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > .gallery-countdown-empty-where { font-size: 12px; line-height: 18px; color: var(--gallery-faint); }
89
+
90
+ /* The month, at a wide card's right. */
91
+ > .gallery-countdown-face > .gallery-countdown-month { display: none; }
92
+ > .gallery-countdown-face[data-layout="wide"] > .gallery-countdown-month {
93
+ display: grid;
94
+ flex: none;
95
+ align-self: flex-end;
96
+ grid-template-columns: repeat(7, 18px);
97
+ row-gap: 2px;
98
+ width: 126px;
99
+ font-variant-numeric: tabular-nums;
100
+ }
101
+ > .gallery-countdown-face > .gallery-countdown-month > span {
102
+ display: grid;
103
+ place-items: center;
104
+ height: 16px;
105
+ border-radius: 5px;
106
+ font-size: 10.5px;
107
+ line-height: 1;
108
+ color: var(--gallery-muted);
109
+ }
110
+ > .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-initial { font-size: 10px; color: var(--gallery-faint); }
111
+ > .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-weekend { color: var(--gallery-faint); }
112
+ > .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-on { background: var(--gallery-accent); color: #fff; font-weight: 600; }
113
+ > .gallery-countdown-face > .gallery-countdown-month[data-weeks="6"] { row-gap: 1px; }
114
+ > .gallery-countdown-face > .gallery-countdown-month[data-weeks="6"] > span { height: 14px; }
115
+ }
116
+ /* On a custom page the face fills the card the board frames. */
117
+ .gallery-card > [data-doc-component="gallery/countdown"] { height: 100%; }
118
+ .gallery-card > [data-doc-component="gallery/countdown"] > .gallery-countdown-face { height: 100%; }
@@ -0,0 +1,3 @@
1
+ <div data-doc-component="gallery/countdown">
2
+ <script type="application/json">{}</script>
3
+ </div>
@@ -0,0 +1,22 @@
1
+ # 倒计时 (gallery/countdown)
2
+
3
+ A card for a custom page (its places are `page`): how many days are left until a date, 就是今天 on the day, and how many days have gone since after it. Use it for a day the user waits for or counts from (a holiday, a deadline, an anniversary).
4
+
5
+ ## Settings
6
+
7
+ Its two settings are the card's form, which the user opens from the grip at the card's top right › 设置…:
8
+
9
+ | Key | Label | Type | What it is |
10
+ | --- | --- | --- | --- |
11
+ | `title` | 名称 | text | the name of the day, as 春节 or 项目上线; left empty, the card says 还有 / 已经过去 alone |
12
+ | `date` | 日期 | date | the day, `YYYY-MM-DD` |
13
+
14
+ They are kept in its data part `settings`, a `<script type="application/json">`, as example.html does: `{"title":"春节","date":"2027-02-06"}` (on one line and compact, as the card's 设置… writes it back). Write them there when the user tells you the day, or `gallery page add <slug> gallery/countdown --set date=2027-02-06 --set title=春节` with the add; the date is the one setting it cannot show anything without (`required` in its manifest): ask the user for it when they did not say which day. `{}` (template.html, what a menu adds) is a card with no date yet, which asks for one (右上角手柄 › 设置…), and `gallery page check` notes it. The block reads them and writes nothing.
15
+
16
+ ## How to write it
17
+
18
+ Put it on a custom page as a card of its board, `<section class="gallery-card" data-card-id="…" data-x data-y data-w data-h>`, holding one instance, after `gallery block add countdown`, the instance as template.html has it, then its settings as above. Sizes: 2 × 2 (the default) and 4 × 2 (the month of the date beside the count, the day marked).
19
+
20
+ ## How it looks
21
+
22
+ In Gallery 风格's look (the kit's card tokens, light and dark): a head of a small gray chip and a title, its end clear of the card's grip; one hero; the rest small and gray; the accent on the data and on today alone. Its head is an hourglass's chip and the day's name; at the bottom 还有 (or 已经过去) over the count of days, 44px, and the date faint under them (2027年2月6日 周六). On the day itself 就是今天 in the accent stands where the count was. A 4 × 2 card sets the month of the date at its right, Monday first, the day the one solid square of the accent. With no date it says 选一个日子 and where to set one.
@@ -0,0 +1,14 @@
1
+ {
2
+ "id": "gallery/habit",
3
+ "apiVersion": 1,
4
+ "version": "2.0.0",
5
+ "name": { "zh": "习惯打卡", "en": "Habit tracker" },
6
+ "description": { "zh": "每天打一次卡,显示连续了几天和这一周,名字在卡片上直接改", "en": "A check-in a day, the streak and this week; the habit's name is edited on the card" },
7
+ "words": "xiguandaka xiguan daka habit streak checkin tracker 习惯 打卡 连续 坚持",
8
+ "parts": {
9
+ "habit": { "at": ":scope > script", "edit": "data" }
10
+ },
11
+ "runtime": { "generated": [":scope > .gallery-habit-face"] },
12
+ "places": ["page"],
13
+ "card": { "sizes": [[4, 2], [2, 2], [4, 4]], "resize": true }
14
+ }
@@ -0,0 +1,3 @@
1
+ <div data-doc-component="gallery/habit">
2
+ <script type="application/json">{"name":"每天读书半小时","days":["2026-10-30","2026-10-31","2026-11-02","2026-11-03","2026-11-04","2026-11-05","2026-11-06"]}</script>
3
+ </div>