tempo-sdk 0.0.99 → 0.0.102

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 (170) hide show
  1. package/README.md +3 -403
  2. package/dist/assets/editor.d.ts +43 -65
  3. package/dist/assets/editor.js +1 -573
  4. package/dist/assets/index.d.ts +11 -61
  5. package/dist/assets/index.js +1 -338
  6. package/dist/assets/parser.d.ts +68 -78
  7. package/dist/assets/parser.js +1 -33
  8. package/dist/astro/asset-preview-client.d.ts +3 -2
  9. package/dist/astro/asset-preview-client.js +1 -93
  10. package/dist/astro/controls.d.ts +1 -3
  11. package/dist/astro/controls.js +1 -7
  12. package/dist/astro/document-client.d.ts +5 -6
  13. package/dist/astro/document-client.js +1 -78
  14. package/dist/astro/runtime.d.ts +23 -11
  15. package/dist/astro/runtime.js +1 -86
  16. package/dist/astro.d.ts +19 -13
  17. package/dist/astro.js +1 -818
  18. package/dist/canvas/astro-contract.d.ts +0 -3
  19. package/dist/canvas/astro-contract.js +1 -9
  20. package/dist/canvas/astro.d.ts +3 -4
  21. package/dist/canvas/astro.js +1 -42
  22. package/dist/canvas/editor.d.ts +187 -183
  23. package/dist/canvas/editor.js +1 -1094
  24. package/dist/canvas/flutter-preview.d.ts +0 -1
  25. package/dist/canvas/flutter-preview.js +1 -9
  26. package/dist/canvas/index.d.ts +46 -100
  27. package/dist/canvas/index.js +1 -3926
  28. package/dist/canvas/interact-projection.d.ts +7 -5
  29. package/dist/canvas/interact-projection.js +1 -12
  30. package/dist/canvas/parser.d.ts +10 -303
  31. package/dist/canvas/parser.js +1 -30
  32. package/dist/canvas/svelte.d.ts +6 -7
  33. package/dist/canvas/svelte.js +1 -91
  34. package/dist/canvas/vue.d.ts +9 -49
  35. package/dist/canvas/vue.js +1 -264
  36. package/dist/chunk-CXCUJCXD.js +1 -0
  37. package/dist/chunk-FH6TMWFA.js +1 -0
  38. package/dist/chunk-FL7FSJSL.js +1 -0
  39. package/dist/chunk-GQIOB5SV.js +1 -0
  40. package/dist/chunk-HBQ7FFH7.js +1 -0
  41. package/dist/chunk-JRJOWLCN.js +1 -0
  42. package/dist/chunk-LJCBFTMP.js +1 -0
  43. package/dist/chunk-M3GN2KUH.js +1 -0
  44. package/dist/chunk-MPIHFFML.js +1 -0
  45. package/dist/chunk-T5TY3U2H.js +1 -0
  46. package/dist/chunk-XO2BSHWM.js +1 -0
  47. package/dist/chunk-XUSV3KOD.js +1 -0
  48. package/dist/chunk-ZXBMP6RV.js +1 -0
  49. package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
  50. package/dist/expo/plugin.cjs +1 -1928
  51. package/dist/expo/plugin.js +1 -8
  52. package/dist/expo-babel-plugin.cjs +1 -1928
  53. package/dist/expo-babel-plugin.d.cts +46 -40
  54. package/dist/expo-babel-plugin.d.ts +46 -40
  55. package/dist/expo-babel-plugin.js +1 -8
  56. package/dist/flutter-preview-path.d.ts +23 -7
  57. package/dist/flutter-preview-path.js +1 -16
  58. package/dist/index.d.ts +33 -45
  59. package/dist/index.js +1 -20
  60. package/dist/nextjs/plugin.cjs +1 -413
  61. package/dist/nextjs/plugin.js +1 -7
  62. package/dist/nextjs-loader.cjs +1 -2277
  63. package/dist/nextjs.cjs +1 -484
  64. package/dist/nextjs.d.cts +2 -58
  65. package/dist/nextjs.d.ts +2 -58
  66. package/dist/nextjs.js +1 -17
  67. package/dist/nuxt/runtime/identity.d.ts +2 -4
  68. package/dist/nuxt/runtime/identity.js +1 -18
  69. package/dist/nuxt.d.ts +31 -92
  70. package/dist/nuxt.js +1 -5854
  71. package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
  72. package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
  73. package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
  74. package/dist/svelte.d.ts +8 -18
  75. package/dist/svelte.js +1 -917
  76. package/dist/types-CfUgM2w4.d.ts +57 -0
  77. package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
  78. package/dist/vue.d.ts +17 -58
  79. package/dist/vue.js +1 -1501
  80. package/package.json +12 -62
  81. package/dist/assets/editor.js.map +0 -1
  82. package/dist/assets/index.js.map +0 -1
  83. package/dist/assets/parser.js.map +0 -1
  84. package/dist/astro/asset-preview-client.js.map +0 -1
  85. package/dist/astro/controls.js.map +0 -1
  86. package/dist/astro/document-client.js.map +0 -1
  87. package/dist/astro/runtime.js.map +0 -1
  88. package/dist/astro.js.map +0 -1
  89. package/dist/canvas/astro-contract.js.map +0 -1
  90. package/dist/canvas/astro.js.map +0 -1
  91. package/dist/canvas/editor.js.map +0 -1
  92. package/dist/canvas/flutter-preview.js.map +0 -1
  93. package/dist/canvas/index.js.map +0 -1
  94. package/dist/canvas/interact-projection.js.map +0 -1
  95. package/dist/canvas/parser.js.map +0 -1
  96. package/dist/canvas/svelte.js.map +0 -1
  97. package/dist/canvas/vue.js.map +0 -1
  98. package/dist/chunk-27WT3XUG.js +0 -455
  99. package/dist/chunk-27WT3XUG.js.map +0 -1
  100. package/dist/chunk-5HIIF354.js +0 -67
  101. package/dist/chunk-5HIIF354.js.map +0 -1
  102. package/dist/chunk-65B52AR7.js +0 -11
  103. package/dist/chunk-65B52AR7.js.map +0 -1
  104. package/dist/chunk-6HYKKP5N.js +0 -2658
  105. package/dist/chunk-6HYKKP5N.js.map +0 -1
  106. package/dist/chunk-6SOP4XU6.js +0 -1891
  107. package/dist/chunk-6SOP4XU6.js.map +0 -1
  108. package/dist/chunk-AFXE462X.js +0 -1253
  109. package/dist/chunk-AFXE462X.js.map +0 -1
  110. package/dist/chunk-BQPKOVI5.js +0 -115
  111. package/dist/chunk-BQPKOVI5.js.map +0 -1
  112. package/dist/chunk-CYDF4LYJ.js +0 -342
  113. package/dist/chunk-CYDF4LYJ.js.map +0 -1
  114. package/dist/chunk-CYQE3TLC.js +0 -37
  115. package/dist/chunk-CYQE3TLC.js.map +0 -1
  116. package/dist/chunk-DI2ZFAWL.js +0 -14
  117. package/dist/chunk-DI2ZFAWL.js.map +0 -1
  118. package/dist/chunk-EGRHWZRV.js +0 -1
  119. package/dist/chunk-EGRHWZRV.js.map +0 -1
  120. package/dist/chunk-FGWGY3G3.js +0 -157
  121. package/dist/chunk-FGWGY3G3.js.map +0 -1
  122. package/dist/chunk-HOBTDB6G.js +0 -112
  123. package/dist/chunk-HOBTDB6G.js.map +0 -1
  124. package/dist/chunk-I7VF4ZOV.js +0 -630
  125. package/dist/chunk-I7VF4ZOV.js.map +0 -1
  126. package/dist/chunk-JVVHU3A7.js +0 -1077
  127. package/dist/chunk-JVVHU3A7.js.map +0 -1
  128. package/dist/chunk-MIXQVPDH.js +0 -8606
  129. package/dist/chunk-MIXQVPDH.js.map +0 -1
  130. package/dist/chunk-MU7S7NU7.js +0 -183
  131. package/dist/chunk-MU7S7NU7.js.map +0 -1
  132. package/dist/chunk-OX2YKYSL.js +0 -13
  133. package/dist/chunk-OX2YKYSL.js.map +0 -1
  134. package/dist/chunk-PYAJHLXO.js +0 -903
  135. package/dist/chunk-PYAJHLXO.js.map +0 -1
  136. package/dist/chunk-SGN7BDRE.js +0 -16
  137. package/dist/chunk-SGN7BDRE.js.map +0 -1
  138. package/dist/chunk-SGTGDLOX.js +0 -285
  139. package/dist/chunk-SGTGDLOX.js.map +0 -1
  140. package/dist/chunk-T364NBR3.js +0 -1440
  141. package/dist/chunk-T364NBR3.js.map +0 -1
  142. package/dist/chunk-U66QI3EN.js +0 -1524
  143. package/dist/chunk-U66QI3EN.js.map +0 -1
  144. package/dist/chunk-WTXOWQ7N.js +0 -47
  145. package/dist/chunk-WTXOWQ7N.js.map +0 -1
  146. package/dist/chunk-X5DJKVBT.js +0 -1308
  147. package/dist/chunk-X5DJKVBT.js.map +0 -1
  148. package/dist/chunk-ZT7HJ6YU.js +0 -38
  149. package/dist/chunk-ZT7HJ6YU.js.map +0 -1
  150. package/dist/chunk-ZW26VZHX.js +0 -3169
  151. package/dist/chunk-ZW26VZHX.js.map +0 -1
  152. package/dist/controls-reader-5MFHYBZZ.js +0 -192
  153. package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
  154. package/dist/expo/plugin.cjs.map +0 -1
  155. package/dist/expo/plugin.js.map +0 -1
  156. package/dist/expo-babel-plugin.cjs.map +0 -1
  157. package/dist/expo-babel-plugin.js.map +0 -1
  158. package/dist/flutter-preview-path.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/nextjs/plugin.cjs.map +0 -1
  161. package/dist/nextjs/plugin.js.map +0 -1
  162. package/dist/nextjs-loader.cjs.map +0 -1
  163. package/dist/nextjs.cjs.map +0 -1
  164. package/dist/nextjs.js.map +0 -1
  165. package/dist/nuxt/runtime/identity.js.map +0 -1
  166. package/dist/nuxt.js.map +0 -1
  167. package/dist/svelte.js.map +0 -1
  168. package/dist/types-C8OIU-kc.d.ts +0 -106
  169. package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
  170. package/dist/vue.js.map +0 -1
