@scaffold-ui-kit/preview 0.0.0-stage → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1868 -2
- package/application/host/bootstrap.ts +43 -0
- package/application/host/main.ts +31 -0
- package/application/host/shell-host.ts +47 -0
- package/application/index.html +12 -0
- package/application/lib/base-url.ts +15 -0
- package/application/lib/no-code-block.ts +7 -0
- package/application/lib/no-setup.ts +3 -0
- package/application/lib/no-views.ts +6 -0
- package/application/preview/code/code.html +12 -0
- package/application/preview/code/main.ts +89 -0
- package/application/preview/globals.ts +254 -0
- package/application/preview/html/main.ts +93 -0
- package/application/preview/html/preview.html +12 -0
- package/application/preview/react/main.tsx +146 -0
- package/application/preview/react/preview.html +12 -0
- package/application/preview/svelte/Preview.svelte +104 -0
- package/application/preview/svelte/main.ts +13 -0
- package/application/preview/svelte/preview.html +12 -0
- package/application/preview/svelte/story-props.ts +172 -0
- package/application/preview/view/main.ts +124 -0
- package/application/preview/view/view.html +12 -0
- package/application/preview/vue/main.ts +145 -0
- package/application/preview/vue/preview.html +12 -0
- package/application/shells/charcell/components/Application/index.css +37 -0
- package/application/shells/charcell/components/Application/index.tsx +65 -0
- package/application/shells/charcell/components/Bar/index.css +68 -0
- package/application/shells/charcell/components/Bar/index.tsx +60 -0
- package/application/shells/charcell/components/CodePane/index.css +60 -0
- package/application/shells/charcell/components/CodePane/index.tsx +113 -0
- package/application/shells/charcell/components/ComponentStage/index.css +26 -0
- package/application/shells/charcell/components/ComponentStage/index.tsx +110 -0
- package/application/shells/charcell/components/Control/index.css +20 -0
- package/application/shells/charcell/components/Control/index.tsx +118 -0
- package/application/shells/charcell/components/CopyLink/index.tsx +35 -0
- package/application/shells/charcell/components/Description/index.css +6 -0
- package/application/shells/charcell/components/Description/index.tsx +24 -0
- package/application/shells/charcell/components/EditorAddDialog/index.css +9 -0
- package/application/shells/charcell/components/EditorAddDialog/index.tsx +158 -0
- package/application/shells/charcell/components/EditorPanel/index.css +48 -0
- package/application/shells/charcell/components/EditorPanel/index.tsx +496 -0
- package/application/shells/charcell/components/EventsRow/index.css +42 -0
- package/application/shells/charcell/components/EventsRow/index.tsx +68 -0
- package/application/shells/charcell/components/HeadingRow/index.css +11 -0
- package/application/shells/charcell/components/HeadingRow/index.tsx +16 -0
- package/application/shells/charcell/components/Hint/index.css +16 -0
- package/application/shells/charcell/components/Hint/index.tsx +81 -0
- package/application/shells/charcell/components/HtmlWarnings/index.tsx +45 -0
- package/application/shells/charcell/components/KeyHints/index.css +27 -0
- package/application/shells/charcell/components/KeyHints/index.tsx +106 -0
- package/application/shells/charcell/components/KitCodeBlock/index.css +55 -0
- package/application/shells/charcell/components/KitCodeBlock/index.tsx +18 -0
- package/application/shells/charcell/components/Markdown/index.tsx +16 -0
- package/application/shells/charcell/components/Navigation/index.css +13 -0
- package/application/shells/charcell/components/Navigation/index.tsx +98 -0
- package/application/shells/charcell/components/NavigationSplit/index.css +16 -0
- package/application/shells/charcell/components/NavigationSplit/index.tsx +82 -0
- package/application/shells/charcell/components/OptionControls/index.tsx +93 -0
- package/application/shells/charcell/components/PaneStatus/index.css +7 -0
- package/application/shells/charcell/components/PaneStatus/index.tsx +47 -0
- package/application/shells/charcell/components/PaneWidth/index.tsx +45 -0
- package/application/shells/charcell/components/PreviewGrid/index.css +39 -0
- package/application/shells/charcell/components/PreviewGrid/index.tsx +344 -0
- package/application/shells/charcell/components/PreviewPane/index.css +127 -0
- package/application/shells/charcell/components/PreviewPane/index.tsx +182 -0
- package/application/shells/charcell/components/PromptBar/index.tsx +133 -0
- package/application/shells/charcell/components/ScenarioRow/index.css +36 -0
- package/application/shells/charcell/components/ScenarioRow/index.tsx +71 -0
- package/application/shells/charcell/components/Select/index.tsx +48 -0
- package/application/shells/charcell/components/SlotOutlet/index.css +7 -0
- package/application/shells/charcell/components/SlotOutlet/index.tsx +25 -0
- package/application/shells/charcell/components/StageBar/index.css +7 -0
- package/application/shells/charcell/components/StageBar/index.tsx +109 -0
- package/application/shells/charcell/components/StageSplit/index.css +11 -0
- package/application/shells/charcell/components/StageSplit/index.tsx +99 -0
- package/application/shells/charcell/components/StatusBar/index.tsx +30 -0
- package/application/shells/charcell/components/ViewControls/index.css +15 -0
- package/application/shells/charcell/components/ViewControls/index.tsx +58 -0
- package/application/shells/charcell/components/ViewHeading/index.css +13 -0
- package/application/shells/charcell/components/ViewHeading/index.tsx +8 -0
- package/application/shells/charcell/components/ViewStage/index.css +9 -0
- package/application/shells/charcell/components/ViewStage/index.tsx +25 -0
- package/application/shells/charcell/components/WrapToggle/index.tsx +27 -0
- package/application/shells/charcell/configuration.ts +45 -0
- package/application/shells/charcell/controller-context.ts +27 -0
- package/application/shells/charcell/fit-labels.ts +42 -0
- package/application/shells/charcell/html-warnings.ts +18 -0
- package/application/shells/charcell/index.tsx +82 -0
- package/application/shells/charcell/page-loading.html +57 -0
- package/application/shells/charcell/placement.ts +24 -0
- package/application/shells/charcell/shell-options.ts +23 -0
- package/application/shells/charcell/shell.css +37 -0
- package/application/shells/charcell/shell.tsx +25 -0
- package/application/shells/charcell/split-reset.ts +47 -0
- package/application/shells/charcell/stacked-rows.ts +117 -0
- package/application/shells/charcell/stage-toggles.ts +93 -0
- package/application/types/manifest.d.ts +6 -0
- package/application/types/preview-configuration.d.ts +10 -0
- package/application/types/preview-shell.d.ts +7 -0
- package/application/types/react-registry.d.ts +15 -0
- package/application/types/vue-registry.d.ts +6 -0
- package/dist/build.d.ts +24 -0
- package/dist/build.js +34 -0
- package/dist/check.d.ts +48 -0
- package/dist/check.js +781 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +88 -0
- package/dist/context.d.ts +179 -0
- package/dist/context.js +783 -0
- package/dist/controller/catalog.d.ts +339 -0
- package/dist/controller/catalog.js +367 -0
- package/dist/controller/create-preview-controller.d.ts +532 -0
- package/dist/controller/create-preview-controller.js +1707 -0
- package/dist/controller/editor-tree.d.ts +161 -0
- package/dist/controller/editor-tree.js +373 -0
- package/dist/controller/html-source.d.ts +62 -0
- package/dist/controller/html-source.js +61 -0
- package/dist/controller/index.d.ts +9 -0
- package/dist/controller/index.js +12 -0
- package/dist/controller/persistence.d.ts +191 -0
- package/dist/controller/persistence.js +315 -0
- package/dist/controller/regeneration.d.ts +30 -0
- package/dist/controller/regeneration.js +27 -0
- package/dist/controller/source.d.ts +80 -0
- package/dist/controller/source.js +236 -0
- package/dist/controller/store.d.ts +27 -0
- package/dist/controller/store.js +40 -0
- package/dist/declarations/application/shells/charcell/components/Application/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/Bar/index.d.ts +11 -0
- package/dist/declarations/application/shells/charcell/components/CodePane/index.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/components/ComponentStage/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/Control/index.d.ts +9 -0
- package/dist/declarations/application/shells/charcell/components/CopyLink/index.d.ts +1 -0
- package/dist/declarations/application/shells/charcell/components/Description/index.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/components/EditorAddDialog/index.d.ts +6 -0
- package/dist/declarations/application/shells/charcell/components/EditorPanel/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/EventsRow/index.d.ts +4 -0
- package/dist/declarations/application/shells/charcell/components/HeadingRow/index.d.ts +6 -0
- package/dist/declarations/application/shells/charcell/components/Hint/index.d.ts +11 -0
- package/dist/declarations/application/shells/charcell/components/HtmlWarnings/index.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/components/KeyHints/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/KitCodeBlock/index.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/components/Markdown/index.d.ts +3 -0
- package/dist/declarations/application/shells/charcell/components/Navigation/index.d.ts +8 -0
- package/dist/declarations/application/shells/charcell/components/NavigationSplit/index.d.ts +7 -0
- package/dist/declarations/application/shells/charcell/components/OptionControls/index.d.ts +7 -0
- package/dist/declarations/application/shells/charcell/components/PaneStatus/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/PaneWidth/index.d.ts +4 -0
- package/dist/declarations/application/shells/charcell/components/PreviewGrid/index.d.ts +7 -0
- package/dist/declarations/application/shells/charcell/components/PreviewPane/index.d.ts +9 -0
- package/dist/declarations/application/shells/charcell/components/PromptBar/index.d.ts +1 -0
- package/dist/declarations/application/shells/charcell/components/ScenarioRow/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/Select/index.d.ts +16 -0
- package/dist/declarations/application/shells/charcell/components/SlotOutlet/index.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/components/StageBar/index.d.ts +2 -0
- package/dist/declarations/application/shells/charcell/components/StageSplit/index.d.ts +17 -0
- package/dist/declarations/application/shells/charcell/components/StatusBar/index.d.ts +1 -0
- package/dist/declarations/application/shells/charcell/components/ViewControls/index.d.ts +9 -0
- package/dist/declarations/application/shells/charcell/components/ViewHeading/index.d.ts +4 -0
- package/dist/declarations/application/shells/charcell/components/ViewStage/index.d.ts +4 -0
- package/dist/declarations/application/shells/charcell/components/WrapToggle/index.d.ts +1 -0
- package/dist/declarations/application/shells/charcell/configuration.d.ts +31 -0
- package/dist/declarations/application/shells/charcell/controller-context.d.ts +9 -0
- package/dist/declarations/application/shells/charcell/fit-labels.d.ts +18 -0
- package/dist/declarations/application/shells/charcell/html-warnings.d.ts +5 -0
- package/dist/declarations/application/shells/charcell/index.d.ts +39 -0
- package/dist/declarations/application/shells/charcell/placement.d.ts +7 -0
- package/dist/declarations/application/shells/charcell/shell-options.d.ts +15 -0
- package/dist/declarations/application/shells/charcell/shell.d.ts +9 -0
- package/dist/declarations/application/shells/charcell/split-reset.d.ts +30 -0
- package/dist/declarations/application/shells/charcell/stacked-rows.d.ts +58 -0
- package/dist/declarations/application/shells/charcell/stage-toggles.d.ts +28 -0
- package/dist/declarations/src/controller/catalog.d.ts +339 -0
- package/dist/declarations/src/controller/create-preview-controller.d.ts +532 -0
- package/dist/declarations/src/controller/editor-tree.d.ts +161 -0
- package/dist/declarations/src/controller/html-source.d.ts +62 -0
- package/dist/declarations/src/controller/index.d.ts +9 -0
- package/dist/declarations/src/controller/persistence.d.ts +191 -0
- package/dist/declarations/src/controller/regeneration.d.ts +30 -0
- package/dist/declarations/src/controller/source.d.ts +80 -0
- package/dist/declarations/src/controller/store.d.ts +27 -0
- package/dist/declarations/src/emit/common.d.ts +103 -0
- package/dist/declarations/src/emit/manifest.d.ts +138 -0
- package/dist/declarations/src/emit/source.d.ts +87 -0
- package/dist/declarations/src/lib/jsx-roots.d.ts +22 -0
- package/dist/declarations/src/lib/module-of-source.d.ts +18 -0
- package/dist/declarations/src/lib/naming.d.ts +29 -0
- package/dist/declarations/src/lib/react-spelling.d.ts +68 -0
- package/dist/declarations/src/lib/scenario-story.d.ts +41 -0
- package/dist/declarations/src/lib/slot-fill.d.ts +15 -0
- package/dist/declarations/src/lib/types.d.ts +741 -0
- package/dist/declarations/src/options.d.ts +224 -0
- package/dist/declarations/src/protocol.d.ts +541 -0
- package/dist/declarations/src/react-view.d.ts +22 -0
- package/dist/declarations/src/react.d.ts +17 -0
- package/dist/declarations/src/shell.d.ts +99 -0
- package/dist/declarations/src/views.d.ts +152 -0
- package/dist/development-server.d.ts +121 -0
- package/dist/development-server.js +331 -0
- package/dist/emit/common.d.ts +103 -0
- package/dist/emit/common.js +170 -0
- package/dist/emit/html-source.d.ts +46 -0
- package/dist/emit/html-source.js +322 -0
- package/dist/emit/manifest.d.ts +138 -0
- package/dist/emit/manifest.js +74 -0
- package/dist/emit/react.d.ts +16 -0
- package/dist/emit/react.js +210 -0
- package/dist/emit/scratch.d.ts +40 -0
- package/dist/emit/scratch.js +116 -0
- package/dist/emit/source.d.ts +87 -0
- package/dist/emit/source.js +789 -0
- package/dist/emit/svelte.d.ts +9 -0
- package/dist/emit/svelte.js +177 -0
- package/dist/emit/vue.d.ts +2 -0
- package/dist/emit/vue.js +152 -0
- package/dist/enumerate.d.ts +2 -0
- package/dist/enumerate.js +162 -0
- package/dist/generate.d.ts +43 -0
- package/dist/generate.js +302 -0
- package/dist/html-stylesheet.d.ts +43 -0
- package/dist/html-stylesheet.js +145 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +21 -0
- package/dist/landing.d.ts +16 -0
- package/dist/landing.js +45 -0
- package/dist/lib/exported-types.d.ts +42 -0
- package/dist/lib/exported-types.js +86 -0
- package/dist/lib/html-attributes.d.ts +2 -0
- package/dist/lib/html-attributes.js +111 -0
- package/dist/lib/html-warnings.d.ts +19 -0
- package/dist/lib/html-warnings.js +79 -0
- package/dist/lib/jsx-roots.d.ts +22 -0
- package/dist/lib/jsx-roots.js +243 -0
- package/dist/lib/module-of-source.d.ts +18 -0
- package/dist/lib/module-of-source.js +24 -0
- package/dist/lib/naming.d.ts +29 -0
- package/dist/lib/naming.js +56 -0
- package/dist/lib/parse-type.d.ts +32 -0
- package/dist/lib/parse-type.js +103 -0
- package/dist/lib/react-spelling.d.ts +68 -0
- package/dist/lib/react-spelling.js +197 -0
- package/dist/lib/scenario-story.d.ts +41 -0
- package/dist/lib/scenario-story.js +84 -0
- package/dist/lib/slot-fill.d.ts +15 -0
- package/dist/lib/slot-fill.js +92 -0
- package/dist/lib/template-files.d.ts +14 -0
- package/dist/lib/template-files.js +25 -0
- package/dist/lib/types.d.ts +741 -0
- package/dist/lib/types.js +13 -0
- package/dist/lib/void-elements.d.ts +7 -0
- package/dist/lib/void-elements.js +13 -0
- package/dist/load.d.ts +37 -0
- package/dist/load.js +82 -0
- package/dist/model.d.ts +44 -0
- package/dist/model.js +464 -0
- package/dist/options.d.ts +224 -0
- package/dist/options.js +223 -0
- package/dist/prop-types.d.ts +26 -0
- package/dist/prop-types.js +102 -0
- package/dist/props-from.d.ts +84 -0
- package/dist/props-from.js +510 -0
- package/dist/protocol.d.ts +541 -0
- package/dist/protocol.js +819 -0
- package/dist/react-view.d.ts +22 -0
- package/dist/react-view.js +36 -0
- package/dist/react.d.ts +17 -0
- package/dist/react.js +23 -0
- package/dist/sass-importers.d.ts +26 -0
- package/dist/sass-importers.js +32 -0
- package/dist/shell-acceptance.d.ts +21 -0
- package/dist/shell-acceptance.js +37 -0
- package/dist/shell-page.d.ts +36 -0
- package/dist/shell-page.js +90 -0
- package/dist/shell-peers.d.ts +38 -0
- package/dist/shell-peers.js +61 -0
- package/dist/shell.d.ts +99 -0
- package/dist/shell.js +52 -0
- package/dist/shells/charcell/page.d.ts +8 -0
- package/dist/shells/charcell/page.js +69 -0
- package/dist/story-source.d.ts +113 -0
- package/dist/story-source.js +271 -0
- package/dist/story.d.ts +5 -0
- package/dist/story.js +28 -0
- package/dist/testing.d.ts +218 -0
- package/dist/testing.js +284 -0
- package/dist/views.d.ts +152 -0
- package/dist/views.js +7 -0
- package/dist/vite-configuration.d.ts +114 -0
- package/dist/vite-configuration.js +578 -0
- package/package.json +123 -3
- package/src/build.ts +51 -0
- package/src/check.ts +1062 -0
- package/src/cli.ts +123 -0
- package/src/context.ts +1168 -0
- package/src/controller/catalog.ts +719 -0
- package/src/controller/create-preview-controller.ts +2683 -0
- package/src/controller/editor-tree.ts +530 -0
- package/src/controller/html-source.ts +114 -0
- package/src/controller/index.ts +105 -0
- package/src/controller/persistence.ts +403 -0
- package/src/controller/regeneration.ts +55 -0
- package/src/controller/source.ts +333 -0
- package/src/controller/store.ts +55 -0
- package/src/development-server.ts +442 -0
- package/src/emit/common.ts +201 -0
- package/src/emit/html-source.ts +402 -0
- package/src/emit/manifest.ts +241 -0
- package/src/emit/react.ts +263 -0
- package/src/emit/scratch.ts +175 -0
- package/src/emit/source.ts +1094 -0
- package/src/emit/svelte.ts +230 -0
- package/src/emit/vue.ts +194 -0
- package/src/enumerate.ts +220 -0
- package/src/generate.ts +443 -0
- package/src/html-stylesheet.ts +173 -0
- package/src/index.ts +60 -0
- package/src/landing.ts +58 -0
- package/src/lib/exported-types.ts +114 -0
- package/src/lib/html-attributes.ts +113 -0
- package/src/lib/html-warnings.ts +81 -0
- package/src/lib/jsx-roots.ts +238 -0
- package/src/lib/module-of-source.ts +26 -0
- package/src/lib/naming.ts +65 -0
- package/src/lib/parse-type.ts +143 -0
- package/src/lib/react-spelling.ts +235 -0
- package/src/lib/scenario-story.ts +97 -0
- package/src/lib/slot-fill.ts +102 -0
- package/src/lib/template-files.ts +31 -0
- package/src/lib/types.ts +778 -0
- package/src/lib/void-elements.ts +15 -0
- package/src/load.ts +144 -0
- package/src/model.ts +568 -0
- package/src/options.ts +435 -0
- package/src/prop-types.ts +133 -0
- package/src/props-from.ts +678 -0
- package/src/protocol.ts +1135 -0
- package/src/react-view.ts +45 -0
- package/src/react.ts +34 -0
- package/src/sass-importers.ts +45 -0
- package/src/shell-acceptance.ts +45 -0
- package/src/shell-page.ts +133 -0
- package/src/shell-peers.ts +70 -0
- package/src/shell.ts +194 -0
- package/src/shells/charcell/page.ts +82 -0
- package/src/story-source.ts +391 -0
- package/src/story.ts +42 -0
- package/src/testing.ts +497 -0
- package/src/views.ts +183 -0
- package/src/vite-configuration.ts +675 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// A story's source printed in the browser from the catalog: the code a
|
|
2
|
+
// consumer writes per target, importing from the kit's package entries,
|
|
3
|
+
// with the props a person sets and the slot content the story or the editor's
|
|
4
|
+
// tree holds. The printers are pure, so the source follows every change
|
|
5
|
+
// without a round trip; the html source, which renders the kit's templates,
|
|
6
|
+
// is the server's (html-source.ts). Browser-safe.
|
|
7
|
+
import { inDeclarationOrder, SOURCE_PRINTERS, } from '../emit/source.js';
|
|
8
|
+
import { collectSlotComponents } from '../lib/slot-fill.js';
|
|
9
|
+
import { moduleOfSource } from '../lib/module-of-source.js';
|
|
10
|
+
import { defaultScenarioId, } from './catalog.js';
|
|
11
|
+
import { cleanRecord, toPayload } from './editor-tree.js';
|
|
12
|
+
function withoutUndefined(props) {
|
|
13
|
+
const out = {};
|
|
14
|
+
for (const [name, value] of Object.entries(props))
|
|
15
|
+
if (value !== undefined)
|
|
16
|
+
out[name] = value;
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Whether a story's default-slot text is the component's name the preview
|
|
21
|
+
* shows in a default slot the story leaves unfilled, which a consumer never
|
|
22
|
+
* writes: the preview's own starting text, while the scenario does not give
|
|
23
|
+
* `children` itself.
|
|
24
|
+
*/
|
|
25
|
+
export function isPlaceholder(component, text, input) {
|
|
26
|
+
return (component.previewDefaults.children === text &&
|
|
27
|
+
!('children' in (input.scenario?.props ?? {})));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve what a story's source prints. Without a tree, the slot content is
|
|
31
|
+
* the story's own and a string `children` is its default-slot text; with the
|
|
32
|
+
* editor's tree, the root's props and content are the tree's. A prop is left
|
|
33
|
+
* out while it holds the component's declared default, or the preview's own
|
|
34
|
+
* starting value that the scenario does not set, as is the component's name
|
|
35
|
+
* the preview shows in a default slot the story leaves unfilled.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveSourceStory(component, input) {
|
|
38
|
+
let props;
|
|
39
|
+
let children;
|
|
40
|
+
let named;
|
|
41
|
+
if (input.tree) {
|
|
42
|
+
const payload = toPayload(input.tree);
|
|
43
|
+
const { children: _children, ...rootProps } = input.props;
|
|
44
|
+
props = cleanRecord(rootProps);
|
|
45
|
+
children = payload.slots?.default;
|
|
46
|
+
named = payload.slots?.named ?? {};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const { children: text, ...rest } = input.props;
|
|
50
|
+
props = withoutUndefined(rest);
|
|
51
|
+
// A scenario with content of its own shows that in place of the story's.
|
|
52
|
+
const content = input.scenario?.content ?? component.content;
|
|
53
|
+
children =
|
|
54
|
+
content?.default ??
|
|
55
|
+
(typeof text === 'string' && !isPlaceholder(component, text, input)
|
|
56
|
+
? { kind: 'text', value: text }
|
|
57
|
+
: undefined);
|
|
58
|
+
named = content?.named ?? {};
|
|
59
|
+
}
|
|
60
|
+
const declared = new Map(component.propTypes.map((propType) => [propType.name, propType]));
|
|
61
|
+
const scenarioProps = input.scenario?.props ?? {};
|
|
62
|
+
for (const [name, value] of Object.entries(props)) {
|
|
63
|
+
const declaredDefault = declared.get(name)?.declaredDefault;
|
|
64
|
+
const previewDefault = component.previewDefaults[name];
|
|
65
|
+
if ((declaredDefault !== undefined &&
|
|
66
|
+
JSON.stringify(declaredDefault) === JSON.stringify(value)) ||
|
|
67
|
+
(previewDefault !== undefined &&
|
|
68
|
+
!(name in scenarioProps) &&
|
|
69
|
+
JSON.stringify(previewDefault) === JSON.stringify(value)))
|
|
70
|
+
delete props[name];
|
|
71
|
+
}
|
|
72
|
+
props = inDeclarationOrder(props, component.propTypes.map((propType) => propType.name));
|
|
73
|
+
// A two-way prop the story gives is controlled: its source binds it.
|
|
74
|
+
const bindings = (component.bindings ?? [])
|
|
75
|
+
.filter((binding) => binding.prop in props)
|
|
76
|
+
.map((binding) => {
|
|
77
|
+
const declaredType = declared.get(binding.prop)?.declaredType;
|
|
78
|
+
return {
|
|
79
|
+
prop: binding.prop,
|
|
80
|
+
...(binding.changeProp !== undefined
|
|
81
|
+
? { changeProp: binding.changeProp }
|
|
82
|
+
: {}),
|
|
83
|
+
...(binding.defaultProp !== undefined
|
|
84
|
+
? { defaultProp: binding.defaultProp }
|
|
85
|
+
: {}),
|
|
86
|
+
...(binding.vueModel ? { vueModel: true } : {}),
|
|
87
|
+
...(binding.generic ? { generic: true } : {}),
|
|
88
|
+
...(declaredType !== undefined ? { declaredType } : {}),
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
// The content beside the component is the story's, with or without the
|
|
92
|
+
// editor's tree: no edit reaches it.
|
|
93
|
+
const around = component.around;
|
|
94
|
+
return {
|
|
95
|
+
component: component.name,
|
|
96
|
+
props,
|
|
97
|
+
...(children ? { children } : {}),
|
|
98
|
+
named,
|
|
99
|
+
...(around ? { around } : {}),
|
|
100
|
+
...(bindings.length > 0 ? { bindings } : {}),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/** The import of each component a story names, for one target: its root,
|
|
104
|
+
* then what its slot content holds, in order. */
|
|
105
|
+
function importsFor(catalog, story, target) {
|
|
106
|
+
const names = new Set();
|
|
107
|
+
collectSlotComponents(story.children, names);
|
|
108
|
+
for (const fill of [
|
|
109
|
+
...Object.values(story.named),
|
|
110
|
+
story.around?.before,
|
|
111
|
+
story.around?.after,
|
|
112
|
+
])
|
|
113
|
+
collectSlotComponents(fill, names);
|
|
114
|
+
const base = catalog.sources[0]?.moduleBase ?? catalog.kitName;
|
|
115
|
+
const imports = new Map();
|
|
116
|
+
for (const name of [story.component, ...names]) {
|
|
117
|
+
if (imports.has(name))
|
|
118
|
+
continue;
|
|
119
|
+
const known = catalog.imports[name];
|
|
120
|
+
imports.set(name, {
|
|
121
|
+
module: known?.modules[target] ?? moduleOfSource(base, target),
|
|
122
|
+
exported: known?.exportName ?? name,
|
|
123
|
+
...(known?.declaredAttributes
|
|
124
|
+
? { declaredAttributes: known.declaredAttributes }
|
|
125
|
+
: {}),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return imports;
|
|
129
|
+
}
|
|
130
|
+
/** The type names the kit's components' modules export, for one target,
|
|
131
|
+
* each with the module a consumer imports it from: the story's own
|
|
132
|
+
* component's, then the first other component's to export it. A name a
|
|
133
|
+
* component is imported under is a value, never a type here. */
|
|
134
|
+
function exportedTypesFor(catalog, target, component) {
|
|
135
|
+
const base = catalog.sources[0]?.moduleBase ?? catalog.kitName;
|
|
136
|
+
// A component's own name, or the name it is exported under, is a value.
|
|
137
|
+
const values = new Set(Object.entries(catalog.imports).flatMap(([name, known]) => [
|
|
138
|
+
name,
|
|
139
|
+
known.exportName,
|
|
140
|
+
]));
|
|
141
|
+
const types = new Map();
|
|
142
|
+
// The story's own component first, so its type wins a name another
|
|
143
|
+
// component's module exports too.
|
|
144
|
+
const own = catalog.imports[component];
|
|
145
|
+
const entries = [
|
|
146
|
+
...(own ? [own] : []),
|
|
147
|
+
...Object.entries(catalog.imports)
|
|
148
|
+
.filter(([name]) => name !== component)
|
|
149
|
+
.map(([, known]) => known),
|
|
150
|
+
];
|
|
151
|
+
for (const known of entries)
|
|
152
|
+
for (const type of known.types?.[target] ?? [])
|
|
153
|
+
if (!types.has(type) && !values.has(type))
|
|
154
|
+
types.set(type, known.modules[target] ?? moduleOfSource(base, target));
|
|
155
|
+
return types;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Print a resolved story in each of `targets`: a two-way prop it gives
|
|
159
|
+
* bound to state of the source's own, in the catalog's Svelte mode.
|
|
160
|
+
*
|
|
161
|
+
* @param catalog - The catalog the components' imports are read from.
|
|
162
|
+
* @param story - The story, resolved.
|
|
163
|
+
* @param targets - The targets to print.
|
|
164
|
+
* @returns The source per target.
|
|
165
|
+
*/
|
|
166
|
+
export function printSourceStory(catalog, story, targets) {
|
|
167
|
+
const sources = {};
|
|
168
|
+
for (const target of targets) {
|
|
169
|
+
sources[target] = SOURCE_PRINTERS[target]({
|
|
170
|
+
component: story.component,
|
|
171
|
+
props: story.props,
|
|
172
|
+
...(story.children ? { children: story.children } : {}),
|
|
173
|
+
named: story.named,
|
|
174
|
+
...(story.around ? { around: story.around } : {}),
|
|
175
|
+
imports: importsFor(catalog, story, target),
|
|
176
|
+
...(story.bindings ? { bindings: story.bindings } : {}),
|
|
177
|
+
...(catalog.svelteMode ? { svelteMode: catalog.svelteMode } : {}),
|
|
178
|
+
...(catalog.reactAttributeNames
|
|
179
|
+
? { reactAttributeNames: catalog.reactAttributeNames }
|
|
180
|
+
: {}),
|
|
181
|
+
exportedTypes: exportedTypesFor(catalog, target, story.component),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return sources;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Print any story of the catalog as the source a consumer writes, per
|
|
188
|
+
* target the component renders in: the component with the props of the
|
|
189
|
+
* scenario over its defaults and `props` over those, its slot content, and
|
|
190
|
+
* imports from the kit's package entry for each target. A prop is left
|
|
191
|
+
* out while it holds the component's declared default. It takes the story
|
|
192
|
+
* reference `frames.mountStory` takes, so a shell can show the code beside a
|
|
193
|
+
* detached pane. The html source is the preview's own (`state.code.html`)
|
|
194
|
+
* and is not printed here.
|
|
195
|
+
*
|
|
196
|
+
* @param catalog - The controller's catalog.
|
|
197
|
+
* @param story - The story: a component's id, a scenario (omitted, the one
|
|
198
|
+
* the story starts on; `''`, the anonymous default) and props over its own.
|
|
199
|
+
* @returns The source per target, in the component's targets.
|
|
200
|
+
* @throws When the component or the scenario is unknown.
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const { react } = printStorySource(controller.catalog, { component: 'components-button', scenario: 'ghost' });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export function printStorySource(catalog, story) {
|
|
207
|
+
const component = catalog.components.find((candidate) => candidate.id === story.component);
|
|
208
|
+
if (!component)
|
|
209
|
+
throw new Error(`The catalog has no component "${story.component}" to print.`);
|
|
210
|
+
const scenarioId = story.scenario ?? defaultScenarioId(component);
|
|
211
|
+
const scenario = component.scenarios.find((candidate) => candidate.id === scenarioId);
|
|
212
|
+
if (scenarioId !== '' && !scenario)
|
|
213
|
+
throw new Error(`The story "${component.id}" has no scenario "${scenarioId}".`);
|
|
214
|
+
const seeded = { ...component.defaultProps, ...(scenario?.props ?? {}) };
|
|
215
|
+
// The Empty scenario is the story's props with no slot content.
|
|
216
|
+
const props = {
|
|
217
|
+
...(scenario?.empty ? withoutChildren(seeded) : seeded),
|
|
218
|
+
...withoutUndefined(story.props ?? {}),
|
|
219
|
+
};
|
|
220
|
+
const resolved = scenario?.empty
|
|
221
|
+
? resolveSourceStory(component, {
|
|
222
|
+
props,
|
|
223
|
+
scenario,
|
|
224
|
+
tree: {
|
|
225
|
+
root: component.name,
|
|
226
|
+
props: withoutChildren(props),
|
|
227
|
+
slots: {},
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
: resolveSourceStory(component, { props, scenario });
|
|
231
|
+
return printSourceStory(catalog, resolved, component.targets);
|
|
232
|
+
}
|
|
233
|
+
function withoutChildren(props) {
|
|
234
|
+
const { children: _children, ...rest } = props;
|
|
235
|
+
return rest;
|
|
236
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PreviewController, PreviewState } from './create-preview-controller.js';
|
|
2
|
+
/** A readable store: `subscribe` calls `listener` with the current value
|
|
3
|
+
* immediately, then with each new value, until the returned function is called. */
|
|
4
|
+
export interface PreviewStore<Value> {
|
|
5
|
+
subscribe(listener: (value: Value) => void): () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A store of the controller's state, or of a slice of it. Each subscriber is
|
|
9
|
+
* called with the current slice when it subscribes, and again only when the
|
|
10
|
+
* slice changes by identity, so `selector` returns a field of the state (or a
|
|
11
|
+
* primitive derived from it) rather than a fresh object or array.
|
|
12
|
+
*
|
|
13
|
+
* @param controller - The controller to read.
|
|
14
|
+
* @param selector - Picks the slice; the whole state when omitted.
|
|
15
|
+
* @returns The store.
|
|
16
|
+
* @example
|
|
17
|
+
* ```svelte
|
|
18
|
+
* <script lang="ts">
|
|
19
|
+
* import { previewStore } from '@scaffold-ui-kit/preview/shell';
|
|
20
|
+
* const preview = previewStore(controller);
|
|
21
|
+
* const scenario = previewStore(controller, (state) => state.scenario);
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* <p>{$preview.selection.id}: {$scenario}</p>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function previewStore<Selected = PreviewState>(controller: Pick<PreviewController, 'getState' | 'subscribe'>, selector?: (state: PreviewState) => Selected): PreviewStore<Selected>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// A store view of the preview controller: an object with one `subscribe`
|
|
2
|
+
// method that calls its listener with the current value at once and again
|
|
3
|
+
// whenever the value changes. That is the Svelte store contract, so a Svelte
|
|
4
|
+
// shell reads it with `$store` or `fromStore`, and it suits any other
|
|
5
|
+
// store-shaped consumer. Framework-neutral and browser-safe.
|
|
6
|
+
/**
|
|
7
|
+
* A store of the controller's state, or of a slice of it. Each subscriber is
|
|
8
|
+
* called with the current slice when it subscribes, and again only when the
|
|
9
|
+
* slice changes by identity, so `selector` returns a field of the state (or a
|
|
10
|
+
* primitive derived from it) rather than a fresh object or array.
|
|
11
|
+
*
|
|
12
|
+
* @param controller - The controller to read.
|
|
13
|
+
* @param selector - Picks the slice; the whole state when omitted.
|
|
14
|
+
* @returns The store.
|
|
15
|
+
* @example
|
|
16
|
+
* ```svelte
|
|
17
|
+
* <script lang="ts">
|
|
18
|
+
* import { previewStore } from '@scaffold-ui-kit/preview/shell';
|
|
19
|
+
* const preview = previewStore(controller);
|
|
20
|
+
* const scenario = previewStore(controller, (state) => state.scenario);
|
|
21
|
+
* </script>
|
|
22
|
+
*
|
|
23
|
+
* <p>{$preview.selection.id}: {$scenario}</p>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function previewStore(controller, selector = (state) => state) {
|
|
27
|
+
return {
|
|
28
|
+
subscribe(listener) {
|
|
29
|
+
let current = selector(controller.getState());
|
|
30
|
+
listener(current);
|
|
31
|
+
return controller.subscribe((state) => {
|
|
32
|
+
const next = selector(state);
|
|
33
|
+
if (Object.is(next, current))
|
|
34
|
+
return;
|
|
35
|
+
current = next;
|
|
36
|
+
listener(next);
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
export declare function Bar({ variant, joined, unruled, flush, lead, end, children, }: {
|
|
4
|
+
variant?: 'header' | 'status';
|
|
5
|
+
joined?: boolean;
|
|
6
|
+
unruled?: boolean;
|
|
7
|
+
flush?: boolean;
|
|
8
|
+
lead?: ReactNode;
|
|
9
|
+
end?: ReactNode;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PreviewPropType } from '../../../../../src/shell';
|
|
2
|
+
import './index.css';
|
|
3
|
+
type Json = unknown;
|
|
4
|
+
export declare function Control(props: {
|
|
5
|
+
propType: PreviewPropType;
|
|
6
|
+
value: Json;
|
|
7
|
+
onChange: (nextValue: Json) => void;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CopyLink(): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
export declare function Hint({ text, markdown, triggerProps, around, focusable, label, children, }: {
|
|
4
|
+
text?: string;
|
|
5
|
+
markdown?: boolean;
|
|
6
|
+
triggerProps?: Record<string, unknown>;
|
|
7
|
+
around?: boolean;
|
|
8
|
+
focusable?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
children: (triggerProps: Record<string, unknown>) => ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
export declare function Navigation({ collapsed, onCollapsedChange, }: {
|
|
4
|
+
/** The keys of the collapsed groups. */
|
|
5
|
+
collapsed: ReadonlySet<string>;
|
|
6
|
+
/** Sets the keys as a group opens or collapses, as a state setter does. */
|
|
7
|
+
onCollapsedChange: Dispatch<SetStateAction<ReadonlySet<string>>>;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CharcellRegion } from '../../configuration';
|
|
2
|
+
export declare function OptionControls({ placement }: {
|
|
3
|
+
placement: CharcellRegion;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
/** Whether any option the current story offers is placed in a region - so a
|
|
6
|
+
* bar can leave out an empty zone. */
|
|
7
|
+
export declare function useHasOptionControls(placement: CharcellRegion): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PromptBar(): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SelectOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function Select(props: {
|
|
6
|
+
/** Omit for a bare trigger (no inline label), e.g. the editor's node pickers. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** A bare trigger's id, for a label of the caller's own to point at. */
|
|
9
|
+
id?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
/** Omit for a display-only select. */
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
/** Stamped on the trigger for tests to open the widget. */
|
|
15
|
+
testId?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
/** One of the stage's rows, as the split holds it. */
|
|
4
|
+
export interface StageRow {
|
|
5
|
+
id: 'scenario' | 'grid' | 'events';
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
shown: boolean;
|
|
8
|
+
/** The row's heading and controls, on the row above it; the scenario row
|
|
9
|
+
* heads itself. */
|
|
10
|
+
heading?: ReactNode;
|
|
11
|
+
controls?: ReactNode;
|
|
12
|
+
/** The handle above it, named for a reader. */
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function StageSplit({ rows }: {
|
|
16
|
+
rows: StageRow[];
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function StatusBar(): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CharcellView } from '../../configuration';
|
|
3
|
+
import './index.css';
|
|
4
|
+
export declare function ViewControls({ view, options: ownOptions, children, }: {
|
|
5
|
+
view: CharcellView;
|
|
6
|
+
/** The view's own options, shown after the kit's; omit when it has none. */
|
|
7
|
+
options?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function WrapToggle(): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PreviewController } from '../../../src/shell';
|
|
2
|
+
/** One of the stage's views, each headed by a row whose end holds its
|
|
3
|
+
* options, its slot and its own control. */
|
|
4
|
+
export type CharcellView = 'scenario' | 'output' | 'code' | 'events';
|
|
5
|
+
/** A region of the charcell shell an option group can be placed in: the top
|
|
6
|
+
* bar, the end of the stage bar (the bar with the component select), the
|
|
7
|
+
* end of a view's heading row, and the status bar. */
|
|
8
|
+
export type CharcellRegion = 'top-bar' | 'stage-bar' | CharcellView | 'status-bar';
|
|
9
|
+
/** A named slot of the charcell shell: the end of the top bar, the end of the
|
|
10
|
+
* stage bar, the end of a view's heading row, and the status bar. */
|
|
11
|
+
export type CharcellSlotName = 'top-bar-end' | 'stage-bar-end' | 'scenario-end' | 'output-end' | 'code-end' | 'events-end' | 'status-bar';
|
|
12
|
+
/**
|
|
13
|
+
* Content for a slot: mounts into `element` when the shell renders the slot
|
|
14
|
+
* and may return a function that unmounts it. Written in any framework or in
|
|
15
|
+
* plain DOM; `reactFill` wraps a React render function.
|
|
16
|
+
*/
|
|
17
|
+
export type CharcellSlotFill = (element: HTMLElement, controller: PreviewController) => (() => void) | void;
|
|
18
|
+
/** What `charcellShell` takes. */
|
|
19
|
+
export interface CharcellShellConfiguration {
|
|
20
|
+
/** Content for the shell's named slots. */
|
|
21
|
+
slots?: Partial<Record<CharcellSlotName, CharcellSlotFill>>;
|
|
22
|
+
/** Where each option group goes, by group name, over the shell's own
|
|
23
|
+
* placement: a story option, and a global option of the `context` group
|
|
24
|
+
* (or of none), in the output view's region; a global option of the `kit`
|
|
25
|
+
* group in the top bar, and of any other group in the status bar. */
|
|
26
|
+
groups?: Record<string, CharcellRegion>;
|
|
27
|
+
/** Which views hold their options in a popover at the end of
|
|
28
|
+
* their heading row, rather than in the row itself: the output's by
|
|
29
|
+
* default. */
|
|
30
|
+
popovers?: Partial<Record<CharcellView, boolean>>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PreviewController, PreviewState } from '../../../src/shell';
|
|
2
|
+
import type { CharcellShellConfiguration } from './configuration';
|
|
3
|
+
export declare const PreviewControllerContext: import("react").Context<PreviewController | null>;
|
|
4
|
+
export declare const ShellConfigurationContext: import("react").Context<CharcellShellConfiguration>;
|
|
5
|
+
export declare function usePreviewController(): PreviewController;
|
|
6
|
+
/** A slice of the controller's state, re-rendering when it changes. */
|
|
7
|
+
export declare function usePreviewState<Selected>(selector: (state: PreviewState) => Selected): Selected;
|
|
8
|
+
/** The slot fills and group placement the shell was made with. */
|
|
9
|
+
export declare function useShellConfiguration(): CharcellShellConfiguration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fit padded labels, side by side, into a number of cells. The last label
|
|
3
|
+
* gives way first: it loses a letter at a time behind an ellipsis, and once
|
|
4
|
+
* only a letter and the ellipsis would be left it goes, and the one before it
|
|
5
|
+
* starts giving way.
|
|
6
|
+
*
|
|
7
|
+
* @param labels - The labels, in their reading order.
|
|
8
|
+
* @param cells - The cells there are, or `undefined` before they are known.
|
|
9
|
+
* @returns The labels that fit, as they should read; empty if none does.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* fitLabels(['reload', 'open'], 14); // ['reload', 'open']
|
|
13
|
+
* fitLabels(['reload', 'open'], 11); // ['reload']
|
|
14
|
+
* fitLabels(['reload', 'open'], 8); // ['reload']
|
|
15
|
+
* fitLabels(['reload', 'open'], 3); // []
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function fitLabels(labels: readonly string[], cells: number | undefined): string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The count the html's warnings show as: `1 warning`, `2 warnings`. */
|
|
2
|
+
export declare function htmlWarningsLabel(warnings: readonly string[]): string;
|
|
3
|
+
/** The hint over the count, in markdown: what the html leaves out, then
|
|
4
|
+
* each warning as code on a line of its own. */
|
|
5
|
+
export declare function htmlWarningsHint(warnings: readonly string[]): string;
|