@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
@@ -0,0 +1,39 @@
1
+ //#region src/internal/format.ts
2
+ const milliseconds = new Intl.DurationFormat("en", {
3
+ style: "narrow",
4
+ millisecondsDisplay: "always"
5
+ });
6
+ const tenths = new Intl.DurationFormat("en", {
7
+ style: "narrow",
8
+ milliseconds: "numeric",
9
+ fractionalDigits: 1
10
+ });
11
+ const minutes = new Intl.DurationFormat("en", {
12
+ style: "narrow",
13
+ secondsDisplay: "always"
14
+ });
15
+ /** "320ms", "1.2s", "30s", or "1m 35s". Seconds round down, so a running counter never shows "60s". */
16
+ function formatDuration(ms) {
17
+ const whole = Math.round(ms);
18
+ if (whole < 1e3) return milliseconds.format({ milliseconds: whole });
19
+ const elapsed = Math.max(ms, 1e3);
20
+ const seconds = Math.floor(elapsed / 1e3);
21
+ if (seconds < 10) return tenths.format({
22
+ seconds,
23
+ milliseconds: Math.floor(elapsed % 1e3)
24
+ });
25
+ if (seconds < 60) return minutes.format({ seconds });
26
+ return minutes.format({
27
+ minutes: Math.floor(seconds / 60),
28
+ seconds: seconds % 60
29
+ });
30
+ }
31
+ /** Two letters for an avatar without an image: `Ana Lopez` and `ana.lopez@vitehub.dev` are `AL`, `Ana` is `AN`. */
32
+ function initials(name) {
33
+ const words = name.replace(/@.*/, "").trim().split(/[\s._-]+/).filter(Boolean);
34
+ const first = words[0] ?? "";
35
+ const second = words.length > 1 ? words.at(-1) ?? "" : first.slice(1);
36
+ return (first.slice(0, 1) + second.slice(0, 1)).toUpperCase() || "?";
37
+ }
38
+ //#endregion
39
+ export { initials as n, formatDuration as t };
@@ -1,5 +1,5 @@
1
1
  import { a as createCommentVisibility, i as commentLeaveMs, n as CommentVisibilityModel, r as CommentVisibilityOptions, t as CommentVisibility } from "./comment-visibility-DsVuVndP.js";
2
- import { a as CommentThreadAction, c as defaultCommentCan, d as useComments, f as useCommentsContext, i as CommentScope, l as draftPositionKey, n as CommentDraft, o as CommentsState, r as CommentFilterState, s as UseCommentsOptions, t as CommentCan, u as provideComments } from "./comments-Bx2WRsYy.js";
2
+ import { a as CommentThreadAction, c as UseCommentsOptions, d as provideComments, f as useComments, i as CommentScope, l as defaultCommentCan, n as CommentDraft, o as CommentsOutboxState, p as useCommentsContext, r as CommentFilterState, s as CommentsState, t as CommentCan, u as draftPositionKey } from "./comments-D8hulVPy.js";
3
3
  import { a as ChoicesInputSource, i as ChoicesInputField, n as ChoicesInputClear, o as ChoicesInputState, r as ChoicesInputError, s as ChoicesInputStatus, t as ChoicesInput } from "./choices-input-ByXJvDn1.js";
4
4
  import { a as MessageScrollerContent, c as MessageScrollerViewport, i as MessageScrollerButton, l as calculatePrependScrollTop, n as MessageScrollPosition, o as MessageScrollerContext, r as MessageScroller, s as MessageScrollerItem, t as MessageScrollBehavior, u as useMessageScroller } from "./message-scroller-Bm1YWTeY.js";
