@heycys/gallery 0.2.3 → 0.2.4

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 (220) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +1 -1
  3. package/assets/preview/runtime.js +156 -0
  4. package/assets/preview/shell.html +107 -0
  5. package/assets/writing-preferences.md +1 -1
  6. package/browser/editor/components/divider/index.mjs +1 -1
  7. package/browser/editor/page/annotate/card.mjs +6 -0
  8. package/browser/editor/page/annotate/index.mjs +22 -2
  9. package/browser/editor/page/columns/index.mjs +1 -1
  10. package/browser/editor/page/conflicts.mjs +1 -1
  11. package/browser/editor/page/drag/index.mjs +1 -1
  12. package/browser/editor/page/editor.mjs +39 -3
  13. package/browser/editor/page/focus.mjs +104 -0
  14. package/browser/editor/page/handle/index.mjs +14 -2
  15. package/browser/editor/page/links/index.mjs +2 -2
  16. package/browser/editor/page/quiet.mjs +3 -3
  17. package/browser/editor/page/resize/index.mjs +1 -1
  18. package/browser/editor/page/session.mjs +4 -1
  19. package/browser/editor/page/ui.mjs +1 -1
  20. package/browser/shared/annotations.mjs +22 -3
  21. package/browser/shared/block-packs.mjs +13 -4
  22. package/browser/shared/document-look.mjs +14 -0
  23. package/browser/shared/drafts.mjs +1 -1
  24. package/browser/shared/extension-manifest.mjs +40 -12
  25. package/browser/shared/favorite-merge.mjs +17 -0
  26. package/browser/shared/favorites.mjs +77 -0
  27. package/browser/shared/i18n/en.mjs +123 -24
  28. package/browser/shared/outline-ops.mjs +109 -0
  29. package/browser/shared/outline.mjs +6 -0
  30. package/browser/shared/pages.mjs +20 -8
  31. package/browser/shared/paths.mjs +5 -2
  32. package/browser/shared/preference-documents.mjs +137 -0
  33. package/browser/shared/presence.mjs +94 -0
  34. package/browser/shared/preview-server.mjs +8 -5
  35. package/browser/shared/qa-levels.mjs +9 -1
  36. package/browser/shared/session.mjs +4 -0
  37. package/browser/shared/shipped-blocks.mjs +22 -4
  38. package/browser/shared/startup.mjs +101 -0
  39. package/browser/shared/workspace-columns.mjs +1 -1
  40. package/browser/shared/workspace-look.mjs +21 -8
  41. package/browser/shared/workspace-registry.mjs +6 -3
  42. package/browser/shared/workspace.mjs +37 -10
  43. package/browser/shared/writing-preferences.mjs +2 -42
  44. package/dist/chunk-25LYSMAE.mjs +2 -0
  45. package/dist/chunk-2I6ZVC5O.mjs +2 -0
  46. package/dist/{chunk-M4NRDYI5.mjs → chunk-2MYTOOP6.mjs} +1 -1
  47. package/dist/chunk-2VNENLER.mjs +2 -0
  48. package/dist/chunk-3FERXZF5.mjs +4 -0
  49. package/dist/chunk-3M6SBBGU.mjs +2 -0
  50. package/dist/chunk-3VCAAF34.mjs +2 -0
  51. package/dist/{chunk-WD4U6XXT.mjs → chunk-3ZTRLGSA.mjs} +1 -1
  52. package/dist/chunk-4FRA5AUE.mjs +2 -0
  53. package/dist/chunk-4LR2QEC2.mjs +4 -0
  54. package/dist/chunk-56SVJENP.mjs +966 -0
  55. package/dist/chunk-5CQISL2G.mjs +4 -0
  56. package/dist/{chunk-RRKJMHNX.mjs → chunk-5I5ZDDWC.mjs} +5 -5
  57. package/dist/chunk-5IHDLEB4.mjs +10 -0
  58. package/dist/chunk-5LRDMV7O.mjs +2 -0
  59. package/dist/chunk-5MVUYRKG.mjs +5 -0
  60. package/dist/chunk-5TLLIZT7.mjs +2 -0
  61. package/dist/chunk-6ILJWFYW.mjs +4 -0
  62. package/dist/chunk-6N25CJ6Y.mjs +3 -0
  63. package/dist/{chunk-SQ6Y2ZMA.mjs → chunk-7DTINW6U.mjs} +2 -2
  64. package/dist/chunk-7KWAGKIK.mjs +2 -0
  65. package/dist/chunk-7WNUOAFK.mjs +2 -0
  66. package/dist/chunk-7XCRW5RC.mjs +2 -0
  67. package/dist/{chunk-BYNPEUDS.mjs → chunk-7XSDTILF.mjs} +1 -1
  68. package/dist/chunk-ABKYFOVR.mjs +2 -0
  69. package/dist/chunk-AMUF7PUN.mjs +2 -0
  70. package/dist/{chunk-FJLM7YE7.mjs → chunk-B2EIMERT.mjs} +2 -2
  71. package/dist/{chunk-QNECWMGR.mjs → chunk-B45IAAU6.mjs} +1 -1
  72. package/dist/chunk-B6RAGF4R.mjs +2 -0
  73. package/dist/chunk-BSJKFE7I.mjs +4 -0
  74. package/dist/chunk-C72EEVLK.mjs +2 -0
  75. package/dist/chunk-CRAUKZ23.mjs +4 -0
  76. package/dist/chunk-F4CT35KL.mjs +2 -0
  77. package/dist/chunk-F63BNJLG.mjs +2 -0
  78. package/dist/chunk-FBKUPS44.mjs +2 -0
  79. package/dist/chunk-FL52ZL5Z.mjs +15 -0
  80. package/dist/chunk-FOZCU4VW.mjs +2 -0
  81. package/dist/chunk-G5HV7BC3.mjs +2 -0
  82. package/dist/{chunk-ERLAIBOA.mjs → chunk-GB5SOYQJ.mjs} +2 -2
  83. package/dist/chunk-GN3SG3IF.mjs +2 -0
  84. package/dist/{chunk-6QWQXHAV.mjs → chunk-HFTBVEZK.mjs} +1 -1
  85. package/dist/chunk-IOW5HLRK.mjs +2 -0
  86. package/dist/chunk-IQ3GJNTI.mjs +6 -0
  87. package/dist/chunk-K6SPFBUJ.mjs +2 -0
  88. package/dist/chunk-K7Y7SPTS.mjs +2 -0
  89. package/dist/chunk-L2IJCEUH.mjs +2 -0
  90. package/dist/{chunk-GPIWQ4X4.mjs → chunk-L3VT6LM4.mjs} +1 -1
  91. package/dist/chunk-L4WLQYFC.mjs +5 -0
  92. package/dist/{chunk-NLDF35P5.mjs → chunk-LAMCAGK6.mjs} +1 -1
  93. package/dist/chunk-LHGKPMTI.mjs +2 -0
  94. package/dist/chunk-LJZIYVNA.mjs +3 -0
  95. package/dist/chunk-LSVCTLS2.mjs +2 -0
  96. package/dist/chunk-LZY74XTP.mjs +2 -0
  97. package/dist/chunk-MC4LRSVH.mjs +2 -0
  98. package/dist/chunk-MCEXN4G5.mjs +2 -0
  99. package/dist/chunk-MTLAOCFF.mjs +181 -0
  100. package/dist/chunk-MZ66LN3B.mjs +2 -0
  101. package/dist/chunk-N5QWJRRI.mjs +2 -0
  102. package/dist/chunk-NF4MMOUB.mjs +2 -0
  103. package/dist/chunk-NHJYAJ73.mjs +3 -0
  104. package/dist/chunk-NRSD7SVY.mjs +2 -0
  105. package/dist/chunk-NT23I4XW.mjs +2 -0
  106. package/dist/chunk-NUALABIS.mjs +3 -0
  107. package/dist/chunk-NW6LAU22.mjs +2 -0
  108. package/dist/chunk-NWWHDGKF.mjs +5 -0
  109. package/dist/chunk-OFRCVMSJ.mjs +2 -0
  110. package/dist/chunk-OKVQQ3CX.mjs +4 -0
  111. package/dist/chunk-OM24O4KR.mjs +8 -0
  112. package/dist/{chunk-4B2TB5K2.mjs → chunk-PBMOC7KA.mjs} +2 -2
  113. package/dist/chunk-PVTCP43W.mjs +2 -0
  114. package/dist/chunk-Q62HZAJS.mjs +2 -0
  115. package/dist/chunk-QBJWIR3Q.mjs +2 -0
  116. package/dist/chunk-QDSEZX7Z.mjs +6 -0
  117. package/dist/chunk-QR4V4A2Z.mjs +15 -0
  118. package/dist/{chunk-QVGOPHOF.mjs → chunk-QRLVVZ3R.mjs} +1 -1
  119. package/dist/chunk-QW3QG67J.mjs +2 -0
  120. package/dist/chunk-R2T2EVWY.mjs +8 -0
  121. package/dist/{chunk-JJNHKGTD.mjs → chunk-R5RERE6G.mjs} +1 -1
  122. package/dist/chunk-RFHEWT3Y.mjs +5 -0
  123. package/dist/chunk-RS2Z2JQP.mjs +2 -0
  124. package/dist/chunk-S6YEC4GE.mjs +16 -0
  125. package/dist/chunk-SHZLMGGW.mjs +2 -0
  126. package/dist/chunk-TALJQM2O.mjs +2 -0
  127. package/dist/chunk-TLNJWEFY.mjs +22 -0
  128. package/dist/{chunk-ZLS2FRS6.mjs → chunk-TQZU7D7C.mjs} +1 -1
  129. package/dist/chunk-UTKNWYBA.mjs +2 -0
  130. package/dist/chunk-V3TM3TEN.mjs +2 -0
  131. package/dist/chunk-V3XROSP5.mjs +7 -0
  132. package/dist/{chunk-6QBHU4DF.mjs → chunk-V5JTW2LH.mjs} +1 -1
  133. package/dist/chunk-VAXLSISW.mjs +4 -0
  134. package/dist/chunk-VBHI3RG6.mjs +2 -0
  135. package/dist/{chunk-CRDG6EF2.mjs → chunk-VKZJRGDR.mjs} +1 -1
  136. package/dist/chunk-VZXZM7NS.mjs +2 -0
  137. package/dist/chunk-WDS6HEPE.mjs +2 -0
  138. package/dist/chunk-WHGANNEY.mjs +13 -0
  139. package/dist/chunk-WMJWC4QY.mjs +56 -0
  140. package/dist/{chunk-UTMAY3WK.mjs → chunk-WWONJJQS.mjs} +1 -1
  141. package/dist/chunk-X4WNLFIK.mjs +2 -0
  142. package/dist/chunk-XNNCQROX.mjs +11 -0
  143. package/dist/chunk-XRYECF23.mjs +170 -0
  144. package/dist/{chunk-225ALKYI.mjs → chunk-Z4NEXXFK.mjs} +1 -1
  145. package/dist/{chunk-PKVK6WFC.mjs → chunk-ZFVF2YPV.mjs} +2 -2
  146. package/dist/chunk-ZM2IX3R2.mjs +2 -0
  147. package/dist/chunk-ZNGGDUZI.mjs +2 -0
  148. package/dist/chunk-ZOEJQOKT.mjs +2 -0
  149. package/dist/cli.mjs +1 -1
  150. package/dist/server.mjs +1 -1
  151. package/dist/update-fetch.mjs +1 -1
  152. package/dist/worker.mjs +1 -1
  153. package/package.json +1 -1
  154. package/release.json +3 -3
  155. package/skill/SKILL.md +54 -148
  156. package/skill/references/building-blocks.md +4 -4
  157. package/skill/references/charts-and-figures.md +73 -0
  158. package/skill/references/extensions.md +47 -4
  159. package/skill/references/pages-and-data.md +22 -3
  160. package/skill/references/preference-files.md +7 -0
  161. package/skill/references/previews.md +17 -0
  162. package/skill/references/writing-html.md +21 -82
  163. package/web/assets/index-B4uUluLM.js +15 -0
  164. package/web/assets/index-C3vHT8sH.css +1 -0
  165. package/web/index.html +2 -2
  166. package/dist/chunk-2HS7ZBPU.mjs +0 -2
  167. package/dist/chunk-3F57LEN5.mjs +0 -2
  168. package/dist/chunk-4OZWXZE5.mjs +0 -5
  169. package/dist/chunk-5GK7HS62.mjs +0 -2
  170. package/dist/chunk-6GV3CBB2.mjs +0 -2
  171. package/dist/chunk-6NLXUKAY.mjs +0 -4
  172. package/dist/chunk-6XD6U3QA.mjs +0 -5
  173. package/dist/chunk-6Y3HYOBM.mjs +0 -2
  174. package/dist/chunk-7EFHNQ5B.mjs +0 -3
  175. package/dist/chunk-7M2BQQGZ.mjs +0 -2
  176. package/dist/chunk-7UZUQQ7Q.mjs +0 -554
  177. package/dist/chunk-ALZ6ZENZ.mjs +0 -3
  178. package/dist/chunk-BX5AKINW.mjs +0 -15
  179. package/dist/chunk-DR73Y2UJ.mjs +0 -3
  180. package/dist/chunk-EURLTOTZ.mjs +0 -4
  181. package/dist/chunk-F4ZA6JRZ.mjs +0 -3
  182. package/dist/chunk-FNCCVGKX.mjs +0 -2
  183. package/dist/chunk-FOJ3K5Z3.mjs +0 -6
  184. package/dist/chunk-FQ72LZHB.mjs +0 -2
  185. package/dist/chunk-G7N7YFVD.mjs +0 -2
  186. package/dist/chunk-GIRXJBGC.mjs +0 -2
  187. package/dist/chunk-GKOBB6DH.mjs +0 -2
  188. package/dist/chunk-GMJD7ID3.mjs +0 -2
  189. package/dist/chunk-GQJMVSSN.mjs +0 -2
  190. package/dist/chunk-HX4DLE3J.mjs +0 -10
  191. package/dist/chunk-IS7N3N6Q.mjs +0 -168
  192. package/dist/chunk-JEUK3ZO7.mjs +0 -2
  193. package/dist/chunk-JPG2LBQM.mjs +0 -11
  194. package/dist/chunk-JYK5WJPM.mjs +0 -2
  195. package/dist/chunk-KLQP46Y3.mjs +0 -4
  196. package/dist/chunk-L55NOXBE.mjs +0 -4
  197. package/dist/chunk-LCB6MARS.mjs +0 -5
  198. package/dist/chunk-LJLVCU6W.mjs +0 -16
  199. package/dist/chunk-LMUZQK5O.mjs +0 -2
  200. package/dist/chunk-NMF3IPYA.mjs +0 -13
  201. package/dist/chunk-ONKC4BCC.mjs +0 -2
  202. package/dist/chunk-OU6ZZVBX.mjs +0 -5
  203. package/dist/chunk-PUOQ65NC.mjs +0 -2
  204. package/dist/chunk-QJAVCTY7.mjs +0 -2
  205. package/dist/chunk-QP7BOHE4.mjs +0 -2
  206. package/dist/chunk-S3SX3COT.mjs +0 -20
  207. package/dist/chunk-SQ3FQCCN.mjs +0 -8
  208. package/dist/chunk-T4Y2ZSVX.mjs +0 -4
  209. package/dist/chunk-TANZRINB.mjs +0 -2
  210. package/dist/chunk-UGWMMEJ5.mjs +0 -15
  211. package/dist/chunk-UTF7GBQU.mjs +0 -4
  212. package/dist/chunk-V4ZHRALW.mjs +0 -170
  213. package/dist/chunk-XBNFXWAW.mjs +0 -6
  214. package/dist/chunk-XZV72SQ4.mjs +0 -2
  215. package/dist/chunk-YFJB534W.mjs +0 -2
  216. package/dist/chunk-Z6OKLRHC.mjs +0 -2
  217. package/dist/chunk-ZMHUDYLV.mjs +0 -2
  218. package/web/assets/index-D8P8uhDW.js +0 -15
  219. package/web/assets/index-FLb9jCfl.css +0 -1
  220. /package/dist/{chunk-PAREWQGB.mjs → chunk-NOGQX56R.mjs} +0 -0
