spell 0.8.7 → 0.8.9

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 (304) hide show
  1. package/README-epics.md +149 -49
  2. package/app/package.json +25 -1
  3. package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
  4. package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
  5. package/dist/app/app/pages/SiteBoardView.css +5 -5
  6. package/dist/app/app/pages/SiteBoardView.js +1 -1
  7. package/dist/app/app/pages/SiteEditorPage.js +6 -3
  8. package/dist/app/app/pages/SiteEdits.js +27 -10
  9. package/dist/app/app/pages/SiteWrites.js +11 -0
  10. package/dist/app/app/runner/spellRuntime.js +1 -0
  11. package/dist/cli/publish/PublishedPackage.d.ts +2 -1
  12. package/dist/cli/publish/PublishedPackage.js +6 -3
  13. package/dist/cli/publish/ScratchInstall.d.ts +14 -3
  14. package/dist/cli/publish/ScratchInstall.js +69 -8
  15. package/dist/epic/cli/EpicProgram.js +20 -5
  16. package/dist/epic/cli/epicGroups.js +7 -1
  17. package/dist/epic/command/BaseBranch.d.ts +35 -0
  18. package/dist/epic/command/BaseBranch.js +58 -0
  19. package/dist/epic/command/EpicCheckout.d.ts +1 -1
  20. package/dist/epic/command/EpicCheckout.js +4 -4
  21. package/dist/epic/command/EpicGuide.js +3 -2
  22. package/dist/epic/command/EpicTools.d.ts +5 -0
  23. package/dist/epic/command/EpicTools.js +14 -3
  24. package/dist/epic/command/MainMerge.d.ts +26 -15
  25. package/dist/epic/command/MainMerge.js +60 -16
  26. package/dist/epic/command/PullRequest.d.ts +45 -0
  27. package/dist/epic/command/PullRequest.js +100 -0
  28. package/dist/epic/command/RepoInit.d.ts +196 -39
  29. package/dist/epic/command/RepoInit.js +481 -60
  30. package/dist/epic/command/Requests.d.ts +1 -0
  31. package/dist/epic/command/Requests.js +7 -1
  32. package/dist/epic/command/SessionMoves.js +2 -1
  33. package/dist/epic/command/SkillsCheck.js +3 -2
  34. package/dist/epic/command/Stock.js +3 -1
  35. package/dist/epic/command/TurnEnd.d.ts +1 -1
  36. package/dist/epic/command/TurnEnd.js +4 -3
  37. package/dist/epic/command/Worktrees.d.ts +20 -3
  38. package/dist/epic/command/Worktrees.js +39 -7
  39. package/dist/epic/command/command.types.d.ts +3 -0
  40. package/dist/epic/components/__pack/epics.entry.js +43 -43
  41. package/dist/epic/components/__pack/epics.pack.js +36 -12794
  42. package/dist/epic/config/CodeHost.d.ts +96 -0
  43. package/dist/epic/config/CodeHost.js +89 -0
  44. package/dist/epic/config/EngineFiles.mjs +60 -0
  45. package/dist/epic/config/EpicConfig.d.ts +20 -3
  46. package/dist/epic/config/EpicConfig.js +25 -1
  47. package/dist/epic/config/EpicRepo.js +1 -1
  48. package/dist/epic/config/GitHub.d.ts +75 -3
  49. package/dist/epic/config/GitHub.js +106 -5
  50. package/dist/epic/config/GitLab.d.ts +138 -0
  51. package/dist/epic/config/GitLab.js +297 -0
  52. package/dist/epic/config/LayeredSettings.js +3 -2
  53. package/dist/epic/server/EpicServer.d.ts +1 -1
  54. package/dist/epic/server/EpicServer.js +26 -12
  55. package/dist/epic/tool/InboxPoller.mjs +2 -1
  56. package/dist/epic/tool/MigrateCommands.js +6 -8
  57. package/dist/epic/tool/PlanCommits.d.ts +7 -4
  58. package/dist/epic/tool/PlanCommits.js +7 -5
  59. package/dist/epic/tool/PlanDocCommands.js +3 -4
  60. package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
  61. package/dist/epic/tool/PlanDocFiles.js +13 -5
  62. package/dist/epic/tool/ServedFolders.d.ts +1 -1
  63. package/dist/epic/tool/ServedFolders.js +4 -4
  64. package/dist/epic/tools/PageInboxes.js +3 -3
  65. package/dist/epic/tools/_assets/commands.entry.js +149 -68
  66. package/dist/epic/tools/_assets/commands.js +20 -2073
  67. package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
  68. package/dist/epic/tools/_assets/core-reference.js +20 -2142
  69. package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
  70. package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
  71. package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
  72. package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
  73. package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
  74. package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
  75. package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
  76. package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
  77. package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
  78. package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
  79. package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
  80. package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
  81. package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
  82. package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
  83. package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
  84. package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
  85. package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
  86. package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
  87. package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
  88. package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
  89. package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
  90. package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
  91. package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
  92. package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
  93. package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
  94. package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
  95. package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
  96. package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
  97. package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
  98. package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
  99. package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
  100. package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
  101. package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
  102. package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
  103. package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
  104. package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
  105. package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
  106. package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
  107. package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
  108. package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
  109. package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
  110. package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
  111. package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
  112. package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
  113. package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
  114. package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
  115. package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
  116. package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
  117. package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
  118. package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
  119. package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
  120. package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
  121. package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
  122. package/dist/epic/tools/_assets/goals-live.js +318 -210
  123. package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
  124. package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
  125. package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
  126. package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
  127. package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
  128. package/dist/epic/tools/_assets/spell-comments.js +24 -3716
  129. package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
  130. package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
  131. package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
  132. package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
  133. package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
  134. package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
  135. package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
  136. package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
  137. package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
  138. package/dist/epic/tools/pages.d.ts +5 -6
  139. package/dist/epic/tools/pages.js +7 -6
  140. package/dist/epic/window.mjs +2 -3
  141. package/dist/parser/core/classes/View.d.ts +20 -0
  142. package/dist/parser/core/classes/View.js +91 -17
  143. package/dist/parser/core/core.declarations.json5 +18 -0
  144. package/dist/parser/core/core.scopes.js +5 -0
  145. package/dist/parser/core/sites.d.ts +10 -0
  146. package/dist/parser/core/sites.js +12 -0
  147. package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
  148. package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
  149. package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
  150. package/dist/parser/parser/tokenizer/Tokens.js +4 -0
  151. package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
  152. package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
  153. package/dist/parser/py/core/spell_core/apps.py +2 -0
  154. package/dist/parser/spell/PARSING.md +21 -0
  155. package/dist/parser/spell/SpellParser.d.ts +2 -0
  156. package/dist/parser/spell/SpellParser.js +58 -3
  157. package/dist/parser/spell/SpellxTokenizer.js +2 -1
  158. package/dist/parser/spell/SpellxTwin.d.ts +4 -1
  159. package/dist/parser/spell/SpellxTwin.js +10 -3
  160. package/dist/parser/spell/builtinTypes.js +24 -1
  161. package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
  162. package/dist/parser/spell/languages/Language.d.ts +11 -2
  163. package/dist/parser/spell/languages/en/words.js +3 -2
  164. package/dist/parser/spell/languages/es/words.js +7 -4
  165. package/dist/parser/spell/rules/Statement.js +1 -1
  166. package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
  167. package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
  168. package/dist/parser/spell/rules/sites/SitePage.js +2 -2
  169. package/dist/parser/spell/rules/sites/sites.en.js +1 -1
  170. package/dist/parser/spell/rules/sites/sites.es.js +1 -1
  171. package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
  172. package/dist/parser/spell/spell.types.d.ts +7 -0
  173. package/dist/parser/spell/spellSyntax.es.json +6 -6
  174. package/dist/parser/spell/spellSyntax.json +6 -6
  175. package/dist/parser/spellx/SpellxView.js +2 -1
  176. package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
  177. package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
  178. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
  179. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
  180. package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
  181. package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
  182. package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
  183. package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
  184. package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
  185. package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
  186. package/dist/ui/components/ui-card/UICards.d.ts +31 -0
  187. package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
  188. package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
  189. package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
  190. package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
  191. package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
  192. package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
  193. package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
  194. package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
  195. package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
  196. package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
  197. package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
  198. package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
  199. package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
  200. package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
  201. package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
  202. package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
  203. package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
  204. package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
  205. package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
  206. package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
  207. package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
  208. package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
  209. package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
  210. package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
  211. package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
  212. package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
  213. package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
  214. package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
  215. package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
  216. package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
  217. package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
  218. package/dist/ui/components/ui-list/UIList.d.ts +2 -0
  219. package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
  220. package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
  221. package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
  222. package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
  223. package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
  224. package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
  225. package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
  226. package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
  227. package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
  228. package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
  229. package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
  230. package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
  231. package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
  232. package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
  233. package/dist/ui/components/ui-parts/UIHeader.d.ts +15 -3
  234. package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
  235. package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
  236. package/dist/ui/components/ui-parts/UIHeader.js +45 -5
  237. package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
  238. package/dist/ui/components/ui-parts/UIParts.css +18 -0
  239. package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
  240. package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
  241. package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
  242. package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
  243. package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
  244. package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
  245. package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
  246. package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
  247. package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
  248. package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
  249. package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
  250. package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
  251. package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
  252. package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
  253. package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
  254. package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
  255. package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
  256. package/dist/ui/components/ui-section/UISections.d.ts +1 -0
  257. package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
  258. package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
  259. package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
  260. package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
  261. package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
  262. package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
  263. package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
  264. package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
  265. package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
  266. package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
  267. package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
  268. package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
  269. package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
  270. package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
  271. package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
  272. package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
  273. package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
  274. package/dist/ui/components/ui-table/UICell.d.ts +1 -0
  275. package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
  276. package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
  277. package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
  278. package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
  279. package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
  280. package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
  281. package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
  282. package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
  283. package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
  284. package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
  285. package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
  286. package/dist/ui/jsx.d.ts +4 -4
  287. package/dist/ui/vocabulary/defaults.generated.js +1 -1
  288. package/dist/util/spell/constants.js +1 -1
  289. package/epic/.claude-plugin/plugin.json +1 -1
  290. package/epic/.codex-plugin/plugin.json +1 -1
  291. package/epic/hooks/handoff.mjs +4 -3
  292. package/epic/hooks/worktree.mjs +22 -3
  293. package/epic/package.json +41 -2
  294. package/epic/skills/details/SKILL.md +2 -1
  295. package/epic/skills/epic/SKILL.md +7 -1
  296. package/epic/skills/epic/guide.md +3 -0
  297. package/epic/skills/isolate/SKILL.md +53 -20
  298. package/epic/src/AGENTS.md +11 -2
  299. package/epic/templates/durable.html +1 -1
  300. package/epic/vscode/package.json +1 -1
  301. package/epic/vscode/spell-epic.vsix +0 -0
  302. package/package.json +1 -1
  303. package/parser/package.json +1 -1
  304. package/ui/package.json +15 -2
