@arclux/arc-ui 1.0.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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/package.json +186 -0
  4. package/src/content/accordion-item.js +27 -0
  5. package/src/content/accordion.js +151 -0
  6. package/src/content/animated-number.js +160 -0
  7. package/src/content/aspect-ratio.js +78 -0
  8. package/src/content/avatar-group.js +101 -0
  9. package/src/content/avatar.js +92 -0
  10. package/src/content/badge.js +98 -0
  11. package/src/content/callout.js +141 -0
  12. package/src/content/card.js +75 -0
  13. package/src/content/carousel.js +300 -0
  14. package/src/content/code-block.js +152 -0
  15. package/src/content/collapsible.js +142 -0
  16. package/src/content/color-swatch.js +86 -0
  17. package/src/content/column.js +28 -0
  18. package/src/content/data-table.js +332 -0
  19. package/src/content/divider.js +153 -0
  20. package/src/content/empty-state.js +78 -0
  21. package/src/content/feature-card.js +142 -0
  22. package/src/content/highlight.js +63 -0
  23. package/src/content/icon-library.js +30 -0
  24. package/src/content/icon-registry.js +39 -0
  25. package/src/content/icon.js +95 -0
  26. package/src/content/index.js +44 -0
  27. package/src/content/infinite-scroll.js +144 -0
  28. package/src/content/kbd.js +40 -0
  29. package/src/content/markdown.js +294 -0
  30. package/src/content/marquee.js +166 -0
  31. package/src/content/meter.js +167 -0
  32. package/src/content/scroll-area.js +107 -0
  33. package/src/content/skeleton.js +85 -0
  34. package/src/content/spinner.js +77 -0
  35. package/src/content/stack.js +68 -0
  36. package/src/content/stat.js +72 -0
  37. package/src/content/step.js +22 -0
  38. package/src/content/stepper.js +202 -0
  39. package/src/content/table.js +134 -0
  40. package/src/content/tag.js +156 -0
  41. package/src/content/text.js +111 -0
  42. package/src/content/timeline-item.js +29 -0
  43. package/src/content/timeline.js +170 -0
  44. package/src/content/truncate.js +161 -0
  45. package/src/content/value-card.js +94 -0
  46. package/src/feedback/alert.js +187 -0
  47. package/src/feedback/command-item.js +28 -0
  48. package/src/feedback/command-palette.js +346 -0
  49. package/src/feedback/context-menu.js +299 -0
  50. package/src/feedback/dialog.js +298 -0
  51. package/src/feedback/dropdown-menu.js +259 -0
  52. package/src/feedback/hover-card.js +186 -0
  53. package/src/feedback/index.js +17 -0
  54. package/src/feedback/modal.js +226 -0
  55. package/src/feedback/notification-panel.js +196 -0
  56. package/src/feedback/popover.js +184 -0
  57. package/src/feedback/progress.js +169 -0
  58. package/src/feedback/sheet.js +249 -0
  59. package/src/feedback/toast.js +207 -0
  60. package/src/feedback/tooltip.js +189 -0
  61. package/src/icons/lucide.d.ts +1915 -0
  62. package/src/icons/lucide.js +1915 -0
  63. package/src/icons/phosphor.d.ts +1517 -0
  64. package/src/icons/phosphor.js +1517 -0
  65. package/src/icons/types.d.ts +8 -0
  66. package/src/index.js +9 -0
  67. package/src/input/button.js +127 -0
  68. package/src/input/calendar.js +340 -0
  69. package/src/input/checkbox.js +159 -0
  70. package/src/input/chip.js +120 -0
  71. package/src/input/color-picker.js +461 -0
  72. package/src/input/combobox.js +295 -0
  73. package/src/input/copy-button.js +144 -0
  74. package/src/input/date-picker.js +534 -0
  75. package/src/input/file-upload.js +333 -0
  76. package/src/input/form.js +179 -0
  77. package/src/input/icon-button.js +179 -0
  78. package/src/input/index.js +31 -0
  79. package/src/input/input.js +158 -0
  80. package/src/input/multi-select.js +392 -0
  81. package/src/input/number-input.js +239 -0
  82. package/src/input/otp-input.js +221 -0
  83. package/src/input/pin-input.js +294 -0
  84. package/src/input/radio-group.js +177 -0
  85. package/src/input/radio.js +28 -0
  86. package/src/input/rating.js +195 -0
  87. package/src/input/search.js +371 -0
  88. package/src/input/segmented-control.js +174 -0
  89. package/src/input/select.js +267 -0
  90. package/src/input/slider.js +217 -0
  91. package/src/input/sortable-list.js +345 -0
  92. package/src/input/suggestion.js +26 -0
  93. package/src/input/textarea.js +203 -0
  94. package/src/input/theme-toggle.js +196 -0
  95. package/src/input/toggle.js +166 -0
  96. package/src/layout/app-shell.js +266 -0
  97. package/src/layout/auth-shell.js +153 -0
  98. package/src/layout/container.js +37 -0
  99. package/src/layout/dashboard-grid.js +62 -0
  100. package/src/layout/index.js +15 -0
  101. package/src/layout/page-header.js +100 -0
  102. package/src/layout/page-layout.js +112 -0
  103. package/src/layout/resizable.js +221 -0
  104. package/src/layout/section.js +54 -0
  105. package/src/layout/settings-layout.js +91 -0
  106. package/src/layout/split-pane.js +172 -0
  107. package/src/layout/status-bar.js +84 -0
  108. package/src/layout/toolbar.js +92 -0
  109. package/src/navigation/breadcrumb-item.js +26 -0
  110. package/src/navigation/breadcrumb.js +129 -0
  111. package/src/navigation/drawer.js +183 -0
  112. package/src/navigation/footer.js +99 -0
  113. package/src/navigation/index.js +22 -0
  114. package/src/navigation/link.js +120 -0
  115. package/src/navigation/nav-item.js +46 -0
  116. package/src/navigation/navigation-menu.js +687 -0
  117. package/src/navigation/pagination.js +186 -0
  118. package/src/navigation/scroll-spy.js +198 -0
  119. package/src/navigation/scroll-to-top.js +163 -0
  120. package/src/navigation/sidebar-link.js +28 -0
  121. package/src/navigation/sidebar-section.js +45 -0
  122. package/src/navigation/sidebar.js +336 -0
  123. package/src/navigation/spy-link.js +26 -0
  124. package/src/navigation/tab.js +26 -0
  125. package/src/navigation/tabs.js +202 -0
  126. package/src/navigation/top-bar.js +263 -0
  127. package/src/navigation/tree-item.js +38 -0
  128. package/src/navigation/tree-view.js +255 -0
  129. package/src/shared/index.js +6 -0
  130. package/src/shared/menu-divider.js +9 -0
  131. package/src/shared/menu-item.js +30 -0
  132. package/src/shared/option.js +31 -0
  133. package/src/shared-styles.js +81 -0
  134. package/src/tokens.js +445 -0
  135. package/types/index.d.ts +973 -0
