@marvalt/wadapter 2.3.26 → 2.3.27
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/client/wordpress-client.d.ts +0 -34
- package/dist/client/wordpress-client.d.ts.map +1 -1
- package/dist/generators/wordpress/wordpress-generator.d.ts +1 -24
- package/dist/generators/wordpress/wordpress-generator.d.ts.map +1 -1
- package/dist/generators.cjs +1 -396
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.esm.js +3 -398
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.d.ts +2 -122
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -146
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +0 -151
- package/dist/index.js.map +1 -1
- package/dist/static/wordpress-static.d.ts +0 -36
- package/dist/static/wordpress-static.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils/imageDownloader.d.ts +0 -33
- package/dist/utils/imageDownloader.d.ts.map +0 -1
- package/dist/utils/theme-styles.d.ts +0 -50
- package/dist/utils/theme-styles.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -265,13 +265,6 @@ class WordPressClient {
|
|
|
265
265
|
async getSettings() {
|
|
266
266
|
return this.makeRequest('/wp-custom/v1/settings');
|
|
267
267
|
}
|
|
268
|
-
/**
|
|
269
|
-
* Fetch Theme Styles from custom endpoint
|
|
270
|
-
* @returns Theme customization settings (typography, colors, backgrounds, shadows, layout)
|
|
271
|
-
*/
|
|
272
|
-
async getThemeStyles() {
|
|
273
|
-
return this.makeRequest('/wp-custom/v1/theme-styles');
|
|
274
|
-
}
|
|
275
268
|
}
|
|
276
269
|
|
|
277
270
|
/**
|
|
@@ -764,13 +757,6 @@ function getFrontpageMetadata() {
|
|
|
764
757
|
function getSiteSettings() {
|
|
765
758
|
return wordpressStaticData?.site_settings;
|
|
766
759
|
}
|
|
767
|
-
/**
|
|
768
|
-
* Get theme styles (typography, colors, backgrounds, shadows, layout) from static data
|
|
769
|
-
* This is set by the generator from WordPress Customizer settings
|
|
770
|
-
*/
|
|
771
|
-
function getThemeStyles() {
|
|
772
|
-
return wordpressStaticData?.theme_styles;
|
|
773
|
-
}
|
|
774
760
|
|
|
775
761
|
/**
|
|
776
762
|
* @license GPL-3.0-or-later
|
|
@@ -2745,138 +2731,6 @@ function validateFormData(formData, rules) {
|
|
|
2745
2731
|
return { isValid, errors };
|
|
2746
2732
|
}
|
|
2747
2733
|
|
|
2748
|
-
/**
|
|
2749
|
-
* @license GPL-3.0-or-later
|
|
2750
|
-
*
|
|
2751
|
-
* This file is part of the MarVAlt Open SDK.
|
|
2752
|
-
* Copyright (c) 2025 Vibune Pty Ltd.
|
|
2753
|
-
*
|
|
2754
|
-
* This program is free software: you can redistribute it and/or modify
|
|
2755
|
-
* it under the terms of the GNU General Public License as published by
|
|
2756
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
2757
|
-
* (at your option) any later version.
|
|
2758
|
-
*
|
|
2759
|
-
* This program is distributed in the hope that it will be useful,
|
|
2760
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
2761
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
2762
|
-
* See the GNU General Public License for more details.
|
|
2763
|
-
*/
|
|
2764
|
-
/**
|
|
2765
|
-
* List of popular Google Fonts (for detection and validation)
|
|
2766
|
-
*/
|
|
2767
|
-
const GOOGLE_FONTS = [
|
|
2768
|
-
'Montserrat',
|
|
2769
|
-
'Open Sans',
|
|
2770
|
-
'Roboto',
|
|
2771
|
-
'Lato',
|
|
2772
|
-
'Poppins',
|
|
2773
|
-
'Source Sans Pro',
|
|
2774
|
-
'Raleway',
|
|
2775
|
-
'Oswald',
|
|
2776
|
-
'Playfair Display',
|
|
2777
|
-
'Merriweather',
|
|
2778
|
-
'Ubuntu',
|
|
2779
|
-
'Nunito',
|
|
2780
|
-
'Inter',
|
|
2781
|
-
'Work Sans',
|
|
2782
|
-
'Crimson Text',
|
|
2783
|
-
'Libre Baskerville',
|
|
2784
|
-
'PT Sans',
|
|
2785
|
-
'PT Serif',
|
|
2786
|
-
'Dancing Script',
|
|
2787
|
-
'Bebas Neue',
|
|
2788
|
-
'Fira Sans',
|
|
2789
|
-
'Noto Sans',
|
|
2790
|
-
'Noto Serif',
|
|
2791
|
-
'Rubik',
|
|
2792
|
-
'Mukta',
|
|
2793
|
-
'Cabin',
|
|
2794
|
-
'Dosis',
|
|
2795
|
-
'Arimo',
|
|
2796
|
-
'Titillium Web',
|
|
2797
|
-
];
|
|
2798
|
-
/**
|
|
2799
|
-
* Sanitize font name - removes "family" prefix and cleans the name
|
|
2800
|
-
*
|
|
2801
|
-
* @param fontName - Font name to sanitize
|
|
2802
|
-
* @returns Sanitized font name
|
|
2803
|
-
*/
|
|
2804
|
-
function sanitizeFontName(fontName) {
|
|
2805
|
-
if (!fontName)
|
|
2806
|
-
return '';
|
|
2807
|
-
// Remove "family" prefix if present (case insensitive)
|
|
2808
|
-
let cleaned = fontName.replace(/^family\s*/i, '').trim();
|
|
2809
|
-
return cleaned;
|
|
2810
|
-
}
|
|
2811
|
-
/**
|
|
2812
|
-
* Format font-family CSS value with quotes and fallback
|
|
2813
|
-
*
|
|
2814
|
-
* @param fontName - Font name to format
|
|
2815
|
-
* @param fallback - Fallback font (default: 'sans-serif')
|
|
2816
|
-
* @returns Formatted font-family CSS value
|
|
2817
|
-
*/
|
|
2818
|
-
function formatFontFamily(fontName, fallback = 'sans-serif') {
|
|
2819
|
-
if (!fontName)
|
|
2820
|
-
return fallback;
|
|
2821
|
-
const cleaned = sanitizeFontName(fontName);
|
|
2822
|
-
if (!cleaned)
|
|
2823
|
-
return fallback;
|
|
2824
|
-
// If font name contains spaces, wrap in quotes
|
|
2825
|
-
const quotedFont = cleaned.includes(' ') ? `"${cleaned}"` : cleaned;
|
|
2826
|
-
return `${quotedFont}, ${fallback}`;
|
|
2827
|
-
}
|
|
2828
|
-
/**
|
|
2829
|
-
* Load Google Font dynamically via link tag
|
|
2830
|
-
*
|
|
2831
|
-
* @param fontName - Google Font name to load
|
|
2832
|
-
* @param weights - Font weights to load (default: 400, 500, 600, 700)
|
|
2833
|
-
*/
|
|
2834
|
-
function loadGoogleFont(fontName, weights = [400, 500, 600, 700]) {
|
|
2835
|
-
if (typeof document === 'undefined') {
|
|
2836
|
-
// Server-side rendering - skip
|
|
2837
|
-
return;
|
|
2838
|
-
}
|
|
2839
|
-
if (!fontName)
|
|
2840
|
-
return;
|
|
2841
|
-
const cleaned = sanitizeFontName(fontName);
|
|
2842
|
-
if (!cleaned)
|
|
2843
|
-
return;
|
|
2844
|
-
// Check if it's a Google Font
|
|
2845
|
-
const isGoogleFont = GOOGLE_FONTS.some(font => font.toLowerCase() === cleaned.toLowerCase());
|
|
2846
|
-
if (!isGoogleFont) {
|
|
2847
|
-
// Not a Google Font, assume it's a system font or custom font
|
|
2848
|
-
return;
|
|
2849
|
-
}
|
|
2850
|
-
// Check if font is already loaded
|
|
2851
|
-
const fontId = `wp-google-font-${cleaned.toLowerCase().replace(/\s+/g, '-')}`;
|
|
2852
|
-
if (document.getElementById(fontId)) {
|
|
2853
|
-
return; // Already loaded
|
|
2854
|
-
}
|
|
2855
|
-
// Create link element for Google Fonts
|
|
2856
|
-
const link = document.createElement('link');
|
|
2857
|
-
link.id = fontId;
|
|
2858
|
-
link.rel = 'stylesheet';
|
|
2859
|
-
// Build Google Fonts URL with weights
|
|
2860
|
-
const weightsParam = weights.join(';');
|
|
2861
|
-
link.href = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(cleaned)}:wght@${weightsParam}&display=swap`;
|
|
2862
|
-
document.head.appendChild(link);
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* Check if a font name is a Google Font
|
|
2866
|
-
*
|
|
2867
|
-
* @param fontName - Font name to check
|
|
2868
|
-
* @returns True if the font is a Google Font
|
|
2869
|
-
*/
|
|
2870
|
-
function isGoogleFont(fontName) {
|
|
2871
|
-
if (!fontName)
|
|
2872
|
-
return false;
|
|
2873
|
-
const cleaned = sanitizeFontName(fontName);
|
|
2874
|
-
if (!cleaned)
|
|
2875
|
-
return false;
|
|
2876
|
-
return GOOGLE_FONTS.some(font => font.toLowerCase() === cleaned.toLowerCase());
|
|
2877
|
-
}
|
|
2878
|
-
|
|
2879
|
-
exports.GOOGLE_FONTS = GOOGLE_FONTS;
|
|
2880
2734
|
exports.GravityForm = GravityForm;
|
|
2881
2735
|
exports.GravityFormsClient = GravityFormsClient;
|
|
2882
2736
|
exports.GravityFormsProvider = GravityFormsProvider;
|
|
@@ -2890,7 +2744,6 @@ exports.createGravityFormsConfig = createGravityFormsConfig;
|
|
|
2890
2744
|
exports.createWordPressConfig = createWordPressConfig;
|
|
2891
2745
|
exports.findPageById = findPageById;
|
|
2892
2746
|
exports.findPageBySlug = findPageBySlug;
|
|
2893
|
-
exports.formatFontFamily = formatFontFamily;
|
|
2894
2747
|
exports.getActiveForms = getActiveForms;
|
|
2895
2748
|
exports.getChildPages = getChildPages;
|
|
2896
2749
|
exports.getFormById = getFormById;
|
|
@@ -2900,7 +2753,6 @@ exports.getFrontpageSlug = getFrontpageSlug;
|
|
|
2900
2753
|
exports.getPublishedForms = getPublishedForms;
|
|
2901
2754
|
exports.getRootPages = getRootPages;
|
|
2902
2755
|
exports.getSiteSettings = getSiteSettings;
|
|
2903
|
-
exports.getThemeStyles = getThemeStyles;
|
|
2904
2756
|
exports.getWordPressCategories = getWordPressCategories;
|
|
2905
2757
|
exports.getWordPressMedia = getWordPressMedia;
|
|
2906
2758
|
exports.getWordPressPages = getWordPressPages;
|
|
@@ -2908,11 +2760,8 @@ exports.getWordPressPosts = getWordPressPosts;
|
|
|
2908
2760
|
exports.getWordPressTags = getWordPressTags;
|
|
2909
2761
|
exports.hasGravityFormsStatic = hasGravityFormsStatic;
|
|
2910
2762
|
exports.hasWordPressStatic = hasWordPressStatic;
|
|
2911
|
-
exports.isGoogleFont = isGoogleFont;
|
|
2912
|
-
exports.loadGoogleFont = loadGoogleFont;
|
|
2913
2763
|
exports.loadGravityFormsData = loadGravityFormsData;
|
|
2914
2764
|
exports.loadWordPressData = loadWordPressData;
|
|
2915
|
-
exports.sanitizeFontName = sanitizeFontName;
|
|
2916
2765
|
exports.sanitizeHtml = sanitizeHtml;
|
|
2917
2766
|
exports.transformWordPressMedia = transformWordPressMedia;
|
|
2918
2767
|
exports.transformWordPressMediaItems = transformWordPressMediaItems;
|