@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.
- package/README.md +107 -81
- package/dist/announce-Cy_Tn9wW.js +32 -0
- package/dist/{code-view-D0bqhogi.js → code-view-DsU-xzic.js} +4 -4
- package/dist/comment-attachments-C4yNbcx5.js +20 -0
- package/dist/{comment-composer-jYv2ULNP.js → comment-composer-D7ZytyER.js} +257 -10
- package/dist/{comment-composer-Cc8Jvu6u.d.ts → comment-composer-DvKMTrAi.d.ts} +1 -1
- package/dist/{comment-layer-ClH4MLj4.d.ts → comment-layer-GTsLdABl.d.ts} +17 -6
- package/dist/{comment-list-B8hphLfS.d.ts → comment-list-BI96empx.d.ts} +2 -2
- package/dist/comment-marks.css +18 -22
- package/dist/{comment-panel-fcKSKwLC.d.ts → comment-panel-CsKWTms_.d.ts} +15 -4
- package/dist/{comment-row-Bbm9WwuF.js → comment-row-JmTC0uXr.js} +2 -2
- package/dist/comment-selection-bar-CyVBNYl9.d.ts +42 -0
- package/dist/comment-send-7bg4NEEM.js +277 -0
- package/dist/comment-send-C45dHC22.d.ts +25 -0
- package/dist/comment-send.css +267 -0
- package/dist/comment-thread-B_Sc2QX6.js +797 -0
- package/dist/{comment-thread-CoTLrdal.d.ts → comment-thread-C6U-bsK_.d.ts} +23 -6
- package/dist/{comments-CkWc2Khc.js → comments-B88zg9gC.js} +66 -10
- package/dist/{comments-Bx2WRsYy.d.ts → comments-D8hulVPy.d.ts} +34 -6
- package/dist/{comments-context-C2lOZyQ5.js → comments-context-DhbIdYQ1.js} +2 -1
- package/dist/{config-Dk67emQt.js → config-B1u7zqMB.js} +8 -1
- package/dist/{config-DgxBW013.d.ts → config-pHazYdq6.d.ts} +11 -0
- package/dist/drop-field-3CDRFFRm.js +163 -0
- package/dist/{editor-C_wt4RRV.js → editor-BHYGLgty.js} +42 -3
- package/dist/effects-Ql6VzCRa.js +2971 -0
- package/dist/format-orwcdZL_.js +39 -0
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/hold-to-delete-DjWzRDyY.d.ts +51 -0
- package/dist/hold-to-delete-ROLQRZg_.js +434 -0
- package/dist/icon-c5Jb_Tl7.d.ts +31 -0
- package/dist/{image-preview-C9tdkmEj.js → image-preview-BigoAvb3.js} +2 -2
- package/dist/{index-BD1e8vx5.d.ts → index-YUvL2nV8.d.ts} +10 -6
- package/dist/index.d.ts +18 -12
- package/dist/index.js +47 -45
- package/dist/install-D5f6msEU.js +17 -0
- package/dist/list-RCbNZ14q.js +271 -0
- package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-Dfl2DgPS.js} +1 -1
- package/dist/{markdown-editor-DqdZfIEn.d.ts → markdown-editor-wQF0yD5o.d.ts} +1 -1
- package/dist/markdown-editor.d.ts +1 -1
- package/dist/markdown-editor.js +1 -1
- package/dist/motion/core.d.ts +4 -0
- package/dist/motion/core.js +11 -0
- package/dist/motion-core-lHRF8PZz.d.ts +456 -0
- package/dist/motion.d.ts +16 -0
- package/dist/motion.js +13 -0
- package/dist/{nuxt-ui-DSQFzq3s.js → nuxt-ui-CgvMzO5v.js} +20 -14
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +20 -5
- package/dist/opt-out-b6bnUjIT.js +208 -0
- package/dist/parts/components/agent-session.js +1 -1
- package/dist/parts/components/attachment.js +1 -1
- package/dist/parts/components/avatar-stack.js +3 -2
- package/dist/parts/components/chat-session.d.ts +1 -1
- package/dist/parts/components/chat.js +2 -2
- package/dist/parts/components/code-block.js +1 -1
- package/dist/parts/components/code-view.js +1 -1
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -1
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +54 -23
- package/dist/parts/components/comment-list.d.ts +1 -1
- package/dist/parts/components/comment-list.js +13 -7
- package/dist/parts/components/comment-panel.d.ts +1 -1
- package/dist/parts/components/comment-panel.js +46 -20
- package/dist/parts/components/comment-pin.js +1 -1
- package/dist/parts/components/comment-selection-bar.d.ts +2 -0
- package/dist/parts/components/comment-selection-bar.js +117 -0
- package/dist/parts/components/comment-send.d.ts +2 -0
- package/dist/parts/components/comment-send.js +2 -0
- package/dist/parts/components/comment-thread.d.ts +2 -2
- package/dist/parts/components/comment-thread.js +2 -570
- package/dist/parts/components/comments.d.ts +8 -6
- package/dist/parts/components/comments.js +6 -4
- package/dist/parts/components/copy-button.d.ts +12 -2
- package/dist/parts/components/copy-button.js +226 -1
- package/dist/parts/components/drop-field.d.ts +69 -0
- package/dist/parts/components/drop-field.js +77 -0
- package/dist/parts/components/filter-search.js +1 -1
- package/dist/parts/components/hold-to-delete.d.ts +82 -0
- package/dist/parts/components/hold-to-delete.js +76 -0
- package/dist/parts/components/markdown-editor.d.ts +1 -1
- package/dist/parts/components/markdown-editor.js +1 -1
- package/dist/parts/components/markdown-renderer.js +1 -1
- package/dist/parts/components/markdown.js +1 -1
- package/dist/parts/components/message-parts.js +13 -5
- package/dist/parts/components/motion-list.d.ts +42 -0
- package/dist/parts/components/motion-list.js +42 -0
- package/dist/parts/components/motion.d.ts +124 -0
- package/dist/parts/components/motion.js +172 -0
- package/dist/parts/components/progress.d.ts +41 -0
- package/dist/parts/components/progress.js +54 -0
- package/dist/parts/components/prompt-input.d.ts +3 -3
- package/dist/parts/components/prompt-input.js +3 -3
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/sync-status.js +2 -1
- package/dist/parts/components/tool-list.d.ts +1 -1
- package/dist/parts/components/trace-run.d.ts +1 -1
- package/dist/parts/components/trace-run.js +2 -2
- package/dist/parts/headless/comments.d.ts +2 -2
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/playground/share.d.ts +36 -2
- package/dist/parts/workspace/browser-support-notice.js +12 -4
- package/dist/parts/workspace/codemirror.d.ts +9 -0
- package/dist/parts/workspace/codemirror.js +37 -4
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/file-icons.d.ts +16 -0
- package/dist/parts/workspace/file-icons.js +82 -0
- package/dist/parts/workspace/icons.d.ts +1 -0
- package/dist/parts/workspace/icons.js +1 -0
- package/dist/parts/workspace/runners/render.d.ts +26 -0
- package/dist/parts/workspace/runners/render.js +124 -0
- package/dist/parts/workspace/runners/web-container.d.ts +29 -0
- package/dist/parts/workspace/runners/web-container.js +186 -0
- package/dist/parts/workspace/workspace-bar.d.ts +51 -0
- package/dist/parts/workspace/workspace-bar.js +51 -0
- package/dist/parts/workspace/workspace-boot-status.js +1 -1
- package/dist/parts/workspace/workspace-editor-head.d.ts +47 -0
- package/dist/parts/workspace/workspace-editor-head.js +66 -0
- package/dist/parts/workspace/workspace-editor.d.ts +17 -0
- package/dist/parts/workspace/workspace-editor.js +29 -3
- package/dist/parts/workspace/workspace-examples.d.ts +74 -0
- package/dist/parts/workspace/workspace-examples.js +72 -0
- package/dist/parts/workspace/workspace-file-link.d.ts +35 -0
- package/dist/parts/workspace/workspace-file-link.js +39 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +8 -8
- package/dist/parts/workspace/workspace-file-tree.js +26 -19
- package/dist/parts/workspace/workspace-guide.d.ts +52 -0
- package/dist/parts/workspace/workspace-guide.js +91 -0
- package/dist/parts/workspace/workspace-issues.d.ts +46 -0
- package/dist/parts/workspace/workspace-issues.js +49 -0
- package/dist/parts/workspace/workspace-preview.js +1 -1
- package/dist/parts/workspace/workspace-shell.d.ts +2 -88
- package/dist/parts/workspace/workspace-shell.js +131 -78
- package/dist/parts/workspace/workspace-sidebar.d.ts +75 -0
- package/dist/parts/workspace/workspace-sidebar.js +132 -0
- package/dist/parts/workspace/workspace-start.d.ts +47 -0
- package/dist/parts/workspace/workspace-start.js +60 -0
- package/dist/parts/workspace/workspace-status.d.ts +69 -0
- package/dist/parts/workspace/workspace-status.js +74 -0
- package/dist/parts/workspace/workspace-steps.d.ts +2 -0
- package/dist/parts/workspace/workspace-steps.js +128 -0
- package/dist/parts/workspace/workspace-task.d.ts +20 -0
- package/dist/parts/workspace/workspace-task.js +20 -0
- package/dist/parts/workspace/workspace.d.ts +251 -0
- package/dist/parts/workspace/workspace.js +665 -0
- package/dist/{pierre-code-view-xgBL6DO7.js → pierre-code-view-NE35tkmR.js} +37 -17
- package/dist/playground.d.ts +1 -1
- package/dist/progress-C7afI5vq.js +266 -0
- package/dist/registry-D3-ysX7l.js +78 -0
- package/dist/{relative-time-BVmjOsYG.js → relative-time-DgSS3zKN.js} +1 -1
- package/dist/ring-B7Qxu7zd.js +175 -0
- package/dist/runtime/nuxt-plugin.js +2 -2
- package/dist/styles.css +657 -526
- package/dist/text-BCJflBJf.js +826 -0
- package/dist/theme.d.ts +43 -0
- package/dist/theme.js +22 -7
- package/dist/travel-C87xd5Wh.js +182 -0
- package/dist/tween-CO24nMpf.js +62 -0
- package/dist/{types-Dyr6CfBW.d.ts → types-BX64qHlV.d.ts} +1 -1
- package/dist/visual-copy-CrVc3z4n.js +15 -0
- package/dist/workspace-shell-BJGnoF3p.d.ts +112 -0
- package/dist/workspace-steps-Bgph2rpr.d.ts +72 -0
- package/dist/workspace.d.ts +17 -4
- package/dist/workspace.js +16 -3
- package/package.json +22 -11
- package/dist/copy-button-CRN3kmSD.js +0 -253
- package/dist/format-Du58PlsG.js +0 -18
- package/dist/icon-swap.css +0 -69
- package/dist/parts/playground/highlight.d.ts +0 -5
- package/dist/parts/playground/highlight.js +0 -23
- package/dist/parts/playground/playground-render.d.ts +0 -126
- package/dist/parts/playground/playground-render.js +0 -356
- package/dist/parts/workspace/playground-container.d.ts +0 -192
- package/dist/parts/workspace/playground-container.js +0 -603
- package/dist/share-DM4eNy4q.d.ts +0 -37
|
@@ -1,2 +1,227 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
|
+
import { t as ring } from "../../ring-B7Qxu7zd.js";
|
|
3
|
+
import { SwapIcon } from "./motion.js";
|
|
4
|
+
import { a as useViteHubUIIcons } from "../../config-B1u7zqMB.js";
|
|
5
|
+
import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
|
|
6
|
+
import { n as prepareAnnouncer, t as announce } from "../../announce-Cy_Tn9wW.js";
|
|
7
|
+
import { defineComponent, getCurrentInstance, getCurrentScope, h, onMounted, onScopeDispose, readonly, ref, toValue, watch } from "vue";
|
|
8
|
+
//#region src/components/copy-button.ts
|
|
9
|
+
async function writeClipboard(value) {
|
|
10
|
+
const text = typeof value === "function" ? value() : value;
|
|
11
|
+
try {
|
|
12
|
+
await writeClipboardApi(text);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (!copyWithCommand(await text)) throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function writeClipboardApi(text) {
|
|
18
|
+
const clipboard = globalThis.navigator?.clipboard;
|
|
19
|
+
if (typeof clipboard?.writeText !== "function") throw uiErrorDiagnostics.UI_CLIPBOARD_UNAVAILABLE();
|
|
20
|
+
if (typeof text === "string") return clipboard.writeText(text);
|
|
21
|
+
if (typeof ClipboardItem === "function" && typeof clipboard.write === "function") return clipboard.write([new ClipboardItem({ "text/plain": text.then((resolved) => new Blob([resolved], { type: "text/plain" })) })]);
|
|
22
|
+
return clipboard.writeText(await text);
|
|
23
|
+
}
|
|
24
|
+
/** Copies through a hidden text area and `document.execCommand("copy")`. Returns `false` when the browser refuses. */
|
|
25
|
+
function copyWithCommand(text) {
|
|
26
|
+
const doc = globalThis.document;
|
|
27
|
+
if (typeof doc?.execCommand !== "function" || !doc.body) return false;
|
|
28
|
+
const focused = doc.activeElement;
|
|
29
|
+
const area = doc.createElement("textarea");
|
|
30
|
+
area.value = text;
|
|
31
|
+
area.readOnly = true;
|
|
32
|
+
area.style.position = "fixed";
|
|
33
|
+
area.style.opacity = "0";
|
|
34
|
+
doc.body.append(area);
|
|
35
|
+
area.focus({ preventScroll: true });
|
|
36
|
+
area.select();
|
|
37
|
+
try {
|
|
38
|
+
return doc.execCommand("copy");
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
} finally {
|
|
42
|
+
area.remove();
|
|
43
|
+
if (focused instanceof HTMLElement) focused.focus({ preventScroll: true });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The clipboard logic of `CopyButton`, for a control that copies as one part of a larger action, such as the item
|
|
48
|
+
* "Copy link" in a menu. The caller shows the result, for example with a toast.
|
|
49
|
+
*/
|
|
50
|
+
function useCopy(options = {}) {
|
|
51
|
+
const copied = ref(false);
|
|
52
|
+
const failed = ref(false);
|
|
53
|
+
let timer;
|
|
54
|
+
if (getCurrentScope()) onScopeDispose(() => clearTimeout(timer));
|
|
55
|
+
async function copy(value) {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
copied.value = false;
|
|
58
|
+
failed.value = false;
|
|
59
|
+
try {
|
|
60
|
+
await writeClipboard(value);
|
|
61
|
+
copied.value = true;
|
|
62
|
+
} catch {
|
|
63
|
+
failed.value = true;
|
|
64
|
+
}
|
|
65
|
+
timer = setTimeout(() => {
|
|
66
|
+
copied.value = false;
|
|
67
|
+
failed.value = false;
|
|
68
|
+
}, toValue(options.duration) ?? 2e3);
|
|
69
|
+
return copied.value;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
copy,
|
|
73
|
+
copied: readonly(copied),
|
|
74
|
+
failed: readonly(failed)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A button that copies text. It shows `icon`, or the theme's `copy` icon, and swaps to the theme's `copyCheck` icon for
|
|
79
|
+
* `duration` ms after a copy: the copy icon blurs out and the check draws in, a label changes to `copiedLabel` letter by
|
|
80
|
+
* letter, and the button rings once. It announces "Copied", or "Copy failed" when the browser refuses. Without a label
|
|
81
|
+
* it is an icon-only button named "Copy".
|
|
82
|
+
*/
|
|
83
|
+
const CopyButton = defineComponent({
|
|
84
|
+
name: "CopyButton",
|
|
85
|
+
inheritAttrs: false,
|
|
86
|
+
props: {
|
|
87
|
+
value: {
|
|
88
|
+
required: true,
|
|
89
|
+
type: [String, Function]
|
|
90
|
+
},
|
|
91
|
+
label: {
|
|
92
|
+
default: void 0,
|
|
93
|
+
type: String
|
|
94
|
+
},
|
|
95
|
+
copiedLabel: {
|
|
96
|
+
default: "Copied",
|
|
97
|
+
type: String
|
|
98
|
+
},
|
|
99
|
+
/** The icon before a copy, such as `i-lucide-link` for a link. Defaults to the theme's `copy` icon. */
|
|
100
|
+
icon: {
|
|
101
|
+
default: void 0,
|
|
102
|
+
type: String
|
|
103
|
+
},
|
|
104
|
+
ariaLabel: {
|
|
105
|
+
default: void 0,
|
|
106
|
+
type: String
|
|
107
|
+
},
|
|
108
|
+
size: {
|
|
109
|
+
default: void 0,
|
|
110
|
+
type: String
|
|
111
|
+
},
|
|
112
|
+
variant: {
|
|
113
|
+
default: "ghost",
|
|
114
|
+
type: String
|
|
115
|
+
},
|
|
116
|
+
/** How long, in ms, the check shows after a copy. */
|
|
117
|
+
duration: {
|
|
118
|
+
default: 2e3,
|
|
119
|
+
type: Number
|
|
120
|
+
},
|
|
121
|
+
/** Call a function `value` when the pointer enters the button or it gets focus, so the click copies text that is already loaded. */
|
|
122
|
+
preload: {
|
|
123
|
+
default: false,
|
|
124
|
+
type: Boolean
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
emits: {
|
|
128
|
+
copy: () => true,
|
|
129
|
+
error: () => true
|
|
130
|
+
},
|
|
131
|
+
setup(props, { attrs, emit, slots }) {
|
|
132
|
+
const UButton = useUIComponent("UButton");
|
|
133
|
+
const icons = useViteHubUIIcons();
|
|
134
|
+
const { copy, copied } = useCopy({ duration: () => props.duration });
|
|
135
|
+
const instance = getCurrentInstance();
|
|
136
|
+
const element = () => {
|
|
137
|
+
const el = instance?.proxy?.$el;
|
|
138
|
+
return el instanceof Element ? el : void 0;
|
|
139
|
+
};
|
|
140
|
+
onMounted(() => prepareAnnouncer(element()));
|
|
141
|
+
let preloaded;
|
|
142
|
+
watch(() => props.value, () => preloaded = void 0);
|
|
143
|
+
function preload() {
|
|
144
|
+
if (!props.preload || preloaded || typeof props.value !== "function") return;
|
|
145
|
+
const entry = { text: callValue(props.value) };
|
|
146
|
+
preloaded = entry;
|
|
147
|
+
if (typeof entry.text === "string") return;
|
|
148
|
+
entry.text.then((text) => {
|
|
149
|
+
if (preloaded === entry) entry.text = text;
|
|
150
|
+
}, () => {
|
|
151
|
+
if (preloaded === entry) preloaded = void 0;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const loading = ref(false);
|
|
155
|
+
async function onClick(event) {
|
|
156
|
+
const target = event.currentTarget instanceof Element ? event.currentTarget : element();
|
|
157
|
+
let value = props.value;
|
|
158
|
+
if (typeof value === "function") {
|
|
159
|
+
const text = preloaded?.text ?? callValue(value);
|
|
160
|
+
preloaded = void 0;
|
|
161
|
+
value = typeof text === "string" ? text : () => text;
|
|
162
|
+
loading.value = typeof text !== "string";
|
|
163
|
+
}
|
|
164
|
+
const ok = await copy(value);
|
|
165
|
+
loading.value = false;
|
|
166
|
+
announce(target, ok ? "Copied" : "Copy failed");
|
|
167
|
+
if (ok && target instanceof HTMLElement) ring(target);
|
|
168
|
+
if (ok) emit("copy");
|
|
169
|
+
else emit("error");
|
|
170
|
+
}
|
|
171
|
+
const leading = ({ ui }) => {
|
|
172
|
+
const iconClass = ui?.leadingIcon?.({ class: leadingIconClass(attrs.ui) });
|
|
173
|
+
const [name, enter] = loading.value ? [icons.value.loading, "draw"] : copied.value ? [icons.value.copyCheck, "draw"] : [props.icon ?? icons.value.copy, "blur"];
|
|
174
|
+
return [h(SwapIcon, {
|
|
175
|
+
class: iconClass,
|
|
176
|
+
name,
|
|
177
|
+
enter,
|
|
178
|
+
spin: loading.value
|
|
179
|
+
})];
|
|
180
|
+
};
|
|
181
|
+
return () => h(UButton, {
|
|
182
|
+
...attrs,
|
|
183
|
+
"aria-label": props.ariaLabel ?? (props.label || slots.default ? void 0 : "Copy"),
|
|
184
|
+
"data-copied": copied.value ? "" : void 0,
|
|
185
|
+
"data-slot": attrs["data-slot"] ?? "copy-button",
|
|
186
|
+
icon: copied.value ? icons.value.copyCheck : props.icon ?? icons.value.copy,
|
|
187
|
+
label: props.label && copied.value ? props.copiedLabel : props.label,
|
|
188
|
+
disabled: loading.value || attrs.disabled,
|
|
189
|
+
size: props.size,
|
|
190
|
+
variant: props.variant,
|
|
191
|
+
onClick: (event) => {
|
|
192
|
+
callListener(attrs.onClick, event);
|
|
193
|
+
return onClick(event);
|
|
194
|
+
},
|
|
195
|
+
onFocus: (event) => {
|
|
196
|
+
callListener(attrs.onFocus, event);
|
|
197
|
+
if (event.currentTarget instanceof Element) prepareAnnouncer(event.currentTarget);
|
|
198
|
+
preload();
|
|
199
|
+
},
|
|
200
|
+
onPointerenter: (event) => {
|
|
201
|
+
callListener(attrs.onPointerenter, event);
|
|
202
|
+
preload();
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
leading,
|
|
206
|
+
...slots.default ? { default: slots.default } : {}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
/** Calls a function `value`. A function that throws gives a rejected promise, so the copy reports the failure. */
|
|
211
|
+
function callValue(value) {
|
|
212
|
+
try {
|
|
213
|
+
return value();
|
|
214
|
+
} catch (error) {
|
|
215
|
+
return Promise.reject(error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function leadingIconClass(ui) {
|
|
219
|
+
return typeof ui === "object" && ui !== null && "leadingIcon" in ui ? ui.leadingIcon : void 0;
|
|
220
|
+
}
|
|
221
|
+
function callListener(listener, event) {
|
|
222
|
+
if (Array.isArray(listener)) {
|
|
223
|
+
for (const handler of listener) if (typeof handler === "function") handler(event);
|
|
224
|
+
} else if (typeof listener === "function") listener(event);
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
2
227
|
export { CopyButton, useCopy };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SlotsType, VNodeChild } from "vue";
|
|
2
|
+
//#region src/components/drop-field.d.ts
|
|
3
|
+
export interface DropFieldSlots {
|
|
4
|
+
/** The text of the field. `over` is true while a file is over it. */
|
|
5
|
+
default?: (props: {
|
|
6
|
+
over: boolean;
|
|
7
|
+
}) => VNodeChild;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A place to drop files, with the drop field of `@vite-hub/ui/motion` (docs/design/motion.md, "Files are dragged in"):
|
|
11
|
+
* a grid of dots that leans toward the dragged file. It is a label around a native file input, so a click and the
|
|
12
|
+
* keyboard open the file picker as before. It emits `files` for a drop and for a pick.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DropField: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
accept: {
|
|
16
|
+
default: undefined;
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
};
|
|
19
|
+
multiple: {
|
|
20
|
+
default: boolean;
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
};
|
|
23
|
+
disabled: {
|
|
24
|
+
default: boolean;
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
};
|
|
27
|
+
label: {
|
|
28
|
+
default: string;
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
};
|
|
31
|
+
description: {
|
|
32
|
+
default: string;
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
};
|
|
35
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
38
|
+
files: (files: File[]) => boolean;
|
|
39
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
|
+
accept: {
|
|
41
|
+
default: undefined;
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
44
|
+
multiple: {
|
|
45
|
+
default: boolean;
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
};
|
|
48
|
+
disabled: {
|
|
49
|
+
default: boolean;
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
};
|
|
52
|
+
label: {
|
|
53
|
+
default: string;
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
};
|
|
56
|
+
description: {
|
|
57
|
+
default: string;
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
};
|
|
60
|
+
}>> & Readonly<{
|
|
61
|
+
onFiles?: ((files: File[]) => any) | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
label: string;
|
|
64
|
+
multiple: boolean;
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
accept: string;
|
|
67
|
+
description: string;
|
|
68
|
+
}, SlotsType<DropFieldSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
69
|
+
//#endregion
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as createDropField } from "../../drop-field-3CDRFFRm.js";
|
|
2
|
+
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue";
|
|
3
|
+
//#region src/components/drop-field.ts
|
|
4
|
+
/**
|
|
5
|
+
* A place to drop files, with the drop field of `@vite-hub/ui/motion` (docs/design/motion.md, "Files are dragged in"):
|
|
6
|
+
* a grid of dots that leans toward the dragged file. It is a label around a native file input, so a click and the
|
|
7
|
+
* keyboard open the file picker as before. It emits `files` for a drop and for a pick.
|
|
8
|
+
*/
|
|
9
|
+
const DropField = defineComponent({
|
|
10
|
+
name: "DropField",
|
|
11
|
+
props: {
|
|
12
|
+
accept: {
|
|
13
|
+
default: void 0,
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
multiple: {
|
|
17
|
+
default: false,
|
|
18
|
+
type: Boolean
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
default: false,
|
|
22
|
+
type: Boolean
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
default: "Drop files to upload",
|
|
26
|
+
type: String
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
default: "or click to browse",
|
|
30
|
+
type: String
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
emits: { files: (files) => Array.isArray(files) },
|
|
34
|
+
slots: Object,
|
|
35
|
+
setup(props, { emit, slots }) {
|
|
36
|
+
const root = ref();
|
|
37
|
+
const over = ref(false);
|
|
38
|
+
let field;
|
|
39
|
+
const watcher = typeof MutationObserver === "function" ? new MutationObserver(() => over.value = root.value?.dataset.over !== void 0) : void 0;
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (!root.value) return;
|
|
42
|
+
field = createDropField(root.value, {
|
|
43
|
+
accepts: (event) => !props.disabled && [...event.dataTransfer?.types ?? []].includes("Files"),
|
|
44
|
+
onFiles: (files) => {
|
|
45
|
+
if (files.length) emit("files", props.multiple ? files : files.slice(0, 1));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
watcher?.observe(root.value, { attributeFilter: ["data-over"] });
|
|
49
|
+
});
|
|
50
|
+
onBeforeUnmount(() => {
|
|
51
|
+
watcher?.disconnect();
|
|
52
|
+
field?.destroy();
|
|
53
|
+
});
|
|
54
|
+
function pick(event) {
|
|
55
|
+
const input = event.target;
|
|
56
|
+
if (!(input instanceof HTMLInputElement)) return;
|
|
57
|
+
const files = [...input.files ?? []];
|
|
58
|
+
input.value = "";
|
|
59
|
+
if (files.length) emit("files", files);
|
|
60
|
+
}
|
|
61
|
+
return () => h("label", {
|
|
62
|
+
"data-disabled": props.disabled ? "" : void 0,
|
|
63
|
+
"data-focus-ring": "",
|
|
64
|
+
"data-slot": "drop-field",
|
|
65
|
+
ref: root
|
|
66
|
+
}, [h("input", {
|
|
67
|
+
accept: props.accept,
|
|
68
|
+
"data-slot": "drop-field-input",
|
|
69
|
+
disabled: props.disabled,
|
|
70
|
+
multiple: props.multiple,
|
|
71
|
+
onChange: pick,
|
|
72
|
+
type: "file"
|
|
73
|
+
}), slots.default?.({ over: over.value }) ?? [h("span", { "data-slot": "drop-field-label" }, over.value ? "Release to upload" : props.label), props.description ? h("span", { "data-slot": "drop-field-description" }, props.description) : null]]);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
//#endregion
|
|
77
|
+
export { DropField };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as useUIComponent } from "../../nuxt-ui-
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
2
|
import { ChoicesInput, ChoicesInputClear, ChoicesInputError, ChoicesInputField, ChoicesInputStatus } from "../headless/choices-input.js";
|
|
3
3
|
import { defineComponent, h } from "vue";
|
|
4
4
|
//#region src/components/filter-search.ts
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { r as HoldToDeleteState } from "../../hold-to-delete-DjWzRDyY.js";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
//#region src/components/hold-to-delete.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A delete that can be undone, with hold to delete of `@vite-hub/ui/motion` (docs/design/motion.md, "Something is
|
|
6
|
+
* deleted and the delete can be undone"). Hold the button: it fills, and a release before the end cancels. At the end it
|
|
7
|
+
* emits `delete`, so hide the item, the item leaves toward the trash, and the button turns into Undo. `commit` runs the
|
|
8
|
+
* real delete once the Undo window passes. Undo emits `undo`, so show the item again.
|
|
9
|
+
*
|
|
10
|
+
* Use it only where the real delete can wait: a delete in the browser, or an API whose delete the page may send a few
|
|
11
|
+
* seconds later. Unmounting it during the Undo window, or leaving the page, commits.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HoldToDelete: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
commit: {
|
|
15
|
+
required: true;
|
|
16
|
+
type: PropType<() => void | Promise<void>>;
|
|
17
|
+
};
|
|
18
|
+
item: {
|
|
19
|
+
default: undefined;
|
|
20
|
+
type: PropType<() => Element | null | undefined>;
|
|
21
|
+
};
|
|
22
|
+
label: {
|
|
23
|
+
default: string;
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
};
|
|
26
|
+
undoLabel: {
|
|
27
|
+
default: string;
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
30
|
+
undoFor: {
|
|
31
|
+
default: number;
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
};
|
|
34
|
+
confirm: {
|
|
35
|
+
default: undefined;
|
|
36
|
+
type: PropType<() => boolean | Promise<boolean>>;
|
|
37
|
+
};
|
|
38
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
|
+
delete: () => true;
|
|
42
|
+
undo: () => true;
|
|
43
|
+
error: (_error: unknown) => true;
|
|
44
|
+
state: (_state: HoldToDeleteState) => true;
|
|
45
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
46
|
+
commit: {
|
|
47
|
+
required: true;
|
|
48
|
+
type: PropType<() => void | Promise<void>>;
|
|
49
|
+
};
|
|
50
|
+
item: {
|
|
51
|
+
default: undefined;
|
|
52
|
+
type: PropType<() => Element | null | undefined>;
|
|
53
|
+
};
|
|
54
|
+
label: {
|
|
55
|
+
default: string;
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
};
|
|
58
|
+
undoLabel: {
|
|
59
|
+
default: string;
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
};
|
|
62
|
+
undoFor: {
|
|
63
|
+
default: number;
|
|
64
|
+
type: NumberConstructor;
|
|
65
|
+
};
|
|
66
|
+
confirm: {
|
|
67
|
+
default: undefined;
|
|
68
|
+
type: PropType<() => boolean | Promise<boolean>>;
|
|
69
|
+
};
|
|
70
|
+
}>> & Readonly<{
|
|
71
|
+
onError?: ((_error: unknown) => any) | undefined;
|
|
72
|
+
onDelete?: (() => any) | undefined;
|
|
73
|
+
onState?: ((_state: HoldToDeleteState) => any) | undefined;
|
|
74
|
+
onUndo?: (() => any) | undefined;
|
|
75
|
+
}>, {
|
|
76
|
+
label: string;
|
|
77
|
+
confirm: () => boolean | Promise<boolean>;
|
|
78
|
+
item: () => Element | null | undefined;
|
|
79
|
+
undoLabel: string;
|
|
80
|
+
undoFor: number;
|
|
81
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
82
|
+
//#endregion
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { t as createHoldToDelete } from "../../hold-to-delete-ROLQRZg_.js";
|
|
2
|
+
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue";
|
|
3
|
+
//#region src/components/hold-to-delete.ts
|
|
4
|
+
/**
|
|
5
|
+
* A delete that can be undone, with hold to delete of `@vite-hub/ui/motion` (docs/design/motion.md, "Something is
|
|
6
|
+
* deleted and the delete can be undone"). Hold the button: it fills, and a release before the end cancels. At the end it
|
|
7
|
+
* emits `delete`, so hide the item, the item leaves toward the trash, and the button turns into Undo. `commit` runs the
|
|
8
|
+
* real delete once the Undo window passes. Undo emits `undo`, so show the item again.
|
|
9
|
+
*
|
|
10
|
+
* Use it only where the real delete can wait: a delete in the browser, or an API whose delete the page may send a few
|
|
11
|
+
* seconds later. Unmounting it during the Undo window, or leaving the page, commits.
|
|
12
|
+
*/
|
|
13
|
+
const HoldToDelete = defineComponent({
|
|
14
|
+
name: "HoldToDelete",
|
|
15
|
+
props: {
|
|
16
|
+
commit: {
|
|
17
|
+
required: true,
|
|
18
|
+
type: Function
|
|
19
|
+
},
|
|
20
|
+
item: {
|
|
21
|
+
default: void 0,
|
|
22
|
+
type: Function
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
default: "Hold to delete",
|
|
26
|
+
type: String
|
|
27
|
+
},
|
|
28
|
+
undoLabel: {
|
|
29
|
+
default: "Undo",
|
|
30
|
+
type: String
|
|
31
|
+
},
|
|
32
|
+
undoFor: {
|
|
33
|
+
default: 5e3,
|
|
34
|
+
type: Number
|
|
35
|
+
},
|
|
36
|
+
confirm: {
|
|
37
|
+
default: void 0,
|
|
38
|
+
type: Function
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: {
|
|
42
|
+
delete: () => true,
|
|
43
|
+
undo: () => true,
|
|
44
|
+
error: (_error) => true,
|
|
45
|
+
state: (_state) => true
|
|
46
|
+
},
|
|
47
|
+
setup(props, { emit, expose }) {
|
|
48
|
+
const root = ref();
|
|
49
|
+
let hold;
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
if (!root.value) return;
|
|
52
|
+
hold = createHoldToDelete(root.value, {
|
|
53
|
+
commit: () => props.commit(),
|
|
54
|
+
confirm: props.confirm ? () => props.confirm() : void 0,
|
|
55
|
+
item: () => props.item?.(),
|
|
56
|
+
label: props.label,
|
|
57
|
+
onDelete: () => emit("delete"),
|
|
58
|
+
onError: (error) => emit("error", error),
|
|
59
|
+
onState: (state) => emit("state", state),
|
|
60
|
+
onUndo: () => emit("undo"),
|
|
61
|
+
undoFor: props.undoFor,
|
|
62
|
+
undoLabel: props.undoLabel
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
onBeforeUnmount(() => hold?.destroy());
|
|
66
|
+
expose({ undo: () => hold?.undo() });
|
|
67
|
+
return () => h("button", {
|
|
68
|
+
"data-icon-only": props.label ? void 0 : "",
|
|
69
|
+
"data-slot": "hold-to-delete",
|
|
70
|
+
ref: root,
|
|
71
|
+
type: "button"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
//#endregion
|
|
76
|
+
export { HoldToDelete };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MarkdownEditorUpload, r as blobUpload, t as MarkdownEditor } from "../../markdown-editor-
|
|
1
|
+
import { n as MarkdownEditorUpload, r as blobUpload, t as MarkdownEditor } from "../../markdown-editor-wQF0yD5o.js";
|
|
2
2
|
export { MarkdownEditor, MarkdownEditorUpload, blobUpload };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as blobUpload, t as MarkdownEditor } from "../../markdown-editor-
|
|
1
|
+
import { n as blobUpload, t as MarkdownEditor } from "../../markdown-editor-Dfl2DgPS.js";
|
|
2
2
|
export { MarkdownEditor, blobUpload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "../../rolldown-runtime-C9mWXvCC.js";
|
|
2
|
-
import { t as ImagePreview } from "../../image-preview-
|
|
2
|
+
import { t as ImagePreview } from "../../image-preview-BigoAvb3.js";
|
|
3
3
|
import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
|
|
4
4
|
import { a as addStyles$28, c as src_default$38, d as src_default$37, f as src_default$35, l as src_default$36, m as isElement$33, n as components$33, o as typesetCss, p as childrenOf$29, r as vue_exports$31, s as theme$28, u as css$30 } from "../../vue-DGstVdGn.js";
|
|
5
5
|
import { n as SERIES, t as INK } from "../../colors-BghReA9C-CjF9gnmy.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as useViteHubUI } from "../../config-
|
|
1
|
+
import { i as useViteHubUI } from "../../config-B1u7zqMB.js";
|
|
2
2
|
import { Suspense, defineAsyncComponent, defineComponent, getCurrentInstance, h } from "vue";
|
|
3
3
|
//#region src/components/markdown.ts
|
|
4
4
|
const MarkdownRenderer = defineAsyncComponent(() => import("./markdown-renderer.js").then((module) => module.MarkdownRenderer));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Markdown } from "./markdown.js";
|
|
2
|
-
import { t as ImagePreview } from "../../image-preview-
|
|
2
|
+
import { t as ImagePreview } from "../../image-preview-BigoAvb3.js";
|
|
3
3
|
import { defineComponent, h } from "vue";
|
|
4
4
|
import { MessageParts as MessageParts$1 } from "comark-chat/vue";
|
|
5
5
|
//#region src/components/message-parts.ts
|
|
@@ -26,10 +26,18 @@ const MessageParts = defineComponent({
|
|
|
26
26
|
streaming,
|
|
27
27
|
value
|
|
28
28
|
}),
|
|
29
|
-
file: ({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
file: ({ image, mediaType, name, part }) => {
|
|
30
|
+
if (image) return h(ImagePreview, {
|
|
31
|
+
alt: name,
|
|
32
|
+
src: image
|
|
33
|
+
});
|
|
34
|
+
const { url } = part;
|
|
35
|
+
if (typeof url === "string" && url && !URL.canParse(url) && (mediaType === "image" || mediaType.startsWith("image/"))) return h(ImagePreview, {
|
|
36
|
+
alt: name,
|
|
37
|
+
src: url
|
|
38
|
+
});
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
33
41
|
...slots
|
|
34
42
|
});
|
|
35
43
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
//#region src/components/motion-list.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A list whose items move with the list mover of `@vite-hub/ui/motion` (docs/design/motion.md, "Items are added,
|
|
5
|
+
* removed, or reordered"). Use it in place of `<TransitionGroup>`: render keyed items in its slot. When they change,
|
|
6
|
+
* neighbors spring to their new place, a new item grows from `origin` or from its slot, and a removed item folds away
|
|
7
|
+
* or leaves toward `target`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MotionList: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
tag: {
|
|
11
|
+
default: string;
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
origin: {
|
|
15
|
+
default: undefined;
|
|
16
|
+
type: PropType<(item: HTMLElement) => Element | null | undefined>;
|
|
17
|
+
};
|
|
18
|
+
target: {
|
|
19
|
+
default: undefined;
|
|
20
|
+
type: PropType<() => Element | null | undefined>;
|
|
21
|
+
};
|
|
22
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
tag: {
|
|
26
|
+
default: string;
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
};
|
|
29
|
+
origin: {
|
|
30
|
+
default: undefined;
|
|
31
|
+
type: PropType<(item: HTMLElement) => Element | null | undefined>;
|
|
32
|
+
};
|
|
33
|
+
target: {
|
|
34
|
+
default: undefined;
|
|
35
|
+
type: PropType<() => Element | null | undefined>;
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {
|
|
38
|
+
target: () => Element | null | undefined;
|
|
39
|
+
origin: (item: HTMLElement) => Element | null | undefined;
|
|
40
|
+
tag: string;
|
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
42
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { t as createMotionList } from "../../list-RCbNZ14q.js";
|
|
2
|
+
import { defineComponent, h, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, ref } from "vue";
|
|
3
|
+
//#region src/components/motion-list.ts
|
|
4
|
+
/**
|
|
5
|
+
* A list whose items move with the list mover of `@vite-hub/ui/motion` (docs/design/motion.md, "Items are added,
|
|
6
|
+
* removed, or reordered"). Use it in place of `<TransitionGroup>`: render keyed items in its slot. When they change,
|
|
7
|
+
* neighbors spring to their new place, a new item grows from `origin` or from its slot, and a removed item folds away
|
|
8
|
+
* or leaves toward `target`.
|
|
9
|
+
*/
|
|
10
|
+
const MotionList = defineComponent({
|
|
11
|
+
name: "MotionList",
|
|
12
|
+
props: {
|
|
13
|
+
tag: {
|
|
14
|
+
default: "div",
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
origin: {
|
|
18
|
+
default: void 0,
|
|
19
|
+
type: Function
|
|
20
|
+
},
|
|
21
|
+
target: {
|
|
22
|
+
default: void 0,
|
|
23
|
+
type: Function
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(props, { slots }) {
|
|
27
|
+
const root = ref();
|
|
28
|
+
let list;
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
if (root.value) list = createMotionList(root.value);
|
|
31
|
+
});
|
|
32
|
+
onBeforeUpdate(() => list?.measure());
|
|
33
|
+
onUpdated(() => list?.play({
|
|
34
|
+
origin: props.origin,
|
|
35
|
+
target: props.target?.()
|
|
36
|
+
}));
|
|
37
|
+
onBeforeUnmount(() => list?.destroy());
|
|
38
|
+
return () => h(props.tag, { ref: root }, slots.default?.());
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
42
|
+
export { MotionList };
|