@mandolop97/constructor-nexora 1.3.1 → 1.5.0

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.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Utilities for hydrating a Product Card template with real product data.
3
+ * The template is stored as a schema in page_schemas (slug: '__template/product-card').
4
+ */
5
+ import { SchemaNode } from '@/types/schema';
6
+ export interface ProductData {
7
+ id: string;
8
+ name: string;
9
+ price: number;
10
+ original_price?: number | null;
11
+ image_url?: string | null;
12
+ badge?: string | null;
13
+ description?: string | null;
14
+ category?: string | null;
15
+ in_stock?: boolean | null;
16
+ sku?: string | null;
17
+ }
18
+ /**
19
+ * Clones a template's node tree and injects product data into the appropriate nodes.
20
+ * Detection strategy:
21
+ * - Image node → src = product.image_url
22
+ * - Text with level 'h3' → text = product.name
23
+ * - Text with fontWeight '600' (price) → text = formatted price
24
+ * - Text with textDecoration 'line-through' → text = original price (hidden if null)
25
+ * - Badge → text = product.badge (hidden if null)
26
+ * - Button → locked, emits addToCart event
27
+ */
28
+ export declare function hydrateCardTemplate(templateNodes: Record<string, SchemaNode>, rootNodeId: string, product: ProductData): {
29
+ nodes: Record<string, SchemaNode>;
30
+ rootId: string;
31
+ };
32
+ /**
33
+ * Formats a number as a currency string.
34
+ */
35
+ export declare function formatPrice(price: number): string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Default mock data for builder edit/preview mode.
3
+ * Used to populate data-bound blocks when no real data is available.
4
+ */
5
+ export declare const DEFAULT_MOCK_PRODUCTS: {
6
+ id: string;
7
+ name: string;
8
+ price: number;
9
+ original_price: number;
10
+ image_url: string;
11
+ category: string;
12
+ badge: string;
13
+ sku: string;
14
+ in_stock: boolean;
15
+ description: string;
16
+ }[];
17
+ export declare const DEFAULT_MOCK_COLLECTIONS: {
18
+ id: string;
19
+ name: string;
20
+ slug: string;
21
+ image: string;
22
+ description: string;
23
+ productCount: number;
24
+ }[];
25
+ export declare const DEFAULT_MOCK_SETTINGS: {
26
+ storeName: string;
27
+ currency: string;
28
+ language: string;
29
+ };
30
+ /**
31
+ * Build a complete RenderContext data object from mock data
32
+ */
33
+ export declare function buildMockRenderData(mockData?: Record<string, any>): {
34
+ products: any;
35
+ collections: any;
36
+ settings: any;
37
+ pages: any;
38
+ custom: any;
39
+ };
@@ -14,3 +14,16 @@ export declare function generatePseudoStateCSS(nodeId: string, style: NodeStyle)
14
14
  * Generate @container query CSS for responsive overrides.
15
15
  */
16
16
  export declare function generateResponsiveCSS(nodeId: string, style: NodeStyle): string;
17
+ /**
18
+ * Merge global styles into a node's style object.
19
+ * Local node styles take priority over global styles.
20
+ */
21
+ export declare function mergeGlobalStyles(nodeStyle: NodeStyle, appliedIds: string[] | undefined, globalStyles: Record<string, {
22
+ label: string;
23
+ style: Partial<NodeStyle>;
24
+ }> | undefined): NodeStyle;
25
+ /**
26
+ * Convert ThemeTokens into inline CSS custom properties (same logic as PageRenderer).
27
+ * Useful for scoping a template's theme onto a container div.
28
+ */
29
+ export declare function themeTokensToCSS(t: import('@/types/schema').ThemeTokens): React.CSSProperties;