@iyulab/desktop-patterns 0.3.0 → 0.3.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.
@@ -0,0 +1,9 @@
1
+ //#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
2
+ function e(e, t, n, r) {
3
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
4
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
5
+ 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);
6
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
7
+ }
8
+ //#endregion
9
+ export { e as t };
package/dist/index.js CHANGED
@@ -1,17 +1,6 @@
1
- import { DpPage as o } from "./page.js";
2
- import { DpSidebar as p, DpSidebarActionEvent as l, DpSidebarSelectEvent as D } from "./sidebar.js";
3
- import { DpToolbar as S, DpToolbarToggleEvent as i } from "./toolbar.js";
4
- import { DpShell as b, DpShellSidebarCloseEvent as m } from "./shell.js";
5
- import { DpShortcutOverlay as f, DpShortcutOverlayDismissEvent as x } from "./shortcut-overlay.js";
6
- export {
7
- o as DpPage,
8
- b as DpShell,
9
- m as DpShellSidebarCloseEvent,
10
- f as DpShortcutOverlay,
11
- x as DpShortcutOverlayDismissEvent,
12
- p as DpSidebar,
13
- l as DpSidebarActionEvent,
14
- D as DpSidebarSelectEvent,
15
- S as DpToolbar,
16
- i as DpToolbarToggleEvent
17
- };
1
+ import { DpPage as e } from "./page.js";
2
+ import { DpSidebar as t, DpSidebarActionEvent as n, DpSidebarSelectEvent as r } from "./sidebar.js";
3
+ import { DpToolbar as i, DpToolbarToggleEvent as a } from "./toolbar.js";
4
+ import { DpShell as o, DpShellSidebarCloseEvent as s } from "./shell.js";
5
+ import { DpShortcutOverlay as c, DpShortcutOverlayDismissEvent as l } from "./shortcut-overlay.js";
6
+ export { e as DpPage, o as DpShell, s as DpShellSidebarCloseEvent, c as DpShortcutOverlay, l as DpShortcutOverlayDismissEvent, t as DpSidebar, n as DpSidebarActionEvent, r as DpSidebarSelectEvent, i as DpToolbar, a as DpToolbarToggleEvent };
package/dist/page.js CHANGED
@@ -1,30 +1,19 @@
1
- import { css as a, LitElement as m, html as x } from "lit";
2
- import { property as d, customElement as c } from "lit/decorators.js";
3
- var h = Object.defineProperty, u = Object.getOwnPropertyDescriptor, n = (l, e, s, r) => {
4
- for (var t = r > 1 ? void 0 : r ? u(e, s) : e, p = l.length - 1, i; p >= 0; p--)
5
- (i = l[p]) && (t = (r ? i(e, s, t) : i(t)) || t);
6
- return r && t && h(e, s, t), t;
7
- };
8
- const b = {
9
- sm: "672px",
10
- md: "768px",
11
- lg: "896px",
12
- xl: "1152px",
13
- full: "none"
14
- };
15
- let o = class extends m {
16
- constructor() {
17
- super(...arguments), this.maxWidth = "md";
18
- }
19
- render() {
20
- return x`
21
- <div class="inner" style="max-width: ${b[this.maxWidth]}">
22
- <slot></slot>
23
- </div>
24
- `;
25
- }
26
- };
27
- o.styles = a`
1
+ import { t as e } from "./decorate-CafwLXg5.js";
2
+ import { LitElement as t, css as n, html as r } from "lit";
3
+ import { customElement as i, property as a } from "lit/decorators.js";
4
+ //#region src/components/page/dp-page.ts
5
+ var o = {
6
+ sm: "672px",
7
+ md: "768px",
8
+ lg: "896px",
9
+ xl: "1152px",
10
+ full: "none"
11
+ }, s = class extends t {
12
+ constructor(...e) {
13
+ super(...e), this.maxWidth = "md";
14
+ }
15
+ static {
16
+ this.styles = n`
28
17
  :host {
29
18
  display: block;
30
19
  height: 100%;
@@ -37,12 +26,18 @@ o.styles = a`
37
26
  box-sizing: border-box;
38
27
  }
39
28
  `;
40
- n([
41
- d({ attribute: "max-width", reflect: !0 })
42
- ], o.prototype, "maxWidth", 2);
43
- o = n([
44
- c("dp-page")
45
- ], o);
46
- export {
47
- o as DpPage
29
+ }
30
+ render() {
31
+ return r`
32
+ <div class="inner" style="max-width: ${o[this.maxWidth]}">
33
+ <slot></slot>
34
+ </div>
35
+ `;
36
+ }
48
37
  };
