@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 +1,250 @@
|
|
|
1
|
+
// Headless rendering of design artboards for snapshot comparison.
|
|
2
|
+
//
|
|
3
|
+
// A Playwright Chromium page loads each artboard's preview route
|
|
4
|
+
// (`/__seji/preview?design=…&page=…&frame=…&snapshot=1`) from a Vite dev server — the
|
|
5
|
+
// one already running (`url`) or a short-lived one started here — waits for the frame to
|
|
6
|
+
// report ready, fonts and network idle, and screenshots the viewport at the artboard size.
|
|
7
|
+
// Snapshot mode in the preview skips pending review overrides and the inspector, so the
|
|
8
|
+
// image is what the source renders.
|
|
9
|
+
//
|
|
10
|
+
// Playwright is an optional peer dependency and is imported lazily.
|
|
11
|
+
import { existsSync } from 'node:fs'
|
|
12
|
+
import { createRequire } from 'node:module'
|
|
13
|
+
import net from 'node:net'
|
|
14
|
+
import { join } from 'node:path'
|
|
15
|
+
import { pathToFileURL } from 'node:url'
|
|
16
|
+
|
|
17
|
+
import { toolEnv } from '../shared/env.mjs'
|
|
18
|
+
|
|
19
|
+
const PLAYWRIGHT_HINT =
|
|
20
|
+
'Snapshots need Playwright Chromium: install it in the project (`pnpm add -D playwright`, or npm/yarn equivalent) and download the browser with `npx playwright install chromium`.'
|
|
21
|
+
|
|
22
|
+
export class SnapshotUnavailableError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message)
|
|
25
|
+
this.name = 'SnapshotUnavailableError'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Resolve Playwright from the host project first, then from this package. */
|
|
30
|
+
export async function loadPlaywright(root = process.cwd()) {
|
|
31
|
+
const candidates = []
|
|
32
|
+
const hostPkg = join(root, 'package.json')
|
|
33
|
+
for (const name of ['playwright', 'playwright-core']) {
|
|
34
|
+
if (existsSync(hostPkg)) {
|
|
35
|
+
try {
|
|
36
|
+
candidates.push(pathToFileURL(createRequire(hostPkg).resolve(name)).href)
|
|
37
|
+
} catch {
|
|
38
|
+
// not installed in the host
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
candidates.push(name)
|
|
42
|
+
}
|
|
43
|
+
for (const specifier of candidates) {
|
|
44
|
+
try {
|
|
45
|
+
const mod = await import(specifier)
|
|
46
|
+
const chromium = mod.chromium ?? mod.default?.chromium
|
|
47
|
+
if (chromium) return chromium
|
|
48
|
+
} catch {
|
|
49
|
+
// try the next candidate
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw new SnapshotUnavailableError(`Playwright is not installed. ${PLAYWRIGHT_HINT}`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** True when Playwright can be imported (does not launch a browser). */
|
|
56
|
+
export async function hasPlaywright(root) {
|
|
57
|
+
try {
|
|
58
|
+
await loadPlaywright(root)
|
|
59
|
+
return true
|
|
60
|
+
} catch {
|
|
61
|
+
return false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function launchChromium(root) {
|
|
66
|
+
const chromium = await loadPlaywright(root)
|
|
67
|
+
const channel = toolEnv('BROWSER_CHANNEL')
|
|
68
|
+
const attempts = channel ? [{ channel }] : [{}, { channel: 'chrome' }]
|
|
69
|
+
let lastError
|
|
70
|
+
for (const extra of attempts) {
|
|
71
|
+
try {
|
|
72
|
+
return await chromium.launch({ headless: true, ...extra })
|
|
73
|
+
} catch (error) {
|
|
74
|
+
lastError = error
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const detail = lastError instanceof Error ? lastError.message.split('\n')[0] : String(lastError)
|
|
78
|
+
throw new SnapshotUnavailableError(`Could not launch Chromium (${detail}). ${PLAYWRIGHT_HINT}`)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const freePort = () =>
|
|
82
|
+
new Promise((resolvePort, reject) => {
|
|
83
|
+
const server = net.createServer()
|
|
84
|
+
server.unref()
|
|
85
|
+
server.once('error', reject)
|
|
86
|
+
server.listen(0, '127.0.0.1', () => {
|
|
87
|
+
const { port } = server.address()
|
|
88
|
+
server.close(() => resolvePort(port))
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
/** Start a short-lived Vite dev server for the project with the design plugin mounted. */
|
|
93
|
+
export async function startSnapshotServer({ root = process.cwd(), configFile } = {}) {
|
|
94
|
+
const { resolveViteCreateServer, loadDesignPlugin, loadSurfaceConfig } = await import('../cli/dev.mjs')
|
|
95
|
+
const createServer = await resolveViteCreateServer(root)
|
|
96
|
+
const designPlugin = await loadDesignPlugin()
|
|
97
|
+
const port = await freePort()
|
|
98
|
+
const server = await createServer({
|
|
99
|
+
root,
|
|
100
|
+
...(configFile ? { configFile } : {}),
|
|
101
|
+
logLevel: 'error',
|
|
102
|
+
clearScreen: false,
|
|
103
|
+
// The host config may already mount designPlugin; the plugin dedupes itself.
|
|
104
|
+
plugins: [designPlugin({ ...loadSurfaceConfig(root), snapshots: { autoBaseline: false } })],
|
|
105
|
+
// HMR stays on: after Vite optimizes newly discovered deps it reloads the page over the
|
|
106
|
+
// HMR socket; without it the page keeps requesting outdated deps and never renders.
|
|
107
|
+
server: { host: '127.0.0.1', port, strictPort: true, open: false },
|
|
108
|
+
})
|
|
109
|
+
await server.listen()
|
|
110
|
+
return { url: `http://127.0.0.1:${port}`, close: () => server.close() }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const SETTLE_SCRIPT = () =>
|
|
114
|
+
new Promise((resolveSettle) => {
|
|
115
|
+
const done = () => requestAnimationFrame(() => requestAnimationFrame(() => resolveSettle(true)))
|
|
116
|
+
if (document.fonts?.ready) document.fonts.ready.then(done, done)
|
|
117
|
+
else done()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A renderer bound to one server + browser. `frames(design)` lists the artboards of a design,
|
|
122
|
+
* `shoot(target)` returns a PNG buffer of one artboard. Always `close()` it.
|
|
123
|
+
*/
|
|
124
|
+
export async function createRenderer({ root = process.cwd(), url, configFile, timeoutMs = 30_000 } = {}) {
|
|
125
|
+
const browser = await launchChromium(root)
|
|
126
|
+
let server = null
|
|
127
|
+
try {
|
|
128
|
+
if (!url) server = await startSnapshotServer({ root, configFile })
|
|
129
|
+
} catch (error) {
|
|
130
|
+
await browser.close().catch(() => {})
|
|
131
|
+
throw error
|
|
132
|
+
}
|
|
133
|
+
const base = String(url ?? server.url).replace(/\/$/, '')
|
|
134
|
+
const context = await browser.newContext({
|
|
135
|
+
deviceScaleFactor: 1,
|
|
136
|
+
colorScheme: 'light',
|
|
137
|
+
reducedMotion: 'reduce',
|
|
138
|
+
viewport: { width: 1280, height: 800 },
|
|
139
|
+
})
|
|
140
|
+
// Freeze Date so clock-dependent content (timestamps, "x minutes ago") renders the same before
|
|
141
|
+
// and after. Timers keep running. Needs Playwright >= 1.45.
|
|
142
|
+
await context.clock?.setFixedTime?.(new Date('2025-01-01T09:00:00Z'))
|
|
143
|
+
const page = await context.newPage()
|
|
144
|
+
page.setDefaultTimeout(timeoutMs)
|
|
145
|
+
// Recent page errors, attached to timeouts so a broken artboard explains itself.
|
|
146
|
+
let pageErrors = []
|
|
147
|
+
page.on('pageerror', (error) => pageErrors.push(error.message))
|
|
148
|
+
page.on('console', (message) => {
|
|
149
|
+
if (message.type() === 'error') pageErrors.push(message.text())
|
|
150
|
+
})
|
|
151
|
+
page.on('framenavigated', (frame) => {
|
|
152
|
+
if (frame === page.mainFrame()) pageErrors = []
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
const previewUrl = (params) => `${base}/__seji/preview?${new URLSearchParams(params)}`
|
|
156
|
+
|
|
157
|
+
const waitForSnapshotState = async (key, timeout = timeoutMs) => {
|
|
158
|
+
let handle
|
|
159
|
+
try {
|
|
160
|
+
handle = await page.waitForFunction(
|
|
161
|
+
(name) => {
|
|
162
|
+
const state = window.__designSurfaceSnapshot
|
|
163
|
+
return state && (state.error || state[name]) ? state : null
|
|
164
|
+
},
|
|
165
|
+
key,
|
|
166
|
+
{ timeout },
|
|
167
|
+
)
|
|
168
|
+
} catch (error) {
|
|
169
|
+
const detail = pageErrors.slice(-3).join(' | ')
|
|
170
|
+
const message = error instanceof Error ? error.message.split('\n')[0] : String(error)
|
|
171
|
+
throw new Error(`${message}${detail ? ` (page errors: ${detail})` : ''}`)
|
|
172
|
+
}
|
|
173
|
+
const state = await handle.jsonValue()
|
|
174
|
+
if (state.error) {
|
|
175
|
+
const error = new Error(state.error)
|
|
176
|
+
error.reportedByFrame = true
|
|
177
|
+
throw error
|
|
178
|
+
}
|
|
179
|
+
return state
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const manifests = new Map()
|
|
183
|
+
const frames = async (design) => {
|
|
184
|
+
if (!manifests.has(design)) {
|
|
185
|
+
// First loads can trigger Vite dependency optimization and a reload; retry, then settle.
|
|
186
|
+
let lastError
|
|
187
|
+
for (let attempt = 0; attempt < 3 && !manifests.has(design); attempt += 1) {
|
|
188
|
+
try {
|
|
189
|
+
await page.goto(previewUrl({ design, snapshot: 'manifest' }), { waitUntil: 'load' })
|
|
190
|
+
const state = await waitForSnapshotState('manifest', Math.min(timeoutMs, 20_000))
|
|
191
|
+
await page.waitForLoadState('networkidle', { timeout: 10_000 }).catch(() => {})
|
|
192
|
+
manifests.set(design, state.manifest)
|
|
193
|
+
} catch (error) {
|
|
194
|
+
lastError = error
|
|
195
|
+
if (error instanceof Error && error.reportedByFrame) break
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!manifests.has(design)) throw lastError
|
|
199
|
+
}
|
|
200
|
+
return manifests.get(design)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const shootOnce = async ({ design, page: pageId, frame, size }) => {
|
|
204
|
+
await page.setViewportSize({ width: size[0], height: size[1] })
|
|
205
|
+
await page.goto(previewUrl({ design, page: pageId, frame, snapshot: '1' }), { waitUntil: 'load' })
|
|
206
|
+
await waitForSnapshotState('ready')
|
|
207
|
+
await page.waitForLoadState('networkidle', { timeout: 5_000 }).catch(() => {})
|
|
208
|
+
await page.evaluate(SETTLE_SCRIPT)
|
|
209
|
+
const image = await page.screenshot({ animations: 'disabled', caret: 'hide', scale: 'css', type: 'png' })
|
|
210
|
+
// A render error caught after `ready` (late effect, lazy chunk) still fails the frame.
|
|
211
|
+
const late = await page.evaluate(() => window.__designSurfaceSnapshot?.error ?? null)
|
|
212
|
+
if (late) {
|
|
213
|
+
const error = new Error(late)
|
|
214
|
+
error.reportedByFrame = true
|
|
215
|
+
throw error
|
|
216
|
+
}
|
|
217
|
+
return image
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Screenshot until two consecutive captures match (late fonts, images, reloads). Returns
|
|
222
|
+
* `{ image, unstable }`; `unstable` means no two of the attempts matched, so the image may
|
|
223
|
+
* not be what the source settles on and must not be compared as if it were.
|
|
224
|
+
*/
|
|
225
|
+
const shoot = async (target, attempts = 4) => {
|
|
226
|
+
let previous = null
|
|
227
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
228
|
+
try {
|
|
229
|
+
const image = await shootOnce(target)
|
|
230
|
+
if (previous && previous.equals(image)) return { image, unstable: false }
|
|
231
|
+
previous = image
|
|
232
|
+
await page.waitForTimeout(150)
|
|
233
|
+
} catch (error) {
|
|
234
|
+
// A Vite dependency reload can destroy the page mid-capture; retry. Errors the frame
|
|
235
|
+
// reported itself (unknown frame, render error) are final.
|
|
236
|
+
if (attempt === attempts - 1 || (error instanceof Error && error.reportedByFrame)) throw error
|
|
237
|
+
previous = null
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (!previous) throw new Error('no capture succeeded')
|
|
241
|
+
return { image: previous, unstable: true }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const close = async () => {
|
|
245
|
+
await browser.close().catch(() => {})
|
|
246
|
+
if (server) await server.close().catch(() => {})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return { base, frames, shoot, close }
|
|
250
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TokenOpHooks } from '../tokens/ops.mjs'
|
|
2
|
+
|
|
3
|
+
export type BaselineState = { captured: boolean; error: string | null }
|
|
4
|
+
|
|
5
|
+
export declare function toolSnapshotsRequest(request: {
|
|
6
|
+
kind: 'tokens' | 'consolidate'
|
|
7
|
+
op: string
|
|
8
|
+
snapshots: unknown
|
|
9
|
+
dryRun?: unknown
|
|
10
|
+
}): { take: boolean; error?: undefined } | { error: string; take?: undefined }
|
|
11
|
+
|
|
12
|
+
export declare function baselineHooks(options?: {
|
|
13
|
+
root?: string
|
|
14
|
+
url?: string
|
|
15
|
+
run?: <T>(task: () => Promise<T>) => Promise<T>
|
|
16
|
+
capture?: (options: { root: string; item: import('../shared/types').ReviewItem; url?: string }) => Promise<unknown>
|
|
17
|
+
}): { state: BaselineState; hooks: Required<Pick<TokenOpHooks, 'beforeWrite'>> }
|
|
18
|
+
|
|
19
|
+
export declare function compareToolItem(options: {
|
|
20
|
+
root?: string
|
|
21
|
+
state: BaselineState
|
|
22
|
+
result: Record<string, unknown>
|
|
23
|
+
url?: string
|
|
24
|
+
compare?: (options: { root: string; design: string; itemIds: string[]; url?: string }) => Promise<{ compared: Array<Record<string, unknown>> }>
|
|
25
|
+
}): Promise<Record<string, unknown>>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Before/after snapshots around a tool-executed change: `tokens <op> --snapshots`,
|
|
2
|
+
// `consolidate apply --snapshots`, or `snapshots: true` on the HTTP routes. The screens the
|
|
3
|
+
// change affects are rendered from the unchanged source right before the tool writes (the
|
|
4
|
+
// record is stored on the review item the operation creates), then compared after the write
|
|
5
|
+
// and the token rebuild, like `verify --snapshots` does for agent changes.
|
|
6
|
+
//
|
|
7
|
+
// This module only imports the renderer lazily (through ./index.mjs when a capture actually
|
|
8
|
+
// runs), so the CLI and the dev server can check a request without loading Playwright.
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether a tool request takes snapshots — one rule for the CLI (`--snapshots`) and HTTP
|
|
12
|
+
* (`snapshots: true`). `kind` is `tokens` or `consolidate`; `op` the operation / command.
|
|
13
|
+
* Returns `{ error }` for a request to refuse, else `{ take }`: dry runs and `revert` never take
|
|
14
|
+
* snapshots (nothing is written / the batch's own item is archived), and for consolidation
|
|
15
|
+
* only `apply` accepts the flag.
|
|
16
|
+
*/
|
|
17
|
+
export function toolSnapshotsRequest({ kind, op, snapshots, dryRun } = {}) {
|
|
18
|
+
if (snapshots === undefined) return { take: false }
|
|
19
|
+
if (typeof snapshots !== 'boolean') return { error: 'snapshots must be true or false' }
|
|
20
|
+
if (kind === 'consolidate' && op !== 'apply') return { error: 'snapshots: true|false only applies to consolidate apply' }
|
|
21
|
+
return { take: snapshots && dryRun !== true && op !== 'revert' }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const defaultCapture = async (options) => (await import('./index.mjs')).captureItemBaseline(options)
|
|
25
|
+
const defaultCompare = async (options) => (await import('./index.mjs')).compareSnapshots(options)
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `hooks` for runTokenOp / runConsolidate that capture the baseline before the first write.
|
|
29
|
+
* `run` wraps the rendering (the dev server queues it with its other captures). A failed
|
|
30
|
+
* capture does not stop the operation: `state.error` says why and the item has no baseline.
|
|
31
|
+
* `capture` is the baseline renderer (a seam for tests).
|
|
32
|
+
*/
|
|
33
|
+
export function baselineHooks({ root = process.cwd(), url, run = (task) => task(), capture = defaultCapture } = {}) {
|
|
34
|
+
const state = { captured: false, error: null }
|
|
35
|
+
return {
|
|
36
|
+
state,
|
|
37
|
+
hooks: {
|
|
38
|
+
beforeWrite: async (item) => {
|
|
39
|
+
try {
|
|
40
|
+
const snapshots = await run(() => capture({ root, item, url }))
|
|
41
|
+
state.captured = true
|
|
42
|
+
state.error = null
|
|
43
|
+
return { snapshots }
|
|
44
|
+
} catch (error) {
|
|
45
|
+
state.captured = false
|
|
46
|
+
state.error = error instanceof Error ? error.message : String(error)
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Compare the item a tool operation recorded (after its write and rebuild). Returns the
|
|
56
|
+
* compare summary of that item, or `{ error }`. `compare` is the comparer (a seam for tests).
|
|
57
|
+
*/
|
|
58
|
+
export async function compareToolItem({ root = process.cwd(), state, result, url, compare = defaultCompare }) {
|
|
59
|
+
if (!state.captured) return { error: state.error ?? 'no baseline was captured' }
|
|
60
|
+
if (typeof result?.itemId !== 'string' || typeof result?.design !== 'string') {
|
|
61
|
+
return { error: 'the operation recorded no review item' }
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const compared = await compare({ root, design: result.design, itemIds: [result.itemId], url })
|
|
65
|
+
return compared.compared[0] ?? { error: 'nothing was compared' }
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return { error: error instanceof Error ? error.message : String(error) }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import postcss from 'postcss'
|
|
2
|
+
|
|
3
|
+
import { extractCssValueDiagnostics } from './types.mjs'
|
|
4
|
+
|
|
5
|
+
function isCustomPropertyDeclarationBlock(decl) {
|
|
6
|
+
if (!decl.prop.startsWith('--')) return false
|
|
7
|
+
const parent = decl.parent
|
|
8
|
+
if (!parent) return false
|
|
9
|
+
if (parent.type === 'atrule' && parent.name.toLowerCase() === 'theme') return true
|
|
10
|
+
if (
|
|
11
|
+
parent.type === 'rule' &&
|
|
12
|
+
/(?:^|[,\s(]):root(?:\b|$|\s|,|\))/.test(parent.selector)
|
|
13
|
+
) {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function analyzeCssAst({ file, rootAst, adapter = 'css' }) {
|
|
20
|
+
const diagnostics = []
|
|
21
|
+
rootAst.walkDecls((decl) => {
|
|
22
|
+
const line = decl.source?.start?.line ?? 1
|
|
23
|
+
const column = decl.source?.start?.column ?? 1
|
|
24
|
+
const includeLiterals = !isCustomPropertyDeclarationBlock(decl)
|
|
25
|
+
// The enclosing rule selector lets the usage index map CSS refs to components by class name.
|
|
26
|
+
const selector = decl.parent?.type === 'rule' ? decl.parent.selector : undefined
|
|
27
|
+
for (const diag of extractCssValueDiagnostics({
|
|
28
|
+
file,
|
|
29
|
+
line,
|
|
30
|
+
column,
|
|
31
|
+
adapter,
|
|
32
|
+
property: decl.prop,
|
|
33
|
+
value: decl.value,
|
|
34
|
+
includeLiterals,
|
|
35
|
+
})) {
|
|
36
|
+
diagnostics.push(selector ? { ...diag, selector } : diag)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
return diagnostics
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const cssAdapter = {
|
|
43
|
+
id: 'css',
|
|
44
|
+
detect(file) {
|
|
45
|
+
return /\.css$/i.test(file)
|
|
46
|
+
},
|
|
47
|
+
analyze(file, content) {
|
|
48
|
+
const rootAst = postcss.parse(content, { from: file })
|
|
49
|
+
return analyzeCssAst({ file, rootAst, adapter: 'css' })
|
|
50
|
+
},
|
|
51
|
+
}
|