@mandolop97/constructor-nexora 1.0.7 → 1.0.8

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.
@@ -1,5 +1,18 @@
1
1
  import { NodeType, NodeProps, NodeStyle } from '@/types/schema';
2
2
  import React from 'react';
3
+ export interface InspectorFieldDef {
4
+ /** Property key on NodeProps */
5
+ key: string;
6
+ /** Display label */
7
+ label: string;
8
+ /** Field type: text input, select dropdown, or color picker */
9
+ type: 'text' | 'select' | 'color' | 'number';
10
+ /** Options for 'select' type */
11
+ options?: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ }
3
16
  export interface BlockDefinition {
4
17
  type: NodeType;
5
18
  label: string;
@@ -20,9 +33,23 @@ export interface BlockDefinition {
20
33
  * Only relevant for canHaveChildren=true blocks.
21
34
  */
22
35
  allowedChildren?: NodeType[];
36
+ /**
37
+ * Custom inspector fields for this block type.
38
+ * When defined, these fields are rendered in the Props tab of the inspector.
39
+ * Only relevant for custom/host-defined blocks.
40
+ */
41
+ inspectorFields?: InspectorFieldDef[];
23
42
  }
24
43
  export declare const blockRegistry: BlockDefinition[];
25
44
  export declare function getBlockDef(type: NodeType): BlockDefinition | undefined;
45
+ /**
46
+ * Register a custom block definition at runtime.
47
+ * It will appear in the blocks palette and support drag-and-drop.
48
+ * If a block with the same type already exists it will be replaced.
49
+ */
50
+ export declare function registerBlock(def: BlockDefinition): void;
51
+ /** Register multiple custom blocks at once. */
52
+ export declare function registerBlocks(defs: BlockDefinition[]): void;
26
53
  export declare function getCategories(): string[];
27
54
  export declare function getBlocksByCategory(category: string): BlockDefinition[];
28
55
  /**
@@ -1,3 +1,11 @@
1
1
  import { SchemaNode, NodeType } from '@/types/schema';
2
2
  export declare function isContainerType(type: NodeType): boolean;
3
3
  export declare function createNode(type: NodeType): SchemaNode;
4
+ /**
5
+ * Deep-clone a node and all its descendants, assigning fresh IDs.
6
+ * Returns a map of all new nodes (keyed by new ID) and the new root ID.
7
+ */
8
+ export declare function duplicateNodeTree(sourceId: string, nodes: Record<string, SchemaNode>): {
9
+ newNodes: Record<string, SchemaNode>;
10
+ newRootId: string;
11
+ };
@@ -1,4 +1,6 @@
1
- export type NodeType = 'Section' | 'Container' | 'Grid' | 'Stack' | 'Text' | 'Image' | 'Divider' | 'Badge' | 'Button' | 'Card' | 'Input' | 'ProductCard' | 'Navbar' | 'Footer' | 'AnnouncementBar' | 'FeatureBar' | 'TestimonialCard' | 'NewsletterSection' | 'HeroSection' | 'Accordion' | 'TabsBlock' | 'VideoEmbed';
1
+ export type BuiltInNodeType = 'Section' | 'Container' | 'Grid' | 'Stack' | 'Text' | 'Image' | 'Divider' | 'Badge' | 'Button' | 'Card' | 'Input' | 'ProductCard' | 'Navbar' | 'Footer' | 'AnnouncementBar' | 'FeatureBar' | 'TestimonialCard' | 'NewsletterSection' | 'HeroSection' | 'Accordion' | 'TabsBlock' | 'VideoEmbed';
2
+ /** Extensible node type — accepts all built-in types plus any custom string. */
3
+ export type NodeType = BuiltInNodeType | (string & {});
2
4
  export interface NodeStyle {
3
5
  padding?: string;
4
6
  margin?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mandolop97/constructor-nexora",
3
3
  "private": false,
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",