38
+ e([a({
39
+ attribute: "max-width",
40
+ reflect: !0
41
+ })], s.prototype, "maxWidth", void 0), s = e([i("dp-page")], s);
42
+ //#endregion
43
+ export { s as DpPage };
package/dist/shell.js CHANGED
@@ -1,34 +1,20 @@
1
- import { css as p, LitElement as c, nothing as b, html as l } from "lit";
2
- import { property as h, customElement as f } from "lit/decorators.js";
3
- var m = Object.defineProperty, u = Object.getOwnPropertyDescriptor, d = (s, o, t, i) => {
4
- for (var e = i > 1 ? void 0 : i ? u(o, t) : o, a = s.length - 1, n; a >= 0; a--)
5
- (n = s[a]) && (e = (i ? n(o, t, e) : n(e)) || e);
6
- return i && e && m(o, t, e), e;
7
- };
8
- class v extends Event {
9
- constructor() {
10
- super("dp-shell-sidebar-close", { bubbles: !0, composed: !0 });
11
- }
12
- }
13
- let r = class extends c {
14
- constructor() {
15
- super(...arguments), this.sidebarOpen = !1;
16
- }
17
- render() {
18
- return l`
19
- ${this.sidebarOpen ? l`<div class="backdrop" @click=${() => this.dispatchEvent(new v())}></div>` : b}
20
- <div class="sidebar-region"><slot name="sidebar"></slot></div>
21
- <div class="main-column">
22
- <div class="toolbar-row">
23
- <slot name="toolbar"></slot>
24
- </div>
25
- <slot name="banner"></slot>
26
- <main><slot></slot></main>
27
- </div>
28
- `;
29
- }
30
- };
31
- r.styles = p`
1
+ import { t as e } from "./decorate-CafwLXg5.js";
2
+ import { LitElement as t, css as n, html as r, nothing as i } from "lit";
3
+ import { customElement as a, property as o } from "lit/decorators.js";
4
+ //#region src/components/shell/dp-shell.ts
5
+ var s = class extends Event {
6
+ constructor() {
7
+ super("dp-shell-sidebar-close", {
8
+ bubbles: !0,
9
+ composed: !0
10
+ });
11
+ }
12
+ }, c = class extends t {
13
+ constructor(...e) {
14
+ super(...e), this.sidebarOpen = !1;
15
+ }
16
+ static {
17
+ this.styles = n`
32
18
  :host {
33
19
  display: flex;
34
20
  width: 100vw;
@@ -90,13 +76,25 @@ r.styles = p`
90
76
  overflow: auto;
91
77
  }
92
78
  `;
93
- d([
94
- h({ type: Boolean, reflect: !0, attribute: "sidebar-open" })
95
- ], r.prototype, "sidebarOpen", 2);
96
- r = d([
97
- f("dp-shell")
98
- ], r);
99
- export {
100
- r as DpShell,
101
- v as DpShellSidebarCloseEvent
79
+ }
80
+ render() {
81
+ return r`
82
+ ${this.sidebarOpen ? r`<div class="backdrop" @click=${() => this.dispatchEvent(new s())}></div>` : i}
83
+ <div class="sidebar-region"><slot name="sidebar"></slot></div>
84
+ <div class="main-column">
85
+ <div class="toolbar-row">
86
+ <slot name="toolbar"></slot>
87
+ </div>
88
+ <slot name="banner"></slot>
89
+ <main><slot></slot></main>
90
+ </div>
91
+ `;
92
+ }
102
93
  };
