@vite-hub/ui 0.3.1 → 0.5.0

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 (176) hide show
  1. package/README.md +107 -81
  2. package/dist/announce-Cy_Tn9wW.js +32 -0
  3. package/dist/{code-view-D0bqhogi.js → code-view-DsU-xzic.js} +4 -4
  4. package/dist/comment-attachments-C4yNbcx5.js +20 -0
  5. package/dist/{comment-composer-jYv2ULNP.js → comment-composer-D7ZytyER.js} +257 -10
  6. package/dist/{comment-composer-Cc8Jvu6u.d.ts → comment-composer-DvKMTrAi.d.ts} +1 -1
  7. package/dist/{comment-layer-ClH4MLj4.d.ts → comment-layer-GTsLdABl.d.ts} +17 -6
  8. package/dist/{comment-list-B8hphLfS.d.ts → comment-list-BI96empx.d.ts} +2 -2
  9. package/dist/comment-marks.css +18 -22
  10. package/dist/{comment-panel-fcKSKwLC.d.ts → comment-panel-CsKWTms_.d.ts} +15 -4
  11. package/dist/{comment-row-Bbm9WwuF.js → comment-row-JmTC0uXr.js} +2 -2
  12. package/dist/comment-selection-bar-CyVBNYl9.d.ts +42 -0
  13. package/dist/comment-send-7bg4NEEM.js +277 -0
  14. package/dist/comment-send-C45dHC22.d.ts +25 -0
  15. package/dist/comment-send.css +267 -0
  16. package/dist/comment-thread-B_Sc2QX6.js +797 -0
  17. package/dist/{comment-thread-CoTLrdal.d.ts → comment-thread-C6U-bsK_.d.ts} +23 -6
  18. package/dist/{comments-CkWc2Khc.js → comments-B88zg9gC.js} +66 -10
  19. package/dist/{comments-Bx2WRsYy.d.ts → comments-D8hulVPy.d.ts} +34 -6
  20. package/dist/{comments-context-C2lOZyQ5.js → comments-context-DhbIdYQ1.js} +2 -1
  21. package/dist/{config-Dk67emQt.js → config-B1u7zqMB.js} +8 -1
  22. package/dist/{config-DgxBW013.d.ts → config-pHazYdq6.d.ts} +11 -0
  23. package/dist/drop-field-3CDRFFRm.js +163 -0
  24. package/dist/{editor-C_wt4RRV.js → editor-BHYGLgty.js} +42 -3
  25. package/dist/effects-Ql6VzCRa.js +2971 -0
  26. package/dist/format-orwcdZL_.js +39 -0
  27. package/dist/headless.d.ts +2 -2
  28. package/dist/headless.js +1 -1
  29. package/dist/hold-to-delete-DjWzRDyY.d.ts +51 -0
  30. package/dist/hold-to-delete-ROLQRZg_.js +434 -0
  31. package/dist/icon-c5Jb_Tl7.d.ts +31 -0
  32. package/dist/{image-preview-C9tdkmEj.js → image-preview-BigoAvb3.js} +2 -2
  33. package/dist/{index-BD1e8vx5.d.ts → index-YUvL2nV8.d.ts} +10 -6
  34. package/dist/index.d.ts +18 -12
  35. package/dist/index.js +47 -45
  36. package/dist/install-D5f6msEU.js +17 -0
  37. package/dist/list-RCbNZ14q.js +271 -0
  38. package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-Dfl2DgPS.js} +1 -1
  39. package/dist/{markdown-editor-DqdZfIEn.d.ts → markdown-editor-wQF0yD5o.d.ts} +1 -1
  40. package/dist/markdown-editor.d.ts +1 -1
  41. package/dist/markdown-editor.js +1 -1
  42. package/dist/motion/core.d.ts +4 -0
  43. package/dist/motion/core.js +11 -0
  44. package/dist/motion-core-lHRF8PZz.d.ts +456 -0
  45. package/dist/motion.d.ts +16 -0
  46. package/dist/motion.js +13 -0
  47. package/dist/{nuxt-ui-DSQFzq3s.js → nuxt-ui-CgvMzO5v.js} +20 -14
  48. package/dist/nuxt.d.ts +2 -2
  49. package/dist/nuxt.js +20 -5
  50. package/dist/opt-out-b6bnUjIT.js +208 -0
  51. package/dist/parts/components/agent-session.js +1 -1
  52. package/dist/parts/components/attachment.js +1 -1
  53. package/dist/parts/components/avatar-stack.js +3 -2
  54. package/dist/parts/components/chat-session.d.ts +1 -1
  55. package/dist/parts/components/chat.js +2 -2
  56. package/dist/parts/components/code-block.js +1 -1
  57. package/dist/parts/components/code-view.js +1 -1
  58. package/dist/parts/components/comment-composer.d.ts +1 -1
  59. package/dist/parts/components/comment-composer.js +1 -1
  60. package/dist/parts/components/comment-layer.d.ts +1 -1
  61. package/dist/parts/components/comment-layer.js +54 -23
  62. package/dist/parts/components/comment-list.d.ts +1 -1
  63. package/dist/parts/components/comment-list.js +13 -7
  64. package/dist/parts/components/comment-panel.d.ts +1 -1
  65. package/dist/parts/components/comment-panel.js +46 -20
  66. package/dist/parts/components/comment-pin.js +1 -1
  67. package/dist/parts/components/comment-selection-bar.d.ts +2 -0
  68. package/dist/parts/components/comment-selection-bar.js +117 -0
  69. package/dist/parts/components/comment-send.d.ts +2 -0
  70. package/dist/parts/components/comment-send.js +2 -0
  71. package/dist/parts/components/comment-thread.d.ts +2 -2
  72. package/dist/parts/components/comment-thread.js +2 -570
  73. package/dist/parts/components/comments.d.ts +8 -6
  74. package/dist/parts/components/comments.js +6 -4
  75. package/dist/parts/components/copy-button.d.ts +12 -2
  76. package/dist/parts/components/copy-button.js +226 -1
  77. package/dist/parts/components/drop-field.d.ts +69 -0
  78. package/dist/parts/components/drop-field.js +77 -0
  79. package/dist/parts/components/filter-search.js +1 -1
  80. package/dist/parts/components/hold-to-delete.d.ts +82 -0
  81. package/dist/parts/components/hold-to-delete.js +76 -0
  82. package/dist/parts/components/markdown-editor.d.ts +1 -1
  83. package/dist/parts/components/markdown-editor.js +1 -1
  84. package/dist/parts/components/markdown-renderer.js +1 -1
  85. package/dist/parts/components/markdown.js +1 -1
  86. package/dist/parts/components/message-parts.js +13 -5
  87. package/dist/parts/components/motion-list.d.ts +42 -0
  88. package/dist/parts/components/motion-list.js +42 -0
  89. package/dist/parts/components/motion.d.ts +124 -0
  90. package/dist/parts/components/motion.js +172 -0
  91. package/dist/parts/components/progress.d.ts +41 -0
  92. package/dist/parts/components/progress.js +54 -0
  93. package/dist/parts/components/prompt-input.d.ts +3 -3
  94. package/dist/parts/components/prompt-input.js +3 -3
  95. package/dist/parts/components/relative-time.js +1 -1
  96. package/dist/parts/components/sync-status.js +2 -1
  97. package/dist/parts/components/tool-list.d.ts +1 -1
  98. package/dist/parts/components/trace-run.d.ts +1 -1
  99. package/dist/parts/components/trace-run.js +2 -2
  100. package/dist/parts/headless/comments.d.ts +2 -2
  101. package/dist/parts/headless/comments.js +1 -1
  102. package/dist/parts/playground/share.d.ts +36 -2
  103. package/dist/parts/workspace/browser-support-notice.js +12 -4
  104. package/dist/parts/workspace/codemirror.d.ts +9 -0
  105. package/dist/parts/workspace/codemirror.js +37 -4
  106. package/dist/parts/workspace/connect-panel.js +1 -1
  107. package/dist/parts/workspace/file-icons.d.ts +16 -0
  108. package/dist/parts/workspace/file-icons.js +82 -0
  109. package/dist/parts/workspace/icons.d.ts +1 -0
  110. package/dist/parts/workspace/icons.js +1 -0
  111. package/dist/parts/workspace/runners/render.d.ts +26 -0
  112. package/dist/parts/workspace/runners/render.js +124 -0
  113. package/dist/parts/workspace/runners/web-container.d.ts +29 -0
  114. package/dist/parts/workspace/runners/web-container.js +186 -0
  115. package/dist/parts/workspace/workspace-bar.d.ts +51 -0
  116. package/dist/parts/workspace/workspace-bar.js +51 -0
  117. package/dist/parts/workspace/workspace-boot-status.js +1 -1
  118. package/dist/parts/workspace/workspace-editor-head.d.ts +47 -0
  119. package/dist/parts/workspace/workspace-editor-head.js +66 -0
  120. package/dist/parts/workspace/workspace-editor.d.ts +17 -0
  121. package/dist/parts/workspace/workspace-editor.js +29 -3
  122. package/dist/parts/workspace/workspace-examples.d.ts +74 -0
  123. package/dist/parts/workspace/workspace-examples.js +72 -0
  124. package/dist/parts/workspace/workspace-file-link.d.ts +35 -0
  125. package/dist/parts/workspace/workspace-file-link.js +39 -0
  126. package/dist/parts/workspace/workspace-file-tree.d.ts +8 -8
  127. package/dist/parts/workspace/workspace-file-tree.js +26 -19
  128. package/dist/parts/workspace/workspace-guide.d.ts +52 -0
  129. package/dist/parts/workspace/workspace-guide.js +91 -0
  130. package/dist/parts/workspace/workspace-issues.d.ts +46 -0
  131. package/dist/parts/workspace/workspace-issues.js +49 -0
  132. package/dist/parts/workspace/workspace-preview.js +1 -1
  133. package/dist/parts/workspace/workspace-shell.d.ts +2 -88
  134. package/dist/parts/workspace/workspace-shell.js +131 -78
  135. package/dist/parts/workspace/workspace-sidebar.d.ts +75 -0
  136. package/dist/parts/workspace/workspace-sidebar.js +132 -0
  137. package/dist/parts/workspace/workspace-start.d.ts +47 -0
  138. package/dist/parts/workspace/workspace-start.js +60 -0
  139. package/dist/parts/workspace/workspace-status.d.ts +69 -0
  140. package/dist/parts/workspace/workspace-status.js +74 -0
  141. package/dist/parts/workspace/workspace-steps.d.ts +2 -0
  142. package/dist/parts/workspace/workspace-steps.js +128 -0
  143. package/dist/parts/workspace/workspace-task.d.ts +20 -0
  144. package/dist/parts/workspace/workspace-task.js +20 -0
  145. package/dist/parts/workspace/workspace.d.ts +251 -0
  146. package/dist/parts/workspace/workspace.js +665 -0
  147. package/dist/{pierre-code-view-xgBL6DO7.js → pierre-code-view-NE35tkmR.js} +37 -17
  148. package/dist/playground.d.ts +1 -1
  149. package/dist/progress-C7afI5vq.js +266 -0
  150. package/dist/registry-D3-ysX7l.js +78 -0
  151. package/dist/{relative-time-BVmjOsYG.js → relative-time-DgSS3zKN.js} +1 -1
  152. package/dist/ring-B7Qxu7zd.js +175 -0
  153. package/dist/runtime/nuxt-plugin.js +2 -2
  154. package/dist/styles.css +657 -526
  155. package/dist/text-BCJflBJf.js +826 -0
  156. package/dist/theme.d.ts +43 -0
  157. package/dist/theme.js +22 -7
  158. package/dist/travel-C87xd5Wh.js +182 -0
  159. package/dist/tween-CO24nMpf.js +62 -0
  160. package/dist/{types-Dyr6CfBW.d.ts → types-BX64qHlV.d.ts} +1 -1
  161. package/dist/visual-copy-CrVc3z4n.js +15 -0
  162. package/dist/workspace-shell-BJGnoF3p.d.ts +112 -0
  163. package/dist/workspace-steps-Bgph2rpr.d.ts +72 -0
  164. package/dist/workspace.d.ts +17 -4
  165. package/dist/workspace.js +16 -3
  166. package/package.json +22 -11
  167. package/dist/copy-button-CRN3kmSD.js +0 -253
  168. package/dist/format-Du58PlsG.js +0 -18
  169. package/dist/icon-swap.css +0 -69
  170. package/dist/parts/playground/highlight.d.ts +0 -5
  171. package/dist/parts/playground/highlight.js +0 -23
  172. package/dist/parts/playground/playground-render.d.ts +0 -126
  173. package/dist/parts/playground/playground-render.js +0 -356
  174. package/dist/parts/workspace/playground-container.d.ts +0 -192
  175. package/dist/parts/workspace/playground-container.js +0 -603
  176. package/dist/share-DM4eNy4q.d.ts +0 -37
