@widgetic/creator 0.4.13 → 0.4.15
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 +95 -35
- package/dist/components/WidgetElementSelector.svelte +32 -24
- package/dist/components/WidgetShapeLivePreviews.svelte +22 -0
- package/dist/utils/freezeWatchdog.js +2 -14
- package/dist/utils/operationStream.js +0 -9
- package/dist/utils/widgetElementSelector.d.ts +5 -0
- package/package.json +1 -1
package/dist/CreatorApp.svelte
CHANGED
|
@@ -494,10 +494,10 @@
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
/** Project context passed from site /canvas
|
|
497
|
+
/** Project context passed from site /canvas. The create SDK only sends projectId. */
|
|
498
498
|
function embeddedWidgetProjectContext(): Record<string, string> {
|
|
499
499
|
if (!embedded || !projectId) return {};
|
|
500
|
-
const ctx: Record<string, string> = { projectFolder: projectId };
|
|
500
|
+
const ctx: Record<string, string> = { projectId, projectFolder: projectId };
|
|
501
501
|
if (organizationId) ctx.organizationId = organizationId;
|
|
502
502
|
if (workspaceType) ctx.workspaceType = workspaceType;
|
|
503
503
|
return ctx;
|
|
@@ -1918,7 +1918,8 @@
|
|
|
1918
1918
|
|
|
1919
1919
|
// A prompt that already has a commit must not reuse that bubble: Version N and
|
|
1920
1920
|
// Version N+1 would share one message, and "You are here" could not mark the older one.
|
|
1921
|
-
// The
|
|
1921
|
+
// The pictures of that sentence go with the retry, including when an earlier
|
|
1922
|
+
// copy of the same sentence is the one that still has them.
|
|
1922
1923
|
let forkUserMessage = false;
|
|
1923
1924
|
let promptForModel = content;
|
|
1924
1925
|
let retryFileAttachments: Array<{ url: string; file_type: string; file_name: string | null; file_size: number | null }> = [];
|
|
@@ -1930,14 +1931,18 @@
|
|
|
1930
1931
|
const convMessages = await handleLoadMessages(convId, widgetId, { scope: 'all' }) || [];
|
|
1931
1932
|
const needle = content.trim();
|
|
1932
1933
|
let matchIndex = -1;
|
|
1934
|
+
let attachmentIndex = -1;
|
|
1933
1935
|
for (let i = convMessages.length - 1; i >= 0; i--) {
|
|
1934
1936
|
const message = convMessages[i];
|
|
1935
1937
|
const type = message.messageType || message.message_type;
|
|
1936
1938
|
const text = String(message.messageContent || message.message_content || '').trim();
|
|
1937
|
-
if (type
|
|
1938
|
-
|
|
1939
|
-
|
|
1939
|
+
if (type !== 'user' || text !== needle) continue;
|
|
1940
|
+
if (matchIndex < 0) matchIndex = i;
|
|
1941
|
+
const saved = message.attachments || [];
|
|
1942
|
+
if (attachmentIndex < 0 && saved.some((attachment) => attachment?.url && /^https?:\/\//i.test(attachment.url))) {
|
|
1943
|
+
attachmentIndex = i;
|
|
1940
1944
|
}
|
|
1945
|
+
if (matchIndex >= 0 && attachmentIndex >= 0) break;
|
|
1941
1946
|
}
|
|
1942
1947
|
if (matchIndex >= 0) {
|
|
1943
1948
|
let turnEnd = convMessages.length;
|
|
@@ -1965,25 +1970,53 @@
|
|
|
1965
1970
|
(message.messageType || message.message_type) === 'assistant'
|
|
1966
1971
|
&& messageTextHasCommit(message.messageContent || message.message_content),
|
|
1967
1972
|
);
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1973
|
+
// Retry repeats the pictures of that message. A finished version
|
|
1974
|
+
// used to send the sentence alone, so the model was told nothing
|
|
1975
|
+
// was attached and the new bubble had no thumbnail.
|
|
1976
|
+
const attachmentSource = attachmentIndex >= 0 ? attachmentIndex : matchIndex;
|
|
1977
|
+
retryFileAttachments = (convMessages[attachmentSource].attachments || [])
|
|
1978
|
+
.filter((attachment) => attachment.url && /^https?:\/\//i.test(attachment.url))
|
|
1979
|
+
.map((attachment) => ({
|
|
1980
|
+
url: attachment.url,
|
|
1981
|
+
file_type: attachment.file_type || attachment.fileType || 'application/octet-stream',
|
|
1982
|
+
file_name: attachment.file_name || attachment.fileName || null,
|
|
1983
|
+
file_size: attachment.file_size || attachment.fileSize || null,
|
|
1984
|
+
}));
|
|
1979
1985
|
}
|
|
1980
1986
|
}
|
|
1981
1987
|
} catch (retryAttErr) {
|
|
1982
1988
|
console.warn('[Chat→Retry] Could not load the prompt turn for retry:', retryAttErr);
|
|
1983
1989
|
}
|
|
1984
1990
|
}
|
|
1991
|
+
const retryImageAttachments = retryFileAttachments.filter((attachment) => {
|
|
1992
|
+
const type = String(attachment.file_type || '');
|
|
1993
|
+
const name = String(attachment.file_name || '');
|
|
1994
|
+
return type.startsWith('image/') || /\.(png|jpe?g|gif|webp|svg)(\?|$)/i.test(name) || /\.(png|jpe?g|gif|webp|svg)(\?|$)/i.test(attachment.url);
|
|
1995
|
+
});
|
|
1996
|
+
const retryImageDataUrls: string[] = [];
|
|
1997
|
+
for (const attachment of retryImageAttachments) {
|
|
1998
|
+
try {
|
|
1999
|
+
const dataUrl = await resolvePromptImageForCodegen(undefined, attachment.url);
|
|
2000
|
+
if (!dataUrl) continue;
|
|
2001
|
+
const compressed = await compressImageDataUrlForCodegen(dataUrl);
|
|
2002
|
+
if (compressed.startsWith('data:image/') && compressed.length > 100) {
|
|
2003
|
+
retryImageDataUrls.push(compressed);
|
|
2004
|
+
}
|
|
2005
|
+
} catch (imageErr) {
|
|
2006
|
+
console.warn('[Chat→Retry] Could not resend an attachment:', imageErr);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
1985
2009
|
if (forkUserMessage) {
|
|
1986
|
-
|
|
2010
|
+
const bubbleAttachments = retryImageAttachments.map((attachment, index) => ({
|
|
2011
|
+
id: `retry_${Date.now()}_${index}`,
|
|
2012
|
+
url: attachment.url,
|
|
2013
|
+
file_type: attachment.file_type || 'image/png',
|
|
2014
|
+
file_name: /design-screenshot/i.test(attachment.file_name || '')
|
|
2015
|
+
? `attached-sketch-${index + 1}.png`
|
|
2016
|
+
: (attachment.file_name || `attachment-${index + 1}.png`),
|
|
2017
|
+
file_size: attachment.file_size ?? undefined,
|
|
2018
|
+
}));
|
|
2019
|
+
panelChat?.addUserMessage?.(content, bubbleAttachments.length > 0 ? bubbleAttachments : undefined);
|
|
1987
2020
|
}
|
|
1988
2021
|
|
|
1989
2022
|
await generateCode({
|
|
@@ -1995,7 +2028,9 @@
|
|
|
1995
2028
|
skipIntentGate: true,
|
|
1996
2029
|
forkUserMessage,
|
|
1997
2030
|
attachmentIds: forkUserMessage ? undefined : (draftUploadIds.length > 0 ? draftUploadIds : undefined),
|
|
1998
|
-
promptImagesOverride:
|
|
2031
|
+
promptImagesOverride: retryImageDataUrls.length > 0
|
|
2032
|
+
? retryImageDataUrls
|
|
2033
|
+
: (forkUserMessage ? [] : (draftImageUrls.length > 0 ? draftImageUrls : undefined)),
|
|
1999
2034
|
persistFileAttachments: !forkUserMessage && retryFileAttachments.length > 0 ? retryFileAttachments : undefined,
|
|
2000
2035
|
});
|
|
2001
2036
|
}
|
|
@@ -3017,7 +3052,8 @@
|
|
|
3017
3052
|
}
|
|
3018
3053
|
const response = await conversationsClient.createConversationForWidgetRaw({
|
|
3019
3054
|
createConversationForWidgetRequest: {
|
|
3020
|
-
|
|
3055
|
+
// The generated client writes `widgetId`. A snake_case key is dropped, and the API then rejects the body.
|
|
3056
|
+
widgetId: contextId,
|
|
3021
3057
|
title,
|
|
3022
3058
|
},
|
|
3023
3059
|
});
|
|
@@ -3060,6 +3096,31 @@
|
|
|
3060
3096
|
}
|
|
3061
3097
|
|
|
3062
3098
|
/** Map chat attachments to API items. Inline data/blob files are uploaded to user storage (CDN URL). */
|
|
3099
|
+
function chatAttachmentForSdk(item: {
|
|
3100
|
+
url: string;
|
|
3101
|
+
file_type: string;
|
|
3102
|
+
file_name?: string;
|
|
3103
|
+
file_size?: number;
|
|
3104
|
+
display_order?: number;
|
|
3105
|
+
}) {
|
|
3106
|
+
// The generated client writes camelCase only. Snake_case size is dropped,
|
|
3107
|
+
// the row insert then fails, and the picture is saved as text alone.
|
|
3108
|
+
const fileSize = typeof item.file_size === 'number' && item.file_size > 0
|
|
3109
|
+
? Math.round(item.file_size)
|
|
3110
|
+
: 1;
|
|
3111
|
+
return {
|
|
3112
|
+
url: item.url,
|
|
3113
|
+
file_type: item.file_type,
|
|
3114
|
+
file_name: item.file_name,
|
|
3115
|
+
file_size: fileSize,
|
|
3116
|
+
display_order: item.display_order,
|
|
3117
|
+
fileType: item.file_type,
|
|
3118
|
+
fileName: item.file_name,
|
|
3119
|
+
fileSize,
|
|
3120
|
+
displayOrder: item.display_order,
|
|
3121
|
+
};
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3063
3124
|
async function mapChatAttachmentsForApi(
|
|
3064
3125
|
attachments?: Array<{
|
|
3065
3126
|
url?: string;
|
|
@@ -3085,13 +3146,13 @@
|
|
|
3085
3146
|
});
|
|
3086
3147
|
url = uploaded.url;
|
|
3087
3148
|
// console.log('[Chat→Backend] Uploaded chat File to user storage:', uploaded.id, url.slice(0, 80));
|
|
3088
|
-
items.push({
|
|
3149
|
+
items.push(chatAttachmentForSdk({
|
|
3089
3150
|
url,
|
|
3090
3151
|
file_type: guessAttachmentFileType(url, uploaded.fileName || fileName, uploaded.fileType || att.file_type || att.file.type),
|
|
3091
3152
|
file_name: uploaded.fileName || fileName,
|
|
3092
3153
|
file_size: uploaded.fileSize,
|
|
3093
3154
|
display_order: att.display_order ?? i + 1,
|
|
3094
|
-
});
|
|
3155
|
+
}));
|
|
3095
3156
|
continue;
|
|
3096
3157
|
} catch (err) {
|
|
3097
3158
|
console.warn('[Chat→Backend] Chat File upload failed, skipping attachment:', err);
|
|
@@ -3115,26 +3176,26 @@
|
|
|
3115
3176
|
});
|
|
3116
3177
|
url = uploaded.url;
|
|
3117
3178
|
// console.log('[Chat→Backend] Uploaded chat file to user storage:', uploaded.id, url.slice(0, 80));
|
|
3118
|
-
items.push({
|
|
3179
|
+
items.push(chatAttachmentForSdk({
|
|
3119
3180
|
url,
|
|
3120
3181
|
file_type: guessAttachmentFileType(url, uploaded.fileName || fileName, uploaded.fileType || att.file_type),
|
|
3121
3182
|
file_name: uploaded.fileName || fileName,
|
|
3122
3183
|
file_size: uploaded.fileSize,
|
|
3123
3184
|
display_order: att.display_order ?? i + 1,
|
|
3124
|
-
});
|
|
3185
|
+
}));
|
|
3125
3186
|
continue;
|
|
3126
3187
|
} catch (err) {
|
|
3127
3188
|
console.warn('[Chat→Backend] Chat file upload failed, skipping attachment:', err);
|
|
3128
3189
|
continue;
|
|
3129
3190
|
}
|
|
3130
3191
|
}
|
|
3131
|
-
items.push({
|
|
3192
|
+
items.push(chatAttachmentForSdk({
|
|
3132
3193
|
url,
|
|
3133
3194
|
file_type: guessAttachmentFileType(url, fileName, att.file_type),
|
|
3134
3195
|
file_name: fileName,
|
|
3135
3196
|
file_size: att.file_size ?? undefined,
|
|
3136
3197
|
display_order: att.display_order ?? i + 1,
|
|
3137
|
-
});
|
|
3198
|
+
}));
|
|
3138
3199
|
}
|
|
3139
3200
|
return items;
|
|
3140
3201
|
}
|
|
@@ -10330,10 +10391,10 @@ Requirements:
|
|
|
10330
10391
|
}
|
|
10331
10392
|
|
|
10332
10393
|
// Prepare images for the request (if any) — prefer IDs/URLs captured before clearDraft
|
|
10333
|
-
let panelPromptImages = options.
|
|
10334
|
-
?
|
|
10335
|
-
: options.
|
|
10336
|
-
?
|
|
10394
|
+
let panelPromptImages = options.promptImagesOverride && options.promptImagesOverride.length > 0
|
|
10395
|
+
? options.promptImagesOverride
|
|
10396
|
+
: options.forkUserMessage
|
|
10397
|
+
? []
|
|
10337
10398
|
: generationWidgetId === focusedPanelWidgetId
|
|
10338
10399
|
? promptImages
|
|
10339
10400
|
: panelSnap.promptImages;
|
|
@@ -12039,10 +12100,9 @@ Requirements:
|
|
|
12039
12100
|
return codegenProgressDebugLine(op, stage, pct);
|
|
12040
12101
|
}
|
|
12041
12102
|
|
|
12042
|
-
function freezeProbe(
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
void fetch(`http://localhost:3000/health?${query}`).catch(() => {});
|
|
12103
|
+
function freezeProbe(_name: string, _detail = ''): void {
|
|
12104
|
+
// The freeze investigation logged every progress tick. A stall still
|
|
12105
|
+
// reaches the API from the watchdog. Ordinary progress does not.
|
|
12046
12106
|
}
|
|
12047
12107
|
|
|
12048
12108
|
function pushCodegenProgressToUi(op: OperationStatus, widgetId: string | null | undefined) {
|
|
@@ -13389,7 +13449,7 @@ Requirements:
|
|
|
13389
13449
|
for (const record of history || []) {
|
|
13390
13450
|
if (record?.version == null) continue;
|
|
13391
13451
|
const key = versionPromptKey(record?.prompt);
|
|
13392
|
-
if (!key) continue;
|
|
13452
|
+
if (!key || labels[key]) continue;
|
|
13393
13453
|
labels[key] = `Version ${record.version}`;
|
|
13394
13454
|
}
|
|
13395
13455
|
return labels;
|
|
@@ -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
|
|
@@ -197,9 +197,9 @@ export function installFreezeWatchdog() {
|
|
|
197
197
|
const existing = window.__widgeticFreezeWatchdog;
|
|
198
198
|
if (existing)
|
|
199
199
|
return existing;
|
|
200
|
+
// Stall reports only. The per-second heartbeat and the timer-name probes
|
|
201
|
+
// were for the freeze investigation and flooded the API log.
|
|
200
202
|
const probeBase = import.meta.env.DEV ? 'http://localhost:3000/health' : '';
|
|
201
|
-
if (probeBase)
|
|
202
|
-
installDevTimerProbe(probeBase);
|
|
203
203
|
// Both the comment and the variable contain the token. Replace every one.
|
|
204
204
|
const blob = new Blob([WATCHDOG_SOURCE.replaceAll('__PROBE_BASE__', probeBase)], { type: 'text/javascript' });
|
|
205
205
|
const url = URL.createObjectURL(blob);
|
|
@@ -207,23 +207,11 @@ export function installFreezeWatchdog() {
|
|
|
207
207
|
URL.revokeObjectURL(url);
|
|
208
208
|
let lastStatus = '';
|
|
209
209
|
let pendingBreadcrumbs = [];
|
|
210
|
-
let lastHeartbeatAt = 0;
|
|
211
210
|
worker.onmessage = (event) => {
|
|
212
211
|
const data = event.data;
|
|
213
212
|
if (data?.type === 'ping') {
|
|
214
213
|
worker.postMessage({ type: 'pong', status: lastStatus, breadcrumbs: pendingBreadcrumbs });
|
|
215
214
|
pendingBreadcrumbs = [];
|
|
216
|
-
// One line a second, only while this turn can still answer the worker.
|
|
217
|
-
// The last line before a stall is the last second the page thread lived.
|
|
218
|
-
if (probeBase) {
|
|
219
|
-
const now = Date.now();
|
|
220
|
-
if (now - lastHeartbeatAt >= 1000) {
|
|
221
|
-
lastHeartbeatAt = now;
|
|
222
|
-
const second = new Date(now).toISOString().slice(11, 23);
|
|
223
|
-
const shortTimers = window.__widgeticShortTimerCount?.() ?? 0;
|
|
224
|
-
void fetch(`${probeBase}?probe=heartbeat&status=${encodeURIComponent(`${second} short=${shortTimers}`)}`).catch(() => { });
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
215
|
}
|
|
228
216
|
else if (data?.type === 'freeze-report' && data.message) {
|
|
229
217
|
console.warn(data.message);
|
|
@@ -137,15 +137,6 @@ export function streamOperationUpdates(operationId, options) {
|
|
|
137
137
|
}
|
|
138
138
|
try {
|
|
139
139
|
const op = JSON.parse(dataLine);
|
|
140
|
-
// Before any UI update. If this line is missing and the
|
|
141
|
-
// heartbeat has already stopped, the thread died earlier.
|
|
142
|
-
if (import.meta.env.DEV) {
|
|
143
|
-
const query = new URLSearchParams({
|
|
144
|
-
probe: 'stream-read',
|
|
145
|
-
status: `${op?.status ?? ''} ${op?.progress ?? ''}`.slice(0, 180),
|
|
146
|
-
});
|
|
147
|
-
void fetch(`http://localhost:3000/health?${query}`).catch(() => { });
|
|
148
|
-
}
|
|
149
140
|
// Only reset idle timer on real operation payloads — SSE
|
|
150
141
|
// `: keepalive` comment frames must not suppress polling fallback
|
|
151
142
|
// when the terminal `completed` event is lost behind a proxy.
|
|
@@ -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
|
}
|