tempo-sdk 0.0.69 → 0.0.76

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 +24 -14
  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-3W4CVWTK.js} +49 -7
  25. package/dist/chunk-3W4CVWTK.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-5LUQSXSP.js +342 -0
  29. package/dist/chunk-5LUQSXSP.js.map +1 -0
  30. package/dist/{chunk-FE6TYCLF.js → chunk-5VIBKVFO.js} +2 -2
  31. package/dist/{chunk-FE6TYCLF.js.map → chunk-5VIBKVFO.js.map} +1 -1
  32. package/dist/{chunk-77DZCV5Z.js → chunk-CXIW4IKC.js} +2 -2
  33. package/dist/chunk-CYQE3TLC.js +37 -0
  34. package/dist/chunk-CYQE3TLC.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-GCGRJTTS.js +285 -0
  38. package/dist/chunk-GCGRJTTS.js.map +1 -0
  39. package/dist/{chunk-EYKOOLPL.js → chunk-GKDDNDG3.js} +1039 -134
  40. package/dist/chunk-GKDDNDG3.js.map +1 -0
  41. package/dist/{chunk-KOSJXE4G.js → chunk-H6BQZOAW.js} +4 -3
  42. package/dist/chunk-HOBTDB6G.js +112 -0
  43. package/dist/chunk-HOBTDB6G.js.map +1 -0
  44. package/dist/{chunk-WTQQOLXM.js → chunk-R3RYGAPB.js} +1571 -1410
  45. package/dist/chunk-R3RYGAPB.js.map +1 -0
  46. package/dist/chunk-SGN7BDRE.js +16 -0
  47. package/dist/chunk-SGN7BDRE.js.map +1 -0
  48. package/dist/{chunk-F23JGM4U.js → chunk-UBTL6JUF.js} +6 -2
  49. package/dist/{chunk-F23JGM4U.js.map → chunk-UBTL6JUF.js.map} +1 -1
  50. package/dist/{chunk-2JRAG36X.js → chunk-WBMO4ZYO.js} +2 -2
  51. package/dist/chunk-WBMO4ZYO.js.map +1 -0
  52. package/dist/{chunk-K3EYTZLL.js → chunk-WTXOWQ7N.js} +3 -1
  53. package/dist/chunk-WTXOWQ7N.js.map +1 -0
  54. package/dist/{chunk-Q2A46HHW.js → chunk-XFPFWTWX.js} +276 -43
  55. package/dist/chunk-XFPFWTWX.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