package/dist/theme.d.ts CHANGED
@@ -134,6 +134,11 @@ export declare const vitehubTheme: {
134
134
  itemDescription: string;
135
135
  };
136
136
  };
137
+ editorSuggestionMenu: {
138
+ slots: {
139
+ content: string;
140
+ };
141
+ };
137
142
  empty: {
138
143
  slots: {
139
144
  root: string;
@@ -232,6 +237,12 @@ export declare const vitehubTheme: {
232
237
  overlay: string;
233
238
  };
234
239
  };
240
+ transition: {
241
+ true: {
242
+ overlay: string;
243
+ content: string;
244
+ };
245
+ };
235
246
  fullscreen: {
236
247
  false: {
237
248
  content: string;
@@ -277,6 +288,13 @@ export declare const vitehubTheme: {
277
288
  itemTrailingIcon: string;
278
289
  content: string;
279
290
  };
291
+ variants: {
292
+ position: {
293
+ popper: {
294
+ content: string;
295
+ };
296
+ };
297
+ };
280
298
  };
281
299
  selectMenu: {
282
300
  defaultVariants: {
@@ -298,6 +316,26 @@ export declare const vitehubTheme: {
298
316
  content: string;
299
317
  };
300
318
  };
319
+ slideover: {
320
+ variants: {
321
+ transition: {
322
+ true: {
323
+ overlay: string;
324
+ };
325
+ };
326
+ };
327
+ compoundVariants: {
328
+ transition: boolean;
329
+ class: {
330
+ content: string;
331
+ };
332
+ }[];
333
+ };
334
+ switch: {
335
+ slots: {
336
+ thumb: string;
337
+ };
338
+ };
301
339
  table: {
302
340
  slots: {
303
341
  th: string;
@@ -345,6 +383,11 @@ export declare const vitehubTheme: {
345
383
  root: string;
346
384
  };
347
385
  };
386
+ toaster: {
387
+ slots: {
388
+ base: string;
389
+ };
390
+ };
348
391
  tooltip: {
349
392
  slots: {
350
393
  content: string;
package/dist/theme.js CHANGED
@@ -91,7 +91,7 @@ const vitehubTheme = {
91
91
  size: "sm"
92
92
  },
93
93
  slots: {
94
- base: "rounded-md font-medium disabled:opacity-50 aria-disabled:opacity-50 transition-[color,background-color,box-shadow,transform] duration-150 ease-out motion-safe:active:not-disabled:scale-[.97] motion-reduce:transition-none",
94
+ base: "rounded-md font-medium disabled:opacity-50 aria-disabled:opacity-50 transition-[color,background-color,box-shadow] duration-150 ease-out motion-reduce:transition-none",
95
95
  leadingIcon: "size-4 opacity-80",
96
96
  trailingIcon: "size-3.5 opacity-75"
97
97
  },
@@ -116,6 +116,7 @@ const vitehubTheme = {
116
116
  label: "text-xs font-medium text-muted",
117
117
  itemDescription: "text-clip whitespace-normal"
118
118
  } },
119
+ editorSuggestionMenu: { slots: { content: "data-[state=open]:animate-none data-[state=closed]:animate-none" } },
119
120
  empty: { slots: {
120
121
  root: "gap-3 p-5",
121
122
  title: "text-sm font-medium",
@@ -150,7 +151,7 @@ const vitehubTheme = {
150
151
  }],
151
152
  slots: {
152
153
  base: "pointer-coarse:text-base",
153
- content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md"
154
+ content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md data-[state=open]:animate-none data-[state=closed]:animate-none"
154
155
  }
155
156
  },
156
157
  inputNumber: {
@@ -179,6 +180,10 @@ const vitehubTheme = {
179
180
  },
180
181
  modal: { variants: {
181
182
  overlay: { true: { overlay: "bg-black/40 dark:bg-black/60" } },
183
+ transition: { true: {
184
+ overlay: "data-[state=open]:animate-none data-[state=closed]:animate-none",
185
+ content: "data-[state=open]:animate-none data-[state=closed]:animate-none"
186
+ } },
182
187
  fullscreen: { false: { content: "max-w-md rounded-xl ring-0 shadow-(--vh-shadow-dialog)" } }
183
188
  } },
184
189
  pageCard: { slots: {
@@ -189,7 +194,7 @@ const vitehubTheme = {
189
194
  title: "text-sm font-medium",
190
195
  description: "mt-1 text-xs/5 text-muted"
191
196
  } },
192
- popover: { slots: { content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md" } },
197
+ popover: { slots: { content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md data-[state=open]:animate-none data-[state=closed]:animate-none" } },
193
198
  select: {
194
199
  defaultVariants: { size: "sm" },
195
200
  compoundVariants: [{
@@ -207,7 +212,8 @@ const vitehubTheme = {
207
212
  itemLeadingIcon: "size-4 opacity-80",
208
213
  itemTrailingIcon: "size-3.5 opacity-75",
209
214
  content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md"
210
- }
215
+ },
216
+ variants: { position: { popper: { content: "data-[state=open]:animate-none data-[state=closed]:animate-none" } } }
211
217
  },
212
218
  selectMenu: {
213
219
  defaultVariants: { size: "sm" },
@@ -221,9 +227,17 @@ const vitehubTheme = {
221
227
  }],
222
228
  slots: {
223
229
  base: "pointer-coarse:text-base",
224
- content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md"
230
+ content: "rounded-xl ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md data-[state=open]:animate-none data-[state=closed]:animate-none"
225
231
  }
226
232
  },
233
+ slideover: {
234
+ variants: { transition: { true: { overlay: "data-[state=open]:animate-none data-[state=closed]:animate-none" } } },
235
+ compoundVariants: [{
236
+ transition: true,
237
+ class: { content: "data-[state=open]:animate-none data-[state=closed]:animate-none" }
238
+ }]
239
+ },
240
+ switch: { slots: { thumb: "transition-none data-[state=unchecked]:scale-75" } },
227
241
  table: { slots: {
228
242
  th: "h-9 px-2.5 py-2 text-xs font-medium text-muted",
229
243
  td: "h-9 px-2.5 py-2 text-[13px] tabular-nums text-toned"
@@ -237,7 +251,7 @@ const vitehubTheme = {
237
251
  slots: {
238
252
  list: "gap-1",
239
253
  trigger: "data-[state=inactive]:text-muted data-[state=active]:text-highlighted hover:data-[state=inactive]:not-disabled:text-highlighted",
240
- indicator: "bg-(--ui-text-highlighted)"
254
+ indicator: "bg-(--ui-text-highlighted) transition-none"
241
255
  },
242
256
  variants: { size: {
243
257
  sm: {
@@ -259,7 +273,8 @@ const vitehubTheme = {
259
273
  slots: { base: "pointer-coarse:text-base" }
260
274
  },
261
275
  toast: { slots: { root: "rounded-xl ring-0 shadow-(--vh-shadow-floating)" } },
262
- tooltip: { slots: { content: "rounded-md ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md" } }
276
+ toaster: { slots: { base: "animate-none! transition-none" } },
277
+ tooltip: { slots: { content: "rounded-md ring-0 bg-(--vh-floating) shadow-(--vh-shadow-floating) backdrop-blur-md data-[state=delayed-open]:animate-none data-[state=instant-open]:animate-none data-[state=closed]:animate-none" } }
263
278
  };
264
279
  //#endregion
265
280
  export { vitehubTheme };
@@ -0,0 +1,182 @@
1
+ import { l as onReducedMotionChange, r as createSpring, s as springs } from "./opt-out-b6bnUjIT.js";
2
+ import { u as writeMotionStyle } from "./registry-D3-ysX7l.js";
3
+ import { l as reduced, o as motionSkipped } from "./ring-B7Qxu7zd.js";
4
+ import { i as playTween, t as cubicBezier } from "./tween-CO24nMpf.js";
5
+ //#region src/motion/helpers/shake.ts
6
+ const duration = .4;
7
+ const step = cubicBezier(.36, .07, .19, .97);
8
+ const frames = [
9
+ [0, 0],
10
+ [.1, -1],
11
+ [.2, 3],
12
+ [.3, -5],
13
+ [.4, 5],
14
+ [.5, -5],
15
+ [.6, 5],
16
+ [.7, -5],
17
+ [.8, 3],
18
+ [.9, -1],
19
+ [1, 0]
20
+ ];
21
+ const shaking = /* @__PURE__ */ new WeakMap();
22
+ /** The offset in pixels at `progress` of the shake: each step between two frames runs on the curve. */
23
+ function shakeOffset(progress) {
24
+ const index = Math.max(0, frames.findIndex(([at]) => at >= progress) - 1);
25
+ const [fromAt, from] = frames[index];
26
+ const [toAt, to] = frames[index + 1] ?? frames[index];
27
+ const local = toAt > fromAt ? (progress - fromAt) / (toAt - fromAt) : 1;
28
+ return from + (to - from) * step(Math.min(1, Math.max(0, local)));
29
+ }
30
+ /**
31
+ * Shakes `element` from side to side once, when it refuses an action but keeps what the person wrote, such as a comment
32
+ * box that Esc did not close. A second call starts the shake again. Under reduced motion and inside
33
+ * `data-motion="none"` it does nothing: show the refusal with a color instead.
34
+ */
35
+ function shake(element) {
36
+ shaking.get(element)?.();
37
+ if (motionSkipped(element) || reduced()) return;
38
+ const timeline = playTween(duration, (progress) => writeMotionStyle(element, { translate: progress >= 1 ? null : `${shakeOffset(progress).toFixed(2)}px 0` }));
39
+ const stop = () => {
40
+ timeline.stop();
41
+ shaking.delete(element);
42
+ writeMotionStyle(element, { translate: null });
43
+ };
44
+ shaking.set(element, stop);
45
+ timeline.done.then((completed) => completed && stop());
46
+ }
47
+ //#endregion
48
+ //#region src/motion/helpers/travel.ts
49
+ /**
50
+ * The offset that draws a box `rest` as the box `box`, when the scale turns around the point `origin` of the screen.
51
+ * The layer writes the separate `translate` and `scale` properties, which apply around the same point as the element's
52
+ * own transform, so the element can keep a transform of its own.
53
+ */
54
+ function travelOffset(rest, origin, box) {
55
+ const scaleX = rest.width ? box.width / rest.width : 1;
56
+ const scaleY = rest.height ? box.height / rest.height : 1;
57
+ return {
58
+ x: box.left - origin.x - scaleX * (rest.left - origin.x),
59
+ y: box.top - origin.y - scaleY * (rest.top - origin.y),
60
+ scaleX,
61
+ scaleY
62
+ };
63
+ }
64
+ const running = /* @__PURE__ */ new WeakMap();
65
+ const keys = [
66
+ "left",
67
+ "top",
68
+ "width",
69
+ "height"
70
+ ];
71
+ /** The element's box with nothing of the travel written, and the point of the screen that its scale turns around. */
72
+ function measure(element) {
73
+ const { translate, scale } = element.style;
74
+ writeMotionStyle(element, {
75
+ translate: null,
76
+ scale: null
77
+ });
78
+ const box = element.getBoundingClientRect();
79
+ writeMotionStyle(element, { scale: "0.5" });
80
+ const half = element.getBoundingClientRect();
81
+ writeMotionStyle(element, { translate: "100px 100px" });
82
+ const shifted = element.getBoundingClientRect();
83
+ writeMotionStyle(element, {
84
+ translate,
85
+ scale
86
+ });
87
+ return {
88
+ box,
89
+ origin: {
90
+ x: 2 * half.left - box.left,
91
+ y: 2 * half.top - box.top
92
+ },
93
+ pixels: {
94
+ x: (shifted.left - half.left) / 100 || 1,
95
+ y: (shifted.top - half.top) / 100 || 1
96
+ }
97
+ };
98
+ }
99
+ /**
100
+ * Rule 8 for a thing that moves to a new place: a picture that opens larger from where it is in the page, and goes back
101
+ * there when it closes. The element travels from `from` to its own place, or from where it is to `to`, on a spring for
102
+ * each of its position and its size, and keeps its speed when a new travel starts in the middle of one.
103
+ *
104
+ * The page lays the element out at its new place first; the travel only draws it on the way there, with `translate`
105
+ * and `scale`. Under reduced motion and inside `data-motion="none"` a new travel leaves the element at its own place,
106
+ * and `done` is false. If reduced motion turns on during a travel, it lands at once.
107
+ */
108
+ function travel(element, options) {
109
+ const previous = running.get(element);
110
+ if (motionSkipped(element) || reduced()) {
111
+ previous?.stop();
112
+ return {
113
+ done: Promise.resolve(false),
114
+ stop() {}
115
+ };
116
+ }
117
+ const { box, origin, pixels } = measure(element);
118
+ const target = options.to ?? box;
119
+ const preset = options.preset ?? springs.snappy;
120
+ let finish;
121
+ const done = new Promise((resolve) => {
122
+ finish = resolve;
123
+ });
124
+ const draw = () => {
125
+ if (running.get(element) !== motion) return;
126
+ const offset = travelOffset(box, origin, {
127
+ left: parts.left.value,
128
+ top: parts.top.value,
129
+ width: parts.width.value,
130
+ height: parts.height.value
131
+ });
132
+ writeMotionStyle(element, {
133
+ translate: `${offset.x / pixels.x}px ${offset.y / pixels.y}px`,
134
+ scale: `${offset.scaleX} ${offset.scaleY}`
135
+ });
136
+ if (keys.some((key) => parts[key].active)) return;
137
+ unwatch();
138
+ if (!options.to) {
139
+ running.delete(element);
140
+ writeMotionStyle(element, {
141
+ translate: null,
142
+ scale: null
143
+ });
144
+ }
145
+ finish(true);
146
+ };
147
+ const spring = (key) => createSpring(options.from?.[key] ?? previous?.parts[key].value ?? box[key], draw, preset);
148
+ const parts = {
149
+ left: spring("left"),
150
+ top: spring("top"),
151
+ width: spring("width"),
152
+ height: spring("height")
153
+ };
154
+ const velocity = keys.map((key) => previous?.parts[key].velocity ?? 0);
155
+ const unwatch = onReducedMotionChange((isReduced) => {
156
+ if (isReduced) for (const key of keys) parts[key].set(target[key]);
157
+ });
158
+ const motion = {
159
+ parts,
160
+ stop() {
161
+ if (running.get(element) !== motion) return;
162
+ unwatch();
163
+ for (const key of keys) parts[key].stop();
164
+ running.delete(element);
165
+ writeMotionStyle(element, {
166
+ translate: null,
167
+ scale: null
168
+ });
169
+ finish(false);
170
+ }
171
+ };
172
+ previous?.stop();
173
+ running.set(element, motion);
174
+ keys.forEach((key, index) => parts[key].to(target[key], { velocity: velocity[index] }));
175
+ draw();
176
+ return {
177
+ done,
178
+ stop: motion.stop
179
+ };
180
+ }
181
+ //#endregion
182
+ export { shake as n, travel as t };
@@ -0,0 +1,62 @@
1
+ import { a as onEachFrame, u as prefersReducedMotion } from "./opt-out-b6bnUjIT.js";
2
+ //#region src/motion/helpers/tween.ts
3
+ /** The CSS `cubic-bezier()` curve, so a helper uses the same curves as the prototype. */
4
+ function cubicBezier(x1, y1, x2, y2) {
5
+ const at = (t, a, b) => 3 * a * t * (1 - t) ** 2 + 3 * b * t ** 2 * (1 - t) + t ** 3;
6
+ return (x) => {
7
+ if (x <= 0 || x >= 1) return x <= 0 ? 0 : 1;
8
+ let low = 0;
9
+ let high = 1;
10
+ let t = x;
11
+ for (let step = 0; step < 24; step++) {
12
+ if (at(t, x1, x2) < x) low = t;
13
+ else high = t;
14
+ t = (low + high) / 2;
15
+ }
16
+ return at(t, y1, y2);
17
+ };
18
+ }
19
+ const linear = (progress) => progress;
20
+ const easeIn = cubicBezier(.42, 0, 1, 1);
21
+ const easeOut = cubicBezier(0, 0, .58, 1);
22
+ /**
23
+ * Moves a value from `from` to `to` on the shared frame loop of the motion layer, so ¼× slows it. `onFrame` gets the
24
+ * value on each frame, also `from` while the delay runs, and `onDone` runs once at the end.
25
+ */
26
+ function tween(from, to, options, onFrame, onDone) {
27
+ const delay = (options.delay ?? 0) / 1e3;
28
+ const duration = options.duration / 1e3;
29
+ const ease = options.ease ?? linear;
30
+ const reducedAtStart = prefersReducedMotion();
31
+ let elapsed = 0;
32
+ return { stop: onEachFrame((seconds) => {
33
+ elapsed += seconds;
34
+ const progress = !reducedAtStart && prefersReducedMotion() || elapsed >= delay + duration ? 1 : duration > 0 ? Math.max(0, (elapsed - delay) / duration) : 0;
35
+ onFrame(from + (to - from) * ease(progress));
36
+ if (progress < 1) return true;
37
+ onDone?.();
38
+ return false;
39
+ }) };
40
+ }
41
+ /**
42
+ * Plays a timeline of `duration` seconds after `delay` seconds. `draw` gets the progress from 0 to 1 after `ease`. `done`
43
+ * resolves with `true` when it ends, or with `false` when `stop()` ended it first.
44
+ */
45
+ function playTween(duration, draw, ease = linear, delay = 0) {
46
+ let finish = () => {};
47
+ const done = new Promise((resolve) => finish = resolve);
48
+ const timeline = tween(0, 1, {
49
+ duration: duration * 1e3,
50
+ delay: delay * 1e3,
51
+ ease
52
+ }, draw, () => finish(true));
53
+ return {
54
+ done,
55
+ stop: () => {
56
+ timeline.stop();
57
+ finish(false);
58
+ }
59
+ };
60
+ }
61
+ //#endregion
62
+ export { tween as a, playTween as i, easeIn as n, easeOut as r, cubicBezier as t };
@@ -1,4 +1,4 @@
1
- import "./index-BD1e8vx5.js";
1
+ import "./index-YUvL2nV8.js";
2
2
  import { UIDataTypes, UIMessage, UITools } from "ai";
3
3
  //#region src/types.d.ts
4
4
  type ViteHubUIMessage<Metadata = unknown, DataParts extends UIDataTypes = UIDataTypes, Tools extends UITools = UITools> = UIMessage<Metadata, DataParts, Tools>;
@@ -0,0 +1,15 @@
1
+ //#region src/motion/helpers/visual-copy.ts
2
+ function visualCopy(element) {
3
+ const copy = element.cloneNode(true);
4
+ copy.inert = true;
5
+ copy.setAttribute("aria-hidden", "true");
6
+ for (const node of [copy, ...copy.querySelectorAll("[id], [name], [form], input, button, select, textarea, fieldset")]) {
7
+ node.removeAttribute("id");
8
+ node.removeAttribute("name");
9
+ node.removeAttribute("form");
10
+ if (node.matches("input, button, select, textarea, fieldset")) node.setAttribute("disabled", "");
11
+ }
12
+ return copy;
13
+ }
14
+ //#endregion
15
+ export { visualCopy as t };
@@ -0,0 +1,112 @@
1
+ import { PropType, VNode } from "vue";
2
+ //#region src/workspace/workspace-shell.d.ts
3
+ /**
4
+ * Where the guide, the code, and the output go.
5
+ * - `side`: the code, and the output at the side.
6
+ * - `guide-top`: the guide over the code, and the output at the side. Drag the line under the guide to resize it.
7
+ * - `guide-side`: the guide in a column on the left, up to 360px and at most half the shell width. On the right, the
8
+ * output takes 40% at the top and the code sits under it.
9
+ */
10
+ type WorkspaceLayout = "side" | "guide-top" | "guide-side";
11
+ /** A built-in panel or the value of a panel that the page adds. */
12
+ type WorkspaceTab = "preview" | "terminal" | "connect" | (string & {});
13
+ /** One tab of the panel group. */
14
+ interface WorkspaceTabItem {
15
+ value: WorkspaceTab;
16
+ label: string;
17
+ /** A short count or state next to the label, such as the number of connected accounts. */
18
+ badge?: string | number;
19
+ }
20
+ /**
21
+ * Split sizes. `files` is the width of the files in pixels. `code` is the width of the code column in percent of the
22
+ * shell, in `side` and `guide-top`. `guide` is the height of the guide in percent of the code column, in `guide-top`.
23
+ */
24
+ interface WorkspaceSplits {
25
+ files: number;
26
+ code: number;
27
+ guide: number;
28
+ }
29
+ /**
30
+ * The frame of a workspace. Slots: `bar` (44px, over everything), `banner` (under the bar, such as a notice), `files`,
31
+ * `editor-head` (32px, over the editor), `editor`, `status` (24px, under the editor), `guide`, one slot per tab
32
+ * (`preview`, `terminal`, `connect`, or `tab-<value>` for a custom tab), and `overlay` (over the body). The tab bar is
33
+ * 32px too, so its bottom line meets the bottom line of `editor-head`.
34
+ */
35
+ declare const WorkspaceShell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
36
+ layout: {
37
+ default: string;
38
+ type: PropType<WorkspaceLayout>;
39
+ };
40
+ /** The visible tab. Use `v-model:tab`. */
41
+ tab: {
42
+ default: undefined;
43
+ type: PropType<WorkspaceTab>;
44
+ };
45
+ /**
46
+ * The tabs of the output, in order. Defaults to Preview, Terminal, and Connect, for the slots that are set.
47
+ */
48
+ tabs: {
49
+ default: undefined;
50
+ type: PropType<readonly WorkspaceTabItem[]>;
51
+ };
52
+ /** The localStorage key for split sizes. `false` keeps them in memory. Defaults to one key per layout. */
53
+ storageKey: {
54
+ default: undefined;
55
+ type: PropType<string | false>;
56
+ };
57
+ /** The accessible name of the workspace region. */
58
+ label: {
59
+ default: string;
60
+ type: StringConstructor;
61
+ };
62
+ covered: {
63
+ default: boolean;
64
+ type: BooleanConstructor;
65
+ };
66
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
67
+ [key: string]: any;
68
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
69
+ "update:tab": (tab: WorkspaceTab) => boolean;
70
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
71
+ layout: {
72
+ default: string;
73
+ type: PropType<WorkspaceLayout>;
74
+ };
75
+ /** The visible tab. Use `v-model:tab`. */
76
+ tab: {
77
+ default: undefined;
78
+ type: PropType<WorkspaceTab>;
79
+ };
80
+ /**
81
+ * The tabs of the output, in order. Defaults to Preview, Terminal, and Connect, for the slots that are set.
82
+ */
83
+ tabs: {
84
+ default: undefined;
85
+ type: PropType<readonly WorkspaceTabItem[]>;
86
+ };
87
+ /** The localStorage key for split sizes. `false` keeps them in memory. Defaults to one key per layout. */
88
+ storageKey: {
89
+ default: undefined;
90
+ type: PropType<string | false>;
91
+ };
92
+ /** The accessible name of the workspace region. */
93
+ label: {
94
+ default: string;
95
+ type: StringConstructor;
96
+ };
97
+ covered: {
98
+ default: boolean;
99
+ type: BooleanConstructor;
100
+ };
101
+ }>> & Readonly<{
102
+ "onUpdate:tab"?: ((tab: WorkspaceTab) => any) | undefined;
103
+ }>, {
104
+ storageKey: string | false;
105
+ label: string;
106
+ layout: WorkspaceLayout;
107
+ tab: WorkspaceTab;
108
+ tabs: readonly WorkspaceTabItem[];
109
+ covered: boolean;
110
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
111
+ //#endregion
112
+ export { WorkspaceTabItem as a, WorkspaceTab as i, WorkspaceShell as n, WorkspaceSplits as r, WorkspaceLayout as t };
@@ -0,0 +1,72 @@
1
+ import { PropType } from "vue";
2
+ //#region src/workspace/workspace-steps.d.ts
3
+ /** One step of a lesson. The guide shows its title over the step's text, and the steps menu lists it. */
4
+ interface WorkspaceStep {
5
+ title: string;
6
+ /** A short line under the title in the steps menu. */
7
+ description?: string;
8
+ }
9
+ /**
10
+ * The current step of `v-model:step`, from 0, kept inside the steps. Without a `step` prop the part keeps its own.
11
+ * `go(index)` moves to a step that exists and does nothing for one that does not.
12
+ */
13
+ declare function useStepModel(props: {
14
+ step: number | undefined;
15
+ steps: readonly WorkspaceStep[];
16
+ }, emit: (event: "update:step", step: number) => void): {
17
+ current: import("vue").ComputedRef<number>;
18
+ go: (index: number) => void;
19
+ };
20
+ /**
21
+ * After a move from a control inside `root`, focus the control that `pick` returns when the move removed or disabled
22
+ * the focused one. Focus that is still on a live control stays where it is.
23
+ */
24
+ declare function keepFocus(root: () => HTMLElement | null, pick: (controls: HTMLElement[]) => HTMLElement | undefined): void;
25
+ /**
26
+ * The steps of a lesson for the bar of a workspace: a menu with every step, the position, and Back and Next.
27
+ * Use `v-model:step`. The step is a 0-based index.
28
+ */
29
+ declare const WorkspaceSteps: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
30
+ /** The steps of the lesson, in order. */
31
+ steps: {
32
+ required: true;
33
+ type: PropType<readonly WorkspaceStep[]>;
34
+ };
35
+ /** The current step, from 0. Use `v-model:step`. */
36
+ step: {
37
+ default: undefined;
38
+ type: NumberConstructor;
39
+ };
40
+ /** A heading over the steps in the menu, such as the name of the lesson. */
41
+ label: {
42
+ default: undefined;
43
+ type: StringConstructor;
44
+ };
45
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
46
+ [key: string]: any;
47
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ "update:step": (step: number) => boolean;
49
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
50
+ /** The steps of the lesson, in order. */
51
+ steps: {
52
+ required: true;
53
+ type: PropType<readonly WorkspaceStep[]>;
54
+ };
55
+ /** The current step, from 0. Use `v-model:step`. */
56
+ step: {
57
+ default: undefined;
58
+ type: NumberConstructor;
59
+ };
60
+ /** A heading over the steps in the menu, such as the name of the lesson. */
61
+ label: {
62
+ default: undefined;
63
+ type: StringConstructor;
64
+ };
65
+ }>> & Readonly<{
66
+ "onUpdate:step"?: ((step: number) => any) | undefined;
67
+ }>, {
68
+ label: string;
69
+ step: number;
70
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
71
+ //#endregion
72
+ export { useStepModel as i, WorkspaceSteps as n, keepFocus as r, WorkspaceStep as t };
@@ -1,15 +1,28 @@
1
1
  import { BrowserSupportNotice, UnsupportedBrowser, detectUnsupportedBrowser } from "./parts/workspace/browser-support-notice.js";
2
2
  import { ConnectPanel, ConnectProviderRow, ConnectProviderState, ConnectProviderStatus, connectProviderLabel } from "./parts/workspace/connect-panel.js";
3
3
  import { ConnectStore, UseConnectStoreOptions, useConnectStore } from "./parts/workspace/connect-store.js";
4
- import { WorkspaceLayout, WorkspaceShell, WorkspaceSplits, WorkspaceTab, WorkspaceTabItem } from "./parts/workspace/workspace-shell.js";
5
- import { PlaygroundContainer, PlaygroundContainerTemplate, PlaygroundContext, PlaygroundDevice, usePlaygroundDevice } from "./parts/workspace/playground-container.js";
4
+ import { WorkspaceIssue, WorkspaceIssues } from "./parts/workspace/workspace-issues.js";
5
+ import { WorkspaceExample, WorkspaceExamples, groupExamples } from "./parts/workspace/workspace-examples.js";
6
+ import { a as WorkspaceTabItem, i as WorkspaceTab, n as WorkspaceShell, r as WorkspaceSplits, t as WorkspaceLayout } from "./workspace-shell-BJGnoF3p.js";
7
+ import { n as WorkspaceSteps, t as WorkspaceStep } from "./workspace-steps-Bgph2rpr.js";
8
+ import { Workspace, WorkspaceContext, WorkspaceDevice, WorkspaceFiles, WorkspaceMenuItem, WorkspaceRun, WorkspaceRunInput, WorkspaceRunState, WorkspaceRunner, WorkspaceSlotProps, useWorkspace, useWorkspaceDevice } from "./parts/workspace/workspace.js";
9
+ import { RenderRunnerOptions, WorkspaceRenderContext, WorkspaceRenderResult, render } from "./parts/workspace/runners/render.js";
10
+ import { WebContainerRunner, WebContainerRunnerOptions, WorkspaceSnapshot, webContainer } from "./parts/workspace/runners/web-container.js";
11
+ import { WorkspaceBar } from "./parts/workspace/workspace-bar.js";
6
12
  import { BootStepState, BootStepView, WorkspaceBootStatus, bootChecklist } from "./parts/workspace/workspace-boot-status.js";
13
+ import { WorkspaceCursor, WorkspaceStatus, workspaceLanguage } from "./parts/workspace/workspace-status.js";
7
14
  import { WorkspaceEditor } from "./parts/workspace/workspace-editor.js";
15
+ import { WorkspaceEditorHead } from "./parts/workspace/workspace-editor-head.js";
16
+ import { WorkspaceFileLink, WorkspaceFileOpener, provideWorkspaceFileOpener } from "./parts/workspace/workspace-file-link.js";
8
17
  import { WorkspaceFileTree } from "./parts/workspace/workspace-file-tree.js";
18
+ import { WorkspaceGuide } from "./parts/workspace/workspace-guide.js";
9
19
  import { WorkspacePreview, WorkspacePreviewDevice, workspacePreviewScript } from "./parts/workspace/workspace-preview.js";
20
+ import { WorkspaceSidebar, WorkspaceSidebarAction } from "./parts/workspace/workspace-sidebar.js";
21
+ import { WorkspaceStart } from "./parts/workspace/workspace-start.js";
22
+ import { WorkspaceTask } from "./parts/workspace/workspace-task.js";
10
23
  import { WorkspaceTerminal, WorkspaceTerminalOutput } from "./parts/workspace/workspace-terminal.js";
11
24
  //#region src/internal/format.d.ts
12
- /** "320 ms", "1.2 s", "30 s", or "1 min 35 s". Seconds round down, so a running counter never shows "60 s". */
25
+ /** "320ms", "1.2s", "30s", or "1m 35s". Seconds round down, so a running counter never shows "60s". */
13
26
  declare function formatDuration(ms: number): string;
14
27
  //#endregion
15
- export { type BootStepState, type BootStepView, BrowserSupportNotice, ConnectPanel, ConnectProviderRow, type ConnectProviderState, type ConnectProviderStatus, type ConnectStore, PlaygroundContainer, type PlaygroundContainerTemplate, type PlaygroundContext, type PlaygroundDevice, type UnsupportedBrowser, type UseConnectStoreOptions, WorkspaceBootStatus, WorkspaceEditor, WorkspaceFileTree, type WorkspaceLayout, WorkspacePreview, type WorkspacePreviewDevice, WorkspaceShell, type WorkspaceSplits, type WorkspaceTab, type WorkspaceTabItem, WorkspaceTerminal, type WorkspaceTerminalOutput, bootChecklist, connectProviderLabel, detectUnsupportedBrowser, formatDuration as formatElapsed, useConnectStore, usePlaygroundDevice, workspacePreviewScript };
28
+ export { type BootStepState, type BootStepView, BrowserSupportNotice, ConnectPanel, ConnectProviderRow, type ConnectProviderState, type ConnectProviderStatus, type ConnectStore, type RenderRunnerOptions, type UnsupportedBrowser, type UseConnectStoreOptions, type WebContainerRunner, type WebContainerRunnerOptions, Workspace, WorkspaceBar, WorkspaceBootStatus, type WorkspaceContext, type WorkspaceCursor, type WorkspaceDevice, WorkspaceEditor, WorkspaceEditorHead, type WorkspaceExample, WorkspaceExamples, WorkspaceFileLink, type WorkspaceFileOpener, WorkspaceFileTree, type WorkspaceFiles, WorkspaceGuide, type WorkspaceIssue, WorkspaceIssues, type WorkspaceLayout, type WorkspaceMenuItem, WorkspacePreview, type WorkspacePreviewDevice, type WorkspaceRenderContext, type WorkspaceRenderResult, type WorkspaceRun, type WorkspaceRunInput, type WorkspaceRunState, type WorkspaceRunner, WorkspaceShell, WorkspaceSidebar, type WorkspaceSidebarAction, type WorkspaceSlotProps, type WorkspaceSnapshot, type WorkspaceSplits, WorkspaceStart, WorkspaceStatus, type WorkspaceStep, WorkspaceSteps, type WorkspaceTab, type WorkspaceTabItem, WorkspaceTask, WorkspaceTerminal, type WorkspaceTerminalOutput, bootChecklist, connectProviderLabel, detectUnsupportedBrowser, formatDuration as formatElapsed, groupExamples, provideWorkspaceFileOpener, render, useConnectStore, useWorkspace, useWorkspaceDevice, webContainer, workspaceLanguage, workspacePreviewScript };