5
- export { ChoicesInput, ChoicesInputClear, ChoicesInputError, ChoicesInputField, ChoicesInputSource, ChoicesInputState, ChoicesInputStatus, CommentCan, CommentDraft, CommentFilterState, CommentScope, CommentThreadAction, CommentVisibility, CommentVisibilityModel, CommentVisibilityOptions, CommentsState, MessageScrollBehavior, MessageScrollPosition, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerContext, MessageScrollerItem, MessageScrollerViewport, UseCommentsOptions, calculatePrependScrollTop, commentLeaveMs, createCommentVisibility, defaultCommentCan, draftPositionKey, provideComments, useComments, useCommentsContext, useMessageScroller };
5
+ export { ChoicesInput, ChoicesInputClear, ChoicesInputError, ChoicesInputField, ChoicesInputSource, ChoicesInputState, ChoicesInputStatus, CommentCan, CommentDraft, CommentFilterState, CommentScope, CommentThreadAction, CommentVisibility, CommentVisibilityModel, CommentVisibilityOptions, CommentsOutboxState, CommentsState, MessageScrollBehavior, MessageScrollPosition, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerContext, MessageScrollerItem, MessageScrollerViewport, UseCommentsOptions, calculatePrependScrollTop, commentLeaveMs, createCommentVisibility, defaultCommentCan, draftPositionKey, provideComments, useComments, useCommentsContext, useMessageScroller };
package/dist/headless.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerViewport, calculatePrependScrollTop, useMessageScroller } from "./parts/headless/message-scroller.js";
2
2
  import { commentLeaveMs, createCommentVisibility } from "./parts/headless/comment-visibility.js";
3
- import { a as useCommentsContext, i as useComments, n as draftPositionKey, r as provideComments, t as defaultCommentCan } from "./comments-CkWc2Khc.js";
3
+ import { a as useCommentsContext, i as useComments, n as draftPositionKey, r as provideComments, t as defaultCommentCan } from "./comments-B88zg9gC.js";
4
4
  import { ChoicesInput, ChoicesInputClear, ChoicesInputError, ChoicesInputField, ChoicesInputStatus } from "./parts/headless/choices-input.js";
5
5
  export { ChoicesInput, ChoicesInputClear, ChoicesInputError, ChoicesInputField, ChoicesInputStatus, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerViewport, calculatePrependScrollTop, commentLeaveMs, createCommentVisibility, defaultCommentCan, draftPositionKey, provideComments, useComments, useCommentsContext, useMessageScroller };
