@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,115 @@
|
|
|
1
|
+
// Value-level rewriting shared by every scheme: a CSS declaration value, the inside of a
|
|
2
|
+
// style={{}} / StyleX string, an `@apply` list or a Tailwind arbitrary value. Positions come
|
|
3
|
+
// from postcss-value-parser (`sourceIndex` / `sourceEndIndex`), never from text search.
|
|
4
|
+
import valueParser from 'postcss-value-parser'
|
|
5
|
+
|
|
6
|
+
const VAR_FUNCTIONS = new Set(['var', 'theme', '--theme'])
|
|
7
|
+
|
|
8
|
+
const lower = (value) => String(value).trim().toLowerCase()
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Rename `var(--old)` (and Tailwind `theme(--old)` / `--theme(--old)`) inside a value.
|
|
12
|
+
* `emit(start, end, text)` and `leftover(offset, reason, text)` take offsets into `value`.
|
|
13
|
+
*/
|
|
14
|
+
export function rewriteValueVars(value, renames, { emit, leftover }) {
|
|
15
|
+
let parsed
|
|
16
|
+
try {
|
|
17
|
+
parsed = valueParser(value)
|
|
18
|
+
} catch {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
const visit = (nodes, inVarFunction) => {
|
|
22
|
+
for (const node of nodes) {
|
|
23
|
+
if (node.type === 'function') {
|
|
24
|
+
const name = node.value.toLowerCase()
|
|
25
|
+
if (VAR_FUNCTIONS.has(name)) {
|
|
26
|
+
const first = (node.nodes ?? []).find((child) => child.type !== 'space' && child.type !== 'comment')
|
|
27
|
+
if (first?.type === 'word' && renames.has(first.value)) {
|
|
28
|
+
emit(first.sourceIndex, first.sourceIndex + first.value.length, renames.get(first.value))
|
|
29
|
+
}
|
|
30
|
+
// Fallbacks can hold nested var() calls.
|
|
31
|
+
visit((node.nodes ?? []).filter((child) => child !== first), true)
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
visit(node.nodes ?? [], inVarFunction)
|
|
35
|
+
continue
|
|
36
|
+
}
|
|
37
|
+
if (node.type === 'word' && renames.has(node.value)) {
|
|
38
|
+
// A bare `--token` outside var(): a custom-property name used as a value
|
|
39
|
+
// (e.g. `transition-property`, `@property`), or inside a function we do not model.
|
|
40
|
+
leftover(node.sourceIndex, 'bare-token-name', node.value)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
visit(parsed.nodes, false)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Replace a literal with `var(--token)` only when the whole value is exactly that literal
|
|
49
|
+
* (one node, or — for multi-part values such as shadows — the whole value text).
|
|
50
|
+
* Shorthands, calc() and mixed values that contain it become leftovers.
|
|
51
|
+
*/
|
|
52
|
+
export function rewriteValueLiteral(value, literal, replacement, { emit, leftover }) {
|
|
53
|
+
let parsed
|
|
54
|
+
try {
|
|
55
|
+
parsed = valueParser(value)
|
|
56
|
+
} catch {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
const target = lower(literal)
|
|
60
|
+
const significant = parsed.nodes.filter((node) => node.type !== 'space' && node.type !== 'comment')
|
|
61
|
+
const endOf = (node) => node.sourceEndIndex ?? node.sourceIndex + valueParser.stringify(node).length
|
|
62
|
+
if (significant.length === 1 && lower(valueParser.stringify(significant[0])) === target) {
|
|
63
|
+
const node = significant[0]
|
|
64
|
+
emit(node.sourceIndex, endOf(node), replacement)
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
// A multi-part literal (e.g. a whole box-shadow) that is exactly the whole value.
|
|
68
|
+
if (significant.length > 1 && lower(valueParser.stringify(parsed.nodes)) === target) {
|
|
69
|
+
emit(significant[0].sourceIndex, endOf(significant[significant.length - 1]), replacement)
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
const contains = (nodes) =>
|
|
73
|
+
nodes.some((node) => {
|
|
74
|
+
if (node.type === 'word' && lower(node.value) === target) return true
|
|
75
|
+
if (node.type === 'function') {
|
|
76
|
+
if (lower(valueParser.stringify(node)) === target) return true
|
|
77
|
+
return contains(node.nodes ?? [])
|
|
78
|
+
}
|
|
79
|
+
return false
|
|
80
|
+
})
|
|
81
|
+
if (contains(parsed.nodes)) {
|
|
82
|
+
leftover(0, 'mixed-value', value)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Does a value reference one of `names` through var()? (Used for token-file `$value` strings.) */
|
|
87
|
+
export function valueReferences(value, names) {
|
|
88
|
+
let found = false
|
|
89
|
+
rewriteValueVars(String(value), new Map([...names].map((name) => [name, name])), {
|
|
90
|
+
emit: () => {
|
|
91
|
+
found = true
|
|
92
|
+
},
|
|
93
|
+
leftover: () => {
|
|
94
|
+
found = true
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
return found
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Rewrite var() references in a plain string (token `$value`), returning the new string. */
|
|
101
|
+
export function renameVarsInString(value, renames) {
|
|
102
|
+
const edits = []
|
|
103
|
+
rewriteValueVars(String(value), renames, {
|
|
104
|
+
emit: (start, end, text) => edits.push({ start, end, text }),
|
|
105
|
+
leftover: () => {},
|
|
106
|
+
})
|
|
107
|
+
if (!edits.length) return String(value)
|
|
108
|
+
let out = ''
|
|
109
|
+
let cursor = 0
|
|
110
|
+
for (const edit of edits.sort((a, b) => a.start - b.start)) {
|
|
111
|
+
out += String(value).slice(cursor, edit.start) + edit.text
|
|
112
|
+
cursor = edit.end
|
|
113
|
+
}
|
|
114
|
+
return out + String(value).slice(cursor)
|
|
115
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type UsageMatch = { match: string[]; via: string[] }
|
|
2
|
+
|
|
3
|
+
export type TokenUsageReport = {
|
|
4
|
+
token: string
|
|
5
|
+
path: string
|
|
6
|
+
tier: string
|
|
7
|
+
type: string
|
|
8
|
+
value: string
|
|
9
|
+
alias?: string
|
|
10
|
+
description?: string
|
|
11
|
+
deprecated?: boolean | string
|
|
12
|
+
source: string
|
|
13
|
+
references: string[]
|
|
14
|
+
referencedBy: { direct: string[]; transitive: string[]; localAliases: string[] }
|
|
15
|
+
code: { count: number; files: Array<{ file: string; count: number; lines: number[] }> }
|
|
16
|
+
components: Array<{ name: string; file: string } & UsageMatch>
|
|
17
|
+
screens: Array<{ design: string; page?: string } & UsageMatch>
|
|
18
|
+
summary: {
|
|
19
|
+
tokens: number
|
|
20
|
+
components: number
|
|
21
|
+
/** Components using the token itself (not through an alias): the tier rule's count. */
|
|
22
|
+
directComponents: number
|
|
23
|
+
screens: number
|
|
24
|
+
codeRefs: number
|
|
25
|
+
impactCodeRefs: number
|
|
26
|
+
}
|
|
27
|
+
/** `primitive`: a base-layer token used directly by components (`tierWarning`). */
|
|
28
|
+
warning?: 'primitive'
|
|
29
|
+
} & TokenDeleteBlockers
|
|
30
|
+
|
|
31
|
+
/** What still uses a token, by the one rule `tokens delete` applies (`deleteBlockers`). */
|
|
32
|
+
export type TokenDeleteBlockers = {
|
|
33
|
+
/** True when nothing uses it: `tokens delete` would be allowed. */
|
|
34
|
+
deletable: boolean
|
|
35
|
+
blockedBy: { tokens: string[]; localAliases: string[]; codeRefs: number; components: number }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type TokenUsageSummary = {
|
|
39
|
+
token: string
|
|
40
|
+
path: string
|
|
41
|
+
tier: string
|
|
42
|
+
deletable: boolean
|
|
43
|
+
warning?: 'primitive'
|
|
44
|
+
} & TokenUsageReport['summary']
|
|
45
|
+
|
|
46
|
+
export type HardcodedReport = {
|
|
47
|
+
scope: string
|
|
48
|
+
file?: string
|
|
49
|
+
kinds: string[]
|
|
50
|
+
count: number
|
|
51
|
+
files: Array<{
|
|
52
|
+
file: string
|
|
53
|
+
count: number
|
|
54
|
+
values: Array<{
|
|
55
|
+
value: string
|
|
56
|
+
count: number
|
|
57
|
+
lines: number[]
|
|
58
|
+
properties: string[]
|
|
59
|
+
matches: string[]
|
|
60
|
+
}>
|
|
61
|
+
}>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ComponentUsageReport = {
|
|
65
|
+
name: string
|
|
66
|
+
file: string
|
|
67
|
+
line?: number
|
|
68
|
+
page: { design: string; page: string } | null
|
|
69
|
+
tokenRows: import('../shared/types').ComponentTokenRow[]
|
|
70
|
+
literals: import('../shared/types').ComponentLiteralRow[]
|
|
71
|
+
summary: import('../shared/types').ComponentReport['summary']
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type UsageIndex = {
|
|
75
|
+
tokenUsage(token: string): TokenUsageReport | null
|
|
76
|
+
allTokens(): TokenUsageSummary[]
|
|
77
|
+
hardcoded(scope?: string): HardcodedReport
|
|
78
|
+
resolveName(token: string): string | null
|
|
79
|
+
/** Tokens/literals a component's styles use. */
|
|
80
|
+
componentUsage(name: string): ComponentUsageReport | null
|
|
81
|
+
componentNames(): string[]
|
|
82
|
+
componentEntry(name: string): { name: string; exportName: string; file: string; line?: number } | null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare function buildUsageIndex(options?: { root?: string; analysis?: unknown }): Promise<UsageIndex>
|
|
86
|
+
|
|
87
|
+
/** The tier rule shared by the component page and the token page. */
|
|
88
|
+
export declare function tierWarning(tier: string | undefined, directComponents?: number): 'primitive' | null
|
|
89
|
+
|
|
90
|
+
export declare function deleteBlockers(input?: {
|
|
91
|
+
tokens?: string[]
|
|
92
|
+
localAliases?: string[]
|
|
93
|
+
codeRefs?: number
|
|
94
|
+
components?: number
|
|
95
|
+
}): TokenDeleteBlockers
|
|
96
|
+
|
|
97
|
+
export declare function readComponentPages(root: string): Map<string, { design: string; page: string }>
|