@widgetic/creator 0.4.44 → 0.4.46

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.
@@ -14,6 +14,7 @@ export const CREATOR_MESSAGES = {
14
14
  'creator.common.thisAppNeedsARefresh': 'This app needs a refresh',
15
15
  'creator.common.reload': 'Reload',
16
16
  'creator.common.publish': 'Publish',
17
+ 'creator.common.update': 'Update',
17
18
  'creator.common.switchVersion': 'Switch version',
18
19
  'creator.common.live': 'Live',
19
20
  'creator.common.setLive': 'Set live',
@@ -61,8 +62,6 @@ export const CREATOR_MESSAGES = {
61
62
  'creator.general.saveBlocked': 'Save blocked',
62
63
  'creator.general.keptALocalCopyCheck': 'Kept a local copy — check your connection and retry.',
63
64
  'creator.general.apiClientUnavailable': 'API client unavailable.',
64
- 'creator.general.screenshotCouldNotBeCaptured': 'Screenshot could not be captured',
65
- 'creator.general.fixTheSelectionZoomOut': 'Fix the selection (zoom out / deselect) and try Convert again.',
66
65
  'creator.general.checkConsoleForDetails': 'Check console for details.',
67
66
  'creator.general.retryLoad': 'Retry load',
68
67
  'creator.general.dismiss': 'Dismiss',
@@ -96,7 +95,6 @@ export const CREATOR_MESSAGES = {
96
95
  'creator.session.pleaseLoginAgainToContinue': 'Please login again to continue.',
97
96
  'creator.session.signInAgainToPublish': 'Sign in again to publish.',
98
97
  'creator.session.loginRequiredToDuplicateWidget': 'Login required to duplicate widget',
99
- 'creator.session.pleaseLoginFirst': 'Please login first',
100
98
  'creator.session.authenticationRequired': 'Authentication required',
101
99
  'creator.session.pleaseLoginBeforeCreatingA': 'Please login before creating a repository.',
102
100
  'creator.session.thisWidgetReferencesARepository': 'This widget references a repository owned by a different user. A new repository will be provisioned to avoid permission issues.',
@@ -104,6 +102,7 @@ export const CREATOR_MESSAGES = {
104
102
  // Widgets: creating, renaming, deleting, duplicating.
105
103
  'creator.widget.notFound': 'Widget not found',
106
104
  'creator.widget.fallbackName': 'Widget',
105
+ 'creator.widget.untitledName': 'Untitled widget',
107
106
  'creator.widget.noWidgetSelected': 'No widget selected.',
108
107
  'creator.widget.shapeRemoved': 'Shape removed',
109
108
  'creator.widget.widgetKeptInDatabase': 'Widget kept in database',
@@ -125,8 +124,6 @@ export const CREATOR_MESSAGES = {
125
124
  'creator.widget.widgetKeptInDatabase2': 'Widget "{name}" kept in database',
126
125
  'creator.widget.youCanKeepEditingWidgets': 'You can keep editing widgets. Retry load if shapes are missing.',
127
126
  'creator.widget.oneWidgetAlready': 'This canvas already has a widget. Turn Advanced on to add another.',
128
- 'creator.widget.widgetDraftCreated': 'Widget draft created',
129
- 'creator.widget.failedToPrepareWidgetDraft': 'Failed to prepare widget draft',
130
127
  'creator.widget.failedToCreateWidgetFrom': 'Failed to create widget from design',
131
128
  'creator.widget.widgetCreatedButNoId': 'Widget created but no ID returned',
132
129
  'creator.widget.failedToFinalizeWidgetConversion': 'Failed to finalize widget conversion',
@@ -166,6 +163,13 @@ export const CREATOR_MESSAGES = {
166
163
  '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.',
167
164
  'creator.canvas.deleteCanvas': 'Delete Canvas',
168
165
  '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
+ 'creator.sketch.customize': 'Customize',
172
+ 'creator.sketch.publishedJustNow': 'Published just now',
169
173
  // The chat tab reuses `creator.livePreviews.chat` ("Chat"): the catalog holds one key per wording.
170
174
  // Compositions: creating, saving, renaming, deleting, the Edit step.
171
175
  'creator.composition.compositionCreated': 'Composition "{name}" created',
@@ -236,7 +240,7 @@ export const CREATOR_MESSAGES = {
236
240
  'creator.codegen.repositoryMissingUseRebuildCode': 'Repository missing — use Rebuild code or regenerate to create one.',
237
241
  'creator.codegen.buildFailedCheckLogsFor': 'Build failed. Check logs for details.',
238
242
  'creator.codegen.createdWithExistingCode': '"{name}" created with existing code',
239
- 'creator.codegen.editTheSketchFreelySending': 'Edit the sketch freely. Sending the prompt creates the widget.',
243
+ 'creator.codegen.assistantModelLabel': 'Assistant',
240
244
  'creator.codegen.repositoryIsNowLinkedTo': 'Repository {id}… is now linked to this widget.',
241
245
  'creator.codegen.repositoryExists': 'Repository exists',
242
246
  'creator.codegen.repositoryOwnedByAnotherAccount': 'Repository owned by another account',
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Sketch embed creator bar — Figma 514:43 instance rules per canvas state.
3
+ */
4
+ export type PanelCodegenFlags = {
5
+ lastGenerationFailed?: boolean;
6
+ };
7
+ export declare function isSketchGenerationFailed(panelState: PanelCodegenFlags, widget: Record<string, unknown> | null | undefined): boolean;
8
+ /** Figma ready frame: caption "Saved 2m ago" from widget `updatedAt`. */
9
+ export declare function sketchSavedStatusLabel(savedWord: string, updatedAt: unknown, nowMs?: number): string;
10
+ export declare function sketchBarShowsPublish(input: {
11
+ embedded: boolean;
12
+ widgetId: string | null;
13
+ hasGeneratedCode: boolean;
14
+ showsLive: boolean;
15
+ generating: boolean;
16
+ failed: boolean;
17
+ }): boolean;
18
+ export declare function sketchBarShowsCustomize(input: {
19
+ embedded: boolean;
20
+ widgetId: string | null;
21
+ hasGeneratedCode: boolean;
22
+ generating: boolean;
23
+ failed: boolean;
24
+ hasActiveCodegen: boolean;
25
+ }): boolean;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Sketch embed creator bar — Figma 514:43 instance rules per canvas state.
3
+ */
4
+ export function isSketchGenerationFailed(panelState, widget) {
5
+ const codegenStatus = String(widget?.codegenStatus ??
6
+ widget?.codegen_status ??
7
+ '').trim();
8
+ return (panelState.lastGenerationFailed === true ||
9
+ codegenStatus === 'failed' ||
10
+ widget?.generationFailed === true ||
11
+ widget?.generation_failed === true);
12
+ }
13
+ /** Figma ready frame: caption "Saved 2m ago" from widget `updatedAt`. */
14
+ export function sketchSavedStatusLabel(savedWord, updatedAt, nowMs = Date.now()) {
15
+ const raw = updatedAt == null ? '' : String(updatedAt).trim();
16
+ if (!raw)
17
+ return savedWord;
18
+ const t = Date.parse(raw);
19
+ if (!Number.isFinite(t))
20
+ return savedWord;
21
+ const diffMin = Math.max(0, Math.round((nowMs - t) / 60_000));
22
+ if (diffMin < 1)
23
+ return `${savedWord} just now`;
24
+ if (diffMin < 60)
25
+ return `${savedWord} ${diffMin}m ago`;
26
+ const diffH = Math.round(diffMin / 60);
27
+ if (diffH < 24)
28
+ return `${savedWord} ${diffH}h ago`;
29
+ return savedWord;
30
+ }
31
+ export function sketchBarShowsPublish(input) {
32
+ return (input.embedded &&
33
+ !!input.widgetId &&
34
+ input.hasGeneratedCode &&
35
+ !input.showsLive &&
36
+ !input.generating &&
37
+ !input.failed);
38
+ }
39
+ export function sketchBarShowsCustomize(input) {
40
+ return (input.embedded &&
41
+ !!input.widgetId &&
42
+ input.hasGeneratedCode &&
43
+ !input.generating &&
44
+ !input.failed &&
45
+ !input.hasActiveCodegen);
46
+ }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@widgetic/creator",
3
- "version": "0.4.44",
3
+ "version": "0.4.46",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "peerDependencies": {
7
7
  "@sveltejs/kit": "^2.20.0",
8
8
  "@widgetic/api-sdk": "^2.0.0",
9
9
  "@widgetic/cache-layer": "^0.1.2",
10
- "@widgetic/canvas": "^0.5.35",
11
- "@widgetic/chat": "^0.1.34",
12
- "@widgetic/design-system": "^0.5.15",
13
- "@widgetic/editor": "^4.0.10",
14
- "@widgetic/file-browser": "^0.5.24",
10
+ "@widgetic/canvas": "^0.5.36",
11
+ "@widgetic/chat": "^0.1.36",
12
+ "@widgetic/design-system": "^0.5.32",
13
+ "@widgetic/editor": "^4.1.3",
14
+ "@widgetic/file-browser": "^0.5.25",
15
15
  "svelte": "^5.25.0"
16
16
  },
17
17
  "svelte": "./dist/index.js",
@@ -74,12 +74,12 @@
74
74
  "@types/node": "26.4.0",
75
75
  "@widgetic/api-sdk": "^2.0.0",
76
76
  "@widgetic/cache-layer": "^0.1.2",
77
- "@widgetic/canvas": "^0.5.35",
78
- "@widgetic/chat": "^0.1.34",
79
- "@widgetic/design-system": "^0.5.15",
77
+ "@widgetic/canvas": "^0.5.36",
78
+ "@widgetic/chat": "^0.1.36",
79
+ "@widgetic/design-system": "^0.5.32",
80
80
  "@widgetic/dev-tools": "^0.3.0",
81
- "@widgetic/editor": "^4.0.10",
82
- "@widgetic/file-browser": "^0.5.24",
81
+ "@widgetic/editor": "^4.1.3",
82
+ "@widgetic/file-browser": "^0.5.25",
83
83
  "autoprefixer": "^10.4.20",
84
84
  "eslint": "^9.0.0",
85
85
  "eslint-config-prettier": "^9.1.0",