@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/index.cjs
CHANGED
|
@@ -1,850 +1,82 @@
|
|
|
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
|
-
var signalNames = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function hasDebugHooks() {
|
|
10
|
-
return activeDebugHooks !== null;
|
|
11
|
-
}
|
|
12
|
-
__name(hasDebugHooks, "hasDebugHooks");
|
|
13
|
-
function setSignalDebugName(signal, name) {
|
|
14
|
-
signalNames.set(signal, name);
|
|
15
|
-
invokeDebug("signalNamed", signal, name);
|
|
16
|
-
}
|
|
17
|
-
__name(setSignalDebugName, "setSignalDebugName");
|
|
18
|
-
function invokeDebug(name, ...args) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
__name(invokeDebug, "invokeDebug");
|
|
22
|
-
|
|
23
|
-
// packages/reactivity/src/owner.ts
|
|
24
|
-
var currentOwner = null;
|
|
25
|
-
var nextOwnerId = 1;
|
|
26
|
-
var ownerNames = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
function createOwner() {
|
|
28
|
-
const parent = currentOwner;
|
|
29
|
-
let disposed = parent?.disposed ?? false;
|
|
30
|
-
const children = [];
|
|
31
|
-
const cleanups = [];
|
|
32
|
-
const errorHandlers = /* @__PURE__ */ new Set();
|
|
33
|
-
const owner = {
|
|
34
|
-
id: `owner-${nextOwnerId++}`,
|
|
35
|
-
parent,
|
|
36
|
-
children,
|
|
37
|
-
depth: (parent?.depth ?? -1) + 1,
|
|
38
|
-
get disposed() {
|
|
39
|
-
return disposed;
|
|
40
|
-
},
|
|
41
|
-
run(fn) {
|
|
42
|
-
if (disposed) throw new Error("Vobs: \u5DF2\u9500\u6BC1\u7684 Owner \u4E0D\u80FD\u7EE7\u7EED\u8FD0\u884C");
|
|
43
|
-
const previous = currentOwner;
|
|
44
|
-
currentOwner = owner;
|
|
45
|
-
try {
|
|
46
|
-
return fn();
|
|
47
|
-
} finally {
|
|
48
|
-
currentOwner = previous;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
addCleanup(cleanup) {
|
|
52
|
-
if (disposed) {
|
|
53
|
-
cleanup();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
cleanups.push(cleanup);
|
|
57
|
-
},
|
|
58
|
-
onDispose(cleanup) {
|
|
59
|
-
owner.addCleanup(cleanup);
|
|
60
|
-
},
|
|
61
|
-
onError(handler) {
|
|
62
|
-
errorHandlers.add(handler);
|
|
63
|
-
const remove = /* @__PURE__ */ __name(() => errorHandlers.delete(handler), "remove");
|
|
64
|
-
owner.addCleanup(remove);
|
|
65
|
-
return remove;
|
|
66
|
-
},
|
|
67
|
-
handleError(error) {
|
|
68
|
-
for (const handler of [...errorHandlers].reverse()) {
|
|
69
|
-
try {
|
|
70
|
-
handler(error);
|
|
71
|
-
return true;
|
|
72
|
-
} catch (handlerError) {
|
|
73
|
-
return parent?.handleError(handlerError) ?? false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return parent?.handleError(error) ?? false;
|
|
77
|
-
},
|
|
78
|
-
dispose() {
|
|
79
|
-
if (disposed) return;
|
|
80
|
-
disposed = true;
|
|
81
|
-
for (const child of [...children]) child.dispose();
|
|
82
|
-
children.length = 0;
|
|
83
|
-
let firstError;
|
|
84
|
-
for (let index = cleanups.length - 1; index >= 0; index--) {
|
|
85
|
-
try {
|
|
86
|
-
cleanups[index]();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
firstError ?? (firstError = error);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
cleanups.length = 0;
|
|
92
|
-
if (parent) {
|
|
93
|
-
const index = parent.children.indexOf(owner);
|
|
94
|
-
if (index >= 0) parent.children.splice(index, 1);
|
|
95
|
-
}
|
|
96
|
-
if (firstError) throw firstError;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
if (parent && !parent.disposed) parent.children.push(owner);
|
|
100
|
-
return owner;
|
|
101
|
-
}
|
|
102
|
-
__name(createOwner, "createOwner");
|
|
103
|
-
function setOwnerDebugName(owner, name) {
|
|
104
|
-
ownerNames.set(owner, name);
|
|
105
|
-
}
|
|
106
|
-
__name(setOwnerDebugName, "setOwnerDebugName");
|
|
107
|
-
function getCurrentOwner() {
|
|
108
|
-
return currentOwner;
|
|
109
|
-
}
|
|
110
|
-
__name(getCurrentOwner, "getCurrentOwner");
|
|
111
|
-
function onDispose(cleanup) {
|
|
112
|
-
const owner = getCurrentOwner();
|
|
113
|
-
if (!owner) throw new Error("Vobs: onDispose \u5FC5\u987B\u5728 Owner \u4F5C\u7528\u57DF\u5185\u8C03\u7528");
|
|
114
|
-
owner.onDispose(cleanup);
|
|
115
|
-
}
|
|
116
|
-
__name(onDispose, "onDispose");
|
|
117
|
-
|
|
118
|
-
// packages/reactivity/src/signal.ts
|
|
119
|
-
var currentSubscriber = null;
|
|
120
|
-
function getCurrentSubscriber() {
|
|
121
|
-
return currentSubscriber;
|
|
122
|
-
}
|
|
123
|
-
__name(getCurrentSubscriber, "getCurrentSubscriber");
|
|
124
|
-
function setCurrentSubscriber(subscriber) {
|
|
125
|
-
currentSubscriber = subscriber;
|
|
126
|
-
}
|
|
127
|
-
__name(setCurrentSubscriber, "setCurrentSubscriber");
|
|
128
|
-
function trackDependency(dependency) {
|
|
129
|
-
if (!currentSubscriber || currentSubscriber.disposed) return;
|
|
130
|
-
!currentSubscriber.dependencies.has(dependency);
|
|
131
|
-
currentSubscriber.dependencies.add(dependency);
|
|
132
|
-
}
|
|
133
|
-
__name(trackDependency, "trackDependency");
|
|
134
|
-
function state(initialValue, debugName) {
|
|
135
|
-
let value = initialValue;
|
|
136
|
-
let disposed = false;
|
|
137
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
138
|
-
const signalInstance = {
|
|
139
|
-
get value() {
|
|
140
|
-
const subscriber = getCurrentSubscriber();
|
|
141
|
-
if (subscriber && !subscriber.disposed) {
|
|
142
|
-
subscribers.add(subscriber);
|
|
143
|
-
trackDependency(signalInstance);
|
|
144
|
-
}
|
|
145
|
-
return value;
|
|
146
|
-
},
|
|
147
|
-
set value(nextValue) {
|
|
148
|
-
if (disposed || Object.is(value, nextValue)) return;
|
|
149
|
-
value = nextValue;
|
|
150
|
-
for (const subscriber of [...subscribers]) subscriber.notify();
|
|
151
|
-
},
|
|
152
|
-
unsubscribe(subscriber) {
|
|
153
|
-
subscribers.delete(subscriber);
|
|
154
|
-
},
|
|
155
|
-
// 与 `.value =` 赋值同一条路径:判等短路、debug hook、notify 全部一致。
|
|
156
|
-
// 以闭包实现,可安全地作为回调直接传递(无 this 绑定问题)。
|
|
157
|
-
set(next) {
|
|
158
|
-
signalInstance.value = next;
|
|
159
|
-
},
|
|
160
|
-
dispose() {
|
|
161
|
-
if (disposed) return;
|
|
162
|
-
disposed = true;
|
|
163
|
-
subscribers.clear();
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const owner = getCurrentOwner();
|
|
167
|
-
owner?.addCleanup(signalInstance.dispose);
|
|
168
|
-
if (debugName?.trim()) setSignalDebugName(signalInstance, debugName.trim());
|
|
169
|
-
return signalInstance;
|
|
170
|
-
}
|
|
171
|
-
__name(state, "state");
|
|
172
|
-
|
|
173
|
-
// packages/reactivity/src/scheduler.ts
|
|
174
|
-
var _Scheduler = class _Scheduler {
|
|
175
|
-
constructor() {
|
|
176
|
-
this.dirtyEffects = /* @__PURE__ */ new Set();
|
|
177
|
-
this.lowPriorityEffects = /* @__PURE__ */ new Set();
|
|
178
|
-
// flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
|
|
179
|
-
this.normalBuffer = [];
|
|
180
|
-
this.lowBuffer = [];
|
|
181
|
-
this.flushing = false;
|
|
182
|
-
this.scheduled = false;
|
|
183
|
-
this.batchDepth = 0;
|
|
184
|
-
}
|
|
185
|
-
schedule(effect2) {
|
|
186
|
-
if (effect2.disposed) return;
|
|
187
|
-
this.dirtyEffects.add(effect2);
|
|
188
|
-
this.lowPriorityEffects.delete(effect2);
|
|
189
|
-
this.ensureScheduled();
|
|
190
|
-
}
|
|
191
|
-
/** Queue an effect behind normal updates while preserving deterministic order. */
|
|
192
|
-
scheduleLow(effect2) {
|
|
193
|
-
if (effect2.disposed) return;
|
|
194
|
-
if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
|
|
195
|
-
this.ensureScheduled();
|
|
196
|
-
}
|
|
197
|
-
ensureScheduled() {
|
|
198
|
-
if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
|
|
199
|
-
this.scheduled = true;
|
|
200
|
-
queueMicrotask(() => {
|
|
201
|
-
this.scheduled = false;
|
|
202
|
-
this.flush();
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
remove(effect2) {
|
|
207
|
-
this.dirtyEffects.delete(effect2);
|
|
208
|
-
this.lowPriorityEffects.delete(effect2);
|
|
209
|
-
}
|
|
210
|
-
batch(fn) {
|
|
211
|
-
this.batchDepth++;
|
|
212
|
-
try {
|
|
213
|
-
return fn();
|
|
214
|
-
} finally {
|
|
215
|
-
this.batchDepth--;
|
|
216
|
-
if (this.batchDepth === 0) this.flush();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
flush() {
|
|
220
|
-
if (this.flushing || this.batchDepth > 0) return;
|
|
221
|
-
this.flushing = true;
|
|
222
|
-
let rounds = 0;
|
|
223
|
-
let firstError;
|
|
224
|
-
let hasError = false;
|
|
225
|
-
try {
|
|
226
|
-
while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
|
|
227
|
-
if (++rounds > 100) {
|
|
228
|
-
this.dirtyEffects.clear();
|
|
229
|
-
this.lowPriorityEffects.clear();
|
|
230
|
-
throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
|
|
231
|
-
}
|
|
232
|
-
this.collectRunnable(this.dirtyEffects, this.normalBuffer);
|
|
233
|
-
this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
|
|
234
|
-
sortEffects(this.normalBuffer);
|
|
235
|
-
sortEffects(this.lowBuffer);
|
|
236
|
-
for (const effect2 of this.normalBuffer) {
|
|
237
|
-
try {
|
|
238
|
-
effect2.run();
|
|
239
|
-
} catch (error) {
|
|
240
|
-
if (!hasError) {
|
|
241
|
-
firstError = error;
|
|
242
|
-
hasError = true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
for (const effect2 of this.lowBuffer) {
|
|
247
|
-
try {
|
|
248
|
-
effect2.run();
|
|
249
|
-
} catch (error) {
|
|
250
|
-
if (!hasError) {
|
|
251
|
-
firstError = error;
|
|
252
|
-
hasError = true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
this.normalBuffer.length = 0;
|
|
257
|
-
this.lowBuffer.length = 0;
|
|
258
|
-
}
|
|
259
|
-
} finally {
|
|
260
|
-
this.normalBuffer.length = 0;
|
|
261
|
-
this.lowBuffer.length = 0;
|
|
262
|
-
this.flushing = false;
|
|
263
|
-
}
|
|
264
|
-
if (hasError) throw firstError;
|
|
265
|
-
}
|
|
266
|
-
/** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
|
|
267
|
-
collectRunnable(source, target) {
|
|
268
|
-
for (const effect2 of source) {
|
|
269
|
-
if (!effect2.disposed) target.push(effect2);
|
|
270
|
-
}
|
|
271
|
-
source.clear();
|
|
272
|
-
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
273
11
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
__name(sortEffects, "sortEffects");
|
|
282
|
-
var scheduler = new Scheduler();
|
|
283
|
-
|
|
284
|
-
// packages/reactivity/src/effect.ts
|
|
285
|
-
var nextEffectOrder = 1;
|
|
286
|
-
function cleanupDependencies(subscriber) {
|
|
287
|
-
for (const dependency of subscriber.dependencies) {
|
|
288
|
-
dependency.unsubscribe(subscriber);
|
|
289
|
-
}
|
|
290
|
-
subscriber.dependencies.clear();
|
|
291
|
-
}
|
|
292
|
-
__name(cleanupDependencies, "cleanupDependencies");
|
|
293
|
-
function effect(callback) {
|
|
294
|
-
const owner = getCurrentOwner();
|
|
295
|
-
let cleanup;
|
|
296
|
-
let dirty = true;
|
|
297
|
-
let disposed = false;
|
|
298
|
-
const eff = {
|
|
299
|
-
order: nextEffectOrder++,
|
|
300
|
-
depth: owner?.depth ?? 0,
|
|
301
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
302
|
-
get disposed() {
|
|
303
|
-
return disposed;
|
|
304
|
-
},
|
|
305
|
-
notify() {
|
|
306
|
-
if (disposed || dirty) return;
|
|
307
|
-
dirty = true;
|
|
308
|
-
scheduler.schedule(eff);
|
|
309
|
-
},
|
|
310
|
-
run() {
|
|
311
|
-
if (disposed || !dirty) return;
|
|
312
|
-
dirty = false;
|
|
313
|
-
const previousCleanup = cleanup;
|
|
314
|
-
cleanup = void 0;
|
|
315
|
-
let cleanupError;
|
|
316
|
-
if (previousCleanup) {
|
|
317
|
-
try {
|
|
318
|
-
previousCleanup();
|
|
319
|
-
} catch (error) {
|
|
320
|
-
const handled2 = owner?.handleError(error) ?? false;
|
|
321
|
-
if (!handled2) cleanupError = error;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
cleanupDependencies(eff);
|
|
325
|
-
const previous = getCurrentSubscriber();
|
|
326
|
-
setCurrentSubscriber(eff);
|
|
327
|
-
let thrown;
|
|
328
|
-
let handled = false;
|
|
329
|
-
try {
|
|
330
|
-
const result = owner ? owner.run(callback) : callback();
|
|
331
|
-
cleanup = typeof result === "function" ? result : void 0;
|
|
332
|
-
} catch (error) {
|
|
333
|
-
thrown = error;
|
|
334
|
-
handled = owner?.handleError(error) ?? false;
|
|
335
|
-
if (!handled) throw error;
|
|
336
|
-
} finally {
|
|
337
|
-
setCurrentSubscriber(previous);
|
|
338
|
-
}
|
|
339
|
-
if (cleanupError && !thrown) throw cleanupError;
|
|
340
|
-
},
|
|
341
|
-
scheduleLow() {
|
|
342
|
-
if (disposed || dirty) return;
|
|
343
|
-
dirty = true;
|
|
344
|
-
scheduler.scheduleLow(eff);
|
|
345
|
-
},
|
|
346
|
-
dispose() {
|
|
347
|
-
if (disposed) return;
|
|
348
|
-
disposed = true;
|
|
349
|
-
dirty = false;
|
|
350
|
-
scheduler.remove(eff);
|
|
351
|
-
const previousCleanup = cleanup;
|
|
352
|
-
cleanup = void 0;
|
|
353
|
-
let cleanupError;
|
|
354
|
-
if (previousCleanup) {
|
|
355
|
-
try {
|
|
356
|
-
previousCleanup();
|
|
357
|
-
} catch (error) {
|
|
358
|
-
const handled = owner?.handleError(error) ?? false;
|
|
359
|
-
if (!handled) cleanupError = error;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
cleanupDependencies(eff);
|
|
363
|
-
if (cleanupError) throw cleanupError;
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
owner?.addCleanup(eff.dispose);
|
|
367
|
-
eff.run();
|
|
368
|
-
return eff;
|
|
369
|
-
}
|
|
370
|
-
__name(effect, "effect");
|
|
371
|
-
|
|
372
|
-
// packages/runtime/src/debug.ts
|
|
373
|
-
var activeRuntimeDebugHooks = null;
|
|
374
|
-
function getRuntimeDebugHooks() {
|
|
375
|
-
return activeRuntimeDebugHooks;
|
|
376
|
-
}
|
|
377
|
-
__name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
|
|
378
|
-
function invokeRuntimeDebug(name, ...args) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
__name(invokeRuntimeDebug, "invokeRuntimeDebug");
|
|
382
|
-
function readDebugValue(read) {
|
|
383
|
-
try {
|
|
384
|
-
return read();
|
|
385
|
-
} catch {
|
|
386
|
-
return "[Uninspectable]";
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
__name(readDebugValue, "readDebugValue");
|
|
390
|
-
function describeDebugNode(node) {
|
|
391
|
-
if (!node || typeof node !== "object") return "node";
|
|
392
|
-
const value = node;
|
|
393
|
-
const name = typeof value.tagName === "string" ? value.tagName.toLowerCase() : typeof value.nodeName === "string" ? value.nodeName.toLowerCase() : "node";
|
|
394
|
-
const id = typeof value.id === "string" && value.id ? `#${value.id}` : "";
|
|
395
|
-
const className = typeof value.className === "string" && value.className ? `.${value.className.trim().split(/\s+/).filter(Boolean).join(".")}` : "";
|
|
396
|
-
return `${name}${id}${className}`;
|
|
397
|
-
}
|
|
398
|
-
__name(describeDebugNode, "describeDebugNode");
|
|
399
|
-
|
|
400
|
-
// packages/runtime/src/hmr.ts
|
|
401
|
-
var globalTarget = globalThis;
|
|
402
|
-
var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
|
|
403
|
-
globalTarget.__VOBS_HMR__ = hmrGlobal;
|
|
404
|
-
function markHmrInstanceMounted(node, parent) {
|
|
405
|
-
const instance = hmrInstances.get(node);
|
|
406
|
-
if (instance) instance.parent = parent;
|
|
407
|
-
}
|
|
408
|
-
__name(markHmrInstanceMounted, "markHmrInstanceMounted");
|
|
409
|
-
var hmrInstances = /* @__PURE__ */ new WeakMap();
|
|
410
|
-
var nodeOwners = /* @__PURE__ */ new WeakMap();
|
|
411
|
-
var eventBindings = /* @__PURE__ */ new WeakMap();
|
|
412
|
-
function getRenderer() {
|
|
413
|
-
{
|
|
414
|
-
throw new Error("\u6E32\u67D3\u5668\u672A\u521D\u59CB\u5316");
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
__name(getRenderer, "getRenderer");
|
|
418
|
-
function createText(content) {
|
|
419
|
-
return getRenderer().createText(content);
|
|
420
|
-
}
|
|
421
|
-
__name(createText, "createText");
|
|
422
|
-
function createElement(tag) {
|
|
423
|
-
return getRenderer().createElement(tag);
|
|
424
|
-
}
|
|
425
|
-
__name(createElement, "createElement");
|
|
426
|
-
function createComment(content) {
|
|
427
|
-
return getRenderer().createComment(content);
|
|
428
|
-
}
|
|
429
|
-
__name(createComment, "createComment");
|
|
430
|
-
function insertBefore(parent, child, anchor) {
|
|
431
|
-
if (isVobsFragment(child)) {
|
|
432
|
-
child.mount(parent, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
getRenderer().insertBefore(parent, child, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
436
|
-
markHmrInstanceMounted(child, parent);
|
|
437
|
-
}
|
|
438
|
-
__name(insertBefore, "insertBefore");
|
|
439
|
-
function removeChild(parent, child) {
|
|
440
|
-
disposeNodeOwner(child);
|
|
441
|
-
if (isVobsFragment(child)) {
|
|
442
|
-
child.unmount(parent);
|
|
443
|
-
return;
|
|
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 });
|
|
444
17
|
}
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function setTextContent(node, content) {
|
|
449
|
-
getRenderer().setTextContent(node, content);
|
|
450
|
-
}
|
|
451
|
-
__name(setTextContent, "setTextContent");
|
|
452
|
-
function setProperty(node, key, value) {
|
|
453
|
-
getRenderer().setProperty(node, key, value);
|
|
454
|
-
}
|
|
455
|
-
__name(setProperty, "setProperty");
|
|
456
|
-
function setAttribute(node, key, value) {
|
|
457
|
-
getRenderer().setAttribute(node, key, value);
|
|
458
|
-
}
|
|
459
|
-
__name(setAttribute, "setAttribute");
|
|
460
|
-
function addEventListener(node, event, handler) {
|
|
461
|
-
const renderer = getRenderer();
|
|
462
|
-
const owner = getCurrentOwner();
|
|
463
|
-
let bindings = eventBindings.get(node);
|
|
464
|
-
if (!bindings) {
|
|
465
|
-
bindings = /* @__PURE__ */ new Map();
|
|
466
|
-
eventBindings.set(node, bindings);
|
|
467
|
-
}
|
|
468
|
-
const previous = bindings.get(event);
|
|
469
|
-
if (previous && previous.original === handler && previous.owner === owner) return;
|
|
470
|
-
if (previous) renderer.removeEventListener(node, event, previous.handler);
|
|
471
|
-
const listener = owner ? (reason) => {
|
|
472
|
-
try {
|
|
473
|
-
owner.run(() => handler(reason));
|
|
474
|
-
} catch (error) {
|
|
475
|
-
const handled = owner.handleError(error);
|
|
476
|
-
invokeRuntimeDebug("error", {
|
|
477
|
-
error,
|
|
478
|
-
owner,
|
|
479
|
-
phase: "event",
|
|
480
|
-
handled,
|
|
481
|
-
recovery: handled ? "handled" : "propagated"
|
|
482
|
-
});
|
|
483
|
-
if (!handled) throw error;
|
|
484
|
-
}
|
|
485
|
-
} : handler;
|
|
486
|
-
const binding = { handler: listener, owner, original: handler };
|
|
487
|
-
bindings.set(event, binding);
|
|
488
|
-
renderer.addEventListener(node, event, listener);
|
|
489
|
-
owner?.onDispose(() => {
|
|
490
|
-
if (bindings?.get(event) !== binding) return;
|
|
491
|
-
bindings.delete(event);
|
|
492
|
-
renderer.removeEventListener(node, event, listener);
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
__name(addEventListener, "addEventListener");
|
|
496
|
-
function createBlock(factory) {
|
|
497
|
-
const owner = createOwner();
|
|
498
|
-
setOwnerDebugName(owner, "dynamic");
|
|
499
|
-
let node;
|
|
500
|
-
try {
|
|
501
|
-
node = owner.run(factory);
|
|
502
|
-
} catch (error) {
|
|
503
|
-
owner.dispose();
|
|
504
|
-
throw error;
|
|
505
|
-
}
|
|
506
|
-
if (!node) {
|
|
507
|
-
owner.dispose();
|
|
508
|
-
return null;
|
|
509
|
-
}
|
|
510
|
-
associateNodeOwner(node, owner);
|
|
511
|
-
return node;
|
|
512
|
-
}
|
|
513
|
-
__name(createBlock, "createBlock");
|
|
514
|
-
function associateNodeOwner(node, owner) {
|
|
515
|
-
nodeOwners.set(node, owner);
|
|
516
|
-
}
|
|
517
|
-
__name(associateNodeOwner, "associateNodeOwner");
|
|
518
|
-
function disposeNodeOwner(node) {
|
|
519
|
-
const owner = nodeOwners.get(node);
|
|
520
|
-
if (!owner) return;
|
|
521
|
-
nodeOwners.delete(node);
|
|
522
|
-
owner.dispose();
|
|
523
|
-
}
|
|
524
|
-
__name(disposeNodeOwner, "disposeNodeOwner");
|
|
525
|
-
|
|
526
|
-
// packages/runtime/src/fragment.ts
|
|
527
|
-
function createFragment(factory) {
|
|
528
|
-
const start = createComment("vobs:fragment:start");
|
|
529
|
-
const end = createComment("vobs:fragment:end");
|
|
530
|
-
let parent = null;
|
|
531
|
-
let initialized = false;
|
|
532
|
-
const owner = getCurrentOwner();
|
|
533
|
-
const fragment = {
|
|
534
|
-
kind: "vobs-fragment",
|
|
535
|
-
start,
|
|
536
|
-
end,
|
|
537
|
-
mount(nextParent, anchor) {
|
|
538
|
-
if (parent && parent !== nextParent) {
|
|
539
|
-
throw new Error("Vobs Fragment: \u4E0D\u80FD\u8DE8\u7236\u8282\u70B9\u79FB\u52A8 Fragment");
|
|
540
|
-
}
|
|
541
|
-
if (initialized) {
|
|
542
|
-
moveRange(nextParent, start, end, anchor);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
const renderer = getRenderer();
|
|
546
|
-
renderer.insertBefore(nextParent, start, anchor);
|
|
547
|
-
renderer.insertBefore(nextParent, end, anchor);
|
|
548
|
-
parent = nextParent;
|
|
549
|
-
initialized = true;
|
|
550
|
-
if (owner) owner.run(() => factory(nextParent, end));
|
|
551
|
-
else factory(nextParent, end);
|
|
552
|
-
},
|
|
553
|
-
unmount(nextParent) {
|
|
554
|
-
if (!initialized || parent !== nextParent) {
|
|
555
|
-
throw new Error("Vobs Fragment: Fragment \u4E0D\u5C5E\u4E8E\u6307\u5B9A\u7236\u8282\u70B9");
|
|
556
|
-
}
|
|
557
|
-
const renderer = getRenderer();
|
|
558
|
-
let current = renderer.nextSibling(start);
|
|
559
|
-
while (current && current !== end) {
|
|
560
|
-
const next = renderer.nextSibling(current);
|
|
561
|
-
renderer.removeChild(nextParent, current);
|
|
562
|
-
current = next;
|
|
563
|
-
}
|
|
564
|
-
renderer.removeChild(nextParent, start);
|
|
565
|
-
renderer.removeChild(nextParent, end);
|
|
566
|
-
parent = null;
|
|
567
|
-
initialized = false;
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
return fragment;
|
|
571
|
-
}
|
|
572
|
-
__name(createFragment, "createFragment");
|
|
573
|
-
function isVobsFragment(value) {
|
|
574
|
-
return Boolean(value) && typeof value === "object" && value.kind === "vobs-fragment";
|
|
575
|
-
}
|
|
576
|
-
__name(isVobsFragment, "isVobsFragment");
|
|
577
|
-
function moveRange(parent, start, end, anchor) {
|
|
578
|
-
const renderer = getRenderer();
|
|
579
|
-
const nodes = [start];
|
|
580
|
-
let current = renderer.nextSibling(start);
|
|
581
|
-
while (current) {
|
|
582
|
-
nodes.push(current);
|
|
583
|
-
if (current === end) break;
|
|
584
|
-
current = renderer.nextSibling(current);
|
|
585
|
-
}
|
|
586
|
-
if (nodes[nodes.length - 1] !== end) {
|
|
587
|
-
throw new Error("Vobs Fragment: \u627E\u4E0D\u5230\u7ED3\u675F\u951A\u70B9");
|
|
588
|
-
}
|
|
589
|
-
for (const node of nodes) renderer.insertBefore(parent, node, anchor);
|
|
590
|
-
}
|
|
591
|
-
__name(moveRange, "moveRange");
|
|
592
|
-
|
|
593
|
-
// packages/runtime/src/dynamic.ts
|
|
594
|
-
function insertDynamic(parent, anchor, factory) {
|
|
595
|
-
const marker = createComment("vobs:dynamic");
|
|
596
|
-
insertBefore(parent, marker, anchor);
|
|
597
|
-
let current = null;
|
|
598
|
-
effect(() => {
|
|
599
|
-
const next = createBlock(factory);
|
|
600
|
-
if (next === current) return;
|
|
601
|
-
if (current) removeChild(parent, current);
|
|
602
|
-
current = next;
|
|
603
|
-
if (current) insertBefore(parent, current, marker);
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
__name(insertDynamic, "insertDynamic");
|
|
607
|
-
function insertList(parent, anchor, source, renderItem, keyOf) {
|
|
608
|
-
const marker = createComment("vobs:list");
|
|
609
|
-
insertBefore(parent, marker, anchor);
|
|
610
|
-
let entries = [];
|
|
611
|
-
const tracksIndex = renderItem.length >= 2;
|
|
612
|
-
effect(() => {
|
|
613
|
-
const items = source();
|
|
614
|
-
let keys = null;
|
|
615
|
-
if (keyOf) {
|
|
616
|
-
keys = new Array(items.length);
|
|
617
|
-
let allKeyed = items.length > 0;
|
|
618
|
-
for (let index = 0; index < items.length; index++) {
|
|
619
|
-
const key = keyOf(items[index], index);
|
|
620
|
-
if (key == null) {
|
|
621
|
-
allKeyed = false;
|
|
622
|
-
break;
|
|
623
|
-
}
|
|
624
|
-
keys[index] = key;
|
|
625
|
-
}
|
|
626
|
-
if (!allKeyed) keys = null;
|
|
627
|
-
}
|
|
628
|
-
const nextEntries = keys ? reconcileKeyed(items, keys, entries, renderItem) : reconcileIndexed(items, entries, renderItem);
|
|
629
|
-
const refreshed = tracksIndex ? /* @__PURE__ */ new Set() : null;
|
|
630
|
-
for (let index = 0; index < nextEntries.length; index++) {
|
|
631
|
-
const entry = nextEntries[index];
|
|
632
|
-
if (tracksIndex) {
|
|
633
|
-
if (entry.index !== index) {
|
|
634
|
-
refreshListEntry(parent, entry, index, renderItem);
|
|
635
|
-
refreshed.add(entry);
|
|
636
|
-
}
|
|
637
|
-
} else {
|
|
638
|
-
entry.index = index;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const retained = new Set(nextEntries);
|
|
642
|
-
for (const entry of entries) {
|
|
643
|
-
if (!retained.has(entry)) disposeEntry(parent, entry);
|
|
644
|
-
}
|
|
645
|
-
reorderListEntries(parent, marker, entries, nextEntries, refreshed);
|
|
646
|
-
entries = nextEntries;
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
__name(insertList, "insertList");
|
|
650
|
-
function reorderListEntries(parent, marker, previous, nextEntries, forceInsert) {
|
|
651
|
-
const count = nextEntries.length;
|
|
652
|
-
if (count === 0) return;
|
|
653
|
-
if (previous.length === 0) {
|
|
654
|
-
let reference2 = marker;
|
|
655
|
-
for (let index = count - 1; index >= 0; index--) {
|
|
656
|
-
const node = nextEntries[index].node;
|
|
657
|
-
insertBefore(parent, node, reference2);
|
|
658
|
-
reference2 = node;
|
|
659
|
-
}
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
const oldIndexOf = /* @__PURE__ */ new Map();
|
|
663
|
-
for (let index = 0; index < previous.length; index++) oldIndexOf.set(previous[index], index);
|
|
664
|
-
const seq = new Array(count);
|
|
665
|
-
for (let index = 0; index < count; index++) {
|
|
666
|
-
const entry = nextEntries[index];
|
|
667
|
-
seq[index] = forceInsert?.has(entry) ? -1 : oldIndexOf.get(entry) ?? -1;
|
|
668
|
-
}
|
|
669
|
-
const keep = computeKeptByLis(seq);
|
|
670
|
-
let reference = marker;
|
|
671
|
-
for (let index = count - 1; index >= 0; index--) {
|
|
672
|
-
const node = nextEntries[index].node;
|
|
673
|
-
if (keep[index]) {
|
|
674
|
-
reference = node;
|
|
675
|
-
continue;
|
|
676
|
-
}
|
|
677
|
-
insertBefore(parent, node, reference);
|
|
678
|
-
reference = node;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
__name(reorderListEntries, "reorderListEntries");
|
|
682
|
-
function computeKeptByLis(seq) {
|
|
683
|
-
const count = seq.length;
|
|
684
|
-
const keep = new Array(count).fill(false);
|
|
685
|
-
const tailsIndex = [];
|
|
686
|
-
const tailsValue = [];
|
|
687
|
-
const prev = new Array(count).fill(-1);
|
|
688
|
-
for (let i = 0; i < count; i++) {
|
|
689
|
-
const value = seq[i];
|
|
690
|
-
if (value < 0) continue;
|
|
691
|
-
let lo = 0;
|
|
692
|
-
let hi = tailsValue.length;
|
|
693
|
-
while (lo < hi) {
|
|
694
|
-
const mid = lo + hi >> 1;
|
|
695
|
-
if (tailsValue[mid] < value) lo = mid + 1;
|
|
696
|
-
else hi = mid;
|
|
697
|
-
}
|
|
698
|
-
if (lo === tailsValue.length) {
|
|
699
|
-
tailsValue.push(value);
|
|
700
|
-
tailsIndex.push(i);
|
|
701
|
-
} else {
|
|
702
|
-
tailsValue[lo] = value;
|
|
703
|
-
tailsIndex[lo] = i;
|
|
704
|
-
}
|
|
705
|
-
prev[i] = lo > 0 ? tailsIndex[lo - 1] : -1;
|
|
706
|
-
}
|
|
707
|
-
let cursor = tailsIndex.length > 0 ? tailsIndex[tailsIndex.length - 1] : -1;
|
|
708
|
-
while (cursor >= 0) {
|
|
709
|
-
keep[cursor] = true;
|
|
710
|
-
cursor = prev[cursor];
|
|
711
|
-
}
|
|
712
|
-
return keep;
|
|
713
|
-
}
|
|
714
|
-
__name(computeKeptByLis, "computeKeptByLis");
|
|
715
|
-
function reconcileKeyed(items, keys, entries, renderItem) {
|
|
716
|
-
const previous = new Map(entries.map((entry) => [entry.key, entry]));
|
|
717
|
-
const seen = /* @__PURE__ */ new Set();
|
|
718
|
-
const nextEntries = [];
|
|
719
|
-
for (let index = 0; index < items.length; index++) {
|
|
720
|
-
const item = items[index];
|
|
721
|
-
const key = keys[index];
|
|
722
|
-
if (seen.has(key)) {
|
|
723
|
-
console.warn(`Vobs: \u68C0\u6D4B\u5230\u91CD\u590D\u7684\u5217\u8868 key: ${String(key)}`);
|
|
724
|
-
}
|
|
725
|
-
seen.add(key);
|
|
726
|
-
const entry = previous.get(key);
|
|
727
|
-
if (entry) {
|
|
728
|
-
previous.delete(key);
|
|
729
|
-
if (isPrimitiveItem(item) && !Object.is(entry.value, item)) {
|
|
730
|
-
nextEntries.push(createListEntry(item, index, key, renderItem));
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
entry.item.value = item;
|
|
734
|
-
entry.value = item;
|
|
735
|
-
nextEntries.push(entry);
|
|
736
|
-
continue;
|
|
737
|
-
}
|
|
738
|
-
nextEntries.push(createListEntry(item, index, key, renderItem));
|
|
739
|
-
}
|
|
740
|
-
return nextEntries;
|
|
741
|
-
}
|
|
742
|
-
__name(reconcileKeyed, "reconcileKeyed");
|
|
743
|
-
function reconcileIndexed(items, entries, renderItem) {
|
|
744
|
-
const nextEntries = [];
|
|
745
|
-
for (let index = 0; index < items.length; index++) {
|
|
746
|
-
const item = items[index];
|
|
747
|
-
const entry = entries[index];
|
|
748
|
-
if (entry && isPrimitiveItem(item) && !Object.is(entry.value, item)) {
|
|
749
|
-
nextEntries.push(createListEntry(item, index, index, renderItem));
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
if (entry) {
|
|
753
|
-
entry.item.value = item;
|
|
754
|
-
entry.value = item;
|
|
755
|
-
nextEntries.push(entry);
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
nextEntries.push(createListEntry(item, index, index, renderItem));
|
|
759
|
-
}
|
|
760
|
-
return nextEntries;
|
|
761
|
-
}
|
|
762
|
-
__name(reconcileIndexed, "reconcileIndexed");
|
|
763
|
-
function isPrimitiveItem(item) {
|
|
764
|
-
return item === null || typeof item !== "object";
|
|
765
|
-
}
|
|
766
|
-
__name(isPrimitiveItem, "isPrimitiveItem");
|
|
767
|
-
function createListEntry(item, index, key, renderItem) {
|
|
768
|
-
const owner = createOwner();
|
|
769
|
-
let itemSignal;
|
|
770
|
-
let viewOwner;
|
|
771
|
-
let node;
|
|
772
|
-
owner.run(() => {
|
|
773
|
-
itemSignal = state(item);
|
|
774
|
-
viewOwner = createOwner();
|
|
775
|
-
node = viewOwner.run(() => renderItem(toReactiveItem(itemSignal, item), index));
|
|
776
|
-
});
|
|
777
|
-
associateNodeOwner(node, viewOwner);
|
|
778
|
-
return { key, node, owner, viewOwner, item: itemSignal, value: item, index };
|
|
779
|
-
}
|
|
780
|
-
__name(createListEntry, "createListEntry");
|
|
781
|
-
function refreshListEntry(parent, entry, index, renderItem) {
|
|
782
|
-
removeChild(parent, entry.node);
|
|
783
|
-
entry.index = index;
|
|
784
|
-
const previousView = entry.viewOwner;
|
|
785
|
-
entry.owner.run(() => {
|
|
786
|
-
entry.viewOwner = createOwner();
|
|
787
|
-
entry.node = entry.viewOwner.run(() => renderItem(
|
|
788
|
-
toReactiveItem(entry.item, entry.value),
|
|
789
|
-
index
|
|
790
|
-
));
|
|
791
|
-
});
|
|
792
|
-
previousView.dispose();
|
|
793
|
-
associateNodeOwner(entry.node, entry.viewOwner);
|
|
794
|
-
}
|
|
795
|
-
__name(refreshListEntry, "refreshListEntry");
|
|
796
|
-
function toReactiveItem(item, initialValue) {
|
|
797
|
-
if (typeof initialValue !== "object" || initialValue === null) {
|
|
798
|
-
return initialValue;
|
|
799
|
-
}
|
|
800
|
-
return new Proxy(initialValue, {
|
|
801
|
-
get(_target, property, receiver) {
|
|
802
|
-
return Reflect.get(item.value, property, receiver);
|
|
803
|
-
},
|
|
804
|
-
has(_target, property) {
|
|
805
|
-
return property in item.value;
|
|
806
|
-
},
|
|
807
|
-
ownKeys() {
|
|
808
|
-
return Reflect.ownKeys(item.value);
|
|
809
|
-
},
|
|
810
|
-
getOwnPropertyDescriptor(_target, property) {
|
|
811
|
-
return Object.getOwnPropertyDescriptor(item.value, property);
|
|
812
|
-
}
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
__name(toReactiveItem, "toReactiveItem");
|
|
816
|
-
function disposeEntry(parent, entry) {
|
|
817
|
-
removeChild(parent, entry.node);
|
|
818
|
-
entry.owner.dispose();
|
|
819
|
-
}
|
|
820
|
-
__name(disposeEntry, "disposeEntry");
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
821
21
|
|
|
822
|
-
// packages/
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
22
|
+
// packages/ui/src/index.ts
|
|
23
|
+
var src_exports = {};
|
|
24
|
+
__export(src_exports, {
|
|
25
|
+
ActivityRail: () => ActivityRail,
|
|
26
|
+
Alert: () => Alert,
|
|
27
|
+
Avatar: () => Avatar,
|
|
28
|
+
Button: () => Button,
|
|
29
|
+
ButtonGroup: () => ButtonGroup,
|
|
30
|
+
Card: () => Card,
|
|
31
|
+
CardHeader: () => CardHeader,
|
|
32
|
+
ChatComposer: () => ChatComposer,
|
|
33
|
+
Checkbox: () => Checkbox,
|
|
34
|
+
Dialog: () => Dialog,
|
|
35
|
+
Drawer: () => Drawer,
|
|
36
|
+
EditorTabs: () => EditorTabs,
|
|
37
|
+
FileTree: () => FileTree,
|
|
38
|
+
Icon: () => Icon,
|
|
39
|
+
Input: () => Input,
|
|
40
|
+
Kbd: () => Kbd,
|
|
41
|
+
KbdCombo: () => KbdCombo,
|
|
42
|
+
KbdRow: () => KbdRow,
|
|
43
|
+
Menu: () => Menu,
|
|
44
|
+
MenuDivider: () => MenuDivider,
|
|
45
|
+
NavList: () => NavList,
|
|
46
|
+
PageHeader: () => PageHeader,
|
|
47
|
+
PageHeaderAction: () => PageHeaderAction,
|
|
48
|
+
Pagination: () => Pagination,
|
|
49
|
+
Radio: () => Radio,
|
|
50
|
+
Select: () => Select,
|
|
51
|
+
StatCard: () => StatCard,
|
|
52
|
+
StatCardGrid: () => StatCardGrid,
|
|
53
|
+
StatusBar: () => StatusBar,
|
|
54
|
+
Switch: () => Switch,
|
|
55
|
+
Table: () => Table,
|
|
56
|
+
TablePanel: () => TablePanel,
|
|
57
|
+
Tabs: () => Tabs,
|
|
58
|
+
Tag: () => Tag,
|
|
59
|
+
Textarea: () => Textarea,
|
|
60
|
+
ToastHost: () => ToastHost,
|
|
61
|
+
VUI_ICON_PATHS: () => VUI_ICON_PATHS,
|
|
62
|
+
WorkbenchTitlebar: () => WorkbenchTitlebar,
|
|
63
|
+
createDOMPortalAdapter: () => createDOMPortalAdapter,
|
|
64
|
+
createFocusTrap: () => createFocusTrap,
|
|
65
|
+
createIcon: () => import_icon_core.createIcon,
|
|
66
|
+
createOverlayManager: () => createOverlayManager,
|
|
67
|
+
createPortal: () => createPortal,
|
|
68
|
+
registerIcon: () => registerIcon,
|
|
69
|
+
resolveIcon: () => resolveIcon
|
|
70
|
+
});
|
|
71
|
+
module.exports = __toCommonJS(src_exports);
|
|
840
72
|
|
|
841
|
-
// packages/
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
__name(createInjectionKey, "createInjectionKey");
|
|
73
|
+
// packages/ui/src/button.ts
|
|
74
|
+
var import_reactivity2 = require("@vobs/reactivity");
|
|
75
|
+
var import_vobs2 = require("@vobs/vobs");
|
|
846
76
|
|
|
847
77
|
// packages/ui/src/utils.ts
|
|
78
|
+
var import_reactivity = require("@vobs/reactivity");
|
|
79
|
+
var import_vobs = require("@vobs/vobs");
|
|
848
80
|
function classNames(...values) {
|
|
849
81
|
return values.flatMap((value) => typeof value === "string" ? value.trim().split(/\s+/u) : []).filter(Boolean).join(" ");
|
|
850
82
|
}
|
|
@@ -859,8 +91,8 @@ function hasProp(props, name) {
|
|
|
859
91
|
}
|
|
860
92
|
__name(hasProp, "hasProp");
|
|
861
93
|
function bindClassList(root, props, readBaseClasses) {
|
|
862
|
-
effect(() => {
|
|
863
|
-
setAttribute(root, "class", classNames(
|
|
94
|
+
(0, import_reactivity.effect)(() => {
|
|
95
|
+
(0, import_vobs.setAttribute)(root, "class", classNames(
|
|
864
96
|
...readBaseClasses(),
|
|
865
97
|
readString(props, "class"),
|
|
866
98
|
readString(props, "className")
|
|
@@ -874,7 +106,7 @@ function bindCommonAttributes(root, props, skip = [], options = {}) {
|
|
|
874
106
|
ignored.add("className");
|
|
875
107
|
ignored.add("children");
|
|
876
108
|
ignored.add("style");
|
|
877
|
-
effect(() => {
|
|
109
|
+
(0, import_reactivity.effect)(() => {
|
|
878
110
|
const next = /* @__PURE__ */ new Map();
|
|
879
111
|
for (const name of Object.keys(props)) {
|
|
880
112
|
if (ignored.has(name) || name.startsWith("on")) continue;
|
|
@@ -888,7 +120,7 @@ function bindCommonAttributes(root, props, skip = [], options = {}) {
|
|
|
888
120
|
for (const name of managed) {
|
|
889
121
|
if (!next.has(name)) removeAttribute(root, name);
|
|
890
122
|
}
|
|
891
|
-
for (const [name, value] of next) setAttribute(root, name, value);
|
|
123
|
+
for (const [name, value] of next) (0, import_vobs.setAttribute)(root, name, value);
|
|
892
124
|
setManagedAttributes(root, next.keys());
|
|
893
125
|
});
|
|
894
126
|
}
|
|
@@ -898,27 +130,27 @@ function bindUserStyle(root, props) {
|
|
|
898
130
|
}
|
|
899
131
|
__name(bindUserStyle, "bindUserStyle");
|
|
900
132
|
function bindStyle(root, props, createStyle) {
|
|
901
|
-
effect(() => {
|
|
133
|
+
(0, import_reactivity.effect)(() => {
|
|
902
134
|
const userStyle = readString(props, "style");
|
|
903
135
|
const internalStyle = createStyle();
|
|
904
136
|
const style = [internalStyle, userStyle].filter(Boolean).join("; ");
|
|
905
|
-
if (style) setAttribute(root, "style", style);
|
|
137
|
+
if (style) (0, import_vobs.setAttribute)(root, "style", style);
|
|
906
138
|
else removeAttribute(root, "style");
|
|
907
139
|
});
|
|
908
140
|
}
|
|
909
141
|
__name(bindStyle, "bindStyle");
|
|
910
142
|
function bindTextContent(node, read) {
|
|
911
|
-
effect(() => {
|
|
912
|
-
setTextContent(node, String(read() ?? ""));
|
|
143
|
+
(0, import_reactivity.effect)(() => {
|
|
144
|
+
(0, import_vobs.setTextContent)(node, String(read() ?? ""));
|
|
913
145
|
});
|
|
914
146
|
}
|
|
915
147
|
__name(bindTextContent, "bindTextContent");
|
|
916
148
|
function bindPropertyValue(node, name, read) {
|
|
917
|
-
effect(() => setProperty(node, name, read()));
|
|
149
|
+
(0, import_reactivity.effect)(() => (0, import_vobs.setProperty)(node, name, read()));
|
|
918
150
|
}
|
|
919
151
|
__name(bindPropertyValue, "bindPropertyValue");
|
|
920
152
|
function listen(root, event, props, propName, disabled) {
|
|
921
|
-
addEventListener(root, event, (reason) => {
|
|
153
|
+
(0, import_vobs.addEventListener)(root, event, (reason) => {
|
|
922
154
|
if (disabled?.()) return;
|
|
923
155
|
const handler = Reflect.get(props, propName);
|
|
924
156
|
if (typeof handler === "function") handler(reason);
|
|
@@ -926,19 +158,19 @@ function listen(root, event, props, propName, disabled) {
|
|
|
926
158
|
}
|
|
927
159
|
__name(listen, "listen");
|
|
928
160
|
function mountSlot(parent, props, propName) {
|
|
929
|
-
insertDynamic(parent, null, () => resolveSlot(Reflect.get(props, propName)));
|
|
161
|
+
(0, import_vobs.insertDynamic)(parent, null, () => resolveSlot(Reflect.get(props, propName)));
|
|
930
162
|
}
|
|
931
163
|
__name(mountSlot, "mountSlot");
|
|
932
164
|
function resolveSlot(value) {
|
|
933
165
|
const resolved = typeof value === "function" ? value() : value;
|
|
934
166
|
if (resolved === void 0 || resolved === null || resolved === false) return null;
|
|
935
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
167
|
+
if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs.createText)(String(resolved));
|
|
936
168
|
if (Array.isArray(resolved)) {
|
|
937
169
|
const children = resolved;
|
|
938
|
-
return createFragment((parent, anchor) => {
|
|
170
|
+
return (0, import_vobs.createFragment)((parent, anchor) => {
|
|
939
171
|
for (const child of children) {
|
|
940
172
|
const node = resolveSlot(child);
|
|
941
|
-
if (node) insertBefore(parent, node, anchor);
|
|
173
|
+
if (node) (0, import_vobs.insertBefore)(parent, node, anchor);
|
|
942
174
|
}
|
|
943
175
|
});
|
|
944
176
|
}
|
|
@@ -950,12 +182,12 @@ function setOptionalAttribute(node, name, value) {
|
|
|
950
182
|
removeAttribute(node, name);
|
|
951
183
|
return;
|
|
952
184
|
}
|
|
953
|
-
setAttribute(node, name, String(value));
|
|
185
|
+
(0, import_vobs.setAttribute)(node, name, String(value));
|
|
954
186
|
}
|
|
955
187
|
__name(setOptionalAttribute, "setOptionalAttribute");
|
|
956
188
|
function setOptionalProperty(node, name, value) {
|
|
957
189
|
if (value === void 0 || value === null) return;
|
|
958
|
-
setProperty(node, name, value);
|
|
190
|
+
(0, import_vobs.setProperty)(node, name, value);
|
|
959
191
|
}
|
|
960
192
|
__name(setOptionalProperty, "setOptionalProperty");
|
|
961
193
|
function readString(props, name) {
|
|
@@ -990,7 +222,7 @@ __name(removeAttribute, "removeAttribute");
|
|
|
990
222
|
|
|
991
223
|
// packages/ui/src/button.ts
|
|
992
224
|
function Button(props = {}) {
|
|
993
|
-
const root = createElement("button");
|
|
225
|
+
const root = (0, import_vobs2.createElement)("button");
|
|
994
226
|
bindClassList(root, props, () => [
|
|
995
227
|
"vui-btn",
|
|
996
228
|
`vui-btn--${readProp(props, "variant", "primary")}`,
|
|
@@ -1007,7 +239,7 @@ function Button(props = {}) {
|
|
|
1007
239
|
"icon",
|
|
1008
240
|
"onClick"
|
|
1009
241
|
]);
|
|
1010
|
-
effect(() => {
|
|
242
|
+
(0, import_reactivity2.effect)(() => {
|
|
1011
243
|
const disabled = readProp(props, "disabled", false) || readProp(props, "loading", false);
|
|
1012
244
|
setOptionalProperty(root, "disabled", disabled);
|
|
1013
245
|
setOptionalAttribute(root, "type", readProp(props, "type", "button"));
|
|
@@ -1021,7 +253,7 @@ function Button(props = {}) {
|
|
|
1021
253
|
}
|
|
1022
254
|
__name(Button, "Button");
|
|
1023
255
|
function ButtonGroup(props = {}) {
|
|
1024
|
-
const root = createElement("div");
|
|
256
|
+
const root = (0, import_vobs2.createElement)("div");
|
|
1025
257
|
bindClassList(root, props, () => ["vui-btn-group"]);
|
|
1026
258
|
bindCommonAttributes(root, props);
|
|
1027
259
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
@@ -1030,14 +262,16 @@ function ButtonGroup(props = {}) {
|
|
|
1030
262
|
__name(ButtonGroup, "ButtonGroup");
|
|
1031
263
|
|
|
1032
264
|
// packages/ui/src/forms.ts
|
|
265
|
+
var import_reactivity3 = require("@vobs/reactivity");
|
|
266
|
+
var import_vobs3 = require("@vobs/vobs");
|
|
1033
267
|
function bindSignalProp(props) {
|
|
1034
268
|
const value = readProp(props, "bind", void 0);
|
|
1035
269
|
return value && typeof value === "object" && "value" in value ? value : void 0;
|
|
1036
270
|
}
|
|
1037
271
|
__name(bindSignalProp, "bindSignalProp");
|
|
1038
272
|
function Input(props = {}) {
|
|
1039
|
-
const root = createElement("div");
|
|
1040
|
-
const control = createElement("input");
|
|
273
|
+
const root = (0, import_vobs3.createElement)("div");
|
|
274
|
+
const control = (0, import_vobs3.createElement)("input");
|
|
1041
275
|
bindClassList(root, props, () => [
|
|
1042
276
|
"vui-input",
|
|
1043
277
|
readProp(props, "type", "text") === "search" ? "vui-search" : void 0
|
|
@@ -1056,7 +290,7 @@ function Input(props = {}) {
|
|
|
1056
290
|
"onChange",
|
|
1057
291
|
"onBlur"
|
|
1058
292
|
]);
|
|
1059
|
-
effect(() => {
|
|
293
|
+
(0, import_reactivity3.effect)(() => {
|
|
1060
294
|
setOptionalAttribute(control, "type", readProp(props, "type", "text"));
|
|
1061
295
|
setOptionalAttribute(control, "name", readProp(props, "name", void 0));
|
|
1062
296
|
setOptionalAttribute(control, "placeholder", readProp(props, "placeholder", void 0));
|
|
@@ -1074,12 +308,12 @@ function Input(props = {}) {
|
|
|
1074
308
|
bindPropertyValue(control, "value", () => readProp(props, "value", void 0) ?? "");
|
|
1075
309
|
}
|
|
1076
310
|
if (hasProp(props, "icon")) {
|
|
1077
|
-
const icon = createElement("span");
|
|
1078
|
-
setAttribute(icon, "class", "vui-input__icon");
|
|
311
|
+
const icon = (0, import_vobs3.createElement)("span");
|
|
312
|
+
(0, import_vobs3.setAttribute)(icon, "class", "vui-input__icon");
|
|
1079
313
|
mountSlot(icon, props, "icon");
|
|
1080
|
-
insertBefore(root, icon, null);
|
|
314
|
+
(0, import_vobs3.insertBefore)(root, icon, null);
|
|
1081
315
|
}
|
|
1082
|
-
insertBefore(root, control, null);
|
|
316
|
+
(0, import_vobs3.insertBefore)(root, control, null);
|
|
1083
317
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1084
318
|
listen(control, "input", props, "onInput", () => readProp(props, "disabled", false));
|
|
1085
319
|
listen(control, "change", props, "onChange", () => readProp(props, "disabled", false));
|
|
@@ -1088,7 +322,7 @@ function Input(props = {}) {
|
|
|
1088
322
|
}
|
|
1089
323
|
__name(Input, "Input");
|
|
1090
324
|
function Textarea(props = {}) {
|
|
1091
|
-
const root = createElement("textarea");
|
|
325
|
+
const root = (0, import_vobs3.createElement)("textarea");
|
|
1092
326
|
bindClassList(root, props, () => ["vui-textarea"]);
|
|
1093
327
|
bindCommonAttributes(root, props, [
|
|
1094
328
|
"value",
|
|
@@ -1102,7 +336,7 @@ function Textarea(props = {}) {
|
|
|
1102
336
|
"onChange",
|
|
1103
337
|
"onBlur"
|
|
1104
338
|
]);
|
|
1105
|
-
effect(() => {
|
|
339
|
+
(0, import_reactivity3.effect)(() => {
|
|
1106
340
|
setOptionalAttribute(root, "name", readProp(props, "name", void 0));
|
|
1107
341
|
setOptionalAttribute(root, "placeholder", readProp(props, "placeholder", void 0));
|
|
1108
342
|
setOptionalProperty(root, "disabled", readProp(props, "disabled", false));
|
|
@@ -1126,7 +360,7 @@ function Textarea(props = {}) {
|
|
|
1126
360
|
}
|
|
1127
361
|
__name(Textarea, "Textarea");
|
|
1128
362
|
function Select(props = {}) {
|
|
1129
|
-
const root = createElement("select");
|
|
363
|
+
const root = (0, import_vobs3.createElement)("select");
|
|
1130
364
|
bindClassList(root, props, () => ["vui-select"]);
|
|
1131
365
|
bindCommonAttributes(root, props, [
|
|
1132
366
|
"name",
|
|
@@ -1137,7 +371,7 @@ function Select(props = {}) {
|
|
|
1137
371
|
"size",
|
|
1138
372
|
"onChange"
|
|
1139
373
|
]);
|
|
1140
|
-
effect(() => {
|
|
374
|
+
(0, import_reactivity3.effect)(() => {
|
|
1141
375
|
setOptionalAttribute(root, "name", readProp(props, "name", void 0));
|
|
1142
376
|
setOptionalProperty(root, "disabled", readProp(props, "disabled", false));
|
|
1143
377
|
setOptionalProperty(root, "required", readProp(props, "required", false));
|
|
@@ -1167,9 +401,9 @@ function Radio(props = {}) {
|
|
|
1167
401
|
}
|
|
1168
402
|
__name(Radio, "Radio");
|
|
1169
403
|
function createChoice(type, props) {
|
|
1170
|
-
const root = createElement("label");
|
|
1171
|
-
const control = createElement("input");
|
|
1172
|
-
const visual = createElement("span");
|
|
404
|
+
const root = (0, import_vobs3.createElement)("label");
|
|
405
|
+
const control = (0, import_vobs3.createElement)("input");
|
|
406
|
+
const visual = (0, import_vobs3.createElement)("span");
|
|
1173
407
|
bindClassList(root, props, () => [`vui-${type}`]);
|
|
1174
408
|
bindUserStyle(root, props);
|
|
1175
409
|
bindCommonAttributes(control, props, [
|
|
@@ -1180,8 +414,8 @@ function createChoice(type, props) {
|
|
|
1180
414
|
"required",
|
|
1181
415
|
"onChange"
|
|
1182
416
|
]);
|
|
1183
|
-
setAttribute(visual, "class", type === "checkbox" ? "vui-check__box" : "vui-radio__dot");
|
|
1184
|
-
effect(() => {
|
|
417
|
+
(0, import_vobs3.setAttribute)(visual, "class", type === "checkbox" ? "vui-check__box" : "vui-radio__dot");
|
|
418
|
+
(0, import_reactivity3.effect)(() => {
|
|
1185
419
|
setOptionalAttribute(control, "type", type);
|
|
1186
420
|
setOptionalAttribute(control, "name", readProp(props, "name", void 0));
|
|
1187
421
|
setOptionalAttribute(control, "value", readProp(props, "value", void 0));
|
|
@@ -1197,17 +431,17 @@ function createChoice(type, props) {
|
|
|
1197
431
|
} else if (hasProp(props, "checked")) {
|
|
1198
432
|
bindPropertyValue(control, "checked", () => readProp(props, "checked", false));
|
|
1199
433
|
}
|
|
1200
|
-
insertBefore(root, control, null);
|
|
1201
|
-
insertBefore(root, visual, null);
|
|
434
|
+
(0, import_vobs3.insertBefore)(root, control, null);
|
|
435
|
+
(0, import_vobs3.insertBefore)(root, visual, null);
|
|
1202
436
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1203
437
|
listen(control, "change", props, "onChange", () => readProp(props, "disabled", false));
|
|
1204
438
|
return root;
|
|
1205
439
|
}
|
|
1206
440
|
__name(createChoice, "createChoice");
|
|
1207
441
|
function Switch(props = {}) {
|
|
1208
|
-
const root = createElement("label");
|
|
1209
|
-
const control = createElement("input");
|
|
1210
|
-
const thumb = createElement("span");
|
|
442
|
+
const root = (0, import_vobs3.createElement)("label");
|
|
443
|
+
const control = (0, import_vobs3.createElement)("input");
|
|
444
|
+
const thumb = (0, import_vobs3.createElement)("span");
|
|
1211
445
|
bindClassList(root, props, () => [
|
|
1212
446
|
"vui-switch",
|
|
1213
447
|
readProp(props, "size", "md") === "sm" ? "vui-switch--sm" : void 0
|
|
@@ -1222,10 +456,10 @@ function Switch(props = {}) {
|
|
|
1222
456
|
"value",
|
|
1223
457
|
"onChange"
|
|
1224
458
|
]);
|
|
1225
|
-
setAttribute(thumb, "class", "vui-switch__thumb");
|
|
1226
|
-
setAttribute(root, "role", "switch");
|
|
459
|
+
(0, import_vobs3.setAttribute)(thumb, "class", "vui-switch__thumb");
|
|
460
|
+
(0, import_vobs3.setAttribute)(root, "role", "switch");
|
|
1227
461
|
const bind = bindSignalProp(props);
|
|
1228
|
-
effect(() => {
|
|
462
|
+
(0, import_reactivity3.effect)(() => {
|
|
1229
463
|
setOptionalAttribute(control, "type", "checkbox");
|
|
1230
464
|
setOptionalAttribute(control, "name", readProp(props, "name", void 0));
|
|
1231
465
|
setOptionalAttribute(control, "value", readProp(props, "value", void 0));
|
|
@@ -1242,8 +476,8 @@ function Switch(props = {}) {
|
|
|
1242
476
|
} else if (hasProp(props, "checked")) {
|
|
1243
477
|
bindPropertyValue(control, "checked", () => readProp(props, "checked", false));
|
|
1244
478
|
}
|
|
1245
|
-
insertBefore(root, control, null);
|
|
1246
|
-
insertBefore(root, thumb, null);
|
|
479
|
+
(0, import_vobs3.insertBefore)(root, control, null);
|
|
480
|
+
(0, import_vobs3.insertBefore)(root, thumb, null);
|
|
1247
481
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1248
482
|
listen(control, "change", props, "onChange", () => readProp(props, "disabled", false));
|
|
1249
483
|
return root;
|
|
@@ -1251,33 +485,34 @@ function Switch(props = {}) {
|
|
|
1251
485
|
__name(Switch, "Switch");
|
|
1252
486
|
|
|
1253
487
|
// packages/ui/src/card.ts
|
|
488
|
+
var import_vobs4 = require("@vobs/vobs");
|
|
1254
489
|
function Card(props = {}) {
|
|
1255
|
-
const root = createElement("div");
|
|
490
|
+
const root = (0, import_vobs4.createElement)("div");
|
|
1256
491
|
bindClassList(root, props, () => ["vui-card"]);
|
|
1257
492
|
bindCommonAttributes(root, props, ["title", "description"]);
|
|
1258
493
|
bindUserStyle(root, props);
|
|
1259
494
|
if (hasProp(props, "title")) {
|
|
1260
|
-
const title = createElement("div");
|
|
1261
|
-
const text = createText("");
|
|
1262
|
-
setAttribute(title, "class", "vui-card__title");
|
|
495
|
+
const title = (0, import_vobs4.createElement)("div");
|
|
496
|
+
const text = (0, import_vobs4.createText)("");
|
|
497
|
+
(0, import_vobs4.setAttribute)(title, "class", "vui-card__title");
|
|
1263
498
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
1264
|
-
insertBefore(title, text, null);
|
|
1265
|
-
insertBefore(root, title, null);
|
|
499
|
+
(0, import_vobs4.insertBefore)(title, text, null);
|
|
500
|
+
(0, import_vobs4.insertBefore)(root, title, null);
|
|
1266
501
|
}
|
|
1267
502
|
if (hasProp(props, "description")) {
|
|
1268
|
-
const description = createElement("p");
|
|
1269
|
-
const text = createText("");
|
|
1270
|
-
setAttribute(description, "class", "vui-card__desc");
|
|
503
|
+
const description = (0, import_vobs4.createElement)("p");
|
|
504
|
+
const text = (0, import_vobs4.createText)("");
|
|
505
|
+
(0, import_vobs4.setAttribute)(description, "class", "vui-card__desc");
|
|
1271
506
|
bindTextContent(text, () => readProp(props, "description", ""));
|
|
1272
|
-
insertBefore(description, text, null);
|
|
1273
|
-
insertBefore(root, description, null);
|
|
507
|
+
(0, import_vobs4.insertBefore)(description, text, null);
|
|
508
|
+
(0, import_vobs4.insertBefore)(root, description, null);
|
|
1274
509
|
}
|
|
1275
510
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1276
511
|
return root;
|
|
1277
512
|
}
|
|
1278
513
|
__name(Card, "Card");
|
|
1279
514
|
function CardHeader(props = {}) {
|
|
1280
|
-
const root = createElement("div");
|
|
515
|
+
const root = (0, import_vobs4.createElement)("div");
|
|
1281
516
|
bindClassList(root, props, () => ["vui-card__header"]);
|
|
1282
517
|
bindCommonAttributes(root, props);
|
|
1283
518
|
bindUserStyle(root, props);
|
|
@@ -1287,8 +522,9 @@ function CardHeader(props = {}) {
|
|
|
1287
522
|
__name(CardHeader, "CardHeader");
|
|
1288
523
|
|
|
1289
524
|
// packages/ui/src/tag.ts
|
|
525
|
+
var import_vobs5 = require("@vobs/vobs");
|
|
1290
526
|
function Tag(props = {}) {
|
|
1291
|
-
const root = createElement("span");
|
|
527
|
+
const root = (0, import_vobs5.createElement)("span");
|
|
1292
528
|
bindClassList(root, props, () => [
|
|
1293
529
|
"vui-tag",
|
|
1294
530
|
readProp(props, "tone", "default") === "default" ? void 0 : `vui-tag--${readProp(props, "tone", "default")}`
|
|
@@ -1301,65 +537,68 @@ function Tag(props = {}) {
|
|
|
1301
537
|
__name(Tag, "Tag");
|
|
1302
538
|
|
|
1303
539
|
// packages/ui/src/alert.ts
|
|
540
|
+
var import_vobs6 = require("@vobs/vobs");
|
|
1304
541
|
function Alert(props = {}) {
|
|
1305
|
-
const root = createElement("div");
|
|
542
|
+
const root = (0, import_vobs6.createElement)("div");
|
|
1306
543
|
bindClassList(root, props, () => [
|
|
1307
544
|
"vui-alert",
|
|
1308
545
|
`vui-alert--${readProp(props, "tone", "info")}`
|
|
1309
546
|
]);
|
|
1310
547
|
bindCommonAttributes(root, props, ["tone", "title", "description", "icon", "role"]);
|
|
1311
548
|
bindUserStyle(root, props);
|
|
1312
|
-
setAttribute(root, "role", "alert");
|
|
549
|
+
(0, import_vobs6.setAttribute)(root, "role", "alert");
|
|
1313
550
|
if (hasProp(props, "icon")) {
|
|
1314
|
-
const icon = createElement("span");
|
|
1315
|
-
setAttribute(icon, "class", "vui-alert__icon");
|
|
551
|
+
const icon = (0, import_vobs6.createElement)("span");
|
|
552
|
+
(0, import_vobs6.setAttribute)(icon, "class", "vui-alert__icon");
|
|
1316
553
|
mountSlot(icon, props, "icon");
|
|
1317
|
-
insertBefore(root, icon, null);
|
|
554
|
+
(0, import_vobs6.insertBefore)(root, icon, null);
|
|
1318
555
|
}
|
|
1319
|
-
const content = createElement("div");
|
|
556
|
+
const content = (0, import_vobs6.createElement)("div");
|
|
1320
557
|
if (hasProp(props, "title")) {
|
|
1321
|
-
const title = createElement("div");
|
|
1322
|
-
const text = createText("");
|
|
1323
|
-
setAttribute(title, "class", "vui-alert__title");
|
|
558
|
+
const title = (0, import_vobs6.createElement)("div");
|
|
559
|
+
const text = (0, import_vobs6.createText)("");
|
|
560
|
+
(0, import_vobs6.setAttribute)(title, "class", "vui-alert__title");
|
|
1324
561
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
1325
|
-
insertBefore(title, text, null);
|
|
1326
|
-
insertBefore(content, title, null);
|
|
562
|
+
(0, import_vobs6.insertBefore)(title, text, null);
|
|
563
|
+
(0, import_vobs6.insertBefore)(content, title, null);
|
|
1327
564
|
}
|
|
1328
565
|
if (hasProp(props, "description")) {
|
|
1329
|
-
const description = createElement("div");
|
|
1330
|
-
const text = createText("");
|
|
1331
|
-
setAttribute(description, "class", "vui-alert__desc");
|
|
566
|
+
const description = (0, import_vobs6.createElement)("div");
|
|
567
|
+
const text = (0, import_vobs6.createText)("");
|
|
568
|
+
(0, import_vobs6.setAttribute)(description, "class", "vui-alert__desc");
|
|
1332
569
|
bindTextContent(text, () => readProp(props, "description", ""));
|
|
1333
|
-
insertBefore(description, text, null);
|
|
1334
|
-
insertBefore(content, description, null);
|
|
570
|
+
(0, import_vobs6.insertBefore)(description, text, null);
|
|
571
|
+
(0, import_vobs6.insertBefore)(content, description, null);
|
|
1335
572
|
}
|
|
1336
573
|
if (hasProp(props, "children")) mountSlot(content, props, "children");
|
|
1337
|
-
insertBefore(root, content, null);
|
|
574
|
+
(0, import_vobs6.insertBefore)(root, content, null);
|
|
1338
575
|
return root;
|
|
1339
576
|
}
|
|
1340
577
|
__name(Alert, "Alert");
|
|
1341
578
|
|
|
1342
579
|
// packages/ui/src/tabs.ts
|
|
580
|
+
var import_reactivity4 = require("@vobs/reactivity");
|
|
581
|
+
var import_vobs7 = require("@vobs/vobs");
|
|
1343
582
|
function Tabs(props) {
|
|
1344
|
-
const root = createElement("div");
|
|
1345
|
-
const tablist = createElement("div");
|
|
1346
|
-
const panel = createElement("div");
|
|
1347
|
-
const internalValue = state(void 0);
|
|
583
|
+
const root = (0, import_vobs7.createElement)("div");
|
|
584
|
+
const tablist = (0, import_vobs7.createElement)("div");
|
|
585
|
+
const panel = (0, import_vobs7.createElement)("div");
|
|
586
|
+
const internalValue = (0, import_reactivity4.state)(void 0);
|
|
1348
587
|
bindClassList(root, props, () => ["vui-tabs-root"]);
|
|
1349
588
|
bindCommonAttributes(root, props, ["items", "value", "variant", "onChange"]);
|
|
1350
|
-
setAttribute(tablist, "role", "tablist");
|
|
1351
|
-
effect(() => {
|
|
589
|
+
(0, import_vobs7.setAttribute)(tablist, "role", "tablist");
|
|
590
|
+
(0, import_reactivity4.effect)(() => {
|
|
1352
591
|
const variant = readProp(props, "variant", "default");
|
|
1353
|
-
setAttribute(tablist, "class", `vui-tabs${variant === "filled" ? " vui-tabs--filled" : ""}`);
|
|
592
|
+
(0, import_vobs7.setAttribute)(tablist, "class", `vui-tabs${variant === "filled" ? " vui-tabs--filled" : ""}`);
|
|
1354
593
|
});
|
|
1355
|
-
setAttribute(panel, "class", "vui-tabs__panel");
|
|
1356
|
-
insertDynamic(tablist, null, () => createTabButtons(props, internalValue));
|
|
1357
|
-
insertDynamic(panel, null, () => {
|
|
594
|
+
(0, import_vobs7.setAttribute)(panel, "class", "vui-tabs__panel");
|
|
595
|
+
(0, import_vobs7.insertDynamic)(tablist, null, () => createTabButtons(props, internalValue));
|
|
596
|
+
(0, import_vobs7.insertDynamic)(panel, null, () => {
|
|
1358
597
|
const item = activeItem(readProp(props, "items", []), activeId(props, internalValue));
|
|
1359
598
|
return item?.content === void 0 ? null : resolveSlot(item.content);
|
|
1360
599
|
});
|
|
1361
|
-
insertBefore(root, tablist, null);
|
|
1362
|
-
insertBefore(root, panel, null);
|
|
600
|
+
(0, import_vobs7.insertBefore)(root, tablist, null);
|
|
601
|
+
(0, import_vobs7.insertBefore)(root, panel, null);
|
|
1363
602
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1364
603
|
return root;
|
|
1365
604
|
}
|
|
@@ -1367,27 +606,27 @@ __name(Tabs, "Tabs");
|
|
|
1367
606
|
function createTabButtons(props, internalValue) {
|
|
1368
607
|
const items = readProp(props, "items", []);
|
|
1369
608
|
const selected = activeId(props, internalValue);
|
|
1370
|
-
return createFragment((parent, anchor) => {
|
|
609
|
+
return (0, import_vobs7.createFragment)((parent, anchor) => {
|
|
1371
610
|
for (const item of items) {
|
|
1372
|
-
const button = createElement("button");
|
|
611
|
+
const button = (0, import_vobs7.createElement)("button");
|
|
1373
612
|
const isActive = item.id === selected;
|
|
1374
|
-
setAttribute(button, "class", `vui-tab${isActive ? " is-active" : ""}`);
|
|
1375
|
-
setAttribute(button, "role", "tab");
|
|
1376
|
-
setAttribute(button, "type", "button");
|
|
1377
|
-
setAttribute(button, "aria-selected", isActive ? "true" : "false");
|
|
1378
|
-
setAttribute(button, "data-tab-id", item.id);
|
|
613
|
+
(0, import_vobs7.setAttribute)(button, "class", `vui-tab${isActive ? " is-active" : ""}`);
|
|
614
|
+
(0, import_vobs7.setAttribute)(button, "role", "tab");
|
|
615
|
+
(0, import_vobs7.setAttribute)(button, "type", "button");
|
|
616
|
+
(0, import_vobs7.setAttribute)(button, "aria-selected", isActive ? "true" : "false");
|
|
617
|
+
(0, import_vobs7.setAttribute)(button, "data-tab-id", item.id);
|
|
1379
618
|
if (item.disabled === true) {
|
|
1380
|
-
setAttribute(button, "aria-disabled", "true");
|
|
1381
|
-
setProperty(button, "disabled", true);
|
|
619
|
+
(0, import_vobs7.setAttribute)(button, "aria-disabled", "true");
|
|
620
|
+
(0, import_vobs7.setProperty)(button, "disabled", true);
|
|
1382
621
|
}
|
|
1383
|
-
insertBefore(button, createText(item.label), null);
|
|
1384
|
-
addEventListener(button, "click", () => {
|
|
622
|
+
(0, import_vobs7.insertBefore)(button, (0, import_vobs7.createText)(item.label), null);
|
|
623
|
+
(0, import_vobs7.addEventListener)(button, "click", () => {
|
|
1385
624
|
if (item.disabled === true) return;
|
|
1386
625
|
if (readProp(props, "value", void 0) === void 0) internalValue.value = item.id;
|
|
1387
626
|
const onChange = readProp(props, "onChange", void 0);
|
|
1388
627
|
if (typeof onChange === "function") onChange(item.id);
|
|
1389
628
|
});
|
|
1390
|
-
insertBefore(parent, button, anchor);
|
|
629
|
+
(0, import_vobs7.insertBefore)(parent, button, anchor);
|
|
1391
630
|
}
|
|
1392
631
|
});
|
|
1393
632
|
}
|
|
@@ -1404,10 +643,16 @@ function activeItem(items, id) {
|
|
|
1404
643
|
}
|
|
1405
644
|
__name(activeItem, "activeItem");
|
|
1406
645
|
|
|
646
|
+
// packages/ui/src/dialog.ts
|
|
647
|
+
var import_reactivity6 = require("@vobs/reactivity");
|
|
648
|
+
var import_vobs9 = require("@vobs/vobs");
|
|
649
|
+
|
|
1407
650
|
// packages/ui/src/overlay.ts
|
|
651
|
+
var import_reactivity5 = require("@vobs/reactivity");
|
|
652
|
+
var import_vobs8 = require("@vobs/vobs");
|
|
1408
653
|
function createPortal(node, adapter, target) {
|
|
1409
|
-
const placeholder = createComment("vui:portal");
|
|
1410
|
-
const owner = getCurrentOwner();
|
|
654
|
+
const placeholder = (0, import_vobs8.createComment)("vui:portal");
|
|
655
|
+
const owner = (0, import_reactivity5.getCurrentOwner)();
|
|
1411
656
|
if (!owner) throw new Error("Vobs UI: createPortal \u5FC5\u987B\u5728\u7EC4\u4EF6 Owner \u4F5C\u7528\u57DF\u5185\u8C03\u7528");
|
|
1412
657
|
adapter.mount(node, target);
|
|
1413
658
|
const cleanup = /* @__PURE__ */ __name(() => adapter.unmount(node, target), "cleanup");
|
|
@@ -1418,7 +663,7 @@ __name(createPortal, "createPortal");
|
|
|
1418
663
|
function createDOMPortalAdapter() {
|
|
1419
664
|
return {
|
|
1420
665
|
mount(node, target) {
|
|
1421
|
-
insertBefore(target, node, null);
|
|
666
|
+
(0, import_vobs8.insertBefore)(target, node, null);
|
|
1422
667
|
},
|
|
1423
668
|
unmount(node, target) {
|
|
1424
669
|
removePortalNode(node, target);
|
|
@@ -1483,7 +728,7 @@ function createFocusTrap(root, options = {}) {
|
|
|
1483
728
|
disposed = true;
|
|
1484
729
|
}
|
|
1485
730
|
};
|
|
1486
|
-
if (getCurrentOwner()) onDispose(() => handle.dispose());
|
|
731
|
+
if ((0, import_reactivity5.getCurrentOwner)()) (0, import_reactivity5.onDispose)(() => handle.dispose());
|
|
1487
732
|
return handle;
|
|
1488
733
|
}
|
|
1489
734
|
__name(createFocusTrap, "createFocusTrap");
|
|
@@ -1528,7 +773,7 @@ function resolveInitialFocus(target) {
|
|
|
1528
773
|
}
|
|
1529
774
|
__name(resolveInitialFocus, "resolveInitialFocus");
|
|
1530
775
|
function removePortalNode(node, target) {
|
|
1531
|
-
if (isVobsFragment(node)) {
|
|
776
|
+
if ((0, import_vobs8.isVobsFragment)(node)) {
|
|
1532
777
|
let current = node.start.nextSibling;
|
|
1533
778
|
while (current && current !== node.end) {
|
|
1534
779
|
const next = current.nextSibling;
|
|
@@ -1558,9 +803,9 @@ var FOCUSABLE_SELECTOR = [
|
|
|
1558
803
|
|
|
1559
804
|
// packages/ui/src/dialog.ts
|
|
1560
805
|
function Dialog(props = {}) {
|
|
1561
|
-
const root = createElement("div");
|
|
1562
|
-
const surface = createElement("section");
|
|
1563
|
-
const body = createElement("div");
|
|
806
|
+
const root = (0, import_vobs9.createElement)("div");
|
|
807
|
+
const surface = (0, import_vobs9.createElement)("section");
|
|
808
|
+
const body = (0, import_vobs9.createElement)("div");
|
|
1564
809
|
bindClassList(root, props, () => ["vui-backdrop"]);
|
|
1565
810
|
bindUserStyle(root, props);
|
|
1566
811
|
bindCommonAttributes(surface, props, [
|
|
@@ -1578,11 +823,11 @@ function Dialog(props = {}) {
|
|
|
1578
823
|
"portal",
|
|
1579
824
|
"portalTarget"
|
|
1580
825
|
]);
|
|
1581
|
-
setAttribute(root, "role", "presentation");
|
|
1582
|
-
setAttribute(surface, "class", "vui-dialog");
|
|
1583
|
-
setAttribute(surface, "role", "dialog");
|
|
1584
|
-
setAttribute(body, "class", "vui-dialog__body");
|
|
1585
|
-
effect(() => {
|
|
826
|
+
(0, import_vobs9.setAttribute)(root, "role", "presentation");
|
|
827
|
+
(0, import_vobs9.setAttribute)(surface, "class", "vui-dialog");
|
|
828
|
+
(0, import_vobs9.setAttribute)(surface, "role", "dialog");
|
|
829
|
+
(0, import_vobs9.setAttribute)(body, "class", "vui-dialog__body");
|
|
830
|
+
(0, import_reactivity6.effect)(() => {
|
|
1586
831
|
const open = readProp(props, "open", false);
|
|
1587
832
|
const modal = readProp(props, "modal", true);
|
|
1588
833
|
setOptionalProperty(root, "hidden", !open);
|
|
@@ -1593,36 +838,36 @@ function Dialog(props = {}) {
|
|
|
1593
838
|
setOptionalAttribute(surface, "data-size", readProp(props, "size", "md"));
|
|
1594
839
|
});
|
|
1595
840
|
if (hasProp(props, "title") || hasProp(props, "headerActions") || hasProp(props, "onClose")) {
|
|
1596
|
-
const head = createElement("header");
|
|
1597
|
-
setAttribute(head, "class", "vui-dialog__head");
|
|
841
|
+
const head = (0, import_vobs9.createElement)("header");
|
|
842
|
+
(0, import_vobs9.setAttribute)(head, "class", "vui-dialog__head");
|
|
1598
843
|
if (hasProp(props, "title")) {
|
|
1599
|
-
const title = createElement("div");
|
|
1600
|
-
const text = createText("");
|
|
1601
|
-
setAttribute(title, "class", "vui-dialog__title");
|
|
844
|
+
const title = (0, import_vobs9.createElement)("div");
|
|
845
|
+
const text = (0, import_vobs9.createText)("");
|
|
846
|
+
(0, import_vobs9.setAttribute)(title, "class", "vui-dialog__title");
|
|
1602
847
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
1603
|
-
insertBefore(title, text, null);
|
|
1604
|
-
insertBefore(head, title, null);
|
|
848
|
+
(0, import_vobs9.insertBefore)(title, text, null);
|
|
849
|
+
(0, import_vobs9.insertBefore)(head, title, null);
|
|
1605
850
|
}
|
|
1606
851
|
if (hasProp(props, "headerActions")) mountSlot(head, props, "headerActions");
|
|
1607
852
|
if (hasProp(props, "onClose")) {
|
|
1608
|
-
const close = createElement("button");
|
|
1609
|
-
setAttribute(close, "class", "vui-dialog__close");
|
|
1610
|
-
setAttribute(close, "type", "button");
|
|
1611
|
-
setAttribute(close, "aria-label", readProp(props, "closeLabel", "Close"));
|
|
1612
|
-
insertBefore(close, createText("x"), null);
|
|
1613
|
-
addEventListener(close, "click", () => emitClose(props, "close-button"));
|
|
1614
|
-
insertBefore(head, close, null);
|
|
853
|
+
const close = (0, import_vobs9.createElement)("button");
|
|
854
|
+
(0, import_vobs9.setAttribute)(close, "class", "vui-dialog__close");
|
|
855
|
+
(0, import_vobs9.setAttribute)(close, "type", "button");
|
|
856
|
+
(0, import_vobs9.setAttribute)(close, "aria-label", readProp(props, "closeLabel", "Close"));
|
|
857
|
+
(0, import_vobs9.insertBefore)(close, (0, import_vobs9.createText)("x"), null);
|
|
858
|
+
(0, import_vobs9.addEventListener)(close, "click", () => emitClose(props, "close-button"));
|
|
859
|
+
(0, import_vobs9.insertBefore)(head, close, null);
|
|
1615
860
|
}
|
|
1616
|
-
insertBefore(surface, head, null);
|
|
861
|
+
(0, import_vobs9.insertBefore)(surface, head, null);
|
|
1617
862
|
}
|
|
1618
863
|
if (hasProp(props, "children")) mountSlot(body, props, "children");
|
|
1619
|
-
insertBefore(surface, body, null);
|
|
1620
|
-
insertBefore(root, surface, null);
|
|
1621
|
-
addEventListener(root, "click", (event) => {
|
|
864
|
+
(0, import_vobs9.insertBefore)(surface, body, null);
|
|
865
|
+
(0, import_vobs9.insertBefore)(root, surface, null);
|
|
866
|
+
(0, import_vobs9.addEventListener)(root, "click", (event) => {
|
|
1622
867
|
if (event.target !== root) return;
|
|
1623
868
|
if (readProp(props, "closeOnBackdrop", true)) emitClose(props, "backdrop");
|
|
1624
869
|
});
|
|
1625
|
-
addEventListener(root, "keydown", (event) => {
|
|
870
|
+
(0, import_vobs9.addEventListener)(root, "keydown", (event) => {
|
|
1626
871
|
if (event.key !== "Escape") return;
|
|
1627
872
|
if (readProp(props, "closeOnEscape", true)) emitClose(props, "escape");
|
|
1628
873
|
});
|
|
@@ -1638,75 +883,76 @@ function emitClose(props, reason) {
|
|
|
1638
883
|
__name(emitClose, "emitClose");
|
|
1639
884
|
|
|
1640
885
|
// packages/ui/src/menu.ts
|
|
886
|
+
var import_vobs10 = require("@vobs/vobs");
|
|
1641
887
|
function Menu(props = {}) {
|
|
1642
|
-
const root = createElement("div");
|
|
888
|
+
const root = (0, import_vobs10.createElement)("div");
|
|
1643
889
|
bindClassList(root, props, () => ["vui-menu"]);
|
|
1644
890
|
bindCommonAttributes(root, props, ["items", "onSelect"]);
|
|
1645
|
-
if (!hasProp(props, "role")) setAttribute(root, "role", "menu");
|
|
891
|
+
if (!hasProp(props, "role")) (0, import_vobs10.setAttribute)(root, "role", "menu");
|
|
1646
892
|
if (hasProp(props, "items")) {
|
|
1647
|
-
insertDynamic(root, null, () => createMenuItems(props));
|
|
893
|
+
(0, import_vobs10.insertDynamic)(root, null, () => createMenuItems(props));
|
|
1648
894
|
}
|
|
1649
895
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1650
896
|
return root;
|
|
1651
897
|
}
|
|
1652
898
|
__name(Menu, "Menu");
|
|
1653
899
|
function MenuDivider(props = {}) {
|
|
1654
|
-
const root = createElement("div");
|
|
900
|
+
const root = (0, import_vobs10.createElement)("div");
|
|
1655
901
|
bindClassList(root, props, () => ["vui-menu__divider"]);
|
|
1656
902
|
bindCommonAttributes(root, props);
|
|
1657
|
-
setAttribute(root, "role", "separator");
|
|
903
|
+
(0, import_vobs10.setAttribute)(root, "role", "separator");
|
|
1658
904
|
return root;
|
|
1659
905
|
}
|
|
1660
906
|
__name(MenuDivider, "MenuDivider");
|
|
1661
907
|
function createMenuItems(props) {
|
|
1662
908
|
const items = readProp(props, "items", []);
|
|
1663
|
-
return createFragment((parent, anchor) => {
|
|
909
|
+
return (0, import_vobs10.createFragment)((parent, anchor) => {
|
|
1664
910
|
for (const item of items) {
|
|
1665
911
|
const node = item.divider === true ? createMenuDividerNode(item) : createMenuItemNode(item, props);
|
|
1666
|
-
insertBefore(parent, node, anchor);
|
|
912
|
+
(0, import_vobs10.insertBefore)(parent, node, anchor);
|
|
1667
913
|
}
|
|
1668
914
|
});
|
|
1669
915
|
}
|
|
1670
916
|
__name(createMenuItems, "createMenuItems");
|
|
1671
917
|
function createMenuDividerNode(item) {
|
|
1672
|
-
const divider = createElement("div");
|
|
1673
|
-
setAttribute(divider, "class", "vui-menu__divider");
|
|
1674
|
-
setAttribute(divider, "role", "separator");
|
|
918
|
+
const divider = (0, import_vobs10.createElement)("div");
|
|
919
|
+
(0, import_vobs10.setAttribute)(divider, "class", "vui-menu__divider");
|
|
920
|
+
(0, import_vobs10.setAttribute)(divider, "role", "separator");
|
|
1675
921
|
setOptionalAttribute(divider, "data-menu-item-id", item.id);
|
|
1676
922
|
return divider;
|
|
1677
923
|
}
|
|
1678
924
|
__name(createMenuDividerNode, "createMenuDividerNode");
|
|
1679
925
|
function createMenuItemNode(item, props) {
|
|
1680
|
-
const button = createElement("button");
|
|
1681
|
-
setAttribute(button, "class", `vui-menu__item${item.danger === true ? " vui-menu__item--danger" : ""}`);
|
|
1682
|
-
setAttribute(button, "type", "button");
|
|
1683
|
-
setAttribute(button, "role", "menuitem");
|
|
926
|
+
const button = (0, import_vobs10.createElement)("button");
|
|
927
|
+
(0, import_vobs10.setAttribute)(button, "class", `vui-menu__item${item.danger === true ? " vui-menu__item--danger" : ""}`);
|
|
928
|
+
(0, import_vobs10.setAttribute)(button, "type", "button");
|
|
929
|
+
(0, import_vobs10.setAttribute)(button, "role", "menuitem");
|
|
1684
930
|
setOptionalAttribute(button, "data-menu-item-id", item.id);
|
|
1685
931
|
if (item.disabled === true) {
|
|
1686
|
-
setProperty(button, "disabled", true);
|
|
1687
|
-
setAttribute(button, "aria-disabled", "true");
|
|
932
|
+
(0, import_vobs10.setProperty)(button, "disabled", true);
|
|
933
|
+
(0, import_vobs10.setAttribute)(button, "aria-disabled", "true");
|
|
1688
934
|
}
|
|
1689
935
|
if (item.icon !== void 0) {
|
|
1690
|
-
const icon = createElement("span");
|
|
1691
|
-
setAttribute(icon, "class", "vui-menu__icon");
|
|
936
|
+
const icon = (0, import_vobs10.createElement)("span");
|
|
937
|
+
(0, import_vobs10.setAttribute)(icon, "class", "vui-menu__icon");
|
|
1692
938
|
mountSlot(icon, item, "icon");
|
|
1693
|
-
insertBefore(button, icon, null);
|
|
939
|
+
(0, import_vobs10.insertBefore)(button, icon, null);
|
|
1694
940
|
}
|
|
1695
941
|
if (item.label !== void 0) {
|
|
1696
|
-
const label = createElement("span");
|
|
1697
|
-
setAttribute(label, "class", "vui-menu__label");
|
|
1698
|
-
insertBefore(label, createText(item.label), null);
|
|
1699
|
-
insertBefore(button, label, null);
|
|
942
|
+
const label = (0, import_vobs10.createElement)("span");
|
|
943
|
+
(0, import_vobs10.setAttribute)(label, "class", "vui-menu__label");
|
|
944
|
+
(0, import_vobs10.insertBefore)(label, (0, import_vobs10.createText)(item.label), null);
|
|
945
|
+
(0, import_vobs10.insertBefore)(button, label, null);
|
|
1700
946
|
} else if (item.content !== void 0) {
|
|
1701
947
|
mountSlot(button, item, "content");
|
|
1702
948
|
}
|
|
1703
949
|
if (item.shortcut !== void 0) {
|
|
1704
|
-
const shortcut = createElement("span");
|
|
1705
|
-
setAttribute(shortcut, "class", "vui-menu__shortcut");
|
|
1706
|
-
insertBefore(shortcut, createText(item.shortcut), null);
|
|
1707
|
-
insertBefore(button, shortcut, null);
|
|
950
|
+
const shortcut = (0, import_vobs10.createElement)("span");
|
|
951
|
+
(0, import_vobs10.setAttribute)(shortcut, "class", "vui-menu__shortcut");
|
|
952
|
+
(0, import_vobs10.insertBefore)(shortcut, (0, import_vobs10.createText)(item.shortcut), null);
|
|
953
|
+
(0, import_vobs10.insertBefore)(button, shortcut, null);
|
|
1708
954
|
}
|
|
1709
|
-
addEventListener(button, "click", (event) => {
|
|
955
|
+
(0, import_vobs10.addEventListener)(button, "click", (event) => {
|
|
1710
956
|
if (item.disabled === true || item.id === void 0) return;
|
|
1711
957
|
const handler = readProp(props, "onSelect", void 0);
|
|
1712
958
|
if (typeof handler === "function") handler(item.id, event);
|
|
@@ -1716,12 +962,14 @@ function createMenuItemNode(item, props) {
|
|
|
1716
962
|
__name(createMenuItemNode, "createMenuItemNode");
|
|
1717
963
|
|
|
1718
964
|
// packages/ui/src/nav-list.ts
|
|
965
|
+
var import_reactivity7 = require("@vobs/reactivity");
|
|
966
|
+
var import_vobs11 = require("@vobs/vobs");
|
|
1719
967
|
function NavList(props = {}) {
|
|
1720
|
-
const root = createElement("nav");
|
|
1721
|
-
const internalValue = state(void 0);
|
|
968
|
+
const root = (0, import_vobs11.createElement)("nav");
|
|
969
|
+
const internalValue = (0, import_reactivity7.state)(void 0);
|
|
1722
970
|
bindClassList(root, props, () => ["vui-navlist"]);
|
|
1723
971
|
bindCommonAttributes(root, props, ["groups", "value", "defaultValue", "onChange"]);
|
|
1724
|
-
insertDynamic(root, null, () => createNavGroups(props, internalValue));
|
|
972
|
+
(0, import_vobs11.insertDynamic)(root, null, () => createNavGroups(props, internalValue));
|
|
1725
973
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1726
974
|
return root;
|
|
1727
975
|
}
|
|
@@ -1729,61 +977,61 @@ __name(NavList, "NavList");
|
|
|
1729
977
|
function createNavGroups(props, internalValue) {
|
|
1730
978
|
const groups = readProp(props, "groups", []);
|
|
1731
979
|
const selected = activeId2(props, groups, internalValue);
|
|
1732
|
-
return createFragment((parent, anchor) => {
|
|
980
|
+
return (0, import_vobs11.createFragment)((parent, anchor) => {
|
|
1733
981
|
for (const group of groups) {
|
|
1734
|
-
const groupRoot = createElement("div");
|
|
1735
|
-
setAttribute(groupRoot, "class", "vui-navlist__group");
|
|
982
|
+
const groupRoot = (0, import_vobs11.createElement)("div");
|
|
983
|
+
(0, import_vobs11.setAttribute)(groupRoot, "class", "vui-navlist__group");
|
|
1736
984
|
setOptionalAttribute(groupRoot, "data-nav-group-id", group.id);
|
|
1737
985
|
if (group.title !== void 0) {
|
|
1738
|
-
const title = createElement("div");
|
|
1739
|
-
setAttribute(title, "class", "vui-navlist__group-title");
|
|
1740
|
-
insertBefore(title, createText(group.title), null);
|
|
1741
|
-
insertBefore(groupRoot, title, null);
|
|
986
|
+
const title = (0, import_vobs11.createElement)("div");
|
|
987
|
+
(0, import_vobs11.setAttribute)(title, "class", "vui-navlist__group-title");
|
|
988
|
+
(0, import_vobs11.insertBefore)(title, (0, import_vobs11.createText)(group.title), null);
|
|
989
|
+
(0, import_vobs11.insertBefore)(groupRoot, title, null);
|
|
1742
990
|
}
|
|
1743
991
|
for (const item of group.items) {
|
|
1744
|
-
insertBefore(groupRoot, createNavItem(item, props, selected, internalValue), null);
|
|
992
|
+
(0, import_vobs11.insertBefore)(groupRoot, createNavItem(item, props, selected, internalValue), null);
|
|
1745
993
|
}
|
|
1746
|
-
insertBefore(parent, groupRoot, anchor);
|
|
994
|
+
(0, import_vobs11.insertBefore)(parent, groupRoot, anchor);
|
|
1747
995
|
}
|
|
1748
996
|
});
|
|
1749
997
|
}
|
|
1750
998
|
__name(createNavGroups, "createNavGroups");
|
|
1751
999
|
function createNavItem(item, props, selected, internalValue) {
|
|
1752
1000
|
const active = item.id === selected;
|
|
1753
|
-
const element = createElement(item.href === void 0 ? "button" : "a");
|
|
1754
|
-
setAttribute(element, "class", `vui-navlist__item${active ? " is-active" : ""}`);
|
|
1755
|
-
if (item.href !== void 0) setAttribute(element, "role", "link");
|
|
1001
|
+
const element = (0, import_vobs11.createElement)(item.href === void 0 ? "button" : "a");
|
|
1002
|
+
(0, import_vobs11.setAttribute)(element, "class", `vui-navlist__item${active ? " is-active" : ""}`);
|
|
1003
|
+
if (item.href !== void 0) (0, import_vobs11.setAttribute)(element, "role", "link");
|
|
1756
1004
|
setOptionalAttribute(element, "data-nav-id", item.id);
|
|
1757
1005
|
if (item.href !== void 0) {
|
|
1758
|
-
setAttribute(element, "href", item.href);
|
|
1006
|
+
(0, import_vobs11.setAttribute)(element, "href", item.href);
|
|
1759
1007
|
setOptionalAttribute(element, "target", item.target);
|
|
1760
1008
|
setOptionalAttribute(element, "rel", item.rel);
|
|
1761
1009
|
} else {
|
|
1762
|
-
setAttribute(element, "type", "button");
|
|
1010
|
+
(0, import_vobs11.setAttribute)(element, "type", "button");
|
|
1763
1011
|
}
|
|
1764
|
-
if (active) setAttribute(element, "aria-current", "page");
|
|
1012
|
+
if (active) (0, import_vobs11.setAttribute)(element, "aria-current", "page");
|
|
1765
1013
|
if (item.disabled === true) {
|
|
1766
|
-
setAttribute(element, "aria-disabled", "true");
|
|
1767
|
-
setProperty(element, "tabIndex", -1);
|
|
1768
|
-
if (item.href === void 0) setProperty(element, "disabled", true);
|
|
1014
|
+
(0, import_vobs11.setAttribute)(element, "aria-disabled", "true");
|
|
1015
|
+
(0, import_vobs11.setProperty)(element, "tabIndex", -1);
|
|
1016
|
+
if (item.href === void 0) (0, import_vobs11.setProperty)(element, "disabled", true);
|
|
1769
1017
|
}
|
|
1770
1018
|
if (item.icon !== void 0) {
|
|
1771
|
-
const icon = createElement("span");
|
|
1772
|
-
setAttribute(icon, "class", "vui-navlist__icon");
|
|
1019
|
+
const icon = (0, import_vobs11.createElement)("span");
|
|
1020
|
+
(0, import_vobs11.setAttribute)(icon, "class", "vui-navlist__icon");
|
|
1773
1021
|
mountSlot(icon, item, "icon");
|
|
1774
|
-
insertBefore(element, icon, null);
|
|
1022
|
+
(0, import_vobs11.insertBefore)(element, icon, null);
|
|
1775
1023
|
}
|
|
1776
|
-
const label = createElement("span");
|
|
1777
|
-
setAttribute(label, "class", "vui-navlist__label");
|
|
1778
|
-
insertBefore(label, createText(item.label), null);
|
|
1779
|
-
insertBefore(element, label, null);
|
|
1024
|
+
const label = (0, import_vobs11.createElement)("span");
|
|
1025
|
+
(0, import_vobs11.setAttribute)(label, "class", "vui-navlist__label");
|
|
1026
|
+
(0, import_vobs11.insertBefore)(label, (0, import_vobs11.createText)(item.label), null);
|
|
1027
|
+
(0, import_vobs11.insertBefore)(element, label, null);
|
|
1780
1028
|
if (item.badge !== void 0) {
|
|
1781
|
-
const badge = createElement("span");
|
|
1782
|
-
setAttribute(badge, "class", "vui-navlist__badge");
|
|
1029
|
+
const badge = (0, import_vobs11.createElement)("span");
|
|
1030
|
+
(0, import_vobs11.setAttribute)(badge, "class", "vui-navlist__badge");
|
|
1783
1031
|
mountSlot(badge, item, "badge");
|
|
1784
|
-
insertBefore(element, badge, null);
|
|
1032
|
+
(0, import_vobs11.insertBefore)(element, badge, null);
|
|
1785
1033
|
}
|
|
1786
|
-
addEventListener(element, "click", (event) => {
|
|
1034
|
+
(0, import_vobs11.addEventListener)(element, "click", (event) => {
|
|
1787
1035
|
if (item.disabled === true) {
|
|
1788
1036
|
event.preventDefault?.();
|
|
1789
1037
|
return;
|
|
@@ -1810,8 +1058,9 @@ function activeId2(props, groups, internalValue) {
|
|
|
1810
1058
|
__name(activeId2, "activeId");
|
|
1811
1059
|
|
|
1812
1060
|
// packages/ui/src/pagination.ts
|
|
1061
|
+
var import_vobs12 = require("@vobs/vobs");
|
|
1813
1062
|
function Pagination(props = {}) {
|
|
1814
|
-
const root = createElement("nav");
|
|
1063
|
+
const root = (0, import_vobs12.createElement)("nav");
|
|
1815
1064
|
bindClassList(root, props, () => ["vui-pagination"]);
|
|
1816
1065
|
bindCommonAttributes(root, props, [
|
|
1817
1066
|
"page",
|
|
@@ -1824,8 +1073,8 @@ function Pagination(props = {}) {
|
|
|
1824
1073
|
"nextIcon",
|
|
1825
1074
|
"onChange"
|
|
1826
1075
|
]);
|
|
1827
|
-
if (!hasProp(props, "aria-label")) setAttribute(root, "aria-label", "Pagination");
|
|
1828
|
-
insertDynamic(root, null, () => createPaginationItems(props));
|
|
1076
|
+
if (!hasProp(props, "aria-label")) (0, import_vobs12.setAttribute)(root, "aria-label", "Pagination");
|
|
1077
|
+
(0, import_vobs12.insertDynamic)(root, null, () => createPaginationItems(props));
|
|
1829
1078
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1830
1079
|
return root;
|
|
1831
1080
|
}
|
|
@@ -1836,31 +1085,31 @@ function createPaginationItems(props) {
|
|
|
1836
1085
|
const siblingCount = Math.max(0, Math.floor(readProp(props, "siblingCount", 1)));
|
|
1837
1086
|
const disabled = readProp(props, "disabled", false);
|
|
1838
1087
|
const items = pageCount === 0 ? [] : buildPaginationItems(page, pageCount, siblingCount);
|
|
1839
|
-
return createFragment((parent, anchor) => {
|
|
1840
|
-
insertBefore(parent, createPaginationControl(props, "previous", page <= 1 || disabled), anchor);
|
|
1088
|
+
return (0, import_vobs12.createFragment)((parent, anchor) => {
|
|
1089
|
+
(0, import_vobs12.insertBefore)(parent, createPaginationControl(props, "previous", page <= 1 || disabled), anchor);
|
|
1841
1090
|
for (const item of items) {
|
|
1842
1091
|
if (typeof item === "number") {
|
|
1843
|
-
insertBefore(parent, createPageButton(item, item === page, disabled, props), anchor);
|
|
1092
|
+
(0, import_vobs12.insertBefore)(parent, createPageButton(item, item === page, disabled, props), anchor);
|
|
1844
1093
|
} else {
|
|
1845
|
-
insertBefore(parent, createEllipsis(item), anchor);
|
|
1094
|
+
(0, import_vobs12.insertBefore)(parent, createEllipsis(item), anchor);
|
|
1846
1095
|
}
|
|
1847
1096
|
}
|
|
1848
|
-
insertBefore(parent, createPaginationControl(props, "next", page >= pageCount || pageCount === 0 || disabled), anchor);
|
|
1097
|
+
(0, import_vobs12.insertBefore)(parent, createPaginationControl(props, "next", page >= pageCount || pageCount === 0 || disabled), anchor);
|
|
1849
1098
|
});
|
|
1850
1099
|
}
|
|
1851
1100
|
__name(createPaginationItems, "createPaginationItems");
|
|
1852
1101
|
function createPaginationControl(props, direction, disabled) {
|
|
1853
|
-
const button = createElement("button");
|
|
1854
|
-
setAttribute(button, "class", "vui-pagination__item");
|
|
1855
|
-
setAttribute(button, "type", "button");
|
|
1856
|
-
setProperty(button, "disabled", disabled);
|
|
1102
|
+
const button = (0, import_vobs12.createElement)("button");
|
|
1103
|
+
(0, import_vobs12.setAttribute)(button, "class", "vui-pagination__item");
|
|
1104
|
+
(0, import_vobs12.setAttribute)(button, "type", "button");
|
|
1105
|
+
(0, import_vobs12.setProperty)(button, "disabled", disabled);
|
|
1857
1106
|
setOptionalAttribute(button, "aria-label", direction === "previous" ? readProp(props, "previousLabel", "Previous") : readProp(props, "nextLabel", "Next"));
|
|
1858
|
-
if (disabled) setAttribute(button, "aria-disabled", "true");
|
|
1107
|
+
if (disabled) (0, import_vobs12.setAttribute)(button, "aria-disabled", "true");
|
|
1859
1108
|
const icon = direction === "previous" ? readProp(props, "previousIcon", void 0) : readProp(props, "nextIcon", void 0);
|
|
1860
1109
|
const fallback = direction === "previous" ? "<" : ">";
|
|
1861
|
-
const node = icon === void 0 ? createText(fallback) : resolveSlot(icon);
|
|
1862
|
-
if (node) insertBefore(button, node, null);
|
|
1863
|
-
addEventListener(button, "click", () => {
|
|
1110
|
+
const node = icon === void 0 ? (0, import_vobs12.createText)(fallback) : resolveSlot(icon);
|
|
1111
|
+
if (node) (0, import_vobs12.insertBefore)(button, node, null);
|
|
1112
|
+
(0, import_vobs12.addEventListener)(button, "click", () => {
|
|
1864
1113
|
if (disabled) return;
|
|
1865
1114
|
const current = readProp(props, "page", 1);
|
|
1866
1115
|
const nextPage = direction === "previous" ? current - 1 : current + 1;
|
|
@@ -1870,28 +1119,28 @@ function createPaginationControl(props, direction, disabled) {
|
|
|
1870
1119
|
}
|
|
1871
1120
|
__name(createPaginationControl, "createPaginationControl");
|
|
1872
1121
|
function createPageButton(page, active, disabled, props) {
|
|
1873
|
-
const button = createElement("button");
|
|
1874
|
-
setAttribute(button, "class", `vui-pagination__item${active ? " is-active" : ""}`);
|
|
1875
|
-
setAttribute(button, "type", "button");
|
|
1876
|
-
setProperty(button, "disabled", disabled);
|
|
1877
|
-
setAttribute(button, "aria-label", `Page ${page}`);
|
|
1878
|
-
if (active) setAttribute(button, "aria-current", "page");
|
|
1879
|
-
if (disabled) setAttribute(button, "aria-disabled", "true");
|
|
1880
|
-
insertBefore(button, createText(String(page)), null);
|
|
1881
|
-
addEventListener(button, "click", () => {
|
|
1122
|
+
const button = (0, import_vobs12.createElement)("button");
|
|
1123
|
+
(0, import_vobs12.setAttribute)(button, "class", `vui-pagination__item${active ? " is-active" : ""}`);
|
|
1124
|
+
(0, import_vobs12.setAttribute)(button, "type", "button");
|
|
1125
|
+
(0, import_vobs12.setProperty)(button, "disabled", disabled);
|
|
1126
|
+
(0, import_vobs12.setAttribute)(button, "aria-label", `Page ${page}`);
|
|
1127
|
+
if (active) (0, import_vobs12.setAttribute)(button, "aria-current", "page");
|
|
1128
|
+
if (disabled) (0, import_vobs12.setAttribute)(button, "aria-disabled", "true");
|
|
1129
|
+
(0, import_vobs12.insertBefore)(button, (0, import_vobs12.createText)(String(page)), null);
|
|
1130
|
+
(0, import_vobs12.addEventListener)(button, "click", () => {
|
|
1882
1131
|
if (!disabled) emitPageChange(props, page);
|
|
1883
1132
|
});
|
|
1884
1133
|
return button;
|
|
1885
1134
|
}
|
|
1886
1135
|
__name(createPageButton, "createPageButton");
|
|
1887
1136
|
function createEllipsis(item) {
|
|
1888
|
-
const button = createElement("button");
|
|
1889
|
-
setAttribute(button, "class", "vui-pagination__item");
|
|
1890
|
-
setAttribute(button, "type", "button");
|
|
1891
|
-
setProperty(button, "disabled", true);
|
|
1892
|
-
setAttribute(button, "aria-label", item === "ellipsis-left" ? "Previous pages" : "Next pages");
|
|
1893
|
-
setAttribute(button, "aria-hidden", "true");
|
|
1894
|
-
insertBefore(button, createText("..."), null);
|
|
1137
|
+
const button = (0, import_vobs12.createElement)("button");
|
|
1138
|
+
(0, import_vobs12.setAttribute)(button, "class", "vui-pagination__item");
|
|
1139
|
+
(0, import_vobs12.setAttribute)(button, "type", "button");
|
|
1140
|
+
(0, import_vobs12.setProperty)(button, "disabled", true);
|
|
1141
|
+
(0, import_vobs12.setAttribute)(button, "aria-label", item === "ellipsis-left" ? "Previous pages" : "Next pages");
|
|
1142
|
+
(0, import_vobs12.setAttribute)(button, "aria-hidden", "true");
|
|
1143
|
+
(0, import_vobs12.insertBefore)(button, (0, import_vobs12.createText)("..."), null);
|
|
1895
1144
|
return button;
|
|
1896
1145
|
}
|
|
1897
1146
|
__name(createEllipsis, "createEllipsis");
|
|
@@ -1922,8 +1171,9 @@ function buildPaginationItems(page, pageCount, siblingCount) {
|
|
|
1922
1171
|
__name(buildPaginationItems, "buildPaginationItems");
|
|
1923
1172
|
|
|
1924
1173
|
// packages/ui/src/avatar.ts
|
|
1174
|
+
var import_vobs13 = require("@vobs/vobs");
|
|
1925
1175
|
function Avatar(props = {}) {
|
|
1926
|
-
const root = createElement("span");
|
|
1176
|
+
const root = (0, import_vobs13.createElement)("span");
|
|
1927
1177
|
bindClassList(root, props, () => [
|
|
1928
1178
|
"vui-avatar",
|
|
1929
1179
|
readProp(props, "size", "md") === "sm" ? "vui-avatar--sm" : void 0,
|
|
@@ -1933,17 +1183,17 @@ function Avatar(props = {}) {
|
|
|
1933
1183
|
]);
|
|
1934
1184
|
bindCommonAttributes(root, props, ["src", "alt", "size", "shape", "accent", "fallback"]);
|
|
1935
1185
|
bindUserStyle(root, props);
|
|
1936
|
-
insertDynamic(root, null, () => createAvatarContent(props));
|
|
1186
|
+
(0, import_vobs13.insertDynamic)(root, null, () => createAvatarContent(props));
|
|
1937
1187
|
return root;
|
|
1938
1188
|
}
|
|
1939
1189
|
__name(Avatar, "Avatar");
|
|
1940
1190
|
function createAvatarContent(props) {
|
|
1941
1191
|
const src = readProp(props, "src", void 0);
|
|
1942
1192
|
if (src) {
|
|
1943
|
-
const image = createElement("img");
|
|
1944
|
-
setAttribute(image, "class", "vui-avatar__image");
|
|
1945
|
-
setAttribute(image, "src", src);
|
|
1946
|
-
setAttribute(image, "alt", readProp(props, "alt", ""));
|
|
1193
|
+
const image = (0, import_vobs13.createElement)("img");
|
|
1194
|
+
(0, import_vobs13.setAttribute)(image, "class", "vui-avatar__image");
|
|
1195
|
+
(0, import_vobs13.setAttribute)(image, "src", src);
|
|
1196
|
+
(0, import_vobs13.setAttribute)(image, "alt", readProp(props, "alt", ""));
|
|
1947
1197
|
return image;
|
|
1948
1198
|
}
|
|
1949
1199
|
if (hasProp(props, "fallback")) {
|
|
@@ -1954,61 +1204,63 @@ function createAvatarContent(props) {
|
|
|
1954
1204
|
const children = resolveSlot(Reflect.get(props, "children"));
|
|
1955
1205
|
if (children) return children;
|
|
1956
1206
|
}
|
|
1957
|
-
return createText("");
|
|
1207
|
+
return (0, import_vobs13.createText)("");
|
|
1958
1208
|
}
|
|
1959
1209
|
__name(createAvatarContent, "createAvatarContent");
|
|
1960
1210
|
|
|
1961
1211
|
// packages/ui/src/page-header.ts
|
|
1212
|
+
var import_reactivity8 = require("@vobs/reactivity");
|
|
1213
|
+
var import_vobs14 = require("@vobs/vobs");
|
|
1962
1214
|
function PageHeader(props = {}) {
|
|
1963
|
-
const root = createElement("header");
|
|
1964
|
-
const main = createElement("div");
|
|
1215
|
+
const root = (0, import_vobs14.createElement)("header");
|
|
1216
|
+
const main = (0, import_vobs14.createElement)("div");
|
|
1965
1217
|
bindClassList(root, props, () => ["vui-pagehead"]);
|
|
1966
1218
|
bindCommonAttributes(root, props, ["title", "subtitle", "actions"]);
|
|
1967
1219
|
bindUserStyle(root, props);
|
|
1968
|
-
setAttribute(main, "class", "vui-pagehead__main");
|
|
1220
|
+
(0, import_vobs14.setAttribute)(main, "class", "vui-pagehead__main");
|
|
1969
1221
|
if (hasProp(props, "title")) {
|
|
1970
|
-
const title = createElement("h1");
|
|
1971
|
-
const text = createText("");
|
|
1972
|
-
setAttribute(title, "class", "vui-pagehead__title");
|
|
1222
|
+
const title = (0, import_vobs14.createElement)("h1");
|
|
1223
|
+
const text = (0, import_vobs14.createText)("");
|
|
1224
|
+
(0, import_vobs14.setAttribute)(title, "class", "vui-pagehead__title");
|
|
1973
1225
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
1974
|
-
insertBefore(title, text, null);
|
|
1975
|
-
insertBefore(main, title, null);
|
|
1226
|
+
(0, import_vobs14.insertBefore)(title, text, null);
|
|
1227
|
+
(0, import_vobs14.insertBefore)(main, title, null);
|
|
1976
1228
|
}
|
|
1977
1229
|
if (hasProp(props, "subtitle")) {
|
|
1978
|
-
const subtitle = createElement("p");
|
|
1979
|
-
const text = createText("");
|
|
1980
|
-
setAttribute(subtitle, "class", "vui-pagehead__subtitle");
|
|
1230
|
+
const subtitle = (0, import_vobs14.createElement)("p");
|
|
1231
|
+
const text = (0, import_vobs14.createText)("");
|
|
1232
|
+
(0, import_vobs14.setAttribute)(subtitle, "class", "vui-pagehead__subtitle");
|
|
1981
1233
|
bindTextContent(text, () => readProp(props, "subtitle", ""));
|
|
1982
|
-
insertBefore(subtitle, text, null);
|
|
1983
|
-
insertBefore(main, subtitle, null);
|
|
1234
|
+
(0, import_vobs14.insertBefore)(subtitle, text, null);
|
|
1235
|
+
(0, import_vobs14.insertBefore)(main, subtitle, null);
|
|
1984
1236
|
}
|
|
1985
1237
|
if (hasProp(props, "children")) mountSlot(main, props, "children");
|
|
1986
|
-
insertBefore(root, main, null);
|
|
1238
|
+
(0, import_vobs14.insertBefore)(root, main, null);
|
|
1987
1239
|
if (hasProp(props, "actions")) {
|
|
1988
|
-
const actions = createElement("div");
|
|
1989
|
-
setAttribute(actions, "class", "vui-pagehead__actions");
|
|
1240
|
+
const actions = (0, import_vobs14.createElement)("div");
|
|
1241
|
+
(0, import_vobs14.setAttribute)(actions, "class", "vui-pagehead__actions");
|
|
1990
1242
|
mountSlot(actions, props, "actions");
|
|
1991
|
-
insertBefore(root, actions, null);
|
|
1243
|
+
(0, import_vobs14.insertBefore)(root, actions, null);
|
|
1992
1244
|
}
|
|
1993
1245
|
return root;
|
|
1994
1246
|
}
|
|
1995
1247
|
__name(PageHeader, "PageHeader");
|
|
1996
1248
|
function PageHeaderAction(props = {}) {
|
|
1997
|
-
const root = createElement(props.href === void 0 ? "button" : "a");
|
|
1249
|
+
const root = (0, import_vobs14.createElement)(props.href === void 0 ? "button" : "a");
|
|
1998
1250
|
bindClassList(root, props, () => [
|
|
1999
1251
|
"vui-pagehead__btn",
|
|
2000
1252
|
readProp(props, "primary", false) ? "is-primary" : void 0
|
|
2001
1253
|
]);
|
|
2002
1254
|
bindCommonAttributes(root, props, ["href", "primary", "disabled", "onClick"]);
|
|
2003
|
-
if (props.href === void 0) setAttribute(root, "type", "button");
|
|
2004
|
-
else setAttribute(root, "href", props.href);
|
|
2005
|
-
effect(() => {
|
|
1255
|
+
if (props.href === void 0) (0, import_vobs14.setAttribute)(root, "type", "button");
|
|
1256
|
+
else (0, import_vobs14.setAttribute)(root, "href", props.href);
|
|
1257
|
+
(0, import_reactivity8.effect)(() => {
|
|
2006
1258
|
const disabled = readProp(props, "disabled", false);
|
|
2007
1259
|
setOptionalAttribute(root, "aria-disabled", disabled ? "true" : void 0);
|
|
2008
|
-
if (props.href === void 0) setProperty(root, "disabled", disabled);
|
|
1260
|
+
if (props.href === void 0) (0, import_vobs14.setProperty)(root, "disabled", disabled);
|
|
2009
1261
|
});
|
|
2010
1262
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2011
|
-
addEventListener(root, "click", (event) => {
|
|
1263
|
+
(0, import_vobs14.addEventListener)(root, "click", (event) => {
|
|
2012
1264
|
if (readProp(props, "disabled", false)) {
|
|
2013
1265
|
event.preventDefault?.();
|
|
2014
1266
|
return;
|
|
@@ -2021,29 +1273,30 @@ function PageHeaderAction(props = {}) {
|
|
|
2021
1273
|
__name(PageHeaderAction, "PageHeaderAction");
|
|
2022
1274
|
|
|
2023
1275
|
// packages/ui/src/table.ts
|
|
1276
|
+
var import_vobs15 = require("@vobs/vobs");
|
|
2024
1277
|
function Table(props = {}) {
|
|
2025
|
-
const root = createElement("table");
|
|
2026
|
-
const head = createElement("thead");
|
|
2027
|
-
const body = createElement("tbody");
|
|
1278
|
+
const root = (0, import_vobs15.createElement)("table");
|
|
1279
|
+
const head = (0, import_vobs15.createElement)("thead");
|
|
1280
|
+
const body = (0, import_vobs15.createElement)("tbody");
|
|
2028
1281
|
bindClassList(root, props, () => ["vui-table"]);
|
|
2029
1282
|
bindCommonAttributes(root, props, ["columns", "rows", "caption", "empty", "rowKey", "onRowClick"]);
|
|
2030
1283
|
bindUserStyle(root, props);
|
|
2031
1284
|
if (hasProp(props, "caption")) {
|
|
2032
|
-
const caption = createElement("caption");
|
|
2033
|
-
const text = createText("");
|
|
1285
|
+
const caption = (0, import_vobs15.createElement)("caption");
|
|
1286
|
+
const text = (0, import_vobs15.createText)("");
|
|
2034
1287
|
bindTextContent(text, () => readProp(props, "caption", ""));
|
|
2035
|
-
insertBefore(caption, text, null);
|
|
2036
|
-
insertBefore(root, caption, null);
|
|
1288
|
+
(0, import_vobs15.insertBefore)(caption, text, null);
|
|
1289
|
+
(0, import_vobs15.insertBefore)(root, caption, null);
|
|
2037
1290
|
}
|
|
2038
|
-
insertDynamic(head, null, () => createTableHead(props));
|
|
2039
|
-
insertDynamic(body, null, () => createTableBody(props));
|
|
2040
|
-
insertBefore(root, head, null);
|
|
2041
|
-
insertBefore(root, body, null);
|
|
1291
|
+
(0, import_vobs15.insertDynamic)(head, null, () => createTableHead(props));
|
|
1292
|
+
(0, import_vobs15.insertDynamic)(body, null, () => createTableBody(props));
|
|
1293
|
+
(0, import_vobs15.insertBefore)(root, head, null);
|
|
1294
|
+
(0, import_vobs15.insertBefore)(root, body, null);
|
|
2042
1295
|
return root;
|
|
2043
1296
|
}
|
|
2044
1297
|
__name(Table, "Table");
|
|
2045
1298
|
function TablePanel(props = {}) {
|
|
2046
|
-
const root = createElement("div");
|
|
1299
|
+
const root = (0, import_vobs15.createElement)("div");
|
|
2047
1300
|
bindClassList(root, props, () => ["vui-tablepanel"]);
|
|
2048
1301
|
bindCommonAttributes(root, props, ["columns", "rows", "empty", "footer", "rowKey", "onRowClick"]);
|
|
2049
1302
|
bindUserStyle(root, props);
|
|
@@ -2064,29 +1317,29 @@ function TablePanel(props = {}) {
|
|
|
2064
1317
|
return readProp(props, "onRowClick", void 0);
|
|
2065
1318
|
}
|
|
2066
1319
|
});
|
|
2067
|
-
insertBefore(root, table, null);
|
|
1320
|
+
(0, import_vobs15.insertBefore)(root, table, null);
|
|
2068
1321
|
if (hasProp(props, "footer")) {
|
|
2069
|
-
const footer = createElement("div");
|
|
2070
|
-
setAttribute(footer, "class", "vui-tablepanel__foot");
|
|
1322
|
+
const footer = (0, import_vobs15.createElement)("div");
|
|
1323
|
+
(0, import_vobs15.setAttribute)(footer, "class", "vui-tablepanel__foot");
|
|
2071
1324
|
mountSlot(footer, props, "footer");
|
|
2072
|
-
insertBefore(root, footer, null);
|
|
1325
|
+
(0, import_vobs15.insertBefore)(root, footer, null);
|
|
2073
1326
|
}
|
|
2074
1327
|
return root;
|
|
2075
1328
|
}
|
|
2076
1329
|
__name(TablePanel, "TablePanel");
|
|
2077
1330
|
function createTableHead(props) {
|
|
2078
1331
|
const columns = readProp(props, "columns", []);
|
|
2079
|
-
return createFragment((parent, anchor) => {
|
|
2080
|
-
const row = createElement("tr");
|
|
1332
|
+
return (0, import_vobs15.createFragment)((parent, anchor) => {
|
|
1333
|
+
const row = (0, import_vobs15.createElement)("tr");
|
|
2081
1334
|
for (const column of columns) {
|
|
2082
|
-
const cell = createElement("th");
|
|
2083
|
-
setAttribute(cell, "scope", "col");
|
|
2084
|
-
setAttribute(cell, "data-column-id", column.id);
|
|
1335
|
+
const cell = (0, import_vobs15.createElement)("th");
|
|
1336
|
+
(0, import_vobs15.setAttribute)(cell, "scope", "col");
|
|
1337
|
+
(0, import_vobs15.setAttribute)(cell, "data-column-id", column.id);
|
|
2085
1338
|
applyAlignment(cell, column.align);
|
|
2086
|
-
insertBefore(cell, createText(column.label), null);
|
|
2087
|
-
insertBefore(row, cell, null);
|
|
1339
|
+
(0, import_vobs15.insertBefore)(cell, (0, import_vobs15.createText)(column.label), null);
|
|
1340
|
+
(0, import_vobs15.insertBefore)(row, cell, null);
|
|
2088
1341
|
}
|
|
2089
|
-
insertBefore(parent, row, anchor);
|
|
1342
|
+
(0, import_vobs15.insertBefore)(parent, row, anchor);
|
|
2090
1343
|
});
|
|
2091
1344
|
}
|
|
2092
1345
|
__name(createTableHead, "createTableHead");
|
|
@@ -2094,55 +1347,55 @@ function createTableBody(props) {
|
|
|
2094
1347
|
const columns = readProp(props, "columns", []);
|
|
2095
1348
|
const rows = readProp(props, "rows", []);
|
|
2096
1349
|
if (rows.length === 0) return createEmptyRow(props, columns.length);
|
|
2097
|
-
return createFragment((parent, anchor) => {
|
|
1350
|
+
return (0, import_vobs15.createFragment)((parent, anchor) => {
|
|
2098
1351
|
for (let index = 0; index < rows.length; index++) {
|
|
2099
|
-
insertBefore(parent, createTableRow(rows[index], index, columns, props), anchor);
|
|
1352
|
+
(0, import_vobs15.insertBefore)(parent, createTableRow(rows[index], index, columns, props), anchor);
|
|
2100
1353
|
}
|
|
2101
1354
|
});
|
|
2102
1355
|
}
|
|
2103
1356
|
__name(createTableBody, "createTableBody");
|
|
2104
1357
|
function createTableRow(row, index, columns, props) {
|
|
2105
|
-
const tableRow = createElement("tr");
|
|
1358
|
+
const tableRow = (0, import_vobs15.createElement)("tr");
|
|
2106
1359
|
const rowKey = readProp(props, "rowKey", void 0);
|
|
2107
1360
|
if (rowKey) setOptionalAttribute(tableRow, "data-row-key", rowKey(row, index));
|
|
2108
1361
|
for (const column of columns) {
|
|
2109
|
-
const cell = createElement("td");
|
|
2110
|
-
setAttribute(cell, "data-column-id", column.id);
|
|
1362
|
+
const cell = (0, import_vobs15.createElement)("td");
|
|
1363
|
+
(0, import_vobs15.setAttribute)(cell, "data-column-id", column.id);
|
|
2111
1364
|
applyAlignment(cell, column.align);
|
|
2112
|
-
insertDynamic(cell, null, () => {
|
|
1365
|
+
(0, import_vobs15.insertDynamic)(cell, null, () => {
|
|
2113
1366
|
const value = column.render ? column.render(row, index) : column.key === void 0 ? void 0 : readRowValue(row, column.key);
|
|
2114
1367
|
return resolveSlot(value);
|
|
2115
1368
|
});
|
|
2116
|
-
insertBefore(tableRow, cell, null);
|
|
1369
|
+
(0, import_vobs15.insertBefore)(tableRow, cell, null);
|
|
2117
1370
|
}
|
|
2118
1371
|
const onRowClick = readProp(props, "onRowClick", void 0);
|
|
2119
1372
|
if (onRowClick) {
|
|
2120
|
-
setProperty(tableRow, "tabIndex", 0);
|
|
2121
|
-
setAttribute(tableRow, "data-clickable", "true");
|
|
2122
|
-
addEventListener(tableRow, "click", () => onRowClick(row, index));
|
|
1373
|
+
(0, import_vobs15.setProperty)(tableRow, "tabIndex", 0);
|
|
1374
|
+
(0, import_vobs15.setAttribute)(tableRow, "data-clickable", "true");
|
|
1375
|
+
(0, import_vobs15.addEventListener)(tableRow, "click", () => onRowClick(row, index));
|
|
2123
1376
|
}
|
|
2124
1377
|
return tableRow;
|
|
2125
1378
|
}
|
|
2126
1379
|
__name(createTableRow, "createTableRow");
|
|
2127
1380
|
function createEmptyRow(props, columnCount) {
|
|
2128
|
-
const row = createElement("tr");
|
|
2129
|
-
const cell = createElement("td");
|
|
2130
|
-
setAttribute(cell, "colspan", String(Math.max(1, columnCount)));
|
|
1381
|
+
const row = (0, import_vobs15.createElement)("tr");
|
|
1382
|
+
const cell = (0, import_vobs15.createElement)("td");
|
|
1383
|
+
(0, import_vobs15.setAttribute)(cell, "colspan", String(Math.max(1, columnCount)));
|
|
2131
1384
|
if (hasProp(props, "empty")) {
|
|
2132
|
-
insertDynamic(cell, null, () => resolveSlot(Reflect.get(props, "empty")));
|
|
1385
|
+
(0, import_vobs15.insertDynamic)(cell, null, () => resolveSlot(Reflect.get(props, "empty")));
|
|
2133
1386
|
} else {
|
|
2134
|
-
insertBefore(cell, createText("No data"), null);
|
|
1387
|
+
(0, import_vobs15.insertBefore)(cell, (0, import_vobs15.createText)("No data"), null);
|
|
2135
1388
|
}
|
|
2136
|
-
insertBefore(row, cell, null);
|
|
1389
|
+
(0, import_vobs15.insertBefore)(row, cell, null);
|
|
2137
1390
|
return row;
|
|
2138
1391
|
}
|
|
2139
1392
|
__name(createEmptyRow, "createEmptyRow");
|
|
2140
1393
|
function applyAlignment(cell, align) {
|
|
2141
1394
|
if (align === "end") {
|
|
2142
|
-
setAttribute(cell, "class", "num");
|
|
2143
|
-
setAttribute(cell, "data-align", "end");
|
|
1395
|
+
(0, import_vobs15.setAttribute)(cell, "class", "num");
|
|
1396
|
+
(0, import_vobs15.setAttribute)(cell, "data-align", "end");
|
|
2144
1397
|
} else if (align === "center") {
|
|
2145
|
-
setAttribute(cell, "data-align", "center");
|
|
1398
|
+
(0, import_vobs15.setAttribute)(cell, "data-align", "center");
|
|
2146
1399
|
}
|
|
2147
1400
|
}
|
|
2148
1401
|
__name(applyAlignment, "applyAlignment");
|
|
@@ -2153,8 +1406,10 @@ function readRowValue(row, key) {
|
|
|
2153
1406
|
__name(readRowValue, "readRowValue");
|
|
2154
1407
|
|
|
2155
1408
|
// packages/ui/src/stat-card.ts
|
|
1409
|
+
var import_reactivity9 = require("@vobs/reactivity");
|
|
1410
|
+
var import_vobs16 = require("@vobs/vobs");
|
|
2156
1411
|
function StatCard(props = {}) {
|
|
2157
|
-
const root = createElement("div");
|
|
1412
|
+
const root = (0, import_vobs16.createElement)("div");
|
|
2158
1413
|
bindClassList(root, props, () => ["vui-statcard"]);
|
|
2159
1414
|
bindCommonAttributes(root, props, [
|
|
2160
1415
|
"label",
|
|
@@ -2166,41 +1421,41 @@ function StatCard(props = {}) {
|
|
|
2166
1421
|
]);
|
|
2167
1422
|
bindUserStyle(root, props);
|
|
2168
1423
|
if (hasProp(props, "label")) {
|
|
2169
|
-
const label = createElement("span");
|
|
2170
|
-
const text = createText("");
|
|
2171
|
-
setAttribute(label, "class", "vui-statcard__label");
|
|
1424
|
+
const label = (0, import_vobs16.createElement)("span");
|
|
1425
|
+
const text = (0, import_vobs16.createText)("");
|
|
1426
|
+
(0, import_vobs16.setAttribute)(label, "class", "vui-statcard__label");
|
|
2172
1427
|
bindTextContent(text, () => readProp(props, "label", ""));
|
|
2173
|
-
insertBefore(label, text, null);
|
|
2174
|
-
insertBefore(root, label, null);
|
|
1428
|
+
(0, import_vobs16.insertBefore)(label, text, null);
|
|
1429
|
+
(0, import_vobs16.insertBefore)(root, label, null);
|
|
2175
1430
|
}
|
|
2176
1431
|
if (hasProp(props, "value")) {
|
|
2177
|
-
const value = createElement("span");
|
|
2178
|
-
setAttribute(value, "class", "vui-statcard__value");
|
|
2179
|
-
insertDynamic(value, null, () => resolveSlot(Reflect.get(props, "value")));
|
|
2180
|
-
insertBefore(root, value, null);
|
|
1432
|
+
const value = (0, import_vobs16.createElement)("span");
|
|
1433
|
+
(0, import_vobs16.setAttribute)(value, "class", "vui-statcard__value");
|
|
1434
|
+
(0, import_vobs16.insertDynamic)(value, null, () => resolveSlot(Reflect.get(props, "value")));
|
|
1435
|
+
(0, import_vobs16.insertBefore)(root, value, null);
|
|
2181
1436
|
}
|
|
2182
1437
|
if (hasProp(props, "delta") || hasProp(props, "deltaIcon") || hasProp(props, "deltaCaption")) {
|
|
2183
|
-
const delta = createElement("span");
|
|
2184
|
-
effect(() => {
|
|
1438
|
+
const delta = (0, import_vobs16.createElement)("span");
|
|
1439
|
+
(0, import_reactivity9.effect)(() => {
|
|
2185
1440
|
const direction = readProp(props, "deltaDirection", void 0);
|
|
2186
|
-
setAttribute(delta, "class", `vui-statcard__delta${direction ? ` is-${direction}` : ""}`);
|
|
1441
|
+
(0, import_vobs16.setAttribute)(delta, "class", `vui-statcard__delta${direction ? ` is-${direction}` : ""}`);
|
|
2187
1442
|
});
|
|
2188
1443
|
if (hasProp(props, "deltaIcon")) mountSlot(delta, props, "deltaIcon");
|
|
2189
1444
|
if (hasProp(props, "delta")) mountSlot(delta, props, "delta");
|
|
2190
1445
|
if (hasProp(props, "deltaCaption")) {
|
|
2191
|
-
const caption = createElement("span");
|
|
2192
|
-
setAttribute(caption, "class", "vui-statcard__caption");
|
|
1446
|
+
const caption = (0, import_vobs16.createElement)("span");
|
|
1447
|
+
(0, import_vobs16.setAttribute)(caption, "class", "vui-statcard__caption");
|
|
2193
1448
|
mountSlot(caption, props, "deltaCaption");
|
|
2194
|
-
insertBefore(delta, caption, null);
|
|
1449
|
+
(0, import_vobs16.insertBefore)(delta, caption, null);
|
|
2195
1450
|
}
|
|
2196
|
-
insertBefore(root, delta, null);
|
|
1451
|
+
(0, import_vobs16.insertBefore)(root, delta, null);
|
|
2197
1452
|
}
|
|
2198
1453
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2199
1454
|
return root;
|
|
2200
1455
|
}
|
|
2201
1456
|
__name(StatCard, "StatCard");
|
|
2202
1457
|
function StatCardGrid(props = {}) {
|
|
2203
|
-
const root = createElement("div");
|
|
1458
|
+
const root = (0, import_vobs16.createElement)("div");
|
|
2204
1459
|
bindClassList(root, props, () => ["vui-statcard__grid"]);
|
|
2205
1460
|
bindCommonAttributes(root, props);
|
|
2206
1461
|
bindUserStyle(root, props);
|
|
@@ -2210,8 +1465,9 @@ function StatCardGrid(props = {}) {
|
|
|
2210
1465
|
__name(StatCardGrid, "StatCardGrid");
|
|
2211
1466
|
|
|
2212
1467
|
// packages/ui/src/kbd.ts
|
|
1468
|
+
var import_vobs17 = require("@vobs/vobs");
|
|
2213
1469
|
function Kbd(props = {}) {
|
|
2214
|
-
const root = createElement("kbd");
|
|
1470
|
+
const root = (0, import_vobs17.createElement)("kbd");
|
|
2215
1471
|
bindClassList(root, props, () => ["vui-kbd"]);
|
|
2216
1472
|
bindCommonAttributes(root, props);
|
|
2217
1473
|
bindUserStyle(root, props);
|
|
@@ -2220,17 +1476,17 @@ function Kbd(props = {}) {
|
|
|
2220
1476
|
}
|
|
2221
1477
|
__name(Kbd, "Kbd");
|
|
2222
1478
|
function KbdCombo(props = {}) {
|
|
2223
|
-
const root = createElement("span");
|
|
1479
|
+
const root = (0, import_vobs17.createElement)("span");
|
|
2224
1480
|
bindClassList(root, props, () => ["vui-kbd__combo"]);
|
|
2225
1481
|
bindCommonAttributes(root, props, ["keys", "separator"]);
|
|
2226
1482
|
bindUserStyle(root, props);
|
|
2227
|
-
if (hasProp(props, "keys")) insertDynamic(root, null, () => createComboKeys(props));
|
|
1483
|
+
if (hasProp(props, "keys")) (0, import_vobs17.insertDynamic)(root, null, () => createComboKeys(props));
|
|
2228
1484
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2229
1485
|
return root;
|
|
2230
1486
|
}
|
|
2231
1487
|
__name(KbdCombo, "KbdCombo");
|
|
2232
1488
|
function KbdRow(props = {}) {
|
|
2233
|
-
const root = createElement("div");
|
|
1489
|
+
const root = (0, import_vobs17.createElement)("div");
|
|
2234
1490
|
bindClassList(root, props, () => ["vui-kbd__row"]);
|
|
2235
1491
|
bindCommonAttributes(root, props);
|
|
2236
1492
|
bindUserStyle(root, props);
|
|
@@ -2241,30 +1497,32 @@ __name(KbdRow, "KbdRow");
|
|
|
2241
1497
|
function createComboKeys(props) {
|
|
2242
1498
|
const keys = readProp(props, "keys", []);
|
|
2243
1499
|
const separator = readProp(props, "separator", "+");
|
|
2244
|
-
return createFragment((parent, anchor) => {
|
|
1500
|
+
return (0, import_vobs17.createFragment)((parent, anchor) => {
|
|
2245
1501
|
for (let index = 0; index < keys.length; index++) {
|
|
2246
1502
|
if (index > 0) {
|
|
2247
|
-
const plus = createElement("span");
|
|
2248
|
-
setAttribute(plus, "class", "vui-kbd__plus");
|
|
1503
|
+
const plus = (0, import_vobs17.createElement)("span");
|
|
1504
|
+
(0, import_vobs17.setAttribute)(plus, "class", "vui-kbd__plus");
|
|
2249
1505
|
const separatorNode = resolveSlot(separator);
|
|
2250
|
-
if (separatorNode) insertBefore(plus, separatorNode, null);
|
|
2251
|
-
insertBefore(parent, plus, anchor);
|
|
1506
|
+
if (separatorNode) (0, import_vobs17.insertBefore)(plus, separatorNode, null);
|
|
1507
|
+
(0, import_vobs17.insertBefore)(parent, plus, anchor);
|
|
2252
1508
|
}
|
|
2253
|
-
insertBefore(parent, Kbd({ children: keys[index] }), anchor);
|
|
1509
|
+
(0, import_vobs17.insertBefore)(parent, Kbd({ children: keys[index] }), anchor);
|
|
2254
1510
|
}
|
|
2255
1511
|
});
|
|
2256
1512
|
}
|
|
2257
1513
|
__name(createComboKeys, "createComboKeys");
|
|
2258
1514
|
|
|
2259
1515
|
// packages/ui/src/activity-rail.ts
|
|
1516
|
+
var import_reactivity10 = require("@vobs/reactivity");
|
|
1517
|
+
var import_vobs18 = require("@vobs/vobs");
|
|
2260
1518
|
function ActivityRail(props = {}) {
|
|
2261
|
-
const root = createElement("nav");
|
|
2262
|
-
const internalValue = state(void 0);
|
|
1519
|
+
const root = (0, import_vobs18.createElement)("nav");
|
|
1520
|
+
const internalValue = (0, import_reactivity10.state)(void 0);
|
|
2263
1521
|
bindClassList(root, props, () => ["vui-activityrail"]);
|
|
2264
1522
|
bindCommonAttributes(root, props, ["items", "value", "defaultValue", "onChange"]);
|
|
2265
1523
|
bindUserStyle(root, props);
|
|
2266
|
-
if (!hasProp(props, "aria-label")) setAttribute(root, "aria-label", "Activity");
|
|
2267
|
-
if (hasProp(props, "items")) insertDynamic(root, null, () => createActivityItems(props, internalValue));
|
|
1524
|
+
if (!hasProp(props, "aria-label")) (0, import_vobs18.setAttribute)(root, "aria-label", "Activity");
|
|
1525
|
+
if (hasProp(props, "items")) (0, import_vobs18.insertDynamic)(root, null, () => createActivityItems(props, internalValue));
|
|
2268
1526
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2269
1527
|
return root;
|
|
2270
1528
|
}
|
|
@@ -2272,47 +1530,47 @@ __name(ActivityRail, "ActivityRail");
|
|
|
2272
1530
|
function createActivityItems(props, internalValue) {
|
|
2273
1531
|
const items = readProp(props, "items", []);
|
|
2274
1532
|
const selected = activeId3(props, items, internalValue);
|
|
2275
|
-
return createFragment((parent, anchor) => {
|
|
1533
|
+
return (0, import_vobs18.createFragment)((parent, anchor) => {
|
|
2276
1534
|
for (const item of items) {
|
|
2277
1535
|
if (item.divider === true) {
|
|
2278
|
-
const divider = createElement("div");
|
|
2279
|
-
setAttribute(divider, "class", "vui-activityrail__divider");
|
|
2280
|
-
setAttribute(divider, "role", "separator");
|
|
2281
|
-
insertBefore(parent, divider, anchor);
|
|
1536
|
+
const divider = (0, import_vobs18.createElement)("div");
|
|
1537
|
+
(0, import_vobs18.setAttribute)(divider, "class", "vui-activityrail__divider");
|
|
1538
|
+
(0, import_vobs18.setAttribute)(divider, "role", "separator");
|
|
1539
|
+
(0, import_vobs18.insertBefore)(parent, divider, anchor);
|
|
2282
1540
|
continue;
|
|
2283
1541
|
}
|
|
2284
1542
|
if (item.spacer === true) {
|
|
2285
|
-
const spacer = createElement("span");
|
|
2286
|
-
setAttribute(spacer, "class", "vui-activityrail__spacer");
|
|
2287
|
-
insertBefore(parent, spacer, anchor);
|
|
1543
|
+
const spacer = (0, import_vobs18.createElement)("span");
|
|
1544
|
+
(0, import_vobs18.setAttribute)(spacer, "class", "vui-activityrail__spacer");
|
|
1545
|
+
(0, import_vobs18.insertBefore)(parent, spacer, anchor);
|
|
2288
1546
|
continue;
|
|
2289
1547
|
}
|
|
2290
|
-
insertBefore(parent, createActivityButton(item, props, selected, internalValue), anchor);
|
|
1548
|
+
(0, import_vobs18.insertBefore)(parent, createActivityButton(item, props, selected, internalValue), anchor);
|
|
2291
1549
|
}
|
|
2292
1550
|
});
|
|
2293
1551
|
}
|
|
2294
1552
|
__name(createActivityItems, "createActivityItems");
|
|
2295
1553
|
function createActivityButton(item, props, selected, internalValue) {
|
|
2296
|
-
const button = createElement("button");
|
|
1554
|
+
const button = (0, import_vobs18.createElement)("button");
|
|
2297
1555
|
const active = item.id !== void 0 && item.id === selected;
|
|
2298
|
-
setAttribute(button, "class", `vui-activityrail__btn${active ? " is-active" : ""}`);
|
|
2299
|
-
setAttribute(button, "type", "button");
|
|
1556
|
+
(0, import_vobs18.setAttribute)(button, "class", `vui-activityrail__btn${active ? " is-active" : ""}`);
|
|
1557
|
+
(0, import_vobs18.setAttribute)(button, "type", "button");
|
|
2300
1558
|
setOptionalAttribute(button, "aria-label", item.label);
|
|
2301
1559
|
setOptionalAttribute(button, "title", item.label);
|
|
2302
|
-
setAttribute(button, "aria-pressed", active ? "true" : "false");
|
|
1560
|
+
(0, import_vobs18.setAttribute)(button, "aria-pressed", active ? "true" : "false");
|
|
2303
1561
|
if (item.disabled === true) {
|
|
2304
|
-
setProperty(button, "disabled", true);
|
|
2305
|
-
setAttribute(button, "aria-disabled", "true");
|
|
1562
|
+
(0, import_vobs18.setProperty)(button, "disabled", true);
|
|
1563
|
+
(0, import_vobs18.setAttribute)(button, "aria-disabled", "true");
|
|
2306
1564
|
}
|
|
2307
1565
|
if (item.icon !== void 0) {
|
|
2308
|
-
const icon = createElement("span");
|
|
2309
|
-
setAttribute(icon, "class", "vui-activityrail__icon");
|
|
1566
|
+
const icon = (0, import_vobs18.createElement)("span");
|
|
1567
|
+
(0, import_vobs18.setAttribute)(icon, "class", "vui-activityrail__icon");
|
|
2310
1568
|
mountSlot(icon, item, "icon");
|
|
2311
|
-
insertBefore(button, icon, null);
|
|
1569
|
+
(0, import_vobs18.insertBefore)(button, icon, null);
|
|
2312
1570
|
} else if (item.label !== void 0) {
|
|
2313
|
-
insertBefore(button, createText(item.label), null);
|
|
1571
|
+
(0, import_vobs18.insertBefore)(button, (0, import_vobs18.createText)(item.label), null);
|
|
2314
1572
|
}
|
|
2315
|
-
addEventListener(button, "click", (event) => {
|
|
1573
|
+
(0, import_vobs18.addEventListener)(button, "click", (event) => {
|
|
2316
1574
|
if (item.disabled === true || item.id === void 0) return;
|
|
2317
1575
|
if (readProp(props, "value", void 0) === void 0) internalValue.value = item.id;
|
|
2318
1576
|
const handler = readProp(props, "onChange", void 0);
|
|
@@ -2332,10 +1590,12 @@ function activeId3(props, items, internalValue) {
|
|
|
2332
1590
|
__name(activeId3, "activeId");
|
|
2333
1591
|
|
|
2334
1592
|
// packages/ui/src/file-tree.ts
|
|
1593
|
+
var import_reactivity11 = require("@vobs/reactivity");
|
|
1594
|
+
var import_vobs19 = require("@vobs/vobs");
|
|
2335
1595
|
function FileTree(props = {}) {
|
|
2336
1596
|
const items = readProp(props, "items", []);
|
|
2337
|
-
const internalExpanded = state(initialExpanded(props, items));
|
|
2338
|
-
const root = createElement("div");
|
|
1597
|
+
const internalExpanded = (0, import_reactivity11.state)(initialExpanded(props, items));
|
|
1598
|
+
const root = (0, import_vobs19.createElement)("div");
|
|
2339
1599
|
bindClassList(root, props, () => ["vui-filetree"]);
|
|
2340
1600
|
bindCommonAttributes(root, props, [
|
|
2341
1601
|
"items",
|
|
@@ -2347,9 +1607,9 @@ function FileTree(props = {}) {
|
|
|
2347
1607
|
"onToggle"
|
|
2348
1608
|
]);
|
|
2349
1609
|
bindUserStyle(root, props);
|
|
2350
|
-
if (!hasProp(props, "role")) setAttribute(root, "role", "tree");
|
|
2351
|
-
if (!hasProp(props, "aria-label")) setAttribute(root, "aria-label", "Files");
|
|
2352
|
-
insertDynamic(root, null, () => createTreeRows(props, internalExpanded));
|
|
1610
|
+
if (!hasProp(props, "role")) (0, import_vobs19.setAttribute)(root, "role", "tree");
|
|
1611
|
+
if (!hasProp(props, "aria-label")) (0, import_vobs19.setAttribute)(root, "aria-label", "Files");
|
|
1612
|
+
(0, import_vobs19.insertDynamic)(root, null, () => createTreeRows(props, internalExpanded));
|
|
2353
1613
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2354
1614
|
return root;
|
|
2355
1615
|
}
|
|
@@ -2359,9 +1619,9 @@ function createTreeRows(props, internalExpanded) {
|
|
|
2359
1619
|
const expanded = new Set(readProp(props, "expanded", void 0) ?? internalExpanded.value);
|
|
2360
1620
|
const visible = flattenVisible(items, expanded);
|
|
2361
1621
|
const selected = activeId4(props, items);
|
|
2362
|
-
return createFragment((parent, anchor) => {
|
|
1622
|
+
return (0, import_vobs19.createFragment)((parent, anchor) => {
|
|
2363
1623
|
for (const entry of visible) {
|
|
2364
|
-
insertBefore(parent, createTreeRow(entry, props, internalExpanded, selected, expanded), anchor);
|
|
1624
|
+
(0, import_vobs19.insertBefore)(parent, createTreeRow(entry, props, internalExpanded, selected, expanded), anchor);
|
|
2365
1625
|
}
|
|
2366
1626
|
});
|
|
2367
1627
|
}
|
|
@@ -2371,34 +1631,34 @@ function createTreeRow(entry, props, internalExpanded, selected, expanded) {
|
|
|
2371
1631
|
const isFolder = item.kind === "folder";
|
|
2372
1632
|
const hasChildren = isFolder && Boolean(item.children?.length);
|
|
2373
1633
|
const active = item.id === selected;
|
|
2374
|
-
const row = createElement("div");
|
|
2375
|
-
setAttribute(row, "class", `vui-filetree__row${active ? " is-active" : ""}`);
|
|
2376
|
-
setAttribute(row, "role", "treeitem");
|
|
2377
|
-
setAttribute(row, "data-depth", String(entry.depth));
|
|
2378
|
-
setAttribute(row, "data-file-id", item.id);
|
|
2379
|
-
setProperty(row, "tabIndex", item.disabled === true ? -1 : 0);
|
|
2380
|
-
if (active) setAttribute(row, "aria-selected", "true");
|
|
2381
|
-
if (isFolder) setAttribute(row, "aria-expanded", entry.expanded ? "true" : "false");
|
|
2382
|
-
if (item.disabled === true) setAttribute(row, "aria-disabled", "true");
|
|
2383
|
-
const chevron = createElement("span");
|
|
2384
|
-
setAttribute(chevron, "class", `vui-filetree__chevron${hasChildren ? "" : " vui-filetree__chevron--leaf"}`);
|
|
1634
|
+
const row = (0, import_vobs19.createElement)("div");
|
|
1635
|
+
(0, import_vobs19.setAttribute)(row, "class", `vui-filetree__row${active ? " is-active" : ""}`);
|
|
1636
|
+
(0, import_vobs19.setAttribute)(row, "role", "treeitem");
|
|
1637
|
+
(0, import_vobs19.setAttribute)(row, "data-depth", String(entry.depth));
|
|
1638
|
+
(0, import_vobs19.setAttribute)(row, "data-file-id", item.id);
|
|
1639
|
+
(0, import_vobs19.setProperty)(row, "tabIndex", item.disabled === true ? -1 : 0);
|
|
1640
|
+
if (active) (0, import_vobs19.setAttribute)(row, "aria-selected", "true");
|
|
1641
|
+
if (isFolder) (0, import_vobs19.setAttribute)(row, "aria-expanded", entry.expanded ? "true" : "false");
|
|
1642
|
+
if (item.disabled === true) (0, import_vobs19.setAttribute)(row, "aria-disabled", "true");
|
|
1643
|
+
const chevron = (0, import_vobs19.createElement)("span");
|
|
1644
|
+
(0, import_vobs19.setAttribute)(chevron, "class", `vui-filetree__chevron${hasChildren ? "" : " vui-filetree__chevron--leaf"}`);
|
|
2385
1645
|
if (hasChildren) {
|
|
2386
1646
|
if (item.chevron !== void 0) mountSlot(chevron, item, "chevron");
|
|
2387
|
-
else insertBefore(chevron, createText(entry.expanded ? "v" : ">"), null);
|
|
1647
|
+
else (0, import_vobs19.insertBefore)(chevron, (0, import_vobs19.createText)(entry.expanded ? "v" : ">"), null);
|
|
2388
1648
|
}
|
|
2389
|
-
insertBefore(row, chevron, null);
|
|
1649
|
+
(0, import_vobs19.insertBefore)(row, chevron, null);
|
|
2390
1650
|
if (item.icon !== void 0) {
|
|
2391
|
-
const icon = createElement("span");
|
|
2392
|
-
setAttribute(icon, `class`, `vui-filetree__icon ${fileIconClass(item)}`.trim());
|
|
1651
|
+
const icon = (0, import_vobs19.createElement)("span");
|
|
1652
|
+
(0, import_vobs19.setAttribute)(icon, `class`, `vui-filetree__icon ${fileIconClass(item)}`.trim());
|
|
2393
1653
|
mountSlot(icon, item, "icon");
|
|
2394
|
-
insertBefore(row, icon, null);
|
|
1654
|
+
(0, import_vobs19.insertBefore)(row, icon, null);
|
|
2395
1655
|
}
|
|
2396
|
-
const label = createElement("span");
|
|
2397
|
-
setAttribute(label, "class", "vui-filetree__label");
|
|
1656
|
+
const label = (0, import_vobs19.createElement)("span");
|
|
1657
|
+
(0, import_vobs19.setAttribute)(label, "class", "vui-filetree__label");
|
|
2398
1658
|
setOptionalAttribute(label, "title", item.label);
|
|
2399
|
-
insertBefore(label, createText(item.label), null);
|
|
2400
|
-
insertBefore(row, label, null);
|
|
2401
|
-
addEventListener(row, "click", (event) => {
|
|
1659
|
+
(0, import_vobs19.insertBefore)(label, (0, import_vobs19.createText)(item.label), null);
|
|
1660
|
+
(0, import_vobs19.insertBefore)(row, label, null);
|
|
1661
|
+
(0, import_vobs19.addEventListener)(row, "click", (event) => {
|
|
2402
1662
|
if (item.disabled === true) return;
|
|
2403
1663
|
if (isFolder && hasChildren) {
|
|
2404
1664
|
const nextExpanded = !expanded.has(item.id);
|
|
@@ -2416,7 +1676,7 @@ function createTreeRow(entry, props, internalExpanded, selected, expanded) {
|
|
|
2416
1676
|
const onSelect = readProp(props, "onSelect", void 0);
|
|
2417
1677
|
if (typeof onSelect === "function") onSelect(item.id, event);
|
|
2418
1678
|
});
|
|
2419
|
-
addEventListener(row, "keydown", (event) => {
|
|
1679
|
+
(0, import_vobs19.addEventListener)(row, "keydown", (event) => {
|
|
2420
1680
|
const keyboardEvent = event;
|
|
2421
1681
|
if (keyboardEvent.key !== "Enter" && keyboardEvent.key !== " ") return;
|
|
2422
1682
|
keyboardEvent.preventDefault?.();
|
|
@@ -2479,9 +1739,11 @@ function fileIconClass(item) {
|
|
|
2479
1739
|
__name(fileIconClass, "fileIconClass");
|
|
2480
1740
|
|
|
2481
1741
|
// packages/ui/src/editor-tabs.ts
|
|
1742
|
+
var import_reactivity12 = require("@vobs/reactivity");
|
|
1743
|
+
var import_vobs20 = require("@vobs/vobs");
|
|
2482
1744
|
function EditorTabs(props = {}) {
|
|
2483
|
-
const root = createElement("div");
|
|
2484
|
-
const internalValue = state(void 0);
|
|
1745
|
+
const root = (0, import_vobs20.createElement)("div");
|
|
1746
|
+
const internalValue = (0, import_reactivity12.state)(void 0);
|
|
2485
1747
|
bindClassList(root, props, () => ["vui-editortabs"]);
|
|
2486
1748
|
bindCommonAttributes(root, props, [
|
|
2487
1749
|
"tabs",
|
|
@@ -2493,7 +1755,7 @@ function EditorTabs(props = {}) {
|
|
|
2493
1755
|
"onClose"
|
|
2494
1756
|
]);
|
|
2495
1757
|
bindUserStyle(root, props);
|
|
2496
|
-
insertDynamic(root, null, () => createEditorTabs(props, internalValue));
|
|
1758
|
+
(0, import_vobs20.insertDynamic)(root, null, () => createEditorTabs(props, internalValue));
|
|
2497
1759
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
2498
1760
|
return root;
|
|
2499
1761
|
}
|
|
@@ -2501,61 +1763,61 @@ __name(EditorTabs, "EditorTabs");
|
|
|
2501
1763
|
function createEditorTabs(props, internalValue) {
|
|
2502
1764
|
const tabs = readProp(props, "tabs", []);
|
|
2503
1765
|
const selected = activeId5(props, tabs, internalValue);
|
|
2504
|
-
return createFragment((parent, anchor) => {
|
|
1766
|
+
return (0, import_vobs20.createFragment)((parent, anchor) => {
|
|
2505
1767
|
for (const tab of tabs) {
|
|
2506
|
-
insertBefore(parent, createEditorTab(tab, tabs, selected, props, internalValue), anchor);
|
|
1768
|
+
(0, import_vobs20.insertBefore)(parent, createEditorTab(tab, tabs, selected, props, internalValue), anchor);
|
|
2507
1769
|
}
|
|
2508
|
-
const spacer = createElement("span");
|
|
2509
|
-
setAttribute(spacer, "class", "vui-editortabs__spacer");
|
|
2510
|
-
insertBefore(parent, spacer, anchor);
|
|
1770
|
+
const spacer = (0, import_vobs20.createElement)("span");
|
|
1771
|
+
(0, import_vobs20.setAttribute)(spacer, "class", "vui-editortabs__spacer");
|
|
1772
|
+
(0, import_vobs20.insertBefore)(parent, spacer, anchor);
|
|
2511
1773
|
if (hasProp(props, "actions")) {
|
|
2512
|
-
const actions = createElement("span");
|
|
2513
|
-
setAttribute(actions, "class", "vui-editortabs__actions");
|
|
1774
|
+
const actions = (0, import_vobs20.createElement)("span");
|
|
1775
|
+
(0, import_vobs20.setAttribute)(actions, "class", "vui-editortabs__actions");
|
|
2514
1776
|
mountSlot(actions, props, "actions");
|
|
2515
|
-
insertBefore(parent, actions, anchor);
|
|
1777
|
+
(0, import_vobs20.insertBefore)(parent, actions, anchor);
|
|
2516
1778
|
}
|
|
2517
1779
|
});
|
|
2518
1780
|
}
|
|
2519
1781
|
__name(createEditorTabs, "createEditorTabs");
|
|
2520
1782
|
function createEditorTab(tab, tabs, selected, props, internalValue) {
|
|
2521
1783
|
const active = tab.id === selected;
|
|
2522
|
-
const root = createElement("span");
|
|
2523
|
-
setAttribute(root, "class", `vui-editortab${active ? " is-active" : ""}`);
|
|
2524
|
-
setAttribute(root, "role", "tab");
|
|
2525
|
-
setAttribute(root, "aria-selected", active ? "true" : "false");
|
|
2526
|
-
setAttribute(root, "tabindex", active ? "0" : "-1");
|
|
1784
|
+
const root = (0, import_vobs20.createElement)("span");
|
|
1785
|
+
(0, import_vobs20.setAttribute)(root, "class", `vui-editortab${active ? " is-active" : ""}`);
|
|
1786
|
+
(0, import_vobs20.setAttribute)(root, "role", "tab");
|
|
1787
|
+
(0, import_vobs20.setAttribute)(root, "aria-selected", active ? "true" : "false");
|
|
1788
|
+
(0, import_vobs20.setAttribute)(root, "tabindex", active ? "0" : "-1");
|
|
2527
1789
|
setOptionalAttribute(root, "data-editor-tab-id", tab.id);
|
|
2528
|
-
if (tab.disabled === true) setAttribute(root, "aria-disabled", "true");
|
|
1790
|
+
if (tab.disabled === true) (0, import_vobs20.setAttribute)(root, "aria-disabled", "true");
|
|
2529
1791
|
if (tab.icon !== void 0) {
|
|
2530
|
-
const icon = createElement("span");
|
|
2531
|
-
setAttribute(icon, "class", "ic");
|
|
1792
|
+
const icon = (0, import_vobs20.createElement)("span");
|
|
1793
|
+
(0, import_vobs20.setAttribute)(icon, "class", "ic");
|
|
2532
1794
|
mountSlot(icon, tab, "icon");
|
|
2533
|
-
insertBefore(root, icon, null);
|
|
1795
|
+
(0, import_vobs20.insertBefore)(root, icon, null);
|
|
2534
1796
|
}
|
|
2535
|
-
const label = createElement("span");
|
|
2536
|
-
setAttribute(label, "class", "vui-editortab__label");
|
|
2537
|
-
insertBefore(label, createText(tab.label), null);
|
|
2538
|
-
insertBefore(root, label, null);
|
|
1797
|
+
const label = (0, import_vobs20.createElement)("span");
|
|
1798
|
+
(0, import_vobs20.setAttribute)(label, "class", "vui-editortab__label");
|
|
1799
|
+
(0, import_vobs20.insertBefore)(label, (0, import_vobs20.createText)(tab.label), null);
|
|
1800
|
+
(0, import_vobs20.insertBefore)(root, label, null);
|
|
2539
1801
|
if (tab.closeable === true) {
|
|
2540
|
-
const close = createElement("button");
|
|
2541
|
-
setAttribute(close, "class", "close");
|
|
2542
|
-
setAttribute(close, "type", "button");
|
|
2543
|
-
setAttribute(close, "aria-label", `Close ${tab.label}`);
|
|
1802
|
+
const close = (0, import_vobs20.createElement)("button");
|
|
1803
|
+
(0, import_vobs20.setAttribute)(close, "class", "close");
|
|
1804
|
+
(0, import_vobs20.setAttribute)(close, "type", "button");
|
|
1805
|
+
(0, import_vobs20.setAttribute)(close, "aria-label", `Close ${tab.label}`);
|
|
2544
1806
|
const closeIcon = tab.closeIcon ?? readProp(props, "closeIcon", void 0);
|
|
2545
|
-
const icon = closeIcon === void 0 ? createText("x") : resolveSlot(closeIcon);
|
|
2546
|
-
if (icon) insertBefore(close, icon, null);
|
|
2547
|
-
addEventListener(close, "click", (event) => {
|
|
1807
|
+
const icon = closeIcon === void 0 ? (0, import_vobs20.createText)("x") : resolveSlot(closeIcon);
|
|
1808
|
+
if (icon) (0, import_vobs20.insertBefore)(close, icon, null);
|
|
1809
|
+
(0, import_vobs20.addEventListener)(close, "click", (event) => {
|
|
2548
1810
|
event.stopPropagation?.();
|
|
2549
1811
|
const handler = readProp(props, "onClose", void 0);
|
|
2550
1812
|
if (typeof handler === "function") handler(tab.id, event);
|
|
2551
1813
|
});
|
|
2552
|
-
insertBefore(root, close, null);
|
|
1814
|
+
(0, import_vobs20.insertBefore)(root, close, null);
|
|
2553
1815
|
}
|
|
2554
|
-
addEventListener(root, "click", (event) => {
|
|
1816
|
+
(0, import_vobs20.addEventListener)(root, "click", (event) => {
|
|
2555
1817
|
if (tab.disabled === true) return;
|
|
2556
1818
|
selectTab(tab.id, props, internalValue, event);
|
|
2557
1819
|
});
|
|
2558
|
-
addEventListener(root, "keydown", (event) => {
|
|
1820
|
+
(0, import_vobs20.addEventListener)(root, "keydown", (event) => {
|
|
2559
1821
|
const keyboardEvent = event;
|
|
2560
1822
|
if (keyboardEvent.key === "Enter" || keyboardEvent.key === " ") {
|
|
2561
1823
|
keyboardEvent.preventDefault?.();
|
|
@@ -2597,10 +1859,11 @@ function activeId5(props, tabs, internalValue) {
|
|
|
2597
1859
|
__name(activeId5, "activeId");
|
|
2598
1860
|
|
|
2599
1861
|
// packages/ui/src/workbench-titlebar.ts
|
|
1862
|
+
var import_vobs21 = require("@vobs/vobs");
|
|
2600
1863
|
function WorkbenchTitlebar(props = {}) {
|
|
2601
|
-
const root = createElement("header");
|
|
2602
|
-
const left = createElement("div");
|
|
2603
|
-
const right = createElement("div");
|
|
1864
|
+
const root = (0, import_vobs21.createElement)("header");
|
|
1865
|
+
const left = (0, import_vobs21.createElement)("div");
|
|
1866
|
+
const right = (0, import_vobs21.createElement)("div");
|
|
2604
1867
|
bindClassList(root, props, () => ["vui-wbtitlebar"]);
|
|
2605
1868
|
bindCommonAttributes(root, props, [
|
|
2606
1869
|
"mode",
|
|
@@ -2616,50 +1879,50 @@ function WorkbenchTitlebar(props = {}) {
|
|
|
2616
1879
|
"onProjectClick"
|
|
2617
1880
|
]);
|
|
2618
1881
|
bindUserStyle(root, props);
|
|
2619
|
-
setAttribute(left, "class", "vui-wbtitlebar__left");
|
|
2620
|
-
setAttribute(right, "class", "vui-wbtitlebar__right");
|
|
2621
|
-
insertDynamic(left, null, () => createTitlebarLeft(props));
|
|
1882
|
+
(0, import_vobs21.setAttribute)(left, "class", "vui-wbtitlebar__left");
|
|
1883
|
+
(0, import_vobs21.setAttribute)(right, "class", "vui-wbtitlebar__right");
|
|
1884
|
+
(0, import_vobs21.insertDynamic)(left, null, () => createTitlebarLeft(props));
|
|
2622
1885
|
if (hasProp(props, "actions")) mountSlot(right, props, "actions");
|
|
2623
1886
|
if (hasProp(props, "children")) mountSlot(right, props, "children");
|
|
2624
|
-
insertBefore(root, left, null);
|
|
2625
|
-
insertBefore(root, right, null);
|
|
1887
|
+
(0, import_vobs21.insertBefore)(root, left, null);
|
|
1888
|
+
(0, import_vobs21.insertBefore)(root, right, null);
|
|
2626
1889
|
return root;
|
|
2627
1890
|
}
|
|
2628
1891
|
__name(WorkbenchTitlebar, "WorkbenchTitlebar");
|
|
2629
1892
|
function createTitlebarLeft(props) {
|
|
2630
|
-
return createFragment((parent, anchor) => {
|
|
1893
|
+
return (0, import_vobs21.createFragment)((parent, anchor) => {
|
|
2631
1894
|
if (readProp(props, "windowControls", true)) {
|
|
2632
|
-
const lights = createElement("div");
|
|
2633
|
-
setAttribute(lights, "class", "vui-wbtitlebar__lights");
|
|
2634
|
-
insertBefore(lights, createWindowLight("close", props, "onWindowClose"), null);
|
|
2635
|
-
insertBefore(lights, createWindowLight("min", props, "onWindowMinimize"), null);
|
|
2636
|
-
insertBefore(lights, createWindowLight("max", props, "onWindowMaximize"), null);
|
|
2637
|
-
insertBefore(parent, lights, anchor);
|
|
1895
|
+
const lights = (0, import_vobs21.createElement)("div");
|
|
1896
|
+
(0, import_vobs21.setAttribute)(lights, "class", "vui-wbtitlebar__lights");
|
|
1897
|
+
(0, import_vobs21.insertBefore)(lights, createWindowLight("close", props, "onWindowClose"), null);
|
|
1898
|
+
(0, import_vobs21.insertBefore)(lights, createWindowLight("min", props, "onWindowMinimize"), null);
|
|
1899
|
+
(0, import_vobs21.insertBefore)(lights, createWindowLight("max", props, "onWindowMaximize"), null);
|
|
1900
|
+
(0, import_vobs21.insertBefore)(parent, lights, anchor);
|
|
2638
1901
|
}
|
|
2639
1902
|
if (hasProp(props, "mode")) {
|
|
2640
|
-
const mode = createElement("span");
|
|
2641
|
-
setAttribute(mode, "class", "vui-wbtitlebar__mode-chip");
|
|
1903
|
+
const mode = (0, import_vobs21.createElement)("span");
|
|
1904
|
+
(0, import_vobs21.setAttribute)(mode, "class", "vui-wbtitlebar__mode-chip");
|
|
2642
1905
|
if (hasProp(props, "modeIcon")) {
|
|
2643
|
-
const icon = createElement("span");
|
|
2644
|
-
setAttribute(icon, "class", "vui-wbtitlebar__mode-icon");
|
|
1906
|
+
const icon = (0, import_vobs21.createElement)("span");
|
|
1907
|
+
(0, import_vobs21.setAttribute)(icon, "class", "vui-wbtitlebar__mode-icon");
|
|
2645
1908
|
mountSlot(icon, props, "modeIcon");
|
|
2646
|
-
insertBefore(mode, icon, null);
|
|
1909
|
+
(0, import_vobs21.insertBefore)(mode, icon, null);
|
|
2647
1910
|
}
|
|
2648
|
-
const text = createText("");
|
|
1911
|
+
const text = (0, import_vobs21.createText)("");
|
|
2649
1912
|
bindTextContent(text, () => readProp(props, "mode", ""));
|
|
2650
|
-
insertBefore(mode, text, null);
|
|
2651
|
-
insertBefore(parent, mode, anchor);
|
|
1913
|
+
(0, import_vobs21.insertBefore)(mode, text, null);
|
|
1914
|
+
(0, import_vobs21.insertBefore)(parent, mode, anchor);
|
|
2652
1915
|
}
|
|
2653
|
-
if (hasProp(props, "project")) insertBefore(parent, createProjectSelector(props), anchor);
|
|
1916
|
+
if (hasProp(props, "project")) (0, import_vobs21.insertBefore)(parent, createProjectSelector(props), anchor);
|
|
2654
1917
|
});
|
|
2655
1918
|
}
|
|
2656
1919
|
__name(createTitlebarLeft, "createTitlebarLeft");
|
|
2657
1920
|
function createWindowLight(kind, props, handlerName) {
|
|
2658
|
-
const light = createElement("button");
|
|
2659
|
-
setAttribute(light, "class", `vui-wbtitlebar__light vui-wbtitlebar__light--${kind}`);
|
|
2660
|
-
setAttribute(light, "type", "button");
|
|
2661
|
-
setAttribute(light, "aria-label", kind === "close" ? "Close window" : kind === "min" ? "Minimize window" : "Maximize window");
|
|
2662
|
-
addEventListener(light, "click", (event) => {
|
|
1921
|
+
const light = (0, import_vobs21.createElement)("button");
|
|
1922
|
+
(0, import_vobs21.setAttribute)(light, "class", `vui-wbtitlebar__light vui-wbtitlebar__light--${kind}`);
|
|
1923
|
+
(0, import_vobs21.setAttribute)(light, "type", "button");
|
|
1924
|
+
(0, import_vobs21.setAttribute)(light, "aria-label", kind === "close" ? "Close window" : kind === "min" ? "Minimize window" : "Maximize window");
|
|
1925
|
+
(0, import_vobs21.addEventListener)(light, "click", (event) => {
|
|
2663
1926
|
const handler = readProp(props, handlerName, void 0);
|
|
2664
1927
|
if (typeof handler === "function") handler(event);
|
|
2665
1928
|
});
|
|
@@ -2667,26 +1930,26 @@ function createWindowLight(kind, props, handlerName) {
|
|
|
2667
1930
|
}
|
|
2668
1931
|
__name(createWindowLight, "createWindowLight");
|
|
2669
1932
|
function createProjectSelector(props) {
|
|
2670
|
-
const button = createElement("button");
|
|
2671
|
-
setAttribute(button, "class", "vui-wbtitlebar__project-selector");
|
|
2672
|
-
setAttribute(button, "type", "button");
|
|
1933
|
+
const button = (0, import_vobs21.createElement)("button");
|
|
1934
|
+
(0, import_vobs21.setAttribute)(button, "class", "vui-wbtitlebar__project-selector");
|
|
1935
|
+
(0, import_vobs21.setAttribute)(button, "type", "button");
|
|
2673
1936
|
setOptionalAttribute(button, "aria-label", readProp(props, "project", "Project"));
|
|
2674
1937
|
if (hasProp(props, "projectIcon")) {
|
|
2675
|
-
const icon = createElement("span");
|
|
2676
|
-
setAttribute(icon, "class", "vui-wbtitlebar__project-icon");
|
|
1938
|
+
const icon = (0, import_vobs21.createElement)("span");
|
|
1939
|
+
(0, import_vobs21.setAttribute)(icon, "class", "vui-wbtitlebar__project-icon");
|
|
2677
1940
|
mountSlot(icon, props, "projectIcon");
|
|
2678
|
-
insertBefore(button, icon, null);
|
|
1941
|
+
(0, import_vobs21.insertBefore)(button, icon, null);
|
|
2679
1942
|
}
|
|
2680
|
-
const project = createText("");
|
|
1943
|
+
const project = (0, import_vobs21.createText)("");
|
|
2681
1944
|
bindTextContent(project, () => readProp(props, "project", ""));
|
|
2682
|
-
insertBefore(button, project, null);
|
|
1945
|
+
(0, import_vobs21.insertBefore)(button, project, null);
|
|
2683
1946
|
if (hasProp(props, "projectChevron")) {
|
|
2684
|
-
const chevron = createElement("span");
|
|
2685
|
-
setAttribute(chevron, "class", "vui-wbtitlebar__project-chevron");
|
|
1947
|
+
const chevron = (0, import_vobs21.createElement)("span");
|
|
1948
|
+
(0, import_vobs21.setAttribute)(chevron, "class", "vui-wbtitlebar__project-chevron");
|
|
2686
1949
|
mountSlot(chevron, props, "projectChevron");
|
|
2687
|
-
insertBefore(button, chevron, null);
|
|
1950
|
+
(0, import_vobs21.insertBefore)(button, chevron, null);
|
|
2688
1951
|
}
|
|
2689
|
-
addEventListener(button, "click", (event) => {
|
|
1952
|
+
(0, import_vobs21.addEventListener)(button, "click", (event) => {
|
|
2690
1953
|
const handler = readProp(props, "onProjectClick", void 0);
|
|
2691
1954
|
if (typeof handler === "function") handler(event);
|
|
2692
1955
|
});
|
|
@@ -2695,56 +1958,57 @@ function createProjectSelector(props) {
|
|
|
2695
1958
|
__name(createProjectSelector, "createProjectSelector");
|
|
2696
1959
|
|
|
2697
1960
|
// packages/ui/src/status-bar.ts
|
|
1961
|
+
var import_vobs22 = require("@vobs/vobs");
|
|
2698
1962
|
function StatusBar(props = {}) {
|
|
2699
|
-
const root = createElement("footer");
|
|
1963
|
+
const root = (0, import_vobs22.createElement)("footer");
|
|
2700
1964
|
bindClassList(root, props, () => ["vui-statusbar"]);
|
|
2701
1965
|
bindCommonAttributes(root, props, ["left", "right", "onItemClick"]);
|
|
2702
1966
|
bindUserStyle(root, props);
|
|
2703
|
-
setAttribute(root, "role", "status");
|
|
2704
|
-
if (hasProp(props, "left")) insertDynamic(root, null, () => createStatusGroup(props, "left"));
|
|
1967
|
+
(0, import_vobs22.setAttribute)(root, "role", "status");
|
|
1968
|
+
if (hasProp(props, "left")) (0, import_vobs22.insertDynamic)(root, null, () => createStatusGroup(props, "left"));
|
|
2705
1969
|
if (hasProp(props, "right") || hasProp(props, "children")) {
|
|
2706
|
-
const group = createElement("div");
|
|
2707
|
-
setAttribute(group, "class", "vui-statusbar__group");
|
|
2708
|
-
if (hasProp(props, "right")) insertDynamic(group, null, () => createStatusItems(props, "right"));
|
|
1970
|
+
const group = (0, import_vobs22.createElement)("div");
|
|
1971
|
+
(0, import_vobs22.setAttribute)(group, "class", "vui-statusbar__group");
|
|
1972
|
+
if (hasProp(props, "right")) (0, import_vobs22.insertDynamic)(group, null, () => createStatusItems(props, "right"));
|
|
2709
1973
|
if (hasProp(props, "children")) mountSlot(group, props, "children");
|
|
2710
|
-
insertBefore(root, group, null);
|
|
1974
|
+
(0, import_vobs22.insertBefore)(root, group, null);
|
|
2711
1975
|
}
|
|
2712
1976
|
return root;
|
|
2713
1977
|
}
|
|
2714
1978
|
__name(StatusBar, "StatusBar");
|
|
2715
1979
|
function createStatusGroup(props, side) {
|
|
2716
|
-
const group = createElement("div");
|
|
2717
|
-
setAttribute(group, "class", "vui-statusbar__group");
|
|
2718
|
-
insertDynamic(group, null, () => createStatusItems(props, side));
|
|
1980
|
+
const group = (0, import_vobs22.createElement)("div");
|
|
1981
|
+
(0, import_vobs22.setAttribute)(group, "class", "vui-statusbar__group");
|
|
1982
|
+
(0, import_vobs22.insertDynamic)(group, null, () => createStatusItems(props, side));
|
|
2719
1983
|
return group;
|
|
2720
1984
|
}
|
|
2721
1985
|
__name(createStatusGroup, "createStatusGroup");
|
|
2722
1986
|
function createStatusItems(props, side) {
|
|
2723
1987
|
const items = side === "left" ? readProp(props, "left", []) : readProp(props, "right", []);
|
|
2724
|
-
return createFragment((parent, anchor) => {
|
|
2725
|
-
for (const item of items) insertBefore(parent, createStatusItem(item, props), anchor);
|
|
1988
|
+
return (0, import_vobs22.createFragment)((parent, anchor) => {
|
|
1989
|
+
for (const item of items) (0, import_vobs22.insertBefore)(parent, createStatusItem(item, props), anchor);
|
|
2726
1990
|
});
|
|
2727
1991
|
}
|
|
2728
1992
|
__name(createStatusItems, "createStatusItems");
|
|
2729
1993
|
function createStatusItem(item, props) {
|
|
2730
|
-
const root = createElement("span");
|
|
2731
|
-
setAttribute(root, "class", "vui-statusbar__item");
|
|
1994
|
+
const root = (0, import_vobs22.createElement)("span");
|
|
1995
|
+
(0, import_vobs22.setAttribute)(root, "class", "vui-statusbar__item");
|
|
2732
1996
|
if (item.id !== void 0 && readProp(props, "onItemClick", void 0)) {
|
|
2733
|
-
setAttribute(root, "role", "button");
|
|
2734
|
-
setAttribute(root, "tabindex", item.disabled === true ? "-1" : "0");
|
|
1997
|
+
(0, import_vobs22.setAttribute)(root, "role", "button");
|
|
1998
|
+
(0, import_vobs22.setAttribute)(root, "tabindex", item.disabled === true ? "-1" : "0");
|
|
2735
1999
|
}
|
|
2736
|
-
if (item.disabled === true) setAttribute(root, "aria-disabled", "true");
|
|
2000
|
+
if (item.disabled === true) (0, import_vobs22.setAttribute)(root, "aria-disabled", "true");
|
|
2737
2001
|
if (item.icon !== void 0) {
|
|
2738
|
-
const icon = createElement("span");
|
|
2739
|
-
setAttribute(icon, "class", "vui-statusbar__icon");
|
|
2002
|
+
const icon = (0, import_vobs22.createElement)("span");
|
|
2003
|
+
(0, import_vobs22.setAttribute)(icon, "class", "vui-statusbar__icon");
|
|
2740
2004
|
mountSlot(icon, item, "icon");
|
|
2741
|
-
insertBefore(root, icon, null);
|
|
2005
|
+
(0, import_vobs22.insertBefore)(root, icon, null);
|
|
2742
2006
|
}
|
|
2743
2007
|
if (item.dot !== void 0) {
|
|
2744
|
-
const dot = createElement("span");
|
|
2745
|
-
setAttribute(dot, "class", `vui-statusbar__dot vui-statusbar__dot--${item.dot}`);
|
|
2746
|
-
setAttribute(dot, "aria-hidden", "true");
|
|
2747
|
-
insertBefore(root, dot, null);
|
|
2008
|
+
const dot = (0, import_vobs22.createElement)("span");
|
|
2009
|
+
(0, import_vobs22.setAttribute)(dot, "class", `vui-statusbar__dot vui-statusbar__dot--${item.dot}`);
|
|
2010
|
+
(0, import_vobs22.setAttribute)(dot, "aria-hidden", "true");
|
|
2011
|
+
(0, import_vobs22.insertBefore)(root, dot, null);
|
|
2748
2012
|
}
|
|
2749
2013
|
if (item.label !== void 0) mountSlot(root, item, "label");
|
|
2750
2014
|
const activate = /* @__PURE__ */ __name((event) => {
|
|
@@ -2753,8 +2017,8 @@ function createStatusItem(item, props) {
|
|
|
2753
2017
|
if (typeof handler === "function") handler(item.id, event);
|
|
2754
2018
|
}, "activate");
|
|
2755
2019
|
if (item.id !== void 0) {
|
|
2756
|
-
addEventListener(root, "click", activate);
|
|
2757
|
-
addEventListener(root, "keydown", (event) => {
|
|
2020
|
+
(0, import_vobs22.addEventListener)(root, "click", activate);
|
|
2021
|
+
(0, import_vobs22.addEventListener)(root, "keydown", (event) => {
|
|
2758
2022
|
const keyboardEvent = event;
|
|
2759
2023
|
if (keyboardEvent.key !== "Enter" && keyboardEvent.key !== " ") return;
|
|
2760
2024
|
keyboardEvent.preventDefault?.();
|
|
@@ -2766,12 +2030,14 @@ function createStatusItem(item, props) {
|
|
|
2766
2030
|
__name(createStatusItem, "createStatusItem");
|
|
2767
2031
|
|
|
2768
2032
|
// packages/ui/src/chat-composer.ts
|
|
2033
|
+
var import_reactivity13 = require("@vobs/reactivity");
|
|
2034
|
+
var import_vobs23 = require("@vobs/vobs");
|
|
2769
2035
|
function ChatComposer(props = {}) {
|
|
2770
|
-
const root = createElement("div");
|
|
2771
|
-
const input = createElement("textarea");
|
|
2772
|
-
const toolbar = createElement("div");
|
|
2773
|
-
const tools = createElement("div");
|
|
2774
|
-
const actions = createElement("div");
|
|
2036
|
+
const root = (0, import_vobs23.createElement)("div");
|
|
2037
|
+
const input = (0, import_vobs23.createElement)("textarea");
|
|
2038
|
+
const toolbar = (0, import_vobs23.createElement)("div");
|
|
2039
|
+
const tools = (0, import_vobs23.createElement)("div");
|
|
2040
|
+
const actions = (0, import_vobs23.createElement)("div");
|
|
2775
2041
|
bindClassList(root, props, () => ["vui-composer"]);
|
|
2776
2042
|
bindUserStyle(root, props);
|
|
2777
2043
|
bindCommonAttributes(input, props, [
|
|
@@ -2790,11 +2056,11 @@ function ChatComposer(props = {}) {
|
|
|
2790
2056
|
"onSend",
|
|
2791
2057
|
"onModelClick"
|
|
2792
2058
|
]);
|
|
2793
|
-
setAttribute(input, "class", "vui-composer__input");
|
|
2794
|
-
setAttribute(toolbar, "class", "vui-composer__toolbar");
|
|
2795
|
-
setAttribute(tools, "class", "vui-composer__tools");
|
|
2796
|
-
setAttribute(actions, "class", "vui-composer__actions");
|
|
2797
|
-
effect(() => {
|
|
2059
|
+
(0, import_vobs23.setAttribute)(input, "class", "vui-composer__input");
|
|
2060
|
+
(0, import_vobs23.setAttribute)(toolbar, "class", "vui-composer__toolbar");
|
|
2061
|
+
(0, import_vobs23.setAttribute)(tools, "class", "vui-composer__tools");
|
|
2062
|
+
(0, import_vobs23.setAttribute)(actions, "class", "vui-composer__actions");
|
|
2063
|
+
(0, import_reactivity13.effect)(() => {
|
|
2798
2064
|
setOptionalAttribute(input, "placeholder", readProp(props, "placeholder", void 0));
|
|
2799
2065
|
setOptionalProperty(input, "disabled", readProp(props, "disabled", false));
|
|
2800
2066
|
setOptionalAttribute(input, "aria-disabled", readProp(props, "disabled", false) ? "true" : void 0);
|
|
@@ -2803,7 +2069,7 @@ function ChatComposer(props = {}) {
|
|
|
2803
2069
|
bindPropertyValue(input, "value", () => readProp(props, "value", "") ?? "");
|
|
2804
2070
|
}
|
|
2805
2071
|
listen(input, "input", props, "onInput", () => readProp(props, "disabled", false));
|
|
2806
|
-
addEventListener(input, "keydown", (event) => {
|
|
2072
|
+
(0, import_vobs23.addEventListener)(input, "keydown", (event) => {
|
|
2807
2073
|
const keyboardEvent = event;
|
|
2808
2074
|
if (keyboardEvent.key !== "Enter" || !keyboardEvent.metaKey && !keyboardEvent.ctrlKey) return;
|
|
2809
2075
|
keyboardEvent.preventDefault?.();
|
|
@@ -2812,36 +2078,36 @@ function ChatComposer(props = {}) {
|
|
|
2812
2078
|
});
|
|
2813
2079
|
if (hasProp(props, "tools")) mountSlot(tools, props, "tools");
|
|
2814
2080
|
else if (hasProp(props, "children")) mountSlot(tools, props, "children");
|
|
2815
|
-
if (hasProp(props, "model")) insertBefore(tools, createModelSelector(props), null);
|
|
2081
|
+
if (hasProp(props, "model")) (0, import_vobs23.insertBefore)(tools, createModelSelector(props), null);
|
|
2816
2082
|
if (hasProp(props, "actions")) mountSlot(actions, props, "actions");
|
|
2817
|
-
else insertBefore(actions, createSendButton(input, props), null);
|
|
2818
|
-
insertBefore(root, input, null);
|
|
2819
|
-
insertBefore(toolbar, tools, null);
|
|
2820
|
-
insertBefore(toolbar, actions, null);
|
|
2821
|
-
insertBefore(root, toolbar, null);
|
|
2083
|
+
else (0, import_vobs23.insertBefore)(actions, createSendButton(input, props), null);
|
|
2084
|
+
(0, import_vobs23.insertBefore)(root, input, null);
|
|
2085
|
+
(0, import_vobs23.insertBefore)(toolbar, tools, null);
|
|
2086
|
+
(0, import_vobs23.insertBefore)(toolbar, actions, null);
|
|
2087
|
+
(0, import_vobs23.insertBefore)(root, toolbar, null);
|
|
2822
2088
|
return root;
|
|
2823
2089
|
}
|
|
2824
2090
|
__name(ChatComposer, "ChatComposer");
|
|
2825
2091
|
function createModelSelector(props) {
|
|
2826
|
-
const button = createElement("button");
|
|
2827
|
-
setAttribute(button, "class", "vui-composer__model");
|
|
2828
|
-
setAttribute(button, "type", "button");
|
|
2092
|
+
const button = (0, import_vobs23.createElement)("button");
|
|
2093
|
+
(0, import_vobs23.setAttribute)(button, "class", "vui-composer__model");
|
|
2094
|
+
(0, import_vobs23.setAttribute)(button, "type", "button");
|
|
2829
2095
|
if (hasProp(props, "modelIcon")) {
|
|
2830
|
-
const icon = createElement("span");
|
|
2831
|
-
setAttribute(icon, "class", "vui-composer__model-icon");
|
|
2096
|
+
const icon = (0, import_vobs23.createElement)("span");
|
|
2097
|
+
(0, import_vobs23.setAttribute)(icon, "class", "vui-composer__model-icon");
|
|
2832
2098
|
mountSlot(icon, props, "modelIcon");
|
|
2833
|
-
insertBefore(button, icon, null);
|
|
2099
|
+
(0, import_vobs23.insertBefore)(button, icon, null);
|
|
2834
2100
|
}
|
|
2835
|
-
const text = createText("");
|
|
2101
|
+
const text = (0, import_vobs23.createText)("");
|
|
2836
2102
|
bindTextContent(text, () => readProp(props, "model", ""));
|
|
2837
|
-
insertBefore(button, text, null);
|
|
2103
|
+
(0, import_vobs23.insertBefore)(button, text, null);
|
|
2838
2104
|
if (hasProp(props, "modelChevron")) {
|
|
2839
|
-
const chevron = createElement("span");
|
|
2840
|
-
setAttribute(chevron, "class", "vui-composer__model-chevron");
|
|
2105
|
+
const chevron = (0, import_vobs23.createElement)("span");
|
|
2106
|
+
(0, import_vobs23.setAttribute)(chevron, "class", "vui-composer__model-chevron");
|
|
2841
2107
|
mountSlot(chevron, props, "modelChevron");
|
|
2842
|
-
insertBefore(button, chevron, null);
|
|
2108
|
+
(0, import_vobs23.insertBefore)(button, chevron, null);
|
|
2843
2109
|
}
|
|
2844
|
-
addEventListener(button, "click", (event) => {
|
|
2110
|
+
(0, import_vobs23.addEventListener)(button, "click", (event) => {
|
|
2845
2111
|
const handler = readProp(props, "onModelClick", void 0);
|
|
2846
2112
|
if (typeof handler === "function") handler(event);
|
|
2847
2113
|
});
|
|
@@ -2849,21 +2115,21 @@ function createModelSelector(props) {
|
|
|
2849
2115
|
}
|
|
2850
2116
|
__name(createModelSelector, "createModelSelector");
|
|
2851
2117
|
function createSendButton(input, props) {
|
|
2852
|
-
const button = createElement("button");
|
|
2853
|
-
setAttribute(button, "class", "vui-composer__send");
|
|
2854
|
-
setAttribute(button, "type", "button");
|
|
2118
|
+
const button = (0, import_vobs23.createElement)("button");
|
|
2119
|
+
(0, import_vobs23.setAttribute)(button, "class", "vui-composer__send");
|
|
2120
|
+
(0, import_vobs23.setAttribute)(button, "type", "button");
|
|
2855
2121
|
const label = readProp(props, "sendLabel", "Send");
|
|
2856
2122
|
setOptionalAttribute(button, "aria-label", label);
|
|
2857
2123
|
if (hasProp(props, "sendIcon")) {
|
|
2858
|
-
const icon = createElement("span");
|
|
2859
|
-
setAttribute(icon, "class", "vui-composer__send-icon");
|
|
2124
|
+
const icon = (0, import_vobs23.createElement)("span");
|
|
2125
|
+
(0, import_vobs23.setAttribute)(icon, "class", "vui-composer__send-icon");
|
|
2860
2126
|
mountSlot(icon, props, "sendIcon");
|
|
2861
|
-
insertBefore(button, icon, null);
|
|
2127
|
+
(0, import_vobs23.insertBefore)(button, icon, null);
|
|
2862
2128
|
} else {
|
|
2863
|
-
insertBefore(button, createText(label), null);
|
|
2129
|
+
(0, import_vobs23.insertBefore)(button, (0, import_vobs23.createText)(label), null);
|
|
2864
2130
|
}
|
|
2865
|
-
effect(() => setProperty(button, "disabled", readProp(props, "disabled", false)));
|
|
2866
|
-
addEventListener(button, "click", (event) => {
|
|
2131
|
+
(0, import_reactivity13.effect)(() => (0, import_vobs23.setProperty)(button, "disabled", readProp(props, "disabled", false)));
|
|
2132
|
+
(0, import_vobs23.addEventListener)(button, "click", (event) => {
|
|
2867
2133
|
if (readProp(props, "disabled", false)) return;
|
|
2868
2134
|
const handler = readProp(props, "onSend", void 0);
|
|
2869
2135
|
if (typeof handler === "function") handler(currentValue(input, props), event);
|
|
@@ -2878,10 +2144,12 @@ function currentValue(input, props) {
|
|
|
2878
2144
|
__name(currentValue, "currentValue");
|
|
2879
2145
|
|
|
2880
2146
|
// packages/ui/src/drawer.ts
|
|
2147
|
+
var import_reactivity14 = require("@vobs/reactivity");
|
|
2148
|
+
var import_vobs24 = require("@vobs/vobs");
|
|
2881
2149
|
function Drawer(props = {}) {
|
|
2882
|
-
const root = createElement("div");
|
|
2883
|
-
const surface = createElement("aside");
|
|
2884
|
-
const body = createElement("div");
|
|
2150
|
+
const root = (0, import_vobs24.createElement)("div");
|
|
2151
|
+
const surface = (0, import_vobs24.createElement)("aside");
|
|
2152
|
+
const body = (0, import_vobs24.createElement)("div");
|
|
2885
2153
|
bindClassList(root, props, () => ["vui-backdrop"]);
|
|
2886
2154
|
bindUserStyle(root, props);
|
|
2887
2155
|
bindCommonAttributes(surface, props, [
|
|
@@ -2899,11 +2167,11 @@ function Drawer(props = {}) {
|
|
|
2899
2167
|
"portal",
|
|
2900
2168
|
"portalTarget"
|
|
2901
2169
|
]);
|
|
2902
|
-
setAttribute(root, "role", "presentation");
|
|
2903
|
-
setAttribute(surface, "class", "vui-drawer");
|
|
2904
|
-
setAttribute(surface, "role", "dialog");
|
|
2905
|
-
setAttribute(body, "class", "vui-drawer__body");
|
|
2906
|
-
effect(() => {
|
|
2170
|
+
(0, import_vobs24.setAttribute)(root, "role", "presentation");
|
|
2171
|
+
(0, import_vobs24.setAttribute)(surface, "class", "vui-drawer");
|
|
2172
|
+
(0, import_vobs24.setAttribute)(surface, "role", "dialog");
|
|
2173
|
+
(0, import_vobs24.setAttribute)(body, "class", "vui-drawer__body");
|
|
2174
|
+
(0, import_reactivity14.effect)(() => {
|
|
2907
2175
|
const open = readProp(props, "open", false);
|
|
2908
2176
|
const modal = readProp(props, "modal", true);
|
|
2909
2177
|
setOptionalProperty(root, "hidden", !open);
|
|
@@ -2914,41 +2182,41 @@ function Drawer(props = {}) {
|
|
|
2914
2182
|
setOptionalAttribute(surface, "data-side", readProp(props, "side", "right"));
|
|
2915
2183
|
});
|
|
2916
2184
|
if (hasProp(props, "title") || hasProp(props, "onClose")) {
|
|
2917
|
-
const head = createElement("header");
|
|
2918
|
-
setAttribute(head, "class", "vui-drawer__head");
|
|
2185
|
+
const head = (0, import_vobs24.createElement)("header");
|
|
2186
|
+
(0, import_vobs24.setAttribute)(head, "class", "vui-drawer__head");
|
|
2919
2187
|
if (hasProp(props, "title")) {
|
|
2920
|
-
const title = createElement("div");
|
|
2921
|
-
const text = createText("");
|
|
2922
|
-
setAttribute(title, "class", "vui-dialog__title");
|
|
2188
|
+
const title = (0, import_vobs24.createElement)("div");
|
|
2189
|
+
const text = (0, import_vobs24.createText)("");
|
|
2190
|
+
(0, import_vobs24.setAttribute)(title, "class", "vui-dialog__title");
|
|
2923
2191
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
2924
|
-
insertBefore(title, text, null);
|
|
2925
|
-
insertBefore(head, title, null);
|
|
2192
|
+
(0, import_vobs24.insertBefore)(title, text, null);
|
|
2193
|
+
(0, import_vobs24.insertBefore)(head, title, null);
|
|
2926
2194
|
}
|
|
2927
2195
|
if (hasProp(props, "onClose")) {
|
|
2928
|
-
const close = createElement("button");
|
|
2929
|
-
setAttribute(close, "class", "vui-dialog__close");
|
|
2930
|
-
setAttribute(close, "type", "button");
|
|
2931
|
-
setAttribute(close, "aria-label", readProp(props, "closeLabel", "Close"));
|
|
2932
|
-
insertBefore(close, createText("x"), null);
|
|
2933
|
-
addEventListener(close, "click", () => emitClose2(props, "close-button"));
|
|
2934
|
-
insertBefore(head, close, null);
|
|
2196
|
+
const close = (0, import_vobs24.createElement)("button");
|
|
2197
|
+
(0, import_vobs24.setAttribute)(close, "class", "vui-dialog__close");
|
|
2198
|
+
(0, import_vobs24.setAttribute)(close, "type", "button");
|
|
2199
|
+
(0, import_vobs24.setAttribute)(close, "aria-label", readProp(props, "closeLabel", "Close"));
|
|
2200
|
+
(0, import_vobs24.insertBefore)(close, (0, import_vobs24.createText)("x"), null);
|
|
2201
|
+
(0, import_vobs24.addEventListener)(close, "click", () => emitClose2(props, "close-button"));
|
|
2202
|
+
(0, import_vobs24.insertBefore)(head, close, null);
|
|
2935
2203
|
}
|
|
2936
|
-
insertBefore(surface, head, null);
|
|
2204
|
+
(0, import_vobs24.insertBefore)(surface, head, null);
|
|
2937
2205
|
}
|
|
2938
2206
|
if (hasProp(props, "children")) mountSlot(body, props, "children");
|
|
2939
|
-
insertBefore(surface, body, null);
|
|
2207
|
+
(0, import_vobs24.insertBefore)(surface, body, null);
|
|
2940
2208
|
if (hasProp(props, "footer")) {
|
|
2941
|
-
const footer = createElement("footer");
|
|
2942
|
-
setAttribute(footer, "class", "vui-dialog__foot");
|
|
2209
|
+
const footer = (0, import_vobs24.createElement)("footer");
|
|
2210
|
+
(0, import_vobs24.setAttribute)(footer, "class", "vui-dialog__foot");
|
|
2943
2211
|
mountSlot(footer, props, "footer");
|
|
2944
|
-
insertBefore(surface, footer, null);
|
|
2212
|
+
(0, import_vobs24.insertBefore)(surface, footer, null);
|
|
2945
2213
|
}
|
|
2946
|
-
insertBefore(root, surface, null);
|
|
2947
|
-
addEventListener(root, "click", (event) => {
|
|
2214
|
+
(0, import_vobs24.insertBefore)(root, surface, null);
|
|
2215
|
+
(0, import_vobs24.addEventListener)(root, "click", (event) => {
|
|
2948
2216
|
if (event.target !== root) return;
|
|
2949
2217
|
if (readProp(props, "closeOnBackdrop", true)) emitClose2(props, "backdrop");
|
|
2950
2218
|
});
|
|
2951
|
-
addEventListener(root, "keydown", (event) => {
|
|
2219
|
+
(0, import_vobs24.addEventListener)(root, "keydown", (event) => {
|
|
2952
2220
|
if (event.key !== "Escape") return;
|
|
2953
2221
|
if (readProp(props, "closeOnEscape", true)) emitClose2(props, "escape");
|
|
2954
2222
|
});
|
|
@@ -2963,135 +2231,15 @@ function emitClose2(props, reason) {
|
|
|
2963
2231
|
}
|
|
2964
2232
|
__name(emitClose2, "emitClose");
|
|
2965
2233
|
|
|
2966
|
-
// packages/
|
|
2967
|
-
var
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
this.name = "NotificationError";
|
|
2971
|
-
this.code = code;
|
|
2972
|
-
}
|
|
2973
|
-
};
|
|
2974
|
-
__name(_NotificationError, "NotificationError");
|
|
2975
|
-
var NotificationError = _NotificationError;
|
|
2976
|
-
var NOTIFICATION_KEY = createInjectionKey("vobs.notification");
|
|
2977
|
-
function useNotification() {
|
|
2978
|
-
const notification = inject(NOTIFICATION_KEY);
|
|
2979
|
-
if (!notification) {
|
|
2980
|
-
throw new NotificationError("NOTIFICATION_CONTEXT_MISSING", "Vobs Notification: \u627E\u4E0D\u5230\u4E0A\u4E0B\u6587\uFF0C\u8BF7\u5B89\u88C5 notificationPlugin");
|
|
2981
|
-
}
|
|
2982
|
-
return notification;
|
|
2983
|
-
}
|
|
2984
|
-
__name(useNotification, "useNotification");
|
|
2985
|
-
|
|
2986
|
-
// packages/icon-core/src/index.ts
|
|
2987
|
-
function createIcon(name, path, viewBox = "0 0 24 24") {
|
|
2988
|
-
return { name, path, viewBox };
|
|
2989
|
-
}
|
|
2990
|
-
__name(createIcon, "createIcon");
|
|
2991
|
-
function createSvgIconNode(source, props = {}, options = {}) {
|
|
2992
|
-
const root = createElement("span");
|
|
2993
|
-
effect(() => {
|
|
2994
|
-
updateSvgIconNode(root, typeof source === "function" ? source() : source, props, options);
|
|
2995
|
-
});
|
|
2996
|
-
return root;
|
|
2997
|
-
}
|
|
2998
|
-
__name(createSvgIconNode, "createSvgIconNode");
|
|
2999
|
-
function updateSvgIconNode(root, definition, props, options) {
|
|
3000
|
-
const size = readProp2(props, "size", void 0);
|
|
3001
|
-
const width = readProp2(props, "width", size);
|
|
3002
|
-
const height = readProp2(props, "height", size);
|
|
3003
|
-
const normalizedWidth = normalizeSvgLength(width);
|
|
3004
|
-
const normalizedHeight = normalizeSvgLength(height);
|
|
3005
|
-
const userClass = [
|
|
3006
|
-
readProp2(props, "class", void 0),
|
|
3007
|
-
readProp2(props, "className", void 0)
|
|
3008
|
-
].filter(hasText).join(" ");
|
|
3009
|
-
const className = [options.class, options.className, userClass].filter(hasText).join(" ");
|
|
3010
|
-
setAttribute(root, "class", className);
|
|
3011
|
-
const internalStyle = size === void 0 ? "" : `width: ${normalizeCssLength(size)}; height: ${normalizeCssLength(size)}`;
|
|
3012
|
-
const userStyle = readProp2(props, "style", void 0);
|
|
3013
|
-
const style = [internalStyle, userStyle].filter(hasText).join("; ");
|
|
3014
|
-
setOptionalAttribute2(root, "style", style || void 0);
|
|
3015
|
-
const managedAttributes2 = /* @__PURE__ */ new Map();
|
|
3016
|
-
for (const name of Object.keys(props)) {
|
|
3017
|
-
if (name === "class" || name === "className" || name === "style" || name === "children") continue;
|
|
3018
|
-
if (!name.startsWith("aria-") && !name.startsWith("data-") && !["id", "title", "role", "tabIndex"].includes(name)) continue;
|
|
3019
|
-
const value = Reflect.get(props, name);
|
|
3020
|
-
if (value === void 0 || value === null || value === false) continue;
|
|
3021
|
-
managedAttributes2.set(name === "tabIndex" ? "tabindex" : name, String(value));
|
|
3022
|
-
}
|
|
3023
|
-
for (const [name, value] of managedAttributes2) setAttribute(root, name, value);
|
|
3024
|
-
clearStaleAttributes(root, managedAttributes2);
|
|
3025
|
-
const title = readProp2(props, "title", void 0);
|
|
3026
|
-
const ariaLabel = Reflect.get(props, "aria-label");
|
|
3027
|
-
const decorative = readProp2(props, "decorative", title === void 0 && ariaLabel === void 0);
|
|
3028
|
-
setOptionalAttribute2(root, "aria-hidden", decorative ? "true" : void 0);
|
|
3029
|
-
setOptionalAttribute2(root, "aria-label", ariaLabel === void 0 ? title : void 0);
|
|
3030
|
-
setOptionalAttribute2(root, "data-icon-name", options.dataIconName ?? definition?.name);
|
|
3031
|
-
setOptionalAttribute2(root, "color", readProp2(props, "color", void 0));
|
|
3032
|
-
if (!definition) {
|
|
3033
|
-
setProperty(root, "innerHTML", "");
|
|
3034
|
-
return;
|
|
3035
|
-
}
|
|
3036
|
-
const svgAttributes = {
|
|
3037
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3038
|
-
viewBox: definition.viewBox ?? "0 0 24 24",
|
|
3039
|
-
...options.defaultSvgAttributes,
|
|
3040
|
-
...definition.attributes,
|
|
3041
|
-
...normalizedWidth === void 0 ? {} : { width: normalizedWidth },
|
|
3042
|
-
...normalizedHeight === void 0 ? {} : { height: normalizedHeight },
|
|
3043
|
-
...readProp2(props, "color", void 0) === void 0 ? {} : { color: readProp2(props, "color", void 0) },
|
|
3044
|
-
...readProp2(props, "stroke", void 0) === void 0 ? {} : { stroke: readProp2(props, "stroke", void 0) },
|
|
3045
|
-
...readProp2(props, "fill", void 0) === void 0 ? {} : { fill: readProp2(props, "fill", void 0) },
|
|
3046
|
-
...readProp2(props, "strokeWidth", void 0) === void 0 ? {} : { "stroke-width": readProp2(props, "strokeWidth", void 0) }
|
|
3047
|
-
};
|
|
3048
|
-
const markup = Object.entries(svgAttributes).filter(([, value]) => value !== void 0).map(([name, value]) => `${name}="${escapeXml(String(value))}"`).join(" ");
|
|
3049
|
-
const titleMarkup = title === void 0 ? "" : `<title>${escapeXml(title)}</title>`;
|
|
3050
|
-
setProperty(root, "innerHTML", `<svg ${markup} aria-hidden="true">${titleMarkup}${definition.body}</svg>`);
|
|
3051
|
-
}
|
|
3052
|
-
__name(updateSvgIconNode, "updateSvgIconNode");
|
|
3053
|
-
function readProp2(props, name, fallback) {
|
|
3054
|
-
const value = Reflect.get(props, name);
|
|
3055
|
-
return value === void 0 ? fallback : value;
|
|
3056
|
-
}
|
|
3057
|
-
__name(readProp2, "readProp");
|
|
3058
|
-
function hasText(value) {
|
|
3059
|
-
return value !== void 0 && value.trim() !== "";
|
|
3060
|
-
}
|
|
3061
|
-
__name(hasText, "hasText");
|
|
3062
|
-
function normalizeSvgLength(value) {
|
|
3063
|
-
if (value === void 0) return void 0;
|
|
3064
|
-
return typeof value === "number" ? String(value) : value;
|
|
3065
|
-
}
|
|
3066
|
-
__name(normalizeSvgLength, "normalizeSvgLength");
|
|
3067
|
-
function normalizeCssLength(value) {
|
|
3068
|
-
return typeof value === "number" || /^\d+(?:\.\d+)?$/u.test(value) ? `${value}px` : value;
|
|
3069
|
-
}
|
|
3070
|
-
__name(normalizeCssLength, "normalizeCssLength");
|
|
3071
|
-
function setOptionalAttribute2(node, name, value) {
|
|
3072
|
-
if (value === void 0 || value === null || value === false || value === "") {
|
|
3073
|
-
node.removeAttribute(name);
|
|
3074
|
-
return;
|
|
3075
|
-
}
|
|
3076
|
-
setAttribute(node, name, String(value));
|
|
3077
|
-
}
|
|
3078
|
-
__name(setOptionalAttribute2, "setOptionalAttribute");
|
|
3079
|
-
function clearStaleAttributes(node, next) {
|
|
3080
|
-
const previous = node.__vobsIconAttributes ?? /* @__PURE__ */ new Set();
|
|
3081
|
-
for (const name of previous) {
|
|
3082
|
-
if (!next.has(name)) node.removeAttribute(name);
|
|
3083
|
-
}
|
|
3084
|
-
node.__vobsIconAttributes = new Set(next.keys());
|
|
3085
|
-
}
|
|
3086
|
-
__name(clearStaleAttributes, "clearStaleAttributes");
|
|
3087
|
-
function escapeXml(value) {
|
|
3088
|
-
return value.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
3089
|
-
}
|
|
3090
|
-
__name(escapeXml, "escapeXml");
|
|
2234
|
+
// packages/ui/src/toast.ts
|
|
2235
|
+
var import_vobs25 = require("@vobs/vobs");
|
|
2236
|
+
var import_vobs26 = require("@vobs/vobs");
|
|
2237
|
+
var import_notification = require("@vobs/notification");
|
|
3091
2238
|
|
|
3092
2239
|
// packages/ui/src/icon.ts
|
|
2240
|
+
var import_icon_core = require("@vobs/icon-core");
|
|
3093
2241
|
function Icon(props = {}) {
|
|
3094
|
-
const root = createSvgIconNode(() => {
|
|
2242
|
+
const root = (0, import_icon_core.createSvgIconNode)(() => {
|
|
3095
2243
|
const definition = resolveIcon(
|
|
3096
2244
|
readProp(props, "icon", void 0) ?? readProp(props, "name", void 0)
|
|
3097
2245
|
);
|
|
@@ -3187,94 +2335,95 @@ __name(resolveIcon, "resolveIcon");
|
|
|
3187
2335
|
|
|
3188
2336
|
// packages/ui/src/toast.ts
|
|
3189
2337
|
function ToastHost(props = {}) {
|
|
3190
|
-
const notification = props.notification ?? useNotification();
|
|
3191
|
-
const root = createElement("ol");
|
|
2338
|
+
const notification = props.notification ?? (0, import_notification.useNotification)();
|
|
2339
|
+
const root = (0, import_vobs26.createElement)("ol");
|
|
3192
2340
|
bindClassList(root, props, () => [
|
|
3193
2341
|
"vui-toast-host",
|
|
3194
2342
|
`vui-toast-host--${readProp(props, "position", "top-right")}`
|
|
3195
2343
|
]);
|
|
3196
2344
|
bindCommonAttributes(root, props, ["notification", "position", "closeLabel", "portal", "portalTarget"]);
|
|
3197
2345
|
bindUserStyle(root, props);
|
|
3198
|
-
setAttribute(root, "aria-label", "Notifications");
|
|
3199
|
-
setAttribute(root, "role", "region");
|
|
3200
|
-
insertList(root, null, () => notification.notifications.value, (entry) => createToast(entry, notification, readProp(props, "closeLabel", "Dismiss notification")), (entry) => entry.id);
|
|
2346
|
+
(0, import_vobs26.setAttribute)(root, "aria-label", "Notifications");
|
|
2347
|
+
(0, import_vobs26.setAttribute)(root, "role", "region");
|
|
2348
|
+
(0, import_vobs25.insertList)(root, null, () => notification.notifications.value, (entry) => createToast(entry, notification, readProp(props, "closeLabel", "Dismiss notification")), (entry) => entry.id);
|
|
3201
2349
|
const portal = readProp(props, "portal", void 0);
|
|
3202
2350
|
return portal ? createPortal(root, portal, readProp(props, "portalTarget", void 0)) : root;
|
|
3203
2351
|
}
|
|
3204
2352
|
__name(ToastHost, "ToastHost");
|
|
3205
2353
|
function createToast(notification, context, closeLabel) {
|
|
3206
|
-
const item = createElement("li");
|
|
3207
|
-
const content = createElement("div");
|
|
3208
|
-
const close = createElement("button");
|
|
3209
|
-
setAttribute(item, "class", `vui-toast vui-toast--${notification.type}`);
|
|
3210
|
-
setAttribute(item, "data-notification-id", notification.id);
|
|
3211
|
-
setAttribute(item, "role", notification.type === "error" ? "alert" : "status");
|
|
3212
|
-
setAttribute(content, "class", "vui-toast__content");
|
|
3213
|
-
setAttribute(close, "class", "vui-toast__close");
|
|
3214
|
-
setAttribute(close, "type", "button");
|
|
3215
|
-
setAttribute(close, "aria-label", closeLabel);
|
|
3216
|
-
addEventListener(close, "click", () => context.dismiss(notification.id));
|
|
2354
|
+
const item = (0, import_vobs26.createElement)("li");
|
|
2355
|
+
const content = (0, import_vobs26.createElement)("div");
|
|
2356
|
+
const close = (0, import_vobs26.createElement)("button");
|
|
2357
|
+
(0, import_vobs26.setAttribute)(item, "class", `vui-toast vui-toast--${notification.type}`);
|
|
2358
|
+
(0, import_vobs26.setAttribute)(item, "data-notification-id", notification.id);
|
|
2359
|
+
(0, import_vobs26.setAttribute)(item, "role", notification.type === "error" ? "alert" : "status");
|
|
2360
|
+
(0, import_vobs26.setAttribute)(content, "class", "vui-toast__content");
|
|
2361
|
+
(0, import_vobs26.setAttribute)(close, "class", "vui-toast__close");
|
|
2362
|
+
(0, import_vobs26.setAttribute)(close, "type", "button");
|
|
2363
|
+
(0, import_vobs26.setAttribute)(close, "aria-label", closeLabel);
|
|
2364
|
+
(0, import_vobs26.addEventListener)(close, "click", () => context.dismiss(notification.id));
|
|
3217
2365
|
if (notification.title) {
|
|
3218
|
-
const title = createElement("div");
|
|
3219
|
-
setAttribute(title, "class", "vui-toast__title");
|
|
3220
|
-
insertBefore(title, createText(notification.title), null);
|
|
3221
|
-
insertBefore(content, title, null);
|
|
3222
|
-
}
|
|
3223
|
-
const message = createElement("div");
|
|
3224
|
-
setAttribute(message, "class", "vui-toast__message");
|
|
3225
|
-
insertBefore(message, createText(notification.content), null);
|
|
3226
|
-
insertBefore(content, message, null);
|
|
3227
|
-
insertBefore(close, Icon({ name: "x", size: 16, decorative: true }), null);
|
|
3228
|
-
insertBefore(item, content, null);
|
|
3229
|
-
insertBefore(item, close, null);
|
|
2366
|
+
const title = (0, import_vobs26.createElement)("div");
|
|
2367
|
+
(0, import_vobs26.setAttribute)(title, "class", "vui-toast__title");
|
|
2368
|
+
(0, import_vobs26.insertBefore)(title, (0, import_vobs26.createText)(notification.title), null);
|
|
2369
|
+
(0, import_vobs26.insertBefore)(content, title, null);
|
|
2370
|
+
}
|
|
2371
|
+
const message = (0, import_vobs26.createElement)("div");
|
|
2372
|
+
(0, import_vobs26.setAttribute)(message, "class", "vui-toast__message");
|
|
2373
|
+
(0, import_vobs26.insertBefore)(message, (0, import_vobs26.createText)(notification.content), null);
|
|
2374
|
+
(0, import_vobs26.insertBefore)(content, message, null);
|
|
2375
|
+
(0, import_vobs26.insertBefore)(close, Icon({ name: "x", size: 16, decorative: true }), null);
|
|
2376
|
+
(0, import_vobs26.insertBefore)(item, content, null);
|
|
2377
|
+
(0, import_vobs26.insertBefore)(item, close, null);
|
|
3230
2378
|
return item;
|
|
3231
2379
|
}
|
|
3232
2380
|
__name(createToast, "createToast");
|
|
3233
|
-
|
|
3234
|
-
exports
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
2381
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2382
|
+
0 && (module.exports = {
|
|
2383
|
+
ActivityRail,
|
|
2384
|
+
Alert,
|
|
2385
|
+
Avatar,
|
|
2386
|
+
Button,
|
|
2387
|
+
ButtonGroup,
|
|
2388
|
+
Card,
|
|
2389
|
+
CardHeader,
|
|
2390
|
+
ChatComposer,
|
|
2391
|
+
Checkbox,
|
|
2392
|
+
Dialog,
|
|
2393
|
+
Drawer,
|
|
2394
|
+
EditorTabs,
|
|
2395
|
+
FileTree,
|
|
2396
|
+
Icon,
|
|
2397
|
+
Input,
|
|
2398
|
+
Kbd,
|
|
2399
|
+
KbdCombo,
|
|
2400
|
+
KbdRow,
|
|
2401
|
+
Menu,
|
|
2402
|
+
MenuDivider,
|
|
2403
|
+
NavList,
|
|
2404
|
+
PageHeader,
|
|
2405
|
+
PageHeaderAction,
|
|
2406
|
+
Pagination,
|
|
2407
|
+
Radio,
|
|
2408
|
+
Select,
|
|
2409
|
+
StatCard,
|
|
2410
|
+
StatCardGrid,
|
|
2411
|
+
StatusBar,
|
|
2412
|
+
Switch,
|
|
2413
|
+
Table,
|
|
2414
|
+
TablePanel,
|
|
2415
|
+
Tabs,
|
|
2416
|
+
Tag,
|
|
2417
|
+
Textarea,
|
|
2418
|
+
ToastHost,
|
|
2419
|
+
VUI_ICON_PATHS,
|
|
2420
|
+
WorkbenchTitlebar,
|
|
2421
|
+
createDOMPortalAdapter,
|
|
2422
|
+
createFocusTrap,
|
|
2423
|
+
createIcon,
|
|
2424
|
+
createOverlayManager,
|
|
2425
|
+
createPortal,
|
|
2426
|
+
registerIcon,
|
|
2427
|
+
resolveIcon
|
|
2428
|
+
});
|
|
3280
2429
|
//# sourceMappingURL=index.cjs.map
|