tempo-sdk 0.0.69 → 0.0.75

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.
Files changed (109) hide show
  1. package/dist/assets/index.js +3 -3
  2. package/dist/astro/asset-preview-client.js +2 -2
  3. package/dist/astro.js +17 -11
  4. package/dist/astro.js.map +1 -1
  5. package/dist/canvas/astro.d.ts +1 -1
  6. package/dist/canvas/astro.js +2 -2
  7. package/dist/canvas/editor.d.ts +15 -5
  8. package/dist/canvas/editor.js +13 -8
  9. package/dist/canvas/editor.js.map +1 -1
  10. package/dist/canvas/flutter-preview.d.ts +18 -0
  11. package/dist/canvas/flutter-preview.js +9 -0
  12. package/dist/canvas/flutter-preview.js.map +1 -0
  13. package/dist/canvas/index.d.ts +33 -2
  14. package/dist/canvas/index.js +1134 -26
  15. package/dist/canvas/index.js.map +1 -1
  16. package/dist/canvas/interact-projection.js +5 -4
  17. package/dist/canvas/parser.d.ts +142 -3
  18. package/dist/canvas/parser.js +14 -1
  19. package/dist/canvas/svelte.d.ts +1 -1
  20. package/dist/canvas/svelte.js +2 -2
  21. package/dist/canvas/vue.d.ts +74 -0
  22. package/dist/canvas/vue.js +264 -0
  23. package/dist/canvas/vue.js.map +1 -0
  24. package/dist/{chunk-6BSLP7P3.js → chunk-2YX4WVFH.js} +49 -7
  25. package/dist/chunk-2YX4WVFH.js.map +1 -0
  26. package/dist/chunk-5HIIF354.js +67 -0
  27. package/dist/chunk-5HIIF354.js.map +1 -0
  28. package/dist/{chunk-FE6TYCLF.js → chunk-5VIBKVFO.js} +2 -2
  29. package/dist/{chunk-FE6TYCLF.js.map → chunk-5VIBKVFO.js.map} +1 -1
  30. package/dist/{chunk-77DZCV5Z.js → chunk-CXIW4IKC.js} +2 -2
  31. package/dist/chunk-CYQE3TLC.js +37 -0
  32. package/dist/chunk-CYQE3TLC.js.map +1 -0
  33. package/dist/{chunk-WTQQOLXM.js → chunk-DNSCVLKV.js} +1571 -1410
  34. package/dist/chunk-DNSCVLKV.js.map +1 -0
  35. package/dist/chunk-EGRHWZRV.js +1 -0
  36. package/dist/chunk-EGRHWZRV.js.map +1 -0
  37. package/dist/{chunk-EYKOOLPL.js → chunk-GKDDNDG3.js} +1039 -134
  38. package/dist/chunk-GKDDNDG3.js.map +1 -0
  39. package/dist/{chunk-KOSJXE4G.js → chunk-H6BQZOAW.js} +4 -3
  40. package/dist/chunk-HOBTDB6G.js +112 -0
  41. package/dist/chunk-HOBTDB6G.js.map +1 -0
  42. package/dist/chunk-HZXQPM4W.js +285 -0
  43. package/dist/chunk-HZXQPM4W.js.map +1 -0
  44. package/dist/chunk-SGN7BDRE.js +16 -0
  45. package/dist/chunk-SGN7BDRE.js.map +1 -0
  46. package/dist/{chunk-F23JGM4U.js → chunk-UBTL6JUF.js} +6 -2
  47. package/dist/{chunk-F23JGM4U.js.map → chunk-UBTL6JUF.js.map} +1 -1
  48. package/dist/{chunk-2JRAG36X.js → chunk-WBMO4ZYO.js} +2 -2
  49. package/dist/chunk-WBMO4ZYO.js.map +1 -0
  50. package/dist/{chunk-K3EYTZLL.js → chunk-WTXOWQ7N.js} +3 -1
  51. package/dist/chunk-WTXOWQ7N.js.map +1 -0
  52. package/dist/{chunk-Q2A46HHW.js → chunk-XFPFWTWX.js} +276 -43
  53. package/dist/chunk-XFPFWTWX.js.map +1 -0
  54. package/dist/chunk-XMFVWJUY.js +342 -0
  55. package/dist/chunk-XMFVWJUY.js.map +1 -0
  56. package/dist/{chunk-PXDTH36X.js → chunk-Y72PIE3I.js} +212 -20
  57. package/dist/chunk-Y72PIE3I.js.map +1 -0
  58. package/dist/{chunk-6IR5JY6W.js → chunk-YECMP34I.js} +41 -9
  59. package/dist/chunk-YECMP34I.js.map +1 -0
  60. package/dist/{chunk-NSKYOKG5.js → chunk-ZXC7SZIT.js} +278 -26
  61. package/dist/chunk-ZXC7SZIT.js.map +1 -0
  62. package/dist/{controls-reader-SNMI2UY7.js → controls-reader-Z7OQWYWQ.js} +4 -3
  63. package/dist/{controls-reader-SNMI2UY7.js.map → controls-reader-Z7OQWYWQ.js.map} +1 -1
  64. package/dist/expo/plugin.cjs +301 -58
  65. package/dist/expo/plugin.cjs.map +1 -1
  66. package/dist/expo/plugin.js +1 -1
  67. package/dist/expo-babel-plugin.cjs +301 -58
  68. package/dist/expo-babel-plugin.cjs.map +1 -1
  69. package/dist/expo-babel-plugin.js +1 -1
  70. package/dist/flutter-preview-path.d.ts +9 -0
  71. package/dist/flutter-preview-path.js +16 -0
  72. package/dist/flutter-preview-path.js.map +1 -0
  73. package/dist/index.d.ts +16 -15
  74. package/dist/index.js +9 -6
  75. package/dist/nextjs/plugin.cjs +46 -5
  76. package/dist/nextjs/plugin.cjs.map +1 -1
  77. package/dist/nextjs/plugin.js +1 -1
  78. package/dist/nextjs-loader.cjs +343 -68
  79. package/dist/nextjs-loader.cjs.map +1 -1
  80. package/dist/nextjs.cjs +48 -6
  81. package/dist/nextjs.cjs.map +1 -1
  82. package/dist/nextjs.d.cts +9 -1
  83. package/dist/nextjs.d.ts +9 -1
  84. package/dist/nextjs.js +1 -1
  85. package/dist/nuxt/runtime/identity.d.ts +24 -0
  86. package/dist/nuxt/runtime/identity.js +18 -0
  87. package/dist/nuxt/runtime/identity.js.map +1 -0
  88. package/dist/nuxt.d.ts +102 -0
  89. package/dist/nuxt.js +5673 -0
  90. package/dist/nuxt.js.map +1 -0
  91. package/dist/{storyboard-4YdTYq_e.d.ts → storyboard-CMJVBSXn.d.ts} +9 -3
  92. package/dist/svelte.d.ts +4 -2
  93. package/dist/svelte.js +21 -88
  94. package/dist/svelte.js.map +1 -1
  95. package/dist/vue.d.ts +66 -0
  96. package/dist/vue.js +1403 -0
  97. package/dist/vue.js.map +1 -0
  98. package/package.json +48 -5
  99. package/dist/chunk-2JRAG36X.js.map +0 -1
  100. package/dist/chunk-6BSLP7P3.js.map +0 -1
  101. package/dist/chunk-6IR5JY6W.js.map +0 -1
  102. package/dist/chunk-EYKOOLPL.js.map +0 -1
  103. package/dist/chunk-K3EYTZLL.js.map +0 -1
  104. package/dist/chunk-NSKYOKG5.js.map +0 -1
  105. package/dist/chunk-PXDTH36X.js.map +0 -1
  106. package/dist/chunk-Q2A46HHW.js.map +0 -1
  107. package/dist/chunk-WTQQOLXM.js.map +0 -1
  108. /package/dist/{chunk-77DZCV5Z.js.map → chunk-CXIW4IKC.js.map} +0 -0
  109. /package/dist/{chunk-KOSJXE4G.js.map → chunk-H6BQZOAW.js.map} +0 -0
