@marvalt/wadapter 2.3.19 → 2.3.21

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.
@@ -15,8 +15,59 @@
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
+ }
37
+ export interface ThemeStyles {
38
+ typography?: {
39
+ heading_font_family?: string;
40
+ body_font_family?: string;
41
+ base_font_size?: string;
42
+ line_height?: string;
43
+ };
44
+ colors?: {
45
+ primary?: string;
46
+ secondary?: string;
47
+ text?: string;
48
+ background?: string;
49
+ };
50
+ backgrounds?: {
51
+ image?: string;
52
+ repeat?: string;
53
+ position?: string;
54
+ size?: string;
55
+ };
56
+ shadows?: {
57
+ box_shadow?: string;
58
+ text_shadow?: string;
59
+ };
60
+ layout?: {
61
+ container_max_width?: string;
62
+ wide_container_max_width?: string;
63
+ content_padding?: string;
64
+ };
65
+ }
18
66
  export interface WordPressStaticData {
19
67
  generatedAt?: string;
68
+ front_page?: FrontPageMetadata;
69
+ site_settings?: SiteSettings;
70
+ theme_styles?: ThemeStyles;
20
71
  posts: WordPressPost[];
21
72
  pages: WordPressPage[];
22
73
  media: WordPressMedia[];
@@ -30,4 +81,19 @@ export declare function getWordPressPages(): WordPressPage[];
30
81
  export declare function getWordPressMedia(): WordPressMedia[];
31
82
  export declare function getWordPressCategories(): WordPressCategory[];
32
83
  export declare function getWordPressTags(): WordPressTag[];
84
+ /**
85
+ * Get frontpage metadata from static data
86
+ * This is set by the generator based on WordPress Reading Settings or slug 'frontpage'
87
+ */
88
+ export declare function getFrontpageMetadata(): FrontPageMetadata | undefined;
89
+ /**
90
+ * Get site settings (logo, site icon, site name, description) from static data
91
+ * This is set by the generator from WordPress theme mods and options
92
+ */
93
+ export declare function getSiteSettings(): SiteSettings | undefined;
94
+ /**
95
+ * Get theme styles (typography, colors, backgrounds, shadows, layout) from static data
96
+ * This is set by the generator from WordPress Customizer settings
97
+ */
98
+ export declare function getThemeStyles(): ThemeStyles | undefined;
33
99
  //# 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,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"}
1
+ {"version":3,"file":"wordpress-static.d.ts","sourceRoot":"","sources":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-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,KAAK,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAIvF;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,gBAAgB,EAAE,CAoC7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,GAAE,MAAY,EACrB,eAAe,GAAE,OAAc,GAC9B,QAAQ,EAAE,CAgCZ;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE9F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE1F;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,SAAS,CAM9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,aAAa,EAAE,EACvB,iBAAiB,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC/C,MAAM,GAAG,SAAS,CAapB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marvalt/wadapter",
3
- "version": "2.3.19",
3
+ "version": "2.3.21",
4
4
  "description": "WordPress and Gravity Forms integration package for React applications with static data generation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",