@iyulab/modern-app 0.2.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +35 -0
  4. package/dist/app.d.ts +53 -0
  5. package/dist/app.js +111 -0
  6. package/dist/components/ProgressBar.d.ts +22 -0
  7. package/dist/components/ProgressBar.js +54 -0
  8. package/dist/components/ProgressBar.styles.d.ts +1 -0
  9. package/dist/components/ProgressBar.styles.js +31 -0
  10. package/dist/components/SidebarButton.d.ts +29 -0
  11. package/dist/components/SidebarButton.js +50 -0
  12. package/dist/components/SidebarButton.styles.d.ts +1 -0
  13. package/dist/components/SidebarButton.styles.js +62 -0
  14. package/dist/components/SidebarGroup.d.ts +35 -0
  15. package/dist/components/SidebarGroup.js +70 -0
  16. package/dist/components/SidebarGroup.styles.d.ts +1 -0
  17. package/dist/components/SidebarGroup.styles.js +93 -0
  18. package/dist/components/SidebarLink.d.ts +42 -0
  19. package/dist/components/SidebarLink.js +71 -0
  20. package/dist/components/SidebarLink.styles.d.ts +1 -0
  21. package/dist/components/SidebarLink.styles.js +58 -0
  22. package/dist/components/SidebarLogo.d.ts +33 -0
  23. package/dist/components/SidebarLogo.js +60 -0
  24. package/dist/components/SidebarLogo.styles.d.ts +1 -0
  25. package/dist/components/SidebarLogo.styles.js +53 -0
  26. package/dist/components/SidebarSection.d.ts +30 -0
  27. package/dist/components/SidebarSection.js +52 -0
  28. package/dist/components/SidebarSection.styles.d.ts +1 -0
  29. package/dist/components/SidebarSection.styles.js +44 -0
  30. package/dist/components/UnsafeContent.d.ts +16 -0
  31. package/dist/components/UnsafeContent.js +26 -0
  32. package/dist/components/UnsafeContent.styles.d.ts +1 -0
  33. package/dist/components/UnsafeContent.styles.js +9 -0
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.js +4 -0
  36. package/dist/internals/ExtendedBaseElement.d.ts +22 -0
  37. package/dist/internals/ExtendedBaseElement.js +59 -0
  38. package/dist/internals/observers.d.ts +10 -0
  39. package/dist/internals/observers.js +6 -0
  40. package/dist/layouts/SidebarLayout.d.ts +60 -0
  41. package/dist/layouts/SidebarLayout.js +183 -0
  42. package/dist/layouts/SidebarLayout.styles.d.ts +1 -0
  43. package/dist/layouts/SidebarLayout.styles.js +126 -0
  44. package/dist/layouts/SidebarLayout.types.d.ts +25 -0
  45. package/dist/types/AppConfigs.d.ts +54 -0
  46. package/dist/types/AppOptions.d.ts +12 -0
  47. package/dist/types/AppTypes.d.ts +6 -0
  48. package/package.json +53 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+ -
