spell 0.8.7 → 0.8.8

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 (243) hide show
  1. package/README-epics.md +96 -36
  2. package/app/package.json +25 -1
  3. package/dist/cli/publish/PublishedPackage.d.ts +2 -1
  4. package/dist/cli/publish/PublishedPackage.js +6 -3
  5. package/dist/cli/publish/ScratchInstall.d.ts +14 -3
  6. package/dist/cli/publish/ScratchInstall.js +69 -8
  7. package/dist/epic/cli/EpicProgram.js +7 -1
  8. package/dist/epic/cli/epicGroups.js +2 -1
  9. package/dist/epic/command/BaseBranch.d.ts +35 -0
  10. package/dist/epic/command/BaseBranch.js +58 -0
  11. package/dist/epic/command/EpicCheckout.d.ts +1 -1
  12. package/dist/epic/command/EpicCheckout.js +4 -4
  13. package/dist/epic/command/EpicGuide.js +3 -2
  14. package/dist/epic/command/EpicTools.d.ts +5 -0
  15. package/dist/epic/command/EpicTools.js +14 -3
  16. package/dist/epic/command/MainMerge.d.ts +26 -15
  17. package/dist/epic/command/MainMerge.js +60 -16
  18. package/dist/epic/command/RepoInit.d.ts +116 -8
  19. package/dist/epic/command/RepoInit.js +308 -13
  20. package/dist/epic/command/Requests.d.ts +1 -0
  21. package/dist/epic/command/Requests.js +6 -1
  22. package/dist/epic/command/SessionMoves.js +2 -1
  23. package/dist/epic/command/SkillsCheck.js +3 -2
  24. package/dist/epic/command/Stock.js +3 -1
  25. package/dist/epic/command/TurnEnd.d.ts +1 -1
  26. package/dist/epic/command/TurnEnd.js +4 -3
  27. package/dist/epic/command/Worktrees.d.ts +18 -3
  28. package/dist/epic/command/Worktrees.js +38 -7
  29. package/dist/epic/command/command.types.d.ts +3 -0
  30. package/dist/epic/components/__pack/epics.entry.js +43 -43
  31. package/dist/epic/components/__pack/epics.pack.js +36 -12794
  32. package/dist/epic/config/EngineFiles.mjs +60 -0
  33. package/dist/epic/config/EpicConfig.d.ts +12 -2
  34. package/dist/epic/config/EpicConfig.js +9 -1
  35. package/dist/epic/config/GitHub.d.ts +41 -1
  36. package/dist/epic/config/GitHub.js +75 -3
  37. package/dist/epic/config/LayeredSettings.js +3 -2
  38. package/dist/epic/server/EpicServer.d.ts +1 -1
  39. package/dist/epic/server/EpicServer.js +26 -12
  40. package/dist/epic/tool/InboxPoller.mjs +2 -1
  41. package/dist/epic/tool/MigrateCommands.js +6 -8
  42. package/dist/epic/tool/PlanDocFiles.js +3 -2
  43. package/dist/epic/tool/ServedFolders.d.ts +1 -1
  44. package/dist/epic/tool/ServedFolders.js +4 -4
  45. package/dist/epic/tools/PageInboxes.js +3 -3
  46. package/dist/epic/tools/_assets/commands.entry.js +149 -68
  47. package/dist/epic/tools/_assets/commands.js +20 -2073
  48. package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
  49. package/dist/epic/tools/_assets/core-reference.js +20 -2142
  50. package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
  51. package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
  52. package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
  53. package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
  54. package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
  55. package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
  56. package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
  57. package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
  58. package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
  59. package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
  60. package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
  61. package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
  62. package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
  63. package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
  64. package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
  65. package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
  66. package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
  67. package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
  68. package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
  69. package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
  70. package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
  71. package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
  72. package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
  73. package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
  74. package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
  75. package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
  76. package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
  77. package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
  78. package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
  79. package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
  80. package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
  81. package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
  82. package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
  83. package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
  84. package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
  85. package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
  86. package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
  87. package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
  88. package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
  89. package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
  90. package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
  91. package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
  92. package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
  93. package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
  94. package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
  95. package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
  96. package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
  97. package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
  98. package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
  99. package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
  100. package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
  101. package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
  102. package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
  103. package/dist/epic/tools/_assets/goals-live.js +318 -210
  104. package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
  105. package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
  106. package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
  107. package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
  108. package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
  109. package/dist/epic/tools/_assets/spell-comments.js +24 -3716
  110. package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
  111. package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
  112. package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
  113. package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
  114. package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
  115. package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
  116. package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
  117. package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
  118. package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
  119. package/dist/epic/tools/pages.d.ts +5 -6
  120. package/dist/epic/tools/pages.js +7 -6
  121. package/dist/epic/window.mjs +2 -3
  122. package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
  123. package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
  124. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
  125. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
  126. package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
  127. package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
  128. package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
  129. package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
  130. package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
  131. package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
  132. package/dist/ui/components/ui-card/UICards.d.ts +31 -0
  133. package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
  134. package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
  135. package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
  136. package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
  137. package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
  138. package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
  139. package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
  140. package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
  141. package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
  142. package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
  143. package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
  144. package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
  145. package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
  146. package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
  147. package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
  148. package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
  149. package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
  150. package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
  151. package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
  152. package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
  153. package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
  154. package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
  155. package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
  156. package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
  157. package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
  158. package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
  159. package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
  160. package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
  161. package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
  162. package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
  163. package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
  164. package/dist/ui/components/ui-list/UIList.d.ts +2 -0
  165. package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
  166. package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
  167. package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
  168. package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
  169. package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
  170. package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
  171. package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
  172. package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
  173. package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
  174. package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
  175. package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
  176. package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
  177. package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
  178. package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
  179. package/dist/ui/components/ui-parts/UIHeader.d.ts +3 -1
  180. package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
  181. package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
  182. package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
  183. package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
  184. package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
  185. package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
  186. package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
  187. package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
  188. package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
  189. package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
  190. package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
  191. package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
  192. package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
  193. package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
  194. package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
  195. package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
  196. package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
  197. package/dist/ui/components/ui-section/UISections.d.ts +1 -0
  198. package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
  199. package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
  200. package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
  201. package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
  202. package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
  203. package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
  204. package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
  205. package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
  206. package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
  207. package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
  208. package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
  209. package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
  210. package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
  211. package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
  212. package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
  213. package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
  214. package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
  215. package/dist/ui/components/ui-table/UICell.d.ts +1 -0
  216. package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
  217. package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
  218. package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
  219. package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
  220. package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
  221. package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
  222. package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
  223. package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
  224. package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
  225. package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
  226. package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
  227. package/dist/util/spell/constants.js +1 -1
  228. package/epic/.claude-plugin/plugin.json +1 -1
  229. package/epic/.codex-plugin/plugin.json +1 -1
  230. package/epic/hooks/handoff.mjs +4 -3
  231. package/epic/hooks/worktree.mjs +22 -3
  232. package/epic/package.json +41 -2
  233. package/epic/skills/details/SKILL.md +2 -1
  234. package/epic/skills/epic/SKILL.md +7 -1
  235. package/epic/skills/epic/guide.md +4 -0
  236. package/epic/skills/isolate/SKILL.md +35 -0
  237. package/epic/src/AGENTS.md +6 -2
  238. package/epic/templates/durable.html +1 -1
  239. package/epic/vscode/package.json +1 -1
  240. package/epic/vscode/spell-epic.vsix +0 -0
  241. package/package.json +1 -1
  242. package/parser/package.json +1 -1
  243. package/ui/package.json +15 -2
