@chromvoid/uikit 0.1.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/LICENSE +8 -0
- package/README.md +96 -0
- package/dist/components/cv-accordion-item.d.ts +69 -0
- package/dist/components/cv-accordion-item.js +176 -0
- package/dist/components/cv-accordion.d.ts +79 -0
- package/dist/components/cv-accordion.js +310 -0
- package/dist/components/cv-alert-dialog.d.ts +86 -0
- package/dist/components/cv-alert-dialog.js +393 -0
- package/dist/components/cv-alert.d.ts +48 -0
- package/dist/components/cv-alert.js +156 -0
- package/dist/components/cv-badge.d.ts +56 -0
- package/dist/components/cv-badge.js +280 -0
- package/dist/components/cv-breadcrumb-item.d.ts +35 -0
- package/dist/components/cv-breadcrumb-item.js +64 -0
- package/dist/components/cv-breadcrumb.d.ts +39 -0
- package/dist/components/cv-breadcrumb.js +160 -0
- package/dist/components/cv-button.d.ts +83 -0
- package/dist/components/cv-button.js +541 -0
- package/dist/components/cv-callout.d.ts +32 -0
- package/dist/components/cv-callout.js +221 -0
- package/dist/components/cv-card.d.ts +48 -0
- package/dist/components/cv-card.js +269 -0
- package/dist/components/cv-carousel-slide.d.ts +25 -0
- package/dist/components/cv-carousel-slide.js +51 -0
- package/dist/components/cv-carousel.d.ts +96 -0
- package/dist/components/cv-carousel.js +457 -0
- package/dist/components/cv-checkbox.d.ts +84 -0
- package/dist/components/cv-checkbox.js +274 -0
- package/dist/components/cv-combobox-group.d.ts +15 -0
- package/dist/components/cv-combobox-group.js +34 -0
- package/dist/components/cv-combobox-option.d.ts +30 -0
- package/dist/components/cv-combobox-option.js +66 -0
- package/dist/components/cv-combobox.d.ts +135 -0
- package/dist/components/cv-combobox.js +834 -0
- package/dist/components/cv-command-item.d.ts +30 -0
- package/dist/components/cv-command-item.js +68 -0
- package/dist/components/cv-command-palette.d.ts +105 -0
- package/dist/components/cv-command-palette.js +578 -0
- package/dist/components/cv-context-menu.d.ts +98 -0
- package/dist/components/cv-context-menu.js +515 -0
- package/dist/components/cv-copy-button.d.ts +61 -0
- package/dist/components/cv-copy-button.js +318 -0
- package/dist/components/cv-date-picker.d.ts +161 -0
- package/dist/components/cv-date-picker.js +803 -0
- package/dist/components/cv-dialog.d.ts +89 -0
- package/dist/components/cv-dialog.js +459 -0
- package/dist/components/cv-disclosure.d.ts +57 -0
- package/dist/components/cv-disclosure.js +241 -0
- package/dist/components/cv-drawer.d.ts +102 -0
- package/dist/components/cv-drawer.js +595 -0
- package/dist/components/cv-feed-article.d.ts +26 -0
- package/dist/components/cv-feed-article.js +52 -0
- package/dist/components/cv-feed.d.ts +62 -0
- package/dist/components/cv-feed.js +310 -0
- package/dist/components/cv-grid-cell.d.ts +30 -0
- package/dist/components/cv-grid-cell.js +57 -0
- package/dist/components/cv-grid-column.d.ts +30 -0
- package/dist/components/cv-grid-column.js +43 -0
- package/dist/components/cv-grid-row.d.ts +30 -0
- package/dist/components/cv-grid-row.js +42 -0
- package/dist/components/cv-grid.d.ts +119 -0
- package/dist/components/cv-grid.js +567 -0
- package/dist/components/cv-icon.d.ts +57 -0
- package/dist/components/cv-icon.js +352 -0
- package/dist/components/cv-input.d.ts +127 -0
- package/dist/components/cv-input.js +482 -0
- package/dist/components/cv-landmark.d.ts +32 -0
- package/dist/components/cv-landmark.js +62 -0
- package/dist/components/cv-link.d.ts +22 -0
- package/dist/components/cv-link.js +99 -0
- package/dist/components/cv-listbox-group.d.ts +15 -0
- package/dist/components/cv-listbox-group.js +42 -0
- package/dist/components/cv-listbox.d.ts +81 -0
- package/dist/components/cv-listbox.js +388 -0
- package/dist/components/cv-menu-button.d.ts +118 -0
- package/dist/components/cv-menu-button.js +822 -0
- package/dist/components/cv-menu-group.d.ts +20 -0
- package/dist/components/cv-menu-group.js +48 -0
- package/dist/components/cv-menu-item.d.ts +52 -0
- package/dist/components/cv-menu-item.js +105 -0
- package/dist/components/cv-menu.d.ts +62 -0
- package/dist/components/cv-menu.js +414 -0
- package/dist/components/cv-meter.d.ts +66 -0
- package/dist/components/cv-meter.js +154 -0
- package/dist/components/cv-number.d.ts +139 -0
- package/dist/components/cv-number.js +553 -0
- package/dist/components/cv-option.d.ts +30 -0
- package/dist/components/cv-option.js +84 -0
- package/dist/components/cv-popover.d.ts +87 -0
- package/dist/components/cv-popover.js +373 -0
- package/dist/components/cv-progress-ring.d.ts +45 -0
- package/dist/components/cv-progress-ring.js +169 -0
- package/dist/components/cv-progress.d.ts +45 -0
- package/dist/components/cv-progress.js +148 -0
- package/dist/components/cv-radio-group.d.ts +79 -0
- package/dist/components/cv-radio-group.js +398 -0
- package/dist/components/cv-radio.d.ts +36 -0
- package/dist/components/cv-radio.js +123 -0
- package/dist/components/cv-select-group.d.ts +15 -0
- package/dist/components/cv-select-group.js +44 -0
- package/dist/components/cv-select-option.d.ts +30 -0
- package/dist/components/cv-select-option.js +66 -0
- package/dist/components/cv-select.d.ts +128 -0
- package/dist/components/cv-select.js +666 -0
- package/dist/components/cv-sidebar-item.d.ts +26 -0
- package/dist/components/cv-sidebar-item.js +142 -0
- package/dist/components/cv-sidebar.d.ts +171 -0
- package/dist/components/cv-sidebar.js +767 -0
- package/dist/components/cv-slider-multi-thumb.d.ts +73 -0
- package/dist/components/cv-slider-multi-thumb.js +374 -0
- package/dist/components/cv-slider.d.ts +84 -0
- package/dist/components/cv-slider.js +328 -0
- package/dist/components/cv-spinbutton.d.ts +121 -0
- package/dist/components/cv-spinbutton.js +486 -0
- package/dist/components/cv-spinner.d.ts +18 -0
- package/dist/components/cv-spinner.js +95 -0
- package/dist/components/cv-switch.d.ts +81 -0
- package/dist/components/cv-switch.js +285 -0
- package/dist/components/cv-tab-panel.d.ts +20 -0
- package/dist/components/cv-tab-panel.js +37 -0
- package/dist/components/cv-tab.d.ts +40 -0
- package/dist/components/cv-tab.js +132 -0
- package/dist/components/cv-table-cell.d.ts +31 -0
- package/dist/components/cv-table-cell.js +49 -0
- package/dist/components/cv-table-column.d.ts +37 -0
- package/dist/components/cv-table-column.js +63 -0
- package/dist/components/cv-table-row.d.ts +30 -0
- package/dist/components/cv-table-row.js +45 -0
- package/dist/components/cv-table.d.ts +147 -0
- package/dist/components/cv-table.js +607 -0
- package/dist/components/cv-tabs.d.ts +70 -0
- package/dist/components/cv-tabs.js +524 -0
- package/dist/components/cv-textarea.d.ts +108 -0
- package/dist/components/cv-textarea.js +328 -0
- package/dist/components/cv-toast-region.d.ts +39 -0
- package/dist/components/cv-toast-region.js +162 -0
- package/dist/components/cv-toast.d.ts +67 -0
- package/dist/components/cv-toast.js +315 -0
- package/dist/components/cv-toolbar-item.d.ts +25 -0
- package/dist/components/cv-toolbar-item.js +72 -0
- package/dist/components/cv-toolbar-separator.d.ts +25 -0
- package/dist/components/cv-toolbar-separator.js +45 -0
- package/dist/components/cv-toolbar.d.ts +63 -0
- package/dist/components/cv-toolbar.js +295 -0
- package/dist/components/cv-tooltip.d.ts +83 -0
- package/dist/components/cv-tooltip.js +455 -0
- package/dist/components/cv-treegrid-cell.d.ts +30 -0
- package/dist/components/cv-treegrid-cell.js +57 -0
- package/dist/components/cv-treegrid-column.d.ts +37 -0
- package/dist/components/cv-treegrid-column.js +53 -0
- package/dist/components/cv-treegrid-row.d.ts +55 -0
- package/dist/components/cv-treegrid-row.js +90 -0
- package/dist/components/cv-treegrid.d.ts +96 -0
- package/dist/components/cv-treegrid.js +632 -0
- package/dist/components/cv-treeitem.d.ts +58 -0
- package/dist/components/cv-treeitem.js +144 -0
- package/dist/components/cv-treeview.d.ts +70 -0
- package/dist/components/cv-treeview.js +396 -0
- package/dist/components/cv-window-splitter.d.ts +79 -0
- package/dist/components/cv-window-splitter.js +316 -0
- package/dist/components/index.d.ts +94 -0
- package/dist/components/index.js +79 -0
- package/dist/dialog/create-dialog-controller.d.ts +31 -0
- package/dist/dialog/create-dialog-controller.js +320 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +1 -0
- package/dist/form-associated/FormAssociatedReatomElement.d.ts +25 -0
- package/dist/form-associated/FormAssociatedReatomElement.js +70 -0
- package/dist/form-associated/withFormAssociated.d.ts +5 -0
- package/dist/form-associated/withFormAssociated.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/reatom-lit/ReatomLitElement.d.ts +27 -0
- package/dist/reatom-lit/ReatomLitElement.js +118 -0
- package/dist/reatom-lit/html.d.ts +4 -0
- package/dist/reatom-lit/html.js +10 -0
- package/dist/reatom-lit/index.d.ts +4 -0
- package/dist/reatom-lit/index.js +4 -0
- package/dist/reatom-lit/watch.d.ts +15 -0
- package/dist/reatom-lit/watch.js +40 -0
- package/dist/reatom-lit/withReatomElement.d.ts +4 -0
- package/dist/reatom-lit/withReatomElement.js +57 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +84 -0
- package/dist/styles/component-styles.d.ts +4 -0
- package/dist/styles/component-styles.js +78 -0
- package/dist/theme/cv-theme-provider.d.ts +32 -0
- package/dist/theme/cv-theme-provider.js +110 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/theme-engine.d.ts +4 -0
- package/dist/theme/theme-engine.js +67 -0
- package/dist/theme/tokens.css +265 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/types.js +1 -0
- package/dist/toast/create-toast-controller.d.ts +12 -0
- package/dist/toast/create-toast-controller.js +12 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +1 -0
- package/package.json +146 -0
- package/specs/_template.md +110 -0
- package/specs/components/accordion.md +207 -0
- package/specs/components/alert.md +83 -0
- package/specs/components/badge.md +183 -0
- package/specs/components/breadcrumb.md +152 -0
- package/specs/components/button.md +227 -0
- package/specs/components/callout.md +153 -0
- package/specs/components/card.md +192 -0
- package/specs/components/carousel.md +232 -0
- package/specs/components/checkbox.md +141 -0
- package/specs/components/combobox.md +427 -0
- package/specs/components/context-menu.md +375 -0
- package/specs/components/copy-button.md +236 -0
- package/specs/components/date-picker.md +290 -0
- package/specs/components/dialog.md +184 -0
- package/specs/components/disclosure.md +151 -0
- package/specs/components/drawer.md +216 -0
- package/specs/components/feed.md +266 -0
- package/specs/components/grid.md +423 -0
- package/specs/components/input.md +237 -0
- package/specs/components/landmark.md +92 -0
- package/specs/components/link.md +117 -0
- package/specs/components/listbox.md +327 -0
- package/specs/components/menu.md +508 -0
- package/specs/components/meter.md +148 -0
- package/specs/components/number.md +268 -0
- package/specs/components/option.md +167 -0
- package/specs/components/popover.md +207 -0
- package/specs/components/progress-ring.md +134 -0
- package/specs/components/progress.md +110 -0
- package/specs/components/radio.md +208 -0
- package/specs/components/select.md +305 -0
- package/specs/components/sidebar.md +204 -0
- package/specs/components/spinbutton.md +157 -0
- package/specs/components/spinner.md +83 -0
- package/specs/components/switch.md +145 -0
- package/specs/components/table.md +372 -0
- package/specs/components/tabs.md +242 -0
- package/specs/components/textarea.md +166 -0
- package/specs/components/theme.md +364 -0
- package/specs/components/toast.md +198 -0
- package/specs/components/toolbar.md +258 -0
- package/specs/components/tooltip.md +152 -0
- package/specs/components/treegrid.md +363 -0
- package/specs/components/treeview.md +263 -0
- package/specs/components/window-splitter.md +225 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { createWindowSplitter, } from '@chromvoid/headless-ui/window-splitter';
|
|
2
|
+
import { css, html, nothing } from 'lit';
|
|
3
|
+
import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
|
|
4
|
+
const splitterKeysToPrevent = new Set([
|
|
5
|
+
'ArrowLeft',
|
|
6
|
+
'ArrowRight',
|
|
7
|
+
'ArrowUp',
|
|
8
|
+
'ArrowDown',
|
|
9
|
+
'Home',
|
|
10
|
+
'End',
|
|
11
|
+
'Enter',
|
|
12
|
+
]);
|
|
13
|
+
let cvWindowSplitterNonce = 0;
|
|
14
|
+
export class CVWindowSplitter extends ReatomLitElement {
|
|
15
|
+
static elementName = 'cv-window-splitter';
|
|
16
|
+
static get properties() {
|
|
17
|
+
return {
|
|
18
|
+
position: { type: Number, reflect: true },
|
|
19
|
+
min: { type: Number, reflect: true },
|
|
20
|
+
max: { type: Number, reflect: true },
|
|
21
|
+
step: { type: Number, reflect: true },
|
|
22
|
+
orientation: { type: String, reflect: true },
|
|
23
|
+
fixed: { type: Boolean, reflect: true },
|
|
24
|
+
snap: { type: String },
|
|
25
|
+
snapThreshold: { type: Number, attribute: 'snap-threshold' },
|
|
26
|
+
ariaLabel: { type: String, attribute: 'aria-label' },
|
|
27
|
+
ariaLabelledBy: { type: String, attribute: 'aria-labelledby' },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
idBase = `cv-window-splitter-${++cvWindowSplitterNonce}`;
|
|
31
|
+
model;
|
|
32
|
+
_dragStartPosition = 0;
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.position = 50;
|
|
36
|
+
this.min = 0;
|
|
37
|
+
this.max = 100;
|
|
38
|
+
this.step = 1;
|
|
39
|
+
this.orientation = 'vertical';
|
|
40
|
+
this.fixed = false;
|
|
41
|
+
this.snap = undefined;
|
|
42
|
+
this.snapThreshold = 12;
|
|
43
|
+
this.ariaLabel = '';
|
|
44
|
+
this.ariaLabelledBy = '';
|
|
45
|
+
this.model = this.createModel();
|
|
46
|
+
}
|
|
47
|
+
static styles = [
|
|
48
|
+
css `
|
|
49
|
+
:host {
|
|
50
|
+
display: block;
|
|
51
|
+
inline-size: 100%;
|
|
52
|
+
min-block-size: 140px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part='base'] {
|
|
56
|
+
inline-size: 100%;
|
|
57
|
+
block-size: 100%;
|
|
58
|
+
display: grid;
|
|
59
|
+
gap: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[part='base'][data-orientation='vertical'] {
|
|
63
|
+
grid-template-columns:
|
|
64
|
+
var(--cv-window-splitter-primary-size, 50%) var(--cv-window-splitter-divider-size, 8px)
|
|
65
|
+
1fr;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[part='base'][data-orientation='horizontal'] {
|
|
69
|
+
grid-template-rows:
|
|
70
|
+
var(--cv-window-splitter-primary-size, 50%) var(--cv-window-splitter-divider-size, 8px)
|
|
71
|
+
1fr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part='pane'] {
|
|
75
|
+
min-inline-size: 0;
|
|
76
|
+
min-block-size: 0;
|
|
77
|
+
overflow: auto;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[part='pane'][data-pane='primary'] {
|
|
81
|
+
border-inline-end: 1px solid transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[part='separator'] {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
background: color-mix(in oklab, var(--cv-color-surface, #141923) 82%, black);
|
|
89
|
+
border: 1px solid var(--cv-color-border, #2a3245);
|
|
90
|
+
color: var(--cv-color-text-muted, #9aa6bf);
|
|
91
|
+
user-select: none;
|
|
92
|
+
touch-action: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[part='separator']:focus-visible {
|
|
96
|
+
outline: 2px solid var(--cv-color-primary, #65d7ff);
|
|
97
|
+
outline-offset: 1px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[part='separator'][data-orientation='vertical'] {
|
|
101
|
+
cursor: col-resize;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[part='separator'][data-orientation='horizontal'] {
|
|
105
|
+
cursor: row-resize;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
[part='separator-handle'] {
|
|
109
|
+
opacity: 0.8;
|
|
110
|
+
font-size: 11px;
|
|
111
|
+
line-height: 1;
|
|
112
|
+
}
|
|
113
|
+
`,
|
|
114
|
+
];
|
|
115
|
+
static define() {
|
|
116
|
+
if (!customElements.get(this.elementName)) {
|
|
117
|
+
customElements.define(this.elementName, this);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
disconnectedCallback() {
|
|
121
|
+
super.disconnectedCallback();
|
|
122
|
+
}
|
|
123
|
+
willUpdate(changedProperties) {
|
|
124
|
+
super.willUpdate(changedProperties);
|
|
125
|
+
if (changedProperties.has('min') ||
|
|
126
|
+
changedProperties.has('max') ||
|
|
127
|
+
changedProperties.has('step') ||
|
|
128
|
+
changedProperties.has('orientation') ||
|
|
129
|
+
changedProperties.has('fixed') ||
|
|
130
|
+
changedProperties.has('snap') ||
|
|
131
|
+
changedProperties.has('snapThreshold') ||
|
|
132
|
+
changedProperties.has('ariaLabel') ||
|
|
133
|
+
changedProperties.has('ariaLabelledBy')) {
|
|
134
|
+
this.model = this.createModel();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (changedProperties.has('position') && this.model.state.position() !== this.position) {
|
|
138
|
+
this.model.actions.setPosition(this.position);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
createModel() {
|
|
142
|
+
return createWindowSplitter({
|
|
143
|
+
idBase: this.idBase,
|
|
144
|
+
min: this.min,
|
|
145
|
+
max: this.max,
|
|
146
|
+
position: this.position,
|
|
147
|
+
step: this.step,
|
|
148
|
+
orientation: this.orientation,
|
|
149
|
+
isFixed: this.fixed,
|
|
150
|
+
snap: this.snap,
|
|
151
|
+
snapThreshold: this.snapThreshold,
|
|
152
|
+
ariaLabel: this.ariaLabel || undefined,
|
|
153
|
+
ariaLabelledBy: this.ariaLabelledBy || undefined,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
getPercentage() {
|
|
157
|
+
const min = this.model.state.min();
|
|
158
|
+
const max = this.model.state.max();
|
|
159
|
+
if (max <= min)
|
|
160
|
+
return 0;
|
|
161
|
+
return Math.max(0, Math.min(100, ((this.model.state.position() - min) / (max - min)) * 100));
|
|
162
|
+
}
|
|
163
|
+
dispatchInput(detail) {
|
|
164
|
+
this.dispatchEvent(new CustomEvent('cv-input', {
|
|
165
|
+
detail,
|
|
166
|
+
bubbles: true,
|
|
167
|
+
composed: true,
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
dispatchChange(detail) {
|
|
171
|
+
this.dispatchEvent(new CustomEvent('cv-change', {
|
|
172
|
+
detail,
|
|
173
|
+
bubbles: true,
|
|
174
|
+
composed: true,
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
syncFromModelAndEmit(previousPosition, emitChange) {
|
|
178
|
+
const nextPosition = this.model.state.position();
|
|
179
|
+
this.position = nextPosition;
|
|
180
|
+
if (nextPosition === previousPosition)
|
|
181
|
+
return false;
|
|
182
|
+
const detail = { position: nextPosition };
|
|
183
|
+
this.dispatchInput(detail);
|
|
184
|
+
if (emitChange) {
|
|
185
|
+
this.dispatchChange(detail);
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
handleSeparatorKeyDown(event) {
|
|
190
|
+
if (splitterKeysToPrevent.has(event.key)) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
}
|
|
193
|
+
const previousPosition = this.model.state.position();
|
|
194
|
+
this.model.actions.handleKeyDown({ key: event.key });
|
|
195
|
+
// Re-apply setPosition to trigger snap resolution if snap is configured
|
|
196
|
+
if (this.snap) {
|
|
197
|
+
this.model.actions.setPosition(this.model.state.position());
|
|
198
|
+
}
|
|
199
|
+
this.syncFromModelAndEmit(previousPosition, true);
|
|
200
|
+
}
|
|
201
|
+
_onPointerDown = (e) => {
|
|
202
|
+
if (e.button !== undefined &&
|
|
203
|
+
e.button !== 0)
|
|
204
|
+
return;
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
const sep = e.currentTarget;
|
|
207
|
+
sep.setPointerCapture(e.pointerId);
|
|
208
|
+
this.model.actions.startDragging();
|
|
209
|
+
this._dragStartPosition = this.position;
|
|
210
|
+
sep.setAttribute('data-dragging', '');
|
|
211
|
+
sep.addEventListener('pointermove', this._onPointerMove);
|
|
212
|
+
sep.addEventListener('pointerup', this._onPointerUp);
|
|
213
|
+
sep.addEventListener('pointercancel', this._onPointerUp);
|
|
214
|
+
sep.addEventListener('lostpointercapture', this._onLostPointerCapture);
|
|
215
|
+
};
|
|
216
|
+
_onPointerMove = (e) => {
|
|
217
|
+
const base = this.shadowRoot?.querySelector('[part="base"]');
|
|
218
|
+
if (!base)
|
|
219
|
+
return;
|
|
220
|
+
const rect = base.getBoundingClientRect();
|
|
221
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
222
|
+
return;
|
|
223
|
+
const ratioRaw = this.orientation === 'vertical'
|
|
224
|
+
? (e.clientX - rect.left) / rect.width
|
|
225
|
+
: (e.clientY - rect.top) / rect.height;
|
|
226
|
+
const ratio = Math.max(0, Math.min(1, ratioRaw));
|
|
227
|
+
const min = this.model.state.min();
|
|
228
|
+
const max = this.model.state.max();
|
|
229
|
+
const newPos = min + ratio * (max - min);
|
|
230
|
+
this.model.actions.setPosition(newPos);
|
|
231
|
+
const pos = this.model.state.position();
|
|
232
|
+
this.position = pos;
|
|
233
|
+
this.dispatchEvent(new CustomEvent('cv-input', { detail: { position: pos }, bubbles: true, composed: true }));
|
|
234
|
+
};
|
|
235
|
+
_onPointerUp = (e) => {
|
|
236
|
+
const sep = e.currentTarget;
|
|
237
|
+
sep.removeEventListener('pointermove', this._onPointerMove);
|
|
238
|
+
sep.removeEventListener('pointerup', this._onPointerUp);
|
|
239
|
+
sep.removeEventListener('pointercancel', this._onPointerUp);
|
|
240
|
+
sep.removeEventListener('lostpointercapture', this._onLostPointerCapture);
|
|
241
|
+
sep.removeAttribute('data-dragging');
|
|
242
|
+
this.model.actions.stopDragging();
|
|
243
|
+
const pos = this.model.state.position();
|
|
244
|
+
if (pos !== this._dragStartPosition) {
|
|
245
|
+
this.dispatchEvent(new CustomEvent('cv-change', { detail: { position: pos }, bubbles: true, composed: true }));
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
_onLostPointerCapture = (e) => {
|
|
249
|
+
const sep = e.currentTarget;
|
|
250
|
+
sep.removeEventListener('pointermove', this._onPointerMove);
|
|
251
|
+
sep.removeEventListener('pointerup', this._onPointerUp);
|
|
252
|
+
sep.removeEventListener('pointercancel', this._onPointerUp);
|
|
253
|
+
sep.removeEventListener('lostpointercapture', this._onLostPointerCapture);
|
|
254
|
+
sep.removeAttribute('data-dragging');
|
|
255
|
+
this.model.actions.stopDragging();
|
|
256
|
+
const pos = this.model.state.position();
|
|
257
|
+
if (pos !== this._dragStartPosition) {
|
|
258
|
+
this.dispatchEvent(new CustomEvent('cv-change', { detail: { position: pos }, bubbles: true, composed: true }));
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
render() {
|
|
262
|
+
const splitterProps = this.model.contracts.getSplitterProps();
|
|
263
|
+
const primaryPaneProps = this.model.contracts.getPrimaryPaneProps();
|
|
264
|
+
const secondaryPaneProps = this.model.contracts.getSecondaryPaneProps();
|
|
265
|
+
const percentage = this.getPercentage();
|
|
266
|
+
const isDragging = this.model.state.isDragging();
|
|
267
|
+
return html `
|
|
268
|
+
<div
|
|
269
|
+
part="base"
|
|
270
|
+
data-orientation=${this.orientation}
|
|
271
|
+
style=${`--cv-window-splitter-primary-size:${percentage}%;`}
|
|
272
|
+
>
|
|
273
|
+
<div
|
|
274
|
+
id=${primaryPaneProps.id}
|
|
275
|
+
data-pane=${primaryPaneProps['data-pane']}
|
|
276
|
+
data-orientation=${primaryPaneProps['data-orientation']}
|
|
277
|
+
part="pane"
|
|
278
|
+
>
|
|
279
|
+
<slot name="primary"></slot>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div
|
|
283
|
+
id=${splitterProps.id}
|
|
284
|
+
role=${splitterProps.role}
|
|
285
|
+
tabindex=${splitterProps.tabindex}
|
|
286
|
+
aria-valuenow=${splitterProps['aria-valuenow']}
|
|
287
|
+
aria-valuemin=${splitterProps['aria-valuemin']}
|
|
288
|
+
aria-valuemax=${splitterProps['aria-valuemax']}
|
|
289
|
+
aria-valuetext=${splitterProps['aria-valuetext'] ?? nothing}
|
|
290
|
+
aria-orientation=${splitterProps['aria-orientation']}
|
|
291
|
+
aria-controls=${splitterProps['aria-controls']}
|
|
292
|
+
aria-label=${splitterProps['aria-label'] ?? nothing}
|
|
293
|
+
aria-labelledby=${splitterProps['aria-labelledby'] ?? nothing}
|
|
294
|
+
data-orientation=${this.orientation}
|
|
295
|
+
?data-dragging=${isDragging}
|
|
296
|
+
part="separator"
|
|
297
|
+
@keydown=${this.handleSeparatorKeyDown}
|
|
298
|
+
@pointerdown=${this._onPointerDown}
|
|
299
|
+
>
|
|
300
|
+
<span part="separator-handle">
|
|
301
|
+
<slot name="separator">${this.orientation === 'vertical' ? '⋮' : '⋯'}</slot>
|
|
302
|
+
</span>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<div
|
|
306
|
+
id=${secondaryPaneProps.id}
|
|
307
|
+
data-pane=${secondaryPaneProps['data-pane']}
|
|
308
|
+
data-orientation=${secondaryPaneProps['data-orientation']}
|
|
309
|
+
part="pane"
|
|
310
|
+
>
|
|
311
|
+
<slot name="secondary"></slot>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
`;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export { CVAccordion } from './cv-accordion.js';
|
|
2
|
+
export { CVAccordionItem } from './cv-accordion-item.js';
|
|
3
|
+
export { CVAlertDialog } from './cv-alert-dialog.js';
|
|
4
|
+
export { CVAlert } from './cv-alert.js';
|
|
5
|
+
export { CVBreadcrumb } from './cv-breadcrumb.js';
|
|
6
|
+
export { CVBreadcrumbItem } from './cv-breadcrumb-item.js';
|
|
7
|
+
export { CVBadge } from './cv-badge.js';
|
|
8
|
+
export { CVButton } from './cv-button.js';
|
|
9
|
+
export { CVCallout } from './cv-callout.js';
|
|
10
|
+
export { CVCopyButton } from './cv-copy-button.js';
|
|
11
|
+
export { CVCard } from './cv-card.js';
|
|
12
|
+
export { CVCarousel } from './cv-carousel.js';
|
|
13
|
+
export { CVCarouselSlide } from './cv-carousel-slide.js';
|
|
14
|
+
export { CVCheckbox } from './cv-checkbox.js';
|
|
15
|
+
export { CVCommandItem } from './cv-command-item.js';
|
|
16
|
+
export { CVCommandPalette } from './cv-command-palette.js';
|
|
17
|
+
export { CVCombobox } from './cv-combobox.js';
|
|
18
|
+
export { CVComboboxGroup } from './cv-combobox-group.js';
|
|
19
|
+
export { CVComboboxOption } from './cv-combobox-option.js';
|
|
20
|
+
export { CVContextMenu } from './cv-context-menu.js';
|
|
21
|
+
export { CVDisclosure } from './cv-disclosure.js';
|
|
22
|
+
export { CVDatePicker } from './cv-date-picker.js';
|
|
23
|
+
export { CVDialog } from './cv-dialog.js';
|
|
24
|
+
export { CVDrawer } from './cv-drawer.js';
|
|
25
|
+
export { CVFeed } from './cv-feed.js';
|
|
26
|
+
export { CVFeedArticle } from './cv-feed-article.js';
|
|
27
|
+
export { CVGridCell } from './cv-grid-cell.js';
|
|
28
|
+
export { CVGridColumn } from './cv-grid-column.js';
|
|
29
|
+
export { CVGridRow } from './cv-grid-row.js';
|
|
30
|
+
export { CVGrid } from './cv-grid.js';
|
|
31
|
+
export { CVIcon } from './cv-icon.js';
|
|
32
|
+
export { CVInput } from './cv-input.js';
|
|
33
|
+
export type { CVAccordionItemEventMap, CVAccordionItemTriggerClickEvent, CVAccordionItemTriggerFocusEvent, CVAccordionItemTriggerKeydownDetail, CVAccordionItemTriggerKeydownEvent, } from './cv-accordion-item.js';
|
|
34
|
+
export type { CVComboboxChangeEvent, CVComboboxClearEvent, CVComboboxEventDetail, CVComboboxEventMap, CVComboboxInputEvent, } from './cv-combobox.js';
|
|
35
|
+
export type { CVCopyButtonCopyDetail, CVCopyButtonCopyEvent, CVCopyButtonErrorDetail, CVCopyButtonErrorEvent, CVCopyButtonEventMap, } from './cv-copy-button.js';
|
|
36
|
+
export type { CVFeedEventMap, CVFeedExitAfterEvent, CVFeedExitBeforeEvent, CVFeedLoadMoreEvent, CVFeedLoadNewerEvent, } from './cv-feed.js';
|
|
37
|
+
export type { CVGridRowEventMap, CVGridRowSlotchangeEvent } from './cv-grid-row.js';
|
|
38
|
+
export type { CVInputBlurEvent, CVInputChangeEvent, CVInputClearEvent, CVInputEventMap, CVInputFocusEvent, CVInputInputEvent, CVInputValueDetail, } from './cv-input.js';
|
|
39
|
+
export type { CVMenuButtonActionEvent, CVMenuButtonChangeEvent, CVMenuButtonEventDetail, CVMenuButtonEventMap, CVMenuButtonInputEvent, } from './cv-menu-button.js';
|
|
40
|
+
export type { CVNumberBlurEvent, CVNumberChangeEvent, CVNumberClearEvent, CVNumberEventMap, CVNumberFocusEvent, CVNumberValueDetail, } from './cv-number.js';
|
|
41
|
+
export type { CVSelectChangeEvent, CVSelectEventDetail, CVSelectEventMap, CVSelectInputEvent, } from './cv-select.js';
|
|
42
|
+
export type { CVSidebarChangeDetail, CVSidebarChangeEvent, CVSidebarEventMap, CVSidebarInputDetail, CVSidebarInputEvent, CVSidebarScrollspyChangeDetail, CVSidebarScrollspyChangeEvent, } from './cv-sidebar.js';
|
|
43
|
+
export type { CVTableChangeEvent, CVTableEventDetail, CVTableEventMap, CVTableFocusChangeDetail, CVTableFocusChangeEvent, CVTableInputEvent, CVTableSelectionChangeDetail, CVTableSelectionChangeEvent, } from './cv-table.js';
|
|
44
|
+
export type { CVTableRowEventMap, CVTableRowSlotchangeEvent } from './cv-table-row.js';
|
|
45
|
+
export type { CVTextareaBlurEvent, CVTextareaChangeEvent, CVTextareaEventMap, CVTextareaFocusEvent, CVTextareaInputEvent, CVTextareaValueDetail, } from './cv-textarea.js';
|
|
46
|
+
export type { CVTreegridRowEventMap, CVTreegridRowSlotchangeEvent } from './cv-treegrid-row.js';
|
|
47
|
+
export type { CVTreeItemEventMap, CVTreeItemToggleDetail, CVTreeItemToggleEvent } from './cv-treeitem.js';
|
|
48
|
+
export { CVLandmark } from './cv-landmark.js';
|
|
49
|
+
export { CVListbox } from './cv-listbox.js';
|
|
50
|
+
export { CVListboxGroup } from './cv-listbox-group.js';
|
|
51
|
+
export { CVLink } from './cv-link.js';
|
|
52
|
+
export { CVMenu } from './cv-menu.js';
|
|
53
|
+
export { CVMenuButton } from './cv-menu-button.js';
|
|
54
|
+
export { CVMenuGroup } from './cv-menu-group.js';
|
|
55
|
+
export { CVMenuItem } from './cv-menu-item.js';
|
|
56
|
+
export { CVMeter } from './cv-meter.js';
|
|
57
|
+
export { CVNumber } from './cv-number.js';
|
|
58
|
+
export { CVOption } from './cv-option.js';
|
|
59
|
+
export { CVPopover } from './cv-popover.js';
|
|
60
|
+
export { CVProgress } from './cv-progress.js';
|
|
61
|
+
export { CVProgressRing } from './cv-progress-ring.js';
|
|
62
|
+
export { CVRadio } from './cv-radio.js';
|
|
63
|
+
export { CVRadioGroup } from './cv-radio-group.js';
|
|
64
|
+
export { CVSelect } from './cv-select.js';
|
|
65
|
+
export { CVSidebar } from './cv-sidebar.js';
|
|
66
|
+
export { CVSidebarItem } from './cv-sidebar-item.js';
|
|
67
|
+
export { CVSelectGroup } from './cv-select-group.js';
|
|
68
|
+
export { CVSelectOption } from './cv-select-option.js';
|
|
69
|
+
export { CVSlider } from './cv-slider.js';
|
|
70
|
+
export { CVSliderMultiThumb } from './cv-slider-multi-thumb.js';
|
|
71
|
+
export { CVSpinbutton } from './cv-spinbutton.js';
|
|
72
|
+
export { CVSpinner } from './cv-spinner.js';
|
|
73
|
+
export { CVSwitch } from './cv-switch.js';
|
|
74
|
+
export { CVTableCell } from './cv-table-cell.js';
|
|
75
|
+
export { CVTableColumn } from './cv-table-column.js';
|
|
76
|
+
export { CVTableRow } from './cv-table-row.js';
|
|
77
|
+
export { CVTable } from './cv-table.js';
|
|
78
|
+
export { CVTextarea } from './cv-textarea.js';
|
|
79
|
+
export { CVTab } from './cv-tab.js';
|
|
80
|
+
export { CVTabPanel } from './cv-tab-panel.js';
|
|
81
|
+
export { CVTabs } from './cv-tabs.js';
|
|
82
|
+
export { CVToast } from './cv-toast.js';
|
|
83
|
+
export { CVToastRegion } from './cv-toast-region.js';
|
|
84
|
+
export { CVTreegrid } from './cv-treegrid.js';
|
|
85
|
+
export { CVTreegridCell } from './cv-treegrid-cell.js';
|
|
86
|
+
export { CVTreegridColumn } from './cv-treegrid-column.js';
|
|
87
|
+
export { CVTreegridRow } from './cv-treegrid-row.js';
|
|
88
|
+
export { CVTreeItem } from './cv-treeitem.js';
|
|
89
|
+
export { CVTreeview } from './cv-treeview.js';
|
|
90
|
+
export { CVToolbar } from './cv-toolbar.js';
|
|
91
|
+
export { CVToolbarItem } from './cv-toolbar-item.js';
|
|
92
|
+
export { CVToolbarSeparator } from './cv-toolbar-separator.js';
|
|
93
|
+
export { CVTooltip } from './cv-tooltip.js';
|
|
94
|
+
export { CVWindowSplitter } from './cv-window-splitter.js';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export { CVAccordion } from './cv-accordion.js';
|
|
2
|
+
export { CVAccordionItem } from './cv-accordion-item.js';
|
|
3
|
+
export { CVAlertDialog } from './cv-alert-dialog.js';
|
|
4
|
+
export { CVAlert } from './cv-alert.js';
|
|
5
|
+
export { CVBreadcrumb } from './cv-breadcrumb.js';
|
|
6
|
+
export { CVBreadcrumbItem } from './cv-breadcrumb-item.js';
|
|
7
|
+
export { CVBadge } from './cv-badge.js';
|
|
8
|
+
export { CVButton } from './cv-button.js';
|
|
9
|
+
export { CVCallout } from './cv-callout.js';
|
|
10
|
+
export { CVCopyButton } from './cv-copy-button.js';
|
|
11
|
+
export { CVCard } from './cv-card.js';
|
|
12
|
+
export { CVCarousel } from './cv-carousel.js';
|
|
13
|
+
export { CVCarouselSlide } from './cv-carousel-slide.js';
|
|
14
|
+
export { CVCheckbox } from './cv-checkbox.js';
|
|
15
|
+
export { CVCommandItem } from './cv-command-item.js';
|
|
16
|
+
export { CVCommandPalette } from './cv-command-palette.js';
|
|
17
|
+
export { CVCombobox } from './cv-combobox.js';
|
|
18
|
+
export { CVComboboxGroup } from './cv-combobox-group.js';
|
|
19
|
+
export { CVComboboxOption } from './cv-combobox-option.js';
|
|
20
|
+
export { CVContextMenu } from './cv-context-menu.js';
|
|
21
|
+
export { CVDisclosure } from './cv-disclosure.js';
|
|
22
|
+
export { CVDatePicker } from './cv-date-picker.js';
|
|
23
|
+
export { CVDialog } from './cv-dialog.js';
|
|
24
|
+
export { CVDrawer } from './cv-drawer.js';
|
|
25
|
+
export { CVFeed } from './cv-feed.js';
|
|
26
|
+
export { CVFeedArticle } from './cv-feed-article.js';
|
|
27
|
+
export { CVGridCell } from './cv-grid-cell.js';
|
|
28
|
+
export { CVGridColumn } from './cv-grid-column.js';
|
|
29
|
+
export { CVGridRow } from './cv-grid-row.js';
|
|
30
|
+
export { CVGrid } from './cv-grid.js';
|
|
31
|
+
export { CVIcon } from './cv-icon.js';
|
|
32
|
+
export { CVInput } from './cv-input.js';
|
|
33
|
+
export { CVLandmark } from './cv-landmark.js';
|
|
34
|
+
export { CVListbox } from './cv-listbox.js';
|
|
35
|
+
export { CVListboxGroup } from './cv-listbox-group.js';
|
|
36
|
+
export { CVLink } from './cv-link.js';
|
|
37
|
+
export { CVMenu } from './cv-menu.js';
|
|
38
|
+
export { CVMenuButton } from './cv-menu-button.js';
|
|
39
|
+
export { CVMenuGroup } from './cv-menu-group.js';
|
|
40
|
+
export { CVMenuItem } from './cv-menu-item.js';
|
|
41
|
+
export { CVMeter } from './cv-meter.js';
|
|
42
|
+
export { CVNumber } from './cv-number.js';
|
|
43
|
+
export { CVOption } from './cv-option.js';
|
|
44
|
+
export { CVPopover } from './cv-popover.js';
|
|
45
|
+
export { CVProgress } from './cv-progress.js';
|
|
46
|
+
export { CVProgressRing } from './cv-progress-ring.js';
|
|
47
|
+
export { CVRadio } from './cv-radio.js';
|
|
48
|
+
export { CVRadioGroup } from './cv-radio-group.js';
|
|
49
|
+
export { CVSelect } from './cv-select.js';
|
|
50
|
+
export { CVSidebar } from './cv-sidebar.js';
|
|
51
|
+
export { CVSidebarItem } from './cv-sidebar-item.js';
|
|
52
|
+
export { CVSelectGroup } from './cv-select-group.js';
|
|
53
|
+
export { CVSelectOption } from './cv-select-option.js';
|
|
54
|
+
export { CVSlider } from './cv-slider.js';
|
|
55
|
+
export { CVSliderMultiThumb } from './cv-slider-multi-thumb.js';
|
|
56
|
+
export { CVSpinbutton } from './cv-spinbutton.js';
|
|
57
|
+
export { CVSpinner } from './cv-spinner.js';
|
|
58
|
+
export { CVSwitch } from './cv-switch.js';
|
|
59
|
+
export { CVTableCell } from './cv-table-cell.js';
|
|
60
|
+
export { CVTableColumn } from './cv-table-column.js';
|
|
61
|
+
export { CVTableRow } from './cv-table-row.js';
|
|
62
|
+
export { CVTable } from './cv-table.js';
|
|
63
|
+
export { CVTextarea } from './cv-textarea.js';
|
|
64
|
+
export { CVTab } from './cv-tab.js';
|
|
65
|
+
export { CVTabPanel } from './cv-tab-panel.js';
|
|
66
|
+
export { CVTabs } from './cv-tabs.js';
|
|
67
|
+
export { CVToast } from './cv-toast.js';
|
|
68
|
+
export { CVToastRegion } from './cv-toast-region.js';
|
|
69
|
+
export { CVTreegrid } from './cv-treegrid.js';
|
|
70
|
+
export { CVTreegridCell } from './cv-treegrid-cell.js';
|
|
71
|
+
export { CVTreegridColumn } from './cv-treegrid-column.js';
|
|
72
|
+
export { CVTreegridRow } from './cv-treegrid-row.js';
|
|
73
|
+
export { CVTreeItem } from './cv-treeitem.js';
|
|
74
|
+
export { CVTreeview } from './cv-treeview.js';
|
|
75
|
+
export { CVToolbar } from './cv-toolbar.js';
|
|
76
|
+
export { CVToolbarItem } from './cv-toolbar-item.js';
|
|
77
|
+
export { CVToolbarSeparator } from './cv-toolbar-separator.js';
|
|
78
|
+
export { CVTooltip } from './cv-tooltip.js';
|
|
79
|
+
export { CVWindowSplitter } from './cv-window-splitter.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
export type DialogPriority = 'polite' | 'assertive';
|
|
3
|
+
export interface DialogControllerAdapters {
|
|
4
|
+
announce?: (message: string, priority?: DialogPriority) => void;
|
|
5
|
+
setInertExcept?: (element: HTMLElement) => void;
|
|
6
|
+
restoreInert?: () => void;
|
|
7
|
+
findFirstFocusable?: (container: Element) => HTMLElement | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ManagedDialogOptions<T> {
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
title?: string;
|
|
12
|
+
show: () => Promise<T>;
|
|
13
|
+
close: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface CustomDialogOptions {
|
|
16
|
+
title?: string;
|
|
17
|
+
content: TemplateResult | string;
|
|
18
|
+
footer?: TemplateResult;
|
|
19
|
+
size?: 's' | 'm' | 'l' | 'xl';
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
noHeader?: boolean;
|
|
22
|
+
noFooter?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DialogController {
|
|
26
|
+
present<T>(options: ManagedDialogOptions<T>): Promise<T>;
|
|
27
|
+
showCustom<T>(options: CustomDialogOptions, resultHandler: (dialog: HTMLElement, resolve: (value: T | null) => void) => void): Promise<T | null>;
|
|
28
|
+
closeAll(): void;
|
|
29
|
+
getActiveCount(): number;
|
|
30
|
+
}
|
|
31
|
+
export declare function createDialogController(adapters?: DialogControllerAdapters): DialogController;
|