@iyulab/desktop-patterns 0.1.2 → 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.
package/README.md CHANGED
@@ -125,9 +125,10 @@ npm run build # per-component ESM output, type declarations
125
125
  npm run storybook # interactive component browser
126
126
  ```
127
127
 
128
- Until `@iyulab/desktop-compact` publishes its first npm release, this package resolves it via
129
- `file:../desktop-compact` for local development (a sibling checkout at that relative path) — this
130
- switches to a registry semver range once `desktop-compact` publishes.
128
+ `@iyulab/desktop-compact` is a **peer** dependency: this package reads its `--dc-*` tokens but never
129
+ imports its code, so the consumer installs one copy and both packages share it. A regular dependency
130
+ would give a consumer on a newer `desktop-compact` minor a second, unused copy nested under this
131
+ package.
131
132
 
132
133
  ## License
133
134
 
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 n, customElement as g } from "lit/decorators.js";
3
- var y = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, b = (e) => {
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, r, p) => {
6
- for (var a = p > 1 ? void 0 : p ? _(t, r) : t, l = e.length - 1, h; l >= 0; l--)
7
- (h = e[l]) && (a = (p ? h(t, r, a) : h(a)) || a);
8
- return p && a && y(t, r, a), a;
9
- }, w = (e, t, r) => t.has(e) || b("Cannot " + r), I = (e, t, r) => t.has(e) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), v = (e, t, r) => (w(e, t, "access private method"), r), d, f, u;
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 o = class extends x {
15
+ let r = class extends x {
16
16
  constructor() {
17
- super(...arguments), I(this, d), this.items = [], this.bottomItems = [], this.activeId = "", this.header = "", this.collapsed = !1;
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, d, f).call(this, e))}</nav>
26
- ${this.bottomItems.length > 0 ? i`<div class="bottom-group">${this.bottomItems.map((e) => v(this, d, f).call(this, e))}</div>` : c}
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
- d = /* @__PURE__ */ new WeakSet();
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, d, u).call(this, e.id)}
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
- o.styles = m`
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
- n({ type: Array })
135
- ], o.prototype, "items", 2);
143
+ d({ type: Array })
144
+ ], r.prototype, "items", 2);
136
145
  s([
137
- n({ type: Array, attribute: "bottom-items" })
138
- ], o.prototype, "bottomItems", 2);
146
+ d({ type: Array, attribute: "bottom-items" })
147
+ ], r.prototype, "bottomItems", 2);
139
148
  s([
140
- n({ attribute: "active-id" })
141
- ], o.prototype, "activeId", 2);
149
+ d({ attribute: "active-id" })
150
+ ], r.prototype, "activeId", 2);
142
151
  s([
143
- n()
144
- ], o.prototype, "header", 2);
152
+ d()
153
+ ], r.prototype, "header", 2);
145
154
  s([
146
- n({ type: Boolean, reflect: !0 })
147
- ], o.prototype, "collapsed", 2);
148
- o = s([
155
+ d({ type: Boolean, reflect: !0 })
156
+ ], r.prototype, "collapsed", 2);
157
+ r = s([
149
158
  g("dp-sidebar")
150
- ], o);
159
+ ], r);
151
160
  export {
152
- o as DpSidebar,
161
+ r as DpSidebar,
153
162
  $ as DpSidebarSelectEvent
154
163
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/desktop-patterns",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -57,10 +57,13 @@
57
57
  "build-storybook": "storybook build"
58
58
  },
59
59
  "dependencies": {
60
- "@iyulab/desktop-compact": "^0.2.0",
61
60
  "lit": "^3.2.1"
62
61
  },
62
+ "peerDependencies": {
63
+ "@iyulab/desktop-compact": "^0.2.0 || ^0.3.0"
64
+ },
63
65
  "devDependencies": {
66
+ "@iyulab/desktop-compact": "^0.3.0",
64
67
  "@open-wc/testing": "^4.0.0",
65
68
  "@storybook/addon-essentials": "^8.3.0",
66
69
  "@storybook/web-components": "^8.3.0",