@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/layout.cjs
CHANGED
|
@@ -1,788 +1,44 @@
|
|
|
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);
|
|
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 });
|
|
289
17
|
}
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
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 {
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
__name(attachSourceLocation, "attachSourceLocation");
|
|
632
|
-
function attachComponentContext(reason, component, ownerId) {
|
|
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");
|
|
738
|
-
|
|
739
|
-
// packages/runtime/src/dynamic.ts
|
|
740
|
-
function insertDynamic(parent, anchor, factory) {
|
|
741
|
-
const marker = createComment("vobs:dynamic");
|
|
742
|
-
insertBefore(parent, marker, anchor);
|
|
743
|
-
let current = null;
|
|
744
|
-
effect(() => {
|
|
745
|
-
const next = createBlock(factory);
|
|
746
|
-
if (next === current) return;
|
|
747
|
-
if (current) removeChild(parent, current);
|
|
748
|
-
current = next;
|
|
749
|
-
if (current) insertBefore(parent, current, marker);
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
__name(insertDynamic, "insertDynamic");
|
|
753
|
-
|
|
754
|
-
// packages/vobs/src/context.ts
|
|
755
|
-
var ownerProviders = /* @__PURE__ */ new WeakMap();
|
|
756
|
-
function provide(key, value, options = {}) {
|
|
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 provideToOwner(owner, key, value, options = {}) {
|
|
763
|
-
let providers = ownerProviders.get(owner);
|
|
764
|
-
if (!providers) {
|
|
765
|
-
providers = /* @__PURE__ */ new Map();
|
|
766
|
-
ownerProviders.set(owner, providers);
|
|
767
|
-
owner.onDispose(() => ownerProviders.delete(owner));
|
|
768
|
-
}
|
|
769
|
-
if (providers.has(key) && !options.override) {
|
|
770
|
-
throw new Error(`Vobs: \u6CE8\u5165\u9879 ${String(key)} \u5DF2\u5B58\u5728\uFF1B\u5982\u9700\u8986\u76D6\u8BF7\u4F20\u5165 override: true`);
|
|
771
|
-
}
|
|
772
|
-
providers.set(key, value);
|
|
773
|
-
}
|
|
774
|
-
__name(provideToOwner, "provideToOwner");
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
775
21
|
|
|
776
|
-
// packages/
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
22
|
+
// packages/layout/src/layout.ts
|
|
23
|
+
var layout_exports = {};
|
|
24
|
+
__export(layout_exports, {
|
|
25
|
+
KitLayout: () => KitLayout
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(layout_exports);
|
|
28
|
+
var import_reactivity6 = require("@vobs/reactivity");
|
|
29
|
+
var import_vobs6 = require("@vobs/vobs");
|
|
781
30
|
|
|
782
31
|
// packages/layout/src/context.ts
|
|
783
|
-
var
|
|
32
|
+
var import_vobs = require("@vobs/vobs");
|
|
33
|
+
var KIT_LAYOUT_KEY = (0, import_vobs.createInjectionKey)("vobs.kit.layout");
|
|
34
|
+
|
|
35
|
+
// packages/layout/src/header.ts
|
|
36
|
+
var import_reactivity2 = require("@vobs/reactivity");
|
|
37
|
+
var import_vobs3 = require("@vobs/vobs");
|
|
784
38
|
|
|
785
39
|
// packages/layout/src/utils.ts
|
|
40
|
+
var import_reactivity = require("@vobs/reactivity");
|
|
41
|
+
var import_vobs2 = require("@vobs/vobs");
|
|
786
42
|
function readProp(props, name, fallback) {
|
|
787
43
|
const value = Reflect.get(props, name);
|
|
788
44
|
return value === void 0 ? fallback : value;
|
|
@@ -797,8 +53,8 @@ function classNames(...values) {
|
|
|
797
53
|
}
|
|
798
54
|
__name(classNames, "classNames");
|
|
799
55
|
function bindClassList(root, props, readBaseClasses) {
|
|
800
|
-
effect(() => {
|
|
801
|
-
setAttribute(root, "class", classNames(
|
|
56
|
+
(0, import_reactivity.effect)(() => {
|
|
57
|
+
(0, import_vobs2.setAttribute)(root, "class", classNames(
|
|
802
58
|
...readBaseClasses(),
|
|
803
59
|
readString(props, "class"),
|
|
804
60
|
readString(props, "className")
|
|
@@ -812,7 +68,7 @@ function bindCommonAttributes(root, props, skip = []) {
|
|
|
812
68
|
ignored.add("className");
|
|
813
69
|
ignored.add("children");
|
|
814
70
|
ignored.add("style");
|
|
815
|
-
effect(() => {
|
|
71
|
+
(0, import_reactivity.effect)(() => {
|
|
816
72
|
const next = /* @__PURE__ */ new Map();
|
|
817
73
|
for (const name of Object.keys(props)) {
|
|
818
74
|
if (ignored.has(name) || !isCommonAttribute(name)) continue;
|
|
@@ -823,22 +79,22 @@ function bindCommonAttributes(root, props, skip = []) {
|
|
|
823
79
|
for (const name of managed) {
|
|
824
80
|
if (!next.has(name)) removeAttribute(root, name);
|
|
825
81
|
}
|
|
826
|
-
for (const [name, value] of next) setAttribute(root, name, value);
|
|
82
|
+
for (const [name, value] of next) (0, import_vobs2.setAttribute)(root, name, value);
|
|
827
83
|
managedAttributes.set(root, new Set(next.keys()));
|
|
828
84
|
});
|
|
829
85
|
}
|
|
830
86
|
__name(bindCommonAttributes, "bindCommonAttributes");
|
|
831
87
|
function bindUserStyle(root, props, internal) {
|
|
832
|
-
effect(() => {
|
|
88
|
+
(0, import_reactivity.effect)(() => {
|
|
833
89
|
const values = [internal?.() ?? "", readString(props, "style") ?? ""].filter(Boolean);
|
|
834
|
-
if (values.length > 0) setAttribute(root, "style", values.join("; "));
|
|
90
|
+
if (values.length > 0) (0, import_vobs2.setAttribute)(root, "style", values.join("; "));
|
|
835
91
|
else removeAttribute(root, "style");
|
|
836
92
|
});
|
|
837
93
|
}
|
|
838
94
|
__name(bindUserStyle, "bindUserStyle");
|
|
839
95
|
function bindTextContent(node, read) {
|
|
840
|
-
effect(() => {
|
|
841
|
-
setTextContent(node, String(read() ?? ""));
|
|
96
|
+
(0, import_reactivity.effect)(() => {
|
|
97
|
+
(0, import_vobs2.setTextContent)(node, String(read() ?? ""));
|
|
842
98
|
});
|
|
843
99
|
}
|
|
844
100
|
__name(bindTextContent, "bindTextContent");
|
|
@@ -847,22 +103,22 @@ function setOptionalAttribute(node, name, value) {
|
|
|
847
103
|
removeAttribute(node, name);
|
|
848
104
|
return;
|
|
849
105
|
}
|
|
850
|
-
setAttribute(node, name, String(value));
|
|
106
|
+
(0, import_vobs2.setAttribute)(node, name, String(value));
|
|
851
107
|
}
|
|
852
108
|
__name(setOptionalAttribute, "setOptionalAttribute");
|
|
853
109
|
function mountSlot(parent, props, name) {
|
|
854
|
-
insertDynamic(parent, null, () => resolveSlot(Reflect.get(props, name)));
|
|
110
|
+
(0, import_vobs2.insertDynamic)(parent, null, () => resolveSlot(Reflect.get(props, name)));
|
|
855
111
|
}
|
|
856
112
|
__name(mountSlot, "mountSlot");
|
|
857
113
|
function resolveSlot(value) {
|
|
858
114
|
const resolved = typeof value === "function" ? value() : value;
|
|
859
115
|
if (resolved === void 0 || resolved === null || resolved === false) return null;
|
|
860
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
116
|
+
if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs2.createText)(String(resolved));
|
|
861
117
|
if (Array.isArray(resolved)) {
|
|
862
|
-
return createFragment((parent, anchor) => {
|
|
118
|
+
return (0, import_vobs2.createFragment)((parent, anchor) => {
|
|
863
119
|
for (const child of resolved) {
|
|
864
120
|
const node = resolveSlot(child);
|
|
865
|
-
if (node) insertBefore(parent, node, anchor);
|
|
121
|
+
if (node) (0, import_vobs2.insertBefore)(parent, node, anchor);
|
|
866
122
|
}
|
|
867
123
|
});
|
|
868
124
|
}
|
|
@@ -896,10 +152,10 @@ var managedAttributes = /* @__PURE__ */ new WeakMap();
|
|
|
896
152
|
|
|
897
153
|
// packages/layout/src/header.ts
|
|
898
154
|
function KitHeader(props = {}) {
|
|
899
|
-
const root = createElement("header");
|
|
900
|
-
const toggleRegion = createElement("div");
|
|
901
|
-
const brand = createElement("div");
|
|
902
|
-
const actions = createElement("div");
|
|
155
|
+
const root = (0, import_vobs3.createElement)("header");
|
|
156
|
+
const toggleRegion = (0, import_vobs3.createElement)("div");
|
|
157
|
+
const brand = (0, import_vobs3.createElement)("div");
|
|
158
|
+
const actions = (0, import_vobs3.createElement)("div");
|
|
903
159
|
bindClassList(root, props, () => ["vobs-kit-header"]);
|
|
904
160
|
bindCommonAttributes(root, props, [
|
|
905
161
|
"logo",
|
|
@@ -911,45 +167,45 @@ function KitHeader(props = {}) {
|
|
|
911
167
|
"onToggleSidebar"
|
|
912
168
|
]);
|
|
913
169
|
bindUserStyle(root, props);
|
|
914
|
-
setAttribute(toggleRegion, "class", "vobs-kit-header__toggle");
|
|
170
|
+
(0, import_vobs3.setAttribute)(toggleRegion, "class", "vobs-kit-header__toggle");
|
|
915
171
|
if (hasProp(props, "sidebarToggle")) {
|
|
916
172
|
mountSlot(toggleRegion, props, "sidebarToggle");
|
|
917
173
|
} else {
|
|
918
|
-
insertBefore(toggleRegion, createDefaultToggle(props), null);
|
|
174
|
+
(0, import_vobs3.insertBefore)(toggleRegion, createDefaultToggle(props), null);
|
|
919
175
|
}
|
|
920
|
-
setAttribute(brand, "class", "vobs-kit-header__brand");
|
|
176
|
+
(0, import_vobs3.setAttribute)(brand, "class", "vobs-kit-header__brand");
|
|
921
177
|
if (readProp(props, "logo", void 0) !== void 0) {
|
|
922
|
-
const logo = createElement("span");
|
|
923
|
-
setAttribute(logo, "class", "vobs-kit-header__logo");
|
|
178
|
+
const logo = (0, import_vobs3.createElement)("span");
|
|
179
|
+
(0, import_vobs3.setAttribute)(logo, "class", "vobs-kit-header__logo");
|
|
924
180
|
mountSlot(logo, props, "logo");
|
|
925
|
-
insertBefore(brand, logo, null);
|
|
181
|
+
(0, import_vobs3.insertBefore)(brand, logo, null);
|
|
926
182
|
}
|
|
927
183
|
if (readProp(props, "title", void 0) !== void 0) {
|
|
928
|
-
const title = createElement("h1");
|
|
929
|
-
const text = createText("");
|
|
930
|
-
setAttribute(title, "class", "vobs-kit-header__title");
|
|
184
|
+
const title = (0, import_vobs3.createElement)("h1");
|
|
185
|
+
const text = (0, import_vobs3.createText)("");
|
|
186
|
+
(0, import_vobs3.setAttribute)(title, "class", "vobs-kit-header__title");
|
|
931
187
|
bindTextContent(text, () => readProp(props, "title", ""));
|
|
932
|
-
insertBefore(title, text, null);
|
|
933
|
-
insertBefore(brand, title, null);
|
|
188
|
+
(0, import_vobs3.insertBefore)(title, text, null);
|
|
189
|
+
(0, import_vobs3.insertBefore)(brand, title, null);
|
|
934
190
|
}
|
|
935
|
-
setAttribute(actions, "class", "vobs-kit-header__actions");
|
|
191
|
+
(0, import_vobs3.setAttribute)(actions, "class", "vobs-kit-header__actions");
|
|
936
192
|
if (readProp(props, "headerActions", void 0) !== void 0) mountSlot(actions, props, "headerActions");
|
|
937
193
|
if (readProp(props, "userMenu", void 0) !== void 0) mountSlot(actions, props, "userMenu");
|
|
938
|
-
insertBefore(root, toggleRegion, null);
|
|
939
|
-
insertBefore(root, brand, null);
|
|
940
|
-
insertBefore(root, actions, null);
|
|
194
|
+
(0, import_vobs3.insertBefore)(root, toggleRegion, null);
|
|
195
|
+
(0, import_vobs3.insertBefore)(root, brand, null);
|
|
196
|
+
(0, import_vobs3.insertBefore)(root, actions, null);
|
|
941
197
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
942
198
|
return root;
|
|
943
199
|
}
|
|
944
200
|
__name(KitHeader, "KitHeader");
|
|
945
201
|
function createDefaultToggle(props) {
|
|
946
|
-
const button = createElement("button");
|
|
947
|
-
const label = createText("");
|
|
948
|
-
setAttribute(button, "type", "button");
|
|
949
|
-
setAttribute(button, "class", "vobs-kit-header__toggle-button");
|
|
202
|
+
const button = (0, import_vobs3.createElement)("button");
|
|
203
|
+
const label = (0, import_vobs3.createText)("");
|
|
204
|
+
(0, import_vobs3.setAttribute)(button, "type", "button");
|
|
205
|
+
(0, import_vobs3.setAttribute)(button, "class", "vobs-kit-header__toggle-button");
|
|
950
206
|
bindTextContent(label, () => readProp(props, "toggleLabel", "Menu"));
|
|
951
|
-
insertBefore(button, label, null);
|
|
952
|
-
addEventListener(button, "click", () => {
|
|
207
|
+
(0, import_vobs3.insertBefore)(button, label, null);
|
|
208
|
+
(0, import_vobs3.addEventListener)(button, "click", () => {
|
|
953
209
|
const handler = readProp(props, "onToggleSidebar", void 0);
|
|
954
210
|
if (typeof handler === "function") handler();
|
|
955
211
|
});
|
|
@@ -958,20 +214,26 @@ function createDefaultToggle(props) {
|
|
|
958
214
|
}
|
|
959
215
|
__name(createDefaultToggle, "createDefaultToggle");
|
|
960
216
|
function effectToggleLabel(button, props) {
|
|
961
|
-
effect(() => {
|
|
217
|
+
(0, import_reactivity2.effect)(() => {
|
|
962
218
|
setOptionalAttribute(button, "aria-label", readProp(props, "toggleLabel", "Menu"));
|
|
963
219
|
});
|
|
964
220
|
}
|
|
965
221
|
__name(effectToggleLabel, "effectToggleLabel");
|
|
966
222
|
|
|
223
|
+
// packages/layout/src/sidebar.ts
|
|
224
|
+
var import_reactivity4 = require("@vobs/reactivity");
|
|
225
|
+
var import_vobs5 = require("@vobs/vobs");
|
|
226
|
+
|
|
967
227
|
// packages/layout/src/menu.ts
|
|
228
|
+
var import_reactivity3 = require("@vobs/reactivity");
|
|
229
|
+
var import_vobs4 = require("@vobs/vobs");
|
|
968
230
|
function KitMenu(props) {
|
|
969
|
-
const root = createElement("ul");
|
|
970
|
-
const expanded = state(/* @__PURE__ */ new Set());
|
|
231
|
+
const root = (0, import_vobs4.createElement)("ul");
|
|
232
|
+
const expanded = (0, import_reactivity3.state)(/* @__PURE__ */ new Set());
|
|
971
233
|
bindClassList(root, props, () => ["vobs-kit-menu"]);
|
|
972
234
|
bindCommonAttributes(root, props, ["items", "collapsed", "activeKey", "onSelect"]);
|
|
973
|
-
if (!hasProp(props, "role")) setAttribute(root, "role", "menu");
|
|
974
|
-
insertDynamic(root, null, () => createMenuTree(props, expanded));
|
|
235
|
+
if (!hasProp(props, "role")) (0, import_vobs4.setAttribute)(root, "role", "menu");
|
|
236
|
+
(0, import_vobs4.insertDynamic)(root, null, () => createMenuTree(props, expanded));
|
|
975
237
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
976
238
|
return root;
|
|
977
239
|
}
|
|
@@ -980,93 +242,93 @@ function createMenuTree(props, expanded) {
|
|
|
980
242
|
const items = readProp(props, "items", []);
|
|
981
243
|
const activeKey = readProp(props, "activeKey", void 0);
|
|
982
244
|
const collapsed = readProp(props, "collapsed", false);
|
|
983
|
-
return createFragment((parent, anchor) => {
|
|
245
|
+
return (0, import_vobs4.createFragment)((parent, anchor) => {
|
|
984
246
|
for (const item of items) {
|
|
985
|
-
insertBefore(parent, createMenuItem(item, props, activeKey, collapsed, expanded), anchor);
|
|
247
|
+
(0, import_vobs4.insertBefore)(parent, createMenuItem(item, props, activeKey, collapsed, expanded), anchor);
|
|
986
248
|
}
|
|
987
249
|
});
|
|
988
250
|
}
|
|
989
251
|
__name(createMenuTree, "createMenuTree");
|
|
990
252
|
function createMenuItem(item, props, activeKey, collapsed, expanded) {
|
|
991
|
-
const li = createElement("li");
|
|
253
|
+
const li = (0, import_vobs4.createElement)("li");
|
|
992
254
|
const children = item.children ?? [];
|
|
993
255
|
const hasChildren = children.length > 0;
|
|
994
256
|
const active = item.key === activeKey;
|
|
995
257
|
const activeDescendant = children.some((child) => hasActiveDescendant(child, activeKey));
|
|
996
258
|
const isExpanded = expanded.value.has(item.key) || activeDescendant;
|
|
997
|
-
setAttribute(li, "class", `vobs-kit-menu__item${active || activeDescendant ? " is-active" : ""}`);
|
|
259
|
+
(0, import_vobs4.setAttribute)(li, "class", `vobs-kit-menu__item${active || activeDescendant ? " is-active" : ""}`);
|
|
998
260
|
setOptionalAttribute(li, "data-menu-key", item.key);
|
|
999
261
|
if (hasChildren) {
|
|
1000
|
-
const groupButton = createElement("button");
|
|
1001
|
-
setAttribute(groupButton, "type", "button");
|
|
1002
|
-
setAttribute(groupButton, "class", "vobs-kit-menu__link vobs-kit-menu__group-toggle");
|
|
1003
|
-
setAttribute(groupButton, "aria-expanded", isExpanded ? "true" : "false");
|
|
262
|
+
const groupButton = (0, import_vobs4.createElement)("button");
|
|
263
|
+
(0, import_vobs4.setAttribute)(groupButton, "type", "button");
|
|
264
|
+
(0, import_vobs4.setAttribute)(groupButton, "class", "vobs-kit-menu__link vobs-kit-menu__group-toggle");
|
|
265
|
+
(0, import_vobs4.setAttribute)(groupButton, "aria-expanded", isExpanded ? "true" : "false");
|
|
1004
266
|
if (collapsed) setOptionalAttribute(groupButton, "title", item.label);
|
|
1005
267
|
appendMenuContent(groupButton, item, collapsed);
|
|
1006
|
-
addEventListener(groupButton, "click", () => {
|
|
268
|
+
(0, import_vobs4.addEventListener)(groupButton, "click", () => {
|
|
1007
269
|
toggleExpanded(expanded, item.key);
|
|
1008
270
|
if (item.href !== void 0) emitSelect(props, item);
|
|
1009
271
|
});
|
|
1010
|
-
insertBefore(li, groupButton, null);
|
|
272
|
+
(0, import_vobs4.insertBefore)(li, groupButton, null);
|
|
1011
273
|
if (isExpanded) {
|
|
1012
|
-
const nested = createElement("ul");
|
|
1013
|
-
setAttribute(nested, "class", "vobs-kit-menu__children");
|
|
1014
|
-
setAttribute(nested, "role", "menu");
|
|
274
|
+
const nested = (0, import_vobs4.createElement)("ul");
|
|
275
|
+
(0, import_vobs4.setAttribute)(nested, "class", "vobs-kit-menu__children");
|
|
276
|
+
(0, import_vobs4.setAttribute)(nested, "role", "menu");
|
|
1015
277
|
for (const child of children) {
|
|
1016
|
-
insertBefore(nested, createMenuItem(child, props, activeKey, collapsed, expanded), null);
|
|
278
|
+
(0, import_vobs4.insertBefore)(nested, createMenuItem(child, props, activeKey, collapsed, expanded), null);
|
|
1017
279
|
}
|
|
1018
|
-
insertBefore(li, nested, null);
|
|
280
|
+
(0, import_vobs4.insertBefore)(li, nested, null);
|
|
1019
281
|
}
|
|
1020
282
|
} else {
|
|
1021
|
-
const link = createElement(item.href === void 0 ? "button" : "a");
|
|
1022
|
-
setAttribute(link, "class", "vobs-kit-menu__link");
|
|
1023
|
-
if (item.href === void 0) setAttribute(link, "type", "button");
|
|
283
|
+
const link = (0, import_vobs4.createElement)(item.href === void 0 ? "button" : "a");
|
|
284
|
+
(0, import_vobs4.setAttribute)(link, "class", "vobs-kit-menu__link");
|
|
285
|
+
if (item.href === void 0) (0, import_vobs4.setAttribute)(link, "type", "button");
|
|
1024
286
|
else {
|
|
1025
|
-
setAttribute(link, "href", item.href);
|
|
287
|
+
(0, import_vobs4.setAttribute)(link, "href", item.href);
|
|
1026
288
|
setOptionalAttribute(link, "target", item.target);
|
|
1027
289
|
setOptionalAttribute(link, "rel", item.rel);
|
|
1028
290
|
}
|
|
1029
|
-
if (active) setAttribute(link, "aria-current", "page");
|
|
291
|
+
if (active) (0, import_vobs4.setAttribute)(link, "aria-current", "page");
|
|
1030
292
|
if (item.disabled === true) {
|
|
1031
|
-
setAttribute(link, "aria-disabled", "true");
|
|
1032
|
-
setProperty(link, "disabled", true);
|
|
293
|
+
(0, import_vobs4.setAttribute)(link, "aria-disabled", "true");
|
|
294
|
+
(0, import_vobs4.setProperty)(link, "disabled", true);
|
|
1033
295
|
}
|
|
1034
296
|
if (collapsed) setOptionalAttribute(link, "title", item.label);
|
|
1035
297
|
appendMenuContent(link, item, collapsed);
|
|
1036
|
-
addEventListener(link, "click", (event) => {
|
|
298
|
+
(0, import_vobs4.addEventListener)(link, "click", (event) => {
|
|
1037
299
|
if (item.disabled === true) {
|
|
1038
300
|
event.preventDefault?.();
|
|
1039
301
|
return;
|
|
1040
302
|
}
|
|
1041
303
|
emitSelect(props, item);
|
|
1042
304
|
});
|
|
1043
|
-
insertBefore(li, link, null);
|
|
305
|
+
(0, import_vobs4.insertBefore)(li, link, null);
|
|
1044
306
|
}
|
|
1045
307
|
return li;
|
|
1046
308
|
}
|
|
1047
309
|
__name(createMenuItem, "createMenuItem");
|
|
1048
310
|
function appendMenuContent(parent, item, collapsed) {
|
|
1049
311
|
if (item.icon !== void 0) {
|
|
1050
|
-
const icon = createElement("span");
|
|
1051
|
-
setAttribute(icon, "class", "vobs-kit-menu__icon");
|
|
312
|
+
const icon = (0, import_vobs4.createElement)("span");
|
|
313
|
+
(0, import_vobs4.setAttribute)(icon, "class", "vobs-kit-menu__icon");
|
|
1052
314
|
mountSlot(icon, item, "icon");
|
|
1053
|
-
insertBefore(parent, icon, null);
|
|
315
|
+
(0, import_vobs4.insertBefore)(parent, icon, null);
|
|
1054
316
|
}
|
|
1055
|
-
const label = createElement("span");
|
|
1056
|
-
setAttribute(label, "class", "vobs-kit-menu__label");
|
|
1057
|
-
insertBefore(label, createText(item.label), null);
|
|
1058
|
-
insertBefore(parent, label, null);
|
|
317
|
+
const label = (0, import_vobs4.createElement)("span");
|
|
318
|
+
(0, import_vobs4.setAttribute)(label, "class", "vobs-kit-menu__label");
|
|
319
|
+
(0, import_vobs4.insertBefore)(label, (0, import_vobs4.createText)(item.label), null);
|
|
320
|
+
(0, import_vobs4.insertBefore)(parent, label, null);
|
|
1059
321
|
if (item.badge !== void 0 && !collapsed) {
|
|
1060
|
-
const badge = createElement("span");
|
|
1061
|
-
setAttribute(badge, "class", "vobs-kit-menu__badge");
|
|
322
|
+
const badge = (0, import_vobs4.createElement)("span");
|
|
323
|
+
(0, import_vobs4.setAttribute)(badge, "class", "vobs-kit-menu__badge");
|
|
1062
324
|
mountSlot(badge, item, "badge");
|
|
1063
|
-
insertBefore(parent, badge, null);
|
|
325
|
+
(0, import_vobs4.insertBefore)(parent, badge, null);
|
|
1064
326
|
}
|
|
1065
327
|
if (item.children && item.children.length > 0) {
|
|
1066
|
-
const expand = createElement("span");
|
|
1067
|
-
setAttribute(expand, "class", "vobs-kit-menu__expand");
|
|
1068
|
-
setAttribute(expand, "aria-hidden", "true");
|
|
1069
|
-
insertBefore(parent, expand, null);
|
|
328
|
+
const expand = (0, import_vobs4.createElement)("span");
|
|
329
|
+
(0, import_vobs4.setAttribute)(expand, "class", "vobs-kit-menu__expand");
|
|
330
|
+
(0, import_vobs4.setAttribute)(expand, "aria-hidden", "true");
|
|
331
|
+
(0, import_vobs4.insertBefore)(parent, expand, null);
|
|
1070
332
|
}
|
|
1071
333
|
}
|
|
1072
334
|
__name(appendMenuContent, "appendMenuContent");
|
|
@@ -1090,8 +352,8 @@ __name(hasActiveDescendant, "hasActiveDescendant");
|
|
|
1090
352
|
|
|
1091
353
|
// packages/layout/src/sidebar.ts
|
|
1092
354
|
function KitSidebar(props = {}) {
|
|
1093
|
-
const root = createElement("aside");
|
|
1094
|
-
const close = createElement("button");
|
|
355
|
+
const root = (0, import_vobs5.createElement)("aside");
|
|
356
|
+
const close = (0, import_vobs5.createElement)("button");
|
|
1095
357
|
bindClassList(root, props, () => [
|
|
1096
358
|
"vobs-kit-sidebar",
|
|
1097
359
|
readProp(props, "collapsed", false) ? "is-collapsed" : void 0,
|
|
@@ -1111,23 +373,23 @@ function KitSidebar(props = {}) {
|
|
|
1111
373
|
"onClose"
|
|
1112
374
|
]);
|
|
1113
375
|
bindUserStyle(root, props);
|
|
1114
|
-
setAttribute(close, "type", "button");
|
|
1115
|
-
setAttribute(close, "class", "vobs-kit-sidebar__close");
|
|
1116
|
-
effect(() => {
|
|
376
|
+
(0, import_vobs5.setAttribute)(close, "type", "button");
|
|
377
|
+
(0, import_vobs5.setAttribute)(close, "class", "vobs-kit-sidebar__close");
|
|
378
|
+
(0, import_reactivity4.effect)(() => {
|
|
1117
379
|
setOptionalAttribute(close, "aria-label", readProp(props, "closeLabel", "Close navigation"));
|
|
1118
380
|
});
|
|
1119
|
-
insertBefore(close, createCloseLabel(props), null);
|
|
1120
|
-
addEventListener(close, "click", () => {
|
|
381
|
+
(0, import_vobs5.insertBefore)(close, createCloseLabel(props), null);
|
|
382
|
+
(0, import_vobs5.addEventListener)(close, "click", () => {
|
|
1121
383
|
const handler = readProp(props, "onClose", void 0);
|
|
1122
384
|
if (typeof handler === "function") handler();
|
|
1123
385
|
});
|
|
1124
|
-
insertBefore(root, close, null);
|
|
1125
|
-
insertDynamic(root, null, () => createDefaultMenu(props));
|
|
386
|
+
(0, import_vobs5.insertBefore)(root, close, null);
|
|
387
|
+
(0, import_vobs5.insertDynamic)(root, null, () => createDefaultMenu(props));
|
|
1126
388
|
if (hasProp(props, "footer")) {
|
|
1127
|
-
const footer = createElement("div");
|
|
1128
|
-
setAttribute(footer, "class", "vobs-kit-sidebar__footer");
|
|
389
|
+
const footer = (0, import_vobs5.createElement)("div");
|
|
390
|
+
(0, import_vobs5.setAttribute)(footer, "class", "vobs-kit-sidebar__footer");
|
|
1129
391
|
mountSlot(footer, props, "footer");
|
|
1130
|
-
insertBefore(root, footer, null);
|
|
392
|
+
(0, import_vobs5.insertBefore)(root, footer, null);
|
|
1131
393
|
}
|
|
1132
394
|
if (hasProp(props, "children")) mountSlot(root, props, "children");
|
|
1133
395
|
return root;
|
|
@@ -1136,7 +398,7 @@ __name(KitSidebar, "KitSidebar");
|
|
|
1136
398
|
function createDefaultMenu(props) {
|
|
1137
399
|
const items = readProp(props, "items", void 0) ?? readProp(props, "menu", []);
|
|
1138
400
|
if (items.length === 0 && hasProp(props, "children")) return null;
|
|
1139
|
-
return createComponent(KitMenu, {
|
|
401
|
+
return (0, import_vobs5.createComponent)(KitMenu, {
|
|
1140
402
|
get items() {
|
|
1141
403
|
return items;
|
|
1142
404
|
},
|
|
@@ -1153,22 +415,23 @@ function createDefaultMenu(props) {
|
|
|
1153
415
|
}
|
|
1154
416
|
__name(createDefaultMenu, "createDefaultMenu");
|
|
1155
417
|
function createCloseLabel(props) {
|
|
1156
|
-
const text = createElement("span");
|
|
1157
|
-
const content = createText("");
|
|
1158
|
-
setAttribute(text, "class", "vobs-kit-sidebar__close-label");
|
|
418
|
+
const text = (0, import_vobs5.createElement)("span");
|
|
419
|
+
const content = (0, import_vobs5.createText)("");
|
|
420
|
+
(0, import_vobs5.setAttribute)(text, "class", "vobs-kit-sidebar__close-label");
|
|
1159
421
|
bindTextContent(content, () => readProp(props, "closeLabel", "Close navigation"));
|
|
1160
|
-
insertBefore(text, content, null);
|
|
422
|
+
(0, import_vobs5.insertBefore)(text, content, null);
|
|
1161
423
|
return text;
|
|
1162
424
|
}
|
|
1163
425
|
__name(createCloseLabel, "createCloseLabel");
|
|
1164
426
|
|
|
1165
427
|
// packages/layout/src/viewport.ts
|
|
428
|
+
var import_reactivity5 = require("@vobs/reactivity");
|
|
1166
429
|
var DEFAULT_MOBILE_BREAKPOINT = 768;
|
|
1167
430
|
function createKitViewport(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
|
|
1168
431
|
const normalizedBreakpoint = normalizeBreakpoint(breakpoint);
|
|
1169
|
-
const width = state(readWidth(), "layout.viewport.width");
|
|
1170
|
-
const height = state(readHeight(), "layout.viewport.height");
|
|
1171
|
-
const isMobile = memo(() => width.value < normalizedBreakpoint);
|
|
432
|
+
const width = (0, import_reactivity5.state)(readWidth(), "layout.viewport.width");
|
|
433
|
+
const height = (0, import_reactivity5.state)(readHeight(), "layout.viewport.height");
|
|
434
|
+
const isMobile = (0, import_reactivity5.memo)(() => width.value < normalizedBreakpoint);
|
|
1172
435
|
let disposed = false;
|
|
1173
436
|
const onResize = /* @__PURE__ */ __name(() => {
|
|
1174
437
|
if (disposed) return;
|
|
@@ -1191,7 +454,7 @@ function createKitViewport(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
|
|
|
1191
454
|
height.dispose();
|
|
1192
455
|
}
|
|
1193
456
|
};
|
|
1194
|
-
if (getCurrentOwner()) onDispose(viewport.dispose);
|
|
457
|
+
if ((0, import_reactivity5.getCurrentOwner)()) (0, import_reactivity5.onDispose)(viewport.dispose);
|
|
1195
458
|
return viewport;
|
|
1196
459
|
}
|
|
1197
460
|
__name(createKitViewport, "createKitViewport");
|
|
@@ -1213,33 +476,33 @@ __name(readHeight, "readHeight");
|
|
|
1213
476
|
|
|
1214
477
|
// packages/layout/src/layout.ts
|
|
1215
478
|
function KitLayout(props = {}) {
|
|
1216
|
-
const root = createElement("div");
|
|
1217
|
-
const header = createElement("div");
|
|
1218
|
-
const body = createElement("div");
|
|
1219
|
-
const sidebar = createElement("div");
|
|
1220
|
-
const main = createElement("main");
|
|
1221
|
-
const breadcrumb = createElement("div");
|
|
1222
|
-
const tabs = createElement("div");
|
|
1223
|
-
const content = createElement("div");
|
|
1224
|
-
const backdrop = createElement("div");
|
|
1225
|
-
const footer = createElement("footer");
|
|
479
|
+
const root = (0, import_vobs6.createElement)("div");
|
|
480
|
+
const header = (0, import_vobs6.createElement)("div");
|
|
481
|
+
const body = (0, import_vobs6.createElement)("div");
|
|
482
|
+
const sidebar = (0, import_vobs6.createElement)("div");
|
|
483
|
+
const main = (0, import_vobs6.createElement)("main");
|
|
484
|
+
const breadcrumb = (0, import_vobs6.createElement)("div");
|
|
485
|
+
const tabs = (0, import_vobs6.createElement)("div");
|
|
486
|
+
const content = (0, import_vobs6.createElement)("div");
|
|
487
|
+
const backdrop = (0, import_vobs6.createElement)("div");
|
|
488
|
+
const footer = (0, import_vobs6.createElement)("footer");
|
|
1226
489
|
const breakpoint = normalizeBreakpoint(
|
|
1227
490
|
readProp(props, "mobileBreakpoint", DEFAULT_MOBILE_BREAKPOINT)
|
|
1228
491
|
);
|
|
1229
492
|
const viewport = createKitViewport(breakpoint);
|
|
1230
493
|
const sidebarExpanded = readProp(props, "sidebarExpanded", false);
|
|
1231
|
-
const internalCollapsed = state(
|
|
494
|
+
const internalCollapsed = (0, import_reactivity6.state)(
|
|
1232
495
|
readProp(props, "sidebarCollapsed", void 0) ?? !sidebarExpanded
|
|
1233
496
|
);
|
|
1234
|
-
const internalMobileOpen = state(readProp(props, "mobileOpen", void 0) ?? false);
|
|
1235
|
-
const collapsed = memo(() => readProp(props, "sidebarCollapsed", void 0) ?? internalCollapsed.value);
|
|
1236
|
-
const mobileOpen = memo(() => readProp(props, "mobileOpen", void 0) ?? internalMobileOpen.value);
|
|
1237
|
-
const headerVisible = state(!isProvided(props, "header"));
|
|
1238
|
-
const sidebarVisible = state(isProvided(props, "sidebar") || hasProp(props, "menu"));
|
|
1239
|
-
const backdropVisible = state(!isProvided(props, "mobileBackdrop"));
|
|
1240
|
-
const breadcrumbVisible = state(false);
|
|
1241
|
-
const tabsVisible = state(false);
|
|
1242
|
-
const footerVisible = state(false);
|
|
497
|
+
const internalMobileOpen = (0, import_reactivity6.state)(readProp(props, "mobileOpen", void 0) ?? false);
|
|
498
|
+
const collapsed = (0, import_reactivity6.memo)(() => readProp(props, "sidebarCollapsed", void 0) ?? internalCollapsed.value);
|
|
499
|
+
const mobileOpen = (0, import_reactivity6.memo)(() => readProp(props, "mobileOpen", void 0) ?? internalMobileOpen.value);
|
|
500
|
+
const headerVisible = (0, import_reactivity6.state)(!isProvided(props, "header"));
|
|
501
|
+
const sidebarVisible = (0, import_reactivity6.state)(isProvided(props, "sidebar") || hasProp(props, "menu"));
|
|
502
|
+
const backdropVisible = (0, import_reactivity6.state)(!isProvided(props, "mobileBackdrop"));
|
|
503
|
+
const breadcrumbVisible = (0, import_reactivity6.state)(false);
|
|
504
|
+
const tabsVisible = (0, import_reactivity6.state)(false);
|
|
505
|
+
const footerVisible = (0, import_reactivity6.state)(false);
|
|
1243
506
|
const context = {
|
|
1244
507
|
sidebarCollapsed: collapsed,
|
|
1245
508
|
mobileOpen,
|
|
@@ -1268,7 +531,7 @@ function KitLayout(props = {}) {
|
|
|
1268
531
|
if (typeof handler === "function") handler(value);
|
|
1269
532
|
}
|
|
1270
533
|
};
|
|
1271
|
-
provide(KIT_LAYOUT_KEY, context);
|
|
534
|
+
(0, import_vobs6.provide)(KIT_LAYOUT_KEY, context);
|
|
1272
535
|
bindClassList(root, props, () => [
|
|
1273
536
|
"vobs-kit-layout",
|
|
1274
537
|
collapsed.value ? "vobs-kit-layout--sidebar-collapsed" : void 0,
|
|
@@ -1303,41 +566,41 @@ function KitLayout(props = {}) {
|
|
|
1303
566
|
if (sidebarWidth === void 0) return "";
|
|
1304
567
|
return `--vobs-kit-sidebar-width: ${normalizeSidebarWidth(sidebarWidth)}px`;
|
|
1305
568
|
});
|
|
1306
|
-
setAttribute(header, "class", "vobs-kit-layout__header");
|
|
1307
|
-
insertDynamic(header, null, () => createHeaderSlot(props, context, headerVisible));
|
|
569
|
+
(0, import_vobs6.setAttribute)(header, "class", "vobs-kit-layout__header");
|
|
570
|
+
(0, import_vobs6.insertDynamic)(header, null, () => createHeaderSlot(props, context, headerVisible));
|
|
1308
571
|
bindVisibility(header, headerVisible);
|
|
1309
|
-
setAttribute(body, "class", "vobs-kit-layout__body");
|
|
1310
|
-
setAttribute(sidebar, "class", "vobs-kit-layout__sidebar");
|
|
1311
|
-
setAttribute(main, "class", "vobs-kit-layout__main");
|
|
1312
|
-
setAttribute(breadcrumb, "class", "vobs-kit-layout__breadcrumb");
|
|
1313
|
-
setAttribute(tabs, "class", "vobs-kit-layout__tabs");
|
|
1314
|
-
setAttribute(content, "class", "vobs-kit-layout__content");
|
|
1315
|
-
insertDynamic(sidebar, null, () => createSidebarSlot(props, context, sidebarVisible));
|
|
572
|
+
(0, import_vobs6.setAttribute)(body, "class", "vobs-kit-layout__body");
|
|
573
|
+
(0, import_vobs6.setAttribute)(sidebar, "class", "vobs-kit-layout__sidebar");
|
|
574
|
+
(0, import_vobs6.setAttribute)(main, "class", "vobs-kit-layout__main");
|
|
575
|
+
(0, import_vobs6.setAttribute)(breadcrumb, "class", "vobs-kit-layout__breadcrumb");
|
|
576
|
+
(0, import_vobs6.setAttribute)(tabs, "class", "vobs-kit-layout__tabs");
|
|
577
|
+
(0, import_vobs6.setAttribute)(content, "class", "vobs-kit-layout__content");
|
|
578
|
+
(0, import_vobs6.insertDynamic)(sidebar, null, () => createSidebarSlot(props, context, sidebarVisible));
|
|
1316
579
|
bindVisibility(sidebar, sidebarVisible);
|
|
1317
|
-
insertDynamic(breadcrumb, null, () => createNamedSlot(props, "breadcrumb", breadcrumbVisible));
|
|
580
|
+
(0, import_vobs6.insertDynamic)(breadcrumb, null, () => createNamedSlot(props, "breadcrumb", breadcrumbVisible));
|
|
1318
581
|
bindVisibility(breadcrumb, breadcrumbVisible);
|
|
1319
|
-
insertDynamic(tabs, null, () => createNamedSlot(props, "tabs", tabsVisible));
|
|
582
|
+
(0, import_vobs6.insertDynamic)(tabs, null, () => createNamedSlot(props, "tabs", tabsVisible));
|
|
1320
583
|
bindVisibility(tabs, tabsVisible);
|
|
1321
584
|
if (hasProp(props, "children")) mountSlot(content, props, "children");
|
|
1322
|
-
insertBefore(main, breadcrumb, null);
|
|
1323
|
-
insertBefore(main, tabs, null);
|
|
1324
|
-
insertBefore(main, content, null);
|
|
1325
|
-
insertBefore(body, sidebar, null);
|
|
1326
|
-
insertBefore(body, main, null);
|
|
1327
|
-
setAttribute(backdrop, "class", "vobs-kit-layout__backdrop");
|
|
1328
|
-
insertDynamic(backdrop, null, () => createBackdropSlot(props, context, sidebarVisible, backdropVisible));
|
|
1329
|
-
bindVisibility(backdrop, memo(() => backdropVisible.value && sidebarVisible.value && mobileOpen.value));
|
|
1330
|
-
setAttribute(footer, "class", "vobs-kit-layout__footer");
|
|
1331
|
-
insertDynamic(footer, null, () => {
|
|
585
|
+
(0, import_vobs6.insertBefore)(main, breadcrumb, null);
|
|
586
|
+
(0, import_vobs6.insertBefore)(main, tabs, null);
|
|
587
|
+
(0, import_vobs6.insertBefore)(main, content, null);
|
|
588
|
+
(0, import_vobs6.insertBefore)(body, sidebar, null);
|
|
589
|
+
(0, import_vobs6.insertBefore)(body, main, null);
|
|
590
|
+
(0, import_vobs6.setAttribute)(backdrop, "class", "vobs-kit-layout__backdrop");
|
|
591
|
+
(0, import_vobs6.insertDynamic)(backdrop, null, () => createBackdropSlot(props, context, sidebarVisible, backdropVisible));
|
|
592
|
+
bindVisibility(backdrop, (0, import_reactivity6.memo)(() => backdropVisible.value && sidebarVisible.value && mobileOpen.value));
|
|
593
|
+
(0, import_vobs6.setAttribute)(footer, "class", "vobs-kit-layout__footer");
|
|
594
|
+
(0, import_vobs6.insertDynamic)(footer, null, () => {
|
|
1332
595
|
const value = isProvided(props, "footer") ? resolveSlot(readProp(props, "footer", void 0)) : null;
|
|
1333
596
|
footerVisible.value = value !== null;
|
|
1334
597
|
return value;
|
|
1335
598
|
});
|
|
1336
599
|
bindVisibility(footer, footerVisible);
|
|
1337
|
-
insertBefore(root, header, null);
|
|
1338
|
-
insertBefore(root, body, null);
|
|
1339
|
-
insertBefore(root, backdrop, null);
|
|
1340
|
-
insertBefore(root, footer, null);
|
|
600
|
+
(0, import_vobs6.insertBefore)(root, header, null);
|
|
601
|
+
(0, import_vobs6.insertBefore)(root, body, null);
|
|
602
|
+
(0, import_vobs6.insertBefore)(root, backdrop, null);
|
|
603
|
+
(0, import_vobs6.insertBefore)(root, footer, null);
|
|
1341
604
|
return root;
|
|
1342
605
|
}
|
|
1343
606
|
__name(KitLayout, "KitLayout");
|
|
@@ -1348,7 +611,7 @@ function createHeaderSlot(props, context, visible) {
|
|
|
1348
611
|
return value;
|
|
1349
612
|
}
|
|
1350
613
|
visible.value = true;
|
|
1351
|
-
return createComponent(KitHeader, {
|
|
614
|
+
return (0, import_vobs6.createComponent)(KitHeader, {
|
|
1352
615
|
get logo() {
|
|
1353
616
|
return readProp(props, "logo", void 0);
|
|
1354
617
|
},
|
|
@@ -1380,7 +643,7 @@ function createSidebarSlot(props, context, visible) {
|
|
|
1380
643
|
return null;
|
|
1381
644
|
}
|
|
1382
645
|
visible.value = true;
|
|
1383
|
-
return createComponent(KitSidebar, {
|
|
646
|
+
return (0, import_vobs6.createComponent)(KitSidebar, {
|
|
1384
647
|
get menu() {
|
|
1385
648
|
return readProp(props, "menu", []);
|
|
1386
649
|
},
|
|
@@ -1424,12 +687,12 @@ function createBackdropSlot(props, context, sidebarVisible, visible) {
|
|
|
1424
687
|
return null;
|
|
1425
688
|
}
|
|
1426
689
|
visible.value = true;
|
|
1427
|
-
const button = createElement("button");
|
|
1428
|
-
setAttribute(button, "type", "button");
|
|
1429
|
-
setAttribute(button, "class", "vobs-kit-layout__backdrop-button");
|
|
1430
|
-
setAttribute(button, "aria-label", "Close navigation");
|
|
1431
|
-
insertBefore(button, createText(""), null);
|
|
1432
|
-
addEventListener(button, "click", () => {
|
|
690
|
+
const button = (0, import_vobs6.createElement)("button");
|
|
691
|
+
(0, import_vobs6.setAttribute)(button, "type", "button");
|
|
692
|
+
(0, import_vobs6.setAttribute)(button, "class", "vobs-kit-layout__backdrop-button");
|
|
693
|
+
(0, import_vobs6.setAttribute)(button, "aria-label", "Close navigation");
|
|
694
|
+
(0, import_vobs6.insertBefore)(button, (0, import_vobs6.createText)(""), null);
|
|
695
|
+
(0, import_vobs6.addEventListener)(button, "click", () => {
|
|
1433
696
|
context.setMobileOpen(false);
|
|
1434
697
|
const handler = readProp(props, "onCloseSidebar", void 0);
|
|
1435
698
|
if (typeof handler === "function") handler();
|
|
@@ -1438,8 +701,8 @@ function createBackdropSlot(props, context, sidebarVisible, visible) {
|
|
|
1438
701
|
}
|
|
1439
702
|
__name(createBackdropSlot, "createBackdropSlot");
|
|
1440
703
|
function bindVisibility(node, visible) {
|
|
1441
|
-
effect(() => {
|
|
1442
|
-
setProperty(node, "hidden", !visible.value);
|
|
704
|
+
(0, import_reactivity6.effect)(() => {
|
|
705
|
+
(0, import_vobs6.setProperty)(node, "hidden", !visible.value);
|
|
1443
706
|
setOptionalAttribute(node, "aria-hidden", visible.value ? void 0 : "true");
|
|
1444
707
|
});
|
|
1445
708
|
}
|
|
@@ -1459,7 +722,8 @@ function isProvided(props, name) {
|
|
|
1459
722
|
return hasProp(props, name) && Reflect.get(props, name) !== void 0;
|
|
1460
723
|
}
|
|
1461
724
|
__name(isProvided, "isProvided");
|
|
1462
|
-
|
|
1463
|
-
exports
|
|
1464
|
-
|
|
725
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
726
|
+
0 && (module.exports = {
|
|
727
|
+
KitLayout
|
|
728
|
+
});
|
|
1465
729
|
//# sourceMappingURL=layout.cjs.map
|