@@ -1,100 +1,142 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ /*
2
+ * Saving for the docs' source elements (`<ui-include>`, `<ui-code>`, `<ui-markdown>`): `UI.sources.saver`, through
3
+ * the page server's `SPELL_SERVER.saveFile()` (`spell/server`'s live client).
4
+ * Bundled into `spell-ui.js` by `scripts/bundle-spell-ui.js`; side effects only.
5
+ * - Only on a page the page server served (`window.SPELL_SERVER`): from `file://` there's no server, so no saver,
6
+ * and `save()` fails with `no-saver`.
7
+ * - `saveFile` is added by the live client (`/api/server/live.js`, deferred), so it's read when a save happens.
8
+ * - Failures are thrown as `{ kind, message, status }` (a classic script can't import `SourceError`): `conflict`
9
+ * for 409 (the file changed since it was loaded: reload, then save again), `save` otherwise.
10
+ * - And `UI.sources.inlineSaver`, on a page the page server may save (`SPELL_SERVER.writable`): an element's OWN
11
+ * text (a `<ui-markdown>` written in the page) written back into the page's file (epic `epic-engine` P60).
12
+ */
13
+
14
+ import { E, UI } from "spell/ui/core"
3
15
 
4
- // src/tools/_assets/spell-ui-sources.js
5
- import { E, UI } from "spell/ui/core";
6
16
  if (window.SPELL_SERVER) {
7
17
  void UI.load().then((ui) => {
8
- ui.sources.saver ??= saveThroughPageServer;
9
- if (window.SPELL_SERVER.writable) ui.sources.inlineSaver ??= saveInlineThroughPageServer;
10
- });
18
+ ui.sources.saver ??= saveThroughPageServer
19
+ if (window.SPELL_SERVER.writable) ui.sources.inlineSaver ??= saveInlineThroughPageServer
20
+ })
11
21
  }