@@ -1,8 +1,10 @@
1
- /**
2
- * Starts the combined DOM + React source used by Tempo's direct interact iframe.
3
- * The Vite plugin installs a synchronous hook first; replaying its latest roots
4
- * here closes the small gap while this lazy client module is loading.
5
- */
1
+ declare global {
2
+ interface Window {
3
+ __tempoInteractProjectionRuntime?: {
4
+ install(): () => void;
5
+ };
6
+ }
7
+ }
6
8
  declare function installTempoInteractProjectionSource(): () => void;
7
9
 
8
10
  export { installTempoInteractProjectionSource };
@@ -1,12 +1 @@
1
- import {
2
- installTempoInteractProjectionSource
3
- } from "../chunk-MIXQVPDH.js";
4
- import "../chunk-SGN7BDRE.js";
5
- import "../chunk-I7VF4ZOV.js";
6
- import "../chunk-65B52AR7.js";
7
- import "../chunk-ZW26VZHX.js";
8
- import "../chunk-T364NBR3.js";
9
- export {
10
- installTempoInteractProjectionSource
11
- };
12
- //# sourceMappingURL=interact-projection.js.map
1
+ import{c as a}from"../chunk-M3GN2KUH.js";import"../chunk-XUSV3KOD.js";export{a as installTempoInteractProjectionSource};
@@ -1,307 +1,14 @@
1
- import { JSXElement } from 'oxc-parser';
1
+ import { c as componentFrameworkForStoryboard$1, f as fallbackPageName$1, m as misimportedSdkCanvasImportMessage$1, p as parseCanvasFile$1, a as parseComponentRoot$1, u as unwrapTsExpression$1 } from '../parser.d-MO5ciJ5n.js';
2
+ export { b as CanvasParseError, C as CanvasSourceSpan, M as MisimportedSdkCanvasImport, d as ParsedCanvasComponentReference, e as ParsedCanvasExpressionReference, P as ParsedCanvasFile, g as ParsedCanvasImport, h as ParsedCanvasLayout, i as ParsedCanvasLayoutSpans, j as ParsedCanvasStoryboard, k as ParsedStoryboardVrt, l as ParsedStoryboardVrtIgnoreRegion, n as STORYBOARD_SDK_COMPONENTS, o as StoryboardSdkComponent, q as StoryboardSdkComponentSpec, S as StoryboardUiFramework, r as componentFileExtensionForFramework, s as componentImportPath, t as componentImportSpecifier, v as storyboardComponentForFramework } from '../parser.d-MO5ciJ5n.js';
3
+ import 'oxc-parser';
2
4
 
