@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
@@ -17,13 +17,14 @@ let any = false; // the server could not say which: the page connected a moment
17
17
  export const isBehind = (id) => any || behind.has(id);
18
18
 
19
19
  /**
20
- * `components`, the list a page holds, as the reader's settings now say: the state each package says,
21
- * which a menu reads, at once and with nothing shown again (`doc-settings-changed`). A package that
22
- * comes on is in none of that yet: it comes with the list the page reads as the catalog changes, as
23
- * one added does (`doc-catalog-changed`, ./page.mjs).
20
+ * `components`, the list a page holds, as the reader's settings now say: the state each package says
21
+ * by its `places` and gallery.json's hidden, shown, disabled, unlisted and packs off (settingState, inDocumentMenus: the
22
+ * server's own rule), which a menu reads, at once and with nothing shown again (`doc-settings-changed`).
23
+ * A package that comes on is in none of that yet: it comes with the list the page reads as the catalog
24
+ * changes, as one added does (`doc-catalog-changed`, ./page.mjs).
24
25
  */
25
26
  export function followSettings(components, settings) {
26
- for (const entry of components) entry.state = settingState(entry.id, settings);
27
+ for (const entry of components) entry.state = settingState(entry.id, { hidden: [], shown: [], disabled: [], unlisted: [], packsOff: [], ...settings }, entry.places);
27
28
  }
28
29
 
29
30
  /** Hears what changed of the catalog while the page held no instance of it. */
@@ -0,0 +1,18 @@
1
+ import { ATTRIBUTE, INSTANCE } from "../../shared/components/installed.mjs";
2
+
3
+ // A custom page's card read for the instance it holds, by the host's own mark of an instance
4
+ // (shared/components/installed.mjs INSTANCE, ATTRIBUTE: a div or section naming its package): the one
5
+ // the server reads (shared/page-cards.mjs readPage, which refuses an article or a span carrying the
6
+ // attribute, and page check fails it) and the kit's page runtime reads. The board
7
+ // (src/editor/page/board/index.mjs) is a page engine and knows no package's marks, so what it asks of
8
+ // the DOM it asks here: a card with an `<article data-doc-component="…">` is a card with no instance on
9
+ // the page too, offered no settings and sending no part, instead of one the service then refuses.
10
+
11
+ /** The instance card `card` holds (its child that is one), or null. */
12
+ export const instanceOf = (card) => [...card.children].find((child) => child.matches(INSTANCE)) ?? null;
13
+
14
+ /** The package id an instance names (<scope>/<name>), or null for no instance. */
15
+ export const packageOf = (instance) => instance?.getAttribute(ATTRIBUTE) ?? null;
16
+
17
+ /** The nearest instance around `node` (itself counted), or null. */
18
+ export const instanceAround = (node) => node.closest(INSTANCE);
@@ -6,7 +6,7 @@ import { begin, done, made } from "../../page/made.mjs";
6
6
  import { createMenu } from "../../page/menu.mjs";
7
7
  import { keptByComponent } from "../../page/page-objects.mjs";
8
8
  import { hideTooltip, tooltipAt } from "../../page/tooltip.mjs";
9
- import { addStyle, element } from "../../page/ui.mjs";
9
+ import { addStyle, element, textButton } from "../../page/ui.mjs";
10
10
  import { CHECKED, CONTINUE, FLOW, START, TODO, heldListType, holdsSays, listType, mergeSays } from "./index.mjs";
11
11
  import { BLOCK_TYPES, accepts } from "../registry.mjs";
12
12
  import { FLOW_KEY, isFlowLabel } from "../../../shared/components/list.mjs";
@@ -186,8 +186,7 @@ const STYLE = `
186
186
  .ge-list-value-title { padding: 10px 12px 0; color: var(--ge-tx2); font-size: 12px; font-weight: 500; line-height: 14px; }
187
187
  .ge-list-value input { box-sizing: border-box; flex: 1; min-width: 0; height: 28px; margin: 0; padding: 0 8px; border: 0; border-radius: 6px; outline: none; background: var(--ge-hover); color: var(--ge-tx); font: inherit; box-shadow: inset 0 0 0 1px var(--ge-line); }
188
188
  .ge-list-value input:focus { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ge-tx3) 60%, transparent); }
189
- .ge-list-value button { flex: none; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: var(--ge-accent); color: #fff; font: inherit; cursor: pointer; }
190
- .ge-list-value button:hover { background: var(--ge-accent-hover); }
189
+ .ge-list-value .ge-btn { flex: none; }
191
190
  `;
