nextpress-core 1.1.0 → 2.0.0

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 (227) hide show
  1. package/cli/install.js +27 -0
  2. package/{dist/acf-functions/core/acf-builder.js → lib/acf-functions/core/acf-builder.ts} +45 -17
  3. package/{dist/acf-functions/core/acf-component-autoloader.js → lib/acf-functions/core/acf-component-autoloader.ts} +13 -7
  4. package/{dist/acf-functions/core/acf-field-group-autoloader.js → lib/acf-functions/core/acf-field-group-autoloader.ts} +11 -5
  5. package/{dist/acf-functions/services/define-field-group.d.ts → lib/acf-functions/services/define-field-group.ts} +4 -1
  6. package/{dist/acf-functions/services/define-layout.d.ts → lib/acf-functions/services/define-layout.ts} +4 -1
  7. package/lib/acf-functions/services/map-fields/helpers/map-choice-object.ts +20 -0
  8. package/{dist/acf-functions/services/map-fields/map-fields.js → lib/acf-functions/services/map-fields/map-fields.ts} +128 -89
  9. package/{dist/acf-functions/types/acf-field-group.d.ts → lib/acf-functions/types/acf-field-group.ts} +49 -28
  10. package/lib/acf-functions/types/acf-field.ts +2853 -0
  11. package/lib/acf-functions/types/acf-layout.ts +22 -0
  12. package/lib/acf-functions/types/components/field-props.ts +189 -0
  13. package/{dist/acf-functions/types/components/nextpress-component.d.ts → lib/acf-functions/types/components/nextpress-component.ts} +4 -3
  14. package/lib/ambient.d.ts +16 -0
  15. package/{dist/entities/common.d.ts → lib/entities/common.ts} +6 -4
  16. package/{dist/entities/option/option.interface.d.ts → lib/entities/option/option.interface.ts} +3 -3
  17. package/{dist/entities/option/option.js → lib/entities/option/option.ts} +21 -14
  18. package/{dist/entities/post/post.interface.d.ts → lib/entities/post/post.interface.ts} +26 -21
  19. package/lib/entities/post/post.ts +209 -0
  20. package/{dist/entities/term/term.interface.d.ts → lib/entities/term/term.interface.ts} +3 -3
  21. package/lib/entities/term/term.ts +82 -0
  22. package/{dist/entities/user/user.interface.d.ts → lib/entities/user/user.interface.ts} +2 -1
  23. package/lib/entities/user/user.ts +86 -0
  24. package/{dist/globals/entity-loader/entity-loader-base.js → lib/globals/entity-loader/entity-loader-base.ts} +64 -10
  25. package/{dist/globals/entity-loader/entity-loader.interface.d.ts → lib/globals/entity-loader/entity-loader.ts} +2 -4
  26. package/lib/globals/entity-loader/option-loader.ts +56 -0
  27. package/lib/globals/entity-loader/post-loader.ts +60 -0
  28. package/lib/globals/entity-loader/term-loader.ts +60 -0
  29. package/lib/globals/entity-loader/user-loader.ts +61 -0
  30. package/lib/globals/get-field/get-field.ts +76 -0
  31. package/{dist/globals/globals.js → lib/globals/globals.ts} +8 -3
  32. package/{dist/globals/nextpress-config/nextpress-config.interface.d.ts → lib/globals/nextpress-config/nextpress-config.interface.ts} +10 -6
  33. package/lib/globals/nextpress-config/nextpress-config.ts +8 -0
  34. package/lib/globals/queried-object/queried-object.ts +124 -0
  35. package/{dist/repository/optionquery/option-query-args.d.ts → lib/repository/optionquery/option-query-args.ts} +5 -2
  36. package/lib/repository/optionquery/option-query.ts +29 -0
  37. package/{dist/repository/postquery/post-query-args.d.ts → lib/repository/postquery/post-query-args.ts} +10 -6
  38. package/lib/repository/postquery/post-query.ts +282 -0
  39. package/{dist/repository/termquery/term-query-args.d.ts → lib/repository/termquery/term-query-args.ts} +16 -6
  40. package/lib/repository/termquery/term-query.ts +244 -0
  41. package/{dist/repository/userquery/user-query-args.d.ts → lib/repository/userquery/user-query-args.ts} +19 -7
  42. package/{dist/repository/userquery/user-query.js → lib/repository/userquery/user-query.ts} +93 -76
  43. package/{dist/router/helpers.js → lib/router/helpers.ts} +4 -4
  44. package/{dist/router/nextpress-layout.js → lib/router/nextpress-layout.tsx} +28 -9
  45. package/{dist/router/routes/not-found-page.js → lib/router/nextpress-not-found-route.tsx} +7 -5
  46. package/{dist/router/nextpress-proxy.js → lib/router/nextpress-proxy.ts} +15 -3
  47. package/{dist/router/nextpress-static-params.js → lib/router/nextpress-static-params.ts} +17 -5
  48. package/{dist/router/router.js → lib/router/router.tsx} +29 -22
  49. package/{dist/router/routes/api/api-get-admin-bar.js → lib/router/routes/api/api-get-admin-bar.ts} +8 -6
  50. package/{dist/router/routes/api/api-get-draft-mode.js → lib/router/routes/api/api-get-draft-mode.ts} +15 -6
  51. package/{dist/router/routes/api/api-get-field-groups.js → lib/router/routes/api/api-get-field-groups.ts} +13 -8
  52. package/{dist/router/routes/api/api-post-revalidate.js → lib/router/routes/api/api-post-revalidate.ts} +6 -4
  53. package/{dist/router/routes/api/helpers.js → lib/router/routes/api/helpers.ts} +4 -3
  54. package/lib/router/routes/author-archive.tsx +75 -0
  55. package/lib/router/routes/post-index-page.tsx +58 -0
  56. package/lib/router/routes/singular-page.tsx +78 -0
  57. package/lib/router/routes/site-front-page.tsx +51 -0
  58. package/lib/router/routes/term-archive.tsx +93 -0
  59. package/{dist/router/types.d.ts → lib/router/types.ts} +4 -2
  60. package/{dist/services/get-menu.js → lib/services/get-menu.ts} +56 -32
  61. package/{dist/services/get-theme-mods.js → lib/services/get-theme-mods.ts} +6 -4
  62. package/{dist/services/metadata/get-blogname.js → lib/services/metadata/get-blogname.ts} +2 -2
  63. package/{dist/services/metadata/get-favicon-url.js → lib/services/metadata/get-favicon-url.ts} +5 -4
  64. package/{dist/services/metadata/get-language-attribute.js → lib/services/metadata/get-language-attribute.ts} +1 -1
  65. package/{dist/services/utilities/capitalise-first-letter.js → lib/services/utilities/capitalise-first-letter.ts} +2 -3
  66. package/{dist/services/utilities/esc-html.js → lib/services/utilities/esc-html.ts} +3 -1
  67. package/{dist/services/utilities/get-date-time-formatter.js → lib/services/utilities/get-date-time-formatter.ts} +16 -6
  68. package/{dist/services/utilities/kses-post.js → lib/services/utilities/kses-post.ts} +2 -1
  69. package/{dist/services/utilities/process-url.js → lib/services/utilities/process-url.ts} +4 -3
  70. package/{dist/template-heirarchy/_autoloader/template-autoloader.js → lib/template-heirarchy/_autoloader/template-autoloader.ts} +18 -9
  71. package/{dist/template-heirarchy/archive/archive.js → lib/template-heirarchy/archive/archive.tsx} +10 -7
  72. package/{dist/template-heirarchy/archive/author.js → lib/template-heirarchy/archive/author.tsx} +10 -7
  73. package/{dist/template-heirarchy/archive/category.js → lib/template-heirarchy/archive/category.tsx} +11 -7
  74. package/{dist/template-heirarchy/archive/posttypearchive.js → lib/template-heirarchy/archive/posttypearchive.tsx} +11 -8
  75. package/{dist/template-heirarchy/archive/tag.js → lib/template-heirarchy/archive/tag.tsx} +12 -7
  76. package/{dist/template-heirarchy/archive/taxonomy.js → lib/template-heirarchy/archive/taxonomy.tsx} +10 -7
  77. package/{dist/template-heirarchy/home/home.js → lib/template-heirarchy/home/home.tsx} +10 -7
  78. package/{dist/template-heirarchy/index.js → lib/template-heirarchy/index.tsx} +9 -5
  79. package/{dist/template-heirarchy/not-found.tsx/not-found.js → lib/template-heirarchy/not-found.tsx/not-found.tsx} +10 -7
  80. package/{dist/template-heirarchy/page/page.js → lib/template-heirarchy/page/page.tsx} +10 -7
  81. package/{dist/template-heirarchy/page/posttype.js → lib/template-heirarchy/page/posttype.tsx} +12 -8
  82. package/{dist/template-heirarchy/page/single.js → lib/template-heirarchy/page/single.tsx} +10 -7
  83. package/{dist/template-heirarchy/page/singular.js → lib/template-heirarchy/page/singular.tsx} +10 -7
  84. package/lib/ui/render-attachment-image.tsx +28 -0
  85. package/lib/ui/render-components.tsx +12 -0
  86. package/lib/ui/render-the-admin-bar.tsx +79 -0
  87. package/lib/ui/render-the-logo.tsx +24 -0
  88. package/{dist/wpdb/wpdb.interface.d.ts → lib/wpdb/wpdb.interface.ts} +20 -1
  89. package/{dist/wpdb/wpdb.js → lib/wpdb/wpdb.ts} +9 -5
  90. package/package.json +8 -43
  91. package/dist/acf-functions/core/acf-builder.d.ts +0 -51
  92. package/dist/acf-functions/core/acf-component-autoloader.d.ts +0 -11
  93. package/dist/acf-functions/core/acf-field-group-autoloader.d.ts +0 -10
  94. package/dist/acf-functions/field-props.d.ts +0 -196
  95. package/dist/acf-functions/field-props.js +0 -1
  96. package/dist/acf-functions/index.d.ts +0 -13
  97. package/dist/acf-functions/index.js +0 -13
  98. package/dist/acf-functions/services/define-field-group.js +0 -10
  99. package/dist/acf-functions/services/define-layout.js +0 -10
  100. package/dist/acf-functions/services/map-fields/helpers/map-choice-object.d.ts +0 -2
  101. package/dist/acf-functions/services/map-fields/helpers/map-choice-object.js +0 -18
  102. package/dist/acf-functions/services/map-fields/map-fields.d.ts +0 -21
  103. package/dist/acf-functions/types/acf-field-group.js +0 -1
  104. package/dist/acf-functions/types/acf-field.d.ts +0 -2813
  105. package/dist/acf-functions/types/acf-field.js +0 -1
  106. package/dist/acf-functions/types/acf-layout.d.ts +0 -19
  107. package/dist/acf-functions/types/acf-layout.js +0 -1
  108. package/dist/acf-functions/types/acf-values.js +0 -1
  109. package/dist/acf-functions/types/components/field-props.d.ts +0 -196
  110. package/dist/acf-functions/types/components/field-props.js +0 -1
  111. package/dist/acf-functions/types/components/nextpress-component.js +0 -1
  112. package/dist/entities/common.js +0 -1
  113. package/dist/entities/index.d.ts +0 -9
  114. package/dist/entities/index.js +0 -9
  115. package/dist/entities/option/option.d.ts +0 -19
  116. package/dist/entities/option/option.interface.js +0 -2
  117. package/dist/entities/post/post.d.ts +0 -50
  118. package/dist/entities/post/post.interface.js +0 -2
  119. package/dist/entities/post/post.js +0 -184
  120. package/dist/entities/term/term.d.ts +0 -28
  121. package/dist/entities/term/term.interface.js +0 -1
  122. package/dist/entities/term/term.js +0 -67
  123. package/dist/entities/user/user.d.ts +0 -27
  124. package/dist/entities/user/user.interface.js +0 -1
  125. package/dist/entities/user/user.js +0 -74
  126. package/dist/globals/entity-loader/entity-loader-base.d.ts +0 -65
  127. package/dist/globals/entity-loader/entity-loader.interface.js +0 -1
  128. package/dist/globals/entity-loader/option-loader.d.ts +0 -15
  129. package/dist/globals/entity-loader/option-loader.js +0 -31
  130. package/dist/globals/entity-loader/post-loader.d.ts +0 -21
  131. package/dist/globals/entity-loader/post-loader.js +0 -28
  132. package/dist/globals/entity-loader/term-loader.d.ts +0 -21
  133. package/dist/globals/entity-loader/term-loader.js +0 -28
  134. package/dist/globals/entity-loader/user-loader.d.ts +0 -21
  135. package/dist/globals/entity-loader/user-loader.js +0 -28
  136. package/dist/globals/get-field/get-field.d.ts +0 -18
  137. package/dist/globals/get-field/get-field.js +0 -44
  138. package/dist/globals/globals.d.ts +0 -18
  139. package/dist/globals/index.d.ts +0 -10
  140. package/dist/globals/index.js +0 -10
  141. package/dist/globals/nextpress-config/nextpress-config.d.ts +0 -4
  142. package/dist/globals/nextpress-config/nextpress-config.interface.js +0 -1
  143. package/dist/globals/nextpress-config/nextpress-config.js +0 -2
  144. package/dist/globals/queried-object/queried-object.d.ts +0 -62
  145. package/dist/globals/queried-object/queried-object.js +0 -56
  146. package/dist/repository/index.d.ts +0 -5
  147. package/dist/repository/index.js +0 -5
  148. package/dist/repository/optionquery/option-query-args.js +0 -1
  149. package/dist/repository/optionquery/option-query.d.ts +0 -12
  150. package/dist/repository/optionquery/option-query.js +0 -20
  151. package/dist/repository/postquery/post-query-args.js +0 -1
  152. package/dist/repository/postquery/post-query.d.ts +0 -12
  153. package/dist/repository/postquery/post-query.js +0 -272
  154. package/dist/repository/termquery/term-query-args.js +0 -1
  155. package/dist/repository/termquery/term-query.d.ts +0 -11
  156. package/dist/repository/termquery/term-query.js +0 -213
  157. package/dist/repository/userquery/user-query-args.js +0 -1
  158. package/dist/repository/userquery/user-query.d.ts +0 -12
  159. package/dist/router/helpers.d.ts +0 -14
  160. package/dist/router/index.d.ts +0 -17
  161. package/dist/router/index.js +0 -17
  162. package/dist/router/nextpress-layout.d.ts +0 -11
  163. package/dist/router/nextpress-proxy.d.ts +0 -8
  164. package/dist/router/nextpress-static-params.d.ts +0 -9
  165. package/dist/router/router.d.ts +0 -23
  166. package/dist/router/routes/api/api-get-admin-bar.d.ts +0 -8
  167. package/dist/router/routes/api/api-get-draft-mode.d.ts +0 -8
  168. package/dist/router/routes/api/api-get-field-groups.d.ts +0 -7
  169. package/dist/router/routes/api/api-post-revalidate.d.ts +0 -7
  170. package/dist/router/routes/api/helpers.d.ts +0 -8
  171. package/dist/router/routes/author-archive.d.ts +0 -25
  172. package/dist/router/routes/author-archive.js +0 -49
  173. package/dist/router/routes/not-found-page.d.ts +0 -15
  174. package/dist/router/routes/post-index-page.d.ts +0 -25
  175. package/dist/router/routes/post-index-page.js +0 -33
  176. package/dist/router/routes/singular-page.d.ts +0 -29
  177. package/dist/router/routes/singular-page.js +0 -51
  178. package/dist/router/routes/site-front-page.d.ts +0 -27
  179. package/dist/router/routes/site-front-page.js +0 -26
  180. package/dist/router/routes/term-archive.d.ts +0 -29
  181. package/dist/router/routes/term-archive.js +0 -65
  182. package/dist/router/types.js +0 -1
  183. package/dist/services/get-menu.d.ts +0 -13
  184. package/dist/services/get-theme-mods.d.ts +0 -7
  185. package/dist/services/index.d.ts +0 -10
  186. package/dist/services/index.js +0 -10
  187. package/dist/services/metadata/get-blogname.d.ts +0 -6
  188. package/dist/services/metadata/get-favicon-url.d.ts +0 -6
  189. package/dist/services/metadata/get-language-attribute.d.ts +0 -6
  190. package/dist/services/services.d.ts +0 -3
  191. package/dist/services/services.js +0 -3
  192. package/dist/services/utilities/capitalise-first-letter.d.ts +0 -7
  193. package/dist/services/utilities/esc-html.d.ts +0 -7
  194. package/dist/services/utilities/get-date-time-formatter.d.ts +0 -6
  195. package/dist/services/utilities/index.d.ts +0 -0
  196. package/dist/services/utilities/index.js +0 -1
  197. package/dist/services/utilities/kses-post.d.ts +0 -7
  198. package/dist/services/utilities/process-url.d.ts +0 -7
  199. package/dist/template-heirarchy/_autoloader/template-autoloader.d.ts +0 -9
  200. package/dist/template-heirarchy/archive/archive.d.ts +0 -16
  201. package/dist/template-heirarchy/archive/author.d.ts +0 -16
  202. package/dist/template-heirarchy/archive/category.d.ts +0 -16
  203. package/dist/template-heirarchy/archive/posttypearchive.d.ts +0 -24
  204. package/dist/template-heirarchy/archive/tag.d.ts +0 -16
  205. package/dist/template-heirarchy/archive/taxonomy.d.ts +0 -16
  206. package/dist/template-heirarchy/home/home.d.ts +0 -16
  207. package/dist/template-heirarchy/index.d.ts +0 -17
  208. package/dist/template-heirarchy/not-found.tsx/not-found.d.ts +0 -16
  209. package/dist/template-heirarchy/page/page.d.ts +0 -16
  210. package/dist/template-heirarchy/page/posttype.d.ts +0 -24
  211. package/dist/template-heirarchy/page/single.d.ts +0 -16
  212. package/dist/template-heirarchy/page/singular.d.ts +0 -16
  213. package/dist/ui/index.d.ts +0 -4
  214. package/dist/ui/index.js +0 -4
  215. package/dist/ui/render-attachment-image.d.ts +0 -12
  216. package/dist/ui/render-attachment-image.js +0 -24
  217. package/dist/ui/render-components.d.ts +0 -9
  218. package/dist/ui/render-components.js +0 -7
  219. package/dist/ui/render-the-admin-bar.d.ts +0 -8
  220. package/dist/ui/render-the-admin-bar.js +0 -36
  221. package/dist/ui/render-the-logo.d.ts +0 -10
  222. package/dist/ui/render-the-logo.js +0 -16
  223. package/dist/wpdb/index.d.ts +0 -0
  224. package/dist/wpdb/index.js +0 -1
  225. package/dist/wpdb/wpdb.d.ts +0 -3
  226. package/dist/wpdb/wpdb.interface.js +0 -5
  227. /package/{dist/acf-functions/types/acf-values.d.ts → lib/acf-functions/types/acf-values.ts} +0 -0
