@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.
Files changed (423) hide show
  1. package/bin/cli.js +159 -0
  2. package/package.json +29 -0
  3. package/template/.env.example +35 -0
  4. package/template/.gitattributes +2 -0
  5. package/template/.prettierrc.json +6 -0
  6. package/template/.vscode/extensions.json +3 -0
  7. package/template/.vscode/launch.json +24 -0
  8. package/template/.vscode/settings.json +86 -0
  9. package/template/.yarnrc +1 -0
  10. package/template/LICENSE.md +22 -0
  11. package/template/README.md +128 -0
  12. package/template/eslint.config.mjs +32 -0
  13. package/template/next-env.d.ts +6 -0
  14. package/template/next.config.ts +36 -0
  15. package/template/package.json +75 -0
  16. package/template/public/adminFavicon.svg +1 -0
  17. package/template/public/ogImage.webp +0 -0
  18. package/template/src/access/anyone.ts +3 -0
  19. package/template/src/access/authenticated.ts +7 -0
  20. package/template/src/access/authenticatedOrPublished.ts +6 -0
  21. package/template/src/app/(frontend)/[...slug]/page.tsx +48 -0
  22. package/template/src/app/(frontend)/layout.tsx +49 -0
  23. package/template/src/app/(frontend)/next/exit-preview/route.ts +7 -0
  24. package/template/src/app/(frontend)/next/preview/route.ts +45 -0
  25. package/template/src/app/(frontend)/next/seed/route.ts +31 -0
  26. package/template/src/app/(frontend)/not-found.tsx +93 -0
  27. package/template/src/app/(frontend)/page.tsx +5 -0
  28. package/template/src/app/(frontend)/sitemap.ts +14 -0
  29. package/template/src/app/(payload)/admin/[[...segments]]/not-found.tsx +24 -0
  30. package/template/src/app/(payload)/admin/[[...segments]]/page.tsx +24 -0
  31. package/template/src/app/(payload)/admin/importMap.js +85 -0
  32. package/template/src/app/(payload)/api/[...slug]/route.ts +19 -0
  33. package/template/src/app/(payload)/custom.scss +29 -0
  34. package/template/src/app/(payload)/layout.tsx +31 -0
  35. package/template/src/blocks/actions/blocks.ts +27 -0
  36. package/template/src/blocks/actions/cookieConsent/set/block.ts +17 -0
  37. package/template/src/blocks/actions/cookieConsent/set/filter.ts +3 -0
  38. package/template/src/blocks/actions/cookieConsent/set/options.ts +35 -0
  39. package/template/src/blocks/actions/cookieConsent/toDA/block.ts +14 -0
  40. package/template/src/blocks/actions/cookieConsent/toDA/filter.ts +3 -0
  41. package/template/src/blocks/actions/cookieConsent/toDA/options.ts +19 -0
  42. package/template/src/blocks/actions/dynamicStore/boolean/set/block.ts +15 -0
  43. package/template/src/blocks/actions/dynamicStore/boolean/set/filter.ts +4 -0
  44. package/template/src/blocks/actions/dynamicStore/boolean/set/options.ts +18 -0
  45. package/template/src/blocks/actions/dynamicStore/boolean/toDA/block.ts +10 -0
  46. package/template/src/blocks/actions/dynamicStore/boolean/toDA/filter.ts +3 -0
  47. package/template/src/blocks/actions/dynamicStore/boolean/toDA/options.ts +12 -0
  48. package/template/src/blocks/actions/dynamicStore/text/cycle/block.ts +41 -0
  49. package/template/src/blocks/actions/dynamicStore/text/cycle/filter.ts +4 -0
  50. package/template/src/blocks/actions/dynamicStore/text/cycle/options.ts +23 -0
  51. package/template/src/blocks/actions/dynamicStore/text/toDA/block.ts +10 -0
  52. package/template/src/blocks/actions/dynamicStore/text/toDA/filter.ts +3 -0
  53. package/template/src/blocks/actions/dynamicStore/text/toDA/options.ts +12 -0
  54. package/template/src/blocks/actions/filters.ts +27 -0
  55. package/template/src/blocks/actions/form/errorToDA/block.ts +18 -0
  56. package/template/src/blocks/actions/form/errorToDA/filter.ts +3 -0
  57. package/template/src/blocks/actions/form/errorToDA/options.ts +15 -0
  58. package/template/src/blocks/actions/form/reset/block.ts +18 -0
  59. package/template/src/blocks/actions/form/reset/filter.ts +3 -0
  60. package/template/src/blocks/actions/form/reset/options.ts +30 -0
  61. package/template/src/blocks/actions/form/statusToDA/block.ts +12 -0
  62. package/template/src/blocks/actions/form/statusToDA/filter.ts +3 -0
  63. package/template/src/blocks/actions/form/statusToDA/options.ts +15 -0
  64. package/template/src/blocks/actions/form/submit/block.ts +18 -0
  65. package/template/src/blocks/actions/form/submit/filter.ts +3 -0
  66. package/template/src/blocks/actions/form/submit/options.ts +35 -0
  67. package/template/src/blocks/actions/portal/set/block.ts +25 -0
  68. package/template/src/blocks/actions/portal/set/filter.ts +3 -0
  69. package/template/src/blocks/actions/portal/set/options.ts +43 -0
  70. package/template/src/blocks/actions/processor.ts +263 -0
  71. package/template/src/blocks/actions/theme/set/block.ts +10 -0
  72. package/template/src/blocks/actions/theme/set/filter.ts +3 -0
  73. package/template/src/blocks/actions/theme/set/options.ts +9 -0
  74. package/template/src/blocks/actions/zap.ts +4 -0
  75. package/template/src/blocks/children/atomic/block.ts +123 -0
  76. package/template/src/blocks/children/atomic/controlBar.ts +43 -0
  77. package/template/src/blocks/children/atomic/variants/button/typeField.ts +16 -0
  78. package/template/src/blocks/children/atomic/variants/button/variants/link/component.client.tsx +21 -0
  79. package/template/src/blocks/children/atomic/variants/button/variants/link/component.tsx +13 -0
  80. package/template/src/blocks/children/atomic/variants/button/variants/link/controlBar.ts +73 -0
  81. package/template/src/blocks/children/atomic/variants/button/variants/link/settings.ts +26 -0
  82. package/template/src/blocks/children/atomic/variants/button/variants/portal/controlBar.ts +35 -0
  83. package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/component.tsx +36 -0
  84. package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/settings.ts +24 -0
  85. package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/component.tsx +41 -0
  86. package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/settings.ts +111 -0
  87. package/template/src/blocks/children/atomic/variants/button/variants/regular/component.client.tsx +19 -0
  88. package/template/src/blocks/children/atomic/variants/button/variants/regular/component.tsx +11 -0
  89. package/template/src/blocks/children/atomic/variants/form/component.tsx +18 -0
  90. package/template/src/blocks/children/atomic/variants/form/controlBar.ts +22 -0
  91. package/template/src/blocks/children/atomic/variants/form/settings.ts +20 -0
  92. package/template/src/blocks/children/atomic/variants/input/autoCompleteOptions.ts +51 -0
  93. package/template/src/blocks/children/atomic/variants/input/controlBar.ts +13 -0
  94. package/template/src/blocks/children/atomic/variants/input/settings.ts +35 -0
  95. package/template/src/blocks/children/atomic/variants/input/typeField.ts +23 -0
  96. package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.client.tsx +12 -0
  97. package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.tsx +6 -0
  98. package/template/src/blocks/children/atomic/variants/input/variants/checkBox/settings.ts +9 -0
  99. package/template/src/blocks/children/atomic/variants/input/variants/number/component.client.tsx +12 -0
  100. package/template/src/blocks/children/atomic/variants/input/variants/number/component.tsx +6 -0
  101. package/template/src/blocks/children/atomic/variants/input/variants/number/settings.ts +9 -0
  102. package/template/src/blocks/children/atomic/variants/input/variants/radio/component.client.tsx +12 -0
  103. package/template/src/blocks/children/atomic/variants/input/variants/radio/component.tsx +6 -0
  104. package/template/src/blocks/children/atomic/variants/input/variants/radio/settings.ts +9 -0
  105. package/template/src/blocks/children/atomic/variants/input/variants/text/component.client.tsx +12 -0
  106. package/template/src/blocks/children/atomic/variants/input/variants/text/component.tsx +7 -0
  107. package/template/src/blocks/children/atomic/variants/input/variants/text/settings.ts +12 -0
  108. package/template/src/blocks/children/atomic/variants/tag/component.client.tsx +17 -0
  109. package/template/src/blocks/children/atomic/variants/tag/component.tsx +13 -0
  110. package/template/src/blocks/children/atomic/variants/tag/controlBar.ts +6 -0
  111. package/template/src/blocks/children/atomic/variants/tag/settings.ts +9 -0
  112. package/template/src/blocks/children/blocks.ts +13 -0
  113. package/template/src/blocks/children/icon/block.ts +41 -0
  114. package/template/src/blocks/children/icon/component.tsx +17 -0
  115. package/template/src/blocks/children/image/block.ts +80 -0
  116. package/template/src/blocks/children/image/component.tsx +21 -0
  117. package/template/src/blocks/children/richText/block.ts +50 -0
  118. package/template/src/blocks/children/richText/component/converters/index.tsx +10 -0
  119. package/template/src/blocks/children/richText/component/converters/internalLink.tsx +8 -0
  120. package/template/src/blocks/children/richText/component/index.tsx +10 -0
  121. package/template/src/blocks/children/richText/component.tsx +7 -0
  122. package/template/src/blocks/children/richText/defaultLexical.ts +65 -0
  123. package/template/src/blocks/children/simpleText/block.ts +41 -0
  124. package/template/src/blocks/children/simpleText/component.client.tsx +18 -0
  125. package/template/src/blocks/children/simpleText/component.tsx +11 -0
  126. package/template/src/blocks/children/svg/block.ts +39 -0
  127. package/template/src/blocks/children/svg/component.tsx +6 -0
  128. package/template/src/blocks/children/video/block.ts +70 -0
  129. package/template/src/blocks/children/video/component.tsx +11 -0
  130. package/template/src/blocks/children/zap.ts +54 -0
  131. package/template/src/blocks/submitForm/form/rateLimiting/blocks.ts +5 -0
  132. package/template/src/blocks/submitForm/form/rateLimiting/functions.ts +1 -0
  133. package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/block.ts +23 -0
  134. package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/serverFunction.ts +46 -0
  135. package/template/src/blocks/submitForm/form/sanitation/blocks.ts +6 -0
  136. package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/block.ts +19 -0
  137. package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/serverFunction.ts +22 -0
  138. package/template/src/blocks/submitForm/form/sanitation/functions.ts +1 -0
  139. package/template/src/blocks/submitForm/form/validation/blocks.ts +6 -0
  140. package/template/src/blocks/submitForm/form/validation/functions.ts +1 -0
  141. package/template/src/blocks/submitForm/form/validation/isUnique/block.ts +19 -0
  142. package/template/src/blocks/submitForm/form/validation/isUnique/serverFunction.ts +40 -0
  143. package/template/src/blocks/submitForm/form/zap.ts +8 -0
  144. package/template/src/blocks/submitForm/formProcessor.ts +222 -0
  145. package/template/src/blocks/submitForm/input/sanitation/blocks.ts +5 -0
  146. package/template/src/blocks/submitForm/input/sanitation/functions.ts +1 -0
  147. package/template/src/blocks/submitForm/input/sanitation/trimText/block.ts +24 -0
  148. package/template/src/blocks/submitForm/input/sanitation/trimText/serverFunction.ts +63 -0
  149. package/template/src/blocks/submitForm/input/useOn.ts +8 -0
  150. package/template/src/blocks/submitForm/input/validation/blocks.ts +6 -0
  151. package/template/src/blocks/submitForm/input/validation/contains/block.ts +12 -0
  152. package/template/src/blocks/submitForm/input/validation/contains/serverFunction.ts +23 -0
  153. package/template/src/blocks/submitForm/input/validation/doesNotContain/block.ts +12 -0
  154. package/template/src/blocks/submitForm/input/validation/doesNotContain/serverFunction.ts +23 -0
  155. package/template/src/blocks/submitForm/input/validation/functions.ts +2 -0
  156. package/template/src/blocks/submitForm/input/zap.ts +6 -0
  157. package/template/src/blocks/submitForm/serverFunction.ts +42 -0
  158. package/template/src/collections/designSets/collection.ts +44 -0
  159. package/template/src/collections/designSets/defaults.ts +20 -0
  160. package/template/src/collections/designSets/tabs/animation.ts +71 -0
  161. package/template/src/collections/designSets/tabs/colors.ts +31 -0
  162. package/template/src/collections/designSets/tabs/fonts.ts +53 -0
  163. package/template/src/collections/designSets/tabs/miscellaneous.ts +22 -0
  164. package/template/src/collections/designSets/tabs/prose.ts +151 -0
  165. package/template/src/collections/designSets/tabs/settings.ts +52 -0
  166. package/template/src/collections/designSets/tabs/sizes.ts +30 -0
  167. package/template/src/collections/designSets/tabs/storage.ts +51 -0
  168. package/template/src/collections/designSets/tabs/variables.ts +28 -0
  169. package/template/src/collections/favicons.ts +11 -0
  170. package/template/src/collections/fonts/collection.ts +20 -0
  171. package/template/src/collections/fonts/script.ts +199 -0
  172. package/template/src/collections/footers/collection.ts +48 -0
  173. package/template/src/collections/footers/component.tsx +13 -0
  174. package/template/src/collections/headers/collection.ts +47 -0
  175. package/template/src/collections/headers/component.tsx +13 -0
  176. package/template/src/collections/iconSets/collection.ts +80 -0
  177. package/template/src/collections/iconSets/defaults.ts +81 -0
  178. package/template/src/collections/icons.ts +20 -0
  179. package/template/src/collections/images.ts +29 -0
  180. package/template/src/collections/index.ts +17 -0
  181. package/template/src/collections/muxVideos.ts +13 -0
  182. package/template/src/collections/pages/collection.ts +88 -0
  183. package/template/src/collections/pages/tabs/SEO.ts +70 -0
  184. package/template/src/collections/pages/tabs/settings.ts +17 -0
  185. package/template/src/collections/posthogProperty.ts +48 -0
  186. package/template/src/collections/shortcutSets/collection.ts +30 -0
  187. package/template/src/collections/shortcutSets/defaults.ts +1 -0
  188. package/template/src/collections/shortcutSets/protectedNames.ts +135 -0
  189. package/template/src/collections/shortcutSets/tabs/settings.ts +13 -0
  190. package/template/src/collections/shortcutSets/tabs/shortcuts.ts +70 -0
  191. package/template/src/collections/users.ts +11 -0
  192. package/template/src/collections/zap.ts +59 -0
  193. package/template/src/components/child/SSRProps.ts +381 -0
  194. package/template/src/components/child/renderChildren.tsx +148 -0
  195. package/template/src/components/livePreviewListener.tsx +10 -0
  196. package/template/src/components/providers/formProvider.tsx +11 -0
  197. package/template/src/components/providers/tracking/gtm.tsx +11 -0
  198. package/template/src/components/providers/tracking/index.tsx +46 -0
  199. package/template/src/components/providers/tracking/postHog.tsx +41 -0
  200. package/template/src/components/providers/tracking/vercel.tsx +10 -0
  201. package/template/src/components/toast/index.module.css +142 -0
  202. package/template/src/components/toast/index.tsx +55 -0
  203. package/template/src/endpoints/seed/backendForm.ts +48 -0
  204. package/template/src/endpoints/seed/designSet.ts +476 -0
  205. package/template/src/endpoints/seed/footer.ts +389 -0
  206. package/template/src/endpoints/seed/header.ts +3511 -0
  207. package/template/src/endpoints/seed/iconSet.ts +19 -0
  208. package/template/src/endpoints/seed/icons/assets/check.svg +4 -0
  209. package/template/src/endpoints/seed/icons/assets/close.svg +4 -0
  210. package/template/src/endpoints/seed/icons/assets/cookie.svg +7 -0
  211. package/template/src/endpoints/seed/icons/assets/github.svg +1 -0
  212. package/template/src/endpoints/seed/icons/assets/logo.svg +11 -0
  213. package/template/src/endpoints/seed/icons/assets/menu.svg +4 -0
  214. package/template/src/endpoints/seed/icons/assets/theme.svg +4 -0
  215. package/template/src/endpoints/seed/icons/check.ts +14 -0
  216. package/template/src/endpoints/seed/icons/close.ts +14 -0
  217. package/template/src/endpoints/seed/icons/cookie.ts +14 -0
  218. package/template/src/endpoints/seed/icons/github.ts +14 -0
  219. package/template/src/endpoints/seed/icons/index.ts +7 -0
  220. package/template/src/endpoints/seed/icons/logo.ts +14 -0
  221. package/template/src/endpoints/seed/icons/menu.ts +14 -0
  222. package/template/src/endpoints/seed/icons/theme.ts +14 -0
  223. package/template/src/endpoints/seed/index.ts +100 -0
  224. package/template/src/endpoints/seed/pages/home.ts +858 -0
  225. package/template/src/endpoints/seed/pages/index.ts +4 -0
  226. package/template/src/endpoints/seed/pages/notFoundPage.ts +287 -0
  227. package/template/src/endpoints/seed/pages/prose.ts +1436 -0
  228. package/template/src/endpoints/seed/pages/testing.ts +2181 -0
  229. package/template/src/endpoints/seed/shortcutSet.ts +187 -0
  230. package/template/src/endpoints/seed/siteMetaData.ts +10 -0
  231. package/template/src/fields/actions/changeKey.ts +12 -0
  232. package/template/src/fields/actions/index.ts +6 -0
  233. package/template/src/fields/actions/initialValueCheckbox.ts +14 -0
  234. package/template/src/fields/actions/keyText.ts +10 -0
  235. package/template/src/fields/actions/persisted.ts +14 -0
  236. package/template/src/fields/actions/setData.ts +20 -0
  237. package/template/src/fields/actions/strict/index.ts +3 -0
  238. package/template/src/fields/actions/strict/keySelect.ts +28 -0
  239. package/template/src/fields/actions/strict/listenSelect.ts +28 -0
  240. package/template/src/fields/actions/strict/performSelect.ts +30 -0
  241. package/template/src/fields/actions/strict/registry/cookieConsent.ts +14 -0
  242. package/template/src/fields/actions/strict/registry/index.ts +6 -0
  243. package/template/src/fields/actions/strict/registry/theme.ts +9 -0
  244. package/template/src/fields/active.ts +16 -0
  245. package/template/src/fields/apf/index.ts +69 -0
  246. package/template/src/fields/apf/storage.ts +38 -0
  247. package/template/src/fields/blocks/actions.ts +30 -0
  248. package/template/src/fields/blocks/backdropChildren.ts +11 -0
  249. package/template/src/fields/blocks/children.ts +15 -0
  250. package/template/src/fields/blocks/submitForm/form.ts +24 -0
  251. package/template/src/fields/blocks/submitForm/input.ts +25 -0
  252. package/template/src/fields/className.ts +26 -0
  253. package/template/src/fields/coloredEnd.ts +5 -0
  254. package/template/src/fields/defaultOpen.ts +14 -0
  255. package/template/src/fields/designSets/value.ts +80 -0
  256. package/template/src/fields/devMode.ts +11 -0
  257. package/template/src/fields/favicon.ts +18 -0
  258. package/template/src/fields/for.ts +11 -0
  259. package/template/src/fields/keepMounted.ts +11 -0
  260. package/template/src/fields/modal.ts +16 -0
  261. package/template/src/fields/slug.ts +35 -0
  262. package/template/src/fields/staticDataAttributes.ts +29 -0
  263. package/template/src/fields/tabs/block/children/actions.ts +49 -0
  264. package/template/src/fields/tabs/block/children/backdrop.ts +17 -0
  265. package/template/src/fields/tabs/block/children/settings.ts +45 -0
  266. package/template/src/fields/tabs/block/children/submitForm/form.ts +23 -0
  267. package/template/src/fields/tabs/block/children/submitForm/input.ts +14 -0
  268. package/template/src/fields/tabs/block/children/tracking.ts +25 -0
  269. package/template/src/fields/tabs/collection/storage.ts +55 -0
  270. package/template/src/fields/tagType.ts +32 -0
  271. package/template/src/fields/testPath.ts +3 -0
  272. package/template/src/fields/uniqueTitle.ts +8 -0
  273. package/template/src/fields/validationMessage.ts +13 -0
  274. package/template/src/globals/index.ts +8 -0
  275. package/template/src/globals/settings.ts +36 -0
  276. package/template/src/globals/siteMetaData.ts +29 -0
  277. package/template/src/globals/storage.ts +15 -0
  278. package/template/src/globals/tracking/global.ts +25 -0
  279. package/template/src/globals/tracking/tabs/gtm.ts +18 -0
  280. package/template/src/globals/tracking/tabs/postHog.ts +35 -0
  281. package/template/src/hooks/collection/atomicHook/atomicHook.ts +223 -0
  282. package/template/src/hooks/collection/atomicHook/processors/cssProcessor.ts +60 -0
  283. package/template/src/hooks/collection/atomicHook/processors/processDesignSet/generatePreflights.ts +36 -0
  284. package/template/src/hooks/collection/atomicHook/processors/processDesignSet/index.ts +176 -0
  285. package/template/src/hooks/collection/atomicHook/processors/unsetActive.ts +24 -0
  286. package/template/src/hooks/collection/formatSVG.ts +157 -0
  287. package/template/src/hooks/collection/revalidate.ts +53 -0
  288. package/template/src/hooks/collection/sanitizeCollection.ts +5 -0
  289. package/template/src/hooks/field/apf.ts +59 -0
  290. package/template/src/hooks/field/formatSlug.ts +23 -0
  291. package/template/src/hooks/field/href.ts +6 -0
  292. package/template/src/hooks/field/publishedAt.ts +5 -0
  293. package/template/src/hooks/frontEnd/atomicStore/create.ts +69 -0
  294. package/template/src/hooks/frontEnd/atomicStore/index.tsx +20 -0
  295. package/template/src/hooks/frontEnd/atomicStore/slices/base.ts +7 -0
  296. package/template/src/hooks/frontEnd/atomicStore/slices/consent.ts +76 -0
  297. package/template/src/hooks/frontEnd/atomicStore/slices/dynamic.ts +51 -0
  298. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/function.ts +14 -0
  299. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/zap.ts +12 -0
  300. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/function.ts +34 -0
  301. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/zap.ts +17 -0
  302. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/function.ts +22 -0
  303. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/zap.ts +10 -0
  304. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/function.ts +20 -0
  305. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/function.ts +24 -0
  306. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/zap.ts +10 -0
  307. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/function.ts +21 -0
  308. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/zap.ts +12 -0
  309. package/template/src/hooks/frontEnd/useActions/dispatch/attributer/zap.ts +15 -0
  310. package/template/src/hooks/frontEnd/useActions/dispatch/index.ts +2 -0
  311. package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/function.ts +30 -0
  312. package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/zap.ts +12 -0
  313. package/template/src/hooks/frontEnd/useActions/dispatch/runner/function.ts +21 -0
  314. package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/function.ts +7 -0
  315. package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/zap.ts +9 -0
  316. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/function.ts +10 -0
  317. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/zap.ts +11 -0
  318. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/function.ts +33 -0
  319. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/zap.ts +14 -0
  320. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/function.ts +11 -0
  321. package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/zap.ts +10 -0
  322. package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/function.ts +32 -0
  323. package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/zap.ts +9 -0
  324. package/template/src/hooks/frontEnd/useActions/dispatch/runner/zap.ts +16 -0
  325. package/template/src/hooks/frontEnd/useActions/dispatch/zap.ts +2 -0
  326. package/template/src/hooks/frontEnd/useActions/index.ts +6 -0
  327. package/template/src/hooks/frontEnd/useActions/useActionContext.ts +21 -0
  328. package/template/src/hooks/frontEnd/useActions/useButtonActions.ts +17 -0
  329. package/template/src/hooks/frontEnd/useActions/useDaToText.ts +34 -0
  330. package/template/src/hooks/frontEnd/useActions/useForm.ts +114 -0
  331. package/template/src/hooks/frontEnd/useActions/usePortal.ts +33 -0
  332. package/template/src/hooks/frontEnd/useActions/useToDa.ts +12 -0
  333. package/template/src/hooks/global/revalidate.ts +26 -0
  334. package/template/src/payload.config.ts +78 -0
  335. package/template/src/plugins/blurDataUrls.ts +8 -0
  336. package/template/src/plugins/formBuilder.ts +40 -0
  337. package/template/src/plugins/index.ts +17 -0
  338. package/template/src/plugins/muxVideo.ts +13 -0
  339. package/template/src/plugins/nestedDocs.ts +9 -0
  340. package/template/src/plugins/vercelBlobStorage.ts +8 -0
  341. package/template/src/ts/JSONSchema.ts +93 -0
  342. package/template/src/ts/declarations.ts +24 -0
  343. package/template/src/ts/types/actions.ts +175 -0
  344. package/template/src/ts/types/apf.ts +108 -0
  345. package/template/src/ts/types/cache.ts +166 -0
  346. package/template/src/ts/types/css.ts +14 -0
  347. package/template/src/ts/types/forms.ts +214 -0
  348. package/template/src/ts/types/frontEnd.ts +115 -0
  349. package/template/src/ts/types/index.ts +49 -0
  350. package/template/src/ts/types/payload-types.ts +3684 -0
  351. package/template/src/ts/zap/ap.ts +82 -0
  352. package/template/src/ts/zap/index.ts +4 -0
  353. package/template/src/ui/apf/controls.tsx +88 -0
  354. package/template/src/ui/apf/field.tsx +81 -0
  355. package/template/src/ui/apf/index.scss +59 -0
  356. package/template/src/ui/apf/label.tsx +23 -0
  357. package/template/src/ui/assets/Icon.tsx +21 -0
  358. package/template/src/ui/assets/Logo.tsx +21 -0
  359. package/template/src/ui/assets/atomicIcon.tsx +27 -0
  360. package/template/src/ui/assets/warningIcon.ts +6 -0
  361. package/template/src/ui/blocks/actionBlock.tsx +44 -0
  362. package/template/src/ui/blocks/inputBlock.tsx +24 -0
  363. package/template/src/ui/decorative/coloredEnd.tsx +16 -0
  364. package/template/src/ui/decorative/index.scss +46 -0
  365. package/template/src/ui/fields/iconSelect/index.tsx +19 -0
  366. package/template/src/ui/fields/slug/index.scss +12 -0
  367. package/template/src/ui/fields/slug/index.tsx +72 -0
  368. package/template/src/ui/index.ts +32 -0
  369. package/template/src/ui/root/beforeDashboard/index.scss +22 -0
  370. package/template/src/ui/root/beforeDashboard/index.tsx +39 -0
  371. package/template/src/ui/root/beforeDashboard/seedButton/index.scss +12 -0
  372. package/template/src/ui/root/beforeDashboard/seedButton/index.tsx +84 -0
  373. package/template/src/ui/root/siteTriggers/index.scss +22 -0
  374. package/template/src/ui/root/siteTriggers/index.tsx +94 -0
  375. package/template/src/ui/root/siteTriggers/triggerVercelDeploy.ts +37 -0
  376. package/template/src/ui/rowLabels/animation.tsx +27 -0
  377. package/template/src/ui/rowLabels/atomic/index.scss +62 -0
  378. package/template/src/ui/rowLabels/atomic/index.tsx +96 -0
  379. package/template/src/ui/rowLabels/color.tsx +33 -0
  380. package/template/src/ui/rowLabels/designToken.tsx +30 -0
  381. package/template/src/ui/rowLabels/icon.tsx +32 -0
  382. package/template/src/ui/rowLabels/shortcut/index.scss +21 -0
  383. package/template/src/ui/rowLabels/shortcut/index.tsx +30 -0
  384. package/template/src/ui/rowLabels/simpleText.tsx +41 -0
  385. package/template/src/utilities/deepMerge.ts +30 -0
  386. package/template/src/utilities/extractSVG.ts +9 -0
  387. package/template/src/utilities/format/toKebabCase.ts +79 -0
  388. package/template/src/utilities/format/toTitleCase.ts +47 -0
  389. package/template/src/utilities/formatDurationWithTokens.ts +56 -0
  390. package/template/src/utilities/generateMetaData.ts +45 -0
  391. package/template/src/utilities/generatePreviewPath.ts +43 -0
  392. package/template/src/utilities/get/cache/getAtomicActions.ts +48 -0
  393. package/template/src/utilities/get/cache/getAtomicClasses.ts +20 -0
  394. package/template/src/utilities/get/cache/getDesignSet.ts +15 -0
  395. package/template/src/utilities/get/cache/getFooter.ts +17 -0
  396. package/template/src/utilities/get/cache/getFormSubmissions.ts +17 -0
  397. package/template/src/utilities/get/cache/getForms.ts +43 -0
  398. package/template/src/utilities/get/cache/getHeader.ts +17 -0
  399. package/template/src/utilities/get/cache/getIcon.ts +51 -0
  400. package/template/src/utilities/get/cache/getImage.ts +20 -0
  401. package/template/src/utilities/get/cache/getPage.ts +35 -0
  402. package/template/src/utilities/get/cache/getPages.ts +24 -0
  403. package/template/src/utilities/get/cache/getShortcutSet.ts +17 -0
  404. package/template/src/utilities/get/cache/getSiteCSS.ts +17 -0
  405. package/template/src/utilities/get/cache/getSiteMetadata.ts +14 -0
  406. package/template/src/utilities/get/cache/getSitemap.ts +50 -0
  407. package/template/src/utilities/get/cache/getTracking.ts +14 -0
  408. package/template/src/utilities/get/cache/index.ts +129 -0
  409. package/template/src/utilities/get/cache/react.ts +5 -0
  410. package/template/src/utilities/get/getImageURL.ts +20 -0
  411. package/template/src/utilities/get/getMeUser.ts +22 -0
  412. package/template/src/utilities/get/getURL.ts +20 -0
  413. package/template/src/utilities/log/cache.ts +8 -0
  414. package/template/src/utilities/log/manual.ts +11 -0
  415. package/template/src/utilities/log/revalidation.ts +6 -0
  416. package/template/src/utilities/mergeTags.ts +7 -0
  417. package/template/src/utilities/propertyApplicatorUtility.ts +20 -0
  418. package/template/src/utilities/revalidateTag.ts +55 -0
  419. package/template/src/utilities/runAPF.ts +10 -0
  420. package/template/src/utilities/sanitizeData.ts +24 -0
  421. package/template/src/utilities/seedNestedRelationship.ts +5 -0
  422. package/template/tailwind.config.js +9 -0
  423. package/template/tsconfig.json +49 -0