22
+
23
+ /** `UI.sources.saver`: `{ url, text, etag, fragment }` to `SPELL_SERVER.saveFile()`, by URL path. */
12
24
  async function saveThroughPageServer({ url, text, etag, fragment }) {
13
- const saveFile = window.SPELL_SERVER?.saveFile;
14
- if (!saveFile) throw { kind: "no-saver", message: "the page server's live client isn't loaded" };
15
- const answer = await saveFile({ path: decodeURIComponent(new URL(url).pathname), text, etag, fragment });
16
- if (answer.ok) return { etag: answer.etag };
17
- const kind = answer.status === 409 || answer.status === 412 ? "conflict" : "save";
18
- throw { kind, message: answer.error ?? `the server said ${answer.status}`, status: answer.status };
25
+ const saveFile = window.SPELL_SERVER?.saveFile
26
+ if (!saveFile) throw { kind: "no-saver", message: "the page server's live client isn't loaded" }
27
+ const answer = await saveFile({ path: decodeURIComponent(new URL(url).pathname), text, etag, fragment })
28
+ if (answer.ok) return { etag: answer.etag }
29
+ const kind = answer.status === 409 || answer.status === 412 ? "conflict" : "save"
30
+ throw { kind, message: answer.error ?? `the server said ${answer.status}`, status: answer.status }
19
31
  }
