forgebook 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -2
- package/dist/bin/forgebook/catalogueVite.d.ts +16 -0
- package/dist/bin/forgebook/catalogueVite.d.ts.map +1 -0
- package/dist/bin/forgebook/catalogueVite.js +15 -0
- package/dist/bin/forgebook/catalogueVite.js.map +1 -0
- package/dist/bin/forgebook/forgebook.d.mts +3 -0
- package/dist/bin/forgebook/forgebook.d.mts.map +1 -0
- package/dist/bin/forgebook/forgebook.mjs +93 -0
- package/dist/bin/forgebook/forgebook.mjs.map +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts +90 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.js +1 -0
- package/dist/bin/forgebook-docs/catalogueDocs.types.js.map +1 -0
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts +9 -0
- package/dist/bin/forgebook-docs/catalogueMarkdown.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/catalogueMarkdown.js +132 -0
- package/dist/bin/forgebook-docs/catalogueMarkdown.js.map +1 -0
- package/dist/bin/forgebook-docs/collectDocs.d.ts +17 -0
- package/dist/bin/forgebook-docs/collectDocs.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/collectDocs.js +115 -0
- package/dist/bin/forgebook-docs/collectDocs.js.map +1 -0
- package/dist/bin/forgebook-docs/forgebook-docs.d.mts +3 -0
- package/dist/bin/forgebook-docs/forgebook-docs.d.mts.map +1 -0
- package/dist/bin/forgebook-docs/forgebook-docs.mjs +115 -0
- package/dist/bin/forgebook-docs/forgebook-docs.mjs.map +1 -0
- package/dist/bin/forgebook-docs/moduleDocs.d.ts +9 -0
- package/dist/bin/forgebook-docs/moduleDocs.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/moduleDocs.js +62 -0
- package/dist/bin/forgebook-docs/moduleDocs.js.map +1 -0
- package/dist/bin/forgebook-docs/sassDocs.d.ts +20 -0
- package/dist/bin/forgebook-docs/sassDocs.d.ts.map +1 -0
- package/dist/bin/forgebook-docs/sassDocs.js +77 -0
- package/dist/bin/forgebook-docs/sassDocs.js.map +1 -0
- package/dist/bin/forgebook-texts/forgebook-texts.d.mts +3 -0
- package/dist/bin/forgebook-texts/forgebook-texts.d.mts.map +1 -0
- package/dist/bin/forgebook-texts/forgebook-texts.mjs +94 -0
- package/dist/bin/forgebook-texts/forgebook-texts.mjs.map +1 -0
- package/dist/bin/forgebook-texts/storyTextsReport.d.ts +26 -0
- package/dist/bin/forgebook-texts/storyTextsReport.d.ts.map +1 -0
- package/dist/bin/forgebook-texts/storyTextsReport.js +35 -0
- package/dist/bin/forgebook-texts/storyTextsReport.js.map +1 -0
- package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts +25 -0
- package/dist/bin/forgebook-texts/storyTextsReport.types.d.ts.map +1 -0
- package/dist/bin/forgebook-texts/storyTextsReport.types.js +7 -0
- package/dist/bin/forgebook-texts/storyTextsReport.types.js.map +1 -0
- package/dist/src/a11y.d.ts +28 -0
- package/dist/src/a11y.d.ts.map +1 -0
- package/dist/src/a11y.js +29 -0
- package/dist/src/a11y.js.map +1 -0
- package/dist/src/argTypes.d.ts +114 -0
- package/dist/src/argTypes.d.ts.map +1 -0
- package/dist/src/argTypes.js +254 -0
- package/dist/src/argTypes.js.map +1 -0
- package/dist/src/backdrops.d.ts +88 -0
- package/dist/src/backdrops.d.ts.map +1 -0
- package/dist/src/backdrops.js +202 -0
- package/dist/src/backdrops.js.map +1 -0
- package/dist/src/catalogue.d.ts +120 -0
- package/dist/src/catalogue.d.ts.map +1 -0
- package/dist/src/catalogue.js +80 -0
- package/dist/src/catalogue.js.map +1 -0
- package/dist/src/componentDocs.d.ts +98 -0
- package/dist/src/componentDocs.d.ts.map +1 -0
- package/dist/src/componentDocs.js +47 -0
- package/dist/src/componentDocs.js.map +1 -0
- package/dist/src/frame/checkStory.d.ts +20 -0
- package/dist/src/frame/checkStory.d.ts.map +1 -0
- package/dist/src/frame/checkStory.js +31 -0
- package/dist/src/frame/checkStory.js.map +1 -0
- package/dist/src/frame/frame.css +51 -0
- package/dist/src/frame/frameClock.d.ts +53 -0
- package/dist/src/frame/frameClock.d.ts.map +1 -0
- package/dist/src/frame/frameClock.js +80 -0
- package/dist/src/frame/frameClock.js.map +1 -0
- package/dist/src/frame/frameStatus.d.ts +8 -0
- package/dist/src/frame/frameStatus.d.ts.map +1 -0
- package/dist/src/frame/frameStatus.js +8 -0
- package/dist/src/frame/frameStatus.js.map +1 -0
- package/dist/src/frame/frameView.d.ts +33 -0
- package/dist/src/frame/frameView.d.ts.map +1 -0
- package/dist/src/frame/frameView.js +134 -0
- package/dist/src/frame/frameView.js.map +1 -0
- package/dist/src/frame/matrixLayout.d.ts +36 -0
- package/dist/src/frame/matrixLayout.d.ts.map +1 -0
- package/dist/src/frame/matrixLayout.js +87 -0
- package/dist/src/frame/matrixLayout.js.map +1 -0
- package/dist/src/frame/measureTools.d.ts +24 -0
- package/dist/src/frame/measureTools.d.ts.map +1 -0
- package/dist/src/frame/measureTools.js +141 -0
- package/dist/src/frame/measureTools.js.map +1 -0
- package/dist/src/frame/mountFrame.d.ts +47 -0
- package/dist/src/frame/mountFrame.d.ts.map +1 -0
- package/dist/src/frame/mountFrame.js +229 -0
- package/dist/src/frame/mountFrame.js.map +1 -0
- package/dist/src/frame/playStory.d.ts +40 -0
- package/dist/src/frame/playStory.d.ts.map +1 -0
- package/dist/src/frame/playStory.js +55 -0
- package/dist/src/frame/playStory.js.map +1 -0
- package/dist/src/frame/renderer.d.ts +85 -0
- package/dist/src/frame/renderer.d.ts.map +1 -0
- package/dist/src/frame/renderer.js +18 -0
- package/dist/src/frame/renderer.js.map +1 -0
- package/dist/src/frame/settle.d.ts +24 -0
- package/dist/src/frame/settle.d.ts.map +1 -0
- package/dist/src/frame/settle.js +25 -0
- package/dist/src/frame/settle.js.map +1 -0
- package/dist/src/frame/staleModule.d.ts +40 -0
- package/dist/src/frame/staleModule.d.ts.map +1 -0
- package/dist/src/frame/staleModule.js +74 -0
- package/dist/src/frame/staleModule.js.map +1 -0
- package/dist/src/frame/storyCanvas.d.ts +21 -0
- package/dist/src/frame/storyCanvas.d.ts.map +1 -0
- package/dist/src/frame/storyCanvas.js +30 -0
- package/dist/src/frame/storyCanvas.js.map +1 -0
- package/dist/src/frame/storyHooks.d.ts +31 -0
- package/dist/src/frame/storyHooks.d.ts.map +1 -0
- package/dist/src/frame/storyHooks.js +59 -0
- package/dist/src/frame/storyHooks.js.map +1 -0
- package/dist/src/frame/storyModule.d.ts +104 -0
- package/dist/src/frame/storyModule.d.ts.map +1 -0
- package/dist/src/frame/storyModule.js +205 -0
- package/dist/src/frame/storyModule.js.map +1 -0
- package/dist/src/frame/storyRun.d.ts +96 -0
- package/dist/src/frame/storyRun.d.ts.map +1 -0
- package/dist/src/frame/storyRun.js +318 -0
- package/dist/src/frame/storyRun.js.map +1 -0
- package/dist/src/languages.d.ts +15 -0
- package/dist/src/languages.d.ts.map +1 -0
- package/dist/src/languages.js +8 -0
- package/dist/src/languages.js.map +1 -0
- package/dist/src/matrix.d.ts +56 -0
- package/dist/src/matrix.d.ts.map +1 -0
- package/dist/src/matrix.js +61 -0
- package/dist/src/matrix.js.map +1 -0
- package/dist/src/messages.d.ts +203 -0
- package/dist/src/messages.d.ts.map +1 -0
- package/dist/src/messages.js +193 -0
- package/dist/src/messages.js.map +1 -0
- package/dist/src/namedValues.d.ts +38 -0
- package/dist/src/namedValues.d.ts.map +1 -0
- package/dist/src/namedValues.js +48 -0
- package/dist/src/namedValues.js.map +1 -0
- package/dist/src/pageConfig.d.ts +23 -0
- package/dist/src/pageConfig.d.ts.map +1 -0
- package/dist/src/pageConfig.js +1 -0
- package/dist/src/pageConfig.js.map +1 -0
- package/dist/src/playTrace.d.ts +41 -0
- package/dist/src/playTrace.d.ts.map +1 -0
- package/dist/src/playTrace.js +35 -0
- package/dist/src/playTrace.js.map +1 -0
- package/dist/src/shell/A11yTab.d.ts +44 -0
- package/dist/src/shell/A11yTab.d.ts.map +1 -0
- package/dist/src/shell/A11yTab.js +30 -0
- package/dist/src/shell/A11yTab.js.map +1 -0
- package/dist/src/shell/ApiReference.d.ts +18 -0
- package/dist/src/shell/ApiReference.d.ts.map +1 -0
- package/dist/src/shell/ApiReference.js +41 -0
- package/dist/src/shell/ApiReference.js.map +1 -0
- package/dist/src/shell/ClockControls.d.ts +43 -0
- package/dist/src/shell/ClockControls.d.ts.map +1 -0
- package/dist/src/shell/ClockControls.js +53 -0
- package/dist/src/shell/ClockControls.js.map +1 -0
- package/dist/src/shell/Code.d.ts +16 -0
- package/dist/src/shell/Code.d.ts.map +1 -0
- package/dist/src/shell/Code.js +9 -0
- package/dist/src/shell/Code.js.map +1 -0
- package/dist/src/shell/CodeTab.d.ts +17 -0
- package/dist/src/shell/CodeTab.d.ts.map +1 -0
- package/dist/src/shell/CodeTab.js +17 -0
- package/dist/src/shell/CodeTab.js.map +1 -0
- package/dist/src/shell/CodeText.d.ts +16 -0
- package/dist/src/shell/CodeText.d.ts.map +1 -0
- package/dist/src/shell/CodeText.js +10 -0
- package/dist/src/shell/CodeText.js.map +1 -0
- package/dist/src/shell/ComponentPage.d.ts +38 -0
- package/dist/src/shell/ComponentPage.d.ts.map +1 -0
- package/dist/src/shell/ComponentPage.js +146 -0
- package/dist/src/shell/ComponentPage.js.map +1 -0
- package/dist/src/shell/Dock.d.ts +42 -0
- package/dist/src/shell/Dock.d.ts.map +1 -0
- package/dist/src/shell/Dock.js +90 -0
- package/dist/src/shell/Dock.js.map +1 -0
- package/dist/src/shell/EventsTab.d.ts +25 -0
- package/dist/src/shell/EventsTab.d.ts.map +1 -0
- package/dist/src/shell/EventsTab.js +26 -0
- package/dist/src/shell/EventsTab.js.map +1 -0
- package/dist/src/shell/FrameView.d.ts +49 -0
- package/dist/src/shell/FrameView.d.ts.map +1 -0
- package/dist/src/shell/FrameView.js +29 -0
- package/dist/src/shell/FrameView.js.map +1 -0
- package/dist/src/shell/HomePage.d.ts +39 -0
- package/dist/src/shell/HomePage.d.ts.map +1 -0
- package/dist/src/shell/HomePage.js +85 -0
- package/dist/src/shell/HomePage.js.map +1 -0
- package/dist/src/shell/InteractionsTab.d.ts +28 -0
- package/dist/src/shell/InteractionsTab.d.ts.map +1 -0
- package/dist/src/shell/InteractionsTab.js +17 -0
- package/dist/src/shell/InteractionsTab.js.map +1 -0
- package/dist/src/shell/MatrixPicker.d.ts +24 -0
- package/dist/src/shell/MatrixPicker.d.ts.map +1 -0
- package/dist/src/shell/MatrixPicker.js +29 -0
- package/dist/src/shell/MatrixPicker.js.map +1 -0
- package/dist/src/shell/PackageHtml.d.ts +17 -0
- package/dist/src/shell/PackageHtml.d.ts.map +1 -0
- package/dist/src/shell/PackageHtml.js +13 -0
- package/dist/src/shell/PackageHtml.js.map +1 -0
- package/dist/src/shell/PartsTab.d.ts +23 -0
- package/dist/src/shell/PartsTab.d.ts.map +1 -0
- package/dist/src/shell/PartsTab.js +23 -0
- package/dist/src/shell/PartsTab.js.map +1 -0
- package/dist/src/shell/PropFields.d.ts +31 -0
- package/dist/src/shell/PropFields.d.ts.map +1 -0
- package/dist/src/shell/PropFields.js +81 -0
- package/dist/src/shell/PropFields.js.map +1 -0
- package/dist/src/shell/PropsTab.d.ts +45 -0
- package/dist/src/shell/PropsTab.d.ts.map +1 -0
- package/dist/src/shell/PropsTab.js +81 -0
- package/dist/src/shell/PropsTab.js.map +1 -0
- package/dist/src/shell/SchemeSwitches.d.ts +24 -0
- package/dist/src/shell/SchemeSwitches.d.ts.map +1 -0
- package/dist/src/shell/SchemeSwitches.js +36 -0
- package/dist/src/shell/SchemeSwitches.js.map +1 -0
- package/dist/src/shell/Segmented.d.ts +41 -0
- package/dist/src/shell/Segmented.d.ts.map +1 -0
- package/dist/src/shell/Segmented.js +19 -0
- package/dist/src/shell/Segmented.js.map +1 -0
- package/dist/src/shell/Shell.d.ts +49 -0
- package/dist/src/shell/Shell.d.ts.map +1 -0
- package/dist/src/shell/Shell.js +279 -0
- package/dist/src/shell/Shell.js.map +1 -0
- package/dist/src/shell/Sidebar.d.ts +52 -0
- package/dist/src/shell/Sidebar.d.ts.map +1 -0
- package/dist/src/shell/Sidebar.js +132 -0
- package/dist/src/shell/Sidebar.js.map +1 -0
- package/dist/src/shell/SidebarHandle.d.ts +29 -0
- package/dist/src/shell/SidebarHandle.d.ts.map +1 -0
- package/dist/src/shell/SidebarHandle.js +46 -0
- package/dist/src/shell/SidebarHandle.js.map +1 -0
- package/dist/src/shell/Stage.d.ts +68 -0
- package/dist/src/shell/Stage.d.ts.map +1 -0
- package/dist/src/shell/Stage.js +218 -0
- package/dist/src/shell/Stage.js.map +1 -0
- package/dist/src/shell/StageTools.d.ts +27 -0
- package/dist/src/shell/StageTools.d.ts.map +1 -0
- package/dist/src/shell/StageTools.js +34 -0
- package/dist/src/shell/StageTools.js.map +1 -0
- package/dist/src/shell/StageViewport.d.ts +47 -0
- package/dist/src/shell/StageViewport.d.ts.map +1 -0
- package/dist/src/shell/StageViewport.js +174 -0
- package/dist/src/shell/StageViewport.js.map +1 -0
- package/dist/src/shell/StoryCodeBlock.d.ts +35 -0
- package/dist/src/shell/StoryCodeBlock.d.ts.map +1 -0
- package/dist/src/shell/StoryCodeBlock.js +27 -0
- package/dist/src/shell/StoryCodeBlock.js.map +1 -0
- package/dist/src/shell/StoryPicker.d.ts +26 -0
- package/dist/src/shell/StoryPicker.d.ts.map +1 -0
- package/dist/src/shell/StoryPicker.js +32 -0
- package/dist/src/shell/StoryPicker.js.map +1 -0
- package/dist/src/shell/Toolbar.d.ts +40 -0
- package/dist/src/shell/Toolbar.d.ts.map +1 -0
- package/dist/src/shell/Toolbar.js +125 -0
- package/dist/src/shell/Toolbar.js.map +1 -0
- package/dist/src/shell/WidthField.d.ts +24 -0
- package/dist/src/shell/WidthField.d.ts.map +1 -0
- package/dist/src/shell/WidthField.js +40 -0
- package/dist/src/shell/WidthField.js.map +1 -0
- package/dist/src/shell/catalogueContext.d.ts +6 -0
- package/dist/src/shell/catalogueContext.d.ts.map +1 -0
- package/dist/src/shell/catalogueContext.js +14 -0
- package/dist/src/shell/catalogueContext.js.map +1 -0
- package/dist/src/shell/codeTokens.d.ts +23 -0
- package/dist/src/shell/codeTokens.d.ts.map +1 -0
- package/dist/src/shell/codeTokens.js +48 -0
- package/dist/src/shell/codeTokens.js.map +1 -0
- package/dist/src/shell/codeWriter.d.ts +6 -0
- package/dist/src/shell/codeWriter.d.ts.map +1 -0
- package/dist/src/shell/codeWriter.js +14 -0
- package/dist/src/shell/codeWriter.js.map +1 -0
- package/dist/src/shell/compareVariants.d.ts +35 -0
- package/dist/src/shell/compareVariants.d.ts.map +1 -0
- package/dist/src/shell/compareVariants.js +68 -0
- package/dist/src/shell/compareVariants.js.map +1 -0
- package/dist/src/shell/dockTabs.d.ts +63 -0
- package/dist/src/shell/dockTabs.d.ts.map +1 -0
- package/dist/src/shell/dockTabs.js +140 -0
- package/dist/src/shell/dockTabs.js.map +1 -0
- package/dist/src/shell/icons.d.ts +47 -0
- package/dist/src/shell/icons.d.ts.map +1 -0
- package/dist/src/shell/icons.js +36 -0
- package/dist/src/shell/icons.js.map +1 -0
- package/dist/src/shell/keyboard.d.ts +35 -0
- package/dist/src/shell/keyboard.d.ts.map +1 -0
- package/dist/src/shell/keyboard.js +51 -0
- package/dist/src/shell/keyboard.js.map +1 -0
- package/dist/src/shell/mountShell.d.ts +22 -0
- package/dist/src/shell/mountShell.d.ts.map +1 -0
- package/dist/src/shell/mountShell.js +39 -0
- package/dist/src/shell/mountShell.js.map +1 -0
- package/dist/src/shell/shell.css +1831 -0
- package/dist/src/shell/strings.d.ts +184 -0
- package/dist/src/shell/strings.d.ts.map +1 -0
- package/dist/src/shell/strings.js +188 -0
- package/dist/src/shell/strings.js.map +1 -0
- package/dist/src/shell/switchView.d.ts +23 -0
- package/dist/src/shell/switchView.d.ts.map +1 -0
- package/dist/src/shell/switchView.js +19 -0
- package/dist/src/shell/switchView.js.map +1 -0
- package/dist/src/shell/treeSearch.d.ts +35 -0
- package/dist/src/shell/treeSearch.d.ts.map +1 -0
- package/dist/src/shell/treeSearch.js +60 -0
- package/dist/src/shell/treeSearch.js.map +1 -0
- package/dist/src/shell/useComponentDocs.d.ts +16 -0
- package/dist/src/shell/useComponentDocs.d.ts.map +1 -0
- package/dist/src/shell/useComponentDocs.js +25 -0
- package/dist/src/shell/useComponentDocs.js.map +1 -0
- package/dist/src/shell/useCopy.d.ts +10 -0
- package/dist/src/shell/useCopy.d.ts.map +1 -0
- package/dist/src/shell/useCopy.js +23 -0
- package/dist/src/shell/useCopy.js.map +1 -0
- package/dist/src/shell/useFrameMessages.d.ts +54 -0
- package/dist/src/shell/useFrameMessages.d.ts.map +1 -0
- package/dist/src/shell/useFrameMessages.js +90 -0
- package/dist/src/shell/useFrameMessages.js.map +1 -0
- package/dist/src/shell/useFrameQueue.d.ts +29 -0
- package/dist/src/shell/useFrameQueue.d.ts.map +1 -0
- package/dist/src/shell/useFrameQueue.js +72 -0
- package/dist/src/shell/useFrameQueue.js.map +1 -0
- package/dist/src/shell/useLiveView.d.ts +29 -0
- package/dist/src/shell/useLiveView.d.ts.map +1 -0
- package/dist/src/shell/useLiveView.js +51 -0
- package/dist/src/shell/useLiveView.js.map +1 -0
- package/dist/src/shell/useLoaded.d.ts +20 -0
- package/dist/src/shell/useLoaded.d.ts.map +1 -0
- package/dist/src/shell/useLoaded.js +40 -0
- package/dist/src/shell/useLoaded.js.map +1 -0
- package/dist/src/shell/usePageDoc.d.ts +20 -0
- package/dist/src/shell/usePageDoc.d.ts.map +1 -0
- package/dist/src/shell/usePageDoc.js +21 -0
- package/dist/src/shell/usePageDoc.js.map +1 -0
- package/dist/src/shell/usePopover.d.ts +23 -0
- package/dist/src/shell/usePopover.d.ts.map +1 -0
- package/dist/src/shell/usePopover.js +39 -0
- package/dist/src/shell/usePopover.js.map +1 -0
- package/dist/src/shell/useRecentPages.d.ts +21 -0
- package/dist/src/shell/useRecentPages.d.ts.map +1 -0
- package/dist/src/shell/useRecentPages.js +62 -0
- package/dist/src/shell/useRecentPages.js.map +1 -0
- package/dist/src/shell/useScrollMemory.d.ts +40 -0
- package/dist/src/shell/useScrollMemory.d.ts.map +1 -0
- package/dist/src/shell/useScrollMemory.js +69 -0
- package/dist/src/shell/useScrollMemory.js.map +1 -0
- package/dist/src/shell/useSidebarLayout.d.ts +14 -0
- package/dist/src/shell/useSidebarLayout.d.ts.map +1 -0
- package/dist/src/shell/useSidebarLayout.js +19 -0
- package/dist/src/shell/useSidebarLayout.js.map +1 -0
- package/dist/src/shell/useStored.d.ts +11 -0
- package/dist/src/shell/useStored.d.ts.map +1 -0
- package/dist/src/shell/useStored.js +68 -0
- package/dist/src/shell/useStored.js.map +1 -0
- package/dist/src/shell/useStoryCode.d.ts +14 -0
- package/dist/src/shell/useStoryCode.d.ts.map +1 -0
- package/dist/src/shell/useStoryCode.js +29 -0
- package/dist/src/shell/useStoryCode.js.map +1 -0
- package/dist/src/shell/useStoryHeights.d.ts +9 -0
- package/dist/src/shell/useStoryHeights.d.ts.map +1 -0
- package/dist/src/shell/useStoryHeights.js +31 -0
- package/dist/src/shell/useStoryHeights.js.map +1 -0
- package/dist/src/shell/useStoryIdsElement.d.ts +7 -0
- package/dist/src/shell/useStoryIdsElement.d.ts.map +1 -0
- package/dist/src/shell/useStoryIdsElement.js +29 -0
- package/dist/src/shell/useStoryIdsElement.js.map +1 -0
- package/dist/src/shell/useStoryKeys.d.ts +11 -0
- package/dist/src/shell/useStoryKeys.d.ts.map +1 -0
- package/dist/src/shell/useStoryKeys.js +40 -0
- package/dist/src/shell/useStoryKeys.js.map +1 -0
- package/dist/src/shell/useSystemDark.d.ts +3 -0
- package/dist/src/shell/useSystemDark.d.ts.map +1 -0
- package/dist/src/shell/useSystemDark.js +19 -0
- package/dist/src/shell/useSystemDark.js.map +1 -0
- package/dist/src/sourceFiles.d.ts +18 -0
- package/dist/src/sourceFiles.d.ts.map +1 -0
- package/dist/src/sourceFiles.js +22 -0
- package/dist/src/sourceFiles.js.map +1 -0
- package/dist/src/storyBackground.d.ts +21 -0
- package/dist/src/storyBackground.d.ts.map +1 -0
- package/dist/src/storyBackground.js +27 -0
- package/dist/src/storyBackground.js.map +1 -0
- package/dist/src/storyClock.d.ts +62 -0
- package/dist/src/storyClock.d.ts.map +1 -0
- package/dist/src/storyClock.js +51 -0
- package/dist/src/storyClock.js.map +1 -0
- package/dist/src/storyGlobals.d.ts +60 -0
- package/dist/src/storyGlobals.d.ts.map +1 -0
- package/dist/src/storyGlobals.js +117 -0
- package/dist/src/storyGlobals.js.map +1 -0
- package/dist/src/storyHeights.d.ts +37 -0
- package/dist/src/storyHeights.d.ts.map +1 -0
- package/dist/src/storyHeights.js +53 -0
- package/dist/src/storyHeights.js.map +1 -0
- package/dist/src/storyIdsElement.d.ts +9 -0
- package/dist/src/storyIdsElement.d.ts.map +1 -0
- package/dist/src/storyIdsElement.js +9 -0
- package/dist/src/storyIdsElement.js.map +1 -0
- package/dist/src/storyTexts.d.ts +43 -0
- package/dist/src/storyTexts.d.ts.map +1 -0
- package/dist/src/storyTexts.js +71 -0
- package/dist/src/storyTexts.js.map +1 -0
- package/dist/src/storyTree.d.ts +215 -0
- package/dist/src/storyTree.d.ts.map +1 -0
- package/dist/src/storyTree.js +308 -0
- package/dist/src/storyTree.js.map +1 -0
- package/dist/src/switches.d.ts +156 -0
- package/dist/src/switches.d.ts.map +1 -0
- package/dist/src/switches.js +193 -0
- package/dist/src/switches.js.map +1 -0
- package/dist/src/viewState.d.ts +194 -0
- package/dist/src/viewState.d.ts.map +1 -0
- package/dist/src/viewState.js +303 -0
- package/dist/src/viewState.js.map +1 -0
- package/dist/src/vite/adapter.d.ts +70 -0
- package/dist/src/vite/adapter.d.ts.map +1 -0
- package/dist/src/vite/adapter.js +22 -0
- package/dist/src/vite/adapter.js.map +1 -0
- package/dist/src/vite/autoTitle.d.ts +28 -0
- package/dist/src/vite/autoTitle.d.ts.map +1 -0
- package/dist/src/vite/autoTitle.js +44 -0
- package/dist/src/vite/autoTitle.js.map +1 -0
- package/dist/src/vite/componentPage.d.ts +34 -0
- package/dist/src/vite/componentPage.d.ts.map +1 -0
- package/dist/src/vite/componentPage.js +94 -0
- package/dist/src/vite/componentPage.js.map +1 -0
- package/dist/src/vite/config.d.ts +72 -0
- package/dist/src/vite/config.d.ts.map +1 -0
- package/dist/src/vite/config.js +25 -0
- package/dist/src/vite/config.js.map +1 -0
- package/dist/src/vite/configFile.d.ts +76 -0
- package/dist/src/vite/configFile.d.ts.map +1 -0
- package/dist/src/vite/configFile.js +190 -0
- package/dist/src/vite/configFile.js.map +1 -0
- package/dist/src/vite/docsExtractor.d.ts +46 -0
- package/dist/src/vite/docsExtractor.d.ts.map +1 -0
- package/dist/src/vite/docsExtractor.js +88 -0
- package/dist/src/vite/docsExtractor.js.map +1 -0
- package/dist/src/vite/docsProgram.d.ts +42 -0
- package/dist/src/vite/docsProgram.d.ts.map +1 -0
- package/dist/src/vite/docsProgram.js +144 -0
- package/dist/src/vite/docsProgram.js.map +1 -0
- package/dist/src/vite/docsWorker.d.ts +2 -0
- package/dist/src/vite/docsWorker.d.ts.map +1 -0
- package/dist/src/vite/docsWorker.js +68 -0
- package/dist/src/vite/docsWorker.js.map +1 -0
- package/dist/src/vite/forcedStates.d.ts +27 -0
- package/dist/src/vite/forcedStates.d.ts.map +1 -0
- package/dist/src/vite/forcedStates.js +60 -0
- package/dist/src/vite/forcedStates.js.map +1 -0
- package/dist/src/vite/forgebookPlugin.d.ts +28 -0
- package/dist/src/vite/forgebookPlugin.d.ts.map +1 -0
- package/dist/src/vite/forgebookPlugin.js +375 -0
- package/dist/src/vite/forgebookPlugin.js.map +1 -0
- package/dist/src/vite/highlightCode.d.ts +16 -0
- package/dist/src/vite/highlightCode.d.ts.map +1 -0
- package/dist/src/vite/highlightCode.js +82 -0
- package/dist/src/vite/highlightCode.js.map +1 -0
- package/dist/src/vite/indexStoryFile.d.ts +35 -0
- package/dist/src/vite/indexStoryFile.d.ts.map +1 -0
- package/dist/src/vite/indexStoryFile.js +458 -0
- package/dist/src/vite/indexStoryFile.js.map +1 -0
- package/dist/src/vite/pages.d.ts +49 -0
- package/dist/src/vite/pages.d.ts.map +1 -0
- package/dist/src/vite/pages.js +171 -0
- package/dist/src/vite/pages.js.map +1 -0
- package/dist/src/vite/prebundled.d.ts +30 -0
- package/dist/src/vite/prebundled.d.ts.map +1 -0
- package/dist/src/vite/prebundled.js +81 -0
- package/dist/src/vite/prebundled.js.map +1 -0
- package/dist/src/vite/storyCode.d.ts +28 -0
- package/dist/src/vite/storyCode.d.ts.map +1 -0
- package/dist/src/vite/storyCode.js +80 -0
- package/dist/src/vite/storyCode.js.map +1 -0
- package/dist/src/vite/storyFilesModule.d.ts +17 -0
- package/dist/src/vite/storyFilesModule.d.ts.map +1 -0
- package/dist/src/vite/storyFilesModule.js +64 -0
- package/dist/src/vite/storyFilesModule.js.map +1 -0
- package/dist/src/vite/storyMeta.d.ts +34 -0
- package/dist/src/vite/storyMeta.d.ts.map +1 -0
- package/dist/src/vite/storyMeta.js +74 -0
- package/dist/src/vite/storyMeta.js.map +1 -0
- package/dist/src/vite/typeScriptPieces.d.ts +23 -0
- package/dist/src/vite/typeScriptPieces.d.ts.map +1 -0
- package/dist/src/vite/typeScriptPieces.js +236 -0
- package/dist/src/vite/typeScriptPieces.js.map +1 -0
- package/package.json +202 -3
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The sidebar: a search field and the tree, by source, family (opens and closes), group and component, one line per
|
|
4
|
+
* component that never opens: a component's link opens its page, and its stories are picked in the page's header, so
|
|
5
|
+
* nothing in the list folds under the pointer. A family stays open once opened; a search finds a component by its
|
|
6
|
+
* name, its place, its meta's search words or its stories' names and descriptions. A component listed in other places too (`alsoIn`) has an
|
|
7
|
+
* alias entry in each, beside the components that live there, which says where it lives and opens its page (D-492).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { useEffect, useRef, useState } from "react";
|
|
12
|
+
import { Icon } from "./icons.js";
|
|
13
|
+
import { isTyping } from "./keyboard.js";
|
|
14
|
+
import { STRINGS } from "./strings.js";
|
|
15
|
+
import { foundFamily, searchWords } from "./treeSearch.js";
|
|
16
|
+
/** A family's key, unique across sources. */
|
|
17
|
+
const familyKey = (source, family) => `${source.id}/${family.name}`;
|
|
18
|
+
/** The key of the family the shown component is in; none when no component is shown. */
|
|
19
|
+
const currentFamilyOf = (tree, current) => {
|
|
20
|
+
if (current === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const source = tree.sources.find((candidate) => candidate.id === current.sourceId);
|
|
23
|
+
const family = source?.families.find((candidate) => candidate.groups.some((group) => group.components.some((component) => component.title === current.title)));
|
|
24
|
+
return source === undefined || family === undefined ? undefined : familyKey(source, family);
|
|
25
|
+
};
|
|
26
|
+
/** A link that opens a page in place, keeping a real address for a new tab. */
|
|
27
|
+
const PageLink = ({ href, className, current, onOpen, children }) => (_jsx("a", { className: className, href: href, "aria-current": current, onClick: (event) => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
onOpen();
|
|
30
|
+
}, children: children }));
|
|
31
|
+
/** How many components a family holds. */
|
|
32
|
+
const componentCount = (family) => family.groups.reduce((count, group) => count + group.components.length, 0);
|
|
33
|
+
/** What the shown component's link is: the page itself on the component's page, where the page is on a story's. */
|
|
34
|
+
const currentKind = (currentStoryId) => currentStoryId === undefined ? "page" : "location";
|
|
35
|
+
/** A component's link: its page, where its stories are picked from the header. */
|
|
36
|
+
const ComponentEntry = ({ sourceId, component, isCurrent, currentStoryId, links }) => {
|
|
37
|
+
const current = isCurrent ? currentKind(currentStoryId) : undefined;
|
|
38
|
+
return (_jsx("div", { className: "forgebook-tree__component", children: _jsxs(PageLink, { href: links.componentHref(sourceId, component.title), className: "forgebook-tree__item", current: current, onOpen: () => links.onOpenComponent(sourceId, component.title), children: [_jsx("span", { className: "forgebook-tree__item-name", children: component.name }), _jsx("span", { className: "forgebook-tree__count", children: component.stories.length })] }) }));
|
|
39
|
+
};
|
|
40
|
+
/** The family a title places a component in: its first segment. */
|
|
41
|
+
const familyOf = (title) => title.split("/")[0]?.trim() ?? title;
|
|
42
|
+
/**
|
|
43
|
+
* An alias entry: the name of a component that lives elsewhere, marked with the family it lives in, opening its page
|
|
44
|
+
* (D-492). It is never marked as the shown page: the entry where the component lives is, so the sidebar says where
|
|
45
|
+
* it sits.
|
|
46
|
+
*/
|
|
47
|
+
const AliasEntry = ({ sourceId, alias, links }) => (_jsx("div", { className: "forgebook-tree__component", title: STRINGS.aliasHint(alias.title.split("/").join(" › ")), children: _jsxs(PageLink, { href: links.componentHref(sourceId, alias.title), className: "forgebook-tree__item", current: undefined, onOpen: () => links.onOpenComponent(sourceId, alias.title), children: [_jsx("span", { className: "forgebook-tree__item-name", children: alias.name }), _jsxs("span", { className: "forgebook-tree__alias", children: [_jsx(Icon, { name: "external", size: 10 }), STRINGS.aliasPlace(familyOf(alias.title))] })] }) }));
|
|
48
|
+
/** A group's entries in name order: its own components and the aliases of components that live elsewhere. */
|
|
49
|
+
const groupEntries = (group) => [
|
|
50
|
+
...group.components.map((component) => ({ kind: "component", component, name: component.name })),
|
|
51
|
+
...group.aliases.map((alias) => ({ kind: "alias", alias, name: alias.name }))
|
|
52
|
+
].sort((left, right) => left.name.localeCompare(right.name));
|
|
53
|
+
/**
|
|
54
|
+
* The sidebar.
|
|
55
|
+
*
|
|
56
|
+
* @param props - the tree, the shown component and how to open one.
|
|
57
|
+
*/
|
|
58
|
+
export const Sidebar = ({ title, logo, tree, isHome, homeHref, onOpenHome, current, width, isOpen, onHide, ...links }) => {
|
|
59
|
+
const [query, setQuery] = useState("");
|
|
60
|
+
const searchRef = useRef(null);
|
|
61
|
+
const navRef = useRef(null);
|
|
62
|
+
// the shown component stays in sight: a page opened by a key, the picker or the address scrolls the list to it
|
|
63
|
+
const currentTitle = current?.title;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (currentTitle === undefined)
|
|
66
|
+
return;
|
|
67
|
+
navRef.current
|
|
68
|
+
?.querySelector(".forgebook-tree__item[aria-current]")
|
|
69
|
+
?.scrollIntoView({ block: "nearest" });
|
|
70
|
+
}, [currentTitle]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
// "/" goes to the search from anywhere in the shell, as in most catalogues
|
|
73
|
+
// a hidden sidebar leaves the key to the page
|
|
74
|
+
if (!isOpen)
|
|
75
|
+
return;
|
|
76
|
+
const focusSearch = (event) => {
|
|
77
|
+
if (event.key !== "/" || event.metaKey || event.ctrlKey || event.altKey || isTyping(event.target))
|
|
78
|
+
return;
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
searchRef.current?.focus();
|
|
81
|
+
};
|
|
82
|
+
document.addEventListener("keydown", focusSearch);
|
|
83
|
+
return () => document.removeEventListener("keydown", focusSearch);
|
|
84
|
+
}, [isOpen]);
|
|
85
|
+
// the families the user opened or closed, and the ones a shown component opened: once open, a family stays open
|
|
86
|
+
// until the user closes it, so opening a component elsewhere never folds the list under the pointer
|
|
87
|
+
const [familyChoices, setFamilyChoices] = useState(new Map());
|
|
88
|
+
const currentFamilyKey = currentFamilyOf(tree, current);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (currentFamilyKey === undefined)
|
|
91
|
+
return;
|
|
92
|
+
setFamilyChoices((choices) => choices.has(currentFamilyKey) ? choices : new Map(choices).set(currentFamilyKey, true));
|
|
93
|
+
}, [currentFamilyKey]);
|
|
94
|
+
const words = searchWords(query);
|
|
95
|
+
const isSearching = words.length > 0;
|
|
96
|
+
const isCurrentFamily = (source, family) => current?.sourceId === source.id &&
|
|
97
|
+
family.groups.some((group) => group.components.some((component) => component.title === current.title));
|
|
98
|
+
const setFamilyOpen = (key, isOpen) => setFamilyChoices((choices) => new Map(choices).set(key, isOpen));
|
|
99
|
+
const sources = tree.sources.map((source) => ({
|
|
100
|
+
source,
|
|
101
|
+
families: source.families.flatMap((family) => {
|
|
102
|
+
const shown = foundFamily(family, words);
|
|
103
|
+
return shown === undefined ? [] : [shown];
|
|
104
|
+
})
|
|
105
|
+
}));
|
|
106
|
+
const hasMatches = sources.some(({ families }) => families.length > 0);
|
|
107
|
+
return (_jsxs("aside", { className: "forgebook-sidebar", "data-open": isOpen ? "" : undefined, inert: !isOpen, style: { width, marginInlineStart: isOpen ? 0 : -width }, children: [_jsxs("div", { className: "forgebook-brand", children: [_jsxs("a", { className: "forgebook-brand__home", href: homeHref, "aria-current": isHome ? "page" : undefined, title: STRINGS.home, onClick: (event) => {
|
|
108
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
|
|
109
|
+
return;
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
onOpenHome();
|
|
112
|
+
}, children: [logo === undefined ? (_jsx("span", { className: "forgebook-brand__mark", children: _jsx(Icon, { name: "compare", size: 14 }) })) : (_jsx("img", { className: "forgebook-brand__logo", src: logo, alt: "", width: 28, height: 28 })), _jsx("span", { className: "forgebook-brand__name", children: title })] }), _jsx("button", { type: "button", className: "forgebook-icon-button forgebook-brand__hide", title: STRINGS.hideSidebar, "aria-label": STRINGS.hideSidebar, onClick: onHide, children: _jsx(Icon, { name: "sidebar", size: 14 }) })] }), _jsxs("label", { className: "forgebook-search", children: [_jsx(Icon, { name: "search", size: 14 }), _jsx("input", { type: "search", ref: searchRef, value: query, onKeyDown: (event) => {
|
|
113
|
+
// Escape empties the search first, then leaves the field
|
|
114
|
+
if (event.key !== "Escape")
|
|
115
|
+
return;
|
|
116
|
+
if (query === "")
|
|
117
|
+
event.currentTarget.blur();
|
|
118
|
+
else
|
|
119
|
+
setQuery("");
|
|
120
|
+
}, placeholder: STRINGS.searchPlaceholder, "aria-label": STRINGS.searchLabel, onChange: (event) => setQuery(event.target.value) }), query === "" ? (_jsx("kbd", { className: "forgebook-search__key", children: "/" })) : (_jsx("button", { type: "button", className: "forgebook-search__clear", "aria-label": STRINGS.clearSearch, title: STRINGS.clearSearch, onClick: () => {
|
|
121
|
+
setQuery("");
|
|
122
|
+
searchRef.current?.focus();
|
|
123
|
+
}, children: _jsx(Icon, { name: "close", size: 10 }) }))] }), _jsxs("nav", { ref: navRef, className: "forgebook-tree", "aria-label": STRINGS.componentsNav, children: [hasMatches ? null : _jsx("p", { className: "forgebook-tree__empty", children: STRINGS.noMatch }), sources.map(({ source, families }) => families.length === 0 ? null : (_jsxs("section", { className: "forgebook-tree__source", children: [_jsxs("h2", { className: "forgebook-tree__source-name", children: [source.logo === undefined ? null : (_jsx("img", { className: "forgebook-source-logo", src: source.logo, alt: "", width: 14, height: 14 })), source.name] }), families.map((family) => {
|
|
124
|
+
const key = familyKey(source, family);
|
|
125
|
+
// a search opens every family it finds something in
|
|
126
|
+
const isOpen = isSearching || (familyChoices.get(key) ?? isCurrentFamily(source, family));
|
|
127
|
+
return (_jsxs("div", { className: "forgebook-tree__family", children: [_jsxs("button", { type: "button", className: "forgebook-tree__family-button", "aria-expanded": isOpen, onClick: () => setFamilyOpen(key, !isOpen), children: [_jsx(Icon, { name: isOpen ? "chevronDown" : "chevronRight", size: 12 }), _jsx("span", { className: "forgebook-tree__family-name", children: family.name }), _jsx("span", { className: "forgebook-tree__count", children: componentCount(family) })] }), isOpen
|
|
128
|
+
? family.groups.map((group) => (_jsxs("div", { className: "forgebook-tree__group", children: [group.name === undefined ? null : (_jsx("h3", { className: "forgebook-tree__group-name", children: group.name })), groupEntries(group).map((entry) => entry.kind === "component" ? (_jsx(ComponentEntry, { sourceId: source.id, component: entry.component, isCurrent: current?.sourceId === source.id && current.title === entry.component.title, currentStoryId: current?.storyId, links: links }, entry.component.title)) : (_jsx(AliasEntry, { sourceId: source.id, alias: entry.alias, links: links }, `alias:${entry.alias.title}`)))] }, group.name ?? "")))
|
|
129
|
+
: null] }, key));
|
|
130
|
+
})] }, source.id)))] })] }));
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../src/shell/Sidebar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,EAKL,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,IAAI,EAAE,MAAM,YAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAmC3D,6CAA6C;AAC7C,MAAM,SAAS,GAAG,CAAC,MAAkB,EAAE,MAAkB,EAAU,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;AAEpG,wFAAwF;AACxF,MAAM,eAAe,GAAG,CAAC,IAAe,EAAE,OAAgC,EAAsB,EAAE;IAChG,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACjD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAC1G,CAAC;IACF,OAAO,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
+
*/
|
|
6
|
+
import type { ReactNode } from "react";
|
|
7
|
+
/** The sidebar's width, in CSS px: the default, the bounds, and one arrow key's step. */
|
|
8
|
+
export declare const SIDEBAR_WIDTH: {
|
|
9
|
+
readonly initial: 248;
|
|
10
|
+
readonly min: 192;
|
|
11
|
+
readonly max: 448;
|
|
12
|
+
readonly step: 16;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A width kept between the sidebar's bounds, in whole pixels.
|
|
16
|
+
*
|
|
17
|
+
* @param width - a width in CSS px.
|
|
18
|
+
*/
|
|
19
|
+
export declare const boundedSidebarWidth: (width: number) => number;
|
|
20
|
+
/**
|
|
21
|
+
* The sidebar's handle.
|
|
22
|
+
*
|
|
23
|
+
* @param props - the width and its setter.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SidebarHandle: ({ width, onWidthChange }: {
|
|
26
|
+
readonly width: number;
|
|
27
|
+
readonly onWidthChange: (width: number) => void;
|
|
28
|
+
}) => ReactNode;
|
|
29
|
+
//# sourceMappingURL=SidebarHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarHandle.d.ts","sourceRoot":"","sources":["../../../src/shell/SidebarHandle.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpE,yFAAyF;AACzF,eAAO,MAAM,aAAa;;;;;CAA0D,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,MACyB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,0BAG3B;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD,KAAG,SAwCH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { STRINGS } from "./strings.js";
|
|
3
|
+
/** The sidebar's width, in CSS px: the default, the bounds, and one arrow key's step. */
|
|
4
|
+
export const SIDEBAR_WIDTH = { initial: 248, min: 192, max: 448, step: 16 };
|
|
5
|
+
/**
|
|
6
|
+
* A width kept between the sidebar's bounds, in whole pixels.
|
|
7
|
+
*
|
|
8
|
+
* @param width - a width in CSS px.
|
|
9
|
+
*/
|
|
10
|
+
export const boundedSidebarWidth = (width) => Math.round(Math.min(SIDEBAR_WIDTH.max, Math.max(SIDEBAR_WIDTH.min, width)));
|
|
11
|
+
/**
|
|
12
|
+
* The sidebar's handle.
|
|
13
|
+
*
|
|
14
|
+
* @param props - the width and its setter.
|
|
15
|
+
*/
|
|
16
|
+
export const SidebarHandle = ({ width, onWidthChange }) => {
|
|
17
|
+
const startResize = (event) => {
|
|
18
|
+
if (event.button !== 0)
|
|
19
|
+
return;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
const handle = event.currentTarget;
|
|
22
|
+
handle.setPointerCapture(event.pointerId);
|
|
23
|
+
const startX = event.clientX;
|
|
24
|
+
const startWidth = width;
|
|
25
|
+
const move = (moveEvent) => onWidthChange(boundedSidebarWidth(startWidth + moveEvent.clientX - startX));
|
|
26
|
+
const end = () => {
|
|
27
|
+
handle.removeEventListener("pointermove", move);
|
|
28
|
+
handle.removeEventListener("pointerup", end);
|
|
29
|
+
handle.removeEventListener("pointercancel", end);
|
|
30
|
+
};
|
|
31
|
+
handle.addEventListener("pointermove", move);
|
|
32
|
+
handle.addEventListener("pointerup", end);
|
|
33
|
+
handle.addEventListener("pointercancel", end);
|
|
34
|
+
};
|
|
35
|
+
const resizeWithKeys = (event) => {
|
|
36
|
+
if (event.key === "ArrowRight")
|
|
37
|
+
onWidthChange(boundedSidebarWidth(width + SIDEBAR_WIDTH.step));
|
|
38
|
+
else if (event.key === "ArrowLeft")
|
|
39
|
+
onWidthChange(boundedSidebarWidth(width - SIDEBAR_WIDTH.step));
|
|
40
|
+
else
|
|
41
|
+
return;
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
};
|
|
44
|
+
return (_jsx("div", { className: "forgebook-sidebar-handle", role: "separator", "aria-orientation": "vertical", "aria-label": STRINGS.sidebarWidth, "aria-valuenow": width, "aria-valuemin": SIDEBAR_WIDTH.min, "aria-valuemax": SIDEBAR_WIDTH.max, tabIndex: 0, onPointerDown: startResize, onKeyDown: resizeWithKeys }));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=SidebarHandle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarHandle.js","sourceRoot":"","sources":["../../../src/shell/SidebarHandle.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAW,CAAC;AAErF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE,CAC3D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,KAAK,EACL,aAAa,EAId,EAAa,EAAE;IACd,MAAM,WAAW,GAAG,CAAC,KAAmC,EAAQ,EAAE;QAChE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC/B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;QACnC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,C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,EAAE,CAAC,EACX,aAAa,EAAE,WAAW,EAC1B,SAAS,EAAE,cAAc,GACzB,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stage: the chosen story in its frame, at the view's width, with Replay, a Live story's clock controls (D-504)
|
|
3
|
+
* and a link to the frame alone, or the
|
|
4
|
+
* four variants side by side in the compare view; the panel docked under it when it is open.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The story and the panel scroll apart: reading the props, the code or the accessibility results never moves the
|
|
8
|
+
* story away. The view's live part (theme, contrast, motion, text size) reaches the shown frame as a message, so the
|
|
9
|
+
* story keeps its state; only the story, the style sheets or the language load the frame again.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { type ReactNode } from "react";
|
|
14
|
+
import type { PanelArgs } from "../messages.ts";
|
|
15
|
+
import type { NamedValues } from "../namedValues.ts";
|
|
16
|
+
import { type FixedView } from "../storyGlobals.ts";
|
|
17
|
+
import type { TreeComponent, TreeStory } from "../storyTree.ts";
|
|
18
|
+
import { type ViewState } from "../viewState.ts";
|
|
19
|
+
import { type PageScroll } from "./useScrollMemory.ts";
|
|
20
|
+
/** The stage's props. */
|
|
21
|
+
export type StageProps = {
|
|
22
|
+
/** The component the story belongs to. */
|
|
23
|
+
readonly component: TreeComponent;
|
|
24
|
+
/** The shown story. */
|
|
25
|
+
readonly story: TreeStory;
|
|
26
|
+
/** The view. */
|
|
27
|
+
readonly view: ViewState;
|
|
28
|
+
/** Called with the changed view (the width the handle set, the panel's tab). */
|
|
29
|
+
readonly onViewChange: (view: ViewState) => void;
|
|
30
|
+
/** Called with what a story fixes of the view, once its frame read it, for the toolbar to show. */
|
|
31
|
+
readonly onFixedChange: (storyId: string, fixed: FixedView) => void;
|
|
32
|
+
/** The values set in the Props tab, over the story's own args (kept in the address). */
|
|
33
|
+
readonly panelArgs: PanelArgs;
|
|
34
|
+
/** Called with the panel's changed values. */
|
|
35
|
+
readonly onPanelArgsChange: (args: PanelArgs) => void;
|
|
36
|
+
/** The matrix's axes (kept in the address): the rows' prop, then the columns'; empty draws the story alone. */
|
|
37
|
+
readonly matrixAxes: readonly string[];
|
|
38
|
+
/** Called with the chosen axes. */
|
|
39
|
+
readonly onMatrixAxesChange: (axes: readonly string[]) => void;
|
|
40
|
+
/** The frame page's address. */
|
|
41
|
+
readonly frameUrl: string;
|
|
42
|
+
/** Loads the story file's code for the Code tab; `undefined` when the source has none. */
|
|
43
|
+
readonly loadCode: (() => Promise<unknown>) | undefined;
|
|
44
|
+
/** Loads the component's docs for the panel; `undefined` when the source has none for the file. */
|
|
45
|
+
readonly loadDocs: (() => Promise<unknown>) | undefined;
|
|
46
|
+
/** The values the story's source names for types the panel cannot write (icons). */
|
|
47
|
+
readonly namedValues: NamedValues | undefined;
|
|
48
|
+
/** What stays above the story while it scrolls: the component's header. */
|
|
49
|
+
readonly header: ReactNode;
|
|
50
|
+
/** Called with the width the story really has, for the toolbar's width field. */
|
|
51
|
+
readonly onShownWidthChange: (width: number | undefined) => void;
|
|
52
|
+
/** The story's measured height at about its width (`forgebook-heights`), for its box while it loads; none unmeasured. */
|
|
53
|
+
readonly measuredHeight: number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The colour the story's page has in a view (its source's, or the backdrop's when the view draws one), which its
|
|
56
|
+
* box waits on; none without one.
|
|
57
|
+
*/
|
|
58
|
+
readonly backgroundOf: (view: Pick<ViewState, "switches" | "backdrop">) => string | undefined;
|
|
59
|
+
/** Where its scrolling part starts: the shell's visit of the page and every page's last position. */
|
|
60
|
+
readonly scroll: PageScroll;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The stage.
|
|
64
|
+
*
|
|
65
|
+
* @param props - the component, the story, the view, the panel's values, the frame page and the loaders.
|
|
66
|
+
*/
|
|
67
|
+
export declare const Stage: ({ component, story, view: ownView, onViewChange: onOwnViewChange, onFixedChange, panelArgs, onPanelArgsChange, matrixAxes, onMatrixAxesChange, frameUrl, loadCode, loadDocs, namedValues, header, onShownWidthChange, measuredHeight, backgroundOf, scroll }: StageProps) => ReactNode;
|
|
68
|
+
//# sourceMappingURL=Stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stage.d.ts","sourceRoot":"","sources":["../../../src/shell/Stage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAwD,MAAM,OAAO,CAAC;AAI7F,OAAO,KAAK,EAAY,SAAS,EAAgB,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,KAAK,SAAS,EAAsC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAiBzB,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,sBAAsB,CAAC;AAuCxE,yBAAyB;AACzB,MAAM,MAAM,UAAU,GAAG;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,uBAAuB;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACjD,mGAAmG;IACnG,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACpE,wFAAwF;IACxF,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,iBAAiB,EA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Replay, a Live story's clock controls (D-504)
|
|
4
|
+
* and a link to the frame alone, or the
|
|
5
|
+
* four variants side by side in the compare view; the panel docked under it when it is open.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The story and the panel scroll apart: reading the props, the code or the accessibility results never moves the
|
|
9
|
+
* story away. The view's live part (theme, contrast, motion, text size) reaches the shown frame as a message, so the
|
|
10
|
+
* story keeps its state; only the story, the style sheets or the language load the frame again.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
15
|
+
import { matrixOf, matrixProps } from "../matrix.js";
|
|
16
|
+
import { NOT_FIXED, withFixed, withOwnFixed } from "../storyGlobals.js";
|
|
17
|
+
import { frameAddress, isComparing, liveView } from "../viewState.js";
|
|
18
|
+
import { ClockControls, useStoryClockControls } from "./ClockControls.js";
|
|
19
|
+
import { useCatalogue } from "./catalogueContext.js";
|
|
20
|
+
import { compareVariants } from "./compareVariants.js";
|
|
21
|
+
import { Dock } from "./Dock.js";
|
|
22
|
+
import { dockTabs } from "./dockTabs.js";
|
|
23
|
+
import { FrameView, tellFrames } from "./FrameView.js";
|
|
24
|
+
import { Icon } from "./icons.js";
|
|
25
|
+
import { MatrixPicker } from "./MatrixPicker.js";
|
|
26
|
+
import { StageTools } from "./StageTools.js";
|
|
27
|
+
import { StageViewport } from "./StageViewport.js";
|
|
28
|
+
import { STRINGS } from "./strings.js";
|
|
29
|
+
import { useComponentDocs } from "./useComponentDocs.js";
|
|
30
|
+
import { useCopy } from "./useCopy.js";
|
|
31
|
+
import { useFrameMessages } from "./useFrameMessages.js";
|
|
32
|
+
import { useLiveView, useLoadedView } from "./useLiveView.js";
|
|
33
|
+
import { useScrollMemory } from "./useScrollMemory.js";
|
|
34
|
+
import { useStoryCode } from "./useStoryCode.js";
|
|
35
|
+
/** The `argTypes` of a story before its frame reported them. */
|
|
36
|
+
const NO_ARG_TYPES = {};
|
|
37
|
+
/**
|
|
38
|
+
* What the stage's handles set the width with; none, so no handles, when the story fixes the width.
|
|
39
|
+
*
|
|
40
|
+
* @param fixed - what the story fixes.
|
|
41
|
+
* @param view - the view shown.
|
|
42
|
+
* @param onViewChange - the view's setter.
|
|
43
|
+
*/
|
|
44
|
+
const widthSetter = (fixed, view, onViewChange) => fixed.width === undefined ? (width) => onViewChange({ ...view, width }) : undefined;
|
|
45
|
+
/**
|
|
46
|
+
* A story's `argTypes`, controls, actions and fixed view for the panel and the stage: as its frame read them once it ran, which sees a setting
|
|
47
|
+
* written by code the index leaves out; the index's controls and no `argTypes` or actions before.
|
|
48
|
+
*
|
|
49
|
+
* @param panels - what each story's frame reported, by story.
|
|
50
|
+
* @param story - the story.
|
|
51
|
+
*/
|
|
52
|
+
const reportedPanel = (panels, story) => panels.get(story.id) ?? { argTypes: NO_ARG_TYPES, controls: story.controls, actions: [], fixed: NOT_FIXED };
|
|
53
|
+
/** The height of the first frame before its story reports its own, in CSS px. */
|
|
54
|
+
const INITIAL_FRAME_HEIGHT = 240;
|
|
55
|
+
/** The most calls the Events tab keeps. */
|
|
56
|
+
const MAX_CALLS = 50;
|
|
57
|
+
/**
|
|
58
|
+
* The accessibility check of the shown story: its state, cleared when the story or the view changes, and how to run
|
|
59
|
+
* it in the frame.
|
|
60
|
+
*
|
|
61
|
+
* @param frameRef - the story's frame.
|
|
62
|
+
* @param checkKey - the story and the view, as one text: a check belongs to them.
|
|
63
|
+
*/
|
|
64
|
+
const useStoryCheck = (frameRef, checkKey) => {
|
|
65
|
+
const [check, setCheck] = useState({ status: "idle" });
|
|
66
|
+
const [checkedKey, setCheckedKey] = useState(checkKey);
|
|
67
|
+
if (checkedKey !== checkKey) {
|
|
68
|
+
setCheckedKey(checkKey);
|
|
69
|
+
setCheck({ status: "idle" });
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
check,
|
|
73
|
+
run: () => {
|
|
74
|
+
setCheck({ status: "running" });
|
|
75
|
+
const message = { type: "forgebook:check" };
|
|
76
|
+
frameRef.current?.contentWindow?.postMessage(message, window.location.origin);
|
|
77
|
+
},
|
|
78
|
+
receive: (result) => setCheck("error" in result
|
|
79
|
+
? { status: "error", message: result.error }
|
|
80
|
+
: { status: "done", violations: result.violations })
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Copies the story's id (`kit:inputs-selection-select--overview`), the name tests and tools address it by; the id
|
|
85
|
+
* shows as the button's tooltip.
|
|
86
|
+
*
|
|
87
|
+
* @param props - the story's id.
|
|
88
|
+
*/
|
|
89
|
+
const CopyIdButton = ({ storyId }) => {
|
|
90
|
+
const { isCopied, copy } = useCopy();
|
|
91
|
+
return (_jsx("button", { type: "button", className: "forgebook-button forgebook-button--icon", title: `${STRINGS.copyStoryId}: ${storyId}`, "aria-label": isCopied ? STRINGS.copied : STRINGS.copyStoryId, onClick: () => copy(storyId), children: _jsx(Icon, { name: isCopied ? "check" : "hash", size: 14 }) }));
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The stage.
|
|
95
|
+
*
|
|
96
|
+
* @param props - the component, the story, the view, the panel's values, the frame page and the loaders.
|
|
97
|
+
*/
|
|
98
|
+
export const Stage = ({ component, story, view: ownView, onViewChange: onOwnViewChange, onFixedChange, panelArgs, onPanelArgsChange, matrixAxes, onMatrixAxesChange, frameUrl, loadCode, loadDocs, namedValues, header, onShownWidthChange, measuredHeight, backgroundOf, scroll }) => {
|
|
99
|
+
const frameRef = useRef(null);
|
|
100
|
+
const storyRef = useRef(null);
|
|
101
|
+
const docs = useComponentDocs(loadDocs);
|
|
102
|
+
const code = useStoryCode(loadCode);
|
|
103
|
+
// the story's own args, as each frame reported them, by story
|
|
104
|
+
const [storyArgs, setStoryArgs] = useState(new Map());
|
|
105
|
+
// the args each story gives a text by its key, as its frame reported them
|
|
106
|
+
const [storyTextKeys, setStoryTextKeys] = useState(new Map());
|
|
107
|
+
// each story's `argTypes` and controls, as its frame read them once it ran
|
|
108
|
+
const [storyPanels, setStoryPanels] = useState(new Map());
|
|
109
|
+
// the story is drawn with what it fixes of the view; a change from here keeps the user's own in the address
|
|
110
|
+
const panel = reportedPanel(storyPanels, story);
|
|
111
|
+
const view = withFixed(ownView, panel.fixed);
|
|
112
|
+
const onViewChange = (changed) => onOwnViewChange(withOwnFixed(changed, ownView, panel.fixed));
|
|
113
|
+
const [calls, setCalls] = useState([]);
|
|
114
|
+
// each story's play trace, by story: a trace belongs to the story that played
|
|
115
|
+
const [traces, setTraces] = useState(new Map());
|
|
116
|
+
const catalogue = useCatalogue();
|
|
117
|
+
const { switches } = catalogue;
|
|
118
|
+
const storyCheck = useStoryCheck(frameRef, frameAddress(frameUrl, story.id, view, switches));
|
|
119
|
+
const eventNames = useMemo(() => docs.status === "ready"
|
|
120
|
+
? docs.value.props.filter((prop) => prop.kind === "event").map((prop) => prop.name)
|
|
121
|
+
: [], [docs]);
|
|
122
|
+
// a story of fixed examples ignores its args, so a matrix of them would repeat one drawing
|
|
123
|
+
const axisProps = docs.status === "ready" && (story.controls === "all" || story.controls.length > 0)
|
|
124
|
+
? matrixProps(docs.value.props)
|
|
125
|
+
: [];
|
|
126
|
+
const matrix = useMemo(() => (docs.status === "ready" ? matrixOf(docs.value.props, matrixAxes) : undefined) ?? null, [docs, matrixAxes]);
|
|
127
|
+
const clockControls = useStoryClockControls(frameRef, story.id);
|
|
128
|
+
const { replayable, clocked, heights, settled } = useFrameMessages({
|
|
129
|
+
onReady: (frame, message) => {
|
|
130
|
+
setStoryArgs((current) => new Map(current).set(message.storyId, message.args));
|
|
131
|
+
setStoryTextKeys((current) => new Map(current).set(message.storyId, message.textKeys));
|
|
132
|
+
setStoryPanels((current) => new Map(current).set(message.storyId, {
|
|
133
|
+
argTypes: message.argTypes,
|
|
134
|
+
controls: message.controls,
|
|
135
|
+
actions: message.actions,
|
|
136
|
+
fixed: message.fixed
|
|
137
|
+
}));
|
|
138
|
+
onFixedChange(message.storyId, message.fixed);
|
|
139
|
+
const send = (shellMessage) => frame.postMessage(shellMessage, window.location.origin);
|
|
140
|
+
send({ type: "forgebook:events", names: eventNames });
|
|
141
|
+
send({ type: "forgebook:args", args: panelArgs });
|
|
142
|
+
send({ type: "forgebook:matrix", matrix });
|
|
143
|
+
// the view may have changed while the frame loaded
|
|
144
|
+
if (!isComparing(view))
|
|
145
|
+
send({ type: "forgebook:view", view: liveView(view) });
|
|
146
|
+
send({ type: "forgebook:tools", tools: view.tools });
|
|
147
|
+
if (message.hasClock && !isComparing(view))
|
|
148
|
+
clockControls.sendTo(frame);
|
|
149
|
+
},
|
|
150
|
+
onCall: (call) => setCalls((current) => [call, ...current].slice(0, MAX_CALLS)),
|
|
151
|
+
onPlay: (storyId, trace) => setTraces((current) => new Map(current).set(storyId, trace)),
|
|
152
|
+
onChecked: (result) => {
|
|
153
|
+
if (result.storyId === story.id)
|
|
154
|
+
storyCheck.receive(result);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
// the docs may arrive after the frames: they learn the events then
|
|
158
|
+
useEffect(() => tellFrames(storyRef.current, { type: "forgebook:events", names: eventNames }), [eventNames]);
|
|
159
|
+
useEffect(() => tellFrames(storyRef.current, { type: "forgebook:matrix", matrix }), [matrix]);
|
|
160
|
+
// the values reach the frames from the address, so going back in the history sets them too
|
|
161
|
+
useEffect(() => tellFrames(storyRef.current, { type: "forgebook:args", args: panelArgs }), [panelArgs]);
|
|
162
|
+
const changeValue = (name, value) => {
|
|
163
|
+
const { [name]: _removed, ...rest } = panelArgs;
|
|
164
|
+
onPanelArgsChange(value === undefined ? rest : { ...rest, [name]: value });
|
|
165
|
+
};
|
|
166
|
+
const replay = () => {
|
|
167
|
+
const message = { type: "forgebook:replay" };
|
|
168
|
+
frameRef.current?.contentWindow?.postMessage(message, window.location.origin);
|
|
169
|
+
};
|
|
170
|
+
const title = STRINGS.frameTitle(component.name, story.name);
|
|
171
|
+
const canReplay = replayable === story.id && !isComparing(view);
|
|
172
|
+
// the compare view's frames each run their own clock from the start, so no one control drives them all
|
|
173
|
+
const hasClock = clocked === story.id && !isComparing(view);
|
|
174
|
+
// the frame loads again only for another story or style sheets; the rest of the view (the switches, the language
|
|
175
|
+
// among them) is sent live
|
|
176
|
+
const address = frameAddress(frameUrl, story.id, useLoadedView(`${story.id}|${view.sheets}`, view), switches);
|
|
177
|
+
useLiveView(storyRef, view, !isComparing(view));
|
|
178
|
+
useScrollMemory(storyRef, scroll);
|
|
179
|
+
// a story not shown yet waits at its measured height, or keeps the last story's, until it reports its own, so the
|
|
180
|
+
// page does not jump twice
|
|
181
|
+
const reportedHeight = heights.get(address);
|
|
182
|
+
const [lastHeight, setLastHeight] = useState(INITIAL_FRAME_HEIGHT);
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (reportedHeight !== undefined)
|
|
185
|
+
setLastHeight(reportedHeight);
|
|
186
|
+
}, [reportedHeight]);
|
|
187
|
+
// a tab the catalogue turns off is never shown
|
|
188
|
+
const tabs = dockTabs({
|
|
189
|
+
docs,
|
|
190
|
+
code,
|
|
191
|
+
exportName: story.exportName,
|
|
192
|
+
componentName: component.name,
|
|
193
|
+
argTypes: panel.argTypes,
|
|
194
|
+
controls: panel.controls,
|
|
195
|
+
actions: panel.actions,
|
|
196
|
+
values: { ...storyArgs.get(story.id), ...panelArgs },
|
|
197
|
+
onValueChange: changeValue,
|
|
198
|
+
onReset: () => onPanelArgsChange({}),
|
|
199
|
+
namedValues,
|
|
200
|
+
textArgs: Object.fromEntries(Object.entries(storyTextKeys.get(story.id) ?? {}).map(([name, key]) => [
|
|
201
|
+
name,
|
|
202
|
+
{ key, isChanged: panelArgs[name] !== undefined }
|
|
203
|
+
])),
|
|
204
|
+
calls: calls.filter((call) => call.storyId === story.id),
|
|
205
|
+
onClearCalls: () => setCalls([]),
|
|
206
|
+
trace: isComparing(view) ? undefined : traces.get(story.id),
|
|
207
|
+
onPlayAgain: () => {
|
|
208
|
+
const message = { type: "forgebook:play-again" };
|
|
209
|
+
frameRef.current?.contentWindow?.postMessage(message, window.location.origin);
|
|
210
|
+
},
|
|
211
|
+
check: storyCheck.check,
|
|
212
|
+
onCheck: isComparing(view) ? undefined : storyCheck.run
|
|
213
|
+
}).filter((tab) => catalogue.tabs.includes(tab.id));
|
|
214
|
+
return (_jsxs("div", { className: "forgebook-workspace", children: [header, _jsxs("div", { className: "forgebook-story-pane", children: [_jsx("div", { ref: storyRef, className: "forgebook-scroll", children: _jsxs("section", { className: "forgebook-story", "aria-label": STRINGS.storyLabel, children: [_jsxs("div", { className: "forgebook-story__bar", children: [_jsxs("div", { className: "forgebook-stage__heading", children: [_jsx("h2", { className: "forgebook-stage__title", children: story.name }), story.description === undefined ? null : (_jsx("p", { className: "forgebook-stage__description", title: story.description, children: story.description }))] }), axisProps.length === 0 ? null : (_jsx(MatrixPicker, { props: axisProps, axes: matrixAxes, onAxesChange: onMatrixAxesChange })), canReplay ? (_jsxs("button", { type: "button", className: "forgebook-button", onClick: replay, children: [_jsx(Icon, { name: "replay", size: 14 }), STRINGS.replay] })) : null, hasClock ? _jsx(ClockControls, { controls: clockControls }) : null, _jsx(CopyIdButton, { storyId: story.id }), _jsx("a", { className: "forgebook-button forgebook-button--icon", href: frameAddress(frameUrl, story.id, view, switches), target: "_blank", rel: "noopener", title: STRINGS.openFrame, "aria-label": STRINGS.openFrame, children: _jsx(Icon, { name: "external", size: 14 }) })] }), isComparing(view) ? (_jsx("div", { className: "forgebook-compare", children: compareVariants(view.compare, catalogue).map((variant) => (_jsxs("figure", { className: "forgebook-compare__cell",
|
|
215
|
+
// the label (the shell's text) reads on the page's colour; the frame draws the backdrop
|
|
216
|
+
style: { backgroundColor: backgroundOf({ ...variant.viewOf(view), backdrop: "plain" }) }, children: [_jsx("figcaption", { className: "forgebook-compare__label", children: variant.label }), _jsx(FrameView, { title: `${title} · ${variant.label}`, address: frameAddress(frameUrl, story.id, variant.viewOf(view), switches), heights: heights, settled: settled, fallbackHeight: lastHeight, sceneHeight: story.height })] }, variant.label))) })) : (_jsx(StageViewport, { zoom: view.zoom, width: view.width, onWidthChange: widthSetter(panel.fixed, view, onViewChange), onShownWidthChange: onShownWidthChange, background: backgroundOf(view), height: view.height, onHeightChange: (height) => onViewChange({ ...view, height }), children: (fixedHeight) => (_jsx(FrameView, { ref: frameRef, title: title, address: address, heights: heights, settled: settled, fallbackHeight: measuredHeight ?? lastHeight, sceneHeight: story.height, fixedHeight: fixedHeight }, story.id)) }))] }) }), isComparing(view) ? null : (_jsx(StageTools, { zoom: view.zoom, onZoomChange: (zoom) => onViewChange({ ...view, zoom }), tools: view.tools, onToolsChange: (tools) => onViewChange({ ...view, tools }) }))] }), view.isPanelOpen ? (_jsx(Dock, { tabs: tabs, activeTab: view.panelTab, onTabChange: (panelTab) => onViewChange({ ...view, panelTab }), onClose: () => onViewChange({ ...view, isPanelOpen: false }) })) : null] }));
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=Stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stage.js","sourceRoot":"","sources":["../../../src/shell/Stage.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAkC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7F,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIrD,OAAO,EAAkB,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,EACL,YAAY,EACZ,WAAW,EACX,QAAQ,EAOT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAqB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAY,CAAC;AAClC,OAA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,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,EAC9E,OAAO,EAAE,GAAS,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,GAClE,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The zoom and the tools floating on the stage: the story drawn larger or smaller (its layout unchanged), a step at a
|
|
3
|
+
* time, and the tools drawn over it (every element's outline, an 8 px grid, the box under the pointer).
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import { type MeasureTool, type Zoom } from "../viewState.ts";
|
|
9
|
+
/** The tools' props. */
|
|
10
|
+
export type StageToolsProps = {
|
|
11
|
+
/** The zoom. */
|
|
12
|
+
readonly zoom: Zoom;
|
|
13
|
+
/** Called with the chosen zoom. */
|
|
14
|
+
readonly onZoomChange: (zoom: Zoom) => void;
|
|
15
|
+
/** The tools on. */
|
|
16
|
+
readonly tools: readonly MeasureTool[];
|
|
17
|
+
/** Called with the tools on, in their order. */
|
|
18
|
+
readonly onToolsChange: (tools: readonly MeasureTool[]) => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The zoom and the tools, floating at the stage's lower end corner: they change how the story is looked at, not what
|
|
22
|
+
* it gets, so they sit on the stage rather than in the toolbar.
|
|
23
|
+
*
|
|
24
|
+
* @param props - the zoom, the tools and their setters.
|
|
25
|
+
*/
|
|
26
|
+
export declare const StageTools: ({ zoom, onZoomChange, tools, onToolsChange }: StageToolsProps) => ReactNode;
|
|
27
|
+
//# sourceMappingURL=StageTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StageTools.d.ts","sourceRoot":"","sources":["../../../src/shell/StageTools.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAK7E,wBAAwB;AACxB,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC5C,oBAAoB;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;CACjE,CAAC;AASF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,8CAA8C,eAAe,KAAG,SAoE1F,CAAC"}
|