@@ -0,0 +1,82 @@
1
+ import 'server-only' //DO NOT REMOVE
2
+ import z from 'zod'
3
+ import traverse from 'traverse'
4
+ import type { AtomicRegistry } from '@/ts/types'
5
+
6
+ type ZapSchemaRegistry = { id: string; description?: string }
7
+
8
+ //KNOWN ISSUE: Updating past zod 4.1.11 breaks some handling of zod schemas. Need to investigate why and fix.
9
+ const rss = z.record(z.string(), z.string()).meta({ id: 'RSS', description: 'Type: {@link RSS} Record<string, string>' })
10
+ const sosa = z.union([z.string(), z.array(z.string())]).meta({ id: 'SOSA', description: 'Type: {@link SOSA} String | String[]' })
11
+ z.record(z.string(), rss).meta({ id: 'RSRSS', description: 'Type: {@link RSRSS} Record<string, Record<string, string>>' })
12
+ z.record(z.string(), sosa).meta({ id: 'RSSOSA', description: 'Type: {@link RSSOSA} Record<string, string | string[]>' })
13
+
14
+ class AtomicPayloadZodClass {
15
+ /**
16
+ * Adds a schema to the global registry.
17
+ * @param schema - The zod schema to add.
18
+ * @param options - The options for the schema. Always includes the id, and optionally the description. Automatically adds a type link to the schema.
19
+ * @returns The schema.
20
+ */
21
+ add<T extends z.ZodType>(schema: T, options: ZapSchemaRegistry): T {
22
+ const fullDescription = options.description ? `Type:{@link ${options.id}} ${options.description}` : `Type: {@link ${options.id}}`
23
+ if (!z.globalRegistry._idmap.has(options.id)) {
24
+ z.globalRegistry.add(schema, { id: options.id, description: fullDescription })
25
+ z.globalRegistry._idmap.set(options.id, schema)
26
+ }
27
+ return schema
28
+ }
29
+
30
+ /**
31
+ * Gets a schema from the global registry.
32
+ * @param id - The id of the zod schema to get.
33
+ * @param schema - Only necessary if the schema is being called before it is added to the global registry. Import and add said schema here to fix.
34
+ * @returns The schema.
35
+ */
36
+ get<T extends keyof AtomicRegistry>(id: T, schema?: z.ZodType): z.ZodType<AtomicRegistry[T]> {
37
+ const result = z.globalRegistry._idmap.get(id) as z.ZodType<AtomicRegistry[T]>
38
+ if (!result) throw new Error(`Schema with id ${id} not found. It is recommended you add the second argument, which is the desired schema.`)
39
+ return result
40
+ }
41
+
42
+ /**
43
+ * Returns a type helper for the given schema ID.
44
+ * Use this in type annotations: `const value: z.ap.Type<'SchemaId'> = ...`
45
+ * @param id - The id of the zod schema type to get.
46
+ * @returns A type that TypeScript can infer from AtomicRegistry.
47
+ */
48
+ type<T extends keyof AtomicRegistry>(id: T): AtomicRegistry[T] {
49
+ // This method exists for type inference only
50
+ // The actual type is resolved at compile time via the Type helper
51
+ return undefined as any as AtomicRegistry[T]
52
+ }
53
+
54
+ /** Converts the ZOD global registry to a JSON Schema. */
55
+ toJSONSchema() {
56
+ z.globalRegistry.add(z.object(Object.fromEntries(z.globalRegistry._idmap.entries())), { id: 'AtomicRegistry' })
57
+
58
+ const jsonSchema = z.toJSONSchema(z.globalRegistry, { target: 'draft-4', uri: (id) => `#/definitions/${id}` }).schemas
59
+ traverse(jsonSchema).forEach(function () {
60
+ if (this.key === '$id') this.remove()
61
+ })
62
+ return jsonSchema
63
+ }
64
+ }
65
+
66
+ /** {@link AtomicPayloadsZodClass}: Adds methods that enhance Payload's typing. */
67
+ export const ap = new AtomicPayloadZodClass()
68
+
69
+ /**
70
+ * Namespace for type-level helpers that merge with the runtime `ap` instance.
71
+ * This allows `z.ap.Type<'SchemaId'>` to work as a type helper.
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/no-namespace
74
+ export namespace ap {
75
+ /**
76
+ * Type helper to get the TypeScript type for a schema ID from AtomicRegistry.
77
+ * Usage: `const value: z.ap.Type<'SchemaId'> = ...`
78
+ */
79
+ export type Type<T extends keyof AtomicRegistry> = AtomicRegistry[T]
80
+ }
81
+
82
+ export * from 'zod'
@@ -0,0 +1,4 @@
1
+ // Includes all of zods exports, with an attached Atomic Payloads Zod Class Instance
2
+ import * as z from './ap'
3
+ export { z }
4
+ export default z
@@ -0,0 +1,88 @@
1
+ 'use client'
2
+ import './index.scss'
3
+ import React, { memo } from 'react'
4
+ import { type APFunction } from '@/ts/types/apf'
5
+ import { apfRegistry } from '@/fields/apf/storage'
6
+ import type { BeforeDocumentControlsClientProps } from 'payload'
7
+ import { Button, EditIcon, PlusIcon, LinkIcon, MenuIcon, PopupList, SearchIcon, FolderIcon, DocumentIcon, useFormFields } from '@payloadcms/ui'
8
+
9
+ type RunControlsProps = { APFunctions?: APFunction[] } & BeforeDocumentControlsClientProps
10
+
11
+ //TODO: Add better icons
12
+ const apfIcons: Record<APFunction, React.ComponentType> = {
13
+ page: LinkIcon,
14
+ pages: DocumentIcon,
15
+ classes: EditIcon,
16
+ actions: PlusIcon,
17
+ form: MenuIcon,
18
+ active: FolderIcon,
19
+ seo: SearchIcon,
20
+ sitemap: FolderIcon,
21
+ siteMetadata: SearchIcon,
22
+ }
23
+
24
+ const RunControls: React.FC<RunControlsProps> = ({ APFunctions = Object.keys(apfRegistry) }) => {
25
+ const runValues = useFormFields(([fields]) => {
26
+ const values = {} as Record<APFunction, boolean>
27
+
28
+ Object.entries(apfRegistry).forEach(([apFunction, path]) => (values[apFunction as APFunction] = Boolean(fields[path]?.value)))
29
+
30
+ return values
31
+ })
32
+
33
+ const setRunValue = useFormFields(([, dispatch]) => (apFunction: APFunction, value: boolean) => {
34
+ dispatch({ type: 'UPDATE', path: apfRegistry[apFunction], value })
35
+ })
36
+
37
+ const handleToggleRun = (apFunction: APFunction) => setRunValue(apFunction, !runValues[apFunction])
38
+
39
+ const activeControls = Object.entries(runValues)
40
+ .filter(([, isActive]) => isActive)
41
+ .map(([apfFunction]) => apfFunction as APFunction)
42
+
43
+ return (
44
+ <Button
45
+ buttonStyle="none"
46
+ className="full-width-button"
47
+ tooltip="Processes That Run On Save"
48
+ SubMenuPopupContent={() => (
49
+ <PopupList.ButtonGroup>
50
+ <div className="apf-controls__header flex-column">
51
+ <span className="apf-controls__header-title text-sm">Processes That Run On Save</span>
52
+ </div>
53
+ {Object.keys(apfRegistry)
54
+ .filter((apFunctionString) => APFunctions.includes(apFunctionString as APFunction))
55
+ .map((apFunctionString) => {
56
+ const apFunction = apFunctionString as APFunction
57
+ //const isActive = runValues[apFunction]
58
+ const IconComponent = apfIcons[apFunction as APFunction]
59
+
60
+ return (
61
+ <PopupList.Button key={apFunction} onClick={() => handleToggleRun(apFunction)}>
62
+ <div className="apf-controls__button-content">
63
+ <span>{apFunction}</span>
64
+ <IconComponent />
65
+ </div>
66
+ </PopupList.Button>
67
+ )
68
+ })}
69
+ </PopupList.ButtonGroup>
70
+ )}
71
+ >
72
+ {activeControls.length > 0 ? (
73
+ <div className="apf-controls__active-controls">
74
+ {activeControls.map((apFunction) => {
75
+ const IconComponent = apfIcons[apFunction]
76
+ return <IconComponent key={apFunction} />
77
+ })}
78
+ </div>
79
+ ) : (
80
+ <span>None</span>
81
+ )}
82
+ </Button>
83
+ )
84
+ }
85
+
86
+ RunControls.displayName = 'RunControls'
87
+
88
+ export default memo(RunControls)
@@ -0,0 +1,81 @@
1
+ 'use client'
2
+ import './index.scss'
3
+ import APFieldLabelServer from './label'
4
+ import React, { memo, useMemo } from 'react'
5
+ import { apfRegistry } from '@/fields/apf/storage'
6
+ import type { APFFieldComponentType } from '@/ts/types'
7
+ import { toKebabCase } from '@/utilities/format/toKebabCase'
8
+ import { useField, useFormFields, NumberField, TextInput, TextareaInput, CheckboxInput, SelectField, FieldDescription } from '@payloadcms/ui'
9
+
10
+ export const APFieldComponent: APFFieldComponentType = (props) => {
11
+ const { path, field, apf, type } = props
12
+
13
+ const { value, initialValue, setValue } = useField<unknown>({ path })
14
+
15
+ const targetPaths = useMemo(() => {
16
+ const apfArray = Array.isArray(apf) ? apf : [apf]
17
+ return apfArray?.map((apfItem) => apfRegistry[apfItem])
18
+ }, [apf])
19
+
20
+ const setTargetValues = useFormFields(([, dispatch]) => (value: boolean) => {
21
+ targetPaths?.forEach((targetPath) => dispatch({ type: 'UPDATE', path: targetPath, value }))
22
+ })
23
+
24
+ function handleTextChange(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) {
25
+ if (type === 'text' || type === 'textarea') {
26
+ const { kebab } = props
27
+ let tempValue = e.target.value
28
+ if (kebab) tempValue = toKebabCase(tempValue)
29
+ setValue(tempValue)
30
+ setTargetValues(true)
31
+ }
32
+ if (value !== initialValue) setTargetValues(true)
33
+ }
34
+
35
+ function handleChange(value: unknown) {
36
+ setValue(value)
37
+ if (value !== initialValue) setTargetValues(true)
38
+ }
39
+
40
+ let fieldComponent = null
41
+ switch (type) {
42
+ case 'text':
43
+ fieldComponent = (
44
+ <TextInput path={path} style={field?.admin?.style} readOnly={field?.admin?.readOnly} value={value as string} onChange={handleTextChange} />
45
+ )
46
+ break
47
+ case 'textarea':
48
+ fieldComponent = (
49
+ <TextareaInput
50
+ path={path}
51
+ style={field?.admin?.style}
52
+ readOnly={field?.admin?.readOnly}
53
+ value={value as string}
54
+ onChange={handleTextChange}
55
+ />
56
+ )
57
+ break
58
+ case 'checkbox':
59
+ fieldComponent = (
60
+ <CheckboxInput checked={value as boolean} readOnly={field?.admin?.readOnly} onToggle={() => handleChange(!value)} id={`field-${path}`} />
61
+ )
62
+ break
63
+ case 'select':
64
+ return <SelectField value={value as string} readOnly={field?.admin?.readOnly} field={field} onChange={handleChange} path={path} />
65
+ case 'number':
66
+ return <NumberField readOnly={field?.admin?.readOnly} field={field} onChange={handleChange} path={path} />
67
+ default:
68
+ console.warn('Missing Field Component With Type: ', type)
69
+ fieldComponent = <div> Missing Field Component </div>
70
+ }
71
+
72
+ return (
73
+ <div className={`field-type ${type}`}>
74
+ <APFieldLabelServer {...props} />
75
+ {fieldComponent}
76
+ {field?.admin?.description && <FieldDescription description={field.admin.description} path={path} />}
77
+ </div>
78
+ )
79
+ }
80
+
81
+ export default memo(APFieldComponent)
@@ -0,0 +1,59 @@
1
+ .label-wrapper {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ align-items: center;
5
+ }
6
+
7
+ .doc-link-label {
8
+ display: flex;
9
+ direction: row;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ }
13
+
14
+ .doc-link-button {
15
+ background: none;
16
+ border: none;
17
+ padding-bottom: 0.3125rem;
18
+ cursor: pointer;
19
+ border-radius: calc(infinity * 1px);
20
+ }
21
+
22
+ .doc-link-button-icon {
23
+ height: 18px;
24
+ width: 18px;
25
+ padding-bottom: 0.3125rem;
26
+ margin-right: 4px;
27
+ fill: var(--theme-elevation-800);
28
+ stroke: var(--theme-elevation-800);
29
+ &:hover {
30
+ fill: #27ae60;
31
+ stroke: #27ae60;
32
+ }
33
+ }
34
+
35
+ .apf-controls {
36
+ &__header {
37
+ padding: 0 0 4px 0;
38
+ border-bottom: 2px solid var(--theme-border-color);
39
+ text-align: center;
40
+ }
41
+
42
+ &__header-title {
43
+ text-transform: capitalize;
44
+ }
45
+
46
+ &__button-content {
47
+ display: flex;
48
+ justify-content: space-between;
49
+ width: 100%;
50
+ align-items: center;
51
+ text-transform: capitalize;
52
+ }
53
+
54
+ &__active-controls {
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 4px;
58
+ }
59
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import NextLink from 'next/link'
3
+ import { FieldLabel } from '@payloadcms/ui'
4
+ import type { APFFieldComponentType } from '@/ts/types'
5
+
6
+ const APFieldLabelServer: APFFieldComponentType = (props) => {
7
+ const { path, field, docLink } = props
8
+ return (
9
+ <div className="doc-link-label">
10
+ {docLink && (
11
+ <NextLink className="doc-link-button" href={docLink} target="_blank" rel="noopener noreferrer">
12
+ <svg xmlns="http://www.w3.org/2000/svg" className="doc-link-button-icon" viewBox="8.0 8.0 112.1 112.1" fill="#2ecc71" stroke="#2ecc71">
13
+ <path d="M64 8a56 56 0 10.1 112.1A56 56 0 0064 8m0 104a48 48 0 110-96 48 48 0 010 96" />
14
+ <path d="M68 36c0 5.3-8 5.3-8 0s8-5.3 8 0m-4 12a4 4 0 00-4 4v40c0 2.2 1.8 4 4 4s4-1.8 4-4V52a4 4 0 00-4-4" />
15
+ </svg>
16
+ </NextLink>
17
+ )}
18
+ <FieldLabel htmlFor={`field-${path}`} label={field?.label} path={path} required={field?.required} />
19
+ </div>
20
+ )
21
+ }
22
+
23
+ export default APFieldLabelServer
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+
3
+ const AtomicIcon = () => {
4
+ return (
5
+ <svg
6
+ aria-hidden="true"
7
+ fill={'white'}
8
+ stroke={'white'}
9
+ height="18px"
10
+ width="18px"
11
+ viewBox="4.831294298086888 3.964216194994505 119.20798159513734 119.2044895069186"
12
+ >
13
+ <path d="m78.914 57.711-1.453 6.258v-.004a14.34 14.34 0 0 0 10.082-2.895l-4.54-4.539a8.4 8.4 0 0 1-4.089 1.18M40.215 122l38.484-9.164V92.539l-34.102 19.234zM15.164 49.301 6 87.785l10.227-4.383L35.46 49.3zm55.133-.379a8.3 8.3 0 0 1 1.172-3.926l-4.54-4.539a14.6 14.6 0 0 0-2.952 8.844c0 .328 0 .66.035 1zM86.465 5.133A36.4 36.4 0 0 0 78.633 6L122 49.367A36.33 36.33 0 0 0 86.465 5.133" />
14
+ <path d="M54.762 23.648 20.324 84.695l10 10L51.972 73.05a2.11 2.11 0 0 1 2.977 0c.82.824.82 2.152 0 2.977L33.3 97.672l10 10 61.05-34.434a36.42 36.42 0 0 0 16.302-19.266L74.028 7.347a36.43 36.43 0 0 0-19.266 16.3zM103.938 49.3a25.243 25.243 0 0 1-25.239 25.239 25.23 25.23 0 0 1-17.844-7.395 25.23 25.23 0 0 1 0-35.692 25.24 25.24 0 0 1 17.844-7.39 25.28 25.28 0 0 1 17.84 7.398 25.28 25.28 0 0 1 7.399 17.84" />
15
+ <path d="M78.699 70.332a21.02 21.02 0 0 0 14.871-6.16 21.03 21.03 0 0 0 0-29.742c-3.941-3.946-9.293-6.16-14.871-6.16s-10.926 2.214-14.871 6.16a21.02 21.02 0 0 0-6.16 14.87 21.05 21.05 0 0 0 6.168 14.864 21.05 21.05 0 0 0 14.863 6.168m13.398-7.676h.004a18.8 18.8 0 0 1-13.402 5.57 19 19 0 0 1-4.266-.496 2.08 2.08 0 0 1-1.312-.937 2.1 2.1 0 0 1-.266-1.59l2.38-10.242a2.11 2.11 0 0 1 2.522-1.574 4.11 4.11 0 0 0 3.93-1.129c.395-.398.93-.625 1.492-.625a1.91 1.91 0 0 1 1.493.613l7.437 7.438c.82.82.82 2.152 0 2.972zm-14.023-19.96 2.383-10.243.004-.004a2.08 2.08 0 0 1 .937-1.308 2.08 2.08 0 0 1 1.586-.262 18.99 18.99 0 0 1 14.188 14.32 2.1 2.1 0 0 1-1.602 2.508L85.293 49.95l.004.004q-.224.047-.453.047c-.98 0-1.832-.68-2.047-1.637a4.21 4.21 0 0 0-3.133-3.144 2.12 2.12 0 0 1-1.312-.938 2.1 2.1 0 0 1-.262-1.586zm-1.488 6.6.004-.003a2.05 2.05 0 0 1 1.644-2.106 2.15 2.15 0 0 1 1.977.586c.508.52.718 1.262.55 1.97a2.28 2.28 0 0 1-2.07 1.66 2.193 2.193 0 0 1-2.09-2.11zM65.332 35.9l.004-.004c.82-.82 2.148-.82 2.968 0l7.438 7.437a2.095 2.095 0 0 1 0 2.98 4.18 4.18 0 0 0-1.25 2.99q.002.434.086.859a2.1 2.1 0 0 1-1.598 2.484l-10.27 2.242a2.103 2.103 0 0 1-2.508-1.613 19 19 0 0 1-.422-3.973 18.8 18.8 0 0 1 5.563-13.41z" />
16
+ <path d="m86.164 45.457 6.293-1.375a14.82 14.82 0 0 0-8.398-8.48l-1.457 6.265a8.47 8.47 0 0 1 3.562 3.59" />
17
+ </svg>
18
+ )
19
+ }
20
+
21
+ export default AtomicIcon
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+
3
+ const AtomicLogo = () => {
4
+ return (
5
+ <svg
6
+ aria-hidden="true"
7
+ fill={'white'}
8
+ stroke={'white'}
9
+ height="18px"
10
+ width="18px"
11
+ viewBox="4.831294298086888 3.964216194994505 119.20798159513734 119.2044895069186"
12
+ >
13
+ <path d="m78.914 57.711-1.453 6.258v-.004a14.34 14.34 0 0 0 10.082-2.895l-4.54-4.539a8.4 8.4 0 0 1-4.089 1.18M40.215 122l38.484-9.164V92.539l-34.102 19.234zM15.164 49.301 6 87.785l10.227-4.383L35.46 49.3zm55.133-.379a8.3 8.3 0 0 1 1.172-3.926l-4.54-4.539a14.6 14.6 0 0 0-2.952 8.844c0 .328 0 .66.035 1zM86.465 5.133A36.4 36.4 0 0 0 78.633 6L122 49.367A36.33 36.33 0 0 0 86.465 5.133" />
14
+ <path d="M54.762 23.648 20.324 84.695l10 10L51.972 73.05a2.11 2.11 0 0 1 2.977 0c.82.824.82 2.152 0 2.977L33.3 97.672l10 10 61.05-34.434a36.42 36.42 0 0 0 16.302-19.266L74.028 7.347a36.43 36.43 0 0 0-19.266 16.3zM103.938 49.3a25.243 25.243 0 0 1-25.239 25.239 25.23 25.23 0 0 1-17.844-7.395 25.23 25.23 0 0 1 0-35.692 25.24 25.24 0 0 1 17.844-7.39 25.28 25.28 0 0 1 17.84 7.398 25.28 25.28 0 0 1 7.399 17.84" />
15
+ <path d="M78.699 70.332a21.02 21.02 0 0 0 14.871-6.16 21.03 21.03 0 0 0 0-29.742c-3.941-3.946-9.293-6.16-14.871-6.16s-10.926 2.214-14.871 6.16a21.02 21.02 0 0 0-6.16 14.87 21.05 21.05 0 0 0 6.168 14.864 21.05 21.05 0 0 0 14.863 6.168m13.398-7.676h.004a18.8 18.8 0 0 1-13.402 5.57 19 19 0 0 1-4.266-.496 2.08 2.08 0 0 1-1.312-.937 2.1 2.1 0 0 1-.266-1.59l2.38-10.242a2.11 2.11 0 0 1 2.522-1.574 4.11 4.11 0 0 0 3.93-1.129c.395-.398.93-.625 1.492-.625a1.91 1.91 0 0 1 1.493.613l7.437 7.438c.82.82.82 2.152 0 2.972zm-14.023-19.96 2.383-10.243.004-.004a2.08 2.08 0 0 1 .937-1.308 2.08 2.08 0 0 1 1.586-.262 18.99 18.99 0 0 1 14.188 14.32 2.1 2.1 0 0 1-1.602 2.508L85.293 49.95l.004.004q-.224.047-.453.047c-.98 0-1.832-.68-2.047-1.637a4.21 4.21 0 0 0-3.133-3.144 2.12 2.12 0 0 1-1.312-.938 2.1 2.1 0 0 1-.262-1.586zm-1.488 6.6.004-.003a2.05 2.05 0 0 1 1.644-2.106 2.15 2.15 0 0 1 1.977.586c.508.52.718 1.262.55 1.97a2.28 2.28 0 0 1-2.07 1.66 2.193 2.193 0 0 1-2.09-2.11zM65.332 35.9l.004-.004c.82-.82 2.148-.82 2.968 0l7.438 7.437a2.095 2.095 0 0 1 0 2.98 4.18 4.18 0 0 0-1.25 2.99q.002.434.086.859a2.1 2.1 0 0 1-1.598 2.484l-10.27 2.242a2.103 2.103 0 0 1-2.508-1.613 19 19 0 0 1-.422-3.973 18.8 18.8 0 0 1 5.563-13.41z" />
16
+ <path d="m86.164 45.457 6.293-1.375a14.82 14.82 0 0 0-8.398-8.48l-1.457 6.265a8.47 8.47 0 0 1 3.562 3.59" />
17
+ </svg>
18
+ )
19
+ }
20
+
21
+ export default AtomicLogo
@@ -0,0 +1,27 @@
1
+ type AtomicIconProps = { type: 'tag' | 'form' | 'input' | 'button' | 'portal' }
2
+
3
+ const typeColors: Record<AtomicIconProps['type'], string> = {
4
+ tag: 'var(--atomic-distinct-1)', // green
5
+ form: 'var(--atomic-distinct-2)', // orange
6
+ input: 'var(--atomic-distinct-3)', // blue
7
+ button: 'var(--atomic-distinct-4)', // yellow
8
+ portal: 'var(--atomic-distinct-5)', // purple
9
+ }
10
+
11
+ export const AtomicIcon: React.FC<AtomicIconProps> = ({ type }) => {
12
+ return (
13
+ <svg
14
+ aria-hidden="true"
15
+ fill={typeColors[type] || 'white'}
16
+ stroke={typeColors[type] || 'white'}
17
+ height="24px"
18
+ width="24px"
19
+ viewBox="4.831294298086888 3.964216194994505 119.20798159513734 119.2044895069186"
20
+ >
21
+ <path d="m78.914 57.711-1.453 6.258v-.004a14.34 14.34 0 0 0 10.082-2.895l-4.54-4.539a8.4 8.4 0 0 1-4.089 1.18M40.215 122l38.484-9.164V92.539l-34.102 19.234zM15.164 49.301 6 87.785l10.227-4.383L35.46 49.3zm55.133-.379a8.3 8.3 0 0 1 1.172-3.926l-4.54-4.539a14.6 14.6 0 0 0-2.952 8.844c0 .328 0 .66.035 1zM86.465 5.133A36.4 36.4 0 0 0 78.633 6L122 49.367A36.33 36.33 0 0 0 86.465 5.133" />
22
+ <path d="M54.762 23.648 20.324 84.695l10 10L51.972 73.05a2.11 2.11 0 0 1 2.977 0c.82.824.82 2.152 0 2.977L33.3 97.672l10 10 61.05-34.434a36.42 36.42 0 0 0 16.302-19.266L74.028 7.347a36.43 36.43 0 0 0-19.266 16.3zM103.938 49.3a25.243 25.243 0 0 1-25.239 25.239 25.23 25.23 0 0 1-17.844-7.395 25.23 25.23 0 0 1 0-35.692 25.24 25.24 0 0 1 17.844-7.39 25.28 25.28 0 0 1 17.84 7.398 25.28 25.28 0 0 1 7.399 17.84" />
23
+ <path d="M78.699 70.332a21.02 21.02 0 0 0 14.871-6.16 21.03 21.03 0 0 0 0-29.742c-3.941-3.946-9.293-6.16-14.871-6.16s-10.926 2.214-14.871 6.16a21.02 21.02 0 0 0-6.16 14.87 21.05 21.05 0 0 0 6.168 14.864 21.05 21.05 0 0 0 14.863 6.168m13.398-7.676h.004a18.8 18.8 0 0 1-13.402 5.57 19 19 0 0 1-4.266-.496 2.08 2.08 0 0 1-1.312-.937 2.1 2.1 0 0 1-.266-1.59l2.38-10.242a2.11 2.11 0 0 1 2.522-1.574 4.11 4.11 0 0 0 3.93-1.129c.395-.398.93-.625 1.492-.625a1.91 1.91 0 0 1 1.493.613l7.437 7.438c.82.82.82 2.152 0 2.972zm-14.023-19.96 2.383-10.243.004-.004a2.08 2.08 0 0 1 .937-1.308 2.08 2.08 0 0 1 1.586-.262 18.99 18.99 0 0 1 14.188 14.32 2.1 2.1 0 0 1-1.602 2.508L85.293 49.95l.004.004q-.224.047-.453.047c-.98 0-1.832-.68-2.047-1.637a4.21 4.21 0 0 0-3.133-3.144 2.12 2.12 0 0 1-1.312-.938 2.1 2.1 0 0 1-.262-1.586zm-1.488 6.6.004-.003a2.05 2.05 0 0 1 1.644-2.106 2.15 2.15 0 0 1 1.977.586c.508.52.718 1.262.55 1.97a2.28 2.28 0 0 1-2.07 1.66 2.193 2.193 0 0 1-2.09-2.11zM65.332 35.9l.004-.004c.82-.82 2.148-.82 2.968 0l7.438 7.437a2.095 2.095 0 0 1 0 2.98 4.18 4.18 0 0 0-1.25 2.99q.002.434.086.859a2.1 2.1 0 0 1-1.598 2.484l-10.27 2.242a2.103 2.103 0 0 1-2.508-1.613 19 19 0 0 1-.422-3.973 18.8 18.8 0 0 1 5.563-13.41z" />
24
+ <path d="m86.164 45.457 6.293-1.375a14.82 14.82 0 0 0-8.398-8.48l-1.457 6.265a8.47 8.47 0 0 1 3.562 3.59" />
25
+ </svg>
26
+ )
27
+ }
@@ -0,0 +1,6 @@
1
+ const warning = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="10.7 10.7 106.6 106.6" fill="currentColor" stroke="currentColor">
2
+ <path d="M64 37.3a5.3 5.3 0 015.3 5.4v26.6a5.3 5.3 0 11-10.6 0V42.7a5.3 5.3 0 015.3-5.4m0 53.4A5.3 5.3 0 0064 80a5.3 5.3 0 000 10.7"/>
3
+ <path fill-rule="evenodd" d="M10.7 64a53.3 53.3 0 11106.6 0 53.3 53.3 0 01-106.6 0M64 21.3a42.7 42.7 0 100 85.4 42.7 42.7 0 000-85.4"/>
4
+ </svg>`
5
+
6
+ export default warning
@@ -0,0 +1,44 @@
1
+ 'use client'
2
+ import { useMemo } from 'react'
3
+ import { type BlocksFieldClientProps } from 'payload'
4
+ import { ActionFilters } from '@/blocks/actions/filters'
5
+ import { useFormFields, BlocksField } from '@payloadcms/ui'
6
+ import { ActionBlockFilter, ActionBlockPrefix } from '@/ts/types/actions'
7
+ import { AtomicInputTypes, AtomicButtonTypes, AtomicButtonPortalTypes, ChildBlockType, AtomicChildVariants, ActionBlockType } from '@/ts/types'
8
+
9
+ interface ActionBlocksFieldProps extends BlocksFieldClientProps {
10
+ placement: ActionBlockPrefix
11
+ }
12
+
13
+ const ActionBlocksField: React.FC<ActionBlocksFieldProps> = (props) => {
14
+ const { path, field, placement } = props
15
+ const p = useMemo(() => path.split('.').slice(0, -2).join('.'), [path])
16
+
17
+ const type = useFormFields(([fields]) => fields[`${p}.type`]?.value as AtomicChildVariants | undefined)
18
+ const blockType = useFormFields(([fields]) => fields[`${p}.blockType`]?.value as ChildBlockType | undefined)
19
+ const inputType = useFormFields(([fields]) => fields[`${p}.inputType`]?.value as AtomicInputTypes | undefined)
20
+ const buttonType = useFormFields(([fields]) => fields[`${p}.buttonType`]?.value as AtomicButtonTypes | undefined)
21
+ const portalType = useFormFields(([fields]) => fields[`${p}.portalType`]?.value as AtomicButtonPortalTypes | undefined)
22
+
23
+ const block = useMemo((): ActionBlockFilter => {
24
+ const blockFilter: ActionBlockFilter = { placement, blockType: blockType || 'AtomicChild' }
25
+
26
+ if (type) blockFilter.type = type
27
+ if (inputType) blockFilter.inputType = inputType
28
+ if (buttonType) blockFilter.buttonType = buttonType
29
+ if (portalType) blockFilter.portalType = portalType
30
+
31
+ return blockFilter
32
+ }, [placement, type, blockType, inputType, buttonType, portalType])
33
+
34
+ const filteredField = useMemo(() => {
35
+ const blockRefs = field?.blockReferences?.filter((slug) => ActionFilters[slug as ActionBlockType](block))
36
+ return { ...field, blocks: [], blockReferences: blockRefs }
37
+ }, [field, block])
38
+
39
+ return <BlocksField {...props} field={filteredField} />
40
+ }
41
+
42
+ ActionBlocksField.displayName = 'ActionBlocksField'
43
+
44
+ export default ActionBlocksField
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ import { useMemo } from 'react'
3
+ import { AtomicInputTypes } from '@/ts/types'
4
+ import { useFormFields, BlocksField } from '@payloadcms/ui'
5
+ import { type InputBlocksFieldProps } from '@/ts/types'
6
+
7
+ const InputBlocksField: React.FC<InputBlocksFieldProps> = (props) => {
8
+ const { path, field, usedOn } = props
9
+ const p = useMemo(() => path.split('.').slice(0, -1).join('.'), [path])
10
+
11
+ const inputType = useFormFields(([fields]) => fields[`${p}.inputType`]?.value as AtomicInputTypes | undefined)
12
+
13
+ const filteredField = useMemo(() => {
14
+ if (!inputType) return { ...field, blocks: [], blockReferences: [] }
15
+ const inputTypes = field.blockReferences?.filter((ref) => usedOn?.some(({ block, usedOn }) => block === ref && usedOn?.includes(inputType)))
16
+ return { ...field, blocks: [], blockReferences: inputTypes }
17
+ }, [field, usedOn, inputType])
18
+
19
+ return <BlocksField {...props} field={filteredField} />
20
+ }
21
+
22
+ InputBlocksField.displayName = 'InputBlocksField'
23
+
24
+ export default InputBlocksField
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ import './index.scss'
3
+ import { useFormFields } from '@payloadcms/ui'
4
+ import { AtomicChildVariants } from '@/ts/types'
5
+ import type { UIFieldClientComponent } from 'payload'
6
+
7
+ export const ColoredEnd: UIFieldClientComponent = ({ path }) => {
8
+ const parentBlockPath = path.split('.').slice(0, -1).join('.')
9
+ const type = useFormFields(([fields]) => fields[`${parentBlockPath}.type`]?.value as AtomicChildVariants | undefined)
10
+
11
+ const styleClasses = ['colored-end', type && `colored-end--${type}`].filter(Boolean).join(' ')
12
+
13
+ return <div className={styleClasses} />
14
+ }
15
+
16
+ export default ColoredEnd
@@ -0,0 +1,46 @@
1
+ .colored-end {
2
+ width: calc(100% + 40px);
3
+ height: 15px;
4
+ border-radius: 0 0 3px 3px;
5
+ margin-left: -20px;
6
+ margin-right: -20px;
7
+ margin-bottom: -20px;
8
+
9
+ background: linear-gradient(
10
+ to bottom,
11
+ transparent 0%,
12
+ color-mix(in srgb, #fff 65%, transparent) 100%
13
+ );
14
+
15
+ &--tag {
16
+ background: linear-gradient(
17
+ to bottom,
18
+ transparent 0%,
19
+ color-mix(in srgb, var(--atomic-distinct-1) 65%, transparent) 100%
20
+ );
21
+ }
22
+
23
+ &--form {
24
+ background: linear-gradient(
25
+ to bottom,
26
+ transparent 0%,
27
+ color-mix(in srgb, var(--atomic-distinct-2) 65%, transparent) 100%
28
+ );
29
+ }
30
+
31
+ &--input {
32
+ background: linear-gradient(
33
+ to bottom,
34
+ transparent 0%,
35
+ color-mix(in srgb, var(--atomic-distinct-3) 65%, transparent) 100%
36
+ );
37
+ }
38
+
39
+ &--button {
40
+ background: linear-gradient(
41
+ to bottom,
42
+ transparent 0%,
43
+ color-mix(in srgb, var(--atomic-distinct-4) 65%, transparent) 100%
44
+ );
45
+ }
46
+ }
@@ -0,0 +1,19 @@
1
+ 'use server'
2
+ import type React from 'react'
3
+ import { SelectField } from '@payloadcms/ui'
4
+ import getCached from '@/utilities/get/cache/react'
5
+ import type { SelectFieldServerComponent } from 'payload'
6
+
7
+ const IconSelect: SelectFieldServerComponent = async ({ clientField, path, schemaPath, permissions }) => {
8
+ const iconSet = await getCached('iconSet', true)
9
+ const result = await getCached('icon-options', true, iconSet)
10
+
11
+ if (!result) {
12
+ console.warn('Icon options fetch failed')
13
+ return <SelectField field={{ ...clientField, options: [] }} path={path} schemaPath={schemaPath} permissions={permissions} />
14
+ }
15
+
16
+ return <SelectField field={{ ...clientField, options: result || [] }} path={path} schemaPath={schemaPath} permissions={permissions} />
17
+ }
18
+
19
+ export default IconSelect
@@ -0,0 +1,12 @@
1
+ .slug-field-component {
2
+ .label-wrapper {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ align-items: center;
6
+ }
7
+
8
+ .lock-button {
9
+ margin: 0;
10
+ padding-bottom: 0.3125rem;
11
+ }
12
+ }
@@ -0,0 +1,72 @@
1
+ 'use client'
2
+ import './index.scss'
3
+ import { TextFieldClientProps } from 'payload'
4
+ import { formatSlug } from '@/hooks/field/formatSlug'
5
+ import React, { useCallback, useEffect } from 'react'
6
+ import { useField, Button, TextInput, FieldLabel, useFormFields, useForm } from '@payloadcms/ui'
7
+
8
+ type SlugComponentProps = { fieldToUse: string; checkboxFieldPath: string } & TextFieldClientProps
9
+
10
+ const SlugComponent: React.FC<SlugComponentProps> = ({
11
+ path,
12
+ field,
13
+ fieldToUse,
14
+ readOnly: readOnlyFromProps,
15
+ checkboxFieldPath: checkboxFieldPathFromProps,
16
+ }) => {
17
+ const { label } = field
18
+
19
+ const checkboxFieldPath = path?.includes('.') ? `${path}.${checkboxFieldPathFromProps}` : checkboxFieldPathFromProps
20
+
21
+ const { value, setValue } = useField<string>({ path: path || field.name })
22
+ const { dispatchFields } = useForm()
23
+
24
+ // The value of the checkbox
25
+ // We're using separate useFormFields to minimise re-renders
26
+ const checkboxValue = useFormFields(([fields]) => {
27
+ return fields[checkboxFieldPath]?.value as string
28
+ })
29
+
30
+ // The value of the field we're listening to for the slug
31
+ const targetFieldValue = useFormFields(([fields]) => {
32
+ return fields[fieldToUse]?.value as string
33
+ })
34
+
35
+ useEffect(() => {
36
+ if (checkboxValue) {
37
+ if (targetFieldValue) {
38
+ const formattedSlug = formatSlug(targetFieldValue)
39
+ if (value !== formattedSlug) setValue(formattedSlug)
40
+ } else {
41
+ if (value !== '') setValue('')
42
+ }
43
+ }
44
+ }, [targetFieldValue, checkboxValue, setValue, value])
45
+
46
+ const handleLock = useCallback(
47
+ (e: React.MouseEvent<Element>) => {
48
+ e.preventDefault()
49
+
50
+ dispatchFields({ type: 'UPDATE', path: checkboxFieldPath, value: !checkboxValue })
51
+ },
52
+ [checkboxValue, checkboxFieldPath, dispatchFields],
53
+ )
54
+
55
+ const readOnly = readOnlyFromProps || checkboxValue
56
+
57
+ return (
58
+ <div className="field-type slug-field-component">
59
+ <div className="label-wrapper" style={field?.admin?.style}>
60
+ <FieldLabel htmlFor={`field-${path}`} label={label} />
61
+
62
+ <Button className="lock-button" buttonStyle="none" onClick={handleLock}>
63
+ {checkboxValue ? 'Unlock' : 'Lock'}
64
+ </Button>
65
+ </div>
66
+
67
+ <TextInput value={value} onChange={setValue} path={path || field.name} style={field?.admin?.style} readOnly={Boolean(readOnly)} />
68
+ </div>
69
+ )
70
+ }
71
+
72
+ export default SlugComponent