@widgetic/creator 0.3.80 → 0.4.0
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/README.md +157 -0
- package/dist/CreatorApp.svelte +1159 -624
- package/dist/CreatorApp.svelte.d.ts +22 -0
- package/dist/components/BrandKitPanel.svelte +48 -40
- package/dist/components/BrandKitPanel.svelte.d.ts +1 -1
- package/dist/components/DesignQuickEdit.svelte +13 -4
- package/dist/components/EditableName.svelte +13 -8
- package/dist/components/EditableName.svelte.d.ts +2 -2
- package/dist/components/FileUrlSourceControl.svelte +21 -8
- package/dist/components/HoverTooltip.svelte +1 -1
- package/dist/components/SelectorDropdown.svelte +19 -15
- package/dist/components/SelectorDropdown.svelte.d.ts +2 -2
- package/dist/components/VersionDropdownRow.svelte +14 -11
- package/dist/components/WidgetDetails.svelte +118 -92
- package/dist/components/WidgetShapeLivePreviews.svelte +105 -46
- package/dist/creator-types.d.ts +96 -0
- package/dist/host/creatorHost.d.ts +176 -0
- package/dist/host/creatorHost.js +242 -0
- package/dist/host/limitRefusal.d.ts +64 -0
- package/dist/host/limitRefusal.js +109 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +5 -0
- package/dist/i18n/labels.d.ts +14 -0
- package/dist/i18n/labels.js +39 -0
- package/dist/i18n/language.d.ts +559 -0
- package/dist/i18n/language.js +47 -0
- package/dist/i18n/languageKit.d.ts +52 -0
- package/dist/i18n/languageKit.js +45 -0
- package/dist/i18n/messages.d.ts +526 -0
- package/dist/i18n/messages.js +548 -0
- package/dist/i18n/slots.d.ts +22 -0
- package/dist/i18n/slots.js +42 -0
- package/dist/i18n/statusText.d.ts +22 -0
- package/dist/i18n/statusText.js +223 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/stores/userSession.d.ts +8 -1
- package/dist/stores/userSession.js +18 -25
- package/dist/stores/websocketStore.d.ts +6 -0
- package/dist/stores/websocketStore.js +39 -4
- package/dist/utils/designIntentTelemetry.d.ts +8 -0
- package/dist/utils/designIntentTelemetry.js +52 -34
- package/dist/utils/directionPlacement.d.ts +51 -0
- package/dist/utils/directionPlacement.js +55 -0
- package/dist/utils/embedCode.d.ts +0 -1
- package/dist/utils/embedCode.js +0 -4
- package/dist/utils/nativeScrollbarPadding.js +1 -1
- package/dist/utils/pickedFile.d.ts +15 -0
- package/dist/utils/pickedFile.js +21 -0
- package/dist/utils/widgeticChatUpload.d.ts +9 -0
- package/dist/utils/widgeticChatUpload.js +24 -2
- package/package.json +5 -3
- package/dist/retiredSurface.test.d.ts +0 -1
- package/dist/retiredSurface.test.js +0 -113
- package/dist/utils/designIntentResolver.test.d.ts +0 -1
- package/dist/utils/designIntentResolver.test.js +0 -246
- package/dist/utils/designIntentTelemetry.test.d.ts +0 -1
- package/dist/utils/designIntentTelemetry.test.js +0 -385
- package/dist/utils/designQuickEditValues.test.d.ts +0 -1
- package/dist/utils/designQuickEditValues.test.js +0 -100
- package/dist/utils/widgeticChatUpload.test.d.ts +0 -1
- package/dist/utils/widgeticChatUpload.test.js +0 -257
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* the right edge lines up across every row.
|
|
10
10
|
*/
|
|
11
11
|
import HoverTooltip from './HoverTooltip.svelte';
|
|
12
|
+
import { useCreatorLanguage } from '../i18n/index.js';
|
|
13
|
+
|
|
14
|
+
const { t } = useCreatorLanguage();
|
|
12
15
|
|
|
13
16
|
interface Props {
|
|
14
17
|
/** Version label shown in the first cell (e.g. "v2"). */
|
|
@@ -132,8 +135,8 @@
|
|
|
132
135
|
{#if editableTitle}
|
|
133
136
|
<button
|
|
134
137
|
type="button"
|
|
135
|
-
aria-label=
|
|
136
|
-
title=
|
|
138
|
+
aria-label={$t('creator.versions.renameVersion')}
|
|
139
|
+
title={$t('creator.versions.renameVersion')}
|
|
137
140
|
class="shrink-0 hidden group-hover/title:inline text-[9px] text-slate-400 hover:text-emerald-600 {renameDisabled ? 'cursor-wait opacity-50' : 'cursor-pointer'}"
|
|
138
141
|
onclick={(e) => { e.stopPropagation(); openTitleEditor(); }}
|
|
139
142
|
>✎</button>
|
|
@@ -143,11 +146,11 @@
|
|
|
143
146
|
<span class="min-w-0 flex-1">
|
|
144
147
|
<button
|
|
145
148
|
type="button"
|
|
146
|
-
aria-label=
|
|
147
|
-
title=
|
|
149
|
+
aria-label={$t('creator.versions.addVersionTitle')}
|
|
150
|
+
title={$t('creator.versions.addATitleForThis')}
|
|
148
151
|
class="hidden group-hover/title:inline text-[9px] text-slate-300 hover:text-emerald-600 {renameDisabled ? 'cursor-wait opacity-50' : 'cursor-pointer'}"
|
|
149
152
|
onclick={(e) => { e.stopPropagation(); openTitleEditor(); }}
|
|
150
|
-
|
|
153
|
+
>{$t('creator.versions.addTitle')}</button>
|
|
151
154
|
</span>
|
|
152
155
|
{/if}
|
|
153
156
|
{#if showCommit}
|
|
@@ -157,16 +160,16 @@
|
|
|
157
160
|
<!-- DRAFT lives in the date slot — same column, same width, no date line. -->
|
|
158
161
|
<span
|
|
159
162
|
class="{COL_DATE} flex shrink-0 items-center justify-center rounded bg-amber-50 py-0.5 font-semibold uppercase tracking-wide text-amber-600"
|
|
160
|
-
title=
|
|
161
|
-
>
|
|
163
|
+
title={$t('creator.versions.notPublishedPreviewOnly')}
|
|
164
|
+
>{$t('creator.common.draft')}</span>
|
|
162
165
|
{:else}
|
|
163
166
|
<span class="{COL_DATE} flex shrink-0 items-center justify-start whitespace-nowrap tabular-nums text-slate-400">{dateLabel || '—'}</span>
|
|
164
167
|
{/if}
|
|
165
168
|
{#if isLive}
|
|
166
|
-
<span class="{COL_ACTION} flex shrink-0 items-center justify-center rounded bg-emerald-100 py-0.5 font-semibold uppercase tracking-wide text-emerald-600">live</span>
|
|
169
|
+
<span class="{COL_ACTION} flex shrink-0 items-center justify-center rounded bg-emerald-100 py-0.5 font-semibold uppercase tracking-wide text-emerald-600">{$t('creator.versions.live')}</span>
|
|
167
170
|
{:else if isDraft}
|
|
168
171
|
<HoverTooltip
|
|
169
|
-
text={publishDisabledReason || '
|
|
172
|
+
text={publishDisabledReason || $t('creator.common.buildThisDraftVersionAnd')}
|
|
170
173
|
maxWidth={160}
|
|
171
174
|
class="inline-flex shrink-0"
|
|
172
175
|
>
|
|
@@ -175,7 +178,7 @@
|
|
|
175
178
|
class="{COL_ACTION} flex shrink-0 items-center justify-center rounded border border-emerald-600 bg-emerald-600 py-0.5 font-semibold uppercase tracking-wide text-white hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer transition-colors"
|
|
176
179
|
disabled={busy || publishDisabled}
|
|
177
180
|
onclick={(e) => { e.stopPropagation(); onpublish?.(); }}
|
|
178
|
-
>{busy ? '...' : '
|
|
181
|
+
>{busy ? '...' : $t('creator.common.publish')}</button>
|
|
179
182
|
</HoverTooltip>
|
|
180
183
|
{:else}
|
|
181
184
|
<button
|
|
@@ -183,6 +186,6 @@
|
|
|
183
186
|
class="{COL_ACTION} flex shrink-0 items-center justify-center rounded border border-emerald-300 py-0.5 font-semibold uppercase tracking-wide text-emerald-700 hover:bg-emerald-100 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer transition-colors"
|
|
184
187
|
disabled={busy || setLiveDisabled}
|
|
185
188
|
onclick={(e) => { e.stopPropagation(); onsetlive?.(); }}
|
|
186
|
-
>{busy ? '...' : '
|
|
189
|
+
>{busy ? '...' : $t('creator.common.setLive')}</button>
|
|
187
190
|
{/if}
|
|
188
191
|
</div>
|
|
@@ -31,10 +31,19 @@
|
|
|
31
31
|
dynamicWorkerPreviewStatus
|
|
32
32
|
} from '../stores/websocketStore.js';
|
|
33
33
|
import { userSession as userSessionStore } from '../stores/userSession.js';
|
|
34
|
+
import { createDragFeedback, getCreatorShadowRoot, reloadThePage } from '../host/creatorHost.js';
|
|
34
35
|
|
|
35
36
|
import { WidgetPreview } from '@widgetic/editor';
|
|
36
37
|
import HoverTooltip from './HoverTooltip.svelte';
|
|
37
38
|
import EditableName from './EditableName.svelte';
|
|
39
|
+
import { errorLabel, useCreatorLanguage } from '../i18n/index.js';
|
|
40
|
+
import { useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
41
|
+
import { distanceTowardEnd, opensOnRightOfShape, roomBeforeNeighbour } from '../utils/directionPlacement.js';
|
|
42
|
+
|
|
43
|
+
const { t } = useCreatorLanguage();
|
|
44
|
+
// The columns of the panel follow the direction of the screen, so the first one (the chat) is on the right in a right to left
|
|
45
|
+
// creator. The divider is dragged on the screen, so its distance is turned around with them.
|
|
46
|
+
const textDirection = useTextDirection();
|
|
38
47
|
|
|
39
48
|
const HEADER_ELEMENTS_GAP_PX = 6;
|
|
40
49
|
const HEADER_PADDING_PX = HEADER_ELEMENTS_GAP_PX + 2;
|
|
@@ -299,10 +308,12 @@
|
|
|
299
308
|
/** After Set live, Create preview stays on that published artifact until the next Worker build. */
|
|
300
309
|
let pinnedPublishedPreviewUrl: string | null = null;
|
|
301
310
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
{ id: '
|
|
311
|
+
let STEPS: { id: WidgetStep; label: string; number: number }[] = [];
|
|
312
|
+
// The names of the steps follow the language, so the list is made again when it changes.
|
|
313
|
+
$: STEPS = [
|
|
314
|
+
{ id: 'create', label: $t('creator.details.create'), number: 1 },
|
|
315
|
+
{ id: 'edit', label: $t('creator.details.edit'), number: 2 },
|
|
316
|
+
{ id: 'embed', label: $t('creator.details.embed'), number: 3 },
|
|
306
317
|
];
|
|
307
318
|
|
|
308
319
|
$: hasWidgetCode = !!lastCommitId || lastPublishedVersion !== null || !!widgetJsPath;
|
|
@@ -992,11 +1003,19 @@
|
|
|
992
1003
|
previewColumnCollapsed = true;
|
|
993
1004
|
}
|
|
994
1005
|
|
|
1006
|
+
/**
|
|
1007
|
+
* The drag cursor of the panel's edges and of the panel itself (on the page's <body> on the site, in the creator's
|
|
1008
|
+
* own area in a partner's page).
|
|
1009
|
+
*/
|
|
1010
|
+
const detailsDragFeedback = createDragFeedback();
|
|
1011
|
+
|
|
1012
|
+
/** This panel's two columns. (`document.querySelector` would find another panel's first, or none inside a shadow root.) */
|
|
1013
|
+
function findOwnTwoColumnLayout(): HTMLElement | null {
|
|
1014
|
+
return (contentContainerEl?.closest('.widget-details-two-col') as HTMLElement | null) ?? null;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
995
1017
|
function maxLeftColPercent(): number {
|
|
996
|
-
const twoCol =
|
|
997
|
-
typeof document !== 'undefined'
|
|
998
|
-
? (document.querySelector('.widget-details-two-col') as HTMLElement | null)
|
|
999
|
-
: null;
|
|
1018
|
+
const twoCol = typeof document !== 'undefined' ? findOwnTwoColumnLayout() : null;
|
|
1000
1019
|
const width = twoCol?.clientWidth || detailsPanelWidth || DETAILS_PANEL_DEFAULT_WIDTH;
|
|
1001
1020
|
if (width <= 0) return LEFT_COL_MAX_PERCENT;
|
|
1002
1021
|
const maxLeftPx = Math.max(160, width - COL_RESIZER_PX - PREVIEW_COL_MIN_PX);
|
|
@@ -1515,12 +1534,12 @@
|
|
|
1515
1534
|
// upgrade prompt instead of burning the retry loop.
|
|
1516
1535
|
if (isRetiredSurfaceError(buildErr)) {
|
|
1517
1536
|
lastBuildErrorMsg = buildErr.message;
|
|
1518
|
-
showToast('warning', '
|
|
1537
|
+
showToast('warning', $t('creator.common.thisAppNeedsARefresh'), {
|
|
1519
1538
|
description: buildErr.message,
|
|
1520
1539
|
duration: 12000,
|
|
1521
1540
|
action: {
|
|
1522
|
-
label: '
|
|
1523
|
-
onClick: () =>
|
|
1541
|
+
label: $t('creator.common.reload'),
|
|
1542
|
+
onClick: () => reloadThePage()
|
|
1524
1543
|
}
|
|
1525
1544
|
});
|
|
1526
1545
|
// Break, not return: the failure UI below (Step 3) must still
|
|
@@ -2448,7 +2467,7 @@
|
|
|
2448
2467
|
previewHealthCheckHandle = setInterval(() => {
|
|
2449
2468
|
if (!previewLoading && !previewHydrating) { clearPreviewHealthCheck(); return; }
|
|
2450
2469
|
try {
|
|
2451
|
-
const iframe = previewIframe ?? document.querySelector('iframe[title="Widget preview"]') as HTMLIFrameElement;
|
|
2470
|
+
const iframe = previewIframe ?? (getCreatorShadowRoot(contentContainerEl) ?? document).querySelector('iframe[title="Widget preview"]') as HTMLIFrameElement;
|
|
2452
2471
|
if (!iframe || !iframeSrc) return;
|
|
2453
2472
|
if (!previewFullUrlsMatch(iframeSrc, iframe.src)) return;
|
|
2454
2473
|
if (iframe.contentWindow) {
|
|
@@ -2538,9 +2557,9 @@
|
|
|
2538
2557
|
function enqueueQueuedAction(action: QueuedAction): void {
|
|
2539
2558
|
queuedActions = [...queuedActions, action];
|
|
2540
2559
|
const description = action.type === 'generate'
|
|
2541
|
-
? '
|
|
2542
|
-
: '
|
|
2543
|
-
showToast('info', action.type === 'generate' ? '
|
|
2560
|
+
? $t('creator.details.codeGenerationWillStartShortly')
|
|
2561
|
+
: $t('creator.details.saveWillExecuteShortly');
|
|
2562
|
+
showToast('info', action.type === 'generate' ? $t('creator.details.codeGenerationQueued') : $t('creator.details.saveQueued'), { description, duration: 5000 });
|
|
2544
2563
|
}
|
|
2545
2564
|
|
|
2546
2565
|
async function processQueuedActions(): Promise<void> {
|
|
@@ -2716,7 +2735,7 @@
|
|
|
2716
2735
|
|
|
2717
2736
|
const shapeCenterX = shapeRect.left + shapeRect.width / 2;
|
|
2718
2737
|
const viewCenterX = shapeRect.viewportLeft + shapeRect.viewportWidth / 2;
|
|
2719
|
-
const openOnRight = shapeCenterX
|
|
2738
|
+
const openOnRight = opensOnRightOfShape($textDirection, shapeCenterX, viewCenterX);
|
|
2720
2739
|
if (openOnRight) {
|
|
2721
2740
|
detailsPanelX = shapeRect.left + shapeRect.width + DETAILS_PANEL_SHAPE_GAP;
|
|
2722
2741
|
if (detailsPanelX + detailsPanelWidth > viewRight - pad) {
|
|
@@ -2750,18 +2769,19 @@
|
|
|
2750
2769
|
isResizingColumns = true;
|
|
2751
2770
|
columnResizeStartX = e.clientX;
|
|
2752
2771
|
columnResizeStartPercent = leftColPercent;
|
|
2753
|
-
|
|
2754
|
-
document.body.style.userSelect = 'none';
|
|
2772
|
+
detailsDragFeedback.start(contentContainerEl, 'col-resize');
|
|
2755
2773
|
window.addEventListener('mousemove', onColumnResizeMove);
|
|
2756
2774
|
addGlobalStopListeners(stopColumnResize);
|
|
2757
2775
|
}
|
|
2758
2776
|
|
|
2759
2777
|
function onColumnResizeMove(e: MouseEvent) {
|
|
2760
2778
|
if (!isResizingColumns) return;
|
|
2761
|
-
const twoCol =
|
|
2779
|
+
const twoCol = findOwnTwoColumnLayout();
|
|
2762
2780
|
const width = twoCol?.clientWidth || detailsPanelWidth || DETAILS_PANEL_DEFAULT_WIDTH;
|
|
2763
2781
|
if (width <= 0) return;
|
|
2764
|
-
|
|
2782
|
+
// `leftColPercent` is the share of the FIRST column, which is the one at the start of the line: dragging the divider
|
|
2783
|
+
// toward the end of the line widens it, and the end of a right to left line is the left of the screen.
|
|
2784
|
+
const deltaPercent = (distanceTowardEnd($textDirection, columnResizeStartX, e.clientX) / width) * 100;
|
|
2765
2785
|
leftColPercent = clampLeftColPercent(columnResizeStartPercent + deltaPercent);
|
|
2766
2786
|
// Keep preview iframe inside the shrinking right column (avoid clipped "cut off" widgets).
|
|
2767
2787
|
requestAnimationFrame(() => {
|
|
@@ -2773,8 +2793,7 @@
|
|
|
2773
2793
|
function stopColumnResize() {
|
|
2774
2794
|
if (!isResizingColumns) return;
|
|
2775
2795
|
isResizingColumns = false;
|
|
2776
|
-
|
|
2777
|
-
document.body.style.userSelect = '';
|
|
2796
|
+
detailsDragFeedback.stop();
|
|
2778
2797
|
window.removeEventListener('mousemove', onColumnResizeMove);
|
|
2779
2798
|
window.removeEventListener('mouseup', stopColumnResize);
|
|
2780
2799
|
window.removeEventListener('pointerup', stopColumnResize);
|
|
@@ -2871,8 +2890,7 @@
|
|
|
2871
2890
|
: edge === 's' ? 'ns-resize'
|
|
2872
2891
|
: edge === 'sw' ? 'nesw-resize'
|
|
2873
2892
|
: 'nwse-resize';
|
|
2874
|
-
|
|
2875
|
-
document.body.style.userSelect = 'none';
|
|
2893
|
+
detailsDragFeedback.start(contentContainerEl, cursor);
|
|
2876
2894
|
window.addEventListener('mousemove', onDetailsResize);
|
|
2877
2895
|
addGlobalStopListeners(stopDetailsResize);
|
|
2878
2896
|
}
|
|
@@ -2926,8 +2944,7 @@
|
|
|
2926
2944
|
function stopDetailsResize() {
|
|
2927
2945
|
if (!isResizingDetails) return;
|
|
2928
2946
|
isResizingDetails = false;
|
|
2929
|
-
|
|
2930
|
-
document.body.style.userSelect = '';
|
|
2947
|
+
detailsDragFeedback.stop();
|
|
2931
2948
|
window.removeEventListener('mousemove', onDetailsResize);
|
|
2932
2949
|
removeGlobalStopListeners(stopDetailsResize);
|
|
2933
2950
|
}
|
|
@@ -2956,18 +2973,23 @@
|
|
|
2956
2973
|
function updateHeaderNameMaxWidth() {
|
|
2957
2974
|
if (!widgetDetailsNameCtEl) return;
|
|
2958
2975
|
const nameRect = widgetDetailsNameCtEl.getBoundingClientRect();
|
|
2959
|
-
|
|
2976
|
+
// The box beyond the name on the line: on the right of it on a left to right screen, on the left of it on a right to left one.
|
|
2977
|
+
const neighbourEl = showCompositionSteps && widgetDetailsStepsRowEl
|
|
2960
2978
|
? widgetDetailsStepsRowEl
|
|
2961
2979
|
: widgetDetailsDebugButtonsEl;
|
|
2962
|
-
if (!
|
|
2963
|
-
const
|
|
2964
|
-
const available =
|
|
2980
|
+
if (!neighbourEl) return;
|
|
2981
|
+
const neighbourRect = neighbourEl.getBoundingClientRect();
|
|
2982
|
+
const available = roomBeforeNeighbour($textDirection, nameRect, neighbourRect, HEADER_ELEMENTS_GAP_PX);
|
|
2965
2983
|
const next = Math.max(HEADER_NAME_MIN_WIDTH_PX, available);
|
|
2966
2984
|
if (next !== headerNameMaxWidthPx) {
|
|
2967
2985
|
headerNameMaxWidthPx = next;
|
|
2968
2986
|
}
|
|
2969
2987
|
}
|
|
2970
2988
|
|
|
2989
|
+
// A screen that turns around puts the name at the other end of the line, and the size of the bar does not change then:
|
|
2990
|
+
// the room the name has is measured again by itself.
|
|
2991
|
+
$: if ($textDirection && typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(updateHeaderNameMaxWidth);
|
|
2992
|
+
|
|
2971
2993
|
function trackHeaderNameMaxWidth(node: HTMLElement) {
|
|
2972
2994
|
detailsDragBarEl = node;
|
|
2973
2995
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -3026,8 +3048,7 @@
|
|
|
3026
3048
|
e.preventDefault();
|
|
3027
3049
|
e.stopPropagation();
|
|
3028
3050
|
isDraggingDetails = true;
|
|
3029
|
-
|
|
3030
|
-
document.body.style.userSelect = 'none';
|
|
3051
|
+
detailsDragFeedback.start(contentContainerEl, 'grabbing');
|
|
3031
3052
|
try {
|
|
3032
3053
|
detailsDragBarEl?.setPointerCapture?.(e.pointerId);
|
|
3033
3054
|
} catch {
|
|
@@ -3059,8 +3080,7 @@
|
|
|
3059
3080
|
cancelPendingDetailsDrag();
|
|
3060
3081
|
if (!isDraggingDetails) return;
|
|
3061
3082
|
isDraggingDetails = false;
|
|
3062
|
-
|
|
3063
|
-
document.body.style.userSelect = '';
|
|
3083
|
+
detailsDragFeedback.stop();
|
|
3064
3084
|
window.removeEventListener('pointermove', onDetailsDrag);
|
|
3065
3085
|
window.removeEventListener('pointerup', stopDetailsDrag);
|
|
3066
3086
|
window.removeEventListener('pointercancel', stopDetailsDrag);
|
|
@@ -3482,7 +3502,7 @@
|
|
|
3482
3502
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3483
3503
|
<div
|
|
3484
3504
|
class="widget-details-floating-shell pointer-events-none fixed overflow-visible {showWidgetDetails ? '' : 'hidden'}"
|
|
3485
|
-
style="left: {detailsPanelX}px; top: {detailsPanelY}px; width: {detailsPanelWidth}px; z-index: {panelZIndex};
|
|
3505
|
+
style="left: {detailsPanelX}px; /* rtl-ok: the panel is put in pixels from the left edge of the screen, beside its shape, and dragged there */ top: {detailsPanelY}px; width: {detailsPanelWidth}px; z-index: {panelZIndex};
|
|
3486
3506
|
height: {detailsPanelHeight ? detailsPanelHeight + 'px' : `calc(100vh - ${detailsPanelTopOffset + detailsPanelBottomMargin}px)`};"
|
|
3487
3507
|
>
|
|
3488
3508
|
<button
|
|
@@ -3490,8 +3510,8 @@
|
|
|
3490
3510
|
onclick={handleCloseButtonClick}
|
|
3491
3511
|
onmousedown={(e) => e.stopPropagation()}
|
|
3492
3512
|
onpointerdown={(e) => e.stopPropagation()}
|
|
3493
|
-
class="widget-details-close-bt pointer-events-auto absolute -top-3 -
|
|
3494
|
-
title=
|
|
3513
|
+
class="widget-details-close-bt pointer-events-auto absolute -top-3 -end-3 z-40 w-7 h-7 flex items-center justify-center rounded-full bg-white border border-gray-300 shadow-md hover:bg-red-50 hover:border-red-300 hover:text-red-600 text-gray-500 cursor-pointer transition-colors text-sm"
|
|
3514
|
+
title={$t('creator.details.closeWidgetDetails')}
|
|
3495
3515
|
>
|
|
3496
3516
|
✕
|
|
3497
3517
|
</button>
|
|
@@ -3509,7 +3529,7 @@
|
|
|
3509
3529
|
<div class="widget-details-header-ct flex flex-col shrink-0 bg-gray-100 border-b border-gray-200">
|
|
3510
3530
|
<div
|
|
3511
3531
|
class="widget-details-drag-bar relative flex items-center py-1.5 cursor-grab active:cursor-grabbing select-none min-h-[40px] touch-none flex-nowrap min-w-0"
|
|
3512
|
-
style="--header-elements-gap: {HEADER_ELEMENTS_GAP_PX}px; gap: {HEADER_ELEMENTS_GAP_PX}px; padding-
|
|
3532
|
+
style="--header-elements-gap: {HEADER_ELEMENTS_GAP_PX}px; gap: {HEADER_ELEMENTS_GAP_PX}px; padding-inline-start: {HEADER_PADDING_PX}px; padding-inline-end: {HEADER_PADDING_PX}px;"
|
|
3513
3533
|
bind:this={detailsDragBarEl}
|
|
3514
3534
|
use:trackHeaderNameMaxWidth
|
|
3515
3535
|
onpointerdown={startDetailsDrag}
|
|
@@ -3523,8 +3543,8 @@
|
|
|
3523
3543
|
<EditableName
|
|
3524
3544
|
class="widget-details-name min-w-0 truncate text-sm font-bold text-gray-800"
|
|
3525
3545
|
name={selectedWidget?.name || ''}
|
|
3526
|
-
placeholder={isDraftConvertPanel ? '
|
|
3527
|
-
tooltipText=
|
|
3546
|
+
placeholder={isDraftConvertPanel ? $t('creator.details.widgetDraft') : $t('creator.widget.fallbackName')}
|
|
3547
|
+
tooltipText={$t('creator.common.doubleClickToRename')}
|
|
3528
3548
|
on:rename={(e) => {
|
|
3529
3549
|
if (!selectedWidgetId) return;
|
|
3530
3550
|
dispatch('widgetRename', { widgetId: selectedWidgetId, newName: e.detail.newName });
|
|
@@ -3540,7 +3560,7 @@
|
|
|
3540
3560
|
class="widget-details-step-indicator pointer-events-auto flex items-center flex-nowrap justify-center whitespace-nowrap"
|
|
3541
3561
|
style="gap: {HEADER_ELEMENTS_GAP_PX}px;"
|
|
3542
3562
|
>
|
|
3543
|
-
<HoverTooltip text=
|
|
3563
|
+
<HoverTooltip text={$t('creator.details.createWidgetCode')} class="inline-flex shrink-0">
|
|
3544
3564
|
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
3545
3565
|
<button
|
|
3546
3566
|
type="button"
|
|
@@ -3551,11 +3571,11 @@
|
|
|
3551
3571
|
: 'text-gray-600 hover:bg-gray-200 border border-transparent cursor-pointer'}"
|
|
3552
3572
|
>
|
|
3553
3573
|
<span class="step-number inline-flex items-center justify-center w-5 h-5 rounded-full text-[11px] font-bold leading-none {currentStep === 'create' ? 'bg-blue-600 text-white' : 'bg-gray-300 text-gray-700'}">1</span>
|
|
3554
|
-
<span class="step-label">
|
|
3574
|
+
<span class="step-label">{$t('creator.details.create')}</span>
|
|
3555
3575
|
</button>
|
|
3556
3576
|
</HoverTooltip>
|
|
3557
3577
|
<span class="step-connector text-sm font-semibold leading-none {canEditStep ? 'text-gray-500' : 'text-gray-300'}" aria-hidden="true">→</span>
|
|
3558
|
-
<HoverTooltip text={canEditStep ? '
|
|
3578
|
+
<HoverTooltip text={canEditStep ? $t('creator.details.editComposition') : $t('creator.details.publishTheWidgetToEdit')} class="inline-flex shrink-0">
|
|
3559
3579
|
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
3560
3580
|
<button
|
|
3561
3581
|
type="button"
|
|
@@ -3570,11 +3590,11 @@
|
|
|
3570
3590
|
: 'text-gray-300 border border-transparent cursor-default pointer-events-none'}"
|
|
3571
3591
|
>
|
|
3572
3592
|
<span class="step-number inline-flex items-center justify-center w-5 h-5 rounded-full text-[11px] font-bold leading-none {currentStep === 'edit' ? 'bg-blue-600 text-white' : canEditStep ? 'bg-gray-300 text-gray-700' : 'bg-gray-200 text-gray-400'}">2</span>
|
|
3573
|
-
<span class="step-label">
|
|
3593
|
+
<span class="step-label">{$t('creator.details.edit')}</span>
|
|
3574
3594
|
</button>
|
|
3575
3595
|
</HoverTooltip>
|
|
3576
3596
|
<span class="step-connector text-sm font-semibold leading-none {canEmbedStep ? 'text-gray-500' : 'text-gray-300'}" aria-hidden="true">→</span>
|
|
3577
|
-
<HoverTooltip text={canEmbedStep ? '
|
|
3597
|
+
<HoverTooltip text={canEmbedStep ? $t('creator.details.embedThePublishedWidget') : $t('creator.details.publishTheWidgetToGet')} class="inline-flex shrink-0">
|
|
3578
3598
|
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
3579
3599
|
<button
|
|
3580
3600
|
type="button"
|
|
@@ -3589,7 +3609,7 @@
|
|
|
3589
3609
|
: 'text-gray-300 border border-transparent cursor-default pointer-events-none'}"
|
|
3590
3610
|
>
|
|
3591
3611
|
<span class="step-number inline-flex items-center justify-center w-5 h-5 rounded-full text-[11px] font-bold leading-none {currentStep === 'embed' ? 'bg-blue-600 text-white' : canEmbedStep ? 'bg-gray-300 text-gray-700' : 'bg-gray-200 text-gray-400'}">3</span>
|
|
3592
|
-
<span class="step-label">
|
|
3612
|
+
<span class="step-label">{$t('creator.details.embed')}</span>
|
|
3593
3613
|
</button>
|
|
3594
3614
|
</HoverTooltip>
|
|
3595
3615
|
</div>
|
|
@@ -3597,7 +3617,7 @@
|
|
|
3597
3617
|
{/if}
|
|
3598
3618
|
|
|
3599
3619
|
<div
|
|
3600
|
-
class="widget-details-header-actions relative z-[1]
|
|
3620
|
+
class="widget-details-header-actions relative z-[1] ms-auto flex items-center gap-2 shrink-0"
|
|
3601
3621
|
bind:this={widgetDetailsDebugButtonsEl}
|
|
3602
3622
|
>
|
|
3603
3623
|
<div class="widget-details-header-meta flex items-center gap-2 shrink-0 min-w-0">
|
|
@@ -3607,13 +3627,13 @@
|
|
|
3607
3627
|
</div>
|
|
3608
3628
|
</div>
|
|
3609
3629
|
{#if SHOW_PANEL_PREVIEW_COLUMN}
|
|
3610
|
-
<HoverTooltip text={previewColumnCollapsed ? '
|
|
3630
|
+
<HoverTooltip text={previewColumnCollapsed ? $t('creator.details.openLivePreview') : $t('creator.details.closeLivePreview')}>
|
|
3611
3631
|
<button
|
|
3612
3632
|
type="button"
|
|
3613
3633
|
onclick={() => previewColumnCollapsed ? expandPreviewColumn() : collapsePreviewColumn()}
|
|
3614
3634
|
onmousedown={(e) => e.stopPropagation()}
|
|
3615
3635
|
onpointerdown={(e) => e.stopPropagation()}
|
|
3616
|
-
aria-label={previewColumnCollapsed ? '
|
|
3636
|
+
aria-label={previewColumnCollapsed ? $t('creator.details.openLivePreview') : $t('creator.details.closeLivePreview')}
|
|
3617
3637
|
class="widget-details-preview-toggle-bt h-6 w-6 flex items-center justify-center rounded-lg cursor-pointer transition-colors
|
|
3618
3638
|
{previewColumnCollapsed
|
|
3619
3639
|
? 'bg-white border border-gray-300 text-gray-600 hover:bg-gray-100'
|
|
@@ -3648,7 +3668,7 @@
|
|
|
3648
3668
|
class="widget-details-left-col flex flex-col min-w-[460px] min-h-0 overflow-hidden relative"
|
|
3649
3669
|
style="width: {previewColumnCollapsed ? 100 : leftColPercent}%; flex: 0 0 {previewColumnCollapsed ? 100 : leftColPercent}%;"
|
|
3650
3670
|
>
|
|
3651
|
-
<div class="widget-details-left-border absolute inset-y-0
|
|
3671
|
+
<div class="widget-details-left-border absolute inset-y-0 start-0 end-0 border border-gray-300 rounded-none pointer-events-none z-10"></div>
|
|
3652
3672
|
|
|
3653
3673
|
{#if selectedWidgetId}
|
|
3654
3674
|
<div class="widget-details-left-stack relative z-0 flex flex-col h-full min-h-0 min-w-[460px] overflow-hidden">
|
|
@@ -3693,21 +3713,21 @@
|
|
|
3693
3713
|
</div> <!-- end of widget-details-left-col -->
|
|
3694
3714
|
|
|
3695
3715
|
{#if SHOW_PANEL_PREVIEW_COLUMN && previewColumnCollapsed}
|
|
3696
|
-
<div class="widget-details-preview-expand-strip flex items-center justify-center w-8 shrink-0 border-
|
|
3716
|
+
<div class="widget-details-preview-expand-strip flex items-center justify-center w-8 shrink-0 border-s border-gray-200 bg-gray-50">
|
|
3697
3717
|
<button
|
|
3698
3718
|
type="button"
|
|
3699
3719
|
onclick={expandPreviewColumn}
|
|
3700
3720
|
class="widget-details-preview-expand-bt h-full w-full text-[10px] font-semibold text-gray-500 hover:text-forest-green hover:bg-gray-100 cursor-pointer"
|
|
3701
|
-
title=
|
|
3721
|
+
title={$t('creator.details.showLivePreview')}
|
|
3702
3722
|
>
|
|
3703
|
-
<span class="widget-details-preview-expand-label inline-block rotate-180" style="writing-mode: vertical-rl;">
|
|
3723
|
+
<span class="widget-details-preview-expand-label inline-block rotate-180" style="writing-mode: vertical-rl;">{$t('creator.details.preview')}</span>
|
|
3704
3724
|
</button>
|
|
3705
3725
|
</div>
|
|
3706
3726
|
{:else if SHOW_PANEL_PREVIEW_COLUMN}
|
|
3707
3727
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3708
3728
|
<div
|
|
3709
3729
|
class="widget-details-col-resizer w-2.5 shrink-0 cursor-col-resize relative z-20 group"
|
|
3710
|
-
title=
|
|
3730
|
+
title={$t('creator.details.dragToResizeChatPreview')}
|
|
3711
3731
|
onmousedown={startColumnResize}
|
|
3712
3732
|
>
|
|
3713
3733
|
<div class="widget-details-col-resizer-line absolute inset-y-3 left-1/2 w-0.5 -translate-x-1/2 rounded-full bg-gray-300 group-hover:bg-forest-green transition-colors"></div>
|
|
@@ -3725,23 +3745,23 @@
|
|
|
3725
3745
|
<div class="preview-header relative flex items-center justify-center px-3 py-1.5 border-b border-gray-200 shrink-0">
|
|
3726
3746
|
<!-- Center: title + optional debug tabs -->
|
|
3727
3747
|
<div class="preview-header-center flex items-center gap-2">
|
|
3728
|
-
<span class="text-xs font-semibold text-gray-600">
|
|
3748
|
+
<span class="text-xs font-semibold text-gray-600">{$t('creator.details.livePreview')}</span>
|
|
3729
3749
|
{#if debugMode}
|
|
3730
|
-
<div class="preview-header-tabs flex items-center gap-1
|
|
3750
|
+
<div class="preview-header-tabs flex items-center gap-1 ms-1">
|
|
3731
3751
|
<button type="button" onclick={() => toggleInlinePanelView('preview')} title="Switch to preview" class="px-2 py-0.5 text-[10px] rounded border transition-colors cursor-pointer {inlinePanelView === 'preview' ? 'border-blue-400 bg-blue-50 text-blue-700 font-medium' : 'border-gray-200 text-gray-500 hover:bg-gray-50'}">Preview</button>
|
|
3732
3752
|
<button type="button" onclick={() => toggleInlinePanelView('console')} title="Switch to console" class="px-2 py-0.5 text-[10px] rounded border transition-colors cursor-pointer {inlinePanelView === 'console' ? 'border-green-400 bg-green-50 text-green-700 font-medium' : 'border-gray-200 text-gray-500 hover:bg-gray-50'}">Console</button>
|
|
3733
3753
|
</div>
|
|
3734
3754
|
{/if}
|
|
3735
3755
|
</div>
|
|
3736
3756
|
<!-- Right: action buttons (Rebuild on Create step only — refresh lives in URL bar) -->
|
|
3737
|
-
<div class="preview-header-buttons absolute
|
|
3757
|
+
<div class="preview-header-buttons absolute end-3 top-1/2 -translate-y-1/2 flex items-center gap-1">
|
|
3738
3758
|
{#if selectedWidgetId && !previewLoading && !isGeneratingCode && inlinePanelView !== 'console' && (currentStep === 'create' || previewError || publishedArtifactReachable === false)}
|
|
3739
3759
|
<button
|
|
3740
3760
|
type="button"
|
|
3741
3761
|
onclick={() => retryPreview()}
|
|
3742
3762
|
class="preview-rebuild-btn px-2 py-0.5 text-[10px] rounded border border-gray-200 text-gray-600 bg-white hover:bg-gray-50 cursor-pointer {previewError || previewHasRuntimeError || publishedArtifactReachable === false ? 'border-blue-400 bg-blue-50 text-blue-700' : ''}"
|
|
3743
|
-
title=
|
|
3744
|
-
>{isRebuildingPreview ? '
|
|
3763
|
+
title={$t('creator.details.recompileWidgetCodeForPreview')}
|
|
3764
|
+
>{isRebuildingPreview ? $t('creator.details.rebuilding') : $t('creator.details.rebuild')}</button>
|
|
3745
3765
|
{/if}
|
|
3746
3766
|
</div>
|
|
3747
3767
|
</div>
|
|
@@ -3753,7 +3773,7 @@
|
|
|
3753
3773
|
<div
|
|
3754
3774
|
class="widget-details-preview-focus-overlay absolute inset-0 z-20 cursor-pointer"
|
|
3755
3775
|
onmousedown={handlePanelFocusRequest}
|
|
3756
|
-
title=
|
|
3776
|
+
title={$t('creator.details.clickToFocusThisWidget')}
|
|
3757
3777
|
></div>
|
|
3758
3778
|
{/if}
|
|
3759
3779
|
{#if iframeSrc || directPreviewUrl || showPreviewModal || ((isGeneratingCode || previewLoading) && inlinePanelView === 'preview')}
|
|
@@ -3765,9 +3785,9 @@
|
|
|
3765
3785
|
{#if selectedWidget?.name}
|
|
3766
3786
|
<span class="text-base font-semibold text-gray-800 truncate">{selectedWidget.name}</span>
|
|
3767
3787
|
{/if}
|
|
3768
|
-
<p class="text-xs text-gray-500">
|
|
3788
|
+
<p class="text-xs text-gray-500">{$t('creator.details.livePreviewBelow')}</p>
|
|
3769
3789
|
</div>
|
|
3770
|
-
<Button onclick={() => { showPreviewModal = false; }} variant="outline" size="sm" class="close-preview-modal-btn shrink-0 w-6 h-6 p-[3px] cursor-pointer border border-black text-md bg-white text-black hover:bg-gray-100 rounded-lg">X</Button>
|
|
3790
|
+
<Button onclick={() => { showPreviewModal = false; }} variant="outline" size="sm" aria-label={$t('creator.common.close')} title={$t('creator.common.close')} class="close-preview-modal-btn shrink-0 w-6 h-6 p-[3px] cursor-pointer border border-black text-md bg-white text-black hover:bg-gray-100 rounded-lg">X</Button>
|
|
3771
3791
|
</div>
|
|
3772
3792
|
</div>
|
|
3773
3793
|
{/if} <WidgetPreview
|
|
@@ -3811,55 +3831,55 @@
|
|
|
3811
3831
|
<div class="widget-preview-fallback relative flex items-center justify-center h-full rounded-lg bg-gray-50 overflow-hidden">
|
|
3812
3832
|
{#if isGeneratingCode || previewLoading}
|
|
3813
3833
|
<GenerateLoader
|
|
3814
|
-
title={isGeneratingCode ? '
|
|
3834
|
+
title={isGeneratingCode ? $t('creator.details.generatingCode') : $t('creator.details.loadingPreview')}
|
|
3815
3835
|
subtitle=""
|
|
3816
3836
|
size="md"
|
|
3817
3837
|
/>
|
|
3818
3838
|
{:else if previewError === 'DRAFT_PANEL'}
|
|
3819
3839
|
<div class="widget-preview-draft-hint flex flex-col items-center justify-center text-center p-4">
|
|
3820
3840
|
<div class="text-3xl mb-2">🎨</div>
|
|
3821
|
-
<div class="font-medium text-sm text-gray-700 mb-1">
|
|
3822
|
-
<div class="text-xs max-w-[240px] text-gray-500 mb-1">
|
|
3823
|
-
<div class="text-xs max-w-[240px] text-gray-500">
|
|
3841
|
+
<div class="font-medium text-sm text-gray-700 mb-1">{$t('creator.details.sketchDraft')}</div>
|
|
3842
|
+
<div class="text-xs max-w-[240px] text-gray-500 mb-1">{$t('creator.details.yourSketchIsStillOn')}</div>
|
|
3843
|
+
<div class="text-xs max-w-[240px] text-gray-500">{$t('creator.details.sendThePromptInChat')}</div>
|
|
3824
3844
|
</div>
|
|
3825
3845
|
{:else if previewError === 'NO_CODE_YET' && !hasWidgetCode}
|
|
3826
3846
|
<div class="widget-preview-no-code flex flex-col items-center justify-center text-center p-4">
|
|
3827
3847
|
{#if !normalizeRepositoryId(selectedWidget) && repositorySetupStatus !== 'failed'}
|
|
3828
3848
|
<GenerateLoader
|
|
3829
|
-
title=
|
|
3830
|
-
subtitle=
|
|
3849
|
+
title={$t('creator.details.preparingWidget')}
|
|
3850
|
+
subtitle={$t('creator.details.settingUpRepository')}
|
|
3831
3851
|
size="md"
|
|
3832
3852
|
/>
|
|
3833
3853
|
{:else if !normalizeRepositoryId(selectedWidget)}
|
|
3834
3854
|
<div class="text-3xl mb-2">🖼️</div>
|
|
3835
|
-
<div class="font-medium text-sm text-red-600 mb-1">
|
|
3836
|
-
<div class="text-xs max-w-[200px] text-gray-500 mb-3">
|
|
3837
|
-
<button type="button" onclick={() => { dispatch('retryRepository', { widgetId: selectedWidgetId }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium"
|
|
3855
|
+
<div class="font-medium text-sm text-red-600 mb-1">{$t('creator.details.widgetHasNoRepository')}</div>
|
|
3856
|
+
<div class="text-xs max-w-[200px] text-gray-500 mb-3">{$t('creator.details.repositoryCreationFailedPreviouslyClick')}</div>
|
|
3857
|
+
<button type="button" onclick={() => { dispatch('retryRepository', { widgetId: selectedWidgetId }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium">{$t('creator.details.createRepository')}</button>
|
|
3838
3858
|
{:else}
|
|
3839
3859
|
<div class="text-3xl mb-2">🖼️</div>
|
|
3840
|
-
<div class="font-medium text-sm text-gray-700 mb-1">
|
|
3841
|
-
<div class="text-xs max-w-[200px] text-gray-500 mb-3">
|
|
3842
|
-
<button type="button" onclick={() => { dispatch('generateNow', { widgetId: selectedWidgetId }); }} class="generate-now-btn px-3 py-1.5 text-xs rounded border border-green-500 text-green-700 bg-white hover:bg-green-50 cursor-pointer font-medium"
|
|
3860
|
+
<div class="font-medium text-sm text-gray-700 mb-1">{$t('creator.details.noCodeYet')}</div>
|
|
3861
|
+
<div class="text-xs max-w-[200px] text-gray-500 mb-3">{$t('creator.details.writeAPromptAndGenerate')}</div>
|
|
3862
|
+
<button type="button" onclick={() => { dispatch('generateNow', { widgetId: selectedWidgetId }); }} class="generate-now-btn px-3 py-1.5 text-xs rounded border border-green-500 text-green-700 bg-white hover:bg-green-50 cursor-pointer font-medium">{$t('creator.details.generateNow')}</button>
|
|
3843
3863
|
{/if}
|
|
3844
3864
|
</div>
|
|
3845
3865
|
{:else if previewError && (lastPublishedVersion !== null || previewError !== 'NO_CODE_YET')}
|
|
3846
3866
|
<div class="widget-preview-error-indicator flex flex-col items-center justify-center text-center p-4">
|
|
3847
3867
|
<div class="text-3xl mb-2">⚠️</div>
|
|
3848
|
-
<div class="font-medium text-sm text-red-600 mb-1">
|
|
3849
|
-
<div class="text-xs max-w-[200px] text-gray-600 mb-3">{previewError}</div>
|
|
3868
|
+
<div class="font-medium text-sm text-red-600 mb-1">{$t('creator.details.previewUnavailable')}</div>
|
|
3869
|
+
<div class="text-xs max-w-[200px] text-gray-600 mb-3">{errorLabel(previewError, $t)}</div>
|
|
3850
3870
|
{#if !normalizeRepositoryId(selectedWidget)}
|
|
3851
|
-
<button type="button" onclick={() => { previewError = null; dispatch('retryRepository', { widgetId: selectedWidgetId }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium"
|
|
3871
|
+
<button type="button" onclick={() => { previewError = null; dispatch('retryRepository', { widgetId: selectedWidgetId }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium">{$t('creator.details.createRepository')}</button>
|
|
3852
3872
|
{:else}
|
|
3853
3873
|
<div class="preview-error-actions flex flex-col gap-2 items-center">
|
|
3854
3874
|
{#if isCdnArtifactMissingError(previewError) || isInfrastructurePreviewError(previewError)}
|
|
3855
|
-
<button type="button" onclick={() => { previewError = null; previewRetryCount++; void triggerBuildFromRepo({ force: true }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium"
|
|
3875
|
+
<button type="button" onclick={() => { previewError = null; previewRetryCount++; void triggerBuildFromRepo({ force: true }); }} class="px-3 py-1.5 text-xs rounded border border-blue-400 text-blue-600 bg-white hover:bg-blue-50 cursor-pointer font-medium">{$t('creator.details.rebuildCode')}</button>
|
|
3856
3876
|
{:else if lastCommitId || lastPublishedVersion !== null}
|
|
3857
|
-
<button type="button" onclick={() => { dispatch('fixCompileError', { widgetId: selectedWidgetId, error: previewError }); }} class="fix-compile-error-btn px-3 py-1.5 text-xs rounded border border-amber-500 text-amber-800 bg-white hover:bg-amber-50 cursor-pointer font-medium"
|
|
3877
|
+
<button type="button" onclick={() => { dispatch('fixCompileError', { widgetId: selectedWidgetId, error: previewError }); }} class="fix-compile-error-btn px-3 py-1.5 text-xs rounded border border-amber-500 text-amber-800 bg-white hover:bg-amber-50 cursor-pointer font-medium">{$t('creator.details.fixCompileError')}</button>
|
|
3858
3878
|
{:else}
|
|
3859
|
-
<button type="button" onclick={() => { dispatch('generateNow', { widgetId: selectedWidgetId }); }} class="generate-now-btn px-3 py-1.5 text-xs rounded border border-green-500 text-green-700 bg-white hover:bg-green-50 cursor-pointer font-medium"
|
|
3879
|
+
<button type="button" onclick={() => { dispatch('generateNow', { widgetId: selectedWidgetId }); }} class="generate-now-btn px-3 py-1.5 text-xs rounded border border-green-500 text-green-700 bg-white hover:bg-green-50 cursor-pointer font-medium">{$t('creator.details.generateNow')}</button>
|
|
3860
3880
|
{/if}
|
|
3861
3881
|
{#if !isCdnArtifactMissingError(previewError) && !isInfrastructurePreviewError(previewError)}
|
|
3862
|
-
<button type="button" onclick={() => { previewError = null; previewRetryCount++; triggerBuildFromRepo(); }} class="px-2 py-1 text-[10px] rounded border border-gray-300 text-gray-500 bg-white hover:bg-gray-50 cursor-pointer"
|
|
3882
|
+
<button type="button" onclick={() => { previewError = null; previewRetryCount++; triggerBuildFromRepo(); }} class="px-2 py-1 text-[10px] rounded border border-gray-300 text-gray-500 bg-white hover:bg-gray-50 cursor-pointer">{$t('creator.details.retryBuild')}</button>
|
|
3863
3883
|
{/if}
|
|
3864
3884
|
</div>
|
|
3865
3885
|
{/if}
|
|
@@ -3867,21 +3887,21 @@
|
|
|
3867
3887
|
{:else if lastGenerationFailed}
|
|
3868
3888
|
<div class="widget-preview-generation-error flex flex-col items-center justify-center text-center p-4">
|
|
3869
3889
|
<div class="text-3xl mb-2">⚠️</div>
|
|
3870
|
-
<div class="font-medium text-sm text-red-600 mb-1">
|
|
3871
|
-
<div class="text-xs max-w-[220px] text-gray-600 mb-3">{lastGenerationError || '
|
|
3890
|
+
<div class="font-medium text-sm text-red-600 mb-1">{$t('creator.status.failed')}</div>
|
|
3891
|
+
<div class="text-xs max-w-[220px] text-gray-600 mb-3">{errorLabel(lastGenerationError, $t) || $t('creator.details.fixThePromptOrAttachments')}</div>
|
|
3872
3892
|
<button
|
|
3873
3893
|
type="button"
|
|
3874
3894
|
onclick={() => { dispatch('generateNow', { widgetId: selectedWidgetId }); }}
|
|
3875
3895
|
class="generate-now-btn px-3 py-1.5 text-xs rounded border border-green-500 text-green-700 bg-white hover:bg-green-50 cursor-pointer font-medium"
|
|
3876
|
-
|
|
3896
|
+
>{$t('creator.details.retry')}</button>
|
|
3877
3897
|
</div>
|
|
3878
3898
|
{:else if isLoadingDirectPreviewUrl || previewLoading}
|
|
3879
|
-
<GenerateLoader title=
|
|
3899
|
+
<GenerateLoader title={$t('creator.details.buildingPreview')} subtitle={$t('creator.details.compilingWidgetCode')} size="md" />
|
|
3880
3900
|
{:else}
|
|
3881
3901
|
<GenerateLoader
|
|
3882
3902
|
class="widget-preview-idle-indicator text-gray-400"
|
|
3883
3903
|
title=""
|
|
3884
|
-
subtitle=
|
|
3904
|
+
subtitle={$t('creator.details.previewWillAppearAfterCode')}
|
|
3885
3905
|
size="md"
|
|
3886
3906
|
/>
|
|
3887
3907
|
{/if}
|
|
@@ -3903,7 +3923,7 @@
|
|
|
3903
3923
|
{:else}
|
|
3904
3924
|
{#each consoleLogs as entry}
|
|
3905
3925
|
<div class="console-entry py-0.5 border-b border-gray-800 {entry.level === 'error' ? 'text-red-400' : entry.level === 'warn' ? 'text-yellow-400' : 'text-gray-300'}">
|
|
3906
|
-
<span class="text-gray-600
|
|
3926
|
+
<span class="text-gray-600 me-2">{entry.timestamp.toLocaleTimeString()}</span>
|
|
3907
3927
|
<span>{entry.message}</span>
|
|
3908
3928
|
</div>
|
|
3909
3929
|
{/each}
|
|
@@ -3937,7 +3957,9 @@
|
|
|
3937
3957
|
</div> <!-- end of widget-details-content-wrapper -->
|
|
3938
3958
|
|
|
3939
3959
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3940
|
-
|
|
3960
|
+
<!-- rtl-ok: the panel is resized from its corners and sides as they are on the screen: this is the bottom right corner -->
|
|
3961
|
+
<div class="widget-details-resize-se absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize z-20 group" onmousedown={(e) => startDetailsResize(e, 'se')} title={$t('creator.details.resizePanel')}>
|
|
3962
|
+
<!-- rtl-ok: the grip is drawn in the corner it resizes from -->
|
|
3941
3963
|
<svg class="w-3 h-3 absolute bottom-0.5 right-0.5 text-gray-400 group-hover:text-gray-600 transition-colors" viewBox="0 0 6 6" fill="currentColor">
|
|
3942
3964
|
<circle cx="5" cy="1" r="0.7"/>
|
|
3943
3965
|
<circle cx="3" cy="3" r="0.7"/>
|
|
@@ -3949,7 +3971,9 @@
|
|
|
3949
3971
|
</div>
|
|
3950
3972
|
{#if !fillViewport}
|
|
3951
3973
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3952
|
-
|
|
3974
|
+
<!-- rtl-ok: the bottom left corner of the panel -->
|
|
3975
|
+
<div class="widget-details-resize-sw absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize z-20 group" onmousedown={(e) => startDetailsResize(e, 'sw')} title={$t('creator.details.resizePanel')}>
|
|
3976
|
+
<!-- rtl-ok: the grip is drawn in the corner it resizes from -->
|
|
3953
3977
|
<svg class="w-3 h-3 absolute bottom-0.5 left-0.5 text-gray-400 group-hover:text-gray-600 transition-colors rotate-90" viewBox="0 0 6 6" fill="currentColor">
|
|
3954
3978
|
<circle cx="5" cy="1" r="0.7"/>
|
|
3955
3979
|
<circle cx="3" cy="3" r="0.7"/>
|
|
@@ -3960,11 +3984,13 @@
|
|
|
3960
3984
|
</svg>
|
|
3961
3985
|
</div>
|
|
3962
3986
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3963
|
-
|
|
3987
|
+
<!-- rtl-ok: the right side of the panel, where it is widened to the right -->
|
|
3988
|
+
<div class="widget-details-resize-e absolute top-8 bottom-4 right-0 w-1.5 cursor-ew-resize z-20 hover:bg-blue-400/30" onmousedown={(e) => startDetailsResize(e, 'e')} title={$t('creator.details.resizeWidth')}></div>
|
|
3964
3989
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3965
|
-
|
|
3990
|
+
<!-- rtl-ok: the left side of the panel, where it is widened to the left -->
|
|
3991
|
+
<div class="widget-details-resize-w absolute top-8 bottom-4 left-0 w-1.5 cursor-ew-resize z-20 hover:bg-blue-400/30" onmousedown={(e) => startDetailsResize(e, 'w')} title={$t('creator.details.resizeWidth')}></div>
|
|
3966
3992
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
3967
|
-
<div class="widget-details-resize-s absolute bottom-0
|
|
3993
|
+
<div class="widget-details-resize-s absolute bottom-0 start-4 end-4 h-1.5 cursor-ns-resize z-20 hover:bg-blue-400/30" onmousedown={(e) => startDetailsResize(e, 's')} title={$t('creator.details.resizeHeight')}></div>
|
|
3968
3994
|
{/if}
|
|
3969
3995
|
</div>
|
|
3970
3996
|
</div>
|