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
@@ -0,0 +1,86 @@
1
+ // astro/runtime.ts
2
+ import { markHTMLString } from "astro/runtime/server/index.js";
3
+ var CALLSITE_PROP = "__tempo_astro_callsite__";
4
+ var definition = /* @__PURE__ */ Symbol.for("tempo.astro.definition");
5
+ var template = /* @__PURE__ */ Symbol.for("astro.renderTemplateResult");
6
+ var headAndContent = /* @__PURE__ */ Symbol.for("astro.headAndContent");
7
+ function instrumentFrameworkComponent(component, metadata) {
8
+ if ((typeof component === "function" || component && typeof component === "object" && "$$typeof" in component) && Object.isExtensible(component) && !Object.prototype.hasOwnProperty.call(component, definition))
9
+ Object.defineProperty(component, definition, { value: metadata });
10
+ return component;
11
+ }
12
+ function astroHostId() {
13
+ return globalThis.crypto.randomUUID();
14
+ }
15
+ function comment(kind, data) {
16
+ return `<!--tempo:astro:${kind}${data === void 0 ? "" : `:${encodeURIComponent(JSON.stringify(data)).replaceAll("-", "%2D")}`}-->`;
17
+ }
18
+ function thenOrValue(value, fn) {
19
+ return value && typeof value.then === "function" ? Promise.resolve(value).then(fn) : fn(value);
20
+ }
21
+ function withReceipt(value, metadata) {
22
+ if (!value || typeof value !== "object") return value;
23
+ if (value[headAndContent] && value.content) {
24
+ return { ...value, content: withReceipt(value.content, metadata) };
25
+ }
26
+ if (!value[template]) return value;
27
+ const parts = [...value.htmlParts];
28
+ parts[parts.length - 1] += comment("m", metadata);
29
+ return Object.assign(Object.create(Object.getPrototypeOf(value)), value, {
30
+ htmlParts: parts
31
+ });
32
+ }
33
+ function instrumentCreateComponent(original, metadata) {
34
+ return (...args) => {
35
+ const wrap = (factory) => function(...factoryArgs) {
36
+ return thenOrValue(
37
+ factory.apply(this, factoryArgs),
38
+ (value) => withReceipt(value, metadata)
39
+ );
40
+ };
41
+ const first = args[0];
42
+ const component = typeof first === "function" ? original(wrap(first), ...args.slice(1)) : original(
43
+ { ...first, factory: wrap(first.factory) },
44
+ ...args.slice(1)
45
+ );
46
+ Object.defineProperty(component, definition, { value: metadata });
47
+ return component;
48
+ };
49
+ }
50
+ function instrumentRenderComponent(original) {
51
+ return (result, displayName, component, props = {}, ...rest) => {
52
+ const source = props[CALLSITE_PROP];
53
+ if (!source)
54
+ return original(result, displayName, component, props, ...rest);
55
+ const cleanProps = { ...props };
56
+ delete cleanProps[CALLSITE_PROP];
57
+ return thenOrValue(
58
+ original(result, displayName, component, cleanProps, ...rest),
59
+ (instance) => ({
60
+ render(destination) {
61
+ const occurrence = astroHostId();
62
+ destination.write(
63
+ markHTMLString(
64
+ comment("b", {
65
+ occurrence,
66
+ source,
67
+ definition: component?.[definition] ?? null
68
+ })
69
+ )
70
+ );
71
+ return thenOrValue(
72
+ instance.render(destination),
73
+ () => destination.write(markHTMLString(comment("e", { occurrence })))
74
+ );
75
+ }
76
+ })
77
+ );
78
+ };
79
+ }
80
+ export {
81
+ astroHostId,
82
+ instrumentCreateComponent,
83
+ instrumentFrameworkComponent,
84
+ instrumentRenderComponent
85
+ };
86
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../astro/runtime.ts"],"sourcesContent":["/** Server-only Astro 7 adapter. It has no producer, browser hooks or request-global state. */\nimport { markHTMLString } from \"astro/runtime/server/index.js\";\nimport type {\n AstroCallsiteSource,\n AstroModuleSource,\n} from \"@modules/astro-editor\";\n\nconst CALLSITE_PROP = \"__tempo_astro_callsite__\";\nconst definition = Symbol.for(\"tempo.astro.definition\");\nconst template = Symbol.for(\"astro.renderTemplateResult\");\nconst headAndContent = Symbol.for(\"astro.headAndContent\");\n\n/** Attach the defining module's exact transform receipt to server component\n * exports. Re-exports keep the original receipt, and client modules are never\n * transformed by this path. No request-global component registry is needed. */\nexport function instrumentFrameworkComponent<T>(\n component: T,\n metadata: AstroModuleSource & { exportName?: string },\n): T {\n if (\n (typeof component === \"function\" ||\n (component &&\n typeof component === \"object\" &&\n \"$$typeof\" in component)) &&\n Object.isExtensible(component) &&\n !Object.prototype.hasOwnProperty.call(component, definition)\n )\n Object.defineProperty(component, definition, { value: metadata });\n return component;\n}\n\ntype Destination = { write(chunk: unknown): void };\ntype RenderInstance = { render(destination: Destination): unknown };\ntype AnyFunction = (...args: any[]) => any;\n\n/** Each server-emitted occurrence gets a token. Browser clones copy it, not its ownership. */\nexport function astroHostId(): string {\n return globalThis.crypto.randomUUID();\n}\n\n/** Escapes hyphens too: a filename containing `-->` must not terminate a comment. */\nfunction comment(kind: string, data?: unknown): string {\n return `<!--tempo:astro:${kind}${data === undefined ? \"\" : `:${encodeURIComponent(JSON.stringify(data)).replaceAll(\"-\", \"%2D\")}`}-->`;\n}\n\nfunction thenOrValue<T, R>(\n value: T | Promise<T>,\n fn: (value: T) => R,\n): R | Promise<R> {\n return value && typeof (value as Promise<T>).then === \"function\"\n ? Promise.resolve(value).then(fn)\n : fn(value as T);\n}\n\nfunction withReceipt(value: any, metadata: AstroModuleSource): any {\n if (!value || typeof value !== \"object\") return value;\n if (value[headAndContent] && value.content) {\n return { ...value, content: withReceipt(value.content, metadata) };\n }\n if (!value[template]) return value;\n // Astro's streaming engine reads htmlParts directly, bypassing render(). Keep\n // its template/async/head semantics and append the receipt after successful output.\n const parts = [...value.htmlParts];\n parts[parts.length - 1] += comment(\"m\", metadata);\n return Object.assign(Object.create(Object.getPrototypeOf(value)), value, {\n htmlParts: parts,\n });\n}\n\nexport function instrumentCreateComponent(\n original: AnyFunction,\n metadata: AstroModuleSource,\n): AnyFunction {\n return (...args: any[]) => {\n const wrap = (factory: AnyFunction) =>\n function (this: unknown, ...factoryArgs: any[]) {\n return thenOrValue(factory.apply(this, factoryArgs), (value) =>\n withReceipt(value, metadata),\n );\n };\n const first = args[0];\n const component =\n typeof first === \"function\"\n ? original(wrap(first), ...args.slice(1))\n : original(\n { ...first, factory: wrap(first.factory) },\n ...args.slice(1),\n );\n Object.defineProperty(component, definition, { value: metadata });\n return component;\n };\n}\n\nexport function instrumentRenderComponent(original: AnyFunction): AnyFunction {\n return (\n result: unknown,\n displayName: string,\n component: any,\n props: Record<string, unknown> = {},\n ...rest: unknown[]\n ) => {\n const source = props[CALLSITE_PROP] as AstroCallsiteSource | undefined;\n if (!source)\n return original(result, displayName, component, props, ...rest);\n const cleanProps = { ...props };\n delete cleanProps[CALLSITE_PROP];\n // Call the real helper immediately: eager slots and head propagation registration\n // must occur in Astro's original order. Only emission is bracketed by comments.\n return thenOrValue(\n original(result, displayName, component, cleanProps, ...rest),\n (instance: RenderInstance) => ({\n render(destination: Destination) {\n const occurrence = astroHostId();\n destination.write(\n markHTMLString(\n comment(\"b\", {\n occurrence,\n source,\n definition: component?.[definition] ?? null,\n }),\n ),\n );\n return thenOrValue(instance.render(destination), () =>\n destination.write(markHTMLString(comment(\"e\", { occurrence }))),\n );\n },\n }),\n );\n };\n}\n"],"mappings":";AACA,SAAS,sBAAsB;AAM/B,IAAM,gBAAgB;AACtB,IAAM,aAAa,uBAAO,IAAI,wBAAwB;AACtD,IAAM,WAAW,uBAAO,IAAI,4BAA4B;AACxD,IAAM,iBAAiB,uBAAO,IAAI,sBAAsB;AAKjD,SAAS,6BACd,WACA,UACG;AACH,OACG,OAAO,cAAc,cACnB,aACC,OAAO,cAAc,YACrB,cAAc,cAClB,OAAO,aAAa,SAAS,KAC7B,CAAC,OAAO,UAAU,eAAe,KAAK,WAAW,UAAU;AAE3D,WAAO,eAAe,WAAW,YAAY,EAAE,OAAO,SAAS,CAAC;AAClE,SAAO;AACT;AAOO,SAAS,cAAsB;AACpC,SAAO,WAAW,OAAO,WAAW;AACtC;AAGA,SAAS,QAAQ,MAAc,MAAwB;AACrD,SAAO,mBAAmB,IAAI,GAAG,SAAS,SAAY,KAAK,IAAI,mBAAmB,KAAK,UAAU,IAAI,CAAC,EAAE,WAAW,KAAK,KAAK,CAAC,EAAE;AAClI;AAEA,SAAS,YACP,OACA,IACgB;AAChB,SAAO,SAAS,OAAQ,MAAqB,SAAS,aAClD,QAAQ,QAAQ,KAAK,EAAE,KAAK,EAAE,IAC9B,GAAG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,WAAW,aAAa;AAG/B,WAAO;AAAA,MACL,SAAS,QAAQ,aAAa,WAAW,YAAY,GAAG,IAAI;AAAA,MAC5D,CAAC,cAA8B;AAAA,QAC7B,OAAO,aAA0B;AAC/B,gBAAM,aAAa,YAAY;AAC/B,sBAAY;AAAA,YACV;AAAA,cACE,QAAQ,KAAK;AAAA,gBACX;AAAA,gBACA;AAAA,gBACA,YAAY,YAAY,UAAU,KAAK;AAAA,cACzC,CAAC;AAAA,YACH;AAAA,UACF;AACA,iBAAO;AAAA,YAAY,SAAS,OAAO,WAAW;AAAA,YAAG,MAC/C,YAAY,MAAM,eAAe,QAAQ,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAAA,UAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ import { AstroIntegration, AstroUserConfig } from 'astro';
2
+ import { Plugin } from 'vite';
3
+
4
+ interface TempoAstroOptions {
5
+ /** Annotation root; the application root by default. */
6
+ root?: string;
7
+ enabled?: boolean;
8
+ /** Canvas declarations to expose as isolated documents. Defaults to tempo/designs. */
9
+ canvasesRoot?: string;
10
+ /** App-relative CSS entries for isolated components. Defaults to layout/global CSS discovery. */
11
+ styles?: string[];
12
+ }
13
+ /** Native Astro server instrumentation. Inert for builds, previews and normal dev. */
14
+ declare function tempoAstro(options?: TempoAstroOptions): AstroIntegration;
15
+ declare function astroAnnotationPlugins(root: string, generatedRoot?: string): Plugin[];
16
+
17
+ /** Preserve the app's complete config and integrate only at Astro's dev hook. */
18
+ declare function withTempoAstro<T extends AstroUserConfig>(config: T): T;
19
+ declare function withTempoAstro<T extends AstroUserConfig>(config: Promise<T>): Promise<T>;
20
+
21
+ export { type TempoAstroOptions, astroAnnotationPlugins, tempoAstro as default, tempoAstro, withTempoAstro };