3
- /**
4
- * Every storyboard declaration a `<Canvas>` may contain, as data. The parser
5
- * (import whitelist, children check, kind and framework stamps), the editor's
6
- * codegen and the canvas all read this table. It is kept free of the parser's
7
- * dependencies so a renderer module can read a framework's storyboard without
8
- * loading oxc-parser.
9
- */
10
- /** A non-React component runtime a storyboard mounts. Omission means React
11
- * everywhere; the declaration, the page metadata and Convex carry the same
12
- * literals. */
13
- type StoryboardUiFramework = "svelte" | "vue" | "astro";
14
- /** The board kinds a declaration produces (`ParsedCanvasStoryboard.kind`). */
15
- type StoryboardKind = "component" | "route" | "html";
16
- type StoryboardSdkComponentSpec = {
17
- /** The SDK subpath that exports the component. Each non-React runtime has
18
- * its own subpath so a React-only canvas never resolves that framework's
19
- * optional peer dependency. */
20
- importSource: string;
21
- kind: StoryboardKind;
22
- uiFramework?: StoryboardUiFramework;
23
- /** `component={...}` names what the storyboard renders. Legacy boards carry
24
- * it on their referenced object instead. */
25
- requiresComponentProp: boolean;
26
- allowsVrt: boolean;
27
- /** The extension a new component file this storyboard mounts is written
28
- * with (`.tsx` for React). Boards that mount no authored component of
29
- * their own, and legacy boards, have none. */
30
- componentFileExtension?: string;
31
- /** The query the canvas file imports that component with. Astro's
32
- * `?tempo-component` asks Vite for the component descriptor instead of
33
- * the server-rendered module. */
34
- componentImportQuery?: string;
35
- };
36
- /** Every storyboard declaration a `<Canvas>` may contain, in the order the
37
- * children error lists them. The import whitelist, the children check, the
38
- * kind and framework stamps and the editor's codegen all read this table, so
39
- * a new framework's storyboard is one row here (plus its literal in
40
- * `StoryboardUiFramework`). */
41
- declare const STORYBOARD_SDK_COMPONENT_ROWS: {
42
- Storyboard: {
43
- importSource: string;
44
- kind: "component";
45
- requiresComponentProp: true;
46
- allowsVrt: true;
47
- componentFileExtension: string;
48
- };
49
- SvelteStoryboard: {
50
- importSource: string;
51
- kind: "component";
52
- uiFramework: "svelte";
53
- requiresComponentProp: true;
54
- allowsVrt: true;
55
- componentFileExtension: string;
56
- };
57
- VueStoryboard: {
58
- importSource: string;
59
- kind: "component";
60
- uiFramework: "vue";
61
- requiresComponentProp: true;
62
- allowsVrt: true;
63
- componentFileExtension: string;
64
- };
65
- AstroStoryboard: {
66
- importSource: string;
67
- kind: "component";
68
- uiFramework: "astro";
69
- requiresComponentProp: true;
70
- allowsVrt: true;
71
- componentFileExtension: string;
72
- componentImportQuery: string;
73
- };
74
- FlutterStoryboard: {
75
- importSource: string;
76
- kind: "component";
77
- requiresComponentProp: false;
78
- allowsVrt: true;
79
- };
80
- RouteStoryboard: {
81
- importSource: string;
82
- kind: "route";
83
- requiresComponentProp: false;
84
- allowsVrt: false;
85
- };
86
- HtmlStoryboard: {
87
- importSource: string;
88
- kind: "html";
89
- requiresComponentProp: false;
90
- allowsVrt: true;
91
- };
92
- LegacyStoryboardV1: {
93
- importSource: string;
94
- kind: "component";
95
- requiresComponentProp: false;
96
- allowsVrt: false;
97
- };
98
- };
99
- type StoryboardSdkComponent = keyof typeof STORYBOARD_SDK_COMPONENT_ROWS;
100
- /** The table widened to its row type, so optional fields read uniformly. */
101
- declare const STORYBOARD_SDK_COMPONENTS: Readonly<Record<StoryboardSdkComponent, Readonly<StoryboardSdkComponentSpec>>>;
102
- /** The `<Canvas>` child that mounts a component authored in `uiFramework`:
103
- * React, named or omitted, is `<Storyboard>`; any other framework is the
104
- * row that declares it. Codegen picks a storyboard by framework only here. */
105
- declare function storyboardComponentForFramework(uiFramework: StoryboardUiFramework | "react" | undefined): StoryboardSdkComponent;
106
- /** The extension a new component file of `uiFramework` is written with:
107
- * its storyboard's `componentFileExtension` (`.tsx`, `.svelte`, `.vue`,
108
- * `.astro`). */
109
- declare function componentFileExtensionForFramework(uiFramework: StoryboardUiFramework | "react" | undefined): string;
110
- /** The specifier a canvas file imports `source` with: a component file whose
111
- * storyboard declares a `componentImportQuery` gets that query appended
112
- * (`./Card.astro` -> `./Card.astro?tempo-component`); any other path, or one
113
- * that already carries the query, is returned unchanged. */
114
- declare function componentImportSpecifier(source: string): string;
115
- /** The component file a canvas import names, without any storyboard's
116
- * `componentImportQuery` (`./Card.astro?tempo-component` -> `./Card.astro`). */
117
- declare function componentImportPath(source: string): string;
5
+ declare const componentFrameworkForStoryboard: typeof componentFrameworkForStoryboard$1;
6
+ declare const parseCanvasFile: typeof parseCanvasFile$1;
7
+ declare const misimportedSdkCanvasImportMessage: typeof misimportedSdkCanvasImportMessage$1;
8
+ declare const unwrapTsExpression: typeof unwrapTsExpression$1;
9
+ declare const fallbackPageName: typeof fallbackPageName$1;
10
+ declare const parseComponentRoot: typeof parseComponentRoot$1;
118
11
 
