@deneb-ui/ui 2.0.119 → 2.0.121
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/DenebImage.d.ts +24 -0
- package/dist/DenebImage.js +60 -0
- package/dist/EditableFooter.js +3 -3
- package/dist/EditableNavbar.d.ts +12 -1
- package/dist/EditableNavbar.js +44 -21
- package/dist/SiteDataProvider.d.ts +6 -0
- package/dist/SiteDataProvider.js +35 -30
- package/dist/ThemeStyles.js +14 -69
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/dist/utils/urls.d.ts +5 -0
- package/dist/utils/urls.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DenebImageAspectRatio = 'square' | '1/1' | 'video' | '16/9' | 'portrait' | '3/4' | '4/3' | '2/3' | '21/9' | (string & {});
|
|
3
|
+
export type DenebImageRadius = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | (string & {});
|
|
4
|
+
export declare const DEFAULT_IMAGE_FALLBACK_SVG = "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"600\" height=\"400\" viewBox=\"0 0 600 400\" fill=\"none\"><rect width=\"600\" height=\"400\" fill=\"%23f1f5f9\"/><path d=\"M250 180a30 30 0 100-60 30 30 0 000 60zM170 300l80-90 60 70 70-100 90 120H170z\" fill=\"%23cbd5e1\"/></svg>";
|
|
5
|
+
export interface DenebImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> {
|
|
6
|
+
id?: string;
|
|
7
|
+
'data-preview-field-path'?: string;
|
|
8
|
+
src?: string | null;
|
|
9
|
+
fallbackSrc?: string;
|
|
10
|
+
aspectRatio?: DenebImageAspectRatio;
|
|
11
|
+
radius?: DenebImageRadius;
|
|
12
|
+
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
13
|
+
hoverZoom?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Universal auto-resolving image component for DENEB & Fivora templates.
|
|
17
|
+
*
|
|
18
|
+
* - Automatically prepends NEXT_PUBLIC_SITE_BASE_PATH to local assets
|
|
19
|
+
* - Preserves remote URLs (https://..., http://..., data:...)
|
|
20
|
+
* - Safely guards against empty string ("") triggers
|
|
21
|
+
* - Gracefully falls back to fallbackSrc or placeholder on error or missing src
|
|
22
|
+
*/
|
|
23
|
+
export declare function DenebImage({ id, 'data-preview-field-path': previewFieldPath, src, fallbackSrc, alt, aspectRatio, radius, fit, hoverZoom, style, className, onError, ...props }: DenebImageProps): React.JSX.Element;
|
|
24
|
+
export { DenebImage as SafeImage };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_IMAGE_FALLBACK_SVG = void 0;
|
|
4
|
+
exports.DenebImage = DenebImage;
|
|
5
|
+
exports.SafeImage = DenebImage;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const ASPECT_MAP = {
|
|
10
|
+
square: '1 / 1',
|
|
11
|
+
'1/1': '1 / 1',
|
|
12
|
+
video: '16 / 9',
|
|
13
|
+
'16/9': '16 / 9',
|
|
14
|
+
portrait: '3 / 4',
|
|
15
|
+
'3/4': '3 / 4',
|
|
16
|
+
'4/3': '4 / 3',
|
|
17
|
+
'2/3': '2 / 3',
|
|
18
|
+
'21/9': '21 / 9',
|
|
19
|
+
};
|
|
20
|
+
const RADIUS_MAP = {
|
|
21
|
+
none: '0px',
|
|
22
|
+
sm: '4px',
|
|
23
|
+
md: '8px',
|
|
24
|
+
lg: '12px',
|
|
25
|
+
xl: '16px',
|
|
26
|
+
'2xl': '24px',
|
|
27
|
+
full: '9999px',
|
|
28
|
+
};
|
|
29
|
+
exports.DEFAULT_IMAGE_FALLBACK_SVG = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400" viewBox="0 0 600 400" fill="none"><rect width="600" height="400" fill="%23f1f5f9"/><path d="M250 180a30 30 0 100-60 30 30 0 000 60zM170 300l80-90 60 70 70-100 90 120H170z" fill="%23cbd5e1"/></svg>';
|
|
30
|
+
/**
|
|
31
|
+
* Universal auto-resolving image component for DENEB & Fivora templates.
|
|
32
|
+
*
|
|
33
|
+
* - Automatically prepends NEXT_PUBLIC_SITE_BASE_PATH to local assets
|
|
34
|
+
* - Preserves remote URLs (https://..., http://..., data:...)
|
|
35
|
+
* - Safely guards against empty string ("") triggers
|
|
36
|
+
* - Gracefully falls back to fallbackSrc or placeholder on error or missing src
|
|
37
|
+
*/
|
|
38
|
+
function DenebImage({ id, 'data-preview-field-path': previewFieldPath, src, fallbackSrc = exports.DEFAULT_IMAGE_FALLBACK_SVG, alt = '', aspectRatio, radius, fit = 'cover', hoverZoom = false, style, className = '', onError, ...props }) {
|
|
39
|
+
const [hasError, setHasError] = (0, react_1.useState)(false);
|
|
40
|
+
const path = previewFieldPath || id;
|
|
41
|
+
const resolvedAspect = aspectRatio ? (ASPECT_MAP[aspectRatio] || aspectRatio) : undefined;
|
|
42
|
+
const resolvedRadius = radius ? (RADIUS_MAP[radius] || radius) : undefined;
|
|
43
|
+
const combinedStyle = {
|
|
44
|
+
...(resolvedAspect ? { aspectRatio: resolvedAspect } : {}),
|
|
45
|
+
...(resolvedRadius ? { borderRadius: resolvedRadius } : {}),
|
|
46
|
+
...(fit ? { objectFit: fit } : {}),
|
|
47
|
+
...(hoverZoom ? { transition: 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)' } : {}),
|
|
48
|
+
...style,
|
|
49
|
+
};
|
|
50
|
+
const rawSrc = hasError || !src || (typeof src === 'string' && src.trim() === '')
|
|
51
|
+
? fallbackSrc
|
|
52
|
+
: src;
|
|
53
|
+
const finalSrc = typeof rawSrc === 'string' ? (0, utils_1.withBasePath)(rawSrc) : rawSrc;
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)("img", { "data-preview-field-path": path, src: finalSrc, alt: alt, style: combinedStyle, className: `deneb-image ${hoverZoom ? 'hover:scale-105' : ''} ${className}`.trim(), onError: (e) => {
|
|
55
|
+
if (!hasError && fallbackSrc && finalSrc !== (0, utils_1.withBasePath)(fallbackSrc)) {
|
|
56
|
+
setHasError(true);
|
|
57
|
+
}
|
|
58
|
+
onError?.(e);
|
|
59
|
+
}, ...props }));
|
|
60
|
+
}
|
package/dist/EditableFooter.js
CHANGED
|
@@ -153,9 +153,9 @@ function EditableFooter({ defaultLinks = DEFAULT_FOOTER_PAGES, links, basePath =
|
|
|
153
153
|
return ((0, jsx_runtime_1.jsxs)("footer", { style: {
|
|
154
154
|
position: 'relative',
|
|
155
155
|
width: '100%',
|
|
156
|
-
backgroundColor: '#020617',
|
|
157
|
-
color: '#f8fafc',
|
|
158
|
-
borderTop: '1px solid rgba(255, 255, 255, 0.08)',
|
|
156
|
+
backgroundColor: 'var(--footer-bg, var(--page-background, #020617))',
|
|
157
|
+
color: 'var(--color-text, #f8fafc)',
|
|
158
|
+
borderTop: '1px solid var(--color-border, rgba(255, 255, 255, 0.08))',
|
|
159
159
|
padding: '4.5rem 1.5rem 2rem',
|
|
160
160
|
...style,
|
|
161
161
|
}, className: `deneb-footer relative w-full border-t border-slate-800/80 bg-slate-950 text-slate-100 ${className}`.trim(), ...props, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
package/dist/EditableNavbar.d.ts
CHANGED
|
@@ -9,6 +9,17 @@ export interface EditableNavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
9
9
|
sticky?: boolean;
|
|
10
10
|
activeRoute?: string;
|
|
11
11
|
basePath?: string;
|
|
12
|
+
showSearch?: boolean;
|
|
13
|
+
searchFieldPath?: string;
|
|
14
|
+
searchLabel?: string;
|
|
15
|
+
onSearchClick?: () => void;
|
|
16
|
+
searchUrl?: string;
|
|
17
|
+
showCart?: boolean;
|
|
18
|
+
cartCount?: number;
|
|
19
|
+
onCartClick?: () => void;
|
|
20
|
+
showWishlist?: boolean;
|
|
21
|
+
wishlistCount?: number;
|
|
22
|
+
onWishlistClick?: () => void;
|
|
12
23
|
}
|
|
13
24
|
/**
|
|
14
25
|
* Next-Level DENEB UI Navbar / Header
|
|
@@ -23,6 +34,6 @@ export interface EditableNavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
23
34
|
*
|
|
24
35
|
* Created by Chamika Gayashan & Induranga Kawishwara
|
|
25
36
|
*/
|
|
26
|
-
export declare function EditableNavbar({ defaultLinks, sticky, activeRoute, basePath, className, style, ...props }: EditableNavbarProps): React.JSX.Element;
|
|
37
|
+
export declare function EditableNavbar({ defaultLinks, sticky, activeRoute, basePath, showSearch, searchFieldPath, searchLabel: customSearchLabel, onSearchClick, searchUrl, showCart, cartCount, onCartClick, showWishlist, wishlistCount, onWishlistClick, className, style, ...props }: EditableNavbarProps): React.JSX.Element;
|
|
27
38
|
export declare const Navbar: typeof EditableNavbar;
|
|
28
39
|
export declare const Header: typeof EditableNavbar;
|
package/dist/EditableNavbar.js
CHANGED
|
@@ -25,7 +25,7 @@ const DEFAULT_PAGES = [
|
|
|
25
25
|
*
|
|
26
26
|
* Created by Chamika Gayashan & Induranga Kawishwara
|
|
27
27
|
*/
|
|
28
|
-
function EditableNavbar({ defaultLinks = DEFAULT_PAGES, sticky = true, activeRoute, basePath =
|
|
28
|
+
function EditableNavbar({ defaultLinks = DEFAULT_PAGES, sticky = true, activeRoute, basePath = "", showSearch = true, searchFieldPath = "common.header.searchFramesLabel", searchLabel: customSearchLabel, onSearchClick, searchUrl = "/shop", showCart = false, cartCount, onCartClick, showWishlist = false, wishlistCount, onWishlistClick, className = "", style, ...props }) {
|
|
29
29
|
const siteData = (0, SiteDataProvider_1.useSiteData)();
|
|
30
30
|
const [mobileMenuOpen, setMobileMenuOpen] = (0, react_1.useState)(false);
|
|
31
31
|
const content = (siteData?.content || {});
|
|
@@ -35,6 +35,11 @@ function EditableNavbar({ defaultLinks = DEFAULT_PAGES, sticky = true, activeRou
|
|
|
35
35
|
const logoUrl = String(common?.logoUrl || shop?.logoUrl || '');
|
|
36
36
|
const headerCtaLabel = String(common?.headerCtaLabel || 'Get in Touch');
|
|
37
37
|
const navLabels = (common?.navLabels || {});
|
|
38
|
+
const searchLabel = String(customSearchLabel ||
|
|
39
|
+
common?.header?.searchFramesLabel ||
|
|
40
|
+
common?.searchFramesLabel ||
|
|
41
|
+
common?.searchPlaceholder ||
|
|
42
|
+
"Search frames");
|
|
38
43
|
const requiredPages = Array.isArray(siteData?.requirements?.requiredPages)
|
|
39
44
|
? siteData.requirements.requiredPages
|
|
40
45
|
: siteData?.template?.structure?.pages || ['home', 'contact'];
|
|
@@ -98,28 +103,46 @@ function EditableNavbar({ defaultLinks = DEFAULT_PAGES, sticky = true, activeRou
|
|
|
98
103
|
fontWeight: 700,
|
|
99
104
|
letterSpacing: '-0.025em',
|
|
100
105
|
color: 'var(--color-text, #0f172a)',
|
|
101
|
-
}, className: "deneb-site-title text-xl font-bold tracking-tight text-slate-900 dark:text-white", children: siteName })] }), (0, jsx_runtime_1.
|
|
106
|
+
}, className: "deneb-site-title text-xl font-bold tracking-tight text-slate-900 dark:text-white", children: siteName })] }), (0, jsx_runtime_1.jsxs)("nav", { style: {
|
|
102
107
|
alignItems: 'center',
|
|
103
108
|
gap: '0.375rem',
|
|
104
|
-
}, className: "deneb-desktop-nav flex items-center gap-1.5", children:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
:
|
|
122
|
-
|
|
109
|
+
}, className: "deneb-desktop-nav flex items-center gap-1.5", children: [showSearch && ((0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "0.5rem" }, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => {
|
|
110
|
+
setMobileMenuOpen(false);
|
|
111
|
+
if (onSearchClick)
|
|
112
|
+
onSearchClick();
|
|
113
|
+
else
|
|
114
|
+
navigate(searchUrl);
|
|
115
|
+
}, "data-preview-static": "header-search-toggle", style: {
|
|
116
|
+
display: "flex",
|
|
117
|
+
width: "100%",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
gap: "0.75rem",
|
|
120
|
+
padding: "0.625rem 0.875rem",
|
|
121
|
+
borderRadius: "8px",
|
|
122
|
+
border: "1px solid var(--color-border, #e2e8f0)",
|
|
123
|
+
backgroundColor: "transparent",
|
|
124
|
+
color: "var(--color-text-muted, #64748b)",
|
|
125
|
+
cursor: "pointer",
|
|
126
|
+
fontSize: "0.9rem",
|
|
127
|
+
}, className: "w-full flex items-center gap-2.5 px-3.5 py-2.5 rounded-lg border border-slate-200 text-slate-500 dark:border-slate-800 dark:text-slate-400", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", "data-preview-static": "decorative-icon", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "11", cy: "11", r: "8" }), (0, jsx_runtime_1.jsx)("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })] }), (0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": searchFieldPath, children: searchLabel })] }) })), activeLinks.map((link) => {
|
|
128
|
+
const label = navLabels[link.id] || link.label;
|
|
129
|
+
const isActive = activeRoute === link.route;
|
|
130
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-target-page": link.id, children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => navigate(link.route), style: {
|
|
131
|
+
display: 'inline-flex',
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
padding: '0.45rem 0.875rem',
|
|
134
|
+
borderRadius: '9999px',
|
|
135
|
+
fontSize: '0.9rem',
|
|
136
|
+
fontWeight: isActive ? 600 : 500,
|
|
137
|
+
color: isActive ? 'var(--color-primary, #0f172a)' : 'var(--color-text-muted, #475569)',
|
|
138
|
+
backgroundColor: isActive ? 'var(--color-secondary, #f1f5f9)' : 'transparent',
|
|
139
|
+
border: 0,
|
|
140
|
+
cursor: 'pointer',
|
|
141
|
+
transition: 'all 0.15s ease',
|
|
142
|
+
}, className: `deneb-nav-item px-3.5 py-1.5 rounded-full text-sm font-medium transition-all border-0 cursor-pointer ${isActive
|
|
143
|
+
? 'bg-slate-100 text-slate-900 font-semibold dark:bg-slate-800 dark:text-white'
|
|
144
|
+
: 'bg-transparent text-slate-600 hover:text-slate-900 hover:bg-slate-100/70 dark:text-slate-400 dark:hover:text-white dark:hover:bg-slate-800/70'}`, children: (0, jsx_runtime_1.jsx)("span", { "data-preview-field-path": `common.navLabels.${link.id}`, children: label }) }) }, link.id));
|
|
145
|
+
})] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: '0.75rem' }, className: "flex items-center gap-3", children: [hasContact ? ((0, jsx_runtime_1.jsx)("span", { "data-target-page": "contact", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => navigate('/contact'), style: {
|
|
123
146
|
display: 'inline-flex',
|
|
124
147
|
alignItems: 'center',
|
|
125
148
|
justifyContent: 'center',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
2
|
import type { ProductItem } from './EditableProductCard';
|
|
3
3
|
import type { ServiceItem } from './EditableServiceCard';
|
|
4
|
+
import { withBasePath, resolveAsset } from './utils';
|
|
4
5
|
export declare const DENEB_PREVIEW_DATA_MESSAGE = "DENEB_PREVIEW_SITE_DATA";
|
|
5
6
|
export declare const PREVIEW_DATA_MESSAGE = "FIVORA_PREVIEW_SITE_DATA";
|
|
6
7
|
export declare const LEGACY_PREVIEW_DATA_MESSAGE: string;
|
|
@@ -90,6 +91,11 @@ export declare function useSiteData<T = SiteData>(): T;
|
|
|
90
91
|
export declare function contentObject(value: unknown): GenericRecord;
|
|
91
92
|
export declare function contentText(value: unknown): string;
|
|
92
93
|
export declare function contentList<Item = unknown>(value: unknown): Item[];
|
|
94
|
+
/**
|
|
95
|
+
* Safely extracts an image URL from siteData and ensures subpath base path is applied.
|
|
96
|
+
*/
|
|
97
|
+
export declare function contentImage(value: unknown, fallback?: string): string;
|
|
98
|
+
export { withBasePath, resolveAsset };
|
|
93
99
|
export declare function contentNumber(value: unknown, fallback?: number): number;
|
|
94
100
|
export declare function parseFieldPath(path: string): Array<string | number>;
|
|
95
101
|
export declare function getFieldStyle(content: unknown, path?: string): GenericRecord | null;
|
package/dist/SiteDataProvider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DUMMY_PREVIEW_SHOP_NAME = exports.DUMMY_PREVIEW_ADDRESS = exports.DUMMY_PREVIEW_EMAIL = exports.DUMMY_PREVIEW_WHATSAPP = exports.DUMMY_PREVIEW_PHONE = exports.DenebDataContext = exports.useDenebData = exports.DenebDataProvider = exports.SiteDataContext = exports.DENEB_STYLE_PATCH_MESSAGE = exports.STYLE_PATCH_MESSAGE = exports.PREVIEW_FIELD_ATTRIBUTE = exports.LEGACY_PREVIEW_FOCUS_MESSAGE = exports.PREVIEW_FOCUS_MESSAGE = exports.DENEB_PREVIEW_FOCUS_MESSAGE = exports.LEGACY_PREVIEW_READY_MESSAGE = exports.PREVIEW_READY_MESSAGE = exports.DENEB_PREVIEW_READY_MESSAGE = exports.LEGACY_PREVIEW_DATA_MESSAGE = exports.PREVIEW_DATA_MESSAGE = exports.DENEB_PREVIEW_DATA_MESSAGE = void 0;
|
|
4
|
+
exports.DUMMY_PREVIEW_SHOP_NAME = exports.DUMMY_PREVIEW_ADDRESS = exports.DUMMY_PREVIEW_EMAIL = exports.DUMMY_PREVIEW_WHATSAPP = exports.DUMMY_PREVIEW_PHONE = exports.DenebDataContext = exports.useDenebData = exports.DenebDataProvider = exports.resolveAsset = exports.withBasePath = exports.SiteDataContext = exports.DENEB_STYLE_PATCH_MESSAGE = exports.STYLE_PATCH_MESSAGE = exports.PREVIEW_FIELD_ATTRIBUTE = exports.LEGACY_PREVIEW_FOCUS_MESSAGE = exports.PREVIEW_FOCUS_MESSAGE = exports.DENEB_PREVIEW_FOCUS_MESSAGE = exports.LEGACY_PREVIEW_READY_MESSAGE = exports.PREVIEW_READY_MESSAGE = exports.DENEB_PREVIEW_READY_MESSAGE = exports.LEGACY_PREVIEW_DATA_MESSAGE = exports.PREVIEW_DATA_MESSAGE = exports.DENEB_PREVIEW_DATA_MESSAGE = void 0;
|
|
5
5
|
exports.isRecord = isRecord;
|
|
6
6
|
exports.isDarkColor = isDarkColor;
|
|
7
7
|
exports.syncThemeToDocument = syncThemeToDocument;
|
|
@@ -14,6 +14,7 @@ exports.useSiteData = useSiteData;
|
|
|
14
14
|
exports.contentObject = contentObject;
|
|
15
15
|
exports.contentText = contentText;
|
|
16
16
|
exports.contentList = contentList;
|
|
17
|
+
exports.contentImage = contentImage;
|
|
17
18
|
exports.contentNumber = contentNumber;
|
|
18
19
|
exports.parseFieldPath = parseFieldPath;
|
|
19
20
|
exports.getFieldStyle = getFieldStyle;
|
|
@@ -38,6 +39,9 @@ const DenebComponentStyles_1 = require("./DenebComponentStyles");
|
|
|
38
39
|
const FontLoader_1 = require("./fonts/FontLoader");
|
|
39
40
|
const ResponsiveBaseStyles_1 = require("./ResponsiveBaseStyles");
|
|
40
41
|
const ThemeStyles_1 = require("./ThemeStyles");
|
|
42
|
+
const utils_1 = require("./utils");
|
|
43
|
+
Object.defineProperty(exports, "withBasePath", { enumerable: true, get: function () { return utils_1.withBasePath; } });
|
|
44
|
+
Object.defineProperty(exports, "resolveAsset", { enumerable: true, get: function () { return utils_1.resolveAsset; } });
|
|
41
45
|
exports.DENEB_PREVIEW_DATA_MESSAGE = 'DENEB_PREVIEW_SITE_DATA';
|
|
42
46
|
exports.PREVIEW_DATA_MESSAGE = 'FIVORA_PREVIEW_SITE_DATA';
|
|
43
47
|
const PREVIOUS_PREVIEW_PREFIX = `${['MARKET', 'PLACE'].join('')}_PREVIEW_`;
|
|
@@ -82,35 +86,16 @@ function isDarkColor(color) {
|
|
|
82
86
|
function syncThemeToDocument(theme) {
|
|
83
87
|
if (typeof document === "undefined" || !isRecord(theme))
|
|
84
88
|
return;
|
|
89
|
+
const vars = (0, core_1.generateThemeVariables)(theme);
|
|
85
90
|
const rootStyle = document.documentElement.style;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
if (typeof theme.secondaryColor === "string") {
|
|
96
|
-
rootStyle.setProperty("--brand-secondary", theme.secondaryColor);
|
|
97
|
-
}
|
|
98
|
-
if (typeof theme.accentColor === "string") {
|
|
99
|
-
rootStyle.setProperty("--brand-accent", theme.accentColor);
|
|
100
|
-
rootStyle.setProperty("--color-accent", theme.accentColor);
|
|
101
|
-
}
|
|
102
|
-
if (typeof theme.backgroundColor === "string") {
|
|
103
|
-
const isDark = isDarkColor(theme.backgroundColor);
|
|
104
|
-
document.documentElement.classList.toggle("dark", isDark);
|
|
105
|
-
document.documentElement.setAttribute("data-theme", isDark ? "dark" : "light");
|
|
106
|
-
rootStyle.colorScheme = isDark ? "dark" : "light";
|
|
107
|
-
rootStyle.setProperty("--page-background", theme.backgroundColor);
|
|
108
|
-
rootStyle.setProperty("--card-bg", isDark ? "#111a2e" : "#ffffff");
|
|
109
|
-
rootStyle.setProperty("--product-card-bg", isDark ? "#111a2e" : "#ffffff");
|
|
110
|
-
rootStyle.setProperty("--color-surface", isDark ? "rgba(255,255,255,0.05)" : "#ffffff");
|
|
111
|
-
rootStyle.setProperty("--color-secondary", isDark ? "rgba(255,255,255,0.08)" : "#f1f5f9");
|
|
112
|
-
rootStyle.setProperty("--button-secondary-bg", isDark ? "rgba(255,255,255,0.08)" : "#f1f5f9");
|
|
113
|
-
rootStyle.setProperty("--button-secondary-text", isDark ? "#f8fafc" : "#0f172a");
|
|
91
|
+
const isDark = isDarkColor(theme.backgroundColor);
|
|
92
|
+
document.documentElement.classList.toggle("dark", isDark);
|
|
93
|
+
document.documentElement.setAttribute("data-theme", isDark ? "dark" : "light");
|
|
94
|
+
rootStyle.colorScheme = isDark ? "dark" : "light";
|
|
95
|
+
for (const [key, val] of Object.entries(vars)) {
|
|
96
|
+
if (key.startsWith("--")) {
|
|
97
|
+
rootStyle.setProperty(key, val);
|
|
98
|
+
}
|
|
114
99
|
}
|
|
115
100
|
}
|
|
116
101
|
function mergeSiteData(current, incoming, depth = 0, seen = new WeakSet()) {
|
|
@@ -631,8 +616,21 @@ function SiteDataProvider({ children, initialSiteData, fallbackSiteData, liveCat
|
|
|
631
616
|
}
|
|
632
617
|
}
|
|
633
618
|
}, [siteData]);
|
|
619
|
+
const resolvedTheme = (0, react_1.useMemo)(() => {
|
|
620
|
+
const raw = siteData;
|
|
621
|
+
return raw?.theme ||
|
|
622
|
+
raw?.template?.structure?.theme ||
|
|
623
|
+
initialSiteData?.theme ||
|
|
624
|
+
initialSiteData?.template?.structure?.theme ||
|
|
625
|
+
undefined;
|
|
626
|
+
}, [siteData, initialSiteData]);
|
|
627
|
+
(0, react_1.useEffect)(() => {
|
|
628
|
+
if (resolvedTheme) {
|
|
629
|
+
syncThemeToDocument(resolvedTheme);
|
|
630
|
+
}
|
|
631
|
+
}, [resolvedTheme]);
|
|
634
632
|
const value = (0, react_1.useMemo)(() => siteData, [siteData]);
|
|
635
|
-
return ((0, jsx_runtime_1.jsxs)(exports.SiteDataContext.Provider, { value: value, children: [(0, jsx_runtime_1.jsx)(ThemeStyles_1.ThemeStyles, { theme:
|
|
633
|
+
return ((0, jsx_runtime_1.jsxs)(exports.SiteDataContext.Provider, { value: value, children: [(0, jsx_runtime_1.jsx)(ThemeStyles_1.ThemeStyles, { theme: resolvedTheme }), (0, jsx_runtime_1.jsx)(FontLoader_1.FontLoader, {}), (0, jsx_runtime_1.jsx)(ResponsiveBaseStyles_1.ResponsiveBaseStyles, {}), (0, jsx_runtime_1.jsx)(DenebComponentStyles_1.DenebComponentStyles, {}), children] }));
|
|
636
634
|
}
|
|
637
635
|
function useSiteData() {
|
|
638
636
|
const ctx = (0, react_1.useContext)(exports.SiteDataContext);
|
|
@@ -655,6 +653,13 @@ function contentText(value) {
|
|
|
655
653
|
function contentList(value) {
|
|
656
654
|
return Array.isArray(value) ? value : [];
|
|
657
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Safely extracts an image URL from siteData and ensures subpath base path is applied.
|
|
658
|
+
*/
|
|
659
|
+
function contentImage(value, fallback = '') {
|
|
660
|
+
const val = typeof value === 'string' && value.trim() ? value.trim() : fallback;
|
|
661
|
+
return (0, utils_1.withBasePath)(val);
|
|
662
|
+
}
|
|
658
663
|
function contentNumber(value, fallback = 0) {
|
|
659
664
|
return typeof value === 'number' && !Number.isNaN(value) ? value : fallback;
|
|
660
665
|
}
|
package/dist/ThemeStyles.js
CHANGED
|
@@ -136,77 +136,10 @@ function getCategoryTheme(category, overrides) {
|
|
|
136
136
|
* is automatically converted to a CSS variable (e.g. --card-bg: #111).
|
|
137
137
|
*/
|
|
138
138
|
function getThemeCssProperties(theme) {
|
|
139
|
-
const
|
|
140
|
-
if (theme) {
|
|
141
|
-
for (const [key, val] of Object.entries(theme)) {
|
|
142
|
-
if (key !== 'dark' && key !== 'light' && (typeof val === 'string' || typeof val === 'number')) {
|
|
143
|
-
const cssVarName = `--${key.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`;
|
|
144
|
-
customVars[cssVarName] = String(val);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const isDark = (0, core_1.isDarkColor)(theme?.backgroundColor);
|
|
149
|
-
const bgColor = theme?.backgroundColor || (isDark ? '#090d1a' : '#ffffff');
|
|
150
|
-
const textColor = theme?.textColor || (isDark ? '#f8fafc' : '#0f172a');
|
|
151
|
-
const mutedColor = theme?.mutedTextColor || (isDark ? 'rgba(248, 250, 252, 0.7)' : '#64748b');
|
|
152
|
-
const borderColor = isDark ? 'rgba(255, 255, 255, 0.1)' : '#e2e8f0';
|
|
153
|
-
const cardBg = isDark ? '#111a2e' : '#ffffff';
|
|
154
|
-
const cardBorder = isDark ? 'rgba(255, 255, 255, 0.09)' : '#e2e8f0';
|
|
155
|
-
const primaryColor = theme?.primaryColor || '#2563eb';
|
|
156
|
-
const buttonBg = String(theme?.buttonBackgroundColor || primaryColor || '#2563eb');
|
|
157
|
-
const autoButtonText = (0, core_1.getAutoContrastTextColor)(buttonBg);
|
|
158
|
-
const buttonText = String(theme?.buttonTextColor || autoButtonText);
|
|
159
|
-
const buttonSecondaryBg = isDark
|
|
160
|
-
? 'rgba(255, 255, 255, 0.08)'
|
|
161
|
-
: (theme?.secondaryColor && !(0, core_1.isDarkColor)(theme.secondaryColor) ? theme.secondaryColor : '#f1f5f9');
|
|
162
|
-
const buttonSecondaryText = isDark ? '#f8fafc' : '#0f172a';
|
|
139
|
+
const vars = (0, core_1.generateThemeVariables)(theme);
|
|
163
140
|
return {
|
|
164
|
-
|
|
165
|
-
'--brand-secondary': theme?.secondaryColor || (isDark ? '#1e293b' : '#0f172a'),
|
|
166
|
-
'--brand-accent': theme?.accentColor || '#14b8a6',
|
|
167
|
-
'--page-background': bgColor,
|
|
168
|
-
'--page-text': textColor,
|
|
169
|
-
'--heading-color': theme?.headingColor || (isDark ? '#ffffff' : theme?.secondaryColor || '#0f172a'),
|
|
170
|
-
'--muted-text': mutedColor,
|
|
171
|
-
'--link-color': theme?.linkColor || primaryColor,
|
|
172
|
-
'--hero-min-height': theme?.heroMinHeight || '72vh',
|
|
173
|
-
'--section-padding': theme?.sectionPadding || '5rem',
|
|
174
|
-
'--base-size': theme?.baseSize || '16px',
|
|
175
|
-
'--heading-font': theme?.headingFont || 'Inter, sans-serif',
|
|
176
|
-
'--body-font': theme?.bodyFont || 'Inter, sans-serif',
|
|
177
|
-
'--border-radius': theme?.borderRadius || '8px',
|
|
178
|
-
'--content-align': theme?.align || 'left',
|
|
179
|
-
// Canonical color system tokens for light & dark mode harmony
|
|
180
|
-
'--color-primary': primaryColor,
|
|
181
|
-
'--color-secondary': buttonSecondaryBg,
|
|
182
|
-
'--color-accent': theme?.accentColor || '#14b8a6',
|
|
183
|
-
'--color-text': textColor,
|
|
184
|
-
'--color-text-muted': mutedColor,
|
|
185
|
-
'--color-border': borderColor,
|
|
186
|
-
'--color-surface': isDark ? 'rgba(255,255,255,0.05)' : '#ffffff',
|
|
187
|
-
'--card-bg': cardBg,
|
|
188
|
-
'--card-border': cardBorder,
|
|
189
|
-
'--product-card-bg': cardBg,
|
|
190
|
-
'--product-card-border': cardBorder,
|
|
191
|
-
'--tag-bg': isDark ? 'rgba(255, 255, 255, 0.08)' : 'rgba(241, 245, 249, 0.9)',
|
|
192
|
-
'--tag-color': mutedColor,
|
|
193
|
-
'--card-shadow': isDark ? '0 10px 25px -5px rgba(0, 0, 0, 0.4)' : '0 10px 25px -5px rgba(0, 0, 0, 0.05)',
|
|
194
|
-
'--header-bg': isDark ? 'rgba(15, 23, 42, 0.85)' : 'rgba(255, 255, 255, 0.82)',
|
|
195
|
-
'--input-bg': isDark ? '#1e293b' : '#ffffff',
|
|
196
|
-
'--input-border': isDark ? 'rgba(255, 255, 255, 0.15)' : '#cbd5e1',
|
|
197
|
-
'--input-color': textColor,
|
|
198
|
-
// Dedicated Button Design Tokens
|
|
199
|
-
'--button-bg': buttonBg,
|
|
200
|
-
'--button-text': buttonText,
|
|
201
|
-
'--button-primary-bg': buttonBg,
|
|
202
|
-
'--button-primary-text': buttonText,
|
|
203
|
-
'--button-secondary-bg': buttonSecondaryBg,
|
|
204
|
-
'--button-secondary-text': buttonSecondaryText,
|
|
205
|
-
'--button-outline-border': isDark ? 'rgba(255, 255, 255, 0.22)' : 'currentColor',
|
|
206
|
-
'--button-outline-text': isDark ? '#f8fafc' : textColor,
|
|
207
|
-
'--button-ghost-text': isDark ? '#f8fafc' : textColor,
|
|
141
|
+
...vars,
|
|
208
142
|
fontFamily: theme?.bodyFont || 'Inter, sans-serif',
|
|
209
|
-
...customVars,
|
|
210
143
|
};
|
|
211
144
|
}
|
|
212
145
|
/**
|
|
@@ -223,6 +156,10 @@ function ThemeStyles({ theme, enableDualMode = true, }) {
|
|
|
223
156
|
:root {
|
|
224
157
|
${baseLines}
|
|
225
158
|
}
|
|
159
|
+
html, body {
|
|
160
|
+
background-color: var(--page-background, var(--background, #ffffff));
|
|
161
|
+
color: var(--page-text, var(--color-text, #0f172a));
|
|
162
|
+
}
|
|
226
163
|
`;
|
|
227
164
|
if (enableDualMode) {
|
|
228
165
|
const isDarkBase = (0, core_1.isDarkColor)(theme?.backgroundColor);
|
|
@@ -243,6 +180,10 @@ ${baseLines}
|
|
|
243
180
|
css += `
|
|
244
181
|
.light, [data-theme="light"] {
|
|
245
182
|
${lightLines}
|
|
183
|
+
}
|
|
184
|
+
.light body, [data-theme="light"] body {
|
|
185
|
+
background-color: var(--page-background, var(--background, #ffffff));
|
|
186
|
+
color: var(--page-text, var(--color-text, #0f172a));
|
|
246
187
|
}
|
|
247
188
|
`;
|
|
248
189
|
}
|
|
@@ -263,6 +204,10 @@ ${lightLines}
|
|
|
263
204
|
css += `
|
|
264
205
|
.dark, [data-theme="dark"] {
|
|
265
206
|
${darkLines}
|
|
207
|
+
}
|
|
208
|
+
.dark body, [data-theme="dark"] body {
|
|
209
|
+
background-color: var(--page-background, var(--background, #090d1a));
|
|
210
|
+
color: var(--page-text, var(--color-text, #f8fafc));
|
|
266
211
|
}
|
|
267
212
|
`;
|
|
268
213
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from './PreviewField';
|
|
6
6
|
export * from './EditableText';
|
|
7
7
|
export * from './EditableImage';
|
|
8
|
+
export * from './DenebImage';
|
|
8
9
|
export * from './EditableIcon';
|
|
9
10
|
export * from './EditableMap';
|
|
10
11
|
export * from './EditableList';
|
|
@@ -69,6 +70,7 @@ export { EditableParagraph as Paragraph } from './EditableText';
|
|
|
69
70
|
export { EditableBadge as Badge } from './EditableText';
|
|
70
71
|
export { EditableQuote as Quote } from './EditableText';
|
|
71
72
|
export { EditableImage as Image } from './EditableImage';
|
|
73
|
+
export { DenebImage, DenebImage as SafeImage } from './DenebImage';
|
|
72
74
|
export { EditableMap as Map } from './EditableMap';
|
|
73
75
|
export { EditableGrid as Grid } from './EditableGrid';
|
|
74
76
|
export { EditableSection as Section } from './EditableSection';
|
package/dist/index.js
CHANGED
|
@@ -18,11 +18,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
exports.generateThemeVariables = exports.mergeVisualCustomizationIntoTheme = exports.customizationToTheme = exports.parseVisualCustomization = exports.normalizeHexColor = exports.toHexColor = exports.getAutoContrastTextColor = exports.isDarkColor = exports.FONT_PAIRINGS = exports.GLOBAL_FONT_OPTIONS = exports.THEME_PALETTES = exports.DENEB_AUTHOR = exports.DENEB_FRAMEWORK_VERSION = exports.DENEB_FRAMEWORK_NAME = exports.AdditionalPagesNav = exports.PlatformAdditionalPages = exports.TestimonialCarousel = exports.BookingModal = exports.BeforeAfterSlider = exports.FilterSidebar = exports.CartDrawer = exports.CategoryPills = exports.AnnouncementBar = exports.HeroSplit = exports.Hero = exports.Footer = exports.Header = exports.Navbar = exports.ContactForm = exports.FAQ = exports.Accordion = exports.Testimonials = exports.TestimonialSection = void 0;
|
|
21
|
+
exports.ServiceCard = exports.GoogleFeedback = exports.CustomerReviews = exports.ProductDetail = exports.ProductShowcase = exports.ProductGrid = exports.EntityCard = exports.ListingCard = exports.UniversalCard = exports.VehicleCard = exports.ProductCard = exports.List = exports.Box = exports.Section = exports.Grid = exports.Map = exports.SafeImage = exports.DenebImage = exports.Image = exports.Quote = exports.Badge = exports.Paragraph = exports.Heading = exports.Text = exports.Dialog = exports.Card = exports.Button = exports.collectStyleTargetsFromHtml = exports.validateStyleTree = exports.styleToCssVariables = exports.patchStyleByPath = exports.patchElementStyle = exports.STYLE_TYPE_ATTRIBUTE = exports.STYLE_TARGET_ATTRIBUTE = exports.DENEB_STYLE_PATCH_MESSAGE = exports.STYLE_PATCH_MESSAGE = exports.formatResponsiveFontSize = exports.resolveInstallableFont = exports.normalizeFontId = exports.lookupFontDefinition = exports.listFontsByCategory = exports.collectFontIdsFromSiteData = exports.buildGoogleFontsStylesheetUrl = exports.DENEB_GOOGLE_FONT_COUNT = exports.DENEB_FONT_REGISTRY = exports.useDenebFonts = exports.DENEB_FONTS_LINK_ID = exports.FontLoader = exports.DenebComponentStyles = exports.ResponsiveBaseStyles = void 0;
|
|
22
|
+
exports.generateThemeVariables = exports.mergeVisualCustomizationIntoTheme = exports.customizationToTheme = exports.parseVisualCustomization = exports.normalizeHexColor = exports.toHexColor = exports.getAutoContrastTextColor = exports.isDarkColor = exports.FONT_PAIRINGS = exports.GLOBAL_FONT_OPTIONS = exports.THEME_PALETTES = exports.DENEB_AUTHOR = exports.DENEB_FRAMEWORK_VERSION = exports.DENEB_FRAMEWORK_NAME = exports.AdditionalPagesNav = exports.PlatformAdditionalPages = exports.TestimonialCarousel = exports.BookingModal = exports.BeforeAfterSlider = exports.FilterSidebar = exports.CartDrawer = exports.CategoryPills = exports.AnnouncementBar = exports.HeroSplit = exports.Hero = exports.Footer = exports.Header = exports.Navbar = exports.ContactForm = exports.FAQ = exports.Accordion = exports.Testimonials = exports.TestimonialSection = exports.TestimonialCard = exports.PricingCard = void 0;
|
|
23
23
|
__exportStar(require("./PreviewField"), exports);
|
|
24
24
|
__exportStar(require("./EditableText"), exports);
|
|
25
25
|
__exportStar(require("./EditableImage"), exports);
|
|
26
|
+
__exportStar(require("./DenebImage"), exports);
|
|
26
27
|
__exportStar(require("./EditableIcon"), exports);
|
|
27
28
|
__exportStar(require("./EditableMap"), exports);
|
|
28
29
|
__exportStar(require("./EditableList"), exports);
|
|
@@ -121,6 +122,9 @@ var EditableText_6 = require("./EditableText");
|
|
|
121
122
|
Object.defineProperty(exports, "Quote", { enumerable: true, get: function () { return EditableText_6.EditableQuote; } });
|
|
122
123
|
var EditableImage_1 = require("./EditableImage");
|
|
123
124
|
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return EditableImage_1.EditableImage; } });
|
|
125
|
+
var DenebImage_1 = require("./DenebImage");
|
|
126
|
+
Object.defineProperty(exports, "DenebImage", { enumerable: true, get: function () { return DenebImage_1.DenebImage; } });
|
|
127
|
+
Object.defineProperty(exports, "SafeImage", { enumerable: true, get: function () { return DenebImage_1.DenebImage; } });
|
|
124
128
|
var EditableMap_1 = require("./EditableMap");
|
|
125
129
|
Object.defineProperty(exports, "Map", { enumerable: true, get: function () { return EditableMap_1.EditableMap; } });
|
|
126
130
|
var EditableGrid_1 = require("./EditableGrid");
|
package/dist/utils/urls.d.ts
CHANGED
|
@@ -69,3 +69,8 @@ export declare function resolvePageRoute(pageKey: string, pages?: Array<{
|
|
|
69
69
|
id: string;
|
|
70
70
|
route: string;
|
|
71
71
|
}>): string;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves static assets with subpath prefix support.
|
|
74
|
+
* Canonical alias for `withBasePath`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const resolveAsset: typeof withBasePath;
|
package/dist/utils/urls.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Created by Chamika Gayashan & Induranga Kawishwara
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.resolveAsset = void 0;
|
|
7
8
|
exports.createWhatsAppUrl = createWhatsAppUrl;
|
|
8
9
|
exports.createPhoneUrl = createPhoneUrl;
|
|
9
10
|
exports.createEmailUrl = createEmailUrl;
|
|
@@ -162,3 +163,8 @@ function resolvePageRoute(pageKey, pages) {
|
|
|
162
163
|
const match = pages?.find((page) => page.id === pageKey);
|
|
163
164
|
return match?.route ?? `/${pageKey.replace(/_/g, '/')}`;
|
|
164
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Resolves static assets with subpath prefix support.
|
|
168
|
+
* Canonical alias for `withBasePath`.
|
|
169
|
+
*/
|
|
170
|
+
exports.resolveAsset = withBasePath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deneb-ui/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.121",
|
|
4
4
|
"description": "Visual-first React component library for editable commerce storefronts. Built for Next.js and Fivora.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@deneb-ui/core": "^2.0.
|
|
53
|
+
"@deneb-ui/core": "^2.0.121"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^18.0.0 || ^19.0.0",
|