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 @@
|
|
|
1
|
+
{"version":3,"file":"checkStory.js","sourceRoot":"","sources":["../../../src/frame/checkStory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,QAAkB,EAAE,KAAmB,EAAwB,EAAE;IAChG,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACtC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE;QACjD,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;KACzF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC5C,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,SAAS;QACrC,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1E,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@layer catalogue {
|
|
2
|
+
body {
|
|
3
|
+
margin: 0;
|
|
4
|
+
}
|
|
5
|
+
.forgebook-frame {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
.forgebook-frame[data-layout=padded] {
|
|
9
|
+
padding: 1.5rem;
|
|
10
|
+
}
|
|
11
|
+
.forgebook-frame[data-layout=centered] {
|
|
12
|
+
display: grid;
|
|
13
|
+
place-items: center;
|
|
14
|
+
min-height: 12rem;
|
|
15
|
+
padding: 1.5rem;
|
|
16
|
+
}
|
|
17
|
+
.forgebook-frame[data-layout=fullscreen] {
|
|
18
|
+
min-height: 100vh;
|
|
19
|
+
}
|
|
20
|
+
.forgebook-matrix__table {
|
|
21
|
+
border-collapse: collapse;
|
|
22
|
+
}
|
|
23
|
+
.forgebook-matrix__corner,
|
|
24
|
+
.forgebook-matrix__name {
|
|
25
|
+
padding: 0.5rem 0.75rem;
|
|
26
|
+
font: 400 0.6875rem/1.6 "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
|
|
27
|
+
text-align: start;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
opacity: 0.7;
|
|
30
|
+
}
|
|
31
|
+
.forgebook-matrix__cell {
|
|
32
|
+
padding: 0.75rem;
|
|
33
|
+
vertical-align: middle;
|
|
34
|
+
}
|
|
35
|
+
.forgebook-frame-error {
|
|
36
|
+
margin: 1.5rem;
|
|
37
|
+
font: 400 0.8125rem/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
|
|
38
|
+
color: #bc1f16;
|
|
39
|
+
}
|
|
40
|
+
.forgebook-frame-error__message {
|
|
41
|
+
margin: 0;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
}
|
|
44
|
+
.forgebook-frame-error__stack {
|
|
45
|
+
margin: 0.75rem 0 0;
|
|
46
|
+
overflow-x: auto;
|
|
47
|
+
font: 400 0.6875rem/1.6 "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
|
|
48
|
+
color: #56565d;
|
|
49
|
+
white-space: pre;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The story clock a frame runs for its story: it starts at the story's moment and then moves with real time, at the
|
|
3
|
+
* speed the shell's controls set, or stays held (D-504).
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The clock is stepped: it ticks every `TICK_MS` of real time while it runs, and `now()` is the moment of its last
|
|
7
|
+
* tick, so a render reads one moment throughout and React can subscribe to it (`useStoryNow`, D-627). Pausing keeps the
|
|
8
|
+
* moment; Restart brings it back to the start (the frame mounts the story again with it); `advance` jumps at once,
|
|
9
|
+
* held or not. Listeners hear every tick and every jump. The clock names no date library: the library shown turns
|
|
10
|
+
* the milliseconds into its own time type (D-67).
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import type { StoryClock } from "@forgebook/story-format/clock";
|
|
15
|
+
import { type ClockState } from "../storyClock.ts";
|
|
16
|
+
/** The clock a frame runs: the story's clock, and what the shell's controls do to it. */
|
|
17
|
+
export type FrameClock = StoryClock & {
|
|
18
|
+
/** Sets whether it runs and how fast, from its moment now. */
|
|
19
|
+
readonly setState: (state: ClockState) => void;
|
|
20
|
+
/** Brings it back to its start, keeping whether it runs and how fast. */
|
|
21
|
+
readonly restart: () => void;
|
|
22
|
+
};
|
|
23
|
+
/** What a frame clock starts from. */
|
|
24
|
+
export type FrameClockOptions = {
|
|
25
|
+
/** The story's start, in ms since the Unix epoch. */
|
|
26
|
+
readonly start: number;
|
|
27
|
+
/** Whether it runs, and how fast, from the start. */
|
|
28
|
+
readonly state: ClockState;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Starts a story's clock.
|
|
32
|
+
*
|
|
33
|
+
* @param options - its start, and whether it runs and how fast.
|
|
34
|
+
* @returns the clock.
|
|
35
|
+
*/
|
|
36
|
+
export declare const createFrameClock: ({ start, state: initial }: FrameClockOptions) => FrameClock;
|
|
37
|
+
/**
|
|
38
|
+
* The clock a frame runs for its story: a Live story's from its start, held there when the frame's address says so;
|
|
39
|
+
* a still's held at the epoch.
|
|
40
|
+
*
|
|
41
|
+
* @param clockStart - the story's clock start, in ms since the Unix epoch; none for a still.
|
|
42
|
+
* @param isHeld - whether the frame's address holds the clock (`clock=held`, what the tests open).
|
|
43
|
+
* @returns the clock.
|
|
44
|
+
*/
|
|
45
|
+
export declare const storyFrameClock: (clockStart: number | undefined, isHeld: boolean) => FrameClock;
|
|
46
|
+
/**
|
|
47
|
+
* A story's clock held at its start: what a still, a test frame and the server render read.
|
|
48
|
+
*
|
|
49
|
+
* @param start - the start, in ms since the Unix epoch.
|
|
50
|
+
* @returns the clock, held until the controls run it or a play advances it.
|
|
51
|
+
*/
|
|
52
|
+
export declare const heldFrameClock: (start: number) => FrameClock;
|
|
53
|
+
//# sourceMappingURL=frameClock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameClock.d.ts","sourceRoot":"","sources":["../../../src/frame/frameClock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAqB,KAAK,UAAU,EAAkC,MAAM,kBAAkB,CAAC;AAKtG,yFAAyF;AACzF,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/C,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,2BAA2B,iBAAiB,KAAG,UA4C/E,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,GAAG,SAAS,EAAE,QAAQ,OAAO,KAAG,UAKjF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,UACmC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DEFAULT_CLOCK_STATE, readClock } from "../storyClock.js";
|
|
2
|
+
/** How often a running clock ticks, in ms of real time: often enough for a stream's words, a ring's sweep. */
|
|
3
|
+
const TICK_MS = 50;
|
|
4
|
+
/**
|
|
5
|
+
* Starts a story's clock.
|
|
6
|
+
*
|
|
7
|
+
* @param options - its start, and whether it runs and how fast.
|
|
8
|
+
* @returns the clock.
|
|
9
|
+
*/
|
|
10
|
+
export const createFrameClock = ({ start, state: initial }) => {
|
|
11
|
+
let state = initial;
|
|
12
|
+
let reading = { moment: start, at: performance.now() };
|
|
13
|
+
let timer;
|
|
14
|
+
const listeners = new Set();
|
|
15
|
+
const notify = () => {
|
|
16
|
+
for (const listener of listeners)
|
|
17
|
+
listener();
|
|
18
|
+
};
|
|
19
|
+
const tick = () => {
|
|
20
|
+
reading = readClock(reading, state, performance.now());
|
|
21
|
+
notify();
|
|
22
|
+
};
|
|
23
|
+
// a held clock needs no timer: nothing moves it but a jump, which notifies on its own
|
|
24
|
+
const schedule = () => {
|
|
25
|
+
if (timer !== undefined)
|
|
26
|
+
window.clearInterval(timer);
|
|
27
|
+
timer = state.isRunning ? window.setInterval(tick, TICK_MS) : undefined;
|
|
28
|
+
};
|
|
29
|
+
schedule();
|
|
30
|
+
return {
|
|
31
|
+
// whole milliseconds, as the story clock promises: the reading itself keeps the fractions, so nothing drifts
|
|
32
|
+
now: () => Math.floor(reading.moment),
|
|
33
|
+
subscribe: (onTick) => {
|
|
34
|
+
listeners.add(onTick);
|
|
35
|
+
return () => {
|
|
36
|
+
listeners.delete(onTick);
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
advance: (ms) => {
|
|
40
|
+
if (!Number.isFinite(ms) || ms <= 0)
|
|
41
|
+
return;
|
|
42
|
+
const now = readClock(reading, state, performance.now());
|
|
43
|
+
reading = { moment: now.moment + ms, at: now.at };
|
|
44
|
+
notify();
|
|
45
|
+
},
|
|
46
|
+
setState: (next) => {
|
|
47
|
+
reading = readClock(reading, state, performance.now());
|
|
48
|
+
state = next;
|
|
49
|
+
schedule();
|
|
50
|
+
notify();
|
|
51
|
+
},
|
|
52
|
+
restart: () => {
|
|
53
|
+
reading = { moment: start, at: performance.now() };
|
|
54
|
+
notify();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The clock a frame runs for its story: a Live story's from its start, held there when the frame's address says so;
|
|
60
|
+
* a still's held at the epoch.
|
|
61
|
+
*
|
|
62
|
+
* @param clockStart - the story's clock start, in ms since the Unix epoch; none for a still.
|
|
63
|
+
* @param isHeld - whether the frame's address holds the clock (`clock=held`, what the tests open).
|
|
64
|
+
* @returns the clock.
|
|
65
|
+
*/
|
|
66
|
+
export const storyFrameClock = (clockStart, isHeld) => {
|
|
67
|
+
if (clockStart === undefined)
|
|
68
|
+
return heldFrameClock(0);
|
|
69
|
+
return isHeld
|
|
70
|
+
? heldFrameClock(clockStart)
|
|
71
|
+
: createFrameClock({ start: clockStart, state: DEFAULT_CLOCK_STATE });
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* A story's clock held at its start: what a still, a test frame and the server render read.
|
|
75
|
+
*
|
|
76
|
+
* @param start - the start, in ms since the Unix epoch.
|
|
77
|
+
* @returns the clock, held until the controls run it or a play advances it.
|
|
78
|
+
*/
|
|
79
|
+
export const heldFrameClock = (start) => createFrameClock({ start, state: { ...DEFAULT_CLOCK_STATE, isRunning: false } });
|
|
80
|
+
//# sourceMappingURL=frameClock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameClock.js","sourceRoot":"","sources":["../../../src/frame/frameClock.ts"],"names":[],"mappings":"AAeA,OAAO,EAAsC,mBAAmB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtG,8GAA8G;AAC9G,MAAM,OAAO,GAAG,EAAE,CAAC;AAkBnB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE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CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute on a frame's root that says whether its story is shown: what the tests wait for, never a delay.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** `ready` once the story rendered and its play function is over, `error` when it could not render. */
|
|
7
|
+
export declare const STATUS_ATTRIBUTE = "data-forgebook-status";
|
|
8
|
+
//# sourceMappingURL=frameStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameStatus.d.ts","sourceRoot":"","sources":["../../../src/frame/frameStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute on a frame's root that says whether its story is shown: what the tests wait for, never a delay.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** `ready` once the story rendered and its play function is over, `error` when it could not render. */
|
|
7
|
+
export const STATUS_ATTRIBUTE = "data-forgebook-status";
|
|
8
|
+
//# sourceMappingURL=frameStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameStatus.js","sourceRoot":"","sources":["../../../src/frame/frameStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uGAAuG;AACvG,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The view applied to a frame's document: the declared switches that apply on the root (`switches.ts`), the root
|
|
3
|
+
* font size, the backdrop drawn behind the story and the style sheets for the Styles setting.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { StorySheets } from "@forgebook/story-format/source";
|
|
8
|
+
import type { CatalogueSettings } from "../catalogue.ts";
|
|
9
|
+
import { type LiveView, type ViewState } from "../viewState.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Applies the view's live part on a document's root: each declared switch that applies there, the font size, and the
|
|
12
|
+
* backdrop behind the story in the view's scheme.
|
|
13
|
+
*
|
|
14
|
+
* @param root - the document's root element.
|
|
15
|
+
* @param view - the view's live part: the frame applies it again whenever the shell sends a change.
|
|
16
|
+
* @param catalogue - the catalogue's switches and backdrops.
|
|
17
|
+
*/
|
|
18
|
+
export declare const applyView: (root: HTMLElement, view: LiveView, catalogue: Pick<CatalogueSettings, "switches" | "backdrops">) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The style sheets a view loads, in order: the required ones, then the theme or the restyled look.
|
|
21
|
+
*
|
|
22
|
+
* @param sheets - the source's sheets.
|
|
23
|
+
* @param view - the view.
|
|
24
|
+
*/
|
|
25
|
+
export declare const viewSheets: (sheets: StorySheets, view: ViewState) => string[];
|
|
26
|
+
/**
|
|
27
|
+
* Loads style sheets into a document and waits for them, so the story never shows unstyled.
|
|
28
|
+
*
|
|
29
|
+
* @param document - the frame's document.
|
|
30
|
+
* @param urls - the sheets, in order.
|
|
31
|
+
*/
|
|
32
|
+
export declare const loadSheets: (document: Document, urls: readonly string[]) => Promise<void>;
|
|
33
|
+
//# sourceMappingURL=frameView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameView.d.ts","sourceRoot":"","sources":["../../../src/frame/frameView.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,QAAQ,EAAY,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA8E1E;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,WAAW,EACjB,MAAM,QAAQ,EACd,WAAW,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,CAAC,KAC3D,IAKF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,WAAW,EAAE,MAAM,SAAS,KAAG,MAAM,EAIvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAU,UAAU,QAAQ,EAAE,MAAM,SAAS,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAc1F,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The view applied to a frame's document: the declared switches that apply on the root (`switches.ts`), the root
|
|
3
|
+
* font size, the backdrop drawn behind the story and the style sheets for the Styles setting.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { backdropSheet } from "../backdrops.js";
|
|
8
|
+
import { switchValueOf } from "../switches.js";
|
|
9
|
+
import { schemeOf } from "../viewState.js";
|
|
10
|
+
/** The id of the style sheet that draws the backdrop. */
|
|
11
|
+
const BACKDROP_STYLE_ID = "forgebook-backdrop-style";
|
|
12
|
+
/**
|
|
13
|
+
* Draws a backdrop behind the story (D-644): its own style sheet in the document's head, made once and rewritten on
|
|
14
|
+
* every change, empty for the page's own colour.
|
|
15
|
+
*
|
|
16
|
+
* @param document - the frame's document.
|
|
17
|
+
* @param sheet - the backdrop's CSS.
|
|
18
|
+
*/
|
|
19
|
+
const applyBackdrop = (document, sheet) => {
|
|
20
|
+
const existing = document.getElementById(BACKDROP_STYLE_ID);
|
|
21
|
+
const style = existing ?? document.createElement("style");
|
|
22
|
+
if (existing === null) {
|
|
23
|
+
style.id = BACKDROP_STYLE_ID;
|
|
24
|
+
document.head.append(style);
|
|
25
|
+
}
|
|
26
|
+
style.textContent = sheet;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Sets or removes an attribute.
|
|
30
|
+
*
|
|
31
|
+
* @param root - the document's root element.
|
|
32
|
+
* @param name - the attribute.
|
|
33
|
+
* @param value - its value; none removes it.
|
|
34
|
+
*/
|
|
35
|
+
const setAttribute = (root, name, value) => {
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
root.removeAttribute(name);
|
|
38
|
+
else
|
|
39
|
+
root.setAttribute(name, value);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Sets the class of a switch's value, removing its other values' classes.
|
|
43
|
+
*
|
|
44
|
+
* @param root - the document's root element.
|
|
45
|
+
* @param prefix - the classes' prefix.
|
|
46
|
+
* @param each - the switch.
|
|
47
|
+
* @param value - the value; none leaves no class.
|
|
48
|
+
*/
|
|
49
|
+
const setClass = (root, prefix, each, value) => {
|
|
50
|
+
for (const candidate of each.values)
|
|
51
|
+
root.classList.remove(`${prefix}${candidate.value}`);
|
|
52
|
+
if (value !== undefined)
|
|
53
|
+
root.classList.add(`${prefix}${value}`);
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Sets or removes a custom property.
|
|
57
|
+
*
|
|
58
|
+
* @param root - the document's root element.
|
|
59
|
+
* @param name - the property (`--density`).
|
|
60
|
+
* @param value - its value; none removes it.
|
|
61
|
+
*/
|
|
62
|
+
const setProperty = (root, name, value) => {
|
|
63
|
+
if (value === undefined)
|
|
64
|
+
root.style.removeProperty(name);
|
|
65
|
+
else
|
|
66
|
+
root.style.setProperty(name, value);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Applies one declared switch on the root, when it applies there: its attribute, class, colour scheme or custom
|
|
70
|
+
* property; a value marked unset writes nothing, so the library's own default shows. A switch applied by code reaches
|
|
71
|
+
* the story instead (`context.globals`).
|
|
72
|
+
*
|
|
73
|
+
* @param root - the document's root element.
|
|
74
|
+
* @param each - the switch.
|
|
75
|
+
* @param value - its value in the view; none for its default.
|
|
76
|
+
*/
|
|
77
|
+
const applySwitch = (root, each, value) => {
|
|
78
|
+
const shown = switchValueOf(each, value);
|
|
79
|
+
const written = shown === undefined || shown.isUnset === true ? undefined : shown.value;
|
|
80
|
+
const { apply } = each;
|
|
81
|
+
if (apply.kind === "attribute")
|
|
82
|
+
setAttribute(root, apply.name, written);
|
|
83
|
+
if (apply.kind === "class")
|
|
84
|
+
setClass(root, apply.prefix, each, written);
|
|
85
|
+
if (apply.kind === "colorScheme")
|
|
86
|
+
root.style.colorScheme = written ?? "";
|
|
87
|
+
if (apply.kind === "cssVariable")
|
|
88
|
+
setProperty(root, apply.name, written);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Applies the view's live part on a document's root: each declared switch that applies there, the font size, and the
|
|
92
|
+
* backdrop behind the story in the view's scheme.
|
|
93
|
+
*
|
|
94
|
+
* @param root - the document's root element.
|
|
95
|
+
* @param view - the view's live part: the frame applies it again whenever the shell sends a change.
|
|
96
|
+
* @param catalogue - the catalogue's switches and backdrops.
|
|
97
|
+
*/
|
|
98
|
+
export const applyView = (root, view, catalogue) => {
|
|
99
|
+
for (const each of catalogue.switches)
|
|
100
|
+
applySwitch(root, each, view.switches[each.id]);
|
|
101
|
+
root.style.fontSize = `${view.text}%`;
|
|
102
|
+
const backdrop = catalogue.backdrops.find((each) => each.id === view.backdrop);
|
|
103
|
+
applyBackdrop(root.ownerDocument, backdropSheet(backdrop, schemeOf(view, catalogue.switches)));
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* The style sheets a view loads, in order: the required ones, then the theme or the restyled look.
|
|
107
|
+
*
|
|
108
|
+
* @param sheets - the source's sheets.
|
|
109
|
+
* @param view - the view.
|
|
110
|
+
*/
|
|
111
|
+
export const viewSheets = (sheets, view) => {
|
|
112
|
+
if (view.sheets === "structure")
|
|
113
|
+
return [...sheets.required];
|
|
114
|
+
if (view.sheets === "restyled")
|
|
115
|
+
return [...sheets.required, ...sheets.restyled];
|
|
116
|
+
return [...sheets.required, ...sheets.theme];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Loads style sheets into a document and waits for them, so the story never shows unstyled.
|
|
120
|
+
*
|
|
121
|
+
* @param document - the frame's document.
|
|
122
|
+
* @param urls - the sheets, in order.
|
|
123
|
+
*/
|
|
124
|
+
export const loadSheets = async (document, urls) => {
|
|
125
|
+
await Promise.all(urls.map((url) => new Promise((resolve, reject) => {
|
|
126
|
+
const link = document.createElement("link");
|
|
127
|
+
link.rel = "stylesheet";
|
|
128
|
+
link.href = url;
|
|
129
|
+
link.addEventListener("load", () => resolve());
|
|
130
|
+
link.addEventListener("error", () => reject(new Error(`The style sheet ${url} did not load`)));
|
|
131
|
+
document.head.append(link);
|
|
132
|
+
})));
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=frameView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameView.js","sourceRoot":"","sources":["../../../src/frame/frameView.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAiB,QAAQ,EAAkB,MAAM,iBAAiB,CAAC;AAE1E,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,QAAkB,EAAE,KAAa,EAAQ,EAAE;IAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,QAAQ,IAAI,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1D,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,KAAK,CAAC,EAAE,GAAG,iBAAiB,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,CAAC,IAAiB,EAAE,IA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,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7D,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,QAAkB,EAAE,IAAuB,EAAiB,EAAE;IAC7F,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CACN,CAAC,GAAG,EAAE,EAAE,CACN,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/F,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CACL,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout of a story drawn as a matrix: a table with one cell per value of the rows' prop, and of the columns'
|
|
3
|
+
* when there are two, each value named at the head of its row and column.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The frame mounts the story in each cell through the framework; the cells do not run the play function, since a play
|
|
7
|
+
* drives one story and twenty plays at once would fight over the focus. The names take the frame's own colours, so the
|
|
8
|
+
* matrix reads in every theme.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import type { Matrix } from "../matrix.ts";
|
|
13
|
+
import type { LoadedArgs, LoadedStory } from "./storyModule.ts";
|
|
14
|
+
/** One cell of the matrix: where the story is drawn, and its values over the story's args. */
|
|
15
|
+
export type MatrixCell = {
|
|
16
|
+
/** The cell's canvas. */
|
|
17
|
+
readonly canvas: HTMLElement;
|
|
18
|
+
/** The values of the cell's row and column. */
|
|
19
|
+
readonly values: LoadedArgs;
|
|
20
|
+
};
|
|
21
|
+
/** A matrix laid out: its element and its cells, in reading order. */
|
|
22
|
+
export type MatrixLayout = {
|
|
23
|
+
/** The matrix's element, to put in the frame. */
|
|
24
|
+
readonly element: HTMLElement;
|
|
25
|
+
/** Its cells. */
|
|
26
|
+
readonly cells: readonly MatrixCell[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Lays a story out as a matrix.
|
|
30
|
+
*
|
|
31
|
+
* @param document - the frame's document.
|
|
32
|
+
* @param story - the story, for the states it forces in every cell.
|
|
33
|
+
* @param matrix - the axes.
|
|
34
|
+
*/
|
|
35
|
+
export declare const matrixLayout: (document: Document, story: LoadedStory, matrix: Matrix) => MatrixLayout;
|
|
36
|
+
//# sourceMappingURL=matrixLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrixLayout.d.ts","sourceRoot":"","sources":["../../../src/frame/matrixLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,8FAA8F;AAC9F,MAAM,MAAM,UAAU,GAAG;IACvB,yBAAyB;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG;IACzB,iDAAiD;IACjD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,iBAAiB;IACjB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;CACvC,CAAC;AAmCF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,EAAE,OAAO,WAAW,EAAE,QAAQ,MAAM,KAAG,YA2CrF,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout of a story drawn as a matrix: a table with one cell per value of the rows' prop, and of the columns'
|
|
3
|
+
* when there are two, each value named at the head of its row and column.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The frame mounts the story in each cell through the framework; the cells do not run the play function, since a play
|
|
7
|
+
* drives one story and twenty plays at once would fight over the focus. The names take the frame's own colours, so the
|
|
8
|
+
* matrix reads in every theme.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { forceStates } from "./storyCanvas.js";
|
|
13
|
+
/**
|
|
14
|
+
* An element with a class and, optionally, a text.
|
|
15
|
+
*
|
|
16
|
+
* @param document - the frame's document.
|
|
17
|
+
* @param tag - the element's tag.
|
|
18
|
+
* @param className - its class.
|
|
19
|
+
* @param text - its text; none by default.
|
|
20
|
+
*/
|
|
21
|
+
const element = (document, tag, className, text) => {
|
|
22
|
+
const created = document.createElement(tag);
|
|
23
|
+
if (className !== undefined)
|
|
24
|
+
created.className = className;
|
|
25
|
+
if (text !== undefined)
|
|
26
|
+
created.textContent = text;
|
|
27
|
+
return created;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A heading of a row or a column.
|
|
31
|
+
*
|
|
32
|
+
* @param document - the frame's document.
|
|
33
|
+
* @param scope - `row` or `col`.
|
|
34
|
+
* @param text - the value it names.
|
|
35
|
+
*/
|
|
36
|
+
const heading = (document, scope, text) => {
|
|
37
|
+
const cell = element(document, "th", "forgebook-matrix__name", text);
|
|
38
|
+
cell.scope = scope;
|
|
39
|
+
return cell;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Lays a story out as a matrix.
|
|
43
|
+
*
|
|
44
|
+
* @param document - the frame's document.
|
|
45
|
+
* @param story - the story, for the states it forces in every cell.
|
|
46
|
+
* @param matrix - the axes.
|
|
47
|
+
*/
|
|
48
|
+
export const matrixLayout = (document, story, matrix) => {
|
|
49
|
+
const { rows, columns } = matrix;
|
|
50
|
+
const columnValues = columns?.values ?? [undefined];
|
|
51
|
+
const root = element(document, "div", "forgebook-frame forgebook-matrix");
|
|
52
|
+
root.dataset["layout"] = "padded";
|
|
53
|
+
const table = element(document, "table", "forgebook-matrix__table");
|
|
54
|
+
const headRow = element(document, "tr", undefined);
|
|
55
|
+
const corner = element(document, "th", "forgebook-matrix__corner", columns === undefined ? rows.name : `${rows.name} \\ ${columns.name}`);
|
|
56
|
+
corner.scope = "col";
|
|
57
|
+
headRow.append(corner);
|
|
58
|
+
for (const column of columnValues)
|
|
59
|
+
headRow.append(heading(document, "col", column === undefined ? "" : String(column)));
|
|
60
|
+
const head = element(document, "thead", undefined);
|
|
61
|
+
head.append(headRow);
|
|
62
|
+
const body = element(document, "tbody", undefined);
|
|
63
|
+
const cells = [];
|
|
64
|
+
for (const row of rows.values) {
|
|
65
|
+
const tableRow = element(document, "tr", undefined);
|
|
66
|
+
tableRow.append(heading(document, "row", String(row)));
|
|
67
|
+
for (const column of columnValues) {
|
|
68
|
+
const cell = element(document, "td", "forgebook-matrix__cell");
|
|
69
|
+
const canvas = element(document, "div", "forgebook-matrix__story");
|
|
70
|
+
forceStates(canvas, story);
|
|
71
|
+
cell.append(canvas);
|
|
72
|
+
tableRow.append(cell);
|
|
73
|
+
cells.push({
|
|
74
|
+
canvas,
|
|
75
|
+
values: {
|
|
76
|
+
[rows.name]: row,
|
|
77
|
+
...(columns === undefined || column === undefined ? {} : { [columns.name]: column })
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
body.append(tableRow);
|
|
82
|
+
}
|
|
83
|
+
table.append(head, body);
|
|
84
|
+
root.append(table);
|
|
85
|
+
return { element: root, cells };
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=matrixLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrixLayout.js","sourceRoot":"","sources":["../../../src/frame/matrixLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAmB/C;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,CACd,QAAkB,EAClB,GAAS,EACT,SAA6B,EAC7B,IAAa,EACgB,EAAE;IAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC3D,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IACnD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,CAAC,QAAkB,EAAE,KAAoB,EAAE,IAAY,EAAwB,EAAE;IAC/F,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAkB,EAAE,KAAkB,EAAE,MAAc,EAAgB,EA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ue's step), and the box of the element under
|
|
3
|
+
* the pointer with its size, padding and margin.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The tools sit on top of the story and never change its layout: the outlines are CSS outlines (they take no room),
|
|
7
|
+
* the grid and the measured box are overlays that let the pointer through. The outlines and the measure reach every
|
|
8
|
+
* element of the frame's body, not only the story's root: a popover, a menu or a dialog is mounted beside the root (a
|
|
9
|
+
* portal), and the catalogue does not know how each library names its container. The shell sends the tools as a message
|
|
10
|
+
* (`forgebook:tools`), so turning one on never loads the frame again. The overlay's colours are fixed, not the
|
|
11
|
+
* source's: it must read over any theme.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { MeasureTool } from "../viewState.ts";
|
|
16
|
+
/**
|
|
17
|
+
* Draws the tools over the story, replacing the ones drawn before.
|
|
18
|
+
*
|
|
19
|
+
* @param document - the frame's document.
|
|
20
|
+
* @param tools - the tools to draw; none removes them all.
|
|
21
|
+
* @param gridStep - the grid's step, in CSS px; 8 by default.
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyTools: (document: Document, tools: readonly MeasureTool[], gridStep?: number) => void;
|
|
24
|
+
//# sourceMappingURL=measureTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureTools.d.ts","sourceRoot":"","sources":["../../../src/frame/measureTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAuGnD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,QAAQ,EAAE,OAAO,SAAS,WAAW,EAAE,EAAE,iBAAY,KAAG,IAsC5F,CAAC"}
|