@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,70 @@
|
|
|
1
|
+
import { type Tab } from 'payload'
|
|
2
|
+
import { APField } from '@/fields/apf'
|
|
3
|
+
import { onUploadSetAPF } from '@/hooks/field/apf'
|
|
4
|
+
import { FaviconField } from '@/fields/favicon'
|
|
5
|
+
|
|
6
|
+
const d = {
|
|
7
|
+
darkFavicon: 'Overrides the global dark favicon.',
|
|
8
|
+
lightFavicon: 'Overrides the global light favicon.',
|
|
9
|
+
noIndex: 'Prevents the page from being indexed by search engines.',
|
|
10
|
+
changeFrequency: 'How often the page is updated. Defaults to monthly.',
|
|
11
|
+
priority: 'Priority of the page compared to other pages. 0-1. Default is 0.5. Home page should be 1.',
|
|
12
|
+
image: 'The pages Open Graph image. This will override the global Open Graph image.',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SEOTab = () => {
|
|
16
|
+
const seoField: Tab = {
|
|
17
|
+
name: 'meta',
|
|
18
|
+
label: 'SEO',
|
|
19
|
+
interfaceName: 'PageSEO',
|
|
20
|
+
fields: [
|
|
21
|
+
APField({ type: 'text', apf: ['seo'], name: 'title' }),
|
|
22
|
+
APField({ type: 'textarea', apf: ['seo'], name: 'description' }),
|
|
23
|
+
{
|
|
24
|
+
name: 'image',
|
|
25
|
+
type: 'upload',
|
|
26
|
+
relationTo: 'images',
|
|
27
|
+
admin: { width: '50%', description: d.image },
|
|
28
|
+
hooks: { beforeValidate: [onUploadSetAPF(['seo'])] },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'row',
|
|
32
|
+
fields: [
|
|
33
|
+
FaviconField({ apf: ['seo'], name: 'lightFavicon', admin: { description: d.lightFavicon } }),
|
|
34
|
+
FaviconField({ apf: ['seo'], name: 'darkFavicon', admin: { description: d.darkFavicon } }),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'row',
|
|
39
|
+
fields: [
|
|
40
|
+
APField({
|
|
41
|
+
type: 'checkbox',
|
|
42
|
+
apf: ['seo', 'sitemap'],
|
|
43
|
+
name: 'noIndex',
|
|
44
|
+
required: true,
|
|
45
|
+
defaultValue: false,
|
|
46
|
+
admin: { width: '33%', description: d.noIndex },
|
|
47
|
+
}),
|
|
48
|
+
APField({
|
|
49
|
+
apf: ['seo', 'sitemap'],
|
|
50
|
+
name: 'priority',
|
|
51
|
+
type: 'number',
|
|
52
|
+
min: 0,
|
|
53
|
+
max: 1,
|
|
54
|
+
defaultValue: 0.5,
|
|
55
|
+
admin: { width: '33%', description: d.priority },
|
|
56
|
+
}),
|
|
57
|
+
APField({
|
|
58
|
+
type: 'select',
|
|
59
|
+
apf: ['seo', 'sitemap'],
|
|
60
|
+
name: 'changeFrequency',
|
|
61
|
+
options: ['daily', 'weekly', 'monthly', 'yearly', 'never'],
|
|
62
|
+
admin: { width: '33%', description: d.changeFrequency },
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return seoField
|
|
70
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Tab } from 'payload'
|
|
2
|
+
import { DevModeField } from '@/fields/devMode'
|
|
3
|
+
import { generateAPFFields } from '@/fields/apf/storage'
|
|
4
|
+
import { createBreadcrumbsField } from '@payloadcms/plugin-nested-docs'
|
|
5
|
+
|
|
6
|
+
export const SettingsTab = () => {
|
|
7
|
+
const settingsField: Tab = {
|
|
8
|
+
label: 'Settings',
|
|
9
|
+
fields: [
|
|
10
|
+
DevModeField(),
|
|
11
|
+
createBreadcrumbsField('pages', { name: 'breadcrumbs', admin: { initCollapsed: true } }),
|
|
12
|
+
...generateAPFFields(['form', 'page', 'pages', 'actions', 'classes', 'seo', 'sitemap']),
|
|
13
|
+
],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return settingsField
|
|
17
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { authd } from '@/access/authenticated'
|
|
2
|
+
import type { CollectionConfig } from 'payload'
|
|
3
|
+
|
|
4
|
+
const d = {
|
|
5
|
+
purpose: 'What this should be used for. e.g marketing, user flow, etc.',
|
|
6
|
+
propertyFormal: 'The formal property name. e.g page_name',
|
|
7
|
+
propertyObfuscated: 'The obfuscated property name. e.g page_name_obfuscated',
|
|
8
|
+
valueFormal: 'The formal value. e.g Home',
|
|
9
|
+
valueObfuscated: 'The obfuscated value. e.g Home_obfuscated',
|
|
10
|
+
location: 'Where this should be used. e.g page, component, global',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PostHogProperty: CollectionConfig = {
|
|
14
|
+
slug: 'posthogProperty',
|
|
15
|
+
admin: { group: 'Tracking', useAsTitle: 'title' },
|
|
16
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
17
|
+
defaultPopulate: { propertyObfuscated: true, valueObfuscated: true },
|
|
18
|
+
fields: [
|
|
19
|
+
{ name: 'title', type: 'text', required: true, unique: true, admin: { position: 'sidebar' } },
|
|
20
|
+
{ name: 'description', type: 'text', admin: { position: 'sidebar' } },
|
|
21
|
+
{ name: 'purpose', type: 'text', required: true, admin: { description: d.purpose } },
|
|
22
|
+
{
|
|
23
|
+
type: 'row',
|
|
24
|
+
fields: [
|
|
25
|
+
{ name: 'propertyFormal', type: 'text', required: true, admin: { description: d.propertyFormal } },
|
|
26
|
+
{ name: 'propertyObfuscated', type: 'text', required: true, admin: { description: d.propertyObfuscated } },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'row',
|
|
31
|
+
fields: [
|
|
32
|
+
{ name: 'valueFormal', type: 'text', required: true, admin: { description: d.valueFormal } },
|
|
33
|
+
{ name: 'valueObfuscated', type: 'text', required: true, admin: { description: d.valueObfuscated } },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'location',
|
|
38
|
+
type: 'radio',
|
|
39
|
+
required: true,
|
|
40
|
+
admin: { position: 'sidebar', layout: 'horizontal', description: d.location },
|
|
41
|
+
options: [
|
|
42
|
+
{ label: 'Page', value: 'page' },
|
|
43
|
+
{ label: 'Component', value: 'component' },
|
|
44
|
+
{ label: 'Global', value: 'global' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { APFControlsPath } from '@/ui'
|
|
2
|
+
import { SettingsTab } from './tabs/settings'
|
|
3
|
+
import { authd } from '@/access/authenticated'
|
|
4
|
+
import type { CollectionConfig } from 'payload'
|
|
5
|
+
import { ShortcutsTab } from './tabs/shortcuts'
|
|
6
|
+
import type { APFunction } from '@/ts/types/apf'
|
|
7
|
+
import { generateAPFFields } from '@/fields/apf/storage'
|
|
8
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
9
|
+
import { revalidateCacheOnDelete } from '@/hooks/collection/revalidate'
|
|
10
|
+
import { generateLivePreviewPath } from '@/utilities/generatePreviewPath'
|
|
11
|
+
|
|
12
|
+
const APFunctions: APFunction[] = ['classes', 'active']
|
|
13
|
+
|
|
14
|
+
const ShortcutSet: CollectionConfig = {
|
|
15
|
+
slug: 'shortcutSet',
|
|
16
|
+
access: { create: authd, delete: authd, read: authd, update: authd },
|
|
17
|
+
admin: {
|
|
18
|
+
group: 'Sets',
|
|
19
|
+
useAsTitle: 'title',
|
|
20
|
+
defaultColumns: ['title', 'active', '_status'],
|
|
21
|
+
preview: (data, { req }) => generateLivePreviewPath({ data, req }),
|
|
22
|
+
livePreview: { url: ({ data, req }) => generateLivePreviewPath({ data, req }) },
|
|
23
|
+
components: { edit: { beforeDocumentControls: [{ path: APFControlsPath, clientProps: { APFunctions } }] } },
|
|
24
|
+
},
|
|
25
|
+
fields: [{ type: 'tabs', tabs: [SettingsTab(), ShortcutsTab()] }, ...generateAPFFields(APFunctions)],
|
|
26
|
+
hooks: { beforeChange: [atomicHook], afterDelete: [revalidateCacheOnDelete] },
|
|
27
|
+
versions: { drafts: { schedulePublish: true, validate: true }, maxPerDoc: 50 },
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default ShortcutSet
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defaultShortcuts = []
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export const protectedNames = [
|
|
2
|
+
// Media elements
|
|
3
|
+
'img',
|
|
4
|
+
'svg',
|
|
5
|
+
'video',
|
|
6
|
+
'canvas',
|
|
7
|
+
'audio',
|
|
8
|
+
'iframe',
|
|
9
|
+
'embed',
|
|
10
|
+
'object',
|
|
11
|
+
'picture',
|
|
12
|
+
'source',
|
|
13
|
+
'track',
|
|
14
|
+
|
|
15
|
+
// Form elements
|
|
16
|
+
'input',
|
|
17
|
+
'textarea',
|
|
18
|
+
'select',
|
|
19
|
+
'option',
|
|
20
|
+
'optgroup',
|
|
21
|
+
'button',
|
|
22
|
+
'fieldset',
|
|
23
|
+
'legend',
|
|
24
|
+
'label',
|
|
25
|
+
'datalist',
|
|
26
|
+
|
|
27
|
+
// Interactive elements
|
|
28
|
+
'details',
|
|
29
|
+
'summary',
|
|
30
|
+
'dialog',
|
|
31
|
+
'menu',
|
|
32
|
+
'menuitem',
|
|
33
|
+
|
|
34
|
+
// Text elements
|
|
35
|
+
'p',
|
|
36
|
+
'h1',
|
|
37
|
+
'h2',
|
|
38
|
+
'h3',
|
|
39
|
+
'h4',
|
|
40
|
+
'h5',
|
|
41
|
+
'h6',
|
|
42
|
+
'span',
|
|
43
|
+
'div',
|
|
44
|
+
'section',
|
|
45
|
+
'article',
|
|
46
|
+
'aside',
|
|
47
|
+
'header',
|
|
48
|
+
'footer',
|
|
49
|
+
'nav',
|
|
50
|
+
'main',
|
|
51
|
+
'blockquote',
|
|
52
|
+
'pre',
|
|
53
|
+
'code',
|
|
54
|
+
'kbd',
|
|
55
|
+
'samp',
|
|
56
|
+
'var',
|
|
57
|
+
'time',
|
|
58
|
+
'mark',
|
|
59
|
+
'ruby',
|
|
60
|
+
'rt',
|
|
61
|
+
'rp',
|
|
62
|
+
'bdi',
|
|
63
|
+
'bdo',
|
|
64
|
+
'abbr',
|
|
65
|
+
'acronym',
|
|
66
|
+
'cite',
|
|
67
|
+
'dfn',
|
|
68
|
+
'em',
|
|
69
|
+
'i',
|
|
70
|
+
'strong',
|
|
71
|
+
'b',
|
|
72
|
+
'small',
|
|
73
|
+
'sub',
|
|
74
|
+
'sup',
|
|
75
|
+
'del',
|
|
76
|
+
'ins',
|
|
77
|
+
's',
|
|
78
|
+
'u',
|
|
79
|
+
|
|
80
|
+
// List elements
|
|
81
|
+
'ul',
|
|
82
|
+
'ol',
|
|
83
|
+
'li',
|
|
84
|
+
'dl',
|
|
85
|
+
'dt',
|
|
86
|
+
'dd',
|
|
87
|
+
|
|
88
|
+
// Table elements
|
|
89
|
+
'table',
|
|
90
|
+
'thead',
|
|
91
|
+
'tbody',
|
|
92
|
+
'tfoot',
|
|
93
|
+
'tr',
|
|
94
|
+
'td',
|
|
95
|
+
'th',
|
|
96
|
+
'caption',
|
|
97
|
+
'colgroup',
|
|
98
|
+
'col',
|
|
99
|
+
|
|
100
|
+
// Link elements
|
|
101
|
+
'a',
|
|
102
|
+
'link',
|
|
103
|
+
'area',
|
|
104
|
+
|
|
105
|
+
// Meta elements
|
|
106
|
+
'meta',
|
|
107
|
+
'title',
|
|
108
|
+
'base',
|
|
109
|
+
'style',
|
|
110
|
+
'script',
|
|
111
|
+
'noscript',
|
|
112
|
+
'template',
|
|
113
|
+
|
|
114
|
+
// Embedded content
|
|
115
|
+
'map',
|
|
116
|
+
'area',
|
|
117
|
+
|
|
118
|
+
// Semantic elements
|
|
119
|
+
'figure',
|
|
120
|
+
'figcaption',
|
|
121
|
+
'address',
|
|
122
|
+
'time',
|
|
123
|
+
'data',
|
|
124
|
+
|
|
125
|
+
// Other HTML elements
|
|
126
|
+
'html',
|
|
127
|
+
'head',
|
|
128
|
+
'body',
|
|
129
|
+
'hr',
|
|
130
|
+
'br',
|
|
131
|
+
'wbr',
|
|
132
|
+
'param',
|
|
133
|
+
'slot',
|
|
134
|
+
'portal',
|
|
135
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Tab } from 'payload'
|
|
2
|
+
import { ActiveField } from '@/fields/active'
|
|
3
|
+
import { TestPathField } from '@/fields/testPath'
|
|
4
|
+
import { UniqueTitleField } from '@/fields/uniqueTitle'
|
|
5
|
+
|
|
6
|
+
export const SettingsTab = () => {
|
|
7
|
+
const settingsField: Tab = {
|
|
8
|
+
label: 'Settings',
|
|
9
|
+
fields: [{ type: 'row', fields: [ActiveField(), UniqueTitleField('New Shortcut Set'), TestPathField] }],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return settingsField
|
|
13
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type Tab } from 'payload'
|
|
2
|
+
import { APField } from '@/fields/apf'
|
|
3
|
+
import { ShortcutLabelPath } from '@/ui'
|
|
4
|
+
import { ClassNameField } from '@/fields/className'
|
|
5
|
+
import { onArraySetAPFShallow } from '@/hooks/field/apf'
|
|
6
|
+
import { defaultShortcuts } from '@/collections/shortcutSets/defaults'
|
|
7
|
+
import { protectedNames } from '@/collections/shortcutSets/protectedNames'
|
|
8
|
+
|
|
9
|
+
const d = {
|
|
10
|
+
name: 'The name of the shortcut. This is used to identify the shortcut in the code.',
|
|
11
|
+
ds: 'Default shortcuts are set in the project code at /src/collections/shortcutSets/defaults.ts',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ShortcutsTab = () => {
|
|
15
|
+
const settingsField: Tab = {
|
|
16
|
+
label: 'Shortcuts',
|
|
17
|
+
fields: [
|
|
18
|
+
{
|
|
19
|
+
name: 'shortcuts',
|
|
20
|
+
type: 'array',
|
|
21
|
+
required: true,
|
|
22
|
+
admin: { components: { RowLabel: ShortcutLabelPath } },
|
|
23
|
+
fields: [
|
|
24
|
+
{
|
|
25
|
+
type: 'row',
|
|
26
|
+
fields: [
|
|
27
|
+
APField({
|
|
28
|
+
type: 'text',
|
|
29
|
+
name: 'name',
|
|
30
|
+
apf: ['classes'],
|
|
31
|
+
required: true,
|
|
32
|
+
admin: { width: '75%', description: d.name },
|
|
33
|
+
kebab: true,
|
|
34
|
+
validate: (val, options) => {
|
|
35
|
+
if (options.event !== 'onChange') return true
|
|
36
|
+
if (val) return 'Shortcut name is required.'
|
|
37
|
+
if (val === 'default') return 'The name "default" is reserved for the default shortcuts.'
|
|
38
|
+
if (val && typeof val === 'string' && protectedNames.includes(val.split('-')[0]))
|
|
39
|
+
return `The name "${val.split('-')[0]}" is protected and cannot be used as the first part of a shortcut name.`
|
|
40
|
+
return true
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
ClassNameField({ label: 'Atomic Classes' }),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'defaultShortcuts',
|
|
50
|
+
type: 'array',
|
|
51
|
+
required: false,
|
|
52
|
+
defaultValue: defaultShortcuts,
|
|
53
|
+
admin: { readOnly: true, isSortable: false, initCollapsed: true, description: d.ds, components: { RowLabel: ShortcutLabelPath } },
|
|
54
|
+
fields: [
|
|
55
|
+
{
|
|
56
|
+
type: 'row',
|
|
57
|
+
fields: [
|
|
58
|
+
APField({ type: 'text', apf: ['classes'], name: 'name', required: true, kebab: true, admin: { readOnly: true, width: '75%' } }),
|
|
59
|
+
APField({ type: 'checkbox', apf: ['classes'], name: 'mod', label: 'Mod', admin: { readOnly: true, width: '25%' } }),
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
ClassNameField({ label: 'Atomic Classes', admin: { readOnly: true } }),
|
|
63
|
+
],
|
|
64
|
+
hooks: { beforeValidate: [onArraySetAPFShallow(['classes'])] },
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return settingsField
|
|
70
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from '@/ts/zap'
|
|
2
|
+
import traverse from 'traverse'
|
|
3
|
+
import collections from './index'
|
|
4
|
+
import { atomicHook } from '@/hooks/collection/atomicHook/atomicHook'
|
|
5
|
+
|
|
6
|
+
function hasField(collection: Record<string, unknown>, fieldName: string): boolean {
|
|
7
|
+
let found = false
|
|
8
|
+
traverse(collection).forEach(function (node) {
|
|
9
|
+
if (typeof node === 'object' && node !== null && 'name' in node && node.name === fieldName) {
|
|
10
|
+
found = true
|
|
11
|
+
this.stop()
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
return found
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function hasAtomicHook(collection: Record<string, unknown>): boolean {
|
|
18
|
+
if (!('hooks' in collection) || !collection.hooks || typeof collection.hooks !== 'object' || !('beforeChange' in collection.hooks)) return false
|
|
19
|
+
const beforeChangeHooks = collection.hooks.beforeChange
|
|
20
|
+
return Array.isArray(beforeChangeHooks) && beforeChangeHooks.includes(atomicHook)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const CollectionThatUsesAtomicHookSlug = z.ap.add(z.enum(collections.filter(hasAtomicHook).map((collection) => collection.slug)), {
|
|
24
|
+
id: 'CollectionThatUsesAtomicHookSlug',
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const CollectionWithStoredAtomicClassesSlug = z.ap.add(
|
|
28
|
+
z.enum(collections.filter((collection) => hasField(collection, 'storedAtomicClasses')).map((collection) => collection.slug)),
|
|
29
|
+
{ id: 'CollectionWithStoredAtomicClassesSlug' },
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export const CollectionThatUseCSSProcessorSlug = z.ap.add(
|
|
33
|
+
z.enum([
|
|
34
|
+
'designSet',
|
|
35
|
+
'shortcutSet',
|
|
36
|
+
...collections.filter((collection) => hasField(collection, 'storedAtomicClasses')).map((collection) => collection.slug),
|
|
37
|
+
]),
|
|
38
|
+
{ id: 'CollectionThatUsesCSSProcessorSlug' },
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export const CollectionWithStoredAtomicFormsSlug = z.ap.add(
|
|
42
|
+
z.enum(collections.filter((collection) => hasField(collection, 'storedAtomicForms')).map((collection) => collection.slug)),
|
|
43
|
+
{ id: 'CollectionWithStoredAtomicFormsSlug' },
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export const CollectionWithStoredAtomicActionsSlug = z.ap.add(
|
|
47
|
+
z.enum(collections.filter((collection) => hasField(collection, 'storedAtomicActions')).map((collection) => collection.slug)),
|
|
48
|
+
{ id: 'CollectionWithStoredAtomicActionsSlug' },
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const CollectionSchemas = [
|
|
52
|
+
CollectionThatUsesAtomicHookSlug,
|
|
53
|
+
CollectionWithStoredAtomicClassesSlug,
|
|
54
|
+
CollectionThatUseCSSProcessorSlug,
|
|
55
|
+
CollectionWithStoredAtomicFormsSlug,
|
|
56
|
+
CollectionWithStoredAtomicActionsSlug,
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
export default CollectionSchemas
|