20
- __name(saveThroughPageServer, "saveThroughPageServer");
32
+
33
+ /**
34
+ * `UI.sources.inlineSaver`: `element`'s own text, `before` as the page has it, swapped for `text` in the page's file.
35
+ * - The nearest element with an `id` around it is read fresh from the file (`SPELL_SERVER.readElement()`), its script
36
+ * holding `before` found (`InlineBlocks`), its text swapped, indented as it was, its tags untouched (r52's one-line
37
+ * tags hold), and the element written back (`editPage()`, `shown`: the page shows it already).
38
+ * - The page's own script then holds the saved text too, so the page and the file agree, and a later live update
39
+ * patches from there.
40
+ * - The file changed between the read and the write: read again, once.
41
+ * - throws `{ kind, message, status }`: `conflict` when `before` isn't in the file (it changed there), `save` when
42
+ * there's no element with an id the file has, `no-saver` without the live client
43
+ */
21
44
  async function saveInlineThroughPageServer({ element, before, text }) {
22
- const server = window.SPELL_SERVER;
45
+ const server = window.SPELL_SERVER
23
46
  if (!server?.readElement || !server.editPage)
24
- throw { kind: "no-saver", message: "the page server's live client isn't loaded" };
25
- const script = InlineBlocks.scriptOf(element);
26
- if (!script) throw { kind: "save", message: `<${element.localName}>'s text isn't in a script, so it can't be saved` };
47
+ throw { kind: "no-saver", message: "the page server's live client isn't loaded" }
48
+ const script = InlineBlocks.scriptOf(element)
49
+ if (!script) throw { kind: "save", message: `<${element.localName}>'s text isn't in a script, so it can't be saved` }
27
50
  for (let holder = element.parentElement?.closest("[id]"); holder; holder = holder.parentElement?.closest("[id]")) {
28
51
  for (let tries = 0; tries < 2; tries++) {
29
- const read = await server.readElement({ id: holder.id });
30
- if (read.status === 404) break;
31
- if (!read.ok) throw { kind: "save", message: read.error ?? `the server said ${read.status}`, status: read.status };
32
- const block = InlineBlocks.find(read.html, before, InlineBlocks.ordinalOf(element, holder));
33
- if (!block) throw { kind: "conflict", message: "this text changed in the file since the page showed it: reload" };
34
- const inner = InlineBlocks.reindented(block.inner, text);
35
- const html = read.html.slice(0, block.start) + inner + read.html.slice(block.end);
36
- const answer = await server.editPage({ id: holder.id, html, etag: read.etag, shown: true });
52
+ const read = await server.readElement({ id: holder.id })
53
+ // an id the runtime gave it, not the file's: the next one out
54
+ if (read.status === 404) break
55
+ if (!read.ok) throw { kind: "save", message: read.error ?? `the server said ${read.status}`, status: read.status }
56
+ const block = InlineBlocks.find(read.html, before, InlineBlocks.ordinalOf(element, holder))
57
+ if (!block) throw { kind: "conflict", message: "this text changed in the file since the page showed it: reload" }
58
+ const inner = InlineBlocks.reindented(block.inner, text)
59
+ const html = read.html.slice(0, block.start) + inner + read.html.slice(block.end)
60
+ const answer = await server.editPage({ id: holder.id, html, etag: read.etag, shown: true })
37
61
  if (answer.ok) {
38
- script.text = inner;
39
- return { etag: answer.etag };
62
+ script.text = inner
63
+ return { etag: answer.etag }
40
64
  }
41
- const isStale = answer.status === 409 || answer.status === 412;
65
+ const isStale = answer.status === 409 || answer.status === 412
42
66
  if (!isStale || tries)
43
- throw { kind: isStale ? "conflict" : "save", message: answer.error ?? `the server said ${answer.status}` };
67
+ throw { kind: isStale ? "conflict" : "save", message: answer.error ?? `the server said ${answer.status}` }
44
68
  }
45
69
  }
46
- throw { kind: "save", message: `no element around <${element.localName}> has an id the page's file has` };
70
+ throw { kind: "save", message: `no element around <${element.localName}> has an id the page's file has` }
47
71
  }