119
- type CanvasSourceSpan = {
120
- start: number;
121
- end: number;
122
- };
123
- type CanvasParseError = {
124
- message: string;
125
- span?: CanvasSourceSpan;
126
- /** "structural": the file's storyboard identity/structure cannot be
127
- * trusted — readers must fail closed. "degraded": a single storyboard
128
- * (or the canvas display name) is not statically readable/editable but
129
- * identity is intact — readers keep working with fallback values. */
130
- kind: "structural" | "degraded";
131
- /** Set on the structural error for a `<Canvas>` child that a newer
132
- * tempo-sdk exports as a storyboard component this parser does not know
133
- * (a `<VueStoryboard>` read by a parser from before Vue support). That
134
- * board is unreadable, but the canvas's other storyboards are intact, so
135
- * a reader that works per storyboard, like visual review, may skip just
136
- * this one. */
137
- newerSdkStoryboard?: {
138
- component: string;
139
- storyboardKey?: string;
140
- /** Whether the declaration asks for visual-review tracking. */
141
- vrt: boolean;
142
- };
143
- };
144
- type ParsedCanvasImport = {
145
- localName: string;
146
- source: string;
147
- importedName: string;
148
- kind: "default" | "named" | "namespace";
149
- importKind?: "type" | "value";
150
- span: CanvasSourceSpan;
151
- declarationSpan: CanvasSourceSpan;
152
- specifierCount: number;
153
- namedSpecifierCount: number;
154
- hasDefaultSpecifier: boolean;
155
- hasNamespaceSpecifier: boolean;
156
- };
157
- /** An import statement that names Tempo SDK canvas components but uses the
158
- * wrong tempo-sdk specifier (e.g. `import { Canvas } from "tempo-sdk"`).
159
- * Neither the main entry nor the other subpaths export the components, so
160
- * the file both fails at runtime and is invisible to this parser's <Canvas>
161
- * detection — migrate-on-read uses these records to repair the specifier. */
162
- type MisimportedSdkCanvasImport = {
163
- /** Import source exactly as written, e.g. "tempo-sdk". */
164
- source: string;
165
- /** Span of the source string literal INCLUDING its quote characters. */
166
- sourceSpan: CanvasSourceSpan;
167
- /** Imported names of every value specifier on the statement. */
168
- importedNames: string[];
169
- /** True when every value specifier on the statement is a named import of a
170
- * value actually exported by "tempo-sdk/canvas" — rewriting the source
171
- * string to "tempo-sdk/canvas" provably fixes the statement. */
172
- rewritable: boolean;
173
- };
174
- type ParsedCanvasLayout = {
175
- x: number;
176
- y: number;
177
- width?: number;
178
- height?: number;
179
- zIndex?: number;
180
- };
181
- type ParsedCanvasLayoutSpans = {
182
- x?: CanvasSourceSpan;
183
- y?: CanvasSourceSpan;
184
- width?: CanvasSourceSpan;
185
- height?: CanvasSourceSpan;
186
- zIndex?: CanvasSourceSpan;
187
- layoutClose?: number;
188
- };
189
- type ParsedCanvasComponentReference = {
190
- expression: string;
191
- span: CanvasSourceSpan;
192
- attributeSpan?: CanvasSourceSpan;
193
- localName?: string;
194
- import?: ParsedCanvasImport;
195
- };
196
- type ParsedStoryboardVrtIgnoreRegion = {
197
- x: number;
198
- y: number;
199
- w: number;
200
- h: number;
201
- };
202
- /** Opt-in visual-regression tracking parsed from the `vrt` prop on
203
- * `<Storyboard>` (TEM-1775). Presence of the parsed field means the
204
- * storyboard is tracked; `skip: true` keeps the config but pauses gating.
205
- * `vrt` / `vrt={true}` parse to `{}`; `vrt={false}` parses to absent. */
206
- type ParsedStoryboardVrt = {
207
- /** Per-storyboard pixelmatch threshold override (0..0.5). */
208
- threshold?: number;
209
- /** Temporarily untracked without losing config. */
210
- skip?: boolean;
211
- /** Regions (storyboard-local px) excluded from comparison. */
212
- ignore?: ParsedStoryboardVrtIgnoreRegion[];
213
- };
214
- type ParsedCanvasExpressionReference = {
215
- expression: string;
216
- span: CanvasSourceSpan;
217
- attributeSpan?: CanvasSourceSpan;
218
- };
219
- type ParsedCanvasStoryboard = {
220
- storyboardKey: string;
221
- displayName?: string;
222
- kind: StoryboardKind;
223
- /** Legacy component-runtime field; its published output union stays stable. */
224
- uiFramework?: "svelte";
225
- /** Legacy Astro field; its published output union stays stable too. */
226
- runtimeFramework?: "astro";
227
- /** The component's non-React runtime. New consumers should read it through
228
- * componentFrameworkForStoryboard, which also accepts older parser output. */
229
- componentFramework?: StoryboardUiFramework;
230
- layout: ParsedCanvasLayout;
231
- editable: boolean;
232
- jsxElementSpan: CanvasSourceSpan;
233
- openingElementSpan?: CanvasSourceSpan;
234
- idSpan?: CanvasSourceSpan;
235
- idAttributeSpan?: CanvasSourceSpan;
236
- nameSpan?: CanvasSourceSpan;
237
- nameAttributeSpan?: CanvasSourceSpan;
238
- layoutAttributeSpan?: CanvasSourceSpan;
239
- layoutSpans?: ParsedCanvasLayoutSpans;
240
- component?: ParsedCanvasComponentReference;
241
- props?: ParsedCanvasExpressionReference;
242
- vrt?: ParsedStoryboardVrt;
243
- /** Span of the whole `vrt` attribute. Present whenever the attribute
244
- * exists in source — including `vrt={false}` and degraded (dynamic /
245
- * malformed) forms whose `vrt` value stays absent — so an editor can
246
- * replace or remove the declaration without ever inserting a duplicate. */
247
- vrtAttributeSpan?: CanvasSourceSpan;
248
- route?: string;
249
- routeSpan?: CanvasSourceSpan;
250
- routeAttributeSpan?: CanvasSourceSpan;
251
- filepath?: string;
252
- filepathSpan?: CanvasSourceSpan;
253
- filepathAttributeSpan?: CanvasSourceSpan;
254
- src?: string;
255
- srcSpan?: CanvasSourceSpan;
256
- srcAttributeSpan?: CanvasSourceSpan;
257
- /** `<FlutterStoryboard preview>`: `<canvas-relative-file>.dart#<function>` in its
258
- * nearest Dart package. */
259
- preview?: string;
260
- previewSpan?: CanvasSourceSpan;
261
- previewAttributeSpan?: CanvasSourceSpan;
262
- legacyV1?: {
263
- storyboard: ParsedCanvasExpressionReference;
264
- objectName?: string;
265
- objectSpan?: CanvasSourceSpan;
266
- objectClose?: number;
267
- namePropertySpan?: CanvasSourceSpan;
268
- layoutPropertySpan?: CanvasSourceSpan;
269
- };
270
- errors: CanvasParseError[];
271
- };
272
- /** The component runtime, including parser output written before the
273
- * canonical componentFramework field existed. React, routes and HTML omit it. */
274
- declare function componentFrameworkForStoryboard(storyboard: Pick<ParsedCanvasStoryboard, "componentFramework" | "runtimeFramework" | "uiFramework">): StoryboardUiFramework | undefined;
275
- type ParsedCanvasFile = {
276
- filePath: string;
277
- canvasPath?: string;
278
- pageName: string;
279
- backgroundColor?: string;
280
- canvasElementSpan?: CanvasSourceSpan;
281
- canvasOpeningElementSpan?: CanvasSourceSpan;
282
- canvasChildrenInsertionOffset?: number;
283
- nameSpan?: CanvasSourceSpan;
284
- nameAttributeSpan?: CanvasSourceSpan;
285
- pathSpan?: CanvasSourceSpan;
286
- pathAttributeSpan?: CanvasSourceSpan;
287
- backgroundColorSpan?: CanvasSourceSpan;
288
- backgroundColorAttributeSpan?: CanvasSourceSpan;
289
- imports: ParsedCanvasImport[];
290
- misimportedSdkCanvasImports: MisimportedSdkCanvasImport[];
291
- storyboards: ParsedCanvasStoryboard[];
292
- errors: CanvasParseError[];
293
- };
294
- /** Emitted when a file parses cleanly but declares no `<Canvas>` — for
295
- * readers that need to distinguish "legacy page format" from "broken". */
296
12
  declare const NO_CANVAS_DECLARATION_ERROR = "No <Canvas> declaration found in canvas file";
