@qikdev/mcp 6.6.45 → 6.6.47
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/build/src/sdk.d.ts +13 -0
- package/build/src/sdk.d.ts.map +1 -0
- package/build/src/sdk.js +33 -0
- package/build/src/sdk.js.map +1 -0
- package/build/src/tools/component-marketplace.d.ts +96 -0
- package/build/src/tools/component-marketplace.d.ts.map +1 -0
- package/build/src/tools/component-marketplace.js +259 -0
- package/build/src/tools/component-marketplace.js.map +1 -0
- package/build/src/tools/components.d.ts +23 -0
- package/build/src/tools/components.d.ts.map +1 -0
- package/build/src/tools/components.js +388 -0
- package/build/src/tools/components.js.map +1 -0
- package/build/src/tools/create.d.ts.map +1 -1
- package/build/src/tools/create.js +39 -0
- package/build/src/tools/create.js.map +1 -1
- package/build/src/tools/enhanced-interfaces.d.ts +21 -0
- package/build/src/tools/enhanced-interfaces.d.ts.map +1 -0
- package/build/src/tools/enhanced-interfaces.js +64 -0
- package/build/src/tools/enhanced-interfaces.js.map +1 -0
- package/build/src/tools/index.d.ts.map +1 -1
- package/build/src/tools/index.js +17 -0
- package/build/src/tools/index.js.map +1 -1
- package/build/src/tools/interface-builder.d.ts +19 -0
- package/build/src/tools/interface-builder.d.ts.map +1 -0
- package/build/src/tools/interface-builder.js +425 -0
- package/build/src/tools/interface-builder.js.map +1 -0
- package/build/src/tools/interfaces.d.ts +23 -0
- package/build/src/tools/interfaces.d.ts.map +1 -0
- package/build/src/tools/interfaces.js +821 -0
- package/build/src/tools/interfaces.js.map +1 -0
- package/build/src/tools/nlp-parser.d.ts +33 -0
- package/build/src/tools/nlp-parser.d.ts.map +1 -0
- package/build/src/tools/nlp-parser.js +258 -0
- package/build/src/tools/nlp-parser.js.map +1 -0
- package/build/src/tools/route-generator.d.ts +61 -0
- package/build/src/tools/route-generator.d.ts.map +1 -0
- package/build/src/tools/route-generator.js +388 -0
- package/build/src/tools/route-generator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
import { ConfigManager } from "../config.js";
|
|
2
|
+
// Tool to create interface with guided workflow
|
|
3
|
+
export const createInterfaceTool = {
|
|
4
|
+
name: "create_interface",
|
|
5
|
+
description: "🎨 Create a new user interface with guided component selection and intelligent suggestions",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "The title/name of the interface"
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: ["website", "web-app", "portal", "blog", "ecommerce", "custom"],
|
|
16
|
+
description: "The type of interface to create"
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Brief description of what this interface should do (optional)"
|
|
21
|
+
},
|
|
22
|
+
features: {
|
|
23
|
+
type: "array",
|
|
24
|
+
items: { type: "string" },
|
|
25
|
+
description: "List of features needed (e.g., 'user login', 'contact form', 'blog posts')"
|
|
26
|
+
},
|
|
27
|
+
template: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Use a predefined template (optional)"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: ["title", "type"],
|
|
33
|
+
additionalProperties: false
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Tool to add route to existing interface
|
|
37
|
+
export const addInterfaceRouteTool = {
|
|
38
|
+
name: "add_interface_route",
|
|
39
|
+
description: "🛣️ Add a new route/page to an existing interface",
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
interfaceId: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "The ID of the interface to modify"
|
|
46
|
+
},
|
|
47
|
+
routeTitle: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "The title of the new route/page"
|
|
50
|
+
},
|
|
51
|
+
routePath: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The URL path for the route (e.g., '/about', '/contact')"
|
|
54
|
+
},
|
|
55
|
+
routeName: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Internal name for the route (optional, will be generated from title)"
|
|
58
|
+
},
|
|
59
|
+
parentRoute: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Parent route name if this should be nested (optional)"
|
|
62
|
+
},
|
|
63
|
+
components: {
|
|
64
|
+
type: "array",
|
|
65
|
+
items: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
componentId: { type: "string" },
|
|
69
|
+
data: { type: "object" }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
description: "Components to add to this route (optional)"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
required: ["interfaceId", "routeTitle", "routePath"],
|
|
76
|
+
additionalProperties: false
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
// Tool to suggest interface templates
|
|
80
|
+
export const suggestInterfaceTemplatesTool = {
|
|
81
|
+
name: "suggest_interface_templates",
|
|
82
|
+
description: "💡 Get template suggestions based on interface requirements",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
type: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Type of interface (website, web-app, etc.)"
|
|
89
|
+
},
|
|
90
|
+
purpose: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "What the interface is for (business, portfolio, blog, etc.)"
|
|
93
|
+
},
|
|
94
|
+
features: {
|
|
95
|
+
type: "array",
|
|
96
|
+
items: { type: "string" },
|
|
97
|
+
description: "Required features"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
required: ["type"],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
// Handler for creating interfaces
|
|
105
|
+
export async function handleCreateInterface(args) {
|
|
106
|
+
try {
|
|
107
|
+
const configManager = new ConfigManager();
|
|
108
|
+
const config = await configManager.loadConfig();
|
|
109
|
+
if (!config) {
|
|
110
|
+
throw new Error('Qik MCP server not configured. Run setup first.');
|
|
111
|
+
}
|
|
112
|
+
// Get available components first
|
|
113
|
+
const componentsResponse = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/component/available`, {
|
|
114
|
+
headers: {
|
|
115
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
if (!componentsResponse.ok) {
|
|
120
|
+
throw new Error(`Failed to fetch available components: HTTP ${componentsResponse.status}`);
|
|
121
|
+
}
|
|
122
|
+
const availableComponents = await componentsResponse.json();
|
|
123
|
+
// Generate interface structure based on type and features
|
|
124
|
+
const interfaceStructure = generateInterfaceStructure(args, availableComponents);
|
|
125
|
+
// Create the interface using the existing create_content functionality
|
|
126
|
+
const createResponse = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/interface`, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: {
|
|
129
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
130
|
+
'Content-Type': 'application/json',
|
|
131
|
+
},
|
|
132
|
+
body: JSON.stringify(interfaceStructure)
|
|
133
|
+
});
|
|
134
|
+
if (!createResponse.ok) {
|
|
135
|
+
const errorText = await createResponse.text();
|
|
136
|
+
throw new Error(`Failed to create interface: HTTP ${createResponse.status} - ${errorText}`);
|
|
137
|
+
}
|
|
138
|
+
const createdInterface = await createResponse.json();
|
|
139
|
+
// Format success response
|
|
140
|
+
let resultText = `🎨 **Interface "${args.title}" created successfully!**\n\n`;
|
|
141
|
+
resultText += `**ID:** ${createdInterface._id}\n`;
|
|
142
|
+
resultText += `**Type:** ${args.type}\n\n`;
|
|
143
|
+
if (interfaceStructure.routes && interfaceStructure.routes.length > 0) {
|
|
144
|
+
resultText += `**Routes created (${interfaceStructure.routes.length}):**\n`;
|
|
145
|
+
interfaceStructure.routes.forEach((route, index) => {
|
|
146
|
+
if (route.type === 'route') {
|
|
147
|
+
resultText += `${index + 1}. ${route.title} (${route.path})\n`;
|
|
148
|
+
}
|
|
149
|
+
else if (route.type === 'folder' && route.routes) {
|
|
150
|
+
resultText += `${index + 1}. 📁 ${route.title}\n`;
|
|
151
|
+
route.routes.forEach((subRoute, subIndex) => {
|
|
152
|
+
resultText += ` ${subIndex + 1}. ${subRoute.title} (${subRoute.path})\n`;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
resultText += '\n';
|
|
157
|
+
}
|
|
158
|
+
if (interfaceStructure.menus && interfaceStructure.menus.length > 0) {
|
|
159
|
+
resultText += `**Menus created:** ${interfaceStructure.menus.map((m) => m.title).join(', ')}\n\n`;
|
|
160
|
+
}
|
|
161
|
+
resultText += '🚀 Your interface is ready! You can now:\n';
|
|
162
|
+
resultText += '• Use `add_interface_route` to add more pages\n';
|
|
163
|
+
resultText += '• Use `update_content` to modify existing routes\n';
|
|
164
|
+
resultText += '• Use `get_component_details` to customize components\n';
|
|
165
|
+
return {
|
|
166
|
+
content: [{
|
|
167
|
+
type: "text",
|
|
168
|
+
text: resultText
|
|
169
|
+
}]
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
return {
|
|
174
|
+
content: [{
|
|
175
|
+
type: "text",
|
|
176
|
+
text: `❌ Failed to create interface: ${error.message}`
|
|
177
|
+
}]
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Handler for adding routes to interfaces
|
|
182
|
+
export async function handleAddInterfaceRoute(args) {
|
|
183
|
+
try {
|
|
184
|
+
const configManager = new ConfigManager();
|
|
185
|
+
const config = await configManager.loadConfig();
|
|
186
|
+
if (!config) {
|
|
187
|
+
throw new Error('Qik MCP server not configured. Run setup first.');
|
|
188
|
+
}
|
|
189
|
+
// First, get the existing interface
|
|
190
|
+
const getResponse = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/interface/${args.interfaceId}`, {
|
|
191
|
+
headers: {
|
|
192
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
193
|
+
'Content-Type': 'application/json',
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
if (!getResponse.ok) {
|
|
197
|
+
throw new Error(`Failed to fetch interface: HTTP ${getResponse.status}`);
|
|
198
|
+
}
|
|
199
|
+
const existingInterface = await getResponse.json();
|
|
200
|
+
// Generate route name if not provided
|
|
201
|
+
const routeName = args.routeName || generateRouteName(args.routeTitle);
|
|
202
|
+
// Create new route structure
|
|
203
|
+
const newRoute = {
|
|
204
|
+
title: args.routeTitle,
|
|
205
|
+
path: args.routePath,
|
|
206
|
+
name: routeName,
|
|
207
|
+
type: 'route',
|
|
208
|
+
sections: [],
|
|
209
|
+
seo: {
|
|
210
|
+
title: args.routeTitle,
|
|
211
|
+
description: `${args.routeTitle} page`,
|
|
212
|
+
sitemapDisabled: false
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
// Add components if provided
|
|
216
|
+
if (args.components && args.components.length > 0) {
|
|
217
|
+
for (const comp of args.components) {
|
|
218
|
+
const section = {
|
|
219
|
+
title: `Section with ${comp.componentId}`,
|
|
220
|
+
uuid: generateUUID(),
|
|
221
|
+
componentID: comp.componentId,
|
|
222
|
+
componentVersion: 'latest',
|
|
223
|
+
model: comp.data || {},
|
|
224
|
+
slots: []
|
|
225
|
+
};
|
|
226
|
+
newRoute.sections.push(section);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
// Add a default Website Section with Basic Text
|
|
231
|
+
const defaultSection = {
|
|
232
|
+
title: "Website Section",
|
|
233
|
+
uuid: generateUUID(),
|
|
234
|
+
componentID: "647d02f56348660726cc552d", // Website Section component ID
|
|
235
|
+
componentVersion: "latest",
|
|
236
|
+
model: {
|
|
237
|
+
outerClass: "v-wrap",
|
|
238
|
+
innerClass: "h-wrap"
|
|
239
|
+
},
|
|
240
|
+
slots: [{
|
|
241
|
+
title: "Content",
|
|
242
|
+
key: "cells",
|
|
243
|
+
sections: [{
|
|
244
|
+
title: "Basic Text",
|
|
245
|
+
uuid: generateUUID(),
|
|
246
|
+
componentID: "62ba62fb63bd8436aae25c0c", // Basic Text component ID
|
|
247
|
+
componentVersion: "latest",
|
|
248
|
+
model: {
|
|
249
|
+
text: `<h2>${args.routeTitle}</h2><p>This is the ${args.routeTitle.toLowerCase()} page. Add your content here.</p>`
|
|
250
|
+
},
|
|
251
|
+
slots: []
|
|
252
|
+
}]
|
|
253
|
+
}]
|
|
254
|
+
};
|
|
255
|
+
newRoute.sections.push(defaultSection);
|
|
256
|
+
}
|
|
257
|
+
// Add route to the interface
|
|
258
|
+
if (!existingInterface.routes) {
|
|
259
|
+
existingInterface.routes = [];
|
|
260
|
+
}
|
|
261
|
+
// If parentRoute is specified, find it and add as nested route
|
|
262
|
+
if (args.parentRoute) {
|
|
263
|
+
const parentRoute = findRouteByName(existingInterface.routes, args.parentRoute);
|
|
264
|
+
if (parentRoute) {
|
|
265
|
+
if (!parentRoute.routes) {
|
|
266
|
+
parentRoute.routes = [];
|
|
267
|
+
}
|
|
268
|
+
parentRoute.routes.push(newRoute);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
throw new Error(`Parent route "${args.parentRoute}" not found`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
existingInterface.routes.push(newRoute);
|
|
276
|
+
}
|
|
277
|
+
// Update the interface
|
|
278
|
+
const updateResponse = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/interface/${args.interfaceId}`, {
|
|
279
|
+
method: 'PUT',
|
|
280
|
+
headers: {
|
|
281
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
282
|
+
'Content-Type': 'application/json',
|
|
283
|
+
},
|
|
284
|
+
body: JSON.stringify(existingInterface)
|
|
285
|
+
});
|
|
286
|
+
if (!updateResponse.ok) {
|
|
287
|
+
const errorText = await updateResponse.text();
|
|
288
|
+
throw new Error(`Failed to update interface: HTTP ${updateResponse.status} - ${errorText}`);
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
content: [{
|
|
292
|
+
type: "text",
|
|
293
|
+
text: `🛣️ **Route "${args.routeTitle}" added successfully!**\n\n` +
|
|
294
|
+
`**Path:** ${args.routePath}\n` +
|
|
295
|
+
`**Name:** ${routeName}\n` +
|
|
296
|
+
`**Components:** ${newRoute.sections?.length || 0} sections added\n\n` +
|
|
297
|
+
`The route is now available in your interface and can be accessed at ${args.routePath}.`
|
|
298
|
+
}]
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
return {
|
|
303
|
+
content: [{
|
|
304
|
+
type: "text",
|
|
305
|
+
text: `❌ Failed to add route: ${error.message}`
|
|
306
|
+
}]
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// Handler for suggesting interface templates
|
|
311
|
+
export async function handleSuggestInterfaceTemplates(args) {
|
|
312
|
+
const templates = getInterfaceTemplates();
|
|
313
|
+
// Filter templates based on type and features
|
|
314
|
+
let suggestedTemplates = templates.filter(template => {
|
|
315
|
+
if (args.type && !template.name.toLowerCase().includes(args.type.toLowerCase())) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
if (args.features && args.features.length > 0) {
|
|
319
|
+
const templateFeatures = getTemplateFeatures(template);
|
|
320
|
+
const hasRequiredFeatures = args.features.some((feature) => templateFeatures.some(tf => tf.toLowerCase().includes(feature.toLowerCase())));
|
|
321
|
+
return hasRequiredFeatures;
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
324
|
+
});
|
|
325
|
+
if (suggestedTemplates.length === 0) {
|
|
326
|
+
suggestedTemplates = templates.slice(0, 3); // Show first 3 as fallback
|
|
327
|
+
}
|
|
328
|
+
let resultText = `💡 **Interface template suggestions:**\n\n`;
|
|
329
|
+
suggestedTemplates.forEach((template, index) => {
|
|
330
|
+
resultText += `**${index + 1}. ${template.title}**\n`;
|
|
331
|
+
resultText += ` Template: ${template.name}\n`;
|
|
332
|
+
resultText += ` Description: ${template.description}\n`;
|
|
333
|
+
resultText += ` Routes: ${template.routes.length} pages\n`;
|
|
334
|
+
const features = getTemplateFeatures(template);
|
|
335
|
+
if (features.length > 0) {
|
|
336
|
+
resultText += ` Features: ${features.join(', ')}\n`;
|
|
337
|
+
}
|
|
338
|
+
resultText += '\n';
|
|
339
|
+
});
|
|
340
|
+
resultText += '🎨 Use `create_interface` with the `template` parameter to use any of these templates.';
|
|
341
|
+
return {
|
|
342
|
+
content: [{
|
|
343
|
+
type: "text",
|
|
344
|
+
text: resultText
|
|
345
|
+
}]
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
// Helper functions
|
|
349
|
+
function generateInterfaceStructure(args, availableComponents) {
|
|
350
|
+
const structure = {
|
|
351
|
+
title: args.title,
|
|
352
|
+
seo: {
|
|
353
|
+
title: args.title,
|
|
354
|
+
description: args.description || `${args.title} - Built with Qik`
|
|
355
|
+
},
|
|
356
|
+
menus: [],
|
|
357
|
+
services: [],
|
|
358
|
+
components: [],
|
|
359
|
+
styles: getDefaultStyles(),
|
|
360
|
+
header: { sections: [] },
|
|
361
|
+
footer: { sections: [] },
|
|
362
|
+
slots: [],
|
|
363
|
+
layout: "<div><header-slot /><route-slot /><footer-slot /></div>",
|
|
364
|
+
routes: []
|
|
365
|
+
};
|
|
366
|
+
// Use template if specified
|
|
367
|
+
if (args.template) {
|
|
368
|
+
const templates = getInterfaceTemplates();
|
|
369
|
+
const template = templates.find(t => t.name === args.template);
|
|
370
|
+
if (template) {
|
|
371
|
+
structure.routes = template.routes;
|
|
372
|
+
structure.menus = template.menus || [];
|
|
373
|
+
structure.header = template.header || { sections: [] };
|
|
374
|
+
structure.footer = template.footer || { sections: [] };
|
|
375
|
+
return structure;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Generate routes based on type
|
|
379
|
+
switch (args.type) {
|
|
380
|
+
case 'website':
|
|
381
|
+
structure.routes = generateWebsiteRoutes(availableComponents);
|
|
382
|
+
structure.menus = generateWebsiteMenus();
|
|
383
|
+
break;
|
|
384
|
+
case 'web-app':
|
|
385
|
+
structure.routes = generateWebAppRoutes(availableComponents);
|
|
386
|
+
structure.menus = generateWebAppMenus();
|
|
387
|
+
break;
|
|
388
|
+
case 'portal':
|
|
389
|
+
structure.routes = generatePortalRoutes(availableComponents);
|
|
390
|
+
structure.menus = generatePortalMenus();
|
|
391
|
+
break;
|
|
392
|
+
case 'blog':
|
|
393
|
+
structure.routes = generateBlogRoutes(availableComponents);
|
|
394
|
+
structure.menus = generateBlogMenus();
|
|
395
|
+
break;
|
|
396
|
+
default:
|
|
397
|
+
structure.routes = generateBasicRoutes(availableComponents);
|
|
398
|
+
structure.menus = generateBasicMenus();
|
|
399
|
+
}
|
|
400
|
+
return structure;
|
|
401
|
+
}
|
|
402
|
+
function generateWebsiteRoutes(components) {
|
|
403
|
+
return [
|
|
404
|
+
{
|
|
405
|
+
title: "Home",
|
|
406
|
+
path: "/",
|
|
407
|
+
name: "home",
|
|
408
|
+
type: "route",
|
|
409
|
+
sections: [
|
|
410
|
+
{
|
|
411
|
+
title: "Hero Section",
|
|
412
|
+
uuid: generateUUID(),
|
|
413
|
+
componentID: "647d02f56348660726cc552d",
|
|
414
|
+
componentVersion: "latest",
|
|
415
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
416
|
+
slots: [{
|
|
417
|
+
title: "Content",
|
|
418
|
+
key: "cells",
|
|
419
|
+
sections: [{
|
|
420
|
+
title: "Welcome Text",
|
|
421
|
+
uuid: generateUUID(),
|
|
422
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
423
|
+
componentVersion: "latest",
|
|
424
|
+
model: {
|
|
425
|
+
text: "<h1>Welcome to Our Website</h1><p>This is a great place to introduce your business or organization.</p>"
|
|
426
|
+
},
|
|
427
|
+
slots: []
|
|
428
|
+
}]
|
|
429
|
+
}]
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
title: "About",
|
|
435
|
+
path: "/about",
|
|
436
|
+
name: "about",
|
|
437
|
+
type: "route",
|
|
438
|
+
sections: [
|
|
439
|
+
{
|
|
440
|
+
title: "About Section",
|
|
441
|
+
uuid: generateUUID(),
|
|
442
|
+
componentID: "647d02f56348660726cc552d",
|
|
443
|
+
componentVersion: "latest",
|
|
444
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
445
|
+
slots: [{
|
|
446
|
+
title: "Content",
|
|
447
|
+
key: "cells",
|
|
448
|
+
sections: [{
|
|
449
|
+
title: "About Text",
|
|
450
|
+
uuid: generateUUID(),
|
|
451
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
452
|
+
componentVersion: "latest",
|
|
453
|
+
model: {
|
|
454
|
+
text: "<h2>About Us</h2><p>Tell your story here. What makes your organization unique?</p>"
|
|
455
|
+
},
|
|
456
|
+
slots: []
|
|
457
|
+
}]
|
|
458
|
+
}]
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
title: "Contact",
|
|
464
|
+
path: "/contact",
|
|
465
|
+
name: "contact",
|
|
466
|
+
type: "route",
|
|
467
|
+
sections: [
|
|
468
|
+
{
|
|
469
|
+
title: "Contact Section",
|
|
470
|
+
uuid: generateUUID(),
|
|
471
|
+
componentID: "647d02f56348660726cc552d",
|
|
472
|
+
componentVersion: "latest",
|
|
473
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
474
|
+
slots: [{
|
|
475
|
+
title: "Content",
|
|
476
|
+
key: "cells",
|
|
477
|
+
sections: [{
|
|
478
|
+
title: "Contact Text",
|
|
479
|
+
uuid: generateUUID(),
|
|
480
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
481
|
+
componentVersion: "latest",
|
|
482
|
+
model: {
|
|
483
|
+
text: "<h2>Contact Us</h2><p>Get in touch with us. We'd love to hear from you!</p>"
|
|
484
|
+
},
|
|
485
|
+
slots: []
|
|
486
|
+
}]
|
|
487
|
+
}]
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
];
|
|
492
|
+
}
|
|
493
|
+
function generateWebAppRoutes(components) {
|
|
494
|
+
return [
|
|
495
|
+
{
|
|
496
|
+
title: "Dashboard",
|
|
497
|
+
path: "/",
|
|
498
|
+
name: "dashboard",
|
|
499
|
+
type: "route",
|
|
500
|
+
sections: [
|
|
501
|
+
{
|
|
502
|
+
title: "Dashboard Section",
|
|
503
|
+
uuid: generateUUID(),
|
|
504
|
+
componentID: "647d02f56348660726cc552d",
|
|
505
|
+
componentVersion: "latest",
|
|
506
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
507
|
+
slots: [{
|
|
508
|
+
title: "Content",
|
|
509
|
+
key: "cells",
|
|
510
|
+
sections: [{
|
|
511
|
+
title: "Dashboard Content",
|
|
512
|
+
uuid: generateUUID(),
|
|
513
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
514
|
+
componentVersion: "latest",
|
|
515
|
+
model: {
|
|
516
|
+
text: "<h1>Dashboard</h1><p>Welcome to your dashboard. Your app content goes here.</p>"
|
|
517
|
+
},
|
|
518
|
+
slots: []
|
|
519
|
+
}]
|
|
520
|
+
}]
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
title: "User",
|
|
526
|
+
path: "/user",
|
|
527
|
+
name: "user",
|
|
528
|
+
type: "folder",
|
|
529
|
+
routes: [
|
|
530
|
+
{
|
|
531
|
+
title: "Login",
|
|
532
|
+
path: "/login",
|
|
533
|
+
name: "login",
|
|
534
|
+
type: "route",
|
|
535
|
+
sections: [
|
|
536
|
+
{
|
|
537
|
+
title: "Login Section",
|
|
538
|
+
uuid: generateUUID(),
|
|
539
|
+
componentID: "647d02f56348660726cc552d",
|
|
540
|
+
componentVersion: "latest",
|
|
541
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
542
|
+
slots: [{
|
|
543
|
+
title: "Content",
|
|
544
|
+
key: "cells",
|
|
545
|
+
sections: [{
|
|
546
|
+
title: "Login Form",
|
|
547
|
+
uuid: generateUUID(),
|
|
548
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
549
|
+
componentVersion: "latest",
|
|
550
|
+
model: {
|
|
551
|
+
text: "<h2>Login</h2><p>Login form will be added here.</p>"
|
|
552
|
+
},
|
|
553
|
+
slots: []
|
|
554
|
+
}]
|
|
555
|
+
}]
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
title: "Profile",
|
|
561
|
+
path: "/profile",
|
|
562
|
+
name: "profile",
|
|
563
|
+
type: "route",
|
|
564
|
+
sections: [
|
|
565
|
+
{
|
|
566
|
+
title: "Profile Section",
|
|
567
|
+
uuid: generateUUID(),
|
|
568
|
+
componentID: "647d02f56348660726cc552d",
|
|
569
|
+
componentVersion: "latest",
|
|
570
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
571
|
+
slots: [{
|
|
572
|
+
title: "Content",
|
|
573
|
+
key: "cells",
|
|
574
|
+
sections: [{
|
|
575
|
+
title: "Profile Content",
|
|
576
|
+
uuid: generateUUID(),
|
|
577
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
578
|
+
componentVersion: "latest",
|
|
579
|
+
model: {
|
|
580
|
+
text: "<h2>User Profile</h2><p>User profile information goes here.</p>"
|
|
581
|
+
},
|
|
582
|
+
slots: []
|
|
583
|
+
}]
|
|
584
|
+
}]
|
|
585
|
+
}
|
|
586
|
+
]
|
|
587
|
+
}
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
];
|
|
591
|
+
}
|
|
592
|
+
function generatePortalRoutes(components) {
|
|
593
|
+
return generateWebAppRoutes(components); // Similar to web app for now
|
|
594
|
+
}
|
|
595
|
+
function generateBlogRoutes(components) {
|
|
596
|
+
return [
|
|
597
|
+
{
|
|
598
|
+
title: "Home",
|
|
599
|
+
path: "/",
|
|
600
|
+
name: "home",
|
|
601
|
+
type: "route",
|
|
602
|
+
sections: [
|
|
603
|
+
{
|
|
604
|
+
title: "Blog Home",
|
|
605
|
+
uuid: generateUUID(),
|
|
606
|
+
componentID: "647d02f56348660726cc552d",
|
|
607
|
+
componentVersion: "latest",
|
|
608
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
609
|
+
slots: [{
|
|
610
|
+
title: "Content",
|
|
611
|
+
key: "cells",
|
|
612
|
+
sections: [{
|
|
613
|
+
title: "Blog Intro",
|
|
614
|
+
uuid: generateUUID(),
|
|
615
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
616
|
+
componentVersion: "latest",
|
|
617
|
+
model: {
|
|
618
|
+
text: "<h1>My Blog</h1><p>Welcome to my blog. Here you'll find my latest thoughts and articles.</p>"
|
|
619
|
+
},
|
|
620
|
+
slots: []
|
|
621
|
+
}]
|
|
622
|
+
}]
|
|
623
|
+
}
|
|
624
|
+
]
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
title: "About",
|
|
628
|
+
path: "/about",
|
|
629
|
+
name: "about",
|
|
630
|
+
type: "route",
|
|
631
|
+
sections: [
|
|
632
|
+
{
|
|
633
|
+
title: "About Section",
|
|
634
|
+
uuid: generateUUID(),
|
|
635
|
+
componentID: "647d02f56348660726cc552d",
|
|
636
|
+
componentVersion: "latest",
|
|
637
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
638
|
+
slots: [{
|
|
639
|
+
title: "Content",
|
|
640
|
+
key: "cells",
|
|
641
|
+
sections: [{
|
|
642
|
+
title: "About Text",
|
|
643
|
+
uuid: generateUUID(),
|
|
644
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
645
|
+
componentVersion: "latest",
|
|
646
|
+
model: {
|
|
647
|
+
text: "<h2>About Me</h2><p>Learn more about the author of this blog.</p>"
|
|
648
|
+
},
|
|
649
|
+
slots: []
|
|
650
|
+
}]
|
|
651
|
+
}]
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
];
|
|
656
|
+
}
|
|
657
|
+
function generateBasicRoutes(components) {
|
|
658
|
+
return [
|
|
659
|
+
{
|
|
660
|
+
title: "Home",
|
|
661
|
+
path: "/",
|
|
662
|
+
name: "home",
|
|
663
|
+
type: "route",
|
|
664
|
+
sections: [
|
|
665
|
+
{
|
|
666
|
+
title: "Home Section",
|
|
667
|
+
uuid: generateUUID(),
|
|
668
|
+
componentID: "647d02f56348660726cc552d",
|
|
669
|
+
componentVersion: "latest",
|
|
670
|
+
model: { outerClass: "v-wrap", innerClass: "h-wrap" },
|
|
671
|
+
slots: [{
|
|
672
|
+
title: "Content",
|
|
673
|
+
key: "cells",
|
|
674
|
+
sections: [{
|
|
675
|
+
title: "Welcome Text",
|
|
676
|
+
uuid: generateUUID(),
|
|
677
|
+
componentID: "62ba62fb63bd8436aae25c0c",
|
|
678
|
+
componentVersion: "latest",
|
|
679
|
+
model: {
|
|
680
|
+
text: "<h1>Welcome</h1><p>This is your new interface. Start customizing it!</p>"
|
|
681
|
+
},
|
|
682
|
+
slots: []
|
|
683
|
+
}]
|
|
684
|
+
}]
|
|
685
|
+
}
|
|
686
|
+
]
|
|
687
|
+
}
|
|
688
|
+
];
|
|
689
|
+
}
|
|
690
|
+
function generateWebsiteMenus() {
|
|
691
|
+
return [
|
|
692
|
+
{
|
|
693
|
+
title: "Primary Menu",
|
|
694
|
+
name: "primaryMenu",
|
|
695
|
+
items: [
|
|
696
|
+
{ title: "Home", type: "route", route: "home" },
|
|
697
|
+
{ title: "About", type: "route", route: "about" },
|
|
698
|
+
{ title: "Contact", type: "route", route: "contact" }
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
];
|
|
702
|
+
}
|
|
703
|
+
function generateWebAppMenus() {
|
|
704
|
+
return [
|
|
705
|
+
{
|
|
706
|
+
title: "Primary Menu",
|
|
707
|
+
name: "primaryMenu",
|
|
708
|
+
items: [
|
|
709
|
+
{ title: "Dashboard", type: "route", route: "dashboard" },
|
|
710
|
+
{ title: "Login", type: "route", route: "login" },
|
|
711
|
+
{ title: "Profile", type: "route", route: "profile" }
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
function generatePortalMenus() {
|
|
717
|
+
return generateWebAppMenus(); // Similar to web app
|
|
718
|
+
}
|
|
719
|
+
function generateBlogMenus() {
|
|
720
|
+
return [
|
|
721
|
+
{
|
|
722
|
+
title: "Primary Menu",
|
|
723
|
+
name: "primaryMenu",
|
|
724
|
+
items: [
|
|
725
|
+
{ title: "Home", type: "route", route: "home" },
|
|
726
|
+
{ title: "About", type: "route", route: "about" }
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
];
|
|
730
|
+
}
|
|
731
|
+
function generateBasicMenus() {
|
|
732
|
+
return [
|
|
733
|
+
{
|
|
734
|
+
title: "Primary Menu",
|
|
735
|
+
name: "primaryMenu",
|
|
736
|
+
items: [
|
|
737
|
+
{ title: "Home", type: "route", route: "home" }
|
|
738
|
+
]
|
|
739
|
+
}
|
|
740
|
+
];
|
|
741
|
+
}
|
|
742
|
+
function getDefaultStyles() {
|
|
743
|
+
return {
|
|
744
|
+
pre: ":root {\n --primary: #007bff;\n --text: #333;\n --bg: #fff;\n}",
|
|
745
|
+
post: "body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }",
|
|
746
|
+
includes: [],
|
|
747
|
+
themes: []
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
function getInterfaceTemplates() {
|
|
751
|
+
return [
|
|
752
|
+
{
|
|
753
|
+
name: "basic-website",
|
|
754
|
+
title: "Basic Website",
|
|
755
|
+
description: "Simple website with Home, About, and Contact pages",
|
|
756
|
+
routes: generateWebsiteRoutes([]),
|
|
757
|
+
menus: generateWebsiteMenus()
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "user-portal",
|
|
761
|
+
title: "User Portal",
|
|
762
|
+
description: "Web application with user authentication and dashboard",
|
|
763
|
+
routes: generateWebAppRoutes([]),
|
|
764
|
+
menus: generateWebAppMenus()
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: "blog-site",
|
|
768
|
+
title: "Blog Site",
|
|
769
|
+
description: "Blog website with article listing and detail pages",
|
|
770
|
+
routes: generateBlogRoutes([]),
|
|
771
|
+
menus: generateBlogMenus()
|
|
772
|
+
}
|
|
773
|
+
];
|
|
774
|
+
}
|
|
775
|
+
function getTemplateFeatures(template) {
|
|
776
|
+
const features = [];
|
|
777
|
+
// Analyze routes to determine features
|
|
778
|
+
const routeNames = template.routes.map(r => r.name?.toLowerCase() || r.title.toLowerCase());
|
|
779
|
+
if (routeNames.includes('login') || routeNames.includes('signin')) {
|
|
780
|
+
features.push('User Authentication');
|
|
781
|
+
}
|
|
782
|
+
if (routeNames.includes('profile') || routeNames.includes('account')) {
|
|
783
|
+
features.push('User Profiles');
|
|
784
|
+
}
|
|
785
|
+
if (routeNames.includes('dashboard')) {
|
|
786
|
+
features.push('Dashboard');
|
|
787
|
+
}
|
|
788
|
+
if (routeNames.includes('blog') || routeNames.includes('articles')) {
|
|
789
|
+
features.push('Blog/Articles');
|
|
790
|
+
}
|
|
791
|
+
if (routeNames.includes('contact')) {
|
|
792
|
+
features.push('Contact Page');
|
|
793
|
+
}
|
|
794
|
+
if (template.menus && template.menus.length > 0) {
|
|
795
|
+
features.push('Navigation Menu');
|
|
796
|
+
}
|
|
797
|
+
return features;
|
|
798
|
+
}
|
|
799
|
+
function generateRouteName(title) {
|
|
800
|
+
return title.toLowerCase()
|
|
801
|
+
.replace(/[^a-z0-9\s]/g, '')
|
|
802
|
+
.replace(/\s+/g, '')
|
|
803
|
+
.substring(0, 20);
|
|
804
|
+
}
|
|
805
|
+
function generateUUID() {
|
|
806
|
+
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
807
|
+
}
|
|
808
|
+
function findRouteByName(routes, name) {
|
|
809
|
+
for (const route of routes) {
|
|
810
|
+
if (route.name === name) {
|
|
811
|
+
return route;
|
|
812
|
+
}
|
|
813
|
+
if (route.routes) {
|
|
814
|
+
const found = findRouteByName(route.routes, name);
|
|
815
|
+
if (found)
|
|
816
|
+
return found;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return null;
|
|
820
|
+
}
|
|
821
|
+
//# sourceMappingURL=interfaces.js.map
|