tempo-sdk 0.0.57 → 0.0.66

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 (108) hide show
  1. package/astro/client.d.ts +4 -0
  2. package/dist/assets/editor.js +1 -1
  3. package/dist/assets/index.d.ts +10 -63
  4. package/dist/assets/index.js +12 -32
  5. package/dist/assets/index.js.map +1 -1
  6. package/dist/assets/parser.js +1 -1
  7. package/dist/astro/asset-preview-client.d.ts +4 -0
  8. package/dist/astro/asset-preview-client.js +93 -0
  9. package/dist/astro/asset-preview-client.js.map +1 -0
  10. package/dist/astro/controls.d.ts +7 -0
  11. package/dist/astro/controls.js +7 -0
  12. package/dist/astro/controls.js.map +1 -0
  13. package/dist/astro/document-client.d.ts +10 -0
  14. package/dist/astro/document-client.js +78 -0
  15. package/dist/astro/document-client.js.map +1 -0
  16. package/dist/astro/runtime.d.ts +15 -0
  17. package/dist/astro/runtime.js +86 -0
  18. package/dist/astro/runtime.js.map +1 -0
  19. package/dist/astro.d.ts +21 -0
  20. package/dist/astro.js +749 -0
  21. package/dist/astro.js.map +1 -0
  22. package/dist/canvas/astro-contract.d.ts +21 -0
  23. package/dist/canvas/astro-contract.js +9 -0
  24. package/dist/canvas/astro-contract.js.map +1 -0
  25. package/dist/canvas/astro.d.ts +18 -0
  26. package/dist/canvas/astro.js +42 -0
  27. package/dist/canvas/astro.js.map +1 -0
  28. package/dist/canvas/editor.d.ts +1 -1
  29. package/dist/canvas/editor.js +3 -2
  30. package/dist/canvas/editor.js.map +1 -1
  31. package/dist/canvas/index.d.ts +4 -2
  32. package/dist/canvas/index.js +138 -34
  33. package/dist/canvas/index.js.map +1 -1
  34. package/dist/canvas/interact-projection.js +4 -4
  35. package/dist/canvas/parser.d.ts +3 -1
  36. package/dist/canvas/parser.js +1 -1
  37. package/dist/canvas/svelte.d.ts +1 -1
  38. package/dist/canvas/svelte.js +3 -3
  39. package/dist/{chunk-5BHIHP25.js → chunk-2JRAG36X.js} +37 -11
  40. package/dist/chunk-2JRAG36X.js.map +1 -0
  41. package/dist/{chunk-N2TYN3RB.js → chunk-6AAE4LYV.js} +123 -123
  42. package/dist/chunk-6AAE4LYV.js.map +1 -0
  43. package/dist/{chunk-U3SLJNRS.js → chunk-6IR5JY6W.js} +106 -7
  44. package/dist/chunk-6IR5JY6W.js.map +1 -0
  45. package/dist/{chunk-QXL6GL2P.js → chunk-6W6UKDSY.js} +46 -5
  46. package/dist/chunk-6W6UKDSY.js.map +1 -0
  47. package/dist/chunk-77DZCV5Z.js +38 -0
  48. package/dist/chunk-77DZCV5Z.js.map +1 -0
  49. package/dist/chunk-DELFOKU3.js +2495 -0
  50. package/dist/chunk-DELFOKU3.js.map +1 -0
  51. package/dist/{chunk-U64AHDHZ.js → chunk-EYKOOLPL.js} +380 -34
  52. package/dist/chunk-EYKOOLPL.js.map +1 -0
  53. package/dist/chunk-F23JGM4U.js +107 -0
  54. package/dist/chunk-F23JGM4U.js.map +1 -0
  55. package/dist/chunk-FE6TYCLF.js +1514 -0
  56. package/dist/chunk-FE6TYCLF.js.map +1 -0
  57. package/dist/chunk-H6OZIX2U.js +133 -0
  58. package/dist/chunk-H6OZIX2U.js.map +1 -0
  59. package/dist/chunk-JVVHU3A7.js +1077 -0
  60. package/dist/chunk-JVVHU3A7.js.map +1 -0
  61. package/dist/{chunk-2IQD2KPS.js → chunk-KOSJXE4G.js} +3 -102
  62. package/dist/chunk-KOSJXE4G.js.map +1 -0
  63. package/dist/{chunk-TL4MGN7E.js → chunk-NSKYOKG5.js} +254 -10
  64. package/dist/chunk-NSKYOKG5.js.map +1 -0
  65. package/dist/chunk-OX2YKYSL.js +13 -0
  66. package/dist/chunk-OX2YKYSL.js.map +1 -0
  67. package/dist/{chunk-RHHVVWAC.js → chunk-PXDTH36X.js} +14 -12
  68. package/dist/chunk-PXDTH36X.js.map +1 -0
  69. package/dist/{chunk-XLEKCOB7.js → chunk-PYAJHLXO.js} +56 -1
  70. package/dist/chunk-PYAJHLXO.js.map +1 -0
  71. package/dist/{chunk-EMYYTS6D.js → chunk-Q2A46HHW.js} +19 -14
  72. package/dist/chunk-Q2A46HHW.js.map +1 -0
  73. package/dist/controls-reader-SNMI2UY7.js +191 -0
  74. package/dist/controls-reader-SNMI2UY7.js.map +1 -0
  75. package/dist/controls-uCaQ3CNX.d.ts +61 -0
  76. package/dist/expo/plugin.cjs +18 -13
  77. package/dist/expo/plugin.cjs.map +1 -1
  78. package/dist/expo/plugin.js +1 -1
  79. package/dist/expo-babel-plugin.cjs +18 -13
  80. package/dist/expo-babel-plugin.cjs.map +1 -1
  81. package/dist/expo-babel-plugin.js +1 -1
  82. package/dist/index.d.ts +4 -0
  83. package/dist/index.js +10 -2294
  84. package/dist/index.js.map +1 -1
  85. package/dist/nextjs/plugin.cjs +45 -4
  86. package/dist/nextjs/plugin.cjs.map +1 -1
  87. package/dist/nextjs/plugin.js +1 -1
  88. package/dist/nextjs-loader.cjs +63 -17
  89. package/dist/nextjs-loader.cjs.map +1 -1
  90. package/dist/nextjs.cjs +45 -4
  91. package/dist/nextjs.cjs.map +1 -1
  92. package/dist/nextjs.d.cts +4 -4
  93. package/dist/nextjs.d.ts +4 -4
  94. package/dist/nextjs.js +1 -1
  95. package/dist/{storyboard-BtQuVGpl.d.ts → storyboard-4YdTYq_e.d.ts} +3 -1
  96. package/dist/svelte.js +7 -1075
  97. package/dist/svelte.js.map +1 -1
  98. package/package.json +45 -4
  99. package/dist/chunk-2IQD2KPS.js.map +0 -1
  100. package/dist/chunk-5BHIHP25.js.map +0 -1
  101. package/dist/chunk-EMYYTS6D.js.map +0 -1
  102. package/dist/chunk-N2TYN3RB.js.map +0 -1
  103. package/dist/chunk-QXL6GL2P.js.map +0 -1
  104. package/dist/chunk-RHHVVWAC.js.map +0 -1
  105. package/dist/chunk-TL4MGN7E.js.map +0 -1
  106. package/dist/chunk-U3SLJNRS.js.map +0 -1
  107. package/dist/chunk-U64AHDHZ.js.map +0 -1
  108. package/dist/chunk-XLEKCOB7.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tempoExpoBabelPlugin
