@haiyue/ui 0.1.0 → 0.1.1
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 +1 -1
- package/README.md +166 -2
- package/dist/border-beam.d.ts +26 -0
- package/dist/border-beam.js +172 -0
- package/dist/button.d.ts +10 -0
- package/dist/button.js +85 -0
- package/dist/checkbox.d.ts +2 -2
- package/dist/checkbox.js +11 -11
- package/dist/context-menu.d.ts +6 -6
- package/dist/context-menu.js +11 -9
- package/dist/dialog.d.ts +5 -5
- package/dist/dialog.js +18 -18
- package/dist/drawer.d.ts +49 -0
- package/dist/drawer.js +377 -0
- package/dist/dropdown.d.ts +9 -9
- package/dist/dropdown.js +9 -9
- package/dist/history-controls.d.ts +40 -0
- package/dist/history-controls.js +123 -0
- package/dist/index.d.ts +34 -31
- package/dist/index.js +32 -85
- package/dist/input.d.ts +5 -5
- package/dist/input.js +13 -13
- package/dist/menu-shared.d.ts +4 -4
- package/dist/menu-shared.js +4 -4
- package/dist/notification.d.ts +55 -0
- package/dist/notification.js +357 -0
- package/dist/radio.d.ts +2 -2
- package/dist/radio.js +12 -12
- package/dist/range.d.ts +74 -0
- package/dist/range.js +393 -0
- package/dist/select.d.ts +6 -6
- package/dist/select.js +20 -20
- package/dist/split.d.ts +6 -6
- package/dist/split.js +14 -14
- package/dist/tabs.d.ts +6 -6
- package/dist/tabs.js +14 -14
- package/dist/tooltip.d.ts +4 -4
- package/dist/tooltip.js +9 -9
- package/dist/tree-model.d.ts +15 -7
- package/dist/tree-model.js +93 -80
- package/dist/tree-node.d.ts +3 -3
- package/dist/tree-node.js +3 -3
- package/dist/tree-types.d.ts +14 -14
- package/dist/tree.d.ts +9 -7
- package/dist/tree.js +68 -66
- package/dist/virtual-list.d.ts +61 -0
- package/dist/virtual-list.js +322 -0
- package/package.json +87 -11
- package/themes/haiyue-dark.css +46 -0
- package/themes/haiyue-light.css +46 -0
- package/src/checkbox.ts +0 -215
- package/src/context-menu.ts +0 -248
- package/src/dialog.ts +0 -195
- package/src/dropdown.ts +0 -249
- package/src/index.ts +0 -192
- package/src/input.ts +0 -150
- package/src/menu-shared.ts +0 -65
- package/src/radio.ts +0 -216
- package/src/select.ts +0 -271
- package/src/split.ts +0 -306
- package/src/tabs.ts +0 -182
- package/src/tooltip.ts +0 -321
- package/src/tree-model.ts +0 -305
- package/src/tree-node.ts +0 -67
- package/src/tree-types.ts +0 -47
- package/src/tree.ts +0 -1002
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export class HYHistoryControls extends HTMLElement {
|
|
2
|
+
_undo = document.createElement('button');
|
|
3
|
+
_redo = document.createElement('button');
|
|
4
|
+
_canUndo = false;
|
|
5
|
+
_canRedo = false;
|
|
6
|
+
_undoLabel = '';
|
|
7
|
+
_redoLabel = '';
|
|
8
|
+
_busy = false;
|
|
9
|
+
_entries = Object.freeze([]);
|
|
10
|
+
_connected = false;
|
|
11
|
+
_requestUndo = () => this._request('undo-request');
|
|
12
|
+
_requestRedo = () => this._request('redo-request');
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ['can-undo', 'can-redo', 'undo-label', 'redo-label', 'busy', 'locale'];
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
19
|
+
const style = document.createElement('style');
|
|
20
|
+
style.textContent = `
|
|
21
|
+
:host { display: inline-flex; }
|
|
22
|
+
[role="toolbar"] { display: inline-flex; gap: 2px; }
|
|
23
|
+
button {
|
|
24
|
+
width: 30px;
|
|
25
|
+
min-height: 28px;
|
|
26
|
+
border: 1px solid var(--hy-border-color, #3d4654);
|
|
27
|
+
background: var(--hy-surface-elevated-color, #202733);
|
|
28
|
+
color: var(--hy-text-color, #eef3ff);
|
|
29
|
+
font: 600 15px system-ui, sans-serif;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
button:first-child { border-radius: 4px 0 0 4px; }
|
|
33
|
+
button:last-child { border-radius: 0 4px 4px 0; }
|
|
34
|
+
button:hover:not(:disabled) { background: var(--hy-hover-bg-color, #273241); }
|
|
35
|
+
button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
|
36
|
+
button:disabled { opacity: 0.45; cursor: default; }
|
|
37
|
+
`;
|
|
38
|
+
const toolbar = document.createElement('div');
|
|
39
|
+
toolbar.setAttribute('role', 'toolbar');
|
|
40
|
+
this._undo.type = 'button';
|
|
41
|
+
this._redo.type = 'button';
|
|
42
|
+
this._undo.textContent = '↶';
|
|
43
|
+
this._redo.textContent = '↷';
|
|
44
|
+
toolbar.append(this._undo, this._redo);
|
|
45
|
+
root.append(style, toolbar);
|
|
46
|
+
this._render();
|
|
47
|
+
}
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
if (this._connected)
|
|
50
|
+
return;
|
|
51
|
+
this._connected = true;
|
|
52
|
+
this._undo.addEventListener('click', this._requestUndo);
|
|
53
|
+
this._redo.addEventListener('click', this._requestRedo);
|
|
54
|
+
this._syncAttributes();
|
|
55
|
+
}
|
|
56
|
+
disconnectedCallback() {
|
|
57
|
+
if (!this._connected)
|
|
58
|
+
return;
|
|
59
|
+
this._connected = false;
|
|
60
|
+
this._undo.removeEventListener('click', this._requestUndo);
|
|
61
|
+
this._redo.removeEventListener('click', this._requestRedo);
|
|
62
|
+
}
|
|
63
|
+
attributeChangedCallback() { this._syncAttributes(); }
|
|
64
|
+
get canUndo() { return this._canUndo; }
|
|
65
|
+
set canUndo(value) { this._canUndo = Boolean(value); this._reflectBoolean('can-undo', this._canUndo); this._render(); }
|
|
66
|
+
get canRedo() { return this._canRedo; }
|
|
67
|
+
set canRedo(value) { this._canRedo = Boolean(value); this._reflectBoolean('can-redo', this._canRedo); this._render(); }
|
|
68
|
+
get undoLabel() { return this._undoLabel; }
|
|
69
|
+
set undoLabel(value) { this._undoLabel = String(value); this._reflectString('undo-label', this._undoLabel); this._render(); }
|
|
70
|
+
get redoLabel() { return this._redoLabel; }
|
|
71
|
+
set redoLabel(value) { this._redoLabel = String(value); this._reflectString('redo-label', this._redoLabel); this._render(); }
|
|
72
|
+
get busy() { return this._busy; }
|
|
73
|
+
set busy(value) { this._busy = Boolean(value); this._reflectBoolean('busy', this._busy); this._render(); }
|
|
74
|
+
get entries() { return this._entries; }
|
|
75
|
+
set entries(value) {
|
|
76
|
+
this._entries = Object.freeze(value.map(entry => Object.freeze({ id: entry.id, label: entry.label })));
|
|
77
|
+
}
|
|
78
|
+
_syncAttributes() {
|
|
79
|
+
this._canUndo = this.hasAttribute('can-undo');
|
|
80
|
+
this._canRedo = this.hasAttribute('can-redo');
|
|
81
|
+
this._busy = this.hasAttribute('busy');
|
|
82
|
+
this._undoLabel = this.getAttribute('undo-label') ?? '';
|
|
83
|
+
this._redoLabel = this.getAttribute('redo-label') ?? '';
|
|
84
|
+
this._render();
|
|
85
|
+
}
|
|
86
|
+
_render() {
|
|
87
|
+
const chinese = (this.getAttribute('locale') ?? '').toLowerCase().startsWith('zh');
|
|
88
|
+
const undo = chinese ? '撤销' : 'Undo';
|
|
89
|
+
const redo = chinese ? '重做' : 'Redo';
|
|
90
|
+
const undoTitle = this._undoLabel ? `${undo}: ${this._undoLabel}` : undo;
|
|
91
|
+
const redoTitle = this._redoLabel ? `${redo}: ${this._redoLabel}` : redo;
|
|
92
|
+
this._undo.disabled = this._busy || !this._canUndo;
|
|
93
|
+
this._redo.disabled = this._busy || !this._canRedo;
|
|
94
|
+
this._undo.title = undoTitle;
|
|
95
|
+
this._redo.title = redoTitle;
|
|
96
|
+
this._undo.setAttribute('aria-label', undoTitle);
|
|
97
|
+
this._redo.setAttribute('aria-label', redoTitle);
|
|
98
|
+
this.setAttribute('aria-busy', String(this._busy));
|
|
99
|
+
}
|
|
100
|
+
_request(type) {
|
|
101
|
+
if (this._busy || (type === 'undo-request' ? !this._canUndo : !this._canRedo))
|
|
102
|
+
return;
|
|
103
|
+
this.dispatchEvent(new CustomEvent(type, { bubbles: true, composed: true }));
|
|
104
|
+
}
|
|
105
|
+
_reflectBoolean(name, value) {
|
|
106
|
+
if (value === this.hasAttribute(name))
|
|
107
|
+
return;
|
|
108
|
+
this.toggleAttribute(name, value);
|
|
109
|
+
}
|
|
110
|
+
_reflectString(name, value) {
|
|
111
|
+
if (this.getAttribute(name) === value)
|
|
112
|
+
return;
|
|
113
|
+
if (value)
|
|
114
|
+
this.setAttribute(name, value);
|
|
115
|
+
else
|
|
116
|
+
this.removeAttribute(name);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export function defineHistoryControlsComponents() {
|
|
120
|
+
if (!customElements.get('hy-history-controls'))
|
|
121
|
+
customElements.define('hy-history-controls', HYHistoryControls);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=history-controls.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export type {
|
|
19
|
-
export
|
|
20
|
-
export type {
|
|
21
|
-
export type {
|
|
22
|
-
export type {
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
export { defineButtonComponents, HYButton, } from './button.js';
|
|
2
|
+
export { defineBorderBeamComponents, HYBorderBeam, } from './border-beam.js';
|
|
3
|
+
export { defineTreeComponents, HYTree, HYTreeNode, } from './tree.js';
|
|
4
|
+
export { defineSplitComponents, HYSplit, } from './split.js';
|
|
5
|
+
export { defineSelectComponents, HYSelect, } from './select.js';
|
|
6
|
+
export { defineTabsComponents, HYTabs, } from './tabs.js';
|
|
7
|
+
export { defineContextMenuComponents, HYContextMenu, } from './context-menu.js';
|
|
8
|
+
export { defineDropdownComponents, HYDropdown, } from './dropdown.js';
|
|
9
|
+
export { defineTooltipComponents, HYTooltip, } from './tooltip.js';
|
|
10
|
+
export { defineCheckboxComponents, HYCheckbox, } from './checkbox.js';
|
|
11
|
+
export { defineRadioComponents, HYRadio, } from './radio.js';
|
|
12
|
+
export { defineRangeComponents, HYRange, } from './range.js';
|
|
13
|
+
export { defineDialogComponents, HYDialog, } from './dialog.js';
|
|
14
|
+
export { defineDrawerComponents, HYDrawer, } from './drawer.js';
|
|
15
|
+
export { defineInputComponents, HYInput, } from './input.js';
|
|
16
|
+
export { defineNotificationComponents, HYNotification, } from './notification.js';
|
|
17
|
+
export { defineHistoryControlsComponents, HYHistoryControls, } from './history-controls.js';
|
|
18
|
+
export type { HYHistoryEntry, } from './history-controls.js';
|
|
19
|
+
export { calculateVirtualListRange, defineVirtualListComponents, HYVirtualList, } from './virtual-list.js';
|
|
20
|
+
export type { HYVirtualListAlign, HYVirtualListItemClickDetail, HYVirtualListItemRenderer, HYVirtualListRange, HYVirtualListRangeChangeDetail, } from './virtual-list.js';
|
|
21
|
+
export type { HYSplitDirection, HYSplitRatioChangeDetail, } from './split.js';
|
|
22
|
+
export type { HYSelectChangeDetail, HYSelectOption, } from './select.js';
|
|
23
|
+
export type { HYTabChangeDetail, HYTabOption, } from './tabs.js';
|
|
24
|
+
export type { HYContextMenuItem, HYContextMenuSelectDetail, } from './context-menu.js';
|
|
25
|
+
export type { HYDropdownItem, HYDropdownPlacement, HYDropdownSelectDetail, } from './dropdown.js';
|
|
26
|
+
export type { HYTooltipPlacement, } from './tooltip.js';
|
|
27
|
+
export type { HYCheckboxChangeDetail, } from './checkbox.js';
|
|
28
|
+
export type { HYRadioChangeDetail, } from './radio.js';
|
|
29
|
+
export type { HYRangeChangeDetail, HYRangeHandle, HYRangeValue, } from './range.js';
|
|
30
|
+
export type { HYDialogCloseDetail, HYDialogCloseReason, } from './dialog.js';
|
|
31
|
+
export type { HYDrawerCloseDetail, HYDrawerCloseReason, HYDrawerPlacement, } from './drawer.js';
|
|
32
|
+
export type { HYInputChangeDetail, HYInputType, } from './input.js';
|
|
33
|
+
export type { HYNotificationCloseDetail, HYNotificationCloseReason, HYNotificationMethodOptions, HYNotificationOpenDetail, HYNotificationOptions, HYNotificationPlacement, HYNotificationType, } from './notification.js';
|
|
34
|
+
export type { HYTreeDataChangeDetail, HYTreeDropPosition, HYTreeNodeContextMenuDetail, HYTreeNodeData, HYTreeSelectionChangeDetail, } from './tree.js';
|
|
32
35
|
export declare function defineHaiyueUI(): void;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { defineButtonComponents } from './button.js';
|
|
2
|
+
import { defineBorderBeamComponents } from './border-beam.js';
|
|
1
3
|
import { defineTreeComponents } from './tree.js';
|
|
2
4
|
import { defineSplitComponents } from './split.js';
|
|
3
5
|
import { defineSelectComponents } from './select.js';
|
|
@@ -7,94 +9,34 @@ import { defineDropdownComponents } from './dropdown.js';
|
|
|
7
9
|
import { defineTooltipComponents } from './tooltip.js';
|
|
8
10
|
import { defineCheckboxComponents } from './checkbox.js';
|
|
9
11
|
import { defineRadioComponents } from './radio.js';
|
|
12
|
+
import { defineRangeComponents } from './range.js';
|
|
10
13
|
import { defineDialogComponents } from './dialog.js';
|
|
14
|
+
import { defineDrawerComponents } from './drawer.js';
|
|
11
15
|
import { defineInputComponents } from './input.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
style.textContent = `
|
|
34
|
-
:host { display: inline-block; }
|
|
35
|
-
button {
|
|
36
|
-
min-height: 28px;
|
|
37
|
-
padding: 0 10px;
|
|
38
|
-
border: 1px solid #3d4654;
|
|
39
|
-
border-radius: 4px;
|
|
40
|
-
background: #202733;
|
|
41
|
-
color: #eef3ff;
|
|
42
|
-
font: 12px system-ui, sans-serif;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
}
|
|
45
|
-
button.icon-only {
|
|
46
|
-
width: 28px;
|
|
47
|
-
padding: 0;
|
|
48
|
-
display: inline-grid;
|
|
49
|
-
place-items: center;
|
|
50
|
-
}
|
|
51
|
-
::slotted(svg) {
|
|
52
|
-
width: 16px;
|
|
53
|
-
height: 16px;
|
|
54
|
-
display: block;
|
|
55
|
-
fill: none;
|
|
56
|
-
stroke: currentColor;
|
|
57
|
-
stroke-width: 2;
|
|
58
|
-
stroke-linecap: round;
|
|
59
|
-
stroke-linejoin: round;
|
|
60
|
-
}
|
|
61
|
-
button:disabled {
|
|
62
|
-
opacity: 0.5;
|
|
63
|
-
cursor: default;
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
root.append(style, this._button);
|
|
67
|
-
}
|
|
68
|
-
connectedCallback() {
|
|
69
|
-
this._sync();
|
|
70
|
-
}
|
|
71
|
-
attributeChangedCallback() {
|
|
72
|
-
this._sync();
|
|
73
|
-
}
|
|
74
|
-
_sync() {
|
|
75
|
-
const label = this.getAttribute('label');
|
|
76
|
-
if (label !== null) {
|
|
77
|
-
this._button.textContent = label;
|
|
78
|
-
this._button.classList.remove('icon-only');
|
|
79
|
-
this._button.removeAttribute('aria-label');
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (this._button.firstChild !== this._slot)
|
|
83
|
-
this._button.replaceChildren(this._slot);
|
|
84
|
-
this._button.classList.toggle('icon-only', this.hasAttribute('icon-only'));
|
|
85
|
-
const accessibleLabel = this.getAttribute('aria-label') ?? this.getAttribute('title') ?? '';
|
|
86
|
-
if (accessibleLabel)
|
|
87
|
-
this._button.setAttribute('aria-label', accessibleLabel);
|
|
88
|
-
else
|
|
89
|
-
this._button.removeAttribute('aria-label');
|
|
90
|
-
}
|
|
91
|
-
this._button.disabled = this.hasAttribute('disabled');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
16
|
+
import { defineNotificationComponents } from './notification.js';
|
|
17
|
+
import { defineHistoryControlsComponents } from './history-controls.js';
|
|
18
|
+
import { defineVirtualListComponents } from './virtual-list.js';
|
|
19
|
+
export { defineButtonComponents, HYButton, } from './button.js';
|
|
20
|
+
export { defineBorderBeamComponents, HYBorderBeam, } from './border-beam.js';
|
|
21
|
+
export { defineTreeComponents, HYTree, HYTreeNode, } from './tree.js';
|
|
22
|
+
export { defineSplitComponents, HYSplit, } from './split.js';
|
|
23
|
+
export { defineSelectComponents, HYSelect, } from './select.js';
|
|
24
|
+
export { defineTabsComponents, HYTabs, } from './tabs.js';
|
|
25
|
+
export { defineContextMenuComponents, HYContextMenu, } from './context-menu.js';
|
|
26
|
+
export { defineDropdownComponents, HYDropdown, } from './dropdown.js';
|
|
27
|
+
export { defineTooltipComponents, HYTooltip, } from './tooltip.js';
|
|
28
|
+
export { defineCheckboxComponents, HYCheckbox, } from './checkbox.js';
|
|
29
|
+
export { defineRadioComponents, HYRadio, } from './radio.js';
|
|
30
|
+
export { defineRangeComponents, HYRange, } from './range.js';
|
|
31
|
+
export { defineDialogComponents, HYDialog, } from './dialog.js';
|
|
32
|
+
export { defineDrawerComponents, HYDrawer, } from './drawer.js';
|
|
33
|
+
export { defineInputComponents, HYInput, } from './input.js';
|
|
34
|
+
export { defineNotificationComponents, HYNotification, } from './notification.js';
|
|
35
|
+
export { defineHistoryControlsComponents, HYHistoryControls, } from './history-controls.js';
|
|
36
|
+
export { calculateVirtualListRange, defineVirtualListComponents, HYVirtualList, } from './virtual-list.js';
|
|
94
37
|
export function defineHaiyueUI() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
38
|
+
defineBorderBeamComponents();
|
|
39
|
+
defineButtonComponents();
|
|
98
40
|
defineTreeComponents();
|
|
99
41
|
defineSplitComponents();
|
|
100
42
|
defineSelectComponents();
|
|
@@ -104,7 +46,12 @@ export function defineHaiyueUI() {
|
|
|
104
46
|
defineTooltipComponents();
|
|
105
47
|
defineCheckboxComponents();
|
|
106
48
|
defineRadioComponents();
|
|
49
|
+
defineRangeComponents();
|
|
107
50
|
defineDialogComponents();
|
|
51
|
+
defineDrawerComponents();
|
|
108
52
|
defineInputComponents();
|
|
53
|
+
defineNotificationComponents();
|
|
54
|
+
defineHistoryControlsComponents();
|
|
55
|
+
defineVirtualListComponents();
|
|
109
56
|
}
|
|
110
57
|
//# sourceMappingURL=index.js.map
|
package/dist/input.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export interface
|
|
1
|
+
export type HYInputType = 'text' | 'number' | 'color';
|
|
2
|
+
export interface HYInputChangeDetail {
|
|
3
3
|
value: string;
|
|
4
4
|
valueAsNumber: number | null;
|
|
5
5
|
valid: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class HYInput extends HTMLElement {
|
|
8
8
|
private readonly _input;
|
|
9
9
|
static get observedAttributes(): string[];
|
|
10
10
|
constructor();
|
|
11
11
|
connectedCallback(): void;
|
|
12
12
|
disconnectedCallback(): void;
|
|
13
13
|
attributeChangedCallback(): void;
|
|
14
|
-
get type():
|
|
15
|
-
set type(value:
|
|
14
|
+
get type(): HYInputType;
|
|
15
|
+
set type(value: HYInputType);
|
|
16
16
|
get value(): string;
|
|
17
17
|
set value(value: string);
|
|
18
18
|
get valueAsNumber(): number;
|
package/dist/input.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class HYInput extends HTMLElement {
|
|
2
2
|
_input = document.createElement('input');
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return [
|
|
@@ -19,26 +19,26 @@ export class GEInput extends HTMLElement {
|
|
|
19
19
|
input {
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
width: 100%;
|
|
22
|
-
height: var(--
|
|
22
|
+
height: var(--hy-input-height, 28px);
|
|
23
23
|
min-width: 0;
|
|
24
24
|
padding: 0 8px;
|
|
25
|
-
border: 1px solid var(--
|
|
25
|
+
border: 1px solid var(--hy-border-color, #303746);
|
|
26
26
|
border-radius: 4px;
|
|
27
27
|
outline: none;
|
|
28
|
-
color: var(--
|
|
29
|
-
background: var(--
|
|
30
|
-
font: var(--
|
|
31
|
-
color-scheme:
|
|
28
|
+
color: var(--hy-text-color, #d8e2f2);
|
|
29
|
+
background: var(--hy-input-bg-color, var(--hy-surface-color, #121822));
|
|
30
|
+
font: var(--hy-input-font, 12px system-ui, sans-serif);
|
|
31
|
+
color-scheme: inherit;
|
|
32
32
|
}
|
|
33
33
|
input:hover:not(:disabled):not(:read-only) {
|
|
34
|
-
border-color: var(--
|
|
34
|
+
border-color: var(--hy-hover-border-color, #435268);
|
|
35
35
|
}
|
|
36
36
|
input:focus {
|
|
37
|
-
border-color: var(--
|
|
38
|
-
box-shadow: 0 0 0 2px var(--
|
|
37
|
+
border-color: var(--hy-focus-border-color, #3d6fa8);
|
|
38
|
+
box-shadow: 0 0 0 2px var(--hy-focus-ring-color, rgba(61, 111, 168, 0.24));
|
|
39
39
|
}
|
|
40
40
|
input:invalid {
|
|
41
|
-
border-color: var(--
|
|
41
|
+
border-color: var(--hy-invalid-border-color, #b64f62);
|
|
42
42
|
}
|
|
43
43
|
input:disabled,
|
|
44
44
|
input:read-only {
|
|
@@ -122,8 +122,8 @@ export class GEInput extends HTMLElement {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
export function defineInputComponents() {
|
|
125
|
-
if (!customElements.get('
|
|
126
|
-
customElements.define('
|
|
125
|
+
if (!customElements.get('hy-input'))
|
|
126
|
+
customElements.define('hy-input', HYInput);
|
|
127
127
|
}
|
|
128
128
|
function normalizedType(value) {
|
|
129
129
|
return value === 'number' || value === 'color' ? value : 'text';
|
package/dist/menu-shared.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface HYMenuItemLike {
|
|
2
2
|
label?: string;
|
|
3
3
|
value?: string;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
separator?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface HYMenuButtonOptions {
|
|
8
8
|
index?: number;
|
|
9
9
|
role?: string;
|
|
10
10
|
tabIndex?: number;
|
|
11
11
|
}
|
|
12
|
-
export declare const GE_MENU_ITEM_STYLES = "\n button {\n box-sizing: border-box;\n width: 100%;\n height: 26px;\n display: flex;\n align-items: center;\n padding: 0 8px;\n border: 0;\n border-radius: 3px;\n color: var(--
|
|
12
|
+
export declare const GE_MENU_ITEM_STYLES = "\n button {\n box-sizing: border-box;\n width: 100%;\n height: 26px;\n display: flex;\n align-items: center;\n padding: 0 8px;\n border: 0;\n border-radius: 3px;\n color: var(--hy-text-color, #d8e2f2);\n background: transparent;\n font: inherit;\n text-align: left;\n cursor: pointer;\n }\n button:hover,\n button:focus,\n button.active {\n background: var(--hy-menu-item-hover-bg-color, var(--hy-accent-strong-color, #255a91));\n outline: none;\n }\n button:disabled {\n color: var(--hy-muted-color, #66758b);\n cursor: default;\n }\n button:disabled:hover {\n background: transparent;\n }\n .separator {\n height: 1px;\n margin: 4px 2px;\n background: var(--hy-border-color, #303746);\n }\n";
|
|
13
13
|
export declare function createMenuSeparator(): HTMLDivElement;
|
|
14
|
-
export declare function createMenuItemButton(item:
|
|
14
|
+
export declare function createMenuItemButton(item: HYMenuItemLike, options?: HYMenuButtonOptions): HTMLButtonElement;
|
package/dist/menu-shared.js
CHANGED
|
@@ -8,7 +8,7 @@ export const GE_MENU_ITEM_STYLES = `
|
|
|
8
8
|
padding: 0 8px;
|
|
9
9
|
border: 0;
|
|
10
10
|
border-radius: 3px;
|
|
11
|
-
color: var(--
|
|
11
|
+
color: var(--hy-text-color, #d8e2f2);
|
|
12
12
|
background: transparent;
|
|
13
13
|
font: inherit;
|
|
14
14
|
text-align: left;
|
|
@@ -17,11 +17,11 @@ export const GE_MENU_ITEM_STYLES = `
|
|
|
17
17
|
button:hover,
|
|
18
18
|
button:focus,
|
|
19
19
|
button.active {
|
|
20
|
-
background: var(--
|
|
20
|
+
background: var(--hy-menu-item-hover-bg-color, var(--hy-accent-strong-color, #255a91));
|
|
21
21
|
outline: none;
|
|
22
22
|
}
|
|
23
23
|
button:disabled {
|
|
24
|
-
color: var(--
|
|
24
|
+
color: var(--hy-muted-color, #66758b);
|
|
25
25
|
cursor: default;
|
|
26
26
|
}
|
|
27
27
|
button:disabled:hover {
|
|
@@ -30,7 +30,7 @@ export const GE_MENU_ITEM_STYLES = `
|
|
|
30
30
|
.separator {
|
|
31
31
|
height: 1px;
|
|
32
32
|
margin: 4px 2px;
|
|
33
|
-
background: var(--
|
|
33
|
+
background: var(--hy-border-color, #303746);
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
36
|
export function createMenuSeparator() {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type HYNotificationType = 'success' | 'info' | 'warning' | 'error';
|
|
2
|
+
export type HYNotificationPlacement = 'topLeft' | 'top' | 'topRight' | 'bottomLeft' | 'bottom' | 'bottomRight';
|
|
3
|
+
export type HYNotificationCloseReason = 'action' | 'timeout' | 'programmatic';
|
|
4
|
+
export interface HYNotificationOptions {
|
|
5
|
+
readonly key?: string;
|
|
6
|
+
readonly type?: HYNotificationType;
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
/** Auto-close delay in seconds. Use 0 to keep the notification open. */
|
|
10
|
+
readonly duration?: number;
|
|
11
|
+
readonly placement?: HYNotificationPlacement;
|
|
12
|
+
readonly showProgress?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type HYNotificationMethodOptions = Omit<HYNotificationOptions, 'type'>;
|
|
15
|
+
export interface HYNotificationOpenDetail {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly type: HYNotificationType;
|
|
18
|
+
readonly placement: HYNotificationPlacement;
|
|
19
|
+
}
|
|
20
|
+
export interface HYNotificationCloseDetail extends HYNotificationOpenDetail {
|
|
21
|
+
readonly reason: HYNotificationCloseReason;
|
|
22
|
+
}
|
|
23
|
+
/** Imperative notification center with independently timed, stacked notices. */
|
|
24
|
+
export declare class HYNotification extends HTMLElement {
|
|
25
|
+
private readonly _containers;
|
|
26
|
+
private readonly _notices;
|
|
27
|
+
private _sequence;
|
|
28
|
+
static get observedAttributes(): string[];
|
|
29
|
+
constructor();
|
|
30
|
+
connectedCallback(): void;
|
|
31
|
+
disconnectedCallback(): void;
|
|
32
|
+
attributeChangedCallback(name: string): void;
|
|
33
|
+
get placement(): HYNotificationPlacement;
|
|
34
|
+
set placement(value: HYNotificationPlacement);
|
|
35
|
+
get duration(): number;
|
|
36
|
+
set duration(value: number);
|
|
37
|
+
get showProgress(): boolean;
|
|
38
|
+
set showProgress(value: boolean);
|
|
39
|
+
get size(): number;
|
|
40
|
+
open(options: HYNotificationOptions): string;
|
|
41
|
+
success(options: string | HYNotificationMethodOptions): string;
|
|
42
|
+
info(options: string | HYNotificationMethodOptions): string;
|
|
43
|
+
warning(options: string | HYNotificationMethodOptions): string;
|
|
44
|
+
error(options: string | HYNotificationMethodOptions): string;
|
|
45
|
+
close(key: string): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
private _openTyped;
|
|
48
|
+
private _createNotice;
|
|
49
|
+
private _createIcon;
|
|
50
|
+
private _closeNotice;
|
|
51
|
+
private _removeNotice;
|
|
52
|
+
private _updateStack;
|
|
53
|
+
private _syncPlacementAttribute;
|
|
54
|
+
}
|
|
55
|
+
export declare function defineNotificationComponents(): void;
|