@mandolop97/constructor-nexora 1.0.8 → 1.0.9

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,4 +1,4 @@
1
- import { NodeType, NodeProps, NodeStyle } from '@/types/schema';
1
+ import { NodeType, NodeProps, NodeStyle, TemplateType } from '@/types/schema';
2
2
  import React from 'react';
3
3
  export interface InspectorFieldDef {
4
4
  /** Property key on NodeProps */
@@ -39,6 +39,11 @@ export interface BlockDefinition {
39
39
  * Only relevant for custom/host-defined blocks.
40
40
  */
41
41
  inspectorFields?: InspectorFieldDef[];
42
+ /**
43
+ * Restrict this block to specific template types.
44
+ * If undefined or empty, the block appears in all template types.
45
+ */
46
+ allowedTemplateTypes?: TemplateType[];
42
47
  }
43
48
  export declare const blockRegistry: BlockDefinition[];
44
49
  export declare function getBlockDef(type: NodeType): BlockDefinition | undefined;
@@ -51,7 +56,9 @@ export declare function registerBlock(def: BlockDefinition): void;
51
56
  /** Register multiple custom blocks at once. */
52
57
  export declare function registerBlocks(defs: BlockDefinition[]): void;
53
58
  export declare function getCategories(): string[];
54
- export declare function getBlocksByCategory(category: string): BlockDefinition[];
59
+ export declare function getBlocksByCategory(category: string, templateType?: TemplateType): BlockDefinition[];
60
+ /** Get categories that have at least one block for the given templateType */
61
+ export declare function getCategoriesForTemplate(templateType?: TemplateType): string[];
55
62
  /**
56
63
  * Check if a child node type can be placed inside a given parent node type.
57
64
  * - If child has allowedParents defined, parent must be in that list OR be the root.
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  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
3
  /** Extensible node type — accepts all built-in types plus any custom string. */
3
4
  export type NodeType = BuiltInNodeType | (string & {});
@@ -108,6 +109,8 @@ export interface SchemaNode {
108
109
  children: string[];
109
110
  locked?: boolean;
110
111
  hidden?: boolean;
112
+ /** User-defined custom name for this node (shown in Layers panel) */
113
+ customName?: string;
111
114
  }
112
115
  export interface ThemeTokens {
113
116
  colors: {
@@ -156,5 +159,19 @@ export interface PageDefinition {
156
159
  title: string;
157
160
  schema: Schema;
158
161
  status?: 'published' | 'draft';
162
+ /** Type of template being edited. Determines canvas behavior. */
163
+ templateType?: TemplateType;
164
+ /** Category for grouping in the sidebar (e.g. "Páginas", "Elementos Globales", "Templates") */
165
+ category?: string;
166
+ /** Optional icon component for the page list */
167
+ icon?: React.ComponentType;
168
+ /** Custom canvas dimensions. Overrides templateType defaults. */
169
+ canvasSize?: {
170
+ width: number;
171
+ height: number;
172
+ };
173
+ /** Mock data injected into custom components in edit/preview mode */
174
+ mockData?: Record<string, any>;
159
175
  }
160
176
  export type RenderMode = 'public' | 'preview' | 'edit';
177
+ export type TemplateType = 'page' | 'header' | 'footer' | 'component' | 'single';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mandolop97/constructor-nexora",
3
3
  "private": false,
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -17,9 +17,7 @@
17
17
  "react": "^18.0.0",
18
18
  "react-dom": "^18.0.0"
19
19
  },
20
- "files": [
21
- "dist"
22
- ],
20
+ "files": ["dist"],
23
21
  "scripts": {
24
22
  "dev": "vite",
25
23
  "build": "vite build",