@@ -1,554 +0,0 @@
1
- import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
- var n=["init","new","import","open","serve","stop","check","export","qa","list","workspaces","move","set","link","extension","block","page","skill"],r={component:"block"},o=`The workspace (the folder of your documents) is --workspace <dir>, else GALLERY_WORKSPACE, else the
3
- nearest folder up from here holding gallery.json (gallery init makes one), else ~/Documents/Gallery (on Windows
4
- the Documents folder Explorer shows, OneDrive's when OneDrive backs it up): the default workspace, the
5
- sidebar's \u9ED8\u8BA4\u6587\u6863 (GALLERY_DEFAULT_WORKSPACE names another folder in its place).`,t=`A document is named by its slug, by its link (\u5468\u62A5-k3xv9q2a, what gallery list shows after /#) or by a
6
- whole address, as a user hands one over (http://127.0.0.1:4317/#\u5468\u62A5-k3xv9q2a, a block's id after a / or not): the
7
- words in a link are a label, and a title changed since leaves the address good.`,a={init:`Usage: gallery init [<dir>] [--from <old reports dir>] [--name "<name>"]
8
- Makes a workspace: <dir> (else the workspace found as every command finds it) with its gallery.json
9
- only (never over a gallery.json that is there); the home workspace also gets its application folders. Prints \u5DE5\u4F5C\u533A\uFF1A<abs>\uFF08\u65B0\u5EFA or \u5DF2\u6709\uFF09.
10
- --name writes the workspace's name in its gallery.json (the project's: what the sidebar and gallery
11
- workspaces call it; else its folder's), said as \u540D\u5B57\uFF1A<name>; gallery workspaces --name changes it.
12
- The workspace goes on this machine's registry, as every command's does (gallery workspaces).
13
- --from copies the documents of an older Gallery (its reports/ folder: one folder a document, each
14
- holding report.html or doc.html) into the workspace: every document whose slug is free here (the
15
- others listed as skipped), its preferences.md when the workspace has none, the sidebar's order, the
16
- \u5199\u4F5C\u504F\u597D page, the custom emoji and the documents' recent versions. The old folder is only read:
17
- nothing there is changed, moved or deleted.
18
- Only the default workspace gets its home page (\u9996\u9875, pages/home/: Gallery's today and note cards),
19
- as a server's first start gives it, said in a line; once made, nothing makes it again.
20
- Exits 1 when the workspace cannot be written or --from names no folder; 2 for a name that is empty,
21
- over 80 characters or more than one line.`,new:`Usage: gallery new <slug> "<title>" ["<description>"] [--under <document>] [--after <document> | --first] [--no-preview] [--no-browser]
22
- A new document in <workspace>/<slug>/ from the starter: its doc.html, holding the starter's section
23
- to replace, and doc.json, with the title and the description (\u65B0\u6587\u6863 when none is given). Where it goes
24
- in the sidebar's tree: under --under's document, last (first with --first), or right after --after's
25
- (at that one's level); neither, at the top level, last. A document is named there by its slug, link
26
- or address (gallery help says how), and must be there, not in the trash; the \u5199\u4F5C\u504F\u597D page holds none.
27
- Then says where it went (Placed it \u2026), where it wrote (the workspace), where the user's writing preferences are (\u5199\u4F5C\u504F\u597D,
28
- <home>/preferences.md, to read first: made from Gallery's default when there are none yet) and
29
- the next steps (the first: send the user the address now), and last starts the one Gallery
30
- server (or uses the one running: it runs on after this command), opens the default browser at the
31
- document and prints the address to give the user, as gallery open does. In a workspace other than the
32
- default one, the document also joins the default workspace's sidebar (when there is one), in its
33
- workspace's column: a line says where, \u9ED8\u8BA4\u5DE5\u4F5C\u533A\uFF08\u2026\uFF09\u7684\u4FA7\u8FB9\u680F\uFF1A\u5DF2\u52A0\u8FDB\u2026; it is a display only, the file stays in
34
- its own workspace. --no-preview (or
35
- GALLERY_NO_PREVIEW=1) leaves the server alone; --no-browser (or GALLERY_NO_BROWSER=1) opens no
36
- browser. Editing needs Chrome or Edge.
37
- A title or a description that starts with "-" and a letter would be read as an option: put "--"
38
- before the arguments (gallery new q3-review -- "-Q3 \u56DE\u987E").
39
- Exits 1 when the document exists, or the slug is the workspace's own (exports, the \u5199\u4F5C\u504F\u597D page's) or
40
- a document's in the trash, or a document --under or --after names is not there (nothing made), or
41
- the new one could not be placed (made, at the top level); 2 for a document named that is in the trash.`,import:`Usage: gallery import <file> [<slug> ["<title>"]] [--no-preview] [--no-browser]
42
- New documents made of a file, as the workbench's \u5BFC\u5165 makes them: Markdown (.md .markdown .mdx .txt
43
- .text), HTML (.html .htm .xhtml, a Gallery export too), a table (.csv .tsv), Word (.docx), PDF (.pdf,
44
- its text), EPUB (.epub) or a .zip of them (a Notion export: one document a page, nested as there).
45
- The first document's title is the argument's, else the file's (front matter, first heading, name);
46
- its slug the argument's, else made of the title's Latin words (lowercase kebab-case, a number added
47
- when it is taken, as gallery new would refuse it). The pictures a Markdown file links to by relative addresses are copied into
48
- <slug>/assets/. Then says what it made, what it could not bring as the file has it (by line), the
49
- text the preview leaves read-only, the workspace, \u5199\u4F5C\u504F\u597D, the next steps (the first: send the user
50
- the address now), and last, as gallery new does, the browser opened at the first document and the
51
- server's address to give the user (--no-preview, or GALLERY_NO_PREVIEW=1, leaves the server alone;
52
- --no-browser, or GALLERY_NO_BROWSER=1, opens no browser).
53
- Put "--" before a title that starts with "-" and a letter.
54
- Exits 1 when the file is not there, cannot be read, or gallery new would refuse the slug; 2 for a
55
- kind it does not take.`,open:`Usage: gallery open [<slug>] [--no-browser]
56
- Starts this workspace's Gallery server (or uses the one running: it runs on after this command, its
57
- log in <data>/logs/server.log), waits until it answers, and opens the default browser
58
- at the workbench, or at the document <slug>, at its block when an address names one (--no-browser,
59
- or GALLERY_NO_BROWSER=1, opens none).
60
- ${t}
61
- Prints the workspace, the server, the document's page alone (the Agent's own, with a slug) and last
62
- the address to give the user. With a slug in a workspace other than the default one, a line before
63
- them says the document joined the default workspace's sidebar (as gallery new's does). Editing needs Chrome or Edge: open the address there.
64
- With a slug and no qa baseline yet, it first keeps one of the document as it is now, so that the
65
- first gallery qa after the changes pictures what changed.
66
- Exits 1 when there is no such document, no server answers, or the shared Gallery server takes the
67
- request and gives no answer (a second server is never started beside it).`,serve:`Usage: gallery serve [--port <n>]
68
- Runs this workspace's Gallery server in the foreground until Ctrl+C (gallery open runs one in the
69
- background instead). Prints the address once it answers. --port picks the port (else the last one
70
- this workspace used, else the first free one from 4317).
71
- Exits 1 when a server of this workspace runs already (its address said) or the port is taken.`,stop:`Usage: gallery stop
72
- Stops this workspace's Gallery server, the one gallery open or gallery new started: it finishes the
73
- saves in its queue first. A server npm run dev runs (Gallery's own development) is stopped where it runs.
74
- Exits 0 when it stopped or none runs, 1 when it could not be stopped.`,check:`Usage: gallery check [<slug>...] [--allow-failures]
75
- Checks each named document (none named: every document of the workspace) on its own.
76
- ${t}
77
- Reads it as its preview shows it (natural HTML made the kit's in memory) and writes nothing: what the export will
78
- write as the kit's markup is printed by line, and the blocks it will give an id (each at its line
79
- when they are ten at most); first, once, what the preview wrote as the kit's markup when the reader
80
- edited the document, and the \u6279\u6CE8 it deleted because their words are gone. Problems to act on first
81
- ("fix") come before the others ("note").
82
- Exits 1 when a document fails, unless --allow-failures.`,export:`Usage: gallery export <slug>... [--allow-failures]
83
- gallery export --all [--allow-failures]
84
- Hands each named document in: its doc.html (report.html in an older document) written as its
85
- preview shows it, natural HTML as the kit's markup and every block given an id (through the
86
- shared Gallery server while one runs); then checks it and writes one standalone offline file per
87
- passing document, <workspace>/exports/<slug>.html. A document the quick checks fail is not handed in.
88
- ${t}
89
- It says first, once, what the preview wrote when the reader edited a document and the \u6279\u6CE8 it deleted;
90
- then the failures ("FAIL <slug>: N problems"), the exports made, the notes to act on first ("fix")
91
- and the others ("note"), what the hand-in wrote by line, which files to re-read before editing them,
92
- and last, for each document exported, \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A and the export's absolute path.
93
- Exits 1 when a document fails, unless --allow-failures.`,qa:`Usage: gallery qa <slug>... [--tiles] [--blocks <id,\u2026>] [--no-export]
94
- gallery qa --all [--tiles] [--no-export]
95
- Looks at each named document's export (<workspace>/exports/<slug>.html; one with none yet, or one not
96
- made from its doc.html and its custom blocks as they are now, is exported first, as gallery
97
- export does, unless --no-export) as a reader's browser shows it: Chrome or Edge, headless, at 1024, 736 and 360px wide
98
- and in a laptop's 1024\xD7768 window, every disclosure open, each Sheet and detail card shown in turn.
99
- ${t}
100
- Each finding is said with its place in the document's file (doc.html:<line>, report.html:<line> in
101
- an older document): fail (errors, broken pictures, charts that drew nothing, the page wider than the
102
- window\u2026), warn (columns or rows out of sight, overlapping text\u2026), info, unverified (no browser, a
103
- wait that ran out\u2026). Pictures go to <workspace>/.gallery/qa/<slug>/ (its absolute path printed):
104
- flagged/, changed/ and cards/ (the blocks changed since the last look, and the cards not pictured
105
- yet), blocks/ (--blocks <id,\u2026>, one document only; the ids split at commas or spaces, and one the
106
- document has not refused before anything is looked at), tiles/ (--tiles: the page in tiles). Each run
107
- empties its own folders first: flagged/ every run, changed/ and cards/ a plain run, blocks/ a --blocks
108
- run, tiles/ a --tiles run. A --blocks run says, before its verdict, the changed blocks and the cards
109
- it did not picture: a plain run pictures them. First, once, as gallery check says them, what the
110
- preview wrote when the reader edited the document and the \u6279\u6CE8 it deleted. Then a Not opened yet line,
111
- every picture of the run in one place, none opened for you; the verdict; and last, on a line of its
112
- own, the export's absolute path after \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A.
113
- GALLERY_BROWSER=<executable> picks the browser. A browser that does not start is tried once more
114
- with a fresh profile.
115
- Exits 1 when anything fails (or the export it ran first did), 3 when something could not be
116
- verified (UNVERIFIED: no browser, or one that did not start), 2 when an export is missing or stale
117
- with --no-export or --blocks names an id the document has not, else 0. A warning never fails.`,list:`Usage: gallery list [<words>...]
118
- gallery list --tree [<document>]
119
- gallery list [<words>...] --all
120
- The workspace's documents, for an Agent to find the one the user means: each one's slug and title,
121
- its description, where it is in the sidebar's tree when it is under another (\u4F4D\u7F6E\uFF1Athe documents above
122
- it, from the top), its address (\u5730\u5740\uFF1A/#<link>, after the port of the shared Gallery server), when its file
123
- was last written and where that file is, the one edited last first.
124
- With words, only those whose title, description or slug holds any of them (case alike, Chinese found
125
- inside words), the best first, then those whose text holds them, each with its first place there
126
- (\u6B63\u6587\uFF1A\u2026); with a document's link or whole address, that document, or that it is in the trash.
127
- --tree lists them as the sidebar shows them, in its order, each under the one it is under, indented
128
- two spaces a level: a line each, its slug, its title (its emoji before it), its description and its
129
- last edit. --tree <document>: that document and the documents under it, after its \u4F4D\u7F6E line.
130
- The sidebar's web links (gallery link) are listed too, each with \u7F51\u9875\u94FE\u63A5\uFF1Aits address: after the
131
- documents (with words, those whose name, address or slug holds one), and in their place in --tree.
132
- With columns besides the own one (the sidebar's \u680F: each other registered workspace has one, with its
133
- documents; \u9ED8\u8BA4\u6587\u6863 is the default workspace's), --tree lists them column by column, each under its name
134
- (one removed from the sidebar is left out), and \u4F4D\u7F6E starts with the column's (\u4F4D\u7F6E\uFF1A\u56E2\u961F\u680F \u203A \u2026) for an
135
- entry outside the own column; a document outside its own column says that column (\u300C\u9ED8\u8BA4\u6587\u6863\u300D\u7684\u6587\u6863).
136
- ${t}
137
- First, the workspace and where \u5199\u4F5C\u504F\u597D is (made from Gallery's default when there is none yet).
138
- --all searches every workspace of this machine (gallery workspaces lists them, the current one
139
- always among them) by the title, description and slug of each document (not its text), the best
140
- first (no words: all, the one edited last first), each after the line \u5DE5\u4F5C\u533A\uFF1A<path> of its
141
- workspace, which --workspace takes to work on it there; it only reads: nothing is written in any of
142
- them, and \u5199\u4F5C\u504F\u597D is not made. A workspace no longer there is named at the end, not searched.
143
- Exits 1 when --tree names a document that is not there, 2 one in the trash.`,workspaces:`Usage: gallery workspaces
144
- gallery workspaces --scan [<folder>]
145
- gallery workspaces --name "<name>"
146
- gallery workspaces --forget <path>
147
- The workspaces of this machine: every workspace a gallery command or a Gallery server has worked in
148
- is registered in a file of the user's (GALLERY_DATA_DIR,
149
- else %LOCALAPPDATA%\\gallery\\workspaces.json on Windows, ~/Library/Application Support/gallery on macOS,
150
- $XDG_STATE_HOME/gallery or ~/.local/state/gallery elsewhere). Lists them, the current one first (*),
151
- then the one edited last first: each one's name (its gallery.json's, else its folder's; the folder
152
- above it, or its own path, after the name when two are called alike), its id (ws- and six hex
153
- digits), its path (\u8DEF\u5F84\uFF1A), how many documents it has and when one was last edited (\u6587\u6863\uFF1A), and its
154
- one shared service address printed above the list (\u670D\u52A1\uFF1A); one whose folder or gallery.json is gone is marked \u4E0D\u5728\u4E86
155
- and stays registered (a drive may come back).
156
- --scan registers the workspaces in <folder> and below it, 6 levels down at most (not in node_modules,
157
- .git, a dot folder or the recycle bin): the Documents folder when none is named. --name names the
158
- current workspace (gallery.json's name, the workspace made first when it is not there). --forget
159
- takes a workspace off the registry, named by its path or its id; nothing on disk changes (a command
160
- run in it registers it again). Nothing else is written, and no file of a workspace is ever removed.
161
- gallery list <words> --all searches the documents of every one.
162
- Exits 1 when --scan names no folder, --forget no registered workspace, or the name cannot be written;
163
- 2 for a name that is empty, over 80 characters or more than one line, and for two of --scan, --name
164
- and --forget at once.`,move:`Usage: gallery move <document> (--under <document> | --top) [--after <document> | --first]
165
- Moves a document in the sidebar's tree, with the documents under it: under --under's document, to the
166
- top level (--top), or where it is now (neither); right after --after's document (one at that level,
167
- whose level it is when neither --under nor --top says one), first (--first), else last. Written
168
- through the workspace's running server when there is one (an open workbench shows it at once), else
169
- here. Nothing in the documents' files changes: links between documents go by their folders, which
170
- stay where they are.
171
- ${t}
172
- Prints where it went and where it was, then its place (\u4F4D\u7F6E\uFF1A\u2026, as gallery list says it).
173
- Exits 0 when it moved or is there already; 1 when a document named is not there or is the \u5199\u4F5C\u504F\u597D page
174
- (listed apart: it moves nowhere and holds none), when the place is under itself or a document under
175
- it, or --after names one at another level; 2 for a document in the trash.`,set:`Usage: gallery set <document> [--title "<title>"] [--icon <icon>|none] [--description "<text>"]
176
- Changes a document's title, page icon or description as the workbench's \u91CD\u547D\u540D and the page's icon
177
- picker do: the title in doc.html (the h1 of its header, and <title> where that holds the h1's words,
178
- else the whole of it) and in doc.json; the icon in the header (div.doc-icon before the h1: made,
179
- changed, or taken away with none) and in doc.json; the description in doc.json. An icon is an emoji,
180
- an icon of the \u56FE\u6807 tab (/icons/<name>_<color>.svg, Tabler's /icons/tabler/<name>_<color>.svg, the
181
- colors gray, lightgray, brown, yellow, orange, green, blue, purple, pink, red) or a picture of the
182
- document's folder (assets/<file>). doc.html is written as an Agent writes it, the rest of it as it
183
- is: the page open in the browser shows it, and the workbench's sidebar the new title and icon.
184
- A title that starts with "-" and a letter is written --title="-Q3 \u56DE\u987E".
185
- ${t}
186
- Prints what changed, then the files to re-read before editing them.
187
- Exits 1 when the document is not there or is the \u5199\u4F5C\u504F\u597D page, its page has no h1.doc-title, its
188
- doc.json does not read, or the picture is not in its folder; 2 for an icon that is none of these.`,link:`Usage: gallery link add <url> "<name>" [--column "<column>"] [--under <entry>] [--after <entry> | --first] [--icon <emoji>]
189
- gallery link set <link> [--url <url>] [--title "<name>"] [--icon <icon>|none]
190
- gallery link remove <link>
191
- A web link of the sidebar: a page of the web (http or https) the workbench shows beside the sidebar,
192
- in a frame (a site that refuses frames is offered \u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00), in the tree with the documents. It is
193
- a folder <workspace>/<slug>/link.json (no document: nothing checks, exports or searches it), its slug
194
- made of the name's Latin words, else the site's name. A link is named by its slug or its link (what the
195
- workbench's address holds after #).
196
- add puts it first in the own column (the workspace's own documents'; as the sidebar's \u6DFB\u52A0\u5728\u7EBF\u7F51\u9875\u2026
197
- puts one first in its column); --column first in the column of that name (as the sidebar calls it, or
198
- one the user named), --under last under an entry (a document or a link), --after right after one.
199
- Prints where it went (\u4F4D\u7F6E\uFF1A\u2026, as gallery list says it). The site's own icon (its page's <link rel=icon>,
200
- else /favicon.ico; 16 KB at most) is fetched once and kept in link.json, shown when no --icon is given.
201
- An address of this workspace's own server (its host and port) is refused: link the document instead.
202
- set changes its address, its name or its icon (an emoji or an icon of the \u56FE\u6807 tab; none takes it away).
203
- remove moves it to the trash, which the workbench's \u8BBE\u7F6E \u203A \u56DE\u6536\u533A restores it from, where it was.
204
- Each is written through the workspace's running server when there is one (an open workbench shows it
205
- at once), else here.
206
- Exits 1 when a link, a column or an entry named is not there or the server refuses it; 2 for an
207
- address that is not http or https, an empty name, or two places at once.`,extension:`Usage: gallery extension new <id> "<title>"
208
- gallery extension list
209
- gallery extension check <id>
210
- gallery extension install <folder | .zip>
211
- gallery extension remove <id>
212
- An extension (\u6269\u5C55) gives the sidebar a column of entries of its own, beside \u6587\u6863: a folder
213
- <workspace>/extensions/<id>/ whose sidebar.json lists them (a title, an optional icon, and entries each with
214
- an id, a title, an optional address (http or https), an optional icon and optional children). The workbench
215
- reads the file again within a second of every change; a click on an entry with an address opens that page beside
216
- the sidebar (as a web link's), one without opens and closes what is under it. The user may drag the column to
217
- another place, rename it and reorder its root entries; title/order edits write back to sidebar.json.
218
- A file that does not read shows the column with one row, \u6761\u76EE\u8BFB\u4E0D\u51FA\u6765\uFF1A<why>.
219
- new creates an empty sidebar.json in the default workspace. Project-local extensions are not read.
220
- install <folder | .zip> validates and replaces an extension; remove <id> removes it.
221
- list prints capabilities and AGENT.md paths. Executable extensions require user confirmation in Settings > Extensions.
222
- Every sidebar reads only the default workspace's extensions. No files are copied or moved automatically.
223
- list prints the visible extensions, their source paths, titles and entry counts, or why they show none.
224
- check <id> resolves the same default-workspace source as the sidebar and prints what the sidebar will show:
225
- the column, then each entry with its id, title and address, one under another indented; notes (an icon that
226
- is no emoji and no icon of the \u56FE\u6807 tab, which is left out) follow. Writes nothing.
227
- Exits 0 when the file reads; 1 when the extension is not there, has no sidebar.json or its file does not
228
- read (FAIL <file>: <why>, and the row the sidebar shows); 2 for an id that is no extension's id.`,block:`Usage: gallery block new <id> ([--script] [--flow] [--data] [--page] | --recipe <name>)
229
- gallery block add <name>
230
- gallery block list
231
- gallery block show <id>
232
- gallery block check <id> [--documents]
233
- gallery block try <slug> [<instance id>] --press <selector> [--then <key>] [--keep]
234
- gallery block try <slug> [<instance id>] --drag <selector> --to <selector> [--then <key>] [--keep]
235
- gallery block try <slug> [<instance id>] --key <selector> <key> [--then <key>] [--keep]
236
- gallery block try <slug> [<instance id>] --type <selector> <words> [--replace] [--then <key>] [--keep]
237
- gallery block try <slug> [<instance id>] --select <selector> <value> [--then <key>] [--keep]
238
- gallery block try <slug> [<instance id>] --steps <file> [--keep]
239
- gallery block key [<host> [<key>]] [--remove]
240
- gallery block pack install <folder|zip>
241
- gallery block pack list
242
- gallery block pack remove <pack>
243
- A custom block (\u81EA\u5B9A\u4E49\u5757) is a block to use again, kept in the workspace: components/<scope>/<name>/
244
- (its files keep the word component: component.json, data-doc-component). An id is <scope>/<name>, or a
245
- <name> alone in the scope local (but for show and check, a <name> that is none of local's and is one of
246
- Gallery's own is Gallery's, as for add: gallery block show heatmap shows gallery/heatmap); a document
247
- uses one by an element naming it. The scopes gallery and gallery-soft are Gallery's own blocks' (its two packs:
248
- Gallery \u98CE\u683C and \u67D4\u5149\u98CE\u683C). gallery component \u2026 is another name for gallery block \u2026, and says the same.
249
- new starts a block: component.json, template.html, example.html, writing.md and style.css, and with
250
- --script a kit.js; with --flow a slot, body, in place of its paragraph, where a document writes blocks
251
- of its own; with --data a block that keeps what a reader enters in a part of JSON (items, a list of
252
- lines, written on one line as context.editJSON writes it): a kit.js that reads it with context.readJSON
253
- and writes it with context.editJSON, from a field (DocKit.input) and a button hidden where nothing is
254
- written (an export), an example() that adds a line and works on template.html's empty instance as it
255
- does on example.html's (--script is implied; --data and --flow do not go together); with --page a
256
- custom page's card (places ["page"], a card of two sizes the user may resize, its text parts edited as
257
- none, which a page shows as written; --page and --flow do not go together), combined with --data a
258
- card that keeps data; with --recipe <name> (alone: none of --script --flow --data --page goes with it, the
259
- recipe being a block already made: todos, weather and the other blocks of Gallery's for a custom page
260
- are cards for one already, places ["page"]) the files of Gallery's own block of that name, every word
261
- that named it naming the new id, its version 0.1.0, and a line naming what is still the recipe's:
262
- preview.svg, writing.md and example.html. Each passes check, and try on its field, as it stands, and
263
- says what to write next.
264
- Exits 1 when the id is taken; 2 for an id of the scope of Gallery's own packs or of a pack installed, a
265
- recipe Gallery has none of, or options that do not go together.
266
- add puts one of Gallery's own blocks in the workspace as it ships (a <name> alone is Gallery \u98CE\u683C's,
267
- gallery-soft/<name> \u67D4\u5149\u98CE\u683C's), components/gallery/<name>/, no check
268
- or try needed, and records its version and what its files hold in .gallery/blocks.json; run again with a
269
- newer Gallery, it updates a copy that is as it was added, and never one changed since.
270
- Exits 1 when the copy there was changed since it was added (or put there by another hand), said with
271
- what to do: --recipe for a block of your own, or delete the folder and add it again.
272
- list says what the workspace has now, in two groups by where a block may stand (its manifest's places):
273
- \u6587\u6863\u91CC\u53EF\u7528, in documents, and \u81EA\u5B9A\u4E49\u9875\u53EF\u7528, on custom pages, each with its version, what it uses (needs)
274
- and whether the user's switch keeps it out of the document's menus, which is still a block to write;
275
- then those not to use now and why: disabled, one that does not load, a manifest one level too shallow;
276
- then Gallery's own blocks not added yet, or added as an older version, each with its gallery block add
277
- line; and last the built-in blocks the user took out of the document's menus.
278
- pack: a block pack (\u81EA\u5B9A\u4E49\u5757\u5305) is a scope of blocks, components/<pack>/, with its pack.json (id, name,
279
- description, version, author, homepage, icon), to share as its folder or a zip of it. pack install copies
280
- one in (a folder, or a zip with the pack's folder or what it holds at its top), each block's manifest
281
- last, and records its version and what its files hold in .gallery/blocks.json; installed again (a newer
282
- version), a block as it was installed is replaced and one changed since is kept, said with what to do.
283
- Refused, exit 1, with why: no pack.json at its top or one that does not read, a block folder whose
284
- component.json does not name it <pack>/<name>, a file that points out of it, more than 2000 files or 64
285
- MB, the id of one of Gallery's own packs, or one the workspace has a folder of that no install put
286
- there. pack list says the workspace's packs: Gallery's own (installed as a workspace first starts:
287
- Gallery \u98CE\u683C on, \u67D4\u5149\u98CE\u683C off), those installed and the scopes of its own blocks, each with its version,
288
- whether its switch in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 is on (off: no menu or library offers its blocks; what is written of
289
- them shows as ever), how many blocks and who made it. pack remove takes out a pack installed, its
290
- folder and records (exit 1 for one of Gallery's own, which its switch turns off, or a scope no install
291
- put there).
292
- show says how to write one: its parts, where it may stand, its writing.md and its example. Of one of
293
- Gallery's own the workspace has not added (gallery/<name>) it prints what Gallery ships of it the same
294
- way, and ends with the gallery block add <name> line that puts it in.
295
- Exits 1 when there is no such block or it does not load.
296
- check says what is wrong with one, each problem ("FAIL") at its place in the block's files, each note
297
- never a failure, in five sections: 1 the manifest, with template.html there, text parts that hold
298
- words and marks alone, and a note on a Chinese name no word of its words spells whole in pinyin, a
299
- syllable a character, by how many syllables a word reads as; 2 kit.js: what a browser refuses, what
300
- an export refuses, what it registers, a type check against sdk/; 3 style.css: every selector in the
301
- instance, what an export cannot hold, and a note on one that goes down into a slot; 4 template.html
302
- and example.html, each read as a document's page by what gallery check runs, and template.html as what
303
- a menu can put in; 5
304
- both in a temporary document, exported and opened as gallery qa opens one, in Chrome or Edge under the export's
305
- policy: what the console and the policy say, a dialog or a window it opens, mount then dehydrate then
306
- mount and copies put back giving the same DOM (a drawing neither the manifest's runtime nor dehydrate
307
- names piles up, and what piles up outside the instance is named too), a slot the component writes in
308
- or moves, a text part the component redraws, a data part a mount changes, a write with no gesture
309
- once the page takes edits, the way back to the file (a way back line: what the component's example wrote, each part with how many of its
310
- lines the write took out and put in, and that the server took it; a note on a write that lays a part
311
- out anew (not where it is context.editJSON's own layout: a part on several lines closing to one line as
312
- its list empties, an entry in it opening to lines as it comes to hold an object; a part on one line
313
- stays on one), a FAIL at kit.js on an example() that changes nothing on template.html's empty instance, and a
314
- note on a list a card is dropped on that listens for dragover and not for dragenter), a note on a
315
- control of an instance with a data part that is still shown and enabled where nothing is written (the
316
- export's look: context.canEdit() false), a page wider than the window, and the pictures, in <workspace>/.gallery/qa/components/<id>/, its absolute
317
- path printed, emptied each run: overview-light.png and overview-dark.png, the three widths of a theme
318
- side by side, then each at 360, 736 and 1024px wide, light and dark, and edit-1024-light.png and
319
- edit-360-light.png, as the editing page draws it, said when they are the export's. Section 5 waits
320
- until what it needs passes; a page that stops answering or loads itself again ends it, and is said;
321
- with no browser, one that does not start or goes while it looks, or a folder it cannot write, it says
322
- so and the rest stands. A block the user turned off is checked as any, with a note saying so. A note in
323
- section 1 says a preview.svg that is, byte for byte, one of Gallery's own blocks' (a block made with
324
- --recipe keeps its recipe's picture). Last, before the verdict, a Not opened yet line lists every
325
- picture of the run, none looked at for you, as gallery qa's and gallery page check's do.
326
- --documents adds a section for each document of the workspace that holds instances of it, those in
327
- another's slot too: each run as the example is, in a temporary document of their own, exported and
328
- opened under the export's policy, each problem at its line of the document's file (board/doc.html:15),
329
- the pictures in documents/<slug>/ of the block's folder. It writes no document.
330
- GALLERY_BROWSER=<executable> picks the browser.
331
- Exits 1 when anything fails, 3 when nothing did and no browser ran it (UNVERIFIED), else 0.
332
- Exits 2 for an id no block can have.
333
- try makes what a reader does on an instance in a document, with the pointer and the keys, and says
334
- what it wrote. It makes it on a scratch copy of the document (<workspace>/.gallery/try/try-<8 hex>/,
335
- gone at the end, whatever came of it): doc.html is not written, and no page of the user's shows the trial;
336
- --keep makes it on the document itself and leaves what it wrote. It starts the shared Gallery server (or
337
- uses the one running), as gallery open does, and opens the copy's page alone, editable, in Chrome or
338
- Edge, headless, in a profile of its own, and waits until the server has told the page of the writes
339
- made before it (a custom block changed), which load it again. Each selector is the first element of the
340
- instance it finds: --press, a press at its middle; --drag \u2026 --to, pressed there, moved in steps to the
341
- middle of another and released a moment after the move that comes onto it; --key, the key (Enter,
342
- Space, ArrowRight, a letter, Shift+Tab, Control+a) with the focus on it, as Tab gives it; --type, the
343
- words typed in a field or an editable element, pressed first and the caret at its end (unless the focus
344
- is in it already), ASCII key by key and the rest through an input method, composed then committed (the
345
- Gesture line says what the field held, and that the words went after it, or, with the focus in it
346
- already, in at the caret where a step before left it; --replace selects all it holds first, so that
347
- they take its place, as { "type": [".name", "\u65B0\u540D\u5B57"], "replace": true } in a step);
348
- --select, an option of a <select>, by its value or its words, chosen as a reader picks one. --then
349
- <key> presses a key after it where the focus is (--then Enter, for a field that writes on Enter).
350
- --steps <file> makes several, one after another in one page: a JSON list of steps, each one gesture as
351
- the options name them, without their --: [{ "press": ".add" }, { "key": [".name", "Control+a"] },
352
- { "type": [".name", "\u591A\u559D\u6C34"], "then": "Enter" }, { "select": [".unit", "\u676F"] }, { "drag": ".card",
353
- "to": ".column:nth-child(3)" }], 20 at most. <slug> names the document, as its link or a whole address
354
- does too (gallery help says how), and the instance is named by its data-block-id, or by its block's
355
- id where the document holds one of it; with one instance in the document, not at all. An instance in
356
- another's slot is one of them, said with where it stands. Once <html>'s data-ge-save says saved again
357
- after each, it prints a Gesture line (Step N with --steps), what it did to which element, and a Wrote
358
- line: each part of the instance with how many of its lines it took out and put in, then those lines
359
- (- and +), and that nothing outside the instance changed, data-block-id aside, which a save gives
360
- (what did is someone else's, which stays); with --steps, Wrote: nothing of a step that wrote nothing.
361
- Then it undoes as a reader does, the focus taken off a field of the instance first (a field that
362
- writes as it loses the focus writes then), and Ctrl+Z pressed once for each write the page took, the
363
- last first (each context.edit is an undo step of its own: a step that wrote twice takes two), and an
364
- Undone line says the copy came back as it was before each step that wrote; --keep presses none (a Kept
365
- line). Then it opens what the steps wrote in a fresh page (a second copy, or doc.html with --keep),
366
- where the instance is to mount, write nothing as it opens (its file the same once it has come to edit)
367
- and show the words and the fields' values it showed after them of what they wrote (a Read back line);
368
- what it shows otherwise that is none of what the steps wrote (a filter or a tab chosen, an editor left
369
- open, words typed and not committed: what the page showed and never wrote) is a note. Last, a picture of
370
- the instance after the steps, <workspace>/.gallery/qa/<slug>/try/after.png, its absolute path
371
- printed, emptied each run: open it, as the line says; a Not opened yet line then lists the pictures of the
372
- run (after.png, and fresh.png when it was taken), none looked at for you, as gallery qa's does. A trial cut off (the page offline, a load of its
373
- own, the browser gone) says what the file held of it.
374
- Exits 1 when no step wrote anything (what came of the last said: no context.edit, one the page
375
- refused, an HTML5 drag dropped nowhere, a selector that finds nothing as the component failed, a
376
- field typed in that writes on a key or as it loses the focus), when a Ctrl+Z did not take a step's
377
- write back, when the fresh page shows it in its fallback, writes as it opens or shows what the steps
378
- wrote otherwise than the page did after them (fresh.png pictures it), or when the component failed; 2
379
- for a mistake in the command line: a selector that finds nothing shown in the instance, an instance the
380
- document has not among them, a drag that ends on what it drags, an option a <select> has not, a steps
381
- file that does not read (one found at a step after others were made is said after what those wrote,
382
- which with --keep stays in doc.html); 3 when the trial was not seen through (UNVERIFIED: no server or browser ran
383
- it, a page that loaded itself again; with --keep a card waiting for the reader, someone else's write
384
- meanwhile, which stays), the line saying what the file held.
385
- key keeps the workspace's key for a site its blocks reach, by its host (a block's needs' host:
386
- api.example.com), in <workspace>/.gallery/keys.json, never gallery.json: where a block's address on that
387
- host names {key} (its path or its query: \u2026/latest?apikey={key}), Gallery's server writes the key in as it
388
- fetches for the block (context.fetch); no page, cache or export ever holds it. With a host and no key
389
- it says whether one is kept; with --remove it takes it away; with nothing, the hosts that have one and
390
- those the workspace's blocks name with none. A key is never printed.
391
- Exits 2 for a host no block's needs can name, or a key that is empty or more than one line.`,page:`Usage: gallery page new <slug> "<title>"
392
- gallery page list
393
- gallery page open <slug> [--no-browser]
394
- gallery page add <slug> <block> [--board <id>] [--x <n> --y <n>] [--w <n>] [--h <n>] [--set <key>=<value>]\u2026
395
- gallery page try <slug> <card id> --press <selector> [--then <key>] [--keep]
396
- gallery page try <slug> <card id> --drag <selector> --to <selector> [--keep]
397
- gallery page try <slug> <card id> --key <selector> <key> [--keep]
398
- gallery page try <slug> <card id> --type <selector> <words> [--replace] [--then <key>] [--keep]
399
- gallery page try <slug> <card id> --select <selector> <value> [--then <key>] [--keep]
400
- gallery page try <slug> <card id> --steps <file> [--keep]
401
- gallery page check <slug>
402
- A custom page (\u81EA\u5B9A\u4E49\u9875) is a page the workbench lists in its sidebar with \u65B0\u5EFA and \u641C\u7D22, kept in the
403
- workspace: pages/<slug>/, page.html (free HTML: its look, its own scripts, and boards of cards, each card
404
- one custom block's instance, where it has them) and page.json ({ "title", "icon" }). An Agent writes them
405
- (the user may make a blank one for an Agent to write); the user orders, renames and trashes them.
406
- Documents and custom pages share one set of slugs: neither takes the other's, nor pages (the folder).
407
- The home page (\u9996\u9875) is pages/home, a page as any.
408
- new makes one: page.html with its title (in <title>: a page draws no big title) and one empty board (data-board-id="main"), and
409
- page.json with the title; it goes last in the sidebar's head. The server puts in the scripts and styles
410
- of the blocks its cards hold. Says where it wrote and what to write next, and with the shared Gallery server
411
- running ends with the \u4EA4\u7ED9\u7528\u6237 line gallery open has: the page's whole address, to send the user at once
412
- (without one, gallery page open <slug> --no-browser gives it).
413
- Exits 1 when the slug is taken (a document's, a page's, the trash's) or kept (exports, components, pages,
414
- assets, materials\u2026). Before the server's first start in the workspace makes the default home page (with
415
- its own cards; gallery open --no-browser starts one), gallery page open, add, try and check of home say
416
- so in place of "no such page".
417
- list says the workspace's custom pages in the sidebar's order (the order the user dragged them to, then
418
- gallery.json's pages.order, then by title): each one's slug, icon and title, its address (\u5730\u5740\uFF1A, the whole address with
419
- the shared Gallery server running, else /#@<slug>, after the port of a server) and where its page.html is;
420
- in a workspace with no page whose home page is not made yet, only that the home page waits for the server.
421
- open starts this workspace's Gallery server (or uses the one running), as gallery open does, and opens
422
- the default browser at the page in the workbench (--no-browser, or GALLERY_NO_BROWSER=1, opens none).
423
- Prints the workspace, the server, the page alone (the Agent's own: /pages/<slug>) and last the address
424
- to give the user (/#@<slug>).
425
- Exits 1 when there is no such page or no server answers.
426
- add puts a card of a custom block on a board of the page (--board, else main, else its first): the
427
- block's id (local/water) or the name of one of Gallery's own the workspace has (gallery block add puts
428
- one in), a block whose manifest's places hold page. The card takes the block's default size (its
429
- card.sizes' first, else card.w and card.h; one with no h 2 high, where the page's own \u6DFB\u52A0\u81EA\u5B9A\u4E49\u5757 makes it
430
- as high as its content) at the first free spot (the topmost row it fits in, its leftmost column), or the cells --x and
431
- --y (and --w, --h, held to the block's sizes or its min and max: one that writes a min or a max beside its sizes takes any whole size between them) say, the cards it meets pushed down,
432
- never one moved up; its data-card-id is the lowest c<n> no card holds, and every card of the page gets
433
- one it lacks. Written through the workspace's running server when there is one (the queue an open
434
- page's own gestures go through: the page shows the card at once; a block put in a moment ago is
435
- waited for until the server takes it, a few seconds at most), else into page.html, which is kept
436
- first (.gallery/state/pages/<slug>/, the last 20), every other byte of it as it was. Prints the card's
437
- id and cells, and the cards it pushed. Each --set <key>=<value> writes a setting of the block (its manifest's
438
- settings: weather's city, countdown's date) into the card's settings part as it is added, in the same
439
- write, as the card's own grip \u203A \u8BBE\u7F6E\u2026 would, the value held to the setting's type (a number, a date as
440
- YYYY-MM-DD, a select's one of its options, a switch's true or false): --set city=\u4E0A\u6D77 --set unit=\u2109. The
441
- words after the first "=" are the value, whatever the shell does to quotes (no JSON to quote). A block that
442
- has a setting it cannot show anything without (required: weather's city, countdown's date), added with
443
- none, says so after the card: ask the user for it, or take it from what the workspace says.
444
- Exits 1 when there is no such page or board, or the block is not in the workspace, is turned off or is a
445
- document's alone; 2 for a --set of a setting the block has not, or a value its type refuses, nothing written.
446
- try makes what a reader does on one card of the page, named by its data-card-id, and says what it wrote:
447
- gallery block try's gestures (--press, --drag \u2026 --to, --key, --type, --select, --then) and steps
448
- (--steps <file>), made in the page with the pointer and the keys on the card's instance, each selector
449
- the first element of the instance it finds (gallery block --help says each). It makes them on a scratch
450
- copy of the page (<workspace>/.gallery/try/try-<8 hex>/, gone at the end, whatever came of it):
451
- page.html is not written, and no page of the user's shows the trial; --keep makes them on the page itself
452
- and leaves what they wrote. It starts the shared Gallery server (or uses the one running) and opens the
453
- copy's page alone (/pages/<slug>), editable, in Chrome or Edge, headless, in a profile of its own. A
454
- write is what the page's board sends the page service, as the user's gestures go: once each is
455
- answered, a Gesture line (Step N with --steps) and a Wrote line say each data part of the card's
456
- instance (its settings among them) with the lines it took out and put in, those lines under it (- and
457
- +), and that nothing else in page.html changed (card ids aside, which the page service gives the cards
458
- that have none). Only the card's data parts may change: a write anywhere else (the card's place, its
459
- own markup, another card, the page's own HTML) is a problem, said with what it changed. Then the page's
460
- own undo, Ctrl+Z pressed once for each write it took, the last first, the focus taken off a field of the
461
- card first (an Undone line: the copy as it was, card ids aside); --keep presses none (a Kept line). Then
462
- a fresh page of what the steps wrote (a second copy, or page.html with --keep), where the card is to
463
- mount, write nothing as it opens and show what it showed after them of what they wrote (a Read back
464
- line). Last, a picture of the card's instance after the steps, <workspace>/.gallery/qa/<slug>/try/after.png,
465
- its absolute path printed: open it, and the Not opened yet line lists it. --replace goes with --type, as
466
- gallery block try's does.
467
- Exits as gallery block try does: 0 the steps wrote, the undo took it back (or --keep kept it) and a fresh
468
- page read it back; 1 a problem of the block's (gestures that wrote nothing, a write outside the card's
469
- data parts, an undo that left part of a write, a fresh page that shows it otherwise or writes as it
470
- opens), or no such page, a card holding no instance, a block that does not load, is turned off or is a
471
- document's alone; 2 a mistake in the command line (a card the page has not, a selector that finds
472
- nothing in the instance, a steps file that does not read); 3 when the trial was not seen through
473
- (UNVERIFIED: no server or browser, a page that loaded itself again).
474
- check says what is wrong with the page, each problem a FAIL line with its line in page.html, and what
475
- changed in it. Its structure (a page's own scripts, frames and stylesheets are none of its problems):
476
- where it has boards or cards, its boards in <main class="gallery-page">, each board's data-board-id and each
477
- card's data-card-id there, of lowercase letters, digits and hyphens, and once in the page, each card a
478
- board's child holding one instance, its data-x, data-y, data-w and data-h whole numbers on the board
479
- (0 <= x, 1 <= w <= 12, x + w <= 12, 0 <= y, 1 <= h <= 24) and sharing a cell with no other card of its
480
- board, its block in the workspace, loading, not turned off and with page in its places; and each file of
481
- the page's own named (assets/<file>: the folder pages/<slug>/assets/, which the server serves at
482
- /pages/<slug>/assets/<file>) there, and no frame's but a picture's (the server serves a page's own
483
- pictures by their type, its stylesheets and scripts as such, and any other file as bytes for saving: a
484
- frame of a file there downloads it, while a link, a font, a video or audio uses the bytes), a picture,
485
- stylesheet or script written relative any other way being one nothing serves. Then the cards with their ids and cells, and the changes since the page as
486
- the last check that found nothing saw it (or, before any, since the version the page service kept before
487
- its last write): cards added, removed, moved (to another board too), resized, their data parts changed
488
- (with the lines), a card's own markup, the page's own HTML; each change the page wrote since, a gesture
489
- of the user's there (not gallery page add's), ends "(the user's, on the page)": leave it as it is. Then
490
- the page itself, a scratch copy of it on the shared Gallery server (started
491
- or used, as gallery page open does), in Chrome or Edge at 1280, 1920 and 600px wide (a narrow board: fewer
492
- columns of the same 64px cells), light and dark: a card whose content does not fit it, a card drawn out of its board, the page
493
- wider than the window, a block that failed, a picture that does not load, what the console says; each
494
- look pictured whole, <workspace>/.gallery/qa/<slug>/check/<width>-<theme>.png (emptied each run), the
495
- pictures listed and then, on a line of their own, those not opened yet: open them.
496
- Exits 1 when anything is wrong (or there is no such page); 3 when nothing is and the page could not be
497
- looked at (UNVERIFIED: no server or browser), its structure checked all the same; else 0, the page then
498
- what the next check tells its changes against.`,skill:`Usage: gallery skill install [--agent claude|codex] [--project] [--dir <path>]
499
- Writes the Gallery skill that matches this gallery command (what an Agent reads to write documents
500
- with it: SKILL.md, references/, sdk/) where the Agent reads skills:
501
- Claude Code ~/.claude/skills/gallery (CLAUDE_CONFIG_DIR/skills/gallery when that is set)
502
- Codex ~/.codex/skills/gallery (CODEX_HOME/skills/gallery when that is set)
503
- for each of them whose folder is there (neither: Claude Code's), or the one --agent names. --project
504
- writes it into this folder's .claude/skills/gallery (.codex/skills/gallery for Codex) instead, for
505
- this project alone; --dir <path> writes it into <path> itself, the skill's own folder, for any other agent.
506
- A Gallery skill there is replaced (nothing done when it holds the same files). An older Gallery's
507
- skill (the whole tools: package.json and src/, or reports/, its SKILL.md named gallery or
508
- html-report-studio), there or anywhere in that skills folder, has its documents copied into the
509
- workspace first, as gallery init --from copies them, and its exports into <workspace>/exports/ where
510
- the name is free; then it is moved to <workspace>/.gallery/old-skill-<date>/ (never deleted), so that
511
- the Agent sees one Gallery skill. Says what it did and where; then open a new Agent session.
512
- Exits 1, changing nothing, when a target holds something else or an older skill's preview server
513
- still runs (stop it first); 1 too when an older skill cannot be moved (its documents are copied).`};a.component=a.block;var i=a.block.split(`
514
- `).filter(e=>/^(?:Usage:)?\s*gallery block try /.test(e)).map((e,s)=>s===0?`Usage: ${e.trimStart()}`:e).join(`
515
- `),h=a.block.split(`
516
- `).filter(e=>/^(?:Usage:)?\s*gallery block pack /.test(e)).map((e,s)=>s===0?`Usage: ${e.trimStart()}`:e).join(`
517
- `),l=a.page.split(`
518
- `).filter(e=>/^(?:Usage:)?\s*gallery page try /.test(e)).map((e,s)=>s===0?`Usage: ${e.trimStart()}`:e).join(`
519
- `),d=`Usage: gallery <command> [options] [--workspace <dir>]
520
- Gallery: documents written as HTML, edited in the browser, exported as one offline file.
521
-
522
- gallery init [<dir>] [--from <old reports dir>] make a workspace (copy an older Gallery's documents)
523
- gallery new <slug> "<title>" ["<description>"] a new document; starts the server, opens the browser
524
- gallery import <file> [<slug> ["<title>"]] documents made of a file (Markdown, HTML, Word, PDF\u2026)
525
- gallery open [<slug>] [--no-browser] start or reuse the server and open the browser
526
- gallery serve [--port <n>] run the server in the foreground
527
- gallery stop stop the shared Gallery server
528
- gallery check [<slug>...] check documents (none named: all)
529
- gallery export <slug>... | --all write <workspace>/exports/<slug>.html
530
- gallery qa <slug>... [--blocks a,b] [--tiles] look at exports in Chrome or Edge
531
- gallery list [<words>...] | --tree [<slug>] the documents, those the words name, or the tree
532
- gallery list <words>... --all search the documents of every workspace of this machine
533
- gallery workspaces [--scan|--name|--forget] this machine's workspaces; register, name, forget one
534
- gallery move <slug> --under <slug> | --top move a document (and those under it) in the tree
535
- gallery set <slug> --title|--icon|--description change a document's title, icon or description
536
- gallery link add <url> "<name>" | set | remove a web link in the sidebar, shown beside it
537
- gallery extension list | check <id> the sidebar columns extensions provide, as shown
538
- gallery block new|add|list|show|check [<id>] make, add, list, read and check custom blocks
539
- gallery block try <slug> --press <selector> a reader's gestures on an instance, and what they wrote
540
- gallery page new|list|open [<slug>] make, list and open custom pages (boards of cards)
541
- gallery page add <slug> <block> [--x --y --w --h] [--set k=v] put a card of a block on a page, its id given
542
- gallery page try <slug> <card id> --press <sel> a reader's gestures on a card, and what they wrote
543
- gallery page check <slug> what is wrong with a page, what changed, its pictures
544
- gallery skill install [--agent claude|codex] write the Agent's skill for this version
545
- gallery help [<command>] this, or a command's whole usage
546
- gallery --version the version, then what is newer than it
547
-
548
- ${t}
549
- ${o}
550
- gallery --version prints the version first, then a line for each installed Gallery skill older than this
551
- gallery (\u6280\u80FD\uFF1A\u2026, with the gallery skill install that updates it) and one when npm has a newer Gallery
552
- (\u65B0\u7248\u672C\uFF1A\u2026), which a cache knows: checked in the background once a day, never waited for;
553
- GALLERY_NO_UPDATE_CHECK=1 (or CI, NO_UPDATE_NOTIFIER) turns that check off. No other command says them.
554
- Editing in the browser and gallery qa need Chrome or Edge. Node 22.13 or newer.`;export{n as a,r as b,a as c,i as d,h as e,l as f,d as g};
@@ -1,3 +0,0 @@
1
- import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
- import{a as q,b as B}from"./chunk-IA4PSIMD.mjs";import{b as C}from"./chunk-ZTHICSSF.mjs";import x from"node:fs/promises";import W from"node:path";import{MENTION as L}from"../browser/shared/components/mention.mjs";import{writeAtomic as R}from"../browser/shared/files.mjs";import{reportLines as U}from"../browser/shared/search.mjs";import{countWords as Q}from"../browser/shared/words.mjs";import{FACT_KINDS as V,QUERY_KINDS as Y,SNAPSHOT_LIMITS as y,queryOptions as G}from"../browser/shared/workspace-query.mjs";import{documentDirectory as M,documentFiles as T,layoutOf as X,listDocumentSlugs as _,listTrash as Z}from"../browser/shared/workspace.mjs";var ut=f=>c=>f.readTaken(c,{wait:0}),z=({todos:f})=>{let c=new Map,g=d=>JSON.stringify([d.text,d.path]);for(let d of f)c.set(g(d),(c.get(g(d))??0)+1);return f.some(d=>!d.block&&c.get(g(d))>1)},tt=(f,c)=>({hash:B(f),words:Q(c),todos:q(c)});function et(f){let c=new Date(f);return c.setHours(0,0,0,0),c.setDate(c.getDate()-(c.getDay()+6)%7),c.getTime()}function mt({root:f,read:c,draw:g=u=>u,activity:d=null,now:I=()=>new Date}){let u=new Map,m=new Map,b=t=>x.stat(t).then(({mtimeMs:e})=>e,()=>null);async function J(t,e=null){let o=T(M(t,f)),[a,n]=await Promise.all([b(o.html),b(o.json)]);if(a===null)return null;let s=e??await c(t);if(!s)return null;let r={};try{r=JSON.parse(await x.readFile(o.json,"utf8"))??{}}catch{}let{title:i,icon:h}=r,w={slug:t,title:typeof i=="string"&&i.trim()?i:t,icon:typeof h=="string"&&h?h:null,edited:Math.round(a),...tt(s.source,s.text)};return u.set(t,{html:a,json:n,facts:w,held:s.held===!0}),m.has(t)||m.set(t,w),w}async function O(t){let e=u.get(t);if(e&&!e.held){let o=T(M(t,f)),[a,n]=await Promise.all([b(o.html),b(o.json)]);if(a===e.html&&n===e.json)return e.facts}return J(t)}async function S(){let t=await _(f);for(let e of u.keys())t.includes(e)||u.delete(e);for(let e of m.keys())t.includes(e)||m.delete(e);return(await Promise.all(t.map(e=>O(e).catch(()=>null)))).filter(Boolean)}let P={async todos({done:t,slugs:e,limit:o}){let a=(await S()).filter(s=>!e||e.includes(s.slug)).sort((s,r)=>r.edited-s.edited||s.slug.localeCompare(r.slug)),n=[];for(let{slug:s,title:r,icon:i,todos:h,hash:w}of a)for(let l of h)if(!(t!==void 0&&l.done!==t)){if(n.length>=o)return n;n.push({ref:{slug:s,block:l.block,text:l.text,path:l.path,nth:l.nth,version:w},text:l.text,done:l.done,slug:s,title:r,icon:i,path:l.path})}return n},async recent({limit:t}){return(await S()).sort((e,o)=>o.edited-e.edited||e.slug.localeCompare(o.slug)).slice(0,t).map(({slug:e,title:o,icon:a,edited:n})=>({slug:e,title:o,icon:a,edited:new Date(n).toISOString()}))},async stats(){let t=await S(),e=et(I()),o=t.flatMap(a=>a.todos);return{documents:t.length,todos:{done:o.filter(a=>a.done).length,total:o.length},words:t.reduce((a,n)=>a+n.words,0),editedThisWeek:t.filter(a=>a.edited>=e).length}},async activity({days:t}){return d?(await d.load(),await $,d.days(t)):[]},async table({slug:t,key:e,where:o,limit:a},{words:n=!1}={}){let s=await O(t).catch(()=>null),r=u.get(t);if(!s||!r)return k(404,"missing",`no document "${t}"`);if(r.tables??=new Map,!r.tables.has(e)){let l=await c(t);if(!l)return k(404,"missing",`no document "${t}"`);r.tables.set(e,C(l.text,e,t))}let i=r.tables.get(e);if(i.error==="missing")return k(404,"missing",`"${t}" holds no table whose frame carries data-doc-chart-source="${e}"`);if(i.error)return k(422,"missing",`the table "${e}" of "${t}" has merged cells, which no view reads: write each value in its own cell`);let h=Object.keys(o).filter(l=>!i.columns.includes(l));if(h.length>0)return k(400,"options",`table: the table "${e}" of "${t}" has no column ${h.map(l=>JSON.stringify(l)).join(", ")} (its columns: ${i.columns.map(l=>JSON.stringify(l)).join(", ")})`);let w=i.rows.filter(l=>Object.entries(o).every(([D,v])=>l.words[D]===v.replace(/\s+/g," ").trim()));return{columns:[...i.columns],rows:w.slice(0,a).map(({values:l,links:D,words:v})=>({values:{...l},links:D.map(K=>({...K})),...n?{words:{...v}}:{}})),total:w.length}}},k=(t,e,o)=>{throw Object.assign(new Error(o),{refusal:[t,{ok:!1,reason:e,message:o}]})},p=new Map,j=t=>W.join(X(f).gallery,"cache","workspace",`${t}.json`),A=async t=>{if(!p.has(t)){let e=[];try{let o=JSON.parse(await x.readFile(j(t),"utf8"));Array.isArray(o?.tables)&&(e=o.tables.filter(a=>typeof a=="string").slice(-y.tables))}catch{}p.has(t)||p.set(t,e)}return p.get(t)},N=Promise.resolve(),H=async(t,e)=>{let o=await A(t);if(o.at(-1)===e)return;let a=[...o.filter(n=>n!==e),e].slice(-y.tables);p.set(t,a),N=N.then(async()=>{await x.mkdir(W.dirname(j(t)),{recursive:!0}),await R(j(t),`${JSON.stringify({tables:p.get(t)})}
3
- `)}).catch(()=>{})},F=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,$=Promise.resolve(),E={facts:O,all:S,async lines(t,e){let o=u.get(t);if(!await O(t))return null;let n=u.get(t);if(n!==o||!n.lines||n.lines.titles!==null&&n.lines.titles!==e){let s=await c(t);if(!s)return null;n.lines={titles:s.text.includes(L)?e:null,value:U(g(s.text,t))}}return n.lines.value},async query(t,e,{doc:o=null}={}){if(!Y.includes(t))return[400,{ok:!1,reason:"kind",message:`no kind "${t}": todos, recent, stats, activity or table`}];let{problem:a,options:n}=G(t,e);if(a)return[400,{ok:!1,reason:"options",message:`${t}: ${a}`}];let s;try{s=await P[t](n)}catch(r){if(r.refusal)return r.refusal;throw r}return t==="table"&&typeof o=="string"&&F.test(o)&&await H(o,`${n.slug}#${n.key}`),[200,{ok:!0,kind:t,data:s,at:new Date(I()).toISOString()}]},async snapshot(t){let e=async(n,s)=>{let[r,i]=await E.query(n,s);return r===200?i.data:null},o={todos:await e("todos",{limit:y.todos}),recent:await e("recent",{limit:y.recent}),stats:await e("stats"),activity:await e("activity",{days:y.activity})},a={};for(let n of F.test(t)?await A(t):[]){let[s,r]=n.split("#"),i=await P.table({slug:s,key:r,where:{},limit:y.rows},{words:!0}).catch(()=>null);i&&(a[n]=i)}return Object.keys(a).length>0&&(o.tables=a),Object.fromEntries(Object.entries(o).filter(([,n])=>n!==null))},stored:()=>N,async changed(t,{source:e=null,text:o=null,by:a="agent"}={}){let n=m.get(t)??u.get(t)?.facts??null;u.delete(t);let s=e===null?null:await J(t,{source:e,text:o??e}).catch(()=>null);s?m.set(t,s):m.delete(t);let r=new Set;if(!!n!=!!s)for(let i of["todos","recent","stats","table"])r.add(i);return n&&s&&n.hash!==s.hash&&r.add("table"),n&&s&&n.hash!==s.hash&&(z(n)||z(s))&&r.add("todos"),n&&s&&((n.title!==s.title||JSON.stringify(n.todos)!==JSON.stringify(s.todos))&&r.add("todos"),(n.title!==s.title||n.icon!==s.icon||n.edited!==s.edited)&&r.add("recent"),(n.words!==s.words||n.todos.length!==s.todos.length||n.todos.filter(i=>i.done).length!==s.todos.filter(i=>i.done).length||n.edited!==s.edited)&&r.add("stats")),!n&&s&&r.add("recent"),d&&s&&(await d.load(),await $,d.record(t,{hash:s.hash,words:s.words,mtime:s.edited,by:a})&&r.add("activity")),V.filter(i=>r.has(i))},start(){return d?($=(async()=>{await d.load();let t=await _(f),e=(await Promise.all(t.map(async a=>({slug:a,mtime:await b(T(M(a,f)).html)})))).filter(({mtime:a})=>a!==null),o=(await Z(f).catch(()=>[])).map(a=>a.slug);return d.catchUp(e.map(({slug:a,mtime:n})=>({slug:a,mtime:Math.round(n)})),O,{kept:o})})().catch(()=>0),$):Promise.resolve(0)},forget(t){u.delete(t),m.delete(t)}};return E}export{ut as a,mt as b};