@@ -1,23 +1,64 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/tools/_assets/commands.entry.js
5
- import { slug } from "spell/util/string";
6
- import { parseJSON5 } from "spell/util/spell/json";
7
- import { ServerLink } from "../../review/index.js";
8
- import { drawThenBoot, el, sectionNumber, withCode } from "./spell-doc-helpers.js";
9
- var MARKS = {
1
+ /*
2
+ * Entry of `commands.js`: command reference pages (`templates/commands.html`, e.g. `dev/commands/commands.html`): draws the page's tables
3
+ * from the JSON beside it, then boots the docs bundle.
4
+ * - Loaded INSTEAD of `spell-ui.js`: it fetches, draws, then adds `spell-ui.js` (same folder), whatever happened
5
+ * (`drawThenBoot()`).
6
+ * - The data: `<page>.json5` (`body[data-commands]` overrides), read through the page's `ServerLink` (`getFile()`),
7
+ * so the page needs the PAGE SERVER (`epic pages open <page>`); from `file://` a notice where the tables go says so
8
+ * (`drawThenBoot()`).
9
+ * - JSON5, read by the kit's `parseJSON5()`; its old name, `<page>.json`, read when there's no `.json5` yet
10
+ * (`ServerLink.dataFileNames()`)
11
+ * - JSON: `{ families: [{ id, title, icon?, intro?, rows: [Row] }] }` (a family `id` shares the page's id space: never
12
+ * reuse a hand-written section's); `Row`:
13
+ * - `op` -- the operation, in words; `id?` -- anchor, default `<family id>-<slug of op>`
14
+ * - `cli`, `skill`, `yarn` -- `{ mark, names?, note? }`: `mark` one of `same` (✓, under the shared name),
15
+ * `other` (≈, another name), `could` (○, doesn't but could), `no` (—, couldn't really); `names` the commands:
16
+ * `spell compile`, `/epic`, `<package> <script>` (`root plan-doc`, `ui gen:icons`)
17
+ * - `runs` -- the tool doing the work (`src/window.mjs`, `status.py`, `prose`); `target`, `notes` -- text
18
+ * - in `target`, a roadmap id in parens, `(R3)`, links to `#r3`: the page's roadmap rows carry those ids
19
+ * - text fields: `` `code` `` becomes `<code>`; everything else is plain text, never markup
20
+ * - `sources` (top level, optional): what `spell commands` counts: `userSkills` (in `~/.claude/skills`),
21
+ * `ignore` (commands that need no row); ignored here
22
+ * - Built from elements (`el()`), never from markup in strings (epic `epic-engine` P3): Spell UI's own, as a page
23
+ * writes them (`<ui-section>`, `<ui-table>` round a real `<table>`, `<ui-statistic>`, `<ui-message>`), in the
24
+ * page's light DOM, so the runtime's contents, sticky titles, table widths and comment anchors take them as
25
+ * hand-written ones
26
+ * - Placeholders the template holds, all optional:
27
+ * - `[data-commands-families]`: REPLACED by one nested `<ui-section data-commands-family>` per family, numbered
28
+ * after its parent section
29
+ * - the sections take its place, so they're its section's children, as a page writes nested sections: inside the
30
+ * placeholder's box they took the reading column's indent twice (epic `epic-engine` P3, I31)
31
+ * - `[data-commands-stats]` (a `ui-statistics`)
32
+ * - `[data-commands-filter]` (a `ui-input`): hides rows without every typed word
33
+ * - BUNDLED (epic `coherence` C12): `node src/tools/bundle-spell-ui.js --data-pages` builds it into `commands.js`, a
34
+ * classic script with NO Spell UI in it (the page's `spell-ui.js` draws the `<ui-*>` markup); edit THIS, never
35
+ * the bundle. It imports the helpers that exist: the docs helpers' `el()` and start, the kit's `slug()` and
36
+ * `parseJSON5()`, `ServerLink`.
37
+ */
38
+ import { slug } from "spell/util/string"
39
+ import { parseJSON5 } from "spell/util/spell/json"
40
+ import { ServerLink } from "spell/epic/review"
41
+
42
+ import { drawThenBoot, el, sectionNumber, withCode } from "./spell-doc-helpers.js"
43
+
44
+ /** Cell marks: the sign shown, the table cell's verdict class, the legend's words. */
45
+ const MARKS = {
10
46
  same: { sign: "✓", cls: "yes positive", words: "does it, shared name" },
11
47
  other: { sign: "≈", cls: "meh warning", words: "does it, other name" },
12
48
  could: { sign: "○", cls: "", words: "doesn't, but could" },
13
49
  no: { sign: "—", cls: "no negative", words: "couldn't really" }
14
- };
15
- var SURFACES = [
50
+ }
51
+ /** Surface columns, in order: JSON key, header. */
52
+ const SURFACES = [
16
53
  ["cli", "CLI"],
17
54
  ["skill", "skill"],
18
55
  ["yarn", "yarn"]
19
- ];
20
- var DATA_FILE = document.body.dataset.commands || location.pathname.replace(/[^/]*$/, (name) => name.replace(/\.html?$/, ".json5"));
56
+ ]
57
+
58
+ /** The page's data: `<page>.json5` beside it, unless `<body data-commands>` names another. */
59
+ const DATA_FILE =
60
+ document.body.dataset.commands || location.pathname.replace(/[^/]*$/, (name) => name.replace(/\.html?$/, ".json5"))
61
+
21
62
  void drawThenBoot({
22
63
  load,
23
64
  draw,
@@ -25,29 +66,42 @@ void drawThenBoot({
25
66
  header: "Tables not drawn",
26
67
  offServer: `This page draws its tables from ${DATA_FILE.split("/").pop()}`,
27
68
  failure: "Couldn't draw the tables"
28
- });
69
+ })
70
+
71
+ ////////////////
72
+ // ## Start
73
+ ////////////////
74
+
75
+ /** The page's data; throws when there's none. */
29
76
  async function load() {
30
- const text = await ServerLink.forPage().getFile(ServerLink.dataFileNames(DATA_FILE), { format: "text" });
31
- if (text === void 0) throw new Error(`${DATA_FILE}: not found`);
32
- return parseJSON5(text, DATA_FILE);
77
+ // not renamed yet (`epic migrate`): its old name
78
+ const text = await ServerLink.forPage().getFile(ServerLink.dataFileNames(DATA_FILE), { format: "text" })
79
+ if (text === undefined) throw new Error(`${DATA_FILE}: not found`)
80
+ return parseJSON5(text, DATA_FILE)
33
81
  }