192
191
 
193
192
  // ---------- keys, numbers ----------
@@ -494,9 +493,7 @@ export function create({ struct, say, convertHost, targetsOf, look, isEditing, b
494
493
  } else return;
495
494
  event.preventDefault();
496
495
  });
497
- const confirm = element("button", { type: "button", text: t("确定") });
498
- confirm.addEventListener("mousedown", (event) => event.preventDefault());
499
- confirm.addEventListener("click", apply);
496
+ const confirm = textButton(t("确定"), apply, { primary: true });
500
497
  const view = element("div", {}, element("div", { class: "ge-list-value-title", text: t("新编号为") }), element("div", { class: "ge-list-value" }, field, confirm));
501
498
  item.setAttribute("data-ge-number", "open");
502
499
  menu.open([{ node: view, cells: [] }], rect, { label: t("修改编号值"), icons: false, width: 148, highlight: false, onClose: () => item.removeAttribute("data-ge-number") });
@@ -1,18 +1,23 @@
1
1
  import { svg } from "../icons.mjs";
2
+ import { TABLE_ICONS } from "../../page/table/icons.mjs";
2
3
 
3
4
  // The media blocks' toolbar icons (an image's, an embed's, the block menus' rows): the editor's own line
4
5
  // drawings (components/icons.mjs svg) on the same 20 units as the menus' others, the picture in the
5
6
  // middle 16 of them. They carry no size or color: the toolbar's buttons and the menus set them.
7
+ // Plain, a few strokes each (the user, 2026-11-09: Notion's looked too close, then the bars against a
8
+ // guide line that took their place too busy): a side is the editor's own 对齐 lines, the ones a text
9
+ // block's and a table's 对齐 › show (table/icons.mjs), so one look says it everywhere; a caption a picture
10
+ // (one hill in it) over a line of words; viewing large one line corner to corner with a head at each end; three dots.
6
11
 
