@rien7/seji 0.0.0 → 0.6.1
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/bin/design-surface.mjs +6 -0
- package/bin/postinstall.mjs +19 -0
- package/bin/seji.mjs +585 -0
- package/dist/agent/host.d.mts +34 -0
- package/dist/agent/host.mjs +387 -0
- package/dist/agent/messages.d.mts +9 -0
- package/dist/agent/messages.mjs +70 -0
- package/dist/agent/runtimes.mjs +157 -0
- package/dist/cli/app.mjs +321 -0
- package/dist/cli/appScan.mjs +284 -0
- package/dist/cli/catalog.mjs +78 -0
- package/dist/cli/component.mjs +165 -0
- package/dist/cli/consolidate.mjs +159 -0
- package/dist/cli/cssImport.mjs +68 -0
- package/dist/cli/dev.mjs +339 -0
- package/dist/cli/doctor.mjs +311 -0
- package/dist/cli/init.mjs +338 -0
- package/dist/cli/legacyNames.mjs +266 -0
- package/dist/cli/migrate.mjs +163 -0
- package/dist/cli/prompt.mjs +34 -0
- package/dist/cli/propose.mjs +208 -0
- package/dist/cli/providers.mjs +344 -0
- package/dist/cli/reviewOps.mjs +110 -0
- package/dist/cli/semver.mjs +45 -0
- package/dist/cli/setup.mjs +360 -0
- package/dist/cli/sketches.mjs +47 -0
- package/dist/cli/skills.mjs +150 -0
- package/dist/cli/snapshot.mjs +107 -0
- package/dist/cli/tokenOps.mjs +120 -0
- package/dist/cli/types.mjs +191 -0
- package/dist/cli/updater.mjs +274 -0
- package/dist/components/astIndex.mjs +992 -0
- package/dist/components/ops.mjs +1069 -0
- package/dist/editor/AgentProposalCard.d.ts +10 -0
- package/dist/editor/AgentProposalCard.d.ts.map +1 -0
- package/dist/editor/AgentProposalCard.js +31 -0
- package/dist/editor/AgentProposalCard.js.map +1 -0
- package/dist/editor/App.d.ts +2 -0
- package/dist/editor/App.d.ts.map +1 -0
- package/dist/editor/App.js +2834 -0
- package/dist/editor/App.js.map +1 -0
- package/dist/editor/CanvasHud.d.ts +12 -0
- package/dist/editor/CanvasHud.d.ts.map +1 -0
- package/dist/editor/CanvasHud.js +13 -0
- package/dist/editor/CanvasHud.js.map +1 -0
- package/dist/editor/CanvasSurface.d.ts +31 -0
- package/dist/editor/CanvasSurface.d.ts.map +1 -0
- package/dist/editor/CanvasSurface.js +270 -0
- package/dist/editor/CanvasSurface.js.map +1 -0
- package/dist/editor/CommentPopover.d.ts +17 -0
- package/dist/editor/CommentPopover.d.ts.map +1 -0
- package/dist/editor/CommentPopover.js +62 -0
- package/dist/editor/CommentPopover.js.map +1 -0
- package/dist/editor/Comments.d.ts +13 -0
- package/dist/editor/Comments.d.ts.map +1 -0
- package/dist/editor/Comments.js +41 -0
- package/dist/editor/Comments.js.map +1 -0
- package/dist/editor/ComponentPage.d.ts +28 -0
- package/dist/editor/ComponentPage.d.ts.map +1 -0
- package/dist/editor/ComponentPage.js +55 -0
- package/dist/editor/ComponentPage.js.map +1 -0
- package/dist/editor/ComponentPanel.d.ts +38 -0
- package/dist/editor/ComponentPanel.d.ts.map +1 -0
- package/dist/editor/ComponentPanel.js +275 -0
- package/dist/editor/ComponentPanel.js.map +1 -0
- package/dist/editor/Glyph.d.ts +51 -0
- package/dist/editor/Glyph.d.ts.map +1 -0
- package/dist/editor/Glyph.js +50 -0
- package/dist/editor/Glyph.js.map +1 -0
- package/dist/editor/History.d.ts +7 -0
- package/dist/editor/History.d.ts.map +1 -0
- package/dist/editor/History.js +51 -0
- package/dist/editor/History.js.map +1 -0
- package/dist/editor/Inspector.d.ts +56 -0
- package/dist/editor/Inspector.d.ts.map +1 -0
- package/dist/editor/Inspector.js +510 -0
- package/dist/editor/Inspector.js.map +1 -0
- package/dist/editor/LazyMount.d.ts +10 -0
- package/dist/editor/LazyMount.d.ts.map +1 -0
- package/dist/editor/LazyMount.js +29 -0
- package/dist/editor/LazyMount.js.map +1 -0
- package/dist/editor/LocaleSwitch.d.ts +3 -0
- package/dist/editor/LocaleSwitch.d.ts.map +1 -0
- package/dist/editor/LocaleSwitch.js +9 -0
- package/dist/editor/LocaleSwitch.js.map +1 -0
- package/dist/editor/PreviewFrame.d.ts +10 -0
- package/dist/editor/PreviewFrame.d.ts.map +1 -0
- package/dist/editor/PreviewFrame.js +22 -0
- package/dist/editor/PreviewFrame.js.map +1 -0
- package/dist/editor/ProjectIndex.d.ts +12 -0
- package/dist/editor/ProjectIndex.d.ts.map +1 -0
- package/dist/editor/ProjectIndex.js +43 -0
- package/dist/editor/ProjectIndex.js.map +1 -0
- package/dist/editor/PromoteComponent.d.ts +28 -0
- package/dist/editor/PromoteComponent.d.ts.map +1 -0
- package/dist/editor/PromoteComponent.js +33 -0
- package/dist/editor/PromoteComponent.js.map +1 -0
- package/dist/editor/PromoteForm.d.ts +18 -0
- package/dist/editor/PromoteForm.d.ts.map +1 -0
- package/dist/editor/PromoteForm.js +35 -0
- package/dist/editor/PromoteForm.js.map +1 -0
- package/dist/editor/PromoteToken.d.ts +31 -0
- package/dist/editor/PromoteToken.d.ts.map +1 -0
- package/dist/editor/PromoteToken.js +94 -0
- package/dist/editor/PromoteToken.js.map +1 -0
- package/dist/editor/StatePreviews.d.ts +28 -0
- package/dist/editor/StatePreviews.d.ts.map +1 -0
- package/dist/editor/StatePreviews.js +113 -0
- package/dist/editor/StatePreviews.js.map +1 -0
- package/dist/editor/ValueCombo.d.ts +51 -0
- package/dist/editor/ValueCombo.d.ts.map +1 -0
- package/dist/editor/ValueCombo.js +260 -0
- package/dist/editor/ValueCombo.js.map +1 -0
- package/dist/editor/agent/AgentPanel.d.ts +19 -0
- package/dist/editor/agent/AgentPanel.d.ts.map +1 -0
- package/dist/editor/agent/AgentPanel.js +271 -0
- package/dist/editor/agent/AgentPanel.js.map +1 -0
- package/dist/editor/agent/Markdown.d.ts +5 -0
- package/dist/editor/agent/Markdown.d.ts.map +1 -0
- package/dist/editor/agent/Markdown.js +28 -0
- package/dist/editor/agent/Markdown.js.map +1 -0
- package/dist/editor/agent/agentApi.d.ts +106 -0
- package/dist/editor/agent/agentApi.d.ts.map +1 -0
- package/dist/editor/agent/agentApi.js +66 -0
- package/dist/editor/agent/agentApi.js.map +1 -0
- package/dist/editor/agent/toolLines.d.ts +38 -0
- package/dist/editor/agent/toolLines.d.ts.map +1 -0
- package/dist/editor/agent/toolLines.js +159 -0
- package/dist/editor/agent/toolLines.js.map +1 -0
- package/dist/editor/agent/useAgent.d.ts +15 -0
- package/dist/editor/agent/useAgent.d.ts.map +1 -0
- package/dist/editor/agent/useAgent.js +65 -0
- package/dist/editor/agent/useAgent.js.map +1 -0
- package/dist/editor/api.d.ts +378 -0
- package/dist/editor/api.d.ts.map +1 -0
- package/dist/editor/api.js +247 -0
- package/dist/editor/api.js.map +1 -0
- package/dist/editor/camera.d.ts +18 -0
- package/dist/editor/camera.d.ts.map +1 -0
- package/dist/editor/camera.js +40 -0
- package/dist/editor/camera.js.map +1 -0
- package/dist/editor/canvas.d.ts +25 -0
- package/dist/editor/canvas.d.ts.map +1 -0
- package/dist/editor/canvas.js +35 -0
- package/dist/editor/canvas.js.map +1 -0
- package/dist/editor/changes/ChangesPage.d.ts +25 -0
- package/dist/editor/changes/ChangesPage.d.ts.map +1 -0
- package/dist/editor/changes/ChangesPage.js +132 -0
- package/dist/editor/changes/ChangesPage.js.map +1 -0
- package/dist/editor/changes/changeModel.d.ts +25 -0
- package/dist/editor/changes/changeModel.d.ts.map +1 -0
- package/dist/editor/changes/changeModel.js +81 -0
- package/dist/editor/changes/changeModel.js.map +1 -0
- package/dist/editor/changes/changeState.d.mts +29 -0
- package/dist/editor/changes/changeState.mjs +187 -0
- package/dist/editor/chrome/EditorChrome.d.ts +49 -0
- package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
- package/dist/editor/chrome/EditorChrome.js +21 -0
- package/dist/editor/chrome/EditorChrome.js.map +1 -0
- package/dist/editor/drafts.d.ts +46 -0
- package/dist/editor/drafts.d.ts.map +1 -0
- package/dist/editor/drafts.js +38 -0
- package/dist/editor/drafts.js.map +1 -0
- package/dist/editor/i18n.d.ts +29 -0
- package/dist/editor/i18n.d.ts.map +1 -0
- package/dist/editor/i18n.js +2320 -0
- package/dist/editor/i18n.js.map +1 -0
- package/dist/editor/iconStroke.d.ts +6 -0
- package/dist/editor/iconStroke.d.ts.map +1 -0
- package/dist/editor/iconStroke.js +6 -0
- package/dist/editor/iconStroke.js.map +1 -0
- package/dist/editor/main.d.ts +2 -0
- package/dist/editor/main.d.ts.map +1 -0
- package/dist/editor/main.js +14 -0
- package/dist/editor/main.js.map +1 -0
- package/dist/editor/model.d.ts +16 -0
- package/dist/editor/model.d.ts.map +1 -0
- package/dist/editor/model.js +11 -0
- package/dist/editor/model.js.map +1 -0
- package/dist/editor/reasons.d.ts +44 -0
- package/dist/editor/reasons.d.ts.map +1 -0
- package/dist/editor/reasons.js +131 -0
- package/dist/editor/reasons.js.map +1 -0
- package/dist/editor/reviewLifecycle.d.ts +8 -0
- package/dist/editor/reviewLifecycle.d.ts.map +1 -0
- package/dist/editor/reviewLifecycle.js +21 -0
- package/dist/editor/reviewLifecycle.js.map +1 -0
- package/dist/editor/styles.css +8737 -0
- package/dist/editor/tokenMatch.d.ts +59 -0
- package/dist/editor/tokenMatch.d.ts.map +1 -0
- package/dist/editor/tokenMatch.js +198 -0
- package/dist/editor/tokenMatch.js.map +1 -0
- package/dist/editor/tokens/ConsolidatePage.d.ts +16 -0
- package/dist/editor/tokens/ConsolidatePage.d.ts.map +1 -0
- package/dist/editor/tokens/ConsolidatePage.js +244 -0
- package/dist/editor/tokens/ConsolidatePage.js.map +1 -0
- package/dist/editor/tokens/TokenActivity.d.ts +18 -0
- package/dist/editor/tokens/TokenActivity.d.ts.map +1 -0
- package/dist/editor/tokens/TokenActivity.js +18 -0
- package/dist/editor/tokens/TokenActivity.js.map +1 -0
- package/dist/editor/tokens/TokenDialogs.d.ts +26 -0
- package/dist/editor/tokens/TokenDialogs.d.ts.map +1 -0
- package/dist/editor/tokens/TokenDialogs.js +119 -0
- package/dist/editor/tokens/TokenDialogs.js.map +1 -0
- package/dist/editor/tokens/TokenList.d.ts +21 -0
- package/dist/editor/tokens/TokenList.d.ts.map +1 -0
- package/dist/editor/tokens/TokenList.js +98 -0
- package/dist/editor/tokens/TokenList.js.map +1 -0
- package/dist/editor/tokens/TokenPage.d.ts +25 -0
- package/dist/editor/tokens/TokenPage.d.ts.map +1 -0
- package/dist/editor/tokens/TokenPage.js +108 -0
- package/dist/editor/tokens/TokenPage.js.map +1 -0
- package/dist/editor/tokens/tokenModel.d.ts +35 -0
- package/dist/editor/tokens/tokenModel.d.ts.map +1 -0
- package/dist/editor/tokens/tokenModel.js +72 -0
- package/dist/editor/tokens/tokenModel.js.map +1 -0
- package/dist/editor/ui/Button.d.ts +3 -0
- package/dist/editor/ui/Button.d.ts.map +1 -0
- package/dist/editor/ui/Button.js +6 -0
- package/dist/editor/ui/Button.js.map +1 -0
- package/dist/editor/ui/CommentBox.d.ts +23 -0
- package/dist/editor/ui/CommentBox.d.ts.map +1 -0
- package/dist/editor/ui/CommentBox.js +41 -0
- package/dist/editor/ui/CommentBox.js.map +1 -0
- package/dist/editor/ui/Icon.d.ts +8 -0
- package/dist/editor/ui/Icon.d.ts.map +1 -0
- package/dist/editor/ui/Icon.js +6 -0
- package/dist/editor/ui/Icon.js.map +1 -0
- package/dist/editor/ui/IconButton.d.ts +11 -0
- package/dist/editor/ui/IconButton.d.ts.map +1 -0
- package/dist/editor/ui/IconButton.js +6 -0
- package/dist/editor/ui/IconButton.js.map +1 -0
- package/dist/editor/ui/NumberInput.d.ts +14 -0
- package/dist/editor/ui/NumberInput.d.ts.map +1 -0
- package/dist/editor/ui/NumberInput.js +6 -0
- package/dist/editor/ui/NumberInput.js.map +1 -0
- package/dist/editor/ui/PageLine.d.ts +14 -0
- package/dist/editor/ui/PageLine.d.ts.map +1 -0
- package/dist/editor/ui/PageLine.js +7 -0
- package/dist/editor/ui/PageLine.js.map +1 -0
- package/dist/editor/ui/SearchPicker.d.ts +41 -0
- package/dist/editor/ui/SearchPicker.d.ts.map +1 -0
- package/dist/editor/ui/SearchPicker.js +82 -0
- package/dist/editor/ui/SearchPicker.js.map +1 -0
- package/dist/editor/ui/Select.d.ts +19 -0
- package/dist/editor/ui/Select.d.ts.map +1 -0
- package/dist/editor/ui/Select.js +12 -0
- package/dist/editor/ui/Select.js.map +1 -0
- package/dist/editor/ui/TokenField.d.ts +14 -0
- package/dist/editor/ui/TokenField.d.ts.map +1 -0
- package/dist/editor/ui/TokenField.js +41 -0
- package/dist/editor/ui/TokenField.js.map +1 -0
- package/dist/editor/ui/TokenPicker.d.ts +31 -0
- package/dist/editor/ui/TokenPicker.d.ts.map +1 -0
- package/dist/editor/ui/TokenPicker.js +26 -0
- package/dist/editor/ui/TokenPicker.js.map +1 -0
- package/dist/editor/useBuildError.d.ts +7 -0
- package/dist/editor/useBuildError.d.ts.map +1 -0
- package/dist/editor/useBuildError.js +30 -0
- package/dist/editor/useBuildError.js.map +1 -0
- package/dist/editor/useLatestRequest.d.ts +22 -0
- package/dist/editor/useLatestRequest.d.ts.map +1 -0
- package/dist/editor/useLatestRequest.js +49 -0
- package/dist/editor/useLatestRequest.js.map +1 -0
- package/dist/editor-bundle/editor.css +2 -0
- package/dist/editor-bundle/editor.js +83 -0
- package/dist/editor-ui.d.ts +15 -0
- package/dist/editor-ui.d.ts.map +1 -0
- package/dist/editor-ui.js +14 -0
- package/dist/editor-ui.js.map +1 -0
- package/dist/inspector/runtime.d.ts +18 -0
- package/dist/inspector/runtime.d.ts.map +1 -0
- package/dist/inspector/runtime.js +1280 -0
- package/dist/inspector/runtime.js.map +1 -0
- package/dist/preview/main.d.ts +3 -0
- package/dist/preview/main.d.ts.map +1 -0
- package/dist/preview/main.js +320 -0
- package/dist/preview/main.js.map +1 -0
- package/dist/preview/preview.css +40 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/shared/buildError.d.mts +27 -0
- package/dist/shared/buildError.mjs +141 -0
- package/dist/shared/cameraFit.d.mts +16 -0
- package/dist/shared/cameraFit.mjs +47 -0
- package/dist/shared/canvasLayout.d.mts +13 -0
- package/dist/shared/canvasLayout.mjs +171 -0
- package/dist/shared/commentShots.d.mts +12 -0
- package/dist/shared/commentShots.mjs +53 -0
- package/dist/shared/componentExtract.d.mts +43 -0
- package/dist/shared/componentExtract.mjs +136 -0
- package/dist/shared/componentMeta.d.mts +26 -0
- package/dist/shared/componentMeta.mjs +87 -0
- package/dist/shared/componentOps.d.mts +70 -0
- package/dist/shared/componentOps.mjs +407 -0
- package/dist/shared/componentTarget.d.mts +15 -0
- package/dist/shared/componentTarget.mjs +58 -0
- package/dist/shared/components.d.mts +30 -0
- package/dist/shared/components.mjs +106 -0
- package/dist/shared/consolidateCategories.d.mts +2 -0
- package/dist/shared/consolidateCategories.mjs +6 -0
- package/dist/shared/env.d.mts +4 -0
- package/dist/shared/env.mjs +18 -0
- package/dist/shared/gitChanges.d.mts +2 -0
- package/dist/shared/gitChanges.mjs +30 -0
- package/dist/shared/legacyPaths.d.mts +1 -0
- package/dist/shared/legacyPaths.mjs +9 -0
- package/dist/shared/oklab.d.mts +6 -0
- package/dist/shared/oklab.mjs +56 -0
- package/dist/shared/optimizeEntries.d.mts +5 -0
- package/dist/shared/optimizeEntries.mjs +24 -0
- package/dist/shared/packages.d.mts +11 -0
- package/dist/shared/packages.mjs +96 -0
- package/dist/shared/projectFiles.d.mts +23 -0
- package/dist/shared/projectFiles.mjs +72 -0
- package/dist/shared/prompt.d.mts +25 -0
- package/dist/shared/prompt.mjs +217 -0
- package/dist/shared/proposals.d.mts +11 -0
- package/dist/shared/proposals.mjs +42 -0
- package/dist/shared/protocol.d.ts +122 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +7 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/shared/reviewArchive.d.mts +4 -0
- package/dist/shared/reviewArchive.mjs +19 -0
- package/dist/shared/reviewStore.d.mts +30 -0
- package/dist/shared/reviewStore.mjs +218 -0
- package/dist/shared/reviewVerify.d.mts +21 -0
- package/dist/shared/reviewVerify.mjs +158 -0
- package/dist/shared/sizeModes.d.mts +15 -0
- package/dist/shared/sizeModes.mjs +53 -0
- package/dist/shared/sketches.d.mts +10 -0
- package/dist/shared/sketches.mjs +64 -0
- package/dist/shared/snapshotCheck.d.mts +13 -0
- package/dist/shared/snapshotCheck.mjs +81 -0
- package/dist/shared/timeout.d.mts +1 -0
- package/dist/shared/timeout.mjs +15 -0
- package/dist/shared/tokens.d.ts +2 -0
- package/dist/shared/tokens.d.ts.map +1 -0
- package/dist/shared/tokens.js +2 -0
- package/dist/shared/tokens.js.map +1 -0
- package/dist/shared/types.d.ts +689 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +13 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/shared/wheelRouting.d.mts +9 -0
- package/dist/shared/wheelRouting.mjs +31 -0
- package/dist/shared/writeScope.mjs +96 -0
- package/dist/snapshots/diff.d.mts +28 -0
- package/dist/snapshots/diff.mjs +263 -0
- package/dist/snapshots/index.d.mts +110 -0
- package/dist/snapshots/index.mjs +638 -0
- package/dist/snapshots/render.d.mts +24 -0
- package/dist/snapshots/render.mjs +250 -0
- package/dist/snapshots/toolOps.d.mts +25 -0
- package/dist/snapshots/toolOps.mjs +69 -0
- package/dist/tokens/adapters/css.mjs +51 -0
- package/dist/tokens/adapters/cssInCode.mjs +314 -0
- package/dist/tokens/adapters/oxcShared.mjs +80 -0
- package/dist/tokens/adapters/preprocessor.mjs +63 -0
- package/dist/tokens/adapters/registry.mjs +53 -0
- package/dist/tokens/adapters/tailwindcss.mjs +424 -0
- package/dist/tokens/adapters/types.mjs +117 -0
- package/dist/tokens/consolidate/index.d.mts +42 -0
- package/dist/tokens/consolidate/index.mjs +111 -0
- package/dist/tokens/consolidate/normalize.mjs +479 -0
- package/dist/tokens/consolidate/plan.mjs +726 -0
- package/dist/tokens/consolidate/scan.mjs +928 -0
- package/dist/tokens/extract.mjs +441 -0
- package/dist/tokens/moduleData.d.mts +14 -0
- package/dist/tokens/moduleData.mjs +32 -0
- package/dist/tokens/opLock.d.mts +4 -0
- package/dist/tokens/opLock.mjs +108 -0
- package/dist/tokens/ops.d.mts +71 -0
- package/dist/tokens/ops.mjs +1511 -0
- package/dist/tokens/pipeline.mjs +813 -0
- package/dist/tokens/report.d.mts +47 -0
- package/dist/tokens/report.mjs +257 -0
- package/dist/tokens/rewrite/code.mjs +172 -0
- package/dist/tokens/rewrite/css.mjs +154 -0
- package/dist/tokens/rewrite/index.mjs +244 -0
- package/dist/tokens/rewrite/tailwind.mjs +288 -0
- package/dist/tokens/rewrite/text.mjs +116 -0
- package/dist/tokens/rewrite/value.mjs +115 -0
- package/dist/tokens/usage.d.mts +97 -0
- package/dist/tokens/usage.mjs +680 -0
- package/dist/vite/agent.d.ts +21 -0
- package/dist/vite/agent.d.ts.map +1 -0
- package/dist/vite/agent.js +165 -0
- package/dist/vite/agent.js.map +1 -0
- package/dist/vite/events.d.ts +27 -0
- package/dist/vite/events.d.ts.map +1 -0
- package/dist/vite/events.js +156 -0
- package/dist/vite/events.js.map +1 -0
- package/dist/vite/layout.d.ts +2 -0
- package/dist/vite/layout.d.ts.map +1 -0
- package/dist/vite/layout.js +4 -0
- package/dist/vite/layout.js.map +1 -0
- package/dist/vite/plugin.d.ts +40 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +1264 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/requestGuard.d.mts +3 -0
- package/dist/vite/requestGuard.mjs +43 -0
- package/dist/vite/review.d.ts +11 -0
- package/dist/vite/review.d.ts.map +1 -0
- package/dist/vite/review.js +283 -0
- package/dist/vite/review.js.map +1 -0
- package/package.json +106 -1
- package/skills/seji/SKILL.md +400 -0
- package/skills/seji-authoring/SKILL.md +397 -0
- package/skills/seji-tokens/SKILL.md +432 -0
|
@@ -0,0 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O,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;QAC7F,IAAI,KAAK,KAAK,QAAQ;YAAE,OAAM;QAC9B,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;YACE,IAAI,EAAE,cAAc;YACpB,KAAK;YACL,KAAK;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,EACD,GAAG,CACJ,CAAA;IACH,CAAC,EACD,EAAE,OAAO,EAAE,KAAK,EAAE,CACnB,CAAA;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAChE,cAAc,CAAC,EAAE,KAAK,EAAE,2BAA2B,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IAC1E,CAAC;IACD,MAAM,KAAK,CAAA;AACb,CAAC,CAAC,CAAA","sourcesContent":["// preview.css first: it declares the lowest-priority `ds-preview` layer before the app's CSS.\nimport './preview.css'\nimport 'virtual:design/styles'\n\nimport { Component, useEffect, useState, type ReactNode } from 'react'\nimport { createRoot, type Root } from 'react-dom/client'\n\nimport { DesignFrame, designPages, type DesignConfig } from '@rien7/design-surface-runtime'\n\nimport { I18nProvider } from '../editor/i18n'\nimport { installInspector } from '../inspector/runtime'\nimport { routeFrameWheel } from '../shared/wheelRouting.mjs'\nimport {\n AFTER_UPDATE_EVENT,\n BEFORE_UPDATE_EVENT,\n BUILD_ERROR_EVENT,\n errorWhere,\n loadedFailingModule,\n summarizeBuildError,\n summarizeThrown,\n type ErrorSummary,\n} from '../shared/buildError.mjs'\nimport type { ReviewLog } from '../shared/types'\nimport { componentCatalog, componentSources } from 'virtual:design/components'\nimport { projectRoot, tokenAliases } from 'virtual:design/config'\nimport { loadDesign } from 'virtual:design/design-loader'\nimport { Providers } from 'virtual:design/providers'\nimport { tokenGroups } from 'virtual:design/tokens'\n\n// Headless snapshot mode (`?snapshot=1`, used by `seji verify --snapshots`): render the\n// frame exactly as the source does — no pending review overrides, no inspector — and report\n// readiness on `window.__designSurfaceSnapshot`. `?snapshot=manifest` only lists pages/frames.\n// An error is final: a later `ready` never hides it, so a broken frame is reported instead of\n// being captured as a blank screen on both sides.\ntype SnapshotState = { ready?: boolean; manifest?: unknown; error?: string }\nconst snapshotWindow = window as unknown as { __designSurfaceSnapshot?: SnapshotState }\nconst reportSnapshot = (state: SnapshotState) => {\n if (snapshotWindow.__designSurfaceSnapshot?.error) return\n snapshotWindow.__designSurfaceSnapshot = state\n}\nconst errorText = (error: unknown) =>\n error instanceof Error ? `${error.name}: ${error.message}` : String(error)\n\nclass SnapshotErrorBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false }\n static getDerivedStateFromError() {\n return { failed: true }\n }\n componentDidCatch(error: unknown) {\n reportSnapshot({ error: `Frame failed to render: ${errorText(error)}` })\n }\n render() {\n return this.state.failed ? null : this.props.children\n }\n}\n\n// Live frames: a failed design import or a render error shows a small card in this frame only\n// (Vite's full-screen overlay is off in `seji dev`); the next HMR update re-imports and remounts.\n// The latest build error (vite:error) names the file and line a failed import cannot.\nlet latestBuildError: ErrorSummary | null = null\nconst buildErrorListeners = new Set<() => void>()\n// A failed hot update of a module this frame runs keeps the last good render on screen; the\n// frame says so with its card. \"Runs\" = fetched by this window (its resource entries).\nlet onFrameBuildError: (() => void) | null = null\nlet frameErroredThisCycle = false\nperformance.setResourceTimingBufferSize?.(20000)\nwindow.addEventListener(BEFORE_UPDATE_EVENT, () => {\n frameErroredThisCycle = false\n})\nwindow.addEventListener(BUILD_ERROR_EVENT, (event) => {\n const err = (event as CustomEvent<unknown>).detail\n latestBuildError = summarizeBuildError(err, projectRoot)\n for (const listener of buildErrorListeners) listener()\n const loaded = performance.getEntriesByType('resource').map((entry) => entry.name)\n if (loadedFailingModule(err, projectRoot, loaded)) {\n frameErroredThisCycle = true\n onFrameBuildError?.()\n }\n})\n\ntype FrameFailure = { kind: 'import' | 'render'; error: unknown }\n\nconst cardStyle = {\n position: 'fixed',\n top: 12,\n left: 12,\n zIndex: 2147483647,\n boxSizing: 'border-box',\n maxWidth: 'calc(100% - 24px)',\n padding: '10px 12px',\n border: '1px solid #fecaca',\n borderLeft: '3px solid #dc2626',\n borderRadius: 0,\n background: '#fffafa',\n color: '#7f1d1d',\n font: '12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace',\n textAlign: 'left',\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n boxShadow: 'none',\n} as const\n\nfunction FrameErrorCard({ failure }: { failure: FrameFailure }) {\n const [buildError, setBuildError] = useState(latestBuildError)\n useEffect(() => {\n const update = () => setBuildError(latestBuildError)\n buildErrorListeners.add(update)\n return () => {\n buildErrorListeners.delete(update)\n }\n }, [])\n // A failed import only says which module failed to load; the build error says why.\n const summary = failure.kind === 'import' && buildError ? buildError : summarizeThrown(failure.error, projectRoot)\n const where = errorWhere(summary)\n return (\n <div role=\"alert\" data-seji-frame-error=\"\" style={cardStyle} title={summary.detail}>\n {where && <div style={{ fontWeight: 600 }}>{where}</div>}\n <div style={{ color: '#991b1b' }}>{summary.message}</div>\n </div>\n )\n}\n\n// Set by the boundary / a failed import; read by the hot-frame refresh to retry on the next update.\nconst frameHealth = { failed: false }\n\nclass FrameErrorBoundary extends Component<{ children: ReactNode }, { error: FrameFailure | null }> {\n state: { error: FrameFailure | null } = { error: null }\n static getDerivedStateFromError(error: unknown) {\n return { error: { kind: 'render' as const, error } }\n }\n componentDidCatch(error: unknown) {\n frameHealth.failed = true\n console.error('seji: frame failed to render', error)\n }\n // React Refresh remounts a failed boundary after a fix; a healthy mount clears the flag.\n componentDidMount() {\n if (!this.state.error) frameHealth.failed = false\n }\n render() {\n return this.state.error ? <FrameErrorCard failure={this.state.error} /> : this.props.children\n }\n}\n\nconst renderFrameError = (error: unknown) => <FrameErrorCard failure={{ kind: 'render', error }} />\nconst markFrameFailed = () => {\n frameHealth.failed = true\n}\n\nfunction renderFailure(reactRoot: Root, failure: FrameFailure) {\n frameHealth.failed = true\n reactRoot.render(<FrameErrorCard failure={failure} />)\n}\n\nasync function boot() {\n const params = new URLSearchParams(window.location.search)\n const designId = params.get('design') ?? ''\n const snapshot = params.get('snapshot')\n const root = document.getElementById('root')\n\n if (!root) throw new Error('Missing #root')\n\n let design: DesignConfig | undefined = undefined\n try {\n design = designId ? await loadDesign(designId) : undefined\n } catch (error) {\n if (snapshot) throw error\n // The design module does not load yet: show why, and start over on the next update.\n console.error('seji: design failed to load', error)\n renderFailure(createRoot(root), { kind: 'import', error })\n const retry = () => window.location.reload()\n window.addEventListener(AFTER_UPDATE_EVENT, retry, { once: true })\n window.addEventListener('design-surface:design-loader', retry, { once: true })\n return\n }\n const pages = design ? designPages(design) : []\n if (snapshot === 'manifest') {\n if (!design) reportSnapshot({ error: `Unknown design: ${designId}` })\n else {\n reportSnapshot({\n manifest: {\n design: designId,\n pages: pages.map((item) => ({\n id: item.id,\n title: item.title,\n frames: item.frames.map((entry) => ({ id: entry.id, title: entry.title, size: entry.size })),\n })),\n },\n })\n }\n return\n }\n const pageId = params.get('page') ?? pages[0]?.id\n const page = pages.find((item) => item.id === pageId) ?? pages[0]\n const frameId = params.get('frame') ?? page?.frames[0]?.id\n const frame = page?.frames.find((item) => item.id === frameId) ?? page?.frames[0]\n const frameKey = page && frame ? `${page.id}__${frame.id}` : ''\n\n if (!design || !page || !frame || (snapshot && (page.id !== pageId || frame.id !== frameId))) {\n if (snapshot) reportSnapshot({ error: `Unknown design, page or frame: ${designId} / ${String(pageId)} / ${String(frameId)}` })\n root.innerHTML = `<pre style=\"padding:24px;font:13px ui-monospace,monospace;color:#991b1b\">Unknown design, page or frame: ${String(designId)} / ${String(pageId)} / ${String(frameId)}</pre>`\n return\n }\n\n if (snapshot) {\n createRoot(root).render(\n <SnapshotErrorBoundary>\n <I18nProvider>\n <Providers>\n <DesignFrame design={design} frame={frame} />\n </Providers>\n </I18nProvider>\n </SnapshotErrorBoundary>,\n )\n requestAnimationFrame(() => requestAnimationFrame(() => reportSnapshot({ ready: true })))\n return\n }\n\n const review = await fetch(`/__seji/api/review?design=${encodeURIComponent(designId)}`)\n .then((response) => (response.ok ? (response.json() as Promise<ReviewLog>) : null))\n .catch(() => null)\n const items = review?.items ?? []\n const tokenValues = new Map<string, string>()\n for (const item of items) {\n if (\n item.kind !== 'token' ||\n item.target.type !== 'token' ||\n item.to === undefined ||\n item.verifiedAt ||\n item.status === 'archived' ||\n item.proposalDecision === 'rejected'\n ) {\n continue\n }\n tokenValues.set(item.target.token, String(item.to))\n }\n const initialFree = items.flatMap((item) =>\n item.kind === 'free' &&\n item.status !== 'archived' &&\n item.status !== 'resolved' &&\n item.frame === frameKey &&\n item.target.type === 'node' &&\n item.target.node.anchor &&\n item.to\n ? [{ anchor: item.target.node.anchor, rect: item.to as { x: number; y: number; width: number; height: number } }]\n : [],\n )\n\n const componentLines = Object.fromEntries(\n componentCatalog.flatMap((entry) => (entry.line ? [[entry.name, entry.line]] : [])),\n )\n\n const reactRoot = createRoot(root)\n renderFrame(reactRoot, design, frame)\n installHotFrame(reactRoot, designId, design, page.id, frame.id)\n\n installWheelForwarding(frameKey)\n\n requestAnimationFrame(() => {\n installInspector(window, {\n frame: frameKey,\n tokens: tokenGroups.flatMap((group) => group.tokens),\n tokenAliases,\n root: projectRoot,\n componentSources,\n componentLines,\n initialTokens: [...tokenValues].map(([name, value]) => ({ name, value })),\n initialFree,\n })\n })\n\n}\n\ntype FrameConfig = ReturnType<typeof designPages>[number]['frames'][number]\n\nlet liveLoadDesign = loadDesign\nlet LiveProviders = Providers\n\n// Bumped on every recovery so the boundary (and the frame below it) remounts fresh.\nlet frameGeneration = 0\n\nfunction renderFrame(reactRoot: Root, design: DesignConfig, frame: FrameConfig) {\n if (frameHealth.failed) frameGeneration += 1\n frameHealth.failed = false\n latestBuildError = null\n reactRoot.render(\n <FrameErrorBoundary key={frameGeneration}>\n <I18nProvider>\n <LiveProviders>\n <DesignFrame design={design} frame={frame} renderError={renderFrameError} onError={markFrameFailed} />\n </LiveProviders>\n </I18nProvider>\n </FrameErrorBoundary>,\n )\n}\n\n// Hot updates of the self-accepting virtual modules (see vite/plugin.ts): re-run loadDesign\n// through the new loader and re-render the existing root. A frame whose design module did not\n// change gets the same design object back and is left alone, so only the related frames update.\nfunction installHotFrame(reactRoot: Root, designId: string, initial: DesignConfig, pageId: string, frameId: string) {\n let current = initial\n let currentProviders = LiveProviders\n let pending = Promise.resolve()\n // `retry`: the frame is showing an error card; render again even if nothing changed.\n const refresh = (retry = false) => {\n pending = pending.then(async () => {\n if (retry && !frameHealth.failed) return\n const next = await liveLoadDesign(designId)\n if (!next || (!frameHealth.failed && next === current && LiveProviders === currentProviders)) return\n const page = designPages(next).find((item) => item.id === pageId)\n const frame = page?.frames.find((item) => item.id === frameId)\n if (!frame) return\n current = next\n currentProviders = LiveProviders\n renderFrame(reactRoot, next, frame)\n }).catch((error: unknown) => {\n console.error('seji: frame update failed', error)\n renderFailure(reactRoot, { kind: 'import', error })\n })\n }\n // Any finished update (the fix may be in a component the design module does not re-export,\n // e.g. a React Refresh boundary) retries a failed frame.\n // An update whose own fetch failed for this frame is not a fix.\n window.addEventListener(AFTER_UPDATE_EVENT, () => {\n if (!frameErroredThisCycle) refresh(true)\n })\n onFrameBuildError = () => {\n pending = pending.then(() => renderFailure(reactRoot, { kind: 'import', error: null }))\n }\n window.addEventListener('design-surface:design-loader', (event) => {\n liveLoadDesign = (event as CustomEvent<{ loadDesign: typeof loadDesign }>).detail.loadDesign\n refresh()\n })\n window.addEventListener('design-surface:providers', (event) => {\n LiveProviders = (event as CustomEvent<{ Providers: typeof Providers }>).detail.Providers\n refresh()\n })\n for (const name of ['tokens', 'components', 'config']) {\n window.addEventListener(`design-surface:${name}`, () => refresh())\n }\n}\n\n// One non-passive wheel listener: zoom (ctrl / meta / pinch) and inspect-mode pans go to the\n// canvas, run-mode scrolling stays in the frame (shared/wheelRouting.mjs decides).\nfunction installWheelForwarding(frame: string) {\n if (window.parent === window) return\n let inspecting = false\n window.addEventListener('message', (event) => {\n if (event.source !== window.parent) return\n const data = event.data as { type?: unknown; action?: unknown } | null\n if (data?.type !== 'design:command') return\n if (data.action === 'enable') inspecting = true\n if (data.action === 'disable') inspecting = false\n })\n window.addEventListener(\n 'wheel',\n (event) => {\n const route = routeFrameWheel({ ctrlKey: event.ctrlKey, metaKey: event.metaKey, inspecting })\n if (route === 'native') return\n event.preventDefault()\n window.parent.postMessage(\n {\n type: 'design:wheel',\n frame,\n route,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX: event.deltaX,\n deltaY: event.deltaY,\n deltaMode: event.deltaMode,\n },\n '*',\n )\n },\n { passive: false },\n )\n}\n\nboot().catch((error: unknown) => {\n if (new URLSearchParams(window.location.search).has('snapshot')) {\n reportSnapshot({ error: `Preview failed to boot: ${errorText(error)}` })\n }\n throw error\n})\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Preview frame defaults. Everything sits in the `ds-preview` layer, declared before the app's
|
|
3
|
+
* CSS loads (main.tsx imports this file first), so any app style — layered or not — wins.
|
|
4
|
+
*/
|
|
5
|
+
@layer ds-preview {
|
|
6
|
+
html,
|
|
7
|
+
body {
|
|
8
|
+
min-height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.component-specimen {
|
|
16
|
+
display: flex;
|
|
17
|
+
min-height: 100vh;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
padding: 32px;
|
|
21
|
+
background: #fff;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.component-error {
|
|
25
|
+
display: flex;
|
|
26
|
+
max-width: 520px;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 6px;
|
|
29
|
+
padding: 24px;
|
|
30
|
+
border: 1px solid #fecaca;
|
|
31
|
+
border-radius: 0;
|
|
32
|
+
background: #fef2f2;
|
|
33
|
+
color: #991b1b;
|
|
34
|
+
font: 12px/1.6 ui-monospace, monospace;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.component-error strong {
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.tsx"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,mBAAmB,+BAA+B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.tsx"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA","sourcesContent":["export * from '@rien7/design-surface-runtime'\nexport type * from '@rien7/design-surface-runtime'\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const BUILD_ERROR_EVENT: 'seji:vite-error'
|
|
2
|
+
export declare const BEFORE_UPDATE_EVENT: 'seji:vite-before-update'
|
|
3
|
+
export declare const AFTER_UPDATE_EVENT: 'seji:vite-after-update'
|
|
4
|
+
|
|
5
|
+
export type ErrorSummary = {
|
|
6
|
+
/** Project-relative file, or ''. */
|
|
7
|
+
file: string
|
|
8
|
+
line?: number
|
|
9
|
+
/** The first line of the error. */
|
|
10
|
+
message: string
|
|
11
|
+
/** The full text, for a tooltip. */
|
|
12
|
+
detail: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare function displayPath(file: unknown, root?: string): string
|
|
16
|
+
export declare function summarizeBuildError(err: unknown, root?: string): ErrorSummary
|
|
17
|
+
export declare function stackLocation(stack: unknown, root?: string): { file: string; line: number } | undefined
|
|
18
|
+
export declare function summarizeThrown(error: unknown, root?: string): ErrorSummary
|
|
19
|
+
export declare function errorModulePaths(err: unknown, root?: string): string[]
|
|
20
|
+
export declare function loadedFailingModule(err: unknown, root: string, loadedUrls: Iterable<string>): boolean
|
|
21
|
+
export declare function errorWhere(summary: ErrorSummary | null | undefined): string
|
|
22
|
+
export declare function createBuildErrorTracker(root?: string): {
|
|
23
|
+
readonly current: ErrorSummary | null
|
|
24
|
+
error(err: unknown): boolean
|
|
25
|
+
beforeUpdate(): boolean
|
|
26
|
+
afterUpdate(): boolean
|
|
27
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Build / render errors, summarized for the per-frame error card (preview/main.tsx) and the
|
|
2
|
+
// status bar note (editor). Vite's own full-screen overlay is off in `seji dev`; these take its
|
|
3
|
+
// place without covering the editor.
|
|
4
|
+
|
|
5
|
+
/** Window events relayed from the dev server's HMR client (see the virtual config module). */
|
|
6
|
+
export const BUILD_ERROR_EVENT = 'seji:vite-error'
|
|
7
|
+
export const BEFORE_UPDATE_EVENT = 'seji:vite-before-update'
|
|
8
|
+
export const AFTER_UPDATE_EVENT = 'seji:vite-after-update'
|
|
9
|
+
|
|
10
|
+
const firstLine = (text) =>
|
|
11
|
+
String(text ?? '')
|
|
12
|
+
.split('\n')
|
|
13
|
+
.map((line) => line.trim())
|
|
14
|
+
.find(Boolean) ?? ''
|
|
15
|
+
|
|
16
|
+
/** `/abs/root/src/a.tsx` → `src/a.tsx`; URLs lose origin, `/@fs` and the query. */
|
|
17
|
+
export function displayPath(file, root = '') {
|
|
18
|
+
let path = String(file ?? '')
|
|
19
|
+
if (!path) return ''
|
|
20
|
+
try {
|
|
21
|
+
if (/^https?:\/\//.test(path)) path = new URL(path).pathname
|
|
22
|
+
} catch {
|
|
23
|
+
// keep as is
|
|
24
|
+
}
|
|
25
|
+
path = path.replace(/[?#].*$/, '').replace(/^\/@fs(?=\/)/, '')
|
|
26
|
+
const base = String(root ?? '').replace(/\/+$/, '')
|
|
27
|
+
if (base && path.startsWith(`${base}/`)) return path.slice(base.length + 1)
|
|
28
|
+
return path.replace(/^\/+/, '')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The `err` of a Vite `vite:error` payload → `{ file, line, message, detail }`.
|
|
33
|
+
* `file` is project-relative, `message` the first line, `detail` the full text for a tooltip.
|
|
34
|
+
*/
|
|
35
|
+
export function summarizeBuildError(err, root = '') {
|
|
36
|
+
const loc = err?.loc ?? {}
|
|
37
|
+
const file = displayPath(loc.file ?? err?.id ?? '', root)
|
|
38
|
+
const line = Number.isInteger(loc.line) && loc.line > 0 ? loc.line : undefined
|
|
39
|
+
const message = firstLine(err?.message) || 'Build failed'
|
|
40
|
+
const where = file ? `${file}${line ? `:${line}` : ''}` : ''
|
|
41
|
+
const detail = [where, String(err?.message ?? '').trim(), err?.frame ? String(err.frame).trimEnd() : '']
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.join('\n')
|
|
44
|
+
return { file, line, message, detail }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const SKIP_FRAME = /\/node_modules\/|\/\.vite\/|\/@vite\/|\/@react-refresh|\/@id\/|chunk-[\w-]+\.js/
|
|
48
|
+
|
|
49
|
+
/** The first project source location in a stack: `{ file, line }` or undefined. */
|
|
50
|
+
export function stackLocation(stack, root = '') {
|
|
51
|
+
const pattern = /(https?:\/\/[^\s()]+?|\/[^\s():]+?):(\d+):\d+/g
|
|
52
|
+
for (const match of String(stack ?? '').matchAll(pattern)) {
|
|
53
|
+
if (SKIP_FRAME.test(match[1])) continue
|
|
54
|
+
const file = displayPath(match[1], root)
|
|
55
|
+
if (file) return { file, line: Number(match[2]) }
|
|
56
|
+
}
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A thrown render / import error → `{ file, line, message, detail }`. */
|
|
61
|
+
export function summarizeThrown(error, root = '') {
|
|
62
|
+
const message =
|
|
63
|
+
error instanceof Error ? firstLine(`${error.name}: ${error.message}`) : firstLine(error) || 'Unknown error'
|
|
64
|
+
const stack = error instanceof Error ? error.stack ?? '' : ''
|
|
65
|
+
// "Failed to fetch dynamically imported module: http://host/design/x/design.tsx?t=1"
|
|
66
|
+
const fetched = /imported module:\s*(\S+)/.exec(message)?.[1]
|
|
67
|
+
const loc = fetched ? { file: displayPath(fetched, root), line: undefined } : stackLocation(stack, root)
|
|
68
|
+
return {
|
|
69
|
+
file: loc?.file ?? '',
|
|
70
|
+
line: loc?.line,
|
|
71
|
+
message,
|
|
72
|
+
detail: [message, stack.split('\n').slice(1, 8).join('\n')].filter(Boolean).join('\n'),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The dev-server URL paths a failing module may have been loaded under: `/src/a.tsx` inside the
|
|
78
|
+
* root, `/@fs/abs/path` for any file. Used to tell whether a window had loaded that module.
|
|
79
|
+
*/
|
|
80
|
+
export function errorModulePaths(err, root = '') {
|
|
81
|
+
const id = String(err?.id ?? err?.loc?.file ?? '').replace(/[?#].*$/, '')
|
|
82
|
+
if (!id.startsWith('/') && !/^[A-Za-z]:\//.test(id)) return []
|
|
83
|
+
const base = String(root ?? '').replace(/\/+$/, '')
|
|
84
|
+
const paths = [id.startsWith('/') ? `/@fs${id}` : `/@fs/${id}`]
|
|
85
|
+
if (base && id.startsWith(`${base}/`)) paths.unshift(id.slice(base.length))
|
|
86
|
+
return paths
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Whether one of `loadedUrls` (resource URLs of this window) is the failing module. */
|
|
90
|
+
export function loadedFailingModule(err, root, loadedUrls) {
|
|
91
|
+
const wanted = new Set(errorModulePaths(err, root))
|
|
92
|
+
if (!wanted.size) return false
|
|
93
|
+
for (const url of loadedUrls ?? []) {
|
|
94
|
+
let pathname = String(url)
|
|
95
|
+
try {
|
|
96
|
+
pathname = new URL(pathname, 'http://x').pathname
|
|
97
|
+
} catch {
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
if (wanted.has(decodeURIComponent(pathname))) return true
|
|
101
|
+
}
|
|
102
|
+
return false
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** `file:line`, or just the file, or ''. */
|
|
106
|
+
export function errorWhere(summary) {
|
|
107
|
+
if (!summary?.file) return ''
|
|
108
|
+
return summary.line ? `${summary.file}:${summary.line}` : summary.file
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The editor's build state across HMR events. An error shows until an update cycle finishes
|
|
113
|
+
* without one; an error that lands inside a cycle (the failed fetch of that very update) keeps it.
|
|
114
|
+
*/
|
|
115
|
+
export function createBuildErrorTracker(root = '') {
|
|
116
|
+
let current = null
|
|
117
|
+
let erroredThisCycle = false
|
|
118
|
+
return {
|
|
119
|
+
get current() {
|
|
120
|
+
return current
|
|
121
|
+
},
|
|
122
|
+
/** Returns whether the state changed. */
|
|
123
|
+
error(err) {
|
|
124
|
+
current = summarizeBuildError(err, root)
|
|
125
|
+
erroredThisCycle = true
|
|
126
|
+
return true
|
|
127
|
+
},
|
|
128
|
+
beforeUpdate() {
|
|
129
|
+
erroredThisCycle = false
|
|
130
|
+
return false
|
|
131
|
+
},
|
|
132
|
+
afterUpdate() {
|
|
133
|
+
if (erroredThisCycle || !current) {
|
|
134
|
+
erroredThisCycle = false
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
current = null
|
|
138
|
+
return true
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type PageFit = {
|
|
2
|
+
/** The active page changed: a new page is fitted again (no-op for the same page). */
|
|
3
|
+
enter(id: string | null | undefined): void
|
|
4
|
+
/** Run a camera move the editor makes itself; it does not count as the user's. */
|
|
5
|
+
programmatic<T>(move: () => T): T
|
|
6
|
+
/** Call on every camera change. */
|
|
7
|
+
cameraChanged(): void
|
|
8
|
+
/**
|
|
9
|
+
* Should the page be fitted now? True once per measured chrome height while the page's
|
|
10
|
+
* report is loaded and the user has not moved the camera on it; records the fit.
|
|
11
|
+
*/
|
|
12
|
+
shouldFit(input: { page: string | null | undefined; chromeHeight: number; ready: boolean }): boolean
|
|
13
|
+
readonly userMoved: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createPageFit(): PageFit
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// When the editor fits a component page into view, as one small state machine the editor
|
|
2
|
+
// owns (App.tsx keeps a single instance) and tests can drive without a browser.
|
|
3
|
+
//
|
|
4
|
+
// A component page is fitted once its chrome (header, tidy card, usage frame, state strips)
|
|
5
|
+
// has been measured with the page's own report loaded, and again whenever that measured
|
|
6
|
+
// height changes, until the user pans or zooms on that page. Camera moves the editor makes
|
|
7
|
+
// itself (fits, restoring a saved layout) run through `programmatic()` and are not the
|
|
8
|
+
// user's. Entering another page starts over. No timers: the caller feeds it measurements.
|
|
9
|
+
|
|
10
|
+
export function createPageFit() {
|
|
11
|
+
let page = ''
|
|
12
|
+
let userMoved = false
|
|
13
|
+
let depth = 0
|
|
14
|
+
let fitted = ''
|
|
15
|
+
const enter = (id) => {
|
|
16
|
+
const next = String(id ?? '')
|
|
17
|
+
if (next === page) return
|
|
18
|
+
page = next
|
|
19
|
+
userMoved = false
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
enter,
|
|
23
|
+
programmatic(move) {
|
|
24
|
+
depth += 1
|
|
25
|
+
try {
|
|
26
|
+
return move()
|
|
27
|
+
} finally {
|
|
28
|
+
depth -= 1
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
cameraChanged() {
|
|
32
|
+
if (depth === 0) userMoved = true
|
|
33
|
+
},
|
|
34
|
+
shouldFit({ page: id, chromeHeight, ready }) {
|
|
35
|
+
const current = String(id ?? '')
|
|
36
|
+
enter(current)
|
|
37
|
+
if (!current || !ready || !(chromeHeight > 0) || userMoved) return false
|
|
38
|
+
const key = `${current}:${chromeHeight}`
|
|
39
|
+
if (fitted === key) return false
|
|
40
|
+
fitted = key
|
|
41
|
+
return true
|
|
42
|
+
},
|
|
43
|
+
get userMoved() {
|
|
44
|
+
return userMoved
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CanvasCamera, CanvasLayout, CanvasPosition } from './types'
|
|
2
|
+
|
|
3
|
+
export declare function positionsFile(root: string, design: string): string
|
|
4
|
+
export declare function cameraPath(root: string, design: string): string
|
|
5
|
+
export declare function readCamera(value: unknown): CanvasCamera | undefined
|
|
6
|
+
export declare function normalizePositions(source: unknown): Record<string, CanvasPosition>
|
|
7
|
+
export declare function migrateCanvasCamera(root: string, design: string, options?: { dryRun?: boolean }): boolean
|
|
8
|
+
export declare function readLayout(root: string, design: string): CanvasLayout | null
|
|
9
|
+
export declare function writeLayout(
|
|
10
|
+
root: string,
|
|
11
|
+
design: string,
|
|
12
|
+
value: { positions?: unknown; camera?: unknown } | unknown,
|
|
13
|
+
): CanvasLayout
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Canvas layout, split by owner:
|
|
2
|
+
// design/<design>/canvas.json node positions, shared and committed. Written only
|
|
3
|
+
// when a node moves, keys sorted, so no churn.
|
|
4
|
+
// design/.seji/canvas/<design>.json this person's camera (zoom + viewport) per page,
|
|
5
|
+
// ignored: `{ camera, cameras: { <page>: camera } }`
|
|
6
|
+
// (`camera` is the last one saved; a 0.4.3 file is
|
|
7
|
+
// a bare camera).
|
|
8
|
+
// Panning / zooming never touches canvas.json. A 0.4.2 canvas.json that still carries the camera
|
|
9
|
+
// is migrated on first read (camera moved out, canvas.json stripped).
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
11
|
+
import { dirname, resolve, sep } from 'node:path'
|
|
12
|
+
|
|
13
|
+
import { cameraFile } from './projectFiles.mjs'
|
|
14
|
+
|
|
15
|
+
const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/
|
|
16
|
+
const SAFE_NODE_ID = /^[A-Za-z0-9][A-Za-z0-9:_-]{0,127}$/
|
|
17
|
+
const MAX_NODES = 500
|
|
18
|
+
const MAX_COORDINATE = 10_000_000
|
|
19
|
+
|
|
20
|
+
function checkedId(design) {
|
|
21
|
+
if (!SAFE_ID.test(design)) throw new Error(`Invalid design id: ${design}`)
|
|
22
|
+
return design
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function positionsFile(root, design) {
|
|
26
|
+
const dir = resolve(root, 'design', checkedId(design))
|
|
27
|
+
const file = resolve(dir, 'canvas.json')
|
|
28
|
+
if (!file.startsWith(`${dir}${sep}`)) throw new Error('Invalid layout path')
|
|
29
|
+
return file
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const cameraPath = (root, design) => cameraFile(root, checkedId(design))
|
|
33
|
+
|
|
34
|
+
const round = (value, places) => Math.round(value * 10 ** places) / 10 ** places
|
|
35
|
+
|
|
36
|
+
function readPosition(value) {
|
|
37
|
+
if (!value || typeof value !== 'object') return null
|
|
38
|
+
const { x, y } = value
|
|
39
|
+
if (typeof x !== 'number' || typeof y !== 'number') return null
|
|
40
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return null
|
|
41
|
+
if (Math.abs(x) > MAX_COORDINATE || Math.abs(y) > MAX_COORDINATE) return null
|
|
42
|
+
return { x: round(x, 2), y: round(y, 2) }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function readCamera(value) {
|
|
46
|
+
if (!value || typeof value !== 'object') return undefined
|
|
47
|
+
const { x, y, zoom } = value
|
|
48
|
+
if (
|
|
49
|
+
typeof x !== 'number' ||
|
|
50
|
+
typeof y !== 'number' ||
|
|
51
|
+
typeof zoom !== 'number' ||
|
|
52
|
+
!Number.isFinite(x) ||
|
|
53
|
+
!Number.isFinite(y) ||
|
|
54
|
+
!Number.isFinite(zoom) ||
|
|
55
|
+
zoom <= 0 ||
|
|
56
|
+
Math.abs(x) > MAX_COORDINATE ||
|
|
57
|
+
Math.abs(y) > MAX_COORDINATE ||
|
|
58
|
+
zoom > 4
|
|
59
|
+
) {
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
62
|
+
return { x: round(x, 2), y: round(y, 2), zoom: round(zoom, 3) }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Positions with sorted keys: the same layout always serializes to the same bytes. */
|
|
66
|
+
export function normalizePositions(source) {
|
|
67
|
+
const positions = {}
|
|
68
|
+
if (!source || typeof source !== 'object') return positions
|
|
69
|
+
const entries = Object.entries(source)
|
|
70
|
+
.filter(([id]) => SAFE_NODE_ID.test(id))
|
|
71
|
+
.slice(0, MAX_NODES)
|
|
72
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
73
|
+
for (const [id, position] of entries) {
|
|
74
|
+
const next = readPosition(position)
|
|
75
|
+
if (next) positions[id] = next
|
|
76
|
+
}
|
|
77
|
+
return positions
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const readJson = (file) => {
|
|
81
|
+
try {
|
|
82
|
+
return JSON.parse(readFileSync(file, 'utf8'))
|
|
83
|
+
} catch {
|
|
84
|
+
return null
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const writeIfChanged = (file, value) => {
|
|
89
|
+
const text = `${JSON.stringify(value, null, 2)}\n`
|
|
90
|
+
if (existsSync(file) && readFileSync(file, 'utf8') === text) return false
|
|
91
|
+
mkdirSync(dirname(file), { recursive: true })
|
|
92
|
+
writeFileSync(file, text)
|
|
93
|
+
return true
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Move a camera that 0.4.2 stored in canvas.json to the cache and strip it. Returns true when it
|
|
98
|
+
* changed a file. A camera already in the cache wins (it is newer).
|
|
99
|
+
*/
|
|
100
|
+
export function migrateCanvasCamera(root, design, { dryRun = false } = {}) {
|
|
101
|
+
const file = positionsFile(root, design)
|
|
102
|
+
const raw = readJson(file)
|
|
103
|
+
if (!raw || typeof raw !== 'object' || !('camera' in raw)) return false
|
|
104
|
+
if (dryRun) return true
|
|
105
|
+
const camera = readCamera(raw.camera)
|
|
106
|
+
const target = cameraPath(root, design)
|
|
107
|
+
if (camera && !existsSync(target)) writeIfChanged(target, camera)
|
|
108
|
+
writeIfChanged(file, { version: 1, positions: normalizePositions(raw.positions) })
|
|
109
|
+
return true
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The cached cameras: `{ camera?, cameras }` (a bare 0.4.3 camera has no page cameras). */
|
|
113
|
+
function readCameras(value) {
|
|
114
|
+
const bare = readCamera(value)
|
|
115
|
+
if (bare) return { camera: bare, cameras: {} }
|
|
116
|
+
const cameras = {}
|
|
117
|
+
if (value?.cameras && typeof value.cameras === 'object') {
|
|
118
|
+
for (const [page, entry] of Object.entries(value.cameras).slice(0, MAX_NODES)) {
|
|
119
|
+
const camera = readCamera(entry)
|
|
120
|
+
if (camera && SAFE_NODE_ID.test(page)) cameras[page] = camera
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { camera: readCamera(value?.camera), cameras }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* `{ version, positions, camera?, cameras? }` for the editor, or null when neither file exists.
|
|
128
|
+
* `cameras` holds the camera of each page; `camera` is the last one saved.
|
|
129
|
+
*/
|
|
130
|
+
export function readLayout(root, design) {
|
|
131
|
+
try {
|
|
132
|
+
migrateCanvasCamera(root, design)
|
|
133
|
+
} catch {
|
|
134
|
+
// a read-only checkout still serves the layout
|
|
135
|
+
}
|
|
136
|
+
const positions = readJson(positionsFile(root, design))
|
|
137
|
+
const { camera, cameras } = readCameras(readJson(cameraPath(root, design)))
|
|
138
|
+
if (!positions && !camera && !Object.keys(cameras).length) return null
|
|
139
|
+
return {
|
|
140
|
+
version: 1,
|
|
141
|
+
positions: normalizePositions(positions?.positions),
|
|
142
|
+
...(camera ? { camera } : {}),
|
|
143
|
+
...(Object.keys(cameras).length ? { cameras } : {}),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* `{ positions?, camera?, page? }`: positions go to canvas.json (only when they differ), the
|
|
149
|
+
* camera to the cache (as `page`'s camera when given). Either may be absent; returns the layout
|
|
150
|
+
* as stored.
|
|
151
|
+
*/
|
|
152
|
+
export function writeLayout(root, design, value) {
|
|
153
|
+
const input = value && typeof value === 'object' ? value : {}
|
|
154
|
+
if (input.positions && typeof input.positions === 'object') {
|
|
155
|
+
writeIfChanged(positionsFile(root, design), { version: 1, positions: normalizePositions(input.positions) })
|
|
156
|
+
}
|
|
157
|
+
const camera = readCamera(input.camera)
|
|
158
|
+
if (camera) {
|
|
159
|
+
const file = cameraPath(root, design)
|
|
160
|
+
const { cameras } = readCameras(readJson(file))
|
|
161
|
+
const page = typeof input.page === 'string' && SAFE_NODE_ID.test(input.page) ? input.page : null
|
|
162
|
+
const keys = Object.keys(cameras).sort()
|
|
163
|
+
writeIfChanged(file, {
|
|
164
|
+
camera,
|
|
165
|
+
cameras: Object.fromEntries(
|
|
166
|
+
[...keys.map((key) => [key, cameras[key]]), ...(page ? [[page, camera]] : [])].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),
|
|
167
|
+
),
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
return readLayout(root, design) ?? { version: 1, positions: {} }
|
|
171
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReviewLog } from './types'
|
|
2
|
+
|
|
3
|
+
export declare const SAFE_ITEM_ID: RegExp
|
|
4
|
+
export declare function commentShotPath(design: string, itemId: string): string
|
|
5
|
+
export declare function decodePngDataUrl(value: unknown): Buffer | null
|
|
6
|
+
export declare function storeCommentShot(options: {
|
|
7
|
+
root: string
|
|
8
|
+
design: string
|
|
9
|
+
itemId: string
|
|
10
|
+
png: Buffer
|
|
11
|
+
now?: string
|
|
12
|
+
}): { shot: string; file: string; review: ReviewLog }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Comment screenshots: the editor captures a frame's live DOM when a comment is posted and
|
|
2
|
+
// POSTs the PNG to /__seji/api/review/shot. The file lives in the tool cache
|
|
3
|
+
// (design/.seji/comments/<design>/<itemId>.png); the item's `shot` field holds its
|
|
4
|
+
// root-relative path. `shot` is tool-owned (reviewStore TOOL_OWNED_FIELDS): only this writes it.
|
|
5
|
+
import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import { dirname, resolve } from 'node:path'
|
|
7
|
+
|
|
8
|
+
import { CACHE_DIR } from './projectFiles.mjs'
|
|
9
|
+
import { SAFE_DESIGN_ID, mutateReview } from './reviewStore.mjs'
|
|
10
|
+
|
|
11
|
+
export const SAFE_ITEM_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/
|
|
12
|
+
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])
|
|
13
|
+
|
|
14
|
+
/** Root-relative path of an item's screenshot. */
|
|
15
|
+
export const commentShotPath = (design, itemId) => `${CACHE_DIR}/comments/${design}/${itemId}.png`
|
|
16
|
+
|
|
17
|
+
/** PNG bytes from a `data:image/png;base64,…` URL (or bare base64); null when it is not a PNG. */
|
|
18
|
+
export function decodePngDataUrl(value) {
|
|
19
|
+
if (typeof value !== 'string') return null
|
|
20
|
+
const base64 = value.startsWith('data:') ? (/^data:image\/png;base64,(.*)$/s.exec(value)?.[1] ?? '') : value
|
|
21
|
+
const png = Buffer.from(base64, 'base64')
|
|
22
|
+
return png.length > PNG_SIGNATURE.length && png.subarray(0, 8).equals(PNG_SIGNATURE) ? png : null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Write the PNG and set `shot` on the item under the ledger lock. Throws when the ids are
|
|
27
|
+
* invalid, the bytes are not a PNG, or the item does not exist (the file is then removed).
|
|
28
|
+
*/
|
|
29
|
+
export function storeCommentShot({ root, design, itemId, png, now = new Date().toISOString() }) {
|
|
30
|
+
if (!SAFE_DESIGN_ID.test(String(design))) throw new Error('valid design id is required')
|
|
31
|
+
if (!SAFE_ITEM_ID.test(String(itemId))) throw new Error('valid item id is required')
|
|
32
|
+
if (!Buffer.isBuffer(png) || !png.subarray(0, 8).equals(PNG_SIGNATURE)) throw new Error('a PNG image is required')
|
|
33
|
+
const shot = commentShotPath(design, itemId)
|
|
34
|
+
const file = resolve(root, shot)
|
|
35
|
+
mkdirSync(dirname(file), { recursive: true })
|
|
36
|
+
writeFileSync(file, png)
|
|
37
|
+
let found = false
|
|
38
|
+
try {
|
|
39
|
+
const { review } = mutateReview(root, design, (current) => {
|
|
40
|
+
if (!current.items.some((item) => item.id === itemId)) return undefined
|
|
41
|
+
found = true
|
|
42
|
+
return {
|
|
43
|
+
...current,
|
|
44
|
+
items: current.items.map((item) => (item.id === itemId ? { ...item, shot, updatedAt: now } : item)),
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
if (!found) throw new Error(`no review item ${itemId} in ${design}`)
|
|
48
|
+
return { shot, file, review }
|
|
49
|
+
} catch (error) {
|
|
50
|
+
rmSync(file, { force: true })
|
|
51
|
+
throw error
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ExtractFrom, NodeRef, ReviewItem } from './types'
|
|
2
|
+
|
|
3
|
+
export declare const COMPONENT_NAME: RegExp
|
|
4
|
+
export declare const isExtractItem: (item: unknown) => boolean
|
|
5
|
+
|
|
6
|
+
type NodeLike = Partial<NodeRef> & { path?: string; source?: string | null; componentRoot?: boolean; component?: string | null; components?: string[] }
|
|
7
|
+
type Names = Iterable<string> | Set<string>
|
|
8
|
+
|
|
9
|
+
export declare function extractSourceOf(
|
|
10
|
+
node: NodeLike | null | undefined,
|
|
11
|
+
catalog: Names,
|
|
12
|
+
): { from: ExtractFrom; parent: string | null }
|
|
13
|
+
export declare function alreadyComponent(node: NodeLike | null | undefined, catalog: Names): string | null
|
|
14
|
+
export declare function takenComponentNames(input?: {
|
|
15
|
+
catalog?: Iterable<string>
|
|
16
|
+
pages?: Iterable<string>
|
|
17
|
+
items?: ReviewItem[]
|
|
18
|
+
}): Set<string>
|
|
19
|
+
|
|
20
|
+
export type ExtractErrorCode = 'invalid-name' | 'name-taken' | 'description-required' | 'unknown-dir'
|
|
21
|
+
export declare function extractError(input?: {
|
|
22
|
+
name?: string
|
|
23
|
+
description?: string
|
|
24
|
+
dir?: string
|
|
25
|
+
dirs?: Array<string | { dir: string }>
|
|
26
|
+
taken?: Set<string>
|
|
27
|
+
}): ExtractErrorCode | null
|
|
28
|
+
|
|
29
|
+
export declare function extractItem(input: {
|
|
30
|
+
design: string
|
|
31
|
+
node: NodeLike
|
|
32
|
+
page?: string
|
|
33
|
+
frame?: string
|
|
34
|
+
name: string
|
|
35
|
+
description: string
|
|
36
|
+
dir?: string
|
|
37
|
+
from?: ExtractFrom
|
|
38
|
+
parent?: string | null
|
|
39
|
+
parentFile?: string | null
|
|
40
|
+
author?: 'human' | 'agent'
|
|
41
|
+
id?: string
|
|
42
|
+
now?: string
|
|
43
|
+
}): ReviewItem
|