@widgetic/creator 0.4.49 → 0.4.50
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 +395 -85
- package/dist/components/BrandKitPanel.svelte.d.ts +1 -1
- package/dist/components/FileUrlSourceControl.svelte.d.ts +1 -1
- package/dist/components/WidgetDetails.svelte +4 -1
- package/dist/components/WidgetDetails.svelte.d.ts +1 -1
- package/dist/components/WidgetShapeLivePreviews.svelte +1 -1
- package/dist/i18n/language.d.ts +15 -17
- package/dist/i18n/messages.d.ts +7 -9
- package/dist/i18n/messages.js +7 -9
- package/dist/mergeBatchWidgetOntoListRecord.d.ts +16 -0
- package/dist/mergeBatchWidgetOntoListRecord.js +32 -0
- package/dist/sketchBarState.d.ts +10 -3
- package/dist/sketchBarState.js +26 -6
- package/dist/sketchBoardAfterDelete.d.ts +34 -0
- package/dist/sketchBoardAfterDelete.js +20 -0
- package/dist/sketchBoardStatusChip.d.ts +15 -0
- package/dist/sketchBoardStatusChip.js +17 -0
- package/dist/sketchToolbarMode.d.ts +13 -0
- package/dist/sketchToolbarMode.js +13 -0
- package/package.json +3 -3
package/dist/CreatorApp.svelte
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import {
|
|
11
11
|
Button,
|
|
12
|
+
CanvasBoardStatusChip,
|
|
12
13
|
CreatorBar,
|
|
13
14
|
DropdownMenu,
|
|
14
15
|
PasswordInput,
|
|
@@ -60,7 +61,12 @@
|
|
|
60
61
|
sketchBarShowsCustomize,
|
|
61
62
|
sketchBarShowsPublish,
|
|
62
63
|
sketchSavedStatusLabel,
|
|
64
|
+
widgetRowHeadIsAheadOfLive,
|
|
63
65
|
} from './sketchBarState.js';
|
|
66
|
+
import { resolveSketchBoardStatusChip } from './sketchBoardStatusChip.js';
|
|
67
|
+
import { shouldHideDrawingToolbarForSelector } from './sketchToolbarMode.js';
|
|
68
|
+
import { stepAfterBoardChange } from './sketchBoardAfterDelete.js';
|
|
69
|
+
import { mergeBatchWidgetOntoListRecord } from './mergeBatchWidgetOntoListRecord.js';
|
|
64
70
|
import { isDebugTabVisible } from './debug/debugUiVisibility.js';
|
|
65
71
|
import { shouldNudgeSendBeforePublish } from './publish/publishGenerationGate.js';
|
|
66
72
|
|
|
@@ -1445,7 +1451,11 @@
|
|
|
1445
1451
|
let deleteDialogWidgetId = '';
|
|
1446
1452
|
let deleteDialogStep: 'confirm-remove' | 'confirm-delete-db' = 'confirm-remove';
|
|
1447
1453
|
let deleteDialogResolve: ((result: { proceed: boolean; deleteFromDb: boolean }) => void) | null = null;
|
|
1448
|
-
/**
|
|
1454
|
+
/**
|
|
1455
|
+
* Delete recovery (item 21, option A): first confirm removes the canvas shape only (`deleteFromDb: false`).
|
|
1456
|
+
* Gateway `DELETE /widgets/:id` hard-deletes CDN, compositions, and the DB row — not called unless this flag enables step 2.
|
|
1457
|
+
* Undo restores the shape from canvas history; the widget row stays in the project list.
|
|
1458
|
+
*/
|
|
1449
1459
|
const ASK_DELETE_FROM_DB_CONFIRM = false;
|
|
1450
1460
|
|
|
1451
1461
|
function showDeleteWidgetDialog(widgetId: string, widgetName: string): Promise<{ proceed: boolean; deleteFromDb: boolean }> {
|
|
@@ -1472,7 +1482,7 @@
|
|
|
1472
1482
|
return;
|
|
1473
1483
|
}
|
|
1474
1484
|
deleteDialogOpen = false;
|
|
1475
|
-
if (deleteDialogResolve) deleteDialogResolve({ proceed: true, deleteFromDb:
|
|
1485
|
+
if (deleteDialogResolve) deleteDialogResolve({ proceed: true, deleteFromDb: false });
|
|
1476
1486
|
break;
|
|
1477
1487
|
case 'keep-in-db':
|
|
1478
1488
|
deleteDialogOpen = false;
|
|
@@ -1500,7 +1510,6 @@
|
|
|
1500
1510
|
if (selectedWidgetId === widgetId) {
|
|
1501
1511
|
selectedWidgetId = null;
|
|
1502
1512
|
}
|
|
1503
|
-
showToast('success', $t('creator.widget.widgetDeletedFromDatabase'));
|
|
1504
1513
|
} catch (err) {
|
|
1505
1514
|
// A shape can outlive its widget row (deleted from the Projects page or
|
|
1506
1515
|
// another session). The canvas only needs the shape and local entry gone,
|
|
@@ -1583,8 +1592,6 @@
|
|
|
1583
1592
|
'Create a widget from the attached image (short description inside).';
|
|
1584
1593
|
/** Prefilled prompt for Convert-to-Widget — user edits or presses Send to start. */
|
|
1585
1594
|
const CONVERT_PROMPT = 'Create a widget starting from the attached image';
|
|
1586
|
-
/** Id of the one model the docked chat offers when the person is not in debug mode (its label is a message: `creator.codegen.assistantModelLabel`). */
|
|
1587
|
-
const ASSISTANT_MODEL_ID = 'assistant';
|
|
1588
1595
|
let codeGenerationPrompt = DEFAULT_PROMPT;
|
|
1589
1596
|
let isGeneratingCode = false;
|
|
1590
1597
|
let generatingWidgetIds: Record<string, boolean> = {};
|
|
@@ -2469,6 +2476,11 @@
|
|
|
2469
2476
|
function handleChatConversationChange(conversationId: string | null, sourceWidgetId?: string) {
|
|
2470
2477
|
const widgetId = sourceWidgetId ?? selectedWidgetId;
|
|
2471
2478
|
if (!widgetId) return;
|
|
2479
|
+
if (conversationId) {
|
|
2480
|
+
creatorStorage.setItem(CHAT_CONVERSATION_STORAGE_PREFIX + widgetId, conversationId);
|
|
2481
|
+
} else {
|
|
2482
|
+
creatorStorage.removeItem(CHAT_CONVERSATION_STORAGE_PREFIX + widgetId);
|
|
2483
|
+
}
|
|
2472
2484
|
patchPanelSnapshot(widgetId, { currentChatConversationId: conversationId });
|
|
2473
2485
|
if (widgetId === focusedPanelWidgetId) {
|
|
2474
2486
|
currentChatConversationId = conversationId;
|
|
@@ -4150,6 +4162,7 @@
|
|
|
4150
4162
|
const PROMPT_TEXT_STORAGE_PREFIX = 'widgetCreator_promptText_';
|
|
4151
4163
|
const PROMPT_IMAGES_STORAGE_PREFIX = 'widgetCreator_promptImages_';
|
|
4152
4164
|
const CHAT_DRAFT_STORAGE_PREFIX = 'widgetCreator_chatDraft_';
|
|
4165
|
+
const CHAT_CONVERSATION_STORAGE_PREFIX = 'widgetCreator_chatConversationId_';
|
|
4153
4166
|
|
|
4154
4167
|
let isGenerateDisabled = true;
|
|
4155
4168
|
// Publish state: true while the build job is running
|
|
@@ -6411,9 +6424,20 @@
|
|
|
6411
6424
|
return isSketchGenerationFailed(getPanelDisplayState(widgetId), w);
|
|
6412
6425
|
}
|
|
6413
6426
|
|
|
6414
|
-
|
|
6427
|
+
/**
|
|
6428
|
+
* What the bar above the sketch shows (title, status, Publish, Live badge, board chip, drawing tools or selector) is worked
|
|
6429
|
+
* out by functions that read the widget record (`widgetsById`) and the panel state (`panelDisplayRevision`). Svelte 4 re-runs
|
|
6430
|
+
* a `$:` line only when a variable named in the line itself changes, so a line that named only `canvasPrimaryWidgetId` kept
|
|
6431
|
+
* the answer it had when the id was set, and an answer that arrived afterwards (the widgets of the canvas, the canvas
|
|
6432
|
+
* document, the publish history) never reached the bar: a published widget with changes showed "Live" and no Publish, and a
|
|
6433
|
+
* widget whose build failed lost its drawing tools. Every line of the bar names this object, which is new whenever either
|
|
6434
|
+
* of the two changes. Pinned by `sketchBarReactivity.test.ts`.
|
|
6435
|
+
*/
|
|
6436
|
+
$: sketchBarSources = { panelDisplayRevision, widgetsById };
|
|
6437
|
+
|
|
6438
|
+
$: sketchBarGenerationFailed = (void sketchBarSources, sketchPrimaryGenerationFailed(canvasPrimaryWidgetId));
|
|
6415
6439
|
|
|
6416
|
-
$: sketchBarTitleLabel = (void panelDisplayRevision, void sketchBarGenerationFailed, void canvasPrimaryWidgetId, sketchBarTitle());
|
|
6440
|
+
$: sketchBarTitleLabel = (void sketchBarSources, void panelDisplayRevision, void sketchBarGenerationFailed, void canvasPrimaryWidgetId, void sketchWidgetNamesFromBatch, void sketchCanvasPersistenceName, void activeCanvasName, sketchBarTitle());
|
|
6417
6441
|
|
|
6418
6442
|
function sketchBarTitle(): string {
|
|
6419
6443
|
const untitled = $t('creator.widget.untitledName');
|
|
@@ -6464,6 +6488,23 @@
|
|
|
6464
6488
|
return resolvePublishedVersionFromWidget(widget as WidgetSummary | null) !== null;
|
|
6465
6489
|
}
|
|
6466
6490
|
|
|
6491
|
+
/**
|
|
6492
|
+
* A published widget whose row says HEAD is not the live commit. The panel's own answer can lag on embed load, and it
|
|
6493
|
+
* cannot know a build made on another device (it trusts a head that differs from live only when this browser saw the
|
|
6494
|
+
* build finish), so the row's two commits are asked as well.
|
|
6495
|
+
*/
|
|
6496
|
+
function sketchWidgetRowHeadIsAheadOfLive(widgetId: string | null): boolean {
|
|
6497
|
+
if (!widgetId || !sketchPrimaryShowsLiveBadge(widgetId)) return false;
|
|
6498
|
+
return widgetRowHeadIsAheadOfLive(getWidgetById(widgetId) as Record<string, unknown> | null, commitsMatch);
|
|
6499
|
+
}
|
|
6500
|
+
|
|
6501
|
+
/** Sketch header publish: panel diff can lag on embed load — fall back to widget commit SHAs. */
|
|
6502
|
+
function sketchPrimaryHasUnpublishedChanges(widgetId: string | null): boolean {
|
|
6503
|
+
if (!widgetId) return false;
|
|
6504
|
+
if (hasUnpublishedChangesForPanel(widgetId)) return true;
|
|
6505
|
+
return sketchWidgetRowHeadIsAheadOfLive(widgetId);
|
|
6506
|
+
}
|
|
6507
|
+
|
|
6467
6508
|
function sketchWidgetHasActiveCodegenOperation(widgetId: string | null): boolean {
|
|
6468
6509
|
if (!widgetId) return false;
|
|
6469
6510
|
const w = getWidgetById(widgetId) as Record<string, unknown> | null;
|
|
@@ -6473,52 +6514,154 @@
|
|
|
6473
6514
|
return !!op;
|
|
6474
6515
|
}
|
|
6475
6516
|
|
|
6476
|
-
$: sketchBarCanvasGenerating =
|
|
6517
|
+
$: sketchBarCanvasGenerating = (void sketchBarSources,
|
|
6477
6518
|
!!canvasPrimaryWidgetId &&
|
|
6478
6519
|
(!!generatingWidgetIds[canvasPrimaryWidgetId] ||
|
|
6479
|
-
sketchWidgetHasActiveCodegenOperation(canvasPrimaryWidgetId));
|
|
6520
|
+
sketchWidgetHasActiveCodegenOperation(canvasPrimaryWidgetId)));
|
|
6480
6521
|
|
|
6481
|
-
$:
|
|
6522
|
+
$: sketchBarHasUnpublishedLive = (void sketchBarSources,
|
|
6523
|
+
!!canvasPrimaryWidgetId &&
|
|
6524
|
+
sketchPrimaryShowsLiveBadge(canvasPrimaryWidgetId) &&
|
|
6525
|
+
sketchPrimaryHasUnpublishedChanges(canvasPrimaryWidgetId));
|
|
6526
|
+
|
|
6527
|
+
$: sketchBarStatusLabel = (void sketchBarSources, !embeddedSketchShell
|
|
6482
6528
|
? ''
|
|
6483
6529
|
: !canvasPrimaryWidgetId
|
|
6484
|
-
?
|
|
6485
|
-
:
|
|
6486
|
-
?
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
:
|
|
6496
|
-
|
|
6497
|
-
|
|
6530
|
+
? ''
|
|
6531
|
+
: sketchBarGenerationFailed
|
|
6532
|
+
? sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId)
|
|
6533
|
+
? $t('creator.general.saved')
|
|
6534
|
+
: ''
|
|
6535
|
+
: sketchBarCanvasGenerating
|
|
6536
|
+
? sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId)
|
|
6537
|
+
? $t('creator.general.saved')
|
|
6538
|
+
: ''
|
|
6539
|
+
: sketchBarHasUnpublishedLive
|
|
6540
|
+
? $t('creator.general.saved')
|
|
6541
|
+
: sketchPrimaryShowsLiveBadge(canvasPrimaryWidgetId)
|
|
6542
|
+
? $t('creator.sketch.publishedJustNow')
|
|
6543
|
+
: sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId)
|
|
6544
|
+
? $t('creator.general.saved')
|
|
6545
|
+
: '');
|
|
6546
|
+
|
|
6547
|
+
$: sketchBarShowPublish = (void sketchBarSources, sketchBarShowsPublish({
|
|
6498
6548
|
embedded: embeddedSketchShell,
|
|
6499
6549
|
widgetId: canvasPrimaryWidgetId,
|
|
6500
6550
|
hasGeneratedCode: sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId),
|
|
6501
6551
|
showsLive: sketchPrimaryShowsLiveBadge(canvasPrimaryWidgetId),
|
|
6502
6552
|
generating: sketchBarCanvasGenerating,
|
|
6503
6553
|
failed: sketchBarGenerationFailed,
|
|
6504
|
-
|
|
6554
|
+
hasUnpublishedChanges: canvasPrimaryWidgetId
|
|
6555
|
+
? sketchPrimaryHasUnpublishedChanges(canvasPrimaryWidgetId)
|
|
6556
|
+
: false,
|
|
6557
|
+
}));
|
|
6505
6558
|
|
|
6506
|
-
$:
|
|
6559
|
+
$: sketchBoardStatusChip = (void sketchBarSources, resolveSketchBoardStatusChip({
|
|
6560
|
+
embedded: embeddedSketchShell,
|
|
6561
|
+
generating: sketchBarCanvasGenerating,
|
|
6562
|
+
failed: sketchBarGenerationFailed,
|
|
6563
|
+
hasGeneratedCode: sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId),
|
|
6564
|
+
showsLive:
|
|
6565
|
+
sketchPrimaryShowsLiveBadge(canvasPrimaryWidgetId) && !sketchBarHasUnpublishedLive,
|
|
6566
|
+
}));
|
|
6567
|
+
|
|
6568
|
+
function sketchBoardStatusChipLabel(variant: 'generating' | 'ready' | 'failed'): string {
|
|
6569
|
+
if (variant === 'generating') return $t('creator.sketch.boardChipGenerating');
|
|
6570
|
+
if (variant === 'ready') return $t('creator.sketch.boardChipReady');
|
|
6571
|
+
return $t('creator.sketch.boardChipFailed');
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
function sketchBoardStatusChipActionLabel(variant: 'generating' | 'failed'): string {
|
|
6575
|
+
return variant === 'generating' ? $t('creator.sketch.boardChipStop') : $t('creator.sketch.boardChipTryAgain');
|
|
6576
|
+
}
|
|
6577
|
+
|
|
6578
|
+
function handleSketchBoardStatusChipAction(): void {
|
|
6579
|
+
const widgetId = canvasPrimaryWidgetId;
|
|
6580
|
+
if (!widgetId) return;
|
|
6581
|
+
if (sketchBarCanvasGenerating) {
|
|
6582
|
+
stopGeneration(widgetId);
|
|
6583
|
+
return;
|
|
6584
|
+
}
|
|
6585
|
+
if (sketchBarGenerationFailed) {
|
|
6586
|
+
const ps = getPanelDisplayState(widgetId);
|
|
6587
|
+
void handleChatRetryMessage(lastGenerationPrompt || ps.codeGenerationPrompt, widgetId);
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
|
|
6591
|
+
$: sketchBarShowCustomize = (void sketchBarSources, sketchBarShowsCustomize({
|
|
6507
6592
|
embedded: embeddedSketchShell,
|
|
6508
6593
|
widgetId: canvasPrimaryWidgetId,
|
|
6509
6594
|
hasGeneratedCode: sketchPrimaryHasGeneratedCode(canvasPrimaryWidgetId),
|
|
6510
6595
|
generating: !!canvasPrimaryWidgetId && !!generatingWidgetIds[canvasPrimaryWidgetId],
|
|
6511
6596
|
failed: sketchBarGenerationFailed,
|
|
6512
6597
|
hasActiveCodegen: sketchWidgetHasActiveCodegenOperation(canvasPrimaryWidgetId),
|
|
6513
|
-
});
|
|
6598
|
+
}));
|
|
6514
6599
|
|
|
6515
|
-
$: sketchBarShowLiveBadge =
|
|
6516
|
-
embeddedSketchShell
|
|
6600
|
+
$: sketchBarShowLiveBadge = (void sketchBarSources,
|
|
6601
|
+
embeddedSketchShell
|
|
6602
|
+
&& sketchPrimaryShowsLiveBadge(canvasPrimaryWidgetId)
|
|
6603
|
+
&& !sketchBarHasUnpublishedLive);
|
|
6517
6604
|
|
|
6518
|
-
$:
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6605
|
+
$: sketchBarLoading = embeddedSketchShell && !isCanvasStateLoaded && !canvasUnavailable;
|
|
6606
|
+
|
|
6607
|
+
let sketchTitleMenuOpen = false;
|
|
6608
|
+
|
|
6609
|
+
function handleSketchTitleMenuRename(): void {
|
|
6610
|
+
sketchTitleMenuOpen = false;
|
|
6611
|
+
const widgetId = canvasPrimaryWidgetId;
|
|
6612
|
+
if (widgetId) {
|
|
6613
|
+
const widget = getWidgetById(widgetId);
|
|
6614
|
+
if (widget) {
|
|
6615
|
+
startRenameWidget(widget);
|
|
6616
|
+
return;
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
void startCanvasNameEdit();
|
|
6620
|
+
}
|
|
6621
|
+
|
|
6622
|
+
async function handleSketchTitleMenuDuplicate(): Promise<void> {
|
|
6623
|
+
sketchTitleMenuOpen = false;
|
|
6624
|
+
await handleHostDuplicateWidgetEvent();
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
async function handleSketchTitleMenuDelete(): Promise<void> {
|
|
6628
|
+
sketchTitleMenuOpen = false;
|
|
6629
|
+
await handleHostDeleteWidgetEvent();
|
|
6630
|
+
}
|
|
6631
|
+
|
|
6632
|
+
$: sketchBarPublishLabel = (void sketchBarSources, (() => {
|
|
6633
|
+
if (!canvasPrimaryWidgetId) return $t('creator.common.publish');
|
|
6634
|
+
const panel = getPanelDisplayState(canvasPrimaryWidgetId);
|
|
6635
|
+
const widget = getWidgetById(canvasPrimaryWidgetId) as { hasLiveVersion?: boolean; has_live_version?: boolean } | null;
|
|
6636
|
+
const wasPublished =
|
|
6637
|
+
panel.lastPublishedVersion != null
|
|
6638
|
+
|| !!(widget?.hasLiveVersion || widget?.has_live_version);
|
|
6639
|
+
const unpublishedChanges =
|
|
6640
|
+
wasPublished
|
|
6641
|
+
&& (sketchBarShowLiveBadge || sketchPrimaryHasUnpublishedChanges(canvasPrimaryWidgetId));
|
|
6642
|
+
return unpublishedChanges ? $t('creator.publish.publishChanges') : $t('creator.common.publish');
|
|
6643
|
+
})());
|
|
6644
|
+
|
|
6645
|
+
/**
|
|
6646
|
+
* Whether the Publish button of the bar is disabled. `getPublishGateForPanel` reads the publish state of the panel (the head
|
|
6647
|
+
* commit, the live commit, a build that is running, a publish that is open, the session); the template's own call of it is not
|
|
6648
|
+
* tracked, so the button kept the answer it got the first time, "No new version to publish" while the head commit had not
|
|
6649
|
+
* reached the panel yet, and a widget with changes showed "Publish changes" on a button that could not be clicked. The
|
|
6650
|
+
* variables the gate reads are named here, with the two sources of the bar.
|
|
6651
|
+
*/
|
|
6652
|
+
$: sketchBarPublishDisabled = (void sketchBarSources,
|
|
6653
|
+
void isPublishing,
|
|
6654
|
+
void publishingWidgetId,
|
|
6655
|
+
void generatingWidgetIds,
|
|
6656
|
+
void previewReadyAnnouncedByWidgetId,
|
|
6657
|
+
void publishHeldByWidgetId,
|
|
6658
|
+
void hasValidToken,
|
|
6659
|
+
void $userSession,
|
|
6660
|
+
void canvasId,
|
|
6661
|
+
void sessionCanvasId,
|
|
6662
|
+
void lastCommitId,
|
|
6663
|
+
void focusedPanelWidgetId,
|
|
6664
|
+
!!canvasPrimaryWidgetId && isPublishDisabledForPanel(canvasPrimaryWidgetId));
|
|
6522
6665
|
|
|
6523
6666
|
$: if (embeddedSketchShell && canvasRef?.saveCanvas && isCanvasStateLoaded) {
|
|
6524
6667
|
try {
|
|
@@ -6549,11 +6692,7 @@
|
|
|
6549
6692
|
}
|
|
6550
6693
|
|
|
6551
6694
|
function handleSketchBarTitleClick() {
|
|
6552
|
-
|
|
6553
|
-
void openWidgetDetailsPanel(canvasPrimaryWidgetId);
|
|
6554
|
-
return;
|
|
6555
|
-
}
|
|
6556
|
-
startCanvasNameEdit();
|
|
6695
|
+
void startCanvasNameEdit();
|
|
6557
6696
|
}
|
|
6558
6697
|
|
|
6559
6698
|
function handleSketchCustomize() {
|
|
@@ -6839,12 +6978,16 @@
|
|
|
6839
6978
|
return !!(panel.hasGeneratedCode || panel.lastCommitId || panel.lastPublishedVersion != null);
|
|
6840
6979
|
}
|
|
6841
6980
|
|
|
6981
|
+
$: hideDrawingToolbarForSelector = (void sketchBarSources,
|
|
6982
|
+
panelDisplayRevision >= 0
|
|
6983
|
+
&& !!canvasPrimaryWidgetId
|
|
6984
|
+
&& shouldHideDrawingToolbarForSelector({
|
|
6985
|
+
hasBuiltArtifact: primaryWidgetHasGeneratedCode(),
|
|
6986
|
+
generating: sketchBarCanvasGenerating,
|
|
6987
|
+
generationFailed: sketchBarGenerationFailed,
|
|
6988
|
+
}));
|
|
6842
6989
|
$: showDrawingTools = (multipleWidgetsAllowed || singleWidgetChromeReady) && (
|
|
6843
|
-
sketchToolbarAfterRestore || !
|
|
6844
|
-
panelDisplayRevision >= 0
|
|
6845
|
-
&& !!canvasPrimaryWidgetId
|
|
6846
|
-
&& primaryWidgetHasGeneratedCode()
|
|
6847
|
-
)
|
|
6990
|
+
sketchToolbarAfterRestore || !hideDrawingToolbarForSelector
|
|
6848
6991
|
);
|
|
6849
6992
|
$: sketchCanvasShowDrawingTools = embeddedSketchShell
|
|
6850
6993
|
? !canvasPrimaryWidgetId || showDrawingTools
|
|
@@ -6933,7 +7076,7 @@
|
|
|
6933
7076
|
}
|
|
6934
7077
|
const widgetName = getWidgetById(widgetId)?.name || 'Widget';
|
|
6935
7078
|
const result = await showDeleteWidgetDialog(widgetId, widgetName);
|
|
6936
|
-
if (result.proceed) {
|
|
7079
|
+
if (result.proceed && result.deleteFromDb) {
|
|
6937
7080
|
await deleteWidgetFromDb(widgetId);
|
|
6938
7081
|
}
|
|
6939
7082
|
}
|
|
@@ -6943,10 +7086,85 @@
|
|
|
6943
7086
|
announceToSite('widgetic:creator-save-state', { dirty });
|
|
6944
7087
|
}
|
|
6945
7088
|
|
|
7089
|
+
/**
|
|
7090
|
+
* The widget whose card Delete widget took off this one-widget canvas (item 21). The bar, the status chip, the toolbar and the
|
|
7091
|
+
* chat all follow `canvasPrimaryWidgetId`, so the canvas is empty again only when that id is empty too, and Undo gives the
|
|
7092
|
+
* widget back its name, chip and chat only when the id comes back with the card. The widget row itself stays: the delete
|
|
7093
|
+
* takes the card off the board, and Undo (or Restore shapes) brings it back.
|
|
7094
|
+
*/
|
|
7095
|
+
let widgetDeletedFromBoardId: string | null = null;
|
|
7096
|
+
|
|
7097
|
+
/**
|
|
7098
|
+
* The draft chat that docks after Delete widget puts the cursor in its composer (a new chat does that), and a focused text box
|
|
7099
|
+
* keeps Cmd+Z for its own undo. The person's next key is most likely Cmd+Z for the delete they just made, so for a moment the
|
|
7100
|
+
* composer cannot take the focus from the page, unless the person goes there themselves (a click or a key press).
|
|
7101
|
+
*/
|
|
7102
|
+
const KEYS_STAY_ON_PAGE_AFTER_DELETE_MS = 2500;
|
|
7103
|
+
let stopKeepingKeysOnPage: (() => void) | null = null;
|
|
7104
|
+
|
|
7105
|
+
function keepKeysOnPageAfterDelete(): void {
|
|
7106
|
+
if (typeof document === 'undefined') return;
|
|
7107
|
+
stopKeepingKeysOnPage?.();
|
|
7108
|
+
const keepingTimer = setTimeout(() => stopKeepingKeysOnPage?.(), KEYS_STAY_ON_PAGE_AFTER_DELETE_MS);
|
|
7109
|
+
const keepKeysOnPage = (event: FocusEvent) => {
|
|
7110
|
+
const target = (event.composedPath?.()[0] ?? event.target) as Element | null;
|
|
7111
|
+
if (target instanceof HTMLTextAreaElement && target.closest('.floating-panels-overlay')) {
|
|
7112
|
+
console.log('[CreatorApp] The chat composer asked for the focus right after Delete widget: the keys stay on the page for Undo');
|
|
7113
|
+
target.blur();
|
|
7114
|
+
}
|
|
7115
|
+
};
|
|
7116
|
+
const personActs = () => stopKeepingKeysOnPage?.();
|
|
7117
|
+
document.addEventListener('focusin', keepKeysOnPage, true);
|
|
7118
|
+
document.addEventListener('pointerdown', personActs, true);
|
|
7119
|
+
document.addEventListener('keydown', personActs, true);
|
|
7120
|
+
stopKeepingKeysOnPage = () => {
|
|
7121
|
+
clearTimeout(keepingTimer);
|
|
7122
|
+
document.removeEventListener('focusin', keepKeysOnPage, true);
|
|
7123
|
+
document.removeEventListener('pointerdown', personActs, true);
|
|
7124
|
+
document.removeEventListener('keydown', personActs, true);
|
|
7125
|
+
stopKeepingKeysOnPage = null;
|
|
7126
|
+
};
|
|
7127
|
+
}
|
|
7128
|
+
|
|
7129
|
+
/** The one-widget canvas goes back to the empty canvas: no widget name, no chip, the drawing tools, and the draft chat takes the chat's place. */
|
|
7130
|
+
function takeWidgetOffSketchBoard(widgetId: string): void {
|
|
7131
|
+
console.log('[CreatorApp] Widget card is off the board: back to the empty canvas', widgetId.slice(0, 8));
|
|
7132
|
+
widgetDeletedFromBoardId = widgetId;
|
|
7133
|
+
closeWidgetDetailsPanel(widgetId, { fromShapeSwitch: true });
|
|
7134
|
+
if (canvasPrimaryWidgetId === widgetId) canvasPrimaryWidgetId = null;
|
|
7135
|
+
if (selectedWidgetId === widgetId) selectedWidgetId = null;
|
|
7136
|
+
keepKeysOnPageAfterDelete();
|
|
7137
|
+
}
|
|
7138
|
+
|
|
7139
|
+
/** After every change of the board: follow the card of the widget the person deleted (Undo puts it back, Redo takes it off again). */
|
|
7140
|
+
function reconcileSketchBoardWithDeletedWidget(): void {
|
|
7141
|
+
if (!widgetDeletedFromBoardId || !embeddedSketchShell || !isCanvasStateLoaded) return;
|
|
7142
|
+
try {
|
|
7143
|
+
const step = stepAfterBoardChange({
|
|
7144
|
+
deletedWidgetId: widgetDeletedFromBoardId,
|
|
7145
|
+
primaryWidgetId: canvasPrimaryWidgetId,
|
|
7146
|
+
linkedWidgetIds: canvasRef?.getLinkedWidgetIds?.() ?? new Set<string>(),
|
|
7147
|
+
});
|
|
7148
|
+
if (step.kind === 'forget') {
|
|
7149
|
+
widgetDeletedFromBoardId = null;
|
|
7150
|
+
} else if (step.kind === 'clear') {
|
|
7151
|
+
takeWidgetOffSketchBoard(step.widgetId);
|
|
7152
|
+
} else if (step.kind === 'restore') {
|
|
7153
|
+
console.log('[CreatorApp] Widget card is back on the board: the canvas speaks for its widget again', step.widgetId.slice(0, 8));
|
|
7154
|
+
canvasPrimaryWidgetId = step.widgetId;
|
|
7155
|
+
panelDisplayRevision += 1;
|
|
7156
|
+
}
|
|
7157
|
+
} catch (error) {
|
|
7158
|
+
console.warn('[CreatorApp] Could not follow the card of the deleted widget', error);
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
|
|
6946
7162
|
/** The canvas says the person changed the board (a shape, a property, the letters of a text): it is unsaved until a save goes through. */
|
|
6947
7163
|
function handleCanvasDirty(): void {
|
|
6948
7164
|
canvasEditRevision += 1;
|
|
6949
7165
|
emitCreatorSaveState(true);
|
|
7166
|
+
// After the canvas has finished the change it is telling us about: follow the card of a widget the person deleted (Undo, Redo).
|
|
7167
|
+
if (widgetDeletedFromBoardId) queueMicrotask(reconcileSketchBoardWithDeletedWidget);
|
|
6950
7168
|
scheduleSketchPrefillFromCanvasDirty();
|
|
6951
7169
|
}
|
|
6952
7170
|
|
|
@@ -7147,10 +7365,34 @@
|
|
|
7147
7365
|
async function resumeEmbeddedSketchScenario(primaryId: string): Promise<void> {
|
|
7148
7366
|
if (!embeddedSketchShell || !primaryId) return;
|
|
7149
7367
|
ensurePanelState(primaryId);
|
|
7150
|
-
const widget = getWidgetById(primaryId) as
|
|
7368
|
+
const widget = getWidgetById(primaryId) as WidgetSummary | null;
|
|
7369
|
+
if (widget) {
|
|
7370
|
+
hydrateWidgetVersionAndCommitState(widget);
|
|
7371
|
+
}
|
|
7372
|
+
const widgetRecord = widget as Record<string, unknown> | null;
|
|
7373
|
+
if (widgetRecord && isSketchGenerationFailed(getPanelState(primaryId), widgetRecord)) {
|
|
7374
|
+
patchCodegenUiState(primaryId, {
|
|
7375
|
+
lastGenerationFailed: true,
|
|
7376
|
+
lastGenerationError:
|
|
7377
|
+
String(widgetRecord.lastGenerationError ?? widgetRecord.last_generation_error ?? '').trim()
|
|
7378
|
+
|| 'Code generation failed',
|
|
7379
|
+
hasGeneratedCode: sketchPrimaryHasGeneratedCode(primaryId),
|
|
7380
|
+
});
|
|
7381
|
+
widgets = widgets.map((w) =>
|
|
7382
|
+
w.id === primaryId
|
|
7383
|
+
? {
|
|
7384
|
+
...w,
|
|
7385
|
+
codegenStatus: 'failed',
|
|
7386
|
+
codegen_status: 'failed',
|
|
7387
|
+
generationFailed: true,
|
|
7388
|
+
generation_failed: true,
|
|
7389
|
+
}
|
|
7390
|
+
: w,
|
|
7391
|
+
);
|
|
7392
|
+
}
|
|
7151
7393
|
const opId = String(
|
|
7152
|
-
(
|
|
7153
|
-
?? (
|
|
7394
|
+
(widgetRecord?.activeOperationId as string | undefined)
|
|
7395
|
+
?? (widgetRecord?.active_operation_id as string | undefined)
|
|
7154
7396
|
?? '',
|
|
7155
7397
|
).trim();
|
|
7156
7398
|
if (opId && operationsClient) {
|
|
@@ -7249,6 +7491,11 @@
|
|
|
7249
7491
|
emitCanvasWidgetsList('hydrate-primary');
|
|
7250
7492
|
if (embeddedSketchShell) {
|
|
7251
7493
|
await mergeWidgetsLinkedOnCanvas([primaryId]);
|
|
7494
|
+
const recordedPrimary = await resolvePrimaryWidgetIdForCanvas(targetCanvasId);
|
|
7495
|
+
if (recordedPrimary && recordedPrimary !== primaryId) {
|
|
7496
|
+
primaryId = recordedPrimary;
|
|
7497
|
+
canvasPrimaryWidgetId = recordedPrimary;
|
|
7498
|
+
}
|
|
7252
7499
|
}
|
|
7253
7500
|
}
|
|
7254
7501
|
return primaryId || canvasPrimaryWidgetId || null;
|
|
@@ -9270,7 +9517,14 @@
|
|
|
9270
9517
|
}
|
|
9271
9518
|
for (const widget of fetched) {
|
|
9272
9519
|
if (widget?.id) {
|
|
9273
|
-
|
|
9520
|
+
// The batch row is read through the generated model and carries fewer fields than the list row
|
|
9521
|
+
// (`hasLiveVersion`, `lastPublishCommitSha`, `thumbnailUrl`, ...): it goes onto the list row, not over it,
|
|
9522
|
+
// or a published widget with changes loses the live commit and the bar reads "Live" with no Publish.
|
|
9523
|
+
const previousListRow = previousById.get(widget.id);
|
|
9524
|
+
mergedById.set(
|
|
9525
|
+
widget.id,
|
|
9526
|
+
preserveRepositoryOnWidget(mergeBatchWidgetOntoListRecord(previousListRow, widget), previousListRow),
|
|
9527
|
+
);
|
|
9274
9528
|
const batchName = String(widget.name ?? '').trim();
|
|
9275
9529
|
if (embeddedSketchShell && batchName) {
|
|
9276
9530
|
sketchWidgetNamesFromBatch = { ...sketchWidgetNamesFromBatch, [widget.id]: batchName };
|
|
@@ -10952,6 +11206,19 @@
|
|
|
10952
11206
|
pendingReferenceImageDataUrl = null;
|
|
10953
11207
|
chatMethods.restoreAttachmentsFromDataUrls?.([dataUrl]);
|
|
10954
11208
|
}
|
|
11209
|
+
const storedConversationId = ownerWidgetId
|
|
11210
|
+
? creatorStorage.getItem(CHAT_CONVERSATION_STORAGE_PREFIX + ownerWidgetId)
|
|
11211
|
+
: null;
|
|
11212
|
+
if (storedConversationId && methods.selectConversation) {
|
|
11213
|
+
// The method may answer at once or with a promise; a failed restore leaves the chat on its own latest conversation.
|
|
11214
|
+
void (async () => {
|
|
11215
|
+
try {
|
|
11216
|
+
await methods.selectConversation?.(storedConversationId);
|
|
11217
|
+
} catch (error) {
|
|
11218
|
+
console.debug('[CreatorApp] Could not restore the last conversation of this widget', error);
|
|
11219
|
+
}
|
|
11220
|
+
})();
|
|
11221
|
+
}
|
|
10955
11222
|
}
|
|
10956
11223
|
|
|
10957
11224
|
/**
|
|
@@ -13584,6 +13851,7 @@ Requirements:
|
|
|
13584
13851
|
clearTimeout(sketchPrefillDirtyTimer);
|
|
13585
13852
|
sketchPrefillDirtyTimer = null;
|
|
13586
13853
|
}
|
|
13854
|
+
stopKeepingKeysOnPage?.();
|
|
13587
13855
|
if (tokenCheckInterval) clearInterval(tokenCheckInterval);
|
|
13588
13856
|
if (tokenDisplayInterval) clearInterval(tokenDisplayInterval);
|
|
13589
13857
|
if (hydrationSafetyTimeout) clearTimeout(hydrationSafetyTimeout);
|
|
@@ -16794,7 +17062,11 @@ Requirements:
|
|
|
16794
17062
|
|| !!(pendingSha && liveSha && !commitsMatch(pendingSha, liveSha));
|
|
16795
17063
|
const unpublishedAhead = hasUnpublishedChangesForPanel(widgetId)
|
|
16796
17064
|
|| !!(pendingPublish && ps.lastCommitId && liveSha && !commitsMatch(ps.lastCommitId, liveSha))
|
|
16797
|
-
|| !!(ps.lastCommitId && liveSha && !commitsMatch(ps.lastCommitId, liveSha))
|
|
17065
|
+
|| !!(ps.lastCommitId && liveSha && !commitsMatch(ps.lastCommitId, liveSha))
|
|
17066
|
+
// The bar above the sketch says "Publish changes" when the widget row's HEAD is not its live commit, also for a
|
|
17067
|
+
// build this browser never saw finish (made on another device): the button follows the bar. The server publishes
|
|
17068
|
+
// its own HEAD whatever commit is sent, so nothing older can go live through this.
|
|
17069
|
+
|| (embeddedSketchShell && sketchWidgetRowHeadIsAheadOfLive(widgetId));
|
|
16798
17070
|
|
|
16799
17071
|
// Pending codegen SHA wins over a stale GitLab HEAD that still matches live.
|
|
16800
17072
|
if (headSha && liveSha && commitsMatch(headSha, liveSha) && !pendingPublish && !unpublishedAhead) {
|
|
@@ -18220,12 +18492,16 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
18220
18492
|
|
|
18221
18493
|
if (!result.proceed) return false;
|
|
18222
18494
|
|
|
18223
|
-
|
|
18495
|
+
if (embeddedSketchShell && widgetId === canvasPrimaryWidgetId) {
|
|
18496
|
+
// One-widget canvas: the card leaves the board, so the canvas is empty again and the draft chat takes the chat's place.
|
|
18497
|
+
// (Closing the panel and opening it again for the same id in one go leaves the panel without a ref: the chat stayed blank.)
|
|
18498
|
+
takeWidgetOffSketchBoard(widgetId);
|
|
18499
|
+
} else {
|
|
18500
|
+
closeWidgetDetailsPanel(widgetId);
|
|
18501
|
+
}
|
|
18224
18502
|
|
|
18225
18503
|
if (result.deleteFromDb) {
|
|
18226
18504
|
await deleteWidgetFromDb(widgetId);
|
|
18227
|
-
} else {
|
|
18228
|
-
showToast('info', $t('creator.canvas.shapeRemovedFromCanvas'), { description: $t('creator.widget.widgetKeptInDatabase2', { name: widgetName }) });
|
|
18229
18505
|
}
|
|
18230
18506
|
return true;
|
|
18231
18507
|
}
|
|
@@ -19966,28 +20242,63 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
19966
20242
|
data-testid="embedded-sketch-panel-wrap"
|
|
19967
20243
|
>
|
|
19968
20244
|
<section
|
|
20245
|
+
data-testid={embeddedSketchShell ? 'embedded-sketch-canvas-panel' : undefined}
|
|
19969
20246
|
data-sketch-mobile-tab={embeddedSketchShell ? embeddedSketchMobileTab : undefined}
|
|
19970
20247
|
class="{embeddedSketchShell
|
|
19971
|
-
? 'embedded-sketch-canvas-panel
|
|
20248
|
+
? 'embedded-sketch-canvas-panel bg-background flex min-h-0 min-w-0 w-full flex-1 flex-col overflow-hidden rounded-panel max-md:data-[sketch-mobile-tab=chat]:hidden md:max-lg:row-start-1 md:max-lg:h-[600px] md:max-lg:max-h-[600px] md:max-lg:min-h-0 md:max-lg:w-full md:max-lg:flex-none max-md:flex-1 max-md:min-h-0 lg:min-h-0 lg:min-w-0'
|
|
19972
20249
|
: 'contents'}"
|
|
19973
20250
|
>
|
|
19974
20251
|
{#if embeddedSketchShell}
|
|
20252
|
+
{#snippet sketchTitleMenu()}
|
|
20253
|
+
<DropdownMenu.Content
|
|
20254
|
+
class="w-[12.5rem] p-1"
|
|
20255
|
+
data-testid="creator-sketch-title-menu"
|
|
20256
|
+
align="start"
|
|
20257
|
+
sideOffset={4}
|
|
20258
|
+
>
|
|
20259
|
+
<DropdownMenu.Item
|
|
20260
|
+
data-testid="creator-title-menu-rename"
|
|
20261
|
+
class="h-8"
|
|
20262
|
+
onclick={handleSketchTitleMenuRename}
|
|
20263
|
+
>
|
|
20264
|
+
{$t('creator.name.renameWidget')}
|
|
20265
|
+
</DropdownMenu.Item>
|
|
20266
|
+
{#if canvasPrimaryWidgetId}
|
|
20267
|
+
<DropdownMenu.Item
|
|
20268
|
+
data-testid="creator-title-menu-duplicate"
|
|
20269
|
+
class="h-8"
|
|
20270
|
+
onclick={() => void handleSketchTitleMenuDuplicate()}
|
|
20271
|
+
>
|
|
20272
|
+
{$t('creator.name.duplicateWidget')}
|
|
20273
|
+
</DropdownMenu.Item>
|
|
20274
|
+
<DropdownMenu.Separator />
|
|
20275
|
+
<DropdownMenu.Item
|
|
20276
|
+
data-testid="creator-title-menu-delete"
|
|
20277
|
+
class="h-8 text-destructive"
|
|
20278
|
+
onclick={() => void handleSketchTitleMenuDelete()}
|
|
20279
|
+
>
|
|
20280
|
+
{$t('creator.widget.deleteWidget')}
|
|
20281
|
+
</DropdownMenu.Item>
|
|
20282
|
+
{/if}
|
|
20283
|
+
</DropdownMenu.Content>
|
|
20284
|
+
{/snippet}
|
|
19975
20285
|
<CreatorBar
|
|
19976
20286
|
class="shrink-0"
|
|
19977
20287
|
title={sketchBarTitleLabel}
|
|
20288
|
+
titleButtonClass="min-w-0"
|
|
19978
20289
|
status={sketchBarStatusLabel}
|
|
19979
|
-
showStatus={
|
|
19980
|
-
|
|
20290
|
+
showStatus={!!sketchBarStatusLabel && !sketchBarLoading && !sketchBarCanvasGenerating}
|
|
20291
|
+
titleAsCaption={sketchBarLoading}
|
|
20292
|
+
showTitleChevron={!sketchBarLoading}
|
|
19981
20293
|
showLiveBadge={sketchBarShowLiveBadge}
|
|
19982
20294
|
liveLabel={$t('creator.common.live')}
|
|
19983
|
-
showCustomize={
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
20295
|
+
showCustomize={false}
|
|
20296
|
+
showPublish={sketchBarLoading ? true : sketchBarShowPublish}
|
|
20297
|
+
publishLabel={sketchBarLoading ? $t('creator.common.publish') : sketchBarPublishLabel}
|
|
20298
|
+
publishDisabled={sketchBarLoading || sketchBarPublishDisabled}
|
|
20299
|
+
bind:titleMenuOpen={sketchTitleMenuOpen}
|
|
20300
|
+
titleMenu={sketchBarLoading ? undefined : sketchTitleMenu}
|
|
19988
20301
|
onBack={() => window.dispatchEvent(new CustomEvent('widgetic:host-request-back'))}
|
|
19989
|
-
onTitleClick={handleSketchBarTitleClick}
|
|
19990
|
-
onCustomize={handleSketchCustomize}
|
|
19991
20302
|
onPublish={() => void publish()}
|
|
19992
20303
|
/>
|
|
19993
20304
|
{/if}
|
|
@@ -19997,6 +20308,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
19997
20308
|
: 'contents'}"
|
|
19998
20309
|
>
|
|
19999
20310
|
<div
|
|
20311
|
+
data-testid="embedded-sketch-canvas-stage"
|
|
20000
20312
|
class="embedded-sketch-canvas-stage flex-1 min-h-0 relative min-w-0 {embeddedSketchShell
|
|
20001
20313
|
? 'rounded-card bg-muted overflow-hidden max-md:absolute max-md:inset-0 max-md:z-0'
|
|
20002
20314
|
: ''} {embeddedSketchShell && embeddedSketchMobileTab !== 'canvas'
|
|
@@ -20004,7 +20316,16 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
20004
20316
|
: ''}"
|
|
20005
20317
|
aria-hidden={embeddedSketchShell && embeddedSketchMobileTab !== 'canvas' ? 'true' : undefined}
|
|
20006
20318
|
>
|
|
20007
|
-
|
|
20319
|
+
{#if sketchBoardStatusChip}
|
|
20320
|
+
<CanvasBoardStatusChip
|
|
20321
|
+
variant={sketchBoardStatusChip.variant}
|
|
20322
|
+
label={sketchBoardStatusChipLabel(sketchBoardStatusChip.variant)}
|
|
20323
|
+
actionLabel={sketchBoardStatusChip.showAction
|
|
20324
|
+
? sketchBoardStatusChipActionLabel(sketchBoardStatusChip.variant as 'generating' | 'failed')
|
|
20325
|
+
: ''}
|
|
20326
|
+
onAction={sketchBoardStatusChip.showAction ? handleSketchBoardStatusChipAction : undefined}
|
|
20327
|
+
/>
|
|
20328
|
+
{/if}
|
|
20008
20329
|
<!-- Embedded: Debug toggle lives in site AppHeader (avoids overlapping Props Panel). -->
|
|
20009
20330
|
{#if canvasApiLoadError || canvasShapesMissingWarning}
|
|
20010
20331
|
<div class="canvas-state-warning-ct absolute top-3 left-1/2 -translate-x-1/2 z-30 max-w-lg w-[calc(100%-2rem)] pointer-events-auto">
|
|
@@ -20037,7 +20358,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
20037
20358
|
bind:this={canvasRef}
|
|
20038
20359
|
locale={locale}
|
|
20039
20360
|
messages={canvasMessages}
|
|
20040
|
-
showContainerFrame={
|
|
20361
|
+
showContainerFrame={!embedded}
|
|
20041
20362
|
widgetSelectionLayerTarget="floating-panels-overlay"
|
|
20042
20363
|
bind:wireframeMode={canvasWireframeMode}
|
|
20043
20364
|
advancedFeatures={canvasAdvancedFeatures}
|
|
@@ -20115,6 +20436,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
20115
20436
|
|
|
20116
20437
|
<!-- FLOATING PANELS OVERLAY (pointer-events-none container, each panel is pointer-events-auto) -->
|
|
20117
20438
|
<div
|
|
20439
|
+
data-testid={embeddedSketchShell ? 'embedded-sketch-chat-panel' : undefined}
|
|
20118
20440
|
class="floating-panels-overlay z-2003 {embeddedSketchShell
|
|
20119
20441
|
? 'md:max-lg:pointer-events-auto md:max-lg:relative md:max-lg:row-start-2 md:max-lg:flex md:max-lg:h-[400px] md:max-lg:max-h-[400px] md:max-lg:min-h-0 md:max-lg:w-full md:max-lg:min-w-0 md:max-lg:flex-none md:max-lg:flex-col max-md:absolute max-md:inset-x-2 max-md:bottom-0 max-md:top-0 max-md:z-[1] max-md:flex max-md:flex-1 max-md:min-h-0 lg:pointer-events-none lg:relative lg:flex lg:w-chat-panel lg:max-w-full lg:shrink-0 lg:flex-col'
|
|
20120
20442
|
: 'pointer-events-none absolute inset-0'} {embeddedSketchShell && embeddedSketchMobileTab !== 'chat'
|
|
@@ -21163,11 +21485,8 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
21163
21485
|
<!-- Svelte 5: `{@const}` must be the direct child of a block; this wrapper exists only for dockedChatPanel and composerModelOptions. -->
|
|
21164
21486
|
{#if true}
|
|
21165
21487
|
{@const dockedChatPanel = embedded && !canvasAdvancedFeatures}
|
|
21166
|
-
{@const composerModelOptions =
|
|
21167
|
-
|
|
21168
|
-
? availableModels.map((model) => ({ id: model.id, label: model.name }))
|
|
21169
|
-
: [{ id: ASSISTANT_MODEL_ID, label: $t('creator.codegen.assistantModelLabel') }]
|
|
21170
|
-
: debugMode
|
|
21488
|
+
{@const composerModelOptions =
|
|
21489
|
+
debugMode && debugModeAvailable
|
|
21171
21490
|
? availableModels.map((model) => ({ id: model.id, label: model.name }))
|
|
21172
21491
|
: []}
|
|
21173
21492
|
<Chat class="code-generation-chat h-full w-full max-w-full rounded-none border-0"
|
|
@@ -21773,26 +22092,17 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
21773
22092
|
<Dialog.Root bind:open={deleteDialogOpen} onOpenChange={(open) => { if (!open) handleDeleteDialogResponse('cancel'); }}>
|
|
21774
22093
|
<Dialog.Content closeLabel={$t('creator.common.close')} layerBase={creatorDialogLayerBase} class="confirm-delete-dialog-content max-w-md bg-white z-9999">
|
|
21775
22094
|
<Dialog.Header class="confirm-delete-dialog-header">
|
|
21776
|
-
<Dialog.Title>{$t('creator.widget.
|
|
21777
|
-
<Dialog.Description>
|
|
21778
|
-
{#each sentenceParts(deleteDialogStep === 'confirm-remove' ? 'creator.dialog.removeShape' : 'creator.dialog.alsoDeleteWidget', ['name'], $t) as part}
|
|
21779
|
-
{#if 'text' in part}{part.text}{:else}<strong>"{deleteDialogWidgetName}"</strong>{/if}
|
|
21780
|
-
{/each}
|
|
21781
|
-
</Dialog.Description>
|
|
22095
|
+
<Dialog.Title>{$t('creator.widget.deleteWidget')}</Dialog.Title>
|
|
21782
22096
|
</Dialog.Header>
|
|
21783
22097
|
|
|
21784
22098
|
<div class="confirm-delete-dialog-action-ct flex justify-end gap-2 pt-2">
|
|
21785
22099
|
{#if deleteDialogStep === 'confirm-remove'}
|
|
21786
|
-
<
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
type="button"
|
|
21793
|
-
class="px-4 py-2 text-sm rounded-lg bg-red-600 hover:bg-red-700 text-white cursor-pointer"
|
|
21794
|
-
onclick={() => handleDeleteDialogResponse('remove-and-ask-db')}
|
|
21795
|
-
>{$t('creator.common.delete')}</button>
|
|
22100
|
+
<Button variant="outline" size="sm" onclick={() => handleDeleteDialogResponse('cancel')}>
|
|
22101
|
+
{$t('creator.general.cancel')}
|
|
22102
|
+
</Button>
|
|
22103
|
+
<Button variant="destructive" size="sm" onclick={() => handleDeleteDialogResponse('remove-and-ask-db')}>
|
|
22104
|
+
{$t('creator.widget.deleteWidget')}
|
|
22105
|
+
</Button>
|
|
21796
22106
|
{:else if ASK_DELETE_FROM_DB_CONFIRM}
|
|
21797
22107
|
<button
|
|
21798
22108
|
type="button"
|