34
- __name(load, "load");
82
+
83
+ ////////////////
84
+ // ## Drawing
85
+ ////////////////
86
+
87
+ /** Fill every placeholder from `data`. */
35
88
  function draw(data) {
36
- const families = data.families ?? [];
37
- const holder = document.querySelector("[data-commands-families]");
89
+ const families = data.families ?? []
90
+ const holder = document.querySelector("[data-commands-families]")
38
91
  if (holder) {
39
- const number = sectionNumber(holder.closest("ui-section"));
40
- holder.replaceWith(...families.map((each, i) => family(each, number ? `${number}.${i + 1} ` : "")));
92
+ const number = sectionNumber(holder.closest("ui-section"))
93
+ holder.replaceWith(...families.map((each, i) => family(each, number ? `${number}.${i + 1} ` : "")))
41
94
  }
42
- const stats = document.querySelector("[data-commands-stats]");
43
- if (stats) stats.replaceChildren(...statistics(families));
44
- const filter = document.querySelector("[data-commands-filter]");
45
- if (filter) wireFilter(filter);
95
+ const stats = document.querySelector("[data-commands-stats]")
96
+ if (stats) stats.replaceChildren(...statistics(families))
97
+ const filter = document.querySelector("[data-commands-filter]")
98
+ if (filter) wireFilter(filter)
46
99
  }