@@ -0,0 +1,51 @@
1
+ //#region src/motion/hold-to-delete.d.ts
2
+ type HoldToDeleteState = "idle" | "holding" | "leaving" | "undo" | "committing";
3
+ interface HoldToDeleteOptions {
4
+ /** The real delete. It runs once, when the Undo window has passed. A rejection brings the item back. */
5
+ commit: () => void | Promise<void>;
6
+ /** The hold is complete: hide the item now. The delete is not done yet. */
7
+ onDelete?: () => void;
8
+ /** Undo, or a commit that failed: show the item again. */
9
+ onUndo?: () => void;
10
+ /** The commit failed. The item is back. */
11
+ onError?: (error: unknown) => void;
12
+ /** Every change of state, such as for a Vue wrapper. */
13
+ onState?: (state: HoldToDeleteState) => void;
14
+ /** The item that leaves toward the trash, such as the row of the button. */
15
+ item?: () => Element | null | undefined;
16
+ /** The label before the hold. Defaults to "Hold to delete". An empty label shows only the trash can. */
17
+ label?: string;
18
+ /** The label of the Undo window. Defaults to "Undo". */
19
+ undoLabel?: string;
20
+ /** How long Undo stays, in milliseconds. Defaults to 5000. */
21
+ undoFor?: number;
22
+ /**
23
+ * The plain path for assistive technology: a click that is not a hold, such as from a screen reader, asks this first.
24
+ * Defaults to `window.confirm()`.
25
+ */
26
+ confirm?: () => boolean | Promise<boolean>;
27
+ }
28
+ interface HoldToDelete {
29
+ readonly state: HoldToDeleteState;
30
+ /** Brings the item back during the Undo window. */
31
+ undo(): void;
32
+ /**
33
+ * Stops the helper and restores the button. When the item already left and Undo shows, the delete commits now: the
34
+ * person deleted it and did not undo. A hold that is not complete is cancelled.
35
+ */
36
+ destroy(): void;
37
+ }
38
+ /**
39
+ * Hold to delete of docs/design/motion.md: "Something is deleted and the delete can be undone". It draws into `button`:
40
+ * a fill that grows while the button is held and empties when it is let go early, and a trash can whose lid lifts with
41
+ * it. A complete hold calls `onDelete`, the letters of the label jump into the can, the item leaves toward it, and the
42
+ * button turns into Undo for `undoFor` ms. The real delete, `commit`, runs only when that window has passed.
43
+ *
44
+ * A pointer or Space or Enter held on the button holds it. A click that is not a hold, such as from a screen reader,
45
+ * asks `confirm` and then deletes with the same Undo. Leaving the page or `destroy()` during the Undo window commits.
46
+ * Under reduced motion the fill still shows the hold, but the lid, the letters, and the item do not travel: the label
47
+ * cross-fades. Inside `data-motion="none"` the label changes at once.
48
+ */
49
+ declare function createHoldToDelete(button: HTMLElement, options: HoldToDeleteOptions): HoldToDelete;
50
+ //#endregion
51
+ export { createHoldToDelete as i, HoldToDeleteOptions as n, HoldToDeleteState as r, HoldToDelete as t };
@@ -0,0 +1,434 @@
1
+ import { a as onEachFrame, i as getMotionSlowFactor, l as onReducedMotionChange, r as createSpring, t as isMotionOff, u as prefersReducedMotion } from "./opt-out-b6bnUjIT.js";
2
+ import { u as writeMotionStyle } from "./registry-D3-ysX7l.js";
3
+ import { i as playTween, t as cubicBezier } from "./tween-CO24nMpf.js";
4
+ import { t as announce } from "./announce-Cy_Tn9wW.js";
5
+ import { t as visualCopy } from "./visual-copy-CrVc3z4n.js";
6
+ //#region src/motion/hold-to-delete.ts
7
+ const svgNs = "http://www.w3.org/2000/svg";
8
+ const fillSeconds = 1.1;
9
+ const emptySeconds = .35;
10
+ const lidHold = -24;
11
+ const lidOpen = -78;
12
+ const widthSpring = {
13
+ stiffness: 380,
14
+ damping: 32
15
+ };
16
+ const lidOpenEasing = cubicBezier(.3, 1.5, .5, 1);
17
+ const riseEasing = cubicBezier(.2, .7, .4, 1);
18
+ const fallEasing = cubicBezier(.6, 0, .9, .5);
19
+ const easeIn = cubicBezier(.42, 0, 1, 1);
20
+ const leaveEasing = cubicBezier(.5, 0, .75, 0);
21
+ const leavingAttribute = "data-motion-leaving";
22
+ function svg(tag, attributes) {
23
+ const element = document.createElementNS(svgNs, tag);
24
+ for (const [name, value] of Object.entries(attributes)) element.setAttribute(name, value);
25
+ return element;
26
+ }
27
+ function trashCan() {
28
+ const can = svg("svg", {
29
+ "aria-hidden": "true",
30
+ "data-part": "can",
31
+ fill: "none",
32
+ height: "16",
33
+ stroke: "currentColor",
34
+ "stroke-linecap": "round",
35
+ "stroke-linejoin": "round",
36
+ "stroke-width": "2",
37
+ viewBox: "0 0 24 24",
38
+ width: "16"
39
+ });
40
+ const lid = svg("g", { "data-part": "lid" });
41
+ lid.append(svg("path", { d: "M3 6h18" }), svg("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }));
42
+ can.append(lid, svg("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }));
43
+ Object.assign(can.style, {
44
+ flex: "none",
45
+ overflow: "visible"
46
+ });
47
+ Object.assign(lid.style, {
48
+ transformBox: "fill-box",
49
+ transformOrigin: "0% 100%"
50
+ });
51
+ return {
52
+ can,
53
+ lid
54
+ };
55
+ }
56
+ const center = (rect) => ({
57
+ x: rect.left + rect.width / 2,
58
+ y: rect.top + rect.height / 2
59
+ });
60
+ /**
61
+ * Hold to delete of docs/design/motion.md: "Something is deleted and the delete can be undone". It draws into `button`:
62
+ * a fill that grows while the button is held and empties when it is let go early, and a trash can whose lid lifts with
63
+ * it. A complete hold calls `onDelete`, the letters of the label jump into the can, the item leaves toward it, and the
64
+ * button turns into Undo for `undoFor` ms. The real delete, `commit`, runs only when that window has passed.
65
+ *
66
+ * A pointer or Space or Enter held on the button holds it. A click that is not a hold, such as from a screen reader,
67
+ * asks `confirm` and then deletes with the same Undo. Leaving the page or `destroy()` during the Undo window commits.
68
+ * Under reduced motion the fill still shows the hold, but the lid, the letters, and the item do not travel: the label
69
+ * cross-fades. Inside `data-motion="none"` the label changes at once.
70
+ */
71
+ function createHoldToDelete(button, options) {
72
+ const label = options.label ?? "Hold to delete";
73
+ const undoLabel = options.undoLabel ?? "Undo";
74
+ const undoFor = options.undoFor ?? 5e3;
75
+ const fill = document.createElement("span");
76
+ fill.dataset.part = "fill";
77
+ fill.setAttribute("aria-hidden", "true");
78
+ Object.assign(fill.style, {
79
+ background: "var(--vh-hold-fill, color-mix(in oklch, var(--vh-error, var(--ui-error, currentColor)) 14%, transparent))",
80
+ borderRadius: "inherit",
81
+ clipPath: "inset(0 calc((1 - var(--vh-hold, 0)) * 100%) 0 0 round 6px)",
82
+ inset: "-1px",
83
+ pointerEvents: "none",
84
+ position: "absolute"
85
+ });
86
+ const content = document.createElement("span");
87
+ content.dataset.part = "label";
88
+ Object.assign(content.style, {
89
+ alignItems: "center",
90
+ display: "inline-flex",
91
+ gap: "inherit",
92
+ position: "relative"
93
+ });
94
+ const { can, lid } = trashCan();
95
+ const text = document.createElement("span");
96
+ text.dataset.part = "text";
97
+ Object.assign(text.style, { whiteSpace: "pre" });
98
+ content.append(can, text);
99
+ if (getComputedStyle(button).position === "static") button.style.position = "relative";
100
+ button.style.userSelect = "none";
101
+ button.style.setProperty("-webkit-user-select", "none");
102
+ button.style.whiteSpace = "nowrap";
103
+ button.dataset.slot ??= "hold-to-delete";
104
+ button.replaceChildren(fill, content);
105
+ let state = "idle";
106
+ let hold = 0;
107
+ let direction = 0;
108
+ let stopHold;
109
+ let stopTweens = [];
110
+ let undoTimer;
111
+ let pressStart;
112
+ let holdKey;
113
+ let destroyed = false;
114
+ const still = () => prefersReducedMotion() || isMotionOff(button);
115
+ const width = createSpring(0, (value) => {
116
+ button.style.width = width.active ? `${value.toFixed(2)}px` : "";
117
+ }, widthSpring);
118
+ function setState(next) {
119
+ state = next;
120
+ button.dataset.state = next;
121
+ options.onState?.(next);
122
+ }
123
+ function natural() {
124
+ const current = button.style.width;
125
+ button.style.width = "";
126
+ const value = button.getBoundingClientRect().width;
127
+ button.style.width = current;
128
+ return value;
129
+ }
130
+ function setText(value, animate) {
131
+ const from = button.getBoundingClientRect().width;
132
+ text.replaceChildren(...[...value].map((letter) => {
133
+ const span = document.createElement("span");
134
+ span.textContent = letter;
135
+ span.style.display = "inline-block";
136
+ return span;
137
+ }));
138
+ text.hidden = value === "";
139
+ if (!animate || isMotionOff(button)) return;
140
+ const to = natural();
141
+ if (prefersReducedMotion()) {
142
+ const fade = playTween(.15, (p) => text.style.opacity = p < 1 ? p.toFixed(3) : "");
143
+ stopTweens.push(fade.stop);
144
+ return;
145
+ }
146
+ width.set(from);
147
+ button.style.width = `${from}px`;
148
+ width.to(to);
149
+ [...text.children].forEach((letter, index) => {
150
+ if (!(letter instanceof HTMLElement)) return;
151
+ writeMotionStyle(letter, {
152
+ opacity: "0",
153
+ filter: "blur(6px)"
154
+ });
155
+ const tween = playTween(.24, (p) => writeMotionStyle(letter, p < 1 ? {
156
+ opacity: p.toFixed(3),
157
+ filter: `blur(${(6 * (1 - p)).toFixed(2)}px)`
158
+ } : {
159
+ opacity: null,
160
+ filter: null
161
+ }), (t) => t, .04 + index * .028);
162
+ stopTweens.push(tween.stop);
163
+ });
164
+ }
165
+ function paint() {
166
+ button.style.setProperty("--vh-hold", hold.toFixed(4));
167
+ const box = button.getBoundingClientRect();
168
+ const edge = box.left + box.width * hold;
169
+ for (const letter of text.children) {
170
+ if (!(letter instanceof HTMLElement)) continue;
171
+ const rect = letter.getBoundingClientRect();
172
+ letter.style.color = rect.left + rect.width / 2 < edge ? "var(--vh-error, var(--ui-error, currentColor))" : "";
173
+ }
174
+ can.style.color = hold > 0 ? `color-mix(in oklch, var(--vh-error, var(--ui-error, currentColor)) ${Math.min(100, hold * 600).toFixed(1)}%, currentColor)` : "";
175
+ writeMotionStyle(lid, { rotate: !still() && hold > 0 ? `${(lidHold * hold).toFixed(2)}deg` : null });
176
+ }
177
+ function run(next) {
178
+ if (state !== "idle" && state !== "holding") return;
179
+ direction = next;
180
+ if (next > 0) setState("holding");
181
+ if (stopHold) return;
182
+ stopHold = onEachFrame((seconds) => {
183
+ hold = Math.max(0, Math.min(1, hold + seconds * direction / (direction > 0 ? fillSeconds : emptySeconds)));
184
+ paint();
185
+ if (hold >= 1 && direction > 0) {
186
+ stopHold = void 0;
187
+ complete();
188
+ return false;
189
+ }
190
+ if (hold <= 0 && direction < 0) {
191
+ stopHold = void 0;
192
+ setState("idle");
193
+ return false;
194
+ }
195
+ return true;
196
+ });
197
+ }
198
+ function itemLeaves() {
199
+ const item = options.item?.();
200
+ if (!(item instanceof HTMLElement) || still()) return Promise.resolve();
201
+ item.setAttribute(leavingAttribute, "");
202
+ const rect = item.getBoundingClientRect();
203
+ const ghost = visualCopy(item);
204
+ ghost.removeAttribute(leavingAttribute);
205
+ Object.assign(ghost.style, {
206
+ boxSizing: "border-box",
207
+ height: `${rect.height}px`,
208
+ left: `${rect.left}px`,
209
+ margin: "0",
210
+ pointerEvents: "none",
211
+ position: "fixed",
212
+ top: `${rect.top}px`,
213
+ width: `${rect.width}px`,
214
+ zIndex: "2147483646"
215
+ });
216
+ writeMotionStyle(ghost, {
217
+ translate: null,
218
+ scale: null,
219
+ opacity: null,
220
+ filter: null
221
+ });
222
+ document.body.append(ghost);
223
+ const from = center(rect);
224
+ const to = center(can.getBoundingClientRect());
225
+ const tween = playTween(.32, (p) => {
226
+ writeMotionStyle(ghost, {
227
+ translate: `${((to.x - from.x) * p).toFixed(2)}px ${((to.y - from.y) * p).toFixed(2)}px`,
228
+ scale: (1 - .8 * p).toFixed(4),
229
+ opacity: (1 - p).toFixed(3),
230
+ filter: p > 0 ? `blur(${(3 * p).toFixed(2)}px)` : null
231
+ });
232
+ }, leaveEasing);
233
+ stopTweens.push(tween.stop);
234
+ return tween.done.finally(() => {
235
+ ghost.remove();
236
+ item.removeAttribute(leavingAttribute);
237
+ });
238
+ }
239
+ function lettersLeave() {
240
+ const target = can.getBoundingClientRect();
241
+ const tx = target.left + target.width / 2;
242
+ const ty = target.top + target.height * .35;
243
+ return Promise.all([...text.children].map((letter, index) => {
244
+ if (!(letter instanceof HTMLElement)) return void 0;
245
+ letter.style.color = "var(--vh-error, var(--ui-error, currentColor))";
246
+ const rect = letter.getBoundingClientRect();
247
+ const dx = tx - (rect.left + rect.width / 2);
248
+ const dy = ty - (rect.top + rect.height / 2);
249
+ const lift = -12 - Math.min(18, Math.abs(dx) * .14);
250
+ const turn = -15 - index * 4;
251
+ const tween = playTween(.46 + index * .01, (p) => {
252
+ if (p <= .55) {
253
+ const e = riseEasing(p / .55);
254
+ writeMotionStyle(letter, {
255
+ translate: `${(dx * .5 * e).toFixed(2)}px ${(lift * e).toFixed(2)}px`,
256
+ rotate: `${(turn * e).toFixed(2)}deg`
257
+ });
258
+ return;
259
+ }
260
+ const e = fallEasing((p - .55) / .45);
261
+ writeMotionStyle(letter, {
262
+ translate: `${(dx * .5 + dx * .5 * e).toFixed(2)}px ${(lift + (dy - lift) * e).toFixed(2)}px`,
263
+ rotate: `${(turn + (-70 - turn) * e).toFixed(2)}deg`,
264
+ scale: (1 - .7 * e).toFixed(4),
265
+ opacity: (1 - e).toFixed(3)
266
+ });
267
+ }, (t) => t, .14 + index * .042);
268
+ stopTweens.push(tween.stop);
269
+ return tween.done;
270
+ }));
271
+ }
272
+ async function complete() {
273
+ setState("leaving");
274
+ const leaving = itemLeaves();
275
+ options.onDelete?.();
276
+ if (state !== "leaving") return;
277
+ if (still()) return toUndo();
278
+ const open = playTween(.22, (p) => writeMotionStyle(lid, { rotate: `${(lidHold + -54 * p).toFixed(2)}deg` }), lidOpenEasing);
279
+ stopTweens.push(open.stop);
280
+ await Promise.all([lettersLeave(), leaving]);
281
+ if (state !== "leaving") return;
282
+ const shut = playTween(.3, (p) => {
283
+ const angle = p <= .65 ? lidOpen + 83 * (p / .65) : 5 - 5 * ((p - .65) / .35);
284
+ writeMotionStyle(lid, { rotate: p < 1 ? `${angle.toFixed(2)}deg` : null });
285
+ }, easeIn);
286
+ stopTweens.push(shut.stop);
287
+ await new Promise((resolve) => setTimeout(resolve, 340 * getMotionSlowFactor()));
288
+ if (state === "leaving") toUndo();
289
+ }
290
+ function toUndo() {
291
+ if (destroyed) return;
292
+ setState("undo");
293
+ const reset = () => {
294
+ hold = 0;
295
+ button.style.setProperty("--vh-hold", "0");
296
+ fill.style.opacity = "";
297
+ can.style.color = "";
298
+ };
299
+ if (still()) reset();
300
+ else {
301
+ const fade = playTween(.26, (p) => fill.style.opacity = (1 - p).toFixed(3));
302
+ stopTweens.push(fade.stop);
303
+ fade.done.then((done) => done && reset());
304
+ }
305
+ for (const letter of text.children) if (letter instanceof HTMLElement) letter.style.color = "";
306
+ setText(undoLabel, true);
307
+ announce(button, `Deleted. ${undoLabel} is available.`);
308
+ undoTimer = setTimeout(() => void commit(), undoFor * getMotionSlowFactor());
309
+ }
310
+ function clear() {
311
+ stopHold?.();
312
+ stopHold = void 0;
313
+ for (const stop of stopTweens) stop();
314
+ stopTweens = [];
315
+ clearTimeout(undoTimer);
316
+ undoTimer = void 0;
317
+ hold = 0;
318
+ direction = 0;
319
+ fill.style.opacity = "";
320
+ can.style.color = "";
321
+ text.style.opacity = "";
322
+ button.style.setProperty("--vh-hold", "0");
323
+ writeMotionStyle(lid, { rotate: null });
324
+ for (const letter of text.children) if (letter instanceof HTMLElement) letter.style.color = "";
325
+ }
326
+ function toIdle(animate) {
327
+ clear();
328
+ setState("idle");
329
+ setText(label, animate);
330
+ }
331
+ async function commit() {
332
+ if (state !== "undo" && state !== "leaving") return;
333
+ clearTimeout(undoTimer);
334
+ setState("committing");
335
+ try {
336
+ await options.commit();
337
+ if (!destroyed) toIdle(false);
338
+ } catch (error) {
339
+ if (!destroyed) toIdle(true);
340
+ options.onUndo?.();
341
+ options.onError?.(error);
342
+ }
343
+ }
344
+ function undo() {
345
+ if (state !== "undo" && state !== "leaving") return;
346
+ toIdle(true);
347
+ options.onUndo?.();
348
+ }
349
+ const release = () => {
350
+ if (state === "holding") run(-1);
351
+ setTimeout(() => pressStart = void 0);
352
+ };
353
+ const onPointerDown = (event) => {
354
+ if (event.button !== 0) return;
355
+ pressStart = state;
356
+ if (state === "idle" || state === "holding") run(1);
357
+ };
358
+ const onKeyDown = (event) => {
359
+ if (event.key !== " " && event.key !== "Enter") return;
360
+ event.preventDefault();
361
+ if (event.repeat) return;
362
+ pressStart = state;
363
+ if (state === "undo" || state === "leaving") return undo();
364
+ if (state === "idle" || state === "holding") {
365
+ holdKey = event.key;
366
+ run(1);
367
+ }
368
+ };
369
+ const releaseKey = () => {
370
+ if (holdKey === void 0) return;
371
+ holdKey = void 0;
372
+ release();
373
+ };
374
+ const onKeyUp = (event) => {
375
+ if (event.key === holdKey) releaseKey();
376
+ };
377
+ const onClick = async () => {
378
+ const started = pressStart;
379
+ if (state === "undo" || state === "leaving") {
380
+ if (started === void 0 || started === "undo" || started === "leaving") undo();
381
+ return;
382
+ }
383
+ if (started !== void 0 || state !== "idle") return;
384
+ if (await (options.confirm ?? (() => window.confirm(`${label || "Delete"}?`)))() && !destroyed && state === "idle") {
385
+ clear();
386
+ complete();
387
+ }
388
+ };
389
+ const onPageHide = () => {
390
+ if (state === "undo" || state === "leaving") commit();
391
+ };
392
+ const stopWatchingMotion = onReducedMotionChange((reduced) => {
393
+ if (!reduced || state !== "leaving") return;
394
+ clear();
395
+ toUndo();
396
+ });
397
+ button.addEventListener("pointerdown", onPointerDown);
398
+ button.addEventListener("pointerup", release);
399
+ button.addEventListener("pointerleave", release);
400
+ button.addEventListener("pointercancel", release);
401
+ button.addEventListener("keydown", onKeyDown);
402
+ button.addEventListener("keyup", onKeyUp);
403
+ button.addEventListener("blur", releaseKey);
404
+ button.addEventListener("click", onClick);
405
+ window.addEventListener("pagehide", onPageHide);
406
+ setText(label, false);
407
+ setState("idle");
408
+ return {
409
+ get state() {
410
+ return state;
411
+ },
412
+ undo,
413
+ destroy() {
414
+ if (destroyed) return;
415
+ if (state === "undo" || state === "leaving") commit();
416
+ destroyed = true;
417
+ clear();
418
+ width.stop();
419
+ button.style.width = "";
420
+ button.removeEventListener("pointerdown", onPointerDown);
421
+ button.removeEventListener("pointerup", release);
422
+ button.removeEventListener("pointerleave", release);
423
+ button.removeEventListener("pointercancel", release);
424
+ button.removeEventListener("keydown", onKeyDown);
425
+ button.removeEventListener("keyup", onKeyUp);
426
+ button.removeEventListener("blur", releaseKey);
427
+ button.removeEventListener("click", onClick);
428
+ window.removeEventListener("pagehide", onPageHide);
429
+ stopWatchingMotion();
430
+ }
431
+ };
432
+ }
433
+ //#endregion
434
+ export { createHoldToDelete as t };
@@ -0,0 +1,31 @@
1
+ //#region src/motion/helpers/icon.d.ts
2
+ /** How the old icon leaves: it blurs out, or, for an arrow, it leaves in the direction that it points. */
3
+ type IconExit = "blur" | "left" | "right" | "up" | "down";
4
+ /**
5
+ * How the new icon comes in: it blurs in, it draws its stroke (a spinner, a check), or it slides in, moving in the
6
+ * direction given, as an arrow that comes back.
7
+ */
8
+ type IconEnter = "blur" | "draw" | "left" | "right" | "up" | "down";
9
+ interface SwapIconOptions {
10
+ /** Default: `"blur"`. */
11
+ exit?: IconExit;
12
+ /** Default: `"draw"` for a spinning icon (`animate-spin`), else `"blur"`. */
13
+ enter?: IconEnter;
14
+ /**
15
+ * Called for each old icon when it has left, in place of `icon.remove()`, for a container whose children a framework
16
+ * renders. Vue removes the icon from its own list.
17
+ */
18
+ onRemove?: (icon: Element) => void;
19
+ }
20
+ /**
21
+ * Swaps the icon in `container` for `icon`, as rule 5 of docs/design/motion.md asks: the old icon blurs out, or leaves in
22
+ * the direction it points, while the new one comes in, and a spinner or a check draws its stroke. `icon` may already be
23
+ * a child of `container`, as when a framework renders it; else the helper appends it. Every other icon in the container
24
+ * leaves, and is removed when it is gone.
25
+ *
26
+ * Call it again at any time: an icon that is still coming in leaves from where it is. Under reduced motion the icons
27
+ * crossfade in 150ms. Inside `data-motion="none"` the old icons go at once.
28
+ */
29
+ declare function swapIcon(container: HTMLElement, icon: Element, options?: SwapIconOptions): void;
30
+ //#endregion
31
+ export { swapIcon as i, IconExit as n, SwapIconOptions as r, IconEnter as t };
@@ -1,5 +1,5 @@
1
- import { r as useUIComponent } from "./nuxt-ui-DSQFzq3s.js";
2
- import { a as useViteHubUIIcons } from "./config-Dk67emQt.js";
1
+ import { r as useUIComponent } from "./nuxt-ui-CgvMzO5v.js";
2
+ import { a as useViteHubUIIcons } from "./config-B1u7zqMB.js";
3
3
  import { computed, defineComponent, h, ref, watch } from "vue";
4
4
  //#region src/internal/image-preview.ts
5
5
  function isImageUrl(value) {
@@ -1,13 +1,10 @@
1
1
  import "nostics";
2
- //#region ../runtime/src/host.d.ts
2
+ //#region ../runtime/src/core.d.ts
3
3
  declare global {
4
- /** `wrangler types` adds the app's bindings to `Cloudflare.Env`. ViteHub reads it to type `getHostBinding()`. */
5
- namespace Cloudflare {
6
- interface Env {}
4
+ namespace ViteHub {
5
+ interface AuthRegistry {}
7
6
  }
8
7
  }
9
- //#endregion
10
- //#region ../runtime/src/index.d.ts
11
8
  interface TraceContext {
12
9
  id: string;
13
10
  parentId?: string;
@@ -66,4 +63,11 @@ interface TraceRunView {
66
63
  steps: TraceStepView[];
67
64
  }
68
65
  //#endregion
66
+ //#region ../runtime/src/host.d.ts
67
+ declare global {
68
+ namespace Cloudflare {
69
+ interface Env {}
70
+ }
71
+ }
72
+ //#endregion
69
73
  export { TraceRunView as n, TraceStepView as r, TraceEventLogEntry as t };