@vobs/ui 1.2.1 → 1.3.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/dist/activity-rail.cjs +65 -629
- package/dist/activity-rail.cjs.map +1 -1
- package/dist/activity-rail.js +44 -612
- package/dist/activity-rail.js.map +1 -1
- package/dist/alert.cjs +58 -536
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.js +33 -519
- package/dist/alert.js.map +1 -1
- package/dist/avatar.cjs +45 -519
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.js +26 -508
- package/dist/avatar.js.map +1 -1
- package/dist/button.cjs +46 -559
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +21 -545
- package/dist/button.js.map +1 -1
- package/dist/card.cjs +55 -532
- package/dist/card.cjs.map +1 -1
- package/dist/card.js +30 -515
- package/dist/card.js.map +1 -1
- package/dist/chat-composer.cjs +84 -602
- package/dist/chat-composer.cjs.map +1 -1
- package/dist/chat-composer.js +52 -576
- package/dist/chat-composer.js.map +1 -1
- package/dist/dialog.cjs +88 -591
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.js +63 -569
- package/dist/dialog.js.map +1 -1
- package/dist/drawer.cjs +91 -594
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.js +65 -571
- package/dist/drawer.js.map +1 -1
- package/dist/editor-tabs.cjs +75 -635
- package/dist/editor-tabs.cjs.map +1 -1
- package/dist/editor-tabs.js +51 -616
- package/dist/editor-tabs.js.map +1 -1
- package/dist/file-tree.cjs +70 -634
- package/dist/file-tree.cjs.map +1 -1
- package/dist/file-tree.js +49 -617
- package/dist/file-tree.js.map +1 -1
- package/dist/forms.cjs +80 -589
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js +41 -559
- package/dist/forms.js.map +1 -1
- package/dist/icon.cjs +44 -624
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.js +25 -615
- package/dist/icon.js.map +1 -1
- package/dist/icons.cjs +2 -3
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +0 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +735 -1586
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +811 -1517
- package/dist/index.js.map +1 -1
- package/dist/kbd.cjs +53 -525
- package/dist/kbd.cjs.map +1 -1
- package/dist/kbd.js +30 -509
- package/dist/kbd.js.map +1 -1
- package/dist/menu.cjs +68 -582
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +47 -565
- package/dist/menu.js.map +1 -1
- package/dist/nav-list.cjs +71 -635
- package/dist/nav-list.cjs.map +1 -1
- package/dist/nav-list.js +50 -618
- package/dist/nav-list.js.map +1 -1
- package/dist/overlay.cjs +43 -197
- package/dist/overlay.cjs.map +1 -1
- package/dist/overlay.js +20 -192
- package/dist/overlay.js.map +1 -1
- package/dist/page-header.cjs +68 -585
- package/dist/page-header.cjs.map +1 -1
- package/dist/page-header.js +42 -565
- package/dist/page-header.js.map +1 -1
- package/dist/pagination.cjs +70 -585
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.js +53 -572
- package/dist/pagination.js.map +1 -1
- package/dist/stat-card.cjs +62 -538
- package/dist/stat-card.cjs.map +1 -1
- package/dist/stat-card.js +36 -519
- package/dist/stat-card.js.map +1 -1
- package/dist/status-bar.cjs +65 -576
- package/dist/status-bar.cjs.map +1 -1
- package/dist/status-bar.js +43 -560
- package/dist/status-bar.js.map +1 -1
- package/dist/table.cjs +87 -605
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +57 -579
- package/dist/table.js.map +1 -1
- package/dist/tabs.cjs +62 -626
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +45 -613
- package/dist/tabs.js.map +1 -1
- package/dist/tag.cjs +40 -514
- package/dist/tag.cjs.map +1 -1
- package/dist/tag.js +18 -503
- package/dist/tag.js.map +1 -1
- package/dist/toast.cjs +95 -1001
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.js +74 -980
- package/dist/toast.js.map +1 -1
- package/dist/types.cjs +18 -2
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +5 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +77 -580
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +29 -545
- package/dist/utils.js.map +1 -1
- package/dist/workbench-titlebar.cjs +83 -598
- package/dist/workbench-titlebar.cjs.map +1 -1
- package/dist/workbench-titlebar.js +55 -575
- package/dist/workbench-titlebar.js.map +1 -1
- package/package.json +5 -5
- package/src/types.ts +7 -0
package/dist/chat-composer.cjs
CHANGED
|
@@ -1,555 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
|
|
2
|
+
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function hasDebugHooks() {
|
|
9
|
-
return activeDebugHooks !== null;
|
|
10
|
-
}
|
|
11
|
-
__name(hasDebugHooks, "hasDebugHooks");
|
|
12
|
-
function invokeDebug(name, ...args) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
__name(invokeDebug, "invokeDebug");
|
|
16
|
-
|
|
17
|
-
// packages/reactivity/src/owner.ts
|
|
18
|
-
var currentOwner = null;
|
|
19
|
-
var nextOwnerId = 1;
|
|
20
|
-
var ownerNames = /* @__PURE__ */ new WeakMap();
|
|
21
|
-
function createOwner() {
|
|
22
|
-
const parent = currentOwner;
|
|
23
|
-
let disposed = parent?.disposed ?? false;
|
|
24
|
-
const children = [];
|
|
25
|
-
const cleanups = [];
|
|
26
|
-
const errorHandlers = /* @__PURE__ */ new Set();
|
|
27
|
-
const owner = {
|
|
28
|
-
id: `owner-${nextOwnerId++}`,
|
|
29
|
-
parent,
|
|
30
|
-
children,
|
|
31
|
-
depth: (parent?.depth ?? -1) + 1,
|
|
32
|
-
get disposed() {
|
|
33
|
-
return disposed;
|
|
34
|
-
},
|
|
35
|
-
run(fn) {
|
|
36
|
-
if (disposed) throw new Error("Vobs: \u5DF2\u9500\u6BC1\u7684 Owner \u4E0D\u80FD\u7EE7\u7EED\u8FD0\u884C");
|
|
37
|
-
const previous = currentOwner;
|
|
38
|
-
currentOwner = owner;
|
|
39
|
-
try {
|
|
40
|
-
return fn();
|
|
41
|
-
} finally {
|
|
42
|
-
currentOwner = previous;
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
addCleanup(cleanup) {
|
|
46
|
-
if (disposed) {
|
|
47
|
-
cleanup();
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
cleanups.push(cleanup);
|
|
51
|
-
},
|
|
52
|
-
onDispose(cleanup) {
|
|
53
|
-
owner.addCleanup(cleanup);
|
|
54
|
-
},
|
|
55
|
-
onError(handler) {
|
|
56
|
-
errorHandlers.add(handler);
|
|
57
|
-
const remove = /* @__PURE__ */ __name(() => errorHandlers.delete(handler), "remove");
|
|
58
|
-
owner.addCleanup(remove);
|
|
59
|
-
return remove;
|
|
60
|
-
},
|
|
61
|
-
handleError(error) {
|
|
62
|
-
for (const handler of [...errorHandlers].reverse()) {
|
|
63
|
-
try {
|
|
64
|
-
handler(error);
|
|
65
|
-
return true;
|
|
66
|
-
} catch (handlerError) {
|
|
67
|
-
return parent?.handleError(handlerError) ?? false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return parent?.handleError(error) ?? false;
|
|
71
|
-
},
|
|
72
|
-
dispose() {
|
|
73
|
-
if (disposed) return;
|
|
74
|
-
disposed = true;
|
|
75
|
-
for (const child of [...children]) child.dispose();
|
|
76
|
-
children.length = 0;
|
|
77
|
-
let firstError;
|
|
78
|
-
for (let index = cleanups.length - 1; index >= 0; index--) {
|
|
79
|
-
try {
|
|
80
|
-
cleanups[index]();
|
|
81
|
-
} catch (error) {
|
|
82
|
-
firstError ?? (firstError = error);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
cleanups.length = 0;
|
|
86
|
-
if (parent) {
|
|
87
|
-
const index = parent.children.indexOf(owner);
|
|
88
|
-
if (index >= 0) parent.children.splice(index, 1);
|
|
89
|
-
}
|
|
90
|
-
if (firstError) throw firstError;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
if (parent && !parent.disposed) parent.children.push(owner);
|
|
94
|
-
return owner;
|
|
95
|
-
}
|
|
96
|
-
__name(createOwner, "createOwner");
|
|
97
|
-
function setOwnerDebugName(owner, name) {
|
|
98
|
-
ownerNames.set(owner, name);
|
|
99
|
-
}
|
|
100
|
-
__name(setOwnerDebugName, "setOwnerDebugName");
|
|
101
|
-
function getCurrentOwner() {
|
|
102
|
-
return currentOwner;
|
|
103
|
-
}
|
|
104
|
-
__name(getCurrentOwner, "getCurrentOwner");
|
|
105
|
-
|
|
106
|
-
// packages/reactivity/src/signal.ts
|
|
107
|
-
var currentSubscriber = null;
|
|
108
|
-
function getCurrentSubscriber() {
|
|
109
|
-
return currentSubscriber;
|
|
110
|
-
}
|
|
111
|
-
__name(getCurrentSubscriber, "getCurrentSubscriber");
|
|
112
|
-
function setCurrentSubscriber(subscriber) {
|
|
113
|
-
currentSubscriber = subscriber;
|
|
114
|
-
}
|
|
115
|
-
__name(setCurrentSubscriber, "setCurrentSubscriber");
|
|
116
|
-
|
|
117
|
-
// packages/reactivity/src/scheduler.ts
|
|
118
|
-
var _Scheduler = class _Scheduler {
|
|
119
|
-
constructor() {
|
|
120
|
-
this.dirtyEffects = /* @__PURE__ */ new Set();
|
|
121
|
-
this.lowPriorityEffects = /* @__PURE__ */ new Set();
|
|
122
|
-
// flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
|
|
123
|
-
this.normalBuffer = [];
|
|
124
|
-
this.lowBuffer = [];
|
|
125
|
-
this.flushing = false;
|
|
126
|
-
this.scheduled = false;
|
|
127
|
-
this.batchDepth = 0;
|
|
128
|
-
}
|
|
129
|
-
schedule(effect2) {
|
|
130
|
-
if (effect2.disposed) return;
|
|
131
|
-
this.dirtyEffects.add(effect2);
|
|
132
|
-
this.lowPriorityEffects.delete(effect2);
|
|
133
|
-
this.ensureScheduled();
|
|
134
|
-
}
|
|
135
|
-
/** Queue an effect behind normal updates while preserving deterministic order. */
|
|
136
|
-
scheduleLow(effect2) {
|
|
137
|
-
if (effect2.disposed) return;
|
|
138
|
-
if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
|
|
139
|
-
this.ensureScheduled();
|
|
140
|
-
}
|
|
141
|
-
ensureScheduled() {
|
|
142
|
-
if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
|
|
143
|
-
this.scheduled = true;
|
|
144
|
-
queueMicrotask(() => {
|
|
145
|
-
this.scheduled = false;
|
|
146
|
-
this.flush();
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
remove(effect2) {
|
|
151
|
-
this.dirtyEffects.delete(effect2);
|
|
152
|
-
this.lowPriorityEffects.delete(effect2);
|
|
153
|
-
}
|
|
154
|
-
batch(fn) {
|
|
155
|
-
this.batchDepth++;
|
|
156
|
-
try {
|
|
157
|
-
return fn();
|
|
158
|
-
} finally {
|
|
159
|
-
this.batchDepth--;
|
|
160
|
-
if (this.batchDepth === 0) this.flush();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
flush() {
|
|
164
|
-
if (this.flushing || this.batchDepth > 0) return;
|
|
165
|
-
this.flushing = true;
|
|
166
|
-
let rounds = 0;
|
|
167
|
-
let firstError;
|
|
168
|
-
let hasError = false;
|
|
169
|
-
try {
|
|
170
|
-
while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
|
|
171
|
-
if (++rounds > 100) {
|
|
172
|
-
this.dirtyEffects.clear();
|
|
173
|
-
this.lowPriorityEffects.clear();
|
|
174
|
-
throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
|
|
175
|
-
}
|
|
176
|
-
this.collectRunnable(this.dirtyEffects, this.normalBuffer);
|
|
177
|
-
this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
|
|
178
|
-
sortEffects(this.normalBuffer);
|
|
179
|
-
sortEffects(this.lowBuffer);
|
|
180
|
-
for (const effect2 of this.normalBuffer) {
|
|
181
|
-
try {
|
|
182
|
-
effect2.run();
|
|
183
|
-
} catch (error) {
|
|
184
|
-
if (!hasError) {
|
|
185
|
-
firstError = error;
|
|
186
|
-
hasError = true;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
for (const effect2 of this.lowBuffer) {
|
|
191
|
-
try {
|
|
192
|
-
effect2.run();
|
|
193
|
-
} catch (error) {
|
|
194
|
-
if (!hasError) {
|
|
195
|
-
firstError = error;
|
|
196
|
-
hasError = true;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
this.normalBuffer.length = 0;
|
|
201
|
-
this.lowBuffer.length = 0;
|
|
202
|
-
}
|
|
203
|
-
} finally {
|
|
204
|
-
this.normalBuffer.length = 0;
|
|
205
|
-
this.lowBuffer.length = 0;
|
|
206
|
-
this.flushing = false;
|
|
207
|
-
}
|
|
208
|
-
if (hasError) throw firstError;
|
|
209
|
-
}
|
|
210
|
-
/** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
|
|
211
|
-
collectRunnable(source, target) {
|
|
212
|
-
for (const effect2 of source) {
|
|
213
|
-
if (!effect2.disposed) target.push(effect2);
|
|
214
|
-
}
|
|
215
|
-
source.clear();
|
|
216
|
-
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
217
11
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
__name(sortEffects, "sortEffects");
|
|
226
|
-
var scheduler = new Scheduler();
|
|
227
|
-
|
|
228
|
-
// packages/reactivity/src/effect.ts
|
|
229
|
-
var nextEffectOrder = 1;
|
|
230
|
-
function cleanupDependencies(subscriber) {
|
|
231
|
-
for (const dependency of subscriber.dependencies) {
|
|
232
|
-
dependency.unsubscribe(subscriber);
|
|
233
|
-
}
|
|
234
|
-
subscriber.dependencies.clear();
|
|
235
|
-
}
|
|
236
|
-
__name(cleanupDependencies, "cleanupDependencies");
|
|
237
|
-
function effect(callback) {
|
|
238
|
-
const owner = getCurrentOwner();
|
|
239
|
-
let cleanup;
|
|
240
|
-
let dirty = true;
|
|
241
|
-
let disposed = false;
|
|
242
|
-
const eff = {
|
|
243
|
-
order: nextEffectOrder++,
|
|
244
|
-
depth: owner?.depth ?? 0,
|
|
245
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
246
|
-
get disposed() {
|
|
247
|
-
return disposed;
|
|
248
|
-
},
|
|
249
|
-
notify() {
|
|
250
|
-
if (disposed || dirty) return;
|
|
251
|
-
dirty = true;
|
|
252
|
-
scheduler.schedule(eff);
|
|
253
|
-
},
|
|
254
|
-
run() {
|
|
255
|
-
if (disposed || !dirty) return;
|
|
256
|
-
dirty = false;
|
|
257
|
-
const previousCleanup = cleanup;
|
|
258
|
-
cleanup = void 0;
|
|
259
|
-
let cleanupError;
|
|
260
|
-
if (previousCleanup) {
|
|
261
|
-
try {
|
|
262
|
-
previousCleanup();
|
|
263
|
-
} catch (error) {
|
|
264
|
-
const handled2 = owner?.handleError(error) ?? false;
|
|
265
|
-
if (!handled2) cleanupError = error;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
cleanupDependencies(eff);
|
|
269
|
-
const previous = getCurrentSubscriber();
|
|
270
|
-
setCurrentSubscriber(eff);
|
|
271
|
-
let thrown;
|
|
272
|
-
let handled = false;
|
|
273
|
-
try {
|
|
274
|
-
const result = owner ? owner.run(callback) : callback();
|
|
275
|
-
cleanup = typeof result === "function" ? result : void 0;
|
|
276
|
-
} catch (error) {
|
|
277
|
-
thrown = error;
|
|
278
|
-
handled = owner?.handleError(error) ?? false;
|
|
279
|
-
if (!handled) throw error;
|
|
280
|
-
} finally {
|
|
281
|
-
setCurrentSubscriber(previous);
|
|
282
|
-
}
|
|
283
|
-
if (cleanupError && !thrown) throw cleanupError;
|
|
284
|
-
},
|
|
285
|
-
scheduleLow() {
|
|
286
|
-
if (disposed || dirty) return;
|
|
287
|
-
dirty = true;
|
|
288
|
-
scheduler.scheduleLow(eff);
|
|
289
|
-
},
|
|
290
|
-
dispose() {
|
|
291
|
-
if (disposed) return;
|
|
292
|
-
disposed = true;
|
|
293
|
-
dirty = false;
|
|
294
|
-
scheduler.remove(eff);
|
|
295
|
-
const previousCleanup = cleanup;
|
|
296
|
-
cleanup = void 0;
|
|
297
|
-
let cleanupError;
|
|
298
|
-
if (previousCleanup) {
|
|
299
|
-
try {
|
|
300
|
-
previousCleanup();
|
|
301
|
-
} catch (error) {
|
|
302
|
-
const handled = owner?.handleError(error) ?? false;
|
|
303
|
-
if (!handled) cleanupError = error;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
cleanupDependencies(eff);
|
|
307
|
-
if (cleanupError) throw cleanupError;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
owner?.addCleanup(eff.dispose);
|
|
311
|
-
eff.run();
|
|
312
|
-
return eff;
|
|
313
|
-
}
|
|
314
|
-
__name(effect, "effect");
|
|
315
|
-
|
|
316
|
-
// packages/runtime/src/debug.ts
|
|
317
|
-
var activeRuntimeDebugHooks = null;
|
|
318
|
-
function getRuntimeDebugHooks() {
|
|
319
|
-
return activeRuntimeDebugHooks;
|
|
320
|
-
}
|
|
321
|
-
__name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
|
|
322
|
-
function invokeRuntimeDebug(name, ...args) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
__name(invokeRuntimeDebug, "invokeRuntimeDebug");
|
|
326
|
-
function readDebugValue(read) {
|
|
327
|
-
try {
|
|
328
|
-
return read();
|
|
329
|
-
} catch {
|
|
330
|
-
return "[Uninspectable]";
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
331
17
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (!node || typeof node !== "object") return "node";
|
|
336
|
-
const value = node;
|
|
337
|
-
const name = typeof value.tagName === "string" ? value.tagName.toLowerCase() : typeof value.nodeName === "string" ? value.nodeName.toLowerCase() : "node";
|
|
338
|
-
const id = typeof value.id === "string" && value.id ? `#${value.id}` : "";
|
|
339
|
-
const className = typeof value.className === "string" && value.className ? `.${value.className.trim().split(/\s+/).filter(Boolean).join(".")}` : "";
|
|
340
|
-
return `${name}${id}${className}`;
|
|
341
|
-
}
|
|
342
|
-
__name(describeDebugNode, "describeDebugNode");
|
|
343
|
-
|
|
344
|
-
// packages/runtime/src/hmr.ts
|
|
345
|
-
var globalTarget = globalThis;
|
|
346
|
-
var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
|
|
347
|
-
globalTarget.__VOBS_HMR__ = hmrGlobal;
|
|
348
|
-
function markHmrInstanceMounted(node, parent) {
|
|
349
|
-
const instance = hmrInstances.get(node);
|
|
350
|
-
if (instance) instance.parent = parent;
|
|
351
|
-
}
|
|
352
|
-
__name(markHmrInstanceMounted, "markHmrInstanceMounted");
|
|
353
|
-
var hmrInstances = /* @__PURE__ */ new WeakMap();
|
|
354
|
-
var nodeOwners = /* @__PURE__ */ new WeakMap();
|
|
355
|
-
var eventBindings = /* @__PURE__ */ new WeakMap();
|
|
356
|
-
function getRenderer() {
|
|
357
|
-
{
|
|
358
|
-
throw new Error("\u6E32\u67D3\u5668\u672A\u521D\u59CB\u5316");
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
__name(getRenderer, "getRenderer");
|
|
362
|
-
function createText(content) {
|
|
363
|
-
return getRenderer().createText(content);
|
|
364
|
-
}
|
|
365
|
-
__name(createText, "createText");
|
|
366
|
-
function createElement(tag) {
|
|
367
|
-
return getRenderer().createElement(tag);
|
|
368
|
-
}
|
|
369
|
-
__name(createElement, "createElement");
|
|
370
|
-
function createComment(content) {
|
|
371
|
-
return getRenderer().createComment(content);
|
|
372
|
-
}
|
|
373
|
-
__name(createComment, "createComment");
|
|
374
|
-
function insertBefore(parent, child, anchor) {
|
|
375
|
-
if (isVobsFragment(child)) {
|
|
376
|
-
child.mount(parent, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
getRenderer().insertBefore(parent, child, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
380
|
-
markHmrInstanceMounted(child, parent);
|
|
381
|
-
}
|
|
382
|
-
__name(insertBefore, "insertBefore");
|
|
383
|
-
function removeChild(parent, child) {
|
|
384
|
-
disposeNodeOwner(child);
|
|
385
|
-
if (isVobsFragment(child)) {
|
|
386
|
-
child.unmount(parent);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
getRenderer().removeChild(parent, child);
|
|
390
|
-
}
|
|
391
|
-
__name(removeChild, "removeChild");
|
|
392
|
-
function setTextContent(node, content) {
|
|
393
|
-
getRenderer().setTextContent(node, content);
|
|
394
|
-
}
|
|
395
|
-
__name(setTextContent, "setTextContent");
|
|
396
|
-
function setProperty(node, key, value) {
|
|
397
|
-
getRenderer().setProperty(node, key, value);
|
|
398
|
-
}
|
|
399
|
-
__name(setProperty, "setProperty");
|
|
400
|
-
function setAttribute(node, key, value) {
|
|
401
|
-
getRenderer().setAttribute(node, key, value);
|
|
402
|
-
}
|
|
403
|
-
__name(setAttribute, "setAttribute");
|
|
404
|
-
function addEventListener(node, event, handler) {
|
|
405
|
-
const renderer = getRenderer();
|
|
406
|
-
const owner = getCurrentOwner();
|
|
407
|
-
let bindings = eventBindings.get(node);
|
|
408
|
-
if (!bindings) {
|
|
409
|
-
bindings = /* @__PURE__ */ new Map();
|
|
410
|
-
eventBindings.set(node, bindings);
|
|
411
|
-
}
|
|
412
|
-
const previous = bindings.get(event);
|
|
413
|
-
if (previous && previous.original === handler && previous.owner === owner) return;
|
|
414
|
-
if (previous) renderer.removeEventListener(node, event, previous.handler);
|
|
415
|
-
const listener = owner ? (reason) => {
|
|
416
|
-
try {
|
|
417
|
-
owner.run(() => handler(reason));
|
|
418
|
-
} catch (error) {
|
|
419
|
-
const handled = owner.handleError(error);
|
|
420
|
-
invokeRuntimeDebug("error", {
|
|
421
|
-
error,
|
|
422
|
-
owner,
|
|
423
|
-
phase: "event",
|
|
424
|
-
handled,
|
|
425
|
-
recovery: handled ? "handled" : "propagated"
|
|
426
|
-
});
|
|
427
|
-
if (!handled) throw error;
|
|
428
|
-
}
|
|
429
|
-
} : handler;
|
|
430
|
-
const binding = { handler: listener, owner, original: handler };
|
|
431
|
-
bindings.set(event, binding);
|
|
432
|
-
renderer.addEventListener(node, event, listener);
|
|
433
|
-
owner?.onDispose(() => {
|
|
434
|
-
if (bindings?.get(event) !== binding) return;
|
|
435
|
-
bindings.delete(event);
|
|
436
|
-
renderer.removeEventListener(node, event, listener);
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
__name(addEventListener, "addEventListener");
|
|
440
|
-
function createBlock(factory) {
|
|
441
|
-
const owner = createOwner();
|
|
442
|
-
setOwnerDebugName(owner, "dynamic");
|
|
443
|
-
let node;
|
|
444
|
-
try {
|
|
445
|
-
node = owner.run(factory);
|
|
446
|
-
} catch (error) {
|
|
447
|
-
owner.dispose();
|
|
448
|
-
throw error;
|
|
449
|
-
}
|
|
450
|
-
if (!node) {
|
|
451
|
-
owner.dispose();
|
|
452
|
-
return null;
|
|
453
|
-
}
|
|
454
|
-
associateNodeOwner(node, owner);
|
|
455
|
-
return node;
|
|
456
|
-
}
|
|
457
|
-
__name(createBlock, "createBlock");
|
|
458
|
-
function associateNodeOwner(node, owner) {
|
|
459
|
-
nodeOwners.set(node, owner);
|
|
460
|
-
}
|
|
461
|
-
__name(associateNodeOwner, "associateNodeOwner");
|
|
462
|
-
function disposeNodeOwner(node) {
|
|
463
|
-
const owner = nodeOwners.get(node);
|
|
464
|
-
if (!owner) return;
|
|
465
|
-
nodeOwners.delete(node);
|
|
466
|
-
owner.dispose();
|
|
467
|
-
}
|
|
468
|
-
__name(disposeNodeOwner, "disposeNodeOwner");
|
|
469
|
-
|
|
470
|
-
// packages/runtime/src/fragment.ts
|
|
471
|
-
function createFragment(factory) {
|
|
472
|
-
const start = createComment("vobs:fragment:start");
|
|
473
|
-
const end = createComment("vobs:fragment:end");
|
|
474
|
-
let parent = null;
|
|
475
|
-
let initialized = false;
|
|
476
|
-
const owner = getCurrentOwner();
|
|
477
|
-
const fragment = {
|
|
478
|
-
kind: "vobs-fragment",
|
|
479
|
-
start,
|
|
480
|
-
end,
|
|
481
|
-
mount(nextParent, anchor) {
|
|
482
|
-
if (parent && parent !== nextParent) {
|
|
483
|
-
throw new Error("Vobs Fragment: \u4E0D\u80FD\u8DE8\u7236\u8282\u70B9\u79FB\u52A8 Fragment");
|
|
484
|
-
}
|
|
485
|
-
if (initialized) {
|
|
486
|
-
moveRange(nextParent, start, end, anchor);
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
const renderer = getRenderer();
|
|
490
|
-
renderer.insertBefore(nextParent, start, anchor);
|
|
491
|
-
renderer.insertBefore(nextParent, end, anchor);
|
|
492
|
-
parent = nextParent;
|
|
493
|
-
initialized = true;
|
|
494
|
-
if (owner) owner.run(() => factory(nextParent, end));
|
|
495
|
-
else factory(nextParent, end);
|
|
496
|
-
},
|
|
497
|
-
unmount(nextParent) {
|
|
498
|
-
if (!initialized || parent !== nextParent) {
|
|
499
|
-
throw new Error("Vobs Fragment: Fragment \u4E0D\u5C5E\u4E8E\u6307\u5B9A\u7236\u8282\u70B9");
|
|
500
|
-
}
|
|
501
|
-
const renderer = getRenderer();
|
|
502
|
-
let current = renderer.nextSibling(start);
|
|
503
|
-
while (current && current !== end) {
|
|
504
|
-
const next = renderer.nextSibling(current);
|
|
505
|
-
renderer.removeChild(nextParent, current);
|
|
506
|
-
current = next;
|
|
507
|
-
}
|
|
508
|
-
renderer.removeChild(nextParent, start);
|
|
509
|
-
renderer.removeChild(nextParent, end);
|
|
510
|
-
parent = null;
|
|
511
|
-
initialized = false;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
return fragment;
|
|
515
|
-
}
|
|
516
|
-
__name(createFragment, "createFragment");
|
|
517
|
-
function isVobsFragment(value) {
|
|
518
|
-
return Boolean(value) && typeof value === "object" && value.kind === "vobs-fragment";
|
|
519
|
-
}
|
|
520
|
-
__name(isVobsFragment, "isVobsFragment");
|
|
521
|
-
function moveRange(parent, start, end, anchor) {
|
|
522
|
-
const renderer = getRenderer();
|
|
523
|
-
const nodes = [start];
|
|
524
|
-
let current = renderer.nextSibling(start);
|
|
525
|
-
while (current) {
|
|
526
|
-
nodes.push(current);
|
|
527
|
-
if (current === end) break;
|
|
528
|
-
current = renderer.nextSibling(current);
|
|
529
|
-
}
|
|
530
|
-
if (nodes[nodes.length - 1] !== end) {
|
|
531
|
-
throw new Error("Vobs Fragment: \u627E\u4E0D\u5230\u7ED3\u675F\u951A\u70B9");
|
|
532
|
-
}
|
|
533
|
-
for (const node of nodes) renderer.insertBefore(parent, node, anchor);
|
|
534
|
-
}
|
|
535
|
-
__name(moveRange, "moveRange");
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
536
21
|
|
|
537
|
-
// packages/
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (current) removeChild(parent, current);
|
|
546
|
-
current = next;
|
|
547
|
-
if (current) insertBefore(parent, current, marker);
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
__name(insertDynamic, "insertDynamic");
|
|
22
|
+
// packages/ui/src/chat-composer.ts
|
|
23
|
+
var chat_composer_exports = {};
|
|
24
|
+
__export(chat_composer_exports, {
|
|
25
|
+
ChatComposer: () => ChatComposer
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(chat_composer_exports);
|
|
28
|
+
var import_reactivity2 = require("@vobs/reactivity");
|
|
29
|
+
var import_vobs2 = require("@vobs/vobs");
|
|
551
30
|
|
|
552
31
|
// packages/ui/src/utils.ts
|
|
32
|
+
var import_reactivity = require("@vobs/reactivity");
|
|
33
|
+
var import_vobs = require("@vobs/vobs");
|
|
553
34
|
function classNames(...values) {
|
|
554
35
|
return values.flatMap((value) => typeof value === "string" ? value.trim().split(/\s+/u) : []).filter(Boolean).join(" ");
|
|
555
36
|
}
|
|
@@ -564,8 +45,8 @@ function hasProp(props, name) {
|
|
|
564
45
|
}
|
|
565
46
|
__name(hasProp, "hasProp");
|
|
566
47
|
function bindClassList(root, props, readBaseClasses) {
|
|
567
|
-
effect(() => {
|
|
568
|
-
setAttribute(root, "class", classNames(
|
|
48
|
+
(0, import_reactivity.effect)(() => {
|
|
49
|
+
(0, import_vobs.setAttribute)(root, "class", classNames(
|
|
569
50
|
...readBaseClasses(),
|
|
570
51
|
readString(props, "class"),
|
|
571
52
|
readString(props, "className")
|
|
@@ -579,7 +60,7 @@ function bindCommonAttributes(root, props, skip = [], options = {}) {
|
|
|
579
60
|
ignored.add("className");
|
|
580
61
|
ignored.add("children");
|
|
581
62
|
ignored.add("style");
|
|
582
|
-
effect(() => {
|
|
63
|
+
(0, import_reactivity.effect)(() => {
|
|
583
64
|
const next = /* @__PURE__ */ new Map();
|
|
584
65
|
for (const name of Object.keys(props)) {
|
|
585
66
|
if (ignored.has(name) || name.startsWith("on")) continue;
|
|
@@ -593,7 +74,7 @@ function bindCommonAttributes(root, props, skip = [], options = {}) {
|
|
|
593
74
|
for (const name of managed) {
|
|
594
75
|
if (!next.has(name)) removeAttribute(root, name);
|
|
595
76
|
}
|
|
596
|
-
for (const [name, value] of next) setAttribute(root, name, value);
|
|
77
|
+
for (const [name, value] of next) (0, import_vobs.setAttribute)(root, name, value);
|
|
597
78
|
setManagedAttributes(root, next.keys());
|
|
598
79
|
});
|
|
599
80
|
}
|
|
@@ -603,27 +84,27 @@ function bindUserStyle(root, props) {
|
|
|
603
84
|
}
|
|
604
85
|
__name(bindUserStyle, "bindUserStyle");
|
|
605
86
|
function bindStyle(root, props, createStyle) {
|
|
606
|
-
effect(() => {
|
|
87
|
+
(0, import_reactivity.effect)(() => {
|
|
607
88
|
const userStyle = readString(props, "style");
|
|
608
89
|
const internalStyle = createStyle();
|
|
609
90
|
const style = [internalStyle, userStyle].filter(Boolean).join("; ");
|
|
610
|
-
if (style) setAttribute(root, "style", style);
|
|
91
|
+
if (style) (0, import_vobs.setAttribute)(root, "style", style);
|
|
611
92
|
else removeAttribute(root, "style");
|
|
612
93
|
});
|
|
613
94
|
}
|
|
614
95
|
__name(bindStyle, "bindStyle");
|
|
615
96
|
function bindTextContent(node, read) {
|
|
616
|
-
effect(() => {
|
|
617
|
-
setTextContent(node, String(read() ?? ""));
|
|
97
|
+
(0, import_reactivity.effect)(() => {
|
|
98
|
+
(0, import_vobs.setTextContent)(node, String(read() ?? ""));
|
|
618
99
|
});
|
|
619
100
|
}
|
|
620
101
|
__name(bindTextContent, "bindTextContent");
|
|
621
102
|
function bindPropertyValue(node, name, read) {
|
|
622
|
-
effect(() => setProperty(node, name, read()));
|
|
103
|
+
(0, import_reactivity.effect)(() => (0, import_vobs.setProperty)(node, name, read()));
|
|
623
104
|
}
|
|
624
105
|
__name(bindPropertyValue, "bindPropertyValue");
|
|
625
106
|
function listen(root, event, props, propName, disabled) {
|
|
626
|
-
addEventListener(root, event, (reason) => {
|
|
107
|
+
(0, import_vobs.addEventListener)(root, event, (reason) => {
|
|
627
108
|
if (disabled?.()) return;
|
|
628
109
|
const handler = Reflect.get(props, propName);
|
|
629
110
|
if (typeof handler === "function") handler(reason);
|
|
@@ -631,19 +112,19 @@ function listen(root, event, props, propName, disabled) {
|
|
|
631
112
|
}
|
|
632
113
|
__name(listen, "listen");
|
|
633
114
|
function mountSlot(parent, props, propName) {
|
|
634
|
-
insertDynamic(parent, null, () => resolveSlot(Reflect.get(props, propName)));
|
|
115
|
+
(0, import_vobs.insertDynamic)(parent, null, () => resolveSlot(Reflect.get(props, propName)));
|
|
635
116
|
}
|
|
636
117
|
__name(mountSlot, "mountSlot");
|
|
637
118
|
function resolveSlot(value) {
|
|
638
119
|
const resolved = typeof value === "function" ? value() : value;
|
|
639
120
|
if (resolved === void 0 || resolved === null || resolved === false) return null;
|
|
640
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
121
|
+
if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs.createText)(String(resolved));
|
|
641
122
|
if (Array.isArray(resolved)) {
|
|
642
123
|
const children = resolved;
|
|
643
|
-
return createFragment((parent, anchor) => {
|
|
124
|
+
return (0, import_vobs.createFragment)((parent, anchor) => {
|
|
644
125
|
for (const child of children) {
|
|
645
126
|
const node = resolveSlot(child);
|
|
646
|
-
if (node) insertBefore(parent, node, anchor);
|
|
127
|
+
if (node) (0, import_vobs.insertBefore)(parent, node, anchor);
|
|
647
128
|
}
|
|
648
129
|
});
|
|
649
130
|
}
|
|
@@ -655,12 +136,12 @@ function setOptionalAttribute(node, name, value) {
|
|
|
655
136
|
removeAttribute(node, name);
|
|
656
137
|
return;
|
|
657
138
|
}
|
|
658
|
-
setAttribute(node, name, String(value));
|
|
139
|
+
(0, import_vobs.setAttribute)(node, name, String(value));
|
|
659
140
|
}
|
|
660
141
|
__name(setOptionalAttribute, "setOptionalAttribute");
|
|
661
142
|
function setOptionalProperty(node, name, value) {
|
|
662
143
|
if (value === void 0 || value === null) return;
|
|
663
|
-
setProperty(node, name, value);
|
|
144
|
+
(0, import_vobs.setProperty)(node, name, value);
|
|
664
145
|
}
|
|
665
146
|
__name(setOptionalProperty, "setOptionalProperty");
|
|
666
147
|
function readString(props, name) {
|
|
@@ -695,11 +176,11 @@ __name(removeAttribute, "removeAttribute");
|
|
|
695
176
|
|
|
696
177
|
// packages/ui/src/chat-composer.ts
|
|
697
178
|
function ChatComposer(props = {}) {
|
|
698
|
-
const root = createElement("div");
|
|
699
|
-
const input = createElement("textarea");
|
|
700
|
-
const toolbar = createElement("div");
|
|
701
|
-
const tools = createElement("div");
|
|
702
|
-
const actions = createElement("div");
|
|
179
|
+
const root = (0, import_vobs2.createElement)("div");
|
|
180
|
+
const input = (0, import_vobs2.createElement)("textarea");
|
|
181
|
+
const toolbar = (0, import_vobs2.createElement)("div");
|
|
182
|
+
const tools = (0, import_vobs2.createElement)("div");
|
|
183
|
+
const actions = (0, import_vobs2.createElement)("div");
|
|
703
184
|
bindClassList(root, props, () => ["vui-composer"]);
|
|
704
185
|
bindUserStyle(root, props);
|
|
705
186
|
bindCommonAttributes(input, props, [
|
|
@@ -718,11 +199,11 @@ function ChatComposer(props = {}) {
|
|
|
718
199
|
"onSend",
|
|
719
200
|
"onModelClick"
|
|
720
201
|
]);
|
|
721
|
-
setAttribute(input, "class", "vui-composer__input");
|
|
722
|
-
setAttribute(toolbar, "class", "vui-composer__toolbar");
|
|
723
|
-
setAttribute(tools, "class", "vui-composer__tools");
|
|
724
|
-
setAttribute(actions, "class", "vui-composer__actions");
|
|
725
|
-
effect(() => {
|
|
202
|
+
(0, import_vobs2.setAttribute)(input, "class", "vui-composer__input");
|
|
203
|
+
(0, import_vobs2.setAttribute)(toolbar, "class", "vui-composer__toolbar");
|
|
204
|
+
(0, import_vobs2.setAttribute)(tools, "class", "vui-composer__tools");
|
|
205
|
+
(0, import_vobs2.setAttribute)(actions, "class", "vui-composer__actions");
|
|
206
|
+
(0, import_reactivity2.effect)(() => {
|
|
726
207
|
setOptionalAttribute(input, "placeholder", readProp(props, "placeholder", void 0));
|
|
727
208
|
setOptionalProperty(input, "disabled", readProp(props, "disabled", false));
|
|
728
209
|
setOptionalAttribute(input, "aria-disabled", readProp(props, "disabled", false) ? "true" : void 0);
|
|
@@ -731,7 +212,7 @@ function ChatComposer(props = {}) {
|
|
|
731
212
|
bindPropertyValue(input, "value", () => readProp(props, "value", "") ?? "");
|
|
732
213
|
}
|
|
733
214
|
listen(input, "input", props, "onInput", () => readProp(props, "disabled", false));
|
|
734
|
-
addEventListener(input, "keydown", (event) => {
|
|
215
|
+
(0, import_vobs2.addEventListener)(input, "keydown", (event) => {
|
|
735
216
|
const keyboardEvent = event;
|
|
736
217
|
if (keyboardEvent.key !== "Enter" || !keyboardEvent.metaKey && !keyboardEvent.ctrlKey) return;
|
|
737
218
|
keyboardEvent.preventDefault?.();
|
|
@@ -740,36 +221,36 @@ function ChatComposer(props = {}) {
|
|
|
740
221
|
});
|
|
741
222
|
if (hasProp(props, "tools")) mountSlot(tools, props, "tools");
|
|
742
223
|
else if (hasProp(props, "children")) mountSlot(tools, props, "children");
|
|
743
|
-
if (hasProp(props, "model")) insertBefore(tools, createModelSelector(props), null);
|
|
224
|
+
if (hasProp(props, "model")) (0, import_vobs2.insertBefore)(tools, createModelSelector(props), null);
|
|
744
225
|
if (hasProp(props, "actions")) mountSlot(actions, props, "actions");
|
|
745
|
-
else insertBefore(actions, createSendButton(input, props), null);
|
|
746
|
-
insertBefore(root, input, null);
|
|
747
|
-
insertBefore(toolbar, tools, null);
|
|
748
|
-
insertBefore(toolbar, actions, null);
|
|
749
|
-
insertBefore(root, toolbar, null);
|
|
226
|
+
else (0, import_vobs2.insertBefore)(actions, createSendButton(input, props), null);
|
|
227
|
+
(0, import_vobs2.insertBefore)(root, input, null);
|
|
228
|
+
(0, import_vobs2.insertBefore)(toolbar, tools, null);
|
|
229
|
+
(0, import_vobs2.insertBefore)(toolbar, actions, null);
|
|
230
|
+
(0, import_vobs2.insertBefore)(root, toolbar, null);
|
|
750
231
|
return root;
|
|
751
232
|
}
|
|
752
233
|
__name(ChatComposer, "ChatComposer");
|
|
753
234
|
function createModelSelector(props) {
|
|
754
|
-
const button = createElement("button");
|
|
755
|
-
setAttribute(button, "class", "vui-composer__model");
|
|
756
|
-
setAttribute(button, "type", "button");
|
|
235
|
+
const button = (0, import_vobs2.createElement)("button");
|
|
236
|
+
(0, import_vobs2.setAttribute)(button, "class", "vui-composer__model");
|
|
237
|
+
(0, import_vobs2.setAttribute)(button, "type", "button");
|
|
757
238
|
if (hasProp(props, "modelIcon")) {
|
|
758
|
-
const icon = createElement("span");
|
|
759
|
-
setAttribute(icon, "class", "vui-composer__model-icon");
|
|
239
|
+
const icon = (0, import_vobs2.createElement)("span");
|
|
240
|
+
(0, import_vobs2.setAttribute)(icon, "class", "vui-composer__model-icon");
|
|
760
241
|
mountSlot(icon, props, "modelIcon");
|
|
761
|
-
insertBefore(button, icon, null);
|
|
242
|
+
(0, import_vobs2.insertBefore)(button, icon, null);
|
|
762
243
|
}
|
|
763
|
-
const text = createText("");
|
|
244
|
+
const text = (0, import_vobs2.createText)("");
|
|
764
245
|
bindTextContent(text, () => readProp(props, "model", ""));
|
|
765
|
-
insertBefore(button, text, null);
|
|
246
|
+
(0, import_vobs2.insertBefore)(button, text, null);
|
|
766
247
|
if (hasProp(props, "modelChevron")) {
|
|
767
|
-
const chevron = createElement("span");
|
|
768
|
-
setAttribute(chevron, "class", "vui-composer__model-chevron");
|
|
248
|
+
const chevron = (0, import_vobs2.createElement)("span");
|
|
249
|
+
(0, import_vobs2.setAttribute)(chevron, "class", "vui-composer__model-chevron");
|
|
769
250
|
mountSlot(chevron, props, "modelChevron");
|
|
770
|
-
insertBefore(button, chevron, null);
|
|
251
|
+
(0, import_vobs2.insertBefore)(button, chevron, null);
|
|
771
252
|
}
|
|
772
|
-
addEventListener(button, "click", (event) => {
|
|
253
|
+
(0, import_vobs2.addEventListener)(button, "click", (event) => {
|
|
773
254
|
const handler = readProp(props, "onModelClick", void 0);
|
|
774
255
|
if (typeof handler === "function") handler(event);
|
|
775
256
|
});
|
|
@@ -777,21 +258,21 @@ function createModelSelector(props) {
|
|
|
777
258
|
}
|
|
778
259
|
__name(createModelSelector, "createModelSelector");
|
|
779
260
|
function createSendButton(input, props) {
|
|
780
|
-
const button = createElement("button");
|
|
781
|
-
setAttribute(button, "class", "vui-composer__send");
|
|
782
|
-
setAttribute(button, "type", "button");
|
|
261
|
+
const button = (0, import_vobs2.createElement)("button");
|
|
262
|
+
(0, import_vobs2.setAttribute)(button, "class", "vui-composer__send");
|
|
263
|
+
(0, import_vobs2.setAttribute)(button, "type", "button");
|
|
783
264
|
const label = readProp(props, "sendLabel", "Send");
|
|
784
265
|
setOptionalAttribute(button, "aria-label", label);
|
|
785
266
|
if (hasProp(props, "sendIcon")) {
|
|
786
|
-
const icon = createElement("span");
|
|
787
|
-
setAttribute(icon, "class", "vui-composer__send-icon");
|
|
267
|
+
const icon = (0, import_vobs2.createElement)("span");
|
|
268
|
+
(0, import_vobs2.setAttribute)(icon, "class", "vui-composer__send-icon");
|
|
788
269
|
mountSlot(icon, props, "sendIcon");
|
|
789
|
-
insertBefore(button, icon, null);
|
|
270
|
+
(0, import_vobs2.insertBefore)(button, icon, null);
|
|
790
271
|
} else {
|
|
791
|
-
insertBefore(button, createText(label), null);
|
|
272
|
+
(0, import_vobs2.insertBefore)(button, (0, import_vobs2.createText)(label), null);
|
|
792
273
|
}
|
|
793
|
-
effect(() => setProperty(button, "disabled", readProp(props, "disabled", false)));
|
|
794
|
-
addEventListener(button, "click", (event) => {
|
|
274
|
+
(0, import_reactivity2.effect)(() => (0, import_vobs2.setProperty)(button, "disabled", readProp(props, "disabled", false)));
|
|
275
|
+
(0, import_vobs2.addEventListener)(button, "click", (event) => {
|
|
795
276
|
if (readProp(props, "disabled", false)) return;
|
|
796
277
|
const handler = readProp(props, "onSend", void 0);
|
|
797
278
|
if (typeof handler === "function") handler(currentValue(input, props), event);
|
|
@@ -804,7 +285,8 @@ function currentValue(input, props) {
|
|
|
804
285
|
return typeof value === "string" ? value : readProp(props, "value", "") ?? "";
|
|
805
286
|
}
|
|
806
287
|
__name(currentValue, "currentValue");
|
|
807
|
-
|
|
808
|
-
exports
|
|
809
|
-
|
|
288
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
289
|
+
0 && (module.exports = {
|
|
290
|
+
ChatComposer
|
|
291
|
+
});
|
|
810
292
|
//# sourceMappingURL=chat-composer.cjs.map
|