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.
- package/README-epics.md +149 -49
- package/app/package.json +25 -1
- package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
- package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
- package/dist/app/app/pages/SiteBoardView.css +5 -5
- package/dist/app/app/pages/SiteBoardView.js +1 -1
- package/dist/app/app/pages/SiteEditorPage.js +6 -3
- package/dist/app/app/pages/SiteEdits.js +27 -10
- package/dist/app/app/pages/SiteWrites.js +11 -0
- package/dist/app/app/runner/spellRuntime.js +1 -0
- package/dist/cli/publish/PublishedPackage.d.ts +2 -1
- package/dist/cli/publish/PublishedPackage.js +6 -3
- package/dist/cli/publish/ScratchInstall.d.ts +14 -3
- package/dist/cli/publish/ScratchInstall.js +69 -8
- package/dist/epic/cli/EpicProgram.js +20 -5
- package/dist/epic/cli/epicGroups.js +7 -1
- package/dist/epic/command/BaseBranch.d.ts +35 -0
- package/dist/epic/command/BaseBranch.js +58 -0
- package/dist/epic/command/EpicCheckout.d.ts +1 -1
- package/dist/epic/command/EpicCheckout.js +4 -4
- package/dist/epic/command/EpicGuide.js +3 -2
- package/dist/epic/command/EpicTools.d.ts +5 -0
- package/dist/epic/command/EpicTools.js +14 -3
- package/dist/epic/command/MainMerge.d.ts +26 -15
- package/dist/epic/command/MainMerge.js +60 -16
- package/dist/epic/command/PullRequest.d.ts +45 -0
- package/dist/epic/command/PullRequest.js +100 -0
- package/dist/epic/command/RepoInit.d.ts +196 -39
- package/dist/epic/command/RepoInit.js +481 -60
- package/dist/epic/command/Requests.d.ts +1 -0
- package/dist/epic/command/Requests.js +7 -1
- package/dist/epic/command/SessionMoves.js +2 -1
- package/dist/epic/command/SkillsCheck.js +3 -2
- package/dist/epic/command/Stock.js +3 -1
- package/dist/epic/command/TurnEnd.d.ts +1 -1
- package/dist/epic/command/TurnEnd.js +4 -3
- package/dist/epic/command/Worktrees.d.ts +20 -3
- package/dist/epic/command/Worktrees.js +39 -7
- package/dist/epic/command/command.types.d.ts +3 -0
- package/dist/epic/components/__pack/epics.entry.js +43 -43
- package/dist/epic/components/__pack/epics.pack.js +36 -12794
- package/dist/epic/config/CodeHost.d.ts +96 -0
- package/dist/epic/config/CodeHost.js +89 -0
- package/dist/epic/config/EngineFiles.mjs +60 -0
- package/dist/epic/config/EpicConfig.d.ts +20 -3
- package/dist/epic/config/EpicConfig.js +25 -1
- package/dist/epic/config/EpicRepo.js +1 -1
- package/dist/epic/config/GitHub.d.ts +75 -3
- package/dist/epic/config/GitHub.js +106 -5
- package/dist/epic/config/GitLab.d.ts +138 -0
- package/dist/epic/config/GitLab.js +297 -0
- package/dist/epic/config/LayeredSettings.js +3 -2
- package/dist/epic/server/EpicServer.d.ts +1 -1
- package/dist/epic/server/EpicServer.js +26 -12
- package/dist/epic/tool/InboxPoller.mjs +2 -1
- package/dist/epic/tool/MigrateCommands.js +6 -8
- package/dist/epic/tool/PlanCommits.d.ts +7 -4
- package/dist/epic/tool/PlanCommits.js +7 -5
- package/dist/epic/tool/PlanDocCommands.js +3 -4
- package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
- package/dist/epic/tool/PlanDocFiles.js +13 -5
- package/dist/epic/tool/ServedFolders.d.ts +1 -1
- package/dist/epic/tool/ServedFolders.js +4 -4
- package/dist/epic/tools/PageInboxes.js +3 -3
- package/dist/epic/tools/_assets/commands.entry.js +149 -68
- package/dist/epic/tools/_assets/commands.js +20 -2073
- package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
- package/dist/epic/tools/_assets/core-reference.js +20 -2142
- package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
- package/dist/epic/tools/_assets/goals-live.js +318 -210
- package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
- package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
- package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
- package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
- package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
- package/dist/epic/tools/_assets/spell-comments.js +24 -3716
- package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
- package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
- package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
- package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
- package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
- package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
- package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
- package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
- package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
- package/dist/epic/tools/pages.d.ts +5 -6
- package/dist/epic/tools/pages.js +7 -6
- package/dist/epic/window.mjs +2 -3
- package/dist/parser/core/classes/View.d.ts +20 -0
- package/dist/parser/core/classes/View.js +91 -17
- package/dist/parser/core/core.declarations.json5 +18 -0
- package/dist/parser/core/core.scopes.js +5 -0
- package/dist/parser/core/sites.d.ts +10 -0
- package/dist/parser/core/sites.js +12 -0
- package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
- package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
- package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
- package/dist/parser/parser/tokenizer/Tokens.js +4 -0
- package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
- package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
- package/dist/parser/py/core/spell_core/apps.py +2 -0
- package/dist/parser/spell/PARSING.md +21 -0
- package/dist/parser/spell/SpellParser.d.ts +2 -0
- package/dist/parser/spell/SpellParser.js +58 -3
- package/dist/parser/spell/SpellxTokenizer.js +2 -1
- package/dist/parser/spell/SpellxTwin.d.ts +4 -1
- package/dist/parser/spell/SpellxTwin.js +10 -3
- package/dist/parser/spell/builtinTypes.js +24 -1
- package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
- package/dist/parser/spell/languages/Language.d.ts +11 -2
- package/dist/parser/spell/languages/en/words.js +3 -2
- package/dist/parser/spell/languages/es/words.js +7 -4
- package/dist/parser/spell/rules/Statement.js +1 -1
- package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
- package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
- package/dist/parser/spell/rules/sites/SitePage.js +2 -2
- package/dist/parser/spell/rules/sites/sites.en.js +1 -1
- package/dist/parser/spell/rules/sites/sites.es.js +1 -1
- package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
- package/dist/parser/spell/spell.types.d.ts +7 -0
- package/dist/parser/spell/spellSyntax.es.json +6 -6
- package/dist/parser/spell/spellSyntax.json +6 -6
- package/dist/parser/spellx/SpellxView.js +2 -1
- package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
- package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
- package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
- package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
- package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
- package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
- package/dist/ui/components/ui-card/UICards.d.ts +31 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
- package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
- package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
- package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
- package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
- package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
- package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
- package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
- package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
- package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
- package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
- package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
- package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
- package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
- package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
- package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
- package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
- package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
- package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
- package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
- package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
- package/dist/ui/components/ui-list/UIList.d.ts +2 -0
- package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
- package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
- package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
- package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
- package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
- package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIHeader.d.ts +15 -3
- package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
- package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
- package/dist/ui/components/ui-parts/UIHeader.js +45 -5
- package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIParts.css +18 -0
- package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
- package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
- package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
- package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
- package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
- package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
- package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
- package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
- package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
- package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
- package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
- package/dist/ui/components/ui-section/UISections.d.ts +1 -0
- package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
- package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
- package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
- package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
- package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
- package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
- package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
- package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
- package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
- package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
- package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
- package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
- package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
- package/dist/ui/components/ui-table/UICell.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
- package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
- package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
- package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
- package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
- package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
- package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
- package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
- package/dist/ui/jsx.d.ts +4 -4
- package/dist/ui/vocabulary/defaults.generated.js +1 -1
- package/dist/util/spell/constants.js +1 -1
- package/epic/.claude-plugin/plugin.json +1 -1
- package/epic/.codex-plugin/plugin.json +1 -1
- package/epic/hooks/handoff.mjs +4 -3
- package/epic/hooks/worktree.mjs +22 -3
- package/epic/package.json +41 -2
- package/epic/skills/details/SKILL.md +2 -1
- package/epic/skills/epic/SKILL.md +7 -1
- package/epic/skills/epic/guide.md +3 -0
- package/epic/skills/isolate/SKILL.md +53 -20
- package/epic/src/AGENTS.md +11 -2
- package/epic/templates/durable.html +1 -1
- package/epic/vscode/package.json +1 -1
- package/epic/vscode/spell-epic.vsix +0 -0
- package/package.json +1 -1
- package/parser/package.json +1 -1
- package/ui/package.json +15 -2
|
@@ -1,11 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Entry of `core-reference.js`: the core reference page (`guides/targets/core-reference.html`, epic `python-target` P29):
|
|
3
|
+
* draws every name the javascript core offers, file by file,
|
|
4
|
+
* with Python's name for each and whether spell_core has it yet; then boots the docs bundle.
|
|
5
|
+
* - Loaded INSTEAD of `spell-ui.js`, as `commands.js` is: it fetches, draws, then adds `spell-ui.js` (same folder),
|
|
6
|
+
* whatever happened (`drawThenBoot()`).
|
|
7
|
+
* - The data: two JSON files, read from the checkout SERVING the page (the page's `ServerLink`, `getFile()`),
|
|
8
|
+
* so the page shows that checkout's core and can't go stale.
|
|
9
|
+
* Their paths are relative to the page, in `<body>`'s data attributes:
|
|
10
|
+
* - `data-core-declarations`: `parser/src/core/core.declarations.json5`, the core's method list
|
|
11
|
+
* (`yarn core:gen:declarations` in spell-parser, `coreDeclarations.ts`); `{ provides, statements: [Statement] }`
|
|
12
|
+
* - `data-not-ported`: `parser/src/py/core/not_ported_yet.json5`, what spell_core doesn't have yet;
|
|
13
|
+
* `{ about, groups: [{ why, names: [javascript name] }] }`. Optional: without it the Python column says "?"
|
|
14
|
+
* - `Statement`, by its keys:
|
|
15
|
+
* - a method of `core`: `{ kind: "method", name, of, module, params?: [{ name }], section?, description? }`
|
|
16
|
+
* - a property of `core`: `{ property, of, module, section?, description? }`
|
|
17
|
+
* - a class compiled code imports: `{ type, superType?, module, description? }`
|
|
18
|
+
* - a function compiled code imports: `{ kind: "function", name, module, params?, description? }`
|
|
19
|
+
* - `module`: the core's file under `parser/src/core/`, without `.ts` (`classes` is `classes/index.ts`);
|
|
20
|
+
* `section`: the `// ## Heading` it's under there
|
|
21
|
+
* - Python's names, as spell-parser's `tests/py/core/tests/test_core_declarations.py` checks them:
|
|
22
|
+
* `snakeCase()` of the javascript name
|
|
23
|
+
* - a member is `core.get_item_at()`
|
|
24
|
+
* - a class keeps its name (`spell_core.Thing`)
|
|
25
|
+
* - Placeholders the page holds, all optional:
|
|
26
|
+
* - `[data-core-stats]` (a `ui-statistics`)
|
|
27
|
+
* - `[data-core-modules]`: REPLACED by one nested `<ui-section data-core-module>` per file, numbered after its
|
|
28
|
+
* parent section, each a table with a sub-heading row per heading of the file (`headingRuns()`)
|
|
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)
|
|
31
|
+
* - `[data-core-filter]` (a `ui-input`): hides rows without every typed word
|
|
32
|
+
* - `[data-core-not-ported]`: spell_core's missing names, by why, each linked to its row
|
|
33
|
+
* - Built from elements (`el()`), never from markup in strings (epic `epic-engine` P3): Spell UI's own, as a page
|
|
34
|
+
* writes them (`<ui-section>`, `<ui-table>` round a real `<table>`, `<ui-label>`, `<ui-statistic>`, `<ui-message>`,
|
|
35
|
+
* the source link a `<ui-button>`), in the page's light DOM, so the runtime's contents, sticky titles, table widths
|
|
36
|
+
* and comment anchors take them as hand-written ones
|
|
37
|
+
* - From `file://` it shows a notice where the tables go (`drawThenBoot()`):
|
|
38
|
+
* the page needs the PAGE SERVER (`epic pages open <page>`).
|
|
39
|
+
* - BUNDLED (epic `coherence` C12): `node src/tools/bundle-spell-ui.js --data-pages` builds it into
|
|
40
|
+
* `core-reference.js`, a classic script with NO Spell UI in it; edit THIS, never the bundle. It imports the helpers
|
|
41
|
+
* that exist: the docs helpers' `el()`, `titleInside()` and start, the kit's `slug()`, `ServerLink`.
|
|
42
|
+
*/
|
|
43
|
+
import { slug } from "spell/util/string"
|
|
44
|
+
import { ServerLink } from "spell/epic/review"
|
|
45
|
+
|
|
46
|
+
import { drawThenBoot, el, sectionNumber, titleInside, withCode as withCodeSpans } from "./spell-doc-helpers.js"
|
|
47
|
+
|
|
48
|
+
/** Columns of every file's table. */
|
|
49
|
+
const COLUMNS = ["name", "Python", "in Python", "what it does"]
|
|
50
|
+
|
|
9
51
|
void drawThenBoot({
|
|
10
52
|
load,
|
|
11
53
|
draw,
|
|
@@ -13,51 +55,74 @@ void drawThenBoot({
|
|
|
13
55
|
header: "Reference not drawn",
|
|
14
56
|
offServer: "This page draws the core's method list from the checkout serving it",
|
|
15
57
|
failure: "Couldn't draw the reference"
|
|
16
|
-
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
////////////////
|
|
61
|
+
// ## Start
|
|
62
|
+
////////////////
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Both files, as `{ declarations, notPorted? }`.
|
|
66
|
+
* - throws when the core's method list can't be read; a missing `not_ported_yet.json5` only leaves `notPorted` out
|
|
67
|
+
* - each by its name now, `.json5`, first (`ServerLink.dataFileNames()`; epic `people-and-orgs` P12): the page names
|
|
68
|
+
* the old file, `.json`, which an older checkout still has. Both hold plain JSON.
|
|
69
|
+
*/
|
|
17
70
|
async function load() {
|
|
18
|
-
const { coreDeclarations, notPorted } = document.body.dataset
|
|
19
|
-
if (!coreDeclarations) throw new Error("the page's `<body>` has no `data-core-declarations`")
|
|
20
|
-
const link = ServerLink.forPage()
|
|
71
|
+
const { coreDeclarations, notPorted } = document.body.dataset
|
|
72
|
+
if (!coreDeclarations) throw new Error("the page's `<body>` has no `data-core-declarations`")
|
|
73
|
+
const link = ServerLink.forPage()
|
|
21
74
|
const [declarations, groups] = await Promise.all([
|
|
22
75
|
link.getFile(ServerLink.dataFileNames(coreDeclarations)),
|
|
23
|
-
notPorted ? link.getFile(ServerLink.dataFileNames(notPorted)).catch(() =>
|
|
24
|
-
])
|
|
25
|
-
if (declarations ===
|
|
26
|
-
return { declarations, notPorted: groups }
|
|
76
|
+
notPorted ? link.getFile(ServerLink.dataFileNames(notPorted)).catch(() => undefined) : undefined
|
|
77
|
+
])
|
|
78
|
+
if (declarations === undefined) throw new Error(`${coreDeclarations}: not found`)
|
|
79
|
+
return { declarations, notPorted: groups }
|
|
27
80
|
}
|
|
28
|
-
|
|
81
|
+
|
|
82
|
+
////////////////
|
|
83
|
+
// ## Drawing
|
|
84
|
+
////////////////
|
|
85
|
+
|
|
86
|
+
/** Fill every placeholder from `data`. */
|
|
29
87
|
function draw({ declarations, notPorted }) {
|
|
30
|
-
const statements = declarations.statements ?? []
|
|
31
|
-
const missing = missingNames(notPorted)
|
|
32
|
-
const modules = byModule(statements)
|
|
33
|
-
const holder = document.querySelector("[data-core-modules]")
|
|
88
|
+
const statements = declarations.statements ?? []
|
|
89
|
+
const missing = missingNames(notPorted)
|
|
90
|
+
const modules = byModule(statements)
|
|
91
|
+
const holder = document.querySelector("[data-core-modules]")
|
|
34
92
|
if (holder) {
|
|
35
|
-
const number = sectionNumber(holder.closest("ui-section"))
|
|
36
|
-
const sections = [...modules].map(
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
holder.replaceWith(...sections)
|
|
93
|
+
const number = sectionNumber(holder.closest("ui-section"))
|
|
94
|
+
const sections = [...modules].map(([module, rows], i) =>
|
|
95
|
+
moduleSection(module, rows, missing, number ? `${number}.${i + 1} ` : "")
|
|
96
|
+
)
|
|
97
|
+
holder.replaceWith(...sections)
|
|
40
98
|
}
|
|
41
|
-
document.querySelector("[data-core-stats]")?.replaceChildren(...statistics(statements, modules, missing))
|
|
42
|
-
document.querySelector("[data-core-not-ported]")?.replaceChildren(notPortedList(statements, notPorted))
|
|
43
|
-
const filter = document.querySelector("[data-core-filter]")
|
|
44
|
-
if (filter) wireFilter(filter)
|
|
99
|
+
document.querySelector("[data-core-stats]")?.replaceChildren(...statistics(statements, modules, missing))
|
|
100
|
+
document.querySelector("[data-core-not-ported]")?.replaceChildren(notPortedList(statements, notPorted))
|
|
101
|
+
const filter = document.querySelector("[data-core-filter]")
|
|
102
|
+
if (filter) wireFilter(filter)
|
|
45
103
|
}
|
|
46
|
-
|
|
104
|
+
|
|
105
|
+
/** The statements by file, in the list's order. */
|
|
47
106
|
function byModule(statements) {
|
|
48
|
-
const modules =
|
|
107
|
+
const modules = new Map()
|
|
49
108
|
for (const statement of statements) {
|
|
50
|
-
const module = statement.module ?? "core"
|
|
51
|
-
if (!modules.has(module)) modules.set(module, [])
|
|
52
|
-
modules.get(module).push(statement)
|
|
109
|
+
const module = statement.module ?? "core"
|
|
110
|
+
if (!modules.has(module)) modules.set(module, [])
|
|
111
|
+
modules.get(module).push(statement)
|
|
53
112
|
}
|
|
54
|
-
return modules
|
|
113
|
+
return modules
|
|
55
114
|
}
|
|
56
|
-
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* One file: a nested `<ui-section>` with its table, a `<tbody>` per run of names under one heading.
|
|
118
|
+
* - a link to its source file in the title bar's `actions`: a round icon button (a phone has little room); `tiny`,
|
|
119
|
+
* its icon 11px, as the bare icon it was before
|
|
120
|
+
* - its count in the `badge`
|
|
121
|
+
*/
|
|
57
122
|
function moduleSection(module, statements, missing, prefix) {
|
|
58
|
-
const file = sourceFile(module)
|
|
59
|
-
const notIn = missing ? statements.filter((statement) => missing.has(jsName(statement))).length : 0
|
|
60
|
-
const path = `spell-parser/src/core/${file}
|
|
123
|
+
const file = sourceFile(module)
|
|
124
|
+
const notIn = missing ? statements.filter((statement) => missing.has(jsName(statement))).length : 0
|
|
125
|
+
const path = `spell-parser/src/core/${file}`
|
|
61
126
|
const source = el("ui-button", {
|
|
62
127
|
slot: "actions",
|
|
63
128
|
appearance: "circular basic",
|
|
@@ -67,16 +132,16 @@ function moduleSection(module, statements, missing, prefix) {
|
|
|
67
132
|
target: `src-${slug(path)}`,
|
|
68
133
|
title: path,
|
|
69
134
|
"aria-label": `Open ${file.split("/").pop()}`
|
|
70
|
-
})
|
|
71
|
-
titleInside(source)
|
|
72
|
-
const bodies = headingRuns(statements).map(
|
|
73
|
-
|
|
135
|
+
})
|
|
136
|
+
titleInside(source)
|
|
137
|
+
const bodies = headingRuns(statements).map(({ heading, rows }) =>
|
|
138
|
+
el(
|
|
74
139
|
"tbody",
|
|
75
140
|
{},
|
|
76
141
|
heading ? el("tr", {}, el("th", { colspan: String(COLUMNS.length) }, ...withCode(heading))) : "",
|
|
77
142
|
...rows.map((statement) => row(statement, missing))
|
|
78
143
|
)
|
|
79
|
-
)
|
|
144
|
+
)
|
|
80
145
|
return el(
|
|
81
146
|
"ui-section",
|
|
82
147
|
{
|
|
@@ -95,19 +160,27 @@ function moduleSection(module, statements, missing, prefix) {
|
|
|
95
160
|
{ celled: "", padding: "compact", appearance: "striped", unstackable: "" },
|
|
96
161
|
el("table", {}, el("thead", {}, el("tr", {}, ...COLUMNS.map((label) => el("th", {}, label)))), ...bodies)
|
|
97
162
|
)
|
|
98
|
-
)
|
|
163
|
+
)
|
|
99
164
|
}
|
|
100
|
-
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A file's names in the list's order (the file's), cut into runs under one heading: `[{ heading, rows }]`.
|
|
168
|
+
* - members of `core` under their `section`; one without, after one with, stays under the one before
|
|
169
|
+
* - the list says no section for a few whose first declaration is above every heading:
|
|
170
|
+
* an overload, an interface's member
|
|
171
|
+
* - what compiled code imports by name, classes and functions, under "imported by name"
|
|
172
|
+
*/
|
|
101
173
|
function headingRuns(statements) {
|
|
102
|
-
const runs = []
|
|
174
|
+
const runs = []
|
|
103
175
|
for (const statement of statements) {
|
|
104
|
-
const heading = statement.of === "core" ? statement.section ?? runs.at(-1)?.heading ?? "" : "imported by name"
|
|
105
|
-
if (runs.at(-1)?.heading !== heading) runs.push({ heading, rows: [] })
|
|
106
|
-
runs.at(-1).rows.push(statement)
|
|
176
|
+
const heading = statement.of === "core" ? (statement.section ?? runs.at(-1)?.heading ?? "") : "imported by name"
|
|
177
|
+
if (runs.at(-1)?.heading !== heading) runs.push({ heading, rows: [] })
|
|
178
|
+
runs.at(-1).rows.push(statement)
|
|
107
179
|
}
|
|
108
|
-
return runs
|
|
180
|
+
return runs
|
|
109
181
|
}
|
|
110
|
-
|
|
182
|
+
|
|
183
|
+
/** One name's row. */
|
|
111
184
|
function row(statement, missing) {
|
|
112
185
|
return el(
|
|
113
186
|
"tr",
|
|
@@ -116,122 +189,169 @@ function row(statement, missing) {
|
|
|
116
189
|
el("td", {}, el("code", {}, pythonName(statement))),
|
|
117
190
|
ported(jsName(statement), missing),
|
|
118
191
|
el("td", {}, ...withCode(statement.description ?? ""))
|
|
119
|
-
)
|
|
192
|
+
)
|
|
120
193
|
}
|
|
121
|
-
|
|
194
|
+
|
|
195
|
+
/** The javascript name, with its parameters, and a label saying what it is unless it's a method of `core`. */
|
|
122
196
|
function nameParts(statement) {
|
|
123
|
-
const params = statement.params ? `(${statement.params.map((param) => param.name).join(", ")})` : ""
|
|
124
|
-
const kind = kindOf(statement)
|
|
197
|
+
const params = statement.params ? `(${statement.params.map((param) => param.name).join(", ")})` : ""
|
|
198
|
+
const kind = kindOf(statement)
|
|
125
199
|
return [
|
|
126
200
|
el("code", {}, jsName(statement) + (statement.kind ? params || "()" : "")),
|
|
127
|
-
...kind === "method" ? [] : [" ", el("ui-label", { size: "mini" }, kind)],
|
|
128
|
-
...statement.superType ? [" extends ", el("code", {}, statement.superType)] : []
|
|
129
|
-
]
|
|
201
|
+
...(kind === "method" ? [] : [" ", el("ui-label", { size: "mini" }, kind)]),
|
|
202
|
+
...(statement.superType ? [" extends ", el("code", {}, statement.superType)] : [])
|
|
203
|
+
]
|
|
130
204
|
}
|
|
131
|
-
|
|
205
|
+
|
|
206
|
+
/** "in Python" cell: ✓, or ✗ with why as its tooltip; "?" without `not_ported_yet.json5`. */
|
|
132
207
|
function ported(name, missing) {
|
|
133
|
-
if (!missing) return el("td", { title: "this checkout has no parser/src/py/core/not_ported_yet.json5" }, "?")
|
|
134
|
-
const why = missing.get(name)
|
|
135
|
-
if (why ===
|
|
136
|
-
return el("td", { class: "no negative", title: why }, "✗ not yet")
|
|
208
|
+
if (!missing) return el("td", { title: "this checkout has no parser/src/py/core/not_ported_yet.json5" }, "?")
|
|
209
|
+
const why = missing.get(name)
|
|
210
|
+
if (why === undefined) return el("td", { class: "yes positive", title: "spell_core has it" }, "✓")
|
|
211
|
+
return el("td", { class: "no negative", title: why }, "✗ not yet")
|
|
137
212
|
}
|
|
138
|
-
|
|
213
|
+
|
|
214
|
+
/** Headline numbers: names, files, how many Python has and hasn't. */
|
|
139
215
|
function statistics(statements, modules, missing) {
|
|
140
|
-
const notIn = missing ? statements.filter((statement) => missing.has(jsName(statement))).length :
|
|
216
|
+
const notIn = missing ? statements.filter((statement) => missing.has(jsName(statement))).length : undefined
|
|
141
217
|
return [
|
|
142
218
|
[statements.length, "names"],
|
|
143
219
|
[modules.size, "files"],
|
|
144
|
-
[notIn ===
|
|
220
|
+
[notIn === undefined ? "?" : statements.length - notIn, "in Python"],
|
|
145
221
|
[notIn ?? "?", "not in Python yet"]
|
|
146
|
-
].map(([value, label]) => el("ui-statistic", { value: String(value), label }))
|
|
222
|
+
].map(([value, label]) => el("ui-statistic", { value: String(value), label }))
|
|
147
223
|
}
|
|
148
|
-
|
|
224
|
+
|
|
225
|
+
/** spell_core's missing names: one bullet per group, its why, then its names linked to their rows. */
|
|
149
226
|
function notPortedList(statements, notPorted) {
|
|
150
227
|
if (!notPorted)
|
|
151
228
|
return el(
|
|
152
229
|
"ui-message",
|
|
153
230
|
{ state: "warning", heading: "No list of what Python lacks" },
|
|
154
231
|
el("p", {}, "This checkout has no ", el("code", {}, "parser/src/py/core/not_ported_yet.json5"), ".")
|
|
155
|
-
)
|
|
156
|
-
const byName = new Map(statements.map((statement) => [jsName(statement), statement]))
|
|
232
|
+
)
|
|
233
|
+
const byName = new Map(statements.map((statement) => [jsName(statement), statement]))
|
|
157
234
|
const items = (notPorted.groups ?? []).map((group) => {
|
|
158
235
|
const names = group.names.flatMap((name, i) => {
|
|
159
|
-
const statement = byName.get(name)
|
|
160
|
-
const code = el("code", {}, name)
|
|
161
|
-
return [i ? ", " : "", statement ? el("a", { href: `#${rowId(statement)}` }, code) : code]
|
|
162
|
-
})
|
|
163
|
-
return el("li", {}, ...withCode(group.why), ` (${group.names.length}):`, el("br"), ...names)
|
|
164
|
-
})
|
|
165
|
-
return el("ul", {}, ...items)
|
|
166
|
-
}
|
|
167
|
-
|
|
236
|
+
const statement = byName.get(name)
|
|
237
|
+
const code = el("code", {}, name)
|
|
238
|
+
return [i ? ", " : "", statement ? el("a", { href: `#${rowId(statement)}` }, code) : code]
|
|
239
|
+
})
|
|
240
|
+
return el("li", {}, ...withCode(group.why), ` (${group.names.length}):`, el("br"), ...names)
|
|
241
|
+
})
|
|
242
|
+
return el("ul", {}, ...items)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
////////////////
|
|
246
|
+
// ## Names
|
|
247
|
+
////////////////
|
|
248
|
+
|
|
249
|
+
/** The javascript name a statement declares: a member's, a class's or a function's. */
|
|
168
250
|
function jsName(statement) {
|
|
169
|
-
return statement.name ?? statement.property ?? statement.type
|
|
251
|
+
return statement.name ?? statement.property ?? statement.type
|
|
170
252
|
}
|
|
171
|
-
|
|
253
|
+
|
|
254
|
+
/** What a statement declares, as its label says: `method`, `property`, `class` or `import` (a function). */
|
|
172
255
|
function kindOf(statement) {
|
|
173
|
-
if (statement.type) return "class"
|
|
174
|
-
if (statement.property) return "property"
|
|
175
|
-
return statement.kind === "function" ? "import" : "method"
|
|
256
|
+
if (statement.type) return "class"
|
|
257
|
+
if (statement.property) return "property"
|
|
258
|
+
return statement.kind === "function" ? "import" : "method"
|
|
176
259
|
}
|
|
177
|
-
|
|
260
|
+
|
|
261
|
+
/** The row's id: unique, though a few names are both a method and an import (`positionOf`). */
|
|
178
262
|
function rowId(statement) {
|
|
179
|
-
const kind = kindOf(statement)
|
|
180
|
-
const prefix = kind === "class" ? "class" : kind === "import" ? "import" : "spellcore"
|
|
181
|
-
return `${prefix}-${jsName(statement)}
|
|
263
|
+
const kind = kindOf(statement)
|
|
264
|
+
const prefix = kind === "class" ? "class" : kind === "import" ? "import" : "spellcore"
|
|
265
|
+
return `${prefix}-${jsName(statement)}`
|
|
182
266
|
}
|
|
183
|
-
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Python's name for `statement`, as spell_core's test looks for it.
|
|
270
|
+
* - a member of `core`: `core.get_item_at()`, `core.time_units_map` (a constant may keep its capitals)
|
|
271
|
+
* - a class: `spell_core.Thing`; a function compiled code imports: `position_of()`, on `core` or the package
|
|
272
|
+
*/
|
|
184
273
|
function pythonName(statement) {
|
|
185
|
-
const kind = kindOf(statement)
|
|
186
|
-
if (kind === "class") return `spell_core.${statement.type}
|
|
187
|
-
const name = snakeCase(jsName(statement))
|
|
188
|
-
if (kind === "property") return `core.${name}
|
|
189
|
-
return kind === "import" ? `${name}()` : `core.${name}()
|
|
274
|
+
const kind = kindOf(statement)
|
|
275
|
+
if (kind === "class") return `spell_core.${statement.type}`
|
|
276
|
+
const name = snakeCase(jsName(statement))
|
|
277
|
+
if (kind === "property") return `core.${name}`
|
|
278
|
+
return kind === "import" ? `${name}()` : `core.${name}()`
|
|
190
279
|
}
|
|
191
|
-
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* `name` as Python writes it: `getItemAt` is `get_item_at`.
|
|
283
|
+
* - capitals together stay one word: `isANumber` is `is_a_number`, `fromJSON` `from_json`
|
|
284
|
+
* - a name all in capitals is lowercased: `ACTIVE_TEST` is `active_test`
|
|
285
|
+
* - SEE: `snake_case()` in spell-parser's `tests/py/core/tests/test_core_declarations.py`, which this must match
|
|
286
|
+
*/
|
|
192
287
|
function snakeCase(name) {
|
|
193
|
-
if (/^[A-Z0-9_]+$/.test(name)) return name.toLowerCase()
|
|
194
|
-
return name
|
|
288
|
+
if (/^[A-Z0-9_]+$/.test(name)) return name.toLowerCase()
|
|
289
|
+
return name
|
|
290
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2")
|
|
291
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
292
|
+
.toLowerCase()
|
|
195
293
|
}
|
|
196
|
-
|
|
294
|
+
|
|
295
|
+
/** The names spell_core doesn't have yet, each to its group's why; `undefined` without the file. */
|
|
197
296
|
function missingNames(notPorted) {
|
|
198
|
-
if (!notPorted) return
|
|
199
|
-
return new Map((notPorted.groups ?? []).flatMap((group) => group.names.map((name) => [name, group.why])))
|
|
297
|
+
if (!notPorted) return undefined
|
|
298
|
+
return new Map((notPorted.groups ?? []).flatMap((group) => group.names.map((name) => [name, group.why])))
|
|
200
299
|
}
|
|
201
|
-
|
|
300
|
+
|
|
301
|
+
/** `module`'s file under `parser/src/core/`: `classes` is `classes/index.ts`. */
|
|
202
302
|
function sourceFile(module) {
|
|
203
|
-
return module === "classes" ? "classes/index.ts" : `${module}.ts
|
|
303
|
+
return module === "classes" ? "classes/index.ts" : `${module}.ts`
|
|
204
304
|
}
|
|
205
|
-
|
|
305
|
+
|
|
306
|
+
/** `file`'s link from this page: `src/<file>` beside the core's method list, wherever the page says that is. */
|
|
206
307
|
function sourceHref(file) {
|
|
207
|
-
return (document.body.dataset.coreDeclarations ?? "").replace(/[^/]*$/, `src/${file}`)
|
|
308
|
+
return (document.body.dataset.coreDeclarations ?? "").replace(/[^/]*$/, `src/${file}`)
|
|
208
309
|
}
|
|
209
|
-
|
|
310
|
+
|
|
311
|
+
////////////////
|
|
312
|
+
// ## Filter
|
|
313
|
+
////////////////
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Hide the rows without every typed word, the sub-headings left empty, and the files left empty.
|
|
317
|
+
* - reads the value from the events' `detail`: during `ui-input` the element's `value` is still the old one
|
|
318
|
+
*/
|
|
210
319
|
function wireFilter(input) {
|
|
211
|
-
input.addEventListener("ui-typed", apply)
|
|
212
|
-
input.addEventListener("ui-changed", apply)
|
|
320
|
+
input.addEventListener("ui-typed", apply)
|
|
321
|
+
input.addEventListener("ui-changed", apply)
|
|
322
|
+
|
|
323
|
+
/** Apply the filter in `event`. */
|
|
213
324
|
function apply(event) {
|
|
214
|
-
const words = String(event.detail?.value ?? input.value ?? "")
|
|
325
|
+
const words = String(event.detail?.value ?? input.value ?? "")
|
|
326
|
+
.toLowerCase()
|
|
327
|
+
.split(/\s+/)
|
|
328
|
+
.filter(Boolean)
|
|
215
329
|
for (const section of document.querySelectorAll("ui-section[data-core-module]")) {
|
|
216
|
-
let shown = 0
|
|
330
|
+
let shown = 0
|
|
217
331
|
for (const body of section.querySelectorAll("tbody")) {
|
|
218
|
-
let inBody = 0
|
|
219
|
-
for (const
|
|
220
|
-
const content =
|
|
221
|
-
|
|
222
|
-
if (!
|
|
332
|
+
let inBody = 0
|
|
333
|
+
for (const row of body.querySelectorAll("tr:has(td)")) {
|
|
334
|
+
const content = row.textContent.toLowerCase()
|
|
335
|
+
row.hidden = !words.every((word) => content.includes(word))
|
|
336
|
+
if (!row.hidden) inBody++
|
|
223
337
|
}
|
|
224
|
-
const head = body.querySelector("tr:not(:has(td))")
|
|
225
|
-
if (head) head.hidden = inBody === 0
|
|
226
|
-
shown += inBody
|
|
338
|
+
const head = body.querySelector("tr:not(:has(td))")
|
|
339
|
+
if (head) head.hidden = inBody === 0
|
|
340
|
+
shown += inBody
|
|
227
341
|
}
|
|
228
|
-
section.hidden = shown === 0
|
|
342
|
+
section.hidden = shown === 0
|
|
229
343
|
}
|
|
230
344
|
}
|
|
231
|
-
__name(apply, "apply");
|
|
232
345
|
}
|
|
233
|
-
|
|
346
|
+
|
|
347
|
+
////////////////
|
|
348
|
+
// ## Text
|
|
349
|
+
////////////////
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* `value` as nodes: its `` `code` `` spans (and a flattened ```` ```lang ...``` ```` block) as `<code>`, the rest as
|
|
353
|
+
* text, never markup.
|
|
354
|
+
*/
|
|
234
355
|
function withCode(value) {
|
|
235
|
-
return withCodeSpans(String(value).replace(/```(?:[a-z]+\s)?([\s\S]*?)```/g, (_, code) => `\`${code.trim()}\``))
|
|
356
|
+
return withCodeSpans(String(value).replace(/```(?:[a-z]+\s)?([\s\S]*?)```/g, (_, code) => `\`${code.trim()}\``))
|
|
236
357
|
}
|
|
237
|
-
__name(withCode, "withCode");
|