48
- __name(saveInlineThroughPageServer, "saveInlineThroughPageServer");
49
- var InlineBlocks = class _InlineBlocks {
50
- static {
51
- __name(this, "InlineBlocks");
52
- }
72
+
73
+ /****************
74
+ * ### `InlineBlocks`
75
+ * The text of a `<script type="text/...">` written in a page, in the page's file: found by what it says, and swapped
76
+ * keeping its indent.
77
+ * - Pure, but `ordinalOf()` (the live DOM)
78
+ ****************/
79
+ class InlineBlocks {
53
80
  /** `element`'s own text holder: its `<script type="text/...">` child. */
54
81
  static scriptOf(element) {
55
- return [...element.children].find((child) => child.localName === "script" && child.type.startsWith("text/"));
82
+ return [...element.children].find((child) => child.localName === "script" && child.type.startsWith("text/"))
56
83
  }
84
+
57
85
  /**
58
86
  * Which of the blocks saying the same as `element`'s it is, in `holder`: `0` for the first.
59
87
  * - So two blocks with the same text are told apart by their order, as the file has them.
60
88
  */
61
89
  static ordinalOf(element, holder) {
62
- const text = _InlineBlocks.scriptOf(element)?.text;
90
+ const text = InlineBlocks.scriptOf(element)?.text
63
91
  const same = [...holder.querySelectorAll(element.localName)].filter(
64
- (each) => _InlineBlocks.scriptOf(each)?.text === text
65
- );
66
- return Math.max(0, same.indexOf(element));
92
+ (each) => InlineBlocks.scriptOf(each)?.text === text
93
+ )
94
+ return Math.max(0, same.indexOf(element))
67
95
  }
96
+
68
97
  /**
69
98
  * The `ordinal`th script in `html` whose text, dedented, is `before`: where its text starts and ends, and its text;
70
99
  * `undefined` for none.
71
100
  */
72
101
  static find(html, before, ordinal) {
73
- const blocks = [];
102
+ const blocks = []
74
103
  for (const match of html.matchAll(SCRIPT_BLOCK)) {
75
- const inner = match[2];
76
- if (E.LoadableComponent.dedent(inner) !== before) continue;
77
- const start = match.index + match[1].length;
78
- blocks.push({ start, end: start + inner.length, inner });
104
+ const inner = match[2]
105
+ if (E.LoadableComponent.dedent(inner) !== before) continue
106
+ const start = match.index + match[1].length
107
+ blocks.push({ start, end: start + inner.length, inner })
79
108
  }
80
- return blocks[ordinal] ?? blocks[0];
109
+ return blocks[ordinal] ?? blocks[0]
81
110
  }
111
+
82
112
  /**
83
113
  * `text` laid out as `old` was: the same blank lines before and after it (the line end after the opening tag, the
84
114
  * indent before the closing one), each line indented as `old`'s were.
85
115
  */
86
116
  static reindented(old, text) {
87
- const lines = old.split("\n");
88
- const first = lines.findIndex((line) => line.trim());
89
- if (first < 0) return text;
90
- const last = lines.findLastIndex((line) => line.trim());
91
- const indent = lines.filter((line) => line.trim()).map((line) => line.slice(0, line.length - line.trimStart().length)).reduce((shortest, each) => each.length < shortest.length ? each : shortest);
92
- const head = lines.slice(0, first).map((line) => `${line}
93
- `).join("");
94
- const tail = lines.slice(last + 1).map((line) => `
95
- ${line}`).join("");
96
- const body = text.split("\n").map((line) => line.trim() ? `${indent}${line}` : "").join("\n");
97
- return `${head}${body}${tail}`;
117
+ const lines = old.split("\n")
118
+ const first = lines.findIndex((line) => line.trim())
119
+ if (first < 0) return text
120
+ const last = lines.findLastIndex((line) => line.trim())
121
+ const indent = lines
122
+ .filter((line) => line.trim())
123
+ .map((line) => line.slice(0, line.length - line.trimStart().length))
124
+ .reduce((shortest, each) => (each.length < shortest.length ? each : shortest))
125
+ const head = lines
126
+ .slice(0, first)
127
+ .map((line) => `${line}\n`)
128
+ .join("")
129
+ const tail = lines
130
+ .slice(last + 1)
131
+ .map((line) => `\n${line}`)
132
+ .join("")
133
+ const body = text
134
+ .split("\n")
135
+ .map((line) => (line.trim() ? `${indent}${line}` : ""))
136
+ .join("\n")
137
+ return `${head}${body}${tail}`
98
138
  }
99
- };
100
- var SCRIPT_BLOCK = /(<script\b[^>]*\btype="text\/[^"]*"[^>]*>)([\s\S]*?)<\/script>/g;
139
+ }
140
+
141
+ /** A `<script type="text/...">` in a page's markup: its opening tag, then its text. */
142
+ const SCRIPT_BLOCK = /(<script\b[^>]*\btype="text\/[^"]*"[^>]*>)([\s\S]*?)<\/script>/g
@@ -1,27 +1,89 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ /**
2
+ * Entry of `spell-ui.js`, the ONE classic script a `.html` doc loads -- `file://` blocks ES modules.
3
+ * - Built by `node src/tools/bundle-spell-ui.js`, from spell-epic's root (part of `epic pages update`); edit THIS,
4
+ * never the bundle.
5
+ * - `spell-ui` ~== UI's built `dist/index.js`: every family, each `define()`s its tags as it's imported.
6
+ * Solid comes from UI's `node_modules`, so there's exactly one copy.
7
+ * - Order matters -- imports run top to bottom:
8
+ * - `spell-ui:icons` FIRST: a module the bundler writes, registering the icons our widgets and pages draw
9
+ * with `UI.icons` before any element asks for one (a classic script can't load UI's icon packs)
10
+ * - then UI, which defines -- and so upgrades -- every `ui-*` already in the page
11
+ * - then `spell-ui:lazy`, pointing `<ui-code>` / `<ui-markdown>`'s engine loaders at their lazy scripts (before
12
+ * any element highlights: that waits for `UI.load()`), and the source elements' saver (`spell-ui-sources.js`)
13
+ * - then the page runtime, with every tag defined
14
+ * - then the site header (`spell/server/site`): `defineSite()` runs once every import has, so `<spell-site-header>`
15
+ * upgrades -- and sets `--spell-site-header-height` -- before the runtime first measures its sticky offsets
16
+ * (the runtime waits for the `ui-*` definitions first)
17
+ * - Every import is a package name: Spell UI's from its built `dist/` (`spellUiResolver()`), spell-epic's as their
18
+ * source files (the kit's `sourceNames()`), the rest by their packages' `exports`.
19
+ * - Exports become `window.SpellUI` (`UI`), for the page runtime's checks and for poking in DevTools.
20
+ * - Component packs (epic `epic-components`): `<ui-components source="x.pack.js">` in a `<ui-root>` loads a pack's
21
+ * classic script, which calls `SpellUI.registerPack(pack)` and imports the modules it shares with the page from
22
+ * `SpellUI.packModules` (`spell pack build` maps each of their specifiers there, as written), so a pack never brings a
23
+ * second Solid or Spell UI.
24
+ * - `packModules` is the EXACT specifier a pack's build leaves external => that module's namespace. Add one here
25
+ * AND to the pack build's externals, together.
26
+ * - `import * as` a Solid package, against Spell UI's `AGENTS.md` ("One Solid per page"), on purpose and ONLY
27
+ * here: that rule keeps a library's bundles from pinning all of Solid, but this map exists so a pack can use any
28
+ * export, which no tree-shaker can know ahead. So the whole of `solid-js` / `@solidjs/web` stays in this bundle
29
+ * (`ui`'s own code never holds such a map).
30
+ * - The theme: the ONE the person picked, for every place Spell draws (`ThemePreference`, epic `debut` P21:
31
+ * kept in their space, the editor's and Spell UI's pages' too), applied as soon as the bundle runs;
32
+ * Glass until they pick another
33
+ * - light / dark: part of the same choice (`ColorScheme`)
34
+ * - a theme remembered under an old name comes back as its new one (`studio` as `merlot`)
35
+ * - Spell's sheet adds the brand's roles (`--spell-surface-warm`, `--spell-type-lede` ...), which `spell-doc.css` and
36
+ * the other docs sheets read for eyebrows, ledes, asides and panels; in another theme they're missing, and every
37
+ * sheet that reads one has a fallback
38
+ * - each sheet is inlined like every other `import()`, so it registers a few microtasks after the bundle runs, not
39
+ * a network round trip later; none ships font files
40
+ * - The theme menu (`<ui-theme-menu>`) goes in the site header's `theme` slot, in place of its light / dark button
41
+ * (Q30): the header names no menu, it only gives the page's own a place (`addThemeMenu()`).
42
+ */
3
43
 
