forgebook 0.1.8 → 0.2.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/README.md +875 -23
- package/dist/bin/forgebook/agentClient.d.ts +30 -1
- package/dist/bin/forgebook/agentClient.js +155 -14
- package/dist/bin/forgebook/agentLoopCommands.d.mts +0 -1
- package/dist/bin/forgebook/agentLoopCommands.mjs +161 -40
- package/dist/bin/forgebook/agentText.d.ts +74 -3
- package/dist/bin/forgebook/agentText.js +192 -8
- package/dist/bin/forgebook/agents.md +141 -7
- package/dist/bin/forgebook/agentsText.d.ts +7 -3
- package/dist/bin/forgebook/agentsText.js +7 -3
- package/dist/bin/forgebook/builtCatalogue.d.ts +31 -0
- package/dist/bin/forgebook/builtCatalogue.js +96 -0
- package/dist/bin/forgebook/catalogueCommands.d.ts +22 -3
- package/dist/bin/forgebook/catalogueCommands.js +21 -2
- package/dist/bin/forgebook/catalogueVite.d.ts +51 -9
- package/dist/bin/forgebook/catalogueVite.js +95 -9
- package/dist/bin/forgebook/checkCodeRun.d.ts +8 -0
- package/dist/bin/forgebook/checkCodeRun.js +27 -0
- package/dist/bin/forgebook/commandServer.d.ts +11 -0
- package/dist/bin/forgebook/commandServer.js +39 -0
- package/dist/bin/forgebook/compileCache.d.ts +7 -0
- package/dist/bin/forgebook/compileCache.js +24 -0
- package/dist/bin/forgebook/devCommands.d.mts +14 -0
- package/dist/bin/forgebook/devCommands.mjs +104 -0
- package/dist/bin/forgebook/errorsRun.d.ts +0 -1
- package/dist/bin/forgebook/errorsRun.js +0 -1
- package/dist/bin/forgebook/forgebook.d.mts +0 -1
- package/dist/bin/forgebook/forgebook.mjs +18 -302
- package/dist/bin/forgebook/forgebookCommands.d.mts +1 -0
- package/dist/bin/forgebook/forgebookCommands.mjs +292 -0
- package/dist/bin/forgebook/importers/storybook.d.ts +10 -4
- package/dist/bin/forgebook/importers/storybook.js +71 -45
- package/dist/bin/forgebook/importers/storybookAngular.d.ts +15 -0
- package/dist/bin/forgebook/importers/storybookAngular.js +97 -0
- package/dist/bin/forgebook/importers/storybookFrameworks.d.ts +53 -0
- package/dist/bin/forgebook/importers/storybookFrameworks.js +180 -0
- package/dist/bin/forgebook/importers/storybookReactNative.d.ts +40 -0
- package/dist/bin/forgebook/importers/storybookReactNative.js +179 -0
- package/dist/bin/forgebook/initCommands.d.mts +0 -1
- package/dist/bin/forgebook/initCommands.mjs +23 -12
- package/dist/bin/forgebook/initConfig.d.ts +0 -1
- package/dist/bin/forgebook/initConfig.js +17 -3
- package/dist/bin/forgebook/mcpCommand.d.mts +8 -0
- package/dist/bin/forgebook/mcpCommand.mjs +99 -0
- package/dist/bin/forgebook/mcpPreview.d.ts +32 -0
- package/dist/bin/forgebook/mcpPreview.js +107 -0
- package/dist/bin/forgebook/mcpToolParts.d.ts +28 -0
- package/dist/bin/forgebook/mcpToolParts.js +24 -0
- package/dist/bin/forgebook/mcpTools.d.ts +12 -6
- package/dist/bin/forgebook/mcpTools.js +148 -27
- package/dist/bin/forgebook/newStories.d.ts +2 -3
- package/dist/bin/forgebook/newStories.js +4 -3
- package/dist/bin/forgebook/newStoriesFile.d.ts +3 -4
- package/dist/bin/forgebook/newStoriesFile.js +23 -11
- package/dist/bin/forgebook/pageTools.d.ts +8 -0
- package/dist/bin/forgebook/pageTools.js +71 -0
- package/dist/bin/forgebook/pagesCommands.d.mts +14 -0
- package/dist/bin/forgebook/pagesCommands.mjs +109 -0
- package/dist/bin/forgebook/prebundleChild.d.ts +1 -0
- package/dist/bin/forgebook/prebundleChild.js +34 -0
- package/dist/bin/forgebook/prebundleRun.d.ts +22 -0
- package/dist/bin/forgebook/prebundleRun.js +49 -0
- package/dist/bin/forgebook/prebundleStart.d.ts +44 -0
- package/dist/bin/forgebook/prebundleStart.js +82 -0
- package/dist/bin/forgebook/semanticOptions.d.ts +45 -0
- package/dist/bin/forgebook/semanticOptions.js +36 -0
- package/dist/bin/forgebook/storyCheckCommands.d.mts +13 -0
- package/dist/bin/forgebook/storyCheckCommands.mjs +69 -0
- package/dist/bin/forgebook/storyCheckRun.d.ts +40 -6
- package/dist/bin/forgebook/storyCheckRun.js +90 -17
- package/dist/bin/forgebook/tokensRun.d.ts +41 -0
- package/dist/bin/forgebook/tokensRun.js +42 -0
- package/dist/bin/forgebook/touchWindowRun.d.ts +0 -1
- package/dist/bin/forgebook/touchWindowRun.js +0 -1
- package/dist/bin/forgebook/visualCommands.d.mts +37 -0
- package/dist/bin/forgebook/visualCommands.mjs +162 -0
- package/dist/bin/forgebook/viteCache.d.ts +48 -0
- package/dist/bin/forgebook/viteCache.js +112 -0
- package/dist/bin/forgebook-docs/catalogueDocs.d.ts +1 -2
- package/dist/bin/forgebook-docs/catalogueDocs.js +8 -5
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +22 -3
- package/dist/bin/forgebook-docs/catalogueDocs.types.js +0 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +0 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.js +67 -19
- package/dist/bin/forgebook-docs/catalogueOptions.d.ts +1 -2
- package/dist/bin/forgebook-docs/catalogueOptions.js +8 -2
- package/dist/bin/forgebook-docs/collectDocs.d.ts +4 -4
- package/dist/bin/forgebook-docs/collectDocs.js +122 -30
- package/dist/bin/forgebook-docs/forgebook-docs.d.mts +0 -1
- package/dist/bin/forgebook-docs/forgebook-docs.mjs +0 -1
- package/dist/bin/forgebook-docs/llmsText.d.ts +5 -1
- package/dist/bin/forgebook-docs/llmsText.js +5 -2
- package/dist/bin/forgebook-docs/moduleDocs.d.ts +0 -1
- package/dist/bin/forgebook-docs/moduleDocs.js +0 -1
- package/dist/bin/forgebook-docs/sassDocs.d.ts +0 -1
- package/dist/bin/forgebook-docs/sassDocs.js +0 -1
- package/dist/bin/forgebook-texts/forgebook-texts.d.mts +0 -1
- package/dist/bin/forgebook-texts/forgebook-texts.mjs +1 -2
- package/dist/bin/forgebook-texts/storyTextsReport.d.ts +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.js +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.types.js +0 -1
- package/dist/bin/frameworkDocs.d.ts +0 -1
- package/dist/bin/frameworkDocs.js +0 -1
- package/dist/src/a11y.d.ts +0 -1
- package/dist/src/a11y.js +0 -1
- package/dist/src/addressArgs.d.ts +74 -0
- package/dist/src/addressArgs.js +109 -0
- package/dist/src/addressTexts.d.ts +35 -0
- package/dist/src/addressTexts.js +51 -0
- package/dist/src/argTypes.d.ts +0 -1
- package/dist/src/argTypes.js +2 -2
- package/dist/src/audiences.d.ts +17 -0
- package/dist/src/audiences.js +15 -0
- package/dist/src/backdrops.d.ts +39 -40
- package/dist/src/backdrops.js +37 -174
- package/dist/src/catalogue.d.ts +56 -20
- package/dist/src/catalogue.js +33 -14
- package/dist/src/codeLiteral.d.ts +41 -0
- package/dist/src/codeLiteral.js +51 -0
- package/dist/src/componentDocs.d.ts +57 -1
- package/dist/src/componentDocs.js +20 -3
- package/dist/src/controlKeys.d.ts +0 -1
- package/dist/src/controlKeys.js +0 -1
- package/dist/src/deviceDrawing.d.ts +114 -0
- package/dist/src/deviceDrawing.js +358 -0
- package/dist/src/deviceMenuView.d.ts +17 -0
- package/dist/src/deviceMenuView.js +22 -0
- package/dist/src/devicePicture.d.ts +57 -0
- package/dist/src/devicePicture.js +104 -0
- package/dist/src/deviceView.d.ts +172 -0
- package/dist/src/deviceView.js +111 -0
- package/dist/src/devices.d.ts +115 -0
- package/dist/src/devices.js +135 -0
- package/dist/src/docAnchors.d.ts +27 -0
- package/dist/src/docAnchors.js +33 -0
- package/dist/src/docPages.d.ts +203 -0
- package/dist/src/docPages.js +169 -0
- package/dist/src/embed.d.ts +32 -0
- package/dist/src/embed.js +24 -0
- package/dist/src/embedCode.d.ts +31 -0
- package/dist/src/embedCode.js +88 -0
- package/dist/src/frame/backdropPictures.d.ts +29 -0
- package/dist/src/frame/backdropPictures.js +187 -0
- package/dist/src/frame/checkStory.d.ts +6 -3
- package/dist/src/frame/checkStory.js +76 -5
- package/dist/src/frame/followTouch.d.ts +9 -0
- package/dist/src/frame/followTouch.js +43 -0
- package/dist/src/frame/frame.css +8 -3
- package/dist/src/frame/frameClock.d.ts +0 -1
- package/dist/src/frame/frameClock.js +0 -1
- package/dist/src/frame/frameStatus.d.ts +2 -1
- package/dist/src/frame/frameStatus.js +2 -1
- package/dist/src/frame/frameView.d.ts +0 -1
- package/dist/src/frame/frameView.js +1 -2
- package/dist/src/frame/matrixLayout.d.ts +0 -1
- package/dist/src/frame/matrixLayout.js +0 -1
- package/dist/src/frame/measureTools.d.ts +0 -1
- package/dist/src/frame/measureTools.js +0 -1
- package/dist/src/frame/mountFrame.d.ts +10 -3
- package/dist/src/frame/mountFrame.js +162 -63
- package/dist/src/frame/playStory.d.ts +0 -1
- package/dist/src/frame/playStory.js +0 -1
- package/dist/src/frame/pluginFrames.d.ts +31 -0
- package/dist/src/frame/pluginFrames.js +23 -0
- package/dist/src/frame/renderer.d.ts +50 -12
- package/dist/src/frame/renderer.js +27 -6
- package/dist/src/frame/settle.d.ts +0 -1
- package/dist/src/frame/settle.js +0 -1
- package/dist/src/frame/shellChannel.d.ts +47 -0
- package/dist/src/frame/shellChannel.js +39 -0
- package/dist/src/frame/spillOutline.d.ts +0 -1
- package/dist/src/frame/spillOutline.js +0 -1
- package/dist/src/frame/staleModule.d.ts +14 -2
- package/dist/src/frame/staleModule.js +19 -2
- package/dist/src/frame/storyCanvas.d.ts +0 -1
- package/dist/src/frame/storyCanvas.js +0 -1
- package/dist/src/frame/storyHooks.d.ts +0 -1
- package/dist/src/frame/storyHooks.js +0 -1
- package/dist/src/frame/storyModule.d.ts +13 -2
- package/dist/src/frame/storyModule.js +45 -3
- package/dist/src/frame/storyRun.d.ts +21 -4
- package/dist/src/frame/storyRun.js +100 -19
- package/dist/src/frame/touchDots.d.ts +0 -1
- package/dist/src/frame/touchDots.js +0 -1
- package/dist/src/frame/touchEvents.d.ts +0 -1
- package/dist/src/frame/touchEvents.js +0 -1
- package/dist/src/frame/touchGesture.d.ts +0 -1
- package/dist/src/frame/touchGesture.js +0 -1
- package/dist/src/frame/touchLayer.d.ts +3 -3
- package/dist/src/frame/touchLayer.js +4 -30
- package/dist/src/frame/touchScroll.d.ts +0 -1
- package/dist/src/frame/touchScroll.js +0 -1
- package/dist/src/frameOrigins.d.ts +62 -0
- package/dist/src/frameOrigins.js +49 -0
- package/dist/src/hotModules.d.ts +48 -0
- package/dist/src/hotModules.js +53 -0
- package/dist/src/jsxCode.d.ts +22 -0
- package/dist/src/jsxCode.js +36 -0
- package/dist/src/languages.d.ts +0 -1
- package/dist/src/languages.js +0 -1
- package/dist/src/liveErrors.d.ts +0 -1
- package/dist/src/liveErrors.js +0 -1
- package/dist/src/matrix.d.ts +0 -1
- package/dist/src/matrix.js +0 -1
- package/dist/src/messages.d.ts +28 -2
- package/dist/src/messages.js +24 -3
- package/dist/src/namedValues.d.ts +11 -1
- package/dist/src/namedValues.js +25 -2
- package/dist/src/namedViews.d.ts +1 -13
- package/dist/src/namedViews.js +30 -7
- package/dist/src/packedText.d.ts +21 -0
- package/dist/src/packedText.js +36 -0
- package/dist/src/pageAddress.d.ts +26 -0
- package/dist/src/pageAddress.js +39 -0
- package/dist/src/pageConfig.d.ts +3 -1
- package/dist/src/pageConfig.js +0 -1
- package/dist/src/pageTree.d.ts +79 -0
- package/dist/src/pageTree.js +108 -0
- package/dist/src/playTrace.d.ts +0 -1
- package/dist/src/playTrace.js +0 -1
- package/dist/src/plugin.d.ts +230 -0
- package/dist/src/plugin.js +12 -0
- package/dist/src/pluginReact.d.ts +23 -0
- package/dist/src/pluginReact.js +24 -0
- package/dist/src/previewRelay.d.ts +40 -0
- package/dist/src/previewRelay.js +69 -0
- package/dist/src/previewTexts.d.ts +26 -0
- package/dist/src/previewTexts.js +33 -0
- package/dist/src/previewView.d.ts +31 -0
- package/dist/src/previewView.js +264 -0
- package/dist/src/propGroups.d.ts +46 -0
- package/dist/src/propGroups.js +59 -0
- package/dist/src/realTouch.d.ts +1 -2
- package/dist/src/realTouch.js +1 -2
- package/dist/src/safeAreaParameter.d.ts +42 -0
- package/dist/src/safeAreaParameter.js +50 -0
- package/dist/src/search.d.ts +154 -0
- package/dist/src/search.js +265 -0
- package/dist/src/searchIndex.d.ts +61 -0
- package/dist/src/searchIndex.js +55 -0
- package/dist/src/searchMarks.d.ts +29 -0
- package/dist/src/searchMarks.js +165 -0
- package/dist/src/searchMatch.d.ts +58 -0
- package/dist/src/searchMatch.js +127 -0
- package/dist/src/shell/A11yTab.d.ts +0 -7
- package/dist/src/shell/A11yTab.js +4 -15
- package/dist/src/shell/AnchorScroll.d.ts +25 -0
- package/dist/src/shell/AnchorScroll.js +10 -0
- package/dist/src/shell/ApiReference.d.ts +11 -4
- package/dist/src/shell/ApiReference.js +73 -19
- package/dist/src/shell/AppearanceMenu.d.ts +1 -2
- package/dist/src/shell/AppearanceMenu.js +8 -5
- package/dist/src/shell/AudienceSections.d.ts +106 -0
- package/dist/src/shell/AudienceSections.js +154 -0
- package/dist/src/shell/AuthoredHome.d.ts +37 -0
- package/dist/src/shell/AuthoredHome.js +96 -0
- package/dist/src/shell/BoxWidth.d.ts +0 -1
- package/dist/src/shell/BoxWidth.js +0 -1
- package/dist/src/shell/ClockBar.d.ts +19 -0
- package/dist/src/shell/ClockBar.js +15 -0
- package/dist/src/shell/ClockControls.d.ts +5 -9
- package/dist/src/shell/ClockControls.js +13 -16
- package/dist/src/shell/Code.d.ts +0 -1
- package/dist/src/shell/Code.js +0 -1
- package/dist/src/shell/CodeTab.d.ts +0 -1
- package/dist/src/shell/CodeTab.js +2 -2
- package/dist/src/shell/CodeText.d.ts +0 -1
- package/dist/src/shell/CodeText.js +0 -1
- package/dist/src/shell/CompareGrid.d.ts +37 -0
- package/dist/src/shell/CompareGrid.js +24 -0
- package/dist/src/shell/ComponentPage.d.ts +45 -7
- package/dist/src/shell/ComponentPage.js +105 -49
- package/dist/src/shell/ControlKeyField.d.ts +0 -1
- package/dist/src/shell/ControlKeyField.js +3 -4
- package/dist/src/shell/ControlRow.d.ts +4 -4
- package/dist/src/shell/ControlRow.js +5 -5
- package/dist/src/shell/DeviceControl.d.ts +31 -0
- package/dist/src/shell/DeviceControl.js +33 -0
- package/dist/src/shell/DeviceSlot.d.ts +114 -0
- package/dist/src/shell/DeviceSlot.js +134 -0
- package/dist/src/shell/DocBlocks.d.ts +100 -0
- package/dist/src/shell/DocBlocks.js +206 -0
- package/dist/src/shell/DocContainers.d.ts +70 -0
- package/dist/src/shell/DocContainers.js +94 -0
- package/dist/src/shell/DocContents.d.ts +29 -0
- package/dist/src/shell/DocContents.js +88 -0
- package/dist/src/shell/DocPage.d.ts +69 -0
- package/dist/src/shell/DocPage.js +141 -0
- package/dist/src/shell/Dock.d.ts +1 -2
- package/dist/src/shell/Dock.js +1 -2
- package/dist/src/shell/DroppedArgsList.d.ts +26 -0
- package/dist/src/shell/DroppedArgsList.js +8 -0
- package/dist/src/shell/DroppedArgsNote.d.ts +14 -0
- package/dist/src/shell/DroppedArgsNote.js +10 -0
- package/dist/src/shell/EmbedButton.d.ts +19 -0
- package/dist/src/shell/EmbedButton.js +96 -0
- package/dist/src/shell/EmbedPage.d.ts +23 -0
- package/dist/src/shell/EmbedPage.js +168 -0
- package/dist/src/shell/EmbedPanel.d.ts +25 -0
- package/dist/src/shell/EmbedPanel.js +46 -0
- package/dist/src/shell/EventsTab.d.ts +0 -1
- package/dist/src/shell/EventsTab.js +2 -3
- package/dist/src/shell/Example.d.ts +20 -2
- package/dist/src/shell/Example.js +75 -22
- package/dist/src/shell/FrameView.d.ts +1 -2
- package/dist/src/shell/FrameView.js +4 -4
- package/dist/src/shell/HomePage.d.ts +78 -4
- package/dist/src/shell/HomePage.js +53 -14
- package/dist/src/shell/HomePieces.d.ts +40 -0
- package/dist/src/shell/HomePieces.js +29 -0
- package/dist/src/shell/InfoTip.d.ts +0 -1
- package/dist/src/shell/InfoTip.js +0 -1
- package/dist/src/shell/InteractionsTab.d.ts +0 -7
- package/dist/src/shell/InteractionsTab.js +3 -9
- package/dist/src/shell/LazyHost.d.ts +16 -0
- package/dist/src/shell/LazyHost.js +42 -0
- package/dist/src/shell/LazyPage.d.ts +24 -0
- package/dist/src/shell/LazyPage.js +9 -0
- package/dist/src/shell/LogicMark.d.ts +0 -1
- package/dist/src/shell/LogicMark.js +0 -1
- package/dist/src/shell/MatrixPicker.d.ts +0 -1
- package/dist/src/shell/MatrixPicker.js +0 -1
- package/dist/src/shell/NamedViews.d.ts +0 -1
- package/dist/src/shell/NamedViews.js +4 -5
- package/dist/src/shell/PackageHtml.d.ts +0 -1
- package/dist/src/shell/PackageHtml.js +0 -1
- package/dist/src/shell/PartsTab.d.ts +0 -7
- package/dist/src/shell/PartsTab.js +3 -13
- package/dist/src/shell/PinnedControl.d.ts +0 -1
- package/dist/src/shell/PinnedControl.js +2 -2
- package/dist/src/shell/PluginBlockHost.d.ts +46 -0
- package/dist/src/shell/PluginBlockHost.js +39 -0
- package/dist/src/shell/PluginTabHost.d.ts +32 -0
- package/dist/src/shell/PluginTabHost.js +25 -0
- package/dist/src/shell/PluginViewHost.d.ts +37 -0
- package/dist/src/shell/PluginViewHost.js +89 -0
- package/dist/src/shell/PropFields.d.ts +0 -1
- package/dist/src/shell/PropFields.js +0 -1
- package/dist/src/shell/PropsTab.d.ts +11 -2
- package/dist/src/shell/PropsTab.js +31 -5
- package/dist/src/shell/SearchPanel.d.ts +63 -0
- package/dist/src/shell/SearchPanel.js +209 -0
- package/dist/src/shell/Segmented.d.ts +0 -1
- package/dist/src/shell/Segmented.js +0 -1
- package/dist/src/shell/Shell.d.ts +34 -6
- package/dist/src/shell/Shell.js +271 -70
- package/dist/src/shell/Sidebar.d.ts +20 -5
- package/dist/src/shell/Sidebar.js +23 -56
- package/dist/src/shell/SidebarDocs.d.ts +38 -0
- package/dist/src/shell/SidebarDocs.js +30 -0
- package/dist/src/shell/SidebarEntries.d.ts +9 -1
- package/dist/src/shell/SidebarEntries.js +1 -2
- package/dist/src/shell/SidebarHandle.d.ts +0 -1
- package/dist/src/shell/SidebarHandle.js +0 -1
- package/dist/src/shell/SidebarSearch.d.ts +40 -0
- package/dist/src/shell/SidebarSearch.js +85 -0
- package/dist/src/shell/SignatureReference.d.ts +0 -1
- package/dist/src/shell/SignatureReference.js +1 -2
- package/dist/src/shell/Stage.d.ts +9 -4
- package/dist/src/shell/Stage.js +112 -59
- package/dist/src/shell/StageCompare.d.ts +14 -0
- package/dist/src/shell/StageCompare.js +11 -0
- package/dist/src/shell/StageTools.d.ts +0 -1
- package/dist/src/shell/StageTools.js +0 -1
- package/dist/src/shell/StageViewport.d.ts +7 -3
- package/dist/src/shell/StageViewport.js +4 -5
- package/dist/src/shell/StoryBar.d.ts +40 -0
- package/dist/src/shell/StoryBar.js +23 -0
- package/dist/src/shell/StoryCodeBlock.d.ts +1 -2
- package/dist/src/shell/StoryCodeBlock.js +0 -1
- package/dist/src/shell/StoryCoverage.d.ts +36 -0
- package/dist/src/shell/StoryCoverage.js +126 -0
- package/dist/src/shell/StoryPicker.d.ts +0 -1
- package/dist/src/shell/StoryPicker.js +0 -1
- package/dist/src/shell/Toolbar.d.ts +7 -3
- package/dist/src/shell/Toolbar.js +6 -6
- package/dist/src/shell/ToolbarControl.d.ts +6 -8
- package/dist/src/shell/ToolbarControl.js +28 -20
- package/dist/src/shell/UsedIn.d.ts +5 -6
- package/dist/src/shell/UsedIn.js +7 -20
- package/dist/src/shell/ViewMenu.d.ts +7 -7
- package/dist/src/shell/ViewMenu.js +61 -176
- package/dist/src/shell/ViewMenuPanel.d.ts +41 -0
- package/dist/src/shell/ViewMenuPanel.js +199 -0
- package/dist/src/shell/WidthField.d.ts +3 -2
- package/dist/src/shell/WidthField.js +2 -3
- package/dist/src/shell/asideStory.d.ts +34 -0
- package/dist/src/shell/asideStory.js +55 -0
- package/dist/src/shell/audienceLayout.d.ts +39 -0
- package/dist/src/shell/audienceLayout.js +33 -0
- package/dist/src/shell/audiencePage.d.ts +113 -0
- package/dist/src/shell/audiencePage.js +144 -0
- package/dist/src/shell/audienceSections.css +95 -0
- package/dist/src/shell/catalogueContext.d.ts +24 -2
- package/dist/src/shell/catalogueContext.js +12 -9
- package/dist/src/shell/codeTokens.d.ts +0 -1
- package/dist/src/shell/codeTokens.js +0 -1
- package/dist/src/shell/codeWriter.d.ts +0 -1
- package/dist/src/shell/codeWriter.js +0 -1
- package/dist/src/shell/compareVariants.d.ts +0 -1
- package/dist/src/shell/compareVariants.js +2 -2
- package/dist/src/shell/controlCycle.d.ts +0 -1
- package/dist/src/shell/controlCycle.js +13 -1
- package/dist/src/shell/controlLabel.d.ts +7 -0
- package/dist/src/shell/controlLabel.js +17 -0
- package/dist/src/shell/device/deviceFrame.css +42 -0
- package/dist/src/shell/device/deviceParts.d.ts +90 -0
- package/dist/src/shell/device/deviceParts.js +120 -0
- package/dist/src/shell/docPage.css +451 -0
- package/dist/src/shell/dockTabs.d.ts +13 -5
- package/dist/src/shell/dockTabs.js +40 -18
- package/dist/src/shell/embed.css +74 -0
- package/dist/src/shell/filesCode.d.ts +21 -0
- package/dist/src/shell/filesCode.js +37 -0
- package/dist/src/shell/forgebookMark.d.ts +15 -0
- package/dist/src/shell/forgebookMark.js +28 -0
- package/dist/src/shell/framesOrigin.d.ts +23 -0
- package/dist/src/shell/framesOrigin.js +69 -0
- package/dist/src/shell/icons.d.ts +3 -1
- package/dist/src/shell/icons.js +3 -1
- package/dist/src/shell/keyboard.d.ts +0 -1
- package/dist/src/shell/keyboard.js +0 -1
- package/dist/src/shell/laterStrings.d.ts +91 -0
- package/dist/src/shell/laterStrings.js +102 -0
- package/dist/src/shell/lazyModule.d.ts +49 -0
- package/dist/src/shell/lazyModule.js +72 -0
- package/dist/src/shell/lazyTab.d.ts +21 -0
- package/dist/src/shell/lazyTab.js +9 -0
- package/dist/src/shell/logicView.d.ts +0 -12
- package/dist/src/shell/logicView.js +2 -2
- package/dist/src/shell/mountShell.d.ts +5 -3
- package/dist/src/shell/mountShell.js +43 -12
- package/dist/src/shell/pageStrings.d.ts +24 -0
- package/dist/src/shell/pageStrings.js +26 -0
- package/dist/src/shell/pluginHosts.d.ts +9 -0
- package/dist/src/shell/pluginHosts.js +6 -0
- package/dist/src/shell/pluginHostsContext.d.ts +20 -0
- package/dist/src/shell/pluginHostsContext.js +16 -0
- package/dist/src/shell/pluginTabs.d.ts +63 -0
- package/dist/src/shell/pluginTabs.js +60 -0
- package/dist/src/shell/search.css +172 -0
- package/dist/src/shell/searchStrings.d.ts +24 -0
- package/dist/src/shell/searchStrings.js +31 -0
- package/dist/src/shell/shell.css +285 -139
- package/dist/src/shell/shellScheme.d.ts +37 -0
- package/dist/src/shell/shellScheme.js +32 -0
- package/dist/src/shell/storyTouch.d.ts +19 -6
- package/dist/src/shell/storyTouch.js +26 -4
- package/dist/src/shell/strings.d.ts +56 -80
- package/dist/src/shell/strings.js +53 -78
- package/dist/src/shell/switchView.d.ts +0 -1
- package/dist/src/shell/switchView.js +0 -1
- package/dist/src/shell/tabSummaries.d.ts +31 -0
- package/dist/src/shell/tabSummaries.js +27 -0
- package/dist/src/shell/treeSearch.d.ts +39 -3
- package/dist/src/shell/treeSearch.js +27 -1
- package/dist/src/shell/useAddressArgs.d.ts +55 -0
- package/dist/src/shell/useAddressArgs.js +62 -0
- package/dist/src/shell/useAnchorScroll.d.ts +24 -0
- package/dist/src/shell/useAnchorScroll.js +90 -0
- package/dist/src/shell/useAppearance.d.ts +7 -2
- package/dist/src/shell/useAppearance.js +14 -5
- package/dist/src/shell/useComponentDocs.d.ts +0 -1
- package/dist/src/shell/useComponentDocs.js +0 -1
- package/dist/src/shell/useControlKeys.d.ts +2 -1
- package/dist/src/shell/useControlKeys.js +2 -3
- package/dist/src/shell/useCopy.d.ts +2 -1
- package/dist/src/shell/useCopy.js +11 -6
- package/dist/src/shell/useFold.d.ts +0 -1
- package/dist/src/shell/useFold.js +0 -1
- package/dist/src/shell/useFrameMessages.d.ts +19 -4
- package/dist/src/shell/useFrameMessages.js +23 -7
- package/dist/src/shell/useFrameQueue.d.ts +7 -3
- package/dist/src/shell/useFrameQueue.js +39 -22
- package/dist/src/shell/useFullPage.d.ts +0 -1
- package/dist/src/shell/useFullPage.js +0 -1
- package/dist/src/shell/useLiveView.d.ts +0 -1
- package/dist/src/shell/useLiveView.js +0 -1
- package/dist/src/shell/useLoaded.d.ts +1 -2
- package/dist/src/shell/useLoaded.js +28 -6
- package/dist/src/shell/usePageDoc.d.ts +0 -1
- package/dist/src/shell/usePageDoc.js +0 -1
- package/dist/src/shell/usePageFrames.d.ts +46 -0
- package/dist/src/shell/usePageFrames.js +50 -0
- package/dist/src/shell/usePluginTabs.d.ts +18 -0
- package/dist/src/shell/usePluginTabs.js +45 -0
- package/dist/src/shell/usePopover.d.ts +0 -1
- package/dist/src/shell/usePopover.js +0 -1
- package/dist/src/shell/useProseLinks.d.ts +14 -0
- package/dist/src/shell/useProseLinks.js +30 -0
- package/dist/src/shell/useRecentPages.d.ts +3 -4
- package/dist/src/shell/useRecentPages.js +1 -2
- package/dist/src/shell/useScrollMemory.d.ts +9 -1
- package/dist/src/shell/useScrollMemory.js +2 -3
- package/dist/src/shell/useSearchIndex.d.ts +24 -0
- package/dist/src/shell/useSearchIndex.js +51 -0
- package/dist/src/shell/useShownView.d.ts +3 -1
- package/dist/src/shell/useShownView.js +5 -5
- package/dist/src/shell/useSidebarLayout.d.ts +0 -1
- package/dist/src/shell/useSidebarLayout.js +0 -1
- package/dist/src/shell/useStored.d.ts +13 -1
- package/dist/src/shell/useStored.js +13 -5
- package/dist/src/shell/useStoryCheck.d.ts +20 -0
- package/dist/src/shell/useStoryCheck.js +33 -0
- package/dist/src/shell/useStoryCode.d.ts +0 -1
- package/dist/src/shell/useStoryCode.js +0 -1
- package/dist/src/shell/useStoryHeights.d.ts +0 -1
- package/dist/src/shell/useStoryHeights.js +0 -1
- package/dist/src/shell/useStoryIdsElement.d.ts +0 -1
- package/dist/src/shell/useStoryIdsElement.js +0 -1
- package/dist/src/shell/useStoryKeys.d.ts +0 -1
- package/dist/src/shell/useStoryKeys.js +0 -1
- package/dist/src/shell/useSyncedTab.d.ts +8 -0
- package/dist/src/shell/useSyncedTab.js +60 -0
- package/dist/src/shell/useSystemDark.d.ts +0 -1
- package/dist/src/shell/useSystemDark.js +0 -1
- package/dist/src/shell/useToolbarLayout.d.ts +0 -1
- package/dist/src/shell/useToolbarLayout.js +0 -1
- package/dist/src/shell/useToolbarOverflow.d.ts +0 -1
- package/dist/src/shell/useToolbarOverflow.js +0 -1
- package/dist/src/shell/useWorstCase.d.ts +0 -1
- package/dist/src/shell/useWorstCase.js +2 -2
- package/dist/src/shell/worstArgs.d.ts +0 -1
- package/dist/src/shell/worstArgs.js +0 -1
- package/dist/src/shellTheme.d.ts +64 -0
- package/dist/src/shellTheme.js +274 -0
- package/dist/src/shellTheme.types.d.ts +93 -0
- package/dist/src/shellTheme.types.js +10 -0
- package/dist/src/sourceFiles.d.ts +17 -3
- package/dist/src/sourceFiles.js +27 -1
- package/dist/src/spills.d.ts +0 -1
- package/dist/src/spills.js +0 -1
- package/dist/src/storyBackground.d.ts +0 -1
- package/dist/src/storyBackground.js +0 -1
- package/dist/src/storyCheck.d.ts +86 -2
- package/dist/src/storyCheck.js +12 -2
- package/dist/src/storyClock.d.ts +0 -1
- package/dist/src/storyClock.js +0 -1
- package/dist/src/storyGlobals.d.ts +0 -1
- package/dist/src/storyGlobals.js +0 -1
- package/dist/src/storyHeights.d.ts +0 -1
- package/dist/src/storyHeights.js +0 -1
- package/dist/src/storyIds.d.ts +36 -0
- package/dist/src/storyIds.js +52 -0
- package/dist/src/storyIdsElement.d.ts +0 -1
- package/dist/src/storyIdsElement.js +0 -1
- package/dist/src/storyTexts.d.ts +11 -5
- package/dist/src/storyTexts.js +16 -5
- package/dist/src/storyTree.d.ts +79 -25
- package/dist/src/storyTree.js +211 -127
- package/dist/src/switches.d.ts +0 -1
- package/dist/src/switches.js +6 -2
- package/dist/src/toolbarLayout.d.ts +0 -1
- package/dist/src/toolbarLayout.js +0 -1
- package/dist/src/treePlaces.d.ts +60 -0
- package/dist/src/treePlaces.js +89 -0
- package/dist/src/usedIn.d.ts +28 -1
- package/dist/src/usedIn.js +93 -3
- package/dist/src/viewState.d.ts +37 -9
- package/dist/src/viewState.js +67 -9
- package/dist/src/viewWords.d.ts +0 -13
- package/dist/src/viewWords.js +41 -3
- package/dist/src/vite/adapter.d.ts +62 -1
- package/dist/src/vite/adapter.js +20 -2
- package/dist/src/vite/agent.types.d.ts +279 -7
- package/dist/src/vite/agent.types.js +11 -1
- package/dist/src/vite/agentApi.d.ts +55 -2
- package/dist/src/vite/agentApi.js +130 -8
- package/dist/src/vite/agentIds.d.ts +25 -0
- package/dist/src/vite/agentIds.js +41 -0
- package/dist/src/vite/agentIndex.d.ts +63 -0
- package/dist/src/vite/agentIndex.js +91 -0
- package/dist/src/vite/agentIndexRoute.d.ts +10 -0
- package/dist/src/vite/agentIndexRoute.js +35 -0
- package/dist/src/vite/agentRoutes.d.ts +80 -19
- package/dist/src/vite/agentRoutes.js +167 -24
- package/dist/src/vite/autoTitle.d.ts +0 -1
- package/dist/src/vite/autoTitle.js +0 -1
- package/dist/src/vite/axeScript.d.ts +20 -0
- package/dist/src/vite/axeScript.js +60 -0
- package/dist/src/vite/builtTexts.d.ts +75 -0
- package/dist/src/vite/builtTexts.js +142 -0
- package/dist/src/vite/catalogueConfig.d.ts +10 -0
- package/dist/src/vite/catalogueConfig.js +64 -0
- package/dist/src/vite/checkCode.d.ts +67 -0
- package/dist/src/vite/checkCode.js +145 -0
- package/dist/src/vite/closeWatch.d.ts +96 -0
- package/dist/src/vite/closeWatch.js +219 -0
- package/dist/src/vite/codeFence.d.ts +78 -0
- package/dist/src/vite/codeFence.js +267 -0
- package/dist/src/vite/componentImport.d.ts +8 -0
- package/dist/src/vite/componentImport.js +35 -0
- package/dist/src/vite/componentPage.d.ts +15 -2
- package/dist/src/vite/componentPage.js +55 -16
- package/dist/src/vite/config.d.ts +51 -3
- package/dist/src/vite/config.js +0 -1
- package/dist/src/vite/configFile.d.ts +65 -9
- package/dist/src/vite/configFile.js +182 -28
- package/dist/src/vite/designTokens.d.ts +75 -0
- package/dist/src/vite/designTokens.js +382 -0
- package/dist/src/vite/diskCache.d.ts +51 -0
- package/dist/src/vite/diskCache.js +211 -0
- package/dist/src/vite/docDirectives.d.ts +116 -0
- package/dist/src/vite/docDirectives.js +425 -0
- package/dist/src/vite/docMarkdown.d.ts +76 -0
- package/dist/src/vite/docMarkdown.js +150 -0
- package/dist/src/vite/docPageBlocks.d.ts +64 -0
- package/dist/src/vite/docPageBlocks.js +322 -0
- package/dist/src/vite/docPageLinks.d.ts +72 -0
- package/dist/src/vite/docPageLinks.js +135 -0
- package/dist/src/vite/docPageMarkdown.d.ts +86 -0
- package/dist/src/vite/docPageMarkdown.js +133 -0
- package/dist/src/vite/docPageRender.d.ts +27 -0
- package/dist/src/vite/docPageRender.js +199 -0
- package/dist/src/vite/docPageTokens.d.ts +91 -0
- package/dist/src/vite/docPageTokens.js +186 -0
- package/dist/src/vite/docPagesModule.d.ts +50 -0
- package/dist/src/vite/docPagesModule.js +118 -0
- package/dist/src/vite/docPagesRoute.d.ts +38 -0
- package/dist/src/vite/docPagesRoute.js +154 -0
- package/dist/src/vite/docsDependencies.d.ts +6 -0
- package/dist/src/vite/docsDependencies.js +150 -0
- package/dist/src/vite/docsExtractor.d.ts +44 -3
- package/dist/src/vite/docsExtractor.js +160 -26
- package/dist/src/vite/docsProgram.d.ts +89 -9
- package/dist/src/vite/docsProgram.js +413 -50
- package/dist/src/vite/docsWorker.d.ts +0 -1
- package/dist/src/vite/docsWorker.js +49 -15
- package/dist/src/vite/figmaLink.d.ts +26 -0
- package/dist/src/vite/figmaLink.js +92 -0
- package/dist/src/vite/findComponent.d.ts +32 -0
- package/dist/src/vite/findComponent.js +52 -0
- package/dist/src/vite/findRoute.d.ts +14 -0
- package/dist/src/vite/findRoute.js +62 -0
- package/dist/src/vite/forcedStates.d.ts +0 -1
- package/dist/src/vite/forcedStates.js +0 -1
- package/dist/src/vite/forgebookPlugin.d.ts +1 -2
- package/dist/src/vite/forgebookPlugin.js +321 -263
- package/dist/src/vite/framesConfig.d.ts +89 -0
- package/dist/src/vite/framesConfig.js +149 -0
- package/dist/src/vite/framesServer.d.ts +43 -0
- package/dist/src/vite/framesServer.js +326 -0
- package/dist/src/vite/functionComponentDocs.d.ts +26 -0
- package/dist/src/vite/functionComponentDocs.js +193 -0
- package/dist/src/vite/gitChange.d.ts +56 -0
- package/dist/src/vite/gitChange.js +86 -0
- package/dist/src/vite/heightsRoute.d.ts +0 -1
- package/dist/src/vite/heightsRoute.js +0 -1
- package/dist/src/vite/highlightCode.d.ts +0 -1
- package/dist/src/vite/highlightCode.js +8 -27
- package/dist/src/vite/hotSnippets.d.ts +86 -0
- package/dist/src/vite/hotSnippets.js +168 -0
- package/dist/src/vite/indexFields.d.ts +61 -0
- package/dist/src/vite/indexFields.js +149 -0
- package/dist/src/vite/indexStoryFile.d.ts +19 -18
- package/dist/src/vite/indexStoryFile.js +165 -221
- package/dist/src/vite/indexedParameters.d.ts +10 -0
- package/dist/src/vite/indexedParameters.js +110 -0
- package/dist/src/vite/mcpProtocol.d.ts +36 -2
- package/dist/src/vite/mcpProtocol.js +100 -15
- package/dist/src/vite/moduleSummary.d.ts +17 -0
- package/dist/src/vite/moduleSummary.js +40 -0
- package/dist/src/vite/nearestToken.d.ts +50 -0
- package/dist/src/vite/nearestToken.js +295 -0
- package/dist/src/vite/originGuard.d.ts +87 -0
- package/dist/src/vite/originGuard.js +163 -0
- package/dist/src/vite/packedModule.d.ts +40 -0
- package/dist/src/vite/packedModule.js +74 -0
- package/dist/src/vite/pages.d.ts +63 -10
- package/dist/src/vite/pages.js +264 -33
- package/dist/src/vite/parsedFiles.d.ts +18 -0
- package/dist/src/vite/parsedFiles.js +91 -0
- package/dist/src/vite/plainGrammars.d.ts +20 -0
- package/dist/src/vite/plainGrammars.js +113 -0
- package/dist/src/vite/pluginConfig.d.ts +47 -0
- package/dist/src/vite/pluginConfig.js +220 -0
- package/dist/src/vite/pluginIds.d.ts +20 -0
- package/dist/src/vite/pluginIds.js +61 -0
- package/dist/src/vite/pluginModules.d.ts +140 -0
- package/dist/src/vite/pluginModules.js +176 -0
- package/dist/src/vite/prebundled.d.ts +18 -5
- package/dist/src/vite/prebundled.js +28 -18
- package/dist/src/vite/previewPages.d.ts +14 -0
- package/dist/src/vite/previewPages.js +81 -0
- package/dist/src/vite/previewRoute.d.ts +8 -0
- package/dist/src/vite/previewRoute.js +8 -0
- package/dist/src/vite/previewRunner.d.ts +56 -0
- package/dist/src/vite/previewRunner.js +207 -0
- package/dist/src/vite/propDocs.d.ts +60 -0
- package/dist/src/vite/propDocs.js +387 -0
- package/dist/src/vite/searchModule.d.ts +40 -0
- package/dist/src/vite/searchModule.js +212 -0
- package/dist/src/vite/searchRoute.d.ts +7 -0
- package/dist/src/vite/searchRoute.js +79 -0
- package/dist/src/vite/serverConditions.d.ts +31 -0
- package/dist/src/vite/serverConditions.js +69 -0
- package/dist/src/vite/signatureDocs.d.ts +18 -0
- package/dist/src/vite/signatureDocs.js +64 -0
- package/dist/src/vite/sourceTokens.d.ts +57 -0
- package/dist/src/vite/sourceTokens.js +164 -0
- package/dist/src/vite/storyCode.d.ts +0 -1
- package/dist/src/vite/storyCode.js +2 -3
- package/dist/src/vite/storyExports.d.ts +32 -0
- package/dist/src/vite/storyExports.js +27 -0
- package/dist/src/vite/storyFilesModule.d.ts +56 -4
- package/dist/src/vite/storyFilesModule.js +122 -34
- package/dist/src/vite/storyMeta.d.ts +20 -11
- package/dist/src/vite/storyMeta.js +74 -38
- package/dist/src/vite/storyParse.d.ts +18 -0
- package/dist/src/vite/storyParse.js +20 -0
- package/dist/src/vite/storyPlay.d.ts +29 -0
- package/dist/src/vite/storyPlay.js +54 -0
- package/dist/src/vite/storyReach.d.ts +42 -0
- package/dist/src/vite/storyReach.js +43 -0
- package/dist/src/vite/storylessRoutes.d.ts +29 -0
- package/dist/src/vite/storylessRoutes.js +126 -0
- package/dist/src/vite/textModules.d.ts +63 -0
- package/dist/src/vite/textModules.js +132 -0
- package/dist/src/vite/textQueries.d.ts +20 -0
- package/dist/src/vite/textQueries.js +20 -0
- package/dist/src/vite/themeFromTokens.d.ts +35 -0
- package/dist/src/vite/themeFromTokens.js +73 -0
- package/dist/src/vite/tokenAnswers.d.ts +20 -0
- package/dist/src/vite/tokenAnswers.js +86 -0
- package/dist/src/vite/tokenClashes.d.ts +44 -0
- package/dist/src/vite/tokenClashes.js +45 -0
- package/dist/src/vite/touchMedia.d.ts +0 -1
- package/dist/src/vite/touchMedia.js +0 -1
- package/dist/src/vite/typeScriptPieces.d.ts +0 -1
- package/dist/src/vite/typeScriptPieces.js +2 -3
- package/dist/src/vite/usageGraph.d.ts +6 -1
- package/dist/src/vite/usageGraph.js +41 -7
- package/dist/src/vite/usageGuidance.d.ts +33 -0
- package/dist/src/vite/usageGuidance.js +45 -0
- package/dist/src/vite/usageModule.d.ts +0 -1
- package/dist/src/vite/usageModule.js +0 -1
- package/dist/src/vite/vitePaths.d.ts +53 -0
- package/dist/src/vite/vitePaths.js +53 -0
- package/dist/src/worstCase.d.ts +0 -1
- package/dist/src/worstCase.js +0 -1
- package/package.json +68 -5
- package/dist/bin/forgebook/agentClient.d.ts.map +0 -1
- package/dist/bin/forgebook/agentClient.js.map +0 -1
- package/dist/bin/forgebook/agentLoopCommands.d.mts.map +0 -1
- package/dist/bin/forgebook/agentLoopCommands.mjs.map +0 -1
- package/dist/bin/forgebook/agentText.d.ts.map +0 -1
- package/dist/bin/forgebook/agentText.js.map +0 -1
- package/dist/bin/forgebook/agentsText.d.ts.map +0 -1
- package/dist/bin/forgebook/agentsText.js.map +0 -1
- package/dist/bin/forgebook/catalogueCommands.d.ts.map +0 -1
- package/dist/bin/forgebook/catalogueCommands.js.map +0 -1
- package/dist/bin/forgebook/catalogueVite.d.ts.map +0 -1
- package/dist/bin/forgebook/catalogueVite.js.map +0 -1
- package/dist/bin/forgebook/errorsRun.d.ts.map +0 -1
- package/dist/bin/forgebook/errorsRun.js.map +0 -1
- package/dist/bin/forgebook/forgebook.d.mts.map +0 -1
- package/dist/bin/forgebook/forgebook.mjs.map +0 -1
- package/dist/bin/forgebook/importers/storybook.d.ts.map +0 -1
- package/dist/bin/forgebook/importers/storybook.js.map +0 -1
- package/dist/bin/forgebook/initCommands.d.mts.map +0 -1
- package/dist/bin/forgebook/initCommands.mjs.map +0 -1
- package/dist/bin/forgebook/initConfig.d.ts.map +0 -1
- package/dist/bin/forgebook/initConfig.js.map +0 -1
- package/dist/bin/forgebook/mcpTools.d.ts.map +0 -1
- package/dist/bin/forgebook/mcpTools.js.map +0 -1
- package/dist/bin/forgebook/newStories.d.ts.map +0 -1
- package/dist/bin/forgebook/newStories.js.map +0 -1
- package/dist/bin/forgebook/newStoriesFile.d.ts.map +0 -1
- package/dist/bin/forgebook/newStoriesFile.js.map +0 -1
- package/dist/bin/forgebook/storyCheckRun.d.ts.map +0 -1
- package/dist/bin/forgebook/storyCheckRun.js.map +0 -1
- package/dist/bin/forgebook/touchWindowRun.d.ts.map +0 -1
- package/dist/bin/forgebook/touchWindowRun.js.map +0 -1
- package/dist/bin/forgebook-docs/catalogueDocs.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/catalogueDocs.js.map +0 -1
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/catalogueDocs.types.js.map +0 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +0 -1
- package/dist/bin/forgebook-docs/catalogueOptions.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/catalogueOptions.js.map +0 -1
- package/dist/bin/forgebook-docs/collectDocs.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/collectDocs.js.map +0 -1
- package/dist/bin/forgebook-docs/forgebook-docs.d.mts.map +0 -1
- package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +0 -1
- package/dist/bin/forgebook-docs/llmsText.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/llmsText.js.map +0 -1
- package/dist/bin/forgebook-docs/moduleDocs.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/moduleDocs.js.map +0 -1
- package/dist/bin/forgebook-docs/sassDocs.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/sassDocs.js.map +0 -1
- package/dist/bin/forgebook-docs/sourceId.d.ts +0 -9
- package/dist/bin/forgebook-docs/sourceId.d.ts.map +0 -1
- package/dist/bin/forgebook-docs/sourceId.js +0 -45
- package/dist/bin/forgebook-docs/sourceId.js.map +0 -1
- package/dist/bin/forgebook-texts/forgebook-texts.d.mts.map +0 -1
- package/dist/bin/forgebook-texts/forgebook-texts.mjs.map +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.d.ts.map +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.js.map +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts.map +0 -1
- package/dist/bin/forgebook-texts/storyTextsReport.types.js.map +0 -1
- package/dist/bin/frameworkDocs.d.ts.map +0 -1
- package/dist/bin/frameworkDocs.js.map +0 -1
- package/dist/src/a11y.d.ts.map +0 -1
- package/dist/src/a11y.js.map +0 -1
- package/dist/src/argTypes.d.ts.map +0 -1
- package/dist/src/argTypes.js.map +0 -1
- package/dist/src/backdrops.d.ts.map +0 -1
- package/dist/src/backdrops.js.map +0 -1
- package/dist/src/catalogue.d.ts.map +0 -1
- package/dist/src/catalogue.js.map +0 -1
- package/dist/src/componentDocs.d.ts.map +0 -1
- package/dist/src/componentDocs.js.map +0 -1
- package/dist/src/controlKeys.d.ts.map +0 -1
- package/dist/src/controlKeys.js.map +0 -1
- package/dist/src/frame/checkStory.d.ts.map +0 -1
- package/dist/src/frame/checkStory.js.map +0 -1
- package/dist/src/frame/frameClock.d.ts.map +0 -1
- package/dist/src/frame/frameClock.js.map +0 -1
- package/dist/src/frame/frameStatus.d.ts.map +0 -1
- package/dist/src/frame/frameStatus.js.map +0 -1
- package/dist/src/frame/frameView.d.ts.map +0 -1
- package/dist/src/frame/frameView.js.map +0 -1
- package/dist/src/frame/matrixLayout.d.ts.map +0 -1
- package/dist/src/frame/matrixLayout.js.map +0 -1
- package/dist/src/frame/measureTools.d.ts.map +0 -1
- package/dist/src/frame/measureTools.js.map +0 -1
- package/dist/src/frame/mountFrame.d.ts.map +0 -1
- package/dist/src/frame/mountFrame.js.map +0 -1
- package/dist/src/frame/playStory.d.ts.map +0 -1
- package/dist/src/frame/playStory.js.map +0 -1
- package/dist/src/frame/renderer.d.ts.map +0 -1
- package/dist/src/frame/renderer.js.map +0 -1
- package/dist/src/frame/settle.d.ts.map +0 -1
- package/dist/src/frame/settle.js.map +0 -1
- package/dist/src/frame/spillOutline.d.ts.map +0 -1
- package/dist/src/frame/spillOutline.js.map +0 -1
- package/dist/src/frame/staleModule.d.ts.map +0 -1
- package/dist/src/frame/staleModule.js.map +0 -1
- package/dist/src/frame/storyCanvas.d.ts.map +0 -1
- package/dist/src/frame/storyCanvas.js.map +0 -1
- package/dist/src/frame/storyHooks.d.ts.map +0 -1
- package/dist/src/frame/storyHooks.js.map +0 -1
- package/dist/src/frame/storyModule.d.ts.map +0 -1
- package/dist/src/frame/storyModule.js.map +0 -1
- package/dist/src/frame/storyRun.d.ts.map +0 -1
- package/dist/src/frame/storyRun.js.map +0 -1
- package/dist/src/frame/touchDots.d.ts.map +0 -1
- package/dist/src/frame/touchDots.js.map +0 -1
- package/dist/src/frame/touchEvents.d.ts.map +0 -1
- package/dist/src/frame/touchEvents.js.map +0 -1
- package/dist/src/frame/touchGesture.d.ts.map +0 -1
- package/dist/src/frame/touchGesture.js.map +0 -1
- package/dist/src/frame/touchLayer.d.ts.map +0 -1
- package/dist/src/frame/touchLayer.js.map +0 -1
- package/dist/src/frame/touchScroll.d.ts.map +0 -1
- package/dist/src/frame/touchScroll.js.map +0 -1
- package/dist/src/languages.d.ts.map +0 -1
- package/dist/src/languages.js.map +0 -1
- package/dist/src/liveErrors.d.ts.map +0 -1
- package/dist/src/liveErrors.js.map +0 -1
- package/dist/src/matrix.d.ts.map +0 -1
- package/dist/src/matrix.js.map +0 -1
- package/dist/src/messages.d.ts.map +0 -1
- package/dist/src/messages.js.map +0 -1
- package/dist/src/namedValues.d.ts.map +0 -1
- package/dist/src/namedValues.js.map +0 -1
- package/dist/src/namedViews.d.ts.map +0 -1
- package/dist/src/namedViews.js.map +0 -1
- package/dist/src/pageConfig.d.ts.map +0 -1
- package/dist/src/pageConfig.js.map +0 -1
- package/dist/src/playTrace.d.ts.map +0 -1
- package/dist/src/playTrace.js.map +0 -1
- package/dist/src/realTouch.d.ts.map +0 -1
- package/dist/src/realTouch.js.map +0 -1
- package/dist/src/shell/A11yTab.d.ts.map +0 -1
- package/dist/src/shell/A11yTab.js.map +0 -1
- package/dist/src/shell/ApiReference.d.ts.map +0 -1
- package/dist/src/shell/ApiReference.js.map +0 -1
- package/dist/src/shell/AppearanceMenu.d.ts.map +0 -1
- package/dist/src/shell/AppearanceMenu.js.map +0 -1
- package/dist/src/shell/BoxWidth.d.ts.map +0 -1
- package/dist/src/shell/BoxWidth.js.map +0 -1
- package/dist/src/shell/ClockControls.d.ts.map +0 -1
- package/dist/src/shell/ClockControls.js.map +0 -1
- package/dist/src/shell/Code.d.ts.map +0 -1
- package/dist/src/shell/Code.js.map +0 -1
- package/dist/src/shell/CodeTab.d.ts.map +0 -1
- package/dist/src/shell/CodeTab.js.map +0 -1
- package/dist/src/shell/CodeText.d.ts.map +0 -1
- package/dist/src/shell/CodeText.js.map +0 -1
- package/dist/src/shell/ComponentPage.d.ts.map +0 -1
- package/dist/src/shell/ComponentPage.js.map +0 -1
- package/dist/src/shell/ControlKeyField.d.ts.map +0 -1
- package/dist/src/shell/ControlKeyField.js.map +0 -1
- package/dist/src/shell/ControlRow.d.ts.map +0 -1
- package/dist/src/shell/ControlRow.js.map +0 -1
- package/dist/src/shell/Dock.d.ts.map +0 -1
- package/dist/src/shell/Dock.js.map +0 -1
- package/dist/src/shell/EventsTab.d.ts.map +0 -1
- package/dist/src/shell/EventsTab.js.map +0 -1
- package/dist/src/shell/Example.d.ts.map +0 -1
- package/dist/src/shell/Example.js.map +0 -1
- package/dist/src/shell/FrameView.d.ts.map +0 -1
- package/dist/src/shell/FrameView.js.map +0 -1
- package/dist/src/shell/HomePage.d.ts.map +0 -1
- package/dist/src/shell/HomePage.js.map +0 -1
- package/dist/src/shell/InfoTip.d.ts.map +0 -1
- package/dist/src/shell/InfoTip.js.map +0 -1
- package/dist/src/shell/InteractionsTab.d.ts.map +0 -1
- package/dist/src/shell/InteractionsTab.js.map +0 -1
- package/dist/src/shell/LogicMark.d.ts.map +0 -1
- package/dist/src/shell/LogicMark.js.map +0 -1
- package/dist/src/shell/MatrixPicker.d.ts.map +0 -1
- package/dist/src/shell/MatrixPicker.js.map +0 -1
- package/dist/src/shell/NamedViews.d.ts.map +0 -1
- package/dist/src/shell/NamedViews.js.map +0 -1
- package/dist/src/shell/PackageHtml.d.ts.map +0 -1
- package/dist/src/shell/PackageHtml.js.map +0 -1
- package/dist/src/shell/PartsTab.d.ts.map +0 -1
- package/dist/src/shell/PartsTab.js.map +0 -1
- package/dist/src/shell/PinnedControl.d.ts.map +0 -1
- package/dist/src/shell/PinnedControl.js.map +0 -1
- package/dist/src/shell/PropFields.d.ts.map +0 -1
- package/dist/src/shell/PropFields.js.map +0 -1
- package/dist/src/shell/PropsTab.d.ts.map +0 -1
- package/dist/src/shell/PropsTab.js.map +0 -1
- package/dist/src/shell/Segmented.d.ts.map +0 -1
- package/dist/src/shell/Segmented.js.map +0 -1
- package/dist/src/shell/Shell.d.ts.map +0 -1
- package/dist/src/shell/Shell.js.map +0 -1
- package/dist/src/shell/Sidebar.d.ts.map +0 -1
- package/dist/src/shell/Sidebar.js.map +0 -1
- package/dist/src/shell/SidebarEntries.d.ts.map +0 -1
- package/dist/src/shell/SidebarEntries.js.map +0 -1
- package/dist/src/shell/SidebarHandle.d.ts.map +0 -1
- package/dist/src/shell/SidebarHandle.js.map +0 -1
- package/dist/src/shell/SignatureReference.d.ts.map +0 -1
- package/dist/src/shell/SignatureReference.js.map +0 -1
- package/dist/src/shell/Stage.d.ts.map +0 -1
- package/dist/src/shell/Stage.js.map +0 -1
- package/dist/src/shell/StageTools.d.ts.map +0 -1
- package/dist/src/shell/StageTools.js.map +0 -1
- package/dist/src/shell/StageViewport.d.ts.map +0 -1
- package/dist/src/shell/StageViewport.js.map +0 -1
- package/dist/src/shell/StoryCodeBlock.d.ts.map +0 -1
- package/dist/src/shell/StoryCodeBlock.js.map +0 -1
- package/dist/src/shell/StoryPicker.d.ts.map +0 -1
- package/dist/src/shell/StoryPicker.js.map +0 -1
- package/dist/src/shell/Toolbar.d.ts.map +0 -1
- package/dist/src/shell/Toolbar.js.map +0 -1
- package/dist/src/shell/ToolbarControl.d.ts.map +0 -1
- package/dist/src/shell/ToolbarControl.js.map +0 -1
- package/dist/src/shell/UsedIn.d.ts.map +0 -1
- package/dist/src/shell/UsedIn.js.map +0 -1
- package/dist/src/shell/ViewMenu.d.ts.map +0 -1
- package/dist/src/shell/ViewMenu.js.map +0 -1
- package/dist/src/shell/WidthField.d.ts.map +0 -1
- package/dist/src/shell/WidthField.js.map +0 -1
- package/dist/src/shell/catalogueContext.d.ts.map +0 -1
- package/dist/src/shell/catalogueContext.js.map +0 -1
- package/dist/src/shell/codeTokens.d.ts.map +0 -1
- package/dist/src/shell/codeTokens.js.map +0 -1
- package/dist/src/shell/codeWriter.d.ts.map +0 -1
- package/dist/src/shell/codeWriter.js.map +0 -1
- package/dist/src/shell/compareVariants.d.ts.map +0 -1
- package/dist/src/shell/compareVariants.js.map +0 -1
- package/dist/src/shell/controlCycle.d.ts.map +0 -1
- package/dist/src/shell/controlCycle.js.map +0 -1
- package/dist/src/shell/dockTabs.d.ts.map +0 -1
- package/dist/src/shell/dockTabs.js.map +0 -1
- package/dist/src/shell/icons.d.ts.map +0 -1
- package/dist/src/shell/icons.js.map +0 -1
- package/dist/src/shell/keyboard.d.ts.map +0 -1
- package/dist/src/shell/keyboard.js.map +0 -1
- package/dist/src/shell/logicView.d.ts.map +0 -1
- package/dist/src/shell/logicView.js.map +0 -1
- package/dist/src/shell/mountShell.d.ts.map +0 -1
- package/dist/src/shell/mountShell.js.map +0 -1
- package/dist/src/shell/storyTouch.d.ts.map +0 -1
- package/dist/src/shell/storyTouch.js.map +0 -1
- package/dist/src/shell/strings.d.ts.map +0 -1
- package/dist/src/shell/strings.js.map +0 -1
- package/dist/src/shell/switchView.d.ts.map +0 -1
- package/dist/src/shell/switchView.js.map +0 -1
- package/dist/src/shell/treeSearch.d.ts.map +0 -1
- package/dist/src/shell/treeSearch.js.map +0 -1
- package/dist/src/shell/useAppearance.d.ts.map +0 -1
- package/dist/src/shell/useAppearance.js.map +0 -1
- package/dist/src/shell/useComponentDocs.d.ts.map +0 -1
- package/dist/src/shell/useComponentDocs.js.map +0 -1
- package/dist/src/shell/useControlKeys.d.ts.map +0 -1
- package/dist/src/shell/useControlKeys.js.map +0 -1
- package/dist/src/shell/useCopy.d.ts.map +0 -1
- package/dist/src/shell/useCopy.js.map +0 -1
- package/dist/src/shell/useFold.d.ts.map +0 -1
- package/dist/src/shell/useFold.js.map +0 -1
- package/dist/src/shell/useFrameMessages.d.ts.map +0 -1
- package/dist/src/shell/useFrameMessages.js.map +0 -1
- package/dist/src/shell/useFrameQueue.d.ts.map +0 -1
- package/dist/src/shell/useFrameQueue.js.map +0 -1
- package/dist/src/shell/useFullPage.d.ts.map +0 -1
- package/dist/src/shell/useFullPage.js.map +0 -1
- package/dist/src/shell/useLiveView.d.ts.map +0 -1
- package/dist/src/shell/useLiveView.js.map +0 -1
- package/dist/src/shell/useLoaded.d.ts.map +0 -1
- package/dist/src/shell/useLoaded.js.map +0 -1
- package/dist/src/shell/usePageDoc.d.ts.map +0 -1
- package/dist/src/shell/usePageDoc.js.map +0 -1
- package/dist/src/shell/usePopover.d.ts.map +0 -1
- package/dist/src/shell/usePopover.js.map +0 -1
- package/dist/src/shell/useRecentPages.d.ts.map +0 -1
- package/dist/src/shell/useRecentPages.js.map +0 -1
- package/dist/src/shell/useScrollMemory.d.ts.map +0 -1
- package/dist/src/shell/useScrollMemory.js.map +0 -1
- package/dist/src/shell/useShownView.d.ts.map +0 -1
- package/dist/src/shell/useShownView.js.map +0 -1
- package/dist/src/shell/useSidebarLayout.d.ts.map +0 -1
- package/dist/src/shell/useSidebarLayout.js.map +0 -1
- package/dist/src/shell/useStored.d.ts.map +0 -1
- package/dist/src/shell/useStored.js.map +0 -1
- package/dist/src/shell/useStoryCode.d.ts.map +0 -1
- package/dist/src/shell/useStoryCode.js.map +0 -1
- package/dist/src/shell/useStoryHeights.d.ts.map +0 -1
- package/dist/src/shell/useStoryHeights.js.map +0 -1
- package/dist/src/shell/useStoryIdsElement.d.ts.map +0 -1
- package/dist/src/shell/useStoryIdsElement.js.map +0 -1
- package/dist/src/shell/useStoryKeys.d.ts.map +0 -1
- package/dist/src/shell/useStoryKeys.js.map +0 -1
- package/dist/src/shell/useSystemDark.d.ts.map +0 -1
- package/dist/src/shell/useSystemDark.js.map +0 -1
- package/dist/src/shell/useToolbarLayout.d.ts.map +0 -1
- package/dist/src/shell/useToolbarLayout.js.map +0 -1
- package/dist/src/shell/useToolbarOverflow.d.ts.map +0 -1
- package/dist/src/shell/useToolbarOverflow.js.map +0 -1
- package/dist/src/shell/useWorstCase.d.ts.map +0 -1
- package/dist/src/shell/useWorstCase.js.map +0 -1
- package/dist/src/shell/worstArgs.d.ts.map +0 -1
- package/dist/src/shell/worstArgs.js.map +0 -1
- package/dist/src/sourceFiles.d.ts.map +0 -1
- package/dist/src/sourceFiles.js.map +0 -1
- package/dist/src/spills.d.ts.map +0 -1
- package/dist/src/spills.js.map +0 -1
- package/dist/src/storyBackground.d.ts.map +0 -1
- package/dist/src/storyBackground.js.map +0 -1
- package/dist/src/storyCheck.d.ts.map +0 -1
- package/dist/src/storyCheck.js.map +0 -1
- package/dist/src/storyClock.d.ts.map +0 -1
- package/dist/src/storyClock.js.map +0 -1
- package/dist/src/storyGlobals.d.ts.map +0 -1
- package/dist/src/storyGlobals.js.map +0 -1
- package/dist/src/storyHeights.d.ts.map +0 -1
- package/dist/src/storyHeights.js.map +0 -1
- package/dist/src/storyIdsElement.d.ts.map +0 -1
- package/dist/src/storyIdsElement.js.map +0 -1
- package/dist/src/storyTexts.d.ts.map +0 -1
- package/dist/src/storyTexts.js.map +0 -1
- package/dist/src/storyTree.d.ts.map +0 -1
- package/dist/src/storyTree.js.map +0 -1
- package/dist/src/switches.d.ts.map +0 -1
- package/dist/src/switches.js.map +0 -1
- package/dist/src/toolbarLayout.d.ts.map +0 -1
- package/dist/src/toolbarLayout.js.map +0 -1
- package/dist/src/usedIn.d.ts.map +0 -1
- package/dist/src/usedIn.js.map +0 -1
- package/dist/src/viewState.d.ts.map +0 -1
- package/dist/src/viewState.js.map +0 -1
- package/dist/src/viewWords.d.ts.map +0 -1
- package/dist/src/viewWords.js.map +0 -1
- package/dist/src/vite/adapter.d.ts.map +0 -1
- package/dist/src/vite/adapter.js.map +0 -1
- package/dist/src/vite/agent.types.d.ts.map +0 -1
- package/dist/src/vite/agent.types.js.map +0 -1
- package/dist/src/vite/agentApi.d.ts.map +0 -1
- package/dist/src/vite/agentApi.js.map +0 -1
- package/dist/src/vite/agentRoutes.d.ts.map +0 -1
- package/dist/src/vite/agentRoutes.js.map +0 -1
- package/dist/src/vite/autoTitle.d.ts.map +0 -1
- package/dist/src/vite/autoTitle.js.map +0 -1
- package/dist/src/vite/componentPage.d.ts.map +0 -1
- package/dist/src/vite/componentPage.js.map +0 -1
- package/dist/src/vite/config.d.ts.map +0 -1
- package/dist/src/vite/config.js.map +0 -1
- package/dist/src/vite/configFile.d.ts.map +0 -1
- package/dist/src/vite/configFile.js.map +0 -1
- package/dist/src/vite/docsExtractor.d.ts.map +0 -1
- package/dist/src/vite/docsExtractor.js.map +0 -1
- package/dist/src/vite/docsProgram.d.ts.map +0 -1
- package/dist/src/vite/docsProgram.js.map +0 -1
- package/dist/src/vite/docsWorker.d.ts.map +0 -1
- package/dist/src/vite/docsWorker.js.map +0 -1
- package/dist/src/vite/forcedStates.d.ts.map +0 -1
- package/dist/src/vite/forcedStates.js.map +0 -1
- package/dist/src/vite/forgebookPlugin.d.ts.map +0 -1
- package/dist/src/vite/forgebookPlugin.js.map +0 -1
- package/dist/src/vite/heightsRoute.d.ts.map +0 -1
- package/dist/src/vite/heightsRoute.js.map +0 -1
- package/dist/src/vite/highlightCode.d.ts.map +0 -1
- package/dist/src/vite/highlightCode.js.map +0 -1
- package/dist/src/vite/indexStoryFile.d.ts.map +0 -1
- package/dist/src/vite/indexStoryFile.js.map +0 -1
- package/dist/src/vite/mcpProtocol.d.ts.map +0 -1
- package/dist/src/vite/mcpProtocol.js.map +0 -1
- package/dist/src/vite/pages.d.ts.map +0 -1
- package/dist/src/vite/pages.js.map +0 -1
- package/dist/src/vite/prebundled.d.ts.map +0 -1
- package/dist/src/vite/prebundled.js.map +0 -1
- package/dist/src/vite/storyCode.d.ts.map +0 -1
- package/dist/src/vite/storyCode.js.map +0 -1
- package/dist/src/vite/storyFilesModule.d.ts.map +0 -1
- package/dist/src/vite/storyFilesModule.js.map +0 -1
- package/dist/src/vite/storyMeta.d.ts.map +0 -1
- package/dist/src/vite/storyMeta.js.map +0 -1
- package/dist/src/vite/touchMedia.d.ts.map +0 -1
- package/dist/src/vite/touchMedia.js.map +0 -1
- package/dist/src/vite/typeScriptPieces.d.ts.map +0 -1
- package/dist/src/vite/typeScriptPieces.js.map +0 -1
- package/dist/src/vite/usageGraph.d.ts.map +0 -1
- package/dist/src/vite/usageGraph.js.map +0 -1
- package/dist/src/vite/usageModule.d.ts.map +0 -1
- package/dist/src/vite/usageModule.js.map +0 -1
- package/dist/src/worstCase.d.ts.map +0 -1
- package/dist/src/worstCase.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads a catalogue's previews on the dev server for tools, with the packages they import that only a browser can run
|
|
3
|
+
* left as placeholders, so their args and parameters are read on Node.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* A preview is written for a browser: it imports Storybook's docs blocks for its docs container, or a package that
|
|
7
|
+
* reads `document` while it loads. The server reads only its args, parameters and globals, which rarely come from
|
|
8
|
+
* those, but one such import would leave the whole preview out of every answer. So the previews load in a module
|
|
9
|
+
* runner of their own whose evaluator takes a package (a module Vite leaves to Node) that stops on a browser global
|
|
10
|
+
* (`document is not defined`) for a namespace of placeholders. A placeholder can be kept in a parameter (a docs
|
|
11
|
+
* container, a decorator) or called (an addon's factory in `definePreview`), and what a call made can be looked into
|
|
12
|
+
* as the framework composing the preview does; but reading a property of an export, using any placeholder as a
|
|
13
|
+
* string, a number or a list, or listing the names of the namespace throws, naming the package: a preview that uses
|
|
14
|
+
* such a package while it loads still fails to load, and is named among the answers' problems, rather than giving
|
|
15
|
+
* values a browser would not. A placeholder kept in the preview's args or parameters is left out of the answers, as a
|
|
16
|
+
* function is. A file of the catalogue's own that reads a browser global is not replaced: half run, it would leave
|
|
17
|
+
* values a browser does not have.
|
|
18
|
+
*
|
|
19
|
+
* The runner is Vite's (`createServerModuleRunner`, experimental in Vite 8), on the server environment, with its hot
|
|
20
|
+
* updates: an edit of a preview or of a file it imports is read on the next answer. One runner serves a dev server
|
|
21
|
+
* for as long as it runs, made on the first preview asked for. Story files are not loaded through it: a story that
|
|
22
|
+
* only a browser can load is a problem of its own story, which the answers name.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
import { createServerModuleRunner } from "vite";
|
|
27
|
+
import { ESModulesEvaluator } from "vite/module-runner";
|
|
28
|
+
/** The message of a script that read a global its runtime does not have: `document is not defined`. */
|
|
29
|
+
const UNDEFINED_GLOBAL = /^(\S+) is not defined$/;
|
|
30
|
+
/**
|
|
31
|
+
* The globals a browser has and Node does not, that a package reads while it loads: a missing one of these names a
|
|
32
|
+
* package for browsers, where another missing name is a mistake to report.
|
|
33
|
+
*/
|
|
34
|
+
const BROWSER_GLOBALS = new Set([
|
|
35
|
+
"window",
|
|
36
|
+
"document",
|
|
37
|
+
"navigator",
|
|
38
|
+
"location",
|
|
39
|
+
"history",
|
|
40
|
+
"self",
|
|
41
|
+
"localStorage",
|
|
42
|
+
"sessionStorage",
|
|
43
|
+
"matchMedia",
|
|
44
|
+
"getComputedStyle",
|
|
45
|
+
"requestAnimationFrame",
|
|
46
|
+
"cancelAnimationFrame",
|
|
47
|
+
"customElements",
|
|
48
|
+
"HTMLElement",
|
|
49
|
+
"Element",
|
|
50
|
+
"Node",
|
|
51
|
+
"CSS",
|
|
52
|
+
"CSSStyleSheet",
|
|
53
|
+
"IntersectionObserver",
|
|
54
|
+
"ResizeObserver",
|
|
55
|
+
"MutationObserver"
|
|
56
|
+
]);
|
|
57
|
+
/**
|
|
58
|
+
* Whether an error is a script reading a global that a browser has and Node does not.
|
|
59
|
+
*
|
|
60
|
+
* @param error - what a module threw while it loaded.
|
|
61
|
+
*/
|
|
62
|
+
export const isBrowserGlobalError = (error) => {
|
|
63
|
+
if (!(error instanceof ReferenceError))
|
|
64
|
+
return false;
|
|
65
|
+
const name = UNDEFINED_GLOBAL.exec(error.message)?.[1];
|
|
66
|
+
return name !== undefined && BROWSER_GLOBALS.has(name);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* What a placeholder or a namespace answers as absent: what `JSON.stringify` and `await` look for, so a parameter that
|
|
70
|
+
* holds one is written without it and a namespace is not taken for a promise.
|
|
71
|
+
*/
|
|
72
|
+
const ABSENT_KEYS = new Set(["toJSON", "then"]);
|
|
73
|
+
/** What a placeholder answers as any function does. */
|
|
74
|
+
const FUNCTION_KEYS = new Set(["name", "length", "prototype", "constructor"]);
|
|
75
|
+
/**
|
|
76
|
+
* What a script reads of a value to use it as data: to turn it into a string or a number (`${value}`, `value + 1`), and
|
|
77
|
+
* to iterate it (`[...value]`, `for of`, `for await`). A placeholder has no such value, so reading these throws.
|
|
78
|
+
*/
|
|
79
|
+
const VALUE_SYMBOLS = new Set([
|
|
80
|
+
Symbol.toPrimitive,
|
|
81
|
+
Symbol.iterator,
|
|
82
|
+
Symbol.asyncIterator
|
|
83
|
+
]);
|
|
84
|
+
/**
|
|
85
|
+
* Why a placeholder cannot be used.
|
|
86
|
+
*
|
|
87
|
+
* @param name - the export, or what was done with it.
|
|
88
|
+
* @param file - the package's module.
|
|
89
|
+
* @param reason - why the module did not load.
|
|
90
|
+
*/
|
|
91
|
+
const unavailable = (name, file, reason) => new Error(`${name} of ${file} cannot be used on the server: it needs a browser (${reason})`);
|
|
92
|
+
/**
|
|
93
|
+
* How many calls and reads a chain may take from an export: far more than a framework's composition needs (Storybook's
|
|
94
|
+
* takes three, `docs().default.parameters`), and a bound on a loop that walks a placeholder (`while (node.parent)`),
|
|
95
|
+
* which would otherwise never end and hold the dev server with it.
|
|
96
|
+
*/
|
|
97
|
+
const MAX_STEPS = 16;
|
|
98
|
+
/**
|
|
99
|
+
* An export of a package that did not load on Node, or what a call of one made: a function that can be kept and called
|
|
100
|
+
* (what it returns is another), and throws when it is constructed or used as data (made a string or a number, or
|
|
101
|
+
* iterated).
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* A property read differs by origin. Of an export, it throws: the preview's own code reads a value of the package
|
|
105
|
+
* (`themes.light`), which a browser would give and a placeholder cannot. Of what a call made, it is a placeholder too,
|
|
106
|
+
* the same one each time it is read: what a factory returns is handed whole to the framework that composes the
|
|
107
|
+
* preview, which looks into it for what it contributes (Storybook's `definePreview` reads
|
|
108
|
+
* `addon.default?.parameters ?? addon.parameters` of every addon in `addons: [docs()]`), keeps what it finds, or merges
|
|
109
|
+
* it with `Object.assign`, which finds no names on a placeholder. So the composition runs to its end, its values from
|
|
110
|
+
* the package being placeholders, while a string, a number or a list taken from them still throws.
|
|
111
|
+
*
|
|
112
|
+
* @param name - the export, and what was done with it (`docs().default`).
|
|
113
|
+
* @param file - the package's module.
|
|
114
|
+
* @param reason - why the module did not load.
|
|
115
|
+
* @param steps - the calls and reads from the export to this placeholder: none for the export itself.
|
|
116
|
+
*/
|
|
117
|
+
const placeholder = (name, file, reason, steps) => {
|
|
118
|
+
const read = new Map();
|
|
119
|
+
// the next placeholder of the chain, or why it goes no further
|
|
120
|
+
const next = (step) => {
|
|
121
|
+
if (steps >= MAX_STEPS)
|
|
122
|
+
throw unavailable(step, file, reason);
|
|
123
|
+
return placeholder(step, file, reason, steps + 1);
|
|
124
|
+
};
|
|
125
|
+
// a class, not an arrow function: `new` reaches the trap of a constructor only, and its message names the package
|
|
126
|
+
const target = class {
|
|
127
|
+
};
|
|
128
|
+
const proxy = new Proxy(target, {
|
|
129
|
+
apply: () => next(`${name}()`),
|
|
130
|
+
construct: () => {
|
|
131
|
+
throw unavailable(`new ${name}`, file, reason);
|
|
132
|
+
},
|
|
133
|
+
get: (self, key, receiver) => {
|
|
134
|
+
if (typeof key === "symbol") {
|
|
135
|
+
if (VALUE_SYMBOLS.has(key))
|
|
136
|
+
throw unavailable(name, file, reason);
|
|
137
|
+
return Reflect.get(self, key, receiver);
|
|
138
|
+
}
|
|
139
|
+
if (FUNCTION_KEYS.has(key))
|
|
140
|
+
return Reflect.get(self, key, receiver);
|
|
141
|
+
if (ABSENT_KEYS.has(key))
|
|
142
|
+
return undefined;
|
|
143
|
+
if (steps === 0)
|
|
144
|
+
throw unavailable(`${name}.${key}`, file, reason);
|
|
145
|
+
if (!read.has(key))
|
|
146
|
+
read.set(key, next(`${name}.${key}`));
|
|
147
|
+
return read.get(key);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
// the class's prototype leads back to the placeholder, not to a constructor that would make a plain object
|
|
151
|
+
target.prototype.constructor = proxy;
|
|
152
|
+
return proxy;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* The namespace of a package that did not load on Node: every name it is asked for is a placeholder, so an import of
|
|
156
|
+
* any of them resolves; listing its names throws, since it has none to give.
|
|
157
|
+
*
|
|
158
|
+
* @param file - the package's module.
|
|
159
|
+
* @param reason - why it did not load.
|
|
160
|
+
*/
|
|
161
|
+
export const browserOnlyNamespace = (file, reason) => new Proxy(Object.create(null), {
|
|
162
|
+
has: (_target, key) => typeof key === "string" && !ABSENT_KEYS.has(key),
|
|
163
|
+
get: (_target, key) => typeof key === "string" && !ABSENT_KEYS.has(key) ? placeholder(key, file, reason, 0) : undefined,
|
|
164
|
+
ownKeys: () => {
|
|
165
|
+
throw unavailable("The names", file, reason);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* An evaluator that runs every module as Vite's does, and takes a package that stops on a browser global for a
|
|
170
|
+
* namespace of placeholders.
|
|
171
|
+
*
|
|
172
|
+
* @param base - the evaluator it wraps.
|
|
173
|
+
*/
|
|
174
|
+
export const browserTolerantEvaluator = (base = new ESModulesEvaluator()) => ({
|
|
175
|
+
...(base.startOffset === undefined ? {} : { startOffset: base.startOffset }),
|
|
176
|
+
runInlinedModule: (...run) => base.runInlinedModule(...run),
|
|
177
|
+
runExternalModule: async (file) => {
|
|
178
|
+
try {
|
|
179
|
+
return await base.runExternalModule(file);
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
if (!isBrowserGlobalError(error))
|
|
183
|
+
throw error;
|
|
184
|
+
return browserOnlyNamespace(file, error.message);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
/** The runner of each dev server's server environment, made on its first preview. */
|
|
189
|
+
const runners = new WeakMap();
|
|
190
|
+
/**
|
|
191
|
+
* Loads a preview on the server, through the runner of the dev server's server environment.
|
|
192
|
+
*
|
|
193
|
+
* @param environment - the dev server's server environment.
|
|
194
|
+
* @param file - the preview's path.
|
|
195
|
+
* @returns the preview's module.
|
|
196
|
+
*/
|
|
197
|
+
export const loadPreview = (environment, file) => {
|
|
198
|
+
let runner = runners.get(environment);
|
|
199
|
+
if (runner === undefined) {
|
|
200
|
+
runner = createServerModuleRunner(environment, {
|
|
201
|
+
hmr: { logger: false },
|
|
202
|
+
evaluator: browserTolerantEvaluator()
|
|
203
|
+
});
|
|
204
|
+
runners.set(environment, runner);
|
|
205
|
+
}
|
|
206
|
+
return runner.import(file);
|
|
207
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import ts from "typescript-6";
|
|
2
|
+
import type { PropDocs } from "../componentDocs.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A symbol, through an import to what it names.
|
|
5
|
+
*
|
|
6
|
+
* @param symbol - the symbol at the name.
|
|
7
|
+
* @param checker - the program's checker.
|
|
8
|
+
*/
|
|
9
|
+
export declare const declaredSymbol: (symbol: ts.Symbol | undefined, checker: ts.TypeChecker) => ts.Symbol | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The props in the order the source declares them: those declared in the component's own folder first, then the
|
|
12
|
+
* ones it takes from elsewhere, each by file and position. The checker's order follows the types it met first (an
|
|
13
|
+
* `Omit`'s keys are a union), so a program kept between reads changed it from one read to the next.
|
|
14
|
+
*
|
|
15
|
+
* @param props - the props.
|
|
16
|
+
* @param componentFolder - the folder of the file that declares the component.
|
|
17
|
+
*/
|
|
18
|
+
export declare const declarationOrder: (props: readonly ts.Symbol[], componentFolder: string) => ts.Symbol[];
|
|
19
|
+
/** Whether a symbol is declared outside the package (a DOM attribute from React's types). */
|
|
20
|
+
export declare const isForeign: (symbol: ts.Symbol) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* What a prop takes, when it is not its symbol's own type: a framework whose props are wrapped (an Angular signal input,
|
|
23
|
+
* `input<string>()`, takes the `string` its `InputSignal<string>` holds) says what a binding sets.
|
|
24
|
+
*/
|
|
25
|
+
export type BoundType = {
|
|
26
|
+
/** The type a binding sets. */
|
|
27
|
+
readonly type: ts.Type;
|
|
28
|
+
/**
|
|
29
|
+
* The type node that writes it (`input<"md" | "sm">()`'s argument), for its text and a choice's order; none when the
|
|
30
|
+
* source writes none.
|
|
31
|
+
*/
|
|
32
|
+
readonly typeNode: ts.TypeNode | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** How a framework's props differ from a plain function's, for `propDocs`. */
|
|
35
|
+
export type PropReading = {
|
|
36
|
+
/** What the prop takes, when it is not the symbol's own type; none reads the symbol's. */
|
|
37
|
+
readonly taken?: BoundType | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* What an event's name is, for a framework that names its callback props otherwise (Svelte's `onclick`); `on` and a
|
|
40
|
+
* capital by default.
|
|
41
|
+
*/
|
|
42
|
+
readonly eventName?: RegExp | undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* One prop's docs.
|
|
46
|
+
*
|
|
47
|
+
* @param symbol - the prop: its name, its TSDoc, whether it is optional.
|
|
48
|
+
* @param checker - the program's checker.
|
|
49
|
+
* @param node - where the code names the component.
|
|
50
|
+
* @param reading - how the framework's props differ from a plain function's; none for a plain prop.
|
|
51
|
+
*/
|
|
52
|
+
export declare const propDocs: (symbol: ts.Symbol, checker: ts.TypeChecker, node: ts.Node, reading?: PropReading) => PropDocs;
|
|
53
|
+
/**
|
|
54
|
+
* A component's parts: the keys of its `classNames`, `styles` and `refs` maps (the reach-every-part rule).
|
|
55
|
+
*
|
|
56
|
+
* @param propsType - the type of its props, all of them; none when it takes none.
|
|
57
|
+
* @param checker - the program's checker.
|
|
58
|
+
* @param node - where the code names the component.
|
|
59
|
+
*/
|
|
60
|
+
export declare const partsOf: (propsType: ts.Type | undefined, checker: ts.TypeChecker, node: ts.Node) => readonly string[];
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One prop of a component read from its types and TSDoc: its kind (the panel's group and control), its type as the source
|
|
3
|
+
* writes it, a choice's values in the source's order, an event's signature. Shared by the frameworks' docs modules: what a
|
|
4
|
+
* prop is does not depend on how a component takes it.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The checker's own order and text follow the types it happened to meet first, which a program kept between reads
|
|
8
|
+
* changes from one read to the next, so what the source writes is preferred wherever it says the same.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { dirname } from "node:path";
|
|
13
|
+
import ts from "typescript-6";
|
|
14
|
+
import { summaryOf, tagOf } from "./docsProgram.js";
|
|
15
|
+
import { unwrapped } from "./storyMeta.js";
|
|
16
|
+
/** An event: a function prop named `on` and a capital (React's `onPress`). */
|
|
17
|
+
const EVENT_NAME = /^on[A-Z]/;
|
|
18
|
+
/** Whether a type is a union of string or number literals (a choice). */
|
|
19
|
+
const literalValues = (type) => {
|
|
20
|
+
if (!type.isUnion())
|
|
21
|
+
return undefined;
|
|
22
|
+
const values = type.types.map((member) => member.isStringLiteral() || member.isNumberLiteral() ? member.value : undefined);
|
|
23
|
+
return values.every((value) => value !== undefined)
|
|
24
|
+
? values.filter((value) => value !== undefined)
|
|
25
|
+
: undefined;
|
|
26
|
+
};
|
|
27
|
+
/** A literal value an expression writes (`"md"`, `3`, `-1`), or none for anything else. */
|
|
28
|
+
const literalOfExpression = (expression) => {
|
|
29
|
+
if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression))
|
|
30
|
+
return expression.text;
|
|
31
|
+
if (ts.isNumericLiteral(expression))
|
|
32
|
+
return Number(expression.text);
|
|
33
|
+
if (ts.isPrefixUnaryExpression(expression) &&
|
|
34
|
+
expression.operator === ts.SyntaxKind.MinusToken &&
|
|
35
|
+
ts.isNumericLiteral(expression.operand)) {
|
|
36
|
+
return -Number(expression.operand.text);
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A symbol, through an import to what it names.
|
|
42
|
+
*
|
|
43
|
+
* @param symbol - the symbol at the name.
|
|
44
|
+
* @param checker - the program's checker.
|
|
45
|
+
*/
|
|
46
|
+
export const declaredSymbol = (symbol, checker) => symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
47
|
+
/** The value a literal type node writes (`"md"`, `3`, `-1`), or none for another literal (`true`, `null`). */
|
|
48
|
+
const literalTypeValue = (node) => {
|
|
49
|
+
const literal = node.literal;
|
|
50
|
+
const value = ts.isLiteralExpression(literal) || ts.isPrefixUnaryExpression(literal)
|
|
51
|
+
? literalOfExpression(literal)
|
|
52
|
+
: undefined;
|
|
53
|
+
return value === undefined ? [] : [value];
|
|
54
|
+
};
|
|
55
|
+
/** The values a tuple query writes (`(typeof SIZES)[number]` with `SIZES = ["md", "sm"] as const`), in its order. */
|
|
56
|
+
const tupleValues = (node, checker) => {
|
|
57
|
+
let object = node.objectType;
|
|
58
|
+
while (ts.isParenthesizedTypeNode(object))
|
|
59
|
+
object = object.type;
|
|
60
|
+
if (!ts.isTypeQueryNode(object))
|
|
61
|
+
return [];
|
|
62
|
+
const variable = declaredSymbol(checker.getSymbolAtLocation(object.exprName), checker)?.valueDeclaration;
|
|
63
|
+
if (variable === undefined || !ts.isVariableDeclaration(variable) || variable.initializer === undefined)
|
|
64
|
+
return [];
|
|
65
|
+
const list = unwrapped(variable.initializer);
|
|
66
|
+
if (!ts.isArrayLiteralExpression(list))
|
|
67
|
+
return [];
|
|
68
|
+
return list.elements.flatMap((element) => {
|
|
69
|
+
const value = literalOfExpression(element);
|
|
70
|
+
return value === undefined ? [] : [value];
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
/** The keys an object query writes (`keyof typeof TEXT_STYLES`), in the order the object writes them. */
|
|
74
|
+
const keyValues = (node, checker) => {
|
|
75
|
+
if (node.operator !== ts.SyntaxKind.KeyOfKeyword || !ts.isTypeQueryNode(node.type))
|
|
76
|
+
return [];
|
|
77
|
+
const variable = declaredSymbol(checker.getSymbolAtLocation(node.type.exprName), checker)?.valueDeclaration;
|
|
78
|
+
if (variable === undefined || !ts.isVariableDeclaration(variable) || variable.initializer === undefined)
|
|
79
|
+
return [];
|
|
80
|
+
const object = unwrapped(variable.initializer);
|
|
81
|
+
if (!ts.isObjectLiteralExpression(object))
|
|
82
|
+
return [];
|
|
83
|
+
return object.properties.flatMap((property) => {
|
|
84
|
+
const name = property.name;
|
|
85
|
+
return name !== undefined && (ts.isIdentifier(name) || ts.isStringLiteral(name)) ? [name.text] : [];
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The values an indexed type writes: a tuple's members (`(typeof SIZES)[number]`), or another type's prop as that
|
|
90
|
+
* type declares it (`PopoverProps["side"]`).
|
|
91
|
+
*
|
|
92
|
+
* @param node - the indexed type.
|
|
93
|
+
* @param checker - the type checker.
|
|
94
|
+
* @param seen - the nodes already walked.
|
|
95
|
+
*/
|
|
96
|
+
const accessedValues = (node, checker, seen) => {
|
|
97
|
+
const index = node.indexType;
|
|
98
|
+
if (!ts.isLiteralTypeNode(index) || !ts.isStringLiteral(index.literal))
|
|
99
|
+
return tupleValues(node, checker);
|
|
100
|
+
const prop = checker.getPropertyOfType(checker.getTypeFromTypeNode(node.objectType), index.literal.text);
|
|
101
|
+
return (prop?.declarations ?? []).flatMap((declaration) => ts.isPropertySignature(declaration) && declaration.type !== undefined
|
|
102
|
+
? writtenLiterals(declaration.type, checker, seen)
|
|
103
|
+
: []);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* The literal values a type node writes, in the order it writes them: through unions, aliases and a tuple's members.
|
|
107
|
+
*
|
|
108
|
+
* @param node - the type node.
|
|
109
|
+
* @param checker - the type checker, to follow a name to its declaration.
|
|
110
|
+
* @param seen - the nodes already walked, so a recursive alias ends.
|
|
111
|
+
*/
|
|
112
|
+
const writtenLiterals = (node, checker, seen) => {
|
|
113
|
+
if (seen.has(node))
|
|
114
|
+
return [];
|
|
115
|
+
seen.add(node);
|
|
116
|
+
if (ts.isParenthesizedTypeNode(node))
|
|
117
|
+
return writtenLiterals(node.type, checker, seen);
|
|
118
|
+
if (ts.isUnionTypeNode(node))
|
|
119
|
+
return node.types.flatMap((member) => writtenLiterals(member, checker, seen));
|
|
120
|
+
if (ts.isLiteralTypeNode(node))
|
|
121
|
+
return literalTypeValue(node);
|
|
122
|
+
if (ts.isIndexedAccessTypeNode(node))
|
|
123
|
+
return accessedValues(node, checker, seen);
|
|
124
|
+
if (ts.isTypeOperatorNode(node))
|
|
125
|
+
return keyValues(node, checker);
|
|
126
|
+
if (!ts.isTypeReferenceNode(node))
|
|
127
|
+
return [];
|
|
128
|
+
// a generic's arguments first (`Exclude<TableVariant, "changes">`): the values it keeps come from them
|
|
129
|
+
const fromArguments = (node.typeArguments ?? []).flatMap((argument) => writtenLiterals(argument, checker, seen));
|
|
130
|
+
const alias = declaredSymbol(checker.getSymbolAtLocation(node.typeName), checker)?.declarations?.find(ts.isTypeAliasDeclaration);
|
|
131
|
+
return [...fromArguments, ...(alias === undefined ? [] : writtenLiterals(alias.type, checker, seen))];
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* A choice's values in the order the source writes them: the checker's order follows the order it happened to meet
|
|
135
|
+
* the types in, which a program kept between reads changes from one read to the next.
|
|
136
|
+
*
|
|
137
|
+
* @param values - the values, in the checker's order.
|
|
138
|
+
* @param declared - the prop's declared type nodes.
|
|
139
|
+
* @param checker - the type checker.
|
|
140
|
+
* @returns the values, those the source writes in its order first, any other after them in the checker's order.
|
|
141
|
+
*/
|
|
142
|
+
const writtenOrder = (values, declared, checker) => {
|
|
143
|
+
const seen = new Set();
|
|
144
|
+
const written = declared.flatMap((node) => ts.isMethodSignature(node) ? [] : writtenLiterals(node, checker, seen));
|
|
145
|
+
const rank = (value) => {
|
|
146
|
+
const index = written.indexOf(value);
|
|
147
|
+
return index === -1 ? written.length : index;
|
|
148
|
+
};
|
|
149
|
+
return [...values].sort((left, right) => rank(left) - rank(right));
|
|
150
|
+
};
|
|
151
|
+
/** A choice's type as TypeScript writes it, its members in the given order (`"md" | "sm"`). */
|
|
152
|
+
const choiceTypeText = (values) => values.map((value) => (typeof value === "string" ? JSON.stringify(value) : String(value))).join(" | ");
|
|
153
|
+
/**
|
|
154
|
+
* The props in the order the source declares them: those declared in the component's own folder first, then the
|
|
155
|
+
* ones it takes from elsewhere, each by file and position. The checker's order follows the types it met first (an
|
|
156
|
+
* `Omit`'s keys are a union), so a program kept between reads changed it from one read to the next.
|
|
157
|
+
*
|
|
158
|
+
* @param props - the props.
|
|
159
|
+
* @param componentFolder - the folder of the file that declares the component.
|
|
160
|
+
*/
|
|
161
|
+
export const declarationOrder = (props, componentFolder) => {
|
|
162
|
+
const keyOf = (prop) => {
|
|
163
|
+
const [declaration] = prop.declarations ?? [];
|
|
164
|
+
if (declaration === undefined)
|
|
165
|
+
return [2, "", 0];
|
|
166
|
+
const file = declaration.getSourceFile().fileName;
|
|
167
|
+
return [dirname(file) === componentFolder ? 0 : 1, file, declaration.getStart()];
|
|
168
|
+
};
|
|
169
|
+
return [...props].sort((left, right) => {
|
|
170
|
+
const [leftOwn, leftFile, leftAt] = keyOf(left);
|
|
171
|
+
const [rightOwn, rightFile, rightAt] = keyOf(right);
|
|
172
|
+
return leftOwn - rightOwn || leftFile.localeCompare(rightFile) || leftAt - rightAt;
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
/** A type node's text as the source writes it, on one line. */
|
|
176
|
+
const nodeText = (node) => node.getText().replace(/\s+/g, " ").trim();
|
|
177
|
+
/**
|
|
178
|
+
* Whether a type node adds nothing a prop can take: `undefined` and `null` (left out as the checker's `NonNullable`
|
|
179
|
+
* did) and `never` (a branch of the props where the prop is not allowed).
|
|
180
|
+
*/
|
|
181
|
+
const isNothing = (node) => node.kind === ts.SyntaxKind.UndefinedKeyword ||
|
|
182
|
+
node.kind === ts.SyntaxKind.NeverKeyword ||
|
|
183
|
+
(ts.isLiteralTypeNode(node) && node.literal.kind === ts.SyntaxKind.NullKeyword);
|
|
184
|
+
/** A type node without its parentheses. */
|
|
185
|
+
const bareType = (node) => ts.isParenthesizedTypeNode(node) ? bareType(node.type) : node;
|
|
186
|
+
/**
|
|
187
|
+
* A prop's declared type without what adds nothing (`undefined`, `null`, `never`): the members of a written union, or
|
|
188
|
+
* the node itself.
|
|
189
|
+
*
|
|
190
|
+
* @param node - the prop's declared type.
|
|
191
|
+
*/
|
|
192
|
+
const declaredMembers = (node) => {
|
|
193
|
+
const bare = bareType(node);
|
|
194
|
+
return (ts.isUnionTypeNode(bare) ? bare.types : [bare]).filter((member) => !isNothing(member));
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* A prop's declared type nodes: a property's type (in a type or a class) or a method's whole signature, once per
|
|
198
|
+
* declaration. A prop of props written as alternatives (`{ indicator?: never } | { indicator?: "dot" | "spinner" }`)
|
|
199
|
+
* has one per branch.
|
|
200
|
+
*
|
|
201
|
+
* @param symbol - the prop.
|
|
202
|
+
*/
|
|
203
|
+
const declaredTypesOf = (symbol) => (symbol.declarations ?? []).flatMap((declaration) => {
|
|
204
|
+
if (ts.isMethodSignature(declaration))
|
|
205
|
+
return [declaration];
|
|
206
|
+
return (ts.isPropertySignature(declaration) || ts.isPropertyDeclaration(declaration)) &&
|
|
207
|
+
declaration.type !== undefined
|
|
208
|
+
? [declaration.type]
|
|
209
|
+
: [];
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* A prop's type as the source writes it (`ReactNode`, `Ref<HTMLElement>`), without `undefined` and `null`: the
|
|
213
|
+
* checker's own text expands it and orders a union's members by the order it met the types in, which a program kept
|
|
214
|
+
* between reads changes from one read to the next.
|
|
215
|
+
*
|
|
216
|
+
* @param declaredTypes - the prop's declared type nodes.
|
|
217
|
+
* @returns the text, or none when the prop writes no type (the caller falls back to the checker's).
|
|
218
|
+
*/
|
|
219
|
+
const writtenTypeText = (declaredTypes) => {
|
|
220
|
+
const texts = declaredTypes.flatMap((declared) => {
|
|
221
|
+
if (!ts.isMethodSignature(declared))
|
|
222
|
+
return declaredMembers(declared).map(nodeText);
|
|
223
|
+
const parameters = declared.parameters.map(nodeText).join(", ");
|
|
224
|
+
return [`(${parameters}) => ${declared.type === undefined ? "void" : nodeText(declared.type)}`];
|
|
225
|
+
});
|
|
226
|
+
// each branch's members once, in the order the branches write them
|
|
227
|
+
const unique = [...new Set(texts)];
|
|
228
|
+
return unique.length === 0 ? undefined : unique.join(" | ");
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* An event's signature as the source writes it: a function type among the prop's declared members, or a method.
|
|
232
|
+
*
|
|
233
|
+
* @param declaredTypes - the event prop's declared type nodes.
|
|
234
|
+
* @returns the signature, or none when the source writes none in place (a named handler type).
|
|
235
|
+
*/
|
|
236
|
+
const writtenSignature = (declaredTypes) => {
|
|
237
|
+
const nodes = declaredTypes.flatMap((declared) => ts.isMethodSignature(declared) ? [declared] : declaredMembers(declared));
|
|
238
|
+
const fn = nodes.find((node) => ts.isMethodSignature(node) || ts.isFunctionTypeNode(node));
|
|
239
|
+
if (fn === undefined)
|
|
240
|
+
return undefined;
|
|
241
|
+
return {
|
|
242
|
+
parameters: fn.parameters.map((parameter) => ({
|
|
243
|
+
name: nodeText(parameter.name),
|
|
244
|
+
type: parameter.type === undefined ? "unknown" : nodeText(parameter.type)
|
|
245
|
+
})),
|
|
246
|
+
returns: fn.type === undefined ? "void" : nodeText(fn.type)
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
/** An event's signature. */
|
|
250
|
+
const signatureOf = (type, checker, node) => {
|
|
251
|
+
const [signature] = type.getCallSignatures();
|
|
252
|
+
if (signature === undefined)
|
|
253
|
+
return undefined;
|
|
254
|
+
return {
|
|
255
|
+
parameters: signature.parameters.map((parameter) => ({
|
|
256
|
+
name: parameter.getName(),
|
|
257
|
+
type: checker.typeToString(checker.getTypeOfSymbolAtLocation(parameter, node))
|
|
258
|
+
})),
|
|
259
|
+
returns: checker.typeToString(signature.getReturnType())
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
/** A prop's kind, from its name and its type without `undefined`. */
|
|
263
|
+
const kindOf = (name, type, eventName) => {
|
|
264
|
+
if (eventName.test(name) && type.getCallSignatures().length > 0)
|
|
265
|
+
return "event";
|
|
266
|
+
if (type.flags & ts.TypeFlags.Boolean || type.flags & ts.TypeFlags.BooleanLiteral)
|
|
267
|
+
return "toggle";
|
|
268
|
+
if (literalValues(type) !== undefined)
|
|
269
|
+
return "choice";
|
|
270
|
+
if (type.flags & ts.TypeFlags.String)
|
|
271
|
+
return "text";
|
|
272
|
+
if (type.flags & ts.TypeFlags.Number)
|
|
273
|
+
return "number";
|
|
274
|
+
return "other";
|
|
275
|
+
};
|
|
276
|
+
/** Whether a symbol is declared outside the package (a DOM attribute from React's types). */
|
|
277
|
+
export const isForeign = (symbol) => (symbol.declarations ?? []).every((declaration) => declaration.getSourceFile().fileName.includes("/node_modules/"));
|
|
278
|
+
/**
|
|
279
|
+
* Whether a prop's type is a plain object, whose members can be listed one by one as values of their own: not a union,
|
|
280
|
+
* a function, a class's instance, an array or a tuple.
|
|
281
|
+
*/
|
|
282
|
+
const isMemberedObject = (type, checker) => (type.flags & ts.TypeFlags.Object) !== 0 &&
|
|
283
|
+
!type.isUnion() &&
|
|
284
|
+
!type.isClass() &&
|
|
285
|
+
type.getCallSignatures().length === 0 &&
|
|
286
|
+
type.getConstructSignatures().length === 0 &&
|
|
287
|
+
!checker.isArrayType(type) &&
|
|
288
|
+
!checker.isTupleType(type);
|
|
289
|
+
/**
|
|
290
|
+
* The members of a prop's object type, when the package declares and documents them (`texts?: FileFinderTexts`), in
|
|
291
|
+
* the order the source declares them. The members the type takes from outside the package (an element's attributes)
|
|
292
|
+
* are left out, as the props are, and a type none of whose members has TSDoc lists nothing a reader cannot read from
|
|
293
|
+
* its name. One level only: a member's own members are not read, so a recursive type ends and the docs stay small.
|
|
294
|
+
*
|
|
295
|
+
* @param type - the prop's type, without `undefined`.
|
|
296
|
+
* @param checker - the program's checker.
|
|
297
|
+
* @param node - where the code names the component.
|
|
298
|
+
* @returns the members, or none when the type is not such an object.
|
|
299
|
+
*/
|
|
300
|
+
const membersOf = (type, checker, node) => {
|
|
301
|
+
if (!isMemberedObject(type, checker))
|
|
302
|
+
return undefined;
|
|
303
|
+
const own = type.getProperties().filter((member) => !isForeign(member));
|
|
304
|
+
const [firstDeclaration] = type.getSymbol()?.declarations ?? own[0]?.declarations ?? [];
|
|
305
|
+
const folder = firstDeclaration === undefined ? "" : dirname(firstDeclaration.getSourceFile().fileName);
|
|
306
|
+
const members = declarationOrder(own, folder).map((member) => {
|
|
307
|
+
const defaultValue = tagOf(member, checker, "defaultValue");
|
|
308
|
+
const memberType = checker.getNonNullableType(checker.getTypeOfSymbolAtLocation(member, node));
|
|
309
|
+
return {
|
|
310
|
+
name: member.getName(),
|
|
311
|
+
type: writtenTypeText(declaredTypesOf(member)) ?? checker.typeToString(memberType),
|
|
312
|
+
description: summaryOf(member, checker),
|
|
313
|
+
...(defaultValue === undefined ? {} : { defaultValue }),
|
|
314
|
+
isRequired: (member.flags & ts.SymbolFlags.Optional) === 0
|
|
315
|
+
};
|
|
316
|
+
});
|
|
317
|
+
return members.some((member) => member.description !== "") ? members : undefined;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* A prop's place in the reference: the group its TSDoc names (`@group`, as TypeDoc reads it, so a library documented
|
|
321
|
+
* for both writes it once), and the members of its type when it is a documented object. Each only when it has one.
|
|
322
|
+
*
|
|
323
|
+
* @param symbol - the prop.
|
|
324
|
+
* @param kind - its kind: only a prop of kind `other` can be an object.
|
|
325
|
+
* @param type - its type, without `undefined`.
|
|
326
|
+
* @param checker - the program's checker.
|
|
327
|
+
* @param node - where the code names the component.
|
|
328
|
+
*/
|
|
329
|
+
const groupingOf = (symbol, kind, type, checker, node) => {
|
|
330
|
+
const group = tagOf(symbol, checker, "group");
|
|
331
|
+
const members = kind === "other" ? membersOf(type, checker, node) : undefined;
|
|
332
|
+
return {
|
|
333
|
+
...(group === undefined || group === "" ? {} : { group }),
|
|
334
|
+
...(members === undefined ? {} : { members })
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* One prop's docs.
|
|
339
|
+
*
|
|
340
|
+
* @param symbol - the prop: its name, its TSDoc, whether it is optional.
|
|
341
|
+
* @param checker - the program's checker.
|
|
342
|
+
* @param node - where the code names the component.
|
|
343
|
+
* @param reading - how the framework's props differ from a plain function's; none for a plain prop.
|
|
344
|
+
*/
|
|
345
|
+
export const propDocs = (symbol, checker, node, reading = {}) => {
|
|
346
|
+
const { taken, eventName = EVENT_NAME } = reading;
|
|
347
|
+
const type = checker.getNonNullableType(taken?.type ?? checker.getTypeOfSymbolAtLocation(symbol, node));
|
|
348
|
+
const takenNodes = taken?.typeNode === undefined ? [] : [taken.typeNode];
|
|
349
|
+
const declared = taken === undefined ? declaredTypesOf(symbol) : takenNodes;
|
|
350
|
+
const name = symbol.getName();
|
|
351
|
+
const kind = kindOf(name, type, eventName);
|
|
352
|
+
const defaultValue = tagOf(symbol, checker, "defaultValue");
|
|
353
|
+
const checkerChoices = kind === "choice" ? literalValues(type) : undefined;
|
|
354
|
+
const choices = checkerChoices === undefined ? undefined : writtenOrder(checkerChoices, declared, checker);
|
|
355
|
+
const signature = kind === "event" ? (writtenSignature(declared) ?? signatureOf(type, checker, node)) : undefined;
|
|
356
|
+
// a node takes a text: the panel can set it as one, which covers labels, titles and children
|
|
357
|
+
const canTakeText = kind === "other" && checker.isTypeAssignableTo(checker.getStringType(), type);
|
|
358
|
+
return {
|
|
359
|
+
name,
|
|
360
|
+
kind,
|
|
361
|
+
type: choices === undefined
|
|
362
|
+
? (writtenTypeText(declared) ?? checker.typeToString(type))
|
|
363
|
+
: choiceTypeText(choices),
|
|
364
|
+
description: summaryOf(symbol, checker),
|
|
365
|
+
isRequired: (symbol.flags & ts.SymbolFlags.Optional) === 0,
|
|
366
|
+
...(defaultValue === undefined ? {} : { defaultValue }),
|
|
367
|
+
...(choices === undefined ? {} : { choices }),
|
|
368
|
+
...(signature === undefined ? {} : { signature }),
|
|
369
|
+
...(canTakeText ? { canTakeText } : {}),
|
|
370
|
+
...groupingOf(symbol, kind, type, checker, node)
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
/** The props whose keys are the component's parts. */
|
|
374
|
+
const PART_MAPS = ["classNames", "styles", "refs"];
|
|
375
|
+
/**
|
|
376
|
+
* A component's parts: the keys of its `classNames`, `styles` and `refs` maps (the reach-every-part rule).
|
|
377
|
+
*
|
|
378
|
+
* @param propsType - the type of its props, all of them; none when it takes none.
|
|
379
|
+
* @param checker - the program's checker.
|
|
380
|
+
* @param node - where the code names the component.
|
|
381
|
+
*/
|
|
382
|
+
export const partsOf = (propsType, checker, node) => [
|
|
383
|
+
...new Set((propsType?.getProperties() ?? [])
|
|
384
|
+
.filter((prop) => PART_MAPS.includes(prop.getName()))
|
|
385
|
+
.flatMap((prop) => checker.getNonNullableType(checker.getTypeOfSymbolAtLocation(prop, node)).getProperties())
|
|
386
|
+
.map((part) => part.getName()))
|
|
387
|
+
];
|