3
- } from "../chunk-EMYYTS6D.js";
3
+ } from "../chunk-Q2A46HHW.js";
4
4
  export {
5
5
  tempoExpoBabelPlugin as default,
6
6
  tempoExpoBabelPlugin
@@ -33,12 +33,14 @@ var import_node_path = require("path");
33
33
  var import_oxc_parser = require("oxc-parser");
34
34
  var SDK_IMPORT_SOURCES = /* @__PURE__ */ new Set([
35
35
  "tempo-sdk/canvas",
36
- "tempo-sdk/canvas/svelte"
36
+ "tempo-sdk/canvas/svelte",
37
+ "tempo-sdk/canvas/astro"
37
38
  ]);
38
39
  var SDK_COMPONENTS = /* @__PURE__ */ new Set([
39
40
  "Canvas",
40
41
  "Storyboard",
41
42
  "SvelteStoryboard",
43
+ "AstroStoryboard",
42
44
  "LegacyStoryboardV1",
43
45
  "RouteStoryboard",
44
46
  "HtmlStoryboard"
@@ -430,7 +432,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
430
432
  }
431
433
  ])
432
434
  } : readLayout(openingElement, component);
433
- const kind = component === "Storyboard" || component === "SvelteStoryboard" || component === "LegacyStoryboardV1" ? "component" : component === "RouteStoryboard" ? "route" : "html";
435
+ const kind = component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" ? "component" : component === "RouteStoryboard" ? "route" : "html";
434
436
  if (!id) {
435
437
  errors.push({
436
438
  message: `<${component}> must include a literal "id" prop`,
@@ -445,7 +447,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
445
447
  storyboardKey: id?.value ?? "",
446
448
  displayName: name?.value ?? legacyObject?.displayName,
447
449
  kind,
448
- ...component === "SvelteStoryboard" ? { uiFramework: "svelte" } : {},
450
+ ...component === "SvelteStoryboard" ? { uiFramework: "svelte" } : component === "AstroStoryboard" ? { runtimeFramework: "astro" } : {},
449
451
  layout: layout.value,
450
452
  editable: Boolean(id) && layout.errors.length === 0,
451
453
  jsxElementSpan: toSpan(element) ?? { start: 0, end: 0 },
@@ -468,7 +470,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
468
470
  } : void 0,
469
471
  errors
470
472
  };
471
- if (component === "Storyboard" || component === "SvelteStoryboard") {
473
+ if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard") {
472
474
  const componentReference = readComponentReference(
473
475
  openingElement,
474
476
  imports,
@@ -484,7 +486,7 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
484
486
  });
485
487
  }
