@iyulab/desktop-patterns 0.1.1 → 0.1.3
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/components/toolbar/dp-toolbar.d.ts +1 -0
- package/dist/sidebar.js +37 -28
- package/dist/toolbar.js +7 -4
- package/package.json +13 -7
package/dist/sidebar.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { css as m, LitElement as x, nothing as c, html as i } from "lit";
|
|
2
|
-
import { property as
|
|
3
|
-
var y = Object.defineProperty,
|
|
2
|
+
import { property as d, customElement as g } from "lit/decorators.js";
|
|
3
|
+
var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, b = (e) => {
|
|
4
4
|
throw TypeError(e);
|
|
5
|
-
}, s = (e, t,
|
|
6
|
-
for (var
|
|
7
|
-
(h = e[
|
|
8
|
-
return
|
|
9
|
-
},
|
|
5
|
+
}, s = (e, t, a, l) => {
|
|
6
|
+
for (var o = l > 1 ? void 0 : l ? w(t, a) : t, p = e.length - 1, h; p >= 0; p--)
|
|
7
|
+
(h = e[p]) && (o = (l ? h(t, a, o) : h(o)) || o);
|
|
8
|
+
return l && o && y(t, a, o), o;
|
|
9
|
+
}, _ = (e, t, a) => t.has(e) || b("Cannot " + a), I = (e, t, a) => t.has(e) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), v = (e, t, a) => (_(e, t, "access private method"), a), n, f, u;
|
|
10
10
|
class $ extends Event {
|
|
11
11
|
constructor(t) {
|
|
12
12
|
super("dp-sidebar-select", { bubbles: !0, composed: !0 }), this.itemId = t;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
let
|
|
15
|
+
let r = class extends x {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), I(this,
|
|
17
|
+
super(...arguments), I(this, n), this.items = [], this.bottomItems = [], this.activeId = "", this.header = "", this.collapsed = !1;
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
return i`
|
|
@@ -22,20 +22,20 @@ let o = class extends x {
|
|
|
22
22
|
<slot name="icon"></slot>
|
|
23
23
|
${!this.collapsed && this.header ? i`<span class="header-label">${this.header}</span>` : c}
|
|
24
24
|
</div>
|
|
25
|
-
<nav>${this.items.map((e) => v(this,
|
|
26
|
-
${this.bottomItems.length > 0 ? i`<div class="bottom-group">${this.bottomItems.map((e) => v(this,
|
|
25
|
+
<nav>${this.items.map((e) => v(this, n, f).call(this, e))}</nav>
|
|
26
|
+
${this.bottomItems.length > 0 ? i`<div class="bottom-group">${this.bottomItems.map((e) => v(this, n, f).call(this, e))}</div>` : c}
|
|
27
27
|
<div class="footer"><slot name="footer"></slot></div>
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
n = /* @__PURE__ */ new WeakSet();
|
|
32
32
|
f = function(e) {
|
|
33
33
|
const t = e.id === this.activeId;
|
|
34
34
|
return i`
|
|
35
35
|
<button
|
|
36
36
|
title=${this.collapsed ? e.label : c}
|
|
37
37
|
aria-current=${t ? "page" : c}
|
|
38
|
-
@click=${() => v(this,
|
|
38
|
+
@click=${() => v(this, n, u).call(this, e.id)}
|
|
39
39
|
>
|
|
40
40
|
<span class="icon" aria-hidden="true">${e.icon}</span>
|
|
41
41
|
${this.collapsed ? c : i`<span>${e.label}</span>`}
|
|
@@ -45,7 +45,7 @@ f = function(e) {
|
|
|
45
45
|
u = function(e) {
|
|
46
46
|
e !== this.activeId && (this.activeId = e, this.dispatchEvent(new $(e)));
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
r.styles = m`
|
|
49
49
|
:host {
|
|
50
50
|
display: flex;
|
|
51
51
|
flex-direction: column;
|
|
@@ -109,9 +109,18 @@ o.styles = m`
|
|
|
109
109
|
justify-content: center;
|
|
110
110
|
padding: var(--dc-space-3, 12px) 0;
|
|
111
111
|
}
|
|
112
|
+
/* The rail marker keeps the fill accent - it is a 3px bar, judged as a UI
|
|
113
|
+
component (WCAG 1.4.11, 3:1). The label does not: an accent chosen to be
|
|
114
|
+
read as a *fill* is not necessarily readable as 12px text on the hover
|
|
115
|
+
surface the active row sits on. Measured across seven consuming apps,
|
|
116
|
+
twelve of fourteen app x theme combinations failed AA that way, the worst
|
|
117
|
+
at 1.65:1 - and the active item is the one label a user most needs to
|
|
118
|
+
find. --dc-color-accent-text lets a consumer supply the readable
|
|
119
|
+
variant; falling back to the fill accent keeps every existing consumer
|
|
120
|
+
rendering exactly as before. */
|
|
112
121
|
button[aria-current='page'] {
|
|
113
122
|
border-left-color: var(--dc-color-accent, #2563eb);
|
|
114
|
-
color: var(--dc-color-accent, #2563eb);
|
|
123
|
+
color: var(--dc-color-accent-text, var(--dc-color-accent, #2563eb));
|
|
115
124
|
font-weight: var(--dc-font-weight-medium, 500);
|
|
116
125
|
}
|
|
117
126
|
button:hover {
|
|
@@ -131,24 +140,24 @@ o.styles = m`
|
|
|
131
140
|
}
|
|
132
141
|
`;
|
|
133
142
|
s([
|
|
134
|
-
|
|
135
|
-
],
|
|
143
|
+
d({ type: Array })
|
|
144
|
+
], r.prototype, "items", 2);
|
|
136
145
|
s([
|
|
137
|
-
|
|
138
|
-
],
|
|
146
|
+
d({ type: Array, attribute: "bottom-items" })
|
|
147
|
+
], r.prototype, "bottomItems", 2);
|
|
139
148
|
s([
|
|
140
|
-
|
|
141
|
-
],
|
|
149
|
+
d({ attribute: "active-id" })
|
|
150
|
+
], r.prototype, "activeId", 2);
|
|
142
151
|
s([
|
|
143
|
-
|
|
144
|
-
],
|
|
152
|
+
d()
|
|
153
|
+
], r.prototype, "header", 2);
|
|
145
154
|
s([
|
|
146
|
-
|
|
147
|
-
],
|
|
148
|
-
|
|
155
|
+
d({ type: Boolean, reflect: !0 })
|
|
156
|
+
], r.prototype, "collapsed", 2);
|
|
157
|
+
r = s([
|
|
149
158
|
g("dp-sidebar")
|
|
150
|
-
],
|
|
159
|
+
], r);
|
|
151
160
|
export {
|
|
152
|
-
|
|
161
|
+
r as DpSidebar,
|
|
153
162
|
$ as DpSidebarSelectEvent
|
|
154
163
|
};
|
package/dist/toolbar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { css as p, LitElement as g, nothing as h, html as d } from "lit";
|
|
2
2
|
import { property as s, customElement as v } from "lit/decorators.js";
|
|
3
|
-
var f = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (
|
|
4
|
-
for (var e = a > 1 ? void 0 : a ? b(r,
|
|
5
|
-
(c =
|
|
6
|
-
return a && e && f(r,
|
|
3
|
+
var f = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (l, r, i, a) => {
|
|
4
|
+
for (var e = a > 1 ? void 0 : a ? b(r, i) : r, n = l.length - 1, c; n >= 0; n--)
|
|
5
|
+
(c = l[n]) && (e = (a ? c(r, i, e) : c(e)) || e);
|
|
6
|
+
return a && e && f(r, i, e), e;
|
|
7
7
|
};
|
|
8
8
|
class u extends Event {
|
|
9
9
|
constructor() {
|
|
@@ -14,6 +14,9 @@ let t = class extends g {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments), this.heading = "", this.subtitle = "", this.showToggle = !1, this.dragRegion = !1;
|
|
16
16
|
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), this.setAttribute("role", "banner");
|
|
19
|
+
}
|
|
17
20
|
render() {
|
|
18
21
|
return d`
|
|
19
22
|
<div class="start">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/desktop-patterns",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -16,27 +16,33 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
|
-
"import": "./dist/index.js"
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
20
21
|
},
|
|
21
22
|
"./page": {
|
|
22
23
|
"types": "./dist/components/page/dp-page.d.ts",
|
|
23
|
-
"import": "./dist/page.js"
|
|
24
|
+
"import": "./dist/page.js",
|
|
25
|
+
"default": "./dist/page.js"
|
|
24
26
|
},
|
|
25
27
|
"./sidebar": {
|
|
26
28
|
"types": "./dist/components/sidebar/dp-sidebar.d.ts",
|
|
27
|
-
"import": "./dist/sidebar.js"
|
|
29
|
+
"import": "./dist/sidebar.js",
|
|
30
|
+
"default": "./dist/sidebar.js"
|
|
28
31
|
},
|
|
29
32
|
"./toolbar": {
|
|
30
33
|
"types": "./dist/components/toolbar/dp-toolbar.d.ts",
|
|
31
|
-
"import": "./dist/toolbar.js"
|
|
34
|
+
"import": "./dist/toolbar.js",
|
|
35
|
+
"default": "./dist/toolbar.js"
|
|
32
36
|
},
|
|
33
37
|
"./shell": {
|
|
34
38
|
"types": "./dist/components/shell/dp-shell.d.ts",
|
|
35
|
-
"import": "./dist/shell.js"
|
|
39
|
+
"import": "./dist/shell.js",
|
|
40
|
+
"default": "./dist/shell.js"
|
|
36
41
|
},
|
|
37
42
|
"./shortcut-overlay": {
|
|
38
43
|
"types": "./dist/components/shortcut-overlay/dp-shortcut-overlay.d.ts",
|
|
39
|
-
"import": "./dist/shortcut-overlay.js"
|
|
44
|
+
"import": "./dist/shortcut-overlay.js",
|
|
45
|
+
"default": "./dist/shortcut-overlay.js"
|
|
40
46
|
},
|
|
41
47
|
"./tokens.css": "./tokens.css"
|
|
42
48
|
},
|