@widgetic/creator 0.4.46 → 0.4.47

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.
@@ -29,6 +29,6 @@ interface Props {
29
29
  language?: string;
30
30
  languageLocked?: boolean;
31
31
  }
32
- declare const BrandKitPanel: import("svelte").Component<Props, {}, "brandKitEnabled" | "librariesEnabled" | "primary" | "secondary" | "title" | "sub" | "fonts" | "libraries" | "libraryGitUrl" | "libraryFileName" | "libraryUploads" | "fontUploads" | "language">;
32
+ declare const BrandKitPanel: import("svelte").Component<Props, {}, "title" | "sub" | "brandKitEnabled" | "librariesEnabled" | "primary" | "secondary" | "fonts" | "libraries" | "libraryGitUrl" | "libraryFileName" | "libraryUploads" | "fontUploads" | "language">;
33
33
  type BrandKitPanel = ReturnType<typeof BrandKitPanel>;
34
34
  export default BrandKitPanel;
@@ -10,6 +10,6 @@ interface Props {
10
10
  urlPlaceholder?: string;
11
11
  accept?: string;
12
12
  }
13
- declare const FileUrlSourceControl: import("svelte").Component<Props, {}, "fileName" | "fileContent" | "fileEncoding" | "url">;
13
+ declare const FileUrlSourceControl: import("svelte").Component<Props, {}, "url" | "fileName" | "fileContent" | "fileEncoding">;
14
14
  type FileUrlSourceControl = ReturnType<typeof FileUrlSourceControl>;
15
15
  export default FileUrlSourceControl;
@@ -100,7 +100,7 @@ declare const WidgetDetails: $$__sveltets_2_IsomorphicComponent<{
100
100
  /** Stacking order when multiple Widget Details panels are open. */ panelZIndex?: number;
101
101
  /** Cascade offset index (0 = centered, 1+ = shifted down-right). */ panelCascadeIndex?: number;
102
102
  /** False when another panel has keyboard/chat focus. */ isFocusedPanel?: boolean;
103
- currentStep?: "create" | "edit" | "embed";
103
+ currentStep?: "embed" | "create" | "edit";
104
104
  /**
105
105
  * Canvas Creator is code-only (chat + preview). Edit/Embed header steps stay
106
106
  * off until composition editing lives on /composition. Keep the Edit/Embed
@@ -487,13 +487,19 @@
487
487
  console.log('[WidgetShapeLivePreviews] Refresh iframe', widgetId.substring(0, 8));
488
488
  }
489
489
 
490
+ /** Unstick the white Loading overlay when `load` was missed (cached iframe) or URL token raced. */
491
+ const PREVIEW_LOAD_FALLBACK_MS = 3000;
492
+
490
493
  function markIframeLoaded(widgetId: string, iframe: EventTarget | null) {
491
494
  if (!(iframe instanceof HTMLIFrameElement)) return;
495
+ if (iframeLoadedByWidgetId[widgetId] && iframeElementByWidgetId[widgetId] === iframe) return;
492
496
  const loadedSource = iframe.src;
497
+ // Do not re-check buildIframeSrc here: a newer `_t` token after this frame started
498
+ // made matchesFrame fail forever while the iframe had already painted.
493
499
  const matchesFrame = () => enabled && iframe.isConnected
494
- && iframe.dataset.widgetId === widgetId && iframe.src === loadedSource
495
- && overlays.some((overlay) => overlay.widgetId === widgetId
496
- && new URL(buildIframeSrc(overlay.src, widgetId), window.location.href).href === loadedSource);
500
+ && iframe.dataset.widgetId === widgetId
501
+ && iframe.src === loadedSource
502
+ && overlays.some((overlay) => overlay.widgetId === widgetId);
497
503
  // An old load event must not mark the replacement loaded or claim its timer.
498
504
  if (!matchesFrame()) return;
499
505
  iframeLoadedByWidgetId = { ...iframeLoadedByWidgetId, [widgetId]: true };
@@ -528,6 +534,38 @@
528
534
  }, 800));
529
535
  }
530
536
 
