@haiyue/ui 0.2.2 → 0.3.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/CHANGELOG.md +42 -0
- package/README.md +523 -4
- package/dist/adapters/web/controls.js +48 -8
- package/dist/adapters/web/renderer.js +9 -11
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +26 -23
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +62 -0
- package/dist/anchor.js +293 -0
- package/dist/auto-complete.d.ts +83 -0
- package/dist/auto-complete.js +267 -0
- package/dist/avatar.d.ts +45 -0
- package/dist/avatar.js +135 -0
- package/dist/badge.js +5 -5
- package/dist/border-beam.js +3 -2
- package/dist/breadcrumb.js +5 -5
- package/dist/button-group.js +8 -8
- package/dist/button.js +10 -10
- package/dist/card.d.ts +29 -0
- package/dist/card.js +101 -0
- package/dist/carousel.js +6 -6
- package/dist/cascader.js +19 -13
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.js +6 -6
- package/dist/context-menu.js +3 -4
- package/dist/core/actions.js +7 -8
- package/dist/core/data.d.ts +1 -1
- package/dist/core/data.js +44 -10
- package/dist/core/platform-view.js +8 -2
- package/dist/core/selection.js +4 -4
- package/dist/core/semantics.d.ts +26 -0
- package/dist/core/semantics.js +8 -0
- package/dist/core/text.js +3 -3
- package/dist/core/validation.d.ts +3 -1
- package/dist/core/validation.js +23 -5
- package/dist/date-picker.js +19 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.d.ts +4 -0
- package/dist/dialog.js +48 -27
- package/dist/divider.js +2 -2
- package/dist/draggable.js +5 -3
- package/dist/drawer.js +16 -24
- package/dist/dropdown.js +3 -4
- package/dist/empty.d.ts +20 -0
- package/dist/empty.js +58 -0
- package/dist/expandable.js +4 -4
- package/dist/form-item.d.ts +60 -0
- package/dist/form-item.js +212 -0
- package/dist/form.d.ts +41 -0
- package/dist/form.js +154 -0
- package/dist/history-controls.js +5 -5
- package/dist/image-preview.d.ts +22 -0
- package/dist/image-preview.js +38 -0
- package/dist/image.d.ts +52 -0
- package/dist/image.js +152 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +72 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +32 -18
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -0
- package/dist/internal/focus.d.ts +2 -0
- package/dist/internal/focus.js +31 -0
- package/dist/internal/form-control.d.ts +22 -0
- package/dist/internal/form-control.js +52 -0
- package/dist/internal/image-viewer.d.ts +51 -0
- package/dist/internal/image-viewer.js +210 -0
- package/dist/internal/keyboard.d.ts +2 -0
- package/dist/internal/keyboard.js +12 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/numbers.js +8 -0
- package/dist/internal/pagination.d.ts +35 -0
- package/dist/internal/pagination.js +169 -0
- package/dist/internal/popover-base.d.ts +87 -0
- package/dist/internal/popover-base.js +365 -0
- package/dist/internal/presentation.d.ts +2 -0
- package/dist/internal/presentation.js +28 -0
- package/dist/mentions.d.ts +115 -0
- package/dist/mentions.js +485 -0
- package/dist/menu-shared.d.ts +1 -1
- package/dist/menu-shared.js +3 -3
- package/dist/menu.d.ts +63 -0
- package/dist/menu.js +339 -0
- package/dist/modal.js +11 -40
- package/dist/notification.js +11 -10
- package/dist/pagination.d.ts +34 -0
- package/dist/pagination.js +73 -0
- package/dist/popconfirm.d.ts +6 -0
- package/dist/popconfirm.js +7 -0
- package/dist/popover.d.ts +6 -0
- package/dist/popover.js +7 -0
- package/dist/portable/page.js +25 -14
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.js +3 -3
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +18 -5
- package/dist/range.js +7 -7
- package/dist/rate.js +3 -3
- package/dist/resizable.js +8 -5
- package/dist/result.d.ts +22 -0
- package/dist/result.js +88 -0
- package/dist/ribbon.d.ts +19 -0
- package/dist/ribbon.js +106 -0
- package/dist/segmented.d.ts +39 -0
- package/dist/segmented.js +192 -0
- package/dist/select.d.ts +12 -0
- package/dist/select.js +31 -13
- package/dist/skeleton.js +10 -10
- package/dist/spin.d.ts +26 -0
- package/dist/spin.js +80 -0
- package/dist/steps.js +13 -13
- package/dist/switch.d.ts +44 -0
- package/dist/switch.js +104 -0
- package/dist/table.d.ts +3 -3
- package/dist/table.js +110 -128
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +16 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +12 -11
- package/dist/tooltip.d.ts +6 -0
- package/dist/tooltip.js +107 -6
- package/dist/tour.js +26 -17
- package/dist/tree-model.d.ts +2 -0
- package/dist/tree-model.js +32 -11
- package/dist/tree-node.js +2 -2
- package/dist/tree-select.d.ts +94 -0
- package/dist/tree-select.js +398 -0
- package/dist/tree.d.ts +0 -2
- package/dist/tree.js +14 -29
- package/dist/upload.d.ts +108 -0
- package/dist/upload.js +358 -0
- package/dist/virtual-keyboard.d.ts +1 -0
- package/dist/virtual-keyboard.js +72 -41
- package/dist/virtual-list.d.ts +1 -0
- package/dist/virtual-list.js +25 -8
- package/dist/virtual-mouse.js +7 -6
- package/dist/watermark.js +2 -1
- package/package.json +82 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
package/dist/checkbox.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export interface HYCheckboxChangeDetail {
|
|
|
3
3
|
value: string;
|
|
4
4
|
}
|
|
5
5
|
export declare class HYCheckbox extends HTMLElement {
|
|
6
|
+
static readonly formAssociated = true;
|
|
6
7
|
private readonly _input;
|
|
7
8
|
private readonly _box;
|
|
8
9
|
private readonly _label;
|
|
9
10
|
private readonly _slot;
|
|
11
|
+
private readonly _formControl;
|
|
10
12
|
static get observedAttributes(): string[];
|
|
11
13
|
constructor();
|
|
12
14
|
connectedCallback(): void;
|
|
@@ -25,6 +27,16 @@ export declare class HYCheckbox extends HTMLElement {
|
|
|
25
27
|
get name(): string;
|
|
26
28
|
set name(value: string);
|
|
27
29
|
private _sync;
|
|
30
|
+
get form(): HTMLFormElement | null;
|
|
31
|
+
get validity(): ValidityState;
|
|
32
|
+
get validationMessage(): string;
|
|
33
|
+
checkValidity(): boolean;
|
|
34
|
+
reportValidity(): boolean;
|
|
35
|
+
setCustomValidity(message: string): void;
|
|
36
|
+
formDisabledCallback(disabled: boolean): void;
|
|
37
|
+
formResetCallback(): void;
|
|
38
|
+
formStateRestoreCallback(state: string | File | FormData | null): void;
|
|
39
|
+
focus(options?: FocusOptions): void;
|
|
28
40
|
private _onChange;
|
|
29
41
|
}
|
|
30
42
|
export declare function defineCheckboxComponents(): void;
|
package/dist/checkbox.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { HYFormControl } from './internal/form-control.js';
|
|
1
2
|
export class HYCheckbox extends HTMLElement {
|
|
3
|
+
static formAssociated = true;
|
|
2
4
|
_input = document.createElement('input');
|
|
3
5
|
_box = document.createElement('span');
|
|
4
6
|
_label = document.createElement('span');
|
|
5
7
|
_slot = document.createElement('slot');
|
|
8
|
+
_formControl = new HYFormControl(this, this._input);
|
|
6
9
|
static get observedAttributes() {
|
|
7
|
-
return ['checked', 'disabled', 'indeterminate', 'label', 'value', 'name', 'aria-label'];
|
|
10
|
+
return ['checked', 'disabled', 'indeterminate', 'label', 'value', 'name', 'aria-label', 'required'];
|
|
8
11
|
}
|
|
9
12
|
constructor() {
|
|
10
13
|
super();
|
|
@@ -16,7 +19,7 @@ export class HYCheckbox extends HTMLElement {
|
|
|
16
19
|
width: max-content;
|
|
17
20
|
min-width: 0;
|
|
18
21
|
color: var(--hy-checkbox-text-color, var(--hy-text-color, #d8e2f2));
|
|
19
|
-
font: 12px system-ui, sans-serif;
|
|
22
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
20
23
|
}
|
|
21
24
|
:host([disabled]) {
|
|
22
25
|
opacity: 0.55;
|
|
@@ -25,7 +28,7 @@ export class HYCheckbox extends HTMLElement {
|
|
|
25
28
|
label {
|
|
26
29
|
display: inline-flex;
|
|
27
30
|
align-items: center;
|
|
28
|
-
gap: 8px;
|
|
31
|
+
gap: var(--hy-space-4, 8px);
|
|
29
32
|
min-width: 0;
|
|
30
33
|
cursor: pointer;
|
|
31
34
|
user-select: none;
|
|
@@ -52,7 +55,7 @@ export class HYCheckbox extends HTMLElement {
|
|
|
52
55
|
display: inline-grid;
|
|
53
56
|
place-items: center;
|
|
54
57
|
border: 1px solid var(--hy-checkbox-border-color, var(--hy-border-color, #303746));
|
|
55
|
-
border-radius:
|
|
58
|
+
border-radius: calc(var(--hy-radius-xs, 2px) + 1px);
|
|
56
59
|
background: var(--hy-checkbox-bg-color, var(--hy-input-bg-color, #121822));
|
|
57
60
|
color: var(--hy-checkbox-mark-color, var(--hy-selected-text-color, #ffffff));
|
|
58
61
|
transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
|
|
@@ -107,6 +110,7 @@ export class HYCheckbox extends HTMLElement {
|
|
|
107
110
|
connectedCallback() {
|
|
108
111
|
this._input.addEventListener('change', this._onChange);
|
|
109
112
|
this._sync();
|
|
113
|
+
this._formControl.connect();
|
|
110
114
|
}
|
|
111
115
|
disconnectedCallback() {
|
|
112
116
|
this._input.removeEventListener('change', this._onChange);
|
|
@@ -167,7 +171,8 @@ export class HYCheckbox extends HTMLElement {
|
|
|
167
171
|
}
|
|
168
172
|
_sync() {
|
|
169
173
|
this._input.checked = this.checked;
|
|
170
|
-
this._input.disabled = this.disabled;
|
|
174
|
+
this._input.disabled = this.disabled || this._formControl.disabled;
|
|
175
|
+
this._input.required = this.hasAttribute('required');
|
|
171
176
|
this._input.indeterminate = this.indeterminate;
|
|
172
177
|
this._input.value = this.value;
|
|
173
178
|
this._input.name = this.name;
|
|
@@ -181,7 +186,18 @@ export class HYCheckbox extends HTMLElement {
|
|
|
181
186
|
this._input.setAttribute('aria-label', ariaLabel);
|
|
182
187
|
else
|
|
183
188
|
this._input.removeAttribute('aria-label');
|
|
184
|
-
|
|
189
|
+
this._formControl.sync();
|
|
190
|
+
}
|
|
191
|
+
get form() { return this._formControl.internals.form; }
|
|
192
|
+
get validity() { return this._formControl.internals.validity; }
|
|
193
|
+
get validationMessage() { return this._formControl.internals.validationMessage; }
|
|
194
|
+
checkValidity() { return this._formControl.internals.checkValidity(); }
|
|
195
|
+
reportValidity() { return this._formControl.internals.reportValidity(); }
|
|
196
|
+
setCustomValidity(message) { this._formControl.setCustomValidity(message); }
|
|
197
|
+
formDisabledCallback(disabled) { this._formControl.disabled = disabled; this._sync(); }
|
|
198
|
+
formResetCallback() { this._formControl.reset(); }
|
|
199
|
+
formStateRestoreCallback(state) { this._formControl.restore(state); }
|
|
200
|
+
focus(options) { this._input.focus(options); }
|
|
185
201
|
_onChange = () => {
|
|
186
202
|
if (this._input.checked)
|
|
187
203
|
this.setAttribute('checked', '');
|
package/dist/collapse.js
CHANGED
|
@@ -34,11 +34,11 @@ export class HYCollapse extends HTMLElement {
|
|
|
34
34
|
const root = this.attachShadow({ mode: 'open' });
|
|
35
35
|
const style = document.createElement('style');
|
|
36
36
|
style.textContent = `
|
|
37
|
-
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: 12px/1.5 system-ui, sans-serif; }
|
|
38
|
-
.collapse { overflow: hidden; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-collapse-radius, 8px); background: var(--hy-surface-color, #111722); }
|
|
37
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
38
|
+
.collapse { overflow: hidden; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-collapse-radius, var(--hy-radius-lg, 8px)); background: var(--hy-surface-color, #111722); }
|
|
39
39
|
.panel + .panel { border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
40
|
-
.header { display: flex; min-height: var(--hy-collapse-header-height, 44px); align-items: center; background: var(--hy-collapse-header-bg, color-mix(in srgb, var(--hy-surface-elevated-color, #171d27) 82%, transparent)); }
|
|
41
|
-
.trigger { display: flex; min-width: 0; min-height: inherit; flex: 1 1 auto; align-items: center; gap: 10px; padding:
|
|
40
|
+
.header { display: flex; min-height: var(--hy-collapse-header-height, var(--hy-control-height-lg, 44px)); align-items: center; background: var(--hy-collapse-header-bg, color-mix(in srgb, var(--hy-surface-elevated-color, #171d27) 82%, transparent)); }
|
|
41
|
+
.trigger { display: flex; min-width: 0; min-height: inherit; flex: 1 1 auto; align-items: center; gap: var(--hy-space-5, 10px); padding: calc(var(--hy-space-4, 8px) + 1px) var(--hy-space-7, 14px); border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: start; }
|
|
42
42
|
.trigger:hover:not(:disabled) { background: var(--hy-hover-bg-color, #273241); }
|
|
43
43
|
.trigger:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: -2px; }
|
|
44
44
|
.trigger:disabled { color: var(--hy-muted-color, #788697); cursor: not-allowed; }
|
|
@@ -46,9 +46,9 @@ export class HYCollapse extends HTMLElement {
|
|
|
46
46
|
.arrow::before { content: ''; width: 6px; height: 6px; border-block-start: 1.5px solid currentColor; border-inline-end: 1.5px solid currentColor; transform: rotate(45deg); }
|
|
47
47
|
.panel.expanded .arrow { transform: rotate(90deg); }
|
|
48
48
|
.title { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
49
|
-
.extra { flex: 0 0 auto; padding-inline: var(--hy-collapse-extra-gap, 10px) 14px; color: var(--hy-muted-color, #788697); font-size: 10px; }
|
|
49
|
+
.extra { flex: 0 0 auto; padding-inline: var(--hy-collapse-extra-gap, var(--hy-space-5, 10px)) var(--hy-space-7, 14px); color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-xs, 10px); }
|
|
50
50
|
.region[hidden] { display: none; }
|
|
51
|
-
.body { padding: var(--hy-collapse-content-padding, 16px); border-top: 1px solid var(--hy-border-color, #3d4654); color: var(--hy-secondary-text-color, #aebbd0); background: var(--hy-collapse-content-bg, transparent); }
|
|
51
|
+
.body { padding: var(--hy-collapse-content-padding, var(--hy-space-8, 16px)); border-top: 1px solid var(--hy-border-color, #3d4654); color: var(--hy-secondary-text-color, #aebbd0); background: var(--hy-collapse-content-bg, transparent); }
|
|
52
52
|
:host([icon-position="end"]) .arrow { order: 2; }
|
|
53
53
|
:host([bordered="false"]) .collapse { border: 0; border-radius: 0; }
|
|
54
54
|
:host([ghost]) .collapse { border: 0; background: transparent; }
|
package/dist/context-menu.js
CHANGED
|
@@ -19,7 +19,7 @@ export class HYContextMenu extends HTMLElement {
|
|
|
19
19
|
display: none;
|
|
20
20
|
min-width: 132px;
|
|
21
21
|
color: var(--hy-text-color, #d8e2f2);
|
|
22
|
-
font: 12px system-ui, sans-serif;
|
|
22
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
23
23
|
}
|
|
24
24
|
:host([open]) {
|
|
25
25
|
display: block;
|
|
@@ -27,9 +27,9 @@ export class HYContextMenu extends HTMLElement {
|
|
|
27
27
|
.menu {
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
min-width: 132px;
|
|
30
|
-
padding: 4px;
|
|
30
|
+
padding: var(--hy-space-2, 4px);
|
|
31
31
|
border: 1px solid var(--hy-border-color, #303746);
|
|
32
|
-
border-radius: 4px;
|
|
32
|
+
border-radius: var(--hy-radius-sm, 4px);
|
|
33
33
|
background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #1b2230));
|
|
34
34
|
box-shadow: 0 10px 26px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36));
|
|
35
35
|
}
|
|
@@ -40,7 +40,6 @@ ${GE_MENU_ITEM_STYLES}
|
|
|
40
40
|
this._root.append(this._style, this._menu);
|
|
41
41
|
}
|
|
42
42
|
connectedCallback() {
|
|
43
|
-
this._readItemsAttribute();
|
|
44
43
|
this._render();
|
|
45
44
|
this._syncDocumentListeners();
|
|
46
45
|
}
|
package/dist/core/actions.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { hyKey, hyValidateProps } from './validation.js';
|
|
1
|
+
import { hyKey, snapshotValidatedProps } from './validation.js';
|
|
3
2
|
export class HYButtonController {
|
|
4
3
|
key;
|
|
5
4
|
emit;
|
|
@@ -17,8 +16,8 @@ export class HYButtonController {
|
|
|
17
16
|
update(props) {
|
|
18
17
|
if (this.#disposed)
|
|
19
18
|
return;
|
|
20
|
-
|
|
21
|
-
this.#props =
|
|
19
|
+
props = snapshotValidatedProps('Button', props, { key: this.key });
|
|
20
|
+
this.#props = props;
|
|
22
21
|
}
|
|
23
22
|
/** Adapters pass the same gesture id for overlapping tap/click/accessibility callbacks. */
|
|
24
23
|
activate(reason = 'pointer', gesture) {
|
|
@@ -58,8 +57,8 @@ export class HYToggleController {
|
|
|
58
57
|
update(props) {
|
|
59
58
|
if (this.#disposed)
|
|
60
59
|
return;
|
|
61
|
-
|
|
62
|
-
this.#props =
|
|
60
|
+
props = snapshotValidatedProps('Toggle', props, { key: this.key });
|
|
61
|
+
this.#props = props;
|
|
63
62
|
}
|
|
64
63
|
choose(checked, reason = 'pointer') {
|
|
65
64
|
if (typeof checked !== 'boolean' || this.#disposed || this.#emitting || this.#props.disabled || this.#props.visible === false || checked === this.#props.checked)
|
|
@@ -97,12 +96,12 @@ export class HYSliderController {
|
|
|
97
96
|
update(props) {
|
|
98
97
|
if (this.#disposed)
|
|
99
98
|
return;
|
|
100
|
-
|
|
99
|
+
props = snapshotValidatedProps('Slider', props, { key: this.key });
|
|
101
100
|
if (!this.#props || props.value !== this.#props.value || props.min !== this.#props.min || props.max !== this.#props.max || props.step !== this.#props.step || props.disabled || props.visible === false) {
|
|
102
101
|
this.#draft = props.value;
|
|
103
102
|
this.#active = 0;
|
|
104
103
|
}
|
|
105
|
-
this.#props =
|
|
104
|
+
this.#props = props;
|
|
106
105
|
}
|
|
107
106
|
change(value, reason = 'pointer') {
|
|
108
107
|
if (this.#disposed || this.#props.disabled || this.#props.visible === false || !Number.isFinite(value))
|
package/dist/core/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Internal structural comparison for immutable protocol data; never serializes props. */
|
|
2
2
|
export declare function equalData(a: unknown, b: unknown): boolean;
|
|
3
3
|
export declare function isSnapshot(value: object): boolean;
|
|
4
|
-
export declare function snapshot<T>(value: T): T;
|
|
4
|
+
export declare function snapshot<T>(value: T, reject?: (message: string, property: string) => never): T;
|
package/dist/core/data.js
CHANGED
|
@@ -11,17 +11,51 @@ export function equalData(a, b) {
|
|
|
11
11
|
return keys.length === Object.keys(right).length
|
|
12
12
|
&& keys.every(key => Object.hasOwn(right, key) && equalData(left[key], right[key]));
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/** Only internally copied, deeply frozen data may bypass later descriptor checks. */
|
|
15
15
|
const snapshots = new WeakSet();
|
|
16
16
|
export function isSnapshot(value) { return snapshots.has(value); }
|
|
17
|
-
export function snapshot(value) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
export function snapshot(value, reject = message => { throw new TypeError(message); }) {
|
|
18
|
+
const ancestors = new Set();
|
|
19
|
+
const copies = new WeakMap();
|
|
20
|
+
const copy = (value, path) => {
|
|
21
|
+
if (!value || typeof value !== 'object')
|
|
22
|
+
return value;
|
|
23
|
+
if (snapshots.has(value))
|
|
24
|
+
return value;
|
|
25
|
+
if (ancestors.has(value))
|
|
26
|
+
return reject('Cyclic protocol data', path);
|
|
27
|
+
const existing = copies.get(value);
|
|
28
|
+
if (existing)
|
|
29
|
+
return existing;
|
|
30
|
+
const array = Array.isArray(value);
|
|
31
|
+
if (!array && ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
32
|
+
return reject('Expected plain data object', path);
|
|
33
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
34
|
+
const length = array ? descriptors.length.value : 0;
|
|
35
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
36
|
+
if (array && keys.length !== length + 1)
|
|
37
|
+
return reject('Expected dense array without extra properties', path);
|
|
38
|
+
const result = array ? [] : {};
|
|
39
|
+
ancestors.add(value);
|
|
40
|
+
for (const key of keys) {
|
|
41
|
+
if (array && key === 'length')
|
|
42
|
+
continue;
|
|
43
|
+
const property = path ? `${path}.${String(key)}` : String(key);
|
|
44
|
+
if (typeof key !== 'string')
|
|
45
|
+
return reject('Symbols are not protocol data', property);
|
|
46
|
+
const descriptor = descriptors[key];
|
|
47
|
+
if (!descriptor.enumerable || !('value' in descriptor))
|
|
48
|
+
return reject('Accessors or non-enumerable properties are not protocol data', property);
|
|
49
|
+
if (array && (!/^(0|[1-9]\d*)$/.test(key) || Number(key) >= length))
|
|
50
|
+
return reject('Expected dense array index', property);
|
|
51
|
+
Object.defineProperty(result, key, { value: copy(descriptor.value, property), enumerable: true, writable: true, configurable: true });
|
|
52
|
+
}
|
|
53
|
+
ancestors.delete(value);
|
|
54
|
+
Object.freeze(result);
|
|
55
|
+
snapshots.add(result);
|
|
56
|
+
copies.set(value, result);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
return copy(value, '');
|
|
26
60
|
}
|
|
27
61
|
//# sourceMappingURL=data.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { equalData, snapshot } from './data.js';
|
|
2
|
-
import { HYUIError } from './validation.js';
|
|
2
|
+
import { HYUIError, snapshotProtocolData } from './validation.js';
|
|
3
3
|
/** Backend-owned resource lifetime. No GPU acquire/present or platform handles in page state. */
|
|
4
4
|
export class HYPlatformViewController {
|
|
5
5
|
factory;
|
|
@@ -29,7 +29,12 @@ export class HYPlatformViewController {
|
|
|
29
29
|
this.#view.visible(this.shown && !this.#suspended);
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
|
-
|
|
32
|
+
try {
|
|
33
|
+
this.dispose();
|
|
34
|
+
}
|
|
35
|
+
catch (cleanup) {
|
|
36
|
+
throw new AggregateError([error, cleanup], 'PlatformView initialization and cleanup failed', { cause: error });
|
|
37
|
+
}
|
|
33
38
|
throw error;
|
|
34
39
|
}
|
|
35
40
|
}
|
|
@@ -45,6 +50,7 @@ export class HYPlatformViewController {
|
|
|
45
50
|
layout(bounds) {
|
|
46
51
|
if (this.#disposed)
|
|
47
52
|
return;
|
|
53
|
+
bounds = snapshotProtocolData(bounds);
|
|
48
54
|
if (![bounds.x, bounds.y, bounds.width, bounds.height, bounds.scale].every(Number.isFinite)
|
|
49
55
|
|| bounds.width < 0 || bounds.height < 0 || bounds.scale <= 0)
|
|
50
56
|
throw new HYUIError('invalid-props', 'Invalid PlatformView bounds');
|
package/dist/core/selection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { equalData
|
|
2
|
-
import { HYUIError, hyKey,
|
|
1
|
+
import { equalData } from './data.js';
|
|
2
|
+
import { HYUIError, hyKey, snapshotValidatedProps } from './validation.js';
|
|
3
3
|
/** Controlled Select/Tabs semantics. Views report user actions, never delayed setter echoes. */
|
|
4
4
|
export class HYSelectionController {
|
|
5
5
|
key;
|
|
@@ -22,10 +22,10 @@ export class HYSelectionController {
|
|
|
22
22
|
update(props) {
|
|
23
23
|
if (this.#disposed)
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
props = snapshotValidatedProps('Select', props, { key: this.key });
|
|
26
26
|
if (equalData(props, this.#props))
|
|
27
27
|
return;
|
|
28
|
-
this.#props =
|
|
28
|
+
this.#props = props;
|
|
29
29
|
this.#generation++;
|
|
30
30
|
this.#apply();
|
|
31
31
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Exhaustive semantic focus policy, independent of any platform's control implementation. */
|
|
2
|
+
export declare const componentInteraction: Readonly<{
|
|
3
|
+
Row: false;
|
|
4
|
+
Column: false;
|
|
5
|
+
Grid: false;
|
|
6
|
+
Overlay: false;
|
|
7
|
+
Scroll: false;
|
|
8
|
+
Text: false;
|
|
9
|
+
Image: false;
|
|
10
|
+
Icon: false;
|
|
11
|
+
Badge: false;
|
|
12
|
+
Divider: false;
|
|
13
|
+
FormGroup: false;
|
|
14
|
+
Button: true;
|
|
15
|
+
Checkbox: true;
|
|
16
|
+
Toggle: true;
|
|
17
|
+
RadioGroup: true;
|
|
18
|
+
Rate: true;
|
|
19
|
+
Select: true;
|
|
20
|
+
Tabs: true;
|
|
21
|
+
TextInput: true;
|
|
22
|
+
TextArea: true;
|
|
23
|
+
Slider: true;
|
|
24
|
+
Dialog: false;
|
|
25
|
+
PlatformView: true;
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Exhaustive semantic focus policy, independent of any platform's control implementation. */
|
|
2
|
+
export const componentInteraction = Object.freeze({
|
|
3
|
+
Row: false, Column: false, Grid: false, Overlay: false, Scroll: false,
|
|
4
|
+
Text: false, Image: false, Icon: false, Badge: false, Divider: false, FormGroup: false,
|
|
5
|
+
Button: true, Checkbox: true, Toggle: true, RadioGroup: true, Rate: true,
|
|
6
|
+
Select: true, Tabs: true, TextInput: true, TextArea: true, Slider: true, Dialog: false, PlatformView: true,
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=semantics.js.map
|
package/dist/core/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { equalData, snapshot } from './data.js';
|
|
2
|
-
import { HYUIError, hyKey,
|
|
2
|
+
import { HYUIError, hyKey, snapshotValidatedProps } from './validation.js';
|
|
3
3
|
/** Local draft/IME state only. The application accepts or rejects commit through props/revision. */
|
|
4
4
|
export class HYTextController {
|
|
5
5
|
key;
|
|
@@ -28,7 +28,7 @@ export class HYTextController {
|
|
|
28
28
|
update(props, revision = this.#revision) {
|
|
29
29
|
if (this.#disposed)
|
|
30
30
|
return;
|
|
31
|
-
|
|
31
|
+
props = snapshotValidatedProps(this.multiline ? 'TextArea' : 'TextInput', props, { key: this.key });
|
|
32
32
|
if (!Number.isSafeInteger(revision) || revision < 0)
|
|
33
33
|
throw new HYUIError('invalid-props', 'Invalid application revision', { key: this.key });
|
|
34
34
|
if (revision < this.#revision)
|
|
@@ -36,7 +36,7 @@ export class HYTextController {
|
|
|
36
36
|
const changed = !this.#props || props.value !== this.#props.value;
|
|
37
37
|
if (this.#props && changed && revision === this.#revision)
|
|
38
38
|
throw new HYUIError('invalid-props', 'Changed accepted value requires a newer revision', { key: this.key });
|
|
39
|
-
this.#props =
|
|
39
|
+
this.#props = props;
|
|
40
40
|
this.#revision = revision;
|
|
41
41
|
if (changed) {
|
|
42
42
|
if (this.#composing)
|
|
@@ -6,10 +6,12 @@ export declare class HYUIError extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const HY_FEATURES: readonly HYFeature[];
|
|
8
8
|
export declare const HY_COMPONENTS: readonly HYComponentKind[];
|
|
9
|
+
/** Internal descriptor-safe handoff: validation and consumers see the same immutable values. */
|
|
10
|
+
export declare function snapshotProtocolData<T>(value: T, context?: HYDiagnosticContext): T;
|
|
9
11
|
export declare function hyValidateCapabilities(capabilities: HYCapabilities): void;
|
|
10
12
|
export declare function hySupports(capabilities: HYCapabilities, feature: HYFeature): boolean;
|
|
11
13
|
/** Internal immutable hand-off. Mutable and merely shallow-frozen inputs are always validated. */
|
|
12
|
-
export declare function snapshotValidatedProps<K extends HYComponentKind>(kind: K, props: HYComponentProps[K], context: HYDiagnosticContext, capabilities
|
|
14
|
+
export declare function snapshotValidatedProps<K extends HYComponentKind>(kind: K, props: HYComponentProps[K], context: HYDiagnosticContext, capabilities?: HYCapabilities): HYComponentProps[K];
|
|
13
15
|
export declare function hyValidateProps<K extends HYComponentKind>(kind: K, props: HYComponentProps[K], context?: HYDiagnosticContext, capabilities?: HYCapabilities): void;
|
|
14
16
|
/** Escaped, stable backend key. Author keys are unique across all slots of one parent. */
|
|
15
17
|
export declare function hyKey(...parts: readonly string[]): string;
|
package/dist/core/validation.js
CHANGED
|
@@ -97,16 +97,26 @@ const schemas = {
|
|
|
97
97
|
PlatformView: shape({ ...common, slot: name, resourceId: name }, ['slot', 'resourceId']),
|
|
98
98
|
};
|
|
99
99
|
export const HY_COMPONENTS = Object.freeze(Object.keys(schemas));
|
|
100
|
+
const validatedCapabilities = new WeakSet();
|
|
101
|
+
/** Internal descriptor-safe handoff: validation and consumers see the same immutable values. */
|
|
102
|
+
export function snapshotProtocolData(value, context = {}) {
|
|
103
|
+
return snapshot(value, (message, property) => fail(message, property ? field(context, property) : context));
|
|
104
|
+
}
|
|
100
105
|
export function hyValidateCapabilities(capabilities) {
|
|
101
106
|
const context = { property: 'capabilities' };
|
|
107
|
+
capabilities = snapshotProtocolData(capabilities, context);
|
|
108
|
+
if (validatedCapabilities.has(capabilities))
|
|
109
|
+
return;
|
|
102
110
|
shape({ contract: choice(1), backend: choice('web', 'nativescript', 'desktop'), components: list(choice(...HY_COMPONENTS)),
|
|
103
111
|
features: list((v, c) => { if (!HY_FEATURES.includes(v))
|
|
104
112
|
throw new HYUIError('capability', 'Unknown capability', c); }) }, ['contract', 'backend', 'components', 'features'])(capabilities, context);
|
|
105
113
|
if (new Set(capabilities.components).size !== capabilities.components.length || new Set(capabilities.features).size !== capabilities.features.length) {
|
|
106
114
|
throw new HYUIError('capability', 'Duplicate capability declaration', context);
|
|
107
115
|
}
|
|
116
|
+
validatedCapabilities.add(capabilities);
|
|
108
117
|
}
|
|
109
118
|
export function hySupports(capabilities, feature) {
|
|
119
|
+
capabilities = snapshotProtocolData(capabilities, { property: 'capabilities' });
|
|
110
120
|
hyValidateCapabilities(capabilities);
|
|
111
121
|
if (!HY_FEATURES.includes(feature))
|
|
112
122
|
throw new HYUIError('capability', 'Unknown capability', { property: feature });
|
|
@@ -123,12 +133,17 @@ function remember(props, kind) {
|
|
|
123
133
|
}
|
|
124
134
|
/** Internal immutable hand-off. Mutable and merely shallow-frozen inputs are always validated. */
|
|
125
135
|
export function snapshotValidatedProps(kind, props, context, capabilities) {
|
|
136
|
+
props = snapshotProtocolData(props, context);
|
|
126
137
|
hyValidateProps(kind, props, context, capabilities);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return result;
|
|
138
|
+
remember(props, kind);
|
|
139
|
+
return props;
|
|
130
140
|
}
|
|
131
141
|
export function hyValidateProps(kind, props, context = {}, capabilities) {
|
|
142
|
+
props = snapshotProtocolData(props, context);
|
|
143
|
+
if (capabilities) {
|
|
144
|
+
capabilities = snapshotProtocolData(capabilities, { property: 'capabilities' });
|
|
145
|
+
hyValidateCapabilities(capabilities);
|
|
146
|
+
}
|
|
132
147
|
if (!Object.hasOwn(schemas, kind))
|
|
133
148
|
fail('Unknown component kind', context);
|
|
134
149
|
if (!validatedSnapshots.get(props)?.has(kind)) {
|
|
@@ -181,8 +196,11 @@ export function hyKey(...parts) {
|
|
|
181
196
|
return '/' + parts.map(key => key.replace(/~/g, '~0').replace(/\//g, '~1')).join('/');
|
|
182
197
|
}
|
|
183
198
|
export function hyValidateNode(node, capabilities) {
|
|
184
|
-
if (capabilities)
|
|
199
|
+
if (capabilities) {
|
|
200
|
+
capabilities = snapshotProtocolData(capabilities, { property: 'capabilities' });
|
|
185
201
|
hyValidateCapabilities(capabilities);
|
|
202
|
+
}
|
|
203
|
+
node = snapshotProtocolData(node, { property: 'node' });
|
|
186
204
|
const ancestors = new Set();
|
|
187
205
|
const walk = (value, parent) => {
|
|
188
206
|
const raw = record(value, { property: 'node' });
|
|
@@ -238,6 +256,6 @@ export function hyValidateNode(node, capabilities) {
|
|
|
238
256
|
return snapshot(node);
|
|
239
257
|
}
|
|
240
258
|
export function hyNode(kind, key, props, content = {}) {
|
|
241
|
-
return hyValidateNode({ kind, key, props, ...content });
|
|
259
|
+
return hyValidateNode({ kind, key, props, ...snapshotProtocolData(content, { key }) });
|
|
242
260
|
}
|
|
243
261
|
//# sourceMappingURL=validation.js.map
|
package/dist/date-picker.js
CHANGED
|
@@ -43,38 +43,38 @@ export class HYDatePicker extends HTMLElement {
|
|
|
43
43
|
const root = this.attachShadow({ mode: 'open' });
|
|
44
44
|
const style = document.createElement('style');
|
|
45
45
|
style.textContent = `
|
|
46
|
-
:host { position: relative; display: inline-block; min-width: 180px; color: var(--hy-text-color, #eef3ff); font: 12px/1.4 system-ui, sans-serif; }
|
|
47
|
-
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-date-picker-height, 34px); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-radius, 6px); background: var(--hy-input-bg-color, #111722); }
|
|
46
|
+
:host { position: relative; display: inline-block; min-width: 180px; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif); }
|
|
47
|
+
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-date-picker-height, var(--hy-control-height-md, 34px)); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-radius, var(--hy-radius-md, 6px)); background: var(--hy-input-bg-color, #111722); }
|
|
48
48
|
:host(:not([disabled])) .control:hover { border-color: var(--hy-hover-border-color, #596779); }
|
|
49
49
|
:host(:focus-within) .control, :host([open]) .control { border-color: var(--hy-focus-border-color, #79a8ff); box-shadow: 0 0 0 2px var(--hy-focus-ring-color, rgba(121, 168, 255, 0.22)); }
|
|
50
|
-
.trigger { display: flex; align-items: center; min-width: 0; gap: 8px; padding: 0 8px 0 10px; overflow: hidden; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
|
|
50
|
+
.trigger { display: flex; align-items: center; min-width: 0; gap: var(--hy-space-4, 8px); padding: 0 var(--hy-space-4, 8px) 0 var(--hy-space-5, 10px); overflow: hidden; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
|
|
51
51
|
.label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
52
52
|
.label.placeholder { color: var(--hy-muted-color, #788697); }
|
|
53
|
-
.arrow { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: 14px; }
|
|
54
|
-
.clear { width: 28px; padding: 0; border: 0; color: var(--hy-muted-color, #788697); background: transparent; cursor: pointer; font:
|
|
53
|
+
.arrow { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-md, 14px); }
|
|
54
|
+
.clear { width: 28px; padding: 0; border: 0; color: var(--hy-muted-color, #788697); background: transparent; cursor: pointer; font: calc(var(--hy-font-size-md, 14px) + 1px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif); }
|
|
55
55
|
.clear:hover { color: var(--hy-text-color, #eef3ff); }
|
|
56
56
|
.clear[hidden] { display: none; }
|
|
57
57
|
.trigger:focus-visible, .clear:focus-visible { outline: none; }
|
|
58
58
|
:host([disabled]) { opacity: 0.52; }
|
|
59
59
|
:host([disabled]) .trigger, :host([disabled]) .clear { cursor: not-allowed; }
|
|
60
|
-
.panel { position: absolute; z-index: var(--hy-date-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: var(--hy-date-picker-panel-width, 286px); box-sizing: border-box; padding: 10px; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-panel-radius, 8px); background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #171d27)); box-shadow: 0 12px 32px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36)); }
|
|
60
|
+
.panel { position: absolute; z-index: var(--hy-date-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: var(--hy-date-picker-panel-width, 286px); box-sizing: border-box; padding: var(--hy-space-5, 10px); border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-panel-radius, var(--hy-radius-lg, 8px)); background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #171d27)); box-shadow: 0 12px 32px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36)); }
|
|
61
61
|
.panel[hidden] { display: none; }
|
|
62
|
-
.calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom:
|
|
63
|
-
.month-label { color: var(--hy-text-color, #eef3ff); font-weight:
|
|
64
|
-
.month-button, .footer button { height: 28px; border: 1px solid transparent; border-radius: 4px; color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
62
|
+
.calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom: calc(var(--hy-space-3, 6px) + 1px); }
|
|
63
|
+
.month-label { color: var(--hy-text-color, #eef3ff); font-weight: calc(var(--hy-font-weight-semibold, 600) + 50); text-align: center; }
|
|
64
|
+
.month-button, .footer button { height: var(--hy-control-height-sm, 28px); border: 1px solid transparent; border-radius: var(--hy-radius-sm, 4px); color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
65
65
|
.month-button:hover:not(:disabled), .footer button:hover:not(:disabled) { color: var(--hy-accent-color, #79a8ff); background: var(--hy-hover-bg-color, #273241); }
|
|
66
66
|
.month-button:focus-visible, .footer button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
|
67
67
|
.month-button:disabled, .footer button:disabled { cursor: not-allowed; opacity: 0.35; }
|
|
68
|
-
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
|
|
69
|
-
.weekday { padding: 4px 0; color: var(--hy-muted-color, #788697); font-size: 10px; text-align: center; }
|
|
68
|
+
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--hy-space-1, 2px); }
|
|
69
|
+
.weekday { padding: var(--hy-space-2, 4px) 0; color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-xs, 10px); text-align: center; }
|
|
70
70
|
.day { position: relative; width: 100%; aspect-ratio: 1; min-height: 31px; padding: 0; border: 1px solid transparent; border-radius: var(--hy-date-picker-day-radius, 50%); color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
71
71
|
.day:hover:not(:disabled), .day:focus-visible { outline: none; color: var(--hy-text-color, #eef3ff); border-color: var(--hy-hover-border-color, #596779); background: var(--hy-hover-bg-color, #273241); }
|
|
72
72
|
.day.outside { color: var(--hy-muted-color, #788697); opacity: 0.6; }
|
|
73
73
|
.day.today::after { position: absolute; right: 50%; bottom: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--hy-accent-color, #79a8ff); content: ''; transform: translateX(50%); }
|
|
74
74
|
.day[aria-selected="true"] { color: var(--hy-selected-text-color, #fff); border-color: var(--hy-selected-bg-color, #554cc6); background: var(--hy-selected-bg-color, #554cc6); }
|
|
75
75
|
.day:disabled { cursor: not-allowed; opacity: 0.24; }
|
|
76
|
-
.footer { display: flex; justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
77
|
-
.footer button { padding: 0
|
|
76
|
+
.footer { display: flex; justify-content: flex-end; margin-top: var(--hy-space-4, 8px); padding-top: var(--hy-space-4, 8px); border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
77
|
+
.footer button { padding: 0 calc(var(--hy-space-4, 8px) + 1px); color: var(--hy-accent-color, #79a8ff); }
|
|
78
78
|
`;
|
|
79
79
|
this._control.className = 'control';
|
|
80
80
|
this._control.part.add('control');
|
|
@@ -191,6 +191,10 @@ export class HYDatePicker extends HTMLElement {
|
|
|
191
191
|
return new Intl.DateTimeFormat(this.locale, { year: 'numeric', month: 'short', day: 'numeric' }).format(date);
|
|
192
192
|
}
|
|
193
193
|
_render() {
|
|
194
|
+
if (this.disabled && this.open) {
|
|
195
|
+
this.open = false;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
194
198
|
const text = this._formatDate(this._value);
|
|
195
199
|
this._label.textContent = text || this.placeholder;
|
|
196
200
|
this._label.classList.toggle('placeholder', !text);
|
|
@@ -327,6 +331,8 @@ export class HYDatePicker extends HTMLElement {
|
|
|
327
331
|
else
|
|
328
332
|
this._panel.querySelector('.day:not(:disabled)')?.focus(); }
|
|
329
333
|
_commit(value) {
|
|
334
|
+
if (this.disabled)
|
|
335
|
+
return;
|
|
330
336
|
this._value = this._normalizeValue(value);
|
|
331
337
|
this._reflectValue();
|
|
332
338
|
if (this.open)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type HYDescriptionsLayout = 'horizontal' | 'vertical';
|
|
2
|
+
export type HYDescriptionsSize = 'small' | 'default';
|
|
3
|
+
export interface HYDescriptionItem {
|
|
4
|
+
key?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string | number | boolean | null;
|
|
7
|
+
span?: number | 'filled';
|
|
8
|
+
}
|
|
9
|
+
/** Semantic definition list with responsive columns, spans and rich value slots. */
|
|
10
|
+
export declare class HYDescriptions extends HTMLElement {
|
|
11
|
+
private readonly _header;
|
|
12
|
+
private readonly _heading;
|
|
13
|
+
private readonly _extra;
|
|
14
|
+
private readonly _list;
|
|
15
|
+
private readonly _rows;
|
|
16
|
+
private _items;
|
|
17
|
+
private _observer;
|
|
18
|
+
private _width;
|
|
19
|
+
static get observedAttributes(): string[];
|
|
20
|
+
constructor();
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
attributeChangedCallback(name: string): void;
|
|
24
|
+
get items(): HYDescriptionItem[];
|
|
25
|
+
set items(value: readonly HYDescriptionItem[]);
|
|
26
|
+
get heading(): string;
|
|
27
|
+
set heading(value: string);
|
|
28
|
+
get column(): number;
|
|
29
|
+
set column(value: number);
|
|
30
|
+
get layout(): HYDescriptionsLayout;
|
|
31
|
+
set layout(value: HYDescriptionsLayout);
|
|
32
|
+
get bordered(): boolean;
|
|
33
|
+
set bordered(value: boolean);
|
|
34
|
+
get size(): HYDescriptionsSize;
|
|
35
|
+
set size(value: HYDescriptionsSize);
|
|
36
|
+
get responsive(): boolean;
|
|
37
|
+
set responsive(value: boolean);
|
|
38
|
+
get emptyText(): string;
|
|
39
|
+
set emptyText(value: string);
|
|
40
|
+
private _normalize;
|
|
41
|
+
private _layout;
|
|
42
|
+
private _render;
|
|
43
|
+
}
|
|
44
|
+
export declare function defineDescriptionsComponents(): void;
|