@heycys/gallery 0.1.2 → 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 (292) 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/embed/page.mjs +1 -1
  5. package/browser/editor/components/file/page.mjs +4 -4
  6. package/browser/editor/components/heading/index.mjs +7 -6
  7. package/browser/editor/components/icons.mjs +3 -0
  8. package/browser/editor/components/image/index.mjs +2 -0
  9. package/browser/editor/components/image/page.mjs +172 -90
  10. package/browser/editor/components/installed/index.mjs +6 -2
  11. package/browser/editor/components/installed/page.mjs +80 -13
  12. package/browser/editor/components/media/icons.mjs +13 -8
  13. package/browser/editor/components/media/page.mjs +5 -3
  14. package/browser/editor/components/media/toolbar.mjs +12 -3
  15. package/browser/editor/components/paragraph/index.mjs +4 -3
  16. package/browser/editor/components/registry.mjs +17 -5
  17. package/browser/editor/components/table/index.mjs +4 -2
  18. package/browser/editor/page/after/index.mjs +288 -0
  19. package/browser/editor/page/align.mjs +91 -0
  20. package/browser/editor/page/beside.mjs +5 -6
  21. package/browser/editor/page/block-menu/index.mjs +6 -3
  22. package/browser/editor/page/blocks.mjs +3 -1
  23. package/browser/editor/page/board/hint.mjs +64 -27
  24. package/browser/editor/page/board/index.mjs +160 -71
  25. package/browser/editor/page/board/motion.mjs +177 -0
  26. package/browser/editor/page/board/settings.mjs +4 -3
  27. package/browser/editor/page/clipboard/index.mjs +10 -3
  28. package/browser/editor/page/clipboard/own/blocks.mjs +3 -4
  29. package/browser/editor/page/clipboard/own/describe.mjs +6 -2
  30. package/browser/editor/page/commit.mjs +2 -2
  31. package/browser/editor/page/core.mjs +3 -1
  32. package/browser/editor/page/custom-page.mjs +15 -11
  33. package/browser/editor/page/editor.mjs +31 -14
  34. package/browser/editor/page/history.mjs +19 -4
  35. package/browser/editor/page/insert/index.mjs +20 -22
  36. package/browser/editor/page/menu.mjs +15 -7
  37. package/browser/editor/page/page-objects.mjs +3 -7
  38. package/browser/editor/page/present-links.mjs +5 -4
  39. package/browser/editor/page/present-shell.mjs +63 -0
  40. package/browser/editor/page/selection/index.mjs +10 -2
  41. package/browser/editor/page/table/binding.mjs +87 -0
  42. package/browser/editor/page/table/icons.mjs +0 -2
  43. package/browser/editor/page/table/index.mjs +10 -14
  44. package/browser/editor/page/table/views.mjs +5 -52
  45. package/browser/editor/page/table/widths.mjs +82 -10
  46. package/browser/editor/page/typing/index.mjs +44 -12
  47. package/browser/editor/page/typing/leave.mjs +19 -5
  48. package/browser/shared/block-packs.mjs +23 -8
  49. package/browser/shared/component-catalog.mjs +15 -8
  50. package/browser/shared/component-source.mjs +3 -1
  51. package/browser/shared/components/heading.mjs +2 -1
  52. package/browser/shared/components/installed.mjs +1 -1
  53. package/browser/shared/components/page.mjs +2 -0
  54. package/browser/shared/components/paragraph.mjs +8 -1
  55. package/browser/shared/components/table.mjs +1 -0
  56. package/browser/shared/emoji/line-icons.mjs +37 -0
  57. package/browser/shared/http.mjs +9 -0
  58. package/browser/shared/i18n/en.mjs +40 -17
  59. package/browser/shared/outline.mjs +30 -2
  60. package/browser/shared/pack-manifest.mjs +12 -1
  61. package/browser/shared/pages.mjs +169 -57
  62. package/browser/shared/pinyin.mjs +92 -0
  63. package/browser/shared/present-step.mjs +17 -0
  64. package/browser/shared/sidebar-head.mjs +70 -0
  65. package/browser/shared/web-links.mjs +5 -0
  66. package/dist/chunk-2OHANJ6Q.mjs +2 -0
  67. package/dist/{chunk-QOUEFUCH.mjs → chunk-3MBRL2PM.mjs} +1 -1
  68. package/dist/{chunk-NWR2LT5B.mjs → chunk-4OKWZY5E.mjs} +1 -1
  69. package/dist/{chunk-RMECZA2K.mjs → chunk-5K44HLTZ.mjs} +1 -1
  70. package/dist/{chunk-NFMCP2HI.mjs → chunk-5XA2ZBAE.mjs} +2 -2
  71. package/dist/{chunk-OUUP3WKT.mjs → chunk-67N2QJYT.mjs} +1 -1
  72. package/dist/chunk-6KBYRA2C.mjs +2 -0
  73. package/dist/{chunk-SX4LJYT6.mjs → chunk-6N3PX4XX.mjs} +1 -1
  74. package/dist/{chunk-RFDZXFJF.mjs → chunk-7JDX4E65.mjs} +1 -1
  75. package/dist/chunk-7M2BQQGZ.mjs +2 -0
  76. package/dist/{chunk-ZUNVAXLH.mjs → chunk-7OG26PGF.mjs} +1 -1
  77. package/dist/{chunk-B4P2CM2J.mjs → chunk-AHN3NFKJ.mjs} +1 -1
  78. package/dist/chunk-ALZ6ZENZ.mjs +3 -0
  79. package/dist/{chunk-UGWYKHBL.mjs → chunk-AR5D57ZD.mjs} +2 -2
  80. package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
  81. package/dist/{chunk-HLYV7RIH.mjs → chunk-CMA72MAG.mjs} +1 -1
  82. package/dist/{chunk-D4CKRD3V.mjs → chunk-DAZL73VK.mjs} +2 -2
  83. package/dist/{chunk-6VTU6KEO.mjs → chunk-DJISHPUL.mjs} +1 -1
  84. package/dist/{chunk-BPL64HGA.mjs → chunk-EAIFITAV.mjs} +1 -1
  85. package/dist/chunk-EP25HDAJ.mjs +2 -0
  86. package/dist/{chunk-6EZ7FNIK.mjs → chunk-F4ZA6JRZ.mjs} +1 -1
  87. package/dist/{chunk-3KJHLHUO.mjs → chunk-F6HVDZR4.mjs} +1 -1
  88. package/dist/{chunk-3NJACR4W.mjs → chunk-FDMAXMQA.mjs} +1 -1
  89. package/dist/chunk-FETSREUN.mjs +5 -0
  90. package/dist/{chunk-RKPWLGZ3.mjs → chunk-GHOYKMQ3.mjs} +1 -1
  91. package/dist/chunk-HDWTZ763.mjs +12 -0
  92. package/dist/{chunk-VTKNEYT3.mjs → chunk-HPOI4ZX7.mjs} +1 -1
  93. package/dist/{chunk-OW5NWPOJ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
  94. package/dist/{chunk-V6RIYQZZ.mjs → chunk-ITOH5EGO.mjs} +1 -1
  95. package/dist/{chunk-ZWPMCK7P.mjs → chunk-IV64FFI4.mjs} +1 -1
  96. package/dist/chunk-J43Z6LSS.mjs +2 -0
  97. package/dist/chunk-J5PUIV3Y.mjs +4 -0
  98. package/dist/{chunk-KTKHRC6H.mjs → chunk-JA7G53PC.mjs} +1 -1
  99. package/dist/{chunk-NWFBE2YA.mjs → chunk-JLTZF4LA.mjs} +1 -1
  100. package/dist/{chunk-GY3FAUVM.mjs → chunk-JZT7I2OJ.mjs} +1 -1
  101. package/dist/{chunk-QKXMPUXC.mjs → chunk-K5XATEOO.mjs} +1 -1
  102. package/dist/chunk-L2SUIS5S.mjs +2 -0
  103. package/dist/{chunk-TEZAWDSQ.mjs → chunk-LM4XFQHZ.mjs} +1 -1
  104. package/dist/{chunk-5ZJA7CXT.mjs → chunk-MN7BZL4R.mjs} +1 -1
  105. package/dist/chunk-MTYYHM2G.mjs +15 -0
  106. package/dist/{chunk-HMYTM3GT.mjs → chunk-MXUBKDRO.mjs} +1 -1
  107. package/dist/{chunk-MHW7ZKOU.mjs → chunk-OEXWRJME.mjs} +1 -1
  108. package/dist/{chunk-CRJEG7MT.mjs → chunk-OFHXGWOX.mjs} +1 -1
  109. package/dist/chunk-ORID3AE7.mjs +166 -0
  110. package/dist/{chunk-32ZUEFZ7.mjs → chunk-PGDE24N5.mjs} +1 -1
  111. package/dist/{chunk-UNOYVIYR.mjs → chunk-POTA2FV4.mjs} +1 -1
  112. package/dist/{chunk-N7AZZLGT.mjs → chunk-QE5RG76S.mjs} +18 -17
  113. package/dist/{chunk-N76HWBA3.mjs → chunk-R2ZDLJYT.mjs} +1 -1
  114. package/dist/chunk-SWUTTZCN.mjs +2 -0
  115. package/dist/{chunk-POQSE4C2.mjs → chunk-TR7TWGHB.mjs} +1 -1
  116. package/dist/chunk-U5XL7D6A.mjs +3 -0
  117. package/dist/{chunk-PVER7LSC.mjs → chunk-U7NZI6N4.mjs} +2 -2
  118. package/dist/{chunk-Q47PLKIJ.mjs → chunk-UGWMMEJ5.mjs} +1 -1
  119. package/dist/chunk-UJQJKNGK.mjs +2 -0
  120. package/dist/chunk-UYVCQK3H.mjs +22 -0
  121. package/dist/{chunk-FJYN7RTH.mjs → chunk-VFX2KNHP.mjs} +1 -1
  122. package/dist/{chunk-UBBRTJ2R.mjs → chunk-VS7JIGJW.mjs} +1 -1
  123. package/dist/{chunk-NVRNLK25.mjs → chunk-W7665ZEC.mjs} +2 -2
  124. package/dist/{chunk-NG375ILQ.mjs → chunk-WQDQWCX5.mjs} +1 -1
  125. package/dist/chunk-YLPSMDIS.mjs +5 -0
  126. package/dist/{chunk-VXACTLO3.mjs → chunk-YNAWBAYN.mjs} +1 -1
  127. package/dist/{chunk-ZB4H7ZN4.mjs → chunk-YROX2O22.mjs} +1 -1
  128. package/dist/{chunk-YQGT4AB2.mjs → chunk-ZDLPUOAG.mjs} +1 -1
  129. package/dist/chunk-ZQS6H473.mjs +16 -0
  130. package/dist/{chunk-OJKMINIU.mjs → chunk-ZWWC4KLF.mjs} +15 -15
  131. package/dist/cli.mjs +1 -1
  132. package/dist/server.mjs +1 -1
  133. package/dist/worker.mjs +1 -1
  134. package/kit/board.css +5 -5
  135. package/kit/code.js +15 -15
  136. package/kit/report.css +120 -41
  137. package/kit/runtime.js +45 -7
  138. package/kit/tables.js +2 -0
  139. package/kit/ui.js +2 -0
  140. package/package.json +1 -1
  141. package/packs/gallery/chart-view/kit.js +3 -3
  142. package/packs/gallery/chart-view/writing.md +1 -1
  143. package/packs/gallery/countdown/component.json +1 -1
  144. package/packs/gallery/countdown/kit.js +89 -29
  145. package/packs/gallery/countdown/preview.svg +1 -1
  146. package/packs/gallery/countdown/style.css +88 -100
  147. package/packs/gallery/countdown/writing.md +2 -2
  148. package/packs/gallery/habit/component.json +3 -3
  149. package/packs/gallery/habit/kit.js +114 -75
  150. package/packs/gallery/habit/preview.svg +1 -1
  151. package/packs/gallery/habit/style.css +133 -205
  152. package/packs/gallery/habit/writing.md +2 -2
  153. package/packs/gallery/heatmap/component.json +2 -2
  154. package/packs/gallery/heatmap/kit.js +335 -173
  155. package/packs/gallery/heatmap/preview.svg +1 -1
  156. package/packs/gallery/heatmap/style.css +158 -170
  157. package/packs/gallery/heatmap/writing.md +2 -2
  158. package/packs/gallery/kanban/kit.js +3 -3
  159. package/packs/gallery/kanban/writing.md +1 -1
  160. package/packs/gallery/metric/kit.js +3 -3
  161. package/packs/gallery/metric/writing.md +1 -1
  162. package/packs/gallery/note/component.json +3 -3
  163. package/packs/gallery/note/kit.js +40 -13
  164. package/packs/gallery/note/preview.svg +1 -1
  165. package/packs/gallery/note/style.css +51 -30
  166. package/packs/gallery/note/writing.md +2 -2
  167. package/packs/gallery/recent/component.json +2 -2
  168. package/packs/gallery/recent/kit.js +141 -86
  169. package/packs/gallery/recent/preview.svg +1 -1
  170. package/packs/gallery/recent/style.css +53 -126
  171. package/packs/gallery/recent/writing.md +2 -2
  172. package/packs/gallery/static/component.json +2 -2
  173. package/packs/gallery/static/preview.svg +1 -1
  174. package/packs/gallery/static/style.css +99 -66
  175. package/packs/gallery/static/writing.md +2 -2
  176. package/packs/gallery/stats/component.json +3 -3
  177. package/packs/gallery/stats/kit.js +253 -72
  178. package/packs/gallery/stats/preview.svg +1 -1
  179. package/packs/gallery/stats/style.css +64 -142
  180. package/packs/gallery/stats/writing.md +2 -2
  181. package/packs/gallery/today/component.json +2 -2
  182. package/packs/gallery/today/kit.js +62 -27
  183. package/packs/gallery/today/preview.svg +1 -1
  184. package/packs/gallery/today/style.css +101 -72
  185. package/packs/gallery/today/writing.md +2 -2
  186. package/packs/gallery/todos/component.json +1 -1
  187. package/packs/gallery/todos/kit.js +218 -71
  188. package/packs/gallery/todos/preview.svg +1 -1
  189. package/packs/gallery/todos/style.css +170 -223
  190. package/packs/gallery/todos/writing.md +1 -1
  191. package/packs/gallery/weather/component.json +2 -2
  192. package/packs/gallery/weather/kit.js +165 -90
  193. package/packs/gallery/weather/preview.svg +1 -1
  194. package/packs/gallery/weather/style.css +100 -218
  195. package/packs/gallery/weather/writing.md +1 -1
  196. package/packs/gallery-soft/countdown/component.json +18 -0
  197. package/packs/gallery-soft/countdown/example.html +3 -0
  198. package/packs/gallery-soft/countdown/kit.js +206 -0
  199. package/packs/gallery-soft/countdown/preview.svg +1 -0
  200. package/packs/gallery-soft/countdown/style.css +211 -0
  201. package/packs/gallery-soft/countdown/template.html +3 -0
  202. package/packs/gallery-soft/countdown/writing.md +24 -0
  203. package/packs/gallery-soft/habit/component.json +14 -0
  204. package/packs/gallery-soft/habit/example.html +3 -0
  205. package/packs/gallery-soft/habit/kit.js +366 -0
  206. package/packs/gallery-soft/habit/preview.svg +1 -0
  207. package/packs/gallery-soft/habit/style.css +251 -0
  208. package/packs/gallery-soft/habit/template.html +3 -0
  209. package/packs/gallery-soft/habit/writing.md +23 -0
  210. package/packs/gallery-soft/heatmap/component.json +18 -0
  211. package/packs/gallery-soft/heatmap/example.html +3 -0
  212. package/packs/gallery-soft/heatmap/kit.js +498 -0
  213. package/packs/gallery-soft/heatmap/preview.svg +1 -0
  214. package/packs/gallery-soft/heatmap/style.css +181 -0
  215. package/packs/gallery-soft/heatmap/template.html +3 -0
  216. package/packs/gallery-soft/heatmap/writing.md +23 -0
  217. package/packs/gallery-soft/note/component.json +14 -0
  218. package/packs/gallery-soft/note/example.html +3 -0
  219. package/packs/gallery-soft/note/kit.js +162 -0
  220. package/packs/gallery-soft/note/preview.svg +1 -0
  221. package/packs/gallery-soft/note/style.css +148 -0
  222. package/packs/gallery-soft/note/template.html +3 -0
  223. package/packs/gallery-soft/note/writing.md +20 -0
  224. package/packs/gallery-soft/recent/component.json +13 -0
  225. package/packs/gallery-soft/recent/example.html +1 -0
  226. package/packs/gallery-soft/recent/kit.js +335 -0
  227. package/packs/gallery-soft/recent/preview.svg +1 -0
  228. package/packs/gallery-soft/recent/style.css +160 -0
  229. package/packs/gallery-soft/recent/template.html +1 -0
  230. package/packs/gallery-soft/recent/writing.md +17 -0
  231. package/packs/gallery-soft/static/component.json +13 -0
  232. package/packs/gallery-soft/static/example.html +12 -0
  233. package/packs/gallery-soft/static/preview.svg +1 -0
  234. package/packs/gallery-soft/static/style.css +186 -0
  235. package/packs/gallery-soft/static/template.html +1 -0
  236. package/packs/gallery-soft/static/writing.md +20 -0
  237. package/packs/gallery-soft/stats/component.json +13 -0
  238. package/packs/gallery-soft/stats/example.html +1 -0
  239. package/packs/gallery-soft/stats/kit.js +341 -0
  240. package/packs/gallery-soft/stats/preview.svg +1 -0
  241. package/packs/gallery-soft/stats/style.css +119 -0
  242. package/packs/gallery-soft/stats/template.html +1 -0
  243. package/packs/gallery-soft/stats/writing.md +13 -0
  244. package/packs/gallery-soft/today/component.json +12 -0
  245. package/packs/gallery-soft/today/example.html +1 -0
  246. package/packs/gallery-soft/today/kit.js +222 -0
  247. package/packs/gallery-soft/today/preview.svg +1 -0
  248. package/packs/gallery-soft/today/style.css +178 -0
  249. package/packs/gallery-soft/today/template.html +1 -0
  250. package/packs/gallery-soft/today/writing.md +16 -0
  251. package/packs/gallery-soft/todos/component.json +19 -0
  252. package/packs/gallery-soft/todos/example.html +3 -0
  253. package/packs/gallery-soft/todos/kit.js +527 -0
  254. package/packs/gallery-soft/todos/preview.svg +1 -0
  255. package/packs/gallery-soft/todos/style.css +212 -0
  256. package/packs/gallery-soft/todos/template.html +3 -0
  257. package/packs/gallery-soft/todos/writing.md +32 -0
  258. package/packs/gallery-soft/weather/component.json +19 -0
  259. package/packs/gallery-soft/weather/example.html +3 -0
  260. package/packs/gallery-soft/weather/kit.js +411 -0
  261. package/packs/gallery-soft/weather/preview.svg +1 -0
  262. package/packs/gallery-soft/weather/style.css +185 -0
  263. package/packs/gallery-soft/weather/template.html +3 -0
  264. package/packs/gallery-soft/weather/writing.md +28 -0
  265. package/release.json +9 -9
  266. package/skill/SKILL.md +12 -12
  267. package/skill/references/building-blocks.md +4 -4
  268. package/skill/references/pages-and-data.md +13 -9
  269. package/skill/references/writing-html.md +2 -0
  270. package/web/assets/index-BM_K-Auu.css +1 -0
  271. package/web/assets/index-DRslOBiv.js +15 -0
  272. package/web/index.html +2 -2
  273. package/dist/chunk-2NRBY6AJ.mjs +0 -2
  274. package/dist/chunk-35NQ4PLQ.mjs +0 -2
  275. package/dist/chunk-4AV456RQ.mjs +0 -2
  276. package/dist/chunk-5XYHDBJ5.mjs +0 -2
  277. package/dist/chunk-6A53MZYZ.mjs +0 -2
  278. package/dist/chunk-6EXH3ORZ.mjs +0 -166
  279. package/dist/chunk-BVEFGE4B.mjs +0 -2
  280. package/dist/chunk-D4EURAX4.mjs +0 -4
  281. package/dist/chunk-DQCE7TJY.mjs +0 -5
  282. package/dist/chunk-FWNRPMCJ.mjs +0 -12
  283. package/dist/chunk-FWW4CSAZ.mjs +0 -2
  284. package/dist/chunk-JVHHHGEA.mjs +0 -3
  285. package/dist/chunk-PZDLJJTJ.mjs +0 -3
  286. package/dist/chunk-SXHBYZST.mjs +0 -16
  287. package/dist/chunk-UFNYFFKO.mjs +0 -20
  288. package/dist/chunk-UKSHDZZ6.mjs +0 -2
  289. package/dist/chunk-VJPFVNNW.mjs +0 -15
  290. package/dist/chunk-VS3ZMVGX.mjs +0 -5
  291. package/web/assets/index-BK2e_07w.js +0 -13
  292. package/web/assets/index-CWFI83mF.css +0 -1
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "id": "gallery/note",
3
3
  "apiVersion": 1,
4
- "version": "1.2.0",
4
+ "version": "2.0.0",
5
5
  "name": { "zh": "便签", "en": "Note" },
6
6
  "description": { "zh": "几行随手记,在卡片上直接写,存在页面里", "en": "A few lines jotted down, typed on the card and kept in the page" },
7
7
  "words": "bianqian note memo sticky 便签 笔记 随手记 记事",
8
8
  "parts": {
9
9
  "note": { "at": ":scope > script", "edit": "data" }
10
10
  },
11
- "runtime": { "generated": [":scope > .gallery-note-head", ":scope > .gallery-note-field"] },
11
+ "runtime": { "generated": [":scope > .gallery-note-head", ":scope > .gallery-note-field", ":scope > .gallery-note-foot"] },
12
12
  "places": ["page"],
13
- "card": { "sizes": [[4, 2], [2, 2], [4, 4]], "resize": true }
13
+ "card": { "sizes": [[4, 2], [2, 2], [4, 4]], "min": { "w": 2, "h": 2 }, "max": { "w": 4, "h": 8 }, "resize": true }
14
14
  }