7
12
  export const TOOL_ICONS = {
8
- // The three sides: a picture beside the line it stands against, between a rule above and below.
9
- alignLeft: svg('<path d="M4 4.5h12M4 15.5h12"/><rect x="4" y="7.25" width="6.5" height="5.5" rx="1.25"/>'),
10
- alignCenter: svg('<path d="M4 4.5h12M4 15.5h12"/><rect x="6.75" y="7.25" width="6.5" height="5.5" rx="1.25"/>'),
11
- alignRight: svg('<path d="M4 4.5h12M4 15.5h12"/><rect x="9.5" y="7.25" width="6.5" height="5.5" rx="1.25"/>'),
12
- // A picture with two lines of caption under it.
13
- caption: svg('<rect x="4.5" y="4" width="11" height="6.5" rx="1.5"/><path d="M4.5 13.25h11M4.5 16h6"/>'),
14
- // A magnifier with a plus.
15
- expand: svg('<circle cx="9" cy="9" r="5"/><path d="m12.75 12.75 3.5 3.5M7 9h4M9 7v4"/>'),
13
+ // The three sides: the editor's alignment lines (a text block's 对齐 ›, a table's).
14
+ alignLeft: TABLE_ICONS["doc-align-left"],
15
+ alignCenter: TABLE_ICONS["doc-align-center"],
16
+ alignRight: TABLE_ICONS["doc-align-right"],
17
+ // A picture (its frame, one hill in it) over a line of words.
18
+ caption: svg('<rect x="3.75" y="3.25" width="12.5" height="9.5" rx="1.5"/><path d="m4 11.75 4-3.5 4.5 4M3.75 16.25h12.5"/>'),
19
+ // One line from corner to corner, a head at each end.
20
+ expand: svg('<path d="M11.5 4.25h4.25V8.5M8.5 15.75H4.25V11.5M15.25 4.75l-10.5 10.5"/>'),
16
21
  // An arrow down onto a line.
17
22
  download: svg('<path d="M10 4v9M6.5 9.75l3.5 3.5 3.5-3.5M4.5 16h11"/>'),
18
23
  more: svg('<circle cx="5" cy="10" r="1.3" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.3" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.3" fill="currentColor" stroke="none"/>'),
@@ -175,14 +175,16 @@ export function create({ struct, finishStep, look, say, active, blocks, newParag
175
175
  },
176
176
  /**
177
177
  * `file` pasted: a new block made by `make(doc)`, put in its place by `put` (the paste's, clipboard/:
178
- * where a block pasted there goes, one undo step; false when it could not), then `fill(figure, file)`
179
- * (its placeholder filled). Returns whether it took the file.
178
+ * where a block pasted there goes, one undo step; false when it could not), the block selected, then
179
+ * `fill(figure, file, { pasted: true })` (its placeholder filled, in the same undo step: one Ctrl+Z
180
+ * takes the paste back to what stood there). Returns whether it took the file.
180
181
  */
181
182
  paste(put, file, make, fill) {
182
183
  if (!file) return false;
183
184
  const figure = make(document);
184
185
  if (!put(figure)) return false;
185
- fill(figure, file);
186
+ blocks()?.select(figure, { quiet: true });
187
+ fill(figure, file, { pasted: true });
186
188
  return true;
187
189
  },
188
190
  };
@@ -1,3 +1,4 @@
1
+ import { IN_LAYER } from "../../../shared/layers.mjs";
1
2
  import { tooltip } from "../../page/tooltip.mjs";
2
3
  import { element } from "../../page/ui.mjs";
3
4
 
@@ -7,7 +8,7 @@ import { element } from "../../page/ui.mjs";
7
8
 
8
9
  /** The toolbar's look, and its buttons' (a popover's too: an image's 对齐 pops three of them). */
9
10
  export const TOOLBAR_STYLE = `
10
- .ge-layer > .ge-media-bar { pointer-events: auto; }
11
+ .ge-layer > .ge-media-bar { pointer-events: auto; z-index: ${IN_LAYER.button}; } /* over its block's fill while the block is selected */
11
12
  .ge-media-bar { display: flex; padding: 2px; border-radius: 6px; background: var(--ge-bg);
12
13
  box-shadow: 0 0 0 1px var(--ge-outline), 0 4px 12px -2px light-dark(rgb(25 25 25 / 8%), rgb(0 0 0 / 30%)); }
13
14
  .ge-media-tool { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; color: var(--ge-ico2); cursor: pointer; user-select: none; transition: background 20ms ease-in; }
@@ -21,11 +22,19 @@ export const mediaBar = (label) => element("div", { class: "ge-media-bar", role:
21
22
  /**
22
23
  * A toolbar button: `label` (what it is), `tip` (the tooltip), `icon` (an svg, or a function giving
23
24
  * it, drawn by draw() each time the bar is shown), `run(button)` on a click while `alive()` (the block it stands for is
24
- * still on the page).
25
+ * still on the page). draw() puts a new icon in only when it changed: a bar placed every frame (an
26
+ * image's, while it is selected) that put its icons in anew each time took the svg a press landed on
27
+ * out of the page before the button was let go, and the browser then fired no click (2026-11-09).
25
28
  */
26
29
  export function toolButton({ label, tip, icon, run, alive }) {
27
30
  const button = element("div", { class: "ge-media-tool", role: "button", "aria-label": label });
28
- button.draw = () => { button.innerHTML = typeof icon === "function" ? icon() : icon; };
31
+ let drawn = null;
32
+ button.draw = () => {
33
+ const markup = typeof icon === "function" ? icon() : icon;
34
+ if (markup === drawn) return;
35
+ drawn = markup;
36
+ button.innerHTML = markup;
37
+ };
29
38
  if (typeof icon !== "function") button.draw(); // a function icon depends on the block: drawn when the bar is shown
30
39
  tooltip(button, tip);
31
40
  button.addEventListener("pointerdown", (event) => event.preventDefault());
@@ -1,5 +1,6 @@
1
1
  import { svg } from "../icons.mjs";
2
2
  import { PARAGRAPH, classOf } from "../kit.mjs";
3
+ import { ALIGN_TOGGLES } from "../align.mjs";
3
4
  import { t } from "../../../shared/i18n/index.mjs";
4
5
 
5
6
  // 文本 and 小字: the plain text blocks. A paragraph is the editor's default block: Enter makes one,
@@ -8,7 +9,7 @@ import { t } from "../../../shared/i18n/index.mjs";
8
9
  // default, a paragraph is the engines' own: core.mjs (newHost, splitBlock), insert/
9
10
  // (paragraphBefore, newParagraph, clickBlank), convert.mjs (typeOf tells 小字 from text), clipboard/own/
10
11
  // (a text block's description is the engine's own, and a block that says no kind is written as a paragraph).
11
- // Its color (颜色 in the block menu): class switches, colors.mjs.
12
+ // Its color (颜色 in the block menu): class switches, colors.mjs; its alignment and indent (对齐与缩进), align.mjs.
12
13
  // Its look: the kit's styles/flow.css (src/render/kit/).
13
14
  /** The class of small text's end part (the page editor's Tab), a span at the line's right end (the kit's styles/flow.css). */
14
15
  export const TAB = classOf(PARAGRAPH.tail);
@@ -23,7 +24,7 @@ export default {
23
24
  name: "paragraph",
24
25
  listed: () => t("文本"), hideable: false,
25
26
  units: {
26
- paragraph: { name: t("文本"), match: [{ rank: 180, tag: "p" }], colors: ["text", "background"], emptyIsNothing: true, fromWords: true },
27
+ paragraph: { name: t("文本"), match: [{ rank: 180, tag: "p" }], colors: ["text", "background"], toggles: ALIGN_TOGGLES, emptyIsNothing: true, fromWords: true, replacedByFile: true },
27
28
  },
28
29
  types: {
29
30
  paragraph: {
@@ -34,7 +35,7 @@ export default {
34
35
  },
35
36
  note: { // 小字: a brief label, unit or scope note
36
37
  turn: 2, menu: ["basic", 2],
37
- tag: "p", className: "doc-note", kind: "paragraph", leaf: "note", text: true, empty: true,
38
+ tag: "p", className: "doc-note", kind: "paragraph", leaf: "note", text: true, empty: true, emptyToText: true,
38
39
  corner: "paragraph", // seldom picked: the gray corner of 文本's cell (type-grid.mjs), so 文本 and the headings fill one line
39
40
  label: t("小字"), icon: svg('<path d="M6.25 8.5v-.9h7.5v.9M10 7.6v8.15M8.75 15.75h2.5"/>'), words: "小字 注释 说明 备注 标注 xiaozi zhushi shuoming beizhu xz zs sm note small caption",
40
41
  glance: { row: 11, name: "小字", write: "`<p class=\"doc-note\">`, `span.doc-tab` at its right", rule: "Kit blocks" },
