@mandolop97/constructor-nexora 1.3.0 → 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.
- package/dist/NexoraBuilderApp.d.ts +6 -1
- package/dist/components/builder/BindingsPanel.d.ts +7 -0
- package/dist/components/builder/BuilderCanvas.d.ts +13 -1
- package/dist/components/builder/BuilderEditorShell.d.ts +6 -1
- package/dist/components/builder/Inspector.d.ts +5 -2
- package/dist/components/builder/ThemeEditor.d.ts +4 -2
- package/dist/components/schema/PageRenderer.d.ts +13 -1
- package/dist/components/schema/ScrollAnimationWrapper.d.ts +10 -0
- package/dist/components/schema/SortableNodeWrapper.d.ts +20 -1
- package/dist/components/schema/ThemeContext.d.ts +3 -0
- package/dist/components/schema/nodes/CommerceNodes.d.ts +3 -0
- package/dist/components/schema/nodes/TemplateNodes.d.ts +5 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/{index-JT2gobdd.js → index-wna1ND1R.js} +8151 -5852
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +56 -38
- package/dist/integrations/supabase/client.d.ts +39 -0
- package/dist/integrations/supabase/types.d.ts +39 -0
- package/dist/lib/binding-utils.d.ts +51 -0
- package/dist/lib/block-registry.d.ts +11 -3
- package/dist/lib/card-template-utils.d.ts +35 -0
- package/dist/lib/default-schemas.d.ts +17 -1
- package/dist/lib/mock-data.d.ts +39 -0
- package/dist/lib/style-utils.d.ts +13 -0
- package/dist/{lucide-react-Yf25vQUK.js → lucide-react-BWfGGYG0.js} +8217 -8304
- package/dist/types/contract.d.ts +366 -0
- package/dist/types/schema.d.ts +15 -1
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* DATA BINDING UTILITIES
|
|
4
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* Utilities for resolving data bindings, hydrating templates with real data,
|
|
7
|
+
* and transforming bound values.
|
|
8
|
+
*/
|
|
9
|
+
import { NodeBindings, RenderContext, BoundSchemaNode } from '@/types/contract';
|
|
10
|
+
import { Schema, SchemaNode } from '@/types/schema';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a nested field path like "product.images[0].url"
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveFieldPath(data: any, path: string): any;
|
|
15
|
+
/**
|
|
16
|
+
* Set a value at a nested path
|
|
17
|
+
*/
|
|
18
|
+
export declare function setFieldPath(data: any, path: string, value: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve all bindings for a node and return the final props
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveBindings(node: BoundSchemaNode, context: RenderContext): Record<string, any>;
|
|
23
|
+
/**
|
|
24
|
+
* Hydrate a template schema with real data.
|
|
25
|
+
* Creates a new schema with bound values resolved.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hydrateTemplate(template: Schema, data: RenderContext['data']): Schema;
|
|
28
|
+
/**
|
|
29
|
+
* Hydrate a single node for iteration (e.g., ProductGrid items)
|
|
30
|
+
*/
|
|
31
|
+
export declare function hydrateNodeForItem(node: SchemaNode, item: any, index: number, template: Schema): SchemaNode;
|
|
32
|
+
/**
|
|
33
|
+
* Create a default binding configuration for a node type
|
|
34
|
+
*/
|
|
35
|
+
export declare function createDefaultBindings(nodeType: string): NodeBindings;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a node has active bindings
|
|
38
|
+
*/
|
|
39
|
+
export declare function hasActiveBindings(node: SchemaNode): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Get the list of props that are currently bound
|
|
42
|
+
*/
|
|
43
|
+
export declare function getBoundProps(node: SchemaNode): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Register a custom transform function
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerTransform(name: string, fn: (value: any, ...args: any[]) => any): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get available transform names
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAvailableTransforms(): string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeType, NodeProps, NodeStyle, TemplateType } from '@/types/schema';
|
|
1
|
+
import { NodeType, NodeProps, NodeStyle, TemplateType, SchemaNode } from '@/types/schema';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface InspectorFieldDef {
|
|
4
4
|
/** Property key on NodeProps */
|
|
@@ -6,7 +6,7 @@ export interface InspectorFieldDef {
|
|
|
6
6
|
/** Display label */
|
|
7
7
|
label: string;
|
|
8
8
|
/** Field type */
|
|
9
|
-
type: 'text' | 'select' | 'color' | 'number' | 'image' | 'toggle' | 'slider' | 'textarea' | 'link' | 'icon' | 'spacing' | 'group';
|
|
9
|
+
type: 'text' | 'select' | 'color' | 'number' | 'image' | 'toggle' | 'slider' | 'textarea' | 'link' | 'icon' | 'spacing' | 'group' | 'binding';
|
|
10
10
|
/** Options for 'select' type */
|
|
11
11
|
options?: {
|
|
12
12
|
label: string;
|
|
@@ -28,10 +28,14 @@ export interface InspectorFieldDef {
|
|
|
28
28
|
children?: InspectorFieldDef[];
|
|
29
29
|
/** Default value */
|
|
30
30
|
defaultValue?: any;
|
|
31
|
+
/** For binding type: allowed data sources */
|
|
32
|
+
allowedDataSources?: string[];
|
|
33
|
+
/** For binding type: available fields */
|
|
34
|
+
bindableFields?: string[];
|
|
31
35
|
}
|
|
32
36
|
export interface CompositeNodeTree {
|
|
33
37
|
rootId: string;
|
|
34
|
-
nodes: Record<string,
|
|
38
|
+
nodes: Record<string, SchemaNode>;
|
|
35
39
|
}
|
|
36
40
|
export interface BlockDefinition {
|
|
37
41
|
type: NodeType;
|
|
@@ -47,6 +51,10 @@ export interface BlockDefinition {
|
|
|
47
51
|
allowedTemplateTypes?: TemplateType[];
|
|
48
52
|
/** Factory that generates a composite tree of child nodes when this block is created */
|
|
49
53
|
compositeFactory?: () => CompositeNodeTree;
|
|
54
|
+
/** Whether this block supports data binding */
|
|
55
|
+
supportsBinding?: boolean;
|
|
56
|
+
/** Description for documentation */
|
|
57
|
+
description?: string;
|
|
50
58
|
}
|
|
51
59
|
export declare const blockRegistry: BlockDefinition[];
|
|
52
60
|
export declare function getBlockDef(type: NodeType): BlockDefinition | undefined;
|
|
@@ -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;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import { Schema } from '@/types/schema';
|
|
1
|
+
import { Schema, SchemaNode } from '@/types/schema';
|
|
2
|
+
type Nodes = Record<string, SchemaNode>;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a composite ProductCard node tree with individually editable sub-elements.
|
|
5
|
+
* Returns the rootId and all generated nodes for merging into a schema.
|
|
6
|
+
*/
|
|
7
|
+
export declare function productCardNodes(id: string, opts: {
|
|
8
|
+
name: string;
|
|
9
|
+
price: string;
|
|
10
|
+
image: string;
|
|
11
|
+
badge?: string;
|
|
12
|
+
originalPrice?: string;
|
|
13
|
+
}): {
|
|
14
|
+
rootId: string;
|
|
15
|
+
nodes: Nodes;
|
|
16
|
+
};
|
|
2
17
|
export declare function createHomeSchema(): Schema;
|
|
3
18
|
export declare function createProductsSchema(): Schema;
|
|
4
19
|
export declare function createFAQSchema(): Schema;
|
|
@@ -14,3 +29,4 @@ export interface PageSchemaDefinition {
|
|
|
14
29
|
}
|
|
15
30
|
export declare const PAGE_DEFINITIONS: PageSchemaDefinition[];
|
|
16
31
|
export declare function getDefaultSchemaForSlug(slug: string): Schema;
|
|
32
|
+
export {};
|
|
@@ -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;
|