94
+ e([o({
95
+ type: Boolean,
96
+ reflect: !0,
97
+ attribute: "sidebar-open"
98
+ })], c.prototype, "sidebarOpen", void 0), c = e([a("dp-shell")], c);
99
+ //#endregion
100
+ export { c as DpShell, s as DpShellSidebarCloseEvent };
@@ -1,68 +1,22 @@
1
- import { css as m, LitElement as x, nothing as w, html as l } from "lit";
2
- import { property as n, state as _, customElement as k } from "lit/decorators.js";
3
- var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, g = (e) => {
4
- throw TypeError(e);
5
- }, a = (e, t, o, d) => {
6
- for (var s = d > 1 ? void 0 : d ? E(t, o) : t, h = e.length - 1, v; h >= 0; h--)
7
- (v = e[h]) && (s = (d ? v(t, o, s) : v(s)) || s);
8
- return d && s && $(t, o, s), s;
9
- }, b = (e, t, o) => t.has(e) || g("Cannot " + o), u = (e, t, o) => (b(e, t, "read from private field"), t.get(e)), y = (e, t, o) => t.has(e) ? g("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, o), f = (e, t, o) => (b(e, t, "access private method"), o), i, c, p;
10
- class z extends Event {
11
- constructor() {
12
- super("dp-shortcut-overlay-dismiss", { bubbles: !0, composed: !0 });
13
- }
14
- }
15
- let C = 0, r = class extends x {
16
- constructor() {
17
- super(...arguments), y(this, c), this.shortcuts = [], this.open = !1, this.heading = "Keyboard shortcuts", this.emptyMessage = "No shortcuts registered.", this.closeLabel = "Close", this.headingId = `dp-shortcut-overlay-heading-${++C}`, y(this, i, (e) => {
18
- e.key === "Escape" && (e.preventDefault(), f(this, c, p).call(this));
19
- });
20
- }
21
- updated(e) {
22
- e.has("open") && (this.open ? window.addEventListener("keydown", u(this, i)) : window.removeEventListener("keydown", u(this, i)));
23
- }
24
- disconnectedCallback() {
25
- super.disconnectedCallback(), window.removeEventListener("keydown", u(this, i));
26
- }
27
- render() {
28
- return this.open ? l`
29
- <div class="backdrop" @click=${() => f(this, c, p).call(this)}>
30
- <div
31
- class="panel"
32
- role="dialog"
33
- aria-modal="true"
34
- aria-labelledby=${this.headingId}
35
- @click=${(e) => e.stopPropagation()}
36
- >
37
- <div class="header">
38
- <h2 id=${this.headingId}>${this.heading}</h2>
39
- <button class="close" aria-label=${this.closeLabel} @click=${() => f(this, c, p).call(this)}>×</button>
40
- </div>
41
- <div class="body">
42
- ${this.shortcuts.length === 0 ? l`<p class="empty">${this.emptyMessage}</p>` : l`
43
- <ul>
44
- ${this.shortcuts.map(
45
- (e) => l`
46
- <li>
47
- <span>${e.description}</span>
48
- <kbd>${e.combo}</kbd>
49
- </li>
50
- `
51
- )}
52
- </ul>
53
- `}
54
- </div>
55
- </div>
56
- </div>
57
- ` : w;
58
- }
59
- };
60
- i = /* @__PURE__ */ new WeakMap();
61
- c = /* @__PURE__ */ new WeakSet();
62
- p = function() {
63
- this.dispatchEvent(new z());
64
- };
65
- r.styles = m`
1
+ import { t as e } from "./decorate-CafwLXg5.js";
2
+ import { LitElement as t, css as n, html as r, nothing as i } from "lit";
3
+ import { customElement as a, property as o, state as s } from "lit/decorators.js";
4
+ //#region src/components/shortcut-overlay/dp-shortcut-overlay.ts
5
+ var c = class extends Event {
6
+ constructor() {
7
+ super("dp-shortcut-overlay-dismiss", {
8
+ bubbles: !0,
9
+ composed: !0
10
+ });
11
+ }
12
+ }, l = 0, u = class extends t {
13
+ constructor(...e) {
14
+ super(...e), this.shortcuts = [], this.open = !1, this.heading = "Keyboard shortcuts", this.emptyMessage = "No shortcuts registered.", this.closeLabel = "Close", this.headingId = `dp-shortcut-overlay-heading-${++l}`, this.#e = (e) => {
15
+ e.key === "Escape" && (e.preventDefault(), this.#t());
16
+ };
17
+ }
18
+ static {
19
+ this.styles = n`
66
20
  :host {
67
21
  display: contents;
68
22
  font-family: var(--dc-font-family, system-ui, sans-serif);
@@ -148,28 +102,51 @@ r.styles = m`
148
102
  font-size: 10px;
149
103
  }
150
104
  `;
151
- a([
152
- n({ type: Array })
153
- ], r.prototype, "shortcuts", 2);
154
- a([
155
- n({ type: Boolean, reflect: !0 })
156
- ], r.prototype, "open", 2);
157
- a([
158
- n()
159
- ], r.prototype, "heading", 2);
160
- a([
161
- n({ attribute: "empty-message" })
162
- ], r.prototype, "emptyMessage", 2);
163
- a([
164
- n({ attribute: "close-label" })
165
- ], r.prototype, "closeLabel", 2);
166
- a([
167
- _()
168
- ], r.prototype, "headingId", 2);
169
- r = a([
170
- k("dp-shortcut-overlay")
171
- ], r);
172
- export {
173
- r as DpShortcutOverlay,
174
- z as DpShortcutOverlayDismissEvent
105
+ }
106
+ #e;
107
+ updated(e) {
108
+ e.has("open") && (this.open ? window.addEventListener("keydown", this.#e) : window.removeEventListener("keydown", this.#e));
109
+ }
110
+ disconnectedCallback() {
111
+ super.disconnectedCallback(), window.removeEventListener("keydown", this.#e);
112
+ }
113
+ #t() {
114
+ this.dispatchEvent(new c());
115
+ }
116
+ render() {
117
+ return this.open ? r`
118
+ <div class="backdrop" @click=${() => this.#t()}>
119
+ <div
120
+ class="panel"
121
+ role="dialog"
122
+ aria-modal="true"
123
+ aria-labelledby=${this.headingId}
124
+ @click=${(e) => e.stopPropagation()}
125
+ >
126
+ <div class="header">
127
+ <h2 id=${this.headingId}>${this.heading}</h2>
128
+ <button class="close" aria-label=${this.closeLabel} @click=${() => this.#t()}>×</button>
129
+ </div>
130
+ <div class="body">
131
+ ${this.shortcuts.length === 0 ? r`<p class="empty">${this.emptyMessage}</p>` : r`
132
+ <ul>
133
+ ${this.shortcuts.map((e) => r`
134
+ <li>
135
+ <span>${e.description}</span>
136
+ <kbd>${e.combo}</kbd>
137
+ </li>
138
+ `)}
139
+ </ul>
140
+ `}
141
+ </div>
142
+ </div>
143
+ </div>
144
+ ` : i;
145
+ }
175
146
  };
147
+ e([o({ type: Array })], u.prototype, "shortcuts", void 0), e([o({
148
+ type: Boolean,
149
+ reflect: !0
150
+ })], u.prototype, "open", void 0), e([o()], u.prototype, "heading", void 0), e([o({ attribute: "empty-message" })], u.prototype, "emptyMessage", void 0), e([o({ attribute: "close-label" })], u.prototype, "closeLabel", void 0), e([s()], u.prototype, "headingId", void 0), u = e([a("dp-shortcut-overlay")], u);
151
+ //#endregion
152
+ export { u as DpShortcutOverlay, c as DpShortcutOverlayDismissEvent };
package/dist/sidebar.js CHANGED
@@ -1,110 +1,28 @@
1
- import { css as $, LitElement as w, nothing as i, html as s } from "lit";
2
- import { property as h, state as _, customElement as I } from "lit/decorators.js";
3
- var k = Object.defineProperty, A = Object.getOwnPropertyDescriptor, m = (e) => {
4
- throw TypeError(e);
5
- }, d = (e, t, a, r) => {
6
- for (var c = r > 1 ? void 0 : r ? A(t, a) : t, p = e.length - 1, v; p >= 0; p--)
7
- (v = e[p]) && (c = (r ? v(t, a, c) : v(c)) || c);
8
- return r && c && k(t, a, c), c;
9
- }, E = (e, t, a) => t.has(e) || m("Cannot " + a), G = (e, t, a) => t.has(e) ? m("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), l = (e, t, a) => (E(e, t, "access private method"), a), o, g, f, x, u, b, y;
10
- const S = (e) => Array.isArray(e.items);
11
- class D extends Event {
12
- constructor(t) {
13
- super("dp-sidebar-select", { bubbles: !0, composed: !0, cancelable: !0 }), this.itemId = t;
14
- }
15
- }
16
- class z extends Event {
17
- constructor(t) {
18
- super("dp-sidebar-action", { bubbles: !0, composed: !0 }), this.itemId = t;
19
- }
20
- }
21
- let n = class extends w {
22
- constructor() {
23
- super(...arguments), G(this, o), this.items = [], this.bottomItems = [], this.activeId = "", this.header = "", this.navLabel = "", this.collapsed = !1, this.toggledGroups = /* @__PURE__ */ new Set();
24
- }
25
- render() {
26
- return s`
27
- <div class="header">
28
- <slot name="icon"></slot>
29
- ${!this.collapsed && this.header ? s`<span class="header-label">${this.header}</span>` : i}
30
- </div>
31
- <nav aria-label=${this.navLabel || i}>
32
- ${this.items.map((e) => S(e) ? l(this, o, g).call(this, e) : l(this, o, f).call(this, e))}
33
- </nav>
34
- ${this.bottomItems.length > 0 ? s`<div class="bottom-group">${this.bottomItems.map((e) => l(this, o, x).call(this, e))}</div>` : i}
35
- <div class="footer"><slot name="footer"></slot></div>
36
- `;
37
- }
38
- };
39
- o = /* @__PURE__ */ new WeakSet();
40
- g = function(e) {
41
- const t = e.items.some((p) => p.id === this.activeId), a = e.collapsed === !0, r = this.collapsed || t || a === this.toggledGroups.has(e.id), c = `group-${e.id}`;
42
- return s`
43
- <div class="group">
44
- ${this.collapsed ? i : s`<button
45
- class="item group-toggle"
46
- aria-expanded=${r ? "true" : "false"}
47
- aria-controls=${c}
48
- @click=${() => l(this, o, y).call(this, e.id)}
49
- >
50
- ${l(this, o, u).call(this, e.id, e.icon ?? "")}
51
- <span class="label">${e.label}</span>
52
- <span class="caret" aria-hidden="true">▾</span>
53
- </button>`}
54
- <div class="group-items" id=${c} role="group" aria-label=${e.label} ?hidden=${!r}>
55
- ${e.items.map((p) => l(this, o, f).call(this, p))}
56
- </div>
57
- </div>
58
- `;
59
- };
60
- f = function(e) {
61
- const t = e.id === this.activeId, a = s`
62
- ${l(this, o, u).call(this, e.id, e.icon)} ${this.collapsed ? i : s`<span class="label">${e.label}</span>`}
63
- `;
64
- return e.href !== void 0 ? s`<a
65
- class="item"
66
- href=${e.href}
67
- title=${this.collapsed ? e.label : i}
68
- aria-current=${t ? "page" : i}
69
- @click=${(r) => l(this, o, b).call(this, r, e)}
70
- >${a}</a
71
- >` : s`<button
72
- class="item"
73
- title=${this.collapsed ? e.label : i}
74
- aria-current=${t ? "page" : i}
75
- @click=${(r) => l(this, o, b).call(this, r, e)}
76
- >
77
- ${a}
78
- </button>`;
79
- };
80
- x = function(e) {
81
- return s`
82
- <button
83
- class="item"
84
- title=${this.collapsed ? e.label : i}
85
- @click=${() => this.dispatchEvent(new z(e.id))}
86
- >
87
- ${l(this, o, u).call(this, e.id, e.icon)} ${this.collapsed ? i : s`<span class="label">${e.label}</span>`}
88
- </button>
89
- `;
90
- };
91
- u = function(e, t) {
92
- return s`<span class="icon" aria-hidden="true"><slot name=${`icon-${e}`}>${t}</slot></span>`;
93
- };
94
- b = function(e, t) {
95
- if (!(t.href !== void 0 && (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)) && t.id !== this.activeId) {
96
- if (!this.dispatchEvent(new D(t.id))) {
97
- e.preventDefault();
98
- return;
99
- }
100
- this.activeId = t.id;
101
- }
102
- };
103
- y = function(e) {
104
- const t = new Set(this.toggledGroups);
105
- t.delete(e) || t.add(e), this.toggledGroups = t;
106
- };
107
- n.styles = $`
1
+ import { t as e } from "./decorate-CafwLXg5.js";
2
+ import { LitElement as t, css as n, html as r, nothing as i } from "lit";
3
+ import { customElement as a, property as o, state as s } from "lit/decorators.js";
4
+ //#region src/components/sidebar/dp-sidebar.ts
5
+ var c = (e) => Array.isArray(e.items), l = class extends Event {
6
+ constructor(e) {
7
+ super("dp-sidebar-select", {
8
+ bubbles: !0,
9
+ composed: !0,
10
+ cancelable: !0
11
+ }), this.itemId = e;
12
+ }
13
+ }, u = class extends Event {
14
+ constructor(e) {
15
+ super("dp-sidebar-action", {
16
+ bubbles: !0,
17
+ composed: !0
18
+ }), this.itemId = e;
19
+ }
20
+ }, d = class extends t {
21
+ constructor(...e) {
22
+ super(...e), this.items = [], this.bottomItems = [], this.activeId = "", this.header = "", this.navLabel = "", this.collapsed = !1, this.toggledGroups = /* @__PURE__ */ new Set();
23
+ }
24
+ static {
25
+ this.styles = n`
108
26
  :host {
109
27
  display: flex;
110
28
  flex-direction: column;
@@ -217,32 +135,94 @@ n.styles = $`
217
135
  border-top: 1px solid var(--dc-color-border, #e2e2e4);
218
136
  }
219
137
  `;
220
- d([
221
- h({ type: Array })
222
- ], n.prototype, "items", 2);
223
- d([
224
- h({ type: Array, attribute: "bottom-items" })
225
- ], n.prototype, "bottomItems", 2);
226
- d([
227
- h({ attribute: "active-id" })
228
- ], n.prototype, "activeId", 2);
229
- d([
230
- h()
231
- ], n.prototype, "header", 2);
232
- d([
233
- h({ attribute: "nav-label" })
234
- ], n.prototype, "navLabel", 2);
235
- d([
236
- h({ type: Boolean, reflect: !0 })
237
- ], n.prototype, "collapsed", 2);
238
- d([
239
- _()
240
- ], n.prototype, "toggledGroups", 2);
241
- n = d([
242
- I("dp-sidebar")
243
- ], n);
244
- export {
245
- n as DpSidebar,
246
- z as DpSidebarActionEvent,
247
- D as DpSidebarSelectEvent
138
+ }
139
+ render() {
140
+ return r`
141
+ <div class="header">
142
+ <slot name="icon"></slot>
143
+ ${!this.collapsed && this.header ? r`<span class="header-label">${this.header}</span>` : i}
144
+ </div>
145
+ <nav aria-label=${this.navLabel || i}>
146
+ ${this.items.map((e) => c(e) ? this.#e(e) : this.#t(e))}
147
+ </nav>
148
+ ${this.bottomItems.length > 0 ? r`<div class="bottom-group">${this.bottomItems.map((e) => this.#n(e))}</div>` : i}
149
+ <div class="footer"><slot name="footer"></slot></div>
150
+ `;
151
+ }
152
+ #e(e) {
153
+ let t = e.items.some((e) => e.id === this.activeId), n = e.collapsed === !0, a = this.collapsed || t || n === this.toggledGroups.has(e.id), o = `group-${e.id}`;
154
+ return r`
155
+ <div class="group">
156
+ ${this.collapsed ? i : r`<button
157
+ class="item group-toggle"
158
+ aria-expanded=${a ? "true" : "false"}
159
+ aria-controls=${o}
160
+ @click=${() => this.#a(e.id)}
161
+ >
162
+ ${this.#r(e.id, e.icon ?? "")}
163
+ <span class="label">${e.label}</span>
164
+ <span class="caret" aria-hidden="true">▾</span>
165
+ </button>`}
166
+ <div class="group-items" id=${o} role="group" aria-label=${e.label} ?hidden=${!a}>
167
+ ${e.items.map((e) => this.#t(e))}
168
+ </div>
169
+ </div>
170
+ `;
171
+ }
172
+ #t(e) {
173
+ let t = e.id === this.activeId, n = r`
174
+ ${this.#r(e.id, e.icon)} ${this.collapsed ? i : r`<span class="label">${e.label}</span>`}
175
+ `;
176
+ return e.href === void 0 ? r`<button
177
+ class="item"
178
+ title=${this.collapsed ? e.label : i}
179
+ aria-current=${t ? "page" : i}
180
+ @click=${(t) => this.#i(t, e)}
181
+ >
182
+ ${n}
183
+ </button>` : r`<a
184
+ class="item"
185
+ href=${e.href}
186
+ title=${this.collapsed ? e.label : i}
187
+ aria-current=${t ? "page" : i}
188
+ @click=${(t) => this.#i(t, e)}
189
+ >${n}</a
190
+ >`;
191
+ }
192
+ #n(e) {
193
+ return r`
194
+ <button
195
+ class="item"
196
+ title=${this.collapsed ? e.label : i}
197
+ @click=${() => this.dispatchEvent(new u(e.id))}
198
+ >
199
+ ${this.#r(e.id, e.icon)} ${this.collapsed ? i : r`<span class="label">${e.label}</span>`}
200
+ </button>
201
+ `;
202
+ }
203
+ #r(e, t) {
204
+ return r`<span class="icon" aria-hidden="true"><slot name=${`icon-${e}`}>${t}</slot></span>`;
205
+ }
206
+ #i(e, t) {
207
+ if (!(t.href !== void 0 && (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)) && t.id !== this.activeId) {
208
+ if (!this.dispatchEvent(new l(t.id))) {
209
+ e.preventDefault();
210
+ return;
211
+ }
212
+ this.activeId = t.id;
213
+ }
214
+ }
215
+ #a(e) {
216
+ let t = new Set(this.toggledGroups);
217
+ t.delete(e) || t.add(e), this.toggledGroups = t;
218
+ }
248
219
  };
220
+ e([o({ type: Array })], d.prototype, "items", void 0), e([o({
221
+ type: Array,
222
+ attribute: "bottom-items"
223
+ })], d.prototype, "bottomItems", void 0), e([o({ attribute: "active-id" })], d.prototype, "activeId", void 0), e([o()], d.prototype, "header", void 0), e([o({ attribute: "nav-label" })], d.prototype, "navLabel", void 0), e([o({
224
+ type: Boolean,
225
+ reflect: !0
226
+ })], d.prototype, "collapsed", void 0), e([s()], d.prototype, "toggledGroups", void 0), d = e([a("dp-sidebar")], d);
227
+ //#endregion
228
+ export { d as DpSidebar, u as DpSidebarActionEvent, l as DpSidebarSelectEvent };
package/dist/toolbar.js CHANGED
@@ -1,40 +1,20 @@
1
- import { css as p, LitElement as g, nothing as h, html as d } from "lit";
2
- import { property as r, customElement as b } from "lit/decorators.js";
3
- var v = Object.defineProperty, f = Object.getOwnPropertyDescriptor, o = (l, a, i, s) => {
4
- for (var t = s > 1 ? void 0 : s ? f(a, i) : a, n = l.length - 1, c; n >= 0; n--)
5
- (c = l[n]) && (t = (s ? c(a, i, t) : c(t)) || t);
6
- return s && t && v(a, i, t), t;
7
- };
8
- class u extends Event {
9
- constructor() {
10
- super("dp-toolbar-toggle", { bubbles: !0, composed: !0 });
11
- }
12
- }
13
- let e = class extends g {
14
- constructor() {
15
- super(...arguments), this.heading = "", this.subtitle = "", this.showToggle = !1, this.toggleLabel = "Toggle sidebar", this.dragRegion = !1;
16
- }
17
- connectedCallback() {
18
- super.connectedCallback(), this.setAttribute("role", "banner");
19
- }
20
- render() {
21
- return d`
22
- <div class="start">
23
- ${this.showToggle ? d`<button
24
- class="toggle"
25
- aria-label=${this.toggleLabel}
26
- @click=${() => this.dispatchEvent(new u())}
27
- >
28
- ☰
29
- </button>` : h}
30
- <span class="title">${this.subtitle || this.heading}</span>
31
- </div>
32
- <div class="drag-handle" part="drag-handle"></div>
33
- <div class="actions"><slot name="actions"></slot></div>
34
- `;
35
- }
36
- };
37
- e.styles = p`
1
+ import { t as e } from "./decorate-CafwLXg5.js";
2
+ import { LitElement as t, css as n, html as r, nothing as i } from "lit";
3
+ import { customElement as a, property as o } from "lit/decorators.js";
4
+ //#region src/components/toolbar/dp-toolbar.ts
5
+ var s = class extends Event {
6
+ constructor() {
7
+ super("dp-toolbar-toggle", {
8
+ bubbles: !0,
9
+ composed: !0
10
+ });
11
+ }
12
+ }, c = class extends t {
13
+ constructor(...e) {
14
+ super(...e), this.heading = "", this.subtitle = "", this.showToggle = !1, this.toggleLabel = "Toggle sidebar", this.dragRegion = !1;
15
+ }
16
+ static {
17
+ this.styles = n`
38
18
  :host {
39
19
  display: flex;
40
20
  align-items: center;
@@ -90,25 +70,34 @@ e.styles = p`
90
70
  gap: var(--dc-space-3, 12px);
91
71
  }
92
72
  `;
93
- o([
94
- r()
95
- ], e.prototype, "heading", 2);
96
- o([
97
- r()
98
- ], e.prototype, "subtitle", 2);
99
- o([
100
- r({ type: Boolean, attribute: "show-toggle" })
101
- ], e.prototype, "showToggle", 2);
102
- o([
103
- r({ attribute: "toggle-label" })
104
- ], e.prototype, "toggleLabel", 2);
105
- o([
106
- r({ type: Boolean, reflect: !0, attribute: "drag-region" })
107
- ], e.prototype, "dragRegion", 2);
108
- e = o([
109
- b("dp-toolbar")
110
- ], e);
111
- export {
112
- e as DpToolbar,
113
- u as DpToolbarToggleEvent
73
+ }
74
+ connectedCallback() {
75
+ super.connectedCallback(), this.setAttribute("role", "banner");
76
+ }
77
+ render() {
78
+ return r`
79
+ <div class="start">
80
+ ${this.showToggle ? r`<button
81
+ class="toggle"
82
+ aria-label=${this.toggleLabel}
83
+ @click=${() => this.dispatchEvent(new s())}
84
+ >
85
+ ☰
86
+ </button>` : i}
87
+ <span class="title">${this.subtitle || this.heading}</span>
88
+ </div>
89
+ <div class="drag-handle" part="drag-handle"></div>
90
+ <div class="actions"><slot name="actions"></slot></div>
91
+ `;
92
+ }
114
93
  };
94
+ e([o()], c.prototype, "heading", void 0), e([o()], c.prototype, "subtitle", void 0), e([o({
95
+ type: Boolean,
96
+ attribute: "show-toggle"
97
+ })], c.prototype, "showToggle", void 0), e([o({ attribute: "toggle-label" })], c.prototype, "toggleLabel", void 0), e([o({
98
+ type: Boolean,
99
+ reflect: !0,
100
+ attribute: "drag-region"
101
+ })], c.prototype, "dragRegion", void 0), c = e([a("dp-toolbar")], c);
102
+ //#endregion
103
+ export { c as DpToolbar, s as DpToolbarToggleEvent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/desktop-patterns",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -57,23 +57,23 @@
57
57
  "build-storybook": "storybook build"
58
58
  },
59
59
  "dependencies": {
60
- "lit": "^3.2.1"
60
+ "lit": "^3.3.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@iyulab/desktop-compact": "^0.2.0 || ^0.3.0"
63
+ "@iyulab/desktop-compact": "^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@iyulab/desktop-compact": "^0.3.0",
67
- "@open-wc/testing": "^4.0.0",
68
- "@storybook/addon-essentials": "^8.3.0",
69
- "@storybook/web-components": "^8.3.0",
70
- "@storybook/web-components-vite": "^8.3.0",
66
+ "@iyulab/desktop-compact": "^0.5.0",
67
+ "@open-wc/testing": "^5.0.0",
68
+ "@storybook/web-components": "^10.6.0",
69
+ "@storybook/web-components-vite": "^10.6.0",
71
70
  "@types/mocha": "^10.0.10",
72
- "@web/dev-server-esbuild": "^1.0.2",
73
- "@web/test-runner": "^0.19.0",
74
- "storybook": "^8.3.0",
75
- "typescript": "^5.6.3",
76
- "vite": "^5.4.10",
77
- "vite-plugin-dts": "^4.2.4"
71
+ "@web/dev-server-esbuild": "^2.0.0",
72
+ "@web/test-runner": "^1.0.0",
73
+ "axe-core": "^4.13.0",
74
+ "storybook": "^10.6.0",
75
+ "typescript": "^6.0.3",
76
+ "vite": "^8.3.1",
77
+ "vite-plugin-dts": "^5.1.1"
78
78
  }
79
79
  }