@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,153 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcAuthShell extends LitElement {
5
+ static properties = {
6
+ variant: { type: String, reflect: true },
7
+ };
8
+
9
+ static styles = [
10
+ tokenStyles,
11
+ css`
12
+ :host {
13
+ display: block;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ /* Centered variant */
18
+ .auth-shell--centered {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ min-height: 100vh;
24
+ background: var(--bg-surface);
25
+ padding: var(--space-xl) var(--space-lg);
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ .auth-shell--centered .logo {
30
+ margin-bottom: var(--space-xl);
31
+ text-align: center;
32
+ }
33
+
34
+ .auth-shell--centered .card {
35
+ background: var(--bg-card);
36
+ border: 1px solid var(--border-default);
37
+ border-radius: var(--radius-lg);
38
+ padding: var(--space-xl);
39
+ width: 100%;
40
+ max-width: 420px;
41
+ box-sizing: border-box;
42
+ }
43
+
44
+ .auth-shell--centered .footer {
45
+ margin-top: var(--space-lg);
46
+ color: var(--text-muted);
47
+ font-size: var(--text-sm);
48
+ text-align: center;
49
+ }
50
+
51
+ /* Split variant */
52
+ .auth-shell--split {
53
+ display: grid;
54
+ grid-template-columns: 1fr 1fr;
55
+ min-height: 100vh;
56
+ box-sizing: border-box;
57
+ }
58
+
59
+ .auth-shell--split .form-side {
60
+ display: flex;
61
+ flex-direction: column;
62
+ align-items: center;
63
+ justify-content: center;
64
+ background: var(--bg-surface);
65
+ padding: var(--space-xl) var(--space-lg);
66
+ }
67
+
68
+ .auth-shell--split .logo {
69
+ margin-bottom: var(--space-xl);
70
+ text-align: center;
71
+ }
72
+
73
+ .auth-shell--split .card {
74
+ background: var(--bg-card);
75
+ border: 1px solid var(--border-default);
76
+ border-radius: var(--radius-lg);
77
+ padding: var(--space-xl);
78
+ width: 100%;
79
+ max-width: 420px;
80
+ box-sizing: border-box;
81
+ }
82
+
83
+ .auth-shell--split .footer {
84
+ margin-top: var(--space-lg);
85
+ color: var(--text-muted);
86
+ font-size: var(--text-sm);
87
+ text-align: center;
88
+ }
89
+
90
+ .auth-shell--split .aside-side {
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ background: var(--bg-deep);
95
+ padding: var(--space-xl);
96
+ }
97
+
98
+ @media (max-width: 768px) {
99
+ .auth-shell--split {
100
+ grid-template-columns: 1fr;
101
+ }
102
+
103
+ .auth-shell--split .aside-side {
104
+ display: none;
105
+ }
106
+ }
107
+ `,
108
+ ];
109
+
110
+ constructor() {
111
+ super();
112
+ this.variant = 'centered';
113
+ }
114
+
115
+ render() {
116
+ if (this.variant === 'split') {
117
+ return html`
118
+ <div class="auth-shell--split" part="shell">
119
+ <div class="form-side" part="form-side">
120
+ <div class="logo" part="logo">
121
+ <slot name="logo"></slot>
122
+ </div>
123
+ <div class="card" part="card">
124
+ <slot></slot>
125
+ </div>
126
+ <div class="footer" part="footer">
127
+ <slot name="footer"></slot>
128
+ </div>
129
+ </div>
130
+ <div class="aside-side" part="aside">
131
+ <slot name="aside"></slot>
132
+ </div>
133
+ </div>
134
+ `;
135
+ }
136
+
137
+ return html`
138
+ <div class="auth-shell--centered" part="shell">
139
+ <div class="logo" part="logo">
140
+ <slot name="logo"></slot>
141
+ </div>
142
+ <div class="card" part="card">
143
+ <slot></slot>
144
+ </div>
145
+ <div class="footer" part="footer">
146
+ <slot name="footer"></slot>
147
+ </div>
148
+ </div>
149
+ `;
150
+ }
151
+ }
152
+
153
+ customElements.define('arc-auth-shell', ArcAuthShell);
@@ -0,0 +1,37 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcContainer extends LitElement {
5
+ static properties = {
6
+ narrow: { type: Boolean, reflect: true },
7
+ };
8
+
9
+ static styles = [
10
+ tokenStyles,
11
+ css`
12
+ :host { display: block; }
13
+
14
+ .container {
15
+ width: 100%;
16
+ max-width: var(--max-width);
17
+ margin-inline: auto;
18
+ padding-inline: var(--space-lg);
19
+ }
20
+
21
+ :host([narrow]) .container {
22
+ max-width: var(--max-width-sm);
23
+ }
24
+ `,
25
+ ];
26
+
27
+ constructor() {
28
+ super();
29
+ this.narrow = false;
30
+ }
31
+
32
+ render() {
33
+ return html`<div class="container" part="container"><slot></slot></div>`;
34
+ }
35
+ }
36
+
37
+ customElements.define('arc-container', ArcContainer);
@@ -0,0 +1,62 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcDashboardGrid extends LitElement {
5
+ static properties = {
6
+ columns: { type: Number },
7
+ gap: { type: String },
8
+ minColumnWidth: { type: String, attribute: 'min-column-width' },
9
+ };
10
+
11
+ static styles = [
12
+ tokenStyles,
13
+ css`
14
+ :host {
15
+ display: block;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ .dashboard-grid {
20
+ display: grid;
21
+ grid-template-columns: repeat(
22
+ auto-fill,
23
+ minmax(var(--min-col, 280px), 1fr)
24
+ );
25
+ gap: var(--gap, var(--space-lg));
26
+ padding: var(--space-lg);
27
+ }
28
+
29
+ :host([data-explicit-columns]) .dashboard-grid {
30
+ grid-template-columns: repeat(var(--columns, 3), 1fr);
31
+ }
32
+ `,
33
+ ];
34
+
35
+ constructor() {
36
+ super();
37
+ this.columns = 3;
38
+ this.gap = 'var(--space-lg)';
39
+ this.minColumnWidth = '280px';
40
+ this._explicitColumns = false;
41
+ }
42
+
43
+ updated(changedProperties) {
44
+ this.style.setProperty('--min-col', this.minColumnWidth);
45
+ this.style.setProperty('--columns', this.columns);
46
+ this.style.setProperty('--gap', this.gap);
47
+
48
+ if (changedProperties.has('columns') && this.hasAttribute('columns')) {
49
+ this.setAttribute('data-explicit-columns', '');
50
+ }
51
+ }
52
+
53
+ render() {
54
+ return html`
55
+ <div class="dashboard-grid" part="grid">
56
+ <slot></slot>
57
+ </div>
58
+ `;
59
+ }
60
+ }
61
+
62
+ customElements.define('arc-dashboard-grid', ArcDashboardGrid);
@@ -0,0 +1,15 @@
1
+ // ARC UI — Layout tier
2
+ // Application structure and page layout components
3
+
4
+ export { ArcAppShell } from './app-shell.js';
5
+ export { ArcAuthShell } from './auth-shell.js';
6
+ export { ArcContainer } from './container.js';
7
+ export { ArcDashboardGrid } from './dashboard-grid.js';
8
+ export { ArcPageHeader } from './page-header.js';
9
+ export { ArcPageLayout } from './page-layout.js';
10
+ export { ArcResizable } from './resizable.js';
11
+ export { ArcSection } from './section.js';
12
+ export { ArcSettingsLayout } from './settings-layout.js';
13
+ export { ArcSplitPane } from './split-pane.js';
14
+ export { ArcStatusBar } from './status-bar.js';
15
+ export { ArcToolbar } from './toolbar.js';
@@ -0,0 +1,100 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcPageHeader extends LitElement {
5
+ static properties = {
6
+ heading: { type: String },
7
+ description: { type: String },
8
+ };
9
+
10
+ static styles = [
11
+ tokenStyles,
12
+ css`
13
+ :host {
14
+ display: block;
15
+ font-family: var(--font-body);
16
+ }
17
+
18
+ .page-header {
19
+ padding: var(--space-lg) 0 var(--space-md);
20
+ border-bottom: 1px solid var(--border-subtle);
21
+ }
22
+
23
+ .page-header__breadcrumb {
24
+ margin-bottom: var(--space-sm);
25
+ }
26
+
27
+ .page-header__title-row {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: space-between;
31
+ gap: var(--space-md);
32
+ flex-wrap: wrap;
33
+ }
34
+
35
+ .page-header__heading {
36
+ margin: 0;
37
+ font-family: var(--font-body);
38
+ font-size: 28px; /* size-variant, keep hardcoded */
39
+ font-weight: 700;
40
+ color: var(--text-primary);
41
+ line-height: 1.2;
42
+ }
43
+
44
+ .page-header__actions {
45
+ display: flex;
46
+ align-items: center;
47
+ gap: var(--space-sm);
48
+ flex-shrink: 0;
49
+ }
50
+
51
+ .page-header__description {
52
+ margin-top: var(--space-sm);
53
+ color: var(--text-secondary);
54
+ font-size: var(--body-size);
55
+ line-height: 1.5;
56
+ }
57
+
58
+ .page-header__tabs {
59
+ margin-top: var(--space-md);
60
+ }
61
+
62
+ .page-header__content {
63
+ margin-top: var(--space-md);
64
+ }
65
+ `,
66
+ ];
67
+
68
+ constructor() {
69
+ super();
70
+ this.heading = '';
71
+ this.description = '';
72
+ }
73
+
74
+ render() {
75
+ return html`
76
+ <div class="page-header" part="base">
77
+ <div class="page-header__breadcrumb" part="breadcrumb">
78
+ <slot name="breadcrumb"></slot>
79
+ </div>
80
+ <div class="page-header__title-row" part="title-row">
81
+ <h1 class="page-header__heading" part="heading">${this.heading}</h1>
82
+ <div class="page-header__actions" part="actions">
83
+ <slot name="actions"></slot>
84
+ </div>
85
+ </div>
86
+ ${this.description
87
+ ? html`<p class="page-header__description" part="description">${this.description}</p>`
88
+ : ''}
89
+ <div class="page-header__tabs" part="tabs">
90
+ <slot name="tabs"></slot>
91
+ </div>
92
+ <div class="page-header__content" part="content">
93
+ <slot></slot>
94
+ </div>
95
+ </div>
96
+ `;
97
+ }
98
+ }
99
+
100
+ customElements.define('arc-page-header', ArcPageHeader);
@@ -0,0 +1,112 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcPageLayout extends LitElement {
5
+ static properties = {
6
+ layout: { type: String, reflect: true },
7
+ maxWidth: { type: String, attribute: 'max-width' },
8
+ gap: { type: String },
9
+ };
10
+
11
+ static styles = [
12
+ tokenStyles,
13
+ css`
14
+ :host {
15
+ display: block;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ .page-layout {
20
+ padding: var(--space-xl) var(--space-lg);
21
+ gap: var(--gap);
22
+ min-height: 100%;
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ /* Centered layout */
27
+ :host([layout='centered']) .page-layout {
28
+ display: block;
29
+ max-width: var(--max-width);
30
+ margin: 0 auto;
31
+ }
32
+
33
+ /* Wide layout */
34
+ :host([layout='wide']) .page-layout {
35
+ display: block;
36
+ }
37
+
38
+ /* Sidebar left layout */
39
+ :host([layout='sidebar-left']) .page-layout {
40
+ display: grid;
41
+ grid-template-columns: 240px 1fr;
42
+ }
43
+
44
+ /* Sidebar right layout */
45
+ :host([layout='sidebar-right']) .page-layout {
46
+ display: grid;
47
+ grid-template-columns: 1fr 300px;
48
+ }
49
+
50
+ .sidebar {
51
+ display: none;
52
+ }
53
+
54
+ :host([layout='sidebar-left']) .sidebar {
55
+ display: block;
56
+ }
57
+
58
+ .aside {
59
+ display: none;
60
+ }
61
+
62
+ :host([layout='sidebar-right']) .aside {
63
+ display: block;
64
+ }
65
+
66
+ .main {
67
+ min-width: 0;
68
+ }
69
+
70
+ @media (max-width: 768px) {
71
+ :host([layout='sidebar-left']) .page-layout,
72
+ :host([layout='sidebar-right']) .page-layout {
73
+ grid-template-columns: 1fr;
74
+ }
75
+ }
76
+ `,
77
+ ];
78
+
79
+ constructor() {
80
+ super();
81
+ this.layout = 'centered';
82
+ this.maxWidth = '1120px';
83
+ this.gap = 'var(--space-xl)';
84
+ }
85
+
86
+ updated(changed) {
87
+ if (changed.has('maxWidth')) {
88
+ this.style.setProperty('--max-width', this.maxWidth);
89
+ }
90
+ if (changed.has('gap')) {
91
+ this.style.setProperty('--gap', this.gap);
92
+ }
93
+ }
94
+
95
+ render() {
96
+ return html`
97
+ <div class="page-layout" part="layout">
98
+ <div class="sidebar" part="sidebar">
99
+ <slot name="sidebar"></slot>
100
+ </div>
101
+ <div class="main" part="main">
102
+ <slot></slot>
103
+ </div>
104
+ <div class="aside" part="aside">
105
+ <slot name="aside"></slot>
106
+ </div>
107
+ </div>
108
+ `;
109
+ }
110
+ }
111
+
112
+ customElements.define('arc-page-layout', ArcPageLayout);
@@ -0,0 +1,221 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcResizable extends LitElement {
5
+ static properties = {
6
+ direction: { type: String, reflect: true },
7
+ minSize: { type: Number, attribute: 'min-size' },
8
+ maxSize: { type: Number, attribute: 'max-size' },
9
+ size: { type: Number },
10
+ _dragging: { state: true },
11
+ };
12
+
13
+ static styles = [
14
+ tokenStyles,
15
+ css`
16
+ :host {
17
+ display: block;
18
+ position: relative;
19
+ overflow: hidden;
20
+ }
21
+
22
+ .container {
23
+ width: 100%;
24
+ height: 100%;
25
+ overflow: auto;
26
+ }
27
+
28
+ :host([direction="horizontal"]) .container {
29
+ width: var(--panel-size);
30
+ }
31
+
32
+ :host([direction="vertical"]) .container {
33
+ height: var(--panel-size);
34
+ }
35
+
36
+ .handle {
37
+ position: absolute;
38
+ z-index: 10;
39
+ flex-shrink: 0;
40
+ background: var(--border-default);
41
+ transition: background var(--transition-fast);
42
+ touch-action: none;
43
+ }
44
+
45
+ /* Horizontal: handle on right edge */
46
+ :host([direction="horizontal"]) .handle {
47
+ top: 0;
48
+ right: 0;
49
+ width: 4px;
50
+ height: 100%;
51
+ cursor: col-resize;
52
+ }
53
+
54
+ /* Vertical: handle on bottom edge */
55
+ :host([direction="vertical"]) .handle {
56
+ bottom: 0;
57
+ left: 0;
58
+ height: 4px;
59
+ width: 100%;
60
+ cursor: row-resize;
61
+ }
62
+
63
+ .handle:hover,
64
+ .handle.active {
65
+ background: var(--accent-primary);
66
+ }
67
+
68
+ .handle:focus-visible {
69
+ outline: none;
70
+ background: var(--accent-primary);
71
+ box-shadow: var(--focus-glow);
72
+ }
73
+
74
+ /* Expand hit area for easier grabbing */
75
+ .handle::before {
76
+ content: '';
77
+ position: absolute;
78
+ }
79
+
80
+ :host([direction="horizontal"]) .handle::before {
81
+ top: 0;
82
+ left: -4px;
83
+ right: -4px;
84
+ bottom: 0;
85
+ }
86
+
87
+ :host([direction="vertical"]) .handle::before {
88
+ left: 0;
89
+ top: -4px;
90
+ bottom: -4px;
91
+ right: 0;
92
+ }
93
+
94
+ @media (prefers-reduced-motion: reduce) {
95
+ :host *,
96
+ :host *::before,
97
+ :host *::after {
98
+ animation-duration: 0.01ms !important;
99
+ animation-iteration-count: 1 !important;
100
+ transition-duration: 0.01ms !important;
101
+ }
102
+ }
103
+ `,
104
+ ];
105
+
106
+ constructor() {
107
+ super();
108
+ this.direction = 'horizontal';
109
+ this.minSize = 100;
110
+ this.maxSize = Infinity;
111
+ this.size = 300;
112
+ this._dragging = false;
113
+ this._startPos = 0;
114
+ this._startSize = 0;
115
+ }
116
+
117
+ updated(changed) {
118
+ if (changed.has('size') || changed.has('direction')) {
119
+ this.style.setProperty('--panel-size', `${this.size}px`);
120
+ }
121
+ }
122
+
123
+ firstUpdated() {
124
+ this.style.setProperty('--panel-size', `${this.size}px`);
125
+ }
126
+
127
+ _clamp(val) {
128
+ return Math.min(this.maxSize, Math.max(this.minSize, val));
129
+ }
130
+
131
+ _onPointerDown(e) {
132
+ e.preventDefault();
133
+ this._dragging = true;
134
+ this._startPos = this.direction === 'horizontal' ? e.clientX : e.clientY;
135
+ this._startSize = this.size;
136
+
137
+ const handle = e.currentTarget;
138
+ handle.setPointerCapture(e.pointerId);
139
+
140
+ const onMove = (ev) => {
141
+ const current = this.direction === 'horizontal' ? ev.clientX : ev.clientY;
142
+ const delta = current - this._startPos;
143
+ const newSize = this._clamp(this._startSize + delta);
144
+
145
+ if (newSize !== this.size) {
146
+ this.size = newSize;
147
+ this.style.setProperty('--panel-size', `${this.size}px`);
148
+
149
+ this.dispatchEvent(new CustomEvent('arc-resize', {
150
+ detail: { size: this.size },
151
+ bubbles: true,
152
+ composed: true,
153
+ }));
154
+ }
155
+ };
156
+
157
+ const onUp = (ev) => {
158
+ this._dragging = false;
159
+ handle.releasePointerCapture(ev.pointerId);
160
+ handle.removeEventListener('pointermove', onMove);
161
+ handle.removeEventListener('pointerup', onUp);
162
+ handle.removeEventListener('pointercancel', onUp);
163
+ };
164
+
165
+ handle.addEventListener('pointermove', onMove);
166
+ handle.addEventListener('pointerup', onUp);
167
+ handle.addEventListener('pointercancel', onUp);
168
+ }
169
+
170
+ _onKeydown(e) {
171
+ const step = e.shiftKey ? 20 : 5;
172
+ let newSize = this.size;
173
+
174
+ if (this.direction === 'horizontal') {
175
+ if (e.key === 'ArrowRight') newSize += step;
176
+ else if (e.key === 'ArrowLeft') newSize -= step;
177
+ else return;
178
+ } else {
179
+ if (e.key === 'ArrowDown') newSize += step;
180
+ else if (e.key === 'ArrowUp') newSize -= step;
181
+ else return;
182
+ }
183
+
184
+ e.preventDefault();
185
+ newSize = this._clamp(newSize);
186
+
187
+ if (newSize !== this.size) {
188
+ this.size = newSize;
189
+ this.style.setProperty('--panel-size', `${this.size}px`);
190
+
191
+ this.dispatchEvent(new CustomEvent('arc-resize', {
192
+ detail: { size: this.size },
193
+ bubbles: true,
194
+ composed: true,
195
+ }));
196
+ }
197
+ }
198
+
199
+ render() {
200
+ return html`
201
+ <div class="container" part="container">
202
+ <slot></slot>
203
+ </div>
204
+ <div
205
+ class="handle ${this._dragging ? 'active' : ''}"
206
+ part="handle"
207
+ role="separator"
208
+ tabindex="0"
209
+ aria-orientation=${this.direction}
210
+ aria-valuenow=${this.size}
211
+ aria-valuemin=${this.minSize}
212
+ aria-valuemax=${isFinite(this.maxSize) ? this.maxSize : undefined}
213
+ aria-label="Resize handle"
214
+ @pointerdown=${this._onPointerDown}
215
+ @keydown=${this._onKeydown}
216
+ ></div>
217
+ `;
218
+ }
219
+ }
220
+
221
+ customElements.define('arc-resizable', ArcResizable);