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.
- package/cli/install.js +27 -0
- package/{dist/acf-functions/core/acf-builder.js → lib/acf-functions/core/acf-builder.ts} +45 -17
- package/{dist/acf-functions/core/acf-component-autoloader.js → lib/acf-functions/core/acf-component-autoloader.ts} +13 -7
- package/{dist/acf-functions/core/acf-field-group-autoloader.js → lib/acf-functions/core/acf-field-group-autoloader.ts} +11 -5
- package/{dist/acf-functions/services/define-field-group.d.ts → lib/acf-functions/services/define-field-group.ts} +4 -1
- package/{dist/acf-functions/services/define-layout.d.ts → lib/acf-functions/services/define-layout.ts} +4 -1
- package/lib/acf-functions/services/map-fields/helpers/map-choice-object.ts +20 -0
- package/{dist/acf-functions/services/map-fields/map-fields.js → lib/acf-functions/services/map-fields/map-fields.ts} +128 -89
- package/{dist/acf-functions/types/acf-field-group.d.ts → lib/acf-functions/types/acf-field-group.ts} +49 -28
- package/lib/acf-functions/types/acf-field.ts +2853 -0
- package/lib/acf-functions/types/acf-layout.ts +22 -0
- package/lib/acf-functions/types/components/field-props.ts +189 -0
- package/{dist/acf-functions/types/components/nextpress-component.d.ts → lib/acf-functions/types/components/nextpress-component.ts} +4 -3
- package/lib/ambient.d.ts +16 -0
- package/{dist/entities/common.d.ts → lib/entities/common.ts} +6 -4
- package/{dist/entities/option/option.interface.d.ts → lib/entities/option/option.interface.ts} +3 -3
- package/{dist/entities/option/option.js → lib/entities/option/option.ts} +21 -14
- package/{dist/entities/post/post.interface.d.ts → lib/entities/post/post.interface.ts} +26 -21
- package/lib/entities/post/post.ts +209 -0
- package/{dist/entities/term/term.interface.d.ts → lib/entities/term/term.interface.ts} +3 -3
- package/lib/entities/term/term.ts +82 -0
- package/{dist/entities/user/user.interface.d.ts → lib/entities/user/user.interface.ts} +2 -1
- package/lib/entities/user/user.ts +86 -0
- package/{dist/globals/entity-loader/entity-loader-base.js → lib/globals/entity-loader/entity-loader-base.ts} +64 -10
- package/{dist/globals/entity-loader/entity-loader.interface.d.ts → lib/globals/entity-loader/entity-loader.ts} +2 -4
- package/lib/globals/entity-loader/option-loader.ts +56 -0
- package/lib/globals/entity-loader/post-loader.ts +60 -0
- package/lib/globals/entity-loader/term-loader.ts +60 -0
- package/lib/globals/entity-loader/user-loader.ts +61 -0
- package/lib/globals/get-field/get-field.ts +76 -0
- package/{dist/globals/globals.js → lib/globals/globals.ts} +8 -3
- package/{dist/globals/nextpress-config/nextpress-config.interface.d.ts → lib/globals/nextpress-config/nextpress-config.interface.ts} +10 -6
- package/lib/globals/nextpress-config/nextpress-config.ts +8 -0
- package/lib/globals/queried-object/queried-object.ts +124 -0
- package/{dist/repository/optionquery/option-query-args.d.ts → lib/repository/optionquery/option-query-args.ts} +5 -2
- package/lib/repository/optionquery/option-query.ts +29 -0
- package/{dist/repository/postquery/post-query-args.d.ts → lib/repository/postquery/post-query-args.ts} +10 -6
- package/lib/repository/postquery/post-query.ts +282 -0
- package/{dist/repository/termquery/term-query-args.d.ts → lib/repository/termquery/term-query-args.ts} +16 -6
- package/lib/repository/termquery/term-query.ts +244 -0
- package/{dist/repository/userquery/user-query-args.d.ts → lib/repository/userquery/user-query-args.ts} +19 -7
- package/{dist/repository/userquery/user-query.js → lib/repository/userquery/user-query.ts} +93 -76
- package/{dist/router/helpers.js → lib/router/helpers.ts} +4 -4
- package/{dist/router/nextpress-layout.js → lib/router/nextpress-layout.tsx} +28 -9
- package/{dist/router/routes/not-found-page.js → lib/router/nextpress-not-found-route.tsx} +7 -5
- package/{dist/router/nextpress-proxy.js → lib/router/nextpress-proxy.ts} +15 -3
- package/{dist/router/nextpress-static-params.js → lib/router/nextpress-static-params.ts} +17 -5
- package/{dist/router/router.js → lib/router/router.tsx} +29 -22
- package/{dist/router/routes/api/api-get-admin-bar.js → lib/router/routes/api/api-get-admin-bar.ts} +8 -6
- package/{dist/router/routes/api/api-get-draft-mode.js → lib/router/routes/api/api-get-draft-mode.ts} +15 -6
- package/{dist/router/routes/api/api-get-field-groups.js → lib/router/routes/api/api-get-field-groups.ts} +13 -8
- package/{dist/router/routes/api/api-post-revalidate.js → lib/router/routes/api/api-post-revalidate.ts} +6 -4
- package/{dist/router/routes/api/helpers.js → lib/router/routes/api/helpers.ts} +4 -3
- package/lib/router/routes/author-archive.tsx +75 -0
- package/lib/router/routes/post-index-page.tsx +58 -0
- package/lib/router/routes/singular-page.tsx +78 -0
- package/lib/router/routes/site-front-page.tsx +51 -0
- package/lib/router/routes/term-archive.tsx +93 -0
- package/{dist/router/types.d.ts → lib/router/types.ts} +4 -2
- package/{dist/services/get-menu.js → lib/services/get-menu.ts} +56 -32
- package/{dist/services/get-theme-mods.js → lib/services/get-theme-mods.ts} +6 -4
- package/{dist/services/metadata/get-blogname.js → lib/services/metadata/get-blogname.ts} +2 -2
- package/{dist/services/metadata/get-favicon-url.js → lib/services/metadata/get-favicon-url.ts} +5 -4
- package/{dist/services/metadata/get-language-attribute.js → lib/services/metadata/get-language-attribute.ts} +1 -1
- package/{dist/services/utilities/capitalise-first-letter.js → lib/services/utilities/capitalise-first-letter.ts} +2 -3
- package/{dist/services/utilities/esc-html.js → lib/services/utilities/esc-html.ts} +3 -1
- package/{dist/services/utilities/get-date-time-formatter.js → lib/services/utilities/get-date-time-formatter.ts} +16 -6
- package/{dist/services/utilities/kses-post.js → lib/services/utilities/kses-post.ts} +2 -1
- package/{dist/services/utilities/process-url.js → lib/services/utilities/process-url.ts} +4 -3
- package/{dist/template-heirarchy/_autoloader/template-autoloader.js → lib/template-heirarchy/_autoloader/template-autoloader.ts} +18 -9
- package/{dist/template-heirarchy/archive/archive.js → lib/template-heirarchy/archive/archive.tsx} +10 -7
- package/{dist/template-heirarchy/archive/author.js → lib/template-heirarchy/archive/author.tsx} +10 -7
- package/{dist/template-heirarchy/archive/category.js → lib/template-heirarchy/archive/category.tsx} +11 -7
- package/{dist/template-heirarchy/archive/posttypearchive.js → lib/template-heirarchy/archive/posttypearchive.tsx} +11 -8
- package/{dist/template-heirarchy/archive/tag.js → lib/template-heirarchy/archive/tag.tsx} +12 -7
- package/{dist/template-heirarchy/archive/taxonomy.js → lib/template-heirarchy/archive/taxonomy.tsx} +10 -7
- package/{dist/template-heirarchy/home/home.js → lib/template-heirarchy/home/home.tsx} +10 -7
- package/{dist/template-heirarchy/index.js → lib/template-heirarchy/index.tsx} +9 -5
- package/{dist/template-heirarchy/not-found.tsx/not-found.js → lib/template-heirarchy/not-found.tsx/not-found.tsx} +10 -7
- package/{dist/template-heirarchy/page/page.js → lib/template-heirarchy/page/page.tsx} +10 -7
- package/{dist/template-heirarchy/page/posttype.js → lib/template-heirarchy/page/posttype.tsx} +12 -8
- package/{dist/template-heirarchy/page/single.js → lib/template-heirarchy/page/single.tsx} +10 -7
- package/{dist/template-heirarchy/page/singular.js → lib/template-heirarchy/page/singular.tsx} +10 -7
- package/lib/ui/render-attachment-image.tsx +28 -0
- package/lib/ui/render-components.tsx +12 -0
- package/lib/ui/render-the-admin-bar.tsx +79 -0
- package/lib/ui/render-the-logo.tsx +24 -0
- package/{dist/wpdb/wpdb.interface.d.ts → lib/wpdb/wpdb.interface.ts} +20 -1
- package/{dist/wpdb/wpdb.js → lib/wpdb/wpdb.ts} +9 -5
- package/package.json +8 -43
- package/dist/acf-functions/core/acf-builder.d.ts +0 -51
- package/dist/acf-functions/core/acf-component-autoloader.d.ts +0 -11
- package/dist/acf-functions/core/acf-field-group-autoloader.d.ts +0 -10
- package/dist/acf-functions/field-props.d.ts +0 -196
- package/dist/acf-functions/field-props.js +0 -1
- package/dist/acf-functions/index.d.ts +0 -13
- package/dist/acf-functions/index.js +0 -13
- package/dist/acf-functions/services/define-field-group.js +0 -10
- package/dist/acf-functions/services/define-layout.js +0 -10
- package/dist/acf-functions/services/map-fields/helpers/map-choice-object.d.ts +0 -2
- package/dist/acf-functions/services/map-fields/helpers/map-choice-object.js +0 -18
- package/dist/acf-functions/services/map-fields/map-fields.d.ts +0 -21
- package/dist/acf-functions/types/acf-field-group.js +0 -1
- package/dist/acf-functions/types/acf-field.d.ts +0 -2813
- package/dist/acf-functions/types/acf-field.js +0 -1
- package/dist/acf-functions/types/acf-layout.d.ts +0 -19
- package/dist/acf-functions/types/acf-layout.js +0 -1
- package/dist/acf-functions/types/acf-values.js +0 -1
- package/dist/acf-functions/types/components/field-props.d.ts +0 -196
- package/dist/acf-functions/types/components/field-props.js +0 -1
- package/dist/acf-functions/types/components/nextpress-component.js +0 -1
- package/dist/entities/common.js +0 -1
- package/dist/entities/index.d.ts +0 -9
- package/dist/entities/index.js +0 -9
- package/dist/entities/option/option.d.ts +0 -19
- package/dist/entities/option/option.interface.js +0 -2
- package/dist/entities/post/post.d.ts +0 -50
- package/dist/entities/post/post.interface.js +0 -2
- package/dist/entities/post/post.js +0 -184
- package/dist/entities/term/term.d.ts +0 -28
- package/dist/entities/term/term.interface.js +0 -1
- package/dist/entities/term/term.js +0 -67
- package/dist/entities/user/user.d.ts +0 -27
- package/dist/entities/user/user.interface.js +0 -1
- package/dist/entities/user/user.js +0 -74
- package/dist/globals/entity-loader/entity-loader-base.d.ts +0 -65
- package/dist/globals/entity-loader/entity-loader.interface.js +0 -1
- package/dist/globals/entity-loader/option-loader.d.ts +0 -15
- package/dist/globals/entity-loader/option-loader.js +0 -31
- package/dist/globals/entity-loader/post-loader.d.ts +0 -21
- package/dist/globals/entity-loader/post-loader.js +0 -28
- package/dist/globals/entity-loader/term-loader.d.ts +0 -21
- package/dist/globals/entity-loader/term-loader.js +0 -28
- package/dist/globals/entity-loader/user-loader.d.ts +0 -21
- package/dist/globals/entity-loader/user-loader.js +0 -28
- package/dist/globals/get-field/get-field.d.ts +0 -18
- package/dist/globals/get-field/get-field.js +0 -44
- package/dist/globals/globals.d.ts +0 -18
- package/dist/globals/index.d.ts +0 -10
- package/dist/globals/index.js +0 -10
- package/dist/globals/nextpress-config/nextpress-config.d.ts +0 -4
- package/dist/globals/nextpress-config/nextpress-config.interface.js +0 -1
- package/dist/globals/nextpress-config/nextpress-config.js +0 -2
- package/dist/globals/queried-object/queried-object.d.ts +0 -62
- package/dist/globals/queried-object/queried-object.js +0 -56
- package/dist/repository/index.d.ts +0 -5
- package/dist/repository/index.js +0 -5
- package/dist/repository/optionquery/option-query-args.js +0 -1
- package/dist/repository/optionquery/option-query.d.ts +0 -12
- package/dist/repository/optionquery/option-query.js +0 -20
- package/dist/repository/postquery/post-query-args.js +0 -1
- package/dist/repository/postquery/post-query.d.ts +0 -12
- package/dist/repository/postquery/post-query.js +0 -272
- package/dist/repository/termquery/term-query-args.js +0 -1
- package/dist/repository/termquery/term-query.d.ts +0 -11
- package/dist/repository/termquery/term-query.js +0 -213
- package/dist/repository/userquery/user-query-args.js +0 -1
- package/dist/repository/userquery/user-query.d.ts +0 -12
- package/dist/router/helpers.d.ts +0 -14
- package/dist/router/index.d.ts +0 -17
- package/dist/router/index.js +0 -17
- package/dist/router/nextpress-layout.d.ts +0 -11
- package/dist/router/nextpress-proxy.d.ts +0 -8
- package/dist/router/nextpress-static-params.d.ts +0 -9
- package/dist/router/router.d.ts +0 -23
- package/dist/router/routes/api/api-get-admin-bar.d.ts +0 -8
- package/dist/router/routes/api/api-get-draft-mode.d.ts +0 -8
- package/dist/router/routes/api/api-get-field-groups.d.ts +0 -7
- package/dist/router/routes/api/api-post-revalidate.d.ts +0 -7
- package/dist/router/routes/api/helpers.d.ts +0 -8
- package/dist/router/routes/author-archive.d.ts +0 -25
- package/dist/router/routes/author-archive.js +0 -49
- package/dist/router/routes/not-found-page.d.ts +0 -15
- package/dist/router/routes/post-index-page.d.ts +0 -25
- package/dist/router/routes/post-index-page.js +0 -33
- package/dist/router/routes/singular-page.d.ts +0 -29
- package/dist/router/routes/singular-page.js +0 -51
- package/dist/router/routes/site-front-page.d.ts +0 -27
- package/dist/router/routes/site-front-page.js +0 -26
- package/dist/router/routes/term-archive.d.ts +0 -29
- package/dist/router/routes/term-archive.js +0 -65
- package/dist/router/types.js +0 -1
- package/dist/services/get-menu.d.ts +0 -13
- package/dist/services/get-theme-mods.d.ts +0 -7
- package/dist/services/index.d.ts +0 -10
- package/dist/services/index.js +0 -10
- package/dist/services/metadata/get-blogname.d.ts +0 -6
- package/dist/services/metadata/get-favicon-url.d.ts +0 -6
- package/dist/services/metadata/get-language-attribute.d.ts +0 -6
- package/dist/services/services.d.ts +0 -3
- package/dist/services/services.js +0 -3
- package/dist/services/utilities/capitalise-first-letter.d.ts +0 -7
- package/dist/services/utilities/esc-html.d.ts +0 -7
- package/dist/services/utilities/get-date-time-formatter.d.ts +0 -6
- package/dist/services/utilities/index.d.ts +0 -0
- package/dist/services/utilities/index.js +0 -1
- package/dist/services/utilities/kses-post.d.ts +0 -7
- package/dist/services/utilities/process-url.d.ts +0 -7
- package/dist/template-heirarchy/_autoloader/template-autoloader.d.ts +0 -9
- package/dist/template-heirarchy/archive/archive.d.ts +0 -16
- package/dist/template-heirarchy/archive/author.d.ts +0 -16
- package/dist/template-heirarchy/archive/category.d.ts +0 -16
- package/dist/template-heirarchy/archive/posttypearchive.d.ts +0 -24
- package/dist/template-heirarchy/archive/tag.d.ts +0 -16
- package/dist/template-heirarchy/archive/taxonomy.d.ts +0 -16
- package/dist/template-heirarchy/home/home.d.ts +0 -16
- package/dist/template-heirarchy/index.d.ts +0 -17
- package/dist/template-heirarchy/not-found.tsx/not-found.d.ts +0 -16
- package/dist/template-heirarchy/page/page.d.ts +0 -16
- package/dist/template-heirarchy/page/posttype.d.ts +0 -24
- package/dist/template-heirarchy/page/single.d.ts +0 -16
- package/dist/template-heirarchy/page/singular.d.ts +0 -16
- package/dist/ui/index.d.ts +0 -4
- package/dist/ui/index.js +0 -4
- package/dist/ui/render-attachment-image.d.ts +0 -12
- package/dist/ui/render-attachment-image.js +0 -24
- package/dist/ui/render-components.d.ts +0 -9
- package/dist/ui/render-components.js +0 -7
- package/dist/ui/render-the-admin-bar.d.ts +0 -8
- package/dist/ui/render-the-admin-bar.js +0 -36
- package/dist/ui/render-the-logo.d.ts +0 -10
- package/dist/ui/render-the-logo.js +0 -16
- package/dist/wpdb/index.d.ts +0 -0
- package/dist/wpdb/index.js +0 -1
- package/dist/wpdb/wpdb.d.ts +0 -3
- package/dist/wpdb/wpdb.interface.js +0 -5
- /package/{dist/acf-functions/types/acf-values.d.ts → lib/acf-functions/types/acf-values.ts} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createPool } from 'mysql2'
|
|
2
|
-
import { CamelCasePlugin, DeduplicateJoinsPlugin, Kysely, MysqlDialect } from 'kysely'
|
|
1
|
+
import { createPool } from 'mysql2'
|
|
2
|
+
import { CamelCasePlugin, DeduplicateJoinsPlugin, Kysely, MysqlDialect } from 'kysely'
|
|
3
|
+
import { DB } from './wpdb.interface';
|
|
4
|
+
|
|
3
5
|
const dialect = new MysqlDialect({
|
|
4
6
|
pool: createPool({
|
|
5
7
|
user: 'root',
|
|
@@ -14,12 +16,14 @@ const dialect = new MysqlDialect({
|
|
|
14
16
|
enableKeepAlive: true,
|
|
15
17
|
keepAliveInitialDelay: 0,
|
|
16
18
|
}),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const wpdb = new Kysely<DB>({
|
|
19
22
|
dialect,
|
|
20
23
|
plugins: [new CamelCasePlugin(), new DeduplicateJoinsPlugin()],
|
|
21
24
|
// log(event) {
|
|
22
25
|
// if (process.env.NODE_ENV !== 'development') return;
|
|
26
|
+
|
|
23
27
|
// if (event.level === 'query') {
|
|
24
28
|
// console.log(`\n[${event.queryDurationMillis.toFixed(2)}ms] QUERY EXECUTION`);
|
|
25
29
|
// console.log(`SQL: ${event.query.sql}`);
|
|
@@ -29,4 +33,4 @@ export const wpdb = new Kysely({
|
|
|
29
33
|
// console.error(`DB ERROR:`, event.error);
|
|
30
34
|
// }
|
|
31
35
|
// }
|
|
32
|
-
})
|
|
36
|
+
})
|
package/package.json
CHANGED
|
@@ -1,52 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextpress-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Nextpress Core",
|
|
5
5
|
"keywords": [],
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"bin": {
|
|
7
|
+
"nextpress-install": "./cli/install.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
10
|
+
"lib",
|
|
11
|
+
"cli"
|
|
11
12
|
],
|
|
12
|
-
"
|
|
13
|
-
"./acf-functions": {
|
|
14
|
-
"types": "./dist/acf-functions/index.d.ts",
|
|
15
|
-
"import": "./dist/acf-functions/index.js"
|
|
16
|
-
},
|
|
17
|
-
"./entities": {
|
|
18
|
-
"types": "./dist/entities/index.d.ts",
|
|
19
|
-
"import": "./dist/entities/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./globals": {
|
|
22
|
-
"types": "./dist/globals/index.d.ts",
|
|
23
|
-
"import": "./dist/globals/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./repository": {
|
|
26
|
-
"types": "./dist/repository/index.d.ts",
|
|
27
|
-
"import": "./dist/repository/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./router": {
|
|
30
|
-
"types": "./dist/router/index.d.ts",
|
|
31
|
-
"import": "./dist/router/index.js"
|
|
32
|
-
},
|
|
33
|
-
"./services": {
|
|
34
|
-
"types": "./dist/services/index.d.ts",
|
|
35
|
-
"import": "./dist/services/index.js"
|
|
36
|
-
},
|
|
37
|
-
"./ui": {
|
|
38
|
-
"types": "./dist/ui/index.d.ts",
|
|
39
|
-
"import": "./dist/ui/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./wpdb": {
|
|
42
|
-
"types": "./dist/wpdb/index.d.ts",
|
|
43
|
-
"import": "./dist/wpdb/index.js"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"author": "",
|
|
13
|
+
"author": "ellsaw",
|
|
47
14
|
"license": "ISC",
|
|
48
15
|
"type": "module",
|
|
49
|
-
"
|
|
16
|
+
"devDependencies": {
|
|
50
17
|
"html-react-parser": "^6.1.2",
|
|
51
18
|
"isomorphic-dompurify": "^3.14.0",
|
|
52
19
|
"kysely": "^0.29.2",
|
|
@@ -54,9 +21,7 @@
|
|
|
54
21
|
"next": "16.2.6",
|
|
55
22
|
"php-serialize": "^5.1.3",
|
|
56
23
|
"react": "19.2.4",
|
|
57
|
-
"react-dom": "19.2.4"
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
24
|
+
"react-dom": "19.2.4",
|
|
60
25
|
"@microsoft/api-extractor": "^7.58.9",
|
|
61
26
|
"@tailwindcss/postcss": "^4",
|
|
62
27
|
"@types/node": "^20.19.41",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ACFFieldGroup, NextpressFieldGroup } from "../types/acf-field-group";
|
|
2
|
-
/**
|
|
3
|
-
* Class representing ACF builder.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ACFBuilder {
|
|
6
|
-
/** Array of ACF field groups. */
|
|
7
|
-
private fieldGroups;
|
|
8
|
-
constructor();
|
|
9
|
-
/**
|
|
10
|
-
* Gets built field groups.
|
|
11
|
-
*
|
|
12
|
-
* @returns {ACFFieldGroup[]} Array of field groups.
|
|
13
|
-
*/
|
|
14
|
-
getFieldGroups(): ACFFieldGroup[];
|
|
15
|
-
/**
|
|
16
|
-
* Converts field groups to JSON string.
|
|
17
|
-
*
|
|
18
|
-
* @returns {string} JSON string representation of field groups.
|
|
19
|
-
*/
|
|
20
|
-
toJSON(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Registers and processes Nextpress field groups.
|
|
23
|
-
*
|
|
24
|
-
* @param {NextpressFieldGroup[]} fieldGroups - Array of field groups to register.
|
|
25
|
-
* @returns {this} Current instance.
|
|
26
|
-
*/
|
|
27
|
-
registerFieldGroups(fieldGroups: NextpressFieldGroup[]): this;
|
|
28
|
-
/**
|
|
29
|
-
* Sets keys for fields based on parent name.
|
|
30
|
-
*
|
|
31
|
-
* @param {NextpressField[]} fields - Array of fields to process.
|
|
32
|
-
* @param {string} parentName - Parent string name.
|
|
33
|
-
* @returns {ACFField[]} Array of fields with generated keys.
|
|
34
|
-
*/
|
|
35
|
-
private setFieldKeys;
|
|
36
|
-
/**
|
|
37
|
-
* Sets keys for layouts based on parent name.
|
|
38
|
-
*
|
|
39
|
-
* @param {NextpressLayout[]} layouts - Array of layouts to process.
|
|
40
|
-
* @param {string} parentName - Parent string name.
|
|
41
|
-
* @returns {ACFLayout[]} Array of layouts with generated keys.
|
|
42
|
-
*/
|
|
43
|
-
private setLayoutKeys;
|
|
44
|
-
/**
|
|
45
|
-
* Formats suffix string.
|
|
46
|
-
*
|
|
47
|
-
* @param {string} suffix - Suffix to format.
|
|
48
|
-
* @returns {string} Formatted string.
|
|
49
|
-
*/
|
|
50
|
-
private formatKeySuffix;
|
|
51
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NextpressComponent } from '../types/components/nextpress-component';
|
|
2
|
-
/**
|
|
3
|
-
* Autoloads ACF components dynamically from the templates directory.
|
|
4
|
-
* * **Requirements for it to work:**
|
|
5
|
-
* Each `.tsx` file within the `src/app/_templates/components/` directory MUST export the following:
|
|
6
|
-
* 1. `layout` (Named Export): The configuration for the ACF layout, typically defined using the `defineLayout` function.
|
|
7
|
-
* 2. `default` (Default Export): The React component (JSX/TSX function) that renders the layout.
|
|
8
|
-
*
|
|
9
|
-
* @returns {Promise<NextpressComponent[]>} A promise resolving to an array of mapped layout configurations and their respective components.
|
|
10
|
-
*/
|
|
11
|
-
export declare function acfComponentAutoloader(): Promise<NextpressComponent[]>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NextpressFieldGroup } from '../types/acf-field-group';
|
|
2
|
-
/**
|
|
3
|
-
* Autoloads ACF field groups dynamically from the field-groups directory.
|
|
4
|
-
* * **Requirements for it to work:**
|
|
5
|
-
* Each `.ts` file within the `src/app/_templates/components/field-groups/` directory MUST export the following:
|
|
6
|
-
* 1. `default` (Default Export): The configuration object for the ACF Field Group, typically defined using the `defineFieldGroup` function.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Promise<NextpressFieldGroup[]>} A promise resolving to an array of loaded ACF field group configurations.
|
|
9
|
-
*/
|
|
10
|
-
export declare function acfFieldGroupAutoloader(): Promise<NextpressFieldGroup[]>;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { IPost } from "@/entities/post/post.interface";
|
|
2
|
-
import { ITerm } from "@/entities/term/term.interface";
|
|
3
|
-
import { IUser } from "@/entities/user/user.interface";
|
|
4
|
-
import { JSX } from "react";
|
|
5
|
-
type GetFields<T> = T extends {
|
|
6
|
-
fields: readonly any[];
|
|
7
|
-
} ? T['fields'] : T extends {
|
|
8
|
-
sub_fields: readonly any[];
|
|
9
|
-
} ? T['sub_fields'] : never;
|
|
10
|
-
/**
|
|
11
|
-
* Represents the properties passed to a Nextpress ACF component.
|
|
12
|
-
*
|
|
13
|
-
* @template T - The expected type of the mapped ACF fields.
|
|
14
|
-
*/
|
|
15
|
-
export type FieldProps<LayoutT> = LayoutT extends {
|
|
16
|
-
fields: readonly any[];
|
|
17
|
-
} | {
|
|
18
|
-
sub_fields: readonly any[];
|
|
19
|
-
} ? ResolvedFields<GetFields<LayoutT>> : never;
|
|
20
|
-
/**
|
|
21
|
-
* An array of ACF field configurations to a strongly-typed object representing the resolved data structure.
|
|
22
|
-
* It iterates over the array, using the `name` property of each field as the object key, and determines the expected value type using the `MapFieldType` utility.
|
|
23
|
-
*
|
|
24
|
-
* @template Fields - A readonly array of ACF field configuration objects.
|
|
25
|
-
*/
|
|
26
|
-
type ResolvedFields<Fields extends readonly any[]> = {
|
|
27
|
-
[F in Fields[number] as F['name']]: MapFieldType<F>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Maps an array of ACF Flexible Content layouts to a union type representing the resolved layout blocks.
|
|
31
|
-
* For each layout, it checks for the presence of `fields` or `sub_fields`, and resolves to a specific object
|
|
32
|
-
* structure containing the layout's React component and its deeply resolved field content.
|
|
33
|
-
*
|
|
34
|
-
* @template Layouts - A readonly array of ACF Flexible Content layout configuration objects.
|
|
35
|
-
*/
|
|
36
|
-
type ResolvedFlexibleContent<Layouts extends readonly any[]> = {
|
|
37
|
-
[L in Layouts[number] as L['name']]: L extends {
|
|
38
|
-
name: infer Name;
|
|
39
|
-
} & ({
|
|
40
|
-
fields: readonly any[];
|
|
41
|
-
} | {
|
|
42
|
-
sub_fields: readonly any[];
|
|
43
|
-
}) ? {
|
|
44
|
-
Component: () => Promise<JSX.Element>;
|
|
45
|
-
content: ResolvedFields<GetFields<L>>;
|
|
46
|
-
}[] : never;
|
|
47
|
-
}[Layouts[number]['name']];
|
|
48
|
-
type MapFieldType<Field> = Field extends {
|
|
49
|
-
type: 'color_picker';
|
|
50
|
-
} ? string | null : Field extends {
|
|
51
|
-
type: 'date_picker';
|
|
52
|
-
} ? string | null : Field extends {
|
|
53
|
-
type: 'date_time_picker';
|
|
54
|
-
} ? string | null : Field extends {
|
|
55
|
-
type: 'google_map';
|
|
56
|
-
} ? ACFGoogleMapsObject | null : Field extends {
|
|
57
|
-
type: 'icon_picker';
|
|
58
|
-
} ? Field extends {
|
|
59
|
-
return_format: 'string';
|
|
60
|
-
} ? string | null : Field extends {
|
|
61
|
-
return_format: 'array';
|
|
62
|
-
} ? ACFIconObject | null : ACFIconObject | null : Field extends {
|
|
63
|
-
type: 'time_picker';
|
|
64
|
-
} ? string | null : Field extends {
|
|
65
|
-
type: 'email';
|
|
66
|
-
} ? string | null : Field extends {
|
|
67
|
-
type: 'number';
|
|
68
|
-
} ? number | null : Field extends {
|
|
69
|
-
type: 'password';
|
|
70
|
-
} ? string | null : Field extends {
|
|
71
|
-
type: 'range';
|
|
72
|
-
} ? number | null : Field extends {
|
|
73
|
-
type: 'text';
|
|
74
|
-
} ? string | null : Field extends {
|
|
75
|
-
type: 'textarea';
|
|
76
|
-
} ? string | null : Field extends {
|
|
77
|
-
type: 'button_group';
|
|
78
|
-
} ? Field extends {
|
|
79
|
-
return_format: 'array';
|
|
80
|
-
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
81
|
-
type: 'checkbox';
|
|
82
|
-
} ? Field extends {
|
|
83
|
-
return_format: 'array';
|
|
84
|
-
} ? ACFChoiceObject[] : string[] : Field extends {
|
|
85
|
-
type: 'radio';
|
|
86
|
-
} ? Field extends {
|
|
87
|
-
return_format: 'array';
|
|
88
|
-
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
89
|
-
type: 'select';
|
|
90
|
-
} ? Field extends {
|
|
91
|
-
multiple: 1;
|
|
92
|
-
} ? Field extends {
|
|
93
|
-
return_format: 'array';
|
|
94
|
-
} ? ACFChoiceObject[] : string[] : Field extends {
|
|
95
|
-
return_format: 'array';
|
|
96
|
-
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
97
|
-
type: 'true_false';
|
|
98
|
-
} ? boolean : Field extends {
|
|
99
|
-
type: 'file';
|
|
100
|
-
} ? number | null : Field extends {
|
|
101
|
-
type: 'gallery';
|
|
102
|
-
} ? number[] : Field extends {
|
|
103
|
-
type: 'image';
|
|
104
|
-
} ? number | null : Field extends {
|
|
105
|
-
type: 'oembed';
|
|
106
|
-
} ? string | null : Field extends {
|
|
107
|
-
type: 'wysiwyg';
|
|
108
|
-
} ? string | null : Field extends {
|
|
109
|
-
type: 'link';
|
|
110
|
-
} ? Field extends {
|
|
111
|
-
return_format: 'url';
|
|
112
|
-
} ? string | null : Field extends {
|
|
113
|
-
return_format: 'array';
|
|
114
|
-
} ? ACFLinkObject | null : ACFLinkObject : Field extends {
|
|
115
|
-
type: 'page_link';
|
|
116
|
-
} ? Field extends {
|
|
117
|
-
multiple: 1;
|
|
118
|
-
} ? string[] : string | null : Field extends {
|
|
119
|
-
type: 'post_object';
|
|
120
|
-
} ? Field extends {
|
|
121
|
-
multiple: 1;
|
|
122
|
-
} ? Field extends {
|
|
123
|
-
return_format: 'object';
|
|
124
|
-
} ? IPost[] : number[] : Field extends {
|
|
125
|
-
return_format: 'object';
|
|
126
|
-
} ? IPost | null : number | null : Field extends {
|
|
127
|
-
type: 'relationship';
|
|
128
|
-
} ? Field extends {
|
|
129
|
-
return_format: 'object';
|
|
130
|
-
} ? IPost[] | null : number[] | null : Field extends {
|
|
131
|
-
type: 'taxonomy';
|
|
132
|
-
} ? Field extends {
|
|
133
|
-
multiple: 1;
|
|
134
|
-
} ? Field extends {
|
|
135
|
-
return_format: 'object';
|
|
136
|
-
} ? ITerm[] : number[] : Field extends {
|
|
137
|
-
return_format: 'object';
|
|
138
|
-
} ? ITerm | null : number | null : Field extends {
|
|
139
|
-
type: 'user';
|
|
140
|
-
} ? Field extends {
|
|
141
|
-
multiple: 1;
|
|
142
|
-
} ? Field extends {
|
|
143
|
-
return_format: 'object';
|
|
144
|
-
} ? IUser[] : number[] : Field extends {
|
|
145
|
-
return_format: 'object';
|
|
146
|
-
} ? IUser | null : number | null : Field extends {
|
|
147
|
-
type: 'group';
|
|
148
|
-
} & ({
|
|
149
|
-
fields: readonly any[];
|
|
150
|
-
} | {
|
|
151
|
-
sub_fields: readonly any[];
|
|
152
|
-
}) ? ResolvedFields<GetFields<Field>> | null : Field extends {
|
|
153
|
-
type: 'repeater';
|
|
154
|
-
} & ({
|
|
155
|
-
fields: readonly any[];
|
|
156
|
-
} | {
|
|
157
|
-
sub_fields: readonly any[];
|
|
158
|
-
}) ? ResolvedFields<GetFields<Field>>[] | null : Field extends {
|
|
159
|
-
type: 'flexible_content';
|
|
160
|
-
layouts: readonly any[];
|
|
161
|
-
} ? ResolvedFlexibleContent<Field['layouts']> | null : Field extends {
|
|
162
|
-
fields: readonly any[];
|
|
163
|
-
} | {
|
|
164
|
-
sub_fields: readonly any[];
|
|
165
|
-
} ? ResolvedFields<GetFields<Field>> : never;
|
|
166
|
-
type ACFIconObject = {
|
|
167
|
-
type: string;
|
|
168
|
-
value: string;
|
|
169
|
-
};
|
|
170
|
-
type ACFLinkObject = {
|
|
171
|
-
title: string;
|
|
172
|
-
url: string;
|
|
173
|
-
target: string;
|
|
174
|
-
};
|
|
175
|
-
type ACFChoiceObject = {
|
|
176
|
-
label?: string;
|
|
177
|
-
value?: string;
|
|
178
|
-
};
|
|
179
|
-
type ACFGoogleMapsObject = {
|
|
180
|
-
address: string;
|
|
181
|
-
lat: string | number;
|
|
182
|
-
lng: string | number;
|
|
183
|
-
zoom: string | number;
|
|
184
|
-
place_id: string;
|
|
185
|
-
name: string;
|
|
186
|
-
street_number: string | number;
|
|
187
|
-
street_name: string;
|
|
188
|
-
street_name_short: string;
|
|
189
|
-
city: string;
|
|
190
|
-
state: string;
|
|
191
|
-
state_short: string;
|
|
192
|
-
post_code: string | number;
|
|
193
|
-
country: string;
|
|
194
|
-
country_short: string;
|
|
195
|
-
};
|
|
196
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './core/acf-builder';
|
|
2
|
-
export * from './core/acf-field-group-autoloader';
|
|
3
|
-
export * from './core/acf-component-autoloader';
|
|
4
|
-
export * from './services/define-field-group';
|
|
5
|
-
export * from './services/define-layout';
|
|
6
|
-
export * from './services/map-fields/map-fields';
|
|
7
|
-
export * from './services/map-fields/helpers/map-choice-object';
|
|
8
|
-
export * from './types/acf-field';
|
|
9
|
-
export * from './types/acf-values';
|
|
10
|
-
export * from './types/acf-field-group';
|
|
11
|
-
export * from './types/acf-layout';
|
|
12
|
-
export * from './types/components/field-props';
|
|
13
|
-
export * from './types/components/nextpress-component';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './core/acf-builder';
|
|
2
|
-
export * from './core/acf-field-group-autoloader';
|
|
3
|
-
export * from './core/acf-component-autoloader';
|
|
4
|
-
export * from './services/define-field-group';
|
|
5
|
-
export * from './services/define-layout';
|
|
6
|
-
export * from './services/map-fields/map-fields';
|
|
7
|
-
export * from './services/map-fields/helpers/map-choice-object';
|
|
8
|
-
export * from './types/acf-field';
|
|
9
|
-
export * from './types/acf-values';
|
|
10
|
-
export * from './types/acf-field-group';
|
|
11
|
-
export * from './types/acf-layout';
|
|
12
|
-
export * from './types/components/field-props';
|
|
13
|
-
export * from './types/components/nextpress-component';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines field group configuration and applies typing.
|
|
3
|
-
*
|
|
4
|
-
* @template T - Field group type extending NextpressFieldGroup.
|
|
5
|
-
* @param {T} layout - Field group configuration object.
|
|
6
|
-
* @returns {T} Passed field group configuration object.
|
|
7
|
-
*/
|
|
8
|
-
export function defineFieldGroup(layout) {
|
|
9
|
-
return layout;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines layout configuration and applies typing.
|
|
3
|
-
*
|
|
4
|
-
* @template T - Layout type extending NextpressLayout.
|
|
5
|
-
* @param {T} layout - Layout configuration object.
|
|
6
|
-
* @returns {T} Passed layout configuration object.
|
|
7
|
-
*/
|
|
8
|
-
export function defineLayout(layout) {
|
|
9
|
-
return layout;
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function mapChoiceObject(return_format, value, choices) {
|
|
2
|
-
if (return_format === 'value') {
|
|
3
|
-
return value;
|
|
4
|
-
}
|
|
5
|
-
if (!choices)
|
|
6
|
-
return;
|
|
7
|
-
const label = choices[value !== null && value !== void 0 ? value : ''];
|
|
8
|
-
if (return_format === 'array') {
|
|
9
|
-
const result = {
|
|
10
|
-
label: label,
|
|
11
|
-
value: value
|
|
12
|
-
};
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
else if (return_format === 'label') {
|
|
16
|
-
return label;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NextpressField } from "@/acf-functions/types/acf-field";
|
|
2
|
-
import { NextpressLayout } from "@/acf-functions/types/acf-layout";
|
|
3
|
-
import { ACFRawValues } from "@/acf-functions/types/acf-values";
|
|
4
|
-
/**
|
|
5
|
-
* Maps individual ACF field to corresponding value.
|
|
6
|
-
*
|
|
7
|
-
* @param {NextpressField} field - Field configuration.
|
|
8
|
-
* @param {ACFRawValues} rawValues - Raw values map.
|
|
9
|
-
* @returns {Promise<any>} Promise resolving to mapped value.
|
|
10
|
-
*/
|
|
11
|
-
export declare function mapField(field: NextpressField, rawValues: ACFRawValues): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* Maps layout configuration to values object.
|
|
14
|
-
*
|
|
15
|
-
* @param {NextpressLayout} layout - Layout configuration.
|
|
16
|
-
* @param {ACFRawValues} rawValues - Raw values map.
|
|
17
|
-
* @returns {Promise<{ [key: string]: any }>} Promise resolving to layout values object.
|
|
18
|
-
*/
|
|
19
|
-
export declare function mapLayout(layout: NextpressLayout, rawValues: ACFRawValues): Promise<{
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|