tempo-sdk 0.0.28 → 0.0.31
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/canvas/editor.d.ts +29 -1
- package/dist/canvas/editor.js +50 -5
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/index.d.ts +3 -66
- package/dist/canvas/index.js +56 -940
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +2679 -1956
- package/dist/canvas/interact-projection.js.map +1 -1
- package/dist/canvas/parser.d.ts +6 -0
- package/dist/canvas/parser.js +1 -1
- package/dist/canvas/svelte.d.ts +18 -0
- package/dist/canvas/svelte.js +68 -0
- package/dist/canvas/svelte.js.map +1 -0
- package/dist/chunk-DXKG4IGS.js +919 -0
- package/dist/chunk-DXKG4IGS.js.map +1 -0
- package/dist/chunk-F3KJDCMU.js +19 -0
- package/dist/chunk-F3KJDCMU.js.map +1 -0
- package/dist/{chunk-2MAQPUCU.js → chunk-QP2NTODB.js} +19 -12
- package/dist/chunk-QP2NTODB.js.map +1 -0
- package/dist/{chunk-XEXMGSTU.js → chunk-YZ3TMGUC.js} +21 -2
- package/dist/{chunk-XEXMGSTU.js.map → chunk-YZ3TMGUC.js.map} +1 -1
- package/dist/index.js +23 -16
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +20 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/storyboard-xVaRTJAu.d.ts +69 -0
- package/dist/svelte.d.ts +21 -0
- package/dist/svelte.js +1898 -0
- package/dist/svelte.js.map +1 -0
- package/package.json +20 -1
- package/dist/chunk-2MAQPUCU.js.map +0 -1
package/dist/canvas/editor.d.ts
CHANGED
|
@@ -30,6 +30,18 @@ type AddCanvasStoryboardInput = {
|
|
|
30
30
|
source: string;
|
|
31
31
|
importedName?: string;
|
|
32
32
|
};
|
|
33
|
+
} | {
|
|
34
|
+
kind: "svelte-component";
|
|
35
|
+
id: string;
|
|
36
|
+
layout: CanvasEditorLayout;
|
|
37
|
+
name?: string;
|
|
38
|
+
componentExpression?: string;
|
|
39
|
+
props?: string;
|
|
40
|
+
componentImport?: {
|
|
41
|
+
localName: string;
|
|
42
|
+
source: string;
|
|
43
|
+
importedName?: string;
|
|
44
|
+
};
|
|
33
45
|
} | {
|
|
34
46
|
kind: "legacy-v1";
|
|
35
47
|
id: string;
|
|
@@ -99,6 +111,22 @@ declare function updateStoryboardProps(options: {
|
|
|
99
111
|
storyboardId: string;
|
|
100
112
|
propsExpression?: string;
|
|
101
113
|
}): CanvasEditResult;
|
|
114
|
+
/**
|
|
115
|
+
* Sets or clears the opt-in visual-regression tracking mark (TEM-1775) on a
|
|
116
|
+
* component storyboard. `tracked: true` writes the bare `vrt` attribute
|
|
117
|
+
* (tracked with defaults), replacing an existing untracked declaration
|
|
118
|
+
* (`vrt={false}`, dynamic forms) in place; an already-tracked declaration —
|
|
119
|
+
* including the object form with threshold/ignore overrides — is left
|
|
120
|
+
* untouched. `tracked: false` removes the whole `vrt` attribute, object
|
|
121
|
+
* config included: the in-app toggle is a full untrack, not the
|
|
122
|
+
* `skip: true` pause.
|
|
123
|
+
*/
|
|
124
|
+
declare function updateStoryboardVrt(options: {
|
|
125
|
+
filePath: string;
|
|
126
|
+
source: string;
|
|
127
|
+
storyboardId: string;
|
|
128
|
+
tracked: boolean;
|
|
129
|
+
}): CanvasEditResult;
|
|
102
130
|
declare function updateRouteStoryboardRoute(options: {
|
|
103
131
|
filePath: string;
|
|
104
132
|
source: string;
|
|
@@ -161,4 +189,4 @@ declare function sourceContainsIdentifierNode(filePath: string, source: string,
|
|
|
161
189
|
*/
|
|
162
190
|
declare function walkWithParent(node: any, visit: (node: any, parent: any, key: string | null) => void, parent?: any, key?: string | null, seen?: Set<any>): void;
|
|
163
191
|
|
|
164
|
-
export { type AddCanvasStoryboardInput, type CanvasEditResult, type CanvasEditorLayout, type CanvasSourceEdit, addCanvasStoryboard, applyCanvasSourceEdits, collapseBlankLines, detectNewline, expandStatementForward, expandToFullLines, formatJsxStringAttribute, hasIdentifier, removeCanvasStoryboard, sourceContainsIdentifierNode, topLevelInsertionOffset, updateCanvasBackgroundColor, updateCanvasName, updateCanvasPath, updateHtmlStoryboardSource, updateRouteStoryboardRoute, updateStoryboardComponent, updateStoryboardId, updateStoryboardLayout, updateStoryboardName, updateStoryboardProps, walkWithParent };
|
|
192
|
+
export { type AddCanvasStoryboardInput, type CanvasEditResult, type CanvasEditorLayout, type CanvasSourceEdit, addCanvasStoryboard, applyCanvasSourceEdits, collapseBlankLines, detectNewline, expandStatementForward, expandToFullLines, formatJsxStringAttribute, hasIdentifier, removeCanvasStoryboard, sourceContainsIdentifierNode, topLevelInsertionOffset, updateCanvasBackgroundColor, updateCanvasName, updateCanvasPath, updateHtmlStoryboardSource, updateRouteStoryboardRoute, updateStoryboardComponent, updateStoryboardId, updateStoryboardLayout, updateStoryboardName, updateStoryboardProps, updateStoryboardVrt, walkWithParent };
|
package/dist/canvas/editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseCanvasFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-QP2NTODB.js";
|
|
4
4
|
|
|
5
5
|
// canvas/editor.ts
|
|
6
6
|
import { parseSync } from "oxc-parser";
|
|
@@ -217,6 +217,48 @@ function updateStoryboardProps(options) {
|
|
|
217
217
|
});
|
|
218
218
|
return applyResult(options.source, parsed, edit ? [edit] : []);
|
|
219
219
|
}
|
|
220
|
+
function updateStoryboardVrt(options) {
|
|
221
|
+
const parsed = parseCanvasFile(options.filePath, options.source);
|
|
222
|
+
const storyboard = findStoryboard(parsed, options.storyboardId);
|
|
223
|
+
if (storyboard.kind !== "component") {
|
|
224
|
+
throw new Error(
|
|
225
|
+
`Storyboard "${options.storyboardId}" is not a component storyboard`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (!options.tracked) {
|
|
229
|
+
if (!storyboard.vrtAttributeSpan) {
|
|
230
|
+
return applyResult(options.source, parsed, []);
|
|
231
|
+
}
|
|
232
|
+
return applyResult(options.source, parsed, [
|
|
233
|
+
{
|
|
234
|
+
...expandJsxAttributeRemoval(
|
|
235
|
+
options.source,
|
|
236
|
+
storyboard.vrtAttributeSpan
|
|
237
|
+
),
|
|
238
|
+
value: ""
|
|
239
|
+
}
|
|
240
|
+
]);
|
|
241
|
+
}
|
|
242
|
+
if (storyboard.vrt) {
|
|
243
|
+
return applyResult(options.source, parsed, []);
|
|
244
|
+
}
|
|
245
|
+
if (storyboard.vrtAttributeSpan) {
|
|
246
|
+
return applyResult(options.source, parsed, [
|
|
247
|
+
{
|
|
248
|
+
start: storyboard.vrtAttributeSpan.start,
|
|
249
|
+
end: storyboard.vrtAttributeSpan.end,
|
|
250
|
+
value: "vrt"
|
|
251
|
+
}
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
const offset = findOpeningElementAttributeInsertionOffset(
|
|
255
|
+
options.source,
|
|
256
|
+
requireStoryboardOpeningSpan(storyboard, options.storyboardId)
|
|
257
|
+
);
|
|
258
|
+
return applyResult(options.source, parsed, [
|
|
259
|
+
{ start: offset, end: offset, value: " vrt" }
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
220
262
|
function updateRouteStoryboardRoute(options) {
|
|
221
263
|
const parsed = parseCanvasFile(options.filePath, options.source);
|
|
222
264
|
const storyboard = findStoryboard(parsed, options.storyboardId);
|
|
@@ -289,7 +331,7 @@ function addCanvasStoryboard(options) {
|
|
|
289
331
|
storyboardTag = sdkTag.tag;
|
|
290
332
|
}
|
|
291
333
|
let componentExpression;
|
|
292
|
-
if (options.storyboard.kind === "component") {
|
|
334
|
+
if (options.storyboard.kind === "component" || options.storyboard.kind === "svelte-component") {
|
|
293
335
|
componentExpression = options.storyboard.componentExpression ?? options.storyboard.componentImport?.localName;
|
|
294
336
|
if (!componentExpression) {
|
|
295
337
|
throw new Error(
|
|
@@ -537,7 +579,7 @@ function formatJsxStringAttribute(name, value) {
|
|
|
537
579
|
return plainSafe ? `${name}=${encoded}` : `${name}={${encoded}}`;
|
|
538
580
|
}
|
|
539
581
|
function storyboardKindProps(storyboard, componentExpression) {
|
|
540
|
-
if (storyboard.kind === "component") {
|
|
582
|
+
if (storyboard.kind === "component" || storyboard.kind === "svelte-component") {
|
|
541
583
|
return [
|
|
542
584
|
`component={${componentExpression}}`,
|
|
543
585
|
...storyboard.props && storyboard.props.trim() !== "" ? [`props={${storyboard.props.trim()}}`] : []
|
|
@@ -565,11 +607,13 @@ function sdkComponentForStoryboard(kind) {
|
|
|
565
607
|
if (kind === "route") return "RouteStoryboard";
|
|
566
608
|
if (kind === "html") return "HtmlStoryboard";
|
|
567
609
|
if (kind === "legacy-v1") return "LegacyStoryboardV1";
|
|
610
|
+
if (kind === "svelte-component") return "SvelteStoryboard";
|
|
568
611
|
return "Storyboard";
|
|
569
612
|
}
|
|
570
613
|
function resolveSdkTag(parsed, component) {
|
|
614
|
+
const sdkSource = component === "SvelteStoryboard" ? "tempo-sdk/canvas/svelte" : "tempo-sdk/canvas";
|
|
571
615
|
for (const item of parsed.imports) {
|
|
572
|
-
if (item.source !==
|
|
616
|
+
if (item.source !== sdkSource) continue;
|
|
573
617
|
if (item.kind === "namespace")
|
|
574
618
|
return { tag: `${item.localName}.${component}` };
|
|
575
619
|
if (item.importedName === component) return { tag: item.localName };
|
|
@@ -577,7 +621,7 @@ function resolveSdkTag(parsed, component) {
|
|
|
577
621
|
const localName = pickAvailableIdentifier(parsed, `TempoCanvas${component}`);
|
|
578
622
|
return {
|
|
579
623
|
tag: localName,
|
|
580
|
-
importLine: `import { ${component} as ${localName} } from "
|
|
624
|
+
importLine: `import { ${component} as ${localName} } from "${sdkSource}";`
|
|
581
625
|
};
|
|
582
626
|
}
|
|
583
627
|
function buildMissingComponentImportLine(parsed, source, componentImport) {
|
|
@@ -893,6 +937,7 @@ export {
|
|
|
893
937
|
updateStoryboardLayout,
|
|
894
938
|
updateStoryboardName,
|
|
895
939
|
updateStoryboardProps,
|
|
940
|
+
updateStoryboardVrt,
|
|
896
941
|
walkWithParent
|
|
897
942
|
};
|
|
898
943
|
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../canvas/editor.ts"],"sourcesContent":["import { parseSync } from \"oxc-parser\";\n\nimport {\n parseCanvasFile,\n type CanvasSourceSpan,\n type ParsedCanvasFile,\n type ParsedCanvasImport,\n type ParsedCanvasStoryboard,\n} from \"./parser\";\n\nexport type CanvasSourceEdit = {\n start: number;\n end: number;\n value: string;\n};\n\nexport type CanvasEditResult = {\n source: string;\n edits: CanvasSourceEdit[];\n parsed: ParsedCanvasFile;\n};\n\nexport type CanvasEditorLayout = {\n x: number;\n y: number;\n width: number;\n height: number;\n zIndex?: number;\n intrinsicSizing?: \"root-element\";\n};\n\nexport type AddCanvasStoryboardInput =\n | {\n kind: \"component\";\n id: string;\n layout: CanvasEditorLayout;\n name?: string;\n componentExpression?: string;\n // Pre-formatted object-literal expression (e.g. `{ a: \"s\", b: expr }`)\n // emitted as `props={<value>}` after `component=`. Used by migration to\n // render `render: () => <C a={b} />` as `component={C} props={{ a: b }}`.\n props?: string;\n componentImport?: {\n localName: string;\n source: string;\n importedName?: string;\n };\n }\n | {\n // Per-storyboard fallback for legacy object shapes migration cannot\n // convert natively: emits `<LegacyStoryboardV1 id storyboard={Expr} />`.\n // The wrapper reads name/layout off the referenced object, so no\n // name/layout attributes are emitted here.\n kind: \"legacy-v1\";\n id: string;\n storyboardExpression: string;\n }\n | {\n kind: \"route\";\n id: string;\n route: string;\n layout: CanvasEditorLayout;\n name?: string;\n }\n | {\n kind: \"html\";\n id: string;\n layout: CanvasEditorLayout;\n name?: string;\n filepath?: string;\n src?: string;\n };\n\ntype SdkComponent =\n | \"Storyboard\"\n | \"LegacyStoryboardV1\"\n | \"RouteStoryboard\"\n | \"HtmlStoryboard\";\n\nexport function applyCanvasSourceEdits(\n source: string,\n edits: readonly CanvasSourceEdit[],\n): string {\n const sorted = [...edits].sort((left, right) => right.start - left.start);\n let previousStart = source.length + 1;\n let nextSource = source;\n\n for (const edit of sorted) {\n if (\n edit.start < 0 ||\n edit.end < edit.start ||\n edit.end > source.length ||\n edit.end > previousStart\n ) {\n throw new Error(\n `Invalid overlapping canvas source edit ${edit.start}:${edit.end}`,\n );\n }\n nextSource =\n nextSource.slice(0, edit.start) + edit.value + nextSource.slice(edit.end);\n previousStart = edit.start;\n }\n\n return nextSource;\n}\n\nexport function updateCanvasName(options: {\n filePath: string;\n source: string;\n name: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"name\",\n requireNonEmpty(options.name, \"Canvas name\"),\n (parsed) => ({\n valueSpan: parsed.nameSpan,\n attributeSpan: parsed.nameAttributeSpan,\n }),\n );\n}\n\nexport function updateCanvasPath(options: {\n filePath: string;\n source: string;\n path: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"path\",\n requireNonEmpty(options.path, \"Canvas path\"),\n (parsed) => ({\n valueSpan: parsed.pathSpan,\n attributeSpan: parsed.pathAttributeSpan,\n }),\n );\n}\n\nexport function updateCanvasBackgroundColor(options: {\n filePath: string;\n source: string;\n backgroundColor?: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"backgroundColor\",\n options.backgroundColor && options.backgroundColor.trim() !== \"\"\n ? options.backgroundColor\n : undefined,\n (parsed) => ({\n valueSpan: parsed.backgroundColorSpan,\n attributeSpan: parsed.backgroundColorAttributeSpan,\n }),\n );\n}\n\nfunction editCanvasStringAttribute(\n options: { filePath: string; source: string },\n attributeName: string,\n value: string | undefined,\n selectSpans: (parsed: ParsedCanvasFile) => {\n valueSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n },\n): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const spans = selectSpans(parsed);\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requiredSpan(\n parsed.canvasOpeningElementSpan,\n \"Canvas opening element not found\",\n ),\n valueSpan: spans.valueSpan,\n attributeSpan: spans.attributeSpan,\n name: attributeName,\n value,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\nexport function updateStoryboardName(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n name?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.legacyV1) {\n const edit = upsertObjectStringProperty({\n source: options.source,\n objectClose: storyboard.legacyV1.objectClose,\n valueSpan: storyboard.nameSpan,\n propertySpan: storyboard.legacyV1.namePropertySpan,\n name: \"name\",\n value:\n options.name && options.name.trim() !== \"\" ? options.name : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n }\n\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.nameSpan,\n attributeSpan: storyboard.nameAttributeSpan,\n name: \"name\",\n value:\n options.name && options.name.trim() !== \"\" ? options.name : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\nexport function updateStoryboardId(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n nextId: string;\n}): CanvasEditResult {\n const nextId = requireNonEmpty(options.nextId, \"Storyboard id\");\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const duplicate = parsed.storyboards.find(\n (item) =>\n item.storyboardKey === nextId &&\n item.storyboardKey !== storyboard.storyboardKey,\n );\n if (duplicate) {\n throw new Error(`Storyboard id \"${nextId}\" already exists`);\n }\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.idSpan,\n attributeSpan: storyboard.idAttributeSpan,\n name: \"id\",\n value: nextId,\n });\n return applyResult(options.source, parsed, [edit]);\n}\n\nexport function updateStoryboardLayout(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n layout: Partial<CanvasEditorLayout>;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const spans = storyboard.layoutSpans;\n if (!spans) {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" has no editable layout`,\n );\n }\n\n const edits: CanvasSourceEdit[] = [];\n for (const key of [\"x\", \"y\", \"width\", \"height\"] as const) {\n if (options.layout[key] === undefined) continue;\n const span = spans[key];\n if (!span) {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" layout.${key} is not editable`,\n );\n }\n edits.push({\n start: span.start,\n end: span.end,\n value: String(roundLayoutNumber(options.layout[key])),\n });\n }\n\n if (options.layout.zIndex !== undefined) {\n const value = String(roundLayoutNumber(options.layout.zIndex));\n edits.push(\n spans.zIndex\n ? { start: spans.zIndex.start, end: spans.zIndex.end, value }\n : insertLayoutProperty(options.source, spans, `zIndex: ${value}`),\n );\n }\n\n if (options.layout.intrinsicSizing !== undefined) {\n const value = JSON.stringify(options.layout.intrinsicSizing);\n edits.push(\n spans.intrinsicSizing\n ? {\n start: spans.intrinsicSizing.start,\n end: spans.intrinsicSizing.end,\n value,\n }\n : insertLayoutProperty(\n options.source,\n spans,\n `intrinsicSizing: ${value}`,\n ),\n );\n }\n\n return applyResult(options.source, parsed, edits);\n}\n\nexport function updateStoryboardComponent(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n componentExpression: string;\n componentImport?: {\n localName: string;\n source: string;\n importedName?: string;\n };\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"component\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not a component storyboard`,\n );\n }\n\n const imports: string[] = [];\n if (options.componentImport) {\n const importLine = buildMissingComponentImportLine(\n parsed,\n options.source,\n options.componentImport,\n );\n if (importLine) imports.push(importLine);\n }\n\n const importEdit = buildImportInsertionEdit(options.source, parsed, imports);\n const componentEdit = upsertJsxExpressionAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n expressionSpan: storyboard.component?.span,\n attributeSpan: storyboard.component?.attributeSpan,\n name: \"component\",\n value: requireNonEmpty(\n options.componentExpression,\n \"Storyboard component expression\",\n ),\n });\n\n return applyResult(options.source, parsed, [\n ...(importEdit ? [importEdit] : []),\n componentEdit,\n ]);\n}\n\nexport function updateStoryboardProps(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n propsExpression?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const edit = upsertJsxExpressionAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n expressionSpan: storyboard.props?.span,\n attributeSpan: storyboard.props?.attributeSpan,\n name: \"props\",\n value:\n options.propsExpression && options.propsExpression.trim() !== \"\"\n ? options.propsExpression.trim()\n : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\nexport function updateRouteStoryboardRoute(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n route: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"route\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not a route storyboard`,\n );\n }\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.routeSpan,\n attributeSpan: storyboard.routeAttributeSpan,\n name: \"route\",\n value: requireNonEmpty(options.route, \"Route storyboard route\"),\n });\n return applyResult(options.source, parsed, [edit]);\n}\n\nexport function updateHtmlStoryboardSource(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n filepath?: string;\n src?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"html\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not an html storyboard`,\n );\n }\n const filepath =\n options.filepath && options.filepath.trim() !== \"\"\n ? options.filepath.trim()\n : undefined;\n const src =\n options.src && options.src.trim() !== \"\" ? options.src : undefined;\n if (!filepath && !src) {\n throw new Error(\"HTML storyboard source requires filepath or src\");\n }\n\n const openingElementSpan = requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n );\n const filepathEdit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan,\n valueSpan: storyboard.filepathSpan,\n attributeSpan: storyboard.filepathAttributeSpan,\n name: \"filepath\",\n value: filepath,\n });\n const srcEdit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan,\n valueSpan: storyboard.srcSpan,\n attributeSpan: storyboard.srcAttributeSpan,\n name: \"src\",\n value: src,\n });\n\n return applyResult(options.source, parsed, [filepathEdit, srcEdit]);\n}\n\nexport function addCanvasStoryboard(options: {\n filePath: string;\n source: string;\n storyboard: AddCanvasStoryboardInput;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n if (\n parsed.storyboards.some(\n (item) => item.storyboardKey === options.storyboard.id,\n )\n ) {\n throw new Error(`Storyboard id \"${options.storyboard.id}\" already exists`);\n }\n\n const imports: string[] = [];\n const sdkComponent = sdkComponentForStoryboard(options.storyboard.kind);\n const sdkTag = resolveSdkTag(parsed, sdkComponent);\n let storyboardTag = sdkTag.tag;\n if (sdkTag.importLine) {\n imports.push(sdkTag.importLine);\n storyboardTag = sdkTag.tag;\n }\n\n let componentExpression: string | undefined;\n if (options.storyboard.kind === \"component\") {\n componentExpression =\n options.storyboard.componentExpression ??\n options.storyboard.componentImport?.localName;\n if (!componentExpression) {\n throw new Error(\n \"Component storyboard requires componentExpression or componentImport\",\n );\n }\n if (options.storyboard.componentImport) {\n const importLine = buildMissingComponentImportLine(\n parsed,\n options.source,\n options.storyboard.componentImport,\n );\n if (importLine) imports.push(importLine);\n }\n }\n\n const importEdit = buildImportInsertionEdit(options.source, parsed, imports);\n const insertionEdit = buildCanvasChildInsertionEdit({\n source: options.source,\n parsed,\n tag: storyboardTag,\n storyboard: options.storyboard,\n componentExpression,\n });\n\n const edits = [...(importEdit ? [importEdit] : []), insertionEdit];\n return applyResult(options.source, parsed, edits);\n}\n\nexport function removeCanvasStoryboard(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n removeUnusedComponentImport?: boolean;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const edits: CanvasSourceEdit[] = [\n {\n ...expandToFullLines(options.source, storyboard.jsxElementSpan),\n value: \"\",\n },\n ];\n\n if (options.removeUnusedComponentImport ?? true) {\n const importEdit = buildUnusedComponentImportRemoval({\n source: options.source,\n parsed,\n deletedStoryboard: storyboard,\n deletionEdit: edits[0],\n });\n if (importEdit) edits.push(importEdit);\n }\n\n const result = applyResult(options.source, parsed, edits);\n return {\n ...result,\n source: collapseBlankLines(result.source, detectNewline(options.source)),\n };\n}\n\nfunction applyResult(\n source: string,\n parsed: ParsedCanvasFile,\n edits: readonly (CanvasSourceEdit | null | undefined)[],\n): CanvasEditResult {\n const compactEdits = edits.filter((edit): edit is CanvasSourceEdit => {\n if (!edit) return false;\n return source.slice(edit.start, edit.end) !== edit.value;\n });\n return {\n source: applyCanvasSourceEdits(source, compactEdits),\n edits: compactEdits,\n parsed,\n };\n}\n\nfunction findStoryboard(\n parsed: ParsedCanvasFile,\n storyboardId: string,\n): ParsedCanvasStoryboard {\n const storyboard = parsed.storyboards.find(\n (item) => item.storyboardKey === storyboardId,\n );\n if (!storyboard) {\n throw new Error(`Storyboard \"${storyboardId}\" not found`);\n }\n return storyboard;\n}\n\nfunction requireStoryboardOpeningSpan(\n storyboard: ParsedCanvasStoryboard,\n storyboardId: string,\n): CanvasSourceSpan {\n return requiredSpan(\n storyboard.openingElementSpan,\n `Storyboard \"${storyboardId}\" opening element not found`,\n );\n}\n\nfunction upsertJsxStringAttribute(options: {\n source: string;\n openingElementSpan: CanvasSourceSpan;\n valueSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.attributeSpan) return null;\n return {\n ...expandJsxAttributeRemoval(options.source, options.attributeSpan),\n value: \"\",\n };\n }\n\n const value = JSON.stringify(options.value);\n if (options.valueSpan) {\n return {\n start: options.valueSpan.start,\n end: options.valueSpan.end,\n value,\n };\n }\n\n const offset = findOpeningElementAttributeInsertionOffset(\n options.source,\n options.openingElementSpan,\n );\n return {\n start: offset,\n end: offset,\n value: ` ${options.name}={${value}}`,\n };\n}\n\nfunction upsertObjectStringProperty(options: {\n source: string;\n objectClose?: number;\n valueSpan?: CanvasSourceSpan;\n propertySpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.propertySpan) return null;\n return {\n ...expandObjectPropertyRemoval(options.source, options.propertySpan),\n value: \"\",\n };\n }\n\n const value = JSON.stringify(options.value);\n if (options.valueSpan) {\n return {\n start: options.valueSpan.start,\n end: options.valueSpan.end,\n value,\n };\n }\n\n if (typeof options.objectClose !== \"number\") {\n throw new Error(`Object close not found for \"${options.name}\" property`);\n }\n\n return insertObjectProperty(\n options.source,\n options.objectClose,\n `${options.name}: ${value}`,\n );\n}\n\nfunction upsertJsxExpressionAttribute(options: {\n source: string;\n openingElementSpan: CanvasSourceSpan;\n expressionSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.attributeSpan) return null;\n return {\n ...expandJsxAttributeRemoval(options.source, options.attributeSpan),\n value: \"\",\n };\n }\n\n if (options.expressionSpan) {\n return {\n start: options.expressionSpan.start,\n end: options.expressionSpan.end,\n value: options.value,\n };\n }\n\n const offset = findOpeningElementAttributeInsertionOffset(\n options.source,\n options.openingElementSpan,\n );\n return {\n start: offset,\n end: offset,\n value: ` ${options.name}={${options.value}}`,\n };\n}\n\nfunction insertLayoutProperty(\n source: string,\n spans: NonNullable<ParsedCanvasStoryboard[\"layoutSpans\"]>,\n propertySource: string,\n): CanvasSourceEdit {\n if (typeof spans.layoutClose !== \"number\") {\n throw new Error(\"Layout object close span not found\");\n }\n return insertObjectProperty(source, spans.layoutClose, propertySource);\n}\n\nfunction insertObjectProperty(\n source: string,\n objectClose: number,\n propertySource: string,\n): CanvasSourceEdit {\n const offset = trimWhitespaceBeforeOffset(source, objectClose);\n const previous = previousMeaningfulCharacter(source, offset);\n return {\n start: offset,\n end: offset,\n value: `${previous === \"{\" || previous === \",\" ? \" \" : \", \"}${propertySource}`,\n };\n}\n\nfunction formatStoryboardElement(options: {\n source: string;\n insertionOffset: number;\n tag: string;\n storyboard: AddCanvasStoryboardInput;\n componentExpression?: string;\n}): string {\n const newline = detectNewline(options.source);\n const closingIndent = lineIndentAt(options.source, options.insertionOffset);\n const indent = `${closingIndent} `;\n const firstLineIndent = \" \";\n const propIndent = `${indent} `;\n const props = storyboardElementProps(\n options.storyboard,\n options.componentExpression,\n );\n\n return `${firstLineIndent}<${options.tag}${newline}${props\n .map((prop) => `${propIndent}${prop}`)\n .join(newline)}${newline}${indent}/>${newline}${closingIndent}`;\n}\n\nfunction buildCanvasChildInsertionEdit(options: {\n source: string;\n parsed: ParsedCanvasFile;\n tag: string;\n storyboard: AddCanvasStoryboardInput;\n componentExpression?: string;\n}): CanvasSourceEdit {\n const insertionOffset = options.parsed.canvasChildrenInsertionOffset;\n if (typeof insertionOffset === \"number\") {\n return {\n start: insertionOffset,\n end: insertionOffset,\n value: formatStoryboardElement({\n source: options.source,\n insertionOffset,\n tag: options.tag,\n storyboard: options.storyboard,\n componentExpression: options.componentExpression,\n }),\n };\n }\n\n const openingSpan = options.parsed.canvasOpeningElementSpan;\n if (!openingSpan) {\n throw new Error(\"Canvas closing element not found\");\n }\n\n const openingSource = options.source.slice(\n openingSpan.start,\n openingSpan.end,\n );\n const selfClosingMatch = openingSource.match(/\\s*\\/\\s*>$/);\n const canvasName = openingSource.match(\n /^<\\s*([A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*)/,\n )?.[1];\n if (!selfClosingMatch || !canvasName) {\n throw new Error(\"Canvas closing element not found\");\n }\n\n const newline = detectNewline(options.source);\n const replacementStart = openingSpan.end - selfClosingMatch[0].length;\n const closingIndent = lineIndentAt(options.source, openingSpan.start);\n const childIndent = `${closingIndent} `;\n const propIndent = `${childIndent} `;\n const props = storyboardElementProps(\n options.storyboard,\n options.componentExpression,\n );\n\n return {\n start: replacementStart,\n end: openingSpan.end,\n value: `>${newline}${childIndent}<${options.tag}${newline}${props\n .map((prop) => `${propIndent}${prop}`)\n .join(\n newline,\n )}${newline}${childIndent}/>${newline}${closingIndent}</${canvasName}>`,\n };\n}\n\nfunction storyboardElementProps(\n storyboard: AddCanvasStoryboardInput,\n componentExpression?: string,\n): string[] {\n const idProp = formatJsxStringAttribute(\n \"id\",\n requireNonEmpty(storyboard.id, \"Storyboard id\"),\n );\n\n // LegacyStoryboardV1 carries only `id` + `storyboard={Expr}`; name and\n // layout live on the referenced object, so they are never emitted here.\n if (storyboard.kind === \"legacy-v1\") {\n return [idProp, `storyboard={${storyboard.storyboardExpression}}`];\n }\n\n return [\n idProp,\n ...(storyboard.name && storyboard.name.trim() !== \"\"\n ? [formatJsxStringAttribute(\"name\", storyboard.name)]\n : []),\n ...storyboardKindProps(storyboard, componentExpression),\n `layout={{ ${formatLayout(storyboard.layout)} }}`,\n ];\n}\n\n/**\n * Format a JSX string attribute. Prefers the idiomatic plain form\n * (`name=\"value\"`) and falls back to the expression form (`name={\"value\"}`)\n * when the plain form can't represent the value faithfully: JSX string\n * attributes don't process backslash escapes but DO decode HTML entities, so\n * any value that JSON-escapes (quotes, backslashes, control characters) or\n * contains `&` must go through a braced string literal.\n */\nexport function formatJsxStringAttribute(name: string, value: string): string {\n const encoded = JSON.stringify(value);\n const plainSafe = encoded === `\"${value}\"` && !value.includes(\"&\");\n return plainSafe ? `${name}=${encoded}` : `${name}={${encoded}}`;\n}\n\nfunction storyboardKindProps(\n // legacy-v1 never reaches here: `storyboardElementProps` emits its\n // `storyboard={…}` prop directly (it has no name/layout attributes).\n storyboard: Exclude<AddCanvasStoryboardInput, { kind: \"legacy-v1\" }>,\n componentExpression?: string,\n): string[] {\n if (storyboard.kind === \"component\") {\n return [\n `component={${componentExpression}}`,\n ...(storyboard.props && storyboard.props.trim() !== \"\"\n ? [`props={${storyboard.props.trim()}}`]\n : []),\n ];\n }\n if (storyboard.kind === \"route\") {\n return [formatJsxStringAttribute(\"route\", storyboard.route)];\n }\n return [\n ...(storyboard.filepath\n ? [formatJsxStringAttribute(\"filepath\", storyboard.filepath)]\n : []),\n ...(storyboard.src\n ? [formatJsxStringAttribute(\"src\", storyboard.src)]\n : []),\n ];\n}\n\nfunction formatLayout(layout: CanvasEditorLayout): string {\n return [\n `x: ${roundLayoutNumber(layout.x)}`,\n `y: ${roundLayoutNumber(layout.y)}`,\n `width: ${roundLayoutNumber(layout.width)}`,\n `height: ${roundLayoutNumber(layout.height)}`,\n ...(layout.zIndex === undefined\n ? []\n : [`zIndex: ${roundLayoutNumber(layout.zIndex)}`]),\n ...(layout.intrinsicSizing\n ? [`intrinsicSizing: ${JSON.stringify(layout.intrinsicSizing)}`]\n : []),\n ].join(\", \");\n}\n\nfunction sdkComponentForStoryboard(\n kind: AddCanvasStoryboardInput[\"kind\"],\n): SdkComponent {\n if (kind === \"route\") return \"RouteStoryboard\";\n if (kind === \"html\") return \"HtmlStoryboard\";\n if (kind === \"legacy-v1\") return \"LegacyStoryboardV1\";\n return \"Storyboard\";\n}\n\nfunction resolveSdkTag(\n parsed: ParsedCanvasFile,\n component: SdkComponent,\n): { tag: string; importLine?: string } {\n for (const item of parsed.imports) {\n if (item.source !== \"tempo-sdk/canvas\") continue;\n if (item.kind === \"namespace\")\n return { tag: `${item.localName}.${component}` };\n if (item.importedName === component) return { tag: item.localName };\n }\n\n const localName = pickAvailableIdentifier(parsed, `TempoCanvas${component}`);\n return {\n tag: localName,\n importLine: `import { ${component} as ${localName} } from \"tempo-sdk/canvas\";`,\n };\n}\n\nfunction buildMissingComponentImportLine(\n parsed: ParsedCanvasFile,\n source: string,\n componentImport: {\n localName: string;\n source: string;\n importedName?: string;\n },\n): string | null {\n const existing = parsed.imports.find(\n (item) => item.localName === componentImport.localName,\n );\n if (existing) {\n if (existing.source !== componentImport.source) {\n throw new Error(\n `Import binding \"${componentImport.localName}\" already exists`,\n );\n }\n return null;\n }\n // Collision check that THROWS — must not fire on the name merely appearing\n // inside a string literal (e.g. `<Canvas name=\"Card Demo\">` blocking a `Card`\n // import), so use the AST-based node scan, never the textual `hasIdentifier`.\n if (\n sourceContainsIdentifierNode(\n parsed.filePath,\n source,\n componentImport.localName,\n )\n ) {\n throw new Error(`Identifier \"${componentImport.localName}\" already exists`);\n }\n\n if (\n !componentImport.importedName ||\n componentImport.importedName === \"default\"\n ) {\n return `import ${componentImport.localName} from ${JSON.stringify(\n componentImport.source,\n )};`;\n }\n\n const specifier =\n componentImport.importedName === componentImport.localName\n ? componentImport.localName\n : `${componentImport.importedName} as ${componentImport.localName}`;\n return `import { ${specifier} } from ${JSON.stringify(componentImport.source)};`;\n}\n\nfunction buildImportInsertionEdit(\n source: string,\n parsed: ParsedCanvasFile,\n importLines: readonly string[],\n): CanvasSourceEdit | null {\n if (importLines.length === 0) return null;\n const newline = detectNewline(source);\n const uniqueLines = Array.from(new Set(importLines));\n const lastImport = parsed.imports.reduce<ParsedCanvasImport | null>(\n (latest, item) =>\n !latest || item.declarationSpan.end > latest.declarationSpan.end\n ? item\n : latest,\n null,\n );\n\n if (lastImport) {\n return {\n start: lastImport.declarationSpan.end,\n end: lastImport.declarationSpan.end,\n value: `${newline}${uniqueLines.join(newline)}`,\n };\n }\n\n const offset = topLevelInsertionOffset(source);\n return {\n start: offset,\n end: offset,\n value: `${uniqueLines.join(newline)}${newline}`,\n };\n}\n\nfunction buildUnusedComponentImportRemoval(options: {\n source: string;\n parsed: ParsedCanvasFile;\n deletedStoryboard: ParsedCanvasStoryboard;\n deletionEdit: CanvasSourceEdit;\n}): CanvasSourceEdit | null {\n const componentImport = options.deletedStoryboard.component?.import;\n if (!componentImport || componentImport.importKind === \"type\") return null;\n\n const usedByRemainingStoryboard = options.parsed.storyboards.some(\n (storyboard) =>\n storyboard.storyboardKey !== options.deletedStoryboard.storyboardKey &&\n storyboard.component?.import?.localName === componentImport.localName,\n );\n if (usedByRemainingStoryboard) return null;\n\n const sourceAfterStoryboardDelete = applyCanvasSourceEdits(options.source, [\n options.deletionEdit,\n ]);\n\n if (componentImport.specifierCount === 1) {\n const sourceWithoutImport = removeSpanText(\n sourceAfterStoryboardDelete,\n componentImport.declarationSpan,\n );\n if (hasIdentifier(sourceWithoutImport, componentImport.localName))\n return null;\n\n return {\n ...expandToFullLines(options.source, componentImport.declarationSpan),\n value: \"\",\n };\n }\n\n if (\n componentImport.kind !== \"named\" ||\n componentImport.hasDefaultSpecifier ||\n componentImport.hasNamespaceSpecifier ||\n componentImport.namedSpecifierCount <= 1\n ) {\n return null;\n }\n\n const specifierRange = expandImportSpecifierRemovalRange(\n options.source,\n componentImport.span,\n );\n const sourceWithoutImport = removeSpanText(\n sourceAfterStoryboardDelete,\n specifierRange,\n );\n if (hasIdentifier(sourceWithoutImport, componentImport.localName))\n return null;\n\n return {\n ...specifierRange,\n value: \"\",\n };\n}\n\nfunction expandImportSpecifierRemovalRange(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n const lineStart = Math.max(source.lastIndexOf(\"\\n\", span.start - 1) + 1, 0);\n const nextNewline = source.indexOf(\"\\n\", span.end);\n const lineEnd = nextNewline >= 0 ? nextNewline + 1 : source.length;\n const before = source.slice(lineStart, span.start);\n const after = source.slice(span.end, lineEnd);\n if (/^[ \\t]*$/.test(before) && /^[ \\t]*(,)?[ \\t]*(\\r?\\n)?$/.test(after)) {\n return { start: lineStart, end: lineEnd };\n }\n\n let start = span.start;\n let end = span.end;\n while (end < source.length && /\\s/.test(source[end] ?? \"\")) end++;\n if (source[end] === \",\") {\n end++;\n while (\n end < source.length &&\n (source[end] === \" \" || source[end] === \"\\t\")\n ) {\n end++;\n }\n return { start, end };\n }\n\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n if (source[start - 1] === \",\") {\n start--;\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n }\n return { start, end };\n}\n\nfunction removeSpanText(source: string, span: CanvasSourceSpan): string {\n return source.slice(0, span.start) + source.slice(span.end);\n}\n\nfunction findOpeningElementAttributeInsertionOffset(\n source: string,\n span: CanvasSourceSpan,\n): number {\n const close = source.lastIndexOf(\">\", span.end - 1);\n if (close < span.start) {\n throw new Error(\"JSX opening element close not found\");\n }\n return source[close - 1] === \"/\" ? close - 1 : close;\n}\n\nfunction expandJsxAttributeRemoval(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n return { start, end };\n}\n\nfunction expandObjectPropertyRemoval(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n\n while (start > 0 && /\\s/.test(source[start - 1] ?? \"\")) start--;\n while (end < source.length && /\\s/.test(source[end] ?? \"\")) end++;\n\n if (source[end] === \",\") {\n end++;\n while (\n end < source.length &&\n (source[end] === \" \" || source[end] === \"\\t\")\n ) {\n end++;\n }\n return { start, end };\n }\n\n let comma = start - 1;\n while (comma >= 0 && /\\s/.test(source[comma] ?? \"\")) comma--;\n if (source[comma] === \",\") {\n start = comma;\n }\n return { start, end };\n}\n\nexport function expandToFullLines(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n while (\n start > 0 &&\n source[start - 1] !== \"\\n\" &&\n source[start - 1] !== \"\\r\"\n ) {\n start--;\n }\n if (start > 0) {\n if (source[start - 1] === \"\\n\") start--;\n if (start > 0 && source[start - 1] === \"\\r\") start--;\n }\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n if (source.slice(end, end + 2) === \"\\r\\n\") {\n end += 2;\n } else if (source[end] === \"\\n\" || source[end] === \"\\r\") {\n end++;\n }\n return { start, end };\n}\n\nexport function expandStatementForward(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let end = span.end;\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n if (source.slice(end, end + 2) === \"\\r\\n\") {\n end += 2;\n } else if (source[end] === \"\\n\" || source[end] === \"\\r\") {\n end++;\n }\n return { start: span.start, end };\n}\n\nfunction lineIndentAt(source: string, offset: number): string {\n const lineStart = Math.max(source.lastIndexOf(\"\\n\", offset - 1) + 1, 0);\n const linePrefix = source.slice(lineStart, offset);\n const match = linePrefix.match(/^[ \\t]*/);\n return match?.[0] ?? \"\";\n}\n\nfunction previousMeaningfulCharacter(source: string, offset: number): string {\n for (let index = offset - 1; index >= 0; index -= 1) {\n const character = source[index] ?? \"\";\n if (!/\\s/.test(character)) return character;\n }\n return \"\";\n}\n\nfunction trimWhitespaceBeforeOffset(source: string, offset: number): number {\n let nextOffset = offset;\n while (nextOffset > 0 && /\\s/.test(source[nextOffset - 1] ?? \"\")) {\n nextOffset--;\n }\n return nextOffset;\n}\n\nexport function collapseBlankLines(source: string, newline: string): string {\n return newline === \"\\r\\n\"\n ? source.replace(/(\\r\\n){3,}/g, \"\\r\\n\\r\\n\")\n : source.replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nexport function detectNewline(source: string): \"\\n\" | \"\\r\\n\" {\n return source.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n}\n\nexport function topLevelInsertionOffset(source: string): number {\n let offset = 0;\n if (source.startsWith(\"#!\")) {\n const newline = source.indexOf(\"\\n\");\n offset = newline >= 0 ? newline + 1 : source.length;\n }\n\n while (true) {\n const nextLineEnd = source.indexOf(\"\\n\", offset);\n const end = nextLineEnd >= 0 ? nextLineEnd + 1 : source.length;\n const line = source.slice(offset, end).trim();\n if (!/^[\"']use [^\"']+[\"'];?$/.test(line)) break;\n offset = end;\n }\n\n return offset;\n}\n\nfunction pickAvailableIdentifier(\n parsed: ParsedCanvasFile,\n base: string,\n): string {\n const usedImports = new Set(parsed.imports.map((item) => item.localName));\n if (!usedImports.has(base)) return base;\n for (let index = 2; index < 10_000; index += 1) {\n const candidate = `${base}${index}`;\n if (!usedImports.has(candidate)) return candidate;\n }\n throw new Error(`Unable to find available identifier for ${base}`);\n}\n\n/**\n * Cheap word-boundary text scan. It matches occurrences inside string literals\n * and comments too, so it is SAFE-DIRECTION ONLY: use it where a false positive\n * is harmless (conservatively keeping an import that might still be used), NEVER\n * for a collision check that throws or blocks an edit — those must use\n * {@link sourceContainsIdentifierNode}, which counts real identifier nodes only.\n */\nexport function hasIdentifier(source: string, identifier: string): boolean {\n return new RegExp(`\\\\b${escapeRegExp(identifier)}\\\\b`).test(source);\n}\n\n/**\n * True when `name` appears as a real identifier node (`Identifier` /\n * `JSXIdentifier`) anywhere in `source` — a binding or reference, never a\n * string-literal or comment occurrence. Use this for collision checks that\n * throw or block an edit, so a name appearing only inside a string (e.g.\n * `<Canvas name=\"Card Demo\">` vs a `Card` import) can't masquerade as a\n * declared identifier.\n */\nexport function sourceContainsIdentifierNode(\n filePath: string,\n source: string,\n name: string,\n): boolean {\n const program = (parseSync(filePath, source) as any).program;\n let found = false;\n walkWithParent(program, (node) => {\n if (found) return;\n if (\n (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") &&\n node.name === name\n ) {\n found = true;\n }\n });\n return found;\n}\n\n/**\n * Depth-first walk that hands each AST node to `visit` along with its parent and\n * the parent field it was reached through — the context callers need to tell a\n * value reference from a property key or member access.\n */\nexport function walkWithParent(\n node: any,\n visit: (node: any, parent: any, key: string | null) => void,\n parent: any = null,\n key: string | null = null,\n seen = new Set<any>(),\n): void {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n if (typeof node.type === \"string\") visit(node, parent, key);\n for (const [childKey, value] of Object.entries(node)) {\n if (!value || typeof value !== \"object\") continue;\n if (Array.isArray(value)) {\n for (const item of value)\n walkWithParent(item, visit, node, childKey, seen);\n } else {\n walkWithParent(value, visit, node, childKey, seen);\n }\n }\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction roundLayoutNumber(value: number): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(\"Layout values must be finite numbers\");\n }\n return Math.round(value);\n}\n\nfunction requireNonEmpty(value: string, label: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n throw new Error(`${label} must be non-empty`);\n }\n return trimmed;\n}\n\nfunction requiredSpan<T>(value: T | undefined, message: string): T {\n if (value === undefined) {\n throw new Error(message);\n }\n return value;\n}\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AA+EnB,SAAS,uBACd,QACA,OACQ;AACR,QAAM,SAAS,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,UAAU,MAAM,QAAQ,KAAK,KAAK;AACxE,MAAI,gBAAgB,OAAO,SAAS;AACpC,MAAI,aAAa;AAEjB,aAAW,QAAQ,QAAQ;AACzB,QACE,KAAK,QAAQ,KACb,KAAK,MAAM,KAAK,SAChB,KA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sC;AAAA,EACxD;AACA,SAAO,KAAK,MAAM,KAAK;AACzB;AAEA,SAAS,gBAAgB,OAAe,OAAuB;AAC7D,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,GAAG,KAAK,oBAAoB;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,SAAS,aAAgB,OAAsB,SAAoB;AACjE,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,OAAO;AAAA,EACzB;AACA,SAAO;AACT;","names":["edit","sourceWithoutImport"]}
|
|
1
|
+
{"version":3,"sources":["../../canvas/editor.ts"],"sourcesContent":["import { parseSync } from \"oxc-parser\";\n\nimport {\n parseCanvasFile,\n type CanvasSourceSpan,\n type ParsedCanvasFile,\n type ParsedCanvasImport,\n type ParsedCanvasStoryboard,\n} from \"./parser\";\n\nexport type CanvasSourceEdit = {\n start: number;\n end: number;\n value: string;\n};\n\nexport type CanvasEditResult = {\n source: string;\n edits: CanvasSourceEdit[];\n parsed: ParsedCanvasFile;\n};\n\nexport type CanvasEditorLayout = {\n x: number;\n y: number;\n width: number;\n height: number;\n zIndex?: number;\n intrinsicSizing?: \"root-element\";\n};\n\nexport type AddCanvasStoryboardInput =\n | {\n kind: \"component\";\n id: string;\n layout: CanvasEditorLayout;\n name?: string;\n componentExpression?: string;\n // Pre-formatted object-literal expression (e.g. `{ a: \"s\", b: expr }`)\n // emitted as `props={<value>}` after `component=`. Used by migration to\n // render `render: () => <C a={b} />` as `component={C} props={{ a: b }}`.\n props?: string;\n componentImport?: {\n localName: string;\n source: string;\n importedName?: string;\n };\n }\n | {\n kind: \"svelte-component\";\n id: string;\n layout: CanvasEditorLayout;\n name?: string;\n componentExpression?: string;\n props?: string;\n componentImport?: {\n localName: string;\n source: string;\n importedName?: string;\n };\n }\n | {\n // Per-storyboard fallback for legacy object shapes migration cannot\n // convert natively: emits `<LegacyStoryboardV1 id storyboard={Expr} />`.\n // The wrapper reads name/layout off the referenced object, so no\n // name/layout attributes are emitted here.\n kind: \"legacy-v1\";\n id: string;\n storyboardExpression: string;\n }\n | {\n kind: \"route\";\n id: string;\n route: string;\n layout: CanvasEditorLayout;\n name?: string;\n }\n | {\n kind: \"html\";\n id: string;\n layout: CanvasEditorLayout;\n name?: string;\n filepath?: string;\n src?: string;\n };\n\ntype SdkComponent =\n | \"Storyboard\"\n | \"SvelteStoryboard\"\n | \"LegacyStoryboardV1\"\n | \"RouteStoryboard\"\n | \"HtmlStoryboard\";\n\nexport function applyCanvasSourceEdits(\n source: string,\n edits: readonly CanvasSourceEdit[],\n): string {\n const sorted = [...edits].sort((left, right) => right.start - left.start);\n let previousStart = source.length + 1;\n let nextSource = source;\n\n for (const edit of sorted) {\n if (\n edit.start < 0 ||\n edit.end < edit.start ||\n edit.end > source.length ||\n edit.end > previousStart\n ) {\n throw new Error(\n `Invalid overlapping canvas source edit ${edit.start}:${edit.end}`,\n );\n }\n nextSource =\n nextSource.slice(0, edit.start) + edit.value + nextSource.slice(edit.end);\n previousStart = edit.start;\n }\n\n return nextSource;\n}\n\nexport function updateCanvasName(options: {\n filePath: string;\n source: string;\n name: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"name\",\n requireNonEmpty(options.name, \"Canvas name\"),\n (parsed) => ({\n valueSpan: parsed.nameSpan,\n attributeSpan: parsed.nameAttributeSpan,\n }),\n );\n}\n\nexport function updateCanvasPath(options: {\n filePath: string;\n source: string;\n path: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"path\",\n requireNonEmpty(options.path, \"Canvas path\"),\n (parsed) => ({\n valueSpan: parsed.pathSpan,\n attributeSpan: parsed.pathAttributeSpan,\n }),\n );\n}\n\nexport function updateCanvasBackgroundColor(options: {\n filePath: string;\n source: string;\n backgroundColor?: string;\n}): CanvasEditResult {\n return editCanvasStringAttribute(\n options,\n \"backgroundColor\",\n options.backgroundColor && options.backgroundColor.trim() !== \"\"\n ? options.backgroundColor\n : undefined,\n (parsed) => ({\n valueSpan: parsed.backgroundColorSpan,\n attributeSpan: parsed.backgroundColorAttributeSpan,\n }),\n );\n}\n\nfunction editCanvasStringAttribute(\n options: { filePath: string; source: string },\n attributeName: string,\n value: string | undefined,\n selectSpans: (parsed: ParsedCanvasFile) => {\n valueSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n },\n): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const spans = selectSpans(parsed);\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requiredSpan(\n parsed.canvasOpeningElementSpan,\n \"Canvas opening element not found\",\n ),\n valueSpan: spans.valueSpan,\n attributeSpan: spans.attributeSpan,\n name: attributeName,\n value,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\nexport function updateStoryboardName(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n name?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.legacyV1) {\n const edit = upsertObjectStringProperty({\n source: options.source,\n objectClose: storyboard.legacyV1.objectClose,\n valueSpan: storyboard.nameSpan,\n propertySpan: storyboard.legacyV1.namePropertySpan,\n name: \"name\",\n value:\n options.name && options.name.trim() !== \"\" ? options.name : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n }\n\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.nameSpan,\n attributeSpan: storyboard.nameAttributeSpan,\n name: \"name\",\n value:\n options.name && options.name.trim() !== \"\" ? options.name : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\nexport function updateStoryboardId(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n nextId: string;\n}): CanvasEditResult {\n const nextId = requireNonEmpty(options.nextId, \"Storyboard id\");\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const duplicate = parsed.storyboards.find(\n (item) =>\n item.storyboardKey === nextId &&\n item.storyboardKey !== storyboard.storyboardKey,\n );\n if (duplicate) {\n throw new Error(`Storyboard id \"${nextId}\" already exists`);\n }\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.idSpan,\n attributeSpan: storyboard.idAttributeSpan,\n name: \"id\",\n value: nextId,\n });\n return applyResult(options.source, parsed, [edit]);\n}\n\nexport function updateStoryboardLayout(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n layout: Partial<CanvasEditorLayout>;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const spans = storyboard.layoutSpans;\n if (!spans) {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" has no editable layout`,\n );\n }\n\n const edits: CanvasSourceEdit[] = [];\n for (const key of [\"x\", \"y\", \"width\", \"height\"] as const) {\n if (options.layout[key] === undefined) continue;\n const span = spans[key];\n if (!span) {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" layout.${key} is not editable`,\n );\n }\n edits.push({\n start: span.start,\n end: span.end,\n value: String(roundLayoutNumber(options.layout[key])),\n });\n }\n\n if (options.layout.zIndex !== undefined) {\n const value = String(roundLayoutNumber(options.layout.zIndex));\n edits.push(\n spans.zIndex\n ? { start: spans.zIndex.start, end: spans.zIndex.end, value }\n : insertLayoutProperty(options.source, spans, `zIndex: ${value}`),\n );\n }\n\n if (options.layout.intrinsicSizing !== undefined) {\n const value = JSON.stringify(options.layout.intrinsicSizing);\n edits.push(\n spans.intrinsicSizing\n ? {\n start: spans.intrinsicSizing.start,\n end: spans.intrinsicSizing.end,\n value,\n }\n : insertLayoutProperty(\n options.source,\n spans,\n `intrinsicSizing: ${value}`,\n ),\n );\n }\n\n return applyResult(options.source, parsed, edits);\n}\n\nexport function updateStoryboardComponent(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n componentExpression: string;\n componentImport?: {\n localName: string;\n source: string;\n importedName?: string;\n };\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"component\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not a component storyboard`,\n );\n }\n\n const imports: string[] = [];\n if (options.componentImport) {\n const importLine = buildMissingComponentImportLine(\n parsed,\n options.source,\n options.componentImport,\n );\n if (importLine) imports.push(importLine);\n }\n\n const importEdit = buildImportInsertionEdit(options.source, parsed, imports);\n const componentEdit = upsertJsxExpressionAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n expressionSpan: storyboard.component?.span,\n attributeSpan: storyboard.component?.attributeSpan,\n name: \"component\",\n value: requireNonEmpty(\n options.componentExpression,\n \"Storyboard component expression\",\n ),\n });\n\n return applyResult(options.source, parsed, [\n ...(importEdit ? [importEdit] : []),\n componentEdit,\n ]);\n}\n\nexport function updateStoryboardProps(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n propsExpression?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const edit = upsertJsxExpressionAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n expressionSpan: storyboard.props?.span,\n attributeSpan: storyboard.props?.attributeSpan,\n name: \"props\",\n value:\n options.propsExpression && options.propsExpression.trim() !== \"\"\n ? options.propsExpression.trim()\n : undefined,\n });\n return applyResult(options.source, parsed, edit ? [edit] : []);\n}\n\n/**\n * Sets or clears the opt-in visual-regression tracking mark (TEM-1775) on a\n * component storyboard. `tracked: true` writes the bare `vrt` attribute\n * (tracked with defaults), replacing an existing untracked declaration\n * (`vrt={false}`, dynamic forms) in place; an already-tracked declaration —\n * including the object form with threshold/ignore overrides — is left\n * untouched. `tracked: false` removes the whole `vrt` attribute, object\n * config included: the in-app toggle is a full untrack, not the\n * `skip: true` pause.\n */\nexport function updateStoryboardVrt(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n tracked: boolean;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"component\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not a component storyboard`,\n );\n }\n\n if (!options.tracked) {\n if (!storyboard.vrtAttributeSpan) {\n return applyResult(options.source, parsed, []);\n }\n return applyResult(options.source, parsed, [\n {\n ...expandJsxAttributeRemoval(\n options.source,\n storyboard.vrtAttributeSpan,\n ),\n value: \"\",\n },\n ]);\n }\n\n if (storyboard.vrt) {\n return applyResult(options.source, parsed, []);\n }\n if (storyboard.vrtAttributeSpan) {\n return applyResult(options.source, parsed, [\n {\n start: storyboard.vrtAttributeSpan.start,\n end: storyboard.vrtAttributeSpan.end,\n value: \"vrt\",\n },\n ]);\n }\n const offset = findOpeningElementAttributeInsertionOffset(\n options.source,\n requireStoryboardOpeningSpan(storyboard, options.storyboardId),\n );\n return applyResult(options.source, parsed, [\n { start: offset, end: offset, value: \" vrt\" },\n ]);\n}\n\nexport function updateRouteStoryboardRoute(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n route: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"route\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not a route storyboard`,\n );\n }\n const edit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan: requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n ),\n valueSpan: storyboard.routeSpan,\n attributeSpan: storyboard.routeAttributeSpan,\n name: \"route\",\n value: requireNonEmpty(options.route, \"Route storyboard route\"),\n });\n return applyResult(options.source, parsed, [edit]);\n}\n\nexport function updateHtmlStoryboardSource(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n filepath?: string;\n src?: string;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n if (storyboard.kind !== \"html\") {\n throw new Error(\n `Storyboard \"${options.storyboardId}\" is not an html storyboard`,\n );\n }\n const filepath =\n options.filepath && options.filepath.trim() !== \"\"\n ? options.filepath.trim()\n : undefined;\n const src =\n options.src && options.src.trim() !== \"\" ? options.src : undefined;\n if (!filepath && !src) {\n throw new Error(\"HTML storyboard source requires filepath or src\");\n }\n\n const openingElementSpan = requireStoryboardOpeningSpan(\n storyboard,\n options.storyboardId,\n );\n const filepathEdit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan,\n valueSpan: storyboard.filepathSpan,\n attributeSpan: storyboard.filepathAttributeSpan,\n name: \"filepath\",\n value: filepath,\n });\n const srcEdit = upsertJsxStringAttribute({\n source: options.source,\n openingElementSpan,\n valueSpan: storyboard.srcSpan,\n attributeSpan: storyboard.srcAttributeSpan,\n name: \"src\",\n value: src,\n });\n\n return applyResult(options.source, parsed, [filepathEdit, srcEdit]);\n}\n\nexport function addCanvasStoryboard(options: {\n filePath: string;\n source: string;\n storyboard: AddCanvasStoryboardInput;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n if (\n parsed.storyboards.some(\n (item) => item.storyboardKey === options.storyboard.id,\n )\n ) {\n throw new Error(`Storyboard id \"${options.storyboard.id}\" already exists`);\n }\n\n const imports: string[] = [];\n const sdkComponent = sdkComponentForStoryboard(options.storyboard.kind);\n const sdkTag = resolveSdkTag(parsed, sdkComponent);\n let storyboardTag = sdkTag.tag;\n if (sdkTag.importLine) {\n imports.push(sdkTag.importLine);\n storyboardTag = sdkTag.tag;\n }\n\n let componentExpression: string | undefined;\n if (\n options.storyboard.kind === \"component\" ||\n options.storyboard.kind === \"svelte-component\"\n ) {\n componentExpression =\n options.storyboard.componentExpression ??\n options.storyboard.componentImport?.localName;\n if (!componentExpression) {\n throw new Error(\n \"Component storyboard requires componentExpression or componentImport\",\n );\n }\n if (options.storyboard.componentImport) {\n const importLine = buildMissingComponentImportLine(\n parsed,\n options.source,\n options.storyboard.componentImport,\n );\n if (importLine) imports.push(importLine);\n }\n }\n\n const importEdit = buildImportInsertionEdit(options.source, parsed, imports);\n const insertionEdit = buildCanvasChildInsertionEdit({\n source: options.source,\n parsed,\n tag: storyboardTag,\n storyboard: options.storyboard,\n componentExpression,\n });\n\n const edits = [...(importEdit ? [importEdit] : []), insertionEdit];\n return applyResult(options.source, parsed, edits);\n}\n\nexport function removeCanvasStoryboard(options: {\n filePath: string;\n source: string;\n storyboardId: string;\n removeUnusedComponentImport?: boolean;\n}): CanvasEditResult {\n const parsed = parseCanvasFile(options.filePath, options.source);\n const storyboard = findStoryboard(parsed, options.storyboardId);\n const edits: CanvasSourceEdit[] = [\n {\n ...expandToFullLines(options.source, storyboard.jsxElementSpan),\n value: \"\",\n },\n ];\n\n if (options.removeUnusedComponentImport ?? true) {\n const importEdit = buildUnusedComponentImportRemoval({\n source: options.source,\n parsed,\n deletedStoryboard: storyboard,\n deletionEdit: edits[0],\n });\n if (importEdit) edits.push(importEdit);\n }\n\n const result = applyResult(options.source, parsed, edits);\n return {\n ...result,\n source: collapseBlankLines(result.source, detectNewline(options.source)),\n };\n}\n\nfunction applyResult(\n source: string,\n parsed: ParsedCanvasFile,\n edits: readonly (CanvasSourceEdit | null | undefined)[],\n): CanvasEditResult {\n const compactEdits = edits.filter((edit): edit is CanvasSourceEdit => {\n if (!edit) return false;\n return source.slice(edit.start, edit.end) !== edit.value;\n });\n return {\n source: applyCanvasSourceEdits(source, compactEdits),\n edits: compactEdits,\n parsed,\n };\n}\n\nfunction findStoryboard(\n parsed: ParsedCanvasFile,\n storyboardId: string,\n): ParsedCanvasStoryboard {\n const storyboard = parsed.storyboards.find(\n (item) => item.storyboardKey === storyboardId,\n );\n if (!storyboard) {\n throw new Error(`Storyboard \"${storyboardId}\" not found`);\n }\n return storyboard;\n}\n\nfunction requireStoryboardOpeningSpan(\n storyboard: ParsedCanvasStoryboard,\n storyboardId: string,\n): CanvasSourceSpan {\n return requiredSpan(\n storyboard.openingElementSpan,\n `Storyboard \"${storyboardId}\" opening element not found`,\n );\n}\n\nfunction upsertJsxStringAttribute(options: {\n source: string;\n openingElementSpan: CanvasSourceSpan;\n valueSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.attributeSpan) return null;\n return {\n ...expandJsxAttributeRemoval(options.source, options.attributeSpan),\n value: \"\",\n };\n }\n\n const value = JSON.stringify(options.value);\n if (options.valueSpan) {\n return {\n start: options.valueSpan.start,\n end: options.valueSpan.end,\n value,\n };\n }\n\n const offset = findOpeningElementAttributeInsertionOffset(\n options.source,\n options.openingElementSpan,\n );\n return {\n start: offset,\n end: offset,\n value: ` ${options.name}={${value}}`,\n };\n}\n\nfunction upsertObjectStringProperty(options: {\n source: string;\n objectClose?: number;\n valueSpan?: CanvasSourceSpan;\n propertySpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.propertySpan) return null;\n return {\n ...expandObjectPropertyRemoval(options.source, options.propertySpan),\n value: \"\",\n };\n }\n\n const value = JSON.stringify(options.value);\n if (options.valueSpan) {\n return {\n start: options.valueSpan.start,\n end: options.valueSpan.end,\n value,\n };\n }\n\n if (typeof options.objectClose !== \"number\") {\n throw new Error(`Object close not found for \"${options.name}\" property`);\n }\n\n return insertObjectProperty(\n options.source,\n options.objectClose,\n `${options.name}: ${value}`,\n );\n}\n\nfunction upsertJsxExpressionAttribute(options: {\n source: string;\n openingElementSpan: CanvasSourceSpan;\n expressionSpan?: CanvasSourceSpan;\n attributeSpan?: CanvasSourceSpan;\n name: string;\n value?: string;\n}): CanvasSourceEdit | null {\n if (options.value === undefined) {\n if (!options.attributeSpan) return null;\n return {\n ...expandJsxAttributeRemoval(options.source, options.attributeSpan),\n value: \"\",\n };\n }\n\n if (options.expressionSpan) {\n return {\n start: options.expressionSpan.start,\n end: options.expressionSpan.end,\n value: options.value,\n };\n }\n\n const offset = findOpeningElementAttributeInsertionOffset(\n options.source,\n options.openingElementSpan,\n );\n return {\n start: offset,\n end: offset,\n value: ` ${options.name}={${options.value}}`,\n };\n}\n\nfunction insertLayoutProperty(\n source: string,\n spans: NonNullable<ParsedCanvasStoryboard[\"layoutSpans\"]>,\n propertySource: string,\n): CanvasSourceEdit {\n if (typeof spans.layoutClose !== \"number\") {\n throw new Error(\"Layout object close span not found\");\n }\n return insertObjectProperty(source, spans.layoutClose, propertySource);\n}\n\nfunction insertObjectProperty(\n source: string,\n objectClose: number,\n propertySource: string,\n): CanvasSourceEdit {\n const offset = trimWhitespaceBeforeOffset(source, objectClose);\n const previous = previousMeaningfulCharacter(source, offset);\n return {\n start: offset,\n end: offset,\n value: `${previous === \"{\" || previous === \",\" ? \" \" : \", \"}${propertySource}`,\n };\n}\n\nfunction formatStoryboardElement(options: {\n source: string;\n insertionOffset: number;\n tag: string;\n storyboard: AddCanvasStoryboardInput;\n componentExpression?: string;\n}): string {\n const newline = detectNewline(options.source);\n const closingIndent = lineIndentAt(options.source, options.insertionOffset);\n const indent = `${closingIndent} `;\n const firstLineIndent = \" \";\n const propIndent = `${indent} `;\n const props = storyboardElementProps(\n options.storyboard,\n options.componentExpression,\n );\n\n return `${firstLineIndent}<${options.tag}${newline}${props\n .map((prop) => `${propIndent}${prop}`)\n .join(newline)}${newline}${indent}/>${newline}${closingIndent}`;\n}\n\nfunction buildCanvasChildInsertionEdit(options: {\n source: string;\n parsed: ParsedCanvasFile;\n tag: string;\n storyboard: AddCanvasStoryboardInput;\n componentExpression?: string;\n}): CanvasSourceEdit {\n const insertionOffset = options.parsed.canvasChildrenInsertionOffset;\n if (typeof insertionOffset === \"number\") {\n return {\n start: insertionOffset,\n end: insertionOffset,\n value: formatStoryboardElement({\n source: options.source,\n insertionOffset,\n tag: options.tag,\n storyboard: options.storyboard,\n componentExpression: options.componentExpression,\n }),\n };\n }\n\n const openingSpan = options.parsed.canvasOpeningElementSpan;\n if (!openingSpan) {\n throw new Error(\"Canvas closing element not found\");\n }\n\n const openingSource = options.source.slice(\n openingSpan.start,\n openingSpan.end,\n );\n const selfClosingMatch = openingSource.match(/\\s*\\/\\s*>$/);\n const canvasName = openingSource.match(\n /^<\\s*([A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*)/,\n )?.[1];\n if (!selfClosingMatch || !canvasName) {\n throw new Error(\"Canvas closing element not found\");\n }\n\n const newline = detectNewline(options.source);\n const replacementStart = openingSpan.end - selfClosingMatch[0].length;\n const closingIndent = lineIndentAt(options.source, openingSpan.start);\n const childIndent = `${closingIndent} `;\n const propIndent = `${childIndent} `;\n const props = storyboardElementProps(\n options.storyboard,\n options.componentExpression,\n );\n\n return {\n start: replacementStart,\n end: openingSpan.end,\n value: `>${newline}${childIndent}<${options.tag}${newline}${props\n .map((prop) => `${propIndent}${prop}`)\n .join(\n newline,\n )}${newline}${childIndent}/>${newline}${closingIndent}</${canvasName}>`,\n };\n}\n\nfunction storyboardElementProps(\n storyboard: AddCanvasStoryboardInput,\n componentExpression?: string,\n): string[] {\n const idProp = formatJsxStringAttribute(\n \"id\",\n requireNonEmpty(storyboard.id, \"Storyboard id\"),\n );\n\n // LegacyStoryboardV1 carries only `id` + `storyboard={Expr}`; name and\n // layout live on the referenced object, so they are never emitted here.\n if (storyboard.kind === \"legacy-v1\") {\n return [idProp, `storyboard={${storyboard.storyboardExpression}}`];\n }\n\n return [\n idProp,\n ...(storyboard.name && storyboard.name.trim() !== \"\"\n ? [formatJsxStringAttribute(\"name\", storyboard.name)]\n : []),\n ...storyboardKindProps(storyboard, componentExpression),\n `layout={{ ${formatLayout(storyboard.layout)} }}`,\n ];\n}\n\n/**\n * Format a JSX string attribute. Prefers the idiomatic plain form\n * (`name=\"value\"`) and falls back to the expression form (`name={\"value\"}`)\n * when the plain form can't represent the value faithfully: JSX string\n * attributes don't process backslash escapes but DO decode HTML entities, so\n * any value that JSON-escapes (quotes, backslashes, control characters) or\n * contains `&` must go through a braced string literal.\n */\nexport function formatJsxStringAttribute(name: string, value: string): string {\n const encoded = JSON.stringify(value);\n const plainSafe = encoded === `\"${value}\"` && !value.includes(\"&\");\n return plainSafe ? `${name}=${encoded}` : `${name}={${encoded}}`;\n}\n\nfunction storyboardKindProps(\n // legacy-v1 never reaches here: `storyboardElementProps` emits its\n // `storyboard={…}` prop directly (it has no name/layout attributes).\n storyboard: Exclude<AddCanvasStoryboardInput, { kind: \"legacy-v1\" }>,\n componentExpression?: string,\n): string[] {\n if (\n storyboard.kind === \"component\" ||\n storyboard.kind === \"svelte-component\"\n ) {\n return [\n `component={${componentExpression}}`,\n ...(storyboard.props && storyboard.props.trim() !== \"\"\n ? [`props={${storyboard.props.trim()}}`]\n : []),\n ];\n }\n if (storyboard.kind === \"route\") {\n return [formatJsxStringAttribute(\"route\", storyboard.route)];\n }\n return [\n ...(storyboard.filepath\n ? [formatJsxStringAttribute(\"filepath\", storyboard.filepath)]\n : []),\n ...(storyboard.src\n ? [formatJsxStringAttribute(\"src\", storyboard.src)]\n : []),\n ];\n}\n\nfunction formatLayout(layout: CanvasEditorLayout): string {\n return [\n `x: ${roundLayoutNumber(layout.x)}`,\n `y: ${roundLayoutNumber(layout.y)}`,\n `width: ${roundLayoutNumber(layout.width)}`,\n `height: ${roundLayoutNumber(layout.height)}`,\n ...(layout.zIndex === undefined\n ? []\n : [`zIndex: ${roundLayoutNumber(layout.zIndex)}`]),\n ...(layout.intrinsicSizing\n ? [`intrinsicSizing: ${JSON.stringify(layout.intrinsicSizing)}`]\n : []),\n ].join(\", \");\n}\n\nfunction sdkComponentForStoryboard(\n kind: AddCanvasStoryboardInput[\"kind\"],\n): SdkComponent {\n if (kind === \"route\") return \"RouteStoryboard\";\n if (kind === \"html\") return \"HtmlStoryboard\";\n if (kind === \"legacy-v1\") return \"LegacyStoryboardV1\";\n if (kind === \"svelte-component\") return \"SvelteStoryboard\";\n return \"Storyboard\";\n}\n\nfunction resolveSdkTag(\n parsed: ParsedCanvasFile,\n component: SdkComponent,\n): { tag: string; importLine?: string } {\n const sdkSource =\n component === \"SvelteStoryboard\"\n ? \"tempo-sdk/canvas/svelte\"\n : \"tempo-sdk/canvas\";\n for (const item of parsed.imports) {\n if (item.source !== sdkSource) continue;\n if (item.kind === \"namespace\")\n return { tag: `${item.localName}.${component}` };\n if (item.importedName === component) return { tag: item.localName };\n }\n\n const localName = pickAvailableIdentifier(parsed, `TempoCanvas${component}`);\n return {\n tag: localName,\n importLine: `import { ${component} as ${localName} } from \"${sdkSource}\";`,\n };\n}\n\nfunction buildMissingComponentImportLine(\n parsed: ParsedCanvasFile,\n source: string,\n componentImport: {\n localName: string;\n source: string;\n importedName?: string;\n },\n): string | null {\n const existing = parsed.imports.find(\n (item) => item.localName === componentImport.localName,\n );\n if (existing) {\n if (existing.source !== componentImport.source) {\n throw new Error(\n `Import binding \"${componentImport.localName}\" already exists`,\n );\n }\n return null;\n }\n // Collision check that THROWS — must not fire on the name merely appearing\n // inside a string literal (e.g. `<Canvas name=\"Card Demo\">` blocking a `Card`\n // import), so use the AST-based node scan, never the textual `hasIdentifier`.\n if (\n sourceContainsIdentifierNode(\n parsed.filePath,\n source,\n componentImport.localName,\n )\n ) {\n throw new Error(`Identifier \"${componentImport.localName}\" already exists`);\n }\n\n if (\n !componentImport.importedName ||\n componentImport.importedName === \"default\"\n ) {\n return `import ${componentImport.localName} from ${JSON.stringify(\n componentImport.source,\n )};`;\n }\n\n const specifier =\n componentImport.importedName === componentImport.localName\n ? componentImport.localName\n : `${componentImport.importedName} as ${componentImport.localName}`;\n return `import { ${specifier} } from ${JSON.stringify(componentImport.source)};`;\n}\n\nfunction buildImportInsertionEdit(\n source: string,\n parsed: ParsedCanvasFile,\n importLines: readonly string[],\n): CanvasSourceEdit | null {\n if (importLines.length === 0) return null;\n const newline = detectNewline(source);\n const uniqueLines = Array.from(new Set(importLines));\n const lastImport = parsed.imports.reduce<ParsedCanvasImport | null>(\n (latest, item) =>\n !latest || item.declarationSpan.end > latest.declarationSpan.end\n ? item\n : latest,\n null,\n );\n\n if (lastImport) {\n return {\n start: lastImport.declarationSpan.end,\n end: lastImport.declarationSpan.end,\n value: `${newline}${uniqueLines.join(newline)}`,\n };\n }\n\n const offset = topLevelInsertionOffset(source);\n return {\n start: offset,\n end: offset,\n value: `${uniqueLines.join(newline)}${newline}`,\n };\n}\n\nfunction buildUnusedComponentImportRemoval(options: {\n source: string;\n parsed: ParsedCanvasFile;\n deletedStoryboard: ParsedCanvasStoryboard;\n deletionEdit: CanvasSourceEdit;\n}): CanvasSourceEdit | null {\n const componentImport = options.deletedStoryboard.component?.import;\n if (!componentImport || componentImport.importKind === \"type\") return null;\n\n const usedByRemainingStoryboard = options.parsed.storyboards.some(\n (storyboard) =>\n storyboard.storyboardKey !== options.deletedStoryboard.storyboardKey &&\n storyboard.component?.import?.localName === componentImport.localName,\n );\n if (usedByRemainingStoryboard) return null;\n\n const sourceAfterStoryboardDelete = applyCanvasSourceEdits(options.source, [\n options.deletionEdit,\n ]);\n\n if (componentImport.specifierCount === 1) {\n const sourceWithoutImport = removeSpanText(\n sourceAfterStoryboardDelete,\n componentImport.declarationSpan,\n );\n if (hasIdentifier(sourceWithoutImport, componentImport.localName))\n return null;\n\n return {\n ...expandToFullLines(options.source, componentImport.declarationSpan),\n value: \"\",\n };\n }\n\n if (\n componentImport.kind !== \"named\" ||\n componentImport.hasDefaultSpecifier ||\n componentImport.hasNamespaceSpecifier ||\n componentImport.namedSpecifierCount <= 1\n ) {\n return null;\n }\n\n const specifierRange = expandImportSpecifierRemovalRange(\n options.source,\n componentImport.span,\n );\n const sourceWithoutImport = removeSpanText(\n sourceAfterStoryboardDelete,\n specifierRange,\n );\n if (hasIdentifier(sourceWithoutImport, componentImport.localName))\n return null;\n\n return {\n ...specifierRange,\n value: \"\",\n };\n}\n\nfunction expandImportSpecifierRemovalRange(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n const lineStart = Math.max(source.lastIndexOf(\"\\n\", span.start - 1) + 1, 0);\n const nextNewline = source.indexOf(\"\\n\", span.end);\n const lineEnd = nextNewline >= 0 ? nextNewline + 1 : source.length;\n const before = source.slice(lineStart, span.start);\n const after = source.slice(span.end, lineEnd);\n if (/^[ \\t]*$/.test(before) && /^[ \\t]*(,)?[ \\t]*(\\r?\\n)?$/.test(after)) {\n return { start: lineStart, end: lineEnd };\n }\n\n let start = span.start;\n let end = span.end;\n while (end < source.length && /\\s/.test(source[end] ?? \"\")) end++;\n if (source[end] === \",\") {\n end++;\n while (\n end < source.length &&\n (source[end] === \" \" || source[end] === \"\\t\")\n ) {\n end++;\n }\n return { start, end };\n }\n\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n if (source[start - 1] === \",\") {\n start--;\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n }\n return { start, end };\n}\n\nfunction removeSpanText(source: string, span: CanvasSourceSpan): string {\n return source.slice(0, span.start) + source.slice(span.end);\n}\n\nfunction findOpeningElementAttributeInsertionOffset(\n source: string,\n span: CanvasSourceSpan,\n): number {\n const close = source.lastIndexOf(\">\", span.end - 1);\n if (close < span.start) {\n throw new Error(\"JSX opening element close not found\");\n }\n return source[close - 1] === \"/\" ? close - 1 : close;\n}\n\nfunction expandJsxAttributeRemoval(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n\n while (\n start > 0 &&\n (source[start - 1] === \" \" || source[start - 1] === \"\\t\")\n ) {\n start--;\n }\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n return { start, end };\n}\n\nfunction expandObjectPropertyRemoval(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n\n while (start > 0 && /\\s/.test(source[start - 1] ?? \"\")) start--;\n while (end < source.length && /\\s/.test(source[end] ?? \"\")) end++;\n\n if (source[end] === \",\") {\n end++;\n while (\n end < source.length &&\n (source[end] === \" \" || source[end] === \"\\t\")\n ) {\n end++;\n }\n return { start, end };\n }\n\n let comma = start - 1;\n while (comma >= 0 && /\\s/.test(source[comma] ?? \"\")) comma--;\n if (source[comma] === \",\") {\n start = comma;\n }\n return { start, end };\n}\n\nexport function expandToFullLines(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let start = span.start;\n let end = span.end;\n while (\n start > 0 &&\n source[start - 1] !== \"\\n\" &&\n source[start - 1] !== \"\\r\"\n ) {\n start--;\n }\n if (start > 0) {\n if (source[start - 1] === \"\\n\") start--;\n if (start > 0 && source[start - 1] === \"\\r\") start--;\n }\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n if (source.slice(end, end + 2) === \"\\r\\n\") {\n end += 2;\n } else if (source[end] === \"\\n\" || source[end] === \"\\r\") {\n end++;\n }\n return { start, end };\n}\n\nexport function expandStatementForward(\n source: string,\n span: CanvasSourceSpan,\n): CanvasSourceSpan {\n let end = span.end;\n while (end < source.length && (source[end] === \" \" || source[end] === \"\\t\")) {\n end++;\n }\n if (source.slice(end, end + 2) === \"\\r\\n\") {\n end += 2;\n } else if (source[end] === \"\\n\" || source[end] === \"\\r\") {\n end++;\n }\n return { start: span.start, end };\n}\n\nfunction lineIndentAt(source: string, offset: number): string {\n const lineStart = Math.max(source.lastIndexOf(\"\\n\", offset - 1) + 1, 0);\n const linePrefix = source.slice(lineStart, offset);\n const match = linePrefix.match(/^[ \\t]*/);\n return match?.[0] ?? \"\";\n}\n\nfunction previousMeaningfulCharacter(source: string, offset: number): string {\n for (let index = offset - 1; index >= 0; index -= 1) {\n const character = source[index] ?? \"\";\n if (!/\\s/.test(character)) return character;\n }\n return \"\";\n}\n\nfunction trimWhitespaceBeforeOffset(source: string, offset: number): number {\n let nextOffset = offset;\n while (nextOffset > 0 && /\\s/.test(source[nextOffset - 1] ?? \"\")) {\n nextOffset--;\n }\n return nextOffset;\n}\n\nexport function collapseBlankLines(source: string, newline: string): string {\n return newline === \"\\r\\n\"\n ? source.replace(/(\\r\\n){3,}/g, \"\\r\\n\\r\\n\")\n : source.replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nexport function detectNewline(source: string): \"\\n\" | \"\\r\\n\" {\n return source.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n}\n\nexport function topLevelInsertionOffset(source: string): number {\n let offset = 0;\n if (source.startsWith(\"#!\")) {\n const newline = source.indexOf(\"\\n\");\n offset = newline >= 0 ? newline + 1 : source.length;\n }\n\n while (true) {\n const nextLineEnd = source.indexOf(\"\\n\", offset);\n const end = nextLineEnd >= 0 ? nextLineEnd + 1 : source.length;\n const line = source.slice(offset, end).trim();\n if (!/^[\"']use [^\"']+[\"'];?$/.test(line)) break;\n offset = end;\n }\n\n return offset;\n}\n\nfunction pickAvailableIdentifier(\n parsed: ParsedCanvasFile,\n base: string,\n): string {\n const usedImports = new Set(parsed.imports.map((item) => item.localName));\n if (!usedImports.has(base)) return base;\n for (let index = 2; index < 10_000; index += 1) {\n const candidate = `${base}${index}`;\n if (!usedImports.has(candidate)) return candidate;\n }\n throw new Error(`Unable to find available identifier for ${base}`);\n}\n\n/**\n * Cheap word-boundary text scan. It matches occurrences inside string literals\n * and comments too, so it is SAFE-DIRECTION ONLY: use it where a false positive\n * is harmless (conservatively keeping an import that might still be used), NEVER\n * for a collision check that throws or blocks an edit — those must use\n * {@link sourceContainsIdentifierNode}, which counts real identifier nodes only.\n */\nexport function hasIdentifier(source: string, identifier: string): boolean {\n return new RegExp(`\\\\b${escapeRegExp(identifier)}\\\\b`).test(source);\n}\n\n/**\n * True when `name` appears as a real identifier node (`Identifier` /\n * `JSXIdentifier`) anywhere in `source` — a binding or reference, never a\n * string-literal or comment occurrence. Use this for collision checks that\n * throw or block an edit, so a name appearing only inside a string (e.g.\n * `<Canvas name=\"Card Demo\">` vs a `Card` import) can't masquerade as a\n * declared identifier.\n */\nexport function sourceContainsIdentifierNode(\n filePath: string,\n source: string,\n name: string,\n): boolean {\n const program = (parseSync(filePath, source) as any).program;\n let found = false;\n walkWithParent(program, (node) => {\n if (found) return;\n if (\n (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") &&\n node.name === name\n ) {\n found = true;\n }\n });\n return found;\n}\n\n/**\n * Depth-first walk that hands each AST node to `visit` along with its parent and\n * the parent field it was reached through — the context callers need to tell a\n * value reference from a property key or member access.\n */\nexport function walkWithParent(\n node: any,\n visit: (node: any, parent: any, key: string | null) => void,\n parent: any = null,\n key: string | null = null,\n seen = new Set<any>(),\n): void {\n if (!node || typeof node !== \"object\" || seen.has(node)) return;\n seen.add(node);\n if (typeof node.type === \"string\") visit(node, parent, key);\n for (const [childKey, value] of Object.entries(node)) {\n if (!value || typeof value !== \"object\") continue;\n if (Array.isArray(value)) {\n for (const item of value)\n walkWithParent(item, visit, node, childKey, seen);\n } else {\n walkWithParent(value, visit, node, childKey, seen);\n }\n }\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction roundLayoutNumber(value: number): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(\"Layout values must be finite numbers\");\n }\n return Math.round(value);\n}\n\nfunction requireNonEmpty(value: string, label: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n throw new Error(`${label} must be non-empty`);\n }\n return trimmed;\n}\n\nfunction requiredSpan<T>(value: T | undefined, message: string): T {\n if (value === undefined) {\n throw new Error(message);\n }\n return value;\n}\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AA6FnB,SAAS,uBACd,QACA,OACQ;AACR,QAAM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pD;AAEA,SAAS,kBAAkB,OAAuB;AAChD,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,GAAG;AACxD,UAAM,IAAI,MAAM,sCAAsC;AAAA,EACxD;AACA,SAAO,KAAK,MAAM,KAAK;AACzB;AAEA,SAAS,gBAAgB,OAAe,OAAuB;AAC7D,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,GAAG,KAAK,oBAAoB;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,SAAS,aAAgB,OAAsB,SAAoB;AACjE,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,OAAO;AAAA,EACzB;AACA,SAAO;AACT;","names":["edit","sourceWithoutImport"]}
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
|
|
3
|
+
export { H as HtmlStoryboard, L as LegacyStoryboardV1, R as RouteStoryboard, S as Storyboard, a as StoryboardLayout, b as StoryboardSlot, c as StoryboardVrtConfig, d as StoryboardVrtIgnoreRegion } from '../storyboard-xVaRTJAu.js';
|
|
4
|
+
import '../page-xi1aI5a7.js';
|
|
4
5
|
|
|
5
6
|
declare function getCanvasStoryboardRenderId(canvasPath: string, storyboardId: string): string;
|
|
6
7
|
declare function Canvas({ children, name, path, backgroundColor, defaultViewport, ...sourceAnnotations }: {
|
|
@@ -228,68 +229,4 @@ declare global {
|
|
|
228
229
|
|
|
229
230
|
declare function useActiveState(storyboardId: string): boolean;
|
|
230
231
|
|
|
231
|
-
|
|
232
|
-
x: number;
|
|
233
|
-
y: number;
|
|
234
|
-
width: number;
|
|
235
|
-
height: number;
|
|
236
|
-
zIndex?: number;
|
|
237
|
-
intrinsicSizing?: "root-element";
|
|
238
|
-
}
|
|
239
|
-
interface StoryboardVrtIgnoreRegion {
|
|
240
|
-
x: number;
|
|
241
|
-
y: number;
|
|
242
|
-
w: number;
|
|
243
|
-
h: number;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Opt-in visual-regression tracking config (TEM-1775). The `vrt` prop is a
|
|
247
|
-
* static, build-time mark read by AST enumeration (`parseCanvasFile`) — it
|
|
248
|
-
* has no runtime behavior. Values must be literals to be tracked.
|
|
249
|
-
*/
|
|
250
|
-
interface StoryboardVrtConfig {
|
|
251
|
-
/** Per-storyboard pixelmatch threshold override (0..0.5). */
|
|
252
|
-
threshold?: number;
|
|
253
|
-
/** Temporarily untracked without losing config. */
|
|
254
|
-
skip?: boolean;
|
|
255
|
-
/** Regions (storyboard-local px) excluded from comparison. */
|
|
256
|
-
ignore?: StoryboardVrtIgnoreRegion[];
|
|
257
|
-
}
|
|
258
|
-
declare function Storyboard<Props extends object = object>({ id, name, component, layout, props, }: {
|
|
259
|
-
id: string;
|
|
260
|
-
component: ComponentType<Props>;
|
|
261
|
-
layout: StoryboardLayout;
|
|
262
|
-
name?: string;
|
|
263
|
-
props?: Props;
|
|
264
|
-
/** Opt this storyboard into visual regression testing (static mark). */
|
|
265
|
-
vrt?: boolean | StoryboardVrtConfig;
|
|
266
|
-
}): react_jsx_runtime.JSX.Element;
|
|
267
|
-
declare function LegacyStoryboardV1({ id, storyboard, }: {
|
|
268
|
-
id: string;
|
|
269
|
-
storyboard: TempoStoryboard;
|
|
270
|
-
}): react_jsx_runtime.JSX.Element;
|
|
271
|
-
declare function RouteStoryboard({ id, name, route, layout, }: {
|
|
272
|
-
id: string;
|
|
273
|
-
route: string;
|
|
274
|
-
layout: StoryboardLayout;
|
|
275
|
-
name?: string;
|
|
276
|
-
}): react_jsx_runtime.JSX.Element;
|
|
277
|
-
declare function HtmlStoryboard({ id, name, filepath, src, layout, }: {
|
|
278
|
-
id: string;
|
|
279
|
-
layout: StoryboardLayout;
|
|
280
|
-
filepath?: string;
|
|
281
|
-
src?: string;
|
|
282
|
-
name?: string;
|
|
283
|
-
}): react_jsx_runtime.JSX.Element;
|
|
284
|
-
declare function StoryboardSlot({ children, id, kind, layout, name, route, filepath, src, }: {
|
|
285
|
-
children?: ReactNode;
|
|
286
|
-
id: string;
|
|
287
|
-
kind: "component" | "route" | "html";
|
|
288
|
-
layout: StoryboardLayout;
|
|
289
|
-
name?: string;
|
|
290
|
-
route?: string;
|
|
291
|
-
filepath?: string;
|
|
292
|
-
src?: string;
|
|
293
|
-
}): react_jsx_runtime.JSX.Element | null;
|
|
294
|
-
|
|
295
|
-
export { CANVAS_HOST_DOCUMENT_TITLE, Canvas, CanvasContext, CanvasHost, type CanvasHostCaptureResult, CanvasHostContractError, type CanvasHostModule, type CanvasHostRecoveryEvent, type CanvasHostRecoveryFeed, type CanvasHostRuntime, type CanvasHostWatch, CanvasImportBoundary, HtmlStoryboard, LegacyStoryboardV1, RouteStoryboard, Storyboard, type StoryboardLayout, StoryboardSlot, type StoryboardVrtConfig, type StoryboardVrtIgnoreRegion, TEMPO_INTERACT_FRAME_NAME, buildRenderContentFiberSelector, buildRenderContentSelector, buildRenderSelector, canvasHostCapability, captureStoryboardCombined, captureStoryboardHtml, captureStoryboardImage, getCanvasHostRecoveryFeed, getCanvasHostRuntime, getCanvasStoryboardRenderId, getOptionalCanvasHostRuntime, isTempoInteractFrameName, stripRenderContentWrapperAttributes, stripRenderContentWrapperFromCombinedCapture, useActiveState, watchStoryboardCombined };
|
|
232
|
+
export { CANVAS_HOST_DOCUMENT_TITLE, Canvas, CanvasContext, CanvasHost, type CanvasHostCaptureResult, CanvasHostContractError, type CanvasHostModule, type CanvasHostRecoveryEvent, type CanvasHostRecoveryFeed, type CanvasHostRuntime, type CanvasHostWatch, CanvasImportBoundary, TEMPO_INTERACT_FRAME_NAME, buildRenderContentFiberSelector, buildRenderContentSelector, buildRenderSelector, canvasHostCapability, captureStoryboardCombined, captureStoryboardHtml, captureStoryboardImage, getCanvasHostRecoveryFeed, getCanvasHostRuntime, getCanvasStoryboardRenderId, getOptionalCanvasHostRuntime, isTempoInteractFrameName, stripRenderContentWrapperAttributes, stripRenderContentWrapperFromCombinedCapture, useActiveState, watchStoryboardCombined };
|