4
- // src/tools/_assets/spell-ui.entry.js
5
- import "spell-ui:icons";
6
- import "spell-ui:emoji";
7
- import { UI, ThemePreference } from "spell/ui";
8
- import * as solidH from "@solidjs/h";
9
- import * as solidWeb from "@solidjs/web";
10
- import * as solid from "solid-js";
11
- import * as uiCore from "spell/ui/core";
12
- import * as uiForms from "spell/ui/forms";
13
- import * as uiRoot from "spell/ui/components/ui-root";
14
- import * as uiCode from "spell/ui/components/ui-code";
15
- import * as uiMarkdown from "spell/ui/components/ui-markdown";
16
- import * as imageZoom from "spell/ui/components/ui-zoom/ImageZoom";
17
- import { PackHotSwap } from "spell/ui/hot";
18
- import "spell-ui:lazy";
19
- import "./spell-ui-sources.js";
20
- import "./spell-doc-runtime.js";
21
- import { defineSite } from "spell/server/site";
22
- import { registerPack } from "spell/ui";
23
- PackHotSwap.install();
24
- var packModules = Object.freeze({
44
+ import "spell-ui:icons"
45
+ import "spell-ui:emoji"
46
+ import { UI, ThemePreference } from "spell/ui"
47
+ import * as solidH from "@solidjs/h"
48
+ import * as solidWeb from "@solidjs/web"
49
+ import * as solid from "solid-js"
50
+ import * as uiCore from "spell/ui/core"
51
+ import * as uiForms from "spell/ui/forms"
52
+ import * as uiRoot from "spell/ui/components/ui-root"
53
+ import * as uiCode from "spell/ui/components/ui-code"
54
+ import * as uiMarkdown from "spell/ui/components/ui-markdown"
55
+ import * as imageZoom from "spell/ui/components/ui-zoom/ImageZoom"
56
+ import { PackHotSwap } from "spell/ui/hot"
57
+ import "spell-ui:lazy"
58
+ import "./spell-ui-sources.js"
59
+ import "./spell-doc-runtime.js"
60
+ import { defineSite } from "spell/server/site"
61
+
62
+ // a rebuilt pack (a merge) swaps into the live page instead of reloading it (epic `epic-engine` I116):
63
+ // installed now, before any pack defines its tags
64
+ PackHotSwap.install()
65
+
66
+ export { UI }
67
+ export { registerPack } from "spell/ui"
68
+
69
+ /**
70
+ * What a component pack imports, by the specifier its build leaves external => the page's copy of that module.
71
+ * - The keys are the import names themselves, as every repo's source writes them (epic `repo-split` P14, Q45):
72
+ * the kit's `PACK_MODULES` (`spell/element-tools/packModules`) and spell-app's shared-Solid builds read them.
73
+ * - `spell/element`, what the packs' elements are written on: Spell UI's core module, which carries all of it
74
+ * (`spell/ui/core` re-exports it, and its `E` holds every name spell-element's `E` does), so a page has one.
75
+ * - `spell/ui/components/ui-root` is for `<spell-viewer>` / `<spell-editor>`'s scripts (`spell-solid-shared.js`,
76
+ * spell-app's `app/vite.solid.config.ts`), not for packs: `<spell-viewer>` is a root, a subclass of `UIRoot`.
77
+ * - `@solidjs/h` likewise: what compiled spell draws with (`spell-runtime.js`, through `spell-solid-shared.js`),
78
+ * so a program on a docs page draws with the page's one Solid.
79
+ * - `spell/ui/components/ui-code` and `spell/ui/components/ui-markdown` likewise (epic `repo-split` P2): the families spell's
80
+ * own `<spell-code>` / `<spell-markdown>` (spell-app's app package, `spell-code.js` / `spell-markdown.js`) EXTEND,
81
+ * through `spell-ui-shared.js`, so they extend THIS page's `UICode` / `UIMarkdown`: one Spell UI. Without them
82
+ * those scripts stop with an error saying so. Not packs' externals: the epics pack imports neither.
83
+ * - `spell/ui/components/ui-zoom/ImageZoom`: the page's zoom for its screenshots (epic `ui-gaps` P14), the same one the
84
+ * docs runtime wires up, which `<epic-field>`'s request thumbnails open in.
85
+ */
86
+ export const packModules = Object.freeze({
25
87
  "solid-js": solid,
26
88
  "@solidjs/web": solidWeb,
27
89
  "@solidjs/h": solidH,
@@ -32,22 +94,28 @@ var packModules = Object.freeze({
32
94
  "spell/ui/components/ui-code": uiCode,
33
95
  "spell/ui/components/ui-markdown": uiMarkdown,
34
96
  "spell/ui/components/ui-zoom/ImageZoom": imageZoom
35
- });
97
+ })
98
+
99
+ /**
100
+ * Put the theme menu in the site header's `theme` slot, where its light / dark button was (Q30).
101
+ * - Read as the bundle runs, from the end of `<body>`: the page's markup is all there.
102
+ * - A header DOCKED in a page's own chrome: none, the page has its own control.
103
+ * - Before `defineSite()`: the header draws first time without its light / dark button.
104
+ */
36
105
  function addThemeMenu() {
37
- const header = document.querySelector("spell-site-header:not([docked])");
38
- if (!header || header.querySelector(":scope > ui-theme-menu")) return;
39
- const menu = document.createElement("ui-theme-menu");
40
- menu.slot = "theme";
41
- menu.setAttribute("size", "small");
42
- header.append(menu);
106
+ const header = document.querySelector("spell-site-header:not([docked])")
107
+ if (!header || header.querySelector(":scope > ui-theme-menu")) return
108
+ const menu = document.createElement("ui-theme-menu")
109
+ menu.slot = "theme"
110
+ menu.setAttribute("size", "small")
111
+ header.append(menu)
43
112
  }
44
- __name(addThemeMenu, "addThemeMenu");
45
- var themed = ThemePreference.restore().catch((error) => console.error("spell-ui: the page's theme", error));
46
- addThemeMenu();
47
- defineSite();
48
- export {
49
- UI,
50
- packModules,
51
- registerPack,
52
- themed
53
- };
113
+
114
+ /**
115
+ * Resolves once the page wears its theme (`ThemePreference.restore()`); never rejects.
116
+ * - a live reload's new page waits for it before it shows (the docs runtime's `reveal()`, epic `epic-engine` I164):
117
+ * without it, the reload cross-faded through a frame in Spell UI's plain look (white bands, no Fruity backdrop)
118
+ */
119
+ export const themed = ThemePreference.restore().catch((error) => console.error("spell-ui: the page's theme", error))
120
+ addThemeMenu()
121
+ defineSite()