537
+ /**
538
+ * Bind load + widgetic:ready early (Svelte `onload=` can miss a cached load),
539
+ * and fall back so the overlay cannot stick forever.
540
+ */
541
+ function trackIframeLoad(iframe: HTMLIFrameElement, widgetId: string) {
542
+ const onLoad = () => markIframeLoaded(widgetId, iframe);
543
+ const onMessage = (event: MessageEvent) => {
544
+ if (event.source !== iframe.contentWindow) return;
545
+ const type = event?.data && typeof event.data === 'object' ? (event.data as { type?: string }).type : null;
546
+ if (type === 'widgetic:ready') markIframeLoaded(widgetId, iframe);
547
+ };
548
+ iframe.addEventListener('load', onLoad);
549
+ window.addEventListener('message', onMessage);
550
+ // Cached documents sometimes fire load before the attribute handler is attached.
551
+ queueMicrotask(onLoad);
552
+ const fallback = setTimeout(() => {
553
+ if (!iframe.isConnected || iframeLoadedByWidgetId[widgetId]) return;
554
+ console.warn('[WidgetShapeLivePreviews] Preview load fallback', widgetId.substring(0, 8));
555
+ markIframeLoaded(widgetId, iframe);
556
+ }, PREVIEW_LOAD_FALLBACK_MS);
557
+ return {
558
+ update(nextWidgetId: string) {
559
+ widgetId = nextWidgetId;
560
+ },
561
+ destroy() {
562
+ clearTimeout(fallback);
563
+ iframe.removeEventListener('load', onLoad);
564
+ window.removeEventListener('message', onMessage);
565
+ },
566
+ };
567
+ }
568
+
531
569
  function getTitle(widgetId: string): string {
532
570
  return resolveTitle?.(widgetId)?.trim() || 'Widget';
533
571
  }
@@ -1131,6 +1169,7 @@
1131
1169
  loading="eager"
1132
1170
  sandbox="allow-scripts allow-same-origin allow-forms"
1133
1171
  use:trackIframeSelection={overlay.widgetId}
1172
+ use:trackIframeLoad={overlay.widgetId}
1134
1173
  onload={(event) => markIframeLoaded(overlay.widgetId, event.currentTarget)}
1135
1174
  ></iframe>
