@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,78 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import sharp from 'sharp'
|
|
3
|
+
import Globals from '@/globals'
|
|
4
|
+
import { plugins } from '@/plugins'
|
|
5
|
+
import { buildConfig } from 'payload'
|
|
6
|
+
import Collections from '@/collections'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import { Users } from '@/collections/users'
|
|
9
|
+
import JSONSchemaExtensions from '@/ts/JSONSchema'
|
|
10
|
+
import ChildrenBlocks from '@/blocks/children/blocks'
|
|
11
|
+
//import { resendAdapter } from '@payloadcms/email-resend'
|
|
12
|
+
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
|
13
|
+
import { AllActionBlocks } from '@/blocks/actions/blocks'
|
|
14
|
+
import { getServerSideURL } from '@/utilities/get/getURL'
|
|
15
|
+
import { defaultLexical } from '@/blocks/children/richText/defaultLexical'
|
|
16
|
+
import { IconPath, LogoPath, SiteTriggersPath, BeforeDashboard } from '@/ui'
|
|
17
|
+
import FormSanitationBlocks from '@/blocks/submitForm/form/sanitation/blocks'
|
|
18
|
+
import FormValidationBlocks from '@/blocks/submitForm/form/validation/blocks'
|
|
19
|
+
import FormRateLimitBlocks from '@/blocks/submitForm/form/rateLimiting/blocks'
|
|
20
|
+
import InputSanitationBlocks from '@/blocks/submitForm/input/sanitation/blocks'
|
|
21
|
+
import InputValidationBlocks from '@/blocks/submitForm/input/validation/blocks'
|
|
22
|
+
|
|
23
|
+
const filename = fileURLToPath(import.meta.url)
|
|
24
|
+
const dirname = path.dirname(filename)
|
|
25
|
+
|
|
26
|
+
export default buildConfig({
|
|
27
|
+
sharp,
|
|
28
|
+
plugins: [...plugins],
|
|
29
|
+
globals: [...Globals],
|
|
30
|
+
editor: defaultLexical,
|
|
31
|
+
graphQL: { disable: true },
|
|
32
|
+
serverURL: getServerSideURL(), // Used in csrf white list and live preview.
|
|
33
|
+
collections: [...Collections],
|
|
34
|
+
secret: process.env.PAYLOAD_SECRET || '',
|
|
35
|
+
cors: [getServerSideURL()].filter(Boolean),
|
|
36
|
+
typescript: { schema: [JSONSchemaExtensions], outputFile: path.resolve(dirname, 'ts/types/payload-types.ts') },
|
|
37
|
+
db: mongooseAdapter({ url: process.env.MONGODB_URI || '', collectionsSchemaOptions: { pages: { minimize: true } }, allowAdditionalKeys: false }),
|
|
38
|
+
blocks: [
|
|
39
|
+
...ChildrenBlocks,
|
|
40
|
+
...AllActionBlocks,
|
|
41
|
+
...FormRateLimitBlocks,
|
|
42
|
+
...FormSanitationBlocks,
|
|
43
|
+
...FormValidationBlocks,
|
|
44
|
+
...InputSanitationBlocks,
|
|
45
|
+
...InputValidationBlocks,
|
|
46
|
+
],
|
|
47
|
+
/* email: resendAdapter({
|
|
48
|
+
defaultFromAddress: 'chad@notifications.atomicpayload.com',
|
|
49
|
+
defaultFromName: 'Chad At Atomic Payload',
|
|
50
|
+
apiKey: process.env.RESEND_API_KEY || '',
|
|
51
|
+
}), */
|
|
52
|
+
admin: {
|
|
53
|
+
user: Users.slug,
|
|
54
|
+
importMap: { baseDir: path.resolve(dirname) },
|
|
55
|
+
components: {
|
|
56
|
+
beforeDashboard: process.env.INCLUDE_SEED === 'true' ? [BeforeDashboard] : [],
|
|
57
|
+
beforeNavLinks: [SiteTriggersPath],
|
|
58
|
+
graphics: { Icon: IconPath, Logo: LogoPath },
|
|
59
|
+
},
|
|
60
|
+
livePreview: {
|
|
61
|
+
breakpoints: [
|
|
62
|
+
{ label: 'Mobile', name: 'mobile', width: 375, height: 667 },
|
|
63
|
+
{ label: 'Tablet', name: 'tablet', width: 768, height: 1024 },
|
|
64
|
+
{ label: 'Desktop', name: 'desktop', width: 1440, height: 900 },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
meta: {
|
|
68
|
+
titleSuffix: ' - Atomic Payload',
|
|
69
|
+
description: 'A Website Builder Where All You Need To Know Is Tailwind.',
|
|
70
|
+
icons: [{ type: 'image/svg+xml', rel: 'icon', url: '/adminFavicon.svg' }],
|
|
71
|
+
openGraph: {
|
|
72
|
+
title: 'Atomic Payload',
|
|
73
|
+
description: 'A Website Builder Where All You Need To Know Is Tailwind.',
|
|
74
|
+
images: [{ height: 630, width: 1200, url: '/ogImage.webp' }],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Images } from '@/collections/images'
|
|
2
|
+
import { blurDataUrlsPlugin } from '@oversightstudio/blur-data-urls'
|
|
3
|
+
|
|
4
|
+
export const blurDataUrlsPluginConfig = blurDataUrlsPlugin({
|
|
5
|
+
enabled: true,
|
|
6
|
+
collections: [Images],
|
|
7
|
+
blurOptions: { blur: 18, width: 32, height: 'auto' },
|
|
8
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { authd } from '@/access/authenticated'
|
|
2
|
+
import { revalidateCache } from '@/hooks/collection/revalidate'
|
|
3
|
+
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
|
|
4
|
+
|
|
5
|
+
function insertFieldAtPosition<T>(fields: T[], field: T, position: number): T[] {
|
|
6
|
+
return [...fields.slice(0, position), field, ...fields.slice(position)]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const formBuilderPluginConfig = formBuilderPlugin({
|
|
10
|
+
redirectRelationships: ['pages'],
|
|
11
|
+
formSubmissionOverrides: {
|
|
12
|
+
admin: { group: 'Forms', defaultColumns: ['form', 'submissionData', 'updatedAt'] },
|
|
13
|
+
hooks: { beforeChange: [revalidateCache] },
|
|
14
|
+
},
|
|
15
|
+
fields: {
|
|
16
|
+
select: false,
|
|
17
|
+
email: false,
|
|
18
|
+
state: false,
|
|
19
|
+
country: false,
|
|
20
|
+
checkbox: false,
|
|
21
|
+
number: false,
|
|
22
|
+
message: false,
|
|
23
|
+
date: false,
|
|
24
|
+
payment: false,
|
|
25
|
+
radio: false,
|
|
26
|
+
},
|
|
27
|
+
formOverrides: {
|
|
28
|
+
slug: 'forms',
|
|
29
|
+
admin: { group: 'Forms' },
|
|
30
|
+
access: { read: authd, update: authd },
|
|
31
|
+
hooks: { beforeChange: [revalidateCache] },
|
|
32
|
+
labels: { singular: 'Backend Form', plural: 'Backend Forms' },
|
|
33
|
+
fields: ({ defaultFields }) => {
|
|
34
|
+
const fieldsToRemove = ['submitButtonLabel', 'confirmationType', 'confirmationMessage', 'redirect', 'fields']
|
|
35
|
+
const filteredFields = defaultFields.filter((field: any) => !fieldsToRemove.includes(field?.name))
|
|
36
|
+
const updatedFields = insertFieldAtPosition(filteredFields, { type: 'group', fields: [] }, 2)
|
|
37
|
+
return [...updatedFields]
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//Plugin Imports
|
|
2
|
+
import { Plugin } from 'payload'
|
|
3
|
+
|
|
4
|
+
//Plugin Configurations
|
|
5
|
+
import { muxVideoPluginConfig } from './muxVideo'
|
|
6
|
+
import { nestedDocsPluginConfig } from './nestedDocs'
|
|
7
|
+
import { formBuilderPluginConfig } from './formBuilder'
|
|
8
|
+
import { blurDataUrlsPluginConfig } from './blurDataUrls'
|
|
9
|
+
import { vercelBlobStoragePluginConfig } from './vercelBlobStorage'
|
|
10
|
+
|
|
11
|
+
export const plugins: Plugin[] = [
|
|
12
|
+
muxVideoPluginConfig,
|
|
13
|
+
nestedDocsPluginConfig,
|
|
14
|
+
formBuilderPluginConfig,
|
|
15
|
+
blurDataUrlsPluginConfig,
|
|
16
|
+
vercelBlobStoragePluginConfig,
|
|
17
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { muxVideoPlugin } from '@oversightstudio/mux-video'
|
|
2
|
+
|
|
3
|
+
export const muxVideoPluginConfig = muxVideoPlugin({
|
|
4
|
+
enabled: true,
|
|
5
|
+
adminThumbnail: 'image',
|
|
6
|
+
extendCollection: 'mux-video', //Most changes should be made to the MuxVideo collection. @/collections/muxVideos.ts
|
|
7
|
+
uploadSettings: { cors_origin: process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000' },
|
|
8
|
+
initSettings: {
|
|
9
|
+
tokenId: process.env.MUX_TOKEN_ID || '',
|
|
10
|
+
tokenSecret: process.env.MUX_TOKEN_SECRET || '',
|
|
11
|
+
webhookSecret: process.env.MUX_WEBHOOK_SIGNING_SECRET || '',
|
|
12
|
+
},
|
|
13
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { nestedDocsPlugin } from '@payloadcms/plugin-nested-docs'
|
|
2
|
+
|
|
3
|
+
export const nestedDocsPluginConfig = nestedDocsPlugin({
|
|
4
|
+
collections: ['pages'],
|
|
5
|
+
parentFieldSlug: 'parent',
|
|
6
|
+
breadcrumbsFieldSlug: 'breadcrumbs',
|
|
7
|
+
generateURL: (docs) => docs.reduce((url, doc) => `${url}/${doc.slug}`, ''),
|
|
8
|
+
generateLabel: (docs) => docs.reduce((url, doc) => `${url}/${doc.slug}`, ''),
|
|
9
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { vercelBlobStorage } from '@payloadcms/storage-vercel-blob'
|
|
2
|
+
|
|
3
|
+
export const vercelBlobStoragePluginConfig = vercelBlobStorage({
|
|
4
|
+
enabled: true,
|
|
5
|
+
clientUploads: true,
|
|
6
|
+
token: process.env.BLOB_READ_WRITE_TOKEN,
|
|
7
|
+
collections: { images: true, font: true, icon: true, favicons: true },
|
|
8
|
+
})
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from '@/ts/zap'
|
|
2
|
+
import type { JSONSchema4 } from 'json-schema'
|
|
3
|
+
import CollectionSchemas from '@/collections/zap'
|
|
4
|
+
import { ActionBlockType } from '@/blocks/actions/zap'
|
|
5
|
+
import { Runner, Attributer } from '@/hooks/frontEnd/useActions/dispatch/zap'
|
|
6
|
+
import { ChildBlockType, BackdropChildSlug } from '@/blocks/children/zap'
|
|
7
|
+
import { InputValidationBlockType, InputSanitationBlockType } from '@/blocks/submitForm/input/zap'
|
|
8
|
+
import { FormRateLimitBlockType, FormSanitationBlockType, FormValidationBlockType } from '@/blocks/submitForm/form/zap'
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
const instantiate = [Runner, Attributer, CollectionSchemas] //Ensure the nested schemas are added to global registry before type generation
|
|
12
|
+
|
|
13
|
+
type GenerateProps = { name: string; refs: (string | undefined)[] }
|
|
14
|
+
|
|
15
|
+
const generateBlocksType = ({ name, refs }: GenerateProps) => ({
|
|
16
|
+
[name]: { oneOf: [{ items: { oneOf: refs.filter(Boolean).map((ref) => ({ $ref: `#/definitions/${ref}` })) } }] },
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This function is used to add custom type definitions to the JSON schema.
|
|
21
|
+
* Which can be used as a normal type, or referenced in other JSON schema.
|
|
22
|
+
*/
|
|
23
|
+
const JSONSchemaExtensions = ({ jsonSchema }: { jsonSchema: JSONSchema4 }): JSONSchema4 => ({
|
|
24
|
+
...jsonSchema,
|
|
25
|
+
definitions: {
|
|
26
|
+
...jsonSchema.definitions,
|
|
27
|
+
//Add type definitions as needed here
|
|
28
|
+
...z.ap.toJSONSchema(),
|
|
29
|
+
|
|
30
|
+
// Child Blocks
|
|
31
|
+
...generateBlocksType({ name: 'ChildBlocks', refs: ChildBlockType.options }),
|
|
32
|
+
...generateBlocksType({ name: 'BackdropChildren', refs: BackdropChildSlug.options }),
|
|
33
|
+
|
|
34
|
+
// Action Blocks
|
|
35
|
+
...generateBlocksType({ name: 'ActionBlocks', refs: ActionBlockType.options }),
|
|
36
|
+
|
|
37
|
+
// Form Function Blocks
|
|
38
|
+
...generateBlocksType({ name: 'FormRateLimitBlocks', refs: FormRateLimitBlockType.options }),
|
|
39
|
+
...generateBlocksType({ name: 'FormSanitationBlocks', refs: FormSanitationBlockType.options }),
|
|
40
|
+
...generateBlocksType({ name: 'FormValidationBlocks', refs: FormValidationBlockType.options }),
|
|
41
|
+
|
|
42
|
+
//Input Function Blocks
|
|
43
|
+
...generateBlocksType({ name: 'InputSanitationBlocks', refs: InputSanitationBlockType.options }),
|
|
44
|
+
...generateBlocksType({ name: 'InputValidationBlocks', refs: InputValidationBlockType.options }),
|
|
45
|
+
|
|
46
|
+
//Atomic Forms - Dynamically generated from imported arrays
|
|
47
|
+
StoredAtomicFormInput: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
id: { type: 'string' },
|
|
51
|
+
type: { type: 'string' },
|
|
52
|
+
inputName: { type: 'string' },
|
|
53
|
+
sanitationBlocks: { $ref: '#/definitions/InputSanitationBlocks' },
|
|
54
|
+
validationBlocks: { $ref: '#/definitions/InputValidationBlocks' },
|
|
55
|
+
},
|
|
56
|
+
required: ['id', 'type', 'inputName'],
|
|
57
|
+
additionalProperties: false,
|
|
58
|
+
},
|
|
59
|
+
StoredAtomicForm: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
id: { type: 'string' },
|
|
63
|
+
sm: { type: 'string' },
|
|
64
|
+
em: { type: 'string' },
|
|
65
|
+
backendForm: { type: 'string' },
|
|
66
|
+
sanitation: { $ref: '#/definitions/FormSanitationBlocks' },
|
|
67
|
+
validation: { $ref: '#/definitions/FormValidationBlocks' },
|
|
68
|
+
rateLimiting: { $ref: '#/definitions/FormRateLimitBlocks' },
|
|
69
|
+
inputs: { type: 'array', items: { $ref: '#/definitions/StoredAtomicFormInput' } },
|
|
70
|
+
},
|
|
71
|
+
required: ['id', 'backendForm'],
|
|
72
|
+
additionalProperties: false,
|
|
73
|
+
},
|
|
74
|
+
StoredAtomicAction: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
id: { type: 'string' },
|
|
78
|
+
runners: { $ref: '#/definitions/Runners' },
|
|
79
|
+
attributers: { $ref: '#/definitions/Attributers' },
|
|
80
|
+
actions: { type: 'array', items: { $ref: '#/definitions/ActionBlockType' } },
|
|
81
|
+
},
|
|
82
|
+
required: ['id', 'actions'],
|
|
83
|
+
additionalProperties: false,
|
|
84
|
+
},
|
|
85
|
+
StoredAtomicActions: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
patternProperties: { '^.*$': { $ref: '#/definitions/StoredAtomicAction' } },
|
|
88
|
+
additionalProperties: false,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
export default JSONSchemaExtensions
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DesignSet, Footer, Header, Page, ShortcutSet } from '@/ts/types'
|
|
2
|
+
|
|
3
|
+
declare module 'payload' {
|
|
4
|
+
export interface RequestContext {
|
|
5
|
+
pages?: Page
|
|
6
|
+
header?: Header
|
|
7
|
+
footer?: Footer
|
|
8
|
+
designSet?: DesignSet
|
|
9
|
+
shortcutSet?: ShortcutSet
|
|
10
|
+
storedAtomicClasses?: string[]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module 'zod' {
|
|
15
|
+
interface GlobalMeta {
|
|
16
|
+
function?: 'Attributer' | 'Runner'
|
|
17
|
+
block?: 'Child' | 'Action' | 'FormRL' | 'FormV' | 'FormS' | 'InputV' | 'InputS'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare global {
|
|
22
|
+
/** Makes an object and all its properties non-nullable */
|
|
23
|
+
type NonNullableObject<T> = { [K in keyof T]-?: NonNullable<T[K]> }
|
|
24
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// /////////////////////////////////////
|
|
2
|
+
// Types For Actions
|
|
3
|
+
// /////////////////////////////////////
|
|
4
|
+
import type { UseThemeProps } from 'next-themes'
|
|
5
|
+
import type {
|
|
6
|
+
Runners,
|
|
7
|
+
AllActions,
|
|
8
|
+
Attributer,
|
|
9
|
+
RunnerType,
|
|
10
|
+
Attributers,
|
|
11
|
+
ChildBlocks,
|
|
12
|
+
AtomicStore,
|
|
13
|
+
ActionBlocks,
|
|
14
|
+
FormResponse,
|
|
15
|
+
ChildBlockType,
|
|
16
|
+
AttributerType,
|
|
17
|
+
ActionBlockType,
|
|
18
|
+
AtomicInputTypes,
|
|
19
|
+
AtomicButtonTypes,
|
|
20
|
+
AtomicChildVariants,
|
|
21
|
+
AtomicButtonPortalTypes,
|
|
22
|
+
} from '@/ts/types'
|
|
23
|
+
|
|
24
|
+
// /////////////////////////////////////
|
|
25
|
+
// Action General Types
|
|
26
|
+
// /////////////////////////////////////
|
|
27
|
+
|
|
28
|
+
export interface CookiePreferences {
|
|
29
|
+
functional: boolean
|
|
30
|
+
security: boolean
|
|
31
|
+
analytics: boolean
|
|
32
|
+
marketing: boolean
|
|
33
|
+
userData: boolean
|
|
34
|
+
adPersonalization: boolean
|
|
35
|
+
contentPersonalization: boolean
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type FullFormContext = {
|
|
39
|
+
submissionId?: string | null
|
|
40
|
+
formResponse?: FormResponse | null
|
|
41
|
+
formRef?: React.RefObject<HTMLFormElement | null> | null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ActionContext = {
|
|
45
|
+
theme?: UseThemeProps
|
|
46
|
+
atomicStore: AtomicStore
|
|
47
|
+
fullFormContext?: FullFormContext
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ActionBlockPrefix = 'content' | 'trigger'
|
|
51
|
+
|
|
52
|
+
/** Used In UI Components Filter For Action Blocks */
|
|
53
|
+
export type ActionBlockFilter = {
|
|
54
|
+
blockType: ChildBlockType
|
|
55
|
+
type?: AtomicChildVariants
|
|
56
|
+
placement: ActionBlockPrefix
|
|
57
|
+
inputType?: AtomicInputTypes
|
|
58
|
+
buttonType?: AtomicButtonTypes
|
|
59
|
+
portalType?: AtomicButtonPortalTypes
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The name and types of action function storage, and what action processors use to mutate context.*/
|
|
63
|
+
export type ActionBlockDefaultReturns = { actions: ActionBlockType[]; runners: Runners; attributers: Attributers }
|
|
64
|
+
|
|
65
|
+
/** Returns any type or array of types with the dispatcher context added */
|
|
66
|
+
export type WithContext<T> = T extends unknown[] ? { [K in keyof T]: { action: T[K][]; context: ActionContext } } : T & { context: ActionContext }
|
|
67
|
+
|
|
68
|
+
// /////////////////////////////////////
|
|
69
|
+
// Attributes
|
|
70
|
+
// /////////////////////////////////////
|
|
71
|
+
|
|
72
|
+
export type AttFunctionReturns = Record<string, string> | undefined
|
|
73
|
+
|
|
74
|
+
/** Returns attributer function type or array of function types. Pass function type or array of function types*/
|
|
75
|
+
export type GetBaseAtt<T extends AttributerType | AttributerType[]> = T extends AttributerType[]
|
|
76
|
+
? { [K in keyof T]: Extract<Attributer, { type: T[K] }> }
|
|
77
|
+
: Extract<Attributer, { type: T }>
|
|
78
|
+
|
|
79
|
+
/** Returns attributer function type with the dispatcher context added. Pass function type or array of function types*/
|
|
80
|
+
export type GetFullAtt<T extends AttributerType | AttributerType[]> = T extends AttributerType[]
|
|
81
|
+
? { actions: GetBaseAtt<T> | undefined; context: ActionContext }
|
|
82
|
+
: WithContext<GetBaseAtt<T>>
|
|
83
|
+
|
|
84
|
+
/** Function type that takes attributer function types as parameters and returns Record<string, string> */
|
|
85
|
+
export type AttFunction<T extends AttributerType | AttributerType[]> = (args: GetFullAtt<T>) => AttFunctionReturns
|
|
86
|
+
|
|
87
|
+
// /////////////////////////////////////
|
|
88
|
+
// Runners
|
|
89
|
+
// /////////////////////////////////////
|
|
90
|
+
|
|
91
|
+
type RunFunctionReturnsBase = { success: true } | { success: false; message: string }
|
|
92
|
+
export type RunFunctionReturns = Promise<RunFunctionReturnsBase> | RunFunctionReturnsBase
|
|
93
|
+
|
|
94
|
+
/** Returns runner function type. Pass function type or array of function types*/
|
|
95
|
+
export type GetBaseRun<T extends RunnerType | RunnerType[]> = T extends RunnerType[]
|
|
96
|
+
? { [K in keyof T]: Extract<Runners[number], { type: T[K] }> }
|
|
97
|
+
: Extract<Runners[number], { type: T }>
|
|
98
|
+
|
|
99
|
+
/** Returns runner function type with the dispatcher context added. Pass function type or array of function types*/
|
|
100
|
+
export type GetFullRun<T extends RunnerType | RunnerType[]> = T extends RunnerType[]
|
|
101
|
+
? { actions: GetBaseRun<T> | undefined; context: ActionContext }
|
|
102
|
+
: WithContext<GetBaseRun<T>>
|
|
103
|
+
|
|
104
|
+
/** Function type that takes runner function types as parameters and returns Record<string, string> */
|
|
105
|
+
export type RunFunction<T extends RunnerType | RunnerType[]> = (args: GetFullRun<T>) => RunFunctionReturns
|
|
106
|
+
|
|
107
|
+
// /////////////////////////////////////
|
|
108
|
+
// Options
|
|
109
|
+
// /////////////////////////////////////
|
|
110
|
+
|
|
111
|
+
type SetKeyContext = { block: ChildBlocks[number]; initialValuesMap: Map<string, InitialValue> }
|
|
112
|
+
|
|
113
|
+
type ProcessFunctionContext = {
|
|
114
|
+
block: ChildBlocks[number]
|
|
115
|
+
data: NonNullableObject<AllActions>
|
|
116
|
+
initialValuesMap: Map<string, InitialValue>
|
|
117
|
+
/** If a parent has a form name, you can use it with this. */
|
|
118
|
+
useForm?: string
|
|
119
|
+
/** If a parent has a portal name, you can use it with this. */
|
|
120
|
+
usePortal?: string
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type WithProcessFunctionContext<T> = T extends unknown[]
|
|
124
|
+
? { [K in keyof T]: { actionBlock: T[K][]; context: ProcessFunctionContext } }
|
|
125
|
+
: T & ProcessFunctionContext
|
|
126
|
+
|
|
127
|
+
//Establish Base Types
|
|
128
|
+
type GetBaseAction<T extends ActionBlockType | ActionBlockType[]> = T extends ActionBlockType[]
|
|
129
|
+
? { [K in keyof T]: Extract<ActionBlocks[number], { blockType: T[K] }> }
|
|
130
|
+
: Extract<ActionBlocks[number], { blockType: T }>
|
|
131
|
+
|
|
132
|
+
type GetActionsProcessFunction<T extends ActionBlockType | ActionBlockType[]> = T extends ActionBlockType[]
|
|
133
|
+
? { actionBlock: GetBaseAction<T>; context: ProcessFunctionContext }
|
|
134
|
+
: WithProcessFunctionContext<GetBaseAction<T>>
|
|
135
|
+
|
|
136
|
+
export type ActionSetKeyInitialByAction<T extends ActionBlockType> = (
|
|
137
|
+
args: SetKeyContext & { actionBlock: GetBaseAction<T> },
|
|
138
|
+
) => InitialValue | undefined
|
|
139
|
+
|
|
140
|
+
export type ActionSetKeyInitialByBlock = (args: SetKeyContext) => InitialValue | undefined
|
|
141
|
+
export type ActionProcessFunction<T extends ActionBlockType | ActionBlockType[]> = (args: GetActionsProcessFunction<T>) => void
|
|
142
|
+
export type ActionDefaultFunction = (args: ProcessFunctionContext) => void
|
|
143
|
+
|
|
144
|
+
export type ActionBlockMap = { [T in ActionBlocks[number] as T['blockType']]: T }
|
|
145
|
+
export type InitialValue = { key: string; initialValue?: boolean | string | null; persisted?: boolean | null }
|
|
146
|
+
|
|
147
|
+
type OptionFunctionArgs = (args: {
|
|
148
|
+
block: ChildBlocks[number]
|
|
149
|
+
initialValuesMap: Map<string, InitialValue>
|
|
150
|
+
result: ActionBlockDefaultReturns
|
|
151
|
+
actionBlock: ActionBlocks[number]
|
|
152
|
+
useForm?: string
|
|
153
|
+
usePortal?: string
|
|
154
|
+
}) => void
|
|
155
|
+
|
|
156
|
+
export type ActionBlockOptions = {
|
|
157
|
+
processFunction: OptionFunctionArgs
|
|
158
|
+
triggerDefaults?: OptionFunctionArgs
|
|
159
|
+
contentDefaults?: OptionFunctionArgs
|
|
160
|
+
setKeyInitialByBlock?: ActionSetKeyInitialByBlock
|
|
161
|
+
setKeyInitialByAction?: ActionSetKeyInitialByAction<ActionBlockType>
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type ProcessFunctionArgs = (args: {
|
|
165
|
+
block: ChildBlocks[number]
|
|
166
|
+
allActions: NonNullableObject<AllActions>
|
|
167
|
+
actionBlock: ActionBlocks[number]
|
|
168
|
+
result: ActionBlockDefaultReturns
|
|
169
|
+
}) => void
|
|
170
|
+
|
|
171
|
+
export interface ActionClass {
|
|
172
|
+
processFunction: ProcessFunctionArgs
|
|
173
|
+
triggerDefaults?: ProcessFunctionArgs
|
|
174
|
+
contentDefaults?: ProcessFunctionArgs
|
|
175
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Config } from '@/ts/types'
|
|
2
|
+
import type { NumberFieldClientProps, RequestContext } from 'payload'
|
|
3
|
+
import type { NameKebabOptions } from '@/utilities/format/toKebabCase'
|
|
4
|
+
import type {
|
|
5
|
+
TextField,
|
|
6
|
+
SelectField,
|
|
7
|
+
NumberField,
|
|
8
|
+
TextareaField,
|
|
9
|
+
CheckboxField,
|
|
10
|
+
TextFieldClientProps,
|
|
11
|
+
SelectFieldClientProps,
|
|
12
|
+
TextareaFieldClientProps,
|
|
13
|
+
CheckboxFieldClientProps,
|
|
14
|
+
} from 'payload'
|
|
15
|
+
|
|
16
|
+
// /////////////////////////////////////
|
|
17
|
+
// General APF Types
|
|
18
|
+
// /////////////////////////////////////
|
|
19
|
+
|
|
20
|
+
/**Expensive Functions that process data on save, therefore must only run when their dependencies change. */
|
|
21
|
+
export type APFunction = 'form' | 'classes' | 'page' | 'pages' | 'actions' | 'seo' | 'active' | 'sitemap' | 'siteMetadata'
|
|
22
|
+
|
|
23
|
+
/** Type for the runAPF function which checks if a document has been marked as changed in the context. */
|
|
24
|
+
export type RunAPFProps = { context: RequestContext; id: string | undefined; apf: APFunction; data?: unknown }
|
|
25
|
+
|
|
26
|
+
// /////////////////////////////////////
|
|
27
|
+
// APF Field
|
|
28
|
+
// /////////////////////////////////////
|
|
29
|
+
|
|
30
|
+
export type SupportedAPFFields = TextField | TextareaField | CheckboxField | SelectField | NumberField
|
|
31
|
+
|
|
32
|
+
export type APFBaseProps = {
|
|
33
|
+
/** On field change, this atomic payload function will run on submit. {@link APFunction}*/
|
|
34
|
+
apf?: APFunction[]
|
|
35
|
+
/** Defaults to 'name' */
|
|
36
|
+
name?: string
|
|
37
|
+
/** Used To Link To Documentation */
|
|
38
|
+
docLink?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type TextAndTextareaBase = {
|
|
42
|
+
/** Make text kebab case on save. Only runs on client side modification of the field. */
|
|
43
|
+
kebab?: boolean | NameKebabOptions
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type APFieldType =
|
|
47
|
+
| { args: SelectField & APFBaseProps; return: SelectField }
|
|
48
|
+
| { args: NumberField & APFBaseProps; return: NumberField }
|
|
49
|
+
| { args: CheckboxField & APFBaseProps; return: CheckboxField }
|
|
50
|
+
| { args: TextField & APFBaseProps & TextAndTextareaBase; return: TextField }
|
|
51
|
+
| { args: TextareaField & APFBaseProps & TextAndTextareaBase; return: TextareaField }
|
|
52
|
+
|
|
53
|
+
export type APArgs<Type extends SupportedAPFFields['type']> = Extract<APFieldType, { args: { type: Type } }>['args']
|
|
54
|
+
export type APReturn<Type extends SupportedAPFFields['type']> = Extract<APFieldType, { args: { type: Type } }>['return']
|
|
55
|
+
|
|
56
|
+
// /////////////////////////////////////
|
|
57
|
+
// APF Field Wrapper
|
|
58
|
+
// /////////////////////////////////////
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Typed so that when using the preset field, you don't need to add certain fields as they are already defined in the preset.
|
|
62
|
+
* @param T - The type of the field.
|
|
63
|
+
* @param Defaults - The defaults to omit from the args.
|
|
64
|
+
* @param AdditionalArgs - Additional args are additionally required args to be passed when using the preset field.
|
|
65
|
+
* @returns The return type of the field.
|
|
66
|
+
*/
|
|
67
|
+
export type APFieldWrapper<
|
|
68
|
+
T extends SupportedAPFFields['type'],
|
|
69
|
+
Defaults extends keyof APArgs<T>,
|
|
70
|
+
AdditionalArgs extends Record<string, unknown> | void = void,
|
|
71
|
+
> = AdditionalArgs extends void
|
|
72
|
+
? // AdditionalArgs not provided → only base args
|
|
73
|
+
(args?: Omit<APArgs<T>, Defaults>) => Extract<APFieldType, { args: { type: T } }>['return']
|
|
74
|
+
: // AdditionalArgs provided → merged, required
|
|
75
|
+
(args: Omit<APArgs<T>, Defaults> & AdditionalArgs) => Extract<APFieldType, { args: { type: T } }>['return']
|
|
76
|
+
|
|
77
|
+
// /////////////////////////////////////
|
|
78
|
+
// APF Field Component
|
|
79
|
+
// /////////////////////////////////////
|
|
80
|
+
|
|
81
|
+
export type APFComponentBaseProps = {
|
|
82
|
+
docLink?: string
|
|
83
|
+
apf: APFunction[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Atomic Payload Fields, Field Component Type. */
|
|
87
|
+
export type APFFieldComponentType = (
|
|
88
|
+
props:
|
|
89
|
+
| ({ type: 'number' } & NumberFieldClientProps & APFComponentBaseProps)
|
|
90
|
+
| ({ type: 'select' } & SelectFieldClientProps & APFComponentBaseProps)
|
|
91
|
+
| ({ type: 'checkbox' } & CheckboxFieldClientProps & APFComponentBaseProps)
|
|
92
|
+
| ({ type: 'text' } & TextFieldClientProps & APFComponentBaseProps & TextAndTextareaBase)
|
|
93
|
+
| ({ type: 'textarea' } & TextareaFieldClientProps & APFComponentBaseProps & TextAndTextareaBase),
|
|
94
|
+
) => React.ReactNode
|
|
95
|
+
|
|
96
|
+
// /////////////////////////////////////
|
|
97
|
+
// Collections
|
|
98
|
+
// /////////////////////////////////////
|
|
99
|
+
|
|
100
|
+
export type CollectionsWithActive = {
|
|
101
|
+
[K in keyof Config['collections']]: Config['collections'][K] extends { active?: any } ? Config['collections'][K] : never
|
|
102
|
+
}[keyof Config['collections']]
|
|
103
|
+
|
|
104
|
+
export type CollectionsWithoutActive = {
|
|
105
|
+
[K in keyof Config['collections']]: Config['collections'][K] extends { active?: any } ? never : Config['collections'][K]
|
|
106
|
+
}[keyof Config['collections']]
|
|
107
|
+
|
|
108
|
+
export type Collections = Config['collections'][keyof Config['collections']]
|