@@ -1,19 +1,23 @@
1
1
  // gallery/note (便签): a few lines of free text, kept in the instance's data part, a script of JSON,
2
- // { "text": "…" }, and typed on the card itself, in a <textarea> the block draws over the whole card.
2
+ // { "text": "…" }, and typed on the card itself, in a <textarea> the block draws under its head.
3
3
  // The field is the kit's (DocKit.input): what the reader typed goes to the file once they are done with
4
4
  // it, as they leave the field or press Ctrl+Enter (⌘Enter on a Mac; Enter alone is a new line), never
5
5
  // while an input method composes, and never a value it holds already; Esc puts back what the file holds.
6
6
  // Each of those is one context.editJSON, one undo step, the JSON written back on one line as it was. It
7
7
  // draws from the part on every `source` (an Agent's write, an undo), the words the reader is typing kept
8
8
  // where they are. Where nothing takes its writes (an export, a page that has not come to edit yet:
9
- // context.canEdit() false) the field is read-only, and shows the same words. An empty note says 写点什么.
10
- // Above the field its head, as the cards' heads are (the kit's card tokens): the chip, a note's picture,
11
- // and its name, 便签, and its quiet meta, how many characters the field holds (its blanks not counted,
12
- // said again as the reader types); nothing of it is written.
9
+ // context.canEdit() false) the field is read-only, and shows the same words. An empty note says 写点什么….
10
+ // Above the field its head (the pack's design B: the kit's card tokens): the chip, a pencil, its name,
11
+ // 便签, and its quiet meta after it, how many characters the field holds (its blanks not counted, said
12
+ // again as the reader types; none on a card two cells wide, `data-layout` "narrow" by context.size, read
13
+ // again on `layout`). Its lines are ruled faintly, a hint that it takes writing (style.css); while the
14
+ // reader types, a line under the field says the two keys (Ctrl+Enter 保存, Esc 还原; ⌘Enter on a Mac), and
15
+ // the card is ringed in the accent's wash; scrolled down, the field's top fades (data-scrolled). Nothing of
16
+ // the head or the foot is written.
13
17
 
