@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,41 @@
1
+ import type { Block } from 'payload'
2
+ import { IconSelectPath } from '@/ui'
3
+ import { ColoredEnd } from '@/fields/coloredEnd'
4
+ import { ClassNameField } from '@/fields/className'
5
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
6
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
7
+
8
+ const d = {
9
+ icon: 'Select an icon to display.',
10
+ ariaHidden: 'If checked, the icon will be hidden to screen readers. This is useful if you want to use the icon for decorative purposes only.',
11
+ svgAtomicClasses: 'Styles applied directly on the svg. If left empty, defaults to 100% width and height.',
12
+ }
13
+
14
+ export const Icon: Block = {
15
+ slug: 'IconChild',
16
+ interfaceName: 'IconChild',
17
+ labels: { singular: 'Icon', plural: 'Icons' },
18
+ fields: [
19
+ {
20
+ type: 'tabs',
21
+ tabs: [
22
+ {
23
+ label: 'Icon',
24
+ fields: [
25
+ {
26
+ type: 'row',
27
+ fields: [
28
+ { name: `icon`, type: 'text', admin: { width: '50%', components: { Field: { path: IconSelectPath } } } },
29
+ { name: 'ariaHidden', type: 'checkbox', admin: { width: '50%', description: d.ariaHidden } },
30
+ ],
31
+ },
32
+ ClassNameField({ label: 'SVG Atomic Classes', admin: { description: d.svgAtomicClasses, width: '100%' } }),
33
+ ],
34
+ },
35
+ ChildsSettingsTab('IconChild'),
36
+ TrackingTab,
37
+ ],
38
+ },
39
+ ColoredEnd,
40
+ ],
41
+ }
@@ -0,0 +1,17 @@
1
+ 'use server'
2
+ import { draftMode } from 'next/headers'
3
+ import Warning from '@/ui/assets/warningIcon'
4
+ import getCached from '@/utilities/get/cache/react'
5
+ import { IconChild as IconChildType, RenderChild } from '@/ts/types'
6
+ import { extractSvgContent, extractSvgProps } from '@/utilities/extractSVG'
7
+
8
+ export const IconChild: React.FC<RenderChild<IconChildType>> = async ({ block: { icon }, pt }) => {
9
+ const { isEnabled: draft } = await draftMode()
10
+ if (!icon) return <svg {...pt?.c?.p} {...extractSvgProps(Warning)} dangerouslySetInnerHTML={{ __html: extractSvgContent(Warning) }} />
11
+
12
+ // Ensures that if iconSet or the original icon doc is revalidated, the icon will be set as stale, but the page itself will not.
13
+ const iconSet = await getCached('iconSet', draft)
14
+ const svg = await getCached('icon', icon, draft, iconSet)
15
+
16
+ return <svg {...pt?.c?.p} {...extractSvgProps(svg || Warning)} dangerouslySetInnerHTML={{ __html: extractSvgContent(svg || Warning) }} />
17
+ }
@@ -0,0 +1,80 @@
1
+ import type { Block } from 'payload'
2
+ import { ColoredEnd } from '@/fields/coloredEnd'
3
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
4
+ import { ClassNameField } from '@/fields/className'
5
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
6
+ import type { Image as ImageType } from '@/ts/types'
7
+
8
+ const d = {
9
+ image: 'Select the image to be displayed.',
10
+ quality: '0-100. Default is 75. Use 100 for best quality.',
11
+ loading: 'Default is lazy. Use eager for images visible on load.',
12
+ decoding: 'Default is async. Use sync for images visible on load.',
13
+ imageClassName: 'Classes are added directly to the nextImage component.',
14
+ size: 'If not set, will default to image width. Example: "100vw" or "100px".',
15
+ fill: 'Default false. If true, the image will be resized to fill the parent container.',
16
+ priority: 'Default false. If true, the asset will be pre-loaded and disable lazy loading.',
17
+ alt: 'Defaults to alt set on the image asset. But you can add an alt for this instance here.',
18
+ blur: 'Default false. If true, will use the automatically generated blur data URL for the image.',
19
+ version: 'Select the stored version of the image you want to use. Leave blank for automatic optimization.',
20
+ unoptimized: 'Default false. If true, will not optimize the image for the web. Best for tiny images like logos.',
21
+ }
22
+
23
+ const sizeOptions: { label: string; value: keyof NonNullable<ImageType['sizes']> }[] = [
24
+ { label: 'Thumbnail', value: 'thumbnail' },
25
+ { label: 'Square', value: 'square' },
26
+ { label: 'Small', value: 'small' },
27
+ { label: 'Medium', value: 'medium' },
28
+ { label: 'Large', value: 'large' },
29
+ { label: 'XLarge', value: 'xlarge' },
30
+ { label: 'OG', value: 'og' },
31
+ ]
32
+
33
+ export const Image: Block = {
34
+ slug: 'ImageChild',
35
+ interfaceName: 'ImageChild',
36
+ labels: { singular: 'Image', plural: 'Images' },
37
+ fields: [
38
+ {
39
+ type: 'tabs',
40
+ tabs: [
41
+ {
42
+ label: 'Image',
43
+ fields: [
44
+ {
45
+ type: 'row',
46
+ fields: [
47
+ { name: 'image', type: 'upload', relationTo: 'images', required: true, admin: { width: '50%', description: d.image } },
48
+ { name: 'version', type: 'select', options: sizeOptions, admin: { width: '50%', description: d.version } },
49
+ ],
50
+ },
51
+ { name: 'alt', type: 'textarea', admin: { description: d.alt } },
52
+ ClassNameField({ label: 'Image Atomic Classes', admin: { description: d.imageClassName } }),
53
+ {
54
+ type: 'row',
55
+ fields: [
56
+ { name: 'priority', type: 'checkbox', admin: { width: '25%', description: d.priority } },
57
+ { name: 'blur', type: 'checkbox', admin: { width: '25%', description: d.blur } },
58
+ { name: 'unoptimized', type: 'checkbox', admin: { width: '25%', description: d.unoptimized } },
59
+ { name: 'fill', type: 'checkbox', admin: { width: '25%', description: d.fill } },
60
+ {
61
+ name: 'loading',
62
+ type: 'select',
63
+ defaultValue: 'lazy',
64
+ options: ['lazy', 'eager'],
65
+ admin: { width: '25%', description: d.loading },
66
+ },
67
+ { name: 'decoding', type: 'select', options: ['auto', 'sync', 'async'], admin: { width: '25%', description: d.decoding } },
68
+ { name: 'size', type: 'text', admin: { width: '25%', description: d.size } },
69
+ { name: 'quality', type: 'number', min: 0, max: 100, admin: { width: '25%', description: d.quality } },
70
+ ],
71
+ },
72
+ ],
73
+ },
74
+ ChildsSettingsTab('ImageChild'),
75
+ TrackingTab,
76
+ ],
77
+ },
78
+ ColoredEnd,
79
+ ],
80
+ }
@@ -0,0 +1,21 @@
1
+ 'use server'
2
+ import Image from 'next/image'
3
+ import { RenderChild } from '@/ts/types'
4
+ import getCached from '@/utilities/get/cache/react'
5
+ import type { ImageChild as ImageChildType } from '@/ts/types'
6
+
7
+ export const ImageChild: React.FC<RenderChild<ImageChildType>> = async (props) => {
8
+ const { block, pt } = props
9
+ const { alt = '', src: srcFromProps, ...restP } = pt?.c?.p || {}
10
+
11
+ if (typeof block?.image === 'string') return <div className={'w-full h-full bg-gray-200'} />
12
+
13
+ // Since images are relationships. We use the id value as part of the cache key.
14
+ // If the image document is modified, all pages that reference the image doc will be revalidated.
15
+ // Note that the pages using the image will not be revalidated.
16
+ // Hence using this getCached function. Everything else on the page stays the same, the image url is the only thing that changes.
17
+ const src = await getCached('image', block?.image?.id, block?.version)
18
+ if (!src) return <div className={'w-full h-full bg-gray-200'} />
19
+
20
+ return <Image alt={alt as string} src={src} {...restP} {...pt?.c?.da} />
21
+ }
@@ -0,0 +1,50 @@
1
+ import type { Block } from 'payload'
2
+ import { ColoredEnd } from '@/fields/coloredEnd'
3
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
4
+ import { ClassNameField } from '@/fields/className'
5
+ import { lexicalEditor } from '@payloadcms/richtext-lexical'
6
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
7
+ import { FixedToolbarFeature, HeadingFeature, InlineToolbarFeature } from '@payloadcms/richtext-lexical'
8
+
9
+ const d = {
10
+ richTextAtomicClasses:
11
+ "Add the class 'prose' to apply tag based styles to rich text content. Supports suffixes '-sm', '-base', '-lg', '-xl', '-2xl'",
12
+ }
13
+
14
+ export const RichText: Block = {
15
+ slug: 'RichTextChild',
16
+ interfaceName: 'RichTextChild',
17
+ labels: { singular: 'Rich Text', plural: 'Rich Texts' },
18
+ fields: [
19
+ {
20
+ type: 'tabs',
21
+ tabs: [
22
+ {
23
+ label: 'Content',
24
+ fields: [
25
+ ClassNameField({
26
+ label: 'Rich Text Atomic Classes',
27
+ defaultValue: 'prose dark:prose-invert',
28
+ admin: { description: d.richTextAtomicClasses },
29
+ }),
30
+ {
31
+ name: 'richText',
32
+ type: 'richText',
33
+ required: true,
34
+ label: false,
35
+ editor: lexicalEditor({
36
+ admin: { hideGutter: true, hideInsertParagraphAtEnd: true },
37
+ features: ({ rootFeatures }) => {
38
+ return [...rootFeatures, HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4'] }), FixedToolbarFeature(), InlineToolbarFeature()]
39
+ },
40
+ }),
41
+ },
42
+ ],
43
+ },
44
+ ChildsSettingsTab('RichTextChild'),
45
+ TrackingTab,
46
+ ],
47
+ },
48
+ ColoredEnd,
49
+ ],
50
+ }
@@ -0,0 +1,10 @@
1
+ import { internalDocToHref } from './internalLink'
2
+ import { DefaultNodeTypes } from '@payloadcms/richtext-lexical'
3
+ import { JSXConvertersFunction, LinkJSXConverter } from '@payloadcms/richtext-lexical/react'
4
+
5
+ type NodeTypes = DefaultNodeTypes
6
+
7
+ export const jsxConverter: JSXConvertersFunction<NodeTypes> = ({ defaultConverters }) => ({
8
+ ...defaultConverters,
9
+ ...LinkJSXConverter({ internalDocToHref }),
10
+ })
@@ -0,0 +1,8 @@
1
+ import { SerializedLinkNode } from '@payloadcms/richtext-lexical'
2
+
3
+ export const internalDocToHref = ({ linkNode }: { linkNode: SerializedLinkNode }) => {
4
+ const { value } = linkNode.fields.doc!
5
+ if (typeof value !== 'object') throw new Error('Expected value to be an object')
6
+
7
+ return value.href as string
8
+ }
@@ -0,0 +1,10 @@
1
+ import { jsxConverter } from './converters'
2
+ import { type DefaultTypedEditorState } from '@payloadcms/richtext-lexical'
3
+ import { RichText as ConvertRichText } from '@payloadcms/richtext-lexical/react'
4
+
5
+ type Props = { data: DefaultTypedEditorState } & React.HTMLAttributes<HTMLDivElement>
6
+
7
+ export default function RichText(props: Props) {
8
+ const { className, ...rest } = props
9
+ return <ConvertRichText className={className} converters={jsxConverter} {...rest} />
10
+ }
@@ -0,0 +1,7 @@
1
+ import { RenderChild } from '@/ts/types'
2
+ import RichText from '@/blocks/children/richText/component/index'
3
+ import type { RichTextChild as RichTextChildType } from '@/ts/types'
4
+
5
+ export const RichTextChild: React.FC<RenderChild<RichTextChildType>> = ({ block: { richText }, pt }) => {
6
+ return <div {...pt?.c?.p}>{richText && <RichText data={richText} />}</div>
7
+ }
@@ -0,0 +1,65 @@
1
+ import type { TextFieldSingleValidation } from 'payload'
2
+ import {
3
+ BoldFeature,
4
+ ItalicFeature,
5
+ LinkFeature,
6
+ ParagraphFeature,
7
+ lexicalEditor,
8
+ UnderlineFeature,
9
+ type LinkFields,
10
+ StrikethroughFeature,
11
+ OrderedListFeature,
12
+ UnorderedListFeature,
13
+ SuperscriptFeature,
14
+ InlineCodeFeature,
15
+ HeadingFeature,
16
+ AlignFeature,
17
+ IndentFeature,
18
+ BlockquoteFeature,
19
+ InlineToolbarFeature,
20
+ FixedToolbarFeature,
21
+ } from '@payloadcms/richtext-lexical'
22
+
23
+ export const defaultLexical = lexicalEditor({
24
+ features: [
25
+ BoldFeature(),
26
+ ItalicFeature(),
27
+ UnderlineFeature(),
28
+ StrikethroughFeature(),
29
+ SuperscriptFeature(),
30
+ InlineCodeFeature(),
31
+ ParagraphFeature(),
32
+ HeadingFeature(),
33
+ AlignFeature(),
34
+ IndentFeature(),
35
+ UnorderedListFeature(),
36
+ OrderedListFeature(),
37
+ BlockquoteFeature(),
38
+ InlineToolbarFeature(),
39
+ FixedToolbarFeature(),
40
+ LinkFeature({
41
+ enabledCollections: ['pages'],
42
+ fields: ({ defaultFields }) => {
43
+ const defaultFieldsWithoutUrl = defaultFields.filter((field) => {
44
+ if ('name' in field && field.name === 'url') return false
45
+ return true
46
+ })
47
+
48
+ return [
49
+ ...defaultFieldsWithoutUrl,
50
+ {
51
+ name: 'url',
52
+ type: 'text',
53
+ required: true,
54
+ label: ({ t }) => t('fields:enterURL'),
55
+ admin: { condition: (_data, sd) => Boolean(sd?.linkType !== 'internal') },
56
+ validate: ((value, options) => {
57
+ if ((options?.siblingData as LinkFields)?.linkType === 'internal') return true
58
+ return value ? true : 'URL is required'
59
+ }) as TextFieldSingleValidation,
60
+ },
61
+ ]
62
+ },
63
+ }),
64
+ ],
65
+ })
@@ -0,0 +1,41 @@
1
+ import type { Block } from 'payload'
2
+ import { ForField } from '@/fields/for'
3
+ import { SimpleTextLabelPath } from '@/ui'
4
+ import { TagTypeField } from '@/fields/tagType'
5
+ import { ColoredEnd } from '@/fields/coloredEnd'
6
+ import { ClassNameField } from '@/fields/className'
7
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
8
+ import { ContentActionsTab } from '@/fields/tabs/block/children/actions'
9
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
10
+
11
+ const ds = {
12
+ text: 'The text content to display. Use {{data attribute name}} to display the data attributes value.',
13
+ className: 'Add atomic classes or shortcuts to the simple text element here.',
14
+ }
15
+
16
+ export const SimpleText: Block = {
17
+ slug: 'SimpleTextChild',
18
+ interfaceName: 'SimpleTextChild',
19
+ labels: { singular: '"Simple" Text', plural: '"Simple" Texts' },
20
+ admin: { components: { Label: { path: SimpleTextLabelPath } } },
21
+ fields: [
22
+ {
23
+ type: 'tabs',
24
+ tabs: [
25
+ {
26
+ label: 'Content',
27
+ fields: [
28
+ TagTypeField({ childBlock: 'SimpleTextChild', width: '25%' }),
29
+ ClassNameField({ admin: { description: ds.className, condition: (_, sd) => Boolean(sd?.tagType !== 'fragment') } }),
30
+ ForField({ admin: { condition: (_, sd) => Boolean(sd?.tagType === 'label') } }),
31
+ { name: `text`, type: 'textarea', required: true, admin: { description: ds.text } },
32
+ ],
33
+ },
34
+ { label: 'Actions', fields: [ContentActionsTab] },
35
+ ChildsSettingsTab('SimpleTextChild'),
36
+ TrackingTab,
37
+ ],
38
+ },
39
+ ColoredEnd,
40
+ ],
41
+ }
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ import { useActionContext, useDaToText, useToDa } from '@/hooks/frontEnd/useActions'
3
+ import type { SimpleTextChild as SimpleTextChildType, RenderChild } from '@/ts/types'
4
+
5
+ export const SimpleTextChildClient: React.FC<RenderChild<SimpleTextChildType>> = (props) => {
6
+ const { block, pt } = props
7
+
8
+ const context = useActionContext()
9
+ const cda = useToDa({ attributers: block.contentActions?.attributers, context })
10
+ const stt = useDaToText({ text: block.text, sda: cda, ssrda: pt?.c?.da })
11
+
12
+ if (block.tagType === 'fragment') return <>{stt}</>
13
+ return (
14
+ <block.tagType {...pt?.c?.p} {...pt?.c?.da} {...cda}>
15
+ {stt}
16
+ </block.tagType>
17
+ )
18
+ }
@@ -0,0 +1,11 @@
1
+ 'use server'
2
+ import type { SimpleTextChild as SimpleTextChildType, RenderChild } from '@/ts/types'
3
+
4
+ export const SimpleTextChild: React.FC<RenderChild<SimpleTextChildType>> = async ({ block, pt }) => {
5
+ if (block.tagType === 'fragment') return <>{block.text}</>
6
+ return (
7
+ <block.tagType {...pt?.c?.p} {...pt?.c?.da}>
8
+ {block.text}
9
+ </block.tagType>
10
+ )
11
+ }
@@ -0,0 +1,39 @@
1
+ import type { Block } from 'payload'
2
+ import { ColoredEnd } from '@/fields/coloredEnd'
3
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
4
+ import { ClassNameField } from '@/fields/className'
5
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
6
+
7
+ const d = {
8
+ svgAtomicClasses: 'Add atomic classes or shortcuts to the svg element here.',
9
+ ariaHidden: 'If true, the element will be hidden from screen readers.',
10
+ viewbox: 'SVG viewbox attribute. Example: "0 0 24 24".',
11
+ fill: 'SVG fill attribute. Example: "currentColor" or "#000000".',
12
+ contents: 'SVG content/path data.',
13
+ }
14
+
15
+ export const SVGBlock: Block = {
16
+ slug: 'SVGChild',
17
+ interfaceName: 'SVGChild',
18
+ labels: { singular: 'SVG', plural: 'SVGs' },
19
+ fields: [
20
+ {
21
+ type: 'tabs',
22
+ tabs: [
23
+ {
24
+ label: 'Content',
25
+ fields: [
26
+ ClassNameField({ label: 'SVG Atomic Classes', admin: { description: d.svgAtomicClasses } }),
27
+ { name: 'ariaHidden', type: 'checkbox', admin: { description: d.ariaHidden } },
28
+ { name: 'viewBox', type: 'text', required: true, admin: { description: d.viewbox } },
29
+ { name: 'fill', type: 'text', admin: { description: d.fill } },
30
+ { name: 'contents', type: 'textarea', required: true, admin: { description: d.contents } },
31
+ ],
32
+ },
33
+ ChildsSettingsTab('SVGChild'),
34
+ TrackingTab,
35
+ ],
36
+ },
37
+ ColoredEnd,
38
+ ],
39
+ }
@@ -0,0 +1,6 @@
1
+ import { RenderChild } from '@/ts/types'
2
+ import type { SVGChild as SVGChildType } from '@/ts/types'
3
+
4
+ export const SVGChild: React.FC<RenderChild<SVGChildType>> = ({ pt }) => {
5
+ return <svg {...pt?.c?.p} {...pt?.c?.da} />
6
+ }
@@ -0,0 +1,70 @@
1
+ import type { Block } from 'payload'
2
+ import { TagTypeField } from '@/fields/tagType'
3
+ import { ColoredEnd } from '@/fields/coloredEnd'
4
+ import { ClassNameField } from '@/fields/className'
5
+ import { TrackingTab } from '@/fields/tabs/block/children/tracking'
6
+ import { ChildsSettingsTab } from '@/fields/tabs/block/children/settings'
7
+
8
+ const d = {
9
+ video: 'Select the video to be displayed.',
10
+ quality: 'Default is 1. The quality of the video.',
11
+ blur: 'Default is 20. The blur amount of the video.',
12
+ loop: 'Default is false. If true, the video will loop.',
13
+ muted: 'Default is false. If true, the video will be muted.',
14
+ preload: 'Default is metadata. Controls when the video starts loading.',
15
+ time: 'Default is 0. The time in the video, the blur image will be generated from.',
16
+ disableBlur: 'Default is false. If true, the video will not use the blur data URL.',
17
+ autoplay: 'Default is false. If true, the video will autoplay, which also forces muted to be true.',
18
+ className: 'It is recommended to use this inside a tag component that controls sizing, use the default value.',
19
+ }
20
+
21
+ export const Video: Block = {
22
+ slug: 'VideoChild',
23
+ interfaceName: 'VideoChild',
24
+ labels: { singular: 'Video', plural: 'Videos' },
25
+ fields: [
26
+ {
27
+ type: 'tabs',
28
+ tabs: [
29
+ {
30
+ label: 'Video',
31
+ fields: [
32
+ ClassNameField({
33
+ admin: { description: d.className },
34
+ label: 'Video Atomic Classes',
35
+ defaultValue: 'relative flex max-w-full aspect-video overflow-hidden',
36
+ }),
37
+ {
38
+ type: 'row',
39
+ fields: [
40
+ TagTypeField({ childBlock: 'VideoChild', width: '25%' }),
41
+ { name: 'video', label: 'Mux Video', type: 'relationship', relationTo: 'mux-video', required: true, admin: { width: '25%' } },
42
+ ],
43
+ },
44
+ {
45
+ type: 'row',
46
+ fields: [
47
+ { name: 'preload', type: 'select', options: ['none', 'metadata', 'auto'], admin: { width: '20%', description: d.preload } },
48
+ { name: 'autoplay', type: 'checkbox', admin: { width: '20%', description: d.autoplay } },
49
+ { name: 'loop', type: 'checkbox', admin: { width: '20%', description: d.loop } },
50
+ { name: 'muted', type: 'checkbox', admin: { width: '20%', description: d.muted } },
51
+ ],
52
+ },
53
+ {
54
+ type: 'row',
55
+ fields: [
56
+ { name: 'disableBlur', type: 'checkbox', admin: { width: '25%', description: d.disableBlur } },
57
+ { name: 'time', type: 'number', admin: { width: '25%', description: d.time } },
58
+ { name: 'blur', type: 'number', min: 0, max: 100, admin: { width: '25%', description: d.blur } },
59
+ { name: 'quality', type: 'number', min: 0.25, max: 10, admin: { width: '25%', description: d.quality } },
60
+ ],
61
+ },
62
+ ],
63
+ },
64
+ ChildsSettingsTab('VideoChild'),
65
+ TrackingTab,
66
+ ],
67
+ },
68
+ ColoredEnd,
69
+ ],
70
+ }
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import React from 'react'
3
+ import dynamic from 'next/dynamic'
4
+ import { RenderChild } from '@/ts/types'
5
+ import type { VideoChild as VideoChildType } from '@/ts/types'
6
+
7
+ const MuxVideoReact = dynamic(() => import('@mux/mux-video-react'))
8
+
9
+ export const VideoChild: React.FC<RenderChild<VideoChildType>> = ({ pt }) => {
10
+ return <MuxVideoReact {...pt?.c?.p} {...pt?.c?.da} />
11
+ }
@@ -0,0 +1,54 @@
1
+ import { z } from '@/ts/zap'
2
+ import ChildrenBlocks from './blocks'
3
+
4
+ // Helper function to check if a block has actions with the specified prefix
5
+ function hasActions(block: any, prefix: 'trigger' | 'content'): boolean {
6
+ if (!block.fields) return false
7
+
8
+ const actionFieldName = `${prefix}Actions`
9
+
10
+ // Check if any field has the action field name or if it's in a tab with that action field
11
+ return block.fields.some((field: any) => {
12
+ if (field.name === actionFieldName) return true
13
+ if (field.type === 'tabs' && field.tabs) {
14
+ return field.tabs.some((tab: any) => tab.fields?.some((tabField: any) => tabField.name === actionFieldName))
15
+ }
16
+ return false
17
+ })
18
+ }
19
+
20
+ // All Child Blocks
21
+ export const ChildBlockType = z.ap.add(z.enum(ChildrenBlocks.map((block) => block.slug)), { id: 'ChildBlockType' })
22
+
23
+ // Non Recursive Child Blocks. So all except AtomicChild
24
+ export const NonRecursiveChildBlockType = z.ap.add(
25
+ z.enum(ChildrenBlocks.filter((block) => block.slug !== 'AtomicChild').map((block) => block.slug)),
26
+ { id: 'NonRecursiveChildBlockType' },
27
+ )
28
+
29
+ // Portal Backdrop Blocks. Set manually.
30
+ export const BackdropChildSlug = z.ap.add(z.enum(['SVGChild']), { id: 'BackdropChildSlug' })
31
+
32
+ // Blocks that contain triggerActions - automatically determined from ChildrenBlocks
33
+ export const TriggerActionsBlockType = z.ap.add(z.enum(ChildrenBlocks.filter((block) => hasActions(block, 'trigger')).map((block) => block.slug)), {
34
+ id: 'ChildrenWithTriggerActions',
35
+ })
36
+
37
+ // Blocks that contain contentActions - automatically determined from ChildrenBlocks
38
+ export const ContentActionsBlockType = z.ap.add(z.enum(ChildrenBlocks.filter((block) => hasActions(block, 'content')).map((block) => block.slug)), {
39
+ id: 'ChildrenWithContentActions',
40
+ })
41
+
42
+ export const ChildrenWithActions = z.ap.add(z.enum([...TriggerActionsBlockType.options, ...ContentActionsBlockType.options]), {
43
+ id: 'ChildrenWithActions',
44
+ })
45
+
46
+ const ChildBlocks = [
47
+ ChildBlockType,
48
+ NonRecursiveChildBlockType,
49
+ BackdropChildSlug,
50
+ TriggerActionsBlockType,
51
+ ContentActionsBlockType,
52
+ ChildrenWithActions,
53
+ ]
54
+ export default ChildBlocks
@@ -0,0 +1,5 @@
1
+ import { FrlSimpleSlidingWindow } from './simpleSlidingWindow/block'
2
+
3
+ const frlBlocks = [FrlSimpleSlidingWindow]
4
+
5
+ export default frlBlocks
@@ -0,0 +1 @@
1
+ export * from './simpleSlidingWindow/serverFunction'
@@ -0,0 +1,23 @@
1
+ import type { Block } from 'payload'
2
+ import { APField } from '@/fields/apf'
3
+ import { ValidationMessageField } from '@/fields/validationMessage'
4
+
5
+ const d = {
6
+ atStart:
7
+ 'If true, the rate limit trigger runs before validation. For normal forms its recommended to set this to false, as failed submissions due to validation errors will count towards the rate limit.',
8
+ rateLimit: 'The number of requests allowed per time period.',
9
+ rateLimitPeriod: 'The time period in minutes.',
10
+ }
11
+
12
+ export const FrlSimpleSlidingWindow: Block = {
13
+ slug: 'FrlSimpleSlidingWindow',
14
+ admin: { disableBlockName: true },
15
+ interfaceName: 'FrlSimpleSlidingWindow',
16
+ labels: { singular: 'Simple Sliding Window Rate Limit', plural: 'Simple Sliding Window Rate Limit' },
17
+ fields: [
18
+ APField({ type: 'checkbox', apf: ['form'], name: 'atStart', label: 'At Start', required: true, admin: { description: d.atStart } }),
19
+ APField({ type: 'number', apf: ['form'], name: 'rateLimit', required: true, admin: { description: d.rateLimit } }),
20
+ APField({ type: 'number', apf: ['form'], name: 'rateLimitPeriod', required: true, admin: { description: d.rateLimitPeriod } }),
21
+ ValidationMessageField,
22
+ ],
23
+ }