1136
1175
  {#if altKeyHeld}
@@ -581,61 +581,39 @@ export declare const CREATOR_CATALOGS: {
581
581
  readonly 'chat.header.conversations': "Conversations";
582
582
  readonly 'chat.header.new': "New";
583
583
  readonly 'chat.header.untitled': "Untitled";
584
- readonly 'chat.header.newConversationTitle': "New chat";
584
+ readonly 'chat.header.newConversationTitle': "New conversation";
585
585
  readonly 'chat.header.newConversation': "Start new conversation";
586
- readonly 'chat.header.console': "Console";
587
586
  readonly 'chat.header.close': "Close chat";
588
587
  readonly 'chat.contextPreview.expand': "Expand {name} chat context";
589
588
  readonly 'chat.conversation.defaultTitle': "Chat about {name}";
590
- readonly 'chat.messages.emptyTitle': "What do you want to build?";
591
- readonly 'chat.messages.emptyHint': "Sketch it on the canvas, or describe it here.";
589
+ readonly 'chat.messages.startTitle': "Start a conversation";
590
+ readonly 'chat.messages.startHint': "Ask a question about your {type} to get started.";
592
591
  readonly 'chat.messages.loadingHistory': "Loading chat history...";
593
592
  readonly 'chat.messages.thinking': "Assistant is thinking";
594
- readonly 'chat.generation.thinking': "Thinking";
595
- readonly 'chat.generation.writingCode': "Writing code";
596
- readonly 'chat.generation.thoughtFor': "Thought for {seconds} s";
597
- readonly 'chat.generation.expandThought': "Show thinking";
598
- readonly 'chat.generation.collapseThought': "Hide thinking";
599
- readonly 'chat.generation.statusThinking': "Assistant is thinking";
600
- readonly 'chat.generation.statusWritingCode': "Assistant is writing code";
601
- readonly 'chat.plan.title': "Build plan";
602
- readonly 'chat.plan.progress': "{current} of {total}";
603
- readonly 'chat.plan.showMoreTasks': "Show {count} more tasks";
604
- readonly 'chat.plan.showFewerTasks': "Show fewer tasks";
605
- readonly 'chat.plan.regionLabel': "Widget build plan";
593
+ readonly 'chat.messages.viewing': "You are here";
594
+ readonly 'chat.messages.viewingTitle': "This is the version you are looking at";
606
595
  readonly 'chat.messages.attachmentMissingTitle': "Attachment not available";
607
596
  readonly 'chat.messages.attachmentMissingLabel': "Missing file attachment";
608
- readonly 'chat.messages.attachmentMissingCaption': "Attachment not saved. Re-attach with Upload, then send it again.";
609
- readonly 'chat.messages.failedTitle': "Could not build the widget";
610
- readonly 'chat.messages.failedHint': "The build did not finish. Your sketch is safe, so you can try again.";
611
- readonly 'chat.messages.failedRetry': "Try again";
597
+ readonly 'chat.messages.attachmentMissingCaption': "Attachment not saved. Re-attach with Upload, then Retry.";
598
+ readonly 'chat.messages.retry': "Retry";
599
+ readonly 'chat.messages.retryPromptTitle': "Run this prompt again as its own message. The sketch stays with the model, not on the bubble.";
600
+ readonly 'chat.messages.retryLastTitle': "Retry the last user prompt (same generation request)";
612
601
  readonly 'chat.messages.upgrade': "Upgrade";
613
602
  readonly 'chat.messages.upgradeTitle': "Open plans and billing";
614
603
  readonly 'chat.messages.commitId': "(commit id: {id})";
615
604
  readonly 'chat.messages.restore': "Restore Checkpoint";
616
- readonly 'chat.messages.actions': "Message actions";
617
- readonly 'chat.messages.copy': "Copy";
618
- readonly 'chat.messages.copied': "Copied";
619
- readonly 'chat.messages.regenerate': "Regenerate";
620
- readonly 'chat.messages.rateGroup': "Rate this version";
621
- readonly 'chat.messages.rateUp': "This version is good";
622
- readonly 'chat.messages.rateDown': "This version is not good";
605
+ readonly 'chat.messages.restoreTitle': "Restore widget code to this prompt's commit";
606
+ readonly 'chat.messages.alreadyHead': "This checkpoint is already HEAD";
607
+ readonly 'chat.messages.showSuggestions': "Show suggestions";
623
608
  readonly 'chat.messages.version': "Version {number}";
624
609
  readonly 'chat.messages.restoredFrom': "Restored from {label}";
625
610
  readonly 'chat.messages.previousVersion': "a previous version";
626
611
  readonly 'chat.suggestions.title.frame': "Suggested actions for this widget";
627
- readonly 'chat.suggestions.title.panelEmpty': "Suggestions";
628
- readonly 'chat.suggestions.title.tryNext': "Try next";
629
612
  readonly 'chat.suggestions.title.text': "Suggested text improvements";
630
613
  readonly 'chat.suggestions.title.image': "Suggested image analysis";
631
614
  readonly 'chat.suggestions.title.document': "Suggested document actions";
632
615
  readonly 'chat.suggestions.title.other': "Suggested questions";
633
616
  readonly 'chat.suggestions.hide': "Hide suggestions";
634
- readonly 'chat.suggestions.panel.countdown': "A countdown to a sale";
635
- readonly 'chat.suggestions.panel.testimonials': "Customer testimonials";
636
- readonly 'chat.suggestions.panel.gallery': "A before and after gallery";
637
- readonly 'chat.suggestions.panel.changeEndDate': "Change the end date";
638
- readonly 'chat.suggestions.panel.biggerButton': "Make the button bigger";
639
617
  readonly 'chat.suggestions.frame.generateCode': "Generate code from this design";
640
618
  readonly 'chat.suggestions.frame.improveLayout': "Improve this layout";
641
619
  readonly 'chat.suggestions.frame.addInteractivity': "Add interactive functionality";
@@ -662,18 +640,9 @@ export declare const CREATOR_CATALOGS: {
662
640
  readonly 'chat.suggestions.other.understand': "Help me understand this better";
663
641
  readonly 'chat.suggestions.other.options': "What can I do with this?";
664
642
  readonly 'chat.input.placeholder': "Type your message...";
665
- readonly 'chat.input.placeholderCreate': "Describe your widget\u2026";
666
- readonly 'chat.input.placeholderFollowUp': "Ask for a change\u2026";
667
643
  readonly 'chat.input.stop': "Stop generation";
668
644
  readonly 'chat.input.sending': "Sending message...";
669
645
  readonly 'chat.input.send': "Send message";
670
- readonly 'chat.input.tooLong': "Message is too long";
671
- readonly 'chat.composer.assistant': "Assistant";
672
- readonly 'chat.messages.scrollToBottom': "Scroll to latest messages";
673
- readonly 'chat.messages.clarificationPrompt': "Which option fits best?";
674
- readonly 'chat.checkpoint.version': "Version {n}";
675
- readonly 'chat.checkpoint.redo': "Redo";
676
- readonly 'chat.checkpoint.restored': "Restored to version {n}";
677
646
  readonly 'chat.actions.screenshot': "Screenshot";
678
647
  readonly 'chat.actions.screenshotTitle': "Take Screenshot";
679
648
  readonly 'chat.actions.screenshotLabel': "Take screenshot of current content";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/creator",
3
- "version": "0.4.46",
3
+ "version": "0.4.47",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "peerDependencies": {