486
488
  }
487
- if (component === "Storyboard" || component === "SvelteStoryboard" || component === "HtmlStoryboard") {
489
+ if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "HtmlStoryboard") {
488
490
  const vrt = readVrt(openingElement, errors);
489
491
  if (vrt) {
490
492
  if (vrt.value) {
@@ -510,13 +512,13 @@ function readStoryboard(element, component, imports, legacyObjects, source, glob
510
512
  if (component === "HtmlStoryboard") {
511
513
  const filepath = readStringAttribute(openingElement, "filepath");
512
514
  const src = readStringAttribute(openingElement, "src");
513
- storyboard.filepath = filepath?.value;
515
+ storyboard.filepath = filepath?.value.trim() ? filepath.value : void 0;
514
516
  storyboard.filepathSpan = filepath?.valueSpan;
515
517
  storyboard.filepathAttributeSpan = filepath?.attributeSpan;
516
518
  storyboard.src = src?.value;
517
519
  storyboard.srcSpan = src?.valueSpan;
518
520
  storyboard.srcAttributeSpan = src?.attributeSpan;
519
- if (!filepath && !src) {
521
+ if (!filepath?.value.trim() && !src?.value.trim()) {
520
522
  errors.push({
521
523
  message: '<HtmlStoryboard> must include a literal "filepath" or "src" prop',
522
524
  span: toSpan(openingElement),
@@ -583,12 +585,12 @@ function validateCanvasChildren(canvasElement, imports) {
583
585
  child.openingElement?.name,
584
586
  imports
585
587
  );
586
- if (component === "Storyboard" || component === "SvelteStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard") {
588
+ if (component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard") {
587
589
  continue;
588
590
  }
589
591
  }
590
592
  errors.push({
591
- message: "<Canvas> children must be <Storyboard>, <SvelteStoryboard>, <RouteStoryboard>, <HtmlStoryboard>, or <LegacyStoryboardV1> declarations",
593
+ message: "<Canvas> children must be <Storyboard>, <SvelteStoryboard>, <AstroStoryboard>, <RouteStoryboard>, <HtmlStoryboard>, or <LegacyStoryboardV1> declarations",
592
594
  span: toSpan(child),
593
595
  kind: "structural"
594
596
  });
@@ -960,7 +962,7 @@ function resolveMisimportedNamespaceSdkComponent(nameNode, imports, misimportedS
960
962
  ) ?? null;
961
963
  }
962
964
  function isStoryboardSdkComponent(component) {
963
- return component === "Storyboard" || component === "SvelteStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard";
965
+ return component === "Storyboard" || component === "SvelteStoryboard" || component === "AstroStoryboard" || component === "LegacyStoryboardV1" || component === "RouteStoryboard" || component === "HtmlStoryboard";
964
966
  }
965
967
  function readImportedName(specifier) {
966
968
  if (specifier.type === "ImportDefaultSpecifier") return "default";
@@ -973,7 +975,7 @@ function readImportKind(specifier) {
973
975
  return "named";
974
976
  }
975
977
  function isSdkImportSource(source) {
976
- return SDK_IMPORT_SOURCES.has(source) || source.endsWith("/tempo-sdk/canvas") || source.endsWith("/tempo-sdk/canvas/svelte");
978
+ return SDK_IMPORT_SOURCES.has(source) || source.endsWith("/tempo-sdk/canvas") || source.endsWith("/tempo-sdk/canvas/svelte") || source.endsWith("/tempo-sdk/canvas/astro");
977
979
  }
978
980
  function isWrongTempoSdkCanvasImportSource(source) {
979
981
  return (source === "tempo-sdk" || source.startsWith("tempo-sdk/")) && !isSdkImportSource(source);
@@ -1014,7 +1016,10 @@ function walk(node, visitor, seen = /* @__PURE__ */ new Set()) {
1014
1016
  // canvas-component-reference.ts
1015
1017
  var COMPONENT_REFERENCE_ATTRIBUTE = "data-tempo-component-reference";
1016
1018
  function moduleIdentity(file, specifier, resolved) {
1017
- const bundled = resolved?.get(specifier);
1019
+ const resolvedId = resolved?.get(specifier);
1020
+ const bundled = resolvedId?.startsWith("\0tempo:astro-component:") ? decodeURIComponent(
1021
+ resolvedId.slice("\0tempo:astro-component:".length, -3)
1022
+ ) : resolvedId;
1018
1023
  const target = bundled === void 0 ? specifier : bundled.replace(/\bt=\d{13}&?\b/, "").replace(/[?&]$/, "");
1019
1024
  if (target.startsWith("\0")) return target;
1020
1025
  const suffixAt = target.search(/[?#]/);
@@ -1022,7 +1027,7 @@ function moduleIdentity(file, specifier, resolved) {
1022
1027
  /\\/g,
1023
1028
  "/"
1024
1029
  );
1025
- const suffix = suffixAt < 0 ? "" : target.slice(suffixAt);
1030
+ const suffix = suffixAt < 0 || target.endsWith(".astro?tempo-component") ? "" : target.slice(suffixAt);
1026
1031
  if (bundled === void 0 && path.startsWith("."))
1027
1032
  path = (0, import_node_path.resolve)((0, import_node_path.dirname)(file), path);
1028
1033
  if (!(0, import_node_path.isAbsolute)(path) && !/^[A-Za-z]:\//.test(path)) return target;