@iyulab/enterprise 0.1.0 → 0.1.1

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.
@@ -1,823 +0,0 @@
1
- import { D as r, E as e$3, I as E, L as b, M as UElement, O as n, P as A, R as i$1, _ as v, a as UProgressBar, b as i$2, f as M, g as u$1, k as t$5, m as p, p as h$1, t as o, v as o$1, x as t$6, y as e$2 } from "./App-DlLPshVy.js";
2
- //#region node_modules/@iyulab/modern-app/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js
3
- function e$1(e, t) {
4
- if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
5
- }
6
- //#endregion
7
- //#region node_modules/@iyulab/modern-app/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js
8
- function e(e, t, n, r) {
9
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
10
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
11
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
12
- return i > 3 && a && Object.defineProperty(t, n, a), a;
13
- }
14
- //#endregion
15
- //#region node_modules/@iyulab/modern-app/dist/internals/StyledElement.js
16
- var i = class extends UElement {
17
- static {
18
- this.styles = super.styles;
19
- }
20
- updated(e) {
21
- super.updated(e), e.has("styles") && this.styles && this.applyToParts(this.styles);
22
- }
23
- applyToParts(e) {
24
- let t = Object.entries(e);
25
- for (let [e, n] of t) if (n) if (e === "host") this.assignToObject(this, n);
26
- else {
27
- let t = this.renderRoot?.querySelector(`[part="${String(e)}"]`);
28
- if (!t) continue;
29
- this.assignToObject(t, n);
30
- }
31
- }
32
- assignToObject(e, t) {
33
- for (let [n, r] of Object.entries(t)) {
34
- if (r == null) continue;
35
- let t = String(r);
36
- if (n.startsWith("--") || n.includes("-")) {
37
- e.style.setProperty(n, t);
38
- continue;
39
- }
40
- try {
41
- e.style[n] = t;
42
- } catch {
43
- let r = n.replace(/[A-Z]/g, (e) => "-" + e.toLowerCase());
44
- e.style.setProperty(r, t);
45
- }
46
- }
47
- }
48
- };
49
- e([n({
50
- type: Object,
51
- attribute: !1
52
- }), e$1("design:type", Object)], i.prototype, "styles", void 0);
53
- //#endregion
54
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarSection.styles.js
55
- var t$4 = i$1`
56
- :host {
57
- display: flex;
58
- flex-direction: column;
59
- gap: 8px;
60
- margin: 8px 0;
61
- }
62
-
63
- .header {
64
- display: flex;
65
- flex-direction: column;
66
- padding: 8px 12px 4px;
67
- }
68
-
69
- .title {
70
- color: var(--u-neutral-700);
71
- font-size: 12px;
72
- font-weight: 700;
73
- letter-spacing: 0.5px;
74
- white-space: nowrap;
75
- overflow: hidden;
76
- text-overflow: ellipsis;
77
- }
78
-
79
- .subtitle {
80
- color: var(--u-neutral-600);
81
- font-size: 11px;
82
- font-weight: 300;
83
- }
84
-
85
- .items {
86
- display: flex;
87
- flex-direction: column;
88
- }
89
- `;
90
- //#endregion
91
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarSection.js
92
- var s$2 = class extends i {
93
- constructor(...e) {
94
- super(...e), this.compact = !1;
95
- }
96
- static {
97
- this.styles = [super.styles, t$4];
98
- }
99
- render() {
100
- return b`
101
- <div class="header" part="header" ?hidden=${this.compact}>
102
- <span class="title" part="title">
103
- ${this.mainTitle}
104
- </span>
105
- <span class="subtitle" part="subtitle" ?hidden=${!this.subTitle}>
106
- ${this.subTitle}
107
- </span>
108
- </div>
109
-
110
- <div class="items" part="items">
111
- <slot></slot>
112
- </div>
113
- `;
114
- }
115
- };
116
- e([n({ type: Boolean }), e$1("design:type", Object)], s$2.prototype, "compact", void 0), e([n({ type: String }), e$1("design:type", Object)], s$2.prototype, "mainTitle", void 0), e([n({ type: String }), e$1("design:type", Object)], s$2.prototype, "subTitle", void 0), s$2 = e([t$5("u-sidebar-section")], s$2);
117
- //#endregion
118
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarLink.styles.js
119
- var t$3 = i$1`
120
- :host {
121
- display: block;
122
- color: var(--u-neutral-800);
123
- background-color: transparent;
124
- border-radius: 8px;
125
- transition: all 0.2s ease;
126
- cursor: pointer;
127
- }
128
- :host(:hover) {
129
- color: var(--u-txt-color-hover);
130
- background-color: var(--u-bg-color-hover);
131
- }
132
- :host([selected]) {
133
- color: var(--u-txt-color-inverse);
134
- background-color: var(--u-blue-600);
135
- box-shadow: 0 1px 3px var(--u-shadow-color-weak);
136
- }
137
- :host([selected]:hover) {
138
- color: var(--u-txt-color-inverse);
139
- background-color: var(--u-blue-700);
140
- box-shadow: 0 2px 6px var(--u-shadow-color-normal);
141
- }
142
-
143
- .container {
144
- display: flex;
145
- flex-direction: row;
146
- align-items: center;
147
- justify-content: flex-start;
148
- gap: 12px;
149
- padding: 8px 12px;
150
- }
151
- .container[compact] {
152
- justify-content: center;
153
- gap: 0;
154
- padding: 8px;
155
- }
156
-
157
- u-icon {
158
- flex-shrink: 0;
159
- color: inherit;
160
- font-size: 20px;
161
- }
162
-
163
- span {
164
- flex: 1;
165
- font-size: 14px;
166
- line-height: 20px;
167
- font-weight: 500;
168
- white-space: nowrap;
169
- overflow: hidden;
170
- text-overflow: ellipsis;
171
- }
172
- `;
173
- //#endregion
174
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarLink.js
175
- var s$1 = class extends i {
176
- constructor(...e) {
177
- super(...e), this.selected = !1, this.compact = !1;
178
- }
179
- static {
180
- this.styles = [super.styles, t$3];
181
- }
182
- render() {
183
- return b`
184
- <u-link .href=${this.href || "#"}>
185
- <div class="container" part="base" ?compact=${this.compact}>
186
- <u-icon part="icon" ?hidden=${!this.icon}
187
- .name=${this.icon}
188
- ></u-icon>
189
- <span part="label" ?hidden=${this.compact}>
190
- ${this.label}
191
- </span>
192
- </div>
193
- </u-link>
194
- `;
195
- }
196
- };
197
- e([n({
198
- type: Boolean,
199
- reflect: !0
200
- }), e$1("design:type", Object)], s$1.prototype, "selected", void 0), e([n({ type: Boolean }), e$1("design:type", Object)], s$1.prototype, "compact", void 0), e([n({ type: String }), e$1("design:type", String)], s$1.prototype, "icon", void 0), e([n({ type: String }), e$1("design:type", Object)], s$1.prototype, "label", void 0), e([n({ type: String }), e$1("design:type", String)], s$1.prototype, "href", void 0), e([n({ type: String }), e$1("design:type", Object)], s$1.prototype, "pattern", void 0), s$1 = e([t$5("u-sidebar-link")], s$1);
201
- //#endregion
202
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarGroup.styles.js
203
- var t$2 = i$1`
204
- :host {
205
- display: flex;
206
- flex-direction: column;
207
- color: var(--u-neutral-800);
208
- }
209
-
210
- button {
211
- all: unset;
212
- width: 100%;
213
- display: flex;
214
- flex-direction: row;
215
- align-items: center;
216
- justify-content: space-between;
217
- gap: 12px;
218
- padding: 8px 12px;
219
- background-color: transparent;
220
- border: none;
221
- border-radius: 8px;
222
- transition: all 0.2s ease;
223
- cursor: pointer;
224
- }
225
- button[compact] {
226
- justify-content: center;
227
- gap: 0;
228
- padding: 8px;
229
- }
230
- button[selected] {
231
- color: var(--u-blue-700);
232
- }
233
- button:hover {
234
- color: var(--u-txt-color-hover);
235
- background-color: var(--u-bg-color-hover);
236
- }
237
- button:active {
238
- background-color: var(--u-bg-color-active);
239
- }
240
- button:focus-visible {
241
- outline: 2px solid #6666ff;
242
- outline-offset: 2px;
243
- }
244
-
245
- .icon {
246
- flex-shrink: 0;
247
- color: inherit;
248
- font-size: 20px;
249
- }
250
-
251
- .label {
252
- flex: 1;
253
- font-size: 14px;
254
- line-height: 20px;
255
- font-weight: 600;
256
- overflow: hidden;
257
- white-space: nowrap;
258
- text-overflow: ellipsis;
259
- }
260
-
261
- .caret {
262
- color: inherit;
263
- font-size: 16px !important;
264
- transition: transform 0.2s ease;
265
- }
266
- .caret[collapsed] {
267
- transform: rotate(-90deg);
268
- }
269
-
270
- .items {
271
- display: flex;
272
- flex-direction: column;
273
- gap: 4px;
274
- margin-top: 4px;
275
- margin-left: 32px;
276
- border-left: 2px solid var(--u-border-color-weak);
277
- padding-left: 8px;
278
- overflow: hidden;
279
- transition: all 0.3s ease;
280
- }
281
- .items[collapsed] {
282
- margin-top: 0;
283
- height: 0;
284
- opacity: 0;
285
- }
286
- `;
287
- //#endregion
288
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarGroup.js
289
- var c$1 = class extends i {
290
- constructor(...e) {
291
- super(...e), this.compact = !1, this.selected = !1, this.collapsed = !0, this.handleButtonClick = (e) => {
292
- this.compact ? ((this.shadowRoot?.querySelector("slot")?.assignedElements({ flatten: !0 }).find((e) => e instanceof s$1))?.renderRoot.querySelector("u-link"))?.click() : this.collapsed = !this.collapsed;
293
- };
294
- }
295
- static {
296
- this.styles = [super.styles, t$2];
297
- }
298
- render() {
299
- return b`
300
- <button part="header"
301
- ?compact=${this.compact}
302
- ?selected=${this.selected}
303
- @click=${this.handleButtonClick}>
304
- <u-icon class="icon" part="icon" ?hidden=${!this.icon}
305
- .name=${this.icon}
306
- ></u-icon>
307
- <span class="label" part="label" ?hidden=${this.compact}>
308
- ${this.label}
309
- </span>
310
- <u-icon class="caret" part="caret" ?hidden=${this.compact}
311
- ?collapsed=${this.collapsed}
312
- lib="internal"
313
- name="chevron-down"
314
- ></u-icon>
315
- </button>
316
-
317
- <div class="items" part="items" ?hidden=${this.compact}
318
- ?collapsed=${this.collapsed}>
319
- <slot></slot>
320
- </div>
321
- `;
322
- }
323
- };
324
- e([n({
325
- type: Boolean,
326
- reflect: !0
327
- }), e$1("design:type", Boolean)], c$1.prototype, "compact", void 0), e([n({
328
- type: Boolean,
329
- reflect: !0
330
- }), e$1("design:type", Boolean)], c$1.prototype, "selected", void 0), e([n({
331
- type: Boolean,
332
- reflect: !0
333
- }), e$1("design:type", Boolean)], c$1.prototype, "collapsed", void 0), e([n({ type: String }), e$1("design:type", String)], c$1.prototype, "icon", void 0), e([n({ type: String }), e$1("design:type", Object)], c$1.prototype, "label", void 0), c$1 = e([t$5("u-sidebar-group")], c$1);
334
- //#endregion
335
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarButton.styles.js
336
- var t$1 = i$1`
337
- :host {
338
- display: block;
339
- width: 100%;
340
- color: var(--u-txt-color);
341
- background-color: transparent;
342
- border: none;
343
- border-radius: 8px;
344
- transition: all 0.2s ease;
345
- cursor: pointer;
346
- }
347
- :host(:hover) {
348
- color: var(--u-txt-color-hover);
349
- background-color: var(--u-bg-color-hover);
350
- }
351
- :host(:active) {
352
- background-color: var(--u-bg-color-active);
353
- }
354
-
355
- button {
356
- all: unset;
357
- width: 100%;
358
- display: flex;
359
- flex-direction: row;
360
- align-items: center;
361
- justify-content: flex-start;
362
- gap: 12px;
363
- padding: 8px 12px;
364
- }
365
- button[compact] {
366
- justify-content: center;
367
- gap: 0;
368
- padding: 8px;
369
- }
370
- button:focus-visible {
371
- outline: 2px solid #6666ff;
372
- outline-offset: 2px;
373
- }
374
-
375
- u-icon {
376
- flex-shrink: 0;
377
- color: inherit;
378
- font-size: 20px;
379
- }
380
-
381
- span {
382
- flex: 1;
383
- font-size: 14px;
384
- font-weight: 500;
385
- line-height: 20px;
386
- white-space: nowrap;
387
- overflow: hidden;
388
- text-overflow: ellipsis;
389
- }
390
- `;
391
- //#endregion
392
- //#region node_modules/@iyulab/modern-app/dist/components/SidebarButton.js
393
- var s = class extends i {
394
- constructor(...e) {
395
- super(...e), this.compact = !1;
396
- }
397
- static {
398
- this.styles = [super.styles, t$1];
399
- }
400
- render() {
401
- return b`
402
- <button part="base" ?compact=${this.compact}>
403
- <u-icon part="icon" ?hidden=${!this.icon}
404
- .name=${this.icon}
405
- ></u-icon>
406
- <span part="label" ?hidden=${this.compact}>
407
- ${this.label}
408
- </span>
409
- </button>
410
- `;
411
- }
412
- };
413
- e([n({
414
- type: Boolean,
415
- reflect: !0
416
- }), e$1("design:type", Object)], s.prototype, "compact", void 0), e([n({ type: String }), e$1("design:type", String)], s.prototype, "icon", void 0), e([n({ type: String }), e$1("design:type", Object)], s.prototype, "label", void 0), s = e([t$5("u-sidebar-button")], s);
417
- //#endregion
418
- //#region node_modules/@iyulab/modern-app/dist/layouts/SidebarLayout.styles.js
419
- var t = i$1`
420
- :host {
421
- position: relative;
422
- display: flex;
423
- flex-direction: row;
424
- width: 100%;
425
- height: 100%;
426
- font-family: var(--u-font-base);
427
- overflow: hidden;
428
- }
429
- :host([state="mobile"]),
430
- :host([state="mobile-open"]) {
431
- flex-direction: column;
432
- }
433
-
434
- .logo {
435
- color: var(--u-txt-color);
436
- font-size: 24px;
437
- cursor: pointer;
438
- }
439
- .logo:hover {
440
- color: var(--u-txt-color-hover);
441
- }
442
-
443
- .title {
444
- flex: 1;
445
- color: var(--u-txt-color);
446
- font-size: 18px;
447
- line-height: 24px;
448
- font-weight: 700;
449
- white-space: nowrap;
450
- overflow: hidden;
451
- text-overflow: ellipsis;
452
- }
453
-
454
- .toggler {
455
- color: inherit;
456
- font-size: 20px;
457
- padding: 0px;
458
- border: none;
459
- background: transparent;
460
- }
461
- .toggler:hover {
462
- color: var(--u-txt-color-hover);
463
- }
464
-
465
- /* Sidebar Container */
466
- .sidebar {
467
- position: relative;
468
- z-index: 1000;
469
- display: flex;
470
- flex-direction: column;
471
- justify-content: space-between;
472
- gap: 8px;
473
- height: 100%;
474
- background: var(--u-panel-bg-color);
475
- border-right: 1px solid var(--u-border-color);
476
- transition: all 0.3s ease;
477
- }
478
- /* Sidebar states */
479
- .sidebar[state="default"] {
480
- width: 260px;
481
- }
482
- .sidebar[state="slim"] {
483
- width: 64px;
484
- }
485
- .sidebar[state="slim"] .sidebar-header {
486
- flex-direction: column;
487
- gap: 16px;
488
- padding: 16px;
489
- }
490
- .sidebar[state="modal"] {
491
- width: 260px;
492
- position: absolute;
493
- top: 0;
494
- left: 0;
495
- }
496
- .sidebar[state="mobile"] {
497
- position: absolute;
498
- top: 0;
499
- left: 0;
500
- right: 0;
501
- transform: translateY(-100%);
502
- }
503
- .sidebar[state="mobile-open"] {
504
- position: absolute;
505
- top: 0;
506
- left: 0;
507
- right: 0;
508
- transform: translateY(0);
509
- }
510
-
511
- /* Mobile Header */
512
- .mobile-header {
513
- position: relative;
514
- z-index: 1001;
515
- display: flex;
516
- flex-direction: row;
517
- align-items: center;
518
- justify-content: space-between;
519
- gap: 12px;
520
- padding: 16px;
521
- background: var(--u-panel-bg-color);
522
- border-bottom: 1px solid var(--u-border-color-weak);
523
- user-select: none;
524
- }
525
-
526
- /* Sidebar Header */
527
- .sidebar-header {
528
- display: flex;
529
- flex-direction: row;
530
- align-items: center;
531
- justify-content: space-between;
532
- gap: 12px;
533
- padding: 16px;
534
- border-bottom: 1px solid var(--u-border-color-weak);
535
- user-select: none;
536
- }
537
-
538
- /* Sidebar Main Menu */
539
- .sidebar-main {
540
- flex: 1;
541
- display: flex;
542
- flex-direction: column;
543
- gap: 4px;
544
- padding: 8px;
545
- overflow-x: hidden;
546
- overflow-y: auto;
547
- }
548
-
549
- /* Sidebar Footer */
550
- .sidebar-footer {
551
- display: flex;
552
- flex-direction: column;
553
- gap: 4px;
554
- padding: 8px;
555
- border-top: 1px solid var(--u-border-color-weak);
556
- }
557
- .sidebar-footer:empty {
558
- display: none;
559
- }
560
-
561
- /* Main Content */
562
- .main {
563
- position: relative;
564
- flex: 1;
565
- background: var(--u-bg-color);
566
- overflow: auto;
567
- }
568
-
569
- .main u-progress-bar {
570
- --progress-bar-height: 4px;
571
- --progres-bar-track-color: transparent;
572
-
573
- position: absolute;
574
- z-index: 100;
575
- top: 0;
576
- left: 0;
577
- right: 0;
578
- opacity: 0;
579
- transform: translateY(-4px);
580
- transition: opacity 0.3s ease, transform 0.3s ease;
581
- pointer-events: none;
582
- }
583
- .main u-progress-bar[visible] {
584
- opacity: 1;
585
- transform: translateY(0);
586
- }
587
- .main u-progress-bar[error] {
588
- --progress-bar-color: var(--u-red-500);
589
- }
590
-
591
- /* Backdrop for modal mode */
592
- .backdrop {
593
- position: absolute;
594
- z-index: 100;
595
- top: 0;
596
- left: 0;
597
- right: 0;
598
- bottom: 0;
599
- background: var(--u-overlay-bg-color);
600
- }
601
- `;
602
- //#endregion
603
- //#region node_modules/lit-html/directives/repeat.js
604
- /**
605
- * @license
606
- * Copyright 2017 Google LLC
607
- * SPDX-License-Identifier: BSD-3-Clause
608
- */
609
- var u = (e, s, t) => {
610
- const r = /* @__PURE__ */ new Map();
611
- for (let l = s; l <= t; l++) r.set(e[l], l);
612
- return r;
613
- }, c = e$2(class extends i$2 {
614
- constructor(e) {
615
- if (super(e), e.type !== t$6.CHILD) throw Error("repeat() can only be used in text expressions");
616
- }
617
- dt(e, s, t) {
618
- let r;
619
- void 0 === t ? t = s : void 0 !== s && (r = s);
620
- const l = [], o = [];
621
- let i = 0;
622
- for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
623
- return {
624
- values: o,
625
- keys: l
626
- };
627
- }
628
- render(e, s, t) {
629
- return this.dt(e, s, t).values;
630
- }
631
- update(s, [t, r, c]) {
632
- const d = M(s), { values: p$1, keys: a } = this.dt(t, r, c);
633
- if (!Array.isArray(d)) return this.ut = a, p$1;
634
- const h = this.ut ??= [], v$1 = [];
635
- let m, y, x = 0, j = d.length - 1, k = 0, w = p$1.length - 1;
636
- for (; x <= j && k <= w;) if (null === d[x]) x++;
637
- else if (null === d[j]) j--;
638
- else if (h[x] === a[k]) v$1[k] = u$1(d[x], p$1[k]), x++, k++;
639
- else if (h[j] === a[w]) v$1[w] = u$1(d[j], p$1[w]), j--, w--;
640
- else if (h[x] === a[w]) v$1[w] = u$1(d[x], p$1[w]), v(s, v$1[w + 1], d[x]), x++, w--;
641
- else if (h[j] === a[k]) v$1[k] = u$1(d[j], p$1[k]), v(s, d[x], d[j]), j--, k++;
642
- else if (void 0 === m && (m = u(a, k, w), y = u(h, x, j)), m.has(h[x])) if (m.has(h[j])) {
643
- const e = y.get(a[k]), t = void 0 !== e ? d[e] : null;
644
- if (null === t) {
645
- const e = v(s, d[x]);
646
- u$1(e, p$1[k]), v$1[k] = e;
647
- } else v$1[k] = u$1(t, p$1[k]), v(s, d[x], t), d[e] = null;
648
- k++;
649
- } else h$1(d[j]), j--;
650
- else h$1(d[x]), x++;
651
- for (; k <= w;) {
652
- const e = v(s, v$1[w + 1]);
653
- u$1(e, p$1[k]), v$1[k++] = e;
654
- }
655
- for (; x <= j;) {
656
- const e = d[x++];
657
- null !== e && h$1(e);
658
- }
659
- return this.ut = a, p(s, v$1), E;
660
- }
661
- });
662
- //#endregion
663
- //#region node_modules/@iyulab/modern-app/dist/layouts/SidebarLayout.js
664
- var m, h = class extends i {
665
- constructor(...t) {
666
- super(...t), this.state = "default", this.context = null, this.isMatchedLink = (e) => !this.context || !e ? !1 : (e = typeof e == "string" ? new URLPattern(e, window.location.origin) : e, e.test(this.context.path, window.location.origin)), this.handleBrandLogoClick = () => {
667
- o.navigate("");
668
- }, this.handleToggleButtonClick = () => {
669
- let t = o.screen ?? "large";
670
- t === "large" ? this.state = this.state === "default" ? "slim" : "default" : t === "medium" ? this.state = this.state === "slim" ? "modal" : "slim" : t === "small" ? this.state = this.state === "mobile" ? "mobile-open" : "mobile" : console.warn("Unknown screen size:", t);
671
- }, this.handleBackdropClick = () => {
672
- this.state = "slim";
673
- }, this.handleRouteBegin = (e) => {
674
- this.progressBarEl.setAttribute("visible", ""), this.progressBarEl.value = 0, this.state === "modal" && (this.state = "slim"), this.state === "mobile-open" && (this.state = "mobile"), this.context = e.context;
675
- }, this.handleRouteProgress = (e) => {
676
- this.progressBarEl.value = e.progress;
677
- }, this.handleRouteDone = (e) => {
678
- this.progressBarEl.value = 100, setTimeout(() => {
679
- this.progressBarEl.removeAttribute("visible");
680
- }, 300);
681
- }, this.handleRouteError = (e) => {
682
- this.progressBarEl.setAttribute("error", ""), this.progressBarEl.value = 100, setTimeout(() => {
683
- this.progressBarEl.removeAttribute("visible"), this.progressBarEl.removeAttribute("error");
684
- }, 300);
685
- }, this.handleScreenResize = (e) => {
686
- let t = e.detail.size;
687
- t === "large" ? this.state = "default" : t === "medium" ? this.state = "slim" : t === "small" ? this.state = "mobile" : console.warn("Unknown screen size:", t);
688
- };
689
- }
690
- static {
691
- this.styles = [super.styles, t];
692
- }
693
- connectedCallback() {
694
- super.connectedCallback(), window.addEventListener("route-begin", this.handleRouteBegin), window.addEventListener("route-done", this.handleRouteDone), window.addEventListener("route-progress", this.handleRouteProgress), window.addEventListener("route-error", this.handleRouteError), window.addEventListener("screen-resize", this.handleScreenResize);
695
- }
696
- disconnectedCallback() {
697
- window.removeEventListener("route-begin", this.handleRouteBegin), window.removeEventListener("route-done", this.handleRouteDone), window.removeEventListener("route-progress", this.handleRouteProgress), window.removeEventListener("route-error", this.handleRouteError), window.removeEventListener("screen-resize", this.handleScreenResize), super.disconnectedCallback();
698
- }
699
- willUpdate(e) {
700
- super.willUpdate(e), e.has("config") && (this.styles = this.config?.styles);
701
- }
702
- render() {
703
- return this.config ? b`
704
- <!-- Mobile Header -->
705
- <div class="mobile-header" part="mobile-header" ?hidden="${!this.state.startsWith("mobile")}">
706
- <u-icon class="logo"
707
- .name="${this.config.logo}"
708
- @click=${this.handleBrandLogoClick}
709
- ></u-icon>
710
- <span class="title">
711
- ${this.config.title}
712
- </span>
713
- <u-button class="toggler"
714
- @click=${this.handleToggleButtonClick}>
715
- <u-icon
716
- lib="bootstrap"
717
- name=${this.state === "mobile-open" ? "x-lg" : "list"}
718
- ></u-icon>
719
- </u-button>
720
- </div>
721
-
722
- <!-- Sidebar -->
723
- <aside class="sidebar" part="sidebar" state="${this.state}">
724
- <!-- Sidebar Header -->
725
- <div class="sidebar-header" part="sidebar-header">
726
- <u-icon class="logo"
727
- .name="${this.config.logo}"
728
- @click=${this.handleBrandLogoClick}
729
- ></u-icon>
730
- <span class="title" ?hidden=${this.state === "slim"}>
731
- ${this.config.title}
732
- </span>
733
- <u-button class="toggler"
734
- @click=${this.handleToggleButtonClick}>
735
- <u-icon
736
- lib="bootstrap"
737
- name="layout-sidebar"
738
- ></u-icon>
739
- </u-button>
740
- </div>
741
-
742
- <!-- Sidebar Navigation Menu -->
743
- <nav class="sidebar-main" part="sidebar-main" scrollable>
744
- ${c(this.config.main ?? [], (e, t) => t, (e) => this.renderItem(e))}
745
- </nav>
746
-
747
- <!-- Sidebar Footer -->
748
- <div class="sidebar-footer" part="sidebar-footer">
749
- ${c(this.config.footer ?? [], (e, t) => t, (e) => this.renderItem(e))}
750
- </div>
751
- </aside>
752
-
753
- <!-- Main Content -->
754
- <div class="main" part="main" scrollable>
755
- <u-progress-bar part="progress"></u-progress-bar>
756
-
757
- <slot></slot>
758
- </div>
759
-
760
- <!-- Backdrop for modal state -->
761
- <div class="backdrop" ?hidden="${this.state !== "modal"}"
762
- @click="${this.handleBackdropClick}"
763
- ></div>
764
- ` : A;
765
- }
766
- renderItem(e) {
767
- if (!e) return A;
768
- if (e.type === "html") {
769
- let t = e.render(this.state);
770
- return typeof t == "string" ? o$1(t) : b`${t}`;
771
- } else if (e.type === "button") return b`
772
- <u-sidebar-button
773
- ?compact=${this.state === "slim"}
774
- .icon="${e.icon}"
775
- .label="${e.label}"
776
- .styles="${e.styles}"
777
- @click="${e.onClick}"
778
- ></u-sidebar-button>
779
- `;
780
- else if (e.type === "link") {
781
- let t = this.isMatchedLink(e.pattern || e.href);
782
- return b`
783
- <u-sidebar-link
784
- ?compact=${this.state === "slim"}
785
- ?selected=${t}
786
- .icon="${e.icon}"
787
- .label="${e.label}"
788
- .href="${e.href}"
789
- .pattern="${e.pattern}"
790
- .styles="${e.styles}"
791
- ></u-sidebar-link>
792
- `;
793
- } else if (e.type === "section") return b`
794
- <u-sidebar-section
795
- ?compact=${this.state === "slim"}
796
- .mainTitle="${e.title}"
797
- .subTitle="${e.subTitle}"
798
- .styles="${e.styles}">
799
- ${c(e.items, (e, t) => t, (e) => this.renderItem(e))}
800
- </u-sidebar-section>
801
- `;
802
- else if (e.type === "group") {
803
- let t = e.items.some((e) => this.isMatchedLink(e.pattern || e.href));
804
- return b`
805
- <u-sidebar-group
806
- ?compact=${this.state === "slim"}
807
- ?selected=${t}
808
- ?collapsed="${e.collapsed ?? !1}"
809
- .icon="${e.icon}"
810
- .label="${e.label}"
811
- .styles="${e.styles}">
812
- ${c(e.items, (e, t) => t, (e) => this.renderItem(e))}
813
- </u-sidebar-group>
814
- `;
815
- } else return A;
816
- }
817
- };
818
- e([n({
819
- type: String,
820
- reflect: !0
821
- }), e$1("design:type", Object)], h.prototype, "state", void 0), e([n({ type: Object }), e$1("design:type", Object)], h.prototype, "config", void 0), e([e$3("u-progress-bar"), e$1("design:type", typeof (m = UProgressBar !== void 0 && UProgressBar) == "function" ? m : Object)], h.prototype, "progressBarEl", void 0), e([r(), e$1("design:type", Object)], h.prototype, "context", void 0), h = e([t$5("u-sidebar-layout")], h);
822
- //#endregion
823
- export { h as SidebarLayout };