47
- __name(draw, "draw");
100
+
101
+ /** One family: a nested `<ui-section>` with its table. */
48
102
  function family(each, prefix) {
49
- const head = el("tr", {}, el("th", {}, "operation"), ...SURFACES.map(([, label]) => el("th", {}, label)));
50
- head.append(el("th", {}, "runs"), el("th", {}, "target"));
103
+ const head = el("tr", {}, el("th", {}, "operation"), ...SURFACES.map(([, label]) => el("th", {}, label)))
104
+ head.append(el("th", {}, "runs"), el("th", {}, "target"))
51
105
  return el(
52
106
  "ui-section",
53
107
  {
@@ -65,9 +119,10 @@ function family(each, prefix) {
65
119
  { celled: "", padding: "compact", appearance: "striped", unstackable: "" },
66
120
  el("table", {}, el("thead", {}, head), el("tbody", {}, ...(each.rows ?? []).map((row) => operation(each, row))))
67
121
  )
68
- );
122
+ )
69
123
  }
70
- __name(family, "family");
124
+
125
+ /** One operation's row; its notes go under the operation. */
71
126
  function operation(each, row) {
72
127
  return el(
73
128
  "tr",
@@ -76,73 +131,99 @@ function operation(each, row) {
76
131
  ...SURFACES.map(([key]) => surface(row[key])),
77
132
  el("td", {}, ...withCode(row.runs ?? "")),
78
133
  el("td", {}, ...withCode(row.target ?? "", roadmapLinks))
79
- );
134
+ )
80
135
  }