@@ -72,10 +72,16 @@ declare function HtmlStoryboard({ id, name, filepath, src, layout, vrt, ...annot
72
72
  * public component as the shell's parent, which the canvas reads as the
73
73
  * storyboard's root layer.
74
74
  */
75
- declare function StoryboardSlot({ children, id, kind, layout, name, route, filepath, src, vrt, uiFramework, }: {
75
+ declare function StoryboardSlot({ children, id, kind, layout, name, route, filepath, src, vrt, uiFramework, preview, previewKey, keepLayoutWhenParked, }: {
76
76
  "data-tempo-hide-fiber": "true";
77
77
  vrt?: boolean;
78
- uiFramework?: "svelte" | "astro";
78
+ uiFramework?: "svelte" | "vue" | "astro";
79
+ preview?: string;
80
+ previewKey?: string;
81
+ /** A parked (cached) board stays hidden but keeps its layout box instead of
82
+ * leaving layout. For content an engine renders from that box; see where
83
+ * the shell's `display` is chosen. */
84
+ keepLayoutWhenParked?: boolean;
79
85
  children?: ReactNode;
80
86
  id: string;
81
87
  kind: "component" | "route" | "html";
@@ -87,4 +93,4 @@ declare function StoryboardSlot({ children, id, kind, layout, name, route, filep
87
93
  src?: string;
88
94
  }): react.JSX.Element;
89
95
 
90
- export { HtmlStoryboard as H, LegacyStoryboardV1 as L, RouteStoryboard as R, Storyboard as S, type StoryboardLayout as a, StoryboardSlot as b, type StoryboardVrtConfig as c, type StoryboardVrtIgnoreRegion as d };
96
+ export { HtmlStoryboard as H, LegacyStoryboardV1 as L, RouteStoryboard as R, type StoryboardLayout as S, type StoryboardVrtConfig as a, Storyboard as b, StoryboardSlot as c, type StoryboardVrtIgnoreRegion as d };
package/dist/svelte.d.ts CHANGED
@@ -11,8 +11,10 @@ import { PreprocessorGroup } from 'svelte/compiler';
11
11
  interface TempoSveltePreprocessOptions {
12
12
  /** Annotation identity root. Defaults to the process working directory. */
13
13
  root?: string;
14
- /** Allowed source boundary. Defaults to `root`; host sidecars set this to
15
- * the app root while annotations remain relative to the host root. */
14
+ /** Allowed source boundary. Defaults to the package-manager workspace
15
+ * around `root`, else `root` (see defaultSourceRoot); host sidecars set
16
+ * this to the project root while annotations remain relative to the host
17
+ * root. */
16
18
  sourceRoot?: string;
17
19
  /** Override the normal TEMPO environment gate, primarily for tests. */
18
20
  enabled?: boolean;
package/dist/svelte.js CHANGED
@@ -1,83 +1,26 @@
1
+ import {
2
+ applyStringEdits,
3
+ defaultSourceRoot,
4
+ mapOffsetThroughStringEdits,
5
+ readModifiedTs,
6
+ resolveAnnotationIdentity
7
+ } from "./chunk-HOBTDB6G.js";
1
8
  import {
2
9
  MagicString
3
10
  } from "./chunk-JVVHU3A7.js";
4
11
  import {
5
12
  appendModuleVersionRecord
6
- } from "./chunk-F23JGM4U.js";
13
+ } from "./chunk-UBTL6JUF.js";
7
14
  import {
8
15
  sourceVersionHash
9
- } from "./chunk-KOSJXE4G.js";
16
+ } from "./chunk-H6BQZOAW.js";
10
17
 
11
18
  // svelte.ts
12
- import { readFileSync, statSync } from "fs";
13
- import { isAbsolute, relative, resolve } from "path";
14
-
15
- // ../../modules/svelte-editor/annotate.ts
16
- import { compile as compile2 } from "svelte/compiler";
19
+ import { readFileSync } from "fs";
20
+ import { resolve } from "path";
17
21
 
18
- // ../../modules/svelte-editor/edits.ts
19
- var InvalidStringEditError = class extends Error {
20
- constructor(message) {
21
- super(message);
22
- this.name = "InvalidStringEditError";
23
- }
24
- };
25
- function applyStringEdits(source, edits) {
26
- const sorted = validateStringEdits(source, edits);
27
- let nextSource = source;
28
- for (const edit of sorted) {
29
- nextSource = nextSource.slice(0, edit.start) + edit.replacement + nextSource.slice(edit.end);
30
- }
31
- return nextSource;
32
- }
33
- function validateStringEdits(source, edits) {
34
- return validateEditShape(edits, source.length);
35
- }
36
- function validateEditShape(edits, sourceLength) {
37
- const sorted = [...edits].sort(
38
- (left, right) => right.start - left.start || right.end - left.end
39
- );
40
- for (const edit of sorted) {
41
- if (!Number.isInteger(edit.start) || !Number.isInteger(edit.end)) {
42
- throw new InvalidStringEditError("edit offsets must be integers");
43
- }
44
- if (edit.start < 0 || edit.end < edit.start || sourceLength !== void 0 && edit.end > sourceLength) {
45
- throw new InvalidStringEditError(
46
- sourceLength === void 0 ? `edit [${edit.start}, ${edit.end}) is not a valid source range` : `edit [${edit.start}, ${edit.end}) is outside source length ${sourceLength}`
47
- );
48
- }
49
- }
50
- for (let index = 0; index < sorted.length - 1; index += 1) {
51
- const later = sorted[index];
52
- const earlier = sorted[index + 1];
53
- if (!later || !earlier) continue;
54
- if (earlier.start === later.start && (earlier.start === earlier.end || later.start === later.end)) {
55
- throw new InvalidStringEditError(
56
- `an insertion and another edit at offset ${earlier.start} have ambiguous order`
57
- );
58
- }
59
- if (earlier.end > later.start) {
60
- throw new InvalidStringEditError(
61
- `edits [${earlier.start}, ${earlier.end}) and [${later.start}, ${later.end}) overlap`
62
- );
63
- }
64
- }
65
- return sorted;
66
- }
67
- function mapOffsetThroughStringEdits(offset, edits) {
68
- if (!Number.isInteger(offset) || offset < 0) {
69
- throw new InvalidStringEditError(
70
- "the mapped source offset must be a non-negative integer"
71
- );
72
- }
73
- let delta = 0;
74
- for (const edit of [...validateEditShape(edits)].reverse()) {
75
- if (offset < edit.start) break;
76
- if (offset < edit.end) return null;
77
- delta += edit.replacement.length - (edit.end - edit.start);
78
- }
79
- return offset + delta;
80
- }
22
+ // ../../modules/svelte-editor/compiler.ts
23
+ import { compile, parse } from "svelte/compiler";
81
24
 
82
25
  // ../../modules/svelte-editor/escape.ts
83
26
  function escapeSvelteAttributeValue(value, quote) {
@@ -239,7 +182,6 @@ function walk(ast, { enter, leave }) {
239
182
  }
240
183
 
241
184
  // ../../modules/svelte-editor/parse.ts
242
- import { compile, parse } from "svelte/compiler";
243
185
  function parseSvelteSourceInternal(source, filename, validation = "compiler") {
244
186
  const cacheKey = `${validation}\0${filename}\0${source}`;
245
187
  const cached = parseCache.get(cacheKey);
@@ -616,7 +558,7 @@ function annotateSvelteSource(options) {
616
558
  const code = applyStringEdits(inputSource, transformEdits);
617
559
  try {
618
560
  if (validation === "compiler") {
619
- compile2(code, { filename: options.filename, generate: false });
561
+ compile(code, { filename: options.filename, generate: false });
620
562
  } else {
621
563
  const parsedOutput = parseSvelteSourceInternal(
622
564
  code,
@@ -839,31 +781,22 @@ function serializeAnnotations(metadata) {
839
781
  ).join("");
840
782
  }
841
783
 
842
- // ../../modules/svelte-editor/plan.ts
843
- import { compile as compile3, parse as parse2 } from "svelte/compiler";
844
-
845
- // ../../modules/svelte-editor/transfer.ts
846
- import { parse as parse3 } from "svelte/compiler";
784
+ // ../../modules/svelte-editor/markup-transfer.ts
785
+ import { parse as parse2 } from "svelte/compiler";
847
786
 
848
787
  // svelte.ts
849
788
  var MODULE_SCRIPT = /<script\b[^>]*\b(?:module\b|context\s*=\s*["']module["'])[^>]*>/;
850
789
  function tempoSveltePreprocess(options = {}) {
851
790
  const root = resolve(options.root ?? process.cwd());
852
- const sourceRoot = resolve(options.sourceRoot ?? root);
791
+ const sourceRoot = resolve(options.sourceRoot ?? defaultSourceRoot(root));
853
792
  const enabled = options.enabled ?? Boolean(process.env.TEMPO);
854
793
  const metadata = ({ filename }) => {
855
794
  if (!enabled || !filename) return null;
856
- const absoluteFilename = resolve(filename);
857
- if (!absoluteFilename.endsWith(".svelte")) return null;
858
- const sourcePath = relative(sourceRoot, absoluteFilename);
859
- if (!sourcePath || sourcePath.startsWith("../") || isAbsolute(sourcePath) || sourcePath.split(/[\\/]/).includes("node_modules")) {
860
- return null;
861
- }
862
- const filepath = relative(root, absoluteFilename).replace(/\\/g, "/");
863
- if (!filepath || isAbsolute(filepath)) return null;
795
+ const identity = resolveAnnotationIdentity(filename, { root, sourceRoot });
796
+ if (!identity?.absoluteFilename.endsWith(".svelte")) return null;
864
797
  return {
865
- filepath,
866
- modifiedTs: Math.trunc(statSync(absoluteFilename).mtimeMs)
798
+ filepath: identity.filepath,
799
+ modifiedTs: readModifiedTs(identity.absoluteFilename)
867
800
  };
868
801
  };
869
802
  const annotation = createSvelteAnnotationPreprocessor({ metadata });