@marvalt/wadapter 2.3.19 → 2.3.20
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/README.md +746 -62
- package/dist/client/wordpress-client.d.ts +14 -2
- package/dist/client/wordpress-client.d.ts.map +1 -1
- package/dist/generators/wordpress/wordpress-generator.d.ts +2 -0
- package/dist/generators/wordpress/wordpress-generator.d.ts.map +1 -1
- package/dist/generators.cjs +24 -4
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.esm.js +24 -4
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.d.ts +164 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +284 -51
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +294 -50
- package/dist/index.js.map +1 -1
- package/dist/react/hooks/useFrontpageSlug.d.ts +33 -0
- package/dist/react/hooks/useFrontpageSlug.d.ts.map +1 -0
- package/dist/static/wordpress-static.d.ts +31 -0
- package/dist/static/wordpress-static.d.ts.map +1 -1
- package/dist/utils/wordpress-menu.d.ts +84 -0
- package/dist/utils/wordpress-menu.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -15,8 +15,29 @@
|
|
|
15
15
|
* See the GNU General Public License for more details.
|
|
16
16
|
*/
|
|
17
17
|
import { WordPressPost, WordPressPage, WordPressMedia, WordPressCategory, WordPressTag } from '../types/wordpress';
|
|
18
|
+
export interface FrontPageMetadata {
|
|
19
|
+
id: number;
|
|
20
|
+
slug: string;
|
|
21
|
+
title: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SiteSettings {
|
|
24
|
+
logo?: {
|
|
25
|
+
id: number;
|
|
26
|
+
url: string;
|
|
27
|
+
cloudflare_url?: string;
|
|
28
|
+
};
|
|
29
|
+
site_icon?: {
|
|
30
|
+
id: number;
|
|
31
|
+
url: string;
|
|
32
|
+
cloudflare_url?: string;
|
|
33
|
+
};
|
|
34
|
+
site_name?: string;
|
|
35
|
+
site_description?: string;
|
|
36
|
+
}
|
|
18
37
|
export interface WordPressStaticData {
|
|
19
38
|
generatedAt?: string;
|
|
39
|
+
front_page?: FrontPageMetadata;
|
|
40
|
+
site_settings?: SiteSettings;
|
|
20
41
|
posts: WordPressPost[];
|
|
21
42
|
pages: WordPressPage[];
|
|
22
43
|
media: WordPressMedia[];
|
|
@@ -30,4 +51,14 @@ export declare function getWordPressPages(): WordPressPage[];
|
|
|
30
51
|
export declare function getWordPressMedia(): WordPressMedia[];
|
|
31
52
|
export declare function getWordPressCategories(): WordPressCategory[];
|
|
32
53
|
export declare function getWordPressTags(): WordPressTag[];
|
|
54
|
+
/**
|
|
55
|
+
* Get frontpage metadata from static data
|
|
56
|
+
* This is set by the generator based on WordPress Reading Settings or slug 'frontpage'
|
|
57
|
+
*/
|
|
58
|
+
export declare function getFrontpageMetadata(): FrontPageMetadata | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Get site settings (logo, site icon, site name, description) from static data
|
|
61
|
+
* This is set by the generator from WordPress theme mods and options
|
|
62
|
+
*/
|
|
63
|
+
export declare function getSiteSettings(): SiteSettings | undefined;
|
|
33
64
|
//# sourceMappingURL=wordpress-static.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wordpress-static.d.ts","sourceRoot":"","sources":["../../src/static/wordpress-static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAID,wBAAsB,iBAAiB,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E,CAAC;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAID,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAA+B,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CASlH;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,IAAI,cAAc,EAAE,CAEpD;AAED,wBAAgB,sBAAsB,IAAI,iBAAiB,EAAE,CAE5D;AAED,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAEjD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,GAAG,SAAS,CAEpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CAE1D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license GPL-3.0-or-later
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the MarVAlt Open SDK.
|
|
5
|
+
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
15
|
+
* See the GNU General Public License for more details.
|
|
16
|
+
*/
|
|
17
|
+
import { WordPressPage } from '../types/wordpress';
|
|
18
|
+
/**
|
|
19
|
+
* Menu item structure for navigation menus
|
|
20
|
+
*/
|
|
21
|
+
export interface MenuItem {
|
|
22
|
+
id: number;
|
|
23
|
+
title: string;
|
|
24
|
+
slug: string;
|
|
25
|
+
url: string;
|
|
26
|
+
children?: MenuItem[];
|
|
27
|
+
menuOrder: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get root pages (pages with parent = 0)
|
|
31
|
+
* Sorted by menu_order
|
|
32
|
+
*/
|
|
33
|
+
export declare function getRootPages(pages: WordPressPage[]): WordPressPage[];
|
|
34
|
+
/**
|
|
35
|
+
* Get child pages of a specific parent
|
|
36
|
+
* Sorted by menu_order
|
|
37
|
+
*/
|
|
38
|
+
export declare function getChildPages(pages: WordPressPage[], parentId: number): WordPressPage[];
|
|
39
|
+
/**
|
|
40
|
+
* Build hierarchical page structure
|
|
41
|
+
* Returns pages with nested children arrays
|
|
42
|
+
*/
|
|
43
|
+
export interface HierarchicalPage extends WordPressPage {
|
|
44
|
+
children?: HierarchicalPage[];
|
|
45
|
+
}
|
|
46
|
+
export declare function buildPageHierarchy(pages: WordPressPage[]): HierarchicalPage[];
|
|
47
|
+
/**
|
|
48
|
+
* Build menu structure from WordPress pages
|
|
49
|
+
* Converts WordPress pages to a generic menu structure
|
|
50
|
+
*
|
|
51
|
+
* @param pages - Array of WordPress pages
|
|
52
|
+
* @param baseUrl - Base URL for building page URLs (default: '/')
|
|
53
|
+
* @param filterPublished - Only include published pages (default: true)
|
|
54
|
+
* @returns Array of menu items with nested children
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildMenuStructure(pages: WordPressPage[], baseUrl?: string, filterPublished?: boolean): MenuItem[];
|
|
57
|
+
/**
|
|
58
|
+
* Find a page by slug
|
|
59
|
+
*/
|
|
60
|
+
export declare function findPageBySlug(pages: WordPressPage[], slug: string): WordPressPage | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Find a page by ID
|
|
63
|
+
*/
|
|
64
|
+
export declare function findPageById(pages: WordPressPage[], id: number): WordPressPage | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Get frontpage (page with slug 'frontpage' or 'home')
|
|
67
|
+
* Useful for determining homepage content
|
|
68
|
+
*/
|
|
69
|
+
export declare function getFrontpage(pages: WordPressPage[]): WordPressPage | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Get frontpage slug using standardized approach
|
|
72
|
+
*
|
|
73
|
+
* Priority:
|
|
74
|
+
* 1. front_page metadata from generator (WordPress Reading Settings or slug 'frontpage')
|
|
75
|
+
* 2. Fallback to getFrontpage() utility (slug check: 'frontpage', 'home', '')
|
|
76
|
+
*
|
|
77
|
+
* @param pages - Array of WordPress pages (optional, used for fallback)
|
|
78
|
+
* @param frontPageMetadata - Frontpage metadata from static data (optional)
|
|
79
|
+
* @returns Frontpage slug string, or undefined if not found
|
|
80
|
+
*/
|
|
81
|
+
export declare function getFrontpageSlug(pages?: WordPressPage[], frontPageMetadata?: {
|
|
82
|
+
slug: string;
|
|
83
|
+
} | undefined): string | undefined;
|
|
84
|
+
//# sourceMappingURL=wordpress-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordpress-menu.d.ts","sourceRoot":"","sources":["../../src/utils/wordpress-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAIpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC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