297
- declare function parseCanvasFile(filePath: string, source: string): ParsedCanvasFile;
298
- declare function misimportedSdkCanvasImportMessage(entry: MisimportedSdkCanvasImport): string;
299
- declare function unwrapTsExpression(node: any): any;
300
- declare function fallbackPageName(filePath: string): string;
301
- /** Resolve only direct component returns, so nested callbacks cannot supply a false root. */
302
- declare function parseComponentRoot(filePath: string, source: string, exportName: string): {
303
- name: string;
304
- root: JSXElement;
305
- } | null;
306
13
 
307
- export { type CanvasParseError, type CanvasSourceSpan, type MisimportedSdkCanvasImport, NO_CANVAS_DECLARATION_ERROR, type ParsedCanvasComponentReference, type ParsedCanvasExpressionReference, type ParsedCanvasFile, type ParsedCanvasImport, type ParsedCanvasLayout, type ParsedCanvasLayoutSpans, type ParsedCanvasStoryboard, type ParsedStoryboardVrt, type ParsedStoryboardVrtIgnoreRegion, STORYBOARD_SDK_COMPONENTS, type StoryboardSdkComponent, type StoryboardSdkComponentSpec, type StoryboardUiFramework, componentFileExtensionForFramework, componentFrameworkForStoryboard, componentImportPath, componentImportSpecifier, fallbackPageName, misimportedSdkCanvasImportMessage, parseCanvasFile, parseComponentRoot, storyboardComponentForFramework, unwrapTsExpression };
14
+ export { NO_CANVAS_DECLARATION_ERROR, componentFrameworkForStoryboard, fallbackPageName, misimportedSdkCanvasImportMessage, parseCanvasFile, parseComponentRoot, unwrapTsExpression };
@@ -1,30 +1 @@
1
- import {
2
- NO_CANVAS_DECLARATION_ERROR,
3
- STORYBOARD_SDK_COMPONENTS,
4
- componentFileExtensionForFramework,
5
- componentFrameworkForStoryboard,
6
- componentImportPath,
7
- componentImportSpecifier,
8
- fallbackPageName,
9
- misimportedSdkCanvasImportMessage,
10
- parseCanvasFile,
11
- parseComponentRoot,
12
- storyboardComponentForFramework,
13
- unwrapTsExpression
14
- } from "../chunk-AFXE462X.js";
15
- import "../chunk-CYQE3TLC.js";
16
- export {
17
- NO_CANVAS_DECLARATION_ERROR,
18
- STORYBOARD_SDK_COMPONENTS,
19
- componentFileExtensionForFramework,
20
- componentFrameworkForStoryboard,
21
- componentImportPath,
22
- componentImportSpecifier,
23
- fallbackPageName,
24
- misimportedSdkCanvasImportMessage,
25
- parseCanvasFile,
26
- parseComponentRoot,
27
- storyboardComponentForFramework,
28
- unwrapTsExpression
29
- };
30
- //# sourceMappingURL=parser.js.map
1
+ import{b as t}from"../chunk-ZXBMP6RV.js";import{a}from"../chunk-XUSV3KOD.js";var m={Storyboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".tsx"},SvelteStoryboard:{importSource:"tempo-sdk/canvas/svelte",kind:"component",uiFramework:"svelte",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".svelte"},VueStoryboard:{importSource:"tempo-sdk/canvas/vue",kind:"component",uiFramework:"vue",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".vue"},AstroStoryboard:{importSource:"tempo-sdk/canvas/astro",kind:"component",uiFramework:"astro",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".astro",componentImportQuery:"?tempo-component"},FlutterStoryboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!0},RouteStoryboard:{importSource:"tempo-sdk/canvas",kind:"route",requiresComponentProp:!1,allowsVrt:!1},HtmlStoryboard:{importSource:"tempo-sdk/canvas",kind:"html",requiresComponentProp:!1,allowsVrt:!0},LegacyStoryboardV1:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!1}},n=m,c=Object.keys(n);function s(o){if(o===void 0||o==="react")return"Storyboard";let r=c.find(e=>n[e].uiFramework===o);if(!r)throw new Error(`No storyboard component renders "${o}"`);return r}a(s,"storyboardComponentForFramework");function i(o){let r=s(o),e=n[r].componentFileExtension;if(!e)throw new Error(`<${r}> declares no component file extension`);return e}a(i,"componentFileExtensionForFramework");function d(o){for(let r of Object.values(n)){let e=r.componentImportQuery,p=r.componentFileExtension;if(!(!e||!p)&&o.endsWith(p))return o+e}return o}a(d,"componentImportSpecifier");function S(o){for(let r of Object.values(n)){let e=r.componentImportQuery;if(e&&o.endsWith(e))return o.slice(0,-e.length)}return o}a(S,"componentImportPath");var k=t("canvas/parser","componentFrameworkForStoryboard"),f=t("canvas/parser","parseCanvasFile"),C=t("canvas/parser","misimportedSdkCanvasImportMessage"),b=t("canvas/parser","unwrapTsExpression"),v=t("canvas/parser","fallbackPageName"),x=t("canvas/parser","parseComponentRoot"),F="No <Canvas> declaration found in canvas file";export{F as NO_CANVAS_DECLARATION_ERROR,n as STORYBOARD_SDK_COMPONENTS,i as componentFileExtensionForFramework,k as componentFrameworkForStoryboard,S as componentImportPath,d as componentImportSpecifier,v as fallbackPageName,C as misimportedSdkCanvasImportMessage,f as parseCanvasFile,x as parseComponentRoot,s as storyboardComponentForFramework,b as unwrapTsExpression};
@@ -1,14 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import * as svelte from 'svelte';
3
- import { S as StoryboardLayout, a as StoryboardVrtConfig } from '../storyboard-CMJVBSXn.js';
4
- import '../page-DwLnOM5d.js';
5
- import '../v1-client-compat-qxaXEDm_.js';
3
+ import { b as StoryboardLayout, c as StoryboardVrtConfig } from '../storyboard.contract.d-UQ4MUYN5.js';
4
+ import '../page-Bc8PekIX.js';
5
+ import '../v1-client-compat-n0E0XxuX.js';
6
6
 