@@ -1,7 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { ArchiveMetadata, ArchiveTemplate } from "./archive";
4
- import { capitalizeFirstLetter } from "@/services/utilities/capitalise-first-letter";
5
+ import { capitalizeFirstLetter } from "nextpress/services/utilities/capitalise-first-letter";
6
+
5
7
  /**
6
8
  * Loads the metadata for a Post Type Archive template based on the given post type.
7
9
  * Fallback: Archive
@@ -10,10 +12,11 @@ import { capitalizeFirstLetter } from "@/services/utilities/capitalise-first-let
10
12
  * @param {string} props.postType - The post type to load the metadata for.
11
13
  * @returns {Promise<Metadata>} The merged metadata object.
12
14
  */
13
- export async function PostTypeArchiveMetadata({ postType }) {
15
+ export async function PostTypeArchiveMetadata({postType}: {postType: string}): Promise<Metadata> {
14
16
  const metadata = await loadMetadata(capitalizeFirstLetter(postType));
15
- return Object.assign(Object.assign({}, (await ArchiveMetadata())), metadata);
17
+ return {...(await ArchiveMetadata()), ...metadata};
16
18
  }
19
+
17
20
  /**
18
21
  * Renders a Post Type Archive template. Falls back to the Archive template if not found.
19
22
  * Fallback: Archive
@@ -22,9 +25,9 @@ export async function PostTypeArchiveMetadata({ postType }) {
22
25
  * @param {string} props.postType - The post type to load the template for.
23
26
  * @returns {Promise<JSX.Element>} The rendered template component.
24
27
  */
25
- export async function PostTypeArchiveTemplate({ postType }) {
28
+ export async function PostTypeArchiveTemplate({postType}: {postType: string}): Promise<JSX.Element> {
26
29
  const PostTypeArchive = await loadTemplate(capitalizeFirstLetter(postType));
27
- if (!PostTypeArchive)
28
- return _jsx(ArchiveTemplate, {});
29
- return _jsx(PostTypeArchive, {});
30
+ if (!PostTypeArchive) return <ArchiveTemplate/>
31
+
32
+ return <PostTypeArchive/>;
30
33
  }
@@ -1,25 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { ArchiveMetadata, ArchiveTemplate } from "./archive";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Tag template.
6
8
  * Fallback: Archive
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function TagMetadata() {
12
+ export async function TagMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Tag');
12
- return Object.assign(Object.assign({}, (await ArchiveMetadata())), metadata);
14
+ return {...(await ArchiveMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Tag template. Falls back to the Archive template if not found.
16
19
  * Fallback: Archive
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function TagTemplate() {
23
+ export async function TagTemplate(): Promise<JSX.Element> {
21
24
  const Category = await loadTemplate('Tag');
22
- if (!Category)
23
- return _jsx(ArchiveTemplate, {});
24
- return _jsx(Category, {});
25
+ if (!Category) return <ArchiveTemplate/>
26
+
27
+ return <Category/>;
25
28
  }
29
+
30
+
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { ArchiveMetadata, ArchiveTemplate } from "./archive";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Taxonomy template.
6
8
  * Fallback: Archive
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function TaxonomyMetadata() {
12
+ export async function TaxonomyMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Taxonomy');
12
- return Object.assign(Object.assign({}, (await ArchiveMetadata())), metadata);
14
+ return {...(await ArchiveMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Taxonomy template. Falls back to the Archive template if not found.
16
19
  * Fallback: Archive
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function TaxonomyTemplate() {
23
+ export async function TaxonomyTemplate(): Promise<JSX.Element> {
21
24
  const Taxonomy = await loadTemplate('Taxonomy');
22
- if (!Taxonomy)
23
- return _jsx(ArchiveTemplate, {});
24
- return _jsx(Taxonomy, {});
25
+ if (!Taxonomy) return <ArchiveTemplate/>
26
+
27
+ return <Taxonomy/>;
25
28
  }
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { IndexMetadata, IndexTemplate } from "..";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Home template.
6
8
  * Fallback: Index
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function HomeMetadata() {
12
+ export async function HomeMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Home');
12
- return Object.assign(Object.assign({}, (await IndexMetadata())), metadata);
14
+ return {...(await IndexMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Home template. Falls back to the Index template if not found.
16
19
  * Fallback: Index
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function HomeTemplate() {
23
+ export async function HomeTemplate(): Promise<JSX.Element> {
21
24
  const Home = await loadTemplate('Home');
22
- if (!Home)
23
- return _jsx(IndexTemplate, {});
24
- return _jsx(Home, {});
25
+ if (!Home) return <IndexTemplate/>
26
+
27
+ return <Home/>;
25
28
  }
@@ -1,15 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "./_autoloader/template-autoloader";
4
+
3
5
  /**
4
6
  * Loads the metadata for the Index template.
5
7
  * Fallback: None
6
8
  *
7
9
  * @returns {Promise<Metadata>} The loaded metadata object.
8
10
  */
9
- export async function IndexMetadata() {
11
+ export async function IndexMetadata(): Promise<Metadata> {
10
12
  const metadata = await loadMetadata('Index');
11
- return metadata !== null && metadata !== void 0 ? metadata : {};
13
+ return metadata ?? {};
12
14
  }
15
+
13
16
  /**
14
17
  * Renders the Index template.
15
18
  * Fallback: None
@@ -17,10 +20,11 @@ export async function IndexMetadata() {
17
20
  * @throws {Error} Throws if the Index template cannot be found in the _templates directory.
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function IndexTemplate() {
23
+ export async function IndexTemplate(): Promise<JSX.Element> {
21
24
  const Index = await loadTemplate('Index');
22
25
  if (!Index) {
23
26
  throw new Error('Nextpress needs an index.tsx file in the template heirarchy in the _templates directory to function');
24
27
  }
25
- return _jsx(Index, {});
28
+
29
+ return <Index/>;
26
30
  }
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { IndexMetadata, IndexTemplate } from "..";
5
+
4
6
  /**
5
7
  * Loads the metadata for the NotFound template.
6
8
  * Fallback: Index
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function NotFoundMetadata() {
12
+ export async function NotFoundMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('NotFound');
12
- return Object.assign(Object.assign({}, (await IndexMetadata())), metadata);
14
+ return {...(await IndexMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the NotFound template. Falls back to the Index template if not found.
16
19
  * Fallback: Index
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function NotFoundTemplate() {
23
+ export async function NotFoundTemplate(): Promise<JSX.Element> {
21
24
  const NotFound = await loadTemplate('NotFound');
22
- if (!NotFound)
23
- return _jsx(IndexTemplate, {});
24
- return _jsx(NotFound, {});
25
+ if (!NotFound) return <IndexTemplate/>
26
+
27
+ return <NotFound/>;
25
28
  }
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { SingularMetadata, SingularTemplate } from "./singular";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Page template.
6
8
  * Fallback: Singular
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function PageMetadata() {
12
+ export async function PageMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Page');
12
- return Object.assign(Object.assign({}, (await SingularMetadata())), metadata);
14
+ return {...(await SingularMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Page template. Falls back to the Singular template if not found.
16
19
  * Fallback: Singular
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function PageTemplate() {
23
+ export async function PageTemplate(): Promise<JSX.Element> {
21
24
  const Page = await loadTemplate('Page');
22
- if (!Page)
23
- return _jsx(SingularTemplate, {});
24
- return _jsx(Page, {});
25
+ if (!Page) return <SingularTemplate/>
26
+
27
+ return <Page/>;
25
28
  }
@@ -1,7 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { SingularMetadata, SingularTemplate } from "./singular";
4
- import { capitalizeFirstLetter } from "@/services/utilities/capitalise-first-letter";
5
+ import { capitalizeFirstLetter } from "nextpress/services/utilities/capitalise-first-letter";
6
+
5
7
  /**
6
8
  * Loads the metadata for a Post Type template based on the provided post type string.
7
9
  * Fallback: Singular
@@ -10,10 +12,11 @@ import { capitalizeFirstLetter } from "@/services/utilities/capitalise-first-let
10
12
  * @param {string} props.postType - The post type to load metadata for.
11
13
  * @returns {Promise<Metadata>} The merged metadata object.
12
14
  */
13
- export async function PostTypeMetadata({ postType }) {
15
+ export async function PostTypeMetadata({postType}: {postType: string}): Promise<Metadata> {
14
16
  const metadata = await loadMetadata(capitalizeFirstLetter(postType));
15
- return Object.assign(Object.assign({}, (await SingularMetadata())), metadata);
17
+ return {...(await SingularMetadata()), ...metadata};
16
18
  }
19
+
17
20
  /**
18
21
  * Renders a Post Type template based on the provided post type string. Falls back to Singular template if not found.
19
22
  * Fallback: Singular
@@ -22,9 +25,10 @@ export async function PostTypeMetadata({ postType }) {
22
25
  * @param {string} props.postType - The post type to load the template for.
23
26
  * @returns {Promise<JSX.Element>} The rendered template component.
24
27
  */
25
- export async function PostTypeTemplate({ postType }) {
28
+ export async function PostTypeTemplate({postType}: {postType: string}): Promise<JSX.Element> {
26
29
  const PostType = await loadTemplate(capitalizeFirstLetter(postType));
27
- if (!PostType)
28
- return _jsx(SingularTemplate, {});
29
- return _jsx(PostType, {});
30
+ if (!PostType) return <SingularTemplate/>
31
+
32
+ return <PostType/>;
30
33
  }
34
+
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { SingularMetadata, SingularTemplate } from "./singular";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Single template.
6
8
  * Fallback: Singular
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function SingleMetadata() {
12
+ export async function SingleMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Single');
12
- return Object.assign(Object.assign({}, (await SingularMetadata())), metadata);
14
+ return {...(await SingularMetadata()), ...metadata};
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Single template. Falls back to the Singular template if not found.
16
19
  * Fallback: Singular
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function SingleTemplate() {
23
+ export async function SingleTemplate(): Promise<JSX.Element> {
21
24
  const Single = await loadTemplate('Single');
22
- if (!Single)
23
- return _jsx(SingularTemplate, {});
24
- return _jsx(Single, {});
25
+ if (!Single) return <SingularTemplate/>
26
+
27
+ return <Single/>;
25
28
  }
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Metadata } from "next";
2
+ import { JSX } from "react";
2
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
3
4
  import { IndexMetadata, IndexTemplate } from "..";
5
+
4
6
  /**
5
7
  * Loads the metadata for the Singular template.
6
8
  * Fallback: Index
7
9
  *
8
10
  * @returns {Promise<Metadata>} The merged metadata object.
9
11
  */
10
- export async function SingularMetadata() {
12
+ export async function SingularMetadata(): Promise<Metadata> {
11
13
  const metadata = await loadMetadata('Singular');
12
- return Object.assign(Object.assign({}, (await IndexMetadata())), metadata);
14
+ return {...(await IndexMetadata()), ...metadata}
13
15
  }
16
+
14
17
  /**
15
18
  * Renders the Singular template. Falls back to the Index template if not found.
16
19
  * Fallback: Index
17
20
  *
18
21
  * @returns {Promise<JSX.Element>} The rendered template component.
19
22
  */
20
- export async function SingularTemplate() {
23
+ export async function SingularTemplate(): Promise<JSX.Element> {
21
24
  const Singular = await loadTemplate('Singular');
22
- if (!Singular)
23
- return _jsx(IndexTemplate, {});
24
- return _jsx(Singular, Object.assign({}, queriedObject));
25
+ if (!Singular) return <IndexTemplate/>
26
+
27
+ return <Singular {...queriedObject} />;
25
28
  }
@@ -0,0 +1,28 @@
1
+ import Image from "next/image";
2
+ import { ComponentPropsWithoutRef } from "react";
3
+
4
+ type Props = Omit<ComponentPropsWithoutRef<typeof Image>, "src" | "alt" | "height" | "width"> & {
5
+ attachmentId: number;
6
+ className?: string;
7
+ };
8
+
9
+ /**
10
+ * Renders a WordPress media attachment using the Next.js Image component.
11
+ */
12
+ export async function RenderAttachmentImage({ attachmentId, className, ...rest }: Props) {
13
+ const image = await getPost(attachmentId);
14
+ if (!image) return;
15
+
16
+ const { src, alt, height, width } = image.imageAttributes;
17
+
18
+ return (
19
+ <Image
20
+ src={src || ''}
21
+ alt={alt || ''}
22
+ height={height}
23
+ width={width}
24
+ className={className}
25
+ {...rest}
26
+ />
27
+ );
28
+ }
@@ -0,0 +1,12 @@
1
+ import { ResolvedFlexibleContent } from "../acf-functions/types/components/field-props";
2
+
3
+ type Props = {
4
+ layouts: ResolvedFlexibleContent<any>,
5
+ }
6
+
7
+ /**
8
+ * Dynamically resolves and renders an array of mapped ACF Layout components from a resolved flexible content field.
9
+ */
10
+ export async function RenderComponents({ layouts }: Props) {
11
+ return layouts.map((layout, index) => <layout.Component key={index} {...layout.content}/>)
12
+ }
@@ -0,0 +1,79 @@
1
+ "use client"
2
+ import { useEffect, useState } from "react";
3
+ import { usePathname } from "next/navigation";
4
+ import Script from "next/script";
5
+ import { ksesPost } from "nextpress/services/utilities/kses-post";
6
+
7
+ type Props = {
8
+ loggedInUserId?: number
9
+ }
10
+
11
+ type AdminBarResponse = {
12
+ html: string,
13
+ assets: {
14
+ css: {
15
+ admin_bar: string,
16
+ dashicons: string
17
+ },
18
+ js: {
19
+ admin_bar: string
20
+ }
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Renders the WordPress admin bar for authenticated administrators browsing the Next.js frontend.
26
+ */
27
+ export function RenderTheAdminBar({ loggedInUserId }: Props) {
28
+ const [adminBar, setAdminBar] = useState<AdminBarResponse | null>(null);
29
+ const [isMounted, setIsMounted] = useState(false);
30
+
31
+ const path = usePathname();
32
+
33
+ useEffect(() => {
34
+ fetch(`/api/admin-bar?user_id=${loggedInUserId}&path=${encodeURIComponent(path)}`)
35
+ .then((request) => {
36
+ if (!request.ok) {
37
+ throw new Error(`Failed to fetch admin bar: ${request.status}`);
38
+ }
39
+ return request.json();
40
+ })
41
+ .then((response) => {
42
+ setAdminBar(response);
43
+ setTimeout(() => setIsMounted(true), 50);
44
+ })
45
+ .catch((error) => {
46
+ console.error("Failed to load admin bar", error.message);
47
+ })
48
+ }, [loggedInUserId, path]);
49
+
50
+ if (!adminBar) {
51
+ return null;
52
+ }
53
+
54
+ return (
55
+ <>
56
+ <link
57
+ rel="stylesheet"
58
+ href={adminBar.assets.css.admin_bar}
59
+ precedence="high"
60
+ />
61
+ <link
62
+ rel="stylesheet"
63
+ href={adminBar.assets.css.dashicons}
64
+ precedence="high"
65
+ />
66
+ <Script src={adminBar.assets.js.admin_bar}/>
67
+
68
+ <div
69
+ className={`fixed top-0 left-0 right-0 transform transition-all duration-300 ease-in-out ${
70
+ isMounted
71
+ ? "scale-y-100"
72
+ : "scale-y-0"
73
+ }`}
74
+ >
75
+ {ksesPost(adminBar.html)}
76
+ </div>
77
+ </>
78
+ );
79
+ }
@@ -0,0 +1,24 @@
1
+ import { getThemeMods } from "nextpress/services/get-theme-mods";
2
+ import { getBlogname } from "nextpress/services/metadata/get-blogname";
3
+ import { RenderAttachmentImage } from "./render-attachment-image";
4
+
5
+ type Props = {
6
+ className?: string
7
+ }
8
+
9
+ /**
10
+ * Renders the custom site logo defined in the WordPress Customizer.
11
+ *
12
+ * Fallback: Renders the text-based Site Title if no custom logo is assigned in WordPress.
13
+ */
14
+ export async function RenderTheLogo({ className }: Props) {
15
+ const logoId = Number(await getThemeMods('custom_logo')) ?? 0;
16
+
17
+ return (
18
+ <div className={className}>
19
+ {logoId ?
20
+ <RenderAttachmentImage className="h-full w-full object-contain object-center" attachmentId={logoId} sizes="512px"/>
21
+ : <span className="text-4xl font-bold">{await getBlogname()}</span>}
22
+ </div>
23
+ )
24
+ }
@@ -2,14 +2,20 @@
2
2
  * This file was generated by kysely-codegen.
3
3
  * Please do not edit it manually.
4
4
  */
5
+
5
6
  import type { ColumnType } from "kysely";
6
- export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
7
+
8
+ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
9
+ ? ColumnType<S, I | undefined, U>
10
+ : ColumnType<T, T | undefined, T>;
11
+
7
12
  export interface WpCommentmeta {
8
13
  commentId: Generated<number>;
9
14
  metaId: Generated<number>;
10
15
  metaKey: string | null;
11
16
  metaValue: string | null;
12
17
  }
18
+
13
19
  export interface WpComment {
14
20
  commentAgent: Generated<string>;
15
21
  commentApproved: Generated<string>;
@@ -27,6 +33,7 @@ export interface WpComment {
27
33
  commentType: Generated<string>;
28
34
  userId: Generated<number>;
29
35
  }
36
+
30
37
  export interface WpLink {
31
38
  linkDescription: Generated<string>;
32
39
  linkId: Generated<number>;
@@ -42,30 +49,35 @@ export interface WpLink {
42
49
  linkUrl: Generated<string>;
43
50
  linkVisible: Generated<string>;
44
51
  }
52
+
45
53
  export interface WpNextpressPostmeta {
46
54
  metaId: Generated<number>;
47
55
  metaKey: string | null;
48
56
  metaValue: string | null;
49
57
  objectId: Generated<number>;
50
58
  }
59
+
51
60
  export interface WpNextpressTermmeta {
52
61
  metaId: Generated<number>;
53
62
  metaKey: string | null;
54
63
  metaValue: string | null;
55
64
  objectId: Generated<number>;
56
65
  }
66
+
57
67
  export interface WpOption {
58
68
  autoload: Generated<string>;
59
69
  optionId: Generated<number>;
60
70
  optionName: Generated<string>;
61
71
  optionValue: string;
62
72
  }
73
+
63
74
  export interface WpPostmeta {
64
75
  metaId: Generated<number>;
65
76
  metaKey: string | null;
66
77
  metaValue: string | null;
67
78
  postId: Generated<number>;
68
79
  }
80
+
69
81
  export interface WpPost {
70
82
  commentCount: Generated<number>;
71
83
  commentStatus: Generated<string>;
@@ -91,23 +103,27 @@ export interface WpPost {
91
103
  postType: Generated<string>;
92
104
  toPing: string;
93
105
  }
106
+
94
107
  export interface WpTermmeta {
95
108
  metaId: Generated<number>;
96
109
  metaKey: string | null;
97
110
  metaValue: string | null;
98
111
  termId: Generated<number>;
99
112
  }
113
+
100
114
  export interface WpTermRelationship {
101
115
  objectId: Generated<number>;
102
116
  termOrder: Generated<number>;
103
117
  termTaxonomyId: Generated<number>;
104
118
  }
119
+
105
120
  export interface WpTerm {
106
121
  name: Generated<string>;
107
122
  slug: Generated<string>;
108
123
  termGroup: Generated<number>;
109
124
  termId: Generated<number>;
110
125
  }
126
+
111
127
  export interface WpTermTaxonomy {
112
128
  count: Generated<number>;
113
129
  description: string;
@@ -116,12 +132,14 @@ export interface WpTermTaxonomy {
116
132
  termId: Generated<number>;
117
133
  termTaxonomyId: Generated<number>;
118
134
  }
135
+
119
136
  export interface WpUsermeta {
120
137
  metaKey: string | null;
121
138
  metaValue: string | null;
122
139
  umetaId: Generated<number>;
123
140
  userId: Generated<number>;
124
141
  }
142
+
125
143
  export interface WpUser {
126
144
  displayName: Generated<string>;
127
145
  ID: Generated<number>;
@@ -134,6 +152,7 @@ export interface WpUser {
134
152
  userStatus: Generated<number>;
135
153
  userUrl: Generated<string>;
136
154
  }
155
+
137
156
  export interface DB {
138
157
  wpCommentmeta: WpCommentmeta;
139
158
  wpComments: WpComment;