@@ -0,0 +1,196 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcThemeToggle extends LitElement {
5
+ static properties = {
6
+ theme: { type: String, reflect: true },
7
+ disabled: { type: Boolean, reflect: true },
8
+ iconOnly: { type: Boolean, attribute: 'icon-only', reflect: true },
9
+ };
10
+
11
+ static styles = [
12
+ tokenStyles,
13
+ css`
14
+ :host { display: inline-flex; }
15
+ :host([disabled]) { pointer-events: none; opacity: 0.4; }
16
+
17
+ .theme-toggle {
18
+ position: relative;
19
+ display: inline-flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ gap: var(--space-sm);
23
+ background: transparent;
24
+ border: 1px solid var(--border-default);
25
+ border-radius: var(--radius-sm);
26
+ color: var(--text-muted);
27
+ cursor: pointer;
28
+ padding: var(--space-sm);
29
+ min-width: 90px;
30
+ transition:
31
+ background var(--transition-fast),
32
+ border-color var(--transition-fast),
33
+ color var(--transition-fast),
34
+ box-shadow var(--transition-fast);
35
+ }
36
+
37
+ :host([icon-only]) .theme-toggle {
38
+ min-width: 0;
39
+ padding: calc(var(--space-xs) + 2px);
40
+ border-radius: var(--radius-full);
41
+ width: 36px;
42
+ height: 36px;
43
+ }
44
+
45
+ .theme-toggle:hover {
46
+ border-color: var(--border-bright);
47
+ color: var(--text-primary);
48
+ background: var(--bg-hover);
49
+ }
50
+
51
+ .theme-toggle:active {
52
+ transform: scale(0.95);
53
+ }
54
+
55
+ .theme-toggle:focus-visible {
56
+ outline: none;
57
+ box-shadow: var(--focus-glow);
58
+ }
59
+
60
+ /* ── Icon container ── */
61
+ .theme-toggle__icon {
62
+ position: relative;
63
+ display: inline-flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ width: 18px;
67
+ height: 18px;
68
+ flex-shrink: 0;
69
+ }
70
+
71
+ /* All three icons sit on top of each other, opacity-animated */
72
+ .theme-toggle__icon svg {
73
+ position: absolute;
74
+ inset: 0;
75
+ opacity: 0;
76
+ transform: scale(0.5) rotate(-90deg);
77
+ transition: opacity 300ms var(--ease-out-expo), transform 300ms var(--ease-out-expo);
78
+ }
79
+
80
+ .theme-toggle__icon svg.is-active {
81
+ opacity: 1;
82
+ transform: scale(1) rotate(0deg);
83
+ }
84
+
85
+ /* ── Label ── */
86
+ .theme-toggle__label {
87
+ font-family: var(--font-body);
88
+ font-size: var(--text-sm);
89
+ text-transform: capitalize;
90
+ user-select: none;
91
+ width: 32px;
92
+ text-align: left;
93
+ }
94
+
95
+ :host([icon-only]) .theme-toggle__label {
96
+ display: none;
97
+ }
98
+
99
+ @media (prefers-reduced-motion: reduce) {
100
+ :host *,
101
+ :host *::before,
102
+ :host *::after {
103
+ animation-duration: 0.01ms !important;
104
+ animation-iteration-count: 1 !important;
105
+ transition-duration: 0.01ms !important;
106
+ }
107
+ }
108
+ `,
109
+ ];
110
+
111
+ static _themeOrder = ['dark', 'light', 'auto'];
112
+
113
+ constructor() {
114
+ super();
115
+ this.theme = 'auto';
116
+ this.disabled = false;
117
+ this.iconOnly = false;
118
+ }
119
+
120
+ connectedCallback() {
121
+ super.connectedCallback();
122
+ const stored = localStorage.getItem('arc-theme');
123
+ if (stored && ArcThemeToggle._themeOrder.includes(stored)) {
124
+ this.theme = stored;
125
+ } else {
126
+ this.theme = document.documentElement.getAttribute('data-theme') || 'auto';
127
+ }
128
+ }
129
+
130
+ _cycle() {
131
+ if (this.disabled) return;
132
+
133
+ const order = ArcThemeToggle._themeOrder;
134
+ const currentIdx = order.indexOf(this.theme);
135
+ const nextIdx = (currentIdx + 1) % order.length;
136
+ this.theme = order[nextIdx];
137
+
138
+ document.documentElement.setAttribute('data-theme', this.theme);
139
+ localStorage.setItem('arc-theme', this.theme);
140
+
141
+ this.dispatchEvent(new CustomEvent('arc-change', {
142
+ detail: { value: this.theme },
143
+ bubbles: true,
144
+ composed: true,
145
+ }));
146
+ }
147
+
148
+ _handleKeydown(e) {
149
+ if (e.key === ' ' || e.key === 'Enter') {
150
+ e.preventDefault();
151
+ this._cycle();
152
+ }
153
+ }
154
+
155
+ render() {
156
+ return html`
157
+ <button
158
+ class="theme-toggle"
159
+ @click=${this._cycle}
160
+ @keydown=${this._handleKeydown}
161
+ ?disabled=${this.disabled}
162
+ aria-label="Toggle theme, current: ${this.theme}"
163
+ title="Theme: ${this.theme}"
164
+ part="button"
165
+ >
166
+ <span class="theme-toggle__icon" part="icon">
167
+ <!-- Sun -->
168
+ <svg class="${this.theme === 'light' ? 'is-active' : ''}" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
169
+ <circle cx="12" cy="12" r="5"/>
170
+ <line x1="12" y1="1" x2="12" y2="3"/>
171
+ <line x1="12" y1="21" x2="12" y2="23"/>
172
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
173
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
174
+ <line x1="1" y1="12" x2="3" y2="12"/>
175
+ <line x1="21" y1="12" x2="23" y2="12"/>
176
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
177
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
178
+ </svg>
179
+ <!-- Moon -->
180
+ <svg class="${this.theme === 'dark' ? 'is-active' : ''}" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
181
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/>
182
+ </svg>
183
+ <!-- Monitor (auto) -->
184
+ <svg class="${this.theme === 'auto' ? 'is-active' : ''}" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
185
+ <rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
186
+ <line x1="8" y1="21" x2="16" y2="21"/>
187
+ <line x1="12" y1="17" x2="12" y2="21"/>
188
+ </svg>
189
+ </span>
190
+ <span class="theme-toggle__label" part="label">${this.theme}</span>
191
+ </button>
192
+ `;
193
+ }
194
+ }
195
+
196
+ customElements.define('arc-theme-toggle', ArcThemeToggle);
@@ -0,0 +1,166 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcToggle extends LitElement {
5
+ static formAssociated = true;
6
+
7
+ static properties = {
8
+ checked: { type: Boolean, reflect: true },
9
+ disabled: { type: Boolean, reflect: true },
10
+ label: { type: String },
11
+ name: { type: String },
12
+ };
13
+
14
+ static styles = [
15
+ tokenStyles,
16
+ css`
17
+ :host { display: inline-flex; align-items: center; }
18
+ :host([disabled]) { pointer-events: none; opacity: 0.4; }
19
+
20
+ .toggle {
21
+ display: inline-flex;
22
+ align-items: center;
23
+ gap: var(--space-sm);
24
+ cursor: pointer;
25
+ }
26
+
27
+ .toggle__track {
28
+ position: relative;
29
+ width: 44px;
30
+ height: 24px;
31
+ border-radius: var(--radius-full);
32
+ background: var(--bg-elevated);
33
+ border: 1px solid var(--border-bright);
34
+ transition:
35
+ background var(--transition-base),
36
+ border-color var(--transition-base),
37
+ box-shadow var(--transition-base);
38
+ flex-shrink: 0;
39
+ }
40
+
41
+ .toggle__track:hover {
42
+ border-color: var(--text-muted);
43
+ }
44
+
45
+ :host([checked]) .toggle__track {
46
+ background: var(--accent-primary);
47
+ border-color: transparent;
48
+ box-shadow:
49
+ 0 0 8px rgba(var(--accent-primary-rgb), 0.5),
50
+ 0 0 20px rgba(var(--accent-primary-rgb), 0.3),
51
+ 0 0 40px rgba(var(--accent-primary-rgb), 0.15);
52
+ }
53
+
54
+ :host([checked]) .toggle__track:hover {
55
+ box-shadow:
56
+ 0 0 10px rgba(var(--accent-primary-rgb), 0.6),
57
+ 0 0 28px rgba(var(--accent-primary-rgb), 0.35),
58
+ 0 0 50px rgba(var(--accent-primary-rgb), 0.2);
59
+ }
60
+
61
+ .toggle__thumb {
62
+ position: absolute;
63
+ top: 3px;
64
+ left: 3px;
65
+ width: 16px;
66
+ height: 16px;
67
+ border-radius: var(--radius-full);
68
+ background: var(--text-primary);
69
+ transition:
70
+ transform var(--transition-base),
71
+ box-shadow var(--transition-base);
72
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
73
+ }
74
+
75
+ :host([checked]) .toggle__thumb {
76
+ transform: translateX(20px);
77
+ box-shadow:
78
+ 0 1px 3px rgba(0, 0, 0, 0.2),
79
+ 0 0 8px rgba(var(--accent-primary-rgb), 0.5),
80
+ 0 0 16px rgba(var(--accent-primary-rgb), 0.3);
81
+ }
82
+
83
+ .toggle__label {
84
+ font-family: var(--font-accent);
85
+ font-size: var(--text-xs);
86
+ font-weight: 600;
87
+ letter-spacing: 1px;
88
+ text-transform: uppercase;
89
+ color: var(--text-muted);
90
+ user-select: none;
91
+ }
92
+
93
+ .toggle__track:focus-visible {
94
+ outline: none;
95
+ box-shadow: var(--focus-glow);
96
+ }
97
+
98
+ :host([checked]) .toggle__track:focus-visible {
99
+ box-shadow:
100
+ 0 0 0 1px rgba(var(--accent-primary-rgb), 0.25),
101
+ 0 0 10px rgba(var(--accent-primary-rgb), 0.6),
102
+ 0 0 28px rgba(var(--accent-primary-rgb), 0.35),
103
+ 0 0 50px rgba(var(--accent-primary-rgb), 0.2);
104
+ }
105
+
106
+ @media (prefers-reduced-motion: reduce) {
107
+ .toggle__track,
108
+ .toggle__thumb { transition: none; }
109
+ }
110
+ `,
111
+ ];
112
+
113
+ constructor() {
114
+ super();
115
+ this._internals = this.attachInternals();
116
+ this.checked = false;
117
+ this.disabled = false;
118
+ this.label = '';
119
+ this.name = '';
120
+ }
121
+
122
+ updated(changed) {
123
+ if (changed.has('checked')) {
124
+ this._internals.setFormValue(this.checked ? 'on' : null);
125
+ }
126
+ }
127
+
128
+ _toggle() {
129
+ if (this.disabled) return;
130
+ this.checked = !this.checked;
131
+ this._internals.setFormValue(this.checked ? 'on' : null);
132
+ this.dispatchEvent(new CustomEvent('arc-change', {
133
+ detail: { checked: this.checked },
134
+ bubbles: true,
135
+ composed: true,
136
+ }));
137
+ }
138
+
139
+ _handleKeydown(e) {
140
+ if (e.key === ' ') {
141
+ e.preventDefault();
142
+ this._toggle();
143
+ }
144
+ }
145
+
146
+ render() {
147
+ return html`
148
+ <label class="toggle" part="toggle">
149
+ <div
150
+ class="toggle__track"
151
+ role="switch"
152
+ aria-checked=${this.checked ? 'true' : 'false'}
153
+ tabindex=${this.disabled ? '-1' : '0'}
154
+ @click=${this._toggle}
155
+ @keydown=${this._handleKeydown}
156
+ part="track"
157
+ >
158
+ <div class="toggle__thumb" part="thumb"></div>
159
+ </div>
160
+ ${this.label ? html`<span class="toggle__label" part="label">${this.label}</span>` : ''}
161
+ </label>
162
+ `;
163
+ }
164
+ }
165
+
166
+ customElements.define('arc-toggle', ArcToggle);
@@ -0,0 +1,266 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcAppShell extends LitElement {
5
+ static properties = {
6
+ sidebarOpen: { type: Boolean, reflect: true, attribute: 'sidebar-open' },
7
+ breakpoint: { type: Number },
8
+ _mobile: { state: true },
9
+ _hasToc: { state: true },
10
+ };
11
+
12
+ static styles = [
13
+ tokenStyles,
14
+ css`
15
+ :host {
16
+ display: block;
17
+ min-height: 100vh;
18
+ background: var(--bg-deep);
19
+ color: var(--text-primary);
20
+ }
21
+
22
+ .shell {
23
+ display: flex;
24
+ flex-direction: column;
25
+ min-height: 100vh;
26
+ }
27
+
28
+ /* Topbar sits above everything */
29
+ .shell__topbar {
30
+ position: relative;
31
+ z-index: 200;
32
+ }
33
+
34
+ .shell__body {
35
+ display: flex;
36
+ flex: 1;
37
+ padding-top: var(--nav-height);
38
+ }
39
+
40
+ /* ── Desktop sidebar ── */
41
+ .shell__sidebar {
42
+ flex-shrink: 0;
43
+ width: 260px;
44
+ position: sticky;
45
+ top: var(--nav-height);
46
+ height: calc(100vh - var(--nav-height));
47
+ overflow-y: auto;
48
+ overflow-x: hidden;
49
+ z-index: 1;
50
+ }
51
+
52
+ .shell__main {
53
+ flex: 1;
54
+ min-width: 0;
55
+ display: flex;
56
+ }
57
+
58
+ .shell__content {
59
+ flex: 3;
60
+ min-width: 0;
61
+ padding: var(--space-xl) var(--space-xl);
62
+ }
63
+
64
+ .shell__toc {
65
+ flex: 1;
66
+ min-width: 0;
67
+ max-width: 260px;
68
+ position: sticky;
69
+ top: calc(var(--nav-height) + var(--space-xl));
70
+ align-self: flex-start;
71
+ max-height: calc(100vh - var(--nav-height) - var(--space-2xl));
72
+ overflow-y: auto;
73
+ padding: var(--space-md) var(--space-lg) var(--space-md) 0;
74
+ margin-bottom: var(--space-xl);
75
+ border-left: 1px solid var(--border-subtle);
76
+ }
77
+
78
+ .shell__toc--empty { display: none; }
79
+
80
+ @media (max-width: 1280px) {
81
+ .shell__toc { display: none; }
82
+ }
83
+
84
+ :host([mobile]) .shell__toc {
85
+ margin-bottom: var(--space-xl);
86
+ }
87
+
88
+ :host([mobile]) .shell__content {
89
+ padding: var(--space-lg);
90
+ }
91
+
92
+ /* ── Mobile overlay ── */
93
+ :host([mobile]) .shell__sidebar {
94
+ position: fixed;
95
+ top: 0;
96
+ left: 0;
97
+ bottom: 0;
98
+ z-index: 99;
99
+ height: auto;
100
+ width: 300px;
101
+ max-width: 85vw;
102
+ transform: translateX(-100%);
103
+ transition: transform 250ms var(--ease-out-expo);
104
+ background: var(--bg-surface);
105
+ padding-top: var(--nav-height);
106
+ overflow-y: auto;
107
+ overflow-x: hidden;
108
+ scrollbar-width: thin;
109
+ scrollbar-color: var(--border-default) transparent;
110
+ }
111
+
112
+ /* Override arc-sidebar's own sticky/height — the shell wrapper handles it */
113
+ ::slotted(arc-sidebar) {
114
+ position: static !important;
115
+ height: auto !important;
116
+ overflow: visible !important;
117
+ width: 100% !important;
118
+ }
119
+
120
+ :host([mobile][sidebar-open]) .shell__sidebar {
121
+ transform: translateX(0);
122
+ }
123
+
124
+ /* Backdrop */
125
+ .shell__backdrop {
126
+ display: none;
127
+ }
128
+
129
+ :host([mobile]) .shell__backdrop {
130
+ display: block;
131
+ position: fixed;
132
+ inset: 0;
133
+ z-index: 97;
134
+ background: rgba(0, 0, 0, 0.5);
135
+ opacity: 0;
136
+ visibility: hidden;
137
+ transition:
138
+ opacity 200ms ease,
139
+ visibility 200ms ease;
140
+ -webkit-backdrop-filter: blur(2px);
141
+ backdrop-filter: blur(2px);
142
+ }
143
+
144
+ :host([mobile][sidebar-open]) .shell__backdrop {
145
+ opacity: 1;
146
+ visibility: visible;
147
+ }
148
+
149
+ /* Body scroll lock when open */
150
+ @media (prefers-reduced-motion: reduce) {
151
+ :host([mobile]) .shell__sidebar {
152
+ transition: none;
153
+ }
154
+ :host([mobile]) .shell__backdrop {
155
+ transition: none;
156
+ }
157
+ }
158
+ `,
159
+ ];
160
+
161
+ constructor() {
162
+ super();
163
+ this.sidebarOpen = false;
164
+ this.breakpoint = 900;
165
+ this._mobile = false;
166
+ this._hasToc = false;
167
+ this._onToggle = this._onToggle.bind(this);
168
+ this._onNavigate = this._onNavigate.bind(this);
169
+ this._onKeyDown = this._onKeyDown.bind(this);
170
+ this._onResize = this._onResize.bind(this);
171
+ }
172
+
173
+ connectedCallback() {
174
+ super.connectedCallback();
175
+ this.addEventListener('arc-toggle', this._onToggle);
176
+ this.addEventListener('arc-navigate', this._onNavigate);
177
+ document.addEventListener('keydown', this._onKeyDown);
178
+ window.addEventListener('resize', this._onResize);
179
+ this._checkMobile();
180
+ }
181
+
182
+ disconnectedCallback() {
183
+ super.disconnectedCallback();
184
+ this.removeEventListener('arc-toggle', this._onToggle);
185
+ this.removeEventListener('arc-navigate', this._onNavigate);
186
+ document.removeEventListener('keydown', this._onKeyDown);
187
+ window.removeEventListener('resize', this._onResize);
188
+ document.body.style.overflow = '';
189
+ }
190
+
191
+ updated(changed) {
192
+ if (changed.has('_mobile')) {
193
+ if (this._mobile) {
194
+ this.setAttribute('mobile', '');
195
+ } else {
196
+ this.removeAttribute('mobile');
197
+ // Close sidebar when switching to desktop
198
+ this.sidebarOpen = false;
199
+ }
200
+ }
201
+ if (changed.has('sidebarOpen')) {
202
+ if (this._mobile) {
203
+ document.body.style.overflow = this.sidebarOpen ? 'hidden' : '';
204
+ }
205
+ }
206
+ }
207
+
208
+ _checkMobile() {
209
+ this._mobile = window.innerWidth <= this.breakpoint;
210
+ }
211
+
212
+ _onResize() {
213
+ this._checkMobile();
214
+ }
215
+
216
+ _onToggle(e) {
217
+ // Fired by arc-top-bar hamburger
218
+ this.sidebarOpen = !this.sidebarOpen;
219
+ }
220
+
221
+ _onNavigate(e) {
222
+ // Auto-close sidebar on navigation in mobile mode
223
+ if (this._mobile && this.sidebarOpen) {
224
+ this.sidebarOpen = false;
225
+ }
226
+ }
227
+
228
+ _onKeyDown(e) {
229
+ if (e.key === 'Escape' && this._mobile && this.sidebarOpen) {
230
+ this.sidebarOpen = false;
231
+ }
232
+ }
233
+
234
+ _backdropClick() {
235
+ this.sidebarOpen = false;
236
+ }
237
+
238
+ _onTocSlotChange(e) {
239
+ const nodes = e.target.assignedElements({ flatten: true });
240
+ this._hasToc = nodes.some(n => n.children.length > 0 || n.textContent.trim());
241
+ }
242
+
243
+ render() {
244
+ return html`
245
+ <div class="shell" part="shell">
246
+ <div class="shell__topbar"><slot name="topbar"></slot></div>
247
+ <div class="shell__body" part="body">
248
+ <div class="shell__backdrop" @click=${this._backdropClick}></div>
249
+ <div class="shell__sidebar" part="sidebar">
250
+ <slot name="sidebar"></slot>
251
+ </div>
252
+ <div class="shell__main" part="main">
253
+ <div class="shell__content" part="content">
254
+ <slot></slot>
255
+ </div>
256
+ <div class="shell__toc ${this._hasToc ? '' : 'shell__toc--empty'}" part="toc">
257
+ <slot name="toc" @slotchange=${this._onTocSlotChange}></slot>
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ `;
263
+ }
264
+ }
265
+
266
+ customElements.define('arc-app-shell', ArcAppShell);