@widgetic/creator 0.4.46 → 0.4.48
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 +140 -214
- package/dist/CreatorApp.svelte.d.ts +3 -0
- package/dist/components/BrandKitPanel.svelte.d.ts +1 -1
- package/dist/components/FileUrlSourceControl.svelte.d.ts +1 -1
- package/dist/components/WidgetDetails.svelte +1 -1
- package/dist/components/WidgetDetails.svelte.d.ts +1 -1
- package/dist/components/WidgetShapeLivePreviews.svelte +51 -12
- package/dist/components/WidgetShapeLivePreviews.svelte.d.ts +2 -2
- package/dist/creator-types.d.ts +20 -0
- package/dist/debug/debugUiVisibility.d.ts +5 -0
- package/dist/debug/debugUiVisibility.js +4 -0
- package/dist/i18n/language.d.ts +16 -59
- package/dist/i18n/messages.d.ts +1 -16
- package/dist/i18n/messages.js +2 -17
- package/dist/publish/publishGenerationGate.d.ts +9 -0
- package/dist/publish/publishGenerationGate.js +10 -0
- package/dist/sketchBarState.d.ts +5 -0
- package/dist/sketchBarState.js +9 -6
- package/dist/utils/operationStream.js +5 -1
- package/package.json +1 -1
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -82,7 +82,6 @@ export declare const CREATOR_MESSAGES: {
|
|
|
82
82
|
readonly 'creator.general.keepInDatabase': "Keep in Database";
|
|
83
83
|
readonly 'creator.general.deleteFromDatabase': "Delete from Database";
|
|
84
84
|
readonly 'creator.general.checkingWhatWillBeDeleted': "Checking what will be deleted…";
|
|
85
|
-
readonly 'creator.general.describeWhatYouWant': "Describe what you want...";
|
|
86
85
|
readonly 'creator.session.endedStartAgain': "This session is no longer active. Please start again from the page.";
|
|
87
86
|
readonly 'creator.session.canvasCannotOpen': "This canvas cannot be opened. Please start again from the page.";
|
|
88
87
|
readonly 'creator.session.sessionEnded': "Session ended";
|
|
@@ -99,7 +98,6 @@ export declare const CREATOR_MESSAGES: {
|
|
|
99
98
|
readonly 'creator.widget.notFound': "Widget not found";
|
|
100
99
|
readonly 'creator.widget.fallbackName': "Widget";
|
|
101
100
|
readonly 'creator.widget.untitledName': "Untitled widget";
|
|
102
|
-
readonly 'creator.widget.noWidgetSelected': "No widget selected.";
|
|
103
101
|
readonly 'creator.widget.shapeRemoved': "Shape removed";
|
|
104
102
|
readonly 'creator.widget.widgetKeptInDatabase': "Widget kept in database";
|
|
105
103
|
readonly 'creator.widget.widgetDeletedFromDatabase': "Widget deleted from database";
|
|
@@ -158,13 +156,9 @@ export declare const CREATOR_MESSAGES: {
|
|
|
158
156
|
readonly 'creator.canvas.shapeDataMayBeMissing': "Shape data may be missing from the saved canvas (failed autosave or API quota). Widgets still work from the list — click Restore shapes to re-add placeholders on the canvas.";
|
|
159
157
|
readonly 'creator.canvas.deleteCanvas': "Delete Canvas";
|
|
160
158
|
readonly 'creator.embedded.tabCanvas': "Canvas";
|
|
161
|
-
readonly 'creator.sketch.boardReady': "Your widget is ready";
|
|
162
|
-
readonly 'creator.sketch.boardGenerating': "Generating your widget…";
|
|
163
|
-
readonly 'creator.sketch.boardFailed': "Could not generate your widget";
|
|
164
|
-
/** The button inside the failed chip: runs the last prompt again. */
|
|
165
|
-
readonly 'creator.sketch.boardFailedRetry': "Try again";
|
|
166
159
|
readonly 'creator.sketch.customize': "Customize";
|
|
167
160
|
readonly 'creator.sketch.publishedJustNow': "Published just now";
|
|
161
|
+
readonly 'creator.sketch.publishNeedsWidget': "Send a message first so your widget gets built, then publish it.";
|
|
168
162
|
readonly 'creator.composition.compositionCreated': "Composition \"{name}\" created";
|
|
169
163
|
readonly 'creator.composition.failedToCreateComposition': "Failed to create composition: {message}";
|
|
170
164
|
readonly 'creator.composition.compositionSaved': "Composition saved";
|
|
@@ -178,8 +172,6 @@ export declare const CREATOR_MESSAGES: {
|
|
|
178
172
|
readonly 'creator.composition.deleteThisComposition': "Delete this composition?";
|
|
179
173
|
readonly 'creator.composition.webComponentFormatRequiresA': "Web Component format requires a composition. Select a composition first — falling back to iframe for direct widget URL.";
|
|
180
174
|
readonly 'creator.composition.compositionUrl': "Composition URL";
|
|
181
|
-
readonly 'creator.codegen.referenceImages': "Reference Images ({count})";
|
|
182
|
-
readonly 'creator.codegen.referenceNumber': "Reference {number}";
|
|
183
175
|
readonly 'creator.codegen.missingReferenceImage': "Missing reference image";
|
|
184
176
|
readonly 'creator.codegen.unreadableAttachmentsTitle': "Some attached files were not used";
|
|
185
177
|
readonly 'creator.codegen.unreadableAttachments': "The builder reads images, CSV files and Markdown or text files. It did not read: {names}. Paste the text into your message instead.";
|
|
@@ -254,12 +246,6 @@ export declare const CREATOR_MESSAGES: {
|
|
|
254
246
|
readonly 'creator.codegen.generateCodeFirstToCustomize': "Generate code first to customize colors, text, and content.";
|
|
255
247
|
readonly 'creator.codegen.noWidgetCodeYet': "No widget code yet";
|
|
256
248
|
readonly 'creator.codegen.goToStep1Create': "Go to Step 1 (Create) to generate widget code first.";
|
|
257
|
-
readonly 'creator.codegen.confirmCodeGeneration': "Confirm Code Generation";
|
|
258
|
-
readonly 'creator.codegen.reviewThePromptAndReference': "Review the prompt and reference image before starting generation.";
|
|
259
|
-
readonly 'creator.codegen.describeTheWidgetYouWant': "Describe the widget you want. You can attach a screenshot first if you have a design.";
|
|
260
|
-
readonly 'creator.codegen.prompt': "Prompt";
|
|
261
|
-
readonly 'creator.codegen.editPromptFirst': "Edit Prompt First";
|
|
262
|
-
readonly 'creator.codegen.generateNow': "🚀 Generate Now";
|
|
263
249
|
readonly 'creator.preview.newerThanLive': "Newer than Live v{version}";
|
|
264
250
|
readonly 'creator.preview.mayShowLive': "Preview may show Live v{version} while HEAD is broken.";
|
|
265
251
|
readonly 'creator.preview.rebuilt': "Preview rebuilt";
|
|
@@ -305,7 +291,6 @@ export declare const CREATOR_MESSAGES: {
|
|
|
305
291
|
readonly 'creator.publish.publishIsRunningInAnother': "Publish is running in another browser tab.";
|
|
306
292
|
readonly 'creator.publish.thisVersionIsAlreadyPublished': "This version is already published.";
|
|
307
293
|
readonly 'creator.publish.thisDraftHasNoRecorded': "This draft has no recorded commit to publish.";
|
|
308
|
-
readonly 'creator.publish.generateWidgetCodeBeforePublishing': "Generate widget code before publishing.";
|
|
309
294
|
readonly 'creator.publish.publishWidget': "Publish Widget";
|
|
310
295
|
/** The name of the publish button the page shows (it hears it from the creator) when the widget has changes that are not live. */
|
|
311
296
|
readonly 'creator.publish.publishChanges': "Publish changes";
|
package/dist/i18n/messages.js
CHANGED
|
@@ -84,7 +84,6 @@ export const CREATOR_MESSAGES = {
|
|
|
84
84
|
'creator.general.keepInDatabase': 'Keep in Database',
|
|
85
85
|
'creator.general.deleteFromDatabase': 'Delete from Database',
|
|
86
86
|
'creator.general.checkingWhatWillBeDeleted': 'Checking what will be deleted…',
|
|
87
|
-
'creator.general.describeWhatYouWant': 'Describe what you want...',
|
|
88
87
|
// The visitor's session: ended, expired, sign-in needed.
|
|
89
88
|
'creator.session.endedStartAgain': 'This session is no longer active. Please start again from the page.',
|
|
90
89
|
'creator.session.canvasCannotOpen': 'This canvas cannot be opened. Please start again from the page.',
|
|
@@ -103,7 +102,6 @@ export const CREATOR_MESSAGES = {
|
|
|
103
102
|
'creator.widget.notFound': 'Widget not found',
|
|
104
103
|
'creator.widget.fallbackName': 'Widget',
|
|
105
104
|
'creator.widget.untitledName': 'Untitled widget',
|
|
106
|
-
'creator.widget.noWidgetSelected': 'No widget selected.',
|
|
107
105
|
'creator.widget.shapeRemoved': 'Shape removed',
|
|
108
106
|
'creator.widget.widgetKeptInDatabase': 'Widget kept in database',
|
|
109
107
|
'creator.widget.widgetDeletedFromDatabase': 'Widget deleted from database',
|
|
@@ -163,13 +161,9 @@ export const CREATOR_MESSAGES = {
|
|
|
163
161
|
'creator.canvas.shapeDataMayBeMissing': 'Shape data may be missing from the saved canvas (failed autosave or API quota). Widgets still work from the list — click Restore shapes to re-add placeholders on the canvas.',
|
|
164
162
|
'creator.canvas.deleteCanvas': 'Delete Canvas',
|
|
165
163
|
'creator.embedded.tabCanvas': 'Canvas',
|
|
166
|
-
'creator.sketch.boardReady': 'Your widget is ready',
|
|
167
|
-
'creator.sketch.boardGenerating': 'Generating your widget…',
|
|
168
|
-
'creator.sketch.boardFailed': 'Could not generate your widget',
|
|
169
|
-
/** The button inside the failed chip: runs the last prompt again. */
|
|
170
|
-
'creator.sketch.boardFailedRetry': 'Try again',
|
|
171
164
|
'creator.sketch.customize': 'Customize',
|
|
172
165
|
'creator.sketch.publishedJustNow': 'Published just now',
|
|
166
|
+
'creator.sketch.publishNeedsWidget': 'Send a message first so your widget gets built, then publish it.',
|
|
173
167
|
// The chat tab reuses `creator.livePreviews.chat` ("Chat"): the catalog holds one key per wording.
|
|
174
168
|
// Compositions: creating, saving, renaming, deleting, the Edit step.
|
|
175
169
|
'creator.composition.compositionCreated': 'Composition "{name}" created',
|
|
@@ -185,9 +179,7 @@ export const CREATOR_MESSAGES = {
|
|
|
185
179
|
'creator.composition.deleteThisComposition': 'Delete this composition?',
|
|
186
180
|
'creator.composition.webComponentFormatRequiresA': 'Web Component format requires a composition. Select a composition first — falling back to iframe for direct widget URL.',
|
|
187
181
|
'creator.composition.compositionUrl': 'Composition URL',
|
|
188
|
-
// Code generation
|
|
189
|
-
'creator.codegen.referenceImages': 'Reference Images ({count})',
|
|
190
|
-
'creator.codegen.referenceNumber': 'Reference {number}',
|
|
182
|
+
// Code generation and repositories.
|
|
191
183
|
'creator.codegen.missingReferenceImage': 'Missing reference image',
|
|
192
184
|
'creator.codegen.unreadableAttachmentsTitle': 'Some attached files were not used',
|
|
193
185
|
'creator.codegen.unreadableAttachments': 'The builder reads images, CSV files and Markdown or text files. It did not read: {names}. Paste the text into your message instead.',
|
|
@@ -263,12 +255,6 @@ export const CREATOR_MESSAGES = {
|
|
|
263
255
|
'creator.codegen.generateCodeFirstToCustomize': 'Generate code first to customize colors, text, and content.',
|
|
264
256
|
'creator.codegen.noWidgetCodeYet': 'No widget code yet',
|
|
265
257
|
'creator.codegen.goToStep1Create': 'Go to Step 1 (Create) to generate widget code first.',
|
|
266
|
-
'creator.codegen.confirmCodeGeneration': 'Confirm Code Generation',
|
|
267
|
-
'creator.codegen.reviewThePromptAndReference': 'Review the prompt and reference image before starting generation.',
|
|
268
|
-
'creator.codegen.describeTheWidgetYouWant': 'Describe the widget you want. You can attach a screenshot first if you have a design.',
|
|
269
|
-
'creator.codegen.prompt': 'Prompt',
|
|
270
|
-
'creator.codegen.editPromptFirst': 'Edit Prompt First',
|
|
271
|
-
'creator.codegen.generateNow': '🚀 Generate Now',
|
|
272
258
|
// The preview and its banners.
|
|
273
259
|
'creator.preview.newerThanLive': 'Newer than Live v{version}',
|
|
274
260
|
'creator.preview.mayShowLive': 'Preview may show Live v{version} while HEAD is broken.',
|
|
@@ -318,7 +304,6 @@ export const CREATOR_MESSAGES = {
|
|
|
318
304
|
'creator.publish.publishIsRunningInAnother': 'Publish is running in another browser tab.',
|
|
319
305
|
'creator.publish.thisVersionIsAlreadyPublished': 'This version is already published.',
|
|
320
306
|
'creator.publish.thisDraftHasNoRecorded': 'This draft has no recorded commit to publish.',
|
|
321
|
-
'creator.publish.generateWidgetCodeBeforePublishing': 'Generate widget code before publishing.',
|
|
322
307
|
'creator.publish.publishWidget': 'Publish Widget',
|
|
323
308
|
/** The name of the publish button the page shows (it hears it from the creator) when the widget has changes that are not live. */
|
|
324
309
|
'creator.publish.publishChanges': 'Publish changes',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PublishCodeSnapshot = {
|
|
2
|
+
hasGeneratedCode: boolean;
|
|
3
|
+
lastPublishedVersion: number | null;
|
|
4
|
+
lastCommitId: string | null;
|
|
5
|
+
};
|
|
6
|
+
/** True when the panel has no generated version/commit to publish yet (fresh or sketch-only). */
|
|
7
|
+
export declare function panelLacksGeneratedVersion(snapshot: PublishCodeSnapshot): boolean;
|
|
8
|
+
/** Publish stays clickable; this is when a click should nudge Send instead of running publish. */
|
|
9
|
+
export declare function shouldNudgeSendBeforePublish(snapshot: PublishCodeSnapshot): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** True when the panel has no generated version/commit to publish yet (fresh or sketch-only). */
|
|
2
|
+
export function panelLacksGeneratedVersion(snapshot) {
|
|
3
|
+
return !(snapshot.hasGeneratedCode
|
|
4
|
+
|| snapshot.lastPublishedVersion !== null
|
|
5
|
+
|| !!snapshot.lastCommitId);
|
|
6
|
+
}
|
|
7
|
+
/** Publish stays clickable; this is when a click should nudge Send instead of running publish. */
|
|
8
|
+
export function shouldNudgeSendBeforePublish(snapshot) {
|
|
9
|
+
return panelLacksGeneratedVersion(snapshot);
|
|
10
|
+
}
|
package/dist/sketchBarState.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export type PanelCodegenFlags = {
|
|
|
7
7
|
export declare function isSketchGenerationFailed(panelState: PanelCodegenFlags, widget: Record<string, unknown> | null | undefined): boolean;
|
|
8
8
|
/** Figma ready frame: caption "Saved 2m ago" from widget `updatedAt`. */
|
|
9
9
|
export declare function sketchSavedStatusLabel(savedWord: string, updatedAt: unknown, nowMs?: number): string;
|
|
10
|
+
/**
|
|
11
|
+
* The bar of the Figma frames carries Publish in every state except while the widget is being built (526:2466) and after a
|
|
12
|
+
* failed build (526:2984). A canvas that has no widget yet (the Empty frame) shows it too, as the way of learning that
|
|
13
|
+
* Send comes first: a bar with no Publish at all on a new canvas read as "Publish is missing".
|
|
14
|
+
*/
|
|
10
15
|
export declare function sketchBarShowsPublish(input: {
|
|
11
16
|
embedded: boolean;
|
|
12
17
|
widgetId: string | null;
|
package/dist/sketchBarState.js
CHANGED
|
@@ -28,13 +28,16 @@ export function sketchSavedStatusLabel(savedWord, updatedAt, nowMs = Date.now())
|
|
|
28
28
|
return `${savedWord} ${diffH}h ago`;
|
|
29
29
|
return savedWord;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The bar of the Figma frames carries Publish in every state except while the widget is being built (526:2466) and after a
|
|
33
|
+
* failed build (526:2984). A canvas that has no widget yet (the Empty frame) shows it too, as the way of learning that
|
|
34
|
+
* Send comes first: a bar with no Publish at all on a new canvas read as "Publish is missing".
|
|
35
|
+
*/
|
|
31
36
|
export function sketchBarShowsPublish(input) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
!input.generating &&
|
|
37
|
-
!input.failed);
|
|
37
|
+
void input.widgetId;
|
|
38
|
+
void input.hasGeneratedCode;
|
|
39
|
+
void input.showsLive;
|
|
40
|
+
return input.embedded && !input.generating && !input.failed;
|
|
38
41
|
}
|
|
39
42
|
export function sketchBarShowsCustomize(input) {
|
|
40
43
|
return (input.embedded &&
|
|
@@ -29,7 +29,11 @@ export function streamOperationUpdates(operationId, options) {
|
|
|
29
29
|
}
|
|
30
30
|
deferredFrame = null;
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
// `cancel()` answers with a promise that rejects with the AbortError of a stream the caller has aborted (a press
|
|
33
|
+
// of Stop): left alone, that rejection reaches the console as an uncaught error.
|
|
34
|
+
void reader?.cancel().catch(() => {
|
|
35
|
+
/* the stream is closed either way */
|
|
36
|
+
});
|
|
33
37
|
}
|
|
34
38
|
catch {
|
|
35
39
|
/* noop */
|