@mandolop97/constructor-nexora 1.5.0 → 1.7.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 +4 -2
- package/dist/components/builder/ArrayEditor.d.ts +27 -0
- package/dist/components/builder/BuilderCanvas.d.ts +4 -1
- package/dist/components/builder/BuilderEditorShell.d.ts +4 -2
- package/dist/components/schema/NodeRegistry.d.ts +3 -1
- package/dist/components/schema/PageRenderer.d.ts +4 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/toggle-group.d.ts +2 -2
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/{index-wna1ND1R.js → index-BPfPxgpF.js} +9529 -9050
- package/dist/index.css +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +79 -56
- package/dist/lib/block-registry.d.ts +20 -2
- package/dist/lib/host-data.d.ts +69 -0
- package/dist/lib/mock-data.d.ts +3 -37
- package/dist/lib/publish-validator.d.ts +33 -0
- package/dist/lib/render-context-utils.d.ts +55 -0
- package/dist/lib/slot-utils.d.ts +66 -0
- package/dist/{lucide-react-BWfGGYG0.js → lucide-react-D6zDllQb.js} +7676 -7696
- package/dist/types/contract.d.ts +121 -12
- package/dist/types/page-types.d.ts +65 -0
- package/dist/types/schema.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default sample data for builder edit/preview mode.
|
|
3
|
+
* Used to populate data-bound blocks when no real host data is available.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_SAMPLE_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_SAMPLE_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_SAMPLE_SETTINGS: {
|
|
26
|
+
storeName: string;
|
|
27
|
+
currency: string;
|
|
28
|
+
language: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Build a complete RenderContext data object from host data.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildHostData(hostData?: Record<string, any>): {
|
|
34
|
+
products: any;
|
|
35
|
+
collections: any;
|
|
36
|
+
settings: any;
|
|
37
|
+
pages: any;
|
|
38
|
+
custom: any;
|
|
39
|
+
};
|
|
40
|
+
/** @deprecated Use DEFAULT_SAMPLE_PRODUCTS */
|
|
41
|
+
export declare const DEFAULT_MOCK_PRODUCTS: {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
price: number;
|
|
45
|
+
original_price: number;
|
|
46
|
+
image_url: string;
|
|
47
|
+
category: string;
|
|
48
|
+
badge: string;
|
|
49
|
+
sku: string;
|
|
50
|
+
in_stock: boolean;
|
|
51
|
+
description: string;
|
|
52
|
+
}[];
|
|
53
|
+
/** @deprecated Use DEFAULT_SAMPLE_COLLECTIONS */
|
|
54
|
+
export declare const DEFAULT_MOCK_COLLECTIONS: {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
image: string;
|
|
59
|
+
description: string;
|
|
60
|
+
productCount: number;
|
|
61
|
+
}[];
|
|
62
|
+
/** @deprecated Use DEFAULT_SAMPLE_SETTINGS */
|
|
63
|
+
export declare const DEFAULT_MOCK_SETTINGS: {
|
|
64
|
+
storeName: string;
|
|
65
|
+
currency: string;
|
|
66
|
+
language: string;
|
|
67
|
+
};
|
|
68
|
+
/** @deprecated Use buildHostData */
|
|
69
|
+
export declare const buildMockRenderData: typeof buildHostData;
|
package/dist/lib/mock-data.d.ts
CHANGED
|
@@ -1,39 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @deprecated This file is a backward-compatibility shim.
|
|
3
|
+
* Import from '@/lib/host-data' instead.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
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
|
-
};
|
|
5
|
+
export { DEFAULT_SAMPLE_PRODUCTS as DEFAULT_MOCK_PRODUCTS, DEFAULT_SAMPLE_COLLECTIONS as DEFAULT_MOCK_COLLECTIONS, DEFAULT_SAMPLE_SETTINGS as DEFAULT_MOCK_SETTINGS, buildHostData as buildMockRenderData, DEFAULT_SAMPLE_PRODUCTS, DEFAULT_SAMPLE_COLLECTIONS, DEFAULT_SAMPLE_SETTINGS, buildHostData, } from './host-data';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* NEXORA — PUBLISH VALIDATOR
|
|
4
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
* Validates a schema before publishing to catch structural issues,
|
|
6
|
+
* missing required props, orphan nodes, and binding errors.
|
|
7
|
+
*/
|
|
8
|
+
import { Schema, NodeType } from '@/types/schema';
|
|
9
|
+
import { PageType } from '@/types/page-types';
|
|
10
|
+
export type ValidationSeverity = 'error' | 'warning';
|
|
11
|
+
export interface ValidationIssue {
|
|
12
|
+
severity: ValidationSeverity;
|
|
13
|
+
nodeId?: string;
|
|
14
|
+
nodeType?: string;
|
|
15
|
+
message: string;
|
|
16
|
+
code: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PublishValidationResult {
|
|
19
|
+
valid: boolean;
|
|
20
|
+
issues: ValidationIssue[];
|
|
21
|
+
errors: ValidationIssue[];
|
|
22
|
+
warnings: ValidationIssue[];
|
|
23
|
+
}
|
|
24
|
+
interface ValidatorOptions {
|
|
25
|
+
/** Current page type for compatibility checks */
|
|
26
|
+
pageType?: PageType;
|
|
27
|
+
/** Whether to check bindings */
|
|
28
|
+
checkBindings?: boolean;
|
|
29
|
+
/** Custom required props per node type */
|
|
30
|
+
requiredProps?: Partial<Record<NodeType, string[]>>;
|
|
31
|
+
}
|
|
32
|
+
export declare function validateForPublish(schema: Schema, options?: ValidatorOptions): PublishValidationResult;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* RENDER CONTEXT UTILITIES
|
|
4
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* Helper functions for building and validating RenderContext objects.
|
|
7
|
+
* Used by both the builder and consumer templates.
|
|
8
|
+
*/
|
|
9
|
+
import { RenderContext, PageContext, RenderMode } from '@/types/contract';
|
|
10
|
+
import { ThemeTokens, SchemaNode } from '@/types/schema';
|
|
11
|
+
export interface BuildRenderContextOptions {
|
|
12
|
+
mode: RenderMode;
|
|
13
|
+
page?: Partial<PageContext>;
|
|
14
|
+
products?: any[];
|
|
15
|
+
collections?: any[];
|
|
16
|
+
pages?: any[];
|
|
17
|
+
settings?: Record<string, any>;
|
|
18
|
+
cardTemplate?: {
|
|
19
|
+
nodes: Record<string, SchemaNode>;
|
|
20
|
+
rootNodeId: string;
|
|
21
|
+
themeTokens?: ThemeTokens;
|
|
22
|
+
};
|
|
23
|
+
custom?: Record<string, any>;
|
|
24
|
+
theme?: ThemeTokens;
|
|
25
|
+
resolveAssetUrl?: (path: string) => string;
|
|
26
|
+
/** Use sample data when data is not provided */
|
|
27
|
+
useSampleData?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build a complete RenderContext from options.
|
|
31
|
+
*
|
|
32
|
+
* This is the recommended way to create a RenderContext in both
|
|
33
|
+
* builder (edit mode) and template (public/preview mode).
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildRenderContext(options: BuildRenderContextOptions): RenderContext;
|
|
36
|
+
/**
|
|
37
|
+
* Validate a RenderContext and return any issues.
|
|
38
|
+
* Used for debugging and pre-render checks.
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateRenderContext(ctx: RenderContext | undefined): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Check if RenderContext is "strict" (has all required fields for production).
|
|
43
|
+
* V1.1 will make these fields required; this helper aids migration.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isStrictRenderContext(ctx: RenderContext): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Build RenderContext for edit mode using hostData.
|
|
48
|
+
* This is the standard builder context builder.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildEditContext(hostData: Record<string, any> | undefined, theme?: ThemeTokens): RenderContext;
|
|
51
|
+
/**
|
|
52
|
+
* Create an iteration context for collection rendering (e.g., ProductGrid).
|
|
53
|
+
* Clones the parent context and adds currentItem/currentIndex.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createIterationContext(parentContext: RenderContext, item: any, index: number): RenderContext;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* SLOT UTILITIES
|
|
4
|
+
* ════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* Runtime utilities for handling slot behavior in the builder and renderer.
|
|
7
|
+
*/
|
|
8
|
+
import { SchemaNode, Schema } from '@/types/schema';
|
|
9
|
+
import { SlotBehavior, SlotAssignment } from '@/types/contract';
|
|
10
|
+
/**
|
|
11
|
+
* Get the slot assignment for a node, if any.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSlotAssignment(node: SchemaNode): SlotAssignment | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a node is assigned to a specific slot.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isInSlot(node: SchemaNode, slotName: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get the behavior of a node's slot.
|
|
20
|
+
* Returns 'editable' as default if no slot is assigned.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSlotBehavior(node: SchemaNode): SlotBehavior;
|
|
23
|
+
/**
|
|
24
|
+
* Check if a node is locked (cannot be edited/moved/deleted).
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSlotLocked(node: SchemaNode): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a node is editable in the current context.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isSlotEditable(node: SchemaNode): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a node is dynamic (data-driven).
|
|
33
|
+
*/
|
|
34
|
+
export declare function isSlotDynamic(node: SchemaNode): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get all nodes assigned to a specific slot.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getNodesInSlot(schema: Schema, slotName: string): SchemaNode[];
|
|
39
|
+
/**
|
|
40
|
+
* Get the fallback node ID for a slot, if configured.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getSlotFallback(node: SchemaNode): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Build slot constraints for the Inspector.
|
|
45
|
+
* Returns which props/actions should be disabled based on slot behavior.
|
|
46
|
+
*/
|
|
47
|
+
export interface SlotConstraints {
|
|
48
|
+
/** Can edit props in inspector */
|
|
49
|
+
canEditProps: boolean;
|
|
50
|
+
/** Can edit styles in inspector */
|
|
51
|
+
canEditStyles: boolean;
|
|
52
|
+
/** Can delete the node */
|
|
53
|
+
canDelete: boolean;
|
|
54
|
+
/** Can move/reorder the node */
|
|
55
|
+
canMove: boolean;
|
|
56
|
+
/** Can duplicate the node */
|
|
57
|
+
canDuplicate: boolean;
|
|
58
|
+
/** Reason for restrictions (shown to user) */
|
|
59
|
+
restrictionReason?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function getSlotConstraints(node: SchemaNode): SlotConstraints;
|
|
62
|
+
/**
|
|
63
|
+
* Validate slot assignments in a schema.
|
|
64
|
+
* Returns issues found.
|
|
65
|
+
*/
|
|
66
|
+
export declare function validateSlots(schema: Schema): string[];
|