@widgetic/creator 0.4.12 → 0.4.14
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
CHANGED
|
@@ -3017,7 +3017,8 @@
|
|
|
3017
3017
|
}
|
|
3018
3018
|
const response = await conversationsClient.createConversationForWidgetRaw({
|
|
3019
3019
|
createConversationForWidgetRequest: {
|
|
3020
|
-
|
|
3020
|
+
// The generated client writes `widgetId`. A snake_case key is dropped, and the API then rejects the body.
|
|
3021
|
+
widgetId: contextId,
|
|
3021
3022
|
title,
|
|
3022
3023
|
},
|
|
3023
3024
|
});
|
|
@@ -10713,6 +10714,7 @@ Requirements:
|
|
|
10713
10714
|
const completedCommitSha = getOperationCommitId(op.metadata);
|
|
10714
10715
|
const completedCommitTitle = getOperationCommitTitle(op.metadata);
|
|
10715
10716
|
const completedPreviewBuildErr = getOperationPreviewBuildError(op.metadata);
|
|
10717
|
+
const repositorySaveError = getOperationRepositorySaveError(op.metadata);
|
|
10716
10718
|
const completedCached = getOperationCached(op.metadata);
|
|
10717
10719
|
const completedCachedFiles = getOperationCachedFiles(op.metadata);
|
|
10718
10720
|
const cachedChatSummary = completedCached
|
|
@@ -10887,16 +10889,21 @@ Requirements:
|
|
|
10887
10889
|
}
|
|
10888
10890
|
|
|
10889
10891
|
const commitShort = completedCommitSha ? completedCommitSha.substring(0, 7) : '';
|
|
10892
|
+
const unsavedText = repositorySaveError
|
|
10893
|
+
|| 'Code was not saved to the repository. Retry saves it and records a version.';
|
|
10890
10894
|
const savedStatus = !completedCommitSha
|
|
10891
|
-
?
|
|
10895
|
+
? unsavedText
|
|
10892
10896
|
: completedPreviewBuildErr
|
|
10893
10897
|
? `Code saved (${commitShort}) — building preview…`
|
|
10894
10898
|
: `Code saved (${commitShort}) — loading preview…`;
|
|
10899
|
+
const shownFailure = [completedPreviewBuildErr, !completedCommitSha ? unsavedText : null]
|
|
10900
|
+
.filter((part): part is string => !!part)
|
|
10901
|
+
.join('\n');
|
|
10895
10902
|
patchCodegenUiState(generationWidgetId, {
|
|
10896
10903
|
hasGeneratedCode: true,
|
|
10897
10904
|
...(completedCommitSha ? { lastCommitId: completedCommitSha } : {}),
|
|
10898
10905
|
lastGenerationFailed: !completedCommitSha,
|
|
10899
|
-
lastGenerationError:
|
|
10906
|
+
lastGenerationError: shownFailure || null,
|
|
10900
10907
|
generateCodeStatus: savedStatus,
|
|
10901
10908
|
});
|
|
10902
10909
|
|
|
@@ -10919,7 +10926,7 @@ Requirements:
|
|
|
10919
10926
|
});
|
|
10920
10927
|
} else if (!completedCommitSha) {
|
|
10921
10928
|
showToast('warning', $t('creator.codegen.codeWasNotSaved'), {
|
|
10922
|
-
description: $t('creator.codegen.retrySavesItAndRecordsAVersion'),
|
|
10929
|
+
description: repositorySaveError || $t('creator.codegen.retrySavesItAndRecordsAVersion'),
|
|
10923
10930
|
duration: 8000
|
|
10924
10931
|
});
|
|
10925
10932
|
} else {
|
|
@@ -10949,7 +10956,7 @@ Requirements:
|
|
|
10949
10956
|
panelChat?.addAssistantMessage(
|
|
10950
10957
|
cachedChatSummary ??
|
|
10951
10958
|
(!completedCommitSha
|
|
10952
|
-
?
|
|
10959
|
+
? unsavedText
|
|
10953
10960
|
: completedPreviewBuildErr
|
|
10954
10961
|
? `Code saved (Commit: ${commitShort}), but preview build failed:\n${completedPreviewBuildErr}\n\nRebuilding preview…`
|
|
10955
10962
|
: `Code generation completed! Commit: ${commitShort}\nPreview is loading…`),
|
|
@@ -11959,6 +11966,13 @@ Requirements:
|
|
|
11959
11966
|
return sanitizePreviewBuildError(raw);
|
|
11960
11967
|
}
|
|
11961
11968
|
|
|
11969
|
+
/** Why GitLab did not record a version, from the completed operation. */
|
|
11970
|
+
function getOperationRepositorySaveError(metadata?: Record<string, unknown>): string | null {
|
|
11971
|
+
if (!metadata) return null;
|
|
11972
|
+
const raw = metadata.repositorySaveError ?? metadata.repository_save_error;
|
|
11973
|
+
return typeof raw === 'string' && raw.trim().length > 0 ? raw.trim() : null;
|
|
11974
|
+
}
|
|
11975
|
+
|
|
11962
11976
|
/**
|
|
11963
11977
|
* The short design-contract warning the codegen service attached to a
|
|
11964
11978
|
* completed operation, naming the design properties that will silently do
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
...data.element,
|
|
147
147
|
id: `sel_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
|
|
148
148
|
};
|
|
149
|
-
onSelectElement?.(selectedRef);
|
|
149
|
+
onSelectElement?.(rememberFrame(selectedRef));
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -167,6 +167,31 @@
|
|
|
167
167
|
return true;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
function rememberFrame(element: SelectedWidgetElementReference): SelectedWidgetElementReference {
|
|
171
|
+
if (viewportWidth <= 0 || viewportHeight <= 0) return element;
|
|
172
|
+
return {
|
|
173
|
+
...element,
|
|
174
|
+
rectFrame: { width: viewportWidth, height: viewportHeight },
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function rectInCurrentFrame(
|
|
179
|
+
rect: NonNullable<SelectedWidgetElementReference['rect']>,
|
|
180
|
+
frame?: SelectedWidgetElementReference['rectFrame'],
|
|
181
|
+
) {
|
|
182
|
+
const sourceWidth = frame?.width ?? viewportWidth;
|
|
183
|
+
const sourceHeight = frame?.height ?? viewportHeight;
|
|
184
|
+
if (sourceWidth <= 0 || sourceHeight <= 0 || viewportWidth <= 0 || viewportHeight <= 0) return rect;
|
|
185
|
+
const scaleX = viewportWidth / sourceWidth;
|
|
186
|
+
const scaleY = viewportHeight / sourceHeight;
|
|
187
|
+
return {
|
|
188
|
+
x: rect.x * scaleX,
|
|
189
|
+
y: rect.y * scaleY,
|
|
190
|
+
width: rect.width * scaleX,
|
|
191
|
+
height: rect.height * scaleY,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
170
195
|
function handlePointerMove(event: PointerEvent) {
|
|
171
196
|
if (!enabled || passthroughHeld) return;
|
|
172
197
|
const surface = event.currentTarget as HTMLElement;
|
|
@@ -207,7 +232,7 @@
|
|
|
207
232
|
}
|
|
208
233
|
if (target) {
|
|
209
234
|
const selectedRef = serializePickedElement(target);
|
|
210
|
-
onSelectElement?.(selectedRef);
|
|
235
|
+
onSelectElement?.(rememberFrame(selectedRef));
|
|
211
236
|
}
|
|
212
237
|
return;
|
|
213
238
|
}
|
|
@@ -217,7 +242,7 @@
|
|
|
217
242
|
...hoveredElement,
|
|
218
243
|
id: `sel_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
|
|
219
244
|
};
|
|
220
|
-
onSelectElement?.(selectedRef);
|
|
245
|
+
onSelectElement?.(rememberFrame(selectedRef));
|
|
221
246
|
return;
|
|
222
247
|
}
|
|
223
248
|
|
|
@@ -304,7 +329,7 @@
|
|
|
304
329
|
...hoveredElement,
|
|
305
330
|
id: `sel_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
|
|
306
331
|
};
|
|
307
|
-
onSelectElement?.(selectedRef);
|
|
332
|
+
onSelectElement?.(rememberFrame(selectedRef));
|
|
308
333
|
}
|
|
309
334
|
}
|
|
310
335
|
|
|
@@ -368,10 +393,11 @@
|
|
|
368
393
|
<!-- Persistent highlights for already-selected elements -->
|
|
369
394
|
{#each selectedElements as item, index (item.id)}
|
|
370
395
|
{#if item.rect && item.rect.width > 0 && item.rect.height > 0}
|
|
371
|
-
{@const
|
|
396
|
+
{@const box = rectInCurrentFrame(item.rect, item.rectFrame)}
|
|
397
|
+
{@const chipPos = computeChipPlacement(box, viewportWidth, viewportHeight)}
|
|
372
398
|
<div
|
|
373
399
|
class="pointer-events-none absolute z-[35] rounded-md border-2 border-dashed border-[#6D9A59] bg-[#7BA668]/10 transition-all duration-75"
|
|
374
|
-
style="left: {
|
|
400
|
+
style="left: {box.x}px; top: {box.y}px; width: {box.width}px; height: {box.height}px; /* rtl-ok: DOM element bounding box is measured from the left edge of the widget frame */"
|
|
375
401
|
></div>
|
|
376
402
|
<div
|
|
377
403
|
class="pointer-events-auto absolute z-[38] flex max-w-[340px] items-center gap-1.5 whitespace-nowrap rounded-full border border-[#7BA668]/45 bg-[#0F2010] px-2.5 py-1 font-mono text-[11px] font-medium leading-none text-[#A5CE8F] shadow-md"
|
|
@@ -441,24 +467,6 @@
|
|
|
441
467
|
{/if}
|
|
442
468
|
{/if}
|
|
443
469
|
|
|
444
|
-
<!-- Bottom Hint Pill (matches Chrome Extension overlay hint) -->
|
|
445
|
-
<div
|
|
446
|
-
class="pointer-events-none absolute inset-x-0 bottom-3 z-[40] mx-auto flex w-max items-center gap-1.5 whitespace-nowrap rounded-full border border-white/10 bg-neutral-900/90 px-3.5 py-1.5 font-sans text-[11px] font-medium text-neutral-200 shadow-lg backdrop-blur-md"
|
|
447
|
-
>
|
|
448
|
-
<span class="inline-block h-2 w-2 rounded-full bg-[#7BA668]"></span>
|
|
449
|
-
<span>{$t('creator.elementSelector.clickPartToReference')}</span>
|
|
450
|
-
<span class="text-neutral-500">·</span>
|
|
451
|
-
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">↑</kbd>
|
|
452
|
-
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">↓</kbd>
|
|
453
|
-
<span>{$t('creator.elementSelector.parentChild')}</span>
|
|
454
|
-
<span class="text-neutral-500">·</span>
|
|
455
|
-
<span>{$t('creator.elementSelector.hold')}</span>
|
|
456
|
-
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">{$t('creator.elementSelector.cmdCtrl')}</kbd>
|
|
457
|
-
<span>{$t('creator.elementSelector.toInteract')}</span>
|
|
458
|
-
<span class="text-neutral-500">·</span>
|
|
459
|
-
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">{$t('creator.elementSelector.esc')}</kbd>
|
|
460
|
-
<span>{$t('creator.elementSelector.done')}</span>
|
|
461
|
-
</div>
|
|
462
470
|
</div>
|
|
463
471
|
{/if}
|
|
464
472
|
{/if}
|
|
@@ -1054,6 +1054,28 @@
|
|
|
1054
1054
|
></div>
|
|
1055
1055
|
{/if}
|
|
1056
1056
|
</div>
|
|
1057
|
+
{#if resolveSelectorEnabled?.(overlay.widgetId)}
|
|
1058
|
+
<div
|
|
1059
|
+
class="widget-shape-selector-hint pointer-events-none fixed z-[70] flex justify-center"
|
|
1060
|
+
style="left: {overlay.left}px; top: {overlay.top + (overlay.localHeight ?? overlay.height) + 8}px; width: {chromeWidth}px; /* rtl-ok: centered on the shape, under it, the same way the bar sits above */"
|
|
1061
|
+
>
|
|
1062
|
+
<div class="widget-shape-selector-hint-pill flex w-max items-center gap-1.5 whitespace-nowrap rounded-full border border-white/10 bg-neutral-900/90 px-3.5 py-1.5 font-sans text-[11px] font-medium text-neutral-200 shadow-lg">
|
|
1063
|
+
<span class="inline-block h-2 w-2 rounded-full bg-[#7BA668]"></span>
|
|
1064
|
+
<span>{$t('creator.elementSelector.clickPartToReference')}</span>
|
|
1065
|
+
<span class="text-neutral-500">·</span>
|
|
1066
|
+
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">↑</kbd>
|
|
1067
|
+
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">↓</kbd>
|
|
1068
|
+
<span>{$t('creator.elementSelector.parentChild')}</span>
|
|
1069
|
+
<span class="text-neutral-500">·</span>
|
|
1070
|
+
<span>{$t('creator.elementSelector.hold')}</span>
|
|
1071
|
+
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">{$t('creator.elementSelector.cmdCtrl')}</kbd>
|
|
1072
|
+
<span>{$t('creator.elementSelector.toInteract')}</span>
|
|
1073
|
+
<span class="text-neutral-500">·</span>
|
|
1074
|
+
<kbd class="rounded border border-white/15 bg-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white">{$t('creator.elementSelector.esc')}</kbd>
|
|
1075
|
+
<span>{$t('creator.elementSelector.done')}</span>
|
|
1076
|
+
</div>
|
|
1077
|
+
</div>
|
|
1078
|
+
{/if}
|
|
1057
1079
|
{#if versionMenuOpen && versionMenuBox?.widgetId === overlay.widgetId}
|
|
1058
1080
|
{@const hasScroll = versionOptions.length > 5}
|
|
1059
1081
|
<div
|
|
@@ -36,6 +36,11 @@ export interface SelectedWidgetElementReference {
|
|
|
36
36
|
attributes?: Record<string, string>;
|
|
37
37
|
/** Bounding box inside the widget frame (in unscaled widget CSS pixels) */
|
|
38
38
|
rect?: SelectedElementRect;
|
|
39
|
+
/** Frame size the box was measured in, so a later resize can scale it. */
|
|
40
|
+
rectFrame?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
39
44
|
/** Compact human-readable label (`<em> · to shared company work.`) */
|
|
40
45
|
label: string;
|
|
41
46
|
}
|