bsmnt 0.10.0 → 0.11.0
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/dist/application/add-integration/index.js.map +1 -1
- package/dist/application/shared/node-version.js.map +1 -1
- package/dist/core/create/internal-ids.d.ts +3 -0
- package/dist/core/create/internal-ids.d.ts.map +1 -1
- package/dist/core/create/internal-ids.js +4 -0
- package/dist/core/create/internal-ids.js.map +1 -1
- package/dist/domain/agents.d.ts.map +1 -1
- package/dist/domain/animations.d.ts.map +1 -1
- package/dist/domain/cms.d.ts.map +1 -1
- package/dist/domain/forms.d.ts.map +1 -1
- package/dist/domain/hooks.d.ts.map +1 -1
- package/dist/domain/skills.d.ts.map +1 -1
- package/dist/domain/templates.d.ts +10 -0
- package/dist/domain/templates.d.ts.map +1 -1
- package/dist/domain/templates.js +5 -0
- package/dist/domain/templates.js.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/agents/register-sanity-mcp.js +3 -8
- package/dist/infrastructure/agents/register-sanity-mcp.js.map +1 -1
- package/dist/infrastructure/agents/register-storybook-mcp.d.ts +18 -0
- package/dist/infrastructure/agents/register-storybook-mcp.d.ts.map +1 -0
- package/dist/infrastructure/agents/register-storybook-mcp.js +157 -0
- package/dist/infrastructure/agents/register-storybook-mcp.js.map +1 -0
- package/dist/infrastructure/create/lifecycle-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/lifecycle-registry.js +39 -1
- package/dist/infrastructure/create/lifecycle-registry.js.map +1 -1
- package/dist/infrastructure/create/merge-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/merge-registry.js +4 -0
- package/dist/infrastructure/create/merge-registry.js.map +1 -1
- package/dist/infrastructure/create/sanity-auth.js.map +1 -1
- package/dist/infrastructure/create/setup-agent.d.ts +6 -1
- package/dist/infrastructure/create/setup-agent.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-agent.js +23 -21
- package/dist/infrastructure/create/setup-agent.js.map +1 -1
- package/dist/infrastructure/create/setup-dotenvx.js.map +1 -1
- package/dist/infrastructure/create/setup-remote.js.map +1 -1
- package/dist/infrastructure/create/setup-sanity.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-sanity.js +12 -1
- package/dist/infrastructure/create/setup-sanity.js.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.d.ts.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.js +2 -0
- package/dist/infrastructure/integrations/inject-integration.js.map +1 -1
- package/dist/infrastructure/update/notifier.js.map +1 -1
- package/dist/modules/features/cms/index.d.ts.map +1 -1
- package/dist/modules/features/cms/index.js +2 -0
- package/dist/modules/features/cms/index.js.map +1 -1
- package/dist/modules/features/cms/sanity/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/config.js +1 -0
- package/dist/modules/features/cms/sanity/config.js.map +1 -1
- package/dist/modules/features/cms/sanity/index.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/index.js +10 -1
- package/dist/modules/features/cms/sanity/index.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/check-integration.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/check-integration.js +15 -6
- package/dist/modules/features/cms/sanity/mergers/check-integration.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/knip.js +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/layout.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/package-json.d.ts +12 -0
- package/dist/modules/features/cms/sanity/mergers/package-json.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/package-json.js +19 -0
- package/dist/modules/features/cms/sanity/mergers/package-json.js.map +1 -0
- package/dist/modules/features/cms/sanity-pagebuilder/index.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/index.js +7 -1
- package/dist/modules/features/cms/sanity-pagebuilder/index.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder-cache/config.d.ts +14 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/config.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/config.js +50 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/config.js.map +1 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/index.d.ts +3 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/index.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/index.js +55 -0
- package/dist/modules/features/cms/sanity-pagebuilder-cache/index.js.map +1 -0
- package/dist/modules/presets/index.d.ts.map +1 -1
- package/dist/modules/presets/index.js +2 -0
- package/dist/modules/presets/index.js.map +1 -1
- package/dist/modules/presets/next-pagebuilder-cache.d.ts +3 -0
- package/dist/modules/presets/next-pagebuilder-cache.d.ts.map +1 -0
- package/dist/modules/presets/next-pagebuilder-cache.js +10 -0
- package/dist/modules/presets/next-pagebuilder-cache.js.map +1 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +6 -0
- package/dist/paths.js.map +1 -1
- package/package.json +5 -2
- package/src/modules/features/cms/sanity/files/lib/integrations/check-integration.ts +7 -6
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/README.md +1 -1
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/components/rich-text.tsx +1 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/env.ts +2 -2
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/[[...slug]]/route.ts +4 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/revalidate/route.ts +172 -24
- package/src/modules/features/cms/sanity-pagebuilder/files/app/feed.xml/route.ts +14 -7
- package/src/modules/features/cms/sanity-pagebuilder/files/app/sitemap.md/route.ts +2 -2
- package/src/modules/features/cms/sanity-pagebuilder/files/app/studio/[[...tool]]/page.tsx +16 -1
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/rich-text.tsx +1 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/visual-editing.tsx +2 -2
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/check-integration.ts +6 -5
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/client.ts +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-notices.tsx +6 -16
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/env.ts +2 -2
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/layout.ts +22 -52
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/icons.ts +2 -2
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/live/index.tsx +3 -1
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-builder-config.ts +7 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-tree-pane.tsx +70 -57
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/queries.ts +119 -29
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/revalidate-paths.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/index.ts +1 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/rich-text-block.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/index.ts +2 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page.ts +12 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/tags.ts +56 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-builder-markdown.ts +12 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/sitemap.ts +11 -8
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/.knip.json +8 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/api/[[...slug]]/route.ts +112 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/api/draft-mode/disable/route.ts +7 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/api/draft-mode/enable/route.ts +20 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/api/revalidate/route.ts +292 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/feed.xml/route.ts +66 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/sitemap.md/route.ts +132 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/studio/[[...tool]]/layout.tsx +26 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/app/studio/[[...tool]]/page.tsx +23 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/components/sanity/draft-mode-toggle.tsx +27 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/components/sanity/rich-text.tsx +88 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/components/sanity/visual-editing.tsx +11 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/components/ui/sanity-image/index.tsx +51 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/check-integration.ts +6 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/client.ts +37 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/block-actions-item.tsx +81 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/disable-draft-mode.tsx +23 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/page-builder-input.tsx +39 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/page-category-input.tsx +50 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/same-as-input.tsx +66 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/slug-field.tsx +24 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/slug-input.tsx +14 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/components/slug-notices.tsx +125 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/confirm-publish-action.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/env.ts +34 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/fetchers/layout.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/fetchers/redirects.ts +22 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/icons.ts +81 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/live/index.tsx +140 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/markdown-proxy.config.ts +50 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/page-builder-config.ts +144 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/page-category.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/page-tree-pane.tsx +431 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/pinned-pages.ts +54 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/presentation.ts +119 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/queries.ts +548 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/revalidate-paths.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/sanity.cli.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/sanity.config.ts +116 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/index.ts +6 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/reusable/blog-content.ts +89 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/reusable/description.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/reusable/gated-content.ts +178 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/reusable/hero.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/reusable/rich-text-block.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/components/singleton/content-collection.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/content/author.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/content/blog-category.ts +55 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/index.ts +134 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/layout/company-data.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/layout/footer.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/layout/navbar.ts +75 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/layout/redirect.ts +152 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/layout/structured-data.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/link.ts +125 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/logo-field.ts +9 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/metadata.ts +132 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/nav-objects.ts +192 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/page-builder.ts +43 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/page-folder.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/page.ts +265 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/richText.ts +63 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/schemas/shared/structured-data-blocks.ts +436 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/singletons.ts +51 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/structure.ts +334 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/tags.ts +89 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/utils/image.ts +8 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/utils/link.ts +140 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/utils/page-builder-markdown.ts +113 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/integrations/sanity/utils/page-json-ld.ts +208 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/scripts/sanity-typegen.ts +36 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/utils/check-redirect.ts +30 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/utils/json-ld.tsx +522 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/utils/metadata.ts +189 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/lib/utils/sitemap.ts +58 -0
- package/src/modules/features/cms/sanity-pagebuilder-cache/files/proxy.ts +90 -0
- package/src/modules/features/env/dotenvx/files/vercelignore +5 -0
- package/src/templates/next-default/.env.example +2 -2
- package/src/templates/next-default/.github/workflows/ci.yml +1 -1
- package/src/templates/next-default/.vscode/settings.json +0 -2
- package/src/templates/next-default/components/ui/image/index.tsx +2 -4
- package/src/templates/next-default/knip.json +1 -1
- package/src/templates/next-default/lefthook.yml +1 -1
- package/src/templates/next-default/lib/utils/README.md +18 -5
- package/src/templates/next-default/lib/utils/image-sizes.ts +72 -0
- package/src/templates/next-default/lib/utils/merge-refs.ts +56 -0
- package/src/templates/next-default/lib/utils/strings.ts +1 -51
- package/src/templates/next-default/next.config.ts +2 -3
- package/src/templates/next-default/package.json +2 -5
- package/src/templates/next-experiments/.env.example +2 -2
- package/src/templates/next-experiments/.github/workflows/ci.yml +1 -1
- package/src/templates/next-experiments/.vscode/settings.json +0 -2
- package/src/templates/next-experiments/app/page.tsx +1 -1
- package/src/templates/next-experiments/components/ui/image/index.tsx +2 -4
- package/src/templates/next-experiments/knip.json +1 -1
- package/src/templates/next-experiments/lefthook.yml +1 -1
- package/src/templates/next-experiments/lib/utils/README.md +18 -5
- package/src/templates/next-experiments/lib/utils/image-sizes.ts +72 -0
- package/src/templates/next-experiments/lib/utils/merge-refs.ts +56 -0
- package/src/templates/next-experiments/lib/utils/strings.ts +1 -51
- package/src/templates/next-experiments/next.config.ts +2 -3
- package/src/templates/next-experiments/package.json +2 -5
- package/src/templates/next-pagebuilder/.env.example +1 -0
- package/src/templates/next-pagebuilder/.github/workflows/ci.yml +1 -1
- package/src/templates/next-pagebuilder/.vscode/settings.json +0 -2
- package/src/templates/next-pagebuilder/README.md +64 -0
- package/src/templates/next-pagebuilder/app/sitemap.xml/route.ts +3 -1
- package/src/templates/next-pagebuilder/biome.json +2 -1
- package/src/templates/next-pagebuilder/components/layout/footer/index.tsx +3 -6
- package/src/templates/next-pagebuilder/components/layout/header/index.tsx +3 -2
- package/src/templates/next-pagebuilder/components/layout/json-ld/index.tsx +3 -8
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/content-filters.tsx +23 -40
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/index.tsx +88 -58
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/skeleton.tsx +4 -16
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/types.ts +14 -1
- package/src/templates/next-pagebuilder/components/page-builder/components/rich-text-block.tsx +16 -0
- package/src/templates/next-pagebuilder/components/page-builder/renderer.tsx +21 -7
- package/src/templates/next-pagebuilder/components/page-document/index.tsx +1 -0
- package/src/templates/next-pagebuilder/components/ui/image/index.tsx +2 -1
- package/src/templates/next-pagebuilder/knip.json +3 -2
- package/src/templates/next-pagebuilder/lefthook.yml +1 -1
- package/src/templates/next-pagebuilder/lib/integrations/sanity/sanity.types.ts +1221 -977
- package/src/templates/next-pagebuilder/lib/utils/image-sizes.ts +72 -0
- package/src/templates/next-pagebuilder/lib/utils/merge-refs.ts +56 -0
- package/src/templates/next-pagebuilder/next.config.ts +2 -3
- package/src/templates/next-pagebuilder/package.json +4 -6
- package/src/templates/next-pagebuilder-cache/.biome/plugins/README.md +21 -0
- package/src/templates/next-pagebuilder-cache/.biome/plugins/no-anchor-element.grit +12 -0
- package/src/templates/next-pagebuilder-cache/.biome/plugins/no-relative-parent-imports.grit +10 -0
- package/src/templates/next-pagebuilder-cache/.biome/plugins/no-unnecessary-forwardref.grit +9 -0
- package/src/templates/next-pagebuilder-cache/.env.example +40 -0
- package/src/templates/next-pagebuilder-cache/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- package/src/templates/next-pagebuilder-cache/.github/workflows/ci.yml +105 -0
- package/src/templates/next-pagebuilder-cache/.vscode/extensions.json +19 -0
- package/src/templates/next-pagebuilder-cache/.vscode/settings.json +103 -0
- package/src/templates/next-pagebuilder-cache/.zed/settings.json +47 -0
- package/src/templates/next-pagebuilder-cache/README.md +212 -0
- package/src/templates/next-pagebuilder-cache/_gitignore +65 -0
- package/src/templates/next-pagebuilder-cache/app/(content)/[[...slug]]/page.tsx +124 -0
- package/src/templates/next-pagebuilder-cache/app/(content)/layout.tsx +28 -0
- package/src/templates/next-pagebuilder-cache/app/actions/unlock-gated-content.ts +53 -0
- package/src/templates/next-pagebuilder-cache/app/favicon.ico +0 -0
- package/src/templates/next-pagebuilder-cache/app/layout.tsx +83 -0
- package/src/templates/next-pagebuilder-cache/app/robots.ts +13 -0
- package/src/templates/next-pagebuilder-cache/app/sitemap.xml/route.ts +84 -0
- package/src/templates/next-pagebuilder-cache/biome.json +257 -0
- package/src/templates/next-pagebuilder-cache/components/layout/footer/index.tsx +127 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/components/cta-button.tsx +28 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/components/mega-menu-panel.tsx +90 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/components/nav-item-renderer.tsx +98 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/components/nav-leaf-item.tsx +33 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/components/types.ts +7 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/header-client.tsx +110 -0
- package/src/templates/next-pagebuilder-cache/components/layout/header/index.tsx +32 -0
- package/src/templates/next-pagebuilder-cache/components/layout/json-ld/index.tsx +79 -0
- package/src/templates/next-pagebuilder-cache/components/layout/wrapper/index.tsx +33 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/article-content/index.tsx +78 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/article-content/related-post-item.tsx +27 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/content-card.tsx +66 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/content-filters.tsx +76 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/content-grid.tsx +40 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/content-pagination-nav.tsx +71 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/index.tsx +306 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/skeleton.tsx +41 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/content-collection/types.ts +32 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/description.tsx +17 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/gated-content/index.tsx +169 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/hero.tsx +17 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/components/rich-text-block.tsx +16 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/renderer.tsx +71 -0
- package/src/templates/next-pagebuilder-cache/components/page-builder/types.ts +25 -0
- package/src/templates/next-pagebuilder-cache/components/page-document/index.tsx +147 -0
- package/src/templates/next-pagebuilder-cache/components/ui/image/index.tsx +216 -0
- package/src/templates/next-pagebuilder-cache/components/ui/link/index.tsx +152 -0
- package/src/templates/next-pagebuilder-cache/components.json +24 -0
- package/src/templates/next-pagebuilder-cache/knip.json +35 -0
- package/src/templates/next-pagebuilder-cache/lefthook.yml +25 -0
- package/src/templates/next-pagebuilder-cache/lib/integrations/sanity/sanity.types.ts +1588 -0
- package/src/templates/next-pagebuilder-cache/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/templates/next-pagebuilder-cache/lib/styles/cn.ts +5 -0
- package/src/templates/next-pagebuilder-cache/lib/styles/global.css +69 -0
- package/src/templates/next-pagebuilder-cache/lib/utils/base-url.ts +17 -0
- package/src/templates/next-pagebuilder-cache/lib/utils/format-date.ts +8 -0
- package/src/templates/next-pagebuilder-cache/lib/utils/slug-tag.ts +6 -0
- package/src/templates/next-pagebuilder-cache/next.config.ts +176 -0
- package/src/templates/next-pagebuilder-cache/package.json +62 -0
- package/src/templates/next-pagebuilder-cache/postcss.config.mjs +65 -0
- package/src/templates/next-pagebuilder-cache/svg.d.ts +6 -0
- package/src/templates/next-pagebuilder-cache/tsconfig.json +38 -0
- package/src/templates/next-webgl/.env.example +2 -2
- package/src/templates/next-webgl/.github/workflows/ci.yml +1 -1
- package/src/templates/next-webgl/.vscode/settings.json +0 -2
- package/src/templates/next-webgl/components/ui/image/index.tsx +2 -4
- package/src/templates/next-webgl/knip.json +1 -1
- package/src/templates/next-webgl/lefthook.yml +1 -1
- package/src/templates/next-webgl/lib/utils/README.md +18 -5
- package/src/templates/next-webgl/lib/utils/image-sizes.ts +72 -0
- package/src/templates/next-webgl/lib/utils/merge-refs.ts +56 -0
- package/src/templates/next-webgl/lib/utils/strings.ts +1 -51
- package/src/templates/next-webgl/next.config.ts +2 -3
- package/src/templates/next-webgl/package.json +4 -7
- package/src/templates/next-experiments/tsconfig.tsbuildinfo +0 -1
- package/src/templates/next-pagebuilder/app/actions/refresh.ts +0 -5
- package/src/templates/next-webgl/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
import { authorIcon } from "@/lib/integrations/sanity/icons";
|
|
3
|
+
|
|
4
|
+
export const author = defineType({
|
|
5
|
+
name: "author",
|
|
6
|
+
title: "Author",
|
|
7
|
+
type: "document",
|
|
8
|
+
icon: authorIcon,
|
|
9
|
+
fields: [
|
|
10
|
+
defineField({
|
|
11
|
+
name: "name",
|
|
12
|
+
title: "Name",
|
|
13
|
+
type: "string",
|
|
14
|
+
validation: (Rule) => Rule.required(),
|
|
15
|
+
}),
|
|
16
|
+
defineField({
|
|
17
|
+
name: "avatar",
|
|
18
|
+
title: "Avatar",
|
|
19
|
+
type: "image",
|
|
20
|
+
options: {
|
|
21
|
+
hotspot: true,
|
|
22
|
+
},
|
|
23
|
+
fields: [
|
|
24
|
+
{
|
|
25
|
+
name: "alt",
|
|
26
|
+
title: "Alt Text",
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Alternative text for screen readers",
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
validation: (Rule) => Rule.required(),
|
|
32
|
+
}),
|
|
33
|
+
defineField({
|
|
34
|
+
name: "role",
|
|
35
|
+
title: "Role",
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Job title or role (e.g. CEO, Engineering Lead)",
|
|
38
|
+
}),
|
|
39
|
+
defineField({
|
|
40
|
+
name: "description",
|
|
41
|
+
title: "Description",
|
|
42
|
+
type: "text",
|
|
43
|
+
rows: 3,
|
|
44
|
+
description: "Short bio displayed on blog articles",
|
|
45
|
+
}),
|
|
46
|
+
defineField({
|
|
47
|
+
name: "linkedInUrl",
|
|
48
|
+
title: "LinkedIn URL",
|
|
49
|
+
type: "url",
|
|
50
|
+
validation: (Rule) =>
|
|
51
|
+
Rule.uri({
|
|
52
|
+
scheme: ["https"],
|
|
53
|
+
}),
|
|
54
|
+
}),
|
|
55
|
+
],
|
|
56
|
+
preview: {
|
|
57
|
+
select: {
|
|
58
|
+
title: "name",
|
|
59
|
+
subtitle: "role",
|
|
60
|
+
media: "avatar",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
orderings: [
|
|
64
|
+
{
|
|
65
|
+
title: "Name A-Z",
|
|
66
|
+
name: "nameAsc",
|
|
67
|
+
by: [{ field: "name", direction: "asc" }],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
import { blogCategoryIcon } from "@/lib/integrations/sanity/icons";
|
|
3
|
+
|
|
4
|
+
export const blogCategory = defineType({
|
|
5
|
+
name: "blogCategory",
|
|
6
|
+
title: "Blog Category",
|
|
7
|
+
type: "document",
|
|
8
|
+
icon: blogCategoryIcon,
|
|
9
|
+
fields: [
|
|
10
|
+
defineField({
|
|
11
|
+
name: "title",
|
|
12
|
+
title: "Title",
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "Category name (e.g. AI, Product Updates, Engineering)",
|
|
15
|
+
validation: (Rule) => Rule.required(),
|
|
16
|
+
}),
|
|
17
|
+
defineField({
|
|
18
|
+
name: "slug",
|
|
19
|
+
title: "Slug",
|
|
20
|
+
type: "slug",
|
|
21
|
+
description: "URL-friendly identifier used for filtering",
|
|
22
|
+
options: {
|
|
23
|
+
source: "title",
|
|
24
|
+
maxLength: 96,
|
|
25
|
+
},
|
|
26
|
+
validation: (Rule) =>
|
|
27
|
+
Rule.required().custom((slug) => {
|
|
28
|
+
if (!slug?.current) return "Required";
|
|
29
|
+
if (!/^[a-z0-9-]+$/.test(slug.current)) {
|
|
30
|
+
return "Slug must be lowercase with hyphens only";
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
defineField({
|
|
36
|
+
name: "description",
|
|
37
|
+
title: "Description",
|
|
38
|
+
type: "text",
|
|
39
|
+
rows: 2,
|
|
40
|
+
description: "Brief description of this category",
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
preview: {
|
|
44
|
+
select: {
|
|
45
|
+
title: "title",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
orderings: [
|
|
49
|
+
{
|
|
50
|
+
title: "Title A-Z",
|
|
51
|
+
name: "titleAsc",
|
|
52
|
+
by: [{ field: "title", direction: "asc" }],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanity Schema Types
|
|
3
|
+
*
|
|
4
|
+
* All schema definitions for Sanity CMS.
|
|
5
|
+
* Shared schemas live in `schemas/shared`, content documents live in
|
|
6
|
+
* `schemas/content`, component documents live in `schemas/components`, and
|
|
7
|
+
* layout documents live in `schemas/layout`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { SchemaTypeDefinition } from "sanity";
|
|
11
|
+
import {
|
|
12
|
+
blogCollection,
|
|
13
|
+
blogContent,
|
|
14
|
+
description,
|
|
15
|
+
gatedContent,
|
|
16
|
+
hero,
|
|
17
|
+
richTextBlock,
|
|
18
|
+
} from "./components";
|
|
19
|
+
import { author } from "./content/author";
|
|
20
|
+
import { blogCategory } from "./content/blog-category";
|
|
21
|
+
import { companyData } from "./layout/company-data";
|
|
22
|
+
import { footer } from "./layout/footer";
|
|
23
|
+
import { navbar } from "./layout/navbar";
|
|
24
|
+
import { redirect } from "./layout/redirect";
|
|
25
|
+
import { structuredData } from "./layout/structured-data";
|
|
26
|
+
import { externalLink, link, pageReference } from "./shared/link";
|
|
27
|
+
import { metadata } from "./shared/metadata";
|
|
28
|
+
import {
|
|
29
|
+
navColumn,
|
|
30
|
+
navItem,
|
|
31
|
+
navLeafItem,
|
|
32
|
+
navMegaMenu,
|
|
33
|
+
} from "./shared/nav-objects";
|
|
34
|
+
import { page } from "./shared/page";
|
|
35
|
+
import { pageBuilder } from "./shared/page-builder";
|
|
36
|
+
import { pageFolder } from "./shared/page-folder";
|
|
37
|
+
import { richText } from "./shared/richText";
|
|
38
|
+
import {
|
|
39
|
+
customJsonLd,
|
|
40
|
+
eventJsonLd,
|
|
41
|
+
faqJsonLd,
|
|
42
|
+
itemListJsonLd,
|
|
43
|
+
jobPostingJsonLd,
|
|
44
|
+
softwareApplicationJsonLd,
|
|
45
|
+
videoJsonLd,
|
|
46
|
+
} from "./shared/structured-data-blocks";
|
|
47
|
+
|
|
48
|
+
// Re-export all schemas for convenience
|
|
49
|
+
export {
|
|
50
|
+
author,
|
|
51
|
+
blogCategory,
|
|
52
|
+
blogCollection,
|
|
53
|
+
blogContent,
|
|
54
|
+
companyData,
|
|
55
|
+
customJsonLd,
|
|
56
|
+
description,
|
|
57
|
+
eventJsonLd,
|
|
58
|
+
externalLink,
|
|
59
|
+
faqJsonLd,
|
|
60
|
+
footer,
|
|
61
|
+
gatedContent,
|
|
62
|
+
hero,
|
|
63
|
+
itemListJsonLd,
|
|
64
|
+
jobPostingJsonLd,
|
|
65
|
+
link,
|
|
66
|
+
metadata,
|
|
67
|
+
navbar,
|
|
68
|
+
navColumn,
|
|
69
|
+
navItem,
|
|
70
|
+
navLeafItem,
|
|
71
|
+
navMegaMenu,
|
|
72
|
+
page,
|
|
73
|
+
pageBuilder,
|
|
74
|
+
pageFolder,
|
|
75
|
+
pageReference,
|
|
76
|
+
redirect,
|
|
77
|
+
richText,
|
|
78
|
+
softwareApplicationJsonLd,
|
|
79
|
+
structuredData,
|
|
80
|
+
videoJsonLd,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Schema collection for Sanity configuration
|
|
84
|
+
export const schema: { types: SchemaTypeDefinition[] } = {
|
|
85
|
+
types: [
|
|
86
|
+
// Object types (reusable field types)
|
|
87
|
+
pageReference,
|
|
88
|
+
externalLink,
|
|
89
|
+
link,
|
|
90
|
+
metadata,
|
|
91
|
+
pageBuilder,
|
|
92
|
+
richText,
|
|
93
|
+
|
|
94
|
+
// Page-level JSON-LD blocks (selectable in metadata)
|
|
95
|
+
faqJsonLd,
|
|
96
|
+
eventJsonLd,
|
|
97
|
+
videoJsonLd,
|
|
98
|
+
jobPostingJsonLd,
|
|
99
|
+
softwareApplicationJsonLd,
|
|
100
|
+
itemListJsonLd,
|
|
101
|
+
customJsonLd,
|
|
102
|
+
|
|
103
|
+
// Navigation object types (used by navbar)
|
|
104
|
+
navLeafItem,
|
|
105
|
+
navColumn,
|
|
106
|
+
navMegaMenu,
|
|
107
|
+
navItem,
|
|
108
|
+
|
|
109
|
+
// Component types (reusable document components)
|
|
110
|
+
blogCollection,
|
|
111
|
+
blogContent,
|
|
112
|
+
hero,
|
|
113
|
+
description,
|
|
114
|
+
richTextBlock,
|
|
115
|
+
gatedContent,
|
|
116
|
+
|
|
117
|
+
// Layout types (singletons for site-wide layout)
|
|
118
|
+
companyData,
|
|
119
|
+
navbar,
|
|
120
|
+
footer,
|
|
121
|
+
structuredData,
|
|
122
|
+
|
|
123
|
+
// Layout collections (managed lists, not singletons)
|
|
124
|
+
redirect,
|
|
125
|
+
|
|
126
|
+
// Document types (content pages)
|
|
127
|
+
page,
|
|
128
|
+
pageFolder,
|
|
129
|
+
|
|
130
|
+
// Content types (reusable content)
|
|
131
|
+
author,
|
|
132
|
+
blogCategory,
|
|
133
|
+
],
|
|
134
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineArrayMember, defineField, defineType } from "sanity";
|
|
2
|
+
import { socialLinksIcon } from "@/lib/integrations/sanity/icons";
|
|
3
|
+
|
|
4
|
+
export const companyData = defineType({
|
|
5
|
+
name: "companyData",
|
|
6
|
+
title: "Company Data",
|
|
7
|
+
type: "document",
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: "socialLinks",
|
|
11
|
+
title: "Social Links",
|
|
12
|
+
type: "array",
|
|
13
|
+
of: [
|
|
14
|
+
defineArrayMember({
|
|
15
|
+
type: "object",
|
|
16
|
+
icon: socialLinksIcon,
|
|
17
|
+
fields: [
|
|
18
|
+
defineField({
|
|
19
|
+
name: "name",
|
|
20
|
+
title: "Name",
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Platform name (e.g. LinkedIn, TikTok, Bluesky)",
|
|
23
|
+
validation: (Rule) => Rule.required(),
|
|
24
|
+
}),
|
|
25
|
+
defineField({
|
|
26
|
+
name: "icon",
|
|
27
|
+
title: "Icon",
|
|
28
|
+
type: "image",
|
|
29
|
+
description: "Platform icon (SVG, PNG, WebP, etc.)",
|
|
30
|
+
validation: (Rule) => Rule.required(),
|
|
31
|
+
}),
|
|
32
|
+
defineField({
|
|
33
|
+
name: "url",
|
|
34
|
+
title: "URL",
|
|
35
|
+
type: "url",
|
|
36
|
+
validation: (Rule) => Rule.required(),
|
|
37
|
+
}),
|
|
38
|
+
defineField({
|
|
39
|
+
name: "label",
|
|
40
|
+
title: "Label",
|
|
41
|
+
type: "string",
|
|
42
|
+
description:
|
|
43
|
+
"Accessible label for the link (e.g. 'Follow us on LinkedIn')",
|
|
44
|
+
}),
|
|
45
|
+
defineField({
|
|
46
|
+
name: "includeInStructuredData",
|
|
47
|
+
title: "Include in Structured Data",
|
|
48
|
+
type: "boolean",
|
|
49
|
+
description:
|
|
50
|
+
"Add this profile to the site's JSON-LD (schema.org sameAs) emitted for search engines.",
|
|
51
|
+
initialValue: false,
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
preview: {
|
|
55
|
+
select: {
|
|
56
|
+
title: "name",
|
|
57
|
+
subtitle: "url",
|
|
58
|
+
media: "icon",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
preview: {
|
|
66
|
+
prepare() {
|
|
67
|
+
return { title: "Company Data" };
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
|
|
3
|
+
export const footer = defineType({
|
|
4
|
+
name: "footer",
|
|
5
|
+
title: "Footer",
|
|
6
|
+
type: "document",
|
|
7
|
+
fields: [
|
|
8
|
+
defineField({
|
|
9
|
+
name: "links",
|
|
10
|
+
title: "Links",
|
|
11
|
+
description: "Navigation columns (e.g. Products, Solutions, Resources)",
|
|
12
|
+
type: "array",
|
|
13
|
+
of: [
|
|
14
|
+
{
|
|
15
|
+
type: "object",
|
|
16
|
+
fields: [
|
|
17
|
+
defineField({
|
|
18
|
+
name: "title",
|
|
19
|
+
title: "Title",
|
|
20
|
+
type: "string",
|
|
21
|
+
validation: (Rule) => Rule.required(),
|
|
22
|
+
}),
|
|
23
|
+
defineField({
|
|
24
|
+
name: "items",
|
|
25
|
+
title: "Items",
|
|
26
|
+
type: "array",
|
|
27
|
+
of: [
|
|
28
|
+
{
|
|
29
|
+
type: "object",
|
|
30
|
+
fields: [
|
|
31
|
+
defineField({
|
|
32
|
+
name: "label",
|
|
33
|
+
title: "Label",
|
|
34
|
+
type: "string",
|
|
35
|
+
validation: (Rule) => Rule.required(),
|
|
36
|
+
}),
|
|
37
|
+
defineField({
|
|
38
|
+
name: "href",
|
|
39
|
+
title: "Path",
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Relative path (e.g. /products, /about)",
|
|
42
|
+
validation: (Rule) =>
|
|
43
|
+
Rule.required().custom((value) => {
|
|
44
|
+
if (
|
|
45
|
+
typeof value === "string" &&
|
|
46
|
+
!value.startsWith("/")
|
|
47
|
+
) {
|
|
48
|
+
return "Path must start with /";
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
preview: {
|
|
55
|
+
select: { title: "label", subtitle: "href" },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
}),
|
|
60
|
+
],
|
|
61
|
+
preview: {
|
|
62
|
+
select: { title: "title", items: "items" },
|
|
63
|
+
prepare({ title, items }) {
|
|
64
|
+
return {
|
|
65
|
+
title,
|
|
66
|
+
subtitle: `${items?.length ?? 0} items`,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
preview: {
|
|
75
|
+
prepare() {
|
|
76
|
+
return { title: "Footer" };
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineArrayMember, defineField, defineType } from "sanity";
|
|
2
|
+
|
|
3
|
+
import { logoField } from "@/lib/integrations/sanity/schemas/shared/logo-field";
|
|
4
|
+
|
|
5
|
+
export const navbar = defineType({
|
|
6
|
+
name: "navbar",
|
|
7
|
+
title: "Navbar",
|
|
8
|
+
type: "document",
|
|
9
|
+
fields: [
|
|
10
|
+
logoField,
|
|
11
|
+
defineField({
|
|
12
|
+
name: "navigationItems",
|
|
13
|
+
title: "Navigation Items",
|
|
14
|
+
type: "array",
|
|
15
|
+
of: [defineArrayMember({ type: "navItem" })],
|
|
16
|
+
description:
|
|
17
|
+
"Top-level navigation items -- direct links or menu triggers",
|
|
18
|
+
}),
|
|
19
|
+
defineField({
|
|
20
|
+
name: "ctaButtons",
|
|
21
|
+
title: "CTA Buttons",
|
|
22
|
+
type: "array",
|
|
23
|
+
of: [
|
|
24
|
+
{
|
|
25
|
+
type: "object",
|
|
26
|
+
fields: [
|
|
27
|
+
defineField({
|
|
28
|
+
name: "label",
|
|
29
|
+
title: "Label",
|
|
30
|
+
type: "string",
|
|
31
|
+
validation: (Rule) => Rule.required(),
|
|
32
|
+
}),
|
|
33
|
+
defineField({
|
|
34
|
+
name: "link",
|
|
35
|
+
title: "Link",
|
|
36
|
+
type: "link",
|
|
37
|
+
validation: (Rule) => Rule.required(),
|
|
38
|
+
}),
|
|
39
|
+
defineField({
|
|
40
|
+
name: "variant",
|
|
41
|
+
title: "Variant",
|
|
42
|
+
type: "string",
|
|
43
|
+
options: {
|
|
44
|
+
list: [
|
|
45
|
+
{ title: "Primary", value: "primary" },
|
|
46
|
+
{ title: "Secondary", value: "secondary" },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
initialValue: "primary",
|
|
50
|
+
validation: (Rule) => Rule.required(),
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
preview: {
|
|
54
|
+
select: {
|
|
55
|
+
title: "label",
|
|
56
|
+
variant: "variant",
|
|
57
|
+
},
|
|
58
|
+
prepare({ title, variant }) {
|
|
59
|
+
return {
|
|
60
|
+
title,
|
|
61
|
+
subtitle: variant || "primary",
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
description: "Action buttons on the right side of the navbar",
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
preview: {
|
|
71
|
+
prepare() {
|
|
72
|
+
return { title: "Navbar" };
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
import { apiVersion } from "@/lib/integrations/sanity/env";
|
|
3
|
+
import { redirectIcon } from "@/lib/integrations/sanity/icons";
|
|
4
|
+
|
|
5
|
+
type RedirectValidationDocument = {
|
|
6
|
+
_id?: string;
|
|
7
|
+
source?: { current?: string };
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Redirect rule. `source` follows the page/folder slug convention: a slash-free
|
|
12
|
+
* route path (e.g. `old-page`, `blog/old-post`).
|
|
13
|
+
*/
|
|
14
|
+
export const redirect = defineType({
|
|
15
|
+
name: "redirect",
|
|
16
|
+
title: "Redirect",
|
|
17
|
+
type: "document",
|
|
18
|
+
icon: redirectIcon,
|
|
19
|
+
fields: [
|
|
20
|
+
defineField({
|
|
21
|
+
name: "source",
|
|
22
|
+
title: "Source",
|
|
23
|
+
type: "slug",
|
|
24
|
+
description:
|
|
25
|
+
"Incoming route path to match, without a leading slash (e.g. old-page or blog/old-post).",
|
|
26
|
+
options: { maxLength: 200 },
|
|
27
|
+
validation: (Rule) =>
|
|
28
|
+
Rule.required().custom(async (slug, context) => {
|
|
29
|
+
if (!slug?.current) {
|
|
30
|
+
return "Source is required";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!/^[a-z0-9-/]+$/.test(slug.current)) {
|
|
34
|
+
return "Source must be lowercase with hyphens, letters, numbers, and forward slashes only";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (slug.current.startsWith("/") || slug.current.endsWith("/")) {
|
|
38
|
+
return "Source must not start or end with a forward slash";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const document = context.document as
|
|
42
|
+
| RedirectValidationDocument
|
|
43
|
+
| undefined;
|
|
44
|
+
const id = document?._id?.replace(/^drafts\./, "");
|
|
45
|
+
|
|
46
|
+
if (!id) return true;
|
|
47
|
+
|
|
48
|
+
const client = context.getClient({ apiVersion });
|
|
49
|
+
const existing = await client.fetch<number>(
|
|
50
|
+
`count(*[
|
|
51
|
+
_type == "redirect" &&
|
|
52
|
+
source.current == $slug &&
|
|
53
|
+
!(_id in [$id, "drafts." + $id])
|
|
54
|
+
])`,
|
|
55
|
+
{ slug: slug.current, id },
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return existing === 0 || "Another redirect already uses this source";
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
defineField({
|
|
62
|
+
name: "destination",
|
|
63
|
+
title: "Destination",
|
|
64
|
+
type: "string",
|
|
65
|
+
description:
|
|
66
|
+
"Where to send visitors. An internal route path without a leading slash (e.g. new-page or blog/new-post), or an absolute URL (e.g. https://example.com).",
|
|
67
|
+
validation: (Rule) =>
|
|
68
|
+
Rule.required().custom(async (value, context) => {
|
|
69
|
+
if (typeof value !== "string") return true;
|
|
70
|
+
|
|
71
|
+
const isAbsolute = /^https?:\/\//.test(value);
|
|
72
|
+
if (isAbsolute) return true;
|
|
73
|
+
|
|
74
|
+
if (!/^[a-z0-9-/]+$/.test(value)) {
|
|
75
|
+
return "Destination must be a slash-free route path (lowercase, hyphens, numbers, forward slashes) or an absolute http(s) URL";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (value.startsWith("/") || value.endsWith("/")) {
|
|
79
|
+
return "Internal destination must not start or end with a forward slash";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const document = context.document as
|
|
83
|
+
| RedirectValidationDocument
|
|
84
|
+
| undefined;
|
|
85
|
+
const source = document?.source?.current;
|
|
86
|
+
|
|
87
|
+
if (source && source === value) {
|
|
88
|
+
return "Destination must differ from source";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Rejects a direct loop (a -> b, b -> a); longer chains aren't checked.
|
|
92
|
+
// Normalizes slashes since docs written outside Studio can skip that validation.
|
|
93
|
+
if (source) {
|
|
94
|
+
const id = document?._id?.replace(/^drafts\./, "") ?? "";
|
|
95
|
+
const client = context.getClient({ apiVersion });
|
|
96
|
+
const normalize = (path: string) => path.replace(/^\/+|\/+$/g, "");
|
|
97
|
+
const normalizedSource = normalize(source);
|
|
98
|
+
const normalizedDestination = normalize(value);
|
|
99
|
+
const others = await client.fetch<
|
|
100
|
+
Array<{ source?: string; destination?: string }>
|
|
101
|
+
>(
|
|
102
|
+
`*[
|
|
103
|
+
_type == "redirect" &&
|
|
104
|
+
!(_id in [$id, "drafts." + $id])
|
|
105
|
+
]{ "source": source.current, destination }`,
|
|
106
|
+
{ id },
|
|
107
|
+
);
|
|
108
|
+
const hasInverse = others.some(
|
|
109
|
+
(redirect) =>
|
|
110
|
+
redirect.source &&
|
|
111
|
+
normalize(redirect.source) === normalizedDestination &&
|
|
112
|
+
redirect.destination &&
|
|
113
|
+
normalize(redirect.destination) === normalizedSource,
|
|
114
|
+
);
|
|
115
|
+
if (hasInverse) {
|
|
116
|
+
return "This creates a redirect loop — another redirect sends the destination back to this source";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return true;
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
defineField({
|
|
124
|
+
name: "permanent",
|
|
125
|
+
title: "Permanent",
|
|
126
|
+
type: "boolean",
|
|
127
|
+
description:
|
|
128
|
+
"Permanent (308 — cached, SEO transfers). Uncheck for a temporary (307) redirect.",
|
|
129
|
+
initialValue: true,
|
|
130
|
+
options: { layout: "switch" },
|
|
131
|
+
}),
|
|
132
|
+
],
|
|
133
|
+
preview: {
|
|
134
|
+
select: {
|
|
135
|
+
source: "source.current",
|
|
136
|
+
destination: "destination",
|
|
137
|
+
permanent: "permanent",
|
|
138
|
+
},
|
|
139
|
+
prepare({ source, destination, permanent }) {
|
|
140
|
+
let target = "?";
|
|
141
|
+
if (destination) {
|
|
142
|
+
target = /^https?:\/\//.test(destination)
|
|
143
|
+
? destination
|
|
144
|
+
: `/${destination}`;
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
title: source ? `/${source}` : "Untitled redirect",
|
|
148
|
+
subtitle: `→ ${target} (${permanent ? "308" : "307"})`,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
});
|