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