7
- /** Public Svelte 5 component call shape. This Svelte-specific entrypoint keeps
8
- * React-only consumers of tempo-sdk/canvas from resolving the optional Svelte
9
- * peer dependency. */
10
7
  type SvelteComponent<Props extends Record<string, unknown> = Record<string, unknown>> = svelte.Component<Props>;
11
- declare function SvelteStoryboard<Props extends Record<string, unknown> = Record<string, unknown>>({ id, name, component, layout, props, vrt, ...annotations }: {
8
+ declare function SvelteStoryboard$1<Props extends Record<string, unknown> = Record<string, unknown>>({ id, name, component, layout, props, vrt, ...annotations }: {
12
9
  id: string;
13
10
  component: SvelteComponent<Props>;
14
11
  layout: StoryboardLayout;
@@ -17,4 +14,6 @@ declare function SvelteStoryboard<Props extends Record<string, unknown> = Record
17
14
  vrt?: boolean | StoryboardVrtConfig;
18
15
  } & Record<`data-tempo-${string}`, unknown>): react.JSX.Element;
19
16
 
17
+ declare const SvelteStoryboard: typeof SvelteStoryboard$1;
18
+
20
19
  export { type SvelteComponent, SvelteStoryboard };
@@ -1,91 +1 @@
1
- import {
2
- StoryboardSlot
3
- } from "../chunk-X5DJKVBT.js";
4
- import "../chunk-ZW26VZHX.js";
5
- import "../chunk-T364NBR3.js";
6
-
7
- // canvas/svelte.tsx
8
- import { useLayoutEffect, useRef, useState } from "react";
9
- import { jsx } from "react/jsx-runtime";
10
- var svelteRuntimeState = null;
11
- function readSvelteRuntime() {
12
- if (svelteRuntimeState?.kind === "ready") return svelteRuntimeState.runtime;
13
- if (svelteRuntimeState?.kind === "error") throw svelteRuntimeState.error;
14
- if (!svelteRuntimeState) {
15
- const promise = import("svelte").then(
16
- (runtime) => {
17
- svelteRuntimeState = { kind: "ready", runtime };
18
- },
19
- (error) => {
20
- svelteRuntimeState = { kind: "error", error };
21
- }
22
- );
23
- svelteRuntimeState = { kind: "pending", promise };
24
- }
25
- throw svelteRuntimeState.promise;
26
- }
27
- function SvelteStoryboard({
28
- id,
29
- name,
30
- component,
31
- layout,
32
- props,
33
- vrt,
34
- ...annotations
35
- }) {
36
- return /* @__PURE__ */ jsx(
37
- StoryboardSlot,
38
- {
39
- "data-tempo-hide-fiber": "true",
40
- id,
41
- name,
42
- layout,
43
- kind: "component",
44
- uiFramework: "svelte",
45
- vrt: !!vrt,
46
- children: /* @__PURE__ */ jsx(SvelteComponentMount, { component, props })
47
- }
48
- );
49
- }
50
- function svelteComponentIdentity(component) {
51
- const symbol = Object.getOwnPropertySymbols(component).find(
52
- (symbol2) => symbol2.description === "hmr"
53
- );
54
- const hmr = symbol ? Reflect.get(component, symbol) : null;
55
- return hmr && typeof hmr === "object" && typeof hmr.fn === "function" && typeof hmr.update === "function" && hmr.current !== null && typeof hmr.current === "object" ? hmr.current : component;
56
- }
57
- function SvelteComponentMount({
58
- component,
59
- props
60
- }) {
61
- const targetRef = useRef(null);
62
- const [mountError, setMountError] = useState(null);
63
- const runtime = readSvelteRuntime();
64
- const componentIdentity = svelteComponentIdentity(component);
65
- useLayoutEffect(() => {
66
- const target = targetRef.current;
67
- if (!target) return;
68
- let mounted = null;
69
- try {
70
- mounted = runtime.mount(component, {
71
- target,
72
- props: props ?? {}
73
- });
74
- runtime.flushSync();
75
- } catch (error) {
76
- setMountError(error);
77
- }
78
- return () => {
79
- const current = mounted;
80
- mounted = null;
81
- if (current) void runtime.unmount(current);
82
- target.replaceChildren();
83
- };
84
- }, [componentIdentity, runtime]);
85
- if (mountError) throw mountError;
86
- return /* @__PURE__ */ jsx("div", { ref: targetRef, "data-tempo-hide-fiber": "true" });
87
- }
88
- export {
89
- SvelteStoryboard
90
- };
91
- //# sourceMappingURL=svelte.js.map
1
+ import{s as o}from"../chunk-GQIOB5SV.js";import"../chunk-JRJOWLCN.js";import"../chunk-XO2BSHWM.js";import"../chunk-M3GN2KUH.js";import"../chunk-FH6TMWFA.js";import{a as t}from"../chunk-XUSV3KOD.js";var a=t(((...e)=>o("canvas/svelte",{svelte:t(()=>import("svelte"),"svelte")}).SvelteStoryboard(...e)),"SvelteStoryboard");export{a as SvelteStoryboard};
@@ -1,74 +1,34 @@
1
1
  import * as react from 'react';
2
2
  import * as vue from 'vue';
3
- import { S as StoryboardLayout, a as StoryboardVrtConfig } from '../storyboard-CMJVBSXn.js';
4
- import '../page-DwLnOM5d.js';
5
- import '../v1-client-compat-qxaXEDm_.js';
3
+ import { b as StoryboardLayout, c as StoryboardVrtConfig } from '../storyboard.contract.d-UQ4MUYN5.js';
4
+ import '../page-Bc8PekIX.js';
5
+ import '../v1-client-compat-n0E0XxuX.js';
6
6
 
7
- /** Public Vue 3 component shape. This Vue-specific entrypoint keeps
8
- * React-only consumers of tempo-sdk/canvas from resolving the optional Vue
9
- * peer dependency. */
10
7
  type VueComponent<Props extends Record<string, unknown> = Record<string, unknown>> = vue.Component<Props>;
11
- /** The app a storyboard mounts, for `setup` to install plugins on. */
12
8
  type VueApp = vue.App;
13
- /** Where a storyboard's app is being prepared. `renderId` is unique per
14
- * document (canvas path plus storyboard id); `storyboardId` is the authored
15
- * id alone, which two canvases may share. */
16
9
  interface VueStoryboardContext {
17
10
  storyboardId: string;
18
11
  renderId: string;
19
12
  }
20
- /** What every Vue storyboard's app goes through before it mounts. The host
21
- * entry of a meta-framework sidecar installs one: the Nuxt sidecar creates
22
- * the board's Nuxt app context and applies the app's plugins here. A
23
- * storyboard's own `setup` runs after it, on the same app. */
24
13
  interface VueStoryboardEnvironment {
25
14
  setup: ((app: VueApp, context: VueStoryboardContext) => void) | ((app: VueApp, context: VueStoryboardContext) => Promise<void>);
26
- /** Releases what `setup` bound outside the board's Vue app: the Nuxt
27
- * sidecar unbinds the board's Nuxt app context, stops its effect scope and
28
- * removes the global listeners its plugins added. Called once for every
29
- * app `setup` ran on: after the app unmounts, or when it is discarded
30
- * without mounting (its setup failed or missed its deadline, or the board
31
- * went away first). Without it every board remount leaked a whole Nuxt
32
- * app. */
33
15
  teardown?: (app: VueApp, context: VueStoryboardContext) => void;
34
- /** Names what this board's `setup` is still waiting on (the Nuxt sidecar
35
- * names the plugins still running), for the board's error when setup
36
- * misses its deadline. */
37
16
  describePendingSetup?: (app: VueApp, context: VueStoryboardContext) => string | undefined;
38
17
  }
39
- /** Runs before a storyboard's app mounts: `app.use(...)` for pinia,
40
- * vue-router or vue-i18n. May be async; the board stays pending until it
41
- * settles. A union of two signatures rather than one returning
42
- * `void | Promise<void>`, so an inline `(app) => app.use(pinia)` (which
43
- * returns the app) stays assignable, as it was to `(app) => void`. */
44
18
  type VueStoryboardSetup = ((app: VueApp) => void) | ((app: VueApp) => Promise<void>);
45
- /**
46
- * How long a board's setup (the environment's, then the storyboard's) may
47
- * take before the board shows an error instead. The canvas declares a board
48
- * stalled when no first batch has arrived 30 s after it began streaming, and
49
- * then reloads the whole shared host, sibling boards included, with a
50
- * generic convergence-stall problem. A setup that never settles (a Nuxt
51
- * plugin awaiting something the canvas never provides) must become this
52
- * board's own named error well before that; a setup that waits on the
53
- * network still has ample time.
54
- */
55
- declare const VUE_STORYBOARD_SETUP_TIMEOUT_MS = 15000;
56
- /** Installs (or with `null` removes) the environment every Vue storyboard
57
- * in this document is prepared with. Call it before rendering the canvas
58
- * host; a board prepared earlier keeps the environment it was prepared
59
- * with. The Vite host configures nothing, so plain Vue projects mount
60
- * exactly as they did without one. */
61
- declare function configureVueStoryboards(next: VueStoryboardEnvironment | null): void;
62
- declare function VueStoryboard<Props extends Record<string, unknown> = Record<string, unknown>>({ id, name, component, layout, props, vrt, setup, }: {
19
+ declare function configureVueStoryboards$1(next: VueStoryboardEnvironment | null): void;
20
+ declare function VueStoryboard$1<Props extends Record<string, unknown> = Record<string, unknown>>({ id, name, component, layout, props, vrt, setup, }: {
63
21
  id: string;
64
22
  component: VueComponent<Props>;
65
23
  layout: StoryboardLayout;
66
24
  name?: string;
67
25
  props?: Props;
68
26
  vrt?: boolean | StoryboardVrtConfig;
69
- /** Runs on the storyboard's app before it mounts, after the document's
70
- * environment, for plugins such as pinia, vue-router or vue-i18n. */
71
27
  setup?: VueStoryboardSetup;
72
28
  } & Record<`data-tempo-${string}`, unknown>): react.JSX.Element;
73
29
 
30
+ declare const VUE_STORYBOARD_SETUP_TIMEOUT_MS = 15000;
31
+ declare const configureVueStoryboards: typeof configureVueStoryboards$1;
32
+ declare const VueStoryboard: typeof VueStoryboard$1;
33
+
74
34
  export { VUE_STORYBOARD_SETUP_TIMEOUT_MS, type VueApp, type VueComponent, VueStoryboard, type VueStoryboardContext, type VueStoryboardEnvironment, type VueStoryboardSetup, configureVueStoryboards };