@@ -39,25 +39,152 @@ __export(nextjs_loader_exports, {
39
39
  module.exports = __toCommonJS(nextjs_loader_exports);
40
40
 
41
41
  // canvas-component-reference.ts
42
+ var import_node_fs2 = require("fs");
43
+ var import_node_path2 = require("path");
44
+
45
+ // canvas/flutter-preview.ts
46
+ function parseFlutterPreview(value) {
47
+ const prefix = `preview ${JSON.stringify(value)}`;
48
+ if (value.includes("\\"))
49
+ return {
50
+ error: `${prefix} uses a backslash; use "/" (paths in canvases are POSIX).`
51
+ };
52
+ const hash = value.lastIndexOf("#");
53
+ if (hash < 0)
54
+ return {
55
+ error: `${prefix} needs "#<function>" after the file, e.g. "../../lib/cards.dart#productCard".`
56
+ };
57
+ const file = value.slice(0, hash);
58
+ const functionName = value.slice(hash + 1);
59
+ if (!file.startsWith("./") && !file.startsWith("../"))
60
+ return {
61
+ error: file.startsWith("lib/") ? `${prefix} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with "./" or "../".` : `${prefix} must be a path relative to this canvas file and start with "./" or "../", like a relative import.`
62
+ };
63
+ if (!file.endsWith(".dart"))
64
+ return { error: `${prefix} must name a .dart file.` };
65
+ if (/[?#]/.test(file) || file.includes("//"))
66
+ return {
67
+ error: `${prefix} must not contain "?", "#", or empty path segments.`
68
+ };
69
+ if (!/^[A-Za-z$][A-Za-z0-9_$]*$/.test(functionName))
70
+ return {
71
+ error: `${prefix}: ${JSON.stringify(functionName)} is not a public Dart function name.`
72
+ };
73
+ return { file, functionName };
74
+ }
75
+ var FLUTTER_PREVIEW_KEY_ATTRIBUTE = "data-tempo-flutter-preview-key";
76
+
77
+ // flutter-preview-path.ts
42
78
  var import_node_fs = require("fs");
43
- var import_node_path = require("path");
79
+ var import_node_path = __toESM(require("path"), 1);
80
+ function canonicalPathAllowMissing(file) {
81
+ const absolute = import_node_path.default.resolve(file);
82
+ try {
83
+ return import_node_fs.realpathSync.native(absolute);
84
+ } catch (error) {
85
+ const code = error.code;
86
+ if (code !== "ENOENT" && code !== "ENOTDIR") throw error;
87
+ let isLink = false;
88
+ try {
89
+ isLink = (0, import_node_fs.lstatSync)(absolute).isSymbolicLink();
90
+ } catch (statError) {
91
+ if (statError.code !== "ENOENT" && statError.code !== "ENOTDIR")
92
+ throw statError;
93
+ }
94
+ if (isLink) throw error;
95
+ const parent = import_node_path.default.dirname(absolute);
96
+ if (parent === absolute) throw error;
97
+ return import_node_path.default.join(
98
+ canonicalPathAllowMissing(parent),
99
+ import_node_path.default.basename(absolute)
100
+ );
101
+ }
102
+ }
103
+ function flutterPreviewKey(hostRoot, file, functionName) {
104
+ return `${import_node_path.default.relative(canonicalPathAllowMissing(hostRoot), canonicalPathAllowMissing(file)).split(import_node_path.default.sep).join("/")}#${functionName}`;
105
+ }
44
106
 
45
107
  // canvas/parser.ts
46
108
  var import_oxc_parser = require("oxc-parser");
109
+
110
+ // canvas/storyboard-components.ts
111
+ var STORYBOARD_SDK_COMPONENT_ROWS = {
112
+ Storyboard: {
113
+ importSource: "tempo-sdk/canvas",
114
+ kind: "component",
115
+ requiresComponentProp: true,
116
+ allowsVrt: true,
117
+ componentFileExtension: ".tsx"
118
+ },
119
+ SvelteStoryboard: {
120
+ importSource: "tempo-sdk/canvas/svelte",
121
+ kind: "component",
122
+ uiFramework: "svelte",
123
+ requiresComponentProp: true,
124
+ allowsVrt: true,
125
+ componentFileExtension: ".svelte"
126
+ },
127
+ VueStoryboard: {
128
+ importSource: "tempo-sdk/canvas/vue",
129
+ kind: "component",
130
+ uiFramework: "vue",
131
+ requiresComponentProp: true,
132
+ allowsVrt: true,
133
+ componentFileExtension: ".vue"
134
+ },
135
+ AstroStoryboard: {
136
+ importSource: "tempo-sdk/canvas/astro",
137
+ kind: "component",
138
+ uiFramework: "astro",
139
+ requiresComponentProp: true,
140
+ allowsVrt: true,
141
+ componentFileExtension: ".astro",
142
+ componentImportQuery: "?tempo-component"
143
+ },
144
+ FlutterStoryboard: {
145
+ importSource: "tempo-sdk/canvas",
146
+ kind: "component",
147
+ requiresComponentProp: false,
148
+ allowsVrt: true
149
+ },
150
+ RouteStoryboard: {
151
+ importSource: "tempo-sdk/canvas",
152
+ kind: "route",
153
+ requiresComponentProp: false,
154
+ allowsVrt: false
155
+ },
156
+ HtmlStoryboard: {
157
+ importSource: "tempo-sdk/canvas",
158
+ kind: "html",
159
+ requiresComponentProp: false,
160
+ allowsVrt: true
161
+ },
162
+ LegacyStoryboardV1: {
163
+ importSource: "tempo-sdk/canvas",
164
+ kind: "component",
165
+ requiresComponentProp: false,
166
+ allowsVrt: false
167
+ }
168
+ };
169
+ var STORYBOARD_SDK_COMPONENTS = STORYBOARD_SDK_COMPONENT_ROWS;
170
+ var STORYBOARD_SDK_COMPONENT_NAMES = Object.keys(
171
+ STORYBOARD_SDK_COMPONENTS
172
+ );
173
+
174
+ // canvas/parser.ts
47
175
  var SDK_IMPORT_SOURCES = /* @__PURE__ */ new Set([
48
176
  "tempo-sdk/canvas",
49
- "tempo-sdk/canvas/svelte",
50
- "tempo-sdk/canvas/astro"
177
+ ...STORYBOARD_SDK_COMPONENT_NAMES.map(
178
+ (component) => STORYBOARD_SDK_COMPONENTS[component].importSource
179
+ )
51
180
  ]);
52
181
  var SDK_COMPONENTS = /* @__PURE__ */ new Set([
53
182
  "Canvas",
54
- "Storyboard",
55
- "SvelteStoryboard",
56
- "AstroStoryboard",
57
- "LegacyStoryboardV1",
58
- "RouteStoryboard",
59
- "HtmlStoryboard"
183
+ ...STORYBOARD_SDK_COMPONENT_NAMES
60
184
  ]);
185
+ var CANVAS_CHILDREN_ERROR = `<Canvas> children must be ${formatAlternatives(
186
+ STORYBOARD_SDK_COMPONENT_NAMES.map((component) => `<${component}>`)
187
+ )} declarations`;
61
188
  var SDK_CANVAS_VALUE_EXPORTS = /* @__PURE__ */ new Set([
62
189
  "Canvas",
63
190
  "CanvasContext",
@@ -75,6 +202,7 @@ var SDK_CANVAS_VALUE_EXPORTS = /* @__PURE__ */ new Set([
75
202
  "getCanvasHostRuntime",
76
203
  "getOptionalCanvasHostRuntime",
77
204
  "useActiveState",
205
+ "FlutterStoryboard",
78
206
  "HtmlStoryboard",
79
207
  "LegacyStoryboardV1",
80
208
  "RouteStoryboard",
@@ -198,7 +326,7 @@ function parseCanvasFile(filePath, source) {
198
326
  "name",
199
327
  objectStringBindings
200
328
  );
201
- const path = readStringAttribute(openingElement, "path");
329
+ const path2 = readStringAttribute(openingElement, "path");
202
330
  const backgroundColor = readResolvableStringAttribute(
203
331
  openingElement,
204
332
  "backgroundColor",
@@ -217,7 +345,7 @@ function parseCanvasFile(filePath, source) {
217
345
  }
218
346
  return {
219
347
  filePath,
220
- canvasPath: path?.value,
348
+ canvasPath: path2?.value,
221
349
  pageName: name?.value ?? fallbackPageName(filePath),
222
350
  backgroundColor: backgroundColor?.value,
223
351
  canvasElementSpan: toSpan(canvasElement),
@@ -225,8 +353,8 @@ function parseCanvasFile(filePath, source) {
225
353
  canvasChildrenInsertionOffset: typeof canvasElement?.closingElement?.start === "number" ? canvasElement.closingElement.start : void 0,
226
354
  nameSpan: name?.valueSpan,
227
355
  nameAttributeSpan: name?.attributeSpan,
228
- pathSpan: path?.valueSpan,
229
- pathAttributeSpan: path?.attributeSpan,
356
+ pathSpan: path2?.valueSpan,
357
+ pathAttributeSpan: path2?.attributeSpan,
230
358
  backgroundColorSpan: backgroundColor?.valueSpan,
231
359
  backgroundColorAttributeSpan: backgroundColor?.attributeSpan,
232
360
  imports: imports.all,
@@ -445,7 +573,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
445
573
  }
446
574
  ])
447
575
  } : readLayout(openingElement, component);
448
- const kind = component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" ? "component" : component === "RouteStoryboard" ? "route" : "html";
576
+ const spec = STORYBOARD_SDK_COMPONENTS[component];
449
577
  if (!id) {
450
578
  errors.push({
451
579
  message: `<${component}> must include a literal "id" prop`,
@@ -459,8 +587,9 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
459
587
  const storyboard = {
460
588
  storyboardKey: id?.value ?? "",
461
589
  displayName: name?.value ?? legacyObject?.displayName,
462
- kind,
463
- ...component === "SvelteStoryboard" ? { uiFramework: "svelte" } : component === "AstroStoryboard" ? { runtimeFramework: "astro" } : {},
590
+ kind: spec.kind,
591
+ ...spec.uiFramework ? { componentFramework: spec.uiFramework } : {},
592
+ ...spec.uiFramework === "svelte" ? { uiFramework: spec.uiFramework } : spec.uiFramework === "astro" ? { runtimeFramework: spec.uiFramework } : {},
464
593
  layout: layout.value,
465
594
  editable: Boolean(id) && layout.errors.length === 0,
466
595
  jsxElementSpan: toSpan(element) ?? { start: 0, end: 0 },
@@ -483,7 +612,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
483
612
  } : void 0,
484
613
  errors
485
614
  };
486
- if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard") {
615
+ if (spec.requiresComponentProp) {
487
616
  const componentReference = readComponentReference(
488
617
  openingElement,
489
618
  imports,
@@ -499,7 +628,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
499
628
  });
500
629
  }
501
630
  }
502
- if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "HtmlStoryboard") {
631
+ if (spec.allowsVrt) {
503
632
  const vrt = readVrt(openingElement, errors);
504
633
  if (vrt) {
505
634
  if (vrt.value) {
@@ -539,6 +668,27 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
539
668
  });
540
669
  }
541
670
  }
671
+ if (component === "FlutterStoryboard") {
672
+ const preview = readStringAttribute(openingElement, "preview");
673
+ if (preview?.value.trim()) {
674
+ storyboard.preview = preview.value;
675
+ storyboard.previewSpan = preview.valueSpan;
676
+ storyboard.previewAttributeSpan = preview.attributeSpan;
677
+ const parsedPreview = parseFlutterPreview(preview.value);
678
+ if ("error" in parsedPreview)
679
+ errors.push({
680
+ message: `flutter_preview_invalid: ${parsedPreview.error}`,
681
+ span: preview.valueSpan,
682
+ kind: "structural"
683
+ });
684
+ } else {
685
+ errors.push({
686
+ message: '<FlutterStoryboard> must include a literal "preview" prop naming a Flutter @Preview function, e.g. preview="../../lib/cards.dart#productCard"',
687
+ span: toSpan(getAttribute(openingElement, "preview") ?? openingElement),
688
+ kind: "structural"
689
+ });
690
+ }
691
+ }
542
692
  globalErrors.push(...errors);
543
693
  return storyboard;
544
694
  }
@@ -598,18 +748,61 @@ function validateCanvasChildren(canvasElement, imports) {
598
748
  child.openingElement?.name,
599
749
  imports
600
750
  );
601
- if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard") {
751
+ if (isStoryboardSdkComponent(component)) continue;
752
+ const newerComponent = resolveNewerSdkStoryboardComponent(
753
+ child.openingElement?.name,
754
+ imports
755
+ );
756
+ if (newerComponent) {
757
+ errors.push(newerSdkStoryboardError(child, newerComponent));
602
758
  continue;
603
759
  }
604
760
  }
605
761
  errors.push({
606
- message: "<Canvas> children must be <Storyboard>, <SvelteStoryboard>, <AstroStoryboard>, <RouteStoryboard>, <HtmlStoryboard>, or <LegacyStoryboardV1> declarations",
762
+ message: CANVAS_CHILDREN_ERROR,
607
763
  span: toSpan(child),
608
764
  kind: "structural"
609
765
  });
610
766
  }
611
767
  return errors;
612
768
  }
769
+ var SDK_CANVAS_SUBPATH = /(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;
770
+ function resolveNewerSdkStoryboardComponent(nameNode, imports) {
771
+ let importedName;
772
+ let source;
773
+ if (nameNode?.type === "JSXIdentifier") {
774
+ const imported = imports.byLocalName.get(nameNode.name);
775
+ if (imported?.kind !== "named") return null;
776
+ importedName = imported.importedName;
777
+ source = imported.source;
778
+ } else if (nameNode?.type === "JSXMemberExpression" && nameNode.object?.type === "JSXIdentifier" && nameNode.property?.type === "JSXIdentifier") {
779
+ const imported = imports.byLocalName.get(nameNode.object.name);
780
+ if (imported?.kind !== "namespace") return null;
781
+ importedName = nameNode.property.name;
782
+ source = imported.source;
783
+ } else {
784
+ return null;
785
+ }
786
+ const fromSdkCanvas = SDK_CANVAS_SUBPATH.test(source);
787
+ const namesStoryboard = importedName.endsWith("Storyboard");
788
+ return fromSdkCanvas && namesStoryboard ? importedName : null;
789
+ }
790
+ function newerSdkStoryboardError(element, component) {
791
+ const openingElement = element.openingElement;
792
+ const storyboardKey = readStringAttribute(openingElement, "id")?.value;
793
+ const vrt = readVrt(openingElement, [])?.value != null;
794
+ const named = storyboardKey ? ` id="${storyboardKey}"` : "";
795
+ return {
796
+ message: `<${component}${named}> is a storyboard from a newer tempo-sdk than this reader supports`,
797
+ span: toSpan(element),
798
+ kind: "structural",
799
+ newerSdkStoryboard: {
800
+ component,
801
+ ...storyboardKey ? { storyboardKey } : {},
802
+ vrt
803
+ }
804
+ };
805
+ }
613
806
  function readVrt(openingElement, errors) {
614
807
  const attribute = getAttribute(openingElement, "vrt");
615
808
  if (!attribute) return null;
@@ -756,7 +949,7 @@ function isIdentifierExpression(expression) {
756
949
  return /^[A-Za-z_$][\w$]*$/.test(expression);
757
950
  }
758
951
  function readLayout(openingElement, componentName) {
759
- const isViewport = componentName === "RouteStoryboard" || componentName === "HtmlStoryboard";
952
+ const isViewport = requiresFixedLayoutSize(componentName);
760
953
  const attribute = getAttribute(openingElement, "layout");
761
954
  const expression = unwrapAttributeExpression(attribute?.value);
762
955
  if (!expression) {
@@ -780,7 +973,7 @@ function readLayout(openingElement, componentName) {
780
973
  }
781
974
  function readLayoutExpression(expression, componentName) {
782
975
  const errors = [];
783
- const isViewport = componentName === "RouteStoryboard" || componentName === "HtmlStoryboard";
976
+ const isViewport = requiresFixedLayoutSize(componentName);
784
977
  if (expression.type !== "ObjectExpression") {
785
978
  return {
786
979
  value: isViewport ? DEFAULT_VIEWPORT_LAYOUT : DEFAULT_LAYOUT,
@@ -975,7 +1168,14 @@ function resolveMisimportedNamespaceSdkComponent(nameNode, imports, misimportedS
975
1168
  ) ?? null;
976
1169
  }
977
1170
  function isStoryboardSdkComponent(component) {
978
- return component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard";
1171
+ return component !== null && component !== "Canvas";
1172
+ }
1173
+ function formatAlternatives(items) {
1174
+ if (items.length <= 1) return items.join("");
1175
+ return `${items.slice(0, -1).join(", ")}, or ${items[items.length - 1]}`;
1176
+ }
1177
+ function requiresFixedLayoutSize(componentName) {
1178
+ return componentName === "RouteStoryboard" || componentName === "HtmlStoryboard" || componentName === "FlutterStoryboard";
979
1179
  }
980
1180
  function readImportedName(specifier) {
981
1181
  if (specifier.type === "ImportDefaultSpecifier") return "default";
@@ -988,7 +1188,10 @@ function readImportKind(specifier) {
988
1188
  return "named";
989
1189
  }
990
1190
  function isSdkImportSource(source) {
991
- return SDK_IMPORT_SOURCES.has(source) || source.endsWith("/tempo-sdk/canvas") || source.endsWith("/tempo-sdk/canvas/svelte") || source.endsWith("/tempo-sdk/canvas/astro");
1191
+ for (const sdkSource of SDK_IMPORT_SOURCES) {
1192
+ if (source === sdkSource || source.endsWith(`/${sdkSource}`)) return true;
1193
+ }
1194
+ return false;
992
1195
  }
993
1196
  function isWrongTempoSdkCanvasImportSource(source) {
994
1197
  return (source === "tempo-sdk" || source.startsWith("tempo-sdk/")) && !isSdkImportSource(source);
@@ -1036,30 +1239,58 @@ function moduleIdentity(file, specifier, resolved) {
1036
1239
  const target = bundled === void 0 ? specifier : bundled.replace(/\bt=\d{13}&?\b/, "").replace(/[?&]$/, "");
1037
1240
  if (target.startsWith("\0")) return target;
1038
1241
  const suffixAt = target.search(/[?#]/);
1039
- let path = (suffixAt < 0 ? target : target.slice(0, suffixAt)).replace(
1242
+ let path2 = (suffixAt < 0 ? target : target.slice(0, suffixAt)).replace(
1040
1243
  /\\/g,
1041
1244
  "/"
1042
1245
  );
1043
1246
  const suffix = suffixAt < 0 || target.endsWith(".astro?tempo-component") ? "" : target.slice(suffixAt);
1044
- if (bundled === void 0 && path.startsWith("."))
1045
- path = (0, import_node_path.resolve)((0, import_node_path.dirname)(file), path);
1046
- if (!(0, import_node_path.isAbsolute)(path) && !/^[A-Za-z]:\//.test(path)) return target;
1247
+ if (bundled === void 0 && path2.startsWith("."))
1248
+ path2 = (0, import_node_path2.resolve)((0, import_node_path2.dirname)(file), path2);
1249
+ if (!(0, import_node_path2.isAbsolute)(path2) && !/^[A-Za-z]:\//.test(path2)) return target;
1047
1250
  if (bundled !== void 0) {
1048
1251
  try {
1049
- path = import_node_fs.realpathSync.native(path);
1252
+ path2 = import_node_fs2.realpathSync.native(path2);
1050
1253
  } catch {
1051
1254
  }
1052
1255
  }
1053
- return (0, import_node_path.normalize)(path).replace(/\\/g, "/") + suffix;
1256
+ return (0, import_node_path2.normalize)(path2).replace(/\\/g, "/") + suffix;
1054
1257
  }
1055
- function canvasComponentAnnotations(file, source, resolved) {
1258
+ function canvasComponentAnnotations(file, source, resolved, hostRoot) {
1056
1259
  const result = /* @__PURE__ */ new Map();
1057
1260
  if (!source.includes("tempo-sdk/canvas")) return result;
1058
1261
  const parsed = parseCanvasFile(file, source);
1059
1262
  for (const board of parsed.storyboards) {
1060
- const ref = board.component;
1061
- if (board.kind !== "component" || !ref?.localName || board.openingElementSpan === void 0)
1263
+ if (board.kind !== "component" || board.openingElementSpan === void 0)
1062
1264
  continue;
1265
+ const flutterPreview = board.preview ? parseFlutterPreview(board.preview) : null;
1266
+ if (flutterPreview && !("error" in flutterPreview) && hostRoot) {
1267
+ let key;
1268
+ try {
1269
+ const absolute = (0, import_node_path2.resolve)(
1270
+ (0, import_node_path2.dirname)(canonicalPathAllowMissing(file)),
1271
+ flutterPreview.file
1272
+ );
1273
+ key = flutterPreviewKey(
1274
+ hostRoot,
1275
+ absolute,
1276
+ flutterPreview.functionName
1277
+ );
1278
+ } catch {
1279
+ continue;
1280
+ }
1281
+ result.set(board.openingElementSpan.start, {
1282
+ [FLUTTER_PREVIEW_KEY_ATTRIBUTE]: key,
1283
+ [COMPONENT_REFERENCE_ATTRIBUTE]: JSON.stringify([
1284
+ "flutter",
1285
+ key.slice(0, key.lastIndexOf("#")),
1286
+ flutterPreview.functionName
1287
+ ]),
1288
+ "data-tempo-external-component": "true"
1289
+ });
1290
+ continue;
1291
+ }
1292
+ const ref = board.component;
1293
+ if (!ref?.localName) continue;
1063
1294
  const member = ref.expression.match(
1064
1295
  /^\s*([$\w]+)(?:\s*\.\s*([$\w]+))?\s*$/
1065
1296
  );
@@ -1078,8 +1309,8 @@ function canvasComponentAnnotations(file, source, resolved) {
1078
1309
  name = ref.localName;
1079
1310
  }
1080
1311
  const specifier = ref.import?.source.replace(/\\/g, "/").replace(/[?#].*/, "");
1081
- const canvasDir = import_node_path.posix.dirname(file.replace(/\\/g, "/"));
1082
- const external = specifier !== void 0 && (!specifier.startsWith(".") || !import_node_path.posix.join(canvasDir, specifier).startsWith(`${canvasDir}/`));
1312
+ const canvasDir = import_node_path2.posix.dirname(file.replace(/\\/g, "/"));
1313
+ const external = specifier !== void 0 && (!specifier.startsWith(".") || !import_node_path2.posix.join(canvasDir, specifier).startsWith(`${canvasDir}/`));
1083
1314
  result.set(board.openingElementSpan.start, {
1084
1315
  [COMPONENT_REFERENCE_ATTRIBUTE]: JSON.stringify([
1085
1316
  ref.import ? "import" : "local",
@@ -1093,9 +1324,9 @@ function canvasComponentAnnotations(file, source, resolved) {
1093
1324
  }
1094
1325
 
1095
1326
  // nextjs-loader.ts
1096
- var import_node_fs5 = require("fs");
1327
+ var import_node_fs6 = require("fs");
1097
1328
  var import_node_module = require("module");
1098
- var import_node_path5 = require("path");
1329
+ var import_node_path6 = require("path");
1099
1330
 
1100
1331
  // ../../modules/annotation/annotate-file.ts
1101
1332
  var import_oxc_parser3 = require("oxc-parser");
@@ -1344,8 +1575,8 @@ function toHex8(n) {
1344
1575
  var import_oxc_parser4 = require("oxc-parser");
1345
1576
 
1346
1577
  // annotation-strategy.ts
1347
- var import_node_fs2 = require("fs");
1348
- var import_node_path2 = require("path");
1578
+ var import_node_fs3 = require("fs");
1579
+ var import_node_path3 = require("path");
1349
1580
  var HTML_VOID_ELEMENTS = /* @__PURE__ */ new Set([
1350
1581
  "area",
1351
1582
  "base",
@@ -1441,18 +1672,18 @@ function computeTempoAnnotatedProps(params) {
1441
1672
  }
1442
1673
 
1443
1674
  // host-identity.ts
1444
- var import_node_fs3 = require("fs");
1445
- var import_node_path3 = require("path");
1675
+ var import_node_fs4 = require("fs");
1676
+ var import_node_path4 = require("path");
1446
1677
 
1447
1678
  // package.json
1448
1679
  var package_default = {
1449
1680
  name: "tempo-sdk",
1450
- version: "0.0.69",
1681
+ version: "0.0.75",
1451
1682
  publishConfig: {
1452
1683
  tag: "sdk-v2-latest"
1453
1684
  },
1454
1685
  type: "module",
1455
- description: "Tempo SDK \u2014 Vite, Next.js, Expo, Svelte and Astro canvas integration, source annotations and storyboard types",
1686
+ description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
1456
1687
  repository: {
1457
1688
  type: "git",
1458
1689
  url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
@@ -1491,6 +1722,10 @@ var package_default = {
1491
1722
  types: "./dist/canvas/svelte.d.ts",
1492
1723
  import: "./dist/canvas/svelte.js"
1493
1724
  },
1725
+ "./canvas/vue": {
1726
+ types: "./dist/canvas/vue.d.ts",
1727
+ import: "./dist/canvas/vue.js"
1728
+ },
1494
1729
  "./canvas/interact-projection": {
1495
1730
  types: "./dist/canvas/interact-projection.d.ts",
1496
1731
  import: "./dist/canvas/interact-projection.js"
@@ -1524,6 +1759,10 @@ var package_default = {
1524
1759
  types: "./dist/nextjs/plugin.d.ts",
1525
1760
  import: "./dist/nextjs/plugin.js"
1526
1761
  },
1762
+ "./nuxt": {
1763
+ types: "./dist/nuxt.d.ts",
1764
+ import: "./dist/nuxt.js"
1765
+ },
1527
1766
  "./expo": {
1528
1767
  types: "./dist/expo-babel-plugin.d.ts",
1529
1768
  import: "./dist/expo-babel-plugin.js",
@@ -1538,9 +1777,21 @@ var package_default = {
1538
1777
  types: "./dist/svelte.d.ts",
1539
1778
  import: "./dist/svelte.js"
1540
1779
  },
1780
+ "./vue": {
1781
+ types: "./dist/vue.d.ts",
1782
+ import: "./dist/vue.js"
1783
+ },
1541
1784
  "./astro/asset-preview-client": {
1542
1785
  types: "./dist/astro/asset-preview-client.d.ts",
1543
1786
  import: "./dist/astro/asset-preview-client.js"
1787
+ },
1788
+ "./flutter-preview-path": {
1789
+ types: "./dist/flutter-preview-path.d.ts",
1790
+ import: "./dist/flutter-preview-path.js"
1791
+ },
1792
+ "./canvas/flutter-preview": {
1793
+ types: "./dist/canvas/flutter-preview.d.ts",
1794
+ import: "./dist/canvas/flutter-preview.js"
1544
1795
  }
1545
1796
  },
1546
1797
  files: [
@@ -1555,8 +1806,9 @@ var package_default = {
1555
1806
  prepublishOnly: "pnpm build",
1556
1807
  demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
1557
1808
  "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
1809
+ "demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
1558
1810
  test: "vitest run",
1559
- "test:browser": "vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts",
1811
+ "test:browser": "vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts",
1560
1812
  "test:watch": "vitest",
1561
1813
  "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
1562
1814
  "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
@@ -1573,10 +1825,13 @@ var package_default = {
1573
1825
  peerDependencies: {
1574
1826
  astro: "^7.0.0",
1575
1827
  "@babel/core": "^7.0.0",
1828
+ h3: "^1.12.0",
1576
1829
  next: "^13 || ^14 || ^15 || ^16",
1830
+ nuxt: "^3.18.0 || ^4.0.0",
1577
1831
  react: "^18 || ^19",
1578
1832
  svelte: "^5.0.0",
1579
- vite: "^5 || ^6 || ^7 || ^8"
1833
+ vite: "^5 || ^6 || ^7 || ^8",
1834
+ vue: "^3.3.0"
1580
1835
  },
1581
1836
  peerDependenciesMeta: {
1582
1837
  astro: {
@@ -1588,14 +1843,23 @@ var package_default = {
1588
1843
  "@babel/core": {
1589
1844
  optional: true
1590
1845
  },
1846
+ h3: {
1847
+ optional: true
1848
+ },
1591
1849
  next: {
1592
1850
  optional: true
1593
1851
  },
1852
+ nuxt: {
1853
+ optional: true
1854
+ },
1594
1855
  svelte: {
1595
1856
  optional: true
1596
1857
  },
1597
1858
  vite: {
1598
1859
  optional: true
1860
+ },
1861
+ vue: {
1862
+ optional: true
1599
1863
  }
1600
1864
  },
1601
1865
  devDependencies: {
@@ -1605,14 +1869,21 @@ var package_default = {
1605
1869
  "@modules/annotation": "workspace:*",
1606
1870
  "@modules/astro-editor": "workspace:*",
1607
1871
  "@modules/file-parser": "workspace:*",
1872
+ "@modules/frame-pool": "workspace:*",
1873
+ "@modules/iframe-projection": "workspace:*",
1608
1874
  "@modules/svelte-editor": "workspace:*",
1875
+ "@modules/vue-editor": "workspace:*",
1876
+ "@nuxt/kit": "^4.6.2",
1609
1877
  "@types/babel__core": "^7.20.5",
1610
1878
  "@types/node": "^25.0.8",
1611
1879
  "@types/react": "catalog:",
1612
1880
  "@types/react-dom": "catalog:",
1613
1881
  "@vitejs/plugin-react": "catalog:",
1882
+ "@vitejs/plugin-vue": "6.0.10",
1614
1883
  astro: "7.3.8",
1884
+ h3: "^1.15.11",
1615
1885
  "magic-string": "^0.30.21",
1886
+ nuxt: "^4.6.2",
1616
1887
  playwright: "^1.58.2",
1617
1888
  "react-dom": "catalog:",
1618
1889
  "react-dom18": "npm:react-dom@18.3.1",
@@ -1621,7 +1892,8 @@ var package_default = {
1621
1892
  tsup: "^8.5.1",
1622
1893
  typescript: "catalog:",
1623
1894
  vite: "catalog:",
1624
- vitest: "catalog:"
1895
+ vitest: "catalog:",
1896
+ vue: "3.5.44"
1625
1897
  }
1626
1898
  };
1627
1899
 
@@ -1652,7 +1924,7 @@ function readTempoWorkspaceNonce(root = process.cwd()) {
1652
1924
  if (fromEnvironment) return fromEnvironment;
1653
1925
  try {
1654
1926
  return normalizeWorkspaceNonce(
1655
- (0, import_node_fs3.readFileSync)((0, import_node_path3.resolve)(root, WORKSPACE_NONCE_RELATIVE_PATH), "utf-8")
1927
+ (0, import_node_fs4.readFileSync)((0, import_node_path4.resolve)(root, WORKSPACE_NONCE_RELATIVE_PATH), "utf-8")
1656
1928
  );
1657
1929
  } catch {
1658
1930
  return "";
@@ -1660,8 +1932,8 @@ function readTempoWorkspaceNonce(root = process.cwd()) {
1660
1932
  }
1661
1933
 
1662
1934
  // sdk-package-files.ts
1663
- var import_node_fs4 = require("fs");
1664
- var import_node_path4 = require("path");
1935
+ var import_node_fs5 = require("fs");
1936
+ var import_node_path5 = require("path");
1665
1937
  var SDK_PACKAGE_NAME = "tempo-sdk";
1666
1938
  var SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;
1667
1939
  function createSdkFileMatcher() {
@@ -1682,7 +1954,7 @@ function createSdkFileMatcher() {
1682
1954
  isSdk = manifest?.name === SDK_PACKAGE_NAME;
1683
1955
  break;
1684
1956
  }
1685
- const parent = (0, import_node_path4.dirname)(directory);
1957
+ const parent = (0, import_node_path5.dirname)(directory);
1686
1958
  if (parent === directory) break;
1687
1959
  directory = parent;
1688
1960
  }
@@ -1695,16 +1967,16 @@ function createSdkFileMatcher() {
1695
1967
  }
1696
1968
  let realFile = file;
1697
1969
  try {
1698
- realFile = import_node_fs4.realpathSync.native(file);
1970
+ realFile = import_node_fs5.realpathSync.native(file);
1699
1971
  } catch {
1700
1972
  }
1701
- return nearestPackageIsSdk((0, import_node_path4.dirname)(realFile));
1973
+ return nearestPackageIsSdk((0, import_node_path5.dirname)(realFile));
1702
1974
  };
1703
1975
  }
1704
1976
  function readPackageManifest(directory) {
1705
1977
  let text;
1706
1978
  try {
1707
- text = (0, import_node_fs4.readFileSync)((0, import_node_path4.join)(directory, "package.json"), "utf8");
1979
+ text = (0, import_node_fs5.readFileSync)((0, import_node_path5.join)(directory, "package.json"), "utf8");
1708
1980
  } catch {
1709
1981
  return void 0;
1710
1982
  }
@@ -1727,23 +1999,23 @@ function _resetLoaderState() {
1727
1999
  cachedUserComputeProps = void 0;
1728
2000
  cachedComputeModulePath = null;
1729
2001
  }
1730
- function stripQueryAndHash(path) {
1731
- const queryIdx = path.indexOf("?");
1732
- const hashIdx = path.indexOf("#");
1733
- let end = path.length;
2002
+ function stripQueryAndHash(path2) {
2003
+ const queryIdx = path2.indexOf("?");
2004
+ const hashIdx = path2.indexOf("#");
2005
+ let end = path2.length;
1734
2006
  if (queryIdx !== -1) end = Math.min(end, queryIdx);
1735
2007
  if (hashIdx !== -1) end = Math.min(end, hashIdx);
1736
- return path.slice(0, end);
2008
+ return path2.slice(0, end);
1737
2009
  }
1738
2010
  function resolveCanonicalRoot(rootContext) {
1739
2011
  try {
1740
- return import_node_fs5.realpathSync.native(rootContext);
2012
+ return import_node_fs6.realpathSync.native(rootContext);
1741
2013
  } catch {
1742
2014
  return rootContext;
1743
2015
  }
1744
2016
  }
1745
- function isInNodeModules(path) {
1746
- return path.includes(`${import_node_path5.sep}node_modules${import_node_path5.sep}`);
2017
+ function isInNodeModules(path2) {
2018
+ return path2.includes(`${import_node_path6.sep}node_modules${import_node_path6.sep}`);
1747
2019
  }
1748
2020
  function findFirstJSXElement(program, tagName) {
1749
2021
  let result = null;
@@ -1819,7 +2091,7 @@ function injectRootMetaIntoAnnotatedSource(annotatedSource, filename, root) {
1819
2091
  return injectRootMetaIntoSource(annotatedSource, filename, root);
1820
2092
  }
1821
2093
  function loadUserComputeProps(modulePath, canonicalRoot) {
1822
- const resolved = (0, import_node_path5.resolve)(canonicalRoot, modulePath);
2094
+ const resolved = (0, import_node_path6.resolve)(canonicalRoot, modulePath);
1823
2095
  const requireFromRoot = (0, import_node_module.createRequire)(`${canonicalRoot}/__tempo_loader__.js`);
1824
2096
  const mod = requireFromRoot(resolved);
1825
2097
  const fn = mod && (mod.default ?? mod);
@@ -1864,14 +2136,17 @@ function nextjsLoader(source) {
1864
2136
  cachedUserComputeProps = null;
1865
2137
  }
1866
2138
  const userComputeProps = cachedUserComputeProps;
1867
- const filepath = (0, import_node_path5.relative)(canonicalRoot, cleanPath);
1868
- const modifiedtsMs = Math.trunc((0, import_node_fs5.statSync)(cleanPath).mtimeMs);
2139
+ const filepath = (0, import_node_path6.relative)(canonicalRoot, cleanPath);
2140
+ const modifiedtsMs = Math.trunc((0, import_node_fs6.statSync)(cleanPath).mtimeMs);
1869
2141
  const sourceVersion = sourceVersionHash(source);
1870
- const componentReferences = canvasComponentAnnotations(cleanPath, source);
2142
+ const componentReferences = canvasComponentAnnotations(
2143
+ cleanPath,
2144
+ source,
2145
+ void 0,
2146
+ canonicalRoot
2147
+ );
1871
2148
  const annotated = annotateFile(source, cleanPath, (info) => ({
1872
- ...componentReferences.get(
1873
- info.element.openingElement.start
1874
- ),
2149
+ ...componentReferences.get(info.element.openingElement.start),
1875
2150
  ...computeTempoAnnotatedProps({
1876
2151
  info,
1877
2152
  filepath,