@@ -44,7 +44,7 @@ import { t } from "../../shared/i18n/index.mjs";
44
44
  // without. What is hidden goes from "/", 在下方新建 and the handle's grid and nothing else
45
45
  // (page/offered.mjs); its blocks, its Markdown shortcut and "Blocks at a glance" stay.
46
46
  // units the unit kinds it defines (blocks the reader selects, moves and deletes):
47
- // { [kind]: { name, icon?, match, chapter?, fixed?, block?, handle?, below?, boxed?, beside?, inRow?, sharesHeight?, entersAfter?, resizable?, copy?, clipboard?, sizes?, toggles?, colors?, colorDefaults?, removedEmpty?, turnsEmpty?, leadsChapter?, canHaveChildren?, emptyIsNothing?, fromWords?, attributes? } }
47
+ // { [kind]: { name, icon?, match, chapter?, fixed?, block?, handle?, below?, boxed?, beside?, inRow?, sharesHeight?, entersAfter?, resizable?, copy?, clipboard?, sizes?, toggles?, colors?, colorDefaults?, removedEmpty?, turnsEmpty?, leadsChapter?, canHaveChildren?, emptyIsNothing?, fromWords?, replacedByFile?, attributes? } }
48
48
  // match: rules an element matches by its tag (one of `tag`), its class and its
49
49
  // attribute, and by the element it stands in (`parent`: { tag?, class? }, a flowchart's
50
50
  // step being an li whose parent is an ol.doc-flow), whichever are given; every
@@ -58,7 +58,7 @@ import { t } from "../../shared/i18n/index.mjs";
58
58
  // (its container's: a tab's, the Sheet area's, on the tab row); below: false, its menu
59
59
  // offers no new block below it (a tab, a Sheet area); boxed: a block with a frame of its
60
60
  // own, no text flowing beside it: a double click between two of them makes a paragraph,
