@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,263 @@
|
|
|
1
|
+
//Action Options
|
|
2
|
+
import { ActSetTheme } from './theme/set/options'
|
|
3
|
+
import { ActResetForm } from './form/reset/options'
|
|
4
|
+
import { ActSubmitForm } from './form/submit/options'
|
|
5
|
+
import { ActSetCC } from './cookieConsent/set/options'
|
|
6
|
+
import { ActSetPortalOpen } from './portal/set/options'
|
|
7
|
+
import { ActCCToDA } from './cookieConsent/toDA/options'
|
|
8
|
+
import { ActFormErrorToDA } from './form/errorToDA/options'
|
|
9
|
+
import { ActFormStatusToDA } from './form/statusToDA/options'
|
|
10
|
+
import { ActDSTextToDA } from './dynamicStore/text/toDA/options'
|
|
11
|
+
import { ActDSSetBool } from './dynamicStore/boolean/set/options'
|
|
12
|
+
import { ActDSCycleText } from './dynamicStore/text/cycle/options'
|
|
13
|
+
import { ActDSBoolToDA } from './dynamicStore/boolean/toDA/options'
|
|
14
|
+
|
|
15
|
+
//Other
|
|
16
|
+
import { z } from '@/ts/zap'
|
|
17
|
+
import { ActionFilters } from './filters'
|
|
18
|
+
import {
|
|
19
|
+
AllActions,
|
|
20
|
+
ChildBlocks,
|
|
21
|
+
InitialValue,
|
|
22
|
+
StoredAtomicActions,
|
|
23
|
+
ActionProcessFunction,
|
|
24
|
+
ActionBlockDefaultReturns,
|
|
25
|
+
ActionSetKeyInitialByAction,
|
|
26
|
+
} from '@/ts/types'
|
|
27
|
+
|
|
28
|
+
export const ActionOptions = {
|
|
29
|
+
ActSetCC,
|
|
30
|
+
ActCCToDA,
|
|
31
|
+
ActSetTheme,
|
|
32
|
+
ActDSSetBool,
|
|
33
|
+
ActResetForm,
|
|
34
|
+
ActDSTextToDA,
|
|
35
|
+
ActDSBoolToDA,
|
|
36
|
+
ActSubmitForm,
|
|
37
|
+
ActDSCycleText,
|
|
38
|
+
ActFormErrorToDA,
|
|
39
|
+
ActSetPortalOpen,
|
|
40
|
+
ActFormStatusToDA,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// /////////////////////////////////////
|
|
44
|
+
// Action Processor
|
|
45
|
+
// /////////////////////////////////////
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Action Block Processor
|
|
49
|
+
*
|
|
50
|
+
* Processes action blocks and manages their execution context.
|
|
51
|
+
* Handles initial values, form mappings, and action processing for atomic components.
|
|
52
|
+
*
|
|
53
|
+
* This class is responsible for processing action blocks within the atomic system.
|
|
54
|
+
* It manages the lifecycle of actions including setting initial values, processing blocks,
|
|
55
|
+
* and coordinating between different action types (runners, attributers).
|
|
56
|
+
*/
|
|
57
|
+
export class ActionBlockStorageProcessor {
|
|
58
|
+
//Before Storage
|
|
59
|
+
initialValuesMap: Map<string, InitialValue> = new Map()
|
|
60
|
+
formNameMap: Map<string, string> = new Map()
|
|
61
|
+
portalNameMap: Map<string, string> = new Map()
|
|
62
|
+
|
|
63
|
+
//Temp Storage
|
|
64
|
+
triggerStore: NonNullableObject<AllActions> = { actionBlocks: [], actions: [], runners: [], attributers: [] }
|
|
65
|
+
contentStore: NonNullableObject<AllActions> = { actionBlocks: [], actions: [], runners: [], attributers: [] }
|
|
66
|
+
processorResult: ActionBlockDefaultReturns = { actions: [], runners: [], attributers: [] }
|
|
67
|
+
|
|
68
|
+
//New storage for all block actions
|
|
69
|
+
allBlockActions: StoredAtomicActions = {}
|
|
70
|
+
|
|
71
|
+
constructor() {}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @note Stores values in the class instance.
|
|
75
|
+
* @description Grabs All Form/Portal Names and stores a blocks actions initial values for later use.
|
|
76
|
+
*/
|
|
77
|
+
before({ node, path }: { node: object; path: string[] }) {
|
|
78
|
+
if (!node || typeof node !== 'object' || !('blockType' in node)) return node
|
|
79
|
+
const block = node as ChildBlocks[number]
|
|
80
|
+
|
|
81
|
+
this.setKeyInitialValueByAction({ block })
|
|
82
|
+
|
|
83
|
+
//Add FormName & PortalName If They Exist
|
|
84
|
+
if (block.blockType === 'AtomicChild') {
|
|
85
|
+
// Add FormName & PortalName If They Exist
|
|
86
|
+
if (block?.type === 'form' && block.formName) this.formNameMap.set(path.join('.'), block.formName)
|
|
87
|
+
if (block?.type === 'button' && block.buttonType === 'portal' && block.portalName) this.portalNameMap.set(path.join('.'), block.portalName)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Sets initial values for action keys by actions.
|
|
93
|
+
* Runs blocks first, as some atomic block variants have values that we want to inherit initial values from.
|
|
94
|
+
* Then we process the trigger and content actions.
|
|
95
|
+
*/
|
|
96
|
+
setKeyInitialValueByAction({ block }: { block: ChildBlocks[number] }) {
|
|
97
|
+
// Get Trigger Action Initial Values
|
|
98
|
+
if ('triggerActions' in block && block?.triggerActions && block.triggerActions.actionBlocks) {
|
|
99
|
+
if (Array.isArray(block.triggerActions.actionBlocks) && block.triggerActions.actionBlocks?.length > 0) {
|
|
100
|
+
block.triggerActions.actionBlocks?.forEach((actionBlock) => {
|
|
101
|
+
const AO = ActionOptions[actionBlock.blockType]
|
|
102
|
+
if ('setKeyInitialByAction' in AO) {
|
|
103
|
+
const setter = AO.setKeyInitialByAction as ActionSetKeyInitialByAction<typeof actionBlock.blockType>
|
|
104
|
+
const value = setter({ block, initialValuesMap: this.initialValuesMap, actionBlock })
|
|
105
|
+
if (value && !this.initialValuesMap.has(value.key)) this.initialValuesMap.set(value.key, value)
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Get Content Action Initial Values
|
|
112
|
+
if ('contentActions' in block && block?.contentActions && block.contentActions.actionBlocks) {
|
|
113
|
+
if (Array.isArray(block.contentActions.actionBlocks) && block.contentActions.actionBlocks?.length > 0) {
|
|
114
|
+
block.contentActions.actionBlocks?.forEach((actionBlock) => {
|
|
115
|
+
const AO = ActionOptions[actionBlock.blockType]
|
|
116
|
+
if ('setKeyInitialByAction' in AO) {
|
|
117
|
+
const setter = AO.setKeyInitialByAction as ActionSetKeyInitialByAction<typeof actionBlock.blockType>
|
|
118
|
+
const value = setter({ block, initialValuesMap: this.initialValuesMap, actionBlock })
|
|
119
|
+
if (value && !this.initialValuesMap.has(value.key)) this.initialValuesMap.set(value.key, value)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
setKeyInitialValueByBlock({ node }: { node: unknown }) {
|
|
127
|
+
if (!node || typeof node !== 'object' || !('blockType' in node)) return node
|
|
128
|
+
const block = node as ChildBlocks[number]
|
|
129
|
+
//Get initial values from the block itself
|
|
130
|
+
Object.values(ActionOptions).forEach((option) => {
|
|
131
|
+
if ('setKeyInitialByBlock' in option && option.setKeyInitialByBlock) {
|
|
132
|
+
const value = option.setKeyInitialByBlock({ block, initialValuesMap: this.initialValuesMap })
|
|
133
|
+
if (value && !this.initialValuesMap.has(value.key)) this.initialValuesMap.set(value.key, value)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @note Mutates the passed in node.
|
|
140
|
+
* @description Stores the action blocks to their respective storage fields, and utilizes values stored by the "before" method.
|
|
141
|
+
*/
|
|
142
|
+
after({ node, path }: { node: unknown; path: string[] }) {
|
|
143
|
+
if (!node || typeof node !== 'object' || !('blockType' in node)) return node
|
|
144
|
+
const BlockType = z.ap.get('ChildBlockType').safeParse(node.blockType)
|
|
145
|
+
if (!BlockType.success) return node
|
|
146
|
+
const block = node as ChildBlocks[number]
|
|
147
|
+
|
|
148
|
+
// Add Defaults For Any Node
|
|
149
|
+
this.runNodeDefaults({ block })
|
|
150
|
+
|
|
151
|
+
if ('triggerActions' in block) {
|
|
152
|
+
if (block?.triggerActions?.actionBlocks) {
|
|
153
|
+
this.triggerStore.actionBlocks.push(...block?.triggerActions?.actionBlocks)
|
|
154
|
+
this.processActionBlocks({ placement: 'trigger', AllActions: this.triggerStore, block, path })
|
|
155
|
+
block.triggerActions = this.triggerStore
|
|
156
|
+
|
|
157
|
+
this.storeActionBlock({ block, placement: 'trigger' })
|
|
158
|
+
this.resetStore({ placement: 'trigger' })
|
|
159
|
+
} else block.triggerActions = undefined //Remove previously stored actions if no actions are set
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if ('contentActions' in block) {
|
|
163
|
+
if (block?.contentActions?.actionBlocks) {
|
|
164
|
+
this.contentStore.actionBlocks.push(...block?.contentActions?.actionBlocks)
|
|
165
|
+
this.processActionBlocks({ placement: 'content', AllActions: this.contentStore, block, path })
|
|
166
|
+
block.contentActions = this.contentStore
|
|
167
|
+
|
|
168
|
+
this.storeActionBlock({ block, placement: 'content' })
|
|
169
|
+
this.resetStore({ placement: 'content' })
|
|
170
|
+
} else block.contentActions = undefined //Remove previously stored actions if no actions are set
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return block
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Checks for defaults on every child block that CAN have actions.
|
|
178
|
+
* This means if a block has no actions defined, this will still run on it.
|
|
179
|
+
* The default functions conditionally apply actions depending on context.
|
|
180
|
+
*/
|
|
181
|
+
private runNodeDefaults({ block }: { block: ChildBlocks[number] }) {
|
|
182
|
+
if (z.ap.get('ChildrenWithTriggerActions').safeParse(block.blockType).success) {
|
|
183
|
+
Object.values(ActionOptions).forEach((option) => {
|
|
184
|
+
if ('triggerDefaults' in option) {
|
|
185
|
+
option.triggerDefaults({ block, data: this.triggerStore, initialValuesMap: this.initialValuesMap })
|
|
186
|
+
//TODO: Fix typing here.
|
|
187
|
+
//@ts-expect-error zod ensures proper usage.
|
|
188
|
+
if (this.triggerStore.actions.length > 0) block['triggerActions'] = this.triggerStore
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
if (z.ap.get('ChildrenWithContentActions').safeParse(block.blockType).success) {
|
|
193
|
+
Object.values(ActionOptions).forEach((option) => {
|
|
194
|
+
if ('contentDefaults' in option) {
|
|
195
|
+
option.contentDefaults({ block, data: this.contentStore, initialValuesMap: this.initialValuesMap })
|
|
196
|
+
//@ts-expect-error zod ensures proper usage.
|
|
197
|
+
if (this.contentStore.actions.length > 0) block['contentActions'] = this.contentStore
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private processActionBlocks({
|
|
204
|
+
placement,
|
|
205
|
+
AllActions,
|
|
206
|
+
block,
|
|
207
|
+
path,
|
|
208
|
+
}: {
|
|
209
|
+
placement: 'trigger' | 'content'
|
|
210
|
+
AllActions: NonNullableObject<AllActions>
|
|
211
|
+
block: ChildBlocks[number]
|
|
212
|
+
path: string[]
|
|
213
|
+
}) {
|
|
214
|
+
AllActions.actions.push(...AllActions.actionBlocks.map((actionBlock) => actionBlock.blockType))
|
|
215
|
+
AllActions.actionBlocks.forEach((actionBlock) => {
|
|
216
|
+
if (ActionFilters[actionBlock.blockType]({ placement, ...block })) {
|
|
217
|
+
const { blockType } = actionBlock
|
|
218
|
+
const closestFormName = this.formNameMap.get(this.findClosestParent(path, this.formNameMap.keys()) || '')
|
|
219
|
+
const closestPortalName = this.portalNameMap.get(this.findClosestParent(path, this.portalNameMap.keys()) || '')
|
|
220
|
+
const PF = ActionOptions[blockType].processFunction as ActionProcessFunction<typeof blockType>
|
|
221
|
+
PF({
|
|
222
|
+
...actionBlock,
|
|
223
|
+
block,
|
|
224
|
+
data: AllActions,
|
|
225
|
+
initialValuesMap: this.initialValuesMap,
|
|
226
|
+
useForm: ('formName' in block && block?.formName) || closestFormName || undefined,
|
|
227
|
+
usePortal: ('portalName' in block && block?.portalName) || closestPortalName || undefined,
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Adds block to the flat storage array on the document. */
|
|
234
|
+
private storeActionBlock({ block, placement }: { block: ChildBlocks[number]; placement: 'trigger' | 'content' }) {
|
|
235
|
+
if (!block.id) throw new Error('Block ID is required for storing an action. In action block storage processors after method.')
|
|
236
|
+
const store = placement === 'trigger' ? this.triggerStore : this.contentStore
|
|
237
|
+
const { actionBlocks, ...rest } = store
|
|
238
|
+
this.allBlockActions[block.id] = { id: block.id, ...rest }
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private resetStore({ placement }: { placement: 'trigger' | 'content' }) {
|
|
242
|
+
if (placement === 'trigger') this.triggerStore = { actionBlocks: [], actions: [], runners: [], attributers: [] }
|
|
243
|
+
if (placement === 'content') this.contentStore = { actionBlocks: [], actions: [], runners: [], attributers: [] }
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @description Gets all action blocks that have been stored during processing
|
|
248
|
+
* @returns Array of all block actions with their paths
|
|
249
|
+
*/
|
|
250
|
+
getAllActionBlocks(): StoredAtomicActions | undefined {
|
|
251
|
+
return Object.keys(this.allBlockActions).length > 0 ? this.allBlockActions : undefined
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private findClosestParent(inputPath: string[], parentPaths: MapIterator<string>): string | null {
|
|
255
|
+
const inputPathString = inputPath.join('.')
|
|
256
|
+
let bestMatch = { length: 0, path: '' }
|
|
257
|
+
|
|
258
|
+
for (const path of Array.from(parentPaths)) {
|
|
259
|
+
if (inputPathString.startsWith(path) && path.length > bestMatch.length) bestMatch = { length: path.length, path }
|
|
260
|
+
}
|
|
261
|
+
return bestMatch.path
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Block } from 'payload'
|
|
2
|
+
import { PerformSelectField } from '@/fields/actions'
|
|
3
|
+
|
|
4
|
+
export const ActSetTheme: Block = {
|
|
5
|
+
slug: 'ActSetTheme',
|
|
6
|
+
admin: { group: 'Theme' },
|
|
7
|
+
interfaceName: 'ActSetTheme',
|
|
8
|
+
labels: { singular: 'Set Theme', plural: 'Set Theme' },
|
|
9
|
+
fields: [PerformSelectField({ set: 'theme' })],
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from '@/ts/zap'
|
|
2
|
+
import { ActionProcessFunction } from '@/ts/types/actions'
|
|
3
|
+
|
|
4
|
+
const processFunction: ActionProcessFunction<'ActSetTheme'> = ({ perform, data }) => {
|
|
5
|
+
const Run: z.ap.Type<'RunSetTheme'> = { type: 'RunSetTheme', perform }
|
|
6
|
+
data.runners.push(Run)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ActSetTheme = { processFunction }
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AtomicPath } from '@/ui'
|
|
2
|
+
import { DepthControls } from '@/ts/types'
|
|
3
|
+
import { ColoredEnd } from '@/fields/coloredEnd'
|
|
4
|
+
import { ClassNameField } from '@/fields/className'
|
|
5
|
+
import { AtomicBlockControlBar } from './controlBar'
|
|
6
|
+
import { NonRecursiveChildBlockType } from '@/ts/types'
|
|
7
|
+
import type { Block, BlocksField } from 'payload'
|
|
8
|
+
|
|
9
|
+
//Tabs
|
|
10
|
+
import { TrackingTab } from '@/fields/tabs/block/children/tracking'
|
|
11
|
+
import { inputTab } from '@/fields/tabs/block/children/submitForm/input'
|
|
12
|
+
import { AtomicChildSettingsTab } from '@/fields/tabs/block/children/settings'
|
|
13
|
+
import { TriggerActionsTab, ContentActionsTab } from '@/fields/tabs/block/children/actions'
|
|
14
|
+
import { formRateLimitTab, formSanitationTab, formValidationTab } from '@/fields/tabs/block/children/submitForm/form'
|
|
15
|
+
|
|
16
|
+
const d = {
|
|
17
|
+
trigger: 'The trigger is the actual button element. You can add what the button element renders inside it, such as text, icons, or anything else.',
|
|
18
|
+
ariaLabel: 'Accessibility label for screen readers.',
|
|
19
|
+
content: 'Used for all blocks, except non portal button blocks.',
|
|
20
|
+
svr: '( Sanitation | Validation | Rate Limiting ) Used for form and input blocks.',
|
|
21
|
+
screenReaderText: 'Text specifically for screen readers. Required if no visible text is present.',
|
|
22
|
+
actions: 'Used to perform actions, but can also be used to receive data on other actions being performed.',
|
|
23
|
+
contentTab:
|
|
24
|
+
'Content is the element itself, and what is rendered inside it. If you set the Atomic Block to (Button + Open Portal), this is the content inside of the opened portal.',
|
|
25
|
+
}
|
|
26
|
+
//let count = 0
|
|
27
|
+
const contentClassNameField = ClassNameField({ label: 'Content Atomic Classes' })
|
|
28
|
+
const triggerClassNameField = ClassNameField({ namePrefix: 'trigger', label: 'Trigger Atomic Classes' })
|
|
29
|
+
|
|
30
|
+
const NonRecursiveChildBlocks: NonRecursiveChildBlockType[] = [
|
|
31
|
+
'SimpleTextChild',
|
|
32
|
+
'RichTextChild',
|
|
33
|
+
'ImageChild',
|
|
34
|
+
'VideoChild',
|
|
35
|
+
'IconChild',
|
|
36
|
+
'SVGChild',
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
/** Do not use this anywhere. Only use the files default export. */
|
|
40
|
+
export function AtomicBlockFactory({ depthControls }: { depthControls: DepthControls }): Block {
|
|
41
|
+
const { cd, cmd, td, tmd } = depthControls
|
|
42
|
+
|
|
43
|
+
const childrenBase: Omit<BlocksField, 'name'> = {
|
|
44
|
+
type: 'blocks',
|
|
45
|
+
blocks: [],
|
|
46
|
+
admin: { initCollapsed: true },
|
|
47
|
+
typescriptSchema: [() => ({ $ref: `#/definitions/ChildBlocks` })],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const cb: BlocksField = {
|
|
51
|
+
...childrenBase,
|
|
52
|
+
name: 'children',
|
|
53
|
+
blockReferences: [...NonRecursiveChildBlocks],
|
|
54
|
+
admin: { ...childrenBase.admin, condition: (_, sd) => Boolean(sd.type !== 'input') },
|
|
55
|
+
}
|
|
56
|
+
if (cd < cmd) cb.blockReferences?.unshift(AtomicBlockFactory({ depthControls: { ...depthControls, cd: cd + 1 } }))
|
|
57
|
+
|
|
58
|
+
const tcb: BlocksField = { ...childrenBase, name: 'triggerChildren', blockReferences: [...NonRecursiveChildBlocks] }
|
|
59
|
+
if (td < tmd) tcb.blockReferences?.unshift(AtomicBlockFactory({ depthControls: { cd: td + 1, cmd: tmd, td: td + 1, tmd } }))
|
|
60
|
+
|
|
61
|
+
const atomicBlock: Block = {
|
|
62
|
+
slug: 'AtomicChild',
|
|
63
|
+
interfaceName: 'AtomicChild',
|
|
64
|
+
labels: { singular: 'Atomic', plural: 'Atomic' },
|
|
65
|
+
admin: { components: { Label: { path: AtomicPath } } },
|
|
66
|
+
fields: [
|
|
67
|
+
AtomicBlockControlBar,
|
|
68
|
+
{
|
|
69
|
+
type: 'tabs',
|
|
70
|
+
tabs: [
|
|
71
|
+
{
|
|
72
|
+
label: 'Content',
|
|
73
|
+
admin: { description: d.content },
|
|
74
|
+
fields: [
|
|
75
|
+
{
|
|
76
|
+
type: 'group',
|
|
77
|
+
label: 'Content',
|
|
78
|
+
admin: {
|
|
79
|
+
hideGutter: true,
|
|
80
|
+
description: d.contentTab,
|
|
81
|
+
condition: (_, sd) => Boolean(sd?.type !== 'button' || (sd?.type === 'button' && sd?.buttonType === 'portal')),
|
|
82
|
+
},
|
|
83
|
+
fields: [contentClassNameField, cb],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: 'Trigger',
|
|
89
|
+
admin: { description: d.trigger },
|
|
90
|
+
fields: [
|
|
91
|
+
{
|
|
92
|
+
type: 'group',
|
|
93
|
+
label: 'Trigger',
|
|
94
|
+
admin: { hideGutter: true, condition: (_, sd) => Boolean(sd?.type === 'button') },
|
|
95
|
+
fields: [
|
|
96
|
+
triggerClassNameField,
|
|
97
|
+
{
|
|
98
|
+
type: 'row',
|
|
99
|
+
fields: [
|
|
100
|
+
{ type: 'text', name: 'ariaLabel', admin: { description: d.ariaLabel, width: '50%' } },
|
|
101
|
+
{ type: 'text', name: 'screenReaderText', admin: { description: d.screenReaderText, width: '50%' } },
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
tcb,
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{ label: 'Actions', admin: { description: d.actions }, fields: [TriggerActionsTab, ContentActionsTab] },
|
|
110
|
+
{ label: 'SVR', admin: { description: d.svr }, fields: [formRateLimitTab, formSanitationTab, formValidationTab, inputTab] },
|
|
111
|
+
AtomicChildSettingsTab,
|
|
112
|
+
TrackingTab,
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
ColoredEnd,
|
|
116
|
+
],
|
|
117
|
+
}
|
|
118
|
+
return atomicBlock
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const AtomicBlock = AtomicBlockFactory({ depthControls: { cd: 0, cmd: 12, td: 0, tmd: 1 } })
|
|
122
|
+
|
|
123
|
+
export default AtomicBlock
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { GroupField } from 'payload'
|
|
2
|
+
import { FormFields } from './variants/form/controlBar'
|
|
3
|
+
import { TagControlBar } from './variants/tag/controlBar'
|
|
4
|
+
import { InputTypeField } from './variants/input/typeField'
|
|
5
|
+
import { ButtonTypeField } from './variants/button/typeField'
|
|
6
|
+
import { InputControlBar } from './variants/input/controlBar'
|
|
7
|
+
import { LinkControlBarFields } from './variants/button/variants/link/controlBar'
|
|
8
|
+
import { PortalControlsFields } from './variants/button/variants/portal/controlBar'
|
|
9
|
+
|
|
10
|
+
const atomicTypeOptions = [
|
|
11
|
+
{ label: 'Tag', value: 'tag' },
|
|
12
|
+
{ label: 'Form', value: 'form' },
|
|
13
|
+
{ label: 'Input', value: 'input' },
|
|
14
|
+
{ label: 'Button', value: 'button' },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
export const AtomicBlockControlBar: GroupField = {
|
|
18
|
+
type: 'group',
|
|
19
|
+
admin: { hideGutter: true },
|
|
20
|
+
fields: [
|
|
21
|
+
{
|
|
22
|
+
type: 'row',
|
|
23
|
+
fields: [
|
|
24
|
+
{
|
|
25
|
+
name: 'type',
|
|
26
|
+
type: 'select',
|
|
27
|
+
required: true,
|
|
28
|
+
defaultValue: 'tag',
|
|
29
|
+
admin: { width: '25%' },
|
|
30
|
+
interfaceName: 'AtomicChildVariants',
|
|
31
|
+
options: atomicTypeOptions,
|
|
32
|
+
},
|
|
33
|
+
...TagControlBar,
|
|
34
|
+
ButtonTypeField,
|
|
35
|
+
InputTypeField,
|
|
36
|
+
...FormFields,
|
|
37
|
+
...InputControlBar,
|
|
38
|
+
...PortalControlsFields,
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
LinkControlBarFields,
|
|
42
|
+
],
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SelectField } from 'payload'
|
|
2
|
+
import { APField } from '@/fields/apf'
|
|
3
|
+
|
|
4
|
+
export const ButtonTypeField: SelectField = APField({
|
|
5
|
+
name: 'buttonType',
|
|
6
|
+
apf: ['actions'],
|
|
7
|
+
type: 'select',
|
|
8
|
+
required: true,
|
|
9
|
+
interfaceName: 'AtomicButtonTypes',
|
|
10
|
+
admin: { condition: (_, sd) => Boolean(sd?.type === 'button'), width: '25%' },
|
|
11
|
+
options: [
|
|
12
|
+
{ label: 'Link', value: 'link' },
|
|
13
|
+
{ label: 'Regular', value: 'regular' },
|
|
14
|
+
{ label: 'Open Portal', value: 'portal' },
|
|
15
|
+
],
|
|
16
|
+
})
|
package/template/src/blocks/children/atomic/variants/button/variants/link/component.client.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import NextLink from 'next/link'
|
|
4
|
+
import { AtomicChild, RenderChild } from '@/ts/types'
|
|
5
|
+
import { useToDa, useButtonActions, useActionContext } from '@/hooks/frontEnd/useActions'
|
|
6
|
+
|
|
7
|
+
export const AtomicButtonLinkClient: React.FC<RenderChild<AtomicChild>> = (props) => {
|
|
8
|
+
const { block, pt, triggerChildren } = props
|
|
9
|
+
|
|
10
|
+
const context = useActionContext()
|
|
11
|
+
const useButton = useButtonActions({ block, context })
|
|
12
|
+
const tda = useToDa({ attributers: block.triggerActions?.attributers, context })
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
//@ts-expect-error href is already applied in the defaultProps
|
|
16
|
+
<NextLink {...useButton} {...pt?.t?.p} {...pt?.t?.da} {...tda}>
|
|
17
|
+
{triggerChildren}
|
|
18
|
+
{block?.screenReaderText && <span className="sr-only">{block?.screenReaderText}</span>}
|
|
19
|
+
</NextLink>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import NextLink from 'next/link'
|
|
3
|
+
import { AtomicChild, RenderChild } from '@/ts/types'
|
|
4
|
+
|
|
5
|
+
export const AtomicButtonLink: React.FC<RenderChild<AtomicChild>> = async ({ block, pt, triggerChildren }) => {
|
|
6
|
+
return (
|
|
7
|
+
//@ts-expect-error href is already applied in the defaultProps
|
|
8
|
+
<NextLink {...pt?.t?.p} {...pt?.t?.da}>
|
|
9
|
+
{triggerChildren}
|
|
10
|
+
{block?.screenReaderText && <span className="sr-only">{block?.screenReaderText}</span>}
|
|
11
|
+
</NextLink>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { RelationshipField, RowField, SelectField, TextField, UploadField, EmailField as EmailFieldType } from 'payload'
|
|
2
|
+
|
|
3
|
+
const linkTypeField: SelectField = {
|
|
4
|
+
name: 'linkType',
|
|
5
|
+
type: 'select',
|
|
6
|
+
label: 'Link Type',
|
|
7
|
+
required: true,
|
|
8
|
+
interfaceName: 'AtomicButtonLinkTypes',
|
|
9
|
+
options: [
|
|
10
|
+
{ label: 'Internal Link', value: 'internalLink' },
|
|
11
|
+
{ label: 'External Link', value: 'externalLink' },
|
|
12
|
+
{ label: 'Download', value: 'download' },
|
|
13
|
+
{ label: 'Email', value: 'email' },
|
|
14
|
+
{ label: 'Phone', value: 'phone' },
|
|
15
|
+
],
|
|
16
|
+
admin: { width: '25%', condition: (_, sd) => Boolean(sd?.buttonType === 'link') },
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DownloadField: UploadField = {
|
|
20
|
+
name: 'download',
|
|
21
|
+
type: 'upload',
|
|
22
|
+
relationTo: 'images',
|
|
23
|
+
label: 'Download',
|
|
24
|
+
required: true,
|
|
25
|
+
admin: {
|
|
26
|
+
width: '25%',
|
|
27
|
+
allowCreate: false,
|
|
28
|
+
condition: (_, sd) => Boolean(sd?.linkType && sd?.linkType === 'download'),
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const EmailField: EmailFieldType = {
|
|
33
|
+
name: 'email',
|
|
34
|
+
type: 'email',
|
|
35
|
+
label: 'Email',
|
|
36
|
+
required: true,
|
|
37
|
+
admin: { width: '25%', condition: (_, sd) => Boolean(sd?.linkType && sd?.linkType === 'email') },
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ExternalLinkField: TextField = {
|
|
41
|
+
name: 'externalLink',
|
|
42
|
+
type: 'text',
|
|
43
|
+
required: true,
|
|
44
|
+
admin: { width: '25%', condition: (_, sd) => Boolean(sd?.linkType === 'externalLink') },
|
|
45
|
+
}
|
|
46
|
+
const InternalLinkField: RelationshipField = {
|
|
47
|
+
name: 'internalLink',
|
|
48
|
+
type: 'relationship',
|
|
49
|
+
relationTo: 'pages',
|
|
50
|
+
required: true,
|
|
51
|
+
admin: {
|
|
52
|
+
width: '25%',
|
|
53
|
+
allowEdit: false,
|
|
54
|
+
allowCreate: false,
|
|
55
|
+
condition: (_, sd) => Boolean(sd?.linkType && sd?.linkType === 'internalLink'),
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const PhoneField: TextField = {
|
|
60
|
+
name: 'phone',
|
|
61
|
+
type: 'text',
|
|
62
|
+
admin: {
|
|
63
|
+
width: '25%',
|
|
64
|
+
placeholder: '+1 123 456 7890 ',
|
|
65
|
+
condition: (_, sd) => Boolean(sd?.linkType && sd?.linkType === 'phone'),
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const LinkControlBarFields: RowField = {
|
|
70
|
+
type: 'row',
|
|
71
|
+
admin: { condition: (_, sd) => Boolean(sd?.buttonType === 'link') },
|
|
72
|
+
fields: [linkTypeField, InternalLinkField, ExternalLinkField, DownloadField, EmailField, PhoneField],
|
|
73
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GroupField } from 'payload'
|
|
2
|
+
|
|
3
|
+
export const LinkSettingsTab: GroupField = {
|
|
4
|
+
type: 'group',
|
|
5
|
+
label: 'Link Settings',
|
|
6
|
+
admin: {
|
|
7
|
+
hideGutter: true,
|
|
8
|
+
condition: (_, sd) =>
|
|
9
|
+
Boolean(sd?.type === 'button' && sd?.buttonType === 'link' && (sd?.linkType === 'internalLink' || sd?.linkType === 'externalLink')),
|
|
10
|
+
},
|
|
11
|
+
fields: [
|
|
12
|
+
{
|
|
13
|
+
type: 'row',
|
|
14
|
+
fields: [
|
|
15
|
+
{ name: 'anchor', type: 'text', admin: { width: '50%' } },
|
|
16
|
+
{ name: 'parameters', type: 'text', admin: { width: '50%' } },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{ name: 'prefetch', type: 'checkbox', label: 'Prefetch Link Data', admin: { width: '20%' } },
|
|
20
|
+
{ name: 'newTab', type: 'checkbox', label: 'Open in new tab', admin: { width: '20%' } },
|
|
21
|
+
{ name: 'noOpener', type: 'checkbox', admin: { width: '20%' } },
|
|
22
|
+
{ name: 'noReferrer', type: 'checkbox', admin: { width: '20%' } },
|
|
23
|
+
{ name: 'replace', type: 'checkbox', label: 'Replace current page', admin: { width: '20%' } },
|
|
24
|
+
{ name: 'scrollTo', type: 'checkbox', label: 'Scroll to anchor on click?', admin: { width: '20%' } },
|
|
25
|
+
],
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { APField } from '@/fields/apf'
|
|
2
|
+
|
|
3
|
+
import type { CheckboxField, SelectField, TextField } from 'payload'
|
|
4
|
+
|
|
5
|
+
const portalTypeOptions = [
|
|
6
|
+
{ label: 'Popover', value: 'popover' },
|
|
7
|
+
{ label: 'Dialog', value: 'dialog' },
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
const portalTypeField: SelectField = APField({
|
|
11
|
+
type: 'select',
|
|
12
|
+
apf: ['actions'],
|
|
13
|
+
name: 'portalType',
|
|
14
|
+
required: true,
|
|
15
|
+
options: portalTypeOptions,
|
|
16
|
+
interfaceName: 'AtomicButtonPortalTypes',
|
|
17
|
+
admin: { width: '25%', condition: (_, sd) => Boolean(sd?.type === 'button' && sd?.buttonType === 'portal') },
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const portalNameField: TextField = APField({
|
|
21
|
+
type: 'text',
|
|
22
|
+
apf: ['actions'],
|
|
23
|
+
name: 'portalName',
|
|
24
|
+
required: true,
|
|
25
|
+
admin: { condition: (_, sd) => Boolean(sd?.type === 'button' && sd?.buttonType === 'portal'), width: '25%' },
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const portalPersistedField: CheckboxField = APField({
|
|
29
|
+
type: 'checkbox',
|
|
30
|
+
apf: ['actions'],
|
|
31
|
+
name: 'persisted',
|
|
32
|
+
admin: { condition: (_, sd) => Boolean(sd?.type === 'button' && sd?.buttonType === 'portal' && sd?.portalName), width: '25%' },
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const PortalControlsFields: [SelectField, TextField, CheckboxField] = [portalTypeField, portalNameField, portalPersistedField]
|