@widgetic/creator 0.4.24 → 0.4.25
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/CreatorApp.svelte +20 -2
- package/package.json +1 -1
package/dist/CreatorApp.svelte
CHANGED
|
@@ -17360,6 +17360,24 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
17360
17360
|
const draftPanelState = getPanelState(draftId);
|
|
17361
17361
|
const draftName = getWidgetById(draftId)?.name
|
|
17362
17362
|
?? `ConvertedW-${Date.now()}`;
|
|
17363
|
+
let widgetName = draftName;
|
|
17364
|
+
try {
|
|
17365
|
+
const sketchForName = screenshot.startsWith('data:image/') ? screenshot : null;
|
|
17366
|
+
if (agentClient && (prompt.trim().length >= 2 || sketchForName)) {
|
|
17367
|
+
authStatus = 'Naming widget...';
|
|
17368
|
+
const suggestedName = await agentClient.suggestWidgetName(prompt, sketchForName);
|
|
17369
|
+
if (suggestedName) widgetName = suggestedName;
|
|
17370
|
+
}
|
|
17371
|
+
} catch (nameError) {
|
|
17372
|
+
console.warn('[WidgetCreator] Name suggestion before create failed:', nameError);
|
|
17373
|
+
}
|
|
17374
|
+
if (widgetName !== draftName) {
|
|
17375
|
+
announceToSite('widgetic:creator-primary-renamed', { name: widgetName });
|
|
17376
|
+
}
|
|
17377
|
+
widgets = widgets.map((widget) => widget.id === draftId ? { ...widget, name: widgetName } : widget);
|
|
17378
|
+
if (selectedWidget?.id === draftId) {
|
|
17379
|
+
selectedWidget = { ...selectedWidget, name: widgetName };
|
|
17380
|
+
}
|
|
17363
17381
|
|
|
17364
17382
|
authStatus = 'Creating widget from design...';
|
|
17365
17383
|
if (!canvasId) await ensureCanvasRowForFirstEdit();
|
|
@@ -17367,7 +17385,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
17367
17385
|
const response = await widgetsClient.createWidget(
|
|
17368
17386
|
{
|
|
17369
17387
|
newWidget: {
|
|
17370
|
-
name:
|
|
17388
|
+
name: widgetName,
|
|
17371
17389
|
type: 'widget',
|
|
17372
17390
|
// Canvas sketch snapshot is stored on the widget for future reference
|
|
17373
17391
|
content: {
|
|
@@ -17543,7 +17561,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
17543
17561
|
|
|
17544
17562
|
authStatus = 'Widget created from design.';
|
|
17545
17563
|
showToast('success', $t('creator.widget.widgetCreated'), {
|
|
17546
|
-
description: $t('creator.codegen.isReadyGenerationStarted', { name:
|
|
17564
|
+
description: $t('creator.codegen.isReadyGenerationStarted', { name: newWidget.name || widgetName })
|
|
17547
17565
|
});
|
|
17548
17566
|
return widgetId;
|
|
17549
17567
|
} catch (error) {
|