61
- // a click to its right selects it, Enter on it selected puts a paragraph after it unless
61
+ // a click to its right puts the caret after it (page/after/), Enter on it selected puts a paragraph after it unless
62
62
  // it is a text block (beside.mjs), and it is a block of its own to Ctrl+A; beside: the
63
63
  // same click and Enter without being boxed (a row of columns); inRow(element): whether
64
64
  // this one stands beside another now, as a row of columns always does and a flowchart's
@@ -91,6 +91,8 @@ import { t } from "../../shared/i18n/index.mjs";
91
91
  // keys of a block stand after it as they stand in what it is in (a list: under its last item).
92
92
  // emptyIsNothing: a block of it left empty counts as nothing written, in a container
93
93
  // that says `removedEmpty`. fromWords: a block of it can be made again from its words alone.
94
+ // replacedByFile: a file pasted at the caret in an empty block of it takes the block's place (notion-lite's
95
+ // pasteFiles: an empty text block goes), else it goes after the block (page/clipboard/).
94
96
  // boxes the box kinds it defines (containers whose children are units): { [kind]: { role,
95
97
  // name?, classes?, find?, owner?, takenBy?, also?, leaveByEnter?, endIsPadding?, lead?, firstLineActs?, firstBlock?, groups?, holdsOne?, emptyIsNothing?, outer?, selectAll? } }, classes being the kit's classes that make an element one
96
98
  // (rank order, as above); the others the server knows by their tag (findUnits). find: where
@@ -136,7 +138,7 @@ import { t } from "../../shared/i18n/index.mjs";
136
138
  // own. Every component's rules are tried in `rank` order, with the page's (PAGE below),
137
139
  // and the first match wins: a rule ranked below the page's 80 goes before any control's,
138
140
  // and is the one that can claim a button as its own.
139
- // hosts the kinds of text block it defines (data-ge-kind): { [kind]: { name, caps, tex?, wrapped?, parts?, opensBefore?, textFilters?, formula?, closed?, inner?, blankSays?, placeholder? } }, caps
141
+ // hosts the kinds of text block it defines (data-ge-kind): { [kind]: { name, caps, tex?, wrapped?, parts?, opensBefore?, textFilters?, formula?, closed?, inner?, pictures?, blankSays?, placeholder?, untitled?, opensBody? } }, caps
140
142
  // ({ bound, blockLevel }) giving what such a text block can do (source/); opensBefore:
141
143
  // Enter at its very start, with words in it, puts an empty paragraph before its block
142
144
  // where it does not split, as one that splits does (typing/); textFilters: false, what
@@ -145,14 +147,19 @@ import { t } from "../../shared/i18n/index.mjs";
145
147
  // none there (takesFormula);
146
148
  // closed: the page holds no text block for it until the reader opens it (a code block);
147
149
  // inner(element): the text a save takes of one, as markup, where that is not what its
148
- // nodes say (a code block's code);
150
+ // nodes say (a code block's code); pictures: it holds pictures amid its words (a table
151
+ // cell's), { show(root) (the file's made the page's: where the server serves them),
152
+ // write(element) (one's markup, "" for one of no file, null for no picture) } (core.mjs);
149
153
  // parts: the parts of components ([component id, part name]: a part of its shared
150
154
  // description edited as text, src/shared/components/) whose elements are text blocks
151
155
  // of this kind, found so by the server's scan; tex: its text is a formula's TeX alone; wrapped: the page makes the text block a
152
156
  // span inside the element, which keeps its own behaviour (a Sheet tab's button);
153
157
  // blankSays: what the status line says of one left blank that must hold words, as a
154
158
  // type's says of a block of it (blankSaysOf); placeholder: what one says while it
155
- // is empty under the caret, whatever part it is (placeholderOf)
159
+ // is empty under the caret, whatever part it is (placeholderOf); untitled: it says its
160
+ // placeholder whenever it is empty, the caret in it or not (the page's title, notion-lite's
161
+ // data-ph 新页面: typing/ updatePlaceholder); opensBody: Enter in it goes to the body, what
162
+ // follows the caret a new paragraph right below it (the page's title: typing/ enterBody)
156
163
  // placeholders what an empty text block says while the caret is in it: { [part]: text }, part
157
164
  // being a part of its shared description (src/shared/components/) whose element it is
158
165
  // (placeholderOf); a heading's own is its type's `placeholder`, and a type's `placeholder:
