@vobs/layout 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/breadcrumb.cjs +62 -577
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.js +42 -562
- package/dist/breadcrumb.js.map +1 -1
- package/dist/context.cjs +30 -163
- package/dist/context.cjs.map +1 -1
- package/dist/context.js +8 -160
- package/dist/context.js.map +1 -1
- package/dist/header.cjs +69 -583
- package/dist/header.cjs.map +1 -1
- package/dist/header.js +40 -562
- package/dist/header.js.map +1 -1
- package/dist/index.cjs +281 -1018
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +282 -981
- package/dist/index.js.map +1 -1
- package/dist/layout.cjs +201 -937
- package/dist/layout.cjs.map +1 -1
- package/dist/layout.js +196 -910
- package/dist/layout.js.map +1 -1
- package/dist/menu.cjs +81 -645
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +55 -624
- package/dist/menu.js.map +1 -1
- package/dist/sidebar.cjs +105 -759
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.js +82 -733
- package/dist/sidebar.js.map +1 -1
- package/dist/tabs.cjs +70 -634
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +48 -617
- package/dist/tabs.js.map +1 -1
- package/dist/types.cjs +18 -2
- package/dist/types.cjs.map +1 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +61 -532
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +23 -508
- package/dist/utils.js.map +1 -1
- package/dist/viewport.cjs +34 -261
- package/dist/viewport.cjs.map +1 -1
- package/dist/viewport.js +7 -256
- package/dist/viewport.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,804 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
|
|
2
|
+
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var signalNames = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function hasDebugHooks() {
|
|
10
|
-
return activeDebugHooks !== null;
|
|
11
|
-
}
|
|
12
|
-
__name(hasDebugHooks, "hasDebugHooks");
|
|
13
|
-
function setSignalDebugName(signal, name) {
|
|
14
|
-
signalNames.set(signal, name);
|
|
15
|
-
invokeDebug("signalNamed", signal, name);
|
|
16
|
-
}
|
|
17
|
-
__name(setSignalDebugName, "setSignalDebugName");
|
|
18
|
-
function invokeDebug(name, ...args) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
__name(invokeDebug, "invokeDebug");
|
|
22
|
-
|
|
23
|
-
// packages/reactivity/src/owner.ts
|
|
24
|
-
var currentOwner = null;
|
|
25
|
-
var nextOwnerId = 1;
|
|
26
|
-
var ownerNames = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
function createOwner() {
|
|
28
|
-
const parent = currentOwner;
|
|
29
|
-
let disposed = parent?.disposed ?? false;
|
|
30
|
-
const children = [];
|
|
31
|
-
const cleanups = [];
|
|
32
|
-
const errorHandlers = /* @__PURE__ */ new Set();
|
|
33
|
-
const owner = {
|
|
34
|
-
id: `owner-${nextOwnerId++}`,
|
|
35
|
-
parent,
|
|
36
|
-
children,
|
|
37
|
-
depth: (parent?.depth ?? -1) + 1,
|
|
38
|
-
get disposed() {
|
|
39
|
-
return disposed;
|
|
40
|
-
},
|
|
41
|
-
run(fn) {
|
|
42
|
-
if (disposed) throw new Error("Vobs: \u5DF2\u9500\u6BC1\u7684 Owner \u4E0D\u80FD\u7EE7\u7EED\u8FD0\u884C");
|
|
43
|
-
const previous = currentOwner;
|
|
44
|
-
currentOwner = owner;
|
|
45
|
-
try {
|
|
46
|
-
return fn();
|
|
47
|
-
} finally {
|
|
48
|
-
currentOwner = previous;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
addCleanup(cleanup) {
|
|
52
|
-
if (disposed) {
|
|
53
|
-
cleanup();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
cleanups.push(cleanup);
|
|
57
|
-
},
|
|
58
|
-
onDispose(cleanup) {
|
|
59
|
-
owner.addCleanup(cleanup);
|
|
60
|
-
},
|
|
61
|
-
onError(handler) {
|
|
62
|
-
errorHandlers.add(handler);
|
|
63
|
-
const remove = /* @__PURE__ */ __name(() => errorHandlers.delete(handler), "remove");
|
|
64
|
-
owner.addCleanup(remove);
|
|
65
|
-
return remove;
|
|
66
|
-
},
|
|
67
|
-
handleError(error) {
|
|
68
|
-
for (const handler of [...errorHandlers].reverse()) {
|
|
69
|
-
try {
|
|
70
|
-
handler(error);
|
|
71
|
-
return true;
|
|
72
|
-
} catch (handlerError) {
|
|
73
|
-
return parent?.handleError(handlerError) ?? false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return parent?.handleError(error) ?? false;
|
|
77
|
-
},
|
|
78
|
-
dispose() {
|
|
79
|
-
if (disposed) return;
|
|
80
|
-
disposed = true;
|
|
81
|
-
for (const child of [...children]) child.dispose();
|
|
82
|
-
children.length = 0;
|
|
83
|
-
let firstError;
|
|
84
|
-
for (let index = cleanups.length - 1; index >= 0; index--) {
|
|
85
|
-
try {
|
|
86
|
-
cleanups[index]();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
firstError ?? (firstError = error);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
cleanups.length = 0;
|
|
92
|
-
if (parent) {
|
|
93
|
-
const index = parent.children.indexOf(owner);
|
|
94
|
-
if (index >= 0) parent.children.splice(index, 1);
|
|
95
|
-
}
|
|
96
|
-
if (firstError) throw firstError;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
if (parent && !parent.disposed) parent.children.push(owner);
|
|
100
|
-
return owner;
|
|
101
|
-
}
|
|
102
|
-
__name(createOwner, "createOwner");
|
|
103
|
-
function setOwnerDebugName(owner, name) {
|
|
104
|
-
ownerNames.set(owner, name);
|
|
105
|
-
}
|
|
106
|
-
__name(setOwnerDebugName, "setOwnerDebugName");
|
|
107
|
-
function getCurrentOwner() {
|
|
108
|
-
return currentOwner;
|
|
109
|
-
}
|
|
110
|
-
__name(getCurrentOwner, "getCurrentOwner");
|
|
111
|
-
function onDispose(cleanup) {
|
|
112
|
-
const owner = getCurrentOwner();
|
|
113
|
-
if (!owner) throw new Error("Vobs: onDispose \u5FC5\u987B\u5728 Owner \u4F5C\u7528\u57DF\u5185\u8C03\u7528");
|
|
114
|
-
owner.onDispose(cleanup);
|
|
115
|
-
}
|
|
116
|
-
__name(onDispose, "onDispose");
|
|
117
|
-
|
|
118
|
-
// packages/reactivity/src/signal.ts
|
|
119
|
-
var currentSubscriber = null;
|
|
120
|
-
function getCurrentSubscriber() {
|
|
121
|
-
return currentSubscriber;
|
|
122
|
-
}
|
|
123
|
-
__name(getCurrentSubscriber, "getCurrentSubscriber");
|
|
124
|
-
function setCurrentSubscriber(subscriber) {
|
|
125
|
-
currentSubscriber = subscriber;
|
|
126
|
-
}
|
|
127
|
-
__name(setCurrentSubscriber, "setCurrentSubscriber");
|
|
128
|
-
function trackDependency(dependency) {
|
|
129
|
-
if (!currentSubscriber || currentSubscriber.disposed) return;
|
|
130
|
-
!currentSubscriber.dependencies.has(dependency);
|
|
131
|
-
currentSubscriber.dependencies.add(dependency);
|
|
132
|
-
}
|
|
133
|
-
__name(trackDependency, "trackDependency");
|
|
134
|
-
function state(initialValue, debugName) {
|
|
135
|
-
let value = initialValue;
|
|
136
|
-
let disposed = false;
|
|
137
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
138
|
-
const signalInstance = {
|
|
139
|
-
get value() {
|
|
140
|
-
const subscriber = getCurrentSubscriber();
|
|
141
|
-
if (subscriber && !subscriber.disposed) {
|
|
142
|
-
subscribers.add(subscriber);
|
|
143
|
-
trackDependency(signalInstance);
|
|
144
|
-
}
|
|
145
|
-
return value;
|
|
146
|
-
},
|
|
147
|
-
set value(nextValue) {
|
|
148
|
-
if (disposed || Object.is(value, nextValue)) return;
|
|
149
|
-
value = nextValue;
|
|
150
|
-
for (const subscriber of [...subscribers]) subscriber.notify();
|
|
151
|
-
},
|
|
152
|
-
unsubscribe(subscriber) {
|
|
153
|
-
subscribers.delete(subscriber);
|
|
154
|
-
},
|
|
155
|
-
// 与 `.value =` 赋值同一条路径:判等短路、debug hook、notify 全部一致。
|
|
156
|
-
// 以闭包实现,可安全地作为回调直接传递(无 this 绑定问题)。
|
|
157
|
-
set(next) {
|
|
158
|
-
signalInstance.value = next;
|
|
159
|
-
},
|
|
160
|
-
dispose() {
|
|
161
|
-
if (disposed) return;
|
|
162
|
-
disposed = true;
|
|
163
|
-
subscribers.clear();
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const owner = getCurrentOwner();
|
|
167
|
-
owner?.addCleanup(signalInstance.dispose);
|
|
168
|
-
if (debugName?.trim()) setSignalDebugName(signalInstance, debugName.trim());
|
|
169
|
-
return signalInstance;
|
|
170
|
-
}
|
|
171
|
-
__name(state, "state");
|
|
172
|
-
|
|
173
|
-
// packages/reactivity/src/scheduler.ts
|
|
174
|
-
var _Scheduler = class _Scheduler {
|
|
175
|
-
constructor() {
|
|
176
|
-
this.dirtyEffects = /* @__PURE__ */ new Set();
|
|
177
|
-
this.lowPriorityEffects = /* @__PURE__ */ new Set();
|
|
178
|
-
// flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
|
|
179
|
-
this.normalBuffer = [];
|
|
180
|
-
this.lowBuffer = [];
|
|
181
|
-
this.flushing = false;
|
|
182
|
-
this.scheduled = false;
|
|
183
|
-
this.batchDepth = 0;
|
|
184
|
-
}
|
|
185
|
-
schedule(effect2) {
|
|
186
|
-
if (effect2.disposed) return;
|
|
187
|
-
this.dirtyEffects.add(effect2);
|
|
188
|
-
this.lowPriorityEffects.delete(effect2);
|
|
189
|
-
this.ensureScheduled();
|
|
190
|
-
}
|
|
191
|
-
/** Queue an effect behind normal updates while preserving deterministic order. */
|
|
192
|
-
scheduleLow(effect2) {
|
|
193
|
-
if (effect2.disposed) return;
|
|
194
|
-
if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
|
|
195
|
-
this.ensureScheduled();
|
|
196
|
-
}
|
|
197
|
-
ensureScheduled() {
|
|
198
|
-
if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
|
|
199
|
-
this.scheduled = true;
|
|
200
|
-
queueMicrotask(() => {
|
|
201
|
-
this.scheduled = false;
|
|
202
|
-
this.flush();
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
remove(effect2) {
|
|
207
|
-
this.dirtyEffects.delete(effect2);
|
|
208
|
-
this.lowPriorityEffects.delete(effect2);
|
|
209
|
-
}
|
|
210
|
-
batch(fn) {
|
|
211
|
-
this.batchDepth++;
|
|
212
|
-
try {
|
|
213
|
-
return fn();
|
|
214
|
-
} finally {
|
|
215
|
-
this.batchDepth--;
|
|
216
|
-
if (this.batchDepth === 0) this.flush();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
flush() {
|
|
220
|
-
if (this.flushing || this.batchDepth > 0) return;
|
|
221
|
-
this.flushing = true;
|
|
222
|
-
let rounds = 0;
|
|
223
|
-
let firstError;
|
|
224
|
-
let hasError = false;
|
|
225
|
-
try {
|
|
226
|
-
while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
|
|
227
|
-
if (++rounds > 100) {
|
|
228
|
-
this.dirtyEffects.clear();
|
|
229
|
-
this.lowPriorityEffects.clear();
|
|
230
|
-
throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
|
|
231
|
-
}
|
|
232
|
-
this.collectRunnable(this.dirtyEffects, this.normalBuffer);
|
|
233
|
-
this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
|
|
234
|
-
sortEffects(this.normalBuffer);
|
|
235
|
-
sortEffects(this.lowBuffer);
|
|
236
|
-
for (const effect2 of this.normalBuffer) {
|
|
237
|
-
try {
|
|
238
|
-
effect2.run();
|
|
239
|
-
} catch (error) {
|
|
240
|
-
if (!hasError) {
|
|
241
|
-
firstError = error;
|
|
242
|
-
hasError = true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
for (const effect2 of this.lowBuffer) {
|
|
247
|
-
try {
|
|
248
|
-
effect2.run();
|
|
249
|
-
} catch (error) {
|
|
250
|
-
if (!hasError) {
|
|
251
|
-
firstError = error;
|
|
252
|
-
hasError = true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
this.normalBuffer.length = 0;
|
|
257
|
-
this.lowBuffer.length = 0;
|
|
258
|
-
}
|
|
259
|
-
} finally {
|
|
260
|
-
this.normalBuffer.length = 0;
|
|
261
|
-
this.lowBuffer.length = 0;
|
|
262
|
-
this.flushing = false;
|
|
263
|
-
}
|
|
264
|
-
if (hasError) throw firstError;
|
|
265
|
-
}
|
|
266
|
-
/** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
|
|
267
|
-
collectRunnable(source, target) {
|
|
268
|
-
for (const effect2 of source) {
|
|
269
|
-
if (!effect2.disposed) target.push(effect2);
|
|
270
|
-
}
|
|
271
|
-
source.clear();
|
|
272
|
-
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
273
11
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
__name(sortEffects, "sortEffects");
|
|
282
|
-
var scheduler = new Scheduler();
|
|
283
|
-
|
|
284
|
-
// packages/reactivity/src/effect.ts
|
|
285
|
-
var nextEffectOrder = 1;
|
|
286
|
-
function cleanupDependencies(subscriber) {
|
|
287
|
-
for (const dependency of subscriber.dependencies) {
|
|
288
|
-
dependency.unsubscribe(subscriber);
|
|
289
|
-
}
|
|
290
|
-
subscriber.dependencies.clear();
|
|
291
|
-
}
|
|
292
|
-
__name(cleanupDependencies, "cleanupDependencies");
|
|
293
|
-
function effect(callback) {
|
|
294
|
-
const owner = getCurrentOwner();
|
|
295
|
-
let cleanup;
|
|
296
|
-
let dirty = true;
|
|
297
|
-
let disposed = false;
|
|
298
|
-
const eff = {
|
|
299
|
-
order: nextEffectOrder++,
|
|
300
|
-
depth: owner?.depth ?? 0,
|
|
301
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
302
|
-
get disposed() {
|
|
303
|
-
return disposed;
|
|
304
|
-
},
|
|
305
|
-
notify() {
|
|
306
|
-
if (disposed || dirty) return;
|
|
307
|
-
dirty = true;
|
|
308
|
-
scheduler.schedule(eff);
|
|
309
|
-
},
|
|
310
|
-
run() {
|
|
311
|
-
if (disposed || !dirty) return;
|
|
312
|
-
dirty = false;
|
|
313
|
-
const previousCleanup = cleanup;
|
|
314
|
-
cleanup = void 0;
|
|
315
|
-
let cleanupError;
|
|
316
|
-
if (previousCleanup) {
|
|
317
|
-
try {
|
|
318
|
-
previousCleanup();
|
|
319
|
-
} catch (error) {
|
|
320
|
-
const handled2 = owner?.handleError(error) ?? false;
|
|
321
|
-
if (!handled2) cleanupError = error;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
cleanupDependencies(eff);
|
|
325
|
-
const previous = getCurrentSubscriber();
|
|
326
|
-
setCurrentSubscriber(eff);
|
|
327
|
-
let thrown;
|
|
328
|
-
let handled = false;
|
|
329
|
-
try {
|
|
330
|
-
const result = owner ? owner.run(callback) : callback();
|
|
331
|
-
cleanup = typeof result === "function" ? result : void 0;
|
|
332
|
-
} catch (error) {
|
|
333
|
-
thrown = error;
|
|
334
|
-
handled = owner?.handleError(error) ?? false;
|
|
335
|
-
if (!handled) throw error;
|
|
336
|
-
} finally {
|
|
337
|
-
setCurrentSubscriber(previous);
|
|
338
|
-
}
|
|
339
|
-
if (cleanupError && !thrown) throw cleanupError;
|
|
340
|
-
},
|
|
341
|
-
scheduleLow() {
|
|
342
|
-
if (disposed || dirty) return;
|
|
343
|
-
dirty = true;
|
|
344
|
-
scheduler.scheduleLow(eff);
|
|
345
|
-
},
|
|
346
|
-
dispose() {
|
|
347
|
-
if (disposed) return;
|
|
348
|
-
disposed = true;
|
|
349
|
-
dirty = false;
|
|
350
|
-
scheduler.remove(eff);
|
|
351
|
-
const previousCleanup = cleanup;
|
|
352
|
-
cleanup = void 0;
|
|
353
|
-
let cleanupError;
|
|
354
|
-
if (previousCleanup) {
|
|
355
|
-
try {
|
|
356
|
-
previousCleanup();
|
|
357
|
-
} catch (error) {
|
|
358
|
-
const handled = owner?.handleError(error) ?? false;
|
|
359
|
-
if (!handled) cleanupError = error;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
cleanupDependencies(eff);
|
|
363
|
-
if (cleanupError) throw cleanupError;
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
owner?.addCleanup(eff.dispose);
|
|
367
|
-
eff.run();
|
|
368
|
-
return eff;
|
|
369
|
-
}
|
|
370
|
-
__name(effect, "effect");
|
|
371
|
-
|
|
372
|
-
// packages/reactivity/src/memo.ts
|
|
373
|
-
function memo(compute) {
|
|
374
|
-
let cached;
|
|
375
|
-
let dirty = true;
|
|
376
|
-
let disposed = false;
|
|
377
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
378
|
-
const memoSubscriber = {
|
|
379
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
380
|
-
get disposed() {
|
|
381
|
-
return disposed;
|
|
382
|
-
},
|
|
383
|
-
notify() {
|
|
384
|
-
if (disposed || dirty) return;
|
|
385
|
-
dirty = true;
|
|
386
|
-
for (const subscriber of [...subscribers]) subscriber.notify();
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
const memoSignal = {
|
|
390
|
-
get value() {
|
|
391
|
-
const subscriber = getCurrentSubscriber();
|
|
392
|
-
if (subscriber && !subscriber.disposed) {
|
|
393
|
-
subscribers.add(subscriber);
|
|
394
|
-
trackDependency(memoSignal);
|
|
395
|
-
}
|
|
396
|
-
if (dirty) {
|
|
397
|
-
cleanupDependencies(memoSubscriber);
|
|
398
|
-
const previous = getCurrentSubscriber();
|
|
399
|
-
setCurrentSubscriber(memoSubscriber);
|
|
400
|
-
try {
|
|
401
|
-
cached = compute();
|
|
402
|
-
dirty = false;
|
|
403
|
-
} finally {
|
|
404
|
-
setCurrentSubscriber(previous);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return cached;
|
|
408
|
-
},
|
|
409
|
-
set value(_) {
|
|
410
|
-
throw new Error("memo: \u6D3E\u751F\u503C\u4E0D\u80FD\u76F4\u63A5\u8D4B\u503C");
|
|
411
|
-
},
|
|
412
|
-
unsubscribe(subscriber) {
|
|
413
|
-
subscribers.delete(subscriber);
|
|
414
|
-
},
|
|
415
|
-
dispose() {
|
|
416
|
-
if (disposed) return;
|
|
417
|
-
disposed = true;
|
|
418
|
-
subscribers.clear();
|
|
419
|
-
cleanupDependencies(memoSubscriber);
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
const owner = getCurrentOwner();
|
|
423
|
-
owner?.addCleanup(memoSignal.dispose);
|
|
424
|
-
return memoSignal;
|
|
425
|
-
}
|
|
426
|
-
__name(memo, "memo");
|
|
427
|
-
|
|
428
|
-
// packages/runtime/src/debug.ts
|
|
429
|
-
var activeRuntimeDebugHooks = null;
|
|
430
|
-
function getRuntimeDebugHooks() {
|
|
431
|
-
return activeRuntimeDebugHooks;
|
|
432
|
-
}
|
|
433
|
-
__name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
|
|
434
|
-
function invokeRuntimeDebug(name, ...args) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
__name(invokeRuntimeDebug, "invokeRuntimeDebug");
|
|
438
|
-
function readDebugValue(read) {
|
|
439
|
-
try {
|
|
440
|
-
return read();
|
|
441
|
-
} catch {
|
|
442
|
-
return "[Uninspectable]";
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
__name(readDebugValue, "readDebugValue");
|
|
446
|
-
function describeDebugNode(node) {
|
|
447
|
-
if (!node || typeof node !== "object") return "node";
|
|
448
|
-
const value = node;
|
|
449
|
-
const name = typeof value.tagName === "string" ? value.tagName.toLowerCase() : typeof value.nodeName === "string" ? value.nodeName.toLowerCase() : "node";
|
|
450
|
-
const id = typeof value.id === "string" && value.id ? `#${value.id}` : "";
|
|
451
|
-
const className = typeof value.className === "string" && value.className ? `.${value.className.trim().split(/\s+/).filter(Boolean).join(".")}` : "";
|
|
452
|
-
return `${name}${id}${className}`;
|
|
453
|
-
}
|
|
454
|
-
__name(describeDebugNode, "describeDebugNode");
|
|
455
|
-
|
|
456
|
-
// packages/runtime/src/hmr.ts
|
|
457
|
-
var globalTarget = globalThis;
|
|
458
|
-
var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
|
|
459
|
-
globalTarget.__VOBS_HMR__ = hmrGlobal;
|
|
460
|
-
function registerHmrInstance(moduleId, instance) {
|
|
461
|
-
const instances = getModule(moduleId).instances;
|
|
462
|
-
instances.add(instance);
|
|
463
|
-
return () => instances.delete(instance);
|
|
464
|
-
}
|
|
465
|
-
__name(registerHmrInstance, "registerHmrInstance");
|
|
466
|
-
function markHmrInstanceMounted(node, parent) {
|
|
467
|
-
const instance = hmrInstances.get(node);
|
|
468
|
-
if (instance) instance.parent = parent;
|
|
469
|
-
}
|
|
470
|
-
__name(markHmrInstanceMounted, "markHmrInstanceMounted");
|
|
471
|
-
function getModule(moduleId) {
|
|
472
|
-
let module = hmrGlobal.modules.get(moduleId);
|
|
473
|
-
if (!module) {
|
|
474
|
-
module = { components: /* @__PURE__ */ new Map(), state: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Set() };
|
|
475
|
-
hmrGlobal.modules.set(moduleId, module);
|
|
476
|
-
}
|
|
477
|
-
return module;
|
|
478
|
-
}
|
|
479
|
-
__name(getModule, "getModule");
|
|
480
|
-
var hmrInstances = /* @__PURE__ */ new WeakMap();
|
|
481
|
-
function associateHmrInstance(node, instance) {
|
|
482
|
-
hmrInstances.set(node, instance);
|
|
483
|
-
}
|
|
484
|
-
__name(associateHmrInstance, "associateHmrInstance");
|
|
485
|
-
var nodeOwners = /* @__PURE__ */ new WeakMap();
|
|
486
|
-
var eventBindings = /* @__PURE__ */ new WeakMap();
|
|
487
|
-
function getRenderer() {
|
|
488
|
-
{
|
|
489
|
-
throw new Error("\u6E32\u67D3\u5668\u672A\u521D\u59CB\u5316");
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
__name(getRenderer, "getRenderer");
|
|
493
|
-
function createText(content) {
|
|
494
|
-
return getRenderer().createText(content);
|
|
495
|
-
}
|
|
496
|
-
__name(createText, "createText");
|
|
497
|
-
function createElement(tag) {
|
|
498
|
-
return getRenderer().createElement(tag);
|
|
499
|
-
}
|
|
500
|
-
__name(createElement, "createElement");
|
|
501
|
-
function createComment(content) {
|
|
502
|
-
return getRenderer().createComment(content);
|
|
503
|
-
}
|
|
504
|
-
__name(createComment, "createComment");
|
|
505
|
-
function insertBefore(parent, child, anchor) {
|
|
506
|
-
if (isVobsFragment(child)) {
|
|
507
|
-
child.mount(parent, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
getRenderer().insertBefore(parent, child, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
511
|
-
markHmrInstanceMounted(child, parent);
|
|
512
|
-
}
|
|
513
|
-
__name(insertBefore, "insertBefore");
|
|
514
|
-
function removeChild(parent, child) {
|
|
515
|
-
disposeNodeOwner(child);
|
|
516
|
-
if (isVobsFragment(child)) {
|
|
517
|
-
child.unmount(parent);
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
getRenderer().removeChild(parent, child);
|
|
521
|
-
}
|
|
522
|
-
__name(removeChild, "removeChild");
|
|
523
|
-
function setTextContent(node, content) {
|
|
524
|
-
getRenderer().setTextContent(node, content);
|
|
525
|
-
}
|
|
526
|
-
__name(setTextContent, "setTextContent");
|
|
527
|
-
function setProperty(node, key, value) {
|
|
528
|
-
getRenderer().setProperty(node, key, value);
|
|
529
|
-
}
|
|
530
|
-
__name(setProperty, "setProperty");
|
|
531
|
-
function setAttribute(node, key, value) {
|
|
532
|
-
getRenderer().setAttribute(node, key, value);
|
|
533
|
-
}
|
|
534
|
-
__name(setAttribute, "setAttribute");
|
|
535
|
-
function addEventListener(node, event, handler) {
|
|
536
|
-
const renderer = getRenderer();
|
|
537
|
-
const owner = getCurrentOwner();
|
|
538
|
-
let bindings = eventBindings.get(node);
|
|
539
|
-
if (!bindings) {
|
|
540
|
-
bindings = /* @__PURE__ */ new Map();
|
|
541
|
-
eventBindings.set(node, bindings);
|
|
542
|
-
}
|
|
543
|
-
const previous = bindings.get(event);
|
|
544
|
-
if (previous && previous.original === handler && previous.owner === owner) return;
|
|
545
|
-
if (previous) renderer.removeEventListener(node, event, previous.handler);
|
|
546
|
-
const listener = owner ? (reason) => {
|
|
547
|
-
try {
|
|
548
|
-
owner.run(() => handler(reason));
|
|
549
|
-
} catch (error) {
|
|
550
|
-
const handled = owner.handleError(error);
|
|
551
|
-
invokeRuntimeDebug("error", {
|
|
552
|
-
error,
|
|
553
|
-
owner,
|
|
554
|
-
phase: "event",
|
|
555
|
-
handled,
|
|
556
|
-
recovery: handled ? "handled" : "propagated"
|
|
557
|
-
});
|
|
558
|
-
if (!handled) throw error;
|
|
559
|
-
}
|
|
560
|
-
} : handler;
|
|
561
|
-
const binding = { handler: listener, owner, original: handler };
|
|
562
|
-
bindings.set(event, binding);
|
|
563
|
-
renderer.addEventListener(node, event, listener);
|
|
564
|
-
owner?.onDispose(() => {
|
|
565
|
-
if (bindings?.get(event) !== binding) return;
|
|
566
|
-
bindings.delete(event);
|
|
567
|
-
renderer.removeEventListener(node, event, listener);
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
__name(addEventListener, "addEventListener");
|
|
571
|
-
function createComponent(component, props, source) {
|
|
572
|
-
const owner = createOwner();
|
|
573
|
-
const componentName = component.displayName || component.name || "anonymous";
|
|
574
|
-
setOwnerDebugName(owner, source ? `${componentName} (${source.file}:${source.line}:${source.column})` : componentName);
|
|
575
|
-
owner.onError((reason) => {
|
|
576
|
-
attachSourceLocation(reason, source);
|
|
577
|
-
attachComponentContext(reason, componentName, owner.id);
|
|
578
|
-
throw reason;
|
|
579
|
-
});
|
|
580
|
-
let node;
|
|
581
|
-
try {
|
|
582
|
-
node = owner.run(() => component(props));
|
|
583
|
-
} catch (error) {
|
|
584
|
-
owner.dispose();
|
|
585
|
-
attachSourceLocation(error, source);
|
|
586
|
-
attachComponentContext(error, componentName, owner.id);
|
|
587
|
-
throw error;
|
|
588
|
-
}
|
|
589
|
-
associateNodeOwner(node, owner);
|
|
590
|
-
const hmrKey = component.hmrKey;
|
|
591
|
-
if (hmrKey) {
|
|
592
|
-
const instance = {
|
|
593
|
-
node,
|
|
594
|
-
parent: null,
|
|
595
|
-
refresh() {
|
|
596
|
-
const previous = instance.node;
|
|
597
|
-
const next = owner.run(() => component(props));
|
|
598
|
-
if (instance.parent && !isVobsFragment(previous) && !isVobsFragment(next)) {
|
|
599
|
-
getRenderer().insertBefore(instance.parent, next, previous);
|
|
600
|
-
getRenderer().removeChild(instance.parent, previous);
|
|
601
|
-
}
|
|
602
|
-
nodeOwners.delete(previous);
|
|
603
|
-
nodeOwners.set(next, owner);
|
|
604
|
-
associateHmrInstance(next, instance);
|
|
605
|
-
instance.node = next;
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
associateHmrInstance(node, instance);
|
|
609
|
-
const separator = hmrKey.lastIndexOf(":");
|
|
610
|
-
const moduleId = separator < 0 ? hmrKey : hmrKey.slice(0, separator);
|
|
611
|
-
const cleanup = registerHmrInstance(moduleId, instance);
|
|
612
|
-
owner.onDispose(cleanup);
|
|
613
|
-
}
|
|
614
|
-
return node;
|
|
615
|
-
}
|
|
616
|
-
__name(createComponent, "createComponent");
|
|
617
|
-
function attachSourceLocation(reason, source) {
|
|
618
|
-
if (!source || (!reason || typeof reason !== "object" && typeof reason !== "function")) return;
|
|
619
|
-
const error = reason;
|
|
620
|
-
if (error.vobsSource) return;
|
|
621
|
-
try {
|
|
622
|
-
Object.defineProperty(error, "vobsSource", {
|
|
623
|
-
configurable: true,
|
|
624
|
-
enumerable: false,
|
|
625
|
-
value: source,
|
|
626
|
-
writable: false
|
|
627
|
-
});
|
|
628
|
-
} catch {
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
629
17
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
if (!reason || typeof reason !== "object" && typeof reason !== "function") return;
|
|
634
|
-
const error = reason;
|
|
635
|
-
try {
|
|
636
|
-
if (!error.vobsComponent) Object.defineProperty(error, "vobsComponent", { configurable: true, enumerable: false, value: component, writable: false });
|
|
637
|
-
if (!error.vobsOwnerId) Object.defineProperty(error, "vobsOwnerId", { configurable: true, enumerable: false, value: ownerId, writable: false });
|
|
638
|
-
} catch {
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
__name(attachComponentContext, "attachComponentContext");
|
|
642
|
-
function createBlock(factory) {
|
|
643
|
-
const owner = createOwner();
|
|
644
|
-
setOwnerDebugName(owner, "dynamic");
|
|
645
|
-
let node;
|
|
646
|
-
try {
|
|
647
|
-
node = owner.run(factory);
|
|
648
|
-
} catch (error) {
|
|
649
|
-
owner.dispose();
|
|
650
|
-
throw error;
|
|
651
|
-
}
|
|
652
|
-
if (!node) {
|
|
653
|
-
owner.dispose();
|
|
654
|
-
return null;
|
|
655
|
-
}
|
|
656
|
-
associateNodeOwner(node, owner);
|
|
657
|
-
return node;
|
|
658
|
-
}
|
|
659
|
-
__name(createBlock, "createBlock");
|
|
660
|
-
function associateNodeOwner(node, owner) {
|
|
661
|
-
nodeOwners.set(node, owner);
|
|
662
|
-
}
|
|
663
|
-
__name(associateNodeOwner, "associateNodeOwner");
|
|
664
|
-
function disposeNodeOwner(node) {
|
|
665
|
-
const owner = nodeOwners.get(node);
|
|
666
|
-
if (!owner) return;
|
|
667
|
-
nodeOwners.delete(node);
|
|
668
|
-
owner.dispose();
|
|
669
|
-
}
|
|
670
|
-
__name(disposeNodeOwner, "disposeNodeOwner");
|
|
671
|
-
|
|
672
|
-
// packages/runtime/src/fragment.ts
|
|
673
|
-
function createFragment(factory) {
|
|
674
|
-
const start = createComment("vobs:fragment:start");
|
|
675
|
-
const end = createComment("vobs:fragment:end");
|
|
676
|
-
let parent = null;
|
|
677
|
-
let initialized = false;
|
|
678
|
-
const owner = getCurrentOwner();
|
|
679
|
-
const fragment = {
|
|
680
|
-
kind: "vobs-fragment",
|
|
681
|
-
start,
|
|
682
|
-
end,
|
|
683
|
-
mount(nextParent, anchor) {
|
|
684
|
-
if (parent && parent !== nextParent) {
|
|
685
|
-
throw new Error("Vobs Fragment: \u4E0D\u80FD\u8DE8\u7236\u8282\u70B9\u79FB\u52A8 Fragment");
|
|
686
|
-
}
|
|
687
|
-
if (initialized) {
|
|
688
|
-
moveRange(nextParent, start, end, anchor);
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
const renderer = getRenderer();
|
|
692
|
-
renderer.insertBefore(nextParent, start, anchor);
|
|
693
|
-
renderer.insertBefore(nextParent, end, anchor);
|
|
694
|
-
parent = nextParent;
|
|
695
|
-
initialized = true;
|
|
696
|
-
if (owner) owner.run(() => factory(nextParent, end));
|
|
697
|
-
else factory(nextParent, end);
|
|
698
|
-
},
|
|
699
|
-
unmount(nextParent) {
|
|
700
|
-
if (!initialized || parent !== nextParent) {
|
|
701
|
-
throw new Error("Vobs Fragment: Fragment \u4E0D\u5C5E\u4E8E\u6307\u5B9A\u7236\u8282\u70B9");
|
|
702
|
-
}
|
|
703
|
-
const renderer = getRenderer();
|
|
704
|
-
let current = renderer.nextSibling(start);
|
|
705
|
-
while (current && current !== end) {
|
|
706
|
-
const next = renderer.nextSibling(current);
|
|
707
|
-
renderer.removeChild(nextParent, current);
|
|
708
|
-
current = next;
|
|
709
|
-
}
|
|
710
|
-
renderer.removeChild(nextParent, start);
|
|
711
|
-
renderer.removeChild(nextParent, end);
|
|
712
|
-
parent = null;
|
|
713
|
-
initialized = false;
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
return fragment;
|
|
717
|
-
}
|
|
718
|
-
__name(createFragment, "createFragment");
|
|
719
|
-
function isVobsFragment(value) {
|
|
720
|
-
return Boolean(value) && typeof value === "object" && value.kind === "vobs-fragment";
|
|
721
|
-
}
|
|
722
|
-
__name(isVobsFragment, "isVobsFragment");
|
|
723
|
-
function moveRange(parent, start, end, anchor) {
|
|
724
|
-
const renderer = getRenderer();
|
|
725
|
-
const nodes = [start];
|
|
726
|
-
let current = renderer.nextSibling(start);
|
|
727
|
-
while (current) {
|
|
728
|
-
nodes.push(current);
|
|
729
|
-
if (current === end) break;
|
|
730
|
-
current = renderer.nextSibling(current);
|
|
731
|
-
}
|
|
732
|
-
if (nodes[nodes.length - 1] !== end) {
|
|
733
|
-
throw new Error("Vobs Fragment: \u627E\u4E0D\u5230\u7ED3\u675F\u951A\u70B9");
|
|
734
|
-
}
|
|
735
|
-
for (const node of nodes) renderer.insertBefore(parent, node, anchor);
|
|
736
|
-
}
|
|
737
|
-
__name(moveRange, "moveRange");
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
738
21
|
|
|
739
|
-
// packages/
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
22
|
+
// packages/layout/src/index.ts
|
|
23
|
+
var src_exports = {};
|
|
24
|
+
__export(src_exports, {
|
|
25
|
+
DEFAULT_MOBILE_BREAKPOINT: () => DEFAULT_MOBILE_BREAKPOINT,
|
|
26
|
+
KIT_LAYOUT_KEY: () => KIT_LAYOUT_KEY,
|
|
27
|
+
KitBreadcrumb: () => KitBreadcrumb,
|
|
28
|
+
KitHeader: () => KitHeader,
|
|
29
|
+
KitLayout: () => KitLayout,
|
|
30
|
+
KitMenu: () => KitMenu,
|
|
31
|
+
KitSidebar: () => KitSidebar,
|
|
32
|
+
KitTabs: () => KitTabs,
|
|
33
|
+
createKitViewport: () => createKitViewport,
|
|
34
|
+
normalizeBreakpoint: () => normalizeBreakpoint,
|
|
35
|
+
useKitLayout: () => useKitLayout
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
753
38
|
|
|
754
|
-
// packages/
|
|
755
|
-
var
|
|
756
|
-
|
|
757
|
-
const owner = getCurrentOwner();
|
|
758
|
-
if (!owner) throw new Error("Vobs: provide \u5FC5\u987B\u5728\u7EC4\u4EF6\u6216 Owner \u4F5C\u7528\u57DF\u5185\u8C03\u7528");
|
|
759
|
-
provideToOwner(owner, key, value, options);
|
|
760
|
-
}
|
|
761
|
-
__name(provide, "provide");
|
|
762
|
-
function inject(key, fallback) {
|
|
763
|
-
const owner = getCurrentOwner();
|
|
764
|
-
const value = owner ? injectFromOwner(owner, key) : void 0;
|
|
765
|
-
return value === void 0 ? fallback : value;
|
|
766
|
-
}
|
|
767
|
-
__name(inject, "inject");
|
|
768
|
-
function provideToOwner(owner, key, value, options = {}) {
|
|
769
|
-
let providers = ownerProviders.get(owner);
|
|
770
|
-
if (!providers) {
|
|
771
|
-
providers = /* @__PURE__ */ new Map();
|
|
772
|
-
ownerProviders.set(owner, providers);
|
|
773
|
-
owner.onDispose(() => ownerProviders.delete(owner));
|
|
774
|
-
}
|
|
775
|
-
if (providers.has(key) && !options.override) {
|
|
776
|
-
throw new Error(`Vobs: \u6CE8\u5165\u9879 ${String(key)} \u5DF2\u5B58\u5728\uFF1B\u5982\u9700\u8986\u76D6\u8BF7\u4F20\u5165 override: true`);
|
|
777
|
-
}
|
|
778
|
-
providers.set(key, value);
|
|
779
|
-
}
|
|
780
|
-
__name(provideToOwner, "provideToOwner");
|
|
781
|
-
function injectFromOwner(owner, key) {
|
|
782
|
-
let current = owner;
|
|
783
|
-
while (current) {
|
|
784
|
-
const providers = ownerProviders.get(current);
|
|
785
|
-
if (providers?.has(key)) return providers.get(key);
|
|
786
|
-
current = current.parent;
|
|
787
|
-
}
|
|
788
|
-
return void 0;
|
|
789
|
-
}
|
|
790
|
-
__name(injectFromOwner, "injectFromOwner");
|
|
791
|
-
|
|
792
|
-
// packages/vobs/src/app.ts
|
|
793
|
-
function createInjectionKey(description) {
|
|
794
|
-
return Symbol(description);
|
|
795
|
-
}
|
|
796
|
-
__name(createInjectionKey, "createInjectionKey");
|
|
39
|
+
// packages/layout/src/layout.ts
|
|
40
|
+
var import_reactivity6 = require("@vobs/reactivity");
|
|
41
|
+
var import_vobs6 = require("@vobs/vobs");
|
|
797
42
|
|
|
798
43
|
// packages/layout/src/context.ts
|
|
799
|
-
var
|
|
44
|
+
var import_vobs = require("@vobs/vobs");
|
|
45
|
+
var KIT_LAYOUT_KEY = (0, import_vobs.createInjectionKey)("vobs.kit.layout");
|
|
800
46
|
function useKitLayout() {
|
|
801
|
-
const context = inject(KIT_LAYOUT_KEY);
|
|
47
|
+
const context = (0, import_vobs.inject)(KIT_LAYOUT_KEY);
|
|
802
48
|
if (!context) {
|
|
803
49
|
throw new Error("Vobs Layout: \u627E\u4E0D\u5230 KitLayout \u4E0A\u4E0B\u6587");
|
|
804
50
|
}
|
|
@@ -806,7 +52,13 @@ function useKitLayout() {
|
|
|
806
52
|
}
|
|
807
53
|
__name(useKitLayout, "useKitLayout");
|
|
808
54
|
|
|
55
|
+
// packages/layout/src/header.ts
|
|
56
|
+
var import_reactivity2 = require("@vobs/reactivity");
|
|
57
|
+
var import_vobs3 = require("@vobs/vobs");
|
|
58
|
+
|
|
809
59
|
// packages/layout/src/utils.ts
|
|
60
|
+
var import_reactivity = require("@vobs/reactivity");
|
|
61
|
+
var import_vobs2 = require("@vobs/vobs");
|
|
810
62
|
function readProp(props, name, fallback) {
|
|
811
63
|
const value = Reflect.get(props, name);
|
|
812
64
|
return value === void 0 ? fallback : value;
|
|
@@ -821,8 +73,8 @@ function classNames(...values) {
|
|
|
821
73
|
}
|
|
822
74
|
__name(classNames, "classNames");
|
|
823
75
|
function bindClassList(root, props, readBaseClasses) {
|
|
824
|
-
effect(() => {
|
|
825
|
-
setAttribute(root, "class", classNames(
|
|
76
|
+
(0, import_reactivity.effect)(() => {
|
|
77
|
+
(0, import_vobs2.setAttribute)(root, "class", classNames(
|
|
826
78
|
...readBaseClasses(),
|
|
827
79
|
readString(props, "class"),
|
|
828
80
|
readString(props, "className")
|
|
@@ -836,7 +88,7 @@ function bindCommonAttributes(root, props, skip = []) {
|
|
|
836
88
|
ignored.add("className");
|
|
837
89
|
ignored.add("children");
|
|
838
90
|
ignored.add("style");
|
|
839
|
-
effect(() => {
|
|
91
|
+
(0, import_reactivity.effect)(() => {
|
|
840
92
|
const next = /* @__PURE__ */ new Map();
|
|
841
93
|
for (const name of Object.keys(props)) {
|
|
842
94
|
if (ignored.has(name) || !isCommonAttribute(name)) continue;
|
|
@@ -847,22 +99,22 @@ function bindCommonAttributes(root, props, skip = []) {
|
|
|
847
99
|
for (const name of managed) {
|
|
848
100
|
if (!next.has(name)) removeAttribute(root, name);
|
|
849
101
|
}
|
|
850
|
-
for (const [name, value] of next) setAttribute(root, name, value);
|
|
102
|
+
for (const [name, value] of next) (0, import_vobs2.setAttribute)(root, name, value);
|
|
851
103
|
managedAttributes.set(root, new Set(next.keys()));
|
|
852
104
|
});
|
|
853
105
|
}
|
|
854
106
|
__name(bindCommonAttributes, "bindCommonAttributes");
|
|
855
107
|
function bindUserStyle(root, props, internal) {
|
|
856
|
-
effect(() => {
|
|
108
|
+
(0, import_reactivity.effect)(() => {
|
|
857
109
|
const values = [internal?.() ?? "", readString(props, "style") ?? ""].filter(Boolean);
|
|
858
|
-
if (values.length > 0) setAttribute(root, "style", values.join("; "));
|
|
110
|
+
if (values.length > 0) (0, import_vobs2.setAttribute)(root, "style", values.join("; "));
|
|
859
111
|
else removeAttribute(root, "style");
|
|
860
112
|
});
|
|
861
113
|
}
|
|
862
114
|
__name(bindUserStyle, "bindUserStyle");
|
|
863
115
|
function bindTextContent(node, read) {
|
|
864
|
-
effect(() => {
|
|
865
|
-
setTextContent(node, String(read() ?? ""));
|
|
116
|
+
(0, import_reactivity.effect)(() => {
|
|
117
|
+
(0, import_vobs2.setTextContent)(node, String(read() ?? ""));
|
|
866
118
|
});
|
|
867
119
|
}
|
|
868
120
|
__name(bindTextContent, "bindTextContent");
|
|
@@ -871,22 +123,22 @@ function setOptionalAttribute(node, name, value) {
|
|
|
871
123
|
removeAttribute(node, name);
|
|
872
124
|
return;
|
|
873
125
|
}
|
|
874
|
-
setAttribute(node, name, String(value));
|
|
126
|
+
(0, import_vobs2.setAttribute)(node, name, String(value));
|
|
875
127
|
}
|
|
876
128
|
__name(setOptionalAttribute, "setOptionalAttribute");
|
|
877
129
|
function mountSlot(parent, props, name) {
|
|
878
|
-
insertDynamic(parent, null, () => resolveSlot(Reflect.get(props, name)));
|
|
130
|
+
(0, import_vobs2.insertDynamic)(parent, null, () => resolveSlot(Reflect.get(props, name)));
|
|
879
131
|
}
|
|
880
132
|
__name(mountSlot, "mountSlot");
|
|
881
133
|
function resolveSlot(value) {
|
|
882
134
|
const resolved = typeof value === "function" ? value() : value;
|
|
883
135
|
if (resolved === void 0 || resolved === null || resolved === false) return null;
|
|
884
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
136
|
+
if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs2.createText)(String(resolved));
|
|
885
137
|
if (Array.isArray(resolved)) {
|
|
886
|
-
return createFragment((parent, anchor) => {
|
|
138
|
+
return (0, import_vobs2.createFragment)((parent, anchor) => {
|
|
887
139
|
for (const child of resolved) {
|
|
888
140
|
const node = resolveSlot(child);
|
|
889
|
-
if (node) insertBefore(parent, node, anchor);
|
|
141
|
+
if (node) (0, import_vobs2.insertBefore)(parent, node, anchor);
|
|
890
142
|
}
|
|
891
143
|
});
|
|
892
144
|
}
|
|
@@ -920,10 +172,10 @@ var managedAttributes = /* @__PURE__ */ new WeakMap();
|
|
|
920
172
|
|
|
921
173
|
// packages/layout/src/header.ts
|
|
922
174
|
function KitHeader(props = {}) {
|
|
923
|
-
const root = createElement("header");
|
|
924
|
-
const toggleRegion = createElement("div");
|
|
925
|
-
const brand = createElement("div");
|
|
926
|
-
const actions = createElement("div");
|
|
175
|
+
const root = (0, import_vobs3.createElement)("header");
|
|
176
|
+
const toggleRegion = (0, import_vobs3.createElement)("div");
|
|
177
|
+
const brand = (0, import_vobs3.createElement)("div");
|
|
178
|
+
const actions = (0, import_vobs3.createElement)("div");
|
|
927
179
|
bindClassList(root, props, () => ["vobs-kit-header"]);
|
|
928
180
|
bindCommonAttributes(root, props, [
|
|
929
181
|
"logo",
|
|
@@ -935,45 +187,45 @@ function KitHeader(props = {}) {
|
|
|
935
187
|
"onToggleSidebar"
|
|
936
188
|
]);
|
|
937
189
|
bindUserStyle(root, props);
|
|
938
|
-
setAttribute(toggleRegion, "class", "vobs-kit-header__toggle");
|
|
190
|
+
(0, import_vobs3.setAttribute)(toggleRegion, "class", "vobs-kit-header__toggle");
|
|
939
191
|
if (hasProp(props, "sidebarToggle")) {
|
|
940
192
|
mountSlot(toggleRegion, props, "sidebarToggle");
|
|
941
193
|
} else {
|
|
942
|
-
insertBefore(toggleRegion, createDefaultToggle(props), null);
|
|
194
|
+
(0, import_vobs3.insertBefore)(toggleRegion, createDefaultToggle(props), null);
|
|
943
195
|
}
|
|
944
|
-
setAttribute(brand, "class", "vobs-kit-header__brand");
|
|
196
|
+
(0, import_vobs3.setAttribute)(brand, "class", "vobs-kit-header__brand");
|
|
945
197
|
if (readProp(props, "logo", void 0) !== void 0) {
|
|
946
|
-
const logo = createElement("span");
|
|
947
|
-
setAttribute(logo, "class", "vobs-kit-header__logo");
|
|
198
|
+
const logo = (0, import_vobs3.createElement)("span");
|
|
199
|
+
(0, import_vobs3.setAttribute)(logo, "class", "vobs-kit-header__logo");
|
|
948
200
|
mountSlot(logo, props, "logo");
|
|
949
|
-
insertBefore(brand, logo, null);
|
|
201
|
+
(0, import_vobs3.insertBefore)(brand, logo, null);
|
|
950
202
|
}
|
|
951
203
|
if (readProp(props, "title", void 0) !== void 0) {
|
|
952
|
-
const title = createElement("h1");
|
|
953
|
-
const text = createText("");
|
|
954
|
-
setAttribute(title, "class", "vobs-kit-header__title");
|
|
204
|
+
const title = (0, import_vobs3.createElement)("h1");
|
|
205
|
+
const text = (0, import_vobs3.createText)("");
|
|
206
|
+
(0, import_vobs3.setAttribute)(title, "class", "vobs-kit-header__title");
|
|
955
207
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
956
|
-
insertBefore(title, text, null);
|
|
957
|
-
insertBefore(brand, title, null);
|
|
208
|
+
(0, import_vobs3.insertBefore)(title, text, null);
|
|
209
|
+
(0, import_vobs3.insertBefore)(brand, title, null);
|
|
958
210
|
}
|
|
959
|
-
setAttribute(actions, "class", "vobs-kit-header__actions");
|
|
211
|
+
(0, import_vobs3.setAttribute)(actions, "class", "vobs-kit-header__actions");
|
|
960
212
|
if (readProp(props, "headerActions", void 0) !== void 0) mountSlot(actions, props, "headerActions");
|
|
961
213
|
if (readProp(props, "userMenu", void 0) !== void 0) mountSlot(actions, props, "userMenu");
|
|
962
|
-
insertBefore(root, toggleRegion, null);
|
|
963
|
-
insertBefore(root, brand, null);
|
|
964
|
-
insertBefore(root, actions, null);
|
|
214
|
+
(0, import_vobs3.insertBefore)(root, toggleRegion, null);
|
|
215
|
+
(0, import_vobs3.insertBefore)(root, brand, null);
|
|
216
|
+
(0, import_vobs3.insertBefore)(root, actions, null);
|
|
965
217
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
966
218
|
return root;
|
|
967
219
|
}
|
|
968
220
|
__name(KitHeader, "KitHeader");
|
|
969
221
|
function createDefaultToggle(props) {
|
|
970
|
-
const button = createElement("button");
|
|
971
|
-
const label = createText("");
|
|
972
|
-
setAttribute(button, "type", "button");
|
|
973
|
-
setAttribute(button, "class", "vobs-kit-header__toggle-button");
|
|
222
|
+
const button = (0, import_vobs3.createElement)("button");
|
|
223
|
+
const label = (0, import_vobs3.createText)("");
|
|
224
|
+
(0, import_vobs3.setAttribute)(button, "type", "button");
|
|
225
|
+
(0, import_vobs3.setAttribute)(button, "class", "vobs-kit-header__toggle-button");
|
|
974
226
|
bindTextContent(label, () => readProp(props, "toggleLabel", "Menu"));
|
|
975
|
-
insertBefore(button, label, null);
|
|
976
|
-
addEventListener(button, "click", () => {
|
|
227
|
+
(0, import_vobs3.insertBefore)(button, label, null);
|
|
228
|
+
(0, import_vobs3.addEventListener)(button, "click", () => {
|
|
977
229
|
const handler = readProp(props, "onToggleSidebar", void 0);
|
|
978
230
|
if (typeof handler === "function") handler();
|
|
979
231
|
});
|
|
@@ -982,20 +234,26 @@ function createDefaultToggle(props) {
|
|
|
982
234
|
}
|
|
983
235
|
__name(createDefaultToggle, "createDefaultToggle");
|
|
984
236
|
function effectToggleLabel(button, props) {
|
|
985
|
-
effect(() => {
|
|
237
|
+
(0, import_reactivity2.effect)(() => {
|
|
986
238
|
setOptionalAttribute(button, "aria-label", readProp(props, "toggleLabel", "Menu"));
|
|
987
239
|
});
|
|
988
240
|
}
|
|
989
241
|
__name(effectToggleLabel, "effectToggleLabel");
|
|
990
242
|
|
|
243
|
+
// packages/layout/src/sidebar.ts
|
|
244
|
+
var import_reactivity4 = require("@vobs/reactivity");
|
|
245
|
+
var import_vobs5 = require("@vobs/vobs");
|
|
246
|
+
|
|
991
247
|
// packages/layout/src/menu.ts
|
|
248
|
+
var import_reactivity3 = require("@vobs/reactivity");
|
|
249
|
+
var import_vobs4 = require("@vobs/vobs");
|
|
992
250
|
function KitMenu(props) {
|
|
993
|
-
const root = createElement("ul");
|
|
994
|
-
const expanded = state(/* @__PURE__ */ new Set());
|
|
251
|
+
const root = (0, import_vobs4.createElement)("ul");
|
|
252
|
+
const expanded = (0, import_reactivity3.state)(/* @__PURE__ */ new Set());
|
|
995
253
|
bindClassList(root, props, () => ["vobs-kit-menu"]);
|
|
996
254
|
bindCommonAttributes(root, props, ["items", "collapsed", "activeKey", "onSelect"]);
|
|
997
|
-
if (!hasProp(props, "role")) setAttribute(root, "role", "menu");
|
|
998
|
-
insertDynamic(root, null, () => createMenuTree(props, expanded));
|
|
255
|
+
if (!hasProp(props, "role")) (0, import_vobs4.setAttribute)(root, "role", "menu");
|
|
256
|
+
(0, import_vobs4.insertDynamic)(root, null, () => createMenuTree(props, expanded));
|
|
999
257
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1000
258
|
return root;
|
|
1001
259
|
}
|
|
@@ -1004,93 +262,93 @@ function createMenuTree(props, expanded) {
|
|
|
1004
262
|
const items = readProp(props, "items", []);
|
|
1005
263
|
const activeKey = readProp(props, "activeKey", void 0);
|
|
1006
264
|
const collapsed = readProp(props, "collapsed", false);
|
|
1007
|
-
return createFragment((parent, anchor) => {
|
|
265
|
+
return (0, import_vobs4.createFragment)((parent, anchor) => {
|
|
1008
266
|
for (const item of items) {
|
|
1009
|
-
insertBefore(parent, createMenuItem(item, props, activeKey, collapsed, expanded), anchor);
|
|
267
|
+
(0, import_vobs4.insertBefore)(parent, createMenuItem(item, props, activeKey, collapsed, expanded), anchor);
|
|
1010
268
|
}
|
|
1011
269
|
});
|
|
1012
270
|
}
|
|
1013
271
|
__name(createMenuTree, "createMenuTree");
|
|
1014
272
|
function createMenuItem(item, props, activeKey, collapsed, expanded) {
|
|
1015
|
-
const li = createElement("li");
|
|
273
|
+
const li = (0, import_vobs4.createElement)("li");
|
|
1016
274
|
const children = item.children ?? [];
|
|
1017
275
|
const hasChildren = children.length > 0;
|
|
1018
276
|
const active = item.key === activeKey;
|
|
1019
277
|
const activeDescendant = children.some((child) => hasActiveDescendant(child, activeKey));
|
|
1020
278
|
const isExpanded = expanded.value.has(item.key) || activeDescendant;
|
|
1021
|
-
setAttribute(li, "class", `vobs-kit-menu__item${active || activeDescendant ? " is-active" : ""}`);
|
|
279
|
+
(0, import_vobs4.setAttribute)(li, "class", `vobs-kit-menu__item${active || activeDescendant ? " is-active" : ""}`);
|
|
1022
280
|
setOptionalAttribute(li, "data-menu-key", item.key);
|
|
1023
281
|
if (hasChildren) {
|
|
1024
|
-
const groupButton = createElement("button");
|
|
1025
|
-
setAttribute(groupButton, "type", "button");
|
|
1026
|
-
setAttribute(groupButton, "class", "vobs-kit-menu__link vobs-kit-menu__group-toggle");
|
|
1027
|
-
setAttribute(groupButton, "aria-expanded", isExpanded ? "true" : "false");
|
|
282
|
+
const groupButton = (0, import_vobs4.createElement)("button");
|
|
283
|
+
(0, import_vobs4.setAttribute)(groupButton, "type", "button");
|
|
284
|
+
(0, import_vobs4.setAttribute)(groupButton, "class", "vobs-kit-menu__link vobs-kit-menu__group-toggle");
|
|
285
|
+
(0, import_vobs4.setAttribute)(groupButton, "aria-expanded", isExpanded ? "true" : "false");
|
|
1028
286
|
if (collapsed) setOptionalAttribute(groupButton, "title", item.label);
|
|
1029
287
|
appendMenuContent(groupButton, item, collapsed);
|
|
1030
|
-
addEventListener(groupButton, "click", () => {
|
|
288
|
+
(0, import_vobs4.addEventListener)(groupButton, "click", () => {
|
|
1031
289
|
toggleExpanded(expanded, item.key);
|
|
1032
290
|
if (item.href !== void 0) emitSelect(props, item);
|
|
1033
291
|
});
|
|
1034
|
-
insertBefore(li, groupButton, null);
|
|
292
|
+
(0, import_vobs4.insertBefore)(li, groupButton, null);
|
|
1035
293
|
if (isExpanded) {
|
|
1036
|
-
const nested = createElement("ul");
|
|
1037
|
-
setAttribute(nested, "class", "vobs-kit-menu__children");
|
|
1038
|
-
setAttribute(nested, "role", "menu");
|
|
294
|
+
const nested = (0, import_vobs4.createElement)("ul");
|
|
295
|
+
(0, import_vobs4.setAttribute)(nested, "class", "vobs-kit-menu__children");
|
|
296
|
+
(0, import_vobs4.setAttribute)(nested, "role", "menu");
|
|
1039
297
|
for (const child of children) {
|
|
1040
|
-
insertBefore(nested, createMenuItem(child, props, activeKey, collapsed, expanded), null);
|
|
298
|
+
(0, import_vobs4.insertBefore)(nested, createMenuItem(child, props, activeKey, collapsed, expanded), null);
|
|
1041
299
|
}
|
|
1042
|
-
insertBefore(li, nested, null);
|
|
300
|
+
(0, import_vobs4.insertBefore)(li, nested, null);
|
|
1043
301
|
}
|
|
1044
302
|
} else {
|
|
1045
|
-
const link = createElement(item.href === void 0 ? "button" : "a");
|
|
1046
|
-
setAttribute(link, "class", "vobs-kit-menu__link");
|
|
1047
|
-
if (item.href === void 0) setAttribute(link, "type", "button");
|
|
303
|
+
const link = (0, import_vobs4.createElement)(item.href === void 0 ? "button" : "a");
|
|
304
|
+
(0, import_vobs4.setAttribute)(link, "class", "vobs-kit-menu__link");
|
|
305
|
+
if (item.href === void 0) (0, import_vobs4.setAttribute)(link, "type", "button");
|
|
1048
306
|
else {
|
|
1049
|
-
setAttribute(link, "href", item.href);
|
|
307
|
+
(0, import_vobs4.setAttribute)(link, "href", item.href);
|
|
1050
308
|
setOptionalAttribute(link, "target", item.target);
|
|
1051
309
|
setOptionalAttribute(link, "rel", item.rel);
|
|
1052
310
|
}
|
|
1053
|
-
if (active) setAttribute(link, "aria-current", "page");
|
|
311
|
+
if (active) (0, import_vobs4.setAttribute)(link, "aria-current", "page");
|
|
1054
312
|
if (item.disabled === true) {
|
|
1055
|
-
setAttribute(link, "aria-disabled", "true");
|
|
1056
|
-
setProperty(link, "disabled", true);
|
|
313
|
+
(0, import_vobs4.setAttribute)(link, "aria-disabled", "true");
|
|
314
|
+
(0, import_vobs4.setProperty)(link, "disabled", true);
|
|
1057
315
|
}
|
|
1058
316
|
if (collapsed) setOptionalAttribute(link, "title", item.label);
|
|
1059
317
|
appendMenuContent(link, item, collapsed);
|
|
1060
|
-
addEventListener(link, "click", (event) => {
|
|
318
|
+
(0, import_vobs4.addEventListener)(link, "click", (event) => {
|
|
1061
319
|
if (item.disabled === true) {
|
|
1062
320
|
event.preventDefault?.();
|
|
1063
321
|
return;
|
|
1064
322
|
}
|
|
1065
323
|
emitSelect(props, item);
|
|
1066
324
|
});
|
|
1067
|
-
insertBefore(li, link, null);
|
|
325
|
+
(0, import_vobs4.insertBefore)(li, link, null);
|
|
1068
326
|
}
|
|
1069
327
|
return li;
|
|
1070
328
|
}
|
|
1071
329
|
__name(createMenuItem, "createMenuItem");
|
|
1072
330
|
function appendMenuContent(parent, item, collapsed) {
|
|
1073
331
|
if (item.icon !== void 0) {
|
|
1074
|
-
const icon = createElement("span");
|
|
1075
|
-
setAttribute(icon, "class", "vobs-kit-menu__icon");
|
|
332
|
+
const icon = (0, import_vobs4.createElement)("span");
|
|
333
|
+
(0, import_vobs4.setAttribute)(icon, "class", "vobs-kit-menu__icon");
|
|
1076
334
|
mountSlot(icon, item, "icon");
|
|
1077
|
-
insertBefore(parent, icon, null);
|
|
335
|
+
(0, import_vobs4.insertBefore)(parent, icon, null);
|
|
1078
336
|
}
|
|
1079
|
-
const label = createElement("span");
|
|
1080
|
-
setAttribute(label, "class", "vobs-kit-menu__label");
|
|
1081
|
-
insertBefore(label, createText(item.label), null);
|
|
1082
|
-
insertBefore(parent, label, null);
|
|
337
|
+
const label = (0, import_vobs4.createElement)("span");
|
|
338
|
+
(0, import_vobs4.setAttribute)(label, "class", "vobs-kit-menu__label");
|
|
339
|
+
(0, import_vobs4.insertBefore)(label, (0, import_vobs4.createText)(item.label), null);
|
|
340
|
+
(0, import_vobs4.insertBefore)(parent, label, null);
|
|
1083
341
|
if (item.badge !== void 0 && !collapsed) {
|
|
1084
|
-
const badge = createElement("span");
|
|
1085
|
-
setAttribute(badge, "class", "vobs-kit-menu__badge");
|
|
342
|
+
const badge = (0, import_vobs4.createElement)("span");
|
|
343
|
+
(0, import_vobs4.setAttribute)(badge, "class", "vobs-kit-menu__badge");
|
|
1086
344
|
mountSlot(badge, item, "badge");
|
|
1087
|
-
insertBefore(parent, badge, null);
|
|
345
|
+
(0, import_vobs4.insertBefore)(parent, badge, null);
|
|
1088
346
|
}
|
|
1089
347
|
if (item.children && item.children.length > 0) {
|
|
1090
|
-
const expand = createElement("span");
|
|
1091
|
-
setAttribute(expand, "class", "vobs-kit-menu__expand");
|
|
1092
|
-
setAttribute(expand, "aria-hidden", "true");
|
|
1093
|
-
insertBefore(parent, expand, null);
|
|
348
|
+
const expand = (0, import_vobs4.createElement)("span");
|
|
349
|
+
(0, import_vobs4.setAttribute)(expand, "class", "vobs-kit-menu__expand");
|
|
350
|
+
(0, import_vobs4.setAttribute)(expand, "aria-hidden", "true");
|
|
351
|
+
(0, import_vobs4.insertBefore)(parent, expand, null);
|
|
1094
352
|
}
|
|
1095
353
|
}
|
|
1096
354
|
__name(appendMenuContent, "appendMenuContent");
|
|
@@ -1114,8 +372,8 @@ __name(hasActiveDescendant, "hasActiveDescendant");
|
|
|
1114
372
|
|
|
1115
373
|
// packages/layout/src/sidebar.ts
|
|
1116
374
|
function KitSidebar(props = {}) {
|
|
1117
|
-
const root = createElement("aside");
|
|
1118
|
-
const close = createElement("button");
|
|
375
|
+
const root = (0, import_vobs5.createElement)("aside");
|
|
376
|
+
const close = (0, import_vobs5.createElement)("button");
|
|
1119
377
|
bindClassList(root, props, () => [
|
|
1120
378
|
"vobs-kit-sidebar",
|
|
1121
379
|
readProp(props, "collapsed", false) ? "is-collapsed" : void 0,
|
|
@@ -1135,23 +393,23 @@ function KitSidebar(props = {}) {
|
|
|
1135
393
|
"onClose"
|
|
1136
394
|
]);
|
|
1137
395
|
bindUserStyle(root, props);
|
|
1138
|
-
setAttribute(close, "type", "button");
|
|
1139
|
-
setAttribute(close, "class", "vobs-kit-sidebar__close");
|
|
1140
|
-
effect(() => {
|
|
396
|
+
(0, import_vobs5.setAttribute)(close, "type", "button");
|
|
397
|
+
(0, import_vobs5.setAttribute)(close, "class", "vobs-kit-sidebar__close");
|
|
398
|
+
(0, import_reactivity4.effect)(() => {
|
|
1141
399
|
setOptionalAttribute(close, "aria-label", readProp(props, "closeLabel", "Close navigation"));
|
|
1142
400
|
});
|
|
1143
|
-
insertBefore(close, createCloseLabel(props), null);
|
|
1144
|
-
addEventListener(close, "click", () => {
|
|
401
|
+
(0, import_vobs5.insertBefore)(close, createCloseLabel(props), null);
|
|
402
|
+
(0, import_vobs5.addEventListener)(close, "click", () => {
|
|
1145
403
|
const handler = readProp(props, "onClose", void 0);
|
|
1146
404
|
if (typeof handler === "function") handler();
|
|
1147
405
|
});
|
|
1148
|
-
insertBefore(root, close, null);
|
|
1149
|
-
insertDynamic(root, null, () => createDefaultMenu(props));
|
|
406
|
+
(0, import_vobs5.insertBefore)(root, close, null);
|
|
407
|
+
(0, import_vobs5.insertDynamic)(root, null, () => createDefaultMenu(props));
|
|
1150
408
|
if (hasProp(props, "footer")) {
|
|
1151
|
-
const footer = createElement("div");
|
|
1152
|
-
setAttribute(footer, "class", "vobs-kit-sidebar__footer");
|
|
409
|
+
const footer = (0, import_vobs5.createElement)("div");
|
|
410
|
+
(0, import_vobs5.setAttribute)(footer, "class", "vobs-kit-sidebar__footer");
|
|
1153
411
|
mountSlot(footer, props, "footer");
|
|
1154
|
-
insertBefore(root, footer, null);
|
|
412
|
+
(0, import_vobs5.insertBefore)(root, footer, null);
|
|
1155
413
|
}
|
|
1156
414
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1157
415
|
return root;
|
|
@@ -1160,7 +418,7 @@ __name(KitSidebar, "KitSidebar");
|
|
|
1160
418
|
function createDefaultMenu(props) {
|
|
1161
419
|
const items = readProp(props, "items", void 0) ?? readProp(props, "menu", []);
|
|
1162
420
|
if (items.length === 0 && hasProp(props, "children")) return null;
|
|
1163
|
-
return createComponent(KitMenu, {
|
|
421
|
+
return (0, import_vobs5.createComponent)(KitMenu, {
|
|
1164
422
|
get items() {
|
|
1165
423
|
return items;
|
|
1166
424
|
},
|
|
@@ -1177,22 +435,23 @@ function createDefaultMenu(props) {
|
|
|
1177
435
|
}
|
|
1178
436
|
__name(createDefaultMenu, "createDefaultMenu");
|
|
1179
437
|
function createCloseLabel(props) {
|
|
1180
|
-
const text = createElement("span");
|
|
1181
|
-
const content = createText("");
|
|
1182
|
-
setAttribute(text, "class", "vobs-kit-sidebar__close-label");
|
|
438
|
+
const text = (0, import_vobs5.createElement)("span");
|
|
439
|
+
const content = (0, import_vobs5.createText)("");
|
|
440
|
+
(0, import_vobs5.setAttribute)(text, "class", "vobs-kit-sidebar__close-label");
|
|
1183
441
|
bindTextContent(content, () => readProp(props, "closeLabel", "Close navigation"));
|
|
1184
|
-
insertBefore(text, content, null);
|
|
442
|
+
(0, import_vobs5.insertBefore)(text, content, null);
|
|
1185
443
|
return text;
|
|
1186
444
|
}
|
|
1187
445
|
__name(createCloseLabel, "createCloseLabel");
|
|
1188
446
|
|
|
1189
447
|
// packages/layout/src/viewport.ts
|
|
448
|
+
var import_reactivity5 = require("@vobs/reactivity");
|
|
1190
449
|
var DEFAULT_MOBILE_BREAKPOINT = 768;
|
|
1191
450
|
function createKitViewport(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
|
|
1192
451
|
const normalizedBreakpoint = normalizeBreakpoint(breakpoint);
|
|
1193
|
-
const width = state(readWidth(), "layout.viewport.width");
|
|
1194
|
-
const height = state(readHeight(), "layout.viewport.height");
|
|
1195
|
-
const isMobile = memo(() => width.value < normalizedBreakpoint);
|
|
452
|
+
const width = (0, import_reactivity5.state)(readWidth(), "layout.viewport.width");
|
|
453
|
+
const height = (0, import_reactivity5.state)(readHeight(), "layout.viewport.height");
|
|
454
|
+
const isMobile = (0, import_reactivity5.memo)(() => width.value < normalizedBreakpoint);
|
|
1196
455
|
let disposed = false;
|
|
1197
456
|
const onResize = /* @__PURE__ */ __name(() => {
|
|
1198
457
|
if (disposed) return;
|
|
@@ -1215,7 +474,7 @@ function createKitViewport(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
|
|
|
1215
474
|
height.dispose();
|
|
1216
475
|
}
|
|
1217
476
|
};
|
|
1218
|
-
if (getCurrentOwner()) onDispose(viewport.dispose);
|
|
477
|
+
if ((0, import_reactivity5.getCurrentOwner)()) (0, import_reactivity5.onDispose)(viewport.dispose);
|
|
1219
478
|
return viewport;
|
|
1220
479
|
}
|
|
1221
480
|
__name(createKitViewport, "createKitViewport");
|
|
@@ -1237,33 +496,33 @@ __name(readHeight, "readHeight");
|
|
|
1237
496
|
|
|
1238
497
|
// packages/layout/src/layout.ts
|
|
1239
498
|
function KitLayout(props = {}) {
|
|
1240
|
-
const root = createElement("div");
|
|
1241
|
-
const header = createElement("div");
|
|
1242
|
-
const body = createElement("div");
|
|
1243
|
-
const sidebar = createElement("div");
|
|
1244
|
-
const main = createElement("main");
|
|
1245
|
-
const breadcrumb = createElement("div");
|
|
1246
|
-
const tabs = createElement("div");
|
|
1247
|
-
const content = createElement("div");
|
|
1248
|
-
const backdrop = createElement("div");
|
|
1249
|
-
const footer = createElement("footer");
|
|
499
|
+
const root = (0, import_vobs6.createElement)("div");
|
|
500
|
+
const header = (0, import_vobs6.createElement)("div");
|
|
501
|
+
const body = (0, import_vobs6.createElement)("div");
|
|
502
|
+
const sidebar = (0, import_vobs6.createElement)("div");
|
|
503
|
+
const main = (0, import_vobs6.createElement)("main");
|
|
504
|
+
const breadcrumb = (0, import_vobs6.createElement)("div");
|
|
505
|
+
const tabs = (0, import_vobs6.createElement)("div");
|
|
506
|
+
const content = (0, import_vobs6.createElement)("div");
|
|
507
|
+
const backdrop = (0, import_vobs6.createElement)("div");
|
|
508
|
+
const footer = (0, import_vobs6.createElement)("footer");
|
|
1250
509
|
const breakpoint = normalizeBreakpoint(
|
|
1251
510
|
readProp(props, "mobileBreakpoint", DEFAULT_MOBILE_BREAKPOINT)
|
|
1252
511
|
);
|
|
1253
512
|
const viewport = createKitViewport(breakpoint);
|
|
1254
513
|
const sidebarExpanded = readProp(props, "sidebarExpanded", false);
|
|
1255
|
-
const internalCollapsed = state(
|
|
514
|
+
const internalCollapsed = (0, import_reactivity6.state)(
|
|
1256
515
|
readProp(props, "sidebarCollapsed", void 0) ?? !sidebarExpanded
|
|
1257
516
|
);
|
|
1258
|
-
const internalMobileOpen = state(readProp(props, "mobileOpen", void 0) ?? false);
|
|
1259
|
-
const collapsed = memo(() => readProp(props, "sidebarCollapsed", void 0) ?? internalCollapsed.value);
|
|
1260
|
-
const mobileOpen = memo(() => readProp(props, "mobileOpen", void 0) ?? internalMobileOpen.value);
|
|
1261
|
-
const headerVisible = state(!isProvided(props, "header"));
|
|
1262
|
-
const sidebarVisible = state(isProvided(props, "sidebar") || hasProp(props, "menu"));
|
|
1263
|
-
const backdropVisible = state(!isProvided(props, "mobileBackdrop"));
|
|
1264
|
-
const breadcrumbVisible = state(false);
|
|
1265
|
-
const tabsVisible = state(false);
|
|
1266
|
-
const footerVisible = state(false);
|
|
517
|
+
const internalMobileOpen = (0, import_reactivity6.state)(readProp(props, "mobileOpen", void 0) ?? false);
|
|
518
|
+
const collapsed = (0, import_reactivity6.memo)(() => readProp(props, "sidebarCollapsed", void 0) ?? internalCollapsed.value);
|
|
519
|
+
const mobileOpen = (0, import_reactivity6.memo)(() => readProp(props, "mobileOpen", void 0) ?? internalMobileOpen.value);
|
|
520
|
+
const headerVisible = (0, import_reactivity6.state)(!isProvided(props, "header"));
|
|
521
|
+
const sidebarVisible = (0, import_reactivity6.state)(isProvided(props, "sidebar") || hasProp(props, "menu"));
|
|
522
|
+
const backdropVisible = (0, import_reactivity6.state)(!isProvided(props, "mobileBackdrop"));
|
|
523
|
+
const breadcrumbVisible = (0, import_reactivity6.state)(false);
|
|
524
|
+
const tabsVisible = (0, import_reactivity6.state)(false);
|
|
525
|
+
const footerVisible = (0, import_reactivity6.state)(false);
|
|
1267
526
|
const context = {
|
|
1268
527
|
sidebarCollapsed: collapsed,
|
|
1269
528
|
mobileOpen,
|
|
@@ -1292,7 +551,7 @@ function KitLayout(props = {}) {
|
|
|
1292
551
|
if (typeof handler === "function") handler(value);
|
|
1293
552
|
}
|
|
1294
553
|
};
|
|
1295
|
-
provide(KIT_LAYOUT_KEY, context);
|
|
554
|
+
(0, import_vobs6.provide)(KIT_LAYOUT_KEY, context);
|
|
1296
555
|
bindClassList(root, props, () => [
|
|
1297
556
|
"vobs-kit-layout",
|
|
1298
557
|
collapsed.value ? "vobs-kit-layout--sidebar-collapsed" : void 0,
|
|
@@ -1327,41 +586,41 @@ function KitLayout(props = {}) {
|
|
|
1327
586
|
if (sidebarWidth === void 0) return "";
|
|
1328
587
|
return `--vobs-kit-sidebar-width: ${normalizeSidebarWidth(sidebarWidth)}px`;
|
|
1329
588
|
});
|
|
1330
|
-
setAttribute(header, "class", "vobs-kit-layout__header");
|
|
1331
|
-
insertDynamic(header, null, () => createHeaderSlot(props, context, headerVisible));
|
|
589
|
+
(0, import_vobs6.setAttribute)(header, "class", "vobs-kit-layout__header");
|
|
590
|
+
(0, import_vobs6.insertDynamic)(header, null, () => createHeaderSlot(props, context, headerVisible));
|
|
1332
591
|
bindVisibility(header, headerVisible);
|
|
1333
|
-
setAttribute(body, "class", "vobs-kit-layout__body");
|
|
1334
|
-
setAttribute(sidebar, "class", "vobs-kit-layout__sidebar");
|
|
1335
|
-
setAttribute(main, "class", "vobs-kit-layout__main");
|
|
1336
|
-
setAttribute(breadcrumb, "class", "vobs-kit-layout__breadcrumb");
|
|
1337
|
-
setAttribute(tabs, "class", "vobs-kit-layout__tabs");
|
|
1338
|
-
setAttribute(content, "class", "vobs-kit-layout__content");
|
|
1339
|
-
insertDynamic(sidebar, null, () => createSidebarSlot(props, context, sidebarVisible));
|
|
592
|
+
(0, import_vobs6.setAttribute)(body, "class", "vobs-kit-layout__body");
|
|
593
|
+
(0, import_vobs6.setAttribute)(sidebar, "class", "vobs-kit-layout__sidebar");
|
|
594
|
+
(0, import_vobs6.setAttribute)(main, "class", "vobs-kit-layout__main");
|
|
595
|
+
(0, import_vobs6.setAttribute)(breadcrumb, "class", "vobs-kit-layout__breadcrumb");
|
|
596
|
+
(0, import_vobs6.setAttribute)(tabs, "class", "vobs-kit-layout__tabs");
|
|
597
|
+
(0, import_vobs6.setAttribute)(content, "class", "vobs-kit-layout__content");
|
|
598
|
+
(0, import_vobs6.insertDynamic)(sidebar, null, () => createSidebarSlot(props, context, sidebarVisible));
|
|
1340
599
|
bindVisibility(sidebar, sidebarVisible);
|
|
1341
|
-
insertDynamic(breadcrumb, null, () => createNamedSlot(props, "breadcrumb", breadcrumbVisible));
|
|
600
|
+
(0, import_vobs6.insertDynamic)(breadcrumb, null, () => createNamedSlot(props, "breadcrumb", breadcrumbVisible));
|
|
1342
601
|
bindVisibility(breadcrumb, breadcrumbVisible);
|
|
1343
|
-
insertDynamic(tabs, null, () => createNamedSlot(props, "tabs", tabsVisible));
|
|
602
|
+
(0, import_vobs6.insertDynamic)(tabs, null, () => createNamedSlot(props, "tabs", tabsVisible));
|
|
1344
603
|
bindVisibility(tabs, tabsVisible);
|
|
1345
604
|
if (hasProp(props, "children")) mountSlot(content, props, "children");
|
|
1346
|
-
insertBefore(main, breadcrumb, null);
|
|
1347
|
-
insertBefore(main, tabs, null);
|
|
1348
|
-
insertBefore(main, content, null);
|
|
1349
|
-
insertBefore(body, sidebar, null);
|
|
1350
|
-
insertBefore(body, main, null);
|
|
1351
|
-
setAttribute(backdrop, "class", "vobs-kit-layout__backdrop");
|
|
1352
|
-
insertDynamic(backdrop, null, () => createBackdropSlot(props, context, sidebarVisible, backdropVisible));
|
|
1353
|
-
bindVisibility(backdrop, memo(() => backdropVisible.value && sidebarVisible.value && mobileOpen.value));
|
|
1354
|
-
setAttribute(footer, "class", "vobs-kit-layout__footer");
|
|
1355
|
-
insertDynamic(footer, null, () => {
|
|
605
|
+
(0, import_vobs6.insertBefore)(main, breadcrumb, null);
|
|
606
|
+
(0, import_vobs6.insertBefore)(main, tabs, null);
|
|
607
|
+
(0, import_vobs6.insertBefore)(main, content, null);
|
|
608
|
+
(0, import_vobs6.insertBefore)(body, sidebar, null);
|
|
609
|
+
(0, import_vobs6.insertBefore)(body, main, null);
|
|
610
|
+
(0, import_vobs6.setAttribute)(backdrop, "class", "vobs-kit-layout__backdrop");
|
|
611
|
+
(0, import_vobs6.insertDynamic)(backdrop, null, () => createBackdropSlot(props, context, sidebarVisible, backdropVisible));
|
|
612
|
+
bindVisibility(backdrop, (0, import_reactivity6.memo)(() => backdropVisible.value && sidebarVisible.value && mobileOpen.value));
|
|
613
|
+
(0, import_vobs6.setAttribute)(footer, "class", "vobs-kit-layout__footer");
|
|
614
|
+
(0, import_vobs6.insertDynamic)(footer, null, () => {
|
|
1356
615
|
const value = isProvided(props, "footer") ? resolveSlot(readProp(props, "footer", void 0)) : null;
|
|
1357
616
|
footerVisible.value = value !== null;
|
|
1358
617
|
return value;
|
|
1359
618
|
});
|
|
1360
619
|
bindVisibility(footer, footerVisible);
|
|
1361
|
-
insertBefore(root, header, null);
|
|
1362
|
-
insertBefore(root, body, null);
|
|
1363
|
-
insertBefore(root, backdrop, null);
|
|
1364
|
-
insertBefore(root, footer, null);
|
|
620
|
+
(0, import_vobs6.insertBefore)(root, header, null);
|
|
621
|
+
(0, import_vobs6.insertBefore)(root, body, null);
|
|
622
|
+
(0, import_vobs6.insertBefore)(root, backdrop, null);
|
|
623
|
+
(0, import_vobs6.insertBefore)(root, footer, null);
|
|
1365
624
|
return root;
|
|
1366
625
|
}
|
|
1367
626
|
__name(KitLayout, "KitLayout");
|
|
@@ -1372,7 +631,7 @@ function createHeaderSlot(props, context, visible) {
|
|
|
1372
631
|
return value;
|
|
1373
632
|
}
|
|
1374
633
|
visible.value = true;
|
|
1375
|
-
return createComponent(KitHeader, {
|
|
634
|
+
return (0, import_vobs6.createComponent)(KitHeader, {
|
|
1376
635
|
get logo() {
|
|
1377
636
|
return readProp(props, "logo", void 0);
|
|
1378
637
|
},
|
|
@@ -1404,7 +663,7 @@ function createSidebarSlot(props, context, visible) {
|
|
|
1404
663
|
return null;
|
|
1405
664
|
}
|
|
1406
665
|
visible.value = true;
|
|
1407
|
-
return createComponent(KitSidebar, {
|
|
666
|
+
return (0, import_vobs6.createComponent)(KitSidebar, {
|
|
1408
667
|
get menu() {
|
|
1409
668
|
return readProp(props, "menu", []);
|
|
1410
669
|
},
|
|
@@ -1448,12 +707,12 @@ function createBackdropSlot(props, context, sidebarVisible, visible) {
|
|
|
1448
707
|
return null;
|
|
1449
708
|
}
|
|
1450
709
|
visible.value = true;
|
|
1451
|
-
const button = createElement("button");
|
|
1452
|
-
setAttribute(button, "type", "button");
|
|
1453
|
-
setAttribute(button, "class", "vobs-kit-layout__backdrop-button");
|
|
1454
|
-
setAttribute(button, "aria-label", "Close navigation");
|
|
1455
|
-
insertBefore(button, createText(""), null);
|
|
1456
|
-
addEventListener(button, "click", () => {
|
|
710
|
+
const button = (0, import_vobs6.createElement)("button");
|
|
711
|
+
(0, import_vobs6.setAttribute)(button, "type", "button");
|
|
712
|
+
(0, import_vobs6.setAttribute)(button, "class", "vobs-kit-layout__backdrop-button");
|
|
713
|
+
(0, import_vobs6.setAttribute)(button, "aria-label", "Close navigation");
|
|
714
|
+
(0, import_vobs6.insertBefore)(button, (0, import_vobs6.createText)(""), null);
|
|
715
|
+
(0, import_vobs6.addEventListener)(button, "click", () => {
|
|
1457
716
|
context.setMobileOpen(false);
|
|
1458
717
|
const handler = readProp(props, "onCloseSidebar", void 0);
|
|
1459
718
|
if (typeof handler === "function") handler();
|
|
@@ -1462,8 +721,8 @@ function createBackdropSlot(props, context, sidebarVisible, visible) {
|
|
|
1462
721
|
}
|
|
1463
722
|
__name(createBackdropSlot, "createBackdropSlot");
|
|
1464
723
|
function bindVisibility(node, visible) {
|
|
1465
|
-
effect(() => {
|
|
1466
|
-
setProperty(node, "hidden", !visible.value);
|
|
724
|
+
(0, import_reactivity6.effect)(() => {
|
|
725
|
+
(0, import_vobs6.setProperty)(node, "hidden", !visible.value);
|
|
1467
726
|
setOptionalAttribute(node, "aria-hidden", visible.value ? void 0 : "true");
|
|
1468
727
|
});
|
|
1469
728
|
}
|
|
@@ -1485,51 +744,52 @@ function isProvided(props, name) {
|
|
|
1485
744
|
__name(isProvided, "isProvided");
|
|
1486
745
|
|
|
1487
746
|
// packages/layout/src/breadcrumb.ts
|
|
747
|
+
var import_vobs7 = require("@vobs/vobs");
|
|
1488
748
|
function KitBreadcrumb(props) {
|
|
1489
|
-
const root = createElement("nav");
|
|
749
|
+
const root = (0, import_vobs7.createElement)("nav");
|
|
1490
750
|
bindClassList(root, props, () => ["vobs-kit-breadcrumb"]);
|
|
1491
751
|
bindCommonAttributes(root, props, ["items", "separator", "onNavigate"]);
|
|
1492
|
-
if (!hasProp(props, "aria-label")) setAttribute(root, "aria-label", "Breadcrumb");
|
|
1493
|
-
const list = createElement("ol");
|
|
1494
|
-
setAttribute(list, "class", "vobs-kit-breadcrumb__list");
|
|
1495
|
-
insertDynamic(list, null, () => createBreadcrumbItems(props));
|
|
1496
|
-
insertBefore(root, list, null);
|
|
752
|
+
if (!hasProp(props, "aria-label")) (0, import_vobs7.setAttribute)(root, "aria-label", "Breadcrumb");
|
|
753
|
+
const list = (0, import_vobs7.createElement)("ol");
|
|
754
|
+
(0, import_vobs7.setAttribute)(list, "class", "vobs-kit-breadcrumb__list");
|
|
755
|
+
(0, import_vobs7.insertDynamic)(list, null, () => createBreadcrumbItems(props));
|
|
756
|
+
(0, import_vobs7.insertBefore)(root, list, null);
|
|
1497
757
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1498
758
|
return root;
|
|
1499
759
|
}
|
|
1500
760
|
__name(KitBreadcrumb, "KitBreadcrumb");
|
|
1501
761
|
function createBreadcrumbItems(props) {
|
|
1502
762
|
const items = readProp(props, "items", []);
|
|
1503
|
-
return createFragment((parent, anchor) => {
|
|
763
|
+
return (0, import_vobs7.createFragment)((parent, anchor) => {
|
|
1504
764
|
for (let index = 0; index < items.length; index++) {
|
|
1505
765
|
const item = items[index];
|
|
1506
|
-
const entry = createElement("li");
|
|
766
|
+
const entry = (0, import_vobs7.createElement)("li");
|
|
1507
767
|
const isLast = index === items.length - 1;
|
|
1508
|
-
setAttribute(entry, "class", `vobs-kit-breadcrumb__item${isLast ? " is-current" : ""}`);
|
|
768
|
+
(0, import_vobs7.setAttribute)(entry, "class", `vobs-kit-breadcrumb__item${isLast ? " is-current" : ""}`);
|
|
1509
769
|
if (item.key !== void 0) setOptionalAttribute(entry, "data-breadcrumb-key", item.key);
|
|
1510
770
|
if (index > 0) {
|
|
1511
|
-
const separator = createElement("span");
|
|
1512
|
-
setAttribute(separator, "class", "vobs-kit-breadcrumb__separator");
|
|
1513
|
-
setAttribute(separator, "aria-hidden", "true");
|
|
771
|
+
const separator = (0, import_vobs7.createElement)("span");
|
|
772
|
+
(0, import_vobs7.setAttribute)(separator, "class", "vobs-kit-breadcrumb__separator");
|
|
773
|
+
(0, import_vobs7.setAttribute)(separator, "aria-hidden", "true");
|
|
1514
774
|
if (hasProp(props, "separator")) mountSlot(separator, props, "separator");
|
|
1515
|
-
else insertBefore(separator, createText("/"), null);
|
|
1516
|
-
insertBefore(entry, separator, null);
|
|
775
|
+
else (0, import_vobs7.insertBefore)(separator, (0, import_vobs7.createText)("/"), null);
|
|
776
|
+
(0, import_vobs7.insertBefore)(entry, separator, null);
|
|
1517
777
|
}
|
|
1518
778
|
const content = createBreadcrumbContent(item, props, index, isLast);
|
|
1519
|
-
insertBefore(entry, content, null);
|
|
1520
|
-
insertBefore(parent, entry, anchor);
|
|
779
|
+
(0, import_vobs7.insertBefore)(entry, content, null);
|
|
780
|
+
(0, import_vobs7.insertBefore)(parent, entry, anchor);
|
|
1521
781
|
}
|
|
1522
782
|
});
|
|
1523
783
|
}
|
|
1524
784
|
__name(createBreadcrumbItems, "createBreadcrumbItems");
|
|
1525
785
|
function createBreadcrumbContent(item, props, index, isLast) {
|
|
1526
786
|
const isLink = item.href !== void 0 && !isLast;
|
|
1527
|
-
const element = isLink ? createElement("a") : createElement("span");
|
|
1528
|
-
setAttribute(element, "class", "vobs-kit-breadcrumb__label");
|
|
1529
|
-
insertBefore(element, createText(item.label), null);
|
|
787
|
+
const element = isLink ? (0, import_vobs7.createElement)("a") : (0, import_vobs7.createElement)("span");
|
|
788
|
+
(0, import_vobs7.setAttribute)(element, "class", "vobs-kit-breadcrumb__label");
|
|
789
|
+
(0, import_vobs7.insertBefore)(element, (0, import_vobs7.createText)(item.label), null);
|
|
1530
790
|
if (isLink) {
|
|
1531
|
-
setAttribute(element, "href", item.href);
|
|
1532
|
-
addEventListener(element, "click", (event) => {
|
|
791
|
+
(0, import_vobs7.setAttribute)(element, "href", item.href);
|
|
792
|
+
(0, import_vobs7.addEventListener)(element, "click", (event) => {
|
|
1533
793
|
if (item.disabled === true) {
|
|
1534
794
|
event.preventDefault?.();
|
|
1535
795
|
return;
|
|
@@ -1541,18 +801,20 @@ function createBreadcrumbContent(item, props, index, isLast) {
|
|
|
1541
801
|
});
|
|
1542
802
|
}
|
|
1543
803
|
if (item.disabled === true) {
|
|
1544
|
-
setAttribute(element, "aria-disabled", "true");
|
|
1545
|
-
setProperty(element, "tabIndex", -1);
|
|
804
|
+
(0, import_vobs7.setAttribute)(element, "aria-disabled", "true");
|
|
805
|
+
(0, import_vobs7.setProperty)(element, "tabIndex", -1);
|
|
1546
806
|
}
|
|
1547
|
-
if (isLast) setAttribute(element, "aria-current", "page");
|
|
807
|
+
if (isLast) (0, import_vobs7.setAttribute)(element, "aria-current", "page");
|
|
1548
808
|
return element;
|
|
1549
809
|
}
|
|
1550
810
|
__name(createBreadcrumbContent, "createBreadcrumbContent");
|
|
1551
811
|
|
|
1552
812
|
// packages/layout/src/tabs.ts
|
|
813
|
+
var import_reactivity7 = require("@vobs/reactivity");
|
|
814
|
+
var import_vobs8 = require("@vobs/vobs");
|
|
1553
815
|
function KitTabs(props = {}) {
|
|
1554
|
-
const root = createElement("nav");
|
|
1555
|
-
const active = state(void 0);
|
|
816
|
+
const root = (0, import_vobs8.createElement)("nav");
|
|
817
|
+
const active = (0, import_reactivity7.state)(void 0);
|
|
1556
818
|
bindClassList(root, props, () => ["vobs-kit-tabs"]);
|
|
1557
819
|
bindCommonAttributes(root, props, [
|
|
1558
820
|
"tabs",
|
|
@@ -1564,9 +826,9 @@ function KitTabs(props = {}) {
|
|
|
1564
826
|
"onChange",
|
|
1565
827
|
"onClose"
|
|
1566
828
|
]);
|
|
1567
|
-
if (!hasProp(props, "aria-label")) setAttribute(root, "aria-label", "Tabs");
|
|
1568
|
-
if (!hasProp(props, "role")) setAttribute(root, "role", "tablist");
|
|
1569
|
-
insertDynamic(root, null, () => createTabItems(props, active));
|
|
829
|
+
if (!hasProp(props, "aria-label")) (0, import_vobs8.setAttribute)(root, "aria-label", "Tabs");
|
|
830
|
+
if (!hasProp(props, "role")) (0, import_vobs8.setAttribute)(root, "role", "tablist");
|
|
831
|
+
(0, import_vobs8.insertDynamic)(root, null, () => createTabItems(props, active));
|
|
1570
832
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1571
833
|
return root;
|
|
1572
834
|
}
|
|
@@ -1578,52 +840,52 @@ function createTabItems(props, internal) {
|
|
|
1578
840
|
"activeKey",
|
|
1579
841
|
readProp(props, "value", void 0)
|
|
1580
842
|
) ?? internal.value ?? tabs.find((tab) => tab.disabled !== true)?.id;
|
|
1581
|
-
return createFragment((parent, anchor) => {
|
|
843
|
+
return (0, import_vobs8.createFragment)((parent, anchor) => {
|
|
1582
844
|
for (const tab of tabs) {
|
|
1583
|
-
insertBefore(parent, createTab(tab, props, selected, internal), anchor);
|
|
845
|
+
(0, import_vobs8.insertBefore)(parent, createTab(tab, props, selected, internal), anchor);
|
|
1584
846
|
}
|
|
1585
847
|
});
|
|
1586
848
|
}
|
|
1587
849
|
__name(createTabItems, "createTabItems");
|
|
1588
850
|
function createTab(tab, props, selected, internal) {
|
|
1589
851
|
const active = tab.id === selected;
|
|
1590
|
-
const element = createElement(tab.href === void 0 ? "button" : "a");
|
|
1591
|
-
setAttribute(element, "class", `vobs-kit-tabs__tab${active ? " is-active" : ""}`);
|
|
1592
|
-
setAttribute(element, "role", "tab");
|
|
1593
|
-
setAttribute(element, "aria-selected", active ? "true" : "false");
|
|
852
|
+
const element = (0, import_vobs8.createElement)(tab.href === void 0 ? "button" : "a");
|
|
853
|
+
(0, import_vobs8.setAttribute)(element, "class", `vobs-kit-tabs__tab${active ? " is-active" : ""}`);
|
|
854
|
+
(0, import_vobs8.setAttribute)(element, "role", "tab");
|
|
855
|
+
(0, import_vobs8.setAttribute)(element, "aria-selected", active ? "true" : "false");
|
|
1594
856
|
setOptionalAttribute(element, "data-tab-id", tab.id);
|
|
1595
|
-
if (tab.href === void 0) setAttribute(element, "type", "button");
|
|
1596
|
-
else setAttribute(element, "href", tab.href);
|
|
857
|
+
if (tab.href === void 0) (0, import_vobs8.setAttribute)(element, "type", "button");
|
|
858
|
+
else (0, import_vobs8.setAttribute)(element, "href", tab.href);
|
|
1597
859
|
if (tab.disabled === true) {
|
|
1598
|
-
setAttribute(element, "aria-disabled", "true");
|
|
1599
|
-
setProperty(element, "tabIndex", -1);
|
|
1600
|
-
if (tab.href === void 0) setProperty(element, "disabled", true);
|
|
860
|
+
(0, import_vobs8.setAttribute)(element, "aria-disabled", "true");
|
|
861
|
+
(0, import_vobs8.setProperty)(element, "tabIndex", -1);
|
|
862
|
+
if (tab.href === void 0) (0, import_vobs8.setProperty)(element, "disabled", true);
|
|
1601
863
|
}
|
|
1602
864
|
if (tab.icon !== void 0) {
|
|
1603
|
-
const icon = createElement("span");
|
|
1604
|
-
setAttribute(icon, "class", "vobs-kit-tabs__icon");
|
|
865
|
+
const icon = (0, import_vobs8.createElement)("span");
|
|
866
|
+
(0, import_vobs8.setAttribute)(icon, "class", "vobs-kit-tabs__icon");
|
|
1605
867
|
mountSlot(icon, tab, "icon");
|
|
1606
|
-
insertBefore(element, icon, null);
|
|
868
|
+
(0, import_vobs8.insertBefore)(element, icon, null);
|
|
1607
869
|
}
|
|
1608
|
-
const label = createElement("span");
|
|
1609
|
-
setAttribute(label, "class", "vobs-kit-tabs__label");
|
|
1610
|
-
insertBefore(label, createText(tab.label), null);
|
|
1611
|
-
insertBefore(element, label, null);
|
|
870
|
+
const label = (0, import_vobs8.createElement)("span");
|
|
871
|
+
(0, import_vobs8.setAttribute)(label, "class", "vobs-kit-tabs__label");
|
|
872
|
+
(0, import_vobs8.insertBefore)(label, (0, import_vobs8.createText)(tab.label), null);
|
|
873
|
+
(0, import_vobs8.insertBefore)(element, label, null);
|
|
1612
874
|
const closable = readProp(props, "closable", false) || tab.closable === true;
|
|
1613
875
|
if (closable) {
|
|
1614
|
-
const close = createElement("button");
|
|
1615
|
-
setAttribute(close, "class", "vobs-kit-tabs__close");
|
|
1616
|
-
setAttribute(close, "type", "button");
|
|
1617
|
-
setAttribute(close, "aria-label", `Close ${tab.label}`);
|
|
1618
|
-
insertBefore(close, createText("x"), null);
|
|
1619
|
-
addEventListener(close, "click", (event) => {
|
|
876
|
+
const close = (0, import_vobs8.createElement)("button");
|
|
877
|
+
(0, import_vobs8.setAttribute)(close, "class", "vobs-kit-tabs__close");
|
|
878
|
+
(0, import_vobs8.setAttribute)(close, "type", "button");
|
|
879
|
+
(0, import_vobs8.setAttribute)(close, "aria-label", `Close ${tab.label}`);
|
|
880
|
+
(0, import_vobs8.insertBefore)(close, (0, import_vobs8.createText)("x"), null);
|
|
881
|
+
(0, import_vobs8.addEventListener)(close, "click", (event) => {
|
|
1620
882
|
event.stopPropagation?.();
|
|
1621
883
|
const handler = readProp(props, "onClose", void 0);
|
|
1622
884
|
if (typeof handler === "function") handler(tab);
|
|
1623
885
|
});
|
|
1624
|
-
insertBefore(element, close, null);
|
|
886
|
+
(0, import_vobs8.insertBefore)(element, close, null);
|
|
1625
887
|
}
|
|
1626
|
-
addEventListener(element, "click", (event) => {
|
|
888
|
+
(0, import_vobs8.addEventListener)(element, "click", (event) => {
|
|
1627
889
|
if (tab.disabled === true) {
|
|
1628
890
|
event.preventDefault?.();
|
|
1629
891
|
return;
|
|
@@ -1641,17 +903,18 @@ function isControlled(props) {
|
|
|
1641
903
|
return readProp(props, "activeKey", void 0) !== void 0 || readProp(props, "value", void 0) !== void 0;
|
|
1642
904
|
}
|
|
1643
905
|
__name(isControlled, "isControlled");
|
|
1644
|
-
|
|
1645
|
-
exports
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
906
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
907
|
+
0 && (module.exports = {
|
|
908
|
+
DEFAULT_MOBILE_BREAKPOINT,
|
|
909
|
+
KIT_LAYOUT_KEY,
|
|
910
|
+
KitBreadcrumb,
|
|
911
|
+
KitHeader,
|
|
912
|
+
KitLayout,
|
|
913
|
+
KitMenu,
|
|
914
|
+
KitSidebar,
|
|
915
|
+
KitTabs,
|
|
916
|
+
createKitViewport,
|
|
917
|
+
normalizeBreakpoint,
|
|
918
|
+
useKitLayout
|
|
919
|
+
});
|
|
1657
920
|
//# sourceMappingURL=index.cjs.map
|