14
18
  const WORDS = {
15
- zh: { empty: "写点什么", label: "便签", count: (/** @type {number} */ count) => `${count} 字` },
16
- en: { empty: "Write something", label: "Note", count: (/** @type {number} */ count) => `${count} ${count === 1 ? "character" : "characters"}` },
19
+ zh: { empty: "写点什么…", label: "便签", count: (/** @type {number} */ count) => `${count} 字`, save: "保存", undo: "还原" },
20
+ en: { empty: "Write something…", label: "Note", count: (/** @type {number} */ count) => `${count} ${count === 1 ? "character" : "characters"}`, save: "save", undo: "revert" },
17
21
  };
18
22
 
19
23
  /** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
@@ -48,9 +52,12 @@ function writeNote(context, text) {
48
52
  });
49
53
  }
50
54
 
55
+ /** How many characters `text` holds, its blanks (spaces, new lines) not counted. @param {string} text */
56
+ const countOf = (text) => [...text.replace(/\s+/g, "")].length;
57
+
51
58
  DocKit.component({
52
59
  id: "gallery/note",
53
- on: ["source", "editable"],
60
+ on: ["source", "editable", "layout"],
54
61
  mount(host, context) {
55
62
  const words = WORDS[languageOf(document.documentElement)];
56
63
  const head = document.createElement("div");
@@ -58,11 +65,11 @@ DocKit.component({
58
65
  head.setAttribute("aria-hidden", "true");
59
66
  const chip = document.createElement("span");
60
67
  chip.className = "gallery-note-chip";
61
- chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M13 20l7-7M13 20v-6a1 1 0 0 1 1-1h6V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h7"/></svg>';
68
+ chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 19.5h3.8L19 8.8a2.4 2.4 0 0 0-3.4-3.4L4.9 16.1z"/><path d="M14 7l3 3"/></svg>';
62
69
  const title = document.createElement("span");
63
70
  title.className = "gallery-note-title";
64
71
  title.textContent = words.label;
65
- // Its quiet meta at the head's end: how many characters the field holds (its blanks not counted), as the reader types too.
72
+ // Its quiet meta after the title: how many characters the field holds (its blanks not counted), as the reader types too.
66
73
  const meta = document.createElement("span");
67
74
  meta.className = "gallery-note-meta";
68
75
  head.append(chip, title, meta);
@@ -71,16 +78,35 @@ DocKit.component({
71
78
  field.placeholder = words.empty;
72
79
  field.spellcheck = false;
73
80
  field.setAttribute("aria-label", words.label);
74
- host.append(head, field);
81
+ // While the reader types: the two keys, Ctrl+Enter (⌘Enter on a Mac) and Esc.
82
+ const foot = document.createElement("div");
83
+ foot.className = "gallery-note-foot";
84
+ foot.setAttribute("aria-hidden", "true");
85
+ const key = (/** @type {string} */ name, /** @type {string} */ does) => {
86
+ const said = document.createElement("span");
87
+ const bold = document.createElement("b");
88
+ bold.textContent = name;
89
+ said.append(bold, ` ${does}`);
90
+ return said;
91
+ };
92
+ foot.append(key(document.documentElement.dataset.docPlatform === "mac" ? "⌘Enter" : "Ctrl+Enter", words.save), key("Esc", words.undo));
93
+ host.append(head, field, foot);
75
94
  const typed = DocKit.input(field, { signal: context.signal, commit: (value) => writeNote(context, value) });
76
95
  const recount = () => {
77
- const count = [...field.value.replace(/s+/g, "")].length;
96
+ const count = countOf(field.value);
78
97
  const said = count > 0 ? words.count(count) : "";
79
98
  if (meta.textContent !== said) meta.textContent = said;
80
99
  };
81
100
  field.addEventListener("input", recount);
82
101
  context.signal?.addEventListener("abort", () => field.removeEventListener("input", recount), { once: true });
83
- const draw = () => {
102
+ // Scrolled down, its top fades (style.css), so that a line it scrolled past is never cut hard.
103
+ const scrolled = () => field.toggleAttribute("data-scrolled", field.scrollTop > 0);
104
+ field.addEventListener("scroll", scrolled, { passive: true });
105
+ context.signal?.addEventListener("abort", () => field.removeEventListener("scroll", scrolled), { once: true });
106
+ const draw = (/** @type {string} */ reason = "") => {
107
+ const layout = context.size && context.size.w <= 2 ? "narrow" : "wide";
108
+ if (head.dataset.layout !== layout) head.dataset.layout = layout;
109
+ if (reason === "layout") return;
84
110
  const data = context.readJSON("note");
85
111
  if (data === undefined) return; // no JSON: the instance has failed, and Gallery shows what it holds
86
112
  let text;
@@ -92,6 +118,7 @@ DocKit.component({
92
118
  field.readOnly = !context.canEdit();
93
119
  typed.set(text);
94
120
  recount();
121
+ scrolled();
95
122
  };
96
123
  draw();
97
124
  return { update: draw };
@@ -1 +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="16.5" y="12.5" width="207" height="95" rx="12" fill="#ffffff" stroke="#e7e6e3"/><rect x="30" y="24" width="14" height="14" rx="4.5" fill="#ebf2fa"/><g transform="translate(32 26) scale(.4167)" fill="none" stroke="#2e7cd1" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M13 20l7-7M13 20v-6a1 1 0 0 1 1-1h6V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h7"/></g><rect x="50" y="28" width="24" height="6" rx="3" fill="#3b3a37"/><rect x="30" y="50" width="150" height="6" rx="3" fill="#7b7a76"/><rect x="30" y="62" width="118" height="6" rx="3" fill="#7b7a76"/><rect x="30" y="74" width="168" height="6" rx="3" fill="#7b7a76"/><rect x="30" y="86" width="92" height="6" rx="3" fill="#7b7a76"/><rect x="125" y="84" width="1.5" height="10" fill="#3b3a37"/></svg>
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="16.5" y="12.5" width="207" height="95" rx="8" fill="#ffffff" stroke="#e6e6e3"/><rect x="28" y="22" width="10" height="10" rx="3" fill="#efefed"/><rect x="42" y="24.5" width="22" height="5" rx="2.5" fill="#37352f"/><rect x="68" y="24.5" width="18" height="5" rx="2.5" fill="#d4d3cf"/><line x1="28" x2="212" y1="57" y2="57" stroke="#ededeb"/><rect x="28" y="47" width="24" height="6" rx="3" fill="#37352f"/><line x1="28" x2="212" y1="73" y2="73" stroke="#ededeb"/><rect x="28" y="63" width="112" height="6" rx="3" fill="#37352f"/><line x1="28" x2="212" y1="89" y2="89" stroke="#ededeb"/><rect x="28" y="79" width="96" height="6" rx="3" fill="#37352f"/></svg>
@@ -1,39 +1,46 @@
1
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. In the kit's card tokens: its head (the chip and 便签, how many characters
3
- it holds its quiet meta at the end), its end clear of the card's grip, and under it the field the script draws, the rest of the note's face: no border, no
4
- fill and no ring of its own, its words in the page's font, its placeholder (写点什么) muted. On a custom
5
- page it fills the card the board frames; where no card is around it (a document, as gallery block
6
- check shows it) the instance frames itself, a few lines high. Light and dark. */
2
+ reaches the rest of the page. The pack's design B, in the kit's card tokens: its head (the chip, a
3
+ pencil, and 便签, how many characters it holds its quiet meta after it, none on a narrow card), its end
4
+ clear of the card's grip, and under it the field the script draws, the rest of the note's face: no
5
+ border and no fill of its own, words half a size larger than the other cards' on wide lines (26px, a
6
+ faint rule under each, scrolling with them: a hint that it takes writing), its placeholder (写点什么…)
7
+ faint, the caret the accent's. While the reader types the card is ringed in the accent's wash and a line
8
+ under the field says its two keys; scrolled down, the field's top fades over 8px. On a custom page it is the card's whole face, taken out over the card's padding so that
9
+ its ring is the card's edge; where no card is around it (a document, as gallery block check shows it) the
10
+ instance frames itself, a few lines high. Light and dark. */
7
11
  [data-doc-component="gallery/note"] {
12
+ --gallery-note-rule: light-dark(rgb(55 53 47 / 7.5%), rgb(255 255 255 / 6%));
8
13
  display: flex;
9
14
  flex-direction: column;
10
- gap: var(--gallery-face-gap);
11
15
  box-sizing: border-box;
12
- padding: 14px 16px;
13
- border: 1px solid var(--doc-border);
16
+ padding: 16px;
14
17
  border-radius: var(--gallery-card-radius);
18
+ box-shadow: var(--gallery-card-shadow);
19
+ font-family: var(--gallery-font);
20
+ font-size: 13px;
21
+ line-height: 1.5;
22
+ color: var(--gallery-text);
15
23
  > .gallery-note-head {
16
24
  display: flex;
17
25
  align-items: center;
18
26
  gap: 8px;
19
27
  flex: none;
28
+ height: 20px;
20
29
  min-width: 0;
21
30
  padding-inline-end: var(--gallery-grip-room, 0px);
22
31
  }
23
32
  > .gallery-note-head > .gallery-note-chip {
24
33
  flex: none;
25
- display: inline-flex;
26
- align-items: center;
27
- justify-content: center;
34
+ display: grid;
35
+ place-items: center;
28
36
  width: var(--gallery-chip-size);
29
37
  height: var(--gallery-chip-size);
30
38
  border-radius: var(--gallery-chip-radius);
31
- background: var(--gallery-accent-soft);
32
- color: var(--gallery-accent);
39
+ background: var(--gallery-fill);
40
+ color: var(--gallery-muted);
33
41
  }
34
- > .gallery-note-head > .gallery-note-chip > svg { width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
42
+ > .gallery-note-head > .gallery-note-chip > svg { display: block; width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
35
43
  > .gallery-note-head > .gallery-note-title {
36
- flex: 1 1 auto;
37
44
  min-width: 0;
38
45
  overflow: hidden;
39
46
  white-space: nowrap;
@@ -41,36 +48,50 @@
41
48
  font-size: var(--gallery-title-size);
42
49
  line-height: var(--gallery-title-line);
43
50
  font-weight: 600;
44
- color: var(--gallery-text-strong);
51
+ color: var(--gallery-text);
45
52
  }
46
- > .gallery-note-head > .gallery-note-meta { flex: none; font-size: var(--gallery-meta-size); color: var(--doc-muted); white-space: nowrap; font-variant-numeric: tabular-nums; margin-inline-end: calc(-1 * var(--gallery-grip-room, 0px)); opacity: calc(1 - var(--gallery-grip-shown, 0)); transition: opacity .12s ease-out; }
53
+ > .gallery-note-head > .gallery-note-meta { flex: none; font-size: var(--gallery-meta-size); color: var(--gallery-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
54
+ > .gallery-note-head[data-layout="narrow"] > .gallery-note-meta { display: none; }
47
55
  > .gallery-note-field {
48
56
  display: block;
49
57
  flex: 1 1 auto;
50
58
  box-sizing: border-box;
51
59
  width: 100%;
52
- min-height: 7.5em;
53
- margin: 0;
60
+ min-height: 104px;
61
+ margin: 8px 0 0;
54
62
  padding: 0;
55
63
  border: 0;
56
64
  outline: 0;
57
65
  resize: none;
58
- background: transparent;
66
+ background: transparent linear-gradient(to bottom, transparent 25px, var(--gallery-note-rule) 25px, var(--gallery-note-rule) 26px, transparent 26px) 0 0 / 100% 26px local;
59
67
  font: inherit;
60
- font-size: 14px;
61
- line-height: 1.65;
68
+ font-size: 13.5px;
69
+ line-height: 26px;
62
70
  color: var(--gallery-text);
71
+ caret-color: var(--gallery-accent);
63
72
  overflow-wrap: break-word;
64
- scrollbar-width: thin;
73
+ scrollbar-width: none;
65
74
  }
66
- > .gallery-note-field::placeholder { color: var(--doc-muted); opacity: .7; }
75
+ > .gallery-note-field[data-scrolled] { mask-image: linear-gradient(to bottom, transparent, #000 8px); }
76
+ > .gallery-note-head[data-layout="narrow"] ~ .gallery-note-field { font-size: 13px; }
77
+ > .gallery-note-field::placeholder { color: var(--gallery-faint); opacity: 1; }
67
78
  > .gallery-note-field:read-only { cursor: default; }
79
+ > .gallery-note-foot { display: none; flex: none; gap: 12px; padding-top: 6px; font-size: 11.5px; line-height: 16px; color: var(--gallery-faint); white-space: nowrap; }
80
+ > .gallery-note-foot b { font-weight: 600; color: var(--gallery-muted); }
81
+ > .gallery-note-field:focus:not(:read-only) + .gallery-note-foot { display: flex; }
82
+ &:has(> .gallery-note-field:focus:not(:read-only)) { box-shadow: var(--gallery-card-shadow), 0 0 0 2px var(--gallery-accent-wash); }
68
83
  }
69
- /* On a custom page the board draws the frame: the note is as high as what the card holds inside it. */
84
+ /* On a custom page the board draws the frame: the note is the card's whole face, out over its padding, its
85
+ ring (while the reader types) at the card's edge, inside it. */
70
86
  .gallery-card > [data-doc-component="gallery/note"] {
71
- height: 100%;
72
- padding: 0;
73
- border: 0;
74
- border-radius: 0;
75
- > .gallery-note-field { min-height: 0; }
87
+ height: calc(100% + 2 * var(--gallery-card-pad));
88
+ margin: calc(-1 * var(--gallery-card-pad));
89
+ padding: var(--gallery-card-pad);
90
+ box-shadow: none;
91
+ /* The field as high as whole lines fit under the head (20px and 8px), and over the keys' line (22px) while
92
+ the reader types, so that a line scrolled to is never cut at the top: on a 4 × 2 card three lines,
93
+ two while typing. */
94
+ > .gallery-note-field { flex: none; min-height: 0; height: max(26px, round(down, calc(100% - 28px), 26px)); }
95
+ > .gallery-note-field:focus:not(:read-only) { height: max(26px, round(down, calc(100% - 50px), 26px)); }
96
+ &:has(> .gallery-note-field:focus:not(:read-only)) { box-shadow: inset 0 0 0 2px var(--gallery-accent-wash); }
76
97
  }
@@ -7,7 +7,7 @@ A card for a custom page (its places are `page`): a few lines the user types on
7
7
  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 note`, the instance as template.html has it: its data part, a `<script type="application/json">` holding `{"text":"…"}` (on one line and compact, as the block writes it back), the note's words, lines apart with `\n`; `{"text":""}` for an empty one, which shows 写点什么.
8
8
 
9
9
  - Leave the words of a note that is there alone: they are the user's. To start one with words of yours (a list the user asked for), write them in `text`, as example.html does.
10
- - Sizes: 4 × 2 (the default), 2 × 2 and 4 × 4. Words that do not fit scroll inside the card.
10
+ - Sizes: 4 × 2 (the default), 2 × 2 (no count of characters) and 4 × 4 are the ones its menu lists; any height from 2 to 8 cells, 2 to 4 wide, is one too (the card's corner reaches each). Words that do not fit scroll inside the card.
11
11
 
12
12
  ## What the user does
13
13
 
@@ -15,4 +15,4 @@ They click the card and type. What they typed is written to the page once they l
15
15
 
16
16
  ## How it looks
17
17
 
18
- Its head (a chip and 便签, how many characters it holds at its end) at the top, the words filling the rest of the card, in the page's font, with no frame of their own (the board draws the card's), 写点什么 muted where there are none; in the kit's card tokens (as every Gallery card: a head of a tinted chip and a title, its end clear of the card's grip), light and dark. Where nothing can be written (an export) it shows the same words, read-only. The script runs with the rights of the page's own scripts, as any block's does.
18
+ 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 a pencil's chip, 便签 and how many characters it holds; under it the words, half a size larger than the other cards' on wide 26px lines, each ruled faintly (a hint that it takes writing, not a yellow paper). While the reader types the card is ringed in the accent's wash and a line under the field says the two keys (Ctrl+Enter 保存, Esc 还原; ⌘Enter on a Mac). Empty, it says 写点什么… faintly.
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "id": "gallery/recent",
3
3
  "apiVersion": 1,
4
- "version": "1.3.0",
4
+ "version": "2.0.0",
5
5
  "name": { "zh": "最近编辑", "en": "Recently edited" },
6
6
  "description": { "zh": "最近改过的文档,点一篇就打开它", "en": "The documents edited last: click one to open it" },
7
7
  "words": "zuijinbianji zuijin bianji recent recently edited documents 最近 最近编辑 文档 改过",
8
8
  "parts": {},
9
9
  "runtime": { "generated": [":scope > .gallery-recent-face"] },
10
10
  "places": ["page"],
11
- "card": { "sizes": [[4, 5], [4, 2], [4, 4], [4, 6]], "resize": true },
11
+ "card": { "sizes": [[4, 4], [4, 2], [4, 6]], "min": { "w": 4, "h": 2 }, "max": { "w": 4, "h": 8 }, "resize": true },
12
12
  "needs": ["workspace"]
13
13
  }