@pro-laico/create-atomic-payload 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +159 -0
- package/package.json +29 -0
- package/template/.env.example +35 -0
- package/template/.gitattributes +2 -0
- package/template/.prettierrc.json +6 -0
- package/template/.vscode/extensions.json +3 -0
- package/template/.vscode/launch.json +24 -0
- package/template/.vscode/settings.json +86 -0
- package/template/.yarnrc +1 -0
- package/template/LICENSE.md +22 -0
- package/template/README.md +128 -0
- package/template/eslint.config.mjs +32 -0
- package/template/next-env.d.ts +6 -0
- package/template/next.config.ts +36 -0
- package/template/package.json +75 -0
- package/template/public/adminFavicon.svg +1 -0
- package/template/public/ogImage.webp +0 -0
- package/template/src/access/anyone.ts +3 -0
- package/template/src/access/authenticated.ts +7 -0
- package/template/src/access/authenticatedOrPublished.ts +6 -0
- package/template/src/app/(frontend)/[...slug]/page.tsx +48 -0
- package/template/src/app/(frontend)/layout.tsx +49 -0
- package/template/src/app/(frontend)/next/exit-preview/route.ts +7 -0
- package/template/src/app/(frontend)/next/preview/route.ts +45 -0
- package/template/src/app/(frontend)/next/seed/route.ts +31 -0
- package/template/src/app/(frontend)/not-found.tsx +93 -0
- package/template/src/app/(frontend)/page.tsx +5 -0
- package/template/src/app/(frontend)/sitemap.ts +14 -0
- package/template/src/app/(payload)/admin/[[...segments]]/not-found.tsx +24 -0
- package/template/src/app/(payload)/admin/[[...segments]]/page.tsx +24 -0
- package/template/src/app/(payload)/admin/importMap.js +85 -0
- package/template/src/app/(payload)/api/[...slug]/route.ts +19 -0
- package/template/src/app/(payload)/custom.scss +29 -0
- package/template/src/app/(payload)/layout.tsx +31 -0
- package/template/src/blocks/actions/blocks.ts +27 -0
- package/template/src/blocks/actions/cookieConsent/set/block.ts +17 -0
- package/template/src/blocks/actions/cookieConsent/set/filter.ts +3 -0
- package/template/src/blocks/actions/cookieConsent/set/options.ts +35 -0
- package/template/src/blocks/actions/cookieConsent/toDA/block.ts +14 -0
- package/template/src/blocks/actions/cookieConsent/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/cookieConsent/toDA/options.ts +19 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/block.ts +15 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/filter.ts +4 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/options.ts +18 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/block.ts +10 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/options.ts +12 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/block.ts +41 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/filter.ts +4 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/options.ts +23 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/block.ts +10 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/options.ts +12 -0
- package/template/src/blocks/actions/filters.ts +27 -0
- package/template/src/blocks/actions/form/errorToDA/block.ts +18 -0
- package/template/src/blocks/actions/form/errorToDA/filter.ts +3 -0
- package/template/src/blocks/actions/form/errorToDA/options.ts +15 -0
- package/template/src/blocks/actions/form/reset/block.ts +18 -0
- package/template/src/blocks/actions/form/reset/filter.ts +3 -0
- package/template/src/blocks/actions/form/reset/options.ts +30 -0
- package/template/src/blocks/actions/form/statusToDA/block.ts +12 -0
- package/template/src/blocks/actions/form/statusToDA/filter.ts +3 -0
- package/template/src/blocks/actions/form/statusToDA/options.ts +15 -0
- package/template/src/blocks/actions/form/submit/block.ts +18 -0
- package/template/src/blocks/actions/form/submit/filter.ts +3 -0
- package/template/src/blocks/actions/form/submit/options.ts +35 -0
- package/template/src/blocks/actions/portal/set/block.ts +25 -0
- package/template/src/blocks/actions/portal/set/filter.ts +3 -0
- package/template/src/blocks/actions/portal/set/options.ts +43 -0
- package/template/src/blocks/actions/processor.ts +263 -0
- package/template/src/blocks/actions/theme/set/block.ts +10 -0
- package/template/src/blocks/actions/theme/set/filter.ts +3 -0
- package/template/src/blocks/actions/theme/set/options.ts +9 -0
- package/template/src/blocks/actions/zap.ts +4 -0
- package/template/src/blocks/children/atomic/block.ts +123 -0
- package/template/src/blocks/children/atomic/controlBar.ts +43 -0
- package/template/src/blocks/children/atomic/variants/button/typeField.ts +16 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/component.client.tsx +21 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/component.tsx +13 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/controlBar.ts +73 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/settings.ts +26 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/controlBar.ts +35 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/component.tsx +36 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/settings.ts +24 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/component.tsx +41 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/settings.ts +111 -0
- package/template/src/blocks/children/atomic/variants/button/variants/regular/component.client.tsx +19 -0
- package/template/src/blocks/children/atomic/variants/button/variants/regular/component.tsx +11 -0
- package/template/src/blocks/children/atomic/variants/form/component.tsx +18 -0
- package/template/src/blocks/children/atomic/variants/form/controlBar.ts +22 -0
- package/template/src/blocks/children/atomic/variants/form/settings.ts +20 -0
- package/template/src/blocks/children/atomic/variants/input/autoCompleteOptions.ts +51 -0
- package/template/src/blocks/children/atomic/variants/input/controlBar.ts +13 -0
- package/template/src/blocks/children/atomic/variants/input/settings.ts +35 -0
- package/template/src/blocks/children/atomic/variants/input/typeField.ts +23 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/component.tsx +7 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/settings.ts +12 -0
- package/template/src/blocks/children/atomic/variants/tag/component.client.tsx +17 -0
- package/template/src/blocks/children/atomic/variants/tag/component.tsx +13 -0
- package/template/src/blocks/children/atomic/variants/tag/controlBar.ts +6 -0
- package/template/src/blocks/children/atomic/variants/tag/settings.ts +9 -0
- package/template/src/blocks/children/blocks.ts +13 -0
- package/template/src/blocks/children/icon/block.ts +41 -0
- package/template/src/blocks/children/icon/component.tsx +17 -0
- package/template/src/blocks/children/image/block.ts +80 -0
- package/template/src/blocks/children/image/component.tsx +21 -0
- package/template/src/blocks/children/richText/block.ts +50 -0
- package/template/src/blocks/children/richText/component/converters/index.tsx +10 -0
- package/template/src/blocks/children/richText/component/converters/internalLink.tsx +8 -0
- package/template/src/blocks/children/richText/component/index.tsx +10 -0
- package/template/src/blocks/children/richText/component.tsx +7 -0
- package/template/src/blocks/children/richText/defaultLexical.ts +65 -0
- package/template/src/blocks/children/simpleText/block.ts +41 -0
- package/template/src/blocks/children/simpleText/component.client.tsx +18 -0
- package/template/src/blocks/children/simpleText/component.tsx +11 -0
- package/template/src/blocks/children/svg/block.ts +39 -0
- package/template/src/blocks/children/svg/component.tsx +6 -0
- package/template/src/blocks/children/video/block.ts +70 -0
- package/template/src/blocks/children/video/component.tsx +11 -0
- package/template/src/blocks/children/zap.ts +54 -0
- package/template/src/blocks/submitForm/form/rateLimiting/blocks.ts +5 -0
- package/template/src/blocks/submitForm/form/rateLimiting/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/block.ts +23 -0
- package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/serverFunction.ts +46 -0
- package/template/src/blocks/submitForm/form/sanitation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/block.ts +19 -0
- package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/serverFunction.ts +22 -0
- package/template/src/blocks/submitForm/form/sanitation/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/validation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/form/validation/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/validation/isUnique/block.ts +19 -0
- package/template/src/blocks/submitForm/form/validation/isUnique/serverFunction.ts +40 -0
- package/template/src/blocks/submitForm/form/zap.ts +8 -0
- package/template/src/blocks/submitForm/formProcessor.ts +222 -0
- package/template/src/blocks/submitForm/input/sanitation/blocks.ts +5 -0
- package/template/src/blocks/submitForm/input/sanitation/functions.ts +1 -0
- package/template/src/blocks/submitForm/input/sanitation/trimText/block.ts +24 -0
- package/template/src/blocks/submitForm/input/sanitation/trimText/serverFunction.ts +63 -0
- package/template/src/blocks/submitForm/input/useOn.ts +8 -0
- package/template/src/blocks/submitForm/input/validation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/input/validation/contains/block.ts +12 -0
- package/template/src/blocks/submitForm/input/validation/contains/serverFunction.ts +23 -0
- package/template/src/blocks/submitForm/input/validation/doesNotContain/block.ts +12 -0
- package/template/src/blocks/submitForm/input/validation/doesNotContain/serverFunction.ts +23 -0
- package/template/src/blocks/submitForm/input/validation/functions.ts +2 -0
- package/template/src/blocks/submitForm/input/zap.ts +6 -0
- package/template/src/blocks/submitForm/serverFunction.ts +42 -0
- package/template/src/collections/designSets/collection.ts +44 -0
- package/template/src/collections/designSets/defaults.ts +20 -0
- package/template/src/collections/designSets/tabs/animation.ts +71 -0
- package/template/src/collections/designSets/tabs/colors.ts +31 -0
- package/template/src/collections/designSets/tabs/fonts.ts +53 -0
- package/template/src/collections/designSets/tabs/miscellaneous.ts +22 -0
- package/template/src/collections/designSets/tabs/prose.ts +151 -0
- package/template/src/collections/designSets/tabs/settings.ts +52 -0
- package/template/src/collections/designSets/tabs/sizes.ts +30 -0
- package/template/src/collections/designSets/tabs/storage.ts +51 -0
- package/template/src/collections/designSets/tabs/variables.ts +28 -0
- package/template/src/collections/favicons.ts +11 -0
- package/template/src/collections/fonts/collection.ts +20 -0
- package/template/src/collections/fonts/script.ts +199 -0
- package/template/src/collections/footers/collection.ts +48 -0
- package/template/src/collections/footers/component.tsx +13 -0
- package/template/src/collections/headers/collection.ts +47 -0
- package/template/src/collections/headers/component.tsx +13 -0
- package/template/src/collections/iconSets/collection.ts +80 -0
- package/template/src/collections/iconSets/defaults.ts +81 -0
- package/template/src/collections/icons.ts +20 -0
- package/template/src/collections/images.ts +29 -0
- package/template/src/collections/index.ts +17 -0
- package/template/src/collections/muxVideos.ts +13 -0
- package/template/src/collections/pages/collection.ts +88 -0
- package/template/src/collections/pages/tabs/SEO.ts +70 -0
- package/template/src/collections/pages/tabs/settings.ts +17 -0
- package/template/src/collections/posthogProperty.ts +48 -0
- package/template/src/collections/shortcutSets/collection.ts +30 -0
- package/template/src/collections/shortcutSets/defaults.ts +1 -0
- package/template/src/collections/shortcutSets/protectedNames.ts +135 -0
- package/template/src/collections/shortcutSets/tabs/settings.ts +13 -0
- package/template/src/collections/shortcutSets/tabs/shortcuts.ts +70 -0
- package/template/src/collections/users.ts +11 -0
- package/template/src/collections/zap.ts +59 -0
- package/template/src/components/child/SSRProps.ts +381 -0
- package/template/src/components/child/renderChildren.tsx +148 -0
- package/template/src/components/livePreviewListener.tsx +10 -0
- package/template/src/components/providers/formProvider.tsx +11 -0
- package/template/src/components/providers/tracking/gtm.tsx +11 -0
- package/template/src/components/providers/tracking/index.tsx +46 -0
- package/template/src/components/providers/tracking/postHog.tsx +41 -0
- package/template/src/components/providers/tracking/vercel.tsx +10 -0
- package/template/src/components/toast/index.module.css +142 -0
- package/template/src/components/toast/index.tsx +55 -0
- package/template/src/endpoints/seed/backendForm.ts +48 -0
- package/template/src/endpoints/seed/designSet.ts +476 -0
- package/template/src/endpoints/seed/footer.ts +389 -0
- package/template/src/endpoints/seed/header.ts +3511 -0
- package/template/src/endpoints/seed/iconSet.ts +19 -0
- package/template/src/endpoints/seed/icons/assets/check.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/close.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/cookie.svg +7 -0
- package/template/src/endpoints/seed/icons/assets/github.svg +1 -0
- package/template/src/endpoints/seed/icons/assets/logo.svg +11 -0
- package/template/src/endpoints/seed/icons/assets/menu.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/theme.svg +4 -0
- package/template/src/endpoints/seed/icons/check.ts +14 -0
- package/template/src/endpoints/seed/icons/close.ts +14 -0
- package/template/src/endpoints/seed/icons/cookie.ts +14 -0
- package/template/src/endpoints/seed/icons/github.ts +14 -0
- package/template/src/endpoints/seed/icons/index.ts +7 -0
- package/template/src/endpoints/seed/icons/logo.ts +14 -0
- package/template/src/endpoints/seed/icons/menu.ts +14 -0
- package/template/src/endpoints/seed/icons/theme.ts +14 -0
- package/template/src/endpoints/seed/index.ts +100 -0
- package/template/src/endpoints/seed/pages/home.ts +858 -0
- package/template/src/endpoints/seed/pages/index.ts +4 -0
- package/template/src/endpoints/seed/pages/notFoundPage.ts +287 -0
- package/template/src/endpoints/seed/pages/prose.ts +1436 -0
- package/template/src/endpoints/seed/pages/testing.ts +2181 -0
- package/template/src/endpoints/seed/shortcutSet.ts +187 -0
- package/template/src/endpoints/seed/siteMetaData.ts +10 -0
- package/template/src/fields/actions/changeKey.ts +12 -0
- package/template/src/fields/actions/index.ts +6 -0
- package/template/src/fields/actions/initialValueCheckbox.ts +14 -0
- package/template/src/fields/actions/keyText.ts +10 -0
- package/template/src/fields/actions/persisted.ts +14 -0
- package/template/src/fields/actions/setData.ts +20 -0
- package/template/src/fields/actions/strict/index.ts +3 -0
- package/template/src/fields/actions/strict/keySelect.ts +28 -0
- package/template/src/fields/actions/strict/listenSelect.ts +28 -0
- package/template/src/fields/actions/strict/performSelect.ts +30 -0
- package/template/src/fields/actions/strict/registry/cookieConsent.ts +14 -0
- package/template/src/fields/actions/strict/registry/index.ts +6 -0
- package/template/src/fields/actions/strict/registry/theme.ts +9 -0
- package/template/src/fields/active.ts +16 -0
- package/template/src/fields/apf/index.ts +69 -0
- package/template/src/fields/apf/storage.ts +38 -0
- package/template/src/fields/blocks/actions.ts +30 -0
- package/template/src/fields/blocks/backdropChildren.ts +11 -0
- package/template/src/fields/blocks/children.ts +15 -0
- package/template/src/fields/blocks/submitForm/form.ts +24 -0
- package/template/src/fields/blocks/submitForm/input.ts +25 -0
- package/template/src/fields/className.ts +26 -0
- package/template/src/fields/coloredEnd.ts +5 -0
- package/template/src/fields/defaultOpen.ts +14 -0
- package/template/src/fields/designSets/value.ts +80 -0
- package/template/src/fields/devMode.ts +11 -0
- package/template/src/fields/favicon.ts +18 -0
- package/template/src/fields/for.ts +11 -0
- package/template/src/fields/keepMounted.ts +11 -0
- package/template/src/fields/modal.ts +16 -0
- package/template/src/fields/slug.ts +35 -0
- package/template/src/fields/staticDataAttributes.ts +29 -0
- package/template/src/fields/tabs/block/children/actions.ts +49 -0
- package/template/src/fields/tabs/block/children/backdrop.ts +17 -0
- package/template/src/fields/tabs/block/children/settings.ts +45 -0
- package/template/src/fields/tabs/block/children/submitForm/form.ts +23 -0
- package/template/src/fields/tabs/block/children/submitForm/input.ts +14 -0
- package/template/src/fields/tabs/block/children/tracking.ts +25 -0
- package/template/src/fields/tabs/collection/storage.ts +55 -0
- package/template/src/fields/tagType.ts +32 -0
- package/template/src/fields/testPath.ts +3 -0
- package/template/src/fields/uniqueTitle.ts +8 -0
- package/template/src/fields/validationMessage.ts +13 -0
- package/template/src/globals/index.ts +8 -0
- package/template/src/globals/settings.ts +36 -0
- package/template/src/globals/siteMetaData.ts +29 -0
- package/template/src/globals/storage.ts +15 -0
- package/template/src/globals/tracking/global.ts +25 -0
- package/template/src/globals/tracking/tabs/gtm.ts +18 -0
- package/template/src/globals/tracking/tabs/postHog.ts +35 -0
- package/template/src/hooks/collection/atomicHook/atomicHook.ts +223 -0
- package/template/src/hooks/collection/atomicHook/processors/cssProcessor.ts +60 -0
- package/template/src/hooks/collection/atomicHook/processors/processDesignSet/generatePreflights.ts +36 -0
- package/template/src/hooks/collection/atomicHook/processors/processDesignSet/index.ts +176 -0
- package/template/src/hooks/collection/atomicHook/processors/unsetActive.ts +24 -0
- package/template/src/hooks/collection/formatSVG.ts +157 -0
- package/template/src/hooks/collection/revalidate.ts +53 -0
- package/template/src/hooks/collection/sanitizeCollection.ts +5 -0
- package/template/src/hooks/field/apf.ts +59 -0
- package/template/src/hooks/field/formatSlug.ts +23 -0
- package/template/src/hooks/field/href.ts +6 -0
- package/template/src/hooks/field/publishedAt.ts +5 -0
- package/template/src/hooks/frontEnd/atomicStore/create.ts +69 -0
- package/template/src/hooks/frontEnd/atomicStore/index.tsx +20 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/base.ts +7 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/consent.ts +76 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/dynamic.ts +51 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/function.ts +14 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/function.ts +34 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/zap.ts +17 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/function.ts +22 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/function.ts +20 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/function.ts +24 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/function.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/zap.ts +15 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/index.ts +2 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/function.ts +30 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/function.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/function.ts +7 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/zap.ts +9 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/function.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/zap.ts +11 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/function.ts +33 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/zap.ts +14 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/function.ts +11 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/function.ts +32 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/zap.ts +9 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/zap.ts +16 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/zap.ts +2 -0
- package/template/src/hooks/frontEnd/useActions/index.ts +6 -0
- package/template/src/hooks/frontEnd/useActions/useActionContext.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/useButtonActions.ts +17 -0
- package/template/src/hooks/frontEnd/useActions/useDaToText.ts +34 -0
- package/template/src/hooks/frontEnd/useActions/useForm.ts +114 -0
- package/template/src/hooks/frontEnd/useActions/usePortal.ts +33 -0
- package/template/src/hooks/frontEnd/useActions/useToDa.ts +12 -0
- package/template/src/hooks/global/revalidate.ts +26 -0
- package/template/src/payload.config.ts +78 -0
- package/template/src/plugins/blurDataUrls.ts +8 -0
- package/template/src/plugins/formBuilder.ts +40 -0
- package/template/src/plugins/index.ts +17 -0
- package/template/src/plugins/muxVideo.ts +13 -0
- package/template/src/plugins/nestedDocs.ts +9 -0
- package/template/src/plugins/vercelBlobStorage.ts +8 -0
- package/template/src/ts/JSONSchema.ts +93 -0
- package/template/src/ts/declarations.ts +24 -0
- package/template/src/ts/types/actions.ts +175 -0
- package/template/src/ts/types/apf.ts +108 -0
- package/template/src/ts/types/cache.ts +166 -0
- package/template/src/ts/types/css.ts +14 -0
- package/template/src/ts/types/forms.ts +214 -0
- package/template/src/ts/types/frontEnd.ts +115 -0
- package/template/src/ts/types/index.ts +49 -0
- package/template/src/ts/types/payload-types.ts +3684 -0
- package/template/src/ts/zap/ap.ts +82 -0
- package/template/src/ts/zap/index.ts +4 -0
- package/template/src/ui/apf/controls.tsx +88 -0
- package/template/src/ui/apf/field.tsx +81 -0
- package/template/src/ui/apf/index.scss +59 -0
- package/template/src/ui/apf/label.tsx +23 -0
- package/template/src/ui/assets/Icon.tsx +21 -0
- package/template/src/ui/assets/Logo.tsx +21 -0
- package/template/src/ui/assets/atomicIcon.tsx +27 -0
- package/template/src/ui/assets/warningIcon.ts +6 -0
- package/template/src/ui/blocks/actionBlock.tsx +44 -0
- package/template/src/ui/blocks/inputBlock.tsx +24 -0
- package/template/src/ui/decorative/coloredEnd.tsx +16 -0
- package/template/src/ui/decorative/index.scss +46 -0
- package/template/src/ui/fields/iconSelect/index.tsx +19 -0
- package/template/src/ui/fields/slug/index.scss +12 -0
- package/template/src/ui/fields/slug/index.tsx +72 -0
- package/template/src/ui/index.ts +32 -0
- package/template/src/ui/root/beforeDashboard/index.scss +22 -0
- package/template/src/ui/root/beforeDashboard/index.tsx +39 -0
- package/template/src/ui/root/beforeDashboard/seedButton/index.scss +12 -0
- package/template/src/ui/root/beforeDashboard/seedButton/index.tsx +84 -0
- package/template/src/ui/root/siteTriggers/index.scss +22 -0
- package/template/src/ui/root/siteTriggers/index.tsx +94 -0
- package/template/src/ui/root/siteTriggers/triggerVercelDeploy.ts +37 -0
- package/template/src/ui/rowLabels/animation.tsx +27 -0
- package/template/src/ui/rowLabels/atomic/index.scss +62 -0
- package/template/src/ui/rowLabels/atomic/index.tsx +96 -0
- package/template/src/ui/rowLabels/color.tsx +33 -0
- package/template/src/ui/rowLabels/designToken.tsx +30 -0
- package/template/src/ui/rowLabels/icon.tsx +32 -0
- package/template/src/ui/rowLabels/shortcut/index.scss +21 -0
- package/template/src/ui/rowLabels/shortcut/index.tsx +30 -0
- package/template/src/ui/rowLabels/simpleText.tsx +41 -0
- package/template/src/utilities/deepMerge.ts +30 -0
- package/template/src/utilities/extractSVG.ts +9 -0
- package/template/src/utilities/format/toKebabCase.ts +79 -0
- package/template/src/utilities/format/toTitleCase.ts +47 -0
- package/template/src/utilities/formatDurationWithTokens.ts +56 -0
- package/template/src/utilities/generateMetaData.ts +45 -0
- package/template/src/utilities/generatePreviewPath.ts +43 -0
- package/template/src/utilities/get/cache/getAtomicActions.ts +48 -0
- package/template/src/utilities/get/cache/getAtomicClasses.ts +20 -0
- package/template/src/utilities/get/cache/getDesignSet.ts +15 -0
- package/template/src/utilities/get/cache/getFooter.ts +17 -0
- package/template/src/utilities/get/cache/getFormSubmissions.ts +17 -0
- package/template/src/utilities/get/cache/getForms.ts +43 -0
- package/template/src/utilities/get/cache/getHeader.ts +17 -0
- package/template/src/utilities/get/cache/getIcon.ts +51 -0
- package/template/src/utilities/get/cache/getImage.ts +20 -0
- package/template/src/utilities/get/cache/getPage.ts +35 -0
- package/template/src/utilities/get/cache/getPages.ts +24 -0
- package/template/src/utilities/get/cache/getShortcutSet.ts +17 -0
- package/template/src/utilities/get/cache/getSiteCSS.ts +17 -0
- package/template/src/utilities/get/cache/getSiteMetadata.ts +14 -0
- package/template/src/utilities/get/cache/getSitemap.ts +50 -0
- package/template/src/utilities/get/cache/getTracking.ts +14 -0
- package/template/src/utilities/get/cache/index.ts +129 -0
- package/template/src/utilities/get/cache/react.ts +5 -0
- package/template/src/utilities/get/getImageURL.ts +20 -0
- package/template/src/utilities/get/getMeUser.ts +22 -0
- package/template/src/utilities/get/getURL.ts +20 -0
- package/template/src/utilities/log/cache.ts +8 -0
- package/template/src/utilities/log/manual.ts +11 -0
- package/template/src/utilities/log/revalidation.ts +6 -0
- package/template/src/utilities/mergeTags.ts +7 -0
- package/template/src/utilities/propertyApplicatorUtility.ts +20 -0
- package/template/src/utilities/revalidateTag.ts +55 -0
- package/template/src/utilities/runAPF.ts +10 -0
- package/template/src/utilities/sanitizeData.ts +24 -0
- package/template/src/utilities/seedNestedRelationship.ts +5 -0
- package/template/tailwind.config.js +9 -0
- package/template/tsconfig.json +49 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import https from 'https'
|
|
4
|
+
import dotenv from 'dotenv'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { PayloadSDK } from '@payloadcms/sdk'
|
|
7
|
+
import { Font, GenericFontFamily, Config } from '@/ts/types'
|
|
8
|
+
|
|
9
|
+
const colors = {
|
|
10
|
+
blue: (t: string) => `\x1b[34m${t}\x1b[0m`,
|
|
11
|
+
green: (t: string) => `\x1b[32m${t}\x1b[0m`,
|
|
12
|
+
red: (t: string) => `\x1b[31m${t}\x1b[0m`,
|
|
13
|
+
orange: (t: string) => `\x1b[33m${t}\x1b[0m`,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
17
|
+
const __dirname = path.dirname(__filename)
|
|
18
|
+
|
|
19
|
+
dotenv.config({ path: path.join(__dirname, '../../../.env') })
|
|
20
|
+
|
|
21
|
+
const FONT_FILES_DIR = './public/fonts'
|
|
22
|
+
const FONT_DEFINITION_FILE = './src/app/definition.ts'
|
|
23
|
+
|
|
24
|
+
type FontExtensions = {
|
|
25
|
+
sans: string
|
|
26
|
+
serif: string
|
|
27
|
+
mono: string
|
|
28
|
+
display: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let hasWarnings = false
|
|
32
|
+
|
|
33
|
+
function warn(message: string, error?: unknown) {
|
|
34
|
+
hasWarnings = true
|
|
35
|
+
console.warn(message)
|
|
36
|
+
if (error) console.warn(error)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const requiredEnvVars = {
|
|
40
|
+
LIVE_SITE_URL: process.env.LIVE_SITE_URL,
|
|
41
|
+
BLOB_READ_WRITE_TOKEN: process.env.BLOB_READ_WRITE_TOKEN,
|
|
42
|
+
SCRIPT_USER_EMAIL: process.env.SCRIPT_USER_EMAIL,
|
|
43
|
+
SCRIPT_USER_PASSWORD: process.env.SCRIPT_USER_PASSWORD,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const [key, value] of Object.entries(requiredEnvVars)) {
|
|
47
|
+
if (!value) warn(colors.red(`Missing required environment variable: ${key}`))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const sdk = new PayloadSDK<Config>({ baseURL: `${process.env.LIVE_SITE_URL}/api` })
|
|
51
|
+
|
|
52
|
+
function ensureFontOutputs() {
|
|
53
|
+
if (!fs.existsSync(FONT_FILES_DIR)) fs.mkdirSync(FONT_FILES_DIR, { recursive: true })
|
|
54
|
+
|
|
55
|
+
for (const file of fs.readdirSync(FONT_FILES_DIR)) fs.unlinkSync(path.join(FONT_FILES_DIR, file))
|
|
56
|
+
|
|
57
|
+
// Always create a safe fallback definition file
|
|
58
|
+
generateFontDefinitions({ sans: '', serif: '', mono: '', display: '' })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function generateFontDefinitions(extensions: FontExtensions): void {
|
|
62
|
+
const configs: Array<{
|
|
63
|
+
name: string
|
|
64
|
+
type: GenericFontFamily
|
|
65
|
+
extension: string
|
|
66
|
+
variable: string
|
|
67
|
+
}> = [
|
|
68
|
+
{ name: 'fontSans', type: 'sans', extension: extensions.sans, variable: '--font-setSans' },
|
|
69
|
+
{ name: 'fontSerif', type: 'serif', extension: extensions.serif, variable: '--font-setSerif' },
|
|
70
|
+
{ name: 'fontMono', type: 'mono', extension: extensions.mono, variable: '--font-setMono' },
|
|
71
|
+
{ name: 'fontDisplay', type: 'display', extension: extensions.display, variable: '--font-setDisplay' },
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
const available = configs.filter((c) => c.extension)
|
|
75
|
+
|
|
76
|
+
const declarations = available
|
|
77
|
+
.map((c) => `const ${c.name} = localFont({ src: '../../public/fonts/${c.type}.${c.extension}', variable: '${c.variable}' })`)
|
|
78
|
+
.join('\n')
|
|
79
|
+
|
|
80
|
+
const exports = available.map((c) => c.name).join(', ')
|
|
81
|
+
|
|
82
|
+
fs.writeFileSync(
|
|
83
|
+
FONT_DEFINITION_FILE,
|
|
84
|
+
`// DO NOT EDIT MANUALLY. THIS FILE IS AUTOMATICALLY GENERATED.
|
|
85
|
+
${declarations.length === 0 ? '//eslint-disable-next-line' : ''}
|
|
86
|
+
import localFont from 'next/font/local'
|
|
87
|
+
|
|
88
|
+
${declarations || '// No fonts available'}
|
|
89
|
+
|
|
90
|
+
const fonts = { ${exports} }
|
|
91
|
+
export default fonts
|
|
92
|
+
`,
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function downloadFile(fileUrl: string, outputPath: string): Promise<void> {
|
|
97
|
+
const file = fs.createWriteStream(outputPath)
|
|
98
|
+
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
https
|
|
101
|
+
.get(fileUrl, (res) => {
|
|
102
|
+
res.pipe(file)
|
|
103
|
+
file.on('finish', () => {
|
|
104
|
+
file.close((err) => {
|
|
105
|
+
if (err) reject(err)
|
|
106
|
+
else resolve()
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
.on('error', (err) => {
|
|
111
|
+
if (fs.existsSync(outputPath)) fs.unlinkSync(outputPath)
|
|
112
|
+
reject(err)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function downloadFont(font: Font | string | null, fontType: keyof FontExtensions, baseUrl: string): Promise<string | undefined | void> {
|
|
118
|
+
if (typeof font === 'string') return warn(colors.orange(`The ${fontType} font is a string reference`))
|
|
119
|
+
if (!font?.filename) return warn(colors.orange(`No ${fontType} font found`))
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const extension = font.filename.split('.').pop()?.toLowerCase() || 'ttf'
|
|
123
|
+
await downloadFile(`${baseUrl}/${font.filename}?download=1`, `${FONT_FILES_DIR}/${fontType}.${extension}`)
|
|
124
|
+
console.log(`${colors.green('✓')} Downloaded ${fontType} font`)
|
|
125
|
+
return extension
|
|
126
|
+
} catch (err) {
|
|
127
|
+
warn(colors.red(`Failed to download ${fontType} font`), err)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function run() {
|
|
132
|
+
console.log(colors.blue('Starting Font Download...\n'))
|
|
133
|
+
|
|
134
|
+
// Always ensure outputs exist so imports never break
|
|
135
|
+
ensureFontOutputs()
|
|
136
|
+
|
|
137
|
+
if (hasWarnings) {
|
|
138
|
+
console.warn(colors.orange('Font download failed — No fonts will be used'))
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const blobToken = process.env.BLOB_READ_WRITE_TOKEN!
|
|
143
|
+
const accountId = blobToken.split('_').slice(-2, -1)[0]
|
|
144
|
+
const baseUrl = `https://${accountId}.public.blob.vercel-storage.com`
|
|
145
|
+
|
|
146
|
+
let user
|
|
147
|
+
try {
|
|
148
|
+
user = await sdk.login({
|
|
149
|
+
collection: 'users',
|
|
150
|
+
data: {
|
|
151
|
+
email: process.env.SCRIPT_USER_EMAIL!,
|
|
152
|
+
password: process.env.SCRIPT_USER_PASSWORD!,
|
|
153
|
+
},
|
|
154
|
+
})
|
|
155
|
+
} catch (err) {
|
|
156
|
+
warn(colors.red('Authentication failed'), err)
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let designSet
|
|
161
|
+
try {
|
|
162
|
+
designSet = await sdk.find(
|
|
163
|
+
{ collection: 'designSet', where: { active: { equals: true } }, limit: 1 },
|
|
164
|
+
{ headers: { Authorization: `JWT ${user.token}` } },
|
|
165
|
+
)
|
|
166
|
+
} catch (err) {
|
|
167
|
+
warn(colors.red('Failed to fetch design set'), err)
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!designSet.docs.length) return warn(colors.red('No active design set found'))
|
|
172
|
+
|
|
173
|
+
const fonts = designSet.docs[0].font
|
|
174
|
+
if (!fonts) return warn(colors.red('No font configuration found'))
|
|
175
|
+
|
|
176
|
+
const hasProcessableFonts = Object.values(fonts).some((font) => typeof font === 'object' && font?.filename)
|
|
177
|
+
if (!hasProcessableFonts) return console.log(colors.green('No valid fonts to process. Continuing build process.'))
|
|
178
|
+
|
|
179
|
+
console.log(colors.green('✓ Font configuration found\n'))
|
|
180
|
+
|
|
181
|
+
const extensions: FontExtensions = { sans: '', serif: '', mono: '', display: '' }
|
|
182
|
+
const entries = Object.entries(fonts) as Array<[keyof FontExtensions, Font | string | null]>
|
|
183
|
+
|
|
184
|
+
const results = await Promise.all(entries.map(([key, font]) => downloadFont(font, key, baseUrl)))
|
|
185
|
+
|
|
186
|
+
entries.forEach(([key], i) => {
|
|
187
|
+
extensions[key] = results[i] ?? ''
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
if (hasWarnings) {
|
|
191
|
+
console.warn(colors.orange('\n⚠ Warnings encountered — No fonts will be used.'))
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
generateFontDefinitions(extensions)
|
|
196
|
+
console.log(colors.green('\n✓ Font definitions generated successfully\n'))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
run().catch((err) => warn(colors.red('Unexpected script failure'), err))
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { APFControlsPath } from '@/ui'
|
|
2
|
+
import { ActiveField } from '@/fields/active'
|
|
3
|
+
import { authd } from '@/access/authenticated'
|
|
4
|
+
import { DevModeField } from '@/fields/devMode'
|
|
5
|
+
import type { CollectionConfig } from 'payload'
|
|
6
|
+
import { type APFunction } from '@/ts/types/apf'
|
|
7
|
+
import { TestPathField } from '@/fields/testPath'
|
|
8
|
+
import { ClassNameField } from '@/fields/className'
|
|
9
|
+
import { UniqueTitleField } from '@/fields/uniqueTitle'
|
|
10
|
+
import { generateAPFFields } from '@/fields/apf/storage'
|
|
11
|
+
import { ChildrenBlocks } from '@/fields/blocks/children'
|
|
12
|
+
import { StorageTab } from '@/fields/tabs/collection/storage'
|
|
13
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
14
|
+
import { revalidateCacheOnDelete } from '@/hooks/collection/revalidate'
|
|
15
|
+
import { generateLivePreviewPath } from '@/utilities/generatePreviewPath'
|
|
16
|
+
|
|
17
|
+
const APFunctions: APFunction[] = ['form', 'actions', 'classes', 'active']
|
|
18
|
+
|
|
19
|
+
export const Footer: CollectionConfig = {
|
|
20
|
+
slug: 'footer',
|
|
21
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
22
|
+
|
|
23
|
+
admin: {
|
|
24
|
+
group: 'Website',
|
|
25
|
+
useAsTitle: 'title',
|
|
26
|
+
enableListViewSelectAPI: true,
|
|
27
|
+
defaultColumns: ['title', 'active', '_status'],
|
|
28
|
+
preview: (data, { req }) => generateLivePreviewPath({ data, req }),
|
|
29
|
+
livePreview: { url: ({ data, req }) => generateLivePreviewPath({ data, req }) },
|
|
30
|
+
components: { edit: { beforeDocumentControls: [{ path: APFControlsPath, clientProps: { APFunctions } }] } },
|
|
31
|
+
},
|
|
32
|
+
fields: [
|
|
33
|
+
{
|
|
34
|
+
type: 'tabs',
|
|
35
|
+
tabs: [
|
|
36
|
+
{
|
|
37
|
+
label: 'Settings',
|
|
38
|
+
fields: [{ type: 'row', fields: [ActiveField(), DevModeField(), UniqueTitleField('New Footer'), TestPathField] }],
|
|
39
|
+
},
|
|
40
|
+
{ label: 'Content', fields: [ClassNameField({ label: 'Footer Elements Class Name' }), ChildrenBlocks] },
|
|
41
|
+
StorageTab(),
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
...generateAPFFields(APFunctions),
|
|
45
|
+
],
|
|
46
|
+
hooks: { beforeChange: [atomicHook], afterDelete: [revalidateCacheOnDelete] },
|
|
47
|
+
versions: { drafts: { schedulePublish: true, validate: true }, maxPerDoc: 50 },
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import { Footer as FooterType } from '@/ts/types'
|
|
3
|
+
import { RenderChildren } from '@/components/child/renderChildren'
|
|
4
|
+
|
|
5
|
+
export const Footer = async ({ footer }: { footer: FooterType }) => {
|
|
6
|
+
if (!footer) return <footer>No Footer Found</footer>
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<footer className={footer?.ClassName || undefined}>
|
|
10
|
+
<RenderChildren blocks={footer?.children} />
|
|
11
|
+
</footer>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { APFControlsPath } from '@/ui'
|
|
2
|
+
import { ActiveField } from '@/fields/active'
|
|
3
|
+
import { authd } from '@/access/authenticated'
|
|
4
|
+
import { DevModeField } from '@/fields/devMode'
|
|
5
|
+
import type { CollectionConfig } from 'payload'
|
|
6
|
+
import { type APFunction } from '@/ts/types/apf'
|
|
7
|
+
import { TestPathField } from '@/fields/testPath'
|
|
8
|
+
import { ClassNameField } from '@/fields/className'
|
|
9
|
+
import { UniqueTitleField } from '@/fields/uniqueTitle'
|
|
10
|
+
import { generateAPFFields } from '@/fields/apf/storage'
|
|
11
|
+
import { ChildrenBlocks } from '@/fields/blocks/children'
|
|
12
|
+
import { StorageTab } from '@/fields/tabs/collection/storage'
|
|
13
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
14
|
+
import { revalidateCacheOnDelete } from '@/hooks/collection/revalidate'
|
|
15
|
+
import { generateLivePreviewPath } from '@/utilities/generatePreviewPath'
|
|
16
|
+
|
|
17
|
+
const APFunctions: APFunction[] = ['form', 'actions', 'classes', 'active']
|
|
18
|
+
|
|
19
|
+
export const Header: CollectionConfig = {
|
|
20
|
+
slug: 'header',
|
|
21
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
22
|
+
admin: {
|
|
23
|
+
group: 'Website',
|
|
24
|
+
useAsTitle: 'title',
|
|
25
|
+
enableListViewSelectAPI: true,
|
|
26
|
+
defaultColumns: ['title', 'active', '_status'],
|
|
27
|
+
preview: (data, { req }) => generateLivePreviewPath({ data, req }),
|
|
28
|
+
livePreview: { url: ({ data, req }) => generateLivePreviewPath({ data, req }) },
|
|
29
|
+
components: { edit: { beforeDocumentControls: [{ path: APFControlsPath, clientProps: { APFunctions } }] } },
|
|
30
|
+
},
|
|
31
|
+
fields: [
|
|
32
|
+
{
|
|
33
|
+
type: 'tabs',
|
|
34
|
+
tabs: [
|
|
35
|
+
{
|
|
36
|
+
label: 'Settings',
|
|
37
|
+
fields: [{ type: 'row', fields: [ActiveField(), DevModeField(), UniqueTitleField('New Header'), TestPathField] }],
|
|
38
|
+
},
|
|
39
|
+
{ label: 'Content', fields: [ClassNameField({ label: 'Header Elements Class Name' }), ChildrenBlocks] },
|
|
40
|
+
StorageTab(),
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
...generateAPFFields(APFunctions),
|
|
44
|
+
],
|
|
45
|
+
hooks: { beforeChange: [atomicHook], afterDelete: [revalidateCacheOnDelete] },
|
|
46
|
+
versions: { drafts: { schedulePublish: true, validate: true }, maxPerDoc: 50 },
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import { Header as HeaderType } from '@/ts/types'
|
|
3
|
+
import { RenderChildren } from '@/components/child/renderChildren'
|
|
4
|
+
|
|
5
|
+
export const Header = async ({ header }: { header: HeaderType }) => {
|
|
6
|
+
if (!header) return <header>No Header Found</header>
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<header className={header?.ClassName || undefined}>
|
|
10
|
+
<RenderChildren blocks={header?.children} />
|
|
11
|
+
</header>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { APField } from '@/fields/apf'
|
|
2
|
+
import { ActiveField } from '@/fields/active'
|
|
3
|
+
import { authd } from '@/access/authenticated'
|
|
4
|
+
import type { CollectionConfig } from 'payload'
|
|
5
|
+
import { type APFunction } from '@/ts/types/apf'
|
|
6
|
+
import { TestPathField } from '@/fields/testPath'
|
|
7
|
+
import { APFControlsPath, IconLabelPath } from '@/ui'
|
|
8
|
+
import { UniqueTitleField } from '@/fields/uniqueTitle'
|
|
9
|
+
import { generateAPFFields } from '@/fields/apf/storage'
|
|
10
|
+
//import DefaultIconList from '@/collections/iconSets/defaults'
|
|
11
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
12
|
+
import { revalidateCacheOnDelete } from '@/hooks/collection/revalidate'
|
|
13
|
+
import { generateLivePreviewPath } from '@/utilities/generatePreviewPath'
|
|
14
|
+
|
|
15
|
+
const APFunctions: APFunction[] = ['active']
|
|
16
|
+
|
|
17
|
+
const d = {
|
|
18
|
+
icon: 'Select an icon',
|
|
19
|
+
name: 'The name of the icon',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const IconSet: CollectionConfig = {
|
|
23
|
+
slug: 'iconSet',
|
|
24
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
25
|
+
admin: {
|
|
26
|
+
group: 'Sets',
|
|
27
|
+
useAsTitle: 'title',
|
|
28
|
+
enableListViewSelectAPI: true,
|
|
29
|
+
defaultColumns: ['title', 'active', '_status'],
|
|
30
|
+
preview: (data, { req }) => generateLivePreviewPath({ data, req }),
|
|
31
|
+
livePreview: { url: ({ data, req }) => generateLivePreviewPath({ data, req }) },
|
|
32
|
+
components: { edit: { beforeDocumentControls: [{ path: APFControlsPath, clientProps: { APFunctions } }] } },
|
|
33
|
+
},
|
|
34
|
+
fields: [
|
|
35
|
+
{
|
|
36
|
+
type: 'tabs',
|
|
37
|
+
tabs: [
|
|
38
|
+
{
|
|
39
|
+
label: 'Settings',
|
|
40
|
+
fields: [{ type: 'row', fields: [ActiveField(), UniqueTitleField('New Icon Set'), TestPathField] }],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'Icons',
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: 'iconsArray',
|
|
47
|
+
type: 'array',
|
|
48
|
+
admin: { initCollapsed: true, components: { RowLabel: IconLabelPath } },
|
|
49
|
+
//defaultValue: DefaultIconList,
|
|
50
|
+
fields: [
|
|
51
|
+
{
|
|
52
|
+
type: 'row',
|
|
53
|
+
fields: [
|
|
54
|
+
APField({
|
|
55
|
+
name: 'name',
|
|
56
|
+
type: 'text',
|
|
57
|
+
kebab: true,
|
|
58
|
+
required: true,
|
|
59
|
+
admin: { width: '25%', description: d.name, style: { maxWidth: '350px' } },
|
|
60
|
+
}),
|
|
61
|
+
{
|
|
62
|
+
name: 'icon',
|
|
63
|
+
type: 'upload',
|
|
64
|
+
relationTo: 'icon',
|
|
65
|
+
displayPreview: false,
|
|
66
|
+
admin: { allowCreate: false, width: '75%', description: d.icon, style: { maxWidth: '350px' } },
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
...generateAPFFields(APFunctions),
|
|
77
|
+
],
|
|
78
|
+
hooks: { beforeChange: [atomicHook], afterDelete: [revalidateCacheOnDelete] },
|
|
79
|
+
versions: { drafts: { schedulePublish: true, validate: true }, maxPerDoc: 50 },
|
|
80
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const GENERAL_ICON_VARIANTS = [
|
|
2
|
+
{ value: 'day', label: 'Day' },
|
|
3
|
+
{ value: 'night', label: 'Night' },
|
|
4
|
+
{ value: 'person', label: 'Person' },
|
|
5
|
+
{ value: 'people', label: 'People' },
|
|
6
|
+
{ value: 'photo', label: 'Photo' },
|
|
7
|
+
{ value: 'video', label: 'Video' },
|
|
8
|
+
{ value: 'music', label: 'Music' },
|
|
9
|
+
{ value: 'quote', label: 'Quote' },
|
|
10
|
+
{ value: 'text', label: 'Text' },
|
|
11
|
+
] as const
|
|
12
|
+
|
|
13
|
+
export const INTERFACE_ICON_VARIANTS = [
|
|
14
|
+
{ value: 'checkmark', label: 'Checkmark' },
|
|
15
|
+
{ value: 'select', label: 'Select' },
|
|
16
|
+
{ value: 'menu', label: 'Menu' },
|
|
17
|
+
{ value: 'home', label: 'Home' },
|
|
18
|
+
{ value: 'back', label: 'Back' },
|
|
19
|
+
{ value: 'forward', label: 'Forward' },
|
|
20
|
+
{ value: 'close', label: 'Close' },
|
|
21
|
+
{ value: 'search', label: 'Search' },
|
|
22
|
+
{ value: 'settings', label: 'Settings' },
|
|
23
|
+
{ value: 'ellipsis', label: 'Ellipsis' },
|
|
24
|
+
{ value: 'alignRight', label: 'Align Right' },
|
|
25
|
+
{ value: 'alignLeft', label: 'Align Left' },
|
|
26
|
+
{ value: 'chevronDown', label: 'Chevron Down' },
|
|
27
|
+
{ value: 'chevronUp', label: 'Chevron Up' },
|
|
28
|
+
{ value: 'chevronLeft', label: 'Chevron Left' },
|
|
29
|
+
{ value: 'chevronRight', label: 'Chevron Right' },
|
|
30
|
+
{ value: 'play', label: 'Play' },
|
|
31
|
+
{ value: 'pause', label: 'Pause' },
|
|
32
|
+
{ value: 'stop', label: 'Stop' },
|
|
33
|
+
{ value: 'copy', label: 'Copy' },
|
|
34
|
+
{ value: 'link', label: 'Link' },
|
|
35
|
+
{ value: 'plus', label: 'Plus' },
|
|
36
|
+
{ value: 'minus', label: 'Minus' },
|
|
37
|
+
] as const
|
|
38
|
+
|
|
39
|
+
export const SOCIAL_ICON_VARIANTS = [
|
|
40
|
+
{ value: 'facebook', label: 'Facebook' },
|
|
41
|
+
{ value: 'twitter', label: 'Twitter' },
|
|
42
|
+
{ value: 'instagram', label: 'Instagram' },
|
|
43
|
+
{ value: 'linkedin', label: 'LinkedIn' },
|
|
44
|
+
{ value: 'reddit', label: 'Reddit' },
|
|
45
|
+
{ value: 'youtube', label: 'YouTube' },
|
|
46
|
+
{ value: 'bluesky', label: 'Bluesky' },
|
|
47
|
+
{ value: 'tiktok', label: 'TikTok' },
|
|
48
|
+
{ value: 'twitch', label: 'Twitch' },
|
|
49
|
+
{ value: 'discord', label: 'Discord' },
|
|
50
|
+
{ value: 'github', label: 'GitHub' },
|
|
51
|
+
] as const
|
|
52
|
+
|
|
53
|
+
export const SHAPES_ICON_VARIANTS = [
|
|
54
|
+
{ value: 'circle', label: 'Circle' },
|
|
55
|
+
{ value: 'square', label: 'Square' },
|
|
56
|
+
{ value: 'triangle', label: 'Triangle' },
|
|
57
|
+
{ value: 'diamond', label: 'Diamond' },
|
|
58
|
+
] as const
|
|
59
|
+
|
|
60
|
+
export const BRAND_ICON_VARIANTS = [{ value: 'logo', label: 'Logo' }] as const
|
|
61
|
+
|
|
62
|
+
export type IconName =
|
|
63
|
+
| (typeof GENERAL_ICON_VARIANTS)[number]['value']
|
|
64
|
+
| (typeof INTERFACE_ICON_VARIANTS)[number]['value']
|
|
65
|
+
| (typeof SOCIAL_ICON_VARIANTS)[number]['value']
|
|
66
|
+
| (typeof SHAPES_ICON_VARIANTS)[number]['value']
|
|
67
|
+
| (typeof BRAND_ICON_VARIANTS)[number]['value']
|
|
68
|
+
|
|
69
|
+
const IconList = {
|
|
70
|
+
GENERAL_ICON_VARIANTS,
|
|
71
|
+
INTERFACE_ICON_VARIANTS,
|
|
72
|
+
SOCIAL_ICON_VARIANTS,
|
|
73
|
+
SHAPES_ICON_VARIANTS,
|
|
74
|
+
BRAND_ICON_VARIANTS,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const DefaultIconList = Object.values(IconList)
|
|
78
|
+
.flat()
|
|
79
|
+
.map((icon) => ({ name: icon?.value }))
|
|
80
|
+
|
|
81
|
+
export default DefaultIconList
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { authd } from '@/access/authenticated'
|
|
2
|
+
import type { CollectionConfig } from 'payload'
|
|
3
|
+
import { formatSVGHook } from '@/hooks/collection/formatSVG'
|
|
4
|
+
import { revalidateCache } from '@/hooks/collection/revalidate'
|
|
5
|
+
|
|
6
|
+
export const Icon: CollectionConfig = {
|
|
7
|
+
slug: 'icon',
|
|
8
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
9
|
+
admin: { group: 'Assets', useAsTitle: 'filename', enableListViewSelectAPI: true, defaultColumns: ['filename', 'filesize', 'updatedAt'] },
|
|
10
|
+
fields: [
|
|
11
|
+
{ type: 'text', name: 'optimized', admin: { readOnly: true, condition: (data) => Boolean(data?.optimized) } },
|
|
12
|
+
{
|
|
13
|
+
type: 'code',
|
|
14
|
+
name: 'svgString',
|
|
15
|
+
admin: { language: 'xml', condition: (data) => Boolean(data?.svgString), editorOptions: { wordWrap: 'off', scrollBeyondLastLine: false } },
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
upload: { mimeTypes: ['image/svg+xml'] },
|
|
19
|
+
hooks: { beforeChange: [formatSVGHook, revalidateCache] },
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { anyone } from '@/access/anyone'
|
|
2
|
+
import { authd } from '@/access/authenticated'
|
|
3
|
+
import { revalidateCache } from '@/hooks/collection/revalidate'
|
|
4
|
+
import type { CollectionConfig, ImageUploadFormatOptions } from 'payload'
|
|
5
|
+
|
|
6
|
+
const formatOptions: ImageUploadFormatOptions = { format: 'webp', options: { nearLossless: true, quality: 75 } }
|
|
7
|
+
|
|
8
|
+
export const Images: CollectionConfig = {
|
|
9
|
+
slug: 'images',
|
|
10
|
+
access: { create: authd, delete: authd, read: anyone, update: authd },
|
|
11
|
+
admin: { group: 'Assets', enableListViewSelectAPI: true },
|
|
12
|
+
fields: [{ name: 'alt', type: 'text' }],
|
|
13
|
+
hooks: { beforeChange: [revalidateCache] },
|
|
14
|
+
upload: {
|
|
15
|
+
formatOptions,
|
|
16
|
+
focalPoint: true,
|
|
17
|
+
adminThumbnail: 'thumbnail',
|
|
18
|
+
mimeTypes: ['image/png', 'image/jpeg', 'image/jpg', 'image/webp', 'image/avif'],
|
|
19
|
+
imageSizes: [
|
|
20
|
+
{ formatOptions, name: 'thumbnail', width: 300 },
|
|
21
|
+
{ formatOptions, name: 'square', width: 500, height: 500 },
|
|
22
|
+
{ formatOptions, name: 'small', width: 600 },
|
|
23
|
+
{ formatOptions, name: 'medium', width: 900 },
|
|
24
|
+
{ formatOptions, name: 'large', width: 1400 },
|
|
25
|
+
{ formatOptions, name: 'xlarge', width: 1920 },
|
|
26
|
+
{ formatOptions, name: 'og', width: 1200, height: 630, crop: 'center' },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Icon } from './icons'
|
|
2
|
+
import { Users } from './users'
|
|
3
|
+
import { Images } from './images'
|
|
4
|
+
import { Favicons } from './favicons'
|
|
5
|
+
import { MuxVideo } from './muxVideos'
|
|
6
|
+
import { Font } from './fonts/collection'
|
|
7
|
+
import { Pages } from './pages/collection'
|
|
8
|
+
import { Header } from './headers/collection'
|
|
9
|
+
import { Footer } from './footers/collection'
|
|
10
|
+
import { IconSet } from './iconSets/collection'
|
|
11
|
+
import DesignSet from './designSets/collection'
|
|
12
|
+
import ShortcutSet from './shortcutSets/collection'
|
|
13
|
+
import { PostHogProperty } from './posthogProperty'
|
|
14
|
+
|
|
15
|
+
const collections = [Font, Icon, Users, Pages, Footer, Header, Images, Favicons, IconSet, MuxVideo, DesignSet, ShortcutSet, PostHogProperty]
|
|
16
|
+
|
|
17
|
+
export default collections
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { anyone } from '@/access/anyone'
|
|
2
|
+
import { authd } from '@/access/authenticated'
|
|
3
|
+
import type { CollectionConfig } from 'payload'
|
|
4
|
+
|
|
5
|
+
export const MuxVideo: CollectionConfig = {
|
|
6
|
+
slug: 'mux-video', //Do not change. This slug means this extends the Mux Video plugin.
|
|
7
|
+
admin: { group: 'Assets', enableListViewSelectAPI: true },
|
|
8
|
+
access: { create: authd, delete: authd, read: anyone, update: authd },
|
|
9
|
+
fields: [
|
|
10
|
+
//Add fields here to be appended to the mux video plugins default fields.
|
|
11
|
+
//Existing fields: https://github.com/oversightstudio/payload-plugins/blob/main/packages/mux-video/src/collections/MuxVideo.ts
|
|
12
|
+
],
|
|
13
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { APFControlsPath } from '@/ui'
|
|
2
|
+
import { APField } from '@/fields/apf'
|
|
3
|
+
import { slugField } from '@/fields/slug'
|
|
4
|
+
import { authd } from '@/access/authenticated'
|
|
5
|
+
import { type APFunction } from '@/ts/types'
|
|
6
|
+
import type { CollectionConfig } from 'payload'
|
|
7
|
+
import { ClassNameField } from '@/fields/className'
|
|
8
|
+
import { updateHrefHook } from '@/hooks/field/href'
|
|
9
|
+
import { SEOTab } from '@/collections/pages/tabs/SEO'
|
|
10
|
+
import { ChildrenBlocks } from '@/fields/blocks/children'
|
|
11
|
+
import { StorageTab } from '@/fields/tabs/collection/storage'
|
|
12
|
+
import { SettingsTab } from '@/collections/pages/tabs/settings'
|
|
13
|
+
import { updatePublishedAtHook } from '@/hooks/field/publishedAt'
|
|
14
|
+
import { createParentField } from '@payloadcms/plugin-nested-docs'
|
|
15
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
16
|
+
import { revalidateCacheOnDelete } from '@/hooks/collection/revalidate'
|
|
17
|
+
import { generateLivePreviewPath } from '@/utilities/generatePreviewPath'
|
|
18
|
+
import { authenticatedOrPublished } from '@/access/authenticatedOrPublished'
|
|
19
|
+
|
|
20
|
+
const APFunctions: APFunction[] = ['form', 'page', 'pages', 'actions', 'classes', 'seo', 'sitemap']
|
|
21
|
+
|
|
22
|
+
const d = {
|
|
23
|
+
liveDescription: 'If unchecked, the page will not be indexed by search engines, and can only be viewed in admins live preview.',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Pages: CollectionConfig<'pages'> = {
|
|
27
|
+
slug: 'pages',
|
|
28
|
+
defaultPopulate: { title: true, slug: true, href: true },
|
|
29
|
+
access: { create: authd, delete: authd, read: authenticatedOrPublished, update: authd },
|
|
30
|
+
admin: {
|
|
31
|
+
group: 'Website',
|
|
32
|
+
useAsTitle: 'href',
|
|
33
|
+
enableListViewSelectAPI: true,
|
|
34
|
+
preview: (data, { req }) => generateLivePreviewPath({ data, req }),
|
|
35
|
+
livePreview: { url: ({ data, req }) => generateLivePreviewPath({ data, req }) },
|
|
36
|
+
defaultColumns: ['href', 'title', 'publishedAt'],
|
|
37
|
+
components: { edit: { beforeDocumentControls: [{ path: APFControlsPath, clientProps: { APFunctions } }] } },
|
|
38
|
+
},
|
|
39
|
+
fields: [
|
|
40
|
+
{
|
|
41
|
+
type: 'row',
|
|
42
|
+
fields: [
|
|
43
|
+
APField({ type: 'text', apf: ['page'], name: 'title', required: true, admin: { width: '50%', style: { maxWidth: '500px' } } }),
|
|
44
|
+
{
|
|
45
|
+
type: 'date',
|
|
46
|
+
name: 'publishedAt',
|
|
47
|
+
hooks: { beforeChange: [updatePublishedAtHook] },
|
|
48
|
+
admin: { width: '30%', style: { maxWidth: '300px' } },
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
...slugField('title', {
|
|
53
|
+
slugOverrides: { admin: { width: '30%', style: { maxWidth: '300px' } } },
|
|
54
|
+
}),
|
|
55
|
+
{
|
|
56
|
+
type: 'row',
|
|
57
|
+
fields: [
|
|
58
|
+
createParentField('pages', { name: 'parent', admin: { width: '30%', style: { maxWidth: '305px' }, allowCreate: false } }),
|
|
59
|
+
APField({
|
|
60
|
+
type: 'text',
|
|
61
|
+
name: 'href',
|
|
62
|
+
apf: ['page', 'pages'],
|
|
63
|
+
hooks: { beforeChange: [updateHrefHook] },
|
|
64
|
+
admin: { width: '30%', readOnly: true, style: { maxWidth: '300px' } },
|
|
65
|
+
}),
|
|
66
|
+
APField({
|
|
67
|
+
type: 'checkbox',
|
|
68
|
+
apf: ['page', 'pages', 'sitemap'],
|
|
69
|
+
name: 'live',
|
|
70
|
+
required: true,
|
|
71
|
+
defaultValue: true,
|
|
72
|
+
admin: { width: '20%', description: d.liveDescription },
|
|
73
|
+
}),
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'tabs',
|
|
78
|
+
tabs: [
|
|
79
|
+
{ label: 'Content', fields: [ClassNameField({ namePrefix: 'main', defaultValue: 'page-main' }), ChildrenBlocks] },
|
|
80
|
+
SEOTab(),
|
|
81
|
+
StorageTab(),
|
|
82
|
+
SettingsTab(),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
hooks: { beforeChange: [atomicHook], afterDelete: [revalidateCacheOnDelete] },
|
|
87
|
+
versions: { drafts: { schedulePublish: true, validate: true }, maxPerDoc: 50 },
|
|
88
|
+
}
|