handoff-app 1.2.2-7 → 2.0.0-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 +37 -15
- package/README.md +372 -118
- package/dist/app-builder/build.d.ts +41 -2
- package/dist/app-builder/build.js +455 -18
- package/dist/app-builder/client-config.d.ts +15 -2
- package/dist/app-builder/client-config.js +43 -4
- package/dist/app-builder/config-diff/snapshot.d.ts +1 -6
- package/dist/app-builder/config-diff/snapshot.js +2 -9
- package/dist/app-builder/index.d.ts +1 -1
- package/dist/app-builder/index.js +3 -1
- package/dist/app-builder/nav-shell.d.ts +23 -0
- package/dist/app-builder/nav-shell.js +80 -0
- package/dist/app-builder/paths.js +25 -1
- package/dist/app-builder/static-export.d.ts +17 -0
- package/dist/app-builder/static-export.js +206 -0
- package/dist/app-builder/vercel-output.d.ts +39 -0
- package/dist/app-builder/vercel-output.js +259 -0
- package/dist/app-builder/watchers/utils.d.ts +2 -0
- package/dist/app-builder/watchers.d.ts +14 -4
- package/dist/app-builder/watchers.js +123 -28
- package/dist/app-builder/websocket.js +1 -1
- package/dist/artifacts/index.d.ts +2 -0
- package/dist/artifacts/index.js +16 -0
- package/dist/artifacts/types.d.ts +136 -0
- package/dist/artifacts/types.js +24 -0
- package/dist/artifacts/url.d.ts +67 -0
- package/dist/artifacts/url.js +116 -0
- package/dist/cache/build-cache.js +48 -4
- package/dist/cli.js +0 -0
- package/dist/commands/build/app.js +1 -2
- package/dist/commands/build/index.d.ts +17 -0
- package/dist/commands/build/index.js +66 -0
- package/dist/commands/checkout/index.d.ts +24 -0
- package/dist/commands/checkout/index.js +71 -0
- package/dist/commands/db/migrate.d.ts +11 -0
- package/dist/commands/db/migrate.js +33 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/publish/index.d.ts +21 -0
- package/dist/commands/publish/index.js +68 -0
- package/dist/config/defaults.js +15 -1
- package/dist/config/loader.js +6 -1
- package/dist/config/normalizers/declaration.js +4 -1
- package/dist/config/normalizers/page.d.ts +18 -0
- package/dist/config/normalizers/page.js +34 -0
- package/dist/config/normalizers/pattern.js +7 -1
- package/dist/config/runtime.d.ts +4 -0
- package/dist/config/runtime.js +53 -5
- package/dist/index.d.ts +65 -1
- package/dist/index.js +123 -3
- package/dist/nav/index.d.ts +83 -0
- package/dist/nav/index.js +9 -0
- package/dist/nav/registry.d.ts +15 -0
- package/dist/nav/registry.js +42 -0
- package/dist/nav/resolver.d.ts +8 -0
- package/dist/nav/resolver.js +192 -0
- package/dist/nav/workspace.d.ts +18 -0
- package/dist/nav/workspace.js +103 -0
- package/dist/pipeline/styles.js +7 -35
- package/dist/pipeline/token-transformers.d.ts +45 -0
- package/dist/pipeline/token-transformers.js +71 -0
- package/dist/registry/asset-storage/adapters/vercel-blob.d.ts +17 -0
- package/dist/registry/asset-storage/adapters/vercel-blob.js +87 -0
- package/dist/registry/asset-storage/define.d.ts +10 -0
- package/dist/registry/asset-storage/define.js +13 -0
- package/dist/registry/asset-storage/resolve.d.ts +45 -0
- package/dist/registry/asset-storage/resolve.js +36 -0
- package/dist/registry/asset-storage/types.d.ts +51 -0
- package/dist/registry/asset-storage/types.js +9 -0
- package/dist/registry/assets/layout.d.ts +22 -0
- package/dist/registry/assets/layout.js +30 -0
- package/dist/registry/assets/sets.d.ts +18 -0
- package/dist/registry/assets/sets.js +44 -0
- package/dist/registry/assets/transfer.d.ts +45 -0
- package/dist/registry/assets/transfer.js +11 -0
- package/dist/registry/checkout/assets.d.ts +16 -0
- package/dist/registry/checkout/assets.js +150 -0
- package/dist/registry/checkout/index.d.ts +33 -0
- package/dist/registry/checkout/index.js +610 -0
- package/dist/registry/checkout/tokens.d.ts +15 -0
- package/dist/registry/checkout/tokens.js +171 -0
- package/dist/registry/client.d.ts +61 -0
- package/dist/registry/client.js +211 -0
- package/dist/registry/connection.d.ts +30 -0
- package/dist/registry/connection.js +36 -0
- package/dist/registry/db/adapter.d.ts +43 -0
- package/dist/registry/db/adapter.js +59 -0
- package/dist/registry/db/client.d.ts +35 -0
- package/dist/registry/db/client.js +94 -0
- package/dist/registry/db/index.d.ts +5 -0
- package/dist/registry/db/index.js +24 -0
- package/dist/registry/db/migrate.d.ts +23 -0
- package/dist/registry/db/migrate.js +64 -0
- package/dist/registry/db/schema.d.ts +4869 -0
- package/dist/registry/db/schema.js +347 -0
- package/dist/registry/path.d.ts +4 -0
- package/dist/registry/path.js +31 -0
- package/dist/registry/publish/artifacts.d.ts +16 -0
- package/dist/registry/publish/artifacts.js +132 -0
- package/dist/registry/publish/assets.d.ts +16 -0
- package/dist/registry/publish/assets.js +129 -0
- package/dist/registry/publish/errors.d.ts +5 -0
- package/dist/registry/publish/errors.js +26 -0
- package/dist/registry/publish/index.d.ts +27 -0
- package/dist/registry/publish/index.js +126 -0
- package/dist/registry/publish/package.d.ts +27 -0
- package/dist/registry/publish/package.js +257 -0
- package/dist/registry/publish/publish-build.d.ts +12 -0
- package/dist/registry/publish/publish-build.js +43 -0
- package/dist/registry/publish/tokens.d.ts +18 -0
- package/dist/registry/publish/tokens.js +112 -0
- package/dist/registry/tokens/sets.d.ts +59 -0
- package/dist/registry/tokens/sets.js +109 -0
- package/dist/registry/tokens/transfer.d.ts +48 -0
- package/dist/registry/tokens/transfer.js +10 -0
- package/dist/registry/transfer.d.ts +75 -0
- package/dist/registry/transfer.js +11 -0
- package/dist/store/filesystem-assets.d.ts +17 -0
- package/dist/store/filesystem-assets.js +147 -0
- package/dist/store/filesystem.d.ts +76 -0
- package/dist/store/filesystem.js +208 -0
- package/dist/store/index.d.ts +20 -0
- package/dist/store/index.js +38 -0
- package/dist/store/registry.d.ts +77 -0
- package/dist/store/registry.js +350 -0
- package/dist/store/source-files.d.ts +24 -0
- package/dist/store/source-files.js +147 -0
- package/dist/store/types.d.ts +185 -0
- package/dist/store/types.js +12 -0
- package/dist/transformers/plugins/csf-render.js +17 -8
- package/dist/transformers/plugins/handlebars-previews.js +10 -3
- package/dist/transformers/plugins/ssr-render.js +116 -49
- package/dist/transformers/preview/component/api.js +3 -1
- package/dist/transformers/preview/component/artifacts.js +8 -1
- package/dist/transformers/preview/component/builder.js +13 -5
- package/dist/transformers/preview/component/css.js +9 -1
- package/dist/transformers/preview/component/javascript.d.ts +9 -3
- package/dist/transformers/preview/component/javascript.js +45 -17
- package/dist/transformers/preview/component/shared-artifacts.d.ts +83 -0
- package/dist/transformers/preview/component/shared-artifacts.js +92 -0
- package/dist/transformers/preview/component.js +5 -2
- package/dist/transformers/preview/pattern/builder.js +28 -9
- package/dist/transformers/preview/pattern/html.d.ts +13 -10
- package/dist/transformers/preview/pattern/html.js +62 -27
- package/dist/transformers/preview/types.d.ts +38 -0
- package/dist/transformers/utils/handlebars.d.ts +3 -0
- package/dist/transformers/utils/handlebars.js +19 -5
- package/dist/types/config.d.ts +124 -31
- package/dist/utils/menu-shell.d.ts +60 -0
- package/dist/utils/menu-shell.js +221 -0
- package/dist/utils/stable-stringify.d.ts +2 -0
- package/dist/utils/stable-stringify.js +8 -0
- package/docs/cli.md +4 -2
- package/drizzle/0000_init_registry_storage.sql +95 -0
- package/drizzle/0001_add_review_metadata.sql +2 -0
- package/drizzle/0002_add_pages.sql +28 -0
- package/drizzle/0003_add_tokens.sql +29 -0
- package/drizzle/0004_add_assets.sql +37 -0
- package/drizzle/meta/0000_snapshot.json +642 -0
- package/drizzle/meta/0001_snapshot.json +654 -0
- package/drizzle/meta/0002_snapshot.json +835 -0
- package/drizzle/meta/0003_snapshot.json +1023 -0
- package/drizzle/meta/0004_snapshot.json +1252 -0
- package/drizzle/meta/_journal.json +41 -0
- package/drizzle.config.ts +16 -0
- package/package.json +10 -1
- package/src/app/components/Component/Preview.tsx +3 -2
- package/src/app/components/Component/RegistryActions.tsx +150 -0
- package/src/app/components/Foundations/DisplayLogo.tsx +11 -3
- package/src/app/components/Layout/Header.tsx +21 -3
- package/src/app/components/Layout/Main.tsx +11 -3
- package/src/app/components/Navigation/MainNav.tsx +4 -2
- package/src/app/components/Navigation/MobileNav.tsx +4 -2
- package/src/app/components/Navigation/SideNav.tsx +46 -11
- package/src/app/components/NotFound.tsx +24 -0
- package/src/app/components/context/NavProvider.tsx +71 -0
- package/src/app/components/old/Header.tsx +3 -3
- package/src/app/components/util/index.ts +203 -380
- package/src/app/components/util/useCollectionAssets.ts +125 -0
- package/src/app/components/util/useFoundationTokens.ts +67 -0
- package/src/app/generated/default-pages.json +1 -0
- package/src/app/generated/nav-shell.json +1 -0
- package/src/app/lib/api/query.ts +6 -0
- package/src/app/lib/api/redact.ts +46 -0
- package/src/app/lib/asset-storage.ts +81 -0
- package/src/app/lib/docs-api/artifacts.ts +116 -0
- package/src/app/lib/docs-api/backend.ts +151 -0
- package/src/app/lib/docs-api/errors.ts +52 -0
- package/src/app/lib/docs-api/handler.ts +34 -0
- package/src/app/lib/docs-api/index.ts +7 -0
- package/src/app/lib/docs-api/records.ts +189 -0
- package/src/app/lib/docs-api/registry.ts +130 -0
- package/src/app/lib/docs-api/runtime-config.ts +173 -0
- package/src/app/lib/docs-api/serve.ts +37 -0
- package/src/app/lib/docs-api/token-detail.ts +19 -0
- package/src/app/lib/registry-api/allowlist.ts +163 -0
- package/src/app/lib/registry-api/asset-transfer.ts +363 -0
- package/src/app/lib/registry-api/auth.ts +68 -0
- package/src/app/lib/registry-api/entity-routes.ts +197 -0
- package/src/app/lib/registry-api/errors.ts +51 -0
- package/src/app/lib/registry-api/files.ts +135 -0
- package/src/app/lib/registry-api/handler.ts +96 -0
- package/src/app/lib/registry-api/index.ts +4 -0
- package/src/app/lib/registry-api/meta.ts +87 -0
- package/src/app/lib/registry-api/revalidate.ts +36 -0
- package/src/app/lib/registry-api/store.ts +348 -0
- package/src/app/lib/registry-api/token-transfer.ts +231 -0
- package/src/app/lib/registry-api/transfer.ts +513 -0
- package/src/app/lib/registry-api/validation.ts +74 -0
- package/src/app/lib/registry-connection.ts +58 -0
- package/src/app/lib/utils.ts +14 -0
- package/src/app/next.config.mjs +72 -13
- package/src/app/pages/[...slug]/index.tsx +74 -20
- package/src/app/pages/_app.tsx +5 -2
- package/src/app/pages/api/docs/artifacts/[...artifactPath].ts +16 -0
- package/src/app/pages/api/docs/assets/[collection]/[...path].ts +50 -0
- package/src/app/pages/api/docs/assets/[collection]/index.ts +22 -0
- package/src/app/pages/api/docs/components/[id]/assets/[asset].ts +33 -0
- package/src/app/pages/api/docs/components/[id]/inspect/[previewId].ts +20 -0
- package/src/app/pages/api/docs/components/[id]/previews/[previewId].ts +21 -0
- package/src/app/pages/api/docs/components/[id].ts +24 -0
- package/src/app/pages/api/docs/components.json.ts +12 -0
- package/src/app/pages/api/docs/nav.json.ts +48 -0
- package/src/app/pages/api/docs/patterns/[id]/preview.ts +19 -0
- package/src/app/pages/api/docs/patterns/[id].ts +24 -0
- package/src/app/pages/api/docs/patterns.json.ts +12 -0
- package/src/app/pages/api/docs/tokens/components/[id].ts +30 -0
- package/src/app/pages/api/docs/tokens/foundations/[type].ts +32 -0
- package/src/app/pages/api/registry/components/[id]/files/[...filePath].ts +19 -0
- package/src/app/pages/api/registry/components/[id]/files/index.ts +19 -0
- package/src/app/pages/api/registry/components/[id].ts +20 -0
- package/src/app/pages/api/registry/components/index.ts +19 -0
- package/src/app/pages/api/registry/health.ts +20 -0
- package/src/app/pages/api/registry/patterns/[id]/files/[...filePath].ts +19 -0
- package/src/app/pages/api/registry/patterns/[id]/files/index.ts +19 -0
- package/src/app/pages/api/registry/patterns/[id].ts +20 -0
- package/src/app/pages/api/registry/patterns/index.ts +19 -0
- package/src/app/pages/api/registry/transfer/[kind]/[id].ts +39 -0
- package/src/app/pages/api/registry/transfer/assets/[collection].ts +24 -0
- package/src/app/pages/api/registry/transfer/assets/blobs/[hash].ts +23 -0
- package/src/app/pages/api/registry/transfer/assets/blobs/have.ts +11 -0
- package/src/app/pages/api/registry/transfer/assets/index.ts +10 -0
- package/src/app/pages/api/registry/transfer/tokens/[...setId].ts +26 -0
- package/src/app/pages/api/registry/transfer/tokens/index.ts +11 -0
- package/src/app/pages/assets/fonts.tsx +41 -17
- package/src/app/pages/assets/index.tsx +2 -2
- package/src/app/pages/assets/logos.tsx +6 -3
- package/src/app/pages/foundations/colors.tsx +18 -8
- package/src/app/pages/foundations/effects.tsx +18 -8
- package/src/app/pages/foundations/icons/[name]/index.tsx +28 -16
- package/src/app/pages/foundations/icons/index.tsx +18 -12
- package/src/app/pages/foundations/index.tsx +1 -1
- package/src/app/pages/foundations/logo.tsx +12 -8
- package/src/app/pages/foundations/typography.tsx +19 -9
- package/src/app/pages/index.tsx +1 -1
- package/src/app/pages/system/component/[component]/index.tsx +87 -17
- package/src/app/pages/system/index.tsx +13 -4
- package/src/app/pages/system/pattern/[pattern]/index.tsx +70 -14
- package/src/app/pages/system/tokens/components/[component]/index.tsx +42 -14
- package/src/app/pages/system/tokens/foundations/colors.tsx +7 -5
- package/src/app/pages/system/tokens/foundations/effects.tsx +7 -5
- package/src/app/pages/system/tokens/foundations/typography.tsx +8 -4
- package/src/app/tsconfig.json +2 -3
- package/src/app-builder/build.ts +555 -11
- package/src/app-builder/client-config.ts +61 -4
- package/src/app-builder/config-diff/snapshot.ts +1 -11
- package/src/app-builder/index.ts +1 -1
- package/src/app-builder/nav-shell.ts +74 -0
- package/src/app-builder/paths.ts +27 -1
- package/src/app-builder/static-export.ts +242 -0
- package/src/app-builder/vercel-output.ts +297 -0
- package/src/app-builder/watchers/utils.ts +2 -0
- package/src/app-builder/watchers.ts +149 -25
- package/src/app-builder/websocket.ts +2 -2
- package/src/artifacts/README.md +14 -0
- package/src/artifacts/index.ts +24 -0
- package/src/artifacts/types.ts +146 -0
- package/src/artifacts/url.ts +122 -0
- package/src/cache/build-cache.ts +47 -2
- package/src/commands/build/app.ts +1 -2
- package/src/commands/build/index.ts +61 -0
- package/src/commands/checkout/index.ts +66 -0
- package/src/commands/db/migrate.ts +25 -0
- package/src/commands/index.ts +8 -0
- package/src/commands/publish/index.ts +63 -0
- package/src/config/defaults.ts +15 -0
- package/src/config/loader.ts +10 -1
- package/src/config/normalizers/declaration.ts +3 -0
- package/src/config/normalizers/page.ts +45 -0
- package/src/config/normalizers/pattern.ts +4 -1
- package/src/config/runtime.ts +48 -2
- package/src/index.ts +126 -3
- package/src/nav/index.ts +94 -0
- package/src/nav/registry.ts +54 -0
- package/src/nav/resolver.ts +217 -0
- package/src/nav/workspace.ts +87 -0
- package/src/pipeline/styles.ts +4 -35
- package/src/pipeline/token-transformers.ts +97 -0
- package/src/registry/asset-storage/adapters/vercel-blob.ts +51 -0
- package/src/registry/asset-storage/define.ts +15 -0
- package/src/registry/asset-storage/resolve.ts +72 -0
- package/src/registry/asset-storage/types.ts +46 -0
- package/src/registry/assets/layout.ts +38 -0
- package/src/registry/assets/sets.ts +48 -0
- package/src/registry/assets/transfer.ts +50 -0
- package/src/registry/checkout/assets.ts +126 -0
- package/src/registry/checkout/index.ts +596 -0
- package/src/registry/checkout/tokens.ts +152 -0
- package/src/registry/client.ts +234 -0
- package/src/registry/connection.ts +50 -0
- package/src/registry/db/adapter.ts +74 -0
- package/src/registry/db/client.ts +88 -0
- package/src/registry/db/index.ts +35 -0
- package/src/registry/db/migrate.ts +56 -0
- package/src/registry/db/schema.ts +444 -0
- package/src/registry/path.ts +26 -0
- package/src/registry/publish/artifacts.ts +147 -0
- package/src/registry/publish/assets.ts +129 -0
- package/src/registry/publish/errors.ts +34 -0
- package/src/registry/publish/index.ts +128 -0
- package/src/registry/publish/package.ts +272 -0
- package/src/registry/publish/publish-build.ts +51 -0
- package/src/registry/publish/tokens.ts +119 -0
- package/src/registry/tokens/sets.ts +132 -0
- package/src/registry/tokens/transfer.ts +53 -0
- package/src/registry/transfer.ts +82 -0
- package/src/store/filesystem-assets.ts +152 -0
- package/src/store/filesystem.ts +237 -0
- package/src/store/index.ts +62 -0
- package/src/store/registry.ts +334 -0
- package/src/store/source-files.ts +155 -0
- package/src/store/types.ts +210 -0
- package/src/transformers/plugins/csf-render.ts +31 -7
- package/src/transformers/plugins/handlebars-previews.ts +22 -3
- package/src/transformers/plugins/ssr-render.ts +145 -57
- package/src/transformers/preview/component/api.ts +2 -1
- package/src/transformers/preview/component/artifacts.ts +10 -1
- package/src/transformers/preview/component/builder.ts +9 -2
- package/src/transformers/preview/component/css.ts +10 -1
- package/src/transformers/preview/component/javascript.ts +55 -20
- package/src/transformers/preview/component/shared-artifacts.ts +146 -0
- package/src/transformers/preview/component.ts +5 -2
- package/src/transformers/preview/pattern/builder.ts +33 -7
- package/src/transformers/preview/pattern/html.ts +71 -27
- package/src/transformers/preview/types.ts +42 -0
- package/src/transformers/utils/handlebars.ts +31 -5
- package/src/types/config.ts +129 -31
- package/src/utils/menu-shell.ts +241 -0
- package/src/utils/stable-stringify.ts +7 -0
- package/templates/default/package.json.tpl +1 -1
- package/handoff.config.js +0 -90
- package/src/app/components/ComponentSearch.tsx +0 -93
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleDocsRoute, idFromJsonParam, sendDocsData, sendDocsError } from '@/lib/docs-api';
|
|
3
|
+
import { localStylesKeyForFoundationType } from '@handoff/registry/tokens/sets';
|
|
4
|
+
import { tokenFormatStrings } from '@/lib/docs-api/token-detail';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `GET /api/docs/tokens/foundations/{type}.json` — the `foundation/{type}` set: the `localStyles`
|
|
8
|
+
* slice (`design`) plus the generated download strings (css/scss/styleDictionary/types) and the full
|
|
9
|
+
* artifact list. Mode-independent: the same shape whether the filesystem or the registry database
|
|
10
|
+
* backs it. `Cache-Control: no-store` so a publish surfaces without a rebuild/redeploy.
|
|
11
|
+
*/
|
|
12
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
13
|
+
return handleDocsRoute(req, res, async (backend) => {
|
|
14
|
+
const type = idFromJsonParam(req.query.type);
|
|
15
|
+
if (!type) {
|
|
16
|
+
sendDocsError(res, 'not_found', 'Missing foundation token type.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const detail = await backend.getTokenSetDetail(`foundation/${type}`);
|
|
20
|
+
if (!detail) {
|
|
21
|
+
sendDocsError(res, 'not_found', `Foundation token set "${type}" was not found.`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const localStylesKey = localStylesKeyForFoundationType(type);
|
|
25
|
+
res.setHeader('Cache-Control', 'no-store, max-age=0');
|
|
26
|
+
sendDocsData(res, 200, {
|
|
27
|
+
design: localStylesKey ? { [localStylesKey]: detail.record } : {},
|
|
28
|
+
...tokenFormatStrings(detail.artifacts),
|
|
29
|
+
artifacts: detail.artifacts,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityFileItem } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET`, `PUT`, and `DELETE` for a single component text-file record addressed by its relative
|
|
6
|
+
* path. Declaration kind and unsafe paths are rejected; mutations require the bearer token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityFileItem(req, res, 'component');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the PUT file upsert. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityFilesCollection } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/components/{id}/files` (list) and `POST` (create/replace a text-file record).
|
|
6
|
+
* Declaration files and unsafe paths are rejected with `400 bad_request`; POST requires the token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityFilesCollection(req, res, 'component');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the POST file upsert. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityItem } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET` (detail incl. build state), `PUT` (allowlisted metadata update — never touches
|
|
6
|
+
* artifacts/build), and `DELETE` for a single component. Registry-runtime only; mutations require
|
|
7
|
+
* the bearer token.
|
|
8
|
+
*/
|
|
9
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
10
|
+
return handleEntityItem(req, res, 'component');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the PUT write. */
|
|
14
|
+
export const config = {
|
|
15
|
+
api: {
|
|
16
|
+
bodyParser: {
|
|
17
|
+
sizeLimit: '4.5mb',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityCollection } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/components` (list) and `POST /api/registry/components` (create a metadata-only
|
|
6
|
+
* record from allowlisted fields). Registry-runtime only; POST requires the bearer token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityCollection(req, res, 'component');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the POST write. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { ensureRegistryMode, sendRegistryError } from '@/lib/registry-api';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/health` — registry liveness. Registry-runtime only
|
|
6
|
+
* (`409 runtime_mode_conflict` in workspace mode); unauthenticated, like all registry GET reads. It
|
|
7
|
+
* reports the runtime/source without touching the database so it can be used as a cheap probe, and
|
|
8
|
+
* returns the documented bare `{ ok, runtime, source }` body rather than the data envelope.
|
|
9
|
+
*/
|
|
10
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): void {
|
|
11
|
+
if (!ensureRegistryMode(res)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if ((req.method ?? 'GET').toUpperCase() !== 'GET') {
|
|
15
|
+
res.setHeader('Allow', 'GET');
|
|
16
|
+
sendRegistryError(res, 'method_not_allowed', `Method ${req.method ?? 'unknown'} not allowed; health is GET-only.`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
res.status(200).json({ ok: true, runtime: 'registry', source: 'database' });
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityFileItem } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET`, `PUT`, and `DELETE` for a single pattern text-file record addressed by its relative path.
|
|
6
|
+
* Declaration kind and unsafe paths are rejected; mutations require the bearer token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityFileItem(req, res, 'pattern');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the PUT file upsert. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityFilesCollection } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/patterns/{id}/files` (list) and `POST` (create/replace a text-file record).
|
|
6
|
+
* Declaration files and unsafe paths are rejected with `400 bad_request`; POST requires the token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityFilesCollection(req, res, 'pattern');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the POST file upsert. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityItem } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET` (detail incl. build state), `PUT` (allowlisted metadata update — never touches
|
|
6
|
+
* artifacts/build), and `DELETE` for a single pattern. Registry-runtime only; mutations require the
|
|
7
|
+
* bearer token.
|
|
8
|
+
*/
|
|
9
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
10
|
+
return handleEntityItem(req, res, 'pattern');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the PUT write. */
|
|
14
|
+
export const config = {
|
|
15
|
+
api: {
|
|
16
|
+
bodyParser: {
|
|
17
|
+
sizeLimit: '4.5mb',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleEntityCollection } from '@/lib/registry-api/entity-routes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/patterns` (list) and `POST /api/registry/patterns` (create a metadata-only
|
|
6
|
+
* record from allowlisted fields). Registry-runtime only; POST requires the bearer token.
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleEntityCollection(req, res, 'pattern');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Accept request bodies up to Vercel's 4.5 MB function limit (vs. Next's 1 MB default) for the POST write. */
|
|
13
|
+
export const config = {
|
|
14
|
+
api: {
|
|
15
|
+
bodyParser: {
|
|
16
|
+
sizeLimit: '4.5mb',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { singleQueryValue } from '@/lib/api/query';
|
|
3
|
+
import { handleRegistryRoute, sendRegistryError } from '@/lib/registry-api';
|
|
4
|
+
import { handleCheckoutRoute, handleTransferRoute } from '@/lib/registry-api/transfer';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `/api/registry/transfer/{component|pattern|page}/:id` — the transfer endpoint.
|
|
8
|
+
*
|
|
9
|
+
* - `GET` is checkout: returns the normalized record + registry-safe source files so a
|
|
10
|
+
* connected workspace can reconstruct the entity locally. Unauthenticated read.
|
|
11
|
+
* - `PUT` is publish ingestion: the only path allowed to set an entity's
|
|
12
|
+
* render/build-defining fields, source files, rendered artifacts, and build metadata. Requires the
|
|
13
|
+
* bearer token.
|
|
14
|
+
*
|
|
15
|
+
* Both are registry-runtime only (enforced by the guard stack).
|
|
16
|
+
*/
|
|
17
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
18
|
+
const kind = singleQueryValue(req.query.kind);
|
|
19
|
+
if (kind !== 'component' && kind !== 'pattern' && kind !== 'page') {
|
|
20
|
+
return handleRegistryRoute(req, res, ['GET', 'PUT'], async () => {
|
|
21
|
+
sendRegistryError(res, 'not_found', `Unknown transfer entity kind "${kind ?? ''}".`);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const method = (req.method ?? 'GET').toUpperCase();
|
|
25
|
+
return method === 'GET' ? handleCheckoutRoute(req, res, kind) : handleTransferRoute(req, res, kind);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Publish packages (source files + rendered artifacts) are the largest registry payloads, so accept
|
|
30
|
+
* up to Vercel's 4.5 MB function body limit instead of Next's 1 MB default (anything larger would be
|
|
31
|
+
* rejected by the platform with `413 FUNCTION_PAYLOAD_TOO_LARGE` regardless of this setting).
|
|
32
|
+
*/
|
|
33
|
+
export const config = {
|
|
34
|
+
api: {
|
|
35
|
+
bodyParser: {
|
|
36
|
+
sizeLimit: '4.5mb',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleAssetCollectionRoute } from '@/lib/registry-api/asset-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `/api/registry/transfer/assets/:collection`: the asset collection manifest endpoint.
|
|
6
|
+
*
|
|
7
|
+
* - `GET` is checkout: the collection's manifest metadata (bodies travel separately as blobs).
|
|
8
|
+
* - `PUT` is publish ingestion: validates the manifest, asserts referenced blobs exist, and
|
|
9
|
+
* atomically replaces the collection's manifest. Requires the bearer token.
|
|
10
|
+
*
|
|
11
|
+
* Both are registry-runtime only (enforced by the guard stack).
|
|
12
|
+
*/
|
|
13
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
14
|
+
return handleAssetCollectionRoute(req, res);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Manifests are metadata-only but can be large for big collections, so allow up to the 4.5 MB limit. */
|
|
18
|
+
export const config = {
|
|
19
|
+
api: {
|
|
20
|
+
bodyParser: {
|
|
21
|
+
sizeLimit: '4.5mb',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleAssetBlobRoute } from '@/lib/registry-api/asset-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `/api/registry/transfer/assets/blobs/:hash`: one content-addressed blob.
|
|
6
|
+
*
|
|
7
|
+
* - `PUT` stores the raw binary body through the active storage provider (inline `bytea` by default,
|
|
8
|
+
* or an object-storage adapter). Idempotent by hash; requires the bearer token.
|
|
9
|
+
* - `GET` returns the blob's bytes, or redirects to a provider URL for object-backed content.
|
|
10
|
+
*
|
|
11
|
+
* Registry-runtime only (guard stack).
|
|
12
|
+
*/
|
|
13
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
14
|
+
return handleAssetBlobRoute(req, res);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Blobs are binary, so the JSON body parser is disabled and the raw bytes reach the handler intact. */
|
|
18
|
+
export const config = {
|
|
19
|
+
api: {
|
|
20
|
+
bodyParser: false,
|
|
21
|
+
responseLimit: false,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleAssetBlobHaveRoute } from '@/lib/registry-api/asset-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `POST /api/registry/transfer/assets/blobs/have`: given `{ hashes }`, return `{ missing }`, the
|
|
6
|
+
* content hashes the registry does not yet have, so publish uploads only new blobs. Requires the
|
|
7
|
+
* bearer token; registry-runtime only.
|
|
8
|
+
*/
|
|
9
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
10
|
+
return handleAssetBlobHaveRoute(req, res);
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleAssetSummaryRoute } from '@/lib/registry-api/asset-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/transfer/assets`: list asset collection summaries (collection + source hash)
|
|
6
|
+
* for the CLI's skip-unchanged / bulk-checkout logic. Registry-runtime only (guard stack).
|
|
7
|
+
*/
|
|
8
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
9
|
+
return handleAssetSummaryRoute(req, res);
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleTokenCheckoutRoute, handleTokenTransferRoute } from '@/lib/registry-api/token-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `/api/registry/transfer/tokens/:setId` — the token-set transfer endpoint. The catch-all param
|
|
6
|
+
* carries the multi-segment logical set id (`foundation/colors`, `component/button`).
|
|
7
|
+
*
|
|
8
|
+
* - `GET` is checkout: the set record + its generated artifacts. Unauthenticated read.
|
|
9
|
+
* - `PUT` is publish ingestion: validates the package and atomically upserts the set + its artifacts.
|
|
10
|
+
* Requires the bearer token.
|
|
11
|
+
*
|
|
12
|
+
* Both are registry-runtime only (enforced by the guard stack).
|
|
13
|
+
*/
|
|
14
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
15
|
+
const method = (req.method ?? 'GET').toUpperCase();
|
|
16
|
+
return method === 'GET' ? handleTokenCheckoutRoute(req, res) : handleTokenTransferRoute(req, res);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Token packages carry generated artifact content, so accept up to Vercel's 4.5 MB function body limit. */
|
|
20
|
+
export const config = {
|
|
21
|
+
api: {
|
|
22
|
+
bodyParser: {
|
|
23
|
+
sizeLimit: '4.5mb',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { handleTokenSummaryRoute } from '@/lib/registry-api/token-transfer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `GET /api/registry/transfer/tokens` — list the registry's token-set summaries (id + kind + source
|
|
6
|
+
* hash + status) so a connected workspace can skip unchanged sets and enumerate sets for bulk
|
|
7
|
+
* checkout. Registry-runtime only (enforced by the guard stack).
|
|
8
|
+
*/
|
|
9
|
+
export default function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
|
|
10
|
+
return handleTokenSummaryRoute(req, res);
|
|
11
|
+
}
|
|
@@ -11,7 +11,11 @@ import remarkGfm from 'remark-gfm';
|
|
|
11
11
|
import Footer from '../../components/Footer';
|
|
12
12
|
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
13
13
|
import Header from '../../components/old/Header';
|
|
14
|
-
import { fetchDocPageMarkdown, FontDocumentationProps, getClientRuntimeConfig
|
|
14
|
+
import { buildTimeFoundationDesign, fetchDocPageMarkdown, FontDocumentationProps, getClientRuntimeConfig } from '../../components/util';
|
|
15
|
+
import { useFoundationTokens } from '../../components/util/useFoundationTokens';
|
|
16
|
+
|
|
17
|
+
const basePath = process.env.HANDOFF_APP_BASE_PATH ?? '';
|
|
18
|
+
const isRegistry = process.env.HANDOFF_RUNTIME_MODE === 'registry';
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* This statically renders content from the markdown, creating menu and providing
|
|
@@ -22,23 +26,21 @@ import { fetchDocPageMarkdown, FontDocumentationProps, getClientRuntimeConfig, g
|
|
|
22
26
|
* @returns
|
|
23
27
|
*/
|
|
24
28
|
export const getStaticProps: GetStaticProps = async () => {
|
|
25
|
-
|
|
26
|
-
path.resolve(process.env.HANDOFF_MODULE_PATH ?? '', '.handoff', `${process.env.HANDOFF_PROJECT_ID}`, 'public', 'fonts')
|
|
27
|
-
);
|
|
29
|
+
// Workspace/static reads the mirrored font archives; a registry build has none (hydrated at runtime).
|
|
28
30
|
const customFonts: string[] = [];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const name = font.replace('.zip', '');
|
|
34
|
-
customFonts.push(name);
|
|
31
|
+
try {
|
|
32
|
+
const fontDir = path.resolve(process.env.HANDOFF_MODULE_PATH ?? '', '.handoff', `${process.env.HANDOFF_PROJECT_ID}`, 'public', 'fonts');
|
|
33
|
+
for (const font of fs.readdirSync(fontDir)) {
|
|
34
|
+
if (font.endsWith('.zip')) customFonts.push(font.replace('.zip', ''));
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
} catch {
|
|
37
|
+
// No local font archives (e.g. a registry build), so customFonts stays empty.
|
|
38
|
+
}
|
|
37
39
|
|
|
38
40
|
return {
|
|
39
41
|
props: {
|
|
40
|
-
...fetchDocPageMarkdown('docs/assets/', 'fonts', `/assets`).props,
|
|
41
|
-
design:
|
|
42
|
+
...(await fetchDocPageMarkdown('docs/assets/', 'fonts', `/assets`)).props,
|
|
43
|
+
design: buildTimeFoundationDesign(),
|
|
42
44
|
config: getClientRuntimeConfig(),
|
|
43
45
|
customFonts,
|
|
44
46
|
},
|
|
@@ -46,12 +48,34 @@ export const getStaticProps: GetStaticProps = async () => {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
const FontsPage = ({ content, menu, metadata, customFonts, design, config }: FontDocumentationProps) => {
|
|
49
|
-
|
|
51
|
+
// Registry hydrates typography tokens (for the family list) + the published font archives at runtime.
|
|
52
|
+
const tokens = useFoundationTokens('typography', { design });
|
|
53
|
+
const [hydratedFonts, setHydratedFonts] = React.useState<string[]>(customFonts);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (!isRegistry) return;
|
|
56
|
+
let active = true;
|
|
57
|
+
fetch(`${basePath}/api/docs/assets/fonts`)
|
|
58
|
+
.then((res) => (res.ok ? res.json() : null))
|
|
59
|
+
.then((data) => {
|
|
60
|
+
if (!active || !data?.assets) return;
|
|
61
|
+
const names = (data.assets as { path: string }[])
|
|
62
|
+
.filter((a) => typeof a.path === 'string' && /^fonts\/.+\.zip$/i.test(a.path))
|
|
63
|
+
.map((a) => a.path.slice('fonts/'.length).replace(/\.zip$/i, ''));
|
|
64
|
+
setHydratedFonts(names);
|
|
65
|
+
})
|
|
66
|
+
.catch(() => {});
|
|
67
|
+
return () => {
|
|
68
|
+
active = false;
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const typography = tokens.design?.typography ?? [];
|
|
73
|
+
const fontFamilies: string[] = uniq(typography.map((type) => type.values.fontFamily));
|
|
50
74
|
const fontLinks: string[] = fontFamilies.map((fontFamily) => {
|
|
51
75
|
const machineName = fontFamily.replace(/\s/g, '');
|
|
52
|
-
const custom =
|
|
76
|
+
const custom = hydratedFonts.find((font) => font === machineName);
|
|
53
77
|
if (custom) {
|
|
54
|
-
return `/fonts/${machineName}.zip`;
|
|
78
|
+
return isRegistry ? `${basePath}/api/docs/assets/fonts/fonts/${machineName}.zip` : `/fonts/${machineName}.zip`;
|
|
55
79
|
}
|
|
56
80
|
return `https://fonts.google.com/specimen/${fontFamily}`;
|
|
57
81
|
});
|
|
@@ -61,7 +85,7 @@ const FontsPage = ({ content, menu, metadata, customFonts, design, config }: Fon
|
|
|
61
85
|
<title>{metadata.metaTitle}</title>
|
|
62
86
|
<meta name="description" content={metadata.metaDescription} />
|
|
63
87
|
</Head>
|
|
64
|
-
<Header
|
|
88
|
+
<Header config={config} />
|
|
65
89
|
<section className="c-content">
|
|
66
90
|
<div className="o-container-fluid">
|
|
67
91
|
<div className="c-hero">
|
|
@@ -21,7 +21,7 @@ import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from
|
|
|
21
21
|
export const getStaticProps: GetStaticProps = async () => {
|
|
22
22
|
return {
|
|
23
23
|
props: {
|
|
24
|
-
...fetchDocPageMarkdown('docs/', 'assets', `/assets`).props,
|
|
24
|
+
...(await fetchDocPageMarkdown('docs/', 'assets', `/assets`)).props,
|
|
25
25
|
config: getClientRuntimeConfig(),
|
|
26
26
|
},
|
|
27
27
|
};
|
|
@@ -34,7 +34,7 @@ const AssetsPage = ({ content, menu, metadata, config }: DocumentationProps) =>
|
|
|
34
34
|
<title>{metadata.metaTitle}</title>
|
|
35
35
|
<meta name="description" content={metadata.metaDescription} />
|
|
36
36
|
</Head>
|
|
37
|
-
<Header
|
|
37
|
+
<Header config={config} />
|
|
38
38
|
<section className="c-content">
|
|
39
39
|
<div className="o-container-fluid">
|
|
40
40
|
<div className="c-hero c-hero--boxed c-hero--bg-red">
|
|
@@ -6,6 +6,7 @@ import rehypeRaw from 'rehype-raw';
|
|
|
6
6
|
import remarkGfm from 'remark-gfm';
|
|
7
7
|
import Footer from '../../components/Footer';
|
|
8
8
|
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
9
|
+
import { buildAssetDownloadUrl } from '@handoff/artifacts/url';
|
|
9
10
|
import Header from '../../components/old/Header';
|
|
10
11
|
import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from '../../components/util';
|
|
11
12
|
|
|
@@ -20,7 +21,7 @@ import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from
|
|
|
20
21
|
export const getStaticProps: GetStaticProps = async () => {
|
|
21
22
|
return {
|
|
22
23
|
props: {
|
|
23
|
-
...fetchDocPageMarkdown('docs/assets/', 'logos', `/assets`).props,
|
|
24
|
+
...(await fetchDocPageMarkdown('docs/assets/', 'logos', `/assets`)).props,
|
|
24
25
|
config: getClientRuntimeConfig(),
|
|
25
26
|
},
|
|
26
27
|
};
|
|
@@ -33,7 +34,7 @@ const AssetsLogosPage = ({ content, menu, metadata, config }: DocumentationProps
|
|
|
33
34
|
<title>{metadata.metaTitle}</title>
|
|
34
35
|
<meta name="description" content={metadata.metaDescription} />
|
|
35
36
|
</Head>
|
|
36
|
-
<Header
|
|
37
|
+
<Header config={config} />
|
|
37
38
|
<section className="c-content">
|
|
38
39
|
<div className="o-container-fluid">
|
|
39
40
|
<div className="c-hero">
|
|
@@ -52,7 +53,9 @@ const AssetsLogosPage = ({ content, menu, metadata, config }: DocumentationProps
|
|
|
52
53
|
<h4>{config?.app?.client} Logo</h4>
|
|
53
54
|
<p>Vector files of approved {config?.app?.client} logos.</p>
|
|
54
55
|
<p>
|
|
55
|
-
<a href={config?.assets_zip_links?.logos ?? '
|
|
56
|
+
<a href={config?.assets_zip_links?.logos ?? buildAssetDownloadUrl('logos', process.env.HANDOFF_APP_BASE_PATH)} download>
|
|
57
|
+
Download Logos
|
|
58
|
+
</a>
|
|
56
59
|
</p>
|
|
57
60
|
</div>
|
|
58
61
|
</div>
|
|
@@ -12,7 +12,8 @@ import AnchorNav from '../../components/Navigation/AnchorNav';
|
|
|
12
12
|
import PrevNextNav from '../../components/Navigation/PrevNextNav';
|
|
13
13
|
import HeadersType from '../../components/Typography/Headers';
|
|
14
14
|
import * as util from '../../components/util';
|
|
15
|
-
import { getTokens } from '../../components/util';
|
|
15
|
+
import { buildTimeFoundationDesign, getTokens } from '../../components/util';
|
|
16
|
+
import { useFoundationTokens } from '../../components/util/useFoundationTokens';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* This statically renders content from the markdown, creating menu and providing
|
|
@@ -25,9 +26,9 @@ import { getTokens } from '../../components/util';
|
|
|
25
26
|
export const getStaticProps: GetStaticProps = async () => {
|
|
26
27
|
return {
|
|
27
28
|
props: {
|
|
28
|
-
...util.fetchFoundationDocPageMarkdown('docs/foundations/', 'colors', `/foundations`).props,
|
|
29
|
+
...(await util.fetchFoundationDocPageMarkdown('docs/foundations/', 'colors', `/foundations`)).props,
|
|
29
30
|
config: util.getClientRuntimeConfig(),
|
|
30
|
-
design:
|
|
31
|
+
design: buildTimeFoundationDesign(),
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
};
|
|
@@ -37,13 +38,22 @@ const ColorsPage = ({
|
|
|
37
38
|
menu,
|
|
38
39
|
metadata,
|
|
39
40
|
current,
|
|
40
|
-
scss,
|
|
41
|
-
css,
|
|
42
|
-
styleDictionary,
|
|
43
|
-
types,
|
|
44
|
-
design,
|
|
41
|
+
scss: scssProp,
|
|
42
|
+
css: cssProp,
|
|
43
|
+
styleDictionary: styleDictionaryProp,
|
|
44
|
+
types: typesProp,
|
|
45
|
+
design: designProp,
|
|
45
46
|
config,
|
|
46
47
|
}: util.FoundationDocumentationProps) => {
|
|
48
|
+
// In registry mode the build-time token data/downloads are empty; hydrate from the docs read API.
|
|
49
|
+
const { design, css, scss, styleDictionary, types } = useFoundationTokens('colors', {
|
|
50
|
+
design: designProp,
|
|
51
|
+
css: cssProp,
|
|
52
|
+
scss: scssProp,
|
|
53
|
+
styleDictionary: styleDictionaryProp,
|
|
54
|
+
types: typesProp,
|
|
55
|
+
});
|
|
56
|
+
|
|
47
57
|
const colorGroups = Object.fromEntries(
|
|
48
58
|
Object.entries(groupBy(design.color, 'group'))
|
|
49
59
|
.map(([groupKey, colors]) => {
|
|
@@ -13,7 +13,8 @@ import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/Ma
|
|
|
13
13
|
import AnchorNav from '../../components/Navigation/AnchorNav';
|
|
14
14
|
import HeadersType from '../../components/Typography/Headers';
|
|
15
15
|
import * as util from '../../components/util';
|
|
16
|
-
import { getTokens } from '../../components/util';
|
|
16
|
+
import { buildTimeFoundationDesign, getTokens } from '../../components/util';
|
|
17
|
+
import { useFoundationTokens } from '../../components/util/useFoundationTokens';
|
|
17
18
|
|
|
18
19
|
type EffectParametersObject = CoreTypes.IEffectObject['effects'][number];
|
|
19
20
|
|
|
@@ -41,8 +42,8 @@ export const getStaticProps: GetStaticProps = async () => {
|
|
|
41
42
|
return {
|
|
42
43
|
props: {
|
|
43
44
|
config: util.getClientRuntimeConfig(),
|
|
44
|
-
...util.fetchFoundationDocPageMarkdown('docs/foundations/', 'effects', `/foundations`).props,
|
|
45
|
-
design:
|
|
45
|
+
...(await util.fetchFoundationDocPageMarkdown('docs/foundations/', 'effects', `/foundations`)).props,
|
|
46
|
+
design: buildTimeFoundationDesign(),
|
|
46
47
|
},
|
|
47
48
|
};
|
|
48
49
|
};
|
|
@@ -52,13 +53,22 @@ const EffectsPage = ({
|
|
|
52
53
|
menu,
|
|
53
54
|
metadata,
|
|
54
55
|
current,
|
|
55
|
-
css,
|
|
56
|
-
scss,
|
|
57
|
-
styleDictionary,
|
|
58
|
-
types,
|
|
59
|
-
design,
|
|
56
|
+
css: cssProp,
|
|
57
|
+
scss: scssProp,
|
|
58
|
+
styleDictionary: styleDictionaryProp,
|
|
59
|
+
types: typesProp,
|
|
60
|
+
design: designProp,
|
|
60
61
|
config,
|
|
61
62
|
}: util.FoundationDocumentationProps) => {
|
|
63
|
+
// In registry mode the build-time token data/downloads are empty; hydrate from the docs read API.
|
|
64
|
+
const { design, css, scss, styleDictionary, types } = useFoundationTokens('effects', {
|
|
65
|
+
design: designProp,
|
|
66
|
+
css: cssProp,
|
|
67
|
+
scss: scssProp,
|
|
68
|
+
styleDictionary: styleDictionaryProp,
|
|
69
|
+
types: typesProp,
|
|
70
|
+
});
|
|
71
|
+
|
|
62
72
|
const effectGroups = Object.fromEntries(
|
|
63
73
|
Object.entries(groupBy(design.effect, 'group')).map(([groupKey, effects]) => {
|
|
64
74
|
return [
|