handoff-app-next 2.0.0-canary.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/Changelog.md +2069 -0
- package/License.md +19 -0
- package/README.md +461 -0
- package/components.json +21 -0
- package/config/config.template.js +95 -0
- package/config/config.template.ts +54 -0
- package/config/docs/design.md +14 -0
- package/config/docs/foundations/border-radius.md +6 -0
- package/config/docs/foundations/colors.md +7 -0
- package/config/docs/foundations/effects.md +8 -0
- package/config/docs/foundations/elevation.md +6 -0
- package/config/docs/foundations/focus.md +6 -0
- package/config/docs/foundations/fonts.md +7 -0
- package/config/docs/foundations/grid.md +21 -0
- package/config/docs/foundations/icon.md +6 -0
- package/config/docs/foundations/icons.md +6 -0
- package/config/docs/foundations/logo.md +7 -0
- package/config/docs/foundations/logos.md +7 -0
- package/config/docs/foundations/motion.md +6 -0
- package/config/docs/foundations/spacing.md +7 -0
- package/config/docs/foundations/typography.md +8 -0
- package/config/docs/foundations.md +44 -0
- package/config/docs/guidelines.md +11 -0
- package/config/docs/index.md +9 -0
- package/config/docs/playground.md +14 -0
- package/config/docs/system/figma-sync.md +14 -0
- package/config/docs/system/tokens/foundations/colors.md +24 -0
- package/config/docs/system/tokens/foundations/effects.md +21 -0
- package/config/docs/system/tokens/foundations/spacing.md +22 -0
- package/config/docs/system/tokens/foundations/typography.md +24 -0
- package/config/docs/system.md +13 -0
- package/config/templates/component/template.hbs +6 -0
- package/config/templates/component/template.js +0 -0
- package/config/templates/component/template.json +45 -0
- package/config/templates/component/template.scss +2 -0
- package/config/templates/page.md +11 -0
- package/config/templates/page.mdx +49 -0
- package/config/templates/template.html +7 -0
- package/dist/app/components/Component/Cards.d.ts +25 -0
- package/dist/app/components/Component/Cards.jsx +27 -0
- package/dist/app/lib/adapter-kit/types.d.ts +581 -0
- package/dist/app/lib/adapter-kit/types.js +36 -0
- package/dist/app/lib/hubspot-field-map.d.ts +170 -0
- package/dist/app/lib/hubspot-field-map.js +538 -0
- package/dist/app/lib/hubspot-module/build-module.d.ts +136 -0
- package/dist/app/lib/hubspot-module/build-module.js +122 -0
- package/dist/app/lib/hubspot-module/context.d.ts +111 -0
- package/dist/app/lib/hubspot-module/context.js +228 -0
- package/dist/app/lib/hubspot-module/fields/boolean.d.ts +8 -0
- package/dist/app/lib/hubspot-module/fields/boolean.js +22 -0
- package/dist/app/lib/hubspot-module/fields/button.d.ts +19 -0
- package/dist/app/lib/hubspot-module/fields/button.js +66 -0
- package/dist/app/lib/hubspot-module/fields/fields.d.ts +20 -0
- package/dist/app/lib/hubspot-module/fields/fields.js +93 -0
- package/dist/app/lib/hubspot-module/fields/generic.d.ts +33 -0
- package/dist/app/lib/hubspot-module/fields/generic.js +150 -0
- package/dist/app/lib/hubspot-module/fields/hubdb.d.ts +14 -0
- package/dist/app/lib/hubspot-module/fields/hubdb.js +155 -0
- package/dist/app/lib/hubspot-module/fields/image.d.ts +27 -0
- package/dist/app/lib/hubspot-module/fields/image.js +59 -0
- package/dist/app/lib/hubspot-module/fields/menu.d.ts +8 -0
- package/dist/app/lib/hubspot-module/fields/menu.js +12 -0
- package/dist/app/lib/hubspot-module/fields/object.d.ts +11 -0
- package/dist/app/lib/hubspot-module/fields/object.js +31 -0
- package/dist/app/lib/hubspot-module/fields/select.d.ts +17 -0
- package/dist/app/lib/hubspot-module/fields/select.js +37 -0
- package/dist/app/lib/hubspot-module/fields/text.d.ts +15 -0
- package/dist/app/lib/hubspot-module/fields/text.js +63 -0
- package/dist/app/lib/hubspot-module/fields/url.d.ts +35 -0
- package/dist/app/lib/hubspot-module/fields/url.js +57 -0
- package/dist/app/lib/hubspot-module/fields/utils.d.ts +20 -0
- package/dist/app/lib/hubspot-module/fields/utils.js +33 -0
- package/dist/app/lib/hubspot-module/fields/video.d.ts +21 -0
- package/dist/app/lib/hubspot-module/fields/video.js +70 -0
- package/dist/app/lib/hubspot-module/index.d.ts +20 -0
- package/dist/app/lib/hubspot-module/index.js +17 -0
- package/dist/app/lib/hubspot-module/transpile.d.ts +27 -0
- package/dist/app/lib/hubspot-module/transpile.js +658 -0
- package/dist/app/lib/hubspot-module/types.d.ts +204 -0
- package/dist/app/lib/hubspot-module/types.js +47 -0
- package/dist/app/lib/hubspot-module-build.d.ts +33 -0
- package/dist/app/lib/hubspot-module-build.js +41 -0
- package/dist/app-builder/build.d.ts +21 -0
- package/dist/app-builder/build.js +649 -0
- package/dist/app-builder/client-config.d.ts +17 -0
- package/dist/app-builder/client-config.js +106 -0
- package/dist/app-builder/config-diff/index.d.ts +4 -0
- package/dist/app-builder/config-diff/index.js +3 -0
- package/dist/app-builder/config-diff/registry.d.ts +9 -0
- package/dist/app-builder/config-diff/registry.js +15 -0
- package/dist/app-builder/config-diff/snapshot.d.ts +13 -0
- package/dist/app-builder/config-diff/snapshot.js +38 -0
- package/dist/app-builder/config-diff/strategies/pattern.d.ts +2 -0
- package/dist/app-builder/config-diff/strategies/pattern.js +66 -0
- package/dist/app-builder/config-diff/types.d.ts +33 -0
- package/dist/app-builder/config-diff/types.js +1 -0
- package/dist/app-builder/index.d.ts +6 -0
- package/dist/app-builder/index.js +4 -0
- package/dist/app-builder/path-contract.d.ts +23 -0
- package/dist/app-builder/path-contract.js +60 -0
- package/dist/app-builder/paths.d.ts +24 -0
- package/dist/app-builder/paths.js +82 -0
- package/dist/app-builder/watchers/component.d.ts +15 -0
- package/dist/app-builder/watchers/component.js +58 -0
- package/dist/app-builder/watchers/utils.d.ts +14 -0
- package/dist/app-builder/watchers/utils.js +31 -0
- package/dist/app-builder/watchers.d.ts +44 -0
- package/dist/app-builder/watchers.js +299 -0
- package/dist/app-builder/websocket.d.ts +12 -0
- package/dist/app-builder/websocket.js +56 -0
- package/dist/cache/build-cache.d.ts +169 -0
- package/dist/cache/build-cache.js +421 -0
- package/dist/cache/file-state.d.ts +58 -0
- package/dist/cache/file-state.js +122 -0
- package/dist/cache/index.d.ts +3 -0
- package/dist/cache/index.js +6 -0
- package/dist/cache/push-state.d.ts +69 -0
- package/dist/cache/push-state.js +156 -0
- package/dist/cli/create.d.ts +5 -0
- package/dist/cli/create.js +301 -0
- package/dist/cli/eject.d.ts +17 -0
- package/dist/cli/eject.js +82 -0
- package/dist/cli/fetch-design-md.d.ts +14 -0
- package/dist/cli/fetch-design-md.js +62 -0
- package/dist/cli/figma-audit.d.ts +7 -0
- package/dist/cli/figma-audit.js +55 -0
- package/dist/cli/init-claude-core.d.ts +26 -0
- package/dist/cli/init-claude-core.js +81 -0
- package/dist/cli/make.d.ts +12 -0
- package/dist/cli/make.js +178 -0
- package/dist/cli/scaffold.d.ts +5 -0
- package/dist/cli/scaffold.js +504 -0
- package/dist/cli/sync/apply-declaration-pull.d.ts +14 -0
- package/dist/cli/sync/apply-declaration-pull.js +184 -0
- package/dist/cli/sync/apply-pull.d.ts +24 -0
- package/dist/cli/sync/apply-pull.js +174 -0
- package/dist/cli/sync/cli-auth-store.d.ts +12 -0
- package/dist/cli/sync/cli-auth-store.js +44 -0
- package/dist/cli/sync/collect-build-artifacts.d.ts +17 -0
- package/dist/cli/sync/collect-build-artifacts.js +143 -0
- package/dist/cli/sync/collect-referenced-images.d.ts +36 -0
- package/dist/cli/sync/collect-referenced-images.js +165 -0
- package/dist/cli/sync/declaration-patch.d.ts +9 -0
- package/dist/cli/sync/declaration-patch.js +196 -0
- package/dist/cli/sync/hash.d.ts +2 -0
- package/dist/cli/sync/hash.js +11 -0
- package/dist/cli/sync/open-browser.d.ts +5 -0
- package/dist/cli/sync/open-browser.js +37 -0
- package/dist/cli/sync/push-provenance.d.ts +25 -0
- package/dist/cli/sync/push-provenance.js +82 -0
- package/dist/cli/sync/push-registry-content.d.ts +132 -0
- package/dist/cli/sync/push-registry-content.js +854 -0
- package/dist/cli/sync/push-shared-assets.d.ts +26 -0
- package/dist/cli/sync/push-shared-assets.js +33 -0
- package/dist/cli/sync/resolve-declaration-payload.d.ts +8 -0
- package/dist/cli/sync/resolve-declaration-payload.js +208 -0
- package/dist/cli/sync/resolve-declaration.d.ts +5 -0
- package/dist/cli/sync/resolve-declaration.js +12 -0
- package/dist/cli/sync/run-cli-login.d.ts +9 -0
- package/dist/cli/sync/run-cli-login.js +81 -0
- package/dist/cli/sync/run-history-purge.d.ts +19 -0
- package/dist/cli/sync/run-history-purge.js +112 -0
- package/dist/cli/sync/run-pull.d.ts +9 -0
- package/dist/cli/sync/run-pull.js +92 -0
- package/dist/cli/sync/run-push.d.ts +47 -0
- package/dist/cli/sync/run-push.js +585 -0
- package/dist/cli/sync/run-sync-status.d.ts +2 -0
- package/dist/cli/sync/run-sync-status.js +30 -0
- package/dist/cli/sync/sync-remote-env.d.ts +14 -0
- package/dist/cli/sync/sync-remote-env.js +52 -0
- package/dist/cli/sync/sync-state.d.ts +15 -0
- package/dist/cli/sync/sync-state.js +26 -0
- package/dist/cli/tokens/ensure-default-brand.d.ts +18 -0
- package/dist/cli/tokens/ensure-default-brand.js +95 -0
- package/dist/cli/tokens/migrate-legacy.d.ts +23 -0
- package/dist/cli/tokens/migrate-legacy.js +213 -0
- package/dist/cli/tokens/parse-css-brands.d.ts +25 -0
- package/dist/cli/tokens/parse-css-brands.js +148 -0
- package/dist/cli/tokens/transform.d.ts +12 -0
- package/dist/cli/tokens/transform.js +126 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +56 -0
- package/dist/commands/audit/figma-components.d.ts +8 -0
- package/dist/commands/audit/figma-components.js +27 -0
- package/dist/commands/build/app.d.ts +8 -0
- package/dist/commands/build/app.js +22 -0
- package/dist/commands/build/components.d.ts +7 -0
- package/dist/commands/build/components.js +17 -0
- package/dist/commands/build/hubspot.d.ts +56 -0
- package/dist/commands/build/hubspot.js +177 -0
- package/dist/commands/dev/index.d.ts +6 -0
- package/dist/commands/dev/index.js +14 -0
- package/dist/commands/eject/config.d.ts +6 -0
- package/dist/commands/eject/config.js +14 -0
- package/dist/commands/eject/pages.d.ts +6 -0
- package/dist/commands/eject/pages.js +14 -0
- package/dist/commands/eject/theme.d.ts +6 -0
- package/dist/commands/eject/theme.js +14 -0
- package/dist/commands/fetch/index.d.ts +6 -0
- package/dist/commands/fetch/index.js +14 -0
- package/dist/commands/history-purge.d.ts +19 -0
- package/dist/commands/history-purge.js +52 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +66 -0
- package/dist/commands/init/index.d.ts +5 -0
- package/dist/commands/init/index.js +12 -0
- package/dist/commands/init/vercel.d.ts +6 -0
- package/dist/commands/init/vercel.js +99 -0
- package/dist/commands/init-claude.d.ts +9 -0
- package/dist/commands/init-claude.js +47 -0
- package/dist/commands/login.d.ts +9 -0
- package/dist/commands/login.js +28 -0
- package/dist/commands/logout.d.ts +6 -0
- package/dist/commands/logout.js +16 -0
- package/dist/commands/make/component.d.ts +7 -0
- package/dist/commands/make/component.js +23 -0
- package/dist/commands/make/page.d.ts +8 -0
- package/dist/commands/make/page.js +33 -0
- package/dist/commands/make/template.d.ts +8 -0
- package/dist/commands/make/template.js +33 -0
- package/dist/commands/mcp-init.d.ts +12 -0
- package/dist/commands/mcp-init.js +94 -0
- package/dist/commands/mcp-token.d.ts +7 -0
- package/dist/commands/mcp-token.js +23 -0
- package/dist/commands/prepare-runtime.d.ts +7 -0
- package/dist/commands/prepare-runtime.js +28 -0
- package/dist/commands/pull.d.ts +7 -0
- package/dist/commands/pull.js +18 -0
- package/dist/commands/push-all.d.ts +23 -0
- package/dist/commands/push-all.js +146 -0
- package/dist/commands/push-assets.d.ts +8 -0
- package/dist/commands/push-assets.js +40 -0
- package/dist/commands/push-tokens.d.ts +8 -0
- package/dist/commands/push-tokens.js +40 -0
- package/dist/commands/push.d.ts +14 -0
- package/dist/commands/push.js +75 -0
- package/dist/commands/scaffold/index.d.ts +6 -0
- package/dist/commands/scaffold/index.js +15 -0
- package/dist/commands/start/index.d.ts +6 -0
- package/dist/commands/start/index.js +14 -0
- package/dist/commands/sync-status.d.ts +6 -0
- package/dist/commands/sync-status.js +14 -0
- package/dist/commands/tokens-build.d.ts +7 -0
- package/dist/commands/tokens-build.js +104 -0
- package/dist/commands/types.d.ts +5 -0
- package/dist/commands/types.js +1 -0
- package/dist/commands/utils.d.ts +18 -0
- package/dist/commands/utils.js +19 -0
- package/dist/commands/validate/components.d.ts +7 -0
- package/dist/commands/validate/components.js +19 -0
- package/dist/commands/validate.d.ts +11 -0
- package/dist/commands/validate.js +163 -0
- package/dist/commands/vercel-build.d.ts +7 -0
- package/dist/commands/vercel-build.js +81 -0
- package/dist/config/declaration-module-load.d.ts +6 -0
- package/dist/config/declaration-module-load.js +68 -0
- package/dist/config/defaults.d.ts +16 -0
- package/dist/config/defaults.js +60 -0
- package/dist/config/helpers.d.ts +7 -0
- package/dist/config/helpers.js +29 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.js +11 -0
- package/dist/config/loader.d.ts +20 -0
- package/dist/config/loader.js +107 -0
- package/dist/config/normalizers/declaration.d.ts +11 -0
- package/dist/config/normalizers/declaration.js +122 -0
- package/dist/config/normalizers/pattern.d.ts +8 -0
- package/dist/config/normalizers/pattern.js +31 -0
- package/dist/config/runtime.d.ts +42 -0
- package/dist/config/runtime.js +337 -0
- package/dist/config/validator.d.ts +9 -0
- package/dist/config/validator.js +22 -0
- package/dist/declarations/codegen.d.ts +57 -0
- package/dist/declarations/codegen.js +279 -0
- package/dist/declarations/helpers.d.ts +6 -0
- package/dist/declarations/helpers.js +20 -0
- package/dist/declarations/index.d.ts +2 -0
- package/dist/declarations/index.js +1 -0
- package/dist/declarations/types.d.ts +193 -0
- package/dist/declarations/types.js +1 -0
- package/dist/figma/component-linking.d.ts +164 -0
- package/dist/figma/component-linking.js +1080 -0
- package/dist/figma/image-fills.d.ts +32 -0
- package/dist/figma/image-fills.js +211 -0
- package/dist/generated/build-meta.d.ts +4 -0
- package/dist/generated/build-meta.js +6 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +301 -0
- package/dist/pipeline/archive.d.ts +19 -0
- package/dist/pipeline/archive.js +62 -0
- package/dist/pipeline/components.d.ts +5 -0
- package/dist/pipeline/components.js +7 -0
- package/dist/pipeline/documentation.d.ts +3 -0
- package/dist/pipeline/documentation.js +64 -0
- package/dist/pipeline/figma.d.ts +11 -0
- package/dist/pipeline/figma.js +142 -0
- package/dist/pipeline/hubspot/config.d.ts +179 -0
- package/dist/pipeline/hubspot/config.js +171 -0
- package/dist/pipeline/hubspot/emit.d.ts +101 -0
- package/dist/pipeline/hubspot/emit.js +283 -0
- package/dist/pipeline/index.d.ts +14 -0
- package/dist/pipeline/index.js +34 -0
- package/dist/pipeline/patterns.d.ts +8 -0
- package/dist/pipeline/patterns.js +8 -0
- package/dist/pipeline/styles.d.ts +10 -0
- package/dist/pipeline/styles.js +127 -0
- package/dist/pipeline/validation.d.ts +6 -0
- package/dist/pipeline/validation.js +23 -0
- package/dist/transformers/docgen/index.d.ts +24 -0
- package/dist/transformers/docgen/index.js +244 -0
- package/dist/transformers/plugins/csf-render.d.ts +5 -0
- package/dist/transformers/plugins/csf-render.js +406 -0
- package/dist/transformers/plugins/handlebars-previews.d.ts +12 -0
- package/dist/transformers/plugins/handlebars-previews.js +128 -0
- package/dist/transformers/plugins/index.d.ts +11 -0
- package/dist/transformers/plugins/index.js +10 -0
- package/dist/transformers/plugins/slot-probe-candidates.d.ts +159 -0
- package/dist/transformers/plugins/slot-probe-candidates.js +279 -0
- package/dist/transformers/plugins/slot-probe.d.ts +66 -0
- package/dist/transformers/plugins/slot-probe.js +298 -0
- package/dist/transformers/plugins/ssr-render.d.ts +33 -0
- package/dist/transformers/plugins/ssr-render.js +531 -0
- package/dist/transformers/plugins.d.ts +14 -0
- package/dist/transformers/plugins.js +15 -0
- package/dist/transformers/preview/component/api.d.ts +22 -0
- package/dist/transformers/preview/component/api.js +146 -0
- package/dist/transformers/preview/component/artifacts.d.ts +3 -0
- package/dist/transformers/preview/component/artifacts.js +103 -0
- package/dist/transformers/preview/component/build-shared-bundles.d.ts +83 -0
- package/dist/transformers/preview/component/build-shared-bundles.js +400 -0
- package/dist/transformers/preview/component/builder.d.ts +29 -0
- package/dist/transformers/preview/component/builder.js +638 -0
- package/dist/transformers/preview/component/css.d.ts +68 -0
- package/dist/transformers/preview/component/css.js +219 -0
- package/dist/transformers/preview/component/field-annotations.d.ts +129 -0
- package/dist/transformers/preview/component/field-annotations.js +325 -0
- package/dist/transformers/preview/component/html.d.ts +21 -0
- package/dist/transformers/preview/component/html.js +80 -0
- package/dist/transformers/preview/component/javascript.d.ts +24 -0
- package/dist/transformers/preview/component/javascript.js +162 -0
- package/dist/transformers/preview/component/normalizer.d.ts +35 -0
- package/dist/transformers/preview/component/normalizer.js +56 -0
- package/dist/transformers/preview/component/playwright-shared.d.ts +70 -0
- package/dist/transformers/preview/component/playwright-shared.js +164 -0
- package/dist/transformers/preview/component/preview-assets.d.ts +55 -0
- package/dist/transformers/preview/component/preview-assets.js +144 -0
- package/dist/transformers/preview/component/preview-merge.d.ts +53 -0
- package/dist/transformers/preview/component/preview-merge.js +50 -0
- package/dist/transformers/preview/component/preview-select.d.ts +86 -0
- package/dist/transformers/preview/component/preview-select.js +150 -0
- package/dist/transformers/preview/component/preview-server.d.ts +41 -0
- package/dist/transformers/preview/component/preview-server.js +112 -0
- package/dist/transformers/preview/component/preview-validation.d.ts +64 -0
- package/dist/transformers/preview/component/preview-validation.js +194 -0
- package/dist/transformers/preview/component/previews.d.ts +9 -0
- package/dist/transformers/preview/component/previews.js +6 -0
- package/dist/transformers/preview/component/screenshot.d.ts +90 -0
- package/dist/transformers/preview/component/screenshot.js +282 -0
- package/dist/transformers/preview/component/serialized-elements.d.ts +86 -0
- package/dist/transformers/preview/component/serialized-elements.js +118 -0
- package/dist/transformers/preview/component/summary.d.ts +6 -0
- package/dist/transformers/preview/component/summary.js +41 -0
- package/dist/transformers/preview/component.d.ts +13 -0
- package/dist/transformers/preview/component.js +26 -0
- package/dist/transformers/preview/height-reporter.d.ts +27 -0
- package/dist/transformers/preview/height-reporter.js +32 -0
- package/dist/transformers/preview/pattern/api.d.ts +11 -0
- package/dist/transformers/preview/pattern/api.js +58 -0
- package/dist/transformers/preview/pattern/builder.d.ts +17 -0
- package/dist/transformers/preview/pattern/builder.js +149 -0
- package/dist/transformers/preview/pattern/html.d.ts +25 -0
- package/dist/transformers/preview/pattern/html.js +95 -0
- package/dist/transformers/preview/slots.d.ts +109 -0
- package/dist/transformers/preview/slots.js +13 -0
- package/dist/transformers/preview/types.d.ts +292 -0
- package/dist/transformers/preview/types.js +7 -0
- package/dist/transformers/types.d.ts +60 -0
- package/dist/transformers/types.js +1 -0
- package/dist/transformers/utils/build.d.ts +27 -0
- package/dist/transformers/utils/build.js +77 -0
- package/dist/transformers/utils/csf.d.ts +16 -0
- package/dist/transformers/utils/csf.js +29 -0
- package/dist/transformers/utils/handlebars.d.ts +32 -0
- package/dist/transformers/utils/handlebars.js +73 -0
- package/dist/transformers/utils/html.d.ts +18 -0
- package/dist/transformers/utils/html.js +40 -0
- package/dist/transformers/utils/index.d.ts +13 -0
- package/dist/transformers/utils/index.js +20 -0
- package/dist/transformers/utils/module.d.ts +13 -0
- package/dist/transformers/utils/module.js +41 -0
- package/dist/transformers/utils/schema-loader.d.ts +19 -0
- package/dist/transformers/utils/schema-loader.js +61 -0
- package/dist/transformers/utils/schema.d.ts +33 -0
- package/dist/transformers/utils/schema.js +517 -0
- package/dist/transformers/utils/string.d.ts +36 -0
- package/dist/transformers/utils/string.js +52 -0
- package/dist/transformers/utils/svg-sprite.d.ts +16 -0
- package/dist/transformers/utils/svg-sprite.js +114 -0
- package/dist/transformers/utils/usage.d.ts +23 -0
- package/dist/transformers/utils/usage.js +282 -0
- package/dist/transformers/utils/vite-logger.d.ts +2 -0
- package/dist/transformers/utils/vite-logger.js +30 -0
- package/dist/transformers/validation/runner.d.ts +67 -0
- package/dist/transformers/validation/runner.js +277 -0
- package/dist/transformers/vite-config.d.ts +3 -0
- package/dist/transformers/vite-config.js +18 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/config.d.ts +472 -0
- package/dist/types/config.js +1 -0
- package/dist/types/font.d.ts +3 -0
- package/dist/types/font.js +1 -0
- package/dist/types/handoff-sync.d.ts +132 -0
- package/dist/types/handoff-sync.js +5 -0
- package/dist/types/history-purge.d.ts +112 -0
- package/dist/types/history-purge.js +18 -0
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js +1 -0
- package/dist/types/preview.d.ts +138 -0
- package/dist/types/preview.js +1 -0
- package/dist/types/validation.d.ts +200 -0
- package/dist/types/validation.js +11 -0
- package/dist/utils/asset-upload-limits.d.ts +87 -0
- package/dist/utils/asset-upload-limits.js +129 -0
- package/dist/utils/design-md.d.ts +55 -0
- package/dist/utils/design-md.js +107 -0
- package/dist/utils/duration.d.ts +2 -0
- package/dist/utils/duration.js +2 -0
- package/dist/utils/filter.d.ts +31 -0
- package/dist/utils/filter.js +109 -0
- package/dist/utils/fs.d.ts +8 -0
- package/dist/utils/fs.js +31 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/line-diff.d.ts +25 -0
- package/dist/utils/line-diff.js +74 -0
- package/dist/utils/logger.d.ts +50 -0
- package/dist/utils/logger.js +158 -0
- package/dist/utils/path.d.ts +21 -0
- package/dist/utils/path.js +50 -0
- package/dist/utils/port.d.ts +15 -0
- package/dist/utils/port.js +38 -0
- package/dist/utils/rich-text.d.ts +228 -0
- package/dist/utils/rich-text.js +1087 -0
- package/dist/validators/axe.d.ts +47 -0
- package/dist/validators/axe.js +222 -0
- package/dist/validators/contrast.d.ts +33 -0
- package/dist/validators/contrast.js +235 -0
- package/dist/validators/index.d.ts +30 -0
- package/dist/validators/index.js +26 -0
- package/dist/validators/schema.d.ts +34 -0
- package/dist/validators/schema.js +138 -0
- package/docs/DEPENDENCIES.md +26 -0
- package/docs/DEPLOYMENT.md +110 -0
- package/docs/LOCAL-RIG.md +305 -0
- package/docs/README.md +15 -0
- package/docs/REGISTRY-SETUP.md +353 -0
- package/docs/STANDALONE-INSTALL.md +70 -0
- package/docs/WORKSPACE-PACKAGE-JSON.md +125 -0
- package/docs/api.md +657 -0
- package/docs/api_spec.yaml +450 -0
- package/docs/cli.md +86 -0
- package/docs/schemas/component.schema.json +167 -0
- package/docs/schemas/examples/button.json +83 -0
- package/drizzle.config.ts +10 -0
- package/package.json +271 -0
- package/postcss.config.mjs +8 -0
- package/scripts/assert-standalone-install.mjs +60 -0
- package/src/app/app/[...slug]/DocCatchAllClient.tsx +103 -0
- package/src/app/app/[...slug]/page.tsx +101 -0
- package/src/app/app/account/AccountClient.tsx +116 -0
- package/src/app/app/account/IntegrationsSection.tsx +273 -0
- package/src/app/app/account/SanityCard.tsx +473 -0
- package/src/app/app/account/ai-cost/page.tsx +141 -0
- package/src/app/app/account/appearance/AppearanceClient.tsx +433 -0
- package/src/app/app/account/appearance/page.tsx +52 -0
- package/src/app/app/account/integrations/page.tsx +37 -0
- package/src/app/app/account/layout.tsx +82 -0
- package/src/app/app/account/page.tsx +41 -0
- package/src/app/app/account/users/UsersClient.tsx +244 -0
- package/src/app/app/account/users/page.tsx +36 -0
- package/src/app/app/actions/ai-generate.ts +25 -0
- package/src/app/app/actions/components.ts +126 -0
- package/src/app/app/actions/patterns.ts +289 -0
- package/src/app/app/admin/ai-cost/AiCostClient.tsx +236 -0
- package/src/app/app/admin/ai-cost/page.tsx +56 -0
- package/src/app/app/admin/builds/BuildsClient.tsx +527 -0
- package/src/app/app/admin/builds/page.tsx +41 -0
- package/src/app/app/admin/integrations/page.tsx +32 -0
- package/src/app/app/admin/pages/PagesClient.tsx +282 -0
- package/src/app/app/admin/pages/edit/PageEditorClient.tsx +157 -0
- package/src/app/app/admin/pages/edit/page.tsx +48 -0
- package/src/app/app/admin/pages/page.tsx +31 -0
- package/src/app/app/admin/protection/ProtectionClient.tsx +235 -0
- package/src/app/app/admin/protection/page.tsx +33 -0
- package/src/app/app/admin/reference/ReferenceClient.tsx +150 -0
- package/src/app/app/admin/reference/page.tsx +38 -0
- package/src/app/app/admin/users/page.tsx +11 -0
- package/src/app/app/api/account/route.ts +36 -0
- package/src/app/app/api/admin/builds/status/route.ts +34 -0
- package/src/app/app/api/admin/cleanup-versions/route.ts +64 -0
- package/src/app/app/api/admin/contract-limit-audit/route.ts +126 -0
- package/src/app/app/api/admin/contract-render-audit/route.ts +116 -0
- package/src/app/app/api/admin/field-bridge-audit/route.ts +152 -0
- package/src/app/app/api/admin/migrate/route.ts +47 -0
- package/src/app/app/api/admin/playground-turns/route.ts +85 -0
- package/src/app/app/api/admin/purge-history/route.ts +119 -0
- package/src/app/app/api/auth/[...nextauth]/route.ts +30 -0
- package/src/app/app/api/component/[...path]/route.ts +141 -0
- package/src/app/app/api/component-artifact/[...path]/route.ts +18 -0
- package/src/app/app/api/components/route.ts +78 -0
- package/src/app/app/api/figma-plugin/auth/device/route.ts +40 -0
- package/src/app/app/api/figma-plugin/auth/revoke/route.ts +15 -0
- package/src/app/app/api/figma-plugin/auth/token/route.ts +50 -0
- package/src/app/app/api/figma-plugin/foundations/commit/route.ts +111 -0
- package/src/app/app/api/figma-plugin/foundations/preview/route.ts +69 -0
- package/src/app/app/api/figma-plugin/foundations/route.ts +49 -0
- package/src/app/app/api/handoff/admin/appearance/route.ts +80 -0
- package/src/app/app/api/handoff/admin/backfill-artifact-blobs/route.ts +48 -0
- package/src/app/app/api/handoff/admin/build-tasks/kill/route.ts +43 -0
- package/src/app/app/api/handoff/admin/build-tasks/route.ts +21 -0
- package/src/app/app/api/handoff/admin/invite/route.ts +18 -0
- package/src/app/app/api/handoff/admin/normalize-previews/route.ts +107 -0
- package/src/app/app/api/handoff/admin/reference-materials/route.ts +69 -0
- package/src/app/app/api/handoff/admin/remove/route.ts +18 -0
- package/src/app/app/api/handoff/admin/resend-invite/route.ts +18 -0
- package/src/app/app/api/handoff/admin/role/route.ts +18 -0
- package/src/app/app/api/handoff/admin/users/route.ts +16 -0
- package/src/app/app/api/handoff/ai/analyze-layout-guide/route.ts +172 -0
- package/src/app/app/api/handoff/ai/analyze-layout-guide/wireframe-style/wireframe-example-1.png +0 -0
- package/src/app/app/api/handoff/ai/analyze-layout-guide/wireframe-style/wireframe-example-2.png +0 -0
- package/src/app/app/api/handoff/ai/chat/route.ts +217 -0
- package/src/app/app/api/handoff/ai/component-screenshot/route.ts +43 -0
- package/src/app/app/api/handoff/ai/debug-foundation-raster/route.ts +162 -0
- package/src/app/app/api/handoff/ai/design-artifact/[id]/clone/route.ts +68 -0
- package/src/app/app/api/handoff/ai/design-artifact/[id]/public/route.ts +37 -0
- package/src/app/app/api/handoff/ai/design-artifact/[id]/route.ts +99 -0
- package/src/app/app/api/handoff/ai/design-artifact/[id]/status/route.ts +44 -0
- package/src/app/app/api/handoff/ai/design-artifact/route.ts +405 -0
- package/src/app/app/api/handoff/ai/design-artifact-extract/route.ts +37 -0
- package/src/app/app/api/handoff/ai/design-generation-job/[id]/route.ts +67 -0
- package/src/app/app/api/handoff/ai/design-generation-jobs/route.ts +23 -0
- package/src/app/app/api/handoff/ai/design-jobs/run/route.ts +102 -0
- package/src/app/app/api/handoff/ai/extract-url/route.ts +34 -0
- package/src/app/app/api/handoff/ai/foundation-preview/route.ts +44 -0
- package/src/app/app/api/handoff/ai/generate-component/route.ts +137 -0
- package/src/app/app/api/handoff/ai/generate-design/route.ts +210 -0
- package/src/app/app/api/handoff/ai/generate-image/route.ts +72 -0
- package/src/app/app/api/handoff/ai/generate-pattern/route.ts +86 -0
- package/src/app/app/api/handoff/ai/playground-chat/refine/route.ts +52 -0
- package/src/app/app/api/handoff/ai/playground-chat/route.ts +102 -0
- package/src/app/app/api/handoff/ai/status/route.ts +14 -0
- package/src/app/app/api/handoff/artifact-asset/route.ts +88 -0
- package/src/app/app/api/handoff/assets/[id]/raw/route.ts +49 -0
- package/src/app/app/api/handoff/assets/[id]/route.ts +76 -0
- package/src/app/app/api/handoff/assets/collections/route.ts +54 -0
- package/src/app/app/api/handoff/assets/confirm/route.ts +80 -0
- package/src/app/app/api/handoff/assets/icon-sets/route.ts +47 -0
- package/src/app/app/api/handoff/assets/presign/route.ts +41 -0
- package/src/app/app/api/handoff/assets/route.ts +89 -0
- package/src/app/app/api/handoff/assets/upload/route.ts +152 -0
- package/src/app/app/api/handoff/assets/usages/[id]/route.ts +21 -0
- package/src/app/app/api/handoff/assets/usages/route.ts +69 -0
- package/src/app/app/api/handoff/auth/request-reset/route.ts +9 -0
- package/src/app/app/api/handoff/auth/reset-password/route.ts +17 -0
- package/src/app/app/api/handoff/capture/health/route.ts +86 -0
- package/src/app/app/api/handoff/capture/jobs/route.ts +75 -0
- package/src/app/app/api/handoff/capture/run/route.ts +112 -0
- package/src/app/app/api/handoff/changelog/pushes/route.ts +49 -0
- package/src/app/app/api/handoff/changelog/route.ts +28 -0
- package/src/app/app/api/handoff/changes/why/route.ts +41 -0
- package/src/app/app/api/handoff/cms/connections/route.ts +182 -0
- package/src/app/app/api/handoff/cms/sanity/callback/route.ts +18 -0
- package/src/app/app/api/handoff/cms/sanity/categories/route.ts +146 -0
- package/src/app/app/api/handoff/cms/sanity/connect/route.ts +15 -0
- package/src/app/app/api/handoff/cms/sanity/publish/route.ts +161 -0
- package/src/app/app/api/handoff/cms/sanity/token/route.ts +87 -0
- package/src/app/app/api/handoff/components/[id]/screenshot.png/route.ts +101 -0
- package/src/app/app/api/handoff/components/[id]/thumbnail.svg/route.ts +158 -0
- package/src/app/app/api/handoff/components/build/route.ts +26 -0
- package/src/app/app/api/handoff/components/history/contract/route.ts +33 -0
- package/src/app/app/api/handoff/components/history/route.ts +35 -0
- package/src/app/app/api/handoff/components/history/version/route.ts +36 -0
- package/src/app/app/api/handoff/components/route.ts +56 -0
- package/src/app/app/api/handoff/components/validation/route.ts +36 -0
- package/src/app/app/api/handoff/design/workspace/brand-imagery-image/route.ts +75 -0
- package/src/app/app/api/handoff/design/workspace/route.ts +163 -0
- package/src/app/app/api/handoff/figma/component-properties/route.ts +34 -0
- package/src/app/app/api/handoff/figma/components/route.ts +21 -0
- package/src/app/app/api/handoff/figma/components/sync/route.ts +50 -0
- package/src/app/app/api/handoff/figma/fetch/route.ts +126 -0
- package/src/app/app/api/handoff/guest/assets/route.ts +52 -0
- package/src/app/app/api/handoff/guest/enter/route.ts +169 -0
- package/src/app/app/api/handoff/guest/submission/route.ts +209 -0
- package/src/app/app/api/handoff/guest/submission/submit/route.ts +63 -0
- package/src/app/app/api/handoff/image-slots/route.ts +24 -0
- package/src/app/app/api/handoff/navigation/prune/route.ts +106 -0
- package/src/app/app/api/handoff/pages/route.ts +90 -0
- package/src/app/app/api/handoff/patterns/[id]/clone/route.ts +69 -0
- package/src/app/app/api/handoff/patterns/[id]/manifest/route.ts +102 -0
- package/src/app/app/api/handoff/patterns/[id]/notes/route.ts +101 -0
- package/src/app/app/api/handoff/patterns/[id]/route.ts +41 -0
- package/src/app/app/api/handoff/patterns/[id]/thumbnail.svg/route.ts +70 -0
- package/src/app/app/api/handoff/patterns/route.ts +77 -0
- package/src/app/app/api/handoff/reference-materials/route.ts +40 -0
- package/src/app/app/api/handoff/review/[id]/route.ts +172 -0
- package/src/app/app/api/handoff/review/[id]/voice/route.ts +58 -0
- package/src/app/app/api/handoff/review/route.ts +31 -0
- package/src/app/app/api/handoff/share/[token]/route.ts +82 -0
- package/src/app/app/api/handoff/share/links/route.ts +48 -0
- package/src/app/app/api/handoff/share/route.ts +172 -0
- package/src/app/app/api/handoff/site-protection/route.ts +85 -0
- package/src/app/app/api/handoff/site-protection/unlock/route.ts +62 -0
- package/src/app/app/api/handoff/templates/[id]/submissions/route.ts +41 -0
- package/src/app/app/api/mcp/route.ts +39 -0
- package/src/app/app/api/oauth/authorization-server-metadata/route.ts +30 -0
- package/src/app/app/api/oauth/authorize/route.ts +158 -0
- package/src/app/app/api/oauth/device/approve/route.ts +32 -0
- package/src/app/app/api/oauth/device/route.ts +34 -0
- package/src/app/app/api/oauth/protected-resource-metadata/route.ts +26 -0
- package/src/app/app/api/oauth/register/route.ts +43 -0
- package/src/app/app/api/oauth/token/route.ts +94 -0
- package/src/app/app/api/openapi/route.ts +38 -0
- package/src/app/app/api/patterns/route.ts +8 -0
- package/src/app/app/api/registry/assets/ingest/route.ts +204 -0
- package/src/app/app/api/registry/assets/ingest-figma-fills/route.ts +81 -0
- package/src/app/app/api/registry/components/[id]/previews/[previewId]/route.ts +56 -0
- package/src/app/app/api/registry/components/[id]/previews/route.ts +66 -0
- package/src/app/app/api/registry/config/route.ts +50 -0
- package/src/app/app/api/registry/dtcg/download/route.ts +78 -0
- package/src/app/app/api/registry/dtcg/route.ts +133 -0
- package/src/app/app/api/registry/fonts/route.ts +67 -0
- package/src/app/app/api/registry/icons/download/route.ts +52 -0
- package/src/app/app/api/registry/icons/route.ts +47 -0
- package/src/app/app/api/registry/image-slots/route.ts +68 -0
- package/src/app/app/api/registry/logo.svg/route.ts +45 -0
- package/src/app/app/api/registry/logos/route.ts +47 -0
- package/src/app/app/api/registry/navigation/route.ts +52 -0
- package/src/app/app/api/registry/pages/route.ts +67 -0
- package/src/app/app/api/registry/theme/route.ts +51 -0
- package/src/app/app/api/registry/theme.css/route.ts +34 -0
- package/src/app/app/api/registry/tokens/route.ts +59 -0
- package/src/app/app/api/sync/changes/route.ts +24 -0
- package/src/app/app/api/sync/shared-assets/route.ts +79 -0
- package/src/app/app/api/sync/status/route.ts +12 -0
- package/src/app/app/api/sync/upload/route.ts +109 -0
- package/src/app/app/assets/AssetsClient.tsx +670 -0
- package/src/app/app/assets/[id]/AssetDetailClient.tsx +319 -0
- package/src/app/app/assets/[id]/page.tsx +8 -0
- package/src/app/app/assets/fonts/page.tsx +5 -0
- package/src/app/app/assets/logos/page.tsx +5 -0
- package/src/app/app/assets/page.tsx +5 -0
- package/src/app/app/cli/device/CliDeviceClient.tsx +104 -0
- package/src/app/app/cli/device/page.tsx +45 -0
- package/src/app/app/design/DesignClient.tsx +1682 -0
- package/src/app/app/design/SessionHistoryPanel.tsx +116 -0
- package/src/app/app/design/assets/[id]/page.tsx +11 -0
- package/src/app/app/design/assets/icons/page.tsx +8 -0
- package/src/app/app/design/assets/page.tsx +8 -0
- package/src/app/app/design/library/[id]/SavedDesignDetailClient.tsx +892 -0
- package/src/app/app/design/library/[id]/page.tsx +40 -0
- package/src/app/app/design/library/[id]/share/SharePublicClient.tsx +107 -0
- package/src/app/app/design/library/[id]/share/page.tsx +22 -0
- package/src/app/app/design/library/page.tsx +12 -0
- package/src/app/app/design/page.tsx +158 -0
- package/src/app/app/design/settings/SettingsClient.tsx +648 -0
- package/src/app/app/design/settings/page.tsx +41 -0
- package/src/app/app/design/settings/settings-constants.ts +96 -0
- package/src/app/app/design/v1/DesignClient.tsx +1316 -0
- package/src/app/app/design/v1/page.tsx +103 -0
- package/src/app/app/design/workbench-session.ts +54 -0
- package/src/app/app/design/workbench-types.ts +72 -0
- package/src/app/app/dev/local-setup/LocalSetupClient.tsx +119 -0
- package/src/app/app/dev/local-setup/McpSetupSection.tsx +174 -0
- package/src/app/app/dev/local-setup/page.tsx +5 -0
- package/src/app/app/developer/api/route.ts +13 -0
- package/src/app/app/developer/cli/page.tsx +192 -0
- package/src/app/app/developer/layout.tsx +57 -0
- package/src/app/app/developer/local-setup/page.tsx +37 -0
- package/src/app/app/developer/mcp/page.tsx +74 -0
- package/src/app/app/developer/page.tsx +111 -0
- package/src/app/app/developer/push-pull/page.tsx +130 -0
- package/src/app/app/fonts/[filename]/route.ts +41 -0
- package/src/app/app/foundations/[...slug]/page.tsx +83 -0
- package/src/app/app/foundations/assets/[id]/page.tsx +35 -0
- package/src/app/app/foundations/assets/page.tsx +31 -0
- package/src/app/app/foundations/border-radius/page.tsx +179 -0
- package/src/app/app/foundations/colors/page.tsx +166 -0
- package/src/app/app/foundations/effects/page.tsx +124 -0
- package/src/app/app/foundations/elevation/page.tsx +209 -0
- package/src/app/app/foundations/error.tsx +22 -0
- package/src/app/app/foundations/grid/page.tsx +315 -0
- package/src/app/app/foundations/icons/IconsPageClient.tsx +100 -0
- package/src/app/app/foundations/icons/[name]/SingleIconClient.tsx +231 -0
- package/src/app/app/foundations/icons/[name]/page.tsx +44 -0
- package/src/app/app/foundations/icons/page.tsx +58 -0
- package/src/app/app/foundations/logo/page.tsx +213 -0
- package/src/app/app/foundations/motion/page.tsx +228 -0
- package/src/app/app/foundations/page.tsx +65 -0
- package/src/app/app/foundations/spacing/page.tsx +171 -0
- package/src/app/app/foundations/typography/page.tsx +115 -0
- package/src/app/app/layout.tsx +131 -0
- package/src/app/app/library/LibraryClient.tsx +567 -0
- package/src/app/app/library/page.tsx +46 -0
- package/src/app/app/login/LoginClient.tsx +75 -0
- package/src/app/app/login/page.tsx +33 -0
- package/src/app/app/page.tsx +178 -0
- package/src/app/app/patterns/PatternBrowserClient.tsx +263 -0
- package/src/app/app/patterns/page.tsx +14 -0
- package/src/app/app/playground/PlaygroundClient.tsx +84 -0
- package/src/app/app/playground/[id]/page.tsx +215 -0
- package/src/app/app/playground/page.tsx +79 -0
- package/src/app/app/providers.tsx +72 -0
- package/src/app/app/reset-password/ResetPasswordClient.tsx +89 -0
- package/src/app/app/reset-password/page.tsx +24 -0
- package/src/app/app/review/ReviewClient.tsx +31 -0
- package/src/app/app/review/page.tsx +56 -0
- package/src/app/app/s/[token]/page.tsx +317 -0
- package/src/app/app/setup/SetupClient.tsx +87 -0
- package/src/app/app/setup/actions.ts +53 -0
- package/src/app/app/setup/page.tsx +28 -0
- package/src/app/app/system/FigmaFetchControls.tsx +163 -0
- package/src/app/app/system/FigmaSyncPanel.tsx +357 -0
- package/src/app/app/system/NewComponentForm.tsx +272 -0
- package/src/app/app/system/SystemPageClient.tsx +137 -0
- package/src/app/app/system/changelog/ChangelogClient.tsx +608 -0
- package/src/app/app/system/changelog/page.tsx +28 -0
- package/src/app/app/system/component/[component]/ComponentAssetsPanel.tsx +108 -0
- package/src/app/app/system/component/[component]/ComponentDetailClient.tsx +420 -0
- package/src/app/app/system/component/[component]/ComponentImageSlotsPanel.tsx +163 -0
- package/src/app/app/system/component/[component]/ComponentVersionHistory.tsx +430 -0
- package/src/app/app/system/component/[component]/VersionCompare.tsx +267 -0
- package/src/app/app/system/component/[component]/page.tsx +68 -0
- package/src/app/app/system/component/page.tsx +5 -0
- package/src/app/app/system/figma-sync/FigmaSyncPageClient.tsx +35 -0
- package/src/app/app/system/figma-sync/page.tsx +21 -0
- package/src/app/app/system/health/ComponentHealthTable.tsx +217 -0
- package/src/app/app/system/health/HealthDashboardClient.tsx +141 -0
- package/src/app/app/system/health/RuleBreakdownTable.tsx +123 -0
- package/src/app/app/system/health/ScoreBadge.tsx +58 -0
- package/src/app/app/system/health/TrendChart.tsx +76 -0
- package/src/app/app/system/health/ValidatorBreakdownBars.tsx +35 -0
- package/src/app/app/system/health/health-types.ts +7 -0
- package/src/app/app/system/health/page.tsx +100 -0
- package/src/app/app/system/page.tsx +21 -0
- package/src/app/app/system/pattern/[pattern]/PatternDetailClient.tsx +216 -0
- package/src/app/app/system/pattern/[pattern]/page.tsx +53 -0
- package/src/app/app/system/pattern/page.tsx +5 -0
- package/src/app/app/unlock/UnlockClient.tsx +100 -0
- package/src/app/app/unlock/page.tsx +40 -0
- package/src/app/components/Auth/AuthControls.tsx +146 -0
- package/src/app/components/Brief/BuildList.tsx +78 -0
- package/src/app/components/Brief/BuildPanel.tsx +460 -0
- package/src/app/components/Brief/export-blocks.ts +47 -0
- package/src/app/components/Chat/ChatActionCard.tsx +97 -0
- package/src/app/components/Chat/ChatChangelogFeed.tsx +252 -0
- package/src/app/components/Chat/ChatComponentGrid.tsx +144 -0
- package/src/app/components/Chat/ChatContext.tsx +192 -0
- package/src/app/components/Chat/ChatDrawer.tsx +162 -0
- package/src/app/components/Chat/ChatFab.tsx +41 -0
- package/src/app/components/Chat/ChatInput.tsx +150 -0
- package/src/app/components/Chat/ChatMessage.tsx +125 -0
- package/src/app/components/Chat/ChatValidationPanel.tsx +161 -0
- package/src/app/components/CloudFeatureGate.tsx +27 -0
- package/src/app/components/Component/BestPracticesCard.tsx +36 -0
- package/src/app/components/Component/Cards.tsx +76 -0
- package/src/app/components/Component/ComponentLists.tsx +279 -0
- package/src/app/components/Component/ComponentWorkbenchDialog.tsx +230 -0
- package/src/app/components/Component/InlineComponentEditor.tsx +163 -0
- package/src/app/components/Component/PageSliceResolver.tsx +81 -0
- package/src/app/components/Component/Preview.tsx +1091 -0
- package/src/app/components/Component/slices/BestPracticesSlice.tsx +14 -0
- package/src/app/components/Component/slices/CardsSlice.tsx +17 -0
- package/src/app/components/Component/slices/ComponentDisplaySlice.tsx +101 -0
- package/src/app/components/Component/slices/PropertiesSlice.tsx +24 -0
- package/src/app/components/Component/slices/TextSlice.tsx +23 -0
- package/src/app/components/Component/slices/ValidationResultsSlice.tsx +31 -0
- package/src/app/components/Component/slices/index.ts +14 -0
- package/src/app/components/Component/usePreviews.ts +97 -0
- package/src/app/components/ComponentDesignTokens.tsx +271 -0
- package/src/app/components/ComponentGuidelines.tsx +21 -0
- package/src/app/components/ComponentNotFound.tsx +35 -0
- package/src/app/components/ComponentSearch.tsx +96 -0
- package/src/app/components/CopyCode.tsx +59 -0
- package/src/app/components/CopyToClipboard.tsx +63 -0
- package/src/app/components/Design/DevHandoffPanel.tsx +481 -0
- package/src/app/components/DownloadTokens.tsx +78 -0
- package/src/app/components/Footer.tsx +46 -0
- package/src/app/components/Foundations/BrandColorSwatches.tsx +151 -0
- package/src/app/components/Foundations/ColorContrast.tsx +179 -0
- package/src/app/components/Foundations/ColorGrid.tsx +199 -0
- package/src/app/components/Foundations/ColorInfo.tsx +64 -0
- package/src/app/components/Foundations/ColorSpaces.tsx +119 -0
- package/src/app/components/Foundations/ColorTailwind.tsx +58 -0
- package/src/app/components/Foundations/ColorsDisplay.tsx +136 -0
- package/src/app/components/Foundations/DisplayLogo.tsx +16 -0
- package/src/app/components/Foundations/IconCatalogGrid.tsx +145 -0
- package/src/app/components/Foundations/ProvenanceBadge.tsx +40 -0
- package/src/app/components/Foundations/RulesSheet.tsx +204 -0
- package/src/app/components/Foundations/TokenOutputTabs.tsx +88 -0
- package/src/app/components/Foundations/TypographyExample.tsx +275 -0
- package/src/app/components/Guest/GuestAuthoring.tsx +589 -0
- package/src/app/components/Guest/GuestEditor.tsx +157 -0
- package/src/app/components/Hero.tsx +42 -0
- package/src/app/components/InlineEdit/InlineEditField.tsx +162 -0
- package/src/app/components/InlineEdit/InlineEditHeader.tsx +98 -0
- package/src/app/components/Layout/BuildBadge.tsx +90 -0
- package/src/app/components/Layout/Header.tsx +54 -0
- package/src/app/components/Layout/Main.tsx +84 -0
- package/src/app/components/Markdown/CodeHighlight.tsx +328 -0
- package/src/app/components/Markdown/MarkdownComponents.tsx +270 -0
- package/src/app/components/Markdown/MarkdownEditor.tsx +153 -0
- package/src/app/components/Markdown/WysiwygEditor.tsx +364 -0
- package/src/app/components/Markdown/wysiwyg.css +89 -0
- package/src/app/components/ModeSwitcher.tsx +29 -0
- package/src/app/components/NavLink.tsx +26 -0
- package/src/app/components/Navigation/AnchorNav.tsx +94 -0
- package/src/app/components/Navigation/AnchorNavLink.tsx +41 -0
- package/src/app/components/Navigation/AnchorNavNew.tsx +27 -0
- package/src/app/components/Navigation/MainNav.tsx +84 -0
- package/src/app/components/Navigation/MobileNav.tsx +123 -0
- package/src/app/components/Navigation/PrevNextNav.tsx +53 -0
- package/src/app/components/Navigation/SideNav.tsx +336 -0
- package/src/app/components/Navigation/anchor-slugify.ts +6 -0
- package/src/app/components/Playground/AiChatPanel.tsx +1483 -0
- package/src/app/components/Playground/ComponentCard.tsx +65 -0
- package/src/app/components/Playground/ComponentLibrary.tsx +228 -0
- package/src/app/components/Playground/CoverImagePicker.tsx +281 -0
- package/src/app/components/Playground/EditContext.tsx +247 -0
- package/src/app/components/Playground/EditSheet.tsx +82 -0
- package/src/app/components/Playground/FieldGuardrailsContext.ts +31 -0
- package/src/app/components/Playground/FieldLinkContext.ts +138 -0
- package/src/app/components/Playground/FieldMediaContext.ts +50 -0
- package/src/app/components/Playground/FindingsList.tsx +149 -0
- package/src/app/components/Playground/MediaBrowser.tsx +397 -0
- package/src/app/components/Playground/PageChecks.tsx +71 -0
- package/src/app/components/Playground/PageTitle.tsx +93 -0
- package/src/app/components/Playground/PlaygroundBuilder.tsx +1271 -0
- package/src/app/components/Playground/PlaygroundContext.tsx +990 -0
- package/src/app/components/Playground/PlaygroundWorkbench.tsx +260 -0
- package/src/app/components/Playground/Preview.tsx +1465 -0
- package/src/app/components/Playground/PublishToSanityDialog.tsx +468 -0
- package/src/app/components/Playground/SavePatternDialog.tsx +231 -0
- package/src/app/components/Playground/ShareTemplate.tsx +503 -0
- package/src/app/components/Playground/SortableItem.tsx +94 -0
- package/src/app/components/Playground/Wizard/ApiKeySettings.tsx +139 -0
- package/src/app/components/Playground/Wizard/PageImporter.tsx +384 -0
- package/src/app/components/Playground/Wizard/WizardDialog.tsx +329 -0
- package/src/app/components/Playground/Wizard/llm-client.ts +87 -0
- package/src/app/components/Playground/Wizard/prompt-builder.ts +134 -0
- package/src/app/components/Playground/Wizard/response-parser.ts +80 -0
- package/src/app/components/Playground/fields/ButtonField.tsx +24 -0
- package/src/app/components/Playground/fields/Field.tsx +344 -0
- package/src/app/components/Playground/fields/FieldLabel.tsx +9 -0
- package/src/app/components/Playground/fields/FunctionField.tsx +19 -0
- package/src/app/components/Playground/fields/ImageField.tsx +239 -0
- package/src/app/components/Playground/fields/LinkField.tsx +24 -0
- package/src/app/components/Playground/fields/RawJsonField.tsx +60 -0
- package/src/app/components/Playground/fields/RichTextField.tsx +220 -0
- package/src/app/components/Playground/fields/SelectField.tsx +55 -0
- package/src/app/components/Playground/fields/SlotField.tsx +40 -0
- package/src/app/components/Playground/fields/TextField.tsx +125 -0
- package/src/app/components/Playground/fields/VideoFileField.tsx +67 -0
- package/src/app/components/Playground/fields/content-only.ts +121 -0
- package/src/app/components/Playground/fields/field-type.ts +84 -0
- package/src/app/components/Playground/fields/reseed.ts +140 -0
- package/src/app/components/Playground/inline-edit-script.ts +596 -0
- package/src/app/components/Playground/link-guard-script.ts +50 -0
- package/src/app/components/Playground/types.ts +76 -0
- package/src/app/components/Playground/usePublishToSanity.ts +153 -0
- package/src/app/components/Review/ReviewQueueClient.tsx +288 -0
- package/src/app/components/SideNav/Custom.tsx +40 -0
- package/src/app/components/SideNavNew.tsx +280 -0
- package/src/app/components/Typography/Headers.tsx +50 -0
- package/src/app/components/Validation/ValidationFrameworkResults.tsx +208 -0
- package/src/app/components/Validation/ValidationResults.tsx +60 -0
- package/src/app/components/cards/CardsWithIcons.tsx +38 -0
- package/src/app/components/context/AuthUiContext.tsx +13 -0
- package/src/app/components/context/ConfigContext.tsx +43 -0
- package/src/app/components/context/HandoffCapabilitiesContext.tsx +40 -0
- package/src/app/components/context/HotReloadProvider.tsx +38 -0
- package/src/app/components/context/PreviewContext.tsx +135 -0
- package/src/app/components/library/AssetCard.tsx +166 -0
- package/src/app/components/library/KindPicker.tsx +66 -0
- package/src/app/components/library/LaneTabs.tsx +54 -0
- package/src/app/components/library/LifecycleBadge.tsx +28 -0
- package/src/app/components/library/LifecyclePicker.tsx +53 -0
- package/src/app/components/library/MetaControl.tsx +294 -0
- package/src/app/components/library/OwnerAttribution.tsx +106 -0
- package/src/app/components/library/PageNotes.tsx +191 -0
- package/src/app/components/library/PageOrigin.tsx +124 -0
- package/src/app/components/library/VisibilityBadge.tsx +25 -0
- package/src/app/components/library/VisibilityPicker.tsx +56 -0
- package/src/app/components/library/index.ts +7 -0
- package/src/app/components/ui/accordion.tsx +49 -0
- package/src/app/components/ui/alert.tsx +39 -0
- package/src/app/components/ui/attachment.tsx +204 -0
- package/src/app/components/ui/badge.tsx +32 -0
- package/src/app/components/ui/breadcrumb.tsx +68 -0
- package/src/app/components/ui/bubble.tsx +125 -0
- package/src/app/components/ui/button.tsx +45 -0
- package/src/app/components/ui/card.tsx +76 -0
- package/src/app/components/ui/collapsible.tsx +9 -0
- package/src/app/components/ui/dialog.tsx +80 -0
- package/src/app/components/ui/drawer.tsx +103 -0
- package/src/app/components/ui/dropdown-menu.tsx +176 -0
- package/src/app/components/ui/input.tsx +22 -0
- package/src/app/components/ui/json-tree-view.tsx +250 -0
- package/src/app/components/ui/label.tsx +24 -0
- package/src/app/components/ui/marker.tsx +69 -0
- package/src/app/components/ui/message-scroller.tsx +130 -0
- package/src/app/components/ui/message.tsx +92 -0
- package/src/app/components/ui/mobile-nav.tsx +95 -0
- package/src/app/components/ui/navigation-menu.tsx +116 -0
- package/src/app/components/ui/popover.tsx +31 -0
- package/src/app/components/ui/radio-group.tsx +36 -0
- package/src/app/components/ui/select.tsx +132 -0
- package/src/app/components/ui/separator.tsx +29 -0
- package/src/app/components/ui/sheet.tsx +140 -0
- package/src/app/components/ui/sidebar.tsx +609 -0
- package/src/app/components/ui/skeleton.tsx +15 -0
- package/src/app/components/ui/switch.tsx +29 -0
- package/src/app/components/ui/table.tsx +60 -0
- package/src/app/components/ui/tabs.tsx +53 -0
- package/src/app/components/ui/textarea.tsx +19 -0
- package/src/app/components/ui/toggle-group.tsx +51 -0
- package/src/app/components/ui/toggle.tsx +39 -0
- package/src/app/components/ui/tooltip.tsx +30 -0
- package/src/app/components/util/colors.ts +93 -0
- package/src/app/components/util/dtcg.ts +50 -0
- package/src/app/components/util/index.ts +963 -0
- package/src/app/components/util/theme-provider.tsx +11 -0
- package/src/app/components/util/token.ts +70 -0
- package/src/app/components.json +21 -0
- package/src/app/css/index.css +275 -0
- package/src/app/css/theme.css +14 -0
- package/src/app/css.d.ts +1 -0
- package/src/app/hooks/use-mobile.tsx +17 -0
- package/src/app/instrumentation.ts +39 -0
- package/src/app/lib/adapter-kit/errors.ts +141 -0
- package/src/app/lib/adapter-kit/types.ts +637 -0
- package/src/app/lib/admin-build-tasks-types.ts +41 -0
- package/src/app/lib/api-path.ts +12 -0
- package/src/app/lib/asset-search.ts +167 -0
- package/src/app/lib/asset-types.ts +88 -0
- package/src/app/lib/asset-upload-source.ts +314 -0
- package/src/app/lib/auth.ts +244 -0
- package/src/app/lib/authoring-guardrails.ts +591 -0
- package/src/app/lib/authoring-shapes.ts +261 -0
- package/src/app/lib/authz/guest.ts +131 -0
- package/src/app/lib/authz/notes.ts +102 -0
- package/src/app/lib/authz/policy.ts +228 -0
- package/src/app/lib/authz/review.ts +180 -0
- package/src/app/lib/authz/vocab.ts +175 -0
- package/src/app/lib/brief-components.ts +212 -0
- package/src/app/lib/build-audits.ts +239 -0
- package/src/app/lib/capture-chromium-plan.ts +123 -0
- package/src/app/lib/capture-determinism.ts +397 -0
- package/src/app/lib/capture-kinds.ts +207 -0
- package/src/app/lib/change-digest.ts +108 -0
- package/src/app/lib/chat-turn-guards.ts +149 -0
- package/src/app/lib/cli-sync-jwt.ts +110 -0
- package/src/app/lib/client/poll-generation-job.ts +85 -0
- package/src/app/lib/client-name.ts +29 -0
- package/src/app/lib/cms-migration-prompt.ts +99 -0
- package/src/app/lib/component-capture.ts +156 -0
- package/src/app/lib/component-id.ts +14 -0
- package/src/app/lib/component-thumbnail.ts +200 -0
- package/src/app/lib/composition-summary.ts +84 -0
- package/src/app/lib/content-length-plan.ts +512 -0
- package/src/app/lib/contract-limit-audit.ts +228 -0
- package/src/app/lib/contract-render-audit.ts +208 -0
- package/src/app/lib/data/component-row.ts +121 -0
- package/src/app/lib/data/components-digest.ts +116 -0
- package/src/app/lib/data/dynamic-provider.ts +765 -0
- package/src/app/lib/data/has-payload.ts +18 -0
- package/src/app/lib/data/hybrid-provider.ts +6 -0
- package/src/app/lib/data/index.ts +45 -0
- package/src/app/lib/data/menu-merge.ts +417 -0
- package/src/app/lib/data/page-metadata.ts +85 -0
- package/src/app/lib/data/pattern-merge.ts +78 -0
- package/src/app/lib/data/static-provider.ts +237 -0
- package/src/app/lib/data/types.ts +125 -0
- package/src/app/lib/db/auto-migrate.ts +205 -0
- package/src/app/lib/db/bootstrap-admin.ts +45 -0
- package/src/app/lib/db/capture-job-queries.ts +333 -0
- package/src/app/lib/db/changelog-queries.ts +623 -0
- package/src/app/lib/db/cms-connection-config.ts +21 -0
- package/src/app/lib/db/cms-connection-queries.ts +218 -0
- package/src/app/lib/db/component-artifact-queries.ts +115 -0
- package/src/app/lib/db/component-facets.ts +535 -0
- package/src/app/lib/db/component-preview-queries.ts +224 -0
- package/src/app/lib/db/component-version-queries.ts +682 -0
- package/src/app/lib/db/dialect.ts +15 -0
- package/src/app/lib/db/event-log-store.ts +47 -0
- package/src/app/lib/db/grant-queries.ts +827 -0
- package/src/app/lib/db/history-purge-plan.ts +446 -0
- package/src/app/lib/db/history-purge.ts +233 -0
- package/src/app/lib/db/index.ts +92 -0
- package/src/app/lib/db/migrations/0000_init.sql +226 -0
- package/src/app/lib/db/migrations/0001_design_workspace.sql +12 -0
- package/src/app/lib/db/migrations/0002_boring_ricochet.sql +50 -0
- package/src/app/lib/db/migrations/0003_demonic_flatman.sql +41 -0
- package/src/app/lib/db/migrations/0004_validation_runs.sql +18 -0
- package/src/app/lib/db/migrations/0005_component_versions.sql +21 -0
- package/src/app/lib/db/migrations/0006_token_and_page_changes.sql +40 -0
- package/src/app/lib/db/migrations/0007_design_spec.sql +9 -0
- package/src/app/lib/db/migrations/0008_design_generation_jobs.sql +22 -0
- package/src/app/lib/db/migrations/0009_assets.sql +80 -0
- package/src/app/lib/db/migrations/0010_registry_dtcg.sql +13 -0
- package/src/app/lib/db/migrations/0011_dtcg_brands.sql +5 -0
- package/src/app/lib/db/migrations/0012_icon_logo_registry.sql +13 -0
- package/src/app/lib/db/migrations/0013_registry_fonts.sql +13 -0
- package/src/app/lib/db/migrations/0014_asset_blobs.sql +9 -0
- package/src/app/lib/db/migrations/0015_appearance.sql +7 -0
- package/src/app/lib/db/migrations/0016_image_slots.sql +16 -0
- package/src/app/lib/db/migrations/0017_component_preview.sql +20 -0
- package/src/app/lib/db/migrations/0018_token_change_details.sql +26 -0
- package/src/app/lib/db/migrations/0019_change_why.sql +18 -0
- package/src/app/lib/db/migrations/0020_pattern_change.sql +17 -0
- package/src/app/lib/db/migrations/0021_mcp_oauth_connector.sql +37 -0
- package/src/app/lib/db/migrations/0022_dtcg_source.sql +21 -0
- package/src/app/lib/db/migrations/0023_perf_indexes.sql +30 -0
- package/src/app/lib/db/migrations/0024_phase_b_visibility.sql +40 -0
- package/src/app/lib/db/migrations/0027_guest_authoring.sql +49 -0
- package/src/app/lib/db/migrations/0028_invite_to_build.sql +99 -0
- package/src/app/lib/db/migrations/0029_pages_templates_reflow.sql +121 -0
- package/src/app/lib/db/migrations/0030_retire_briefs.sql +71 -0
- package/src/app/lib/db/migrations/0031_drop_brief_columns.sql +32 -0
- package/src/app/lib/db/migrations/0033_site_protection.sql +45 -0
- package/src/app/lib/db/migrations/0034_brand_imagery.sql +8 -0
- package/src/app/lib/db/migrations/0035_history_provenance.sql +42 -0
- package/src/app/lib/db/migrations/0036_cms_connections.sql +68 -0
- package/src/app/lib/db/migrations/0037_component_preview_purpose.sql +17 -0
- package/src/app/lib/db/migrations/0038_capture_job.sql +87 -0
- package/src/app/lib/db/migrations/meta/0000_snapshot.json +1424 -0
- package/src/app/lib/db/migrations/meta/0002_snapshot.json +1644 -0
- package/src/app/lib/db/migrations/meta/0003_snapshot.json +1820 -0
- package/src/app/lib/db/migrations/meta/_journal.json +258 -0
- package/src/app/lib/db/note-queries.ts +184 -0
- package/src/app/lib/db/pattern-write.ts +1094 -0
- package/src/app/lib/db/property-delta.ts +117 -0
- package/src/app/lib/db/push-grouping.ts +256 -0
- package/src/app/lib/db/queries.ts +2426 -0
- package/src/app/lib/db/registry-queries.ts +607 -0
- package/src/app/lib/db/schema-active.ts +2 -0
- package/src/app/lib/db/schema-pg.ts +1201 -0
- package/src/app/lib/db/schema.ts +2 -0
- package/src/app/lib/db/seed.ts +117 -0
- package/src/app/lib/db/sync-queries.ts +542 -0
- package/src/app/lib/db/token-flatten.ts +95 -0
- package/src/app/lib/db/validation-queries.ts +82 -0
- package/src/app/lib/db/version-baseline.ts +42 -0
- package/src/app/lib/design-workspace-client.ts +194 -0
- package/src/app/lib/design-workspace-format.ts +294 -0
- package/src/app/lib/docx-copy.ts +279 -0
- package/src/app/lib/dtcg-axes.ts +138 -0
- package/src/app/lib/dtcg-normalizer.ts +370 -0
- package/src/app/lib/edit-operations.ts +275 -0
- package/src/app/lib/email.ts +199 -0
- package/src/app/lib/error-summary.ts +79 -0
- package/src/app/lib/evals/cases.ts +678 -0
- package/src/app/lib/evals/copy-coverage.ts +147 -0
- package/src/app/lib/evals/copy-decks.ts +296 -0
- package/src/app/lib/field-lens.ts +308 -0
- package/src/app/lib/field-marks.ts +206 -0
- package/src/app/lib/figma-plugin-contract.ts +104 -0
- package/src/app/lib/figma-sync-types.ts +56 -0
- package/src/app/lib/generated/build-meta.ts +8 -0
- package/src/app/lib/guest-editable.ts +371 -0
- package/src/app/lib/handoff-capabilities.ts +91 -0
- package/src/app/lib/health-types.ts +324 -0
- package/src/app/lib/hubspot-field-map.ts +770 -0
- package/src/app/lib/hubspot-module/build-module.ts +238 -0
- package/src/app/lib/hubspot-module/context.ts +259 -0
- package/src/app/lib/hubspot-module/fields/boolean.ts +24 -0
- package/src/app/lib/hubspot-module/fields/button.ts +70 -0
- package/src/app/lib/hubspot-module/fields/fields.ts +104 -0
- package/src/app/lib/hubspot-module/fields/generic.ts +183 -0
- package/src/app/lib/hubspot-module/fields/hubdb.ts +168 -0
- package/src/app/lib/hubspot-module/fields/image.ts +65 -0
- package/src/app/lib/hubspot-module/fields/menu.ts +14 -0
- package/src/app/lib/hubspot-module/fields/object.ts +42 -0
- package/src/app/lib/hubspot-module/fields/select.ts +43 -0
- package/src/app/lib/hubspot-module/fields/text.ts +68 -0
- package/src/app/lib/hubspot-module/fields/url.ts +57 -0
- package/src/app/lib/hubspot-module/fields/utils.ts +36 -0
- package/src/app/lib/hubspot-module/fields/video.ts +75 -0
- package/src/app/lib/hubspot-module/index.ts +30 -0
- package/src/app/lib/hubspot-module/transpile.ts +727 -0
- package/src/app/lib/hubspot-module/types.ts +238 -0
- package/src/app/lib/hubspot-module-build.ts +50 -0
- package/src/app/lib/image-bytes.ts +133 -0
- package/src/app/lib/image-dimensions.ts +214 -0
- package/src/app/lib/image-field-write.ts +51 -0
- package/src/app/lib/image-generation-request.ts +142 -0
- package/src/app/lib/image-target.ts +175 -0
- package/src/app/lib/json-shape.ts +121 -0
- package/src/app/lib/library-image-seed.ts +236 -0
- package/src/app/lib/login-required-messages.ts +17 -0
- package/src/app/lib/mcp/apps/component-gallery.bundle.ts +2 -0
- package/src/app/lib/mcp/apps/component-gallery.client.ts +208 -0
- package/src/app/lib/mcp/apps/component-preview.bundle.ts +2 -0
- package/src/app/lib/mcp/apps/component-preview.client.ts +140 -0
- package/src/app/lib/mcp/apps/token-palette.bundle.ts +2 -0
- package/src/app/lib/mcp/apps/token-palette.client.ts +199 -0
- package/src/app/lib/mcp/contract-report.ts +200 -0
- package/src/app/lib/mcp/create-server.ts +2622 -0
- package/src/app/lib/mcp/history-shapes.ts +72 -0
- package/src/app/lib/mcp/project-profile.ts +82 -0
- package/src/app/lib/mcp/scaffold-helpers.ts +93 -0
- package/src/app/lib/mcp/stack-guides/bootstrap-handlebars.md +62 -0
- package/src/app/lib/mcp/stack-guides/react-scss.md +7 -0
- package/src/app/lib/mcp/stack-guides/react-tailwind.md +9 -0
- package/src/app/lib/mcp/stack-guides/tailwind-handlebars.md +142 -0
- package/src/app/lib/mcp/stack-guides.ts +68 -0
- package/src/app/lib/mcp/tool-catalog.ts +132 -0
- package/src/app/lib/mcp-auth.ts +85 -0
- package/src/app/lib/merge-block-values.ts +868 -0
- package/src/app/lib/normalize-preview-values.ts +244 -0
- package/src/app/lib/notify.ts +213 -0
- package/src/app/lib/oauth-scopes.ts +33 -0
- package/src/app/lib/page-exemplars.ts +112 -0
- package/src/app/lib/page-manifest.ts +162 -0
- package/src/app/lib/page-provenance.ts +231 -0
- package/src/app/lib/page-slug.ts +68 -0
- package/src/app/lib/page-title.ts +44 -0
- package/src/app/lib/page-urls.ts +41 -0
- package/src/app/lib/passwords.ts +33 -0
- package/src/app/lib/pattern-payload.ts +122 -0
- package/src/app/lib/pattern-thumbnail.ts +234 -0
- package/src/app/lib/placeholder-audit.ts +196 -0
- package/src/app/lib/placeholder-copy.ts +370 -0
- package/src/app/lib/playground-prompt-link.ts +46 -0
- package/src/app/lib/preview-groups.ts +107 -0
- package/src/app/lib/preview-purpose-labels.ts +37 -0
- package/src/app/lib/preview-purpose.ts +37 -0
- package/src/app/lib/preview-render-target.ts +27 -0
- package/src/app/lib/preview-url.ts +15 -0
- package/src/app/lib/publish-to-sanity-state.ts +605 -0
- package/src/app/lib/rate-limit.ts +75 -0
- package/src/app/lib/remote-handoff-client.ts +33 -0
- package/src/app/lib/sanity-assets.ts +211 -0
- package/src/app/lib/sanity-categories.ts +178 -0
- package/src/app/lib/sanity-config.ts +266 -0
- package/src/app/lib/sanity-integration-state.ts +235 -0
- package/src/app/lib/sanity-mapping.ts +3284 -0
- package/src/app/lib/sanity-portable-text.ts +640 -0
- package/src/app/lib/sanity-publish.ts +337 -0
- package/src/app/lib/sanity-references.ts +295 -0
- package/src/app/lib/server/admin-users.ts +162 -0
- package/src/app/lib/server/ai-client.ts +633 -0
- package/src/app/lib/server/ai-proxy.ts +70 -0
- package/src/app/lib/server/api-gate.ts +148 -0
- package/src/app/lib/server/appearance.ts +169 -0
- package/src/app/lib/server/asset-generation-worker.ts +133 -0
- package/src/app/lib/server/asset-ingest-store.ts +55 -0
- package/src/app/lib/server/asset-ingest.ts +347 -0
- package/src/app/lib/server/auth-reset.ts +107 -0
- package/src/app/lib/server/capture-browser.ts +130 -0
- package/src/app/lib/server/capture-harness.ts +319 -0
- package/src/app/lib/server/capture-worker.ts +178 -0
- package/src/app/lib/server/change-why.ts +195 -0
- package/src/app/lib/server/cli-device-oauth.ts +159 -0
- package/src/app/lib/server/cms-providers.ts +53 -0
- package/src/app/lib/server/component-build-preload.cjs +3 -0
- package/src/app/lib/server/component-build-worker.ts +196 -0
- package/src/app/lib/server/component-builder.ts +96 -0
- package/src/app/lib/server/component-capture-reads.ts +172 -0
- package/src/app/lib/server/component-generation-context.ts +165 -0
- package/src/app/lib/server/component-generation-images.ts +40 -0
- package/src/app/lib/server/component-generation-llm.ts +232 -0
- package/src/app/lib/server/component-generation-run.ts +289 -0
- package/src/app/lib/server/component-generation-schedule.ts +12 -0
- package/src/app/lib/server/component-preview-screenshot.ts +111 -0
- package/src/app/lib/server/component-scaffold.ts +88 -0
- package/src/app/lib/server/component-visual-compare.ts +90 -0
- package/src/app/lib/server/design-artifact-persist.ts +49 -0
- package/src/app/lib/server/design-asset-extractor.ts +414 -0
- package/src/app/lib/server/design-asset-schedule.ts +36 -0
- package/src/app/lib/server/design-asset-worker-spawn.ts +64 -0
- package/src/app/lib/server/design-asset-worker.ts +24 -0
- package/src/app/lib/server/design-generation-worker.ts +281 -0
- package/src/app/lib/server/design-prompt-builder.ts +322 -0
- package/src/app/lib/server/design-spec-generator.ts +739 -0
- package/src/app/lib/server/design-spec-types.ts +219 -0
- package/src/app/lib/server/design-system-context.ts +141 -0
- package/src/app/lib/server/design-token-summary.ts +133 -0
- package/src/app/lib/server/design-workspace.ts +230 -0
- package/src/app/lib/server/dev-handoff.ts +334 -0
- package/src/app/lib/server/doc-pages.ts +442 -0
- package/src/app/lib/server/event-log.ts +138 -0
- package/src/app/lib/server/fetch-asset-bytes.ts +161 -0
- package/src/app/lib/server/figma-audit-api.ts +188 -0
- package/src/app/lib/server/figma-auth.ts +113 -0
- package/src/app/lib/server/figma-fetch-runner.ts +241 -0
- package/src/app/lib/server/figma-fetch-worker.ts +130 -0
- package/src/app/lib/server/figma-fetch.ts +90 -0
- package/src/app/lib/server/figma-fills-ingest.ts +201 -0
- package/src/app/lib/server/figma-plugin-properties-sync.ts +438 -0
- package/src/app/lib/server/figma-sync-service.ts +1076 -0
- package/src/app/lib/server/find-assets.ts +53 -0
- package/src/app/lib/server/foundation-image.tsx +671 -0
- package/src/app/lib/server/generation-queue-health.ts +108 -0
- package/src/app/lib/server/guest-context.ts +62 -0
- package/src/app/lib/server/guest-session.ts +153 -0
- package/src/app/lib/server/handoff-app-paths.ts +77 -0
- package/src/app/lib/server/handoff-component-patch.ts +123 -0
- package/src/app/lib/server/handoff-config-load.ts +29 -0
- package/src/app/lib/server/handoff-config-project.ts +104 -0
- package/src/app/lib/server/mcp-oauth-connector.ts +269 -0
- package/src/app/lib/server/node-tsx-worker-launcher.cjs +32 -0
- package/src/app/lib/server/oauth-state.ts +83 -0
- package/src/app/lib/server/passphrase.ts +121 -0
- package/src/app/lib/server/pattern-api-map.ts +123 -0
- package/src/app/lib/server/playground-chat.ts +1890 -0
- package/src/app/lib/server/public-api-paths.ts +34 -0
- package/src/app/lib/server/reference-material-generator.ts +341 -0
- package/src/app/lib/server/reference-material-ids.ts +8 -0
- package/src/app/lib/server/reference-material-persist.ts +25 -0
- package/src/app/lib/server/reference-material-schedule.ts +13 -0
- package/src/app/lib/server/registry-cache.ts +110 -0
- package/src/app/lib/server/request-public-url.ts +19 -0
- package/src/app/lib/server/runtime-config.ts +43 -0
- package/src/app/lib/server/s3-assets.ts +188 -0
- package/src/app/lib/server/sanity-connection.ts +176 -0
- package/src/app/lib/server/sanity-oauth.ts +34 -0
- package/src/app/lib/server/scaffold-args.ts +392 -0
- package/src/app/lib/server/secret-box.ts +85 -0
- package/src/app/lib/server/serverless-chromium.ts +93 -0
- package/src/app/lib/server/share-link-token.ts +106 -0
- package/src/app/lib/server/site-protection.ts +145 -0
- package/src/app/lib/server/spawn-tsx-worker.ts +47 -0
- package/src/app/lib/server/store-image-asset.ts +220 -0
- package/src/app/lib/server/token-freshness.ts +23 -0
- package/src/app/lib/server/unlock-cookie.ts +70 -0
- package/src/app/lib/server/upload-asset-to-library.ts +128 -0
- package/src/app/lib/server/url-extract.ts +117 -0
- package/src/app/lib/server/voice-audit.ts +209 -0
- package/src/app/lib/set-at-args-path.ts +36 -0
- package/src/app/lib/site-gate.ts +374 -0
- package/src/app/lib/slot-capabilities.ts +487 -0
- package/src/app/lib/source-copy.ts +295 -0
- package/src/app/lib/storage/artifact-images.ts +225 -0
- package/src/app/lib/storage/capture-artifacts.ts +109 -0
- package/src/app/lib/swap-image-src.ts +121 -0
- package/src/app/lib/sync-auth.ts +124 -0
- package/src/app/lib/tool-payload.ts +101 -0
- package/src/app/lib/turn-log.ts +78 -0
- package/src/app/lib/url-safety.ts +46 -0
- package/src/app/lib/utils.ts +35 -0
- package/src/app/lib/workbench-level.ts +56 -0
- package/src/app/middleware-hook.mjs +2 -0
- package/src/app/next-env.d.ts +6 -0
- package/src/app/next.config.mjs +355 -0
- package/src/app/postcss.config.mjs +8 -0
- package/src/app/proxy.ts +133 -0
- package/src/app/public/assets/css/preview.css +27 -0
- package/src/app/public/assets/design/blocks/callout-cta.jpg +0 -0
- package/src/app/public/assets/design/blocks/carousel.png +0 -0
- package/src/app/public/assets/design/blocks/container.png +0 -0
- package/src/app/public/assets/design/blocks/customer-stories.jpg +0 -0
- package/src/app/public/assets/design/blocks/faq.jpg +0 -0
- package/src/app/public/assets/design/blocks/features-comparison.jpg +0 -0
- package/src/app/public/assets/design/blocks/table.jpg +0 -0
- package/src/app/public/assets/images/blocks.svg +150 -0
- package/src/app/public/assets/images/check-circle.svg +10 -0
- package/src/app/public/assets/images/colors.svg +186 -0
- package/src/app/public/assets/images/components.png +0 -0
- package/src/app/public/assets/images/components.svg +183 -0
- package/src/app/public/assets/images/illustration-sample-2.svg +102 -0
- package/src/app/public/assets/images/illustration-sample-3.svg +124 -0
- package/src/app/public/assets/images/illustration-sample-bw-1.svg +84 -0
- package/src/app/public/assets/images/illustration-sample-bw-2.svg +88 -0
- package/src/app/public/assets/images/illustration-sample-bw-3.svg +125 -0
- package/src/app/public/assets/images/illustration-sample.svg +110 -0
- package/src/app/public/assets/images/typography.svg +279 -0
- package/src/app/public/assets/images/usage-correct.png +0 -0
- package/src/app/public/assets/images/usage-wrong.png +0 -0
- package/src/app/public/assets/images/x-circle.svg +10 -0
- package/src/app/public/assets/js/preview.js +90 -0
- package/src/app/public/assets/svg/activity.svg +1 -0
- package/src/app/public/assets/svg/add.svg +1 -0
- package/src/app/public/assets/svg/airplay.svg +1 -0
- package/src/app/public/assets/svg/alert-circle.svg +1 -0
- package/src/app/public/assets/svg/alert-octagon.svg +1 -0
- package/src/app/public/assets/svg/alert-triangle.svg +1 -0
- package/src/app/public/assets/svg/align-center.svg +1 -0
- package/src/app/public/assets/svg/align-justify.svg +1 -0
- package/src/app/public/assets/svg/align-left.svg +1 -0
- package/src/app/public/assets/svg/arrow-down-circle.svg +1 -0
- package/src/app/public/assets/svg/arrow-left-circle.svg +1 -0
- package/src/app/public/assets/svg/arrow-right-circle.svg +1 -0
- package/src/app/public/assets/svg/arrow-right.svg +4 -0
- package/src/app/public/assets/svg/arrow-up-circle.svg +1 -0
- package/src/app/public/assets/svg/bell-off.svg +1 -0
- package/src/app/public/assets/svg/bell.svg +1 -0
- package/src/app/public/assets/svg/camera.svg +1 -0
- package/src/app/public/assets/svg/cast.svg +1 -0
- package/src/app/public/assets/svg/check.svg +1 -0
- package/src/app/public/assets/svg/clock.svg +1 -0
- package/src/app/public/assets/svg/code.svg +1 -0
- package/src/app/public/assets/svg/component-accordion.svg +56 -0
- package/src/app/public/assets/svg/component-alert.svg +34 -0
- package/src/app/public/assets/svg/component-button.svg +63 -0
- package/src/app/public/assets/svg/component-checkbox.svg +41 -0
- package/src/app/public/assets/svg/component-input.svg +30 -0
- package/src/app/public/assets/svg/component-modal.svg +63 -0
- package/src/app/public/assets/svg/component-pagination.svg +82 -0
- package/src/app/public/assets/svg/component-radio.svg +15 -0
- package/src/app/public/assets/svg/component-select.svg +48 -0
- package/src/app/public/assets/svg/component-switch.svg +6 -0
- package/src/app/public/assets/svg/component-table.svg +45 -0
- package/src/app/public/assets/svg/component-tabs.svg +34 -0
- package/src/app/public/assets/svg/component-tooltip.svg +60 -0
- package/src/app/public/assets/svg/component.svg +48 -0
- package/src/app/public/assets/svg/copy.svg +1 -0
- package/src/app/public/assets/svg/delivery.svg +1 -0
- package/src/app/public/assets/svg/download.svg +1 -0
- package/src/app/public/assets/svg/file-jpg.svg +20 -0
- package/src/app/public/assets/svg/file-svg.svg +31 -0
- package/src/app/public/assets/svg/file-zip.svg +24 -0
- package/src/app/public/assets/svg/hero-brand-assets.svg +44 -0
- package/src/app/public/assets/svg/hero-colors.svg +10 -0
- package/src/app/public/assets/svg/hero-components.svg +68 -0
- package/src/app/public/assets/svg/hero-design.svg +20 -0
- package/src/app/public/assets/svg/hero-effects.svg +1 -0
- package/src/app/public/assets/svg/illustration-sample.svg +82 -0
- package/src/app/public/assets/svg/image.svg +8 -0
- package/src/app/public/assets/svg/link.svg +1 -0
- package/src/app/public/assets/svg/logo.svg +8 -0
- package/src/app/public/assets/svg/moon.svg +1 -0
- package/src/app/public/assets/svg/motiv-logo-dark-example.svg +11 -0
- package/src/app/public/assets/svg/motiv-logo-example.svg +11 -0
- package/src/app/public/assets/svg/plus-circle.svg +1 -0
- package/src/app/public/assets/svg/react.svg +10 -0
- package/src/app/public/assets/svg/search-laptop.svg +20 -0
- package/src/app/public/assets/svg/search.svg +1 -0
- package/src/app/public/assets/svg/send.svg +10 -0
- package/src/app/public/assets/svg/share.svg +1 -0
- package/src/app/public/assets/svg/small-accordion.svg +9 -0
- package/src/app/public/assets/svg/small-button.svg +9 -0
- package/src/app/public/assets/svg/small-pagination.svg +14 -0
- package/src/app/public/assets/svg/small-radio.svg +15 -0
- package/src/app/public/assets/svg/small-select.svg +9 -0
- package/src/app/public/assets/svg/small-table.svg +16 -0
- package/src/app/public/assets/svg/small-toggle.svg +9 -0
- package/src/app/public/assets/svg/sun.svg +1 -0
- package/src/app/public/assets/svg/token-alignment.svg +5 -0
- package/src/app/public/assets/svg/token-border-radius.svg +3 -0
- package/src/app/public/assets/svg/token-border-width.svg +10 -0
- package/src/app/public/assets/svg/token-spacing-horizontal.svg +8 -0
- package/src/app/public/assets/svg/token-spacing-vertical.svg +8 -0
- package/src/app/public/assets/svg/token-type-small.svg +5 -0
- package/src/app/public/assets/svg/x.svg +1 -0
- package/src/app/public/assets/svg/zap.svg +1 -0
- package/src/app/public/favicon.ico +0 -0
- package/src/app/public/fonts/readme.md +4 -0
- package/src/app/public/handoff-logo.svg +38 -0
- package/src/app/public/logo.svg +13 -0
- package/src/app/public/openapi.yaml +1818 -0
- package/src/app/public/robots.txt +0 -0
- package/src/app/tsconfig.json +53 -0
- package/src/app/types/middleware-hook.d.ts +10 -0
- package/src/app/types/next-auth-augmentation.d.ts +20 -0
- package/src/app-builder/README.md +43 -0
- package/src/app-builder/build.ts +741 -0
- package/src/app-builder/client-config.ts +124 -0
- package/src/app-builder/config-diff/index.ts +4 -0
- package/src/app-builder/config-diff/registry.ts +23 -0
- package/src/app-builder/config-diff/snapshot.ts +51 -0
- package/src/app-builder/config-diff/strategies/pattern.ts +80 -0
- package/src/app-builder/config-diff/types.ts +36 -0
- package/src/app-builder/index.ts +7 -0
- package/src/app-builder/path-contract.ts +81 -0
- package/src/app-builder/paths.ts +90 -0
- package/src/app-builder/watchers/component.ts +72 -0
- package/src/app-builder/watchers/utils.ts +44 -0
- package/src/app-builder/watchers.ts +345 -0
- package/src/app-builder/websocket.ts +72 -0
- package/src/cache/README.md +49 -0
- package/src/cache/build-cache.ts +567 -0
- package/src/cache/file-state.ts +170 -0
- package/src/cache/index.ts +46 -0
- package/src/cache/push-state.ts +201 -0
- package/src/cli/README.md +12 -0
- package/src/cli/create.ts +366 -0
- package/src/cli/eject.ts +93 -0
- package/src/cli/fetch-design-md.ts +60 -0
- package/src/cli/figma-audit.ts +76 -0
- package/src/cli/init-claude-core.ts +111 -0
- package/src/cli/make.ts +203 -0
- package/src/cli/scaffold.ts +651 -0
- package/src/cli/sync/apply-declaration-pull.ts +257 -0
- package/src/cli/sync/apply-pull.ts +223 -0
- package/src/cli/sync/cli-auth-store.ts +51 -0
- package/src/cli/sync/collect-build-artifacts.ts +159 -0
- package/src/cli/sync/collect-referenced-images.ts +204 -0
- package/src/cli/sync/declaration-patch.ts +192 -0
- package/src/cli/sync/hash.ts +12 -0
- package/src/cli/sync/open-browser.ts +37 -0
- package/src/cli/sync/push-provenance.ts +109 -0
- package/src/cli/sync/push-registry-content.ts +1025 -0
- package/src/cli/sync/push-shared-assets.ts +62 -0
- package/src/cli/sync/resolve-declaration-payload.ts +231 -0
- package/src/cli/sync/resolve-declaration.ts +18 -0
- package/src/cli/sync/run-cli-login.ts +110 -0
- package/src/cli/sync/run-history-purge.ts +142 -0
- package/src/cli/sync/run-pull.ts +112 -0
- package/src/cli/sync/run-push.ts +702 -0
- package/src/cli/sync/run-sync-status.ts +37 -0
- package/src/cli/sync/sync-remote-env.ts +64 -0
- package/src/cli/sync/sync-state.ts +42 -0
- package/src/cli/tokens/ensure-default-brand.ts +115 -0
- package/src/cli/tokens/migrate-legacy.ts +261 -0
- package/src/cli/tokens/parse-css-brands.ts +208 -0
- package/src/cli/tokens/transform.ts +134 -0
- package/src/cli.ts +62 -0
- package/src/commands/README.md +25 -0
- package/src/commands/audit/figma-components.ts +37 -0
- package/src/commands/build/app.ts +32 -0
- package/src/commands/build/components.ts +25 -0
- package/src/commands/build/hubspot.ts +267 -0
- package/src/commands/dev/index.ts +20 -0
- package/src/commands/eject/config.ts +20 -0
- package/src/commands/eject/pages.ts +20 -0
- package/src/commands/eject/theme.ts +20 -0
- package/src/commands/fetch/index.ts +20 -0
- package/src/commands/history-purge.ts +67 -0
- package/src/commands/index.ts +67 -0
- package/src/commands/init/index.ts +17 -0
- package/src/commands/init/vercel.ts +112 -0
- package/src/commands/init-claude.ts +61 -0
- package/src/commands/login.ts +39 -0
- package/src/commands/logout.ts +22 -0
- package/src/commands/make/component.ts +34 -0
- package/src/commands/make/page.ts +47 -0
- package/src/commands/make/template.ts +47 -0
- package/src/commands/mcp-init.ts +111 -0
- package/src/commands/mcp-token.ts +32 -0
- package/src/commands/prepare-runtime.ts +39 -0
- package/src/commands/pull.ts +28 -0
- package/src/commands/push-all.ts +202 -0
- package/src/commands/push-assets.ts +52 -0
- package/src/commands/push-tokens.ts +52 -0
- package/src/commands/push.ts +91 -0
- package/src/commands/scaffold/index.ts +22 -0
- package/src/commands/start/index.ts +20 -0
- package/src/commands/sync-status.ts +21 -0
- package/src/commands/tokens-build.ts +118 -0
- package/src/commands/types.ts +6 -0
- package/src/commands/utils.ts +21 -0
- package/src/commands/validate/components.ts +27 -0
- package/src/commands/validate.ts +189 -0
- package/src/commands/vercel-build.ts +96 -0
- package/src/config/README.md +32 -0
- package/src/config/declaration-module-load.ts +74 -0
- package/src/config/defaults.ts +78 -0
- package/src/config/helpers.ts +43 -0
- package/src/config/index.ts +16 -0
- package/src/config/loader.ts +131 -0
- package/src/config/normalizers/declaration.ts +180 -0
- package/src/config/normalizers/pattern.ts +56 -0
- package/src/config/runtime.ts +426 -0
- package/src/config/validator.ts +24 -0
- package/src/declarations/codegen.ts +367 -0
- package/src/declarations/helpers.ts +36 -0
- package/src/declarations/index.ts +20 -0
- package/src/declarations/types.ts +214 -0
- package/src/figma/component-linking.ts +1415 -0
- package/src/figma/image-fills.ts +247 -0
- package/src/generated/build-meta.ts +8 -0
- package/src/index.d.ts +13 -0
- package/src/index.ts +369 -0
- package/src/pipeline/README.md +21 -0
- package/src/pipeline/archive.ts +75 -0
- package/src/pipeline/components.ts +9 -0
- package/src/pipeline/documentation.ts +77 -0
- package/src/pipeline/figma.ts +173 -0
- package/src/pipeline/hubspot/config.ts +288 -0
- package/src/pipeline/hubspot/emit.ts +385 -0
- package/src/pipeline/index.ts +38 -0
- package/src/pipeline/patterns.ts +12 -0
- package/src/pipeline/styles.ts +154 -0
- package/src/pipeline/validation.ts +25 -0
- package/src/stacks/bootstrap-handlebars.md +117 -0
- package/src/stacks/react-scss.md +126 -0
- package/src/stacks/react-tailwind.md +123 -0
- package/src/stacks/tailwind-handlebars.md +142 -0
- package/src/transformers/README.md +19 -0
- package/src/transformers/docgen/index.ts +305 -0
- package/src/transformers/plugins/csf-render.ts +485 -0
- package/src/transformers/plugins/handlebars-previews.ts +194 -0
- package/src/transformers/plugins/index.ts +14 -0
- package/src/transformers/plugins/slot-probe-candidates.ts +386 -0
- package/src/transformers/plugins/slot-probe.ts +366 -0
- package/src/transformers/plugins/ssr-render.ts +622 -0
- package/src/transformers/plugins.ts +17 -0
- package/src/transformers/preview/component/api.ts +175 -0
- package/src/transformers/preview/component/artifacts.ts +112 -0
- package/src/transformers/preview/component/build-shared-bundles.ts +453 -0
- package/src/transformers/preview/component/builder.ts +754 -0
- package/src/transformers/preview/component/css.ts +253 -0
- package/src/transformers/preview/component/field-annotations.ts +400 -0
- package/src/transformers/preview/component/html.ts +96 -0
- package/src/transformers/preview/component/javascript.ts +182 -0
- package/src/transformers/preview/component/normalizer.ts +83 -0
- package/src/transformers/preview/component/playwright-shared.ts +183 -0
- package/src/transformers/preview/component/preview-assets.ts +158 -0
- package/src/transformers/preview/component/preview-merge.ts +95 -0
- package/src/transformers/preview/component/preview-select.ts +184 -0
- package/src/transformers/preview/component/preview-server.ts +128 -0
- package/src/transformers/preview/component/preview-validation.ts +255 -0
- package/src/transformers/preview/component/previews.ts +12 -0
- package/src/transformers/preview/component/screenshot.ts +306 -0
- package/src/transformers/preview/component/serialized-elements.ts +124 -0
- package/src/transformers/preview/component/summary.ts +54 -0
- package/src/transformers/preview/component.ts +31 -0
- package/src/transformers/preview/height-reporter.ts +37 -0
- package/src/transformers/preview/pattern/api.ts +83 -0
- package/src/transformers/preview/pattern/builder.ts +192 -0
- package/src/transformers/preview/pattern/html.ts +115 -0
- package/src/transformers/preview/slots.ts +105 -0
- package/src/transformers/preview/types.ts +302 -0
- package/src/transformers/types.ts +68 -0
- package/src/transformers/utils/build.ts +85 -0
- package/src/transformers/utils/csf.ts +48 -0
- package/src/transformers/utils/handlebars.ts +92 -0
- package/src/transformers/utils/html.ts +44 -0
- package/src/transformers/utils/index.ts +27 -0
- package/src/transformers/utils/module.ts +54 -0
- package/src/transformers/utils/schema-loader.ts +68 -0
- package/src/transformers/utils/schema.ts +569 -0
- package/src/transformers/utils/string.ts +55 -0
- package/src/transformers/utils/svg-sprite.ts +139 -0
- package/src/transformers/utils/usage.ts +317 -0
- package/src/transformers/utils/vite-logger.ts +33 -0
- package/src/transformers/validation/runner.ts +351 -0
- package/src/transformers/vite-config.ts +21 -0
- package/src/types/README.md +12 -0
- package/src/types/config.ts +482 -0
- package/src/types/font.ts +3 -0
- package/src/types/handoff-sync.ts +145 -0
- package/src/types/history-purge.ts +141 -0
- package/src/types/icon.ts +8 -0
- package/src/types/preview.ts +136 -0
- package/src/types/validation.ts +213 -0
- package/src/utils/README.md +14 -0
- package/src/utils/asset-upload-limits.ts +157 -0
- package/src/utils/design-md.ts +152 -0
- package/src/utils/duration.ts +3 -0
- package/src/utils/filter.ts +134 -0
- package/src/utils/fs.ts +35 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/line-diff.ts +80 -0
- package/src/utils/logger.ts +176 -0
- package/src/utils/path.ts +61 -0
- package/src/utils/port.ts +46 -0
- package/src/utils/rich-text.ts +1202 -0
- package/src/validators/axe.ts +288 -0
- package/src/validators/contrast.ts +270 -0
- package/src/validators/index.ts +42 -0
- package/src/validators/schema.ts +191 -0
- package/tailwind.config.ts +96 -0
- package/templates/default/README.md.tpl +15 -0
- package/templates/default/components/button/Button.jsx.tpl +64 -0
- package/templates/default/components/button/Button.tsx.tpl +92 -0
- package/templates/default/components/button/button.react.handoff.js.tpl +31 -0
- package/templates/default/components/button/button.react.handoff.ts.tpl +31 -0
- package/templates/default/env.tpl +2 -0
- package/templates/default/gitignore.tpl +7 -0
- package/templates/default/handoff.config.js.tpl +216 -0
- package/templates/default/handoff.config.ts.tpl +196 -0
- package/templates/default/handoff.config.with-examples.js.tpl +215 -0
- package/templates/default/handoff.config.with-examples.ts.tpl +208 -0
- package/templates/default/package.json.tpl +19 -0
- package/templates/default/tsconfig.json.tpl +24 -0
- package/templates/workflows/hubspot-deploy.yml +134 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { getSyncBearerToken, resolveSyncRemoteUrl } from './sync-remote-env.js';
|
|
6
|
+
import { CHUNK_BYTES, planAssetUpload } from '../../utils/asset-upload-limits.js';
|
|
7
|
+
/**
|
|
8
|
+
* Push the per-project content endpoints introduced in ADR-001 / P2:
|
|
9
|
+
* - /api/registry/config — handoff.config.js's app block
|
|
10
|
+
* - /api/registry/theme — compiled theme CSS bytes
|
|
11
|
+
* - /api/registry/navigation — derived nav tree
|
|
12
|
+
* - /api/registry/tokens — IDocumentationObject snapshot
|
|
13
|
+
*
|
|
14
|
+
* Each helper is independent — pushAll() calls them in sequence so partial
|
|
15
|
+
* failures (e.g. nav not yet derived) don't block other pushes.
|
|
16
|
+
*/
|
|
17
|
+
/** `postJson` for the calls whose response body matters (the ingest handshake). */
|
|
18
|
+
async function postJsonForResult(url, bearer, body) {
|
|
19
|
+
const res = await fetch(url, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${bearer}`,
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
},
|
|
25
|
+
body: JSON.stringify(body),
|
|
26
|
+
});
|
|
27
|
+
if (!res.ok) {
|
|
28
|
+
const text = await res.text().catch(() => '');
|
|
29
|
+
throw new Error(`POST ${url} failed (${res.status}): ${text || res.statusText}`);
|
|
30
|
+
}
|
|
31
|
+
return res.json();
|
|
32
|
+
}
|
|
33
|
+
async function postJson(url, bearer, body) {
|
|
34
|
+
const res = await fetch(url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${bearer}`,
|
|
38
|
+
'Content-Type': 'application/json',
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify(body),
|
|
41
|
+
});
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
const text = await res.text().catch(() => '');
|
|
44
|
+
throw new Error(`POST ${url} failed (${res.status}): ${text || res.statusText}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// ─── Config ────────────────────────────────────────────────────────────────────
|
|
48
|
+
export async function pushRegistryConfig(handoff) {
|
|
49
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
50
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
51
|
+
const url = `${baseUrl}/api/registry/config`;
|
|
52
|
+
// The `app` block of handoff.config.js carries title, client, breakpoints,
|
|
53
|
+
// sort orders, base_path, attribution flag, ports, etc. — everything the
|
|
54
|
+
// registry needs to identify this project at runtime.
|
|
55
|
+
const data = { ...(handoff.config?.app ?? {}) };
|
|
56
|
+
// figma_project_id is a top-level config field (not under `app`). The registry
|
|
57
|
+
// is DB-backed and has no handoff.config file at runtime, so the Figma file id
|
|
58
|
+
// must be carried in the pushed config — the fetch runner reads it back from
|
|
59
|
+
// getRegistryConfig(). Stored at the top level of the blob, alongside `app`.
|
|
60
|
+
if (handoff.config?.figma_project_id) {
|
|
61
|
+
data.figma_project_id = handoff.config.figma_project_id;
|
|
62
|
+
}
|
|
63
|
+
// Derive a validation manifest from the workspace's validation config.
|
|
64
|
+
// The registry uses this to:
|
|
65
|
+
// (a) decide whether to show the /system/health page link
|
|
66
|
+
// (b) know which validators to expect (vs "not run yet")
|
|
67
|
+
// We push only the stable IDs/names — not the full Validator objects (which
|
|
68
|
+
// contain closures and can't be serialized).
|
|
69
|
+
// NOTE: `validation` lives on `handoff.config` (the full project config), NOT
|
|
70
|
+
// on `handoff.runtimeConfig` (which only carries component-level options).
|
|
71
|
+
const validationCfg = handoff.config?.validation;
|
|
72
|
+
if (validationCfg?.validators?.length) {
|
|
73
|
+
data.validationManifest = {
|
|
74
|
+
configured: true,
|
|
75
|
+
runOn: validationCfg.runOn ?? 'push',
|
|
76
|
+
validators: validationCfg.validators
|
|
77
|
+
.map((v) => ({ id: v.id, name: v.name, description: v.description })),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Explicitly clear any stale manifest if validators were removed
|
|
82
|
+
data.validationManifest = { configured: false, validators: [], runOn: 'push' };
|
|
83
|
+
}
|
|
84
|
+
Logger.info('Pushing registry config…');
|
|
85
|
+
await postJson(url, bearer, { data });
|
|
86
|
+
Logger.success('Registry config pushed.');
|
|
87
|
+
}
|
|
88
|
+
// ─── Theme ─────────────────────────────────────────────────────────────────────
|
|
89
|
+
/**
|
|
90
|
+
* Look for the workspace's compiled theme CSS. Priority order:
|
|
91
|
+
* 1. <workingPath>/theme.css — most common location
|
|
92
|
+
* 2. <workingPath>/public/theme.css — alternate convention
|
|
93
|
+
* 3. <workingPath>/.handoff/runtime/css/theme.css — legacy materialized output
|
|
94
|
+
*/
|
|
95
|
+
function findThemeCssPath(workingPath) {
|
|
96
|
+
const candidates = [
|
|
97
|
+
path.join(workingPath, 'theme.css'),
|
|
98
|
+
path.join(workingPath, 'public', 'theme.css'),
|
|
99
|
+
path.join(workingPath, '.handoff', 'runtime', 'css', 'theme.css'),
|
|
100
|
+
];
|
|
101
|
+
for (const c of candidates) {
|
|
102
|
+
if (fs.existsSync(c))
|
|
103
|
+
return c;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
export async function pushRegistryTheme(handoff) {
|
|
108
|
+
const themePath = findThemeCssPath(handoff.workingPath);
|
|
109
|
+
if (!themePath) {
|
|
110
|
+
Logger.warn('No theme.css found in workspace (checked theme.css, public/theme.css, .handoff/runtime/css/theme.css). Skipping theme push.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
114
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
115
|
+
const url = `${baseUrl}/api/registry/theme`;
|
|
116
|
+
const css = await fs.readFile(themePath, 'utf8');
|
|
117
|
+
Logger.info(`Pushing registry theme (${Math.round(css.length / 1024)}KB from ${path.relative(handoff.workingPath, themePath)})…`);
|
|
118
|
+
await postJson(url, bearer, { css });
|
|
119
|
+
Logger.success('Registry theme pushed.');
|
|
120
|
+
}
|
|
121
|
+
async function readFrontmatter(filePath) {
|
|
122
|
+
try {
|
|
123
|
+
const raw = await fs.readFile(filePath, 'utf-8');
|
|
124
|
+
const parsed = matter(raw);
|
|
125
|
+
return (parsed.data ?? {});
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async function deriveNavigationFromPages(workingPath) {
|
|
132
|
+
const pagesDir = path.join(workingPath, 'pages');
|
|
133
|
+
if (!(await fs.pathExists(pagesDir)))
|
|
134
|
+
return [];
|
|
135
|
+
/**
|
|
136
|
+
* Find the index .md file for a given dir, if any. Either `dir/index.md` or
|
|
137
|
+
* `dir.md` (the sibling-stem convention) can play that role. The frontmatter
|
|
138
|
+
* on that file is what defines the section: its `title`, `icon`, `weight`,
|
|
139
|
+
* and crucially the `menu:` definition the registry sidebar renders from.
|
|
140
|
+
*/
|
|
141
|
+
const findIndexFrontmatter = async (parentDir, name, isDir) => {
|
|
142
|
+
if (isDir) {
|
|
143
|
+
const inside = path.join(parentDir, name, 'index.md');
|
|
144
|
+
if (await fs.pathExists(inside))
|
|
145
|
+
return readFrontmatter(inside);
|
|
146
|
+
const sibling = path.join(parentDir, `${name}.md`);
|
|
147
|
+
if (await fs.pathExists(sibling))
|
|
148
|
+
return readFrontmatter(sibling);
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return readFrontmatter(path.join(parentDir, `${name}.md`));
|
|
152
|
+
};
|
|
153
|
+
const walk = async (dir, parentSlugParts) => {
|
|
154
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
155
|
+
const visible = entries.filter((e) => !e.name.startsWith('.') && !e.name.startsWith('_'));
|
|
156
|
+
// Sibling `foo.md` next to `foo/` represents the directory's index page —
|
|
157
|
+
// skip the standalone .md node so the slug doesn't get pushed twice.
|
|
158
|
+
const dirStems = new Set(visible.filter((e) => e.isDirectory()).map((e) => e.name));
|
|
159
|
+
const nodes = [];
|
|
160
|
+
for (const entry of visible.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
161
|
+
const abs = path.join(dir, entry.name);
|
|
162
|
+
if (entry.isDirectory()) {
|
|
163
|
+
const stem = entry.name;
|
|
164
|
+
const children = await walk(abs, [...parentSlugParts, stem]);
|
|
165
|
+
const fm = await findIndexFrontmatter(dir, stem, true);
|
|
166
|
+
if (fm?.enabled === false)
|
|
167
|
+
continue;
|
|
168
|
+
if (children.length === 0 && !fm)
|
|
169
|
+
continue;
|
|
170
|
+
nodes.push({
|
|
171
|
+
slug: [...parentSlugParts, stem].join('/'),
|
|
172
|
+
title: fm?.menuTitle ?? fm?.title ?? titleCase(stem),
|
|
173
|
+
type: 'category',
|
|
174
|
+
children: children.length > 0 ? children : undefined,
|
|
175
|
+
definition: fm?.menu,
|
|
176
|
+
icon: fm?.icon,
|
|
177
|
+
weight: fm?.weight,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
181
|
+
const stem = entry.name.replace(/\.md$/, '');
|
|
182
|
+
if (stem === 'index')
|
|
183
|
+
continue;
|
|
184
|
+
if (dirStems.has(stem))
|
|
185
|
+
continue;
|
|
186
|
+
const fm = await readFrontmatter(abs);
|
|
187
|
+
if (fm?.enabled === false)
|
|
188
|
+
continue;
|
|
189
|
+
nodes.push({
|
|
190
|
+
slug: [...parentSlugParts, stem].join('/'),
|
|
191
|
+
title: fm?.menuTitle ?? fm?.title ?? titleCase(stem),
|
|
192
|
+
type: 'markdown',
|
|
193
|
+
definition: fm?.menu,
|
|
194
|
+
icon: fm?.icon,
|
|
195
|
+
weight: fm?.weight,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Stable sort by weight (lower first), title as tie-break.
|
|
200
|
+
nodes.sort((a, b) => {
|
|
201
|
+
const aw = a.weight ?? 0;
|
|
202
|
+
const bw = b.weight ?? 0;
|
|
203
|
+
if (aw !== bw)
|
|
204
|
+
return aw - bw;
|
|
205
|
+
return a.title.localeCompare(b.title);
|
|
206
|
+
});
|
|
207
|
+
return nodes;
|
|
208
|
+
};
|
|
209
|
+
return walk(pagesDir, []);
|
|
210
|
+
}
|
|
211
|
+
function titleCase(s) {
|
|
212
|
+
return s
|
|
213
|
+
.split(/[-_]/)
|
|
214
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
215
|
+
.join(' ');
|
|
216
|
+
}
|
|
217
|
+
export async function pushRegistryNavigation(handoff) {
|
|
218
|
+
const tree = await deriveNavigationFromPages(handoff.workingPath);
|
|
219
|
+
if (tree.length === 0) {
|
|
220
|
+
Logger.warn('No pages found to build navigation tree. Skipping nav push.');
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
224
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
225
|
+
const url = `${baseUrl}/api/registry/navigation`;
|
|
226
|
+
Logger.info(`Pushing registry navigation (${tree.length} top-level nodes)…`);
|
|
227
|
+
await postJson(url, bearer, { tree });
|
|
228
|
+
Logger.success('Registry navigation pushed.');
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Map a page file to the `handoff_page.slug` the registry serves it under.
|
|
232
|
+
*
|
|
233
|
+
* Two files name a *section* rather than a leaf, and both must land on the slug
|
|
234
|
+
* the doc routes ask for (`/foundations` reads slug `foundations`):
|
|
235
|
+
* - `foundations/index.md` — sits inside the directory, so it drops its stem.
|
|
236
|
+
* - `foundations.md` beside `foundations/` — sits one level up, so the plain
|
|
237
|
+
* path already gives `foundations`; it needs no special case, only for the
|
|
238
|
+
* old `continue` that dropped it to be gone.
|
|
239
|
+
*
|
|
240
|
+
* A root-level `index.md` keeps the literal slug `index`, which is what
|
|
241
|
+
* `app/page.tsx` looks up for the home page.
|
|
242
|
+
*/
|
|
243
|
+
export function pageFileToSlug(slugParts, stem) {
|
|
244
|
+
if (stem === 'index' && slugParts.length > 0)
|
|
245
|
+
return slugParts.join('/');
|
|
246
|
+
return [...slugParts, stem].join('/');
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Collect every page under `pages/` with the slug the registry will serve it at.
|
|
250
|
+
*
|
|
251
|
+
* **Section index pages used to be dropped here** — `index.md` and the
|
|
252
|
+
* `foo.md`-beside-`foo/` convention were both `continue`d with the note "nav
|
|
253
|
+
* handles these". Nav does carry the menu label, and nothing else: no
|
|
254
|
+
* description, no metaTitle, no body. So `/foundations` and `/system` on the
|
|
255
|
+
* live registry had no `handoff_page` row at all, fell through to bundled
|
|
256
|
+
* markdown that does not resolve in the Vercel runtime, and rendered an empty
|
|
257
|
+
* H1. Pushing their content — under the section slug — is what fills them.
|
|
258
|
+
*
|
|
259
|
+
* Nav generation is untouched: `deriveNavigationFromPages` still folds these
|
|
260
|
+
* files into their category node rather than emitting a duplicate leaf.
|
|
261
|
+
*/
|
|
262
|
+
export async function collectWorkspacePages(pagesDir) {
|
|
263
|
+
/** Keyed by slug so a `foo/index.md` + `foo.md` pair cannot push the same slug twice. */
|
|
264
|
+
const bySlug = new Map();
|
|
265
|
+
/** Slugs claimed by a literal `index.md`; those win over the `foo.md` sibling. */
|
|
266
|
+
const claimedByIndex = new Set();
|
|
267
|
+
const walk = async (dir, slugParts) => {
|
|
268
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
269
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
270
|
+
if (entry.name.startsWith('.') || entry.name.startsWith('_'))
|
|
271
|
+
continue;
|
|
272
|
+
const abs = path.join(dir, entry.name);
|
|
273
|
+
if (entry.isDirectory()) {
|
|
274
|
+
await walk(abs, [...slugParts, entry.name]);
|
|
275
|
+
}
|
|
276
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
277
|
+
const stem = entry.name.replace(/\.md$/, '');
|
|
278
|
+
const slug = pageFileToSlug(slugParts, stem);
|
|
279
|
+
// `dir/index.md` wins over the `dir.md` sibling, matching the precedence
|
|
280
|
+
// `deriveNavigationFromPages` already uses to pick a section's frontmatter.
|
|
281
|
+
// Tracked explicitly rather than relying on which file the walk reaches first.
|
|
282
|
+
if (claimedByIndex.has(slug))
|
|
283
|
+
continue;
|
|
284
|
+
if (stem === 'index')
|
|
285
|
+
claimedByIndex.add(slug);
|
|
286
|
+
const raw = await fs.readFile(abs, 'utf-8');
|
|
287
|
+
const { data: frontmatter, content: markdown } = matter(raw);
|
|
288
|
+
bySlug.set(slug, { slug, frontmatter: frontmatter, markdown });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
await walk(pagesDir, []);
|
|
293
|
+
return [...bySlug.values()];
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Push every page markdown file from the workspace's `pages/` directory to the
|
|
297
|
+
* registry's `handoff_page` table. Navigation is pushed separately (see
|
|
298
|
+
* pushRegistryNavigation) so this step only carries content — frontmatter + body.
|
|
299
|
+
*
|
|
300
|
+
* Sending all pages in a single batched POST avoids per-file round-trips while
|
|
301
|
+
* staying within Vercel's 4.5 MB function payload limit in most workspaces.
|
|
302
|
+
*/
|
|
303
|
+
export async function pushRegistryPages(handoff, provenance) {
|
|
304
|
+
const pagesDir = path.join(handoff.workingPath, 'pages');
|
|
305
|
+
if (!(await fs.pathExists(pagesDir))) {
|
|
306
|
+
Logger.warn('No pages/ directory found in workspace. Skipping pages content push.');
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const collected = await collectWorkspacePages(pagesDir);
|
|
310
|
+
if (collected.length === 0) {
|
|
311
|
+
Logger.warn('No .md pages found in pages/ directory. Skipping pages content push.');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
315
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
316
|
+
const url = `${baseUrl}/api/registry/pages`;
|
|
317
|
+
Logger.info(`Pushing ${collected.length} page(s) to registry…`);
|
|
318
|
+
// Provenance rides along so the page-change rows land under the same push as the components.
|
|
319
|
+
await postJson(url, bearer, provenance ? { pages: collected, provenance } : { pages: collected });
|
|
320
|
+
Logger.success(`Registry pages pushed (${collected.length} page(s)).`);
|
|
321
|
+
}
|
|
322
|
+
// ─── Tokens ────────────────────────────────────────────────────────────────────
|
|
323
|
+
/**
|
|
324
|
+
* Push the design tokens snapshot. Reads from the workspace's built
|
|
325
|
+
* tokens.json at public/api/tokens.json (the output of `handoff-app fetch`).
|
|
326
|
+
*/
|
|
327
|
+
export async function pushRegistryTokens(handoff, message, provenance) {
|
|
328
|
+
const tokensPath = path.join(handoff.workingPath, 'public', 'api', 'tokens.json');
|
|
329
|
+
if (!(await fs.pathExists(tokensPath))) {
|
|
330
|
+
// Fail loudly rather than skip: the Figma `localStyles` snapshot this pushes is
|
|
331
|
+
// what the registry's foundation visual displays (colors, typography, effects)
|
|
332
|
+
// read. Silently skipping leaves those pages blank on the registry. If a
|
|
333
|
+
// workspace intentionally has no Figma tokens, pass --skip-tokens.
|
|
334
|
+
throw new Error(`No tokens snapshot found at ${tokensPath}. Run \`handoff-app fetch\` first, or pass --skip-tokens to omit this step intentionally.`);
|
|
335
|
+
}
|
|
336
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
337
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
338
|
+
const url = `${baseUrl}/api/registry/tokens`;
|
|
339
|
+
const payload = await fs.readJson(tokensPath);
|
|
340
|
+
Logger.info('Pushing registry tokens snapshot…');
|
|
341
|
+
const trimmed = message?.trim() || provenance?.why || undefined;
|
|
342
|
+
await postJson(url, bearer, {
|
|
343
|
+
payload,
|
|
344
|
+
...(trimmed ? { message: trimmed } : {}),
|
|
345
|
+
...(provenance ? { provenance } : {}),
|
|
346
|
+
});
|
|
347
|
+
Logger.success('Registry tokens pushed.');
|
|
348
|
+
}
|
|
349
|
+
// ─── DTCG ──────────────────────────────────────────────────────────────────────
|
|
350
|
+
/**
|
|
351
|
+
* Push the DTCG token pipeline output. Reads from the workspace's
|
|
352
|
+
* design-system/dist/ directory (the output of `handoff-app tokens:build`).
|
|
353
|
+
*
|
|
354
|
+
* Sends all four compiled formats (CSS, SCSS, Tailwind, resolved DTCG JSON)
|
|
355
|
+
* plus the manifest to POST /api/registry/dtcg so the registry can serve
|
|
356
|
+
* foundation pages without access to the workspace filesystem.
|
|
357
|
+
*
|
|
358
|
+
* If design-system/dist/ doesn't exist, warns and skips — run `handoff-app tokens:build`
|
|
359
|
+
* in the workspace before push:all if you want DTCG data on the registry.
|
|
360
|
+
*/
|
|
361
|
+
/** Collect brand token files from design-system/tokens/brands/ and shared/. */
|
|
362
|
+
async function collectBrandTokens(dsRoot) {
|
|
363
|
+
const brands = {};
|
|
364
|
+
const sharedGray = path.join(dsRoot, 'tokens', 'shared', 'gray.tokens.json');
|
|
365
|
+
if (await fs.pathExists(sharedGray)) {
|
|
366
|
+
brands['shared'] = await fs.readJson(sharedGray);
|
|
367
|
+
}
|
|
368
|
+
const brandsDir = path.join(dsRoot, 'tokens', 'brands');
|
|
369
|
+
if (await fs.pathExists(brandsDir)) {
|
|
370
|
+
for (const entry of await fs.readdir(brandsDir, { withFileTypes: true })) {
|
|
371
|
+
if (entry.isFile() && entry.name.endsWith('.tokens.json')) {
|
|
372
|
+
const brandName = entry.name.replace(/\.tokens\.json$/, '');
|
|
373
|
+
brands[brandName] = await fs.readJson(path.join(brandsDir, entry.name));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return brands;
|
|
378
|
+
}
|
|
379
|
+
export async function pushRegistryDtcg(handoff) {
|
|
380
|
+
const dsRoot = path.join(handoff.workingPath, 'design-system');
|
|
381
|
+
const dsDist = path.join(dsRoot, 'dist');
|
|
382
|
+
const manifestPath = path.join(dsRoot, 'manifest.json');
|
|
383
|
+
if (!(await fs.pathExists(dsDist))) {
|
|
384
|
+
Logger.warn(`No design-system/dist/ found at ${dsDist}. Run \`handoff-app tokens:build\` first. Skipping DTCG push.`);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const cssPath = path.join(dsDist, 'css', 'tokens.css');
|
|
388
|
+
const scssPath = path.join(dsDist, 'scss', '_tokens.scss');
|
|
389
|
+
const tailwindPath = path.join(dsDist, 'tailwind', 'theme.css');
|
|
390
|
+
const dtcgPath = path.join(dsDist, 'dtcg', 'tokens.resolved.json');
|
|
391
|
+
const missing = [cssPath, scssPath, tailwindPath, dtcgPath].filter((p) => !fs.existsSync(p));
|
|
392
|
+
if (missing.length > 0) {
|
|
393
|
+
Logger.warn(`Missing DTCG dist files: ${missing.map((p) => path.relative(handoff.workingPath, p)).join(', ')}. Run \`handoff-app tokens:build\`. Skipping DTCG push.`);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const [css, scss, tailwind, dtcg, manifest, brands] = await Promise.all([
|
|
397
|
+
fs.readFile(cssPath, 'utf-8'),
|
|
398
|
+
fs.readFile(scssPath, 'utf-8'),
|
|
399
|
+
fs.readFile(tailwindPath, 'utf-8'),
|
|
400
|
+
fs.readJson(dtcgPath),
|
|
401
|
+
fs.pathExists(manifestPath).then((exists) => (exists ? fs.readJson(manifestPath) : {})),
|
|
402
|
+
collectBrandTokens(dsRoot),
|
|
403
|
+
]);
|
|
404
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
405
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
406
|
+
const url = `${baseUrl}/api/registry/dtcg`;
|
|
407
|
+
const brandNames = Object.keys(brands).filter((k) => k !== 'shared');
|
|
408
|
+
const cssKb = Math.round(css.length / 1024);
|
|
409
|
+
Logger.info(`Pushing DTCG token dist to registry (~${cssKb}KB CSS${brandNames.length ? `, brands: ${brandNames.join(', ')}` : ''})…`);
|
|
410
|
+
await postJson(url, bearer, { manifest, css, scss, tailwind, dtcg, brands });
|
|
411
|
+
Logger.success('Registry DTCG tokens pushed.');
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Push the icon catalog. Reads from `icons/catalog.json` in the workspace root
|
|
415
|
+
* (an array of IconCatalogEntry). Skips gracefully if the file doesn't exist.
|
|
416
|
+
*/
|
|
417
|
+
export async function pushRegistryIcons(handoff) {
|
|
418
|
+
const catalogPath = path.join(handoff.workingPath, 'icons', 'catalog.json');
|
|
419
|
+
if (!(await fs.pathExists(catalogPath))) {
|
|
420
|
+
Logger.warn(`No icon catalog found at ${catalogPath}. Create icons/catalog.json to push icon data. Skipping.`);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const catalog = await fs.readJson(catalogPath);
|
|
424
|
+
if (!Array.isArray(catalog)) {
|
|
425
|
+
Logger.warn('icons/catalog.json must be a JSON array. Skipping icon push.');
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
429
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
430
|
+
Logger.info(`Pushing icon catalog (${catalog.length} icons)…`);
|
|
431
|
+
await postJson(`${baseUrl}/api/registry/icons`, bearer, { catalog });
|
|
432
|
+
Logger.success('Registry icon catalog pushed.');
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Push the logo set. Reads from `logos/logo-set.json` in the workspace root
|
|
436
|
+
* (a LogoSet object). SVG content for custom logos is inlined in the JSON.
|
|
437
|
+
* Skips gracefully if the file doesn't exist.
|
|
438
|
+
*/
|
|
439
|
+
export async function pushRegistryLogos(handoff) {
|
|
440
|
+
const logoSetPath = path.join(handoff.workingPath, 'logos', 'logo-set.json');
|
|
441
|
+
if (!(await fs.pathExists(logoSetPath))) {
|
|
442
|
+
Logger.warn(`No logo set found at ${logoSetPath}. Create logos/logo-set.json to push logo data. Skipping.`);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const logoSet = await fs.readJson(logoSetPath);
|
|
446
|
+
if (typeof logoSet !== 'object' || Array.isArray(logoSet)) {
|
|
447
|
+
Logger.warn('logos/logo-set.json must be a JSON object. Skipping logo push.');
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
451
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
452
|
+
Logger.info('Pushing logo set…');
|
|
453
|
+
await postJson(`${baseUrl}/api/registry/logos`, bearer, { logoSet });
|
|
454
|
+
Logger.success('Registry logo set pushed.');
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Push component-referenced images to the registry's ingest endpoint.
|
|
458
|
+
*
|
|
459
|
+
* How each image travels is decided by {@link planAssetUpload}, the same function the route uses, so
|
|
460
|
+
* the CLI can no longer send something the server cannot receive — which is precisely what it used to
|
|
461
|
+
* do. Sending each image in its own request was already right; what was wrong was assuming a whole
|
|
462
|
+
* image always fits in one, when base64 had already spent a third of the budget.
|
|
463
|
+
*
|
|
464
|
+
* - small enough → one JSON POST, exactly as before
|
|
465
|
+
* - otherwise → `begin` for a plan, raw-binary chunk PUTs, then `complete`
|
|
466
|
+
* - `mode:'s3'` → one PUT straight to the bucket, then `complete` with the storage key; the bytes
|
|
467
|
+
* never touch the function
|
|
468
|
+
*
|
|
469
|
+
* Returns the number of images successfully ingested.
|
|
470
|
+
*/
|
|
471
|
+
export async function pushComponentImages(handoff, componentId, images) {
|
|
472
|
+
if (images.length === 0)
|
|
473
|
+
return 0;
|
|
474
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
475
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
476
|
+
const url = `${baseUrl}/api/registry/assets/ingest`;
|
|
477
|
+
let ok = 0;
|
|
478
|
+
for (const img of images) {
|
|
479
|
+
try {
|
|
480
|
+
const plan = planAssetUpload({ sizeBytes: img.sizeBytes, s3Configured: false });
|
|
481
|
+
if (plan.mode === 'single') {
|
|
482
|
+
await postJson(url, bearer, {
|
|
483
|
+
assetId: img.assetId,
|
|
484
|
+
filename: img.filename,
|
|
485
|
+
contentHash: img.contentHash,
|
|
486
|
+
mimeType: img.mime,
|
|
487
|
+
dataBase64: img.bytes.toString('base64'),
|
|
488
|
+
componentId,
|
|
489
|
+
refs: img.refs,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
await uploadImageInParts(url, bearer, componentId, img);
|
|
494
|
+
}
|
|
495
|
+
ok++;
|
|
496
|
+
}
|
|
497
|
+
catch (e) {
|
|
498
|
+
Logger.warn(` Image "${img.filename}" for component "${componentId}": ${e instanceof Error ? e.message : String(e)}`);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return ok;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The handshake for an image too big for one request body.
|
|
505
|
+
*
|
|
506
|
+
* The server, not the CLI, decides whether this ends up as a presigned bucket PUT or as chunks through
|
|
507
|
+
* the route — only the server knows whether S3 is configured. So `begin` is asked first and its answer
|
|
508
|
+
* is followed, rather than the CLI guessing and the two disagreeing.
|
|
509
|
+
*/
|
|
510
|
+
async function uploadImageInParts(url, bearer, componentId, img) {
|
|
511
|
+
const begin = (await postJsonForResult(url, bearer, {
|
|
512
|
+
op: 'begin',
|
|
513
|
+
assetId: img.assetId,
|
|
514
|
+
filename: img.filename,
|
|
515
|
+
contentHash: img.contentHash,
|
|
516
|
+
mimeType: img.mime,
|
|
517
|
+
sizeBytes: img.sizeBytes,
|
|
518
|
+
}));
|
|
519
|
+
if (begin.mode === 's3') {
|
|
520
|
+
if (!begin.uploadUrl)
|
|
521
|
+
throw new Error('Registry offered an S3 upload but returned no uploadUrl');
|
|
522
|
+
const put = await fetch(begin.uploadUrl, {
|
|
523
|
+
method: 'PUT',
|
|
524
|
+
headers: { 'Content-Type': img.mime },
|
|
525
|
+
body: new Uint8Array(img.bytes),
|
|
526
|
+
});
|
|
527
|
+
if (!put.ok)
|
|
528
|
+
throw new Error(`Direct upload to storage failed (${put.status})`);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
const chunkSize = begin.chunkSize ?? CHUNK_BYTES;
|
|
532
|
+
for (let offset = 0; offset < img.bytes.length; offset += chunkSize) {
|
|
533
|
+
const slice = img.bytes.subarray(offset, Math.min(offset + chunkSize, img.bytes.length));
|
|
534
|
+
const res = await fetch(url, {
|
|
535
|
+
method: 'PUT',
|
|
536
|
+
headers: {
|
|
537
|
+
Authorization: `Bearer ${bearer}`,
|
|
538
|
+
'Content-Type': 'application/octet-stream',
|
|
539
|
+
'x-handoff-asset-id': img.assetId,
|
|
540
|
+
'x-handoff-chunk-offset': String(offset),
|
|
541
|
+
},
|
|
542
|
+
body: new Uint8Array(slice),
|
|
543
|
+
});
|
|
544
|
+
if (!res.ok) {
|
|
545
|
+
const text = await res.text().catch(() => '');
|
|
546
|
+
throw new Error(`Chunk at ${offset} failed (${res.status}): ${text || res.statusText}`);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
await postJson(url, bearer, {
|
|
551
|
+
op: 'complete',
|
|
552
|
+
assetId: img.assetId,
|
|
553
|
+
contentHash: img.contentHash,
|
|
554
|
+
sizeBytes: img.sizeBytes,
|
|
555
|
+
componentId,
|
|
556
|
+
refs: img.refs,
|
|
557
|
+
storageKey: begin.storageKey ?? null,
|
|
558
|
+
publicUrl: begin.publicUrl,
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
// ─── Fonts ──────────────────────────────────────────────────────────────────
|
|
562
|
+
const FONT_EXT_RE = /\.(woff2|woff|ttf|otf)$/i;
|
|
563
|
+
function weightFromVariant(variant) {
|
|
564
|
+
const s = variant.toLowerCase().replace(/(slanted|slant|italic|oblique)/g, '').trim();
|
|
565
|
+
const num = s.match(/([1-9]00)/);
|
|
566
|
+
if (num)
|
|
567
|
+
return parseInt(num[1], 10);
|
|
568
|
+
if (/thin|hairline/.test(s))
|
|
569
|
+
return 100;
|
|
570
|
+
if (/extralight|ultralight/.test(s))
|
|
571
|
+
return 200;
|
|
572
|
+
if (/semibold|demibold|demi/.test(s))
|
|
573
|
+
return 600;
|
|
574
|
+
if (/extrabold|ultrabold/.test(s))
|
|
575
|
+
return 800;
|
|
576
|
+
if (/black|heavy/.test(s))
|
|
577
|
+
return 900;
|
|
578
|
+
if (/medium/.test(s))
|
|
579
|
+
return 500;
|
|
580
|
+
if (/light/.test(s))
|
|
581
|
+
return 300;
|
|
582
|
+
if (/bold/.test(s))
|
|
583
|
+
return 700;
|
|
584
|
+
return 400; // regular / normal / book / unmatched
|
|
585
|
+
}
|
|
586
|
+
/** 'PPTelegraf' → 'PP Telegraf' (best-effort camelCase split for display). */
|
|
587
|
+
function camelToWords(s) {
|
|
588
|
+
return s
|
|
589
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
590
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
591
|
+
.replace(/[_-]+/g, ' ')
|
|
592
|
+
.trim();
|
|
593
|
+
}
|
|
594
|
+
function parseFontFilename(fileName) {
|
|
595
|
+
const m = fileName.match(FONT_EXT_RE);
|
|
596
|
+
if (!m)
|
|
597
|
+
return null;
|
|
598
|
+
const format = m[1].toLowerCase();
|
|
599
|
+
let base = fileName.slice(0, fileName.length - m[0].length);
|
|
600
|
+
base = base.replace(/^subset-/i, '');
|
|
601
|
+
const parts = base.split('-');
|
|
602
|
+
let variant = '';
|
|
603
|
+
let familyRaw = base;
|
|
604
|
+
if (parts.length > 1) {
|
|
605
|
+
variant = parts[parts.length - 1];
|
|
606
|
+
familyRaw = parts.slice(0, -1).join('-');
|
|
607
|
+
}
|
|
608
|
+
const style = /(slant|italic|oblique)/i.test(variant) ? 'italic' : 'normal';
|
|
609
|
+
const weight = weightFromVariant(variant);
|
|
610
|
+
const familyKey = familyRaw.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
611
|
+
if (!familyKey)
|
|
612
|
+
return null;
|
|
613
|
+
return { familyKey, family: camelToWords(familyRaw), weight, style, format };
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Collect font files from the workspace and push them to the registry so:
|
|
617
|
+
* - theme.css @font-face `url('/fonts/<file>')` references resolve, and
|
|
618
|
+
* - the foundation rasterizer can render branded type samples (satori).
|
|
619
|
+
*
|
|
620
|
+
* Scans <workingPath>/public/fonts, <workingPath>/fonts, and
|
|
621
|
+
* <workingPath>/.handoff/app/public/fonts (whichever exist). De-duplicates by
|
|
622
|
+
* filename, preferring the first occurrence found.
|
|
623
|
+
*/
|
|
624
|
+
export async function pushRegistryFonts(handoff) {
|
|
625
|
+
const candidateDirs = [
|
|
626
|
+
path.join(handoff.workingPath, 'public', 'fonts'),
|
|
627
|
+
path.join(handoff.workingPath, 'fonts'),
|
|
628
|
+
path.join(handoff.workingPath, '.handoff', 'app', 'public', 'fonts'),
|
|
629
|
+
];
|
|
630
|
+
const seen = new Map();
|
|
631
|
+
for (const dir of candidateDirs) {
|
|
632
|
+
if (!(await fs.pathExists(dir)))
|
|
633
|
+
continue;
|
|
634
|
+
let names;
|
|
635
|
+
try {
|
|
636
|
+
names = await fs.readdir(dir);
|
|
637
|
+
}
|
|
638
|
+
catch {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
for (const name of names) {
|
|
642
|
+
if (!FONT_EXT_RE.test(name))
|
|
643
|
+
continue;
|
|
644
|
+
if (!seen.has(name))
|
|
645
|
+
seen.set(name, { dir });
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (seen.size === 0) {
|
|
649
|
+
Logger.warn(`No font files found (checked ${candidateDirs.map((d) => path.relative(handoff.workingPath, d)).join(', ')}). Skipping font push.`);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
const fonts = [];
|
|
653
|
+
for (const [filename, { dir }] of seen) {
|
|
654
|
+
const parsed = parseFontFilename(filename);
|
|
655
|
+
if (!parsed)
|
|
656
|
+
continue;
|
|
657
|
+
try {
|
|
658
|
+
const buf = await fs.readFile(path.join(dir, filename));
|
|
659
|
+
fonts.push({ filename, ...parsed, data: buf.toString('base64') });
|
|
660
|
+
}
|
|
661
|
+
catch (e) {
|
|
662
|
+
Logger.warn(`Could not read font ${filename}: ${e instanceof Error ? e.message : String(e)}`);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if (fonts.length === 0) {
|
|
666
|
+
Logger.warn('No readable font files to push. Skipping.');
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
670
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
671
|
+
const families = Array.from(new Set(fonts.map((f) => f.family))).join(', ');
|
|
672
|
+
const totalKb = Math.round(fonts.reduce((n, f) => n + f.data.length * 0.75, 0) / 1024);
|
|
673
|
+
// Send one font per request — each font file is typically 50–400KB, well under
|
|
674
|
+
// Vercel's 4.5MB request limit. Sending individually avoids any batching math
|
|
675
|
+
// and makes partial failures easy to diagnose without losing the whole push.
|
|
676
|
+
Logger.info(`Pushing ${fonts.length} font file(s) [${families}] (~${totalKb}KB)…`);
|
|
677
|
+
let pushed = 0;
|
|
678
|
+
let failed = 0;
|
|
679
|
+
for (const font of fonts) {
|
|
680
|
+
try {
|
|
681
|
+
await postJson(`${baseUrl}/api/registry/fonts`, bearer, { fonts: [font] });
|
|
682
|
+
pushed++;
|
|
683
|
+
}
|
|
684
|
+
catch (e) {
|
|
685
|
+
failed++;
|
|
686
|
+
Logger.warn(` Failed to push font "${font.filename}": ${e instanceof Error ? e.message : String(e)}`);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
if (failed > 0) {
|
|
690
|
+
Logger.warn(`Registry fonts: ${pushed} pushed, ${failed} failed.`);
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
Logger.success(`Registry fonts pushed (${pushed}).`);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Push Figma image fills cached during `handoff-app fetch` to the asset DAM.
|
|
698
|
+
* Reads `figma-fills/fills.json` + image files written by `fetchAndSaveFigmaImageFills`.
|
|
699
|
+
* Each image is sent individually to stay under Vercel's 4.5MB body limit.
|
|
700
|
+
*/
|
|
701
|
+
export async function pushFigmaImageFills(handoff) {
|
|
702
|
+
const fillsDir = path.join(handoff.getOutputPath(), 'figma-fills');
|
|
703
|
+
const manifestPath = path.join(fillsDir, 'fills.json');
|
|
704
|
+
if (!(await fs.pathExists(manifestPath))) {
|
|
705
|
+
Logger.warn(`No Figma image fills manifest at ${manifestPath}. ` +
|
|
706
|
+
`Run \`handoff-app fetch\` first to download image fills. Skipping.`);
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
const manifest = (await fs.readJson(manifestPath));
|
|
710
|
+
if (!Array.isArray(manifest.fills) || manifest.fills.length === 0) {
|
|
711
|
+
Logger.info('No Figma image fills to push.');
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
715
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
716
|
+
const url = `${baseUrl}/api/registry/assets/ingest-figma-fills`;
|
|
717
|
+
Logger.info(`Pushing ${manifest.fills.length} Figma image fill(s) to asset library…`);
|
|
718
|
+
let ok = 0;
|
|
719
|
+
for (const fill of manifest.fills) {
|
|
720
|
+
try {
|
|
721
|
+
const filePath = path.join(fillsDir, fill.filename);
|
|
722
|
+
if (!(await fs.pathExists(filePath))) {
|
|
723
|
+
Logger.warn(` Fill "${fill.imageRef}": file not found at ${filePath} — skipping.`);
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const bytes = await fs.readFile(filePath);
|
|
727
|
+
const dataBase64 = bytes.toString('base64');
|
|
728
|
+
await postJson(url, bearer, {
|
|
729
|
+
assetId: fill.assetId,
|
|
730
|
+
filename: fill.filename,
|
|
731
|
+
contentHash: fill.contentHash,
|
|
732
|
+
mimeType: fill.mimeType,
|
|
733
|
+
dataBase64,
|
|
734
|
+
figmaFileKey: manifest.figmaFileKey,
|
|
735
|
+
figmaImageRef: fill.imageRef,
|
|
736
|
+
});
|
|
737
|
+
ok++;
|
|
738
|
+
}
|
|
739
|
+
catch (e) {
|
|
740
|
+
Logger.warn(` Fill "${fill.imageRef}": ${e instanceof Error ? e.message : String(e)}`);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
Logger.success(`Figma image fills pushed: ${ok}/${manifest.fills.length} succeeded.`);
|
|
744
|
+
}
|
|
745
|
+
// ─── Image slots ────────────────────────────────────────────────────────────────
|
|
746
|
+
function gcd(a, b) {
|
|
747
|
+
return b === 0 ? a : gcd(b, a % b);
|
|
748
|
+
}
|
|
749
|
+
function toAspectRatio(w, h) {
|
|
750
|
+
const wi = Math.round(w);
|
|
751
|
+
const hi = Math.round(h);
|
|
752
|
+
if (!wi || !hi)
|
|
753
|
+
return null;
|
|
754
|
+
const d = gcd(wi, hi);
|
|
755
|
+
const rw = wi / d;
|
|
756
|
+
const rh = hi / d;
|
|
757
|
+
// If either component exceeds 99, the ratio is too irreducible to be meaningful
|
|
758
|
+
// (e.g. 1366×768 → 683:384). Fall back to rounding to nearest common ratio.
|
|
759
|
+
if (rw > 99 || rh > 99) {
|
|
760
|
+
const decimal = wi / hi;
|
|
761
|
+
const commonRatios = [
|
|
762
|
+
[1, 1], [4, 3], [3, 2], [16, 10], [5, 3], [16, 9], [2, 1],
|
|
763
|
+
[21, 9], [3, 1], [9, 16], [3, 4], [2, 3], [9, 21], [4, 5],
|
|
764
|
+
];
|
|
765
|
+
let best = [wi, hi];
|
|
766
|
+
let bestDiff = Infinity;
|
|
767
|
+
for (const [cw, ch] of commonRatios) {
|
|
768
|
+
const diff = Math.abs(decimal - cw / ch);
|
|
769
|
+
if (diff < bestDiff) {
|
|
770
|
+
bestDiff = diff;
|
|
771
|
+
best = [cw, ch];
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return { w: best[0], h: best[1] };
|
|
775
|
+
}
|
|
776
|
+
return { w: rw, h: rh };
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Extract image sizing specs from the Figma tokens snapshot and push them to
|
|
780
|
+
* the registry's /api/registry/image-slots endpoint. Reads from the workspace's
|
|
781
|
+
* output tokens.json (written by `handoff-app fetch`). Batches components to
|
|
782
|
+
* avoid oversized requests.
|
|
783
|
+
*/
|
|
784
|
+
export async function pushImageSlots(handoff) {
|
|
785
|
+
const tokensPath = handoff.getTokensFilePath();
|
|
786
|
+
if (!(await fs.pathExists(tokensPath))) {
|
|
787
|
+
Logger.warn(`No tokens file at ${tokensPath}. Run \`handoff-app fetch\` first. Skipping image slots push.`);
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const snapshot = await fs.readJson(tokensPath);
|
|
791
|
+
const components = Array.isArray(snapshot.components) ? snapshot.components : [];
|
|
792
|
+
const allSlots = [];
|
|
793
|
+
for (const comp of components) {
|
|
794
|
+
const compId = comp.id;
|
|
795
|
+
if (!compId || !Array.isArray(comp.figmaImages))
|
|
796
|
+
continue;
|
|
797
|
+
for (const img of comp.figmaImages) {
|
|
798
|
+
if (img.width && img.height) {
|
|
799
|
+
allSlots.push({ componentId: compId, slot: img });
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (allSlots.length === 0) {
|
|
804
|
+
Logger.info('No Figma image slots with sizing data found — nothing to push.');
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
const baseUrl = await resolveSyncRemoteUrl(handoff.workingPath);
|
|
808
|
+
const bearer = await getSyncBearerToken(handoff.workingPath);
|
|
809
|
+
const url = `${baseUrl}/api/registry/image-slots`;
|
|
810
|
+
// Build deduplicated slot records, keyed by (componentId, slotName, nodeId)
|
|
811
|
+
const seen = new Set();
|
|
812
|
+
const slots = allSlots
|
|
813
|
+
.map(({ componentId, slot }) => {
|
|
814
|
+
const slotName = slot.name ?? 'image';
|
|
815
|
+
const nodeId = slot.nodeId ?? null;
|
|
816
|
+
const key = `${componentId}:${slotName}:${nodeId ?? ''}`;
|
|
817
|
+
if (seen.has(key))
|
|
818
|
+
return null;
|
|
819
|
+
seen.add(key);
|
|
820
|
+
const ratio = slot.width && slot.height ? toAspectRatio(slot.width, slot.height) : null;
|
|
821
|
+
const idHash = Buffer.from(key).toString('base64url').slice(0, 32);
|
|
822
|
+
return {
|
|
823
|
+
id: idHash,
|
|
824
|
+
componentId,
|
|
825
|
+
slotName,
|
|
826
|
+
nodeId,
|
|
827
|
+
variantKey: null,
|
|
828
|
+
recommendedWidth: slot.width ?? null,
|
|
829
|
+
recommendedHeight: slot.height ?? null,
|
|
830
|
+
aspectRatioW: ratio?.w ?? null,
|
|
831
|
+
aspectRatioH: ratio?.h ?? null,
|
|
832
|
+
scaleMode: slot.scaleMode ?? null,
|
|
833
|
+
isResponsive: slot.isResponsive ?? false,
|
|
834
|
+
minWidth: slot.minWidth ?? null,
|
|
835
|
+
minHeight: slot.minHeight ?? null,
|
|
836
|
+
};
|
|
837
|
+
})
|
|
838
|
+
.filter((s) => s !== null);
|
|
839
|
+
const componentIds = [...new Set(slots.map((s) => s.componentId))];
|
|
840
|
+
Logger.info(`Pushing ${slots.length} image slot(s) across ${componentIds.length} component(s)…`);
|
|
841
|
+
// Batch by component: send up to 50 components at a time
|
|
842
|
+
const BATCH = 50;
|
|
843
|
+
for (let i = 0; i < componentIds.length; i += BATCH) {
|
|
844
|
+
const batchCompIds = componentIds.slice(i, i + BATCH);
|
|
845
|
+
const batchSlots = slots.filter((s) => batchCompIds.includes(s.componentId));
|
|
846
|
+
try {
|
|
847
|
+
await postJson(url, bearer, { componentIds: batchCompIds, slots: batchSlots });
|
|
848
|
+
}
|
|
849
|
+
catch (e) {
|
|
850
|
+
Logger.warn(` Image slots batch ${Math.floor(i / BATCH) + 1}: ${e instanceof Error ? e.message : String(e)}`);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
Logger.success(`Image slots pushed (${slots.length} slot(s)).`);
|
|
854
|
+
}
|