81
- __name(operation, "operation");
136
+
137
+ /** One surface's cell: its mark, the names, the note. */
82
138
  function surface(cell) {
83
- if (!cell) return el("td");
84
- const mark = MARKS[cell.mark] ?? { sign: "?", cls: "", words: "" };
85
- const verdict = mark.cls ? { class: mark.cls, title: mark.words } : { title: mark.words };
86
- return el("td", verdict, `${mark.sign} `, ...names(cell.names), cell.note ? notes(cell.note) : "");
139
+ if (!cell) return el("td")
140
+ const mark = MARKS[cell.mark] ?? { sign: "?", cls: "", words: "" }
141
+ const verdict = mark.cls ? { class: mark.cls, title: mark.words } : { title: mark.words }
142
+ return el("td", verdict, `${mark.sign} `, ...names(cell.names), cell.note ? notes(cell.note) : "")
87
143
  }
88
- __name(surface, "surface");
144
+
145
+ /** A note under a cell's text, small and grey. */
89
146
  function notes(value) {
90
- return el("div", { class: "commands-notes" }, ...withCode(value));
147
+ return el("div", { class: "commands-notes" }, ...withCode(value))
91
148
  }
92
- __name(notes, "notes");
149
+
150
+ /**
151
+ * Names as code, comma-separated, yarn's grouped by script: `ts` (app, cli, core) rather than 3 `<package> ts`s.
152
+ * - a name of two words whose second has no space and isn't a CLI's (`spell ...`) is `<package> <script>`
153
+ */
93
154
  function names(value) {
94
- if (!value) return [];
95
- const list = Array.isArray(value) ? value : [value];
96
- const byScript = /* @__PURE__ */ new Map();
97
- const plain = [];
155
+ if (!value) return []
156
+ const list = Array.isArray(value) ? value : [value]
157
+ const byScript = new Map()
158
+ const plain = []
98
159
  for (const name of list) {
99
- const words = name.split(" ");
160
+ const words = name.split(" ")
100
161
  if (words.length === 2 && words[0] !== "spell" && !name.startsWith("/")) {
101
- if (!byScript.has(words[1])) byScript.set(words[1], []);
102
- byScript.get(words[1]).push(words[0]);
103
- } else plain.push([el("code", {}, name)]);
162
+ if (!byScript.has(words[1])) byScript.set(words[1], [])
163
+ byScript.get(words[1]).push(words[0])
164
+ } else plain.push([el("code", {}, name)])
104
165
  }