5
+
6
+ ## 0.2.0 (2025-11-12)
7
+ - Initial library version release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Iyulab, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Modern App
2
+
3
+ A modern web application framework by iyulab, built on React and Lit Element.
4
+
5
+ For complete examples and documentation, visit our demo site: [https://modern-app.iyulab.com](https://modern-app.iyulab.com)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @iyulab/modern-app
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```javascript
16
+ import { app } from '@iyulab/modern-app';
17
+
18
+ // Load your app configuration
19
+ await app.load({
20
+ layout: {
21
+ type: 'sidebar',
22
+ // layout configuration
23
+ },
24
+ routes: [
25
+ // your routes
26
+ ],
27
+ locales: {
28
+ // locale configuration
29
+ }
30
+ });
31
+ ```
32
+
33
+ ## License
34
+
35
+ MIT
package/dist/app.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { Router } from '@iyulab/router';
2
+ import { ThemeType } from '@iyulab/components/dist/utilities/theme.js';
3
+ import { AppConfig } from './types/AppConfigs.js';
4
+ import { DialogOptions, NotificationOptions } from './types/AppOptions.js';
5
+ /**
6
+ * 애플리케이션 전역 상태 및 설정 관리 클래스
7
+ */
8
+ declare class App {
9
+ private static _instance;
10
+ private _config?;
11
+ private _router?;
12
+ private _root?;
13
+ private constructor();
14
+ /** 싱글톤 인스턴스 반환 */
15
+ static get instance(): App;
16
+ /** 현재 앱 설정 반환 */
17
+ get config(): AppConfig | undefined;
18
+ /** 라우터 인스턴스 반환 */
19
+ get router(): Router | undefined;
20
+ /** 스타일 테마 반환 */
21
+ get theme(): ThemeType;
22
+ /** 스타일 테마 설정 */
23
+ set theme(value: ThemeType);
24
+ /** 현재 진행바 설정 */
25
+ set progress(value: number);
26
+ /** 앱 로드 및 초기화 */
27
+ load(config: AppConfig): Promise<void>;
28
+ /** 앱 언로드 */
29
+ unload(): void;
30
+ /** 페이지 이동 */
31
+ navigate(path: string): void;
32
+ /** 성공 메시지 */
33
+ success(message: string, options?: NotificationOptions): Promise<void>;
34
+ /** 에러 메시지 */
35
+ error(message: string, options?: NotificationOptions): Promise<void>;
36
+ /** 경고 메시지 */
37
+ warning(message: string, options?: NotificationOptions): Promise<void>;
38
+ /** 정보 메시지 */
39
+ info(message: string, options?: NotificationOptions): Promise<void>;
40
+ /** 확인 대화상자 */
41
+ confirm(message: string, _options?: DialogOptions): Promise<boolean>;
42
+ /** 레이아웃 생성 */
43
+ private createLayout;
44
+ /** 알림 표시 */
45
+ private notify;
46
+ /** 화면 크기 변경 핸들러 */
47
+ private handleWindowResize;
48
+ }
49
+ /**
50
+ * 전역 어플리케이션 설정 및 관리 인스턴스
51
+ */
52
+ export declare const app: App;
53
+ export {};
package/dist/app.js ADDED
@@ -0,0 +1,111 @@
1
+ import { runInAction as a } from "mobx";
2
+ import u from "i18next";
3
+ import { Router as c } from "@iyulab/router";
4
+ import { notifier as d } from "@iyulab/components/dist/utilities/notifier.js";
5
+ import { theme as r } from "@iyulab/components/dist/utilities/theme.js";
6
+ import { screen as n, progress as h } from "./internals/observers.js";
7
+ class i {
8
+ // private 생성자로 외부에서 인스턴스 생성 방지
9
+ constructor() {
10
+ this.handleWindowResize = (t) => {
11
+ const e = window.innerWidth, [o, s] = this._config?.layout.breakpoints || [768, 1024];
12
+ a(() => {
13
+ e < o ? n.set("small") : e < s ? n.set("medium") : n.set("large");
14
+ });
15
+ };
16
+ }
17
+ /** 싱글톤 인스턴스 반환 */
18
+ static get instance() {
19
+ return i._instance || (i._instance = new i()), i._instance;
20
+ }
21
+ /** 현재 앱 설정 반환 */
22
+ get config() {
23
+ return this._config;
24
+ }
25
+ /** 라우터 인스턴스 반환 */
26
+ get router() {
27
+ return this._router;
28
+ }
29
+ /** 스타일 테마 반환 */
30
+ get theme() {
31
+ const t = r.get();
32
+ if (!t)
33
+ throw new Error("No theme is set, cannot get theme.");
34
+ return t;
35
+ }
36
+ /** 스타일 테마 설정 */
37
+ set theme(t) {
38
+ r.set(t);
39
+ }
40
+ /** 현재 진행바 설정 */
41
+ set progress(t) {
42
+ a(() => {
43
+ h.set(t);
44
+ });
45
+ }
46
+ /** 앱 로드 및 초기화 */
47
+ async load(t) {
48
+ if (this.unload(), this._config = t, r.init(t.theme), t.locales) {
49
+ for (const e of t.locales.plugins || [])
50
+ u.use(e);
51
+ await u.init(t.locales);
52
+ }
53
+ window.addEventListener("resize", this.handleWindowResize), this.handleWindowResize(new Event("resize")), this._root = await this.createLayout(t.layout), this._router = new c({
54
+ root: this._root,
55
+ basepath: t.basepath,
56
+ routes: t.routes
57
+ }), console.log("✅ App loaded successfully");
58
+ }
59
+ /** 앱 언로드 */
60
+ unload() {
61
+ window.removeEventListener("resize", this.handleWindowResize), this._root && (this._root.remove(), this._root = void 0), this._router && (this._router.destroy(), this._router = void 0), this._config && (this._config = void 0);
62
+ }
63
+ /** 페이지 이동 */
64
+ navigate(t) {
65
+ this._router?.go(t);
66
+ }
67
+ /** 성공 메시지 */
68
+ async success(t, e) {
69
+ await this.notify("success", t, e);
70
+ }
71
+ /** 에러 메시지 */
72
+ async error(t, e) {
73
+ await this.notify("error", t, e);
74
+ }
75
+ /** 경고 메시지 */
76
+ async warning(t, e) {
77
+ await this.notify("warning", t, e);
78
+ }
79
+ /** 정보 메시지 */
80
+ async info(t, e) {
81
+ await this.notify("info", t, e);
82
+ }
83
+ /** 확인 대화상자 */
84
+ async confirm(t, e) {
85
+ return window.confirm(t);
86
+ }
87
+ /** 레이아웃 생성 */
88
+ async createLayout(t) {
89
+ let e = document.body.querySelector("[data-layout]");
90
+ if (e && document.body.removeChild(e), t.type === "sidebar") {
91
+ const { SidebarLayout: o } = await import("./layouts/SidebarLayout.js"), s = new o();
92
+ s.config = t, e = s;
93
+ } else
94
+ throw new Error(`Unsupported layout type: ${t.type}`);
95
+ return e.setAttribute("data-layout", "true"), document.body.appendChild(e), "updateComplete" in e && await e.updateComplete, e;
96
+ }
97
+ /** 알림 표시 */
98
+ async notify(t, e, o) {
99
+ await d.toast({
100
+ type: t,
101
+ content: e,
102
+ label: o?.title,
103
+ duration: o?.duration || 3e3,
104
+ position: o?.position || "top-right"
105
+ });
106
+ }
107
+ }
108
+ const _ = i.instance;
109
+ export {
110
+ _ as app
111
+ };
@@ -0,0 +1,22 @@
1
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
+ /**
3
+ * ProgressBar 컴포넌트는 진행 상태를 시각적으로 표시합니다.
4
+ * 로딩 상태나 작업 진행률을 표시하는데 사용됩니다.
5
+ */
6
+ export declare class ProgressBar extends BaseElement {
7
+ static styles: import('lit').CSSResultGroup[];
8
+ static dependencies: Record<string, typeof BaseElement>;
9
+ /** 불확정 상태 (로딩 애니메이션 표시) */
10
+ indeterminate: boolean;
11
+ /** 최소값 (기본값: 0) */
12
+ minValue: number;
13
+ /** 최대값 (기본값: 100) */
14
+ maxValue: number;
15
+ /** 현재값 */
16
+ value: number;
17
+ connectedCallback(): void;
18
+ protected updated(changedProperties: Map<string, unknown>): void;
19
+ render(): import('lit-html').TemplateResult<1>;
20
+ /** 진행 상태 업데이트 */
21
+ private updateProgress;
22
+ }
@@ -0,0 +1,54 @@
1
+ import { html as h } from "lit";
2
+ import { property as i } from "lit/decorators.js";
3
+ import { BaseElement as n } from "@iyulab/components/dist/components/BaseElement.js";
4
+ import { styles as p } from "./ProgressBar.styles.js";
5
+ var v = Object.defineProperty, a = (u, t, s, o) => {
6
+ for (var e = void 0, l = u.length - 1, m; l >= 0; l--)
7
+ (m = u[l]) && (e = m(t, s, e) || e);
8
+ return e && v(t, s, e), e;
9
+ };
10
+ class r extends n {
11
+ constructor() {
12
+ super(...arguments), this.indeterminate = !1, this.minValue = 0, this.maxValue = 100, this.value = 0;
13
+ }
14
+ static {
15
+ this.styles = [super.styles, p];
16
+ }
17
+ static {
18
+ this.dependencies = {};
19
+ }
20
+ connectedCallback() {
21
+ super.connectedCallback(), this.setAttribute("role", "progressbar");
22
+ }
23
+ updated(t) {
24
+ super.updated(t), t.has("value") && (this.updateProgress(t.get("value"), this.value), this.setAttribute("aria-valuenow", this.value.toString())), t.has("minValue") && (this.updateProgress(this.value, this.value), this.setAttribute("aria-valuemax", this.maxValue.toString())), t.has("maxValue") && (this.updateProgress(this.value, this.value), this.setAttribute("aria-valuemin", this.minValue.toString())), t.has("indeterminate") && (this.updateProgress(this.value, this.value), this.indeterminate ? (this.removeAttribute("aria-valuenow"), this.setAttribute("aria-busy", "true")) : this.removeAttribute("aria-busy"));
25
+ }
26
+ render() {
27
+ return h`<slot></slot>`;
28
+ }
29
+ /** 진행 상태 업데이트 */
30
+ updateProgress(t, s) {
31
+ if (this.indeterminate) return;
32
+ const e = (Math.min(Math.max(s, this.minValue), this.maxValue) - this.minValue) / (this.maxValue - this.minValue);
33
+ t < s ? (this.style.transform = `scaleX(${e})`, s >= this.maxValue && setTimeout(() => {
34
+ this.style.opacity = "0";
35
+ }, 300)) : (this.style.opacity = "0", this.style.transform = "scaleX(0)", setTimeout(() => {
36
+ this.style.opacity = "1", this.style.transform = `scaleX(${e})`;
37
+ }, 300));
38
+ }
39
+ }
40
+ a([
41
+ i({ type: Boolean, reflect: !0 })
42
+ ], r.prototype, "indeterminate");
43
+ a([
44
+ i({ type: Number })
45
+ ], r.prototype, "minValue");
46
+ a([
47
+ i({ type: Number })
48
+ ], r.prototype, "maxValue");
49
+ a([
50
+ i({ type: Number })
51
+ ], r.prototype, "value");
52
+ export {
53
+ r as ProgressBar
54
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,31 @@
1
+ import { css as t } from "lit";
2
+ const a = t`
3
+ :host {
4
+ display: block;
5
+ position: absolute;
6
+ z-index: 9999;
7
+ top: 0;
8
+ left: 0;
9
+ right: 0;
10
+ height: 4px;
11
+ background-color: var(--u-blue-600);
12
+ transform-origin: left;
13
+ transition: all 0.3s ease-out;
14
+ box-shadow: 0 2px 4px var(--u-shadow-weak);
15
+ }
16
+ :host([indeterminate]) {
17
+ animation: indeterminate 1.5s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
18
+ }
19
+
20
+ @keyframes indeterminate {
21
+ 0% {
22
+ transform: translateX(-100%);
23
+ }
24
+ 100% {
25
+ transform: translateX(100%);
26
+ }
27
+ }
28
+ `;
29
+ export {
30
+ a as styles
31
+ };
@@ -0,0 +1,29 @@
1
+ import { DirectiveResult } from 'lit/directive.js';
2
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
+ import { ExtendedBaseElement } from '../internals/ExtendedBaseElement.js';
4
+ import { StyleMap } from '../types/AppTypes.js';
5
+ /** 버튼 항목 부분 */
6
+ type ElementParts = 'host' | 'base' | 'icon' | 'label';
7
+ /** 버튼 항목 구성 */
8
+ export interface SidebarButtonConfig {
9
+ type: 'button';
10
+ icon?: string;
11
+ label?: string | DirectiveResult;
12
+ styles?: StyleMap<ElementParts>;
13
+ onClick?: (event?: Event) => void;
14
+ }
15
+ /**
16
+ * SidebarButton 컴포넌트는 사이드바 내의 버튼을 표시합니다.
17
+ */
18
+ export declare class SidebarButton extends ExtendedBaseElement<ElementParts> {
19
+ static styles: import('lit').CSSResultGroup[];
20
+ static dependencies: Record<string, typeof BaseElement>;
21
+ /** 콤팩트 모드 여부 */
22
+ compact: boolean;
23
+ /** 기본 u-icon 경로의 아이콘 이름 */
24
+ icon?: string;
25
+ /** 버튼 텍스트 라벨 */
26
+ label?: string | DirectiveResult;
27
+ render(): import('lit-html').TemplateResult<1>;
28
+ }
29
+ export {};
@@ -0,0 +1,50 @@
1
+ import { html as c } from "lit";
2
+ import { property as o } from "lit/decorators.js";
3
+ import { Icon as l } from "@iyulab/components/dist/components/Icon/Icon.js";
4
+ import { ExtendedBaseElement as m } from "../internals/ExtendedBaseElement.js";
5
+ import { styles as u } from "./SidebarButton.styles.js";
6
+ var d = Object.defineProperty, n = (e, p, s, f) => {
7
+ for (var t = void 0, r = e.length - 1, a; r >= 0; r--)
8
+ (a = e[r]) && (t = a(p, s, t) || t);
9
+ return t && d(p, s, t), t;
10
+ };
11
+ class i extends m {
12
+ constructor() {
13
+ super(...arguments), this.compact = !1;
14
+ }
15
+ static {
16
+ this.styles = [super.styles, u];
17
+ }
18
+ static {
19
+ this.dependencies = {
20
+ "u-icon": l
21
+ };
22
+ }
23
+ render() {
24
+ return c`
25
+ <button part="base">
26
+ <u-icon part="icon"
27
+ ?hidden=${!this.icon}
28
+ ?remote=${!0}
29
+ .name=${this.icon}
30
+ ></u-icon>
31
+ <span part="label"
32
+ ?hidden=${this.compact}>
33
+ ${this.label}
34
+ </span>
35
+ </button>
36
+ `;
37
+ }
38
+ }
39
+ n([
40
+ o({ type: Boolean, reflect: !0 })
41
+ ], i.prototype, "compact");
42
+ n([
43
+ o({ type: String })
44
+ ], i.prototype, "icon");
45
+ n([
46
+ o({ type: String })
47
+ ], i.prototype, "label");
48
+ export {
49
+ i as SidebarButton
50
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,62 @@
1
+ import { css as o } from "lit";
2
+ const r = o`
3
+ :host {
4
+ display: block;
5
+ width: 100%;
6
+ padding: 8px 12px;
7
+ font-size: 14px;
8
+ color: var(--u-text-color);
9
+ background: transparent;
10
+ border: none;
11
+ border-radius: 8px;
12
+ transition: all 0.2s ease;
13
+ cursor: pointer;
14
+ }
15
+ :host([comact]) {
16
+ padding: 8px;
17
+ }
18
+ :host([compact]) button {
19
+ width: 100%;
20
+ justify-content: center;
21
+ gap: 0;
22
+ }
23
+ :host(:hover) {
24
+ color: var(--u-text-color-hover);
25
+ background-color: var(--u-bg-color-hover);
26
+ }
27
+ :host(:active) {
28
+ background-color: var(--u-bg-color-active);
29
+ }
30
+
31
+ button {
32
+ width: 100%;
33
+ all: unset;
34
+ display: flex;
35
+ flex-direction: row;
36
+ align-items: center;
37
+ justify-content: flex-start;
38
+ gap: 12px;
39
+ }
40
+ button:focus-visible {
41
+ outline: 2px solid var(--u-input-border-focus);
42
+ outline-offset: 2px;
43
+ }
44
+
45
+ u-icon {
46
+ font-size: 20px;
47
+ color: inherit;
48
+ flex-shrink: 0;
49
+ }
50
+
51
+ span {
52
+ flex: 1;
53
+ font-weight: 500;
54
+ color: inherit;
55
+ overflow: hidden;
56
+ white-space: nowrap;
57
+ text-overflow: ellipsis;
58
+ }
59
+ `;
60
+ export {
61
+ r as styles
62
+ };
@@ -0,0 +1,35 @@
1
+ import { DirectiveResult } from 'lit/directive.js';
2
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
3
+ import { StyleMap } from '../types/AppTypes.js';
4
+ import { ExtendedBaseElement } from '../internals/ExtendedBaseElement.js';
5
+ import { SidebarLinkConfig } from './SidebarLink.js';
6
+ type ElementParts = 'host' | 'container' | 'base' | 'icon' | 'label' | 'toggler' | 'items';
7
+ /** 그룹: 하위 링크들 묶음 */
8
+ export interface SidebarGroupConfig {
9
+ type: 'group';
10
+ /** 기본 접힘 상태 */
11
+ collapsed?: boolean;
12
+ icon: string;
13
+ label: string | DirectiveResult;
14
+ items: SidebarLinkConfig[];
15
+ styles?: StyleMap<ElementParts>;
16
+ }
17
+ /**
18
+ * SidebarGroup 컴포넌트는 네비게이션 그룹 아이템을 표시합니다.
19
+ */
20
+ export declare class SidebarGroup extends ExtendedBaseElement<ElementParts> {
21
+ static styles: import('lit').CSSResultGroup[];
22
+ static dependencies: Record<string, typeof BaseElement>;
23
+ /** 콤팩트 모드 여부 */
24
+ compact: boolean;
25
+ /** collapsed 상태 */
26
+ collapsed: boolean;
27
+ /** 네비게이션 아이템 데이터 */
28
+ icon?: string;
29
+ /** 네비게이션 아이템 데이터 */
30
+ label?: string | DirectiveResult;
31
+ render(): import('lit-html').TemplateResult<1>;
32
+ /** 버튼 클릭 핸들러 */
33
+ private handleButtonClick;
34
+ }
35
+ export {};
@@ -0,0 +1,70 @@
1
+ import { html as c } from "lit";
2
+ import { property as o } from "lit/decorators.js";
3
+ import { Icon as d } from "@iyulab/components/dist/components/Icon/Icon.js";
4
+ import { app as m } from "../app.js";
5
+ import { ExtendedBaseElement as u } from "../internals/ExtendedBaseElement.js";
6
+ import { SidebarLink as h } from "./SidebarLink.js";
7
+ import { styles as f } from "./SidebarGroup.styles.js";
8
+ var y = Object.defineProperty, r = (i, n, e, l) => {
9
+ for (var t = void 0, a = i.length - 1, p; a >= 0; a--)
10
+ (p = i[a]) && (t = p(n, e, t) || t);
11
+ return t && y(n, e, t), t;
12
+ };
13
+ class s extends u {
14
+ constructor() {
15
+ super(...arguments), this.compact = !1, this.collapsed = !0, this.handleButtonClick = (n) => {
16
+ if (this.compact) {
17
+ const e = this.shadowRoot?.querySelector("slot")?.assignedElements({ flatten: !0 }).find((l) => l instanceof h);
18
+ m.navigate(e?.href || "/");
19
+ } else
20
+ this.collapsed = !this.collapsed;
21
+ };
22
+ }
23
+ static {
24
+ this.styles = [super.styles, f];
25
+ }
26
+ static {
27
+ this.dependencies = {
28
+ "u-icon": d
29
+ };
30
+ }
31
+ render() {
32
+ return c`
33
+ <div class="container" part="container">
34
+ <button part="base"
35
+ @click=${this.handleButtonClick}>
36
+ <u-icon class="icon" part="icon"
37
+ ?hidden=${!this.icon}
38
+ ?remote=${!0}
39
+ .name=${this.icon}
40
+ ></u-icon>
41
+ <span class="label" part="label">
42
+ ${this.label}
43
+ </span>
44
+ <u-icon class="toggler" part="toggler"
45
+ name="chevron-down"
46
+ ></u-icon>
47
+ </button>
48
+
49
+ <div class="items" part="items">
50
+ <slot></slot>
51
+ </div>
52
+ </div>
53
+ `;
54
+ }
55
+ }
56
+ r([
57
+ o({ type: Boolean, reflect: !0 })
58
+ ], s.prototype, "compact");
59
+ r([
60
+ o({ type: Boolean, reflect: !0 })
61
+ ], s.prototype, "collapsed");
62
+ r([
63
+ o({ type: String })
64
+ ], s.prototype, "icon");
65
+ r([
66
+ o({ type: String })
67
+ ], s.prototype, "label");
68
+ export {
69
+ s as SidebarGroup
70
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;