nextpress-core 1.0.0 → 1.0.1
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/dist/acf-functions/core/acf-builder.d.ts +50 -0
- package/{lib/acf-functions/core/acf-builder.ts → dist/acf-functions/core/acf-builder.js} +17 -41
- package/dist/acf-functions/core/acf-component-autoloader.d.ts +11 -0
- package/{lib/acf-functions/core/acf-component-autoloader.ts → dist/acf-functions/core/acf-component-autoloader.js} +7 -13
- package/dist/acf-functions/core/acf-field-group-autoloader.d.ts +9 -0
- package/{lib/acf-functions/core/acf-field-group-autoloader.ts → dist/acf-functions/core/acf-field-group-autoloader.js} +4 -9
- package/dist/acf-functions/services/define-field-group.d.ts +8 -0
- package/{lib/acf-functions/services/define-field-group.ts → dist/acf-functions/services/define-field-group.js} +1 -1
- package/dist/acf-functions/services/define-layout.d.ts +8 -0
- package/{lib/acf-functions/services/define-layout.ts → dist/acf-functions/services/define-layout.js} +1 -1
- package/dist/acf-functions/services/map-fields/helpers/map-choice-object.d.ts +2 -0
- package/dist/acf-functions/services/map-fields/helpers/map-choice-object.js +18 -0
- package/dist/acf-functions/services/map-fields/map-fields.d.ts +18 -0
- package/{lib/acf-functions/services/map-fields/map-fields.ts → dist/acf-functions/services/map-fields/map-fields.js} +88 -124
- package/dist/entities/option/option.d.ts +19 -0
- package/{lib/entities/option/option.ts → dist/entities/option/option.js} +13 -20
- package/dist/entities/post/post.d.ts +50 -0
- package/dist/entities/post/post.js +184 -0
- package/dist/entities/term/term.d.ts +28 -0
- package/dist/entities/term/term.js +67 -0
- package/dist/entities/user/user.d.ts +27 -0
- package/dist/entities/user/user.js +74 -0
- package/dist/globals/entity-loader/entity-loader-base.d.ts +65 -0
- package/{lib/globals/entity-loader/entity-loader-base.ts → dist/globals/entity-loader/entity-loader-base.js} +10 -64
- package/dist/globals/entity-loader/option-loader.d.ts +15 -0
- package/dist/globals/entity-loader/option-loader.js +31 -0
- package/dist/globals/entity-loader/post-loader.d.ts +21 -0
- package/dist/globals/entity-loader/post-loader.js +28 -0
- package/dist/globals/entity-loader/term-loader.d.ts +21 -0
- package/dist/globals/entity-loader/term-loader.js +28 -0
- package/dist/globals/entity-loader/user-loader.d.ts +21 -0
- package/dist/globals/entity-loader/user-loader.js +28 -0
- package/dist/globals/get-field/get-field.d.ts +17 -0
- package/dist/globals/get-field/get-field.js +44 -0
- package/dist/globals/globals.d.ts +18 -0
- package/{lib/globals/globals.ts → dist/globals/globals.js} +3 -8
- package/dist/globals/nextpress-config/nextpress-config.d.ts +4 -0
- package/{lib/globals/nextpress-config/nextpress-config.ts → dist/globals/nextpress-config/nextpress-config.js} +0 -5
- package/dist/globals/queried-object/queried-object.d.ts +62 -0
- package/dist/globals/queried-object/queried-object.js +56 -0
- package/dist/repository/optionquery/option-query.d.ts +12 -0
- package/dist/repository/optionquery/option-query.js +20 -0
- package/dist/repository/postquery/post-query.d.ts +12 -0
- package/dist/repository/postquery/post-query.js +272 -0
- package/dist/repository/termquery/term-query.d.ts +11 -0
- package/dist/repository/termquery/term-query.js +213 -0
- package/dist/repository/userquery/user-query.d.ts +12 -0
- package/{lib/repository/userquery/user-query.ts → dist/repository/userquery/user-query.js} +75 -91
- package/dist/router/helpers.d.ts +14 -0
- package/{lib/router/helpers.ts → dist/router/helpers.js} +4 -4
- package/dist/router/nextpress-layout.d.ts +11 -0
- package/{lib/router/nextpress-layout.tsx → dist/router/nextpress-layout.js} +6 -23
- package/dist/router/nextpress-proxy.d.ts +8 -0
- package/{lib/router/nextpress-proxy.ts → dist/router/nextpress-proxy.js} +3 -15
- package/dist/router/nextpress-static-params.d.ts +9 -0
- package/{lib/router/nextpress-static-params.ts → dist/router/nextpress-static-params.js} +5 -17
- package/dist/router/router.d.ts +23 -0
- package/{lib/router/router.tsx → dist/router/router.js} +21 -29
- package/dist/router/routes/api/api-get-admin-bar.d.ts +8 -0
- package/{lib/router/routes/api/api-get-admin-bar.ts → dist/router/routes/api/api-get-admin-bar.js} +6 -8
- package/dist/router/routes/api/api-get-draft-mode.d.ts +8 -0
- package/{lib/router/routes/api/api-get-draft-mode.ts → dist/router/routes/api/api-get-draft-mode.js} +6 -15
- package/dist/router/routes/api/api-get-field-groups.d.ts +7 -0
- package/{lib/router/routes/api/api-get-field-groups.ts → dist/router/routes/api/api-get-field-groups.js} +6 -11
- package/dist/router/routes/api/api-post-revalidate.d.ts +7 -0
- package/{lib/router/routes/api/api-post-revalidate.ts → dist/router/routes/api/api-post-revalidate.js} +4 -6
- package/dist/router/routes/api/helpers.d.ts +8 -0
- package/{lib/router/routes/api/helpers.ts → dist/router/routes/api/helpers.js} +3 -4
- package/dist/router/routes/author-archive.d.ts +25 -0
- package/{lib/router/routes/author-archive.tsx → dist/router/routes/author-archive.js} +11 -37
- package/dist/router/routes/not-found-page.d.ts +15 -0
- package/{lib/router/routes/not-found-page.tsx → dist/router/routes/not-found-page.js} +3 -5
- package/dist/router/routes/post-index-page.d.ts +25 -0
- package/dist/router/routes/post-index-page.js +33 -0
- package/dist/router/routes/singular-page.d.ts +29 -0
- package/dist/router/routes/singular-page.js +51 -0
- package/dist/router/routes/site-front-page.d.ts +27 -0
- package/dist/router/routes/site-front-page.js +26 -0
- package/dist/router/routes/term-archive.d.ts +29 -0
- package/{lib/router/routes/term-archive.tsx → dist/router/routes/term-archive.js} +17 -45
- package/dist/services/get-menu.d.ts +13 -0
- package/{lib/services/get-menu.ts → dist/services/get-menu.js} +32 -56
- package/dist/services/get-theme-mods.d.ts +7 -0
- package/{lib/services/get-theme-mods.ts → dist/services/get-theme-mods.js} +4 -6
- package/dist/services/metadata/get-blogname.d.ts +6 -0
- package/{lib/services/metadata/get-blogname.ts → dist/services/metadata/get-blogname.js} +2 -2
- package/dist/services/metadata/get-favicon-url.d.ts +6 -0
- package/{lib/services/metadata/get-favicon-url.ts → dist/services/metadata/get-favicon-url.js} +4 -5
- package/dist/services/metadata/get-language-attribute.d.ts +6 -0
- package/{lib/services/metadata/get-language-attribute.ts → dist/services/metadata/get-language-attribute.js} +1 -1
- package/{lib/services/services.ts → dist/services/services.d.ts} +1 -5
- package/dist/services/services.js +3 -0
- package/dist/services/utilities/capitalise-first-letter.d.ts +7 -0
- package/{lib/services/utilities/capitalise-first-letter.ts → dist/services/utilities/capitalise-first-letter.js} +3 -2
- package/dist/services/utilities/esc-html.d.ts +7 -0
- package/{lib/services/utilities/esc-html.ts → dist/services/utilities/esc-html.js} +1 -3
- package/dist/services/utilities/get-date-time-formatter.d.ts +6 -0
- package/{lib/services/utilities/get-date-time-formatter.ts → dist/services/utilities/get-date-time-formatter.js} +6 -16
- package/dist/services/utilities/index.js +1 -0
- package/dist/services/utilities/kses-post.d.ts +7 -0
- package/{lib/services/utilities/kses-post.ts → dist/services/utilities/kses-post.js} +1 -2
- package/dist/services/utilities/process-url.d.ts +7 -0
- package/{lib/services/utilities/process-url.ts → dist/services/utilities/process-url.js} +3 -4
- package/dist/template-heirarchy/_autoloader/template-autoloader.d.ts +9 -0
- package/{lib/template-heirarchy/_autoloader/template-autoloader.ts → dist/template-heirarchy/_autoloader/template-autoloader.js} +9 -18
- package/dist/template-heirarchy/archive/archive.d.ts +16 -0
- package/{lib/template-heirarchy/archive/archive.tsx → dist/template-heirarchy/archive/archive.js} +7 -10
- package/dist/template-heirarchy/archive/author.d.ts +16 -0
- package/{lib/template-heirarchy/archive/author.tsx → dist/template-heirarchy/archive/author.js} +7 -10
- package/dist/template-heirarchy/archive/category.d.ts +16 -0
- package/{lib/template-heirarchy/archive/category.tsx → dist/template-heirarchy/archive/category.js} +7 -11
- package/dist/template-heirarchy/archive/posttypearchive.d.ts +24 -0
- package/{lib/template-heirarchy/archive/posttypearchive.tsx → dist/template-heirarchy/archive/posttypearchive.js} +7 -10
- package/dist/template-heirarchy/archive/tag.d.ts +16 -0
- package/{lib/template-heirarchy/archive/tag.tsx → dist/template-heirarchy/archive/tag.js} +7 -12
- package/dist/template-heirarchy/archive/taxonomy.d.ts +16 -0
- package/{lib/template-heirarchy/archive/taxonomy.tsx → dist/template-heirarchy/archive/taxonomy.js} +7 -10
- package/dist/template-heirarchy/home/home.d.ts +16 -0
- package/{lib/template-heirarchy/home/home.tsx → dist/template-heirarchy/home/home.js} +7 -10
- package/dist/template-heirarchy/index.d.ts +17 -0
- package/{lib/template-heirarchy/index.tsx → dist/template-heirarchy/index.js} +5 -9
- package/dist/template-heirarchy/not-found.tsx/not-found.d.ts +16 -0
- package/{lib/template-heirarchy/not-found.tsx/not-found.tsx → dist/template-heirarchy/not-found.tsx/not-found.js} +7 -10
- package/dist/template-heirarchy/page/page.d.ts +16 -0
- package/{lib/template-heirarchy/page/page.tsx → dist/template-heirarchy/page/page.js} +7 -10
- package/dist/template-heirarchy/page/posttype.d.ts +24 -0
- package/{lib/template-heirarchy/page/posttype.tsx → dist/template-heirarchy/page/posttype.js} +7 -11
- package/dist/template-heirarchy/page/single.d.ts +16 -0
- package/{lib/template-heirarchy/page/single.tsx → dist/template-heirarchy/page/single.js} +7 -10
- package/dist/template-heirarchy/page/singular.d.ts +16 -0
- package/{lib/template-heirarchy/page/singular.tsx → dist/template-heirarchy/page/singular.js} +7 -10
- package/dist/ui/render-attachment-image.d.ts +12 -0
- package/dist/ui/render-attachment-image.js +24 -0
- package/{lib/ui/render-components.tsx → dist/ui/render-components.d.ts} +4 -7
- package/dist/ui/render-components.js +7 -0
- package/dist/ui/render-the-admin-bar.d.ts +8 -0
- package/dist/ui/render-the-admin-bar.js +36 -0
- package/dist/ui/render-the-logo.d.ts +10 -0
- package/dist/ui/render-the-logo.js +16 -0
- package/dist/wpdb/wpdb.d.ts +3 -0
- package/{lib/wpdb/wpdb.ts → dist/wpdb/wpdb.js} +5 -9
- package/package.json +7 -3
- package/lib/acf-functions/services/map-fields/helpers/map-choice-object.ts +0 -20
- package/lib/acf-functions/types/acf-field-group.d.ts +0 -118
- package/lib/acf-functions/types/acf-field.d.ts +0 -2851
- package/lib/acf-functions/types/acf-layout.d.ts +0 -20
- package/lib/acf-functions/types/acf-values.d.ts +0 -4
- package/lib/acf-functions/types/components/field-props.d.ts +0 -189
- package/lib/acf-functions/types/components/nextpress-component.d.ts +0 -11
- package/lib/ambient.d.ts +0 -15
- package/lib/entities/common.d.ts +0 -30
- package/lib/entities/option/option.interface.d.ts +0 -8
- package/lib/entities/post/post.interface.d.ts +0 -72
- package/lib/entities/post/post.ts +0 -209
- package/lib/entities/term/term.interface.d.ts +0 -8
- package/lib/entities/term/term.ts +0 -82
- package/lib/entities/user/user.interface.d.ts +0 -10
- package/lib/entities/user/user.ts +0 -86
- package/lib/globals/entity-loader/entity-loader.d.ts +0 -50
- package/lib/globals/entity-loader/option-loader.ts +0 -56
- package/lib/globals/entity-loader/post-loader.ts +0 -59
- package/lib/globals/entity-loader/term-loader.ts +0 -59
- package/lib/globals/entity-loader/user-loader.ts +0 -60
- package/lib/globals/get-field/get-field.ts +0 -75
- package/lib/globals/nextpress-config/nextpress-config.interface.d.ts +0 -18
- package/lib/globals/queried-object/queried-object.ts +0 -124
- package/lib/repository/optionquery/option-query-args.d.ts +0 -21
- package/lib/repository/optionquery/option-query.ts +0 -29
- package/lib/repository/postquery/post-query-args.d.ts +0 -108
- package/lib/repository/postquery/post-query.ts +0 -281
- package/lib/repository/termquery/term-query-args.d.ts +0 -61
- package/lib/repository/termquery/term-query.ts +0 -243
- package/lib/repository/userquery/user-query-args.d.ts +0 -75
- package/lib/router/routes/post-index-page.tsx +0 -58
- package/lib/router/routes/singular-page.tsx +0 -78
- package/lib/router/routes/site-front-page.tsx +0 -51
- package/lib/router/types.d.ts +0 -9
- package/lib/ui/render-attachment-image.tsx +0 -29
- package/lib/ui/render-the-admin-bar.tsx +0 -79
- package/lib/ui/render-the-logo.tsx +0 -24
- package/lib/wpdb/wpdb.interface.d.ts +0 -171
- /package/{lib/services/utilities/index.ts → dist/services/utilities/index.d.ts} +0 -0
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JSX } from "react";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
|
|
4
3
|
import { SingularMetadata, SingularTemplate } from "./singular";
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Loads the metadata for the Single template.
|
|
8
6
|
* Fallback: Singular
|
|
9
7
|
*
|
|
10
8
|
* @returns {Promise<Metadata>} The merged metadata object.
|
|
11
9
|
*/
|
|
12
|
-
export async function SingleMetadata()
|
|
10
|
+
export async function SingleMetadata() {
|
|
13
11
|
const metadata = await loadMetadata('Single');
|
|
14
|
-
return {
|
|
12
|
+
return Object.assign(Object.assign({}, (await SingularMetadata())), metadata);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
/**
|
|
18
15
|
* Renders the Single template. Falls back to the Singular template if not found.
|
|
19
16
|
* Fallback: Singular
|
|
20
17
|
*
|
|
21
18
|
* @returns {Promise<JSX.Element>} The rendered template component.
|
|
22
19
|
*/
|
|
23
|
-
export async function SingleTemplate()
|
|
20
|
+
export async function SingleTemplate() {
|
|
24
21
|
const Single = await loadTemplate('Single');
|
|
25
|
-
if (!Single)
|
|
26
|
-
|
|
27
|
-
return
|
|
22
|
+
if (!Single)
|
|
23
|
+
return _jsx(SingularTemplate, {});
|
|
24
|
+
return _jsx(Single, {});
|
|
28
25
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Metadata } from "next";
|
|
2
|
+
import { JSX } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Loads the metadata for the Singular template.
|
|
5
|
+
* Fallback: Index
|
|
6
|
+
*
|
|
7
|
+
* @returns {Promise<Metadata>} The merged metadata object.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SingularMetadata(): Promise<Metadata>;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the Singular template. Falls back to the Index template if not found.
|
|
12
|
+
* Fallback: Index
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<JSX.Element>} The rendered template component.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SingularTemplate(): Promise<JSX.Element>;
|
package/{lib/template-heirarchy/page/singular.tsx → dist/template-heirarchy/page/singular.js}
RENAMED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JSX } from "react";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
|
|
4
3
|
import { IndexMetadata, IndexTemplate } from "..";
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Loads the metadata for the Singular template.
|
|
8
6
|
* Fallback: Index
|
|
9
7
|
*
|
|
10
8
|
* @returns {Promise<Metadata>} The merged metadata object.
|
|
11
9
|
*/
|
|
12
|
-
export async function SingularMetadata()
|
|
10
|
+
export async function SingularMetadata() {
|
|
13
11
|
const metadata = await loadMetadata('Singular');
|
|
14
|
-
return {
|
|
12
|
+
return Object.assign(Object.assign({}, (await IndexMetadata())), metadata);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
/**
|
|
18
15
|
* Renders the Singular template. Falls back to the Index template if not found.
|
|
19
16
|
* Fallback: Index
|
|
20
17
|
*
|
|
21
18
|
* @returns {Promise<JSX.Element>} The rendered template component.
|
|
22
19
|
*/
|
|
23
|
-
export async function SingularTemplate()
|
|
20
|
+
export async function SingularTemplate() {
|
|
24
21
|
const Singular = await loadTemplate('Singular');
|
|
25
|
-
if (!Singular)
|
|
26
|
-
|
|
27
|
-
return
|
|
22
|
+
if (!Singular)
|
|
23
|
+
return _jsx(IndexTemplate, {});
|
|
24
|
+
return _jsx(Singular, Object.assign({}, queriedObject));
|
|
28
25
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClassValue } from "clsx";
|
|
2
|
+
import Image from "next/image";
|
|
3
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
4
|
+
type Props = Omit<ComponentPropsWithoutRef<typeof Image>, "src" | "alt" | "height" | "width"> & {
|
|
5
|
+
attachmentId: number;
|
|
6
|
+
className?: ClassValue;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Renders a WordPress media attachment using the Next.js Image component.
|
|
10
|
+
*/
|
|
11
|
+
export declare function RenderAttachmentImage({ attachmentId, className, ...rest }: Props): Promise<import("react").JSX.Element | undefined>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import Image from "next/image";
|
|
14
|
+
/**
|
|
15
|
+
* Renders a WordPress media attachment using the Next.js Image component.
|
|
16
|
+
*/
|
|
17
|
+
export async function RenderAttachmentImage(_a) {
|
|
18
|
+
var { attachmentId, className } = _a, rest = __rest(_a, ["attachmentId", "className"]);
|
|
19
|
+
const image = await getPost(attachmentId);
|
|
20
|
+
if (!image)
|
|
21
|
+
return;
|
|
22
|
+
const { src, alt, height, width } = image.imageAttributes;
|
|
23
|
+
return (_jsx(Image, Object.assign({ src: src || '', alt: alt || '', height: height, width: width, className: className }, rest)));
|
|
24
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { ResolvedFlexibleContent } from "../acf-functions/types/components/field-props";
|
|
2
|
-
|
|
3
2
|
type Props = {
|
|
4
|
-
layouts: ResolvedFlexibleContent<any
|
|
5
|
-
}
|
|
6
|
-
|
|
3
|
+
layouts: ResolvedFlexibleContent<any>;
|
|
4
|
+
};
|
|
7
5
|
/**
|
|
8
6
|
* Dynamically resolves and renders an array of mapped ACF Layout components from a resolved flexible content field.
|
|
9
7
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
export declare function RenderComponents({ layouts }: Props): Promise<import("react").JSX.Element[]>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Dynamically resolves and renders an array of mapped ACF Layout components from a resolved flexible content field.
|
|
4
|
+
*/
|
|
5
|
+
export async function RenderComponents({ layouts }) {
|
|
6
|
+
return layouts.map((layout, index) => _jsx(layout.Component, Object.assign({}, layout.content), index));
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
loggedInUserId?: number;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Renders the WordPress admin bar for authenticated administrators browsing the Next.js frontend.
|
|
6
|
+
*/
|
|
7
|
+
export declare function RenderTheAdminBar({ loggedInUserId }: Props): Promise<import("react").JSX.Element | null>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import Script from "next/script";
|
|
6
|
+
import { wpKsesPost } from "@/services/utilities/kses-post";
|
|
7
|
+
/**
|
|
8
|
+
* Renders the WordPress admin bar for authenticated administrators browsing the Next.js frontend.
|
|
9
|
+
*/
|
|
10
|
+
export async function RenderTheAdminBar({ loggedInUserId }) {
|
|
11
|
+
const [adminBar, setAdminBar] = useState(null);
|
|
12
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
13
|
+
const path = usePathname();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
fetch(`/api/admin-bar?user_id=${loggedInUserId}&path=${encodeURIComponent(path)}`)
|
|
16
|
+
.then((request) => {
|
|
17
|
+
if (!request.ok) {
|
|
18
|
+
throw new Error(`Failed to fetch admin bar: ${request.status}`);
|
|
19
|
+
}
|
|
20
|
+
return request.json();
|
|
21
|
+
})
|
|
22
|
+
.then((response) => {
|
|
23
|
+
setAdminBar(response);
|
|
24
|
+
setTimeout(() => setIsMounted(true), 50);
|
|
25
|
+
})
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
console.error("Failed to load admin bar", error.message);
|
|
28
|
+
});
|
|
29
|
+
}, [loggedInUserId, path]);
|
|
30
|
+
if (!adminBar) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx("link", { rel: "stylesheet", href: adminBar.assets.css.admin_bar, precedence: "high" }), _jsx("link", { rel: "stylesheet", href: adminBar.assets.css.dashicons, precedence: "high" }), _jsx(Script, { src: adminBar.assets.js.admin_bar }), _jsx("div", { className: `fixed top-0 left-0 right-0 transform transition-all duration-300 ease-in-out ${isMounted
|
|
34
|
+
? "scale-y-100"
|
|
35
|
+
: "scale-y-0"}`, children: wpKsesPost(adminBar.html) })] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
className?: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Renders the custom site logo defined in the WordPress Customizer.
|
|
6
|
+
*
|
|
7
|
+
* Fallback: Renders the text-based Site Title if no custom logo is assigned in WordPress.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RenderTheLogo({ className }: Props): Promise<import("react").JSX.Element>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getThemeMods } from "@/services/get-theme-mods";
|
|
3
|
+
import { getBlogname } from "@/services/metadata/get-blogname";
|
|
4
|
+
import { RenderAttachmentImage } from "./render-attachment-image";
|
|
5
|
+
/**
|
|
6
|
+
* Renders the custom site logo defined in the WordPress Customizer.
|
|
7
|
+
*
|
|
8
|
+
* Fallback: Renders the text-based Site Title if no custom logo is assigned in WordPress.
|
|
9
|
+
*/
|
|
10
|
+
export async function RenderTheLogo({ className }) {
|
|
11
|
+
var _a;
|
|
12
|
+
const logoId = (_a = Number(await getThemeMods('custom_logo'))) !== null && _a !== void 0 ? _a : 0;
|
|
13
|
+
return (_jsx("div", { className: className, children: logoId ?
|
|
14
|
+
_jsx(RenderAttachmentImage, { className: "h-full w-full object-contain object-center", attachmentId: logoId, sizes: "512px" })
|
|
15
|
+
: _jsx("span", { className: "text-4xl font-bold", children: await getBlogname() }) }));
|
|
16
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { CamelCasePlugin, DeduplicateJoinsPlugin, Kysely, MysqlDialect } from 'kysely'
|
|
4
|
-
|
|
1
|
+
import { createPool } from 'mysql2';
|
|
2
|
+
import { CamelCasePlugin, DeduplicateJoinsPlugin, Kysely, MysqlDialect } from 'kysely';
|
|
5
3
|
const dialect = new MysqlDialect({
|
|
6
4
|
pool: createPool({
|
|
7
5
|
user: 'root',
|
|
@@ -16,14 +14,12 @@ const dialect = new MysqlDialect({
|
|
|
16
14
|
enableKeepAlive: true,
|
|
17
15
|
keepAliveInitialDelay: 0,
|
|
18
16
|
}),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export const wpdb = new Kysely<DB>({
|
|
17
|
+
});
|
|
18
|
+
export const wpdb = new Kysely({
|
|
22
19
|
dialect,
|
|
23
20
|
plugins: [new CamelCasePlugin(), new DeduplicateJoinsPlugin()],
|
|
24
21
|
// log(event) {
|
|
25
22
|
// if (process.env.NODE_ENV !== 'development') return;
|
|
26
|
-
|
|
27
23
|
// if (event.level === 'query') {
|
|
28
24
|
// console.log(`\n[${event.queryDurationMillis.toFixed(2)}ms] QUERY EXECUTION`);
|
|
29
25
|
// console.log(`SQL: ${event.query.sql}`);
|
|
@@ -33,4 +29,4 @@ export const wpdb = new Kysely<DB>({
|
|
|
33
29
|
// console.error(`DB ERROR:`, event.error);
|
|
34
30
|
// }
|
|
35
31
|
// }
|
|
36
|
-
})
|
|
32
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextpress-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Nextpress Core",
|
|
5
5
|
"keywords": [],
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc"
|
|
8
|
+
},
|
|
6
9
|
"files": [
|
|
7
|
-
"
|
|
10
|
+
"dist"
|
|
8
11
|
],
|
|
9
12
|
"exports": {
|
|
10
13
|
"./*": {
|
|
11
|
-
"
|
|
14
|
+
"types": "./dist/*.d.ts",
|
|
15
|
+
"import": "./dist/*.js"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"author": "",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ACFChoiceObject } from "@/acf-functions/types/components/field-props";
|
|
2
|
-
|
|
3
|
-
export function mapChoiceObject(return_format: 'array' | 'label' | 'value', value?: string, choices?: Choices): ACFChoiceObject | string | undefined {
|
|
4
|
-
if (return_format === 'value') {
|
|
5
|
-
return value;
|
|
6
|
-
}
|
|
7
|
-
if (!choices) return;
|
|
8
|
-
|
|
9
|
-
const label = choices[value ?? ''];
|
|
10
|
-
|
|
11
|
-
if (return_format === 'array') {
|
|
12
|
-
const result: ACFChoiceObject = {
|
|
13
|
-
label: label,
|
|
14
|
-
value: value
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
} else if (return_format === 'label') {
|
|
18
|
-
return label;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
type TransformACFFieldGroup<T> = T extends any
|
|
2
|
-
? Omit<T, 'key' | 'fields'> &
|
|
3
|
-
('fields' extends keyof T ? { fields: NextpressField[] } : [])
|
|
4
|
-
: never;
|
|
5
|
-
|
|
6
|
-
/** ACF Field Group without key constraints to allow key generation */
|
|
7
|
-
type NextpressFieldGroup = TransformACFFieldGroup<ACFFieldGroup>
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Represents an Advanced Custom Fields (ACF) Field Group configuration.
|
|
11
|
-
*/
|
|
12
|
-
interface ACFFieldGroup {
|
|
13
|
-
/**
|
|
14
|
-
* Unique identifier for the field group with group_ prefix (e.g. 'group_abc123')
|
|
15
|
-
*/
|
|
16
|
-
key: string
|
|
17
|
-
/**
|
|
18
|
-
* The title/name of this entity
|
|
19
|
-
*/
|
|
20
|
-
title: string
|
|
21
|
-
/**
|
|
22
|
-
* Array of field definitions. If empty array, field group appears but contains no fields.
|
|
23
|
-
*/
|
|
24
|
-
fields: ACFField[]
|
|
25
|
-
/**
|
|
26
|
-
* The order of this entity in the admin menu
|
|
27
|
-
*/
|
|
28
|
-
menu_order?: number
|
|
29
|
-
/**
|
|
30
|
-
* [ACF] Whether this entity is active
|
|
31
|
-
*/
|
|
32
|
-
active?: boolean
|
|
33
|
-
/**
|
|
34
|
-
* [ACF Export Only] Unix timestamp of last modification
|
|
35
|
-
*/
|
|
36
|
-
modified?: number
|
|
37
|
-
/**
|
|
38
|
-
* Location rules determining where this field group appears. Array of rule groups (OR logic between groups, AND logic within groups). If omitted or empty, field group won't appear on any edit screens.
|
|
39
|
-
*/
|
|
40
|
-
location?: ACFLocationGroup[]
|
|
41
|
-
/**
|
|
42
|
-
* Position of the field group on the edit screen
|
|
43
|
-
*/
|
|
44
|
-
position?: "normal" | "side" | "acf_after_title"
|
|
45
|
-
/**
|
|
46
|
-
* Visual style of the field group metabox
|
|
47
|
-
*/
|
|
48
|
-
style?: "default" | "seamless"
|
|
49
|
-
/**
|
|
50
|
-
* Placement of field labels relative to fields
|
|
51
|
-
*/
|
|
52
|
-
label_placement?: "top" | "left"
|
|
53
|
-
/**
|
|
54
|
-
* Placement of field instructions
|
|
55
|
-
*/
|
|
56
|
-
instruction_placement?: "label" | "field"
|
|
57
|
-
/**
|
|
58
|
-
* Screen elements to hide when this field group is displayed
|
|
59
|
-
*/
|
|
60
|
-
hide_on_screen?: (
|
|
61
|
-
| "permalink"
|
|
62
|
-
| "the_content"
|
|
63
|
-
| "excerpt"
|
|
64
|
-
| "custom_fields"
|
|
65
|
-
| "discussion"
|
|
66
|
-
| "comments"
|
|
67
|
-
| "revisions"
|
|
68
|
-
| "slug"
|
|
69
|
-
| "author"
|
|
70
|
-
| "format"
|
|
71
|
-
| "page_attributes"
|
|
72
|
-
| "featured_image"
|
|
73
|
-
| "categories"
|
|
74
|
-
| "tags"
|
|
75
|
-
| "send-trackbacks"
|
|
76
|
-
)[]
|
|
77
|
-
/**
|
|
78
|
-
* Description of the field group
|
|
79
|
-
*/
|
|
80
|
-
description?: string
|
|
81
|
-
/**
|
|
82
|
-
* Whether to expose this field group's fields in the REST API
|
|
83
|
-
*/
|
|
84
|
-
show_in_rest?: boolean | number
|
|
85
|
-
/**
|
|
86
|
-
* Whether to expose this field group to AI integrations
|
|
87
|
-
*/
|
|
88
|
-
allow_ai_access?: boolean | number
|
|
89
|
-
/**
|
|
90
|
-
* Description that helps AI integrations understand how to use this field group
|
|
91
|
-
*/
|
|
92
|
-
ai_description?: string
|
|
93
|
-
/**
|
|
94
|
-
* Alternative display title for the field group
|
|
95
|
-
*/
|
|
96
|
-
display_title?: string
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Group of location rules (AND logic within group)
|
|
101
|
-
*/
|
|
102
|
-
type ACFLocationGroup = [ACFLocationRule, ...ACFLocationRule[]]
|
|
103
|
-
|
|
104
|
-
interface ACFLocationRule {
|
|
105
|
-
/**
|
|
106
|
-
* The parameter to compare (e.g. 'post_type', 'page_template', 'user_role')
|
|
107
|
-
*/
|
|
108
|
-
param: string
|
|
109
|
-
/**
|
|
110
|
-
* Comparison operator
|
|
111
|
-
*/
|
|
112
|
-
operator: "==" | "!="
|
|
113
|
-
/**
|
|
114
|
-
* Value to compare against
|
|
115
|
-
*/
|
|
116
|
-
value: string
|
|
117
|
-
[k: string]: unknown
|
|
118
|
-
}
|