105
166
  const grouped = [...byScript].map(([name, packages]) => [
106
167
  el("code", {}, name),
107
168
  " ",
108
169
  el("span", { class: "commands-where" }, `(${packages.join(", ")})`)
109
- ]);
110
- return [...plain, ...grouped].flatMap((parts, i) => i ? [", ", ...parts] : parts);
170
+ ])
171
+ return [...plain, ...grouped].flatMap((parts, i) => (i ? [", ", ...parts] : parts))
111
172
  }
112
- __name(names, "names");
173
+
174
+ /** Headline numbers: operations, families, and how many each surface does. */
113
175
  function statistics(families) {
114
- const rows = families.flatMap((each) => each.rows ?? []);
176
+ const rows = families.flatMap((each) => each.rows ?? [])
115
177
  return [
116
178
  [rows.length, "operations"],
117
179
  [does("cli"), "in the CLI"],
118
180
  [does("skill"), "in a skill"],
119
181
  [does("yarn"), "in yarn"]
120
- ].map(([value, label]) => el("ui-statistic", { value, label }));
182
+ ].map(([value, label]) => el("ui-statistic", { value, label }))
183
+
184
+ /** How many rows surface `key` does, under either name. */
121
185
  function does(key) {
122
- return rows.filter((row) => ["same", "other"].includes(row[key]?.mark)).length;
186
+ return rows.filter((row) => ["same", "other"].includes(row[key]?.mark)).length
123
187
  }
124
- __name(does, "does");
125
188
  }
126
- __name(statistics, "statistics");
189
+
190
+ ////////////////
191
+ // ## Filter
192
+ ////////////////
193
+
194
+ /**
195
+ * Hide the rows without every typed word, and the families left empty.
196
+ * - reads the value from the events' `detail`: during `ui-input` the element's `value` is still the old one
197
+ */
127
198
  function wireFilter(input) {
128
- input.addEventListener("ui-typed", apply);
129
- input.addEventListener("ui-changed", apply);
199
+ input.addEventListener("ui-typed", apply)
200
+ input.addEventListener("ui-changed", apply)
201
+
202
+ /** Apply the filter in `event`. */
130
203
  function apply(event) {
131
- const words = String(event.detail?.value ?? input.value ?? "").toLowerCase().split(/\s+/).filter(Boolean);
204
+ const words = String(event.detail?.value ?? input.value ?? "")
205
+ .toLowerCase()
206
+ .split(/\s+/)
207
+ .filter(Boolean)
132
208
  for (const section of document.querySelectorAll("ui-section[data-commands-family]")) {
133
- let shown = 0;
209
+ let shown = 0
134
210
  for (const row of section.querySelectorAll("tbody tr")) {
135
- const content = row.textContent.toLowerCase();
136
- row.hidden = !words.every((word) => content.includes(word));
137
- if (!row.hidden) shown++;
211
+ const content = row.textContent.toLowerCase()
212
+ row.hidden = !words.every((word) => content.includes(word))
213
+ if (!row.hidden) shown++
138
214
  }
139
- section.hidden = shown === 0;
215
+ section.hidden = shown === 0
140
216
  }
141
217
  }
142
- __name(apply, "apply");
143
218
  }
144
- __name(wireFilter, "wireFilter");
219
+
220
+ ////////////////
221
+ // ## Text
222
+ ////////////////
223
+
224
+ /** `part` with each roadmap id in parens, `(R3)`, linked to its row, `#r3`. */
145
225
  function roadmapLinks(part) {
146
- return part.split(/\((R\d+)\)/).flatMap((piece, i) => i % 2 ? ["(", el("a", { href: `#${piece.toLowerCase()}` }, piece), ")"] : [piece]);
226
+ return part
227
+ .split(/\((R\d+)\)/)
228
+ .flatMap((piece, i) => (i % 2 ? ["(", el("a", { href: `#${piece.toLowerCase()}` }, piece), ")"] : [piece]))
147
229
  }
148
- __name(roadmapLinks, "roadmapLinks");