@@ -160,7 +167,7 @@ import { t } from "../../shared/i18n/index.mjs";
160
167
  // types the blocks the reader can make on the page or turn a block into (the "/" menu,
161
168
  // Markdown shortcuts, the block menu), written by the server in the kit's plain markup:
162
169
  // { [type]: { tag, className?, kind, box?, leaf?, wraps?, container?, part?, text?, inside?, tex?,
163
- // empty?, resettable?, bare?, placeholder?, bar?, label?, icon?, hint?, markdown?, words?, turn?, menu?, fresh?,
170
+ // empty?, resettable?, emptyToText?, bare?, placeholder?, bar?, label?, icon?, hint?, markdown?, words?, turn?, menu?, fresh?,
164
171
  // corner?, preload?, onSplit?, create?, takesAsIs?, holder?, nests?, joins?, leadIcon?, fromSelection?, clipboard?, glance? } } and, for the blocks the page
165
172
  // and the server write apart from text, title?, content?, keyed?, written?,
166
173
  // extras?, textHost?, blanks?, blankSays? (what each says is at its component). Leaves hold
@@ -169,7 +176,8 @@ import { t } from "../../shared/i18n/index.mjs";
169
176
  // giving its markup, its words in the language t() says them in: components/placeholder.mjs
170
177
  // mediaBar); resettable: an empty block of the type
171
178
  // turns into body text on Enter, and the first of its container on Backspace at its start (a
172
- // quote's paragraph, a list item: notion-lite's `resettable`, typing/leave.mjs). leaf: the text block a block turned
179
+ // quote's paragraph, a list item: notion-lite's `resettable`, typing/leave.mjs); emptyToText: Backspace in an
180
+ // empty block of the type turns it into an empty paragraph where it stands (a heading, small text: typing/leave.mjs). leaf: the text block a block turned
173
181
  // into the type becomes; wraps: such a text block sits in a container of the type, found
174
182
  // by `container` (a selector); text: a plain text leaf; empty: a leaf written with no
175
183
  // text too (a paragraph, a heading, a list item, a code block: an empty
@@ -380,7 +388,11 @@ const PAGE = {
380
388
  hosts: {
381
389
  // A free text block may be left empty (Notion's): written as an empty element, one line high.
382
390
  flow: { opensBefore: true, caps: ({ bound }) => bound ? ["split", "merge", "links"] : ["split", "merge", "remove", "empty", "links"] },
383
- title: { name: t("文档主标题"), caps: () => ["plain"], blankSays: t("文档主标题还空着:写上标题后才会保存。") },
391
+ // The page's title may be left empty (notion-lite's page title): an untitled document, its title
392
+ // saying 未命名文档 in gray (`untitled`), never written into the file; whatever names the document
393
+ // names it so (the workbench's reportTitle, links/pages.mjs, an export's <title>). Enter in it goes to the
394
+ // body (`opensBody`: typing/ enterBody, notion-lite's page title).
395
+ title: { name: t("文档主标题"), caps: () => ["plain", "empty"], placeholder: t("未命名文档"), untitled: true, opensBody: true },
384
396
  ...MEDIA_HOSTS,
385
397
  },
386
398
  readOnly: [
@@ -427,6 +439,12 @@ export const CATEGORY_NAMES = Object.fromEntries(Object.entries(CATEGORIES).map(
427
439
  */
428
440
  export const COPIED_AS_ITSELF = new Set(Object.entries(UNITS).filter(([kind, unit]) => UNIT_CATEGORY[kind] === "card" || unit.copy === "itself").map(([kind]) => kind));
429
441
 
442
+ /**
443
+ * The unit kinds drawn with no selection fill while selected alone (their own tools show it), each with
444
+ * the selector its element must hold for that (an image with its picture: a placeholder is filled).
445
+ */
446
+ export const UNFILLED_ALONE = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.unfilled).map(([kind, unit]) => [kind, unit.unfilled]));
447
+
430
448
  /** What the reader calls each kind of unit (block labels while dragging, the block menu). */
431
449
  export const KIND_NAMES = Object.fromEntries(Object.entries(UNITS).filter(([, unit]) => unit.name).map(([kind, unit]) => [kind, unit.name]));
432
450
 
@@ -735,6 +753,9 @@ export const removedFromAnywhere = (kind) => UNITS[kind]?.removedEmpty === "anyw
735
753
  const NOTHING_EMPTY = flagged("emptyIsNothing");
736
754
  export const TEXT_BLOCKS = [...new Set(Object.values(BLOCK_TYPES).filter((spec) => NOTHING_EMPTY.has(spec.kind)).map((spec) => spec.tag)), ...Object.values(BOXES).filter((box) => box.emptyIsNothing).flatMap((box) => box.classes.map((rule) => `.${rule.class}`))].join(", ");
737
755
 
756
+ /** Whether an empty unit of this kind gives its place to a file pasted at its caret (`replacedByFile`). */
757
+ export const replacedByFile = (kind) => Boolean(UNITS[kind]?.replacedByFile);
758
+
738
759
  /** Whether what a unit of this kind is turned into is an empty block in its place (`turnsEmpty`). */
739
760
  export const turnsEmpty = (kind) => Boolean(UNITS[kind]?.turnsEmpty);
740
761
 
@@ -768,7 +789,7 @@ export const hasOuter = (boxKind) => BOXES[boxKind]?.outer !== false;
768
789
  /** The unit kinds with a frame of their own (`boxed`): a double click between two makes a paragraph (insert/). */
769
790
  export const BOXED = flagged("boxed");
770
791
 
771
- /** The unit kinds a click to the right of one, past the text area it stands in, selects: the boxed ones and those that say `beside` (beside.mjs). */
792
+ /** The unit kinds a click to the right of one puts the caret after (page/after/): the boxed ones and those that say `beside` (beside.mjs). */
772
793
  export const BESIDE = new Set([...BOXED, ...flagged("beside")]);
773
794
 
774
795
  /** Whether a unit of this kind stands beside another now, `element` being that unit (`beside`, `inRow`). */
@@ -1,3 +1,4 @@
1
+ import { ALIGN_PLACES } from "../align.mjs";
1
2
  import { BLOCK_COLORS } from "../colors.mjs";
2
3
  import { svg } from "../icons.mjs";
3
4
  import { SPAN } from "../../../shared/media.mjs";
@@ -6,6 +7,8 @@ import { columnWidths, slotsOf, tileSlots, tileSpans } from "../../../shared/tab
6
7
  import { CELL_ALIGN_CLASSES, CELL_BOLD_CLASS, CELL_VALIGN_CLASSES } from "../../../shared/components/table.mjs";
7
8
  import { CHART_KEY, CHART_SOURCE } from "../../../shared/table-chart.mjs";
8
9
  import { t } from "../../../shared/i18n/index.mjs";
10
+ import { escapeAttribute } from "../../../shared/escape.mjs";
11
+ import { servedFile } from "../../page/served.mjs";
9
12
 
10
13
  const ICON = svg('<rect x="3.25" y="3.75" width="13.5" height="12.5" rx="2"/><path d="M3.25 8h13.5M3.25 12.1h13.5M8.25 3.75v12.5"/>');
11
14
 
@@ -51,9 +54,12 @@ export default {
51
54
  { rank: 90, class: "doc-table-wrap" },
52
55
  ],
53
56
  boxed: true,
57
+ toggles: ALIGN_PLACES, // the table placed on the page, at the left (the kit's own), centred or at the right: 对齐 ›, a text block's classes (align.mjs)
54
58
  resizable: ".doc-table-wrap[data-ge-unit]", // its right and bottom edges, once it is in the file
55
59
  copy: "itself", // within the report a copy keeps all of its markup (its scope line, its frame's size); another report's gets the table's data (tableData) made anew
56
- attributes: { [NUMBERS]: (value) => value === "off" },
60
+ // 识别数字列 off, and the key a chart or a view reads it by (src/shared/table-chart.mjs), which a view
61
+ // made from a menu puts on a table that has none (page/table/binding.mjs) in the step that makes the view.
62
+ attributes: { [NUMBERS]: (value) => value === "off", [CHART_SOURCE]: (value) => CHART_KEY.test(value) },
57
63
  sizes: {
58
64
  [SPAN]: { min: 0.15, max: 3 }, // past 1 the table is wider than the text and scrolls in its frame
59
65
  [TABLE_HEIGHT]: { min: 80, max: 4000, px: true, none: true, height: true },
@@ -62,7 +68,7 @@ export default {
62
68
  },
63
69
  components: ["doc-table-wrap", "doc-table-meta"],
64
70
  hosts: {
65
- cell: { name: t("表格单元格"), caps: () => ["empty", "links"] },
71
+ cell: { name: t("表格单元格"), caps: () => ["empty", "links"], pictures: { show: showPictures, write: writtenPicture } },
66
72
  },
67
73
  types: {
68
74
  // Made by a paste or the "/" menu (三列三行, a header row: page.mjs newTable): no class here, so
@@ -306,3 +312,56 @@ export function tableData(element, serializeInner) {
306
312
  ...(chart && CHART_KEY.test(chart) ? { chart } : {}),
307
313
  };
308
314
  }
315
+
316
+ // ---------- a cell's pictures ----------
317
+ // 单元格里的图片 (page/table/pictures.mjs; source/blocks.mjs cellPictureProblem says what the file
318
+ // takes): an <img> amid a cell's words, a picture of the report's folder. On the page it shows where
319
+ // the server serves the folder (`src`, page/served.mjs), the file it is in data-ge-src, as an
320
+ // image block's; the cell's text writes it back from its element (the host's `pictures`, which
321
+ // core.mjs reads): <img src="assets/<file>" alt="…" width="N">, its attributes in the order the
322
+ // element has them, the file's own; one the browser put in from elsewhere, its file no picture of
323
+ // the folder, is no part of the text.
324
+
325
+ const PICTURE_FILE = /^assets\/[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/;
326
+ const PICTURE_WIDTH = /^[1-9]\d{0,3}$/;
327
+ const isPicture = (node) => node?.nodeType === 1 && node.localName === "img";
328
+
329
+ /** The file of a picture in a cell (assets/<file>), or null: none the page writes. */
330
+ export const pictureFile = (img) => {
331
+ const file = img.getAttribute("data-ge-src") || img.getAttribute("src") || "";
332
+ return PICTURE_FILE.test(file) ? file : null;
333
+ };
334
+
335
+ /**
336
+ * A picture for a cell: the file `path` (assets/<file>) shown where the server serves it, its `alt`
337
+ * words, its `width` in pixels (none: the kit's own size).
338
+ */
339
+ export function cellPicture(doc, path, { alt = "", width = null } = {}) {
340
+ const img = doc.createElement("img");
341
+ img.setAttribute("src", servedFile(path));
342
+ img.setAttribute("alt", alt);
343
+ if (width) img.setAttribute("width", String(Math.round(width)));
344
+ img.setAttribute("data-ge-src", path);
345
+ img.draggable = false;
346
+ return img;
347
+ }
348
+
349
+ // A cell's pictures as the file has them made the page's (core.mjs prepareBlock): shown where the server serves them.
350
+ function showPictures(root) {
351
+ for (const img of root.querySelectorAll("img")) {
352
+ const file = img.getAttribute("src") ?? "";
353
+ if (!PICTURE_FILE.test(file)) continue;
354
+ img.setAttribute("data-ge-src", file);
355
+ img.setAttribute("src", servedFile(file));
356
+ img.draggable = false;
357
+ }
358
+ }
359
+
360
+ // A picture as the cell's text writes it: its markup, "" (no file of the folder), null (no picture).
361
+ function writtenPicture(node) {
362
+ if (!isPicture(node)) return null;
363
+ const file = pictureFile(node);
364
+ if (!file) return "";
365
+ const said = [...node.attributes].filter(({ name, value }) => name === "src" || name === "alt" || (name === "width" && PICTURE_WIDTH.test(value)));
366
+ return `<img${said.map(({ name, value }) => ` ${name}="${escapeAttribute(name === "src" ? file : value)}"`).join("")}>`;
367
+ }
@@ -120,7 +120,7 @@ function cellNodes(doc, html, inline) {
120
120
  * row, its names' column a header column, its numeric columns read (the page's own copy as it was).
121
121
  */
122
122
  export function build({ doc, block, inline }) {
123
- const rows = block.rows.map((row) => row.map((html) => cellNodes(doc, html, inline)));
123
+ const rows = block.rows.map((row) => row.map((html) => cellNodes(doc, html, (text) => inline(text, { pictures: true })))); // a cell's pictures its own
124
124
  const table = newTable(doc, { rows, header: Boolean(block.header), column: Boolean(block.column), numbers: block.numbers !== false, looks: block.looks, widths: block.widths, spans: block.spans, chart: block.chart });
125
125
  if (block.outside) optimizeTable(table);
126
126
  return table;