@haiyue/ui 0.2.1 → 0.3.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/CHANGELOG.md +46 -0
- package/LICENSE +27 -0
- package/README.md +707 -5
- package/dist/adapters/web/controls.js +28 -5
- package/dist/adapters/web/renderer.js +11 -10
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +42 -18
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +60 -0
- package/dist/anchor.js +274 -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 +1 -1
- 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.d.ts +92 -0
- package/dist/carousel.js +509 -0
- package/dist/cascader.js +12 -12
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.d.ts +13 -0
- package/dist/collapse.js +100 -13
- package/dist/context-menu.js +3 -3
- package/dist/core/types.d.ts +22 -3
- package/dist/core/validation.js +9 -4
- package/dist/date-picker.js +13 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.js +11 -11
- package/dist/divider.js +2 -2
- package/dist/draggable.js +1 -1
- package/dist/drawer.js +12 -12
- package/dist/dropdown.js +3 -3
- 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 +56 -0
- package/dist/index.js +84 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +29 -15
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -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/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/internal/qrcodegen.d.ts +94 -0
- package/dist/internal/qrcodegen.js +856 -0
- package/dist/masonry.d.ts +36 -0
- package/dist/masonry.js +171 -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.d.ts +73 -0
- package/dist/modal.js +361 -0
- package/dist/notification.js +9 -9
- 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/icons.d.ts +5 -0
- package/dist/portable/icons.js +24 -0
- package/dist/portable/index.d.ts +3 -0
- package/dist/portable/index.js +2 -0
- package/dist/portable/responsive.d.ts +20 -0
- package/dist/portable/responsive.js +15 -0
- package/dist/portable/theme.d.ts +6 -1
- package/dist/portable/theme.js +23 -3
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.d.ts +62 -0
- package/dist/qr-code.js +224 -0
- 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 +4 -4
- 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 +0 -2
- package/dist/table.js +46 -87
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +10 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +9 -9
- package/dist/tooltip.js +4 -4
- package/dist/tour.js +11 -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.js +6 -5
- package/dist/upload.d.ts +107 -0
- package/dist/upload.js +353 -0
- package/dist/virtual-keyboard.js +5 -5
- package/dist/virtual-list.js +4 -4
- package/dist/virtual-mouse.js +5 -5
- package/package.json +99 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
package/dist/anchor.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
function finiteNumber(value, fallback, min, max) {
|
|
2
|
+
const number = Number(value);
|
|
3
|
+
return Number.isFinite(number) ? Math.min(max, Math.max(min, number)) : fallback;
|
|
4
|
+
}
|
|
5
|
+
/** Hash-link navigation that tracks targets inside the viewport or an owned scroll container. */
|
|
6
|
+
export class HYAnchor extends HTMLElement {
|
|
7
|
+
_nav = document.createElement('nav');
|
|
8
|
+
_list = document.createElement('div');
|
|
9
|
+
_items = [];
|
|
10
|
+
_scrollContainer = null;
|
|
11
|
+
_listeners = null;
|
|
12
|
+
_frame = 0;
|
|
13
|
+
_programmaticHref = null;
|
|
14
|
+
_scrollEndTimer = 0;
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return ['items', 'active-href', 'offset-top', 'bounds', 'direction', 'smooth', 'aria-label'];
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
21
|
+
const style = document.createElement('style');
|
|
22
|
+
style.textContent = `
|
|
23
|
+
:host { display: block; min-width: 0; color: var(--hy-secondary-text-color, #8fa7c8); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
24
|
+
nav { position: relative; min-width: 0; }
|
|
25
|
+
.list { display: flex; min-width: 0; flex-direction: column; gap: var(--hy-space-1, 2px); border-inline-start: 1px solid var(--hy-anchor-rail-color, var(--hy-border-color, #303746)); }
|
|
26
|
+
.item { position: relative; min-width: 0; }
|
|
27
|
+
a { display: block; min-width: 0; padding: calc(var(--hy-space-2, 4px) + 1px) var(--hy-space-5, 10px) calc(var(--hy-space-2, 4px) + 1px) calc(var(--hy-space-5, 10px) + var(--_depth, 0) * var(--hy-space-7, 14px)); border-radius: 0 var(--hy-radius-sm, 4px) var(--hy-radius-sm, 4px) 0; overflow: hidden; color: inherit; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; transition: color 120ms ease, background 120ms ease; }
|
|
28
|
+
a::before { content: ''; position: absolute; inset-block: 5px; inset-inline-start: -1px; width: 2px; border-radius: var(--hy-radius-xs, 2px); background: transparent; }
|
|
29
|
+
a:hover { color: var(--hy-text-color, #d8e2f2); background: var(--hy-hover-bg-color, #222b3a); }
|
|
30
|
+
a.active { color: var(--hy-anchor-active-color, var(--hy-accent-color, #6fc8ef)); }
|
|
31
|
+
a.active::before { background: currentColor; }
|
|
32
|
+
a.disabled { opacity: 0.45; cursor: default; }
|
|
33
|
+
a:focus-visible { outline: 2px solid var(--hy-focus-border-color, #3d6fa8); outline-offset: -2px; }
|
|
34
|
+
:host([direction="horizontal"]) .list { flex-direction: row; gap: var(--hy-space-2, 4px); overflow-x: auto; border-inline-start: 0; border-block-end: 1px solid var(--hy-anchor-rail-color, var(--hy-border-color, #303746)); }
|
|
35
|
+
:host([direction="horizontal"]) .item { flex: none; }
|
|
36
|
+
:host([direction="horizontal"]) a { padding: calc(var(--hy-space-3, 6px) + 1px) var(--hy-space-5, 10px); border-radius: var(--hy-radius-sm, 4px) var(--hy-radius-sm, 4px) 0 0; }
|
|
37
|
+
:host([direction="horizontal"]) a::before { inset: auto 6px -1px; width: auto; height: 2px; }
|
|
38
|
+
@media (prefers-reduced-motion: reduce) { a { transition: none; } }
|
|
39
|
+
`;
|
|
40
|
+
this._nav.part.add('nav');
|
|
41
|
+
this._list.className = 'list';
|
|
42
|
+
this._list.part.add('list');
|
|
43
|
+
this._nav.append(this._list);
|
|
44
|
+
root.append(style, this._nav);
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
if (this.hasAttribute('items'))
|
|
48
|
+
this._readItemsAttribute();
|
|
49
|
+
this._render();
|
|
50
|
+
this._connect();
|
|
51
|
+
queueMicrotask(() => this.refresh());
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() { this._disconnect(); }
|
|
54
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
55
|
+
if (oldValue === newValue)
|
|
56
|
+
return;
|
|
57
|
+
if (name === 'items')
|
|
58
|
+
this._readItemsAttribute();
|
|
59
|
+
this._render();
|
|
60
|
+
if (this.isConnected && ['offset-top', 'bounds'].includes(name))
|
|
61
|
+
this.refresh();
|
|
62
|
+
}
|
|
63
|
+
get items() { return this._items; }
|
|
64
|
+
set items(value) { this._items = this._normalizeItems(value); this._render(); this.refresh(); }
|
|
65
|
+
get activeHref() { return this.getAttribute('active-href') ?? ''; }
|
|
66
|
+
set activeHref(value) { if (value)
|
|
67
|
+
this.setAttribute('active-href', value);
|
|
68
|
+
else
|
|
69
|
+
this.removeAttribute('active-href'); }
|
|
70
|
+
get offsetTop() { return finiteNumber(this.getAttribute('offset-top'), 0, 0, 10000); }
|
|
71
|
+
set offsetTop(value) { this.setAttribute('offset-top', String(finiteNumber(value, 0, 0, 10000))); }
|
|
72
|
+
get bounds() { return finiteNumber(this.getAttribute('bounds'), 5, 0, 1000); }
|
|
73
|
+
set bounds(value) { this.setAttribute('bounds', String(finiteNumber(value, 5, 0, 1000))); }
|
|
74
|
+
get direction() { return this.getAttribute('direction') === 'horizontal' ? 'horizontal' : 'vertical'; }
|
|
75
|
+
set direction(value) { this.setAttribute('direction', value); }
|
|
76
|
+
get smooth() { return this.hasAttribute('smooth'); }
|
|
77
|
+
set smooth(value) { this.toggleAttribute('smooth', Boolean(value)); }
|
|
78
|
+
get scrollContainer() { return this._scrollContainer; }
|
|
79
|
+
set scrollContainer(value) {
|
|
80
|
+
this._scrollContainer = value instanceof HTMLElement || value === window ? value : null;
|
|
81
|
+
if (this.isConnected) {
|
|
82
|
+
this._connect();
|
|
83
|
+
this.refresh();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
scrollToAnchor(href) {
|
|
87
|
+
const target = this._resolveTarget(href);
|
|
88
|
+
if (!target)
|
|
89
|
+
return false;
|
|
90
|
+
const container = this._scrollContainer ?? window;
|
|
91
|
+
const behavior = this.smooth && !matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'auto';
|
|
92
|
+
this._programmaticHref = href;
|
|
93
|
+
this._setActive(href, true);
|
|
94
|
+
if (container instanceof HTMLElement) {
|
|
95
|
+
const top = container.scrollTop + target.getBoundingClientRect().top - container.getBoundingClientRect().top - this.offsetTop;
|
|
96
|
+
container.scrollTo({ top, behavior });
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const top = window.scrollY + target.getBoundingClientRect().top - this.offsetTop;
|
|
100
|
+
window.scrollTo({ top, behavior });
|
|
101
|
+
}
|
|
102
|
+
this._scheduleScrollEnd();
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
refresh() {
|
|
106
|
+
cancelAnimationFrame(this._frame);
|
|
107
|
+
this._frame = requestAnimationFrame(() => this._measure());
|
|
108
|
+
}
|
|
109
|
+
_normalizeItems(value) {
|
|
110
|
+
if (!Array.isArray(value))
|
|
111
|
+
return [];
|
|
112
|
+
return value.map(raw => {
|
|
113
|
+
const item = raw && typeof raw === 'object' ? raw : {};
|
|
114
|
+
const href = String(item.href ?? item.key ?? '');
|
|
115
|
+
const normalized = {
|
|
116
|
+
href,
|
|
117
|
+
title: String(item.title ?? item.label ?? href),
|
|
118
|
+
disabled: Boolean(item.disabled),
|
|
119
|
+
children: this._normalizeItems(item.children),
|
|
120
|
+
};
|
|
121
|
+
if (item.key != null)
|
|
122
|
+
return { ...normalized, key: String(item.key) };
|
|
123
|
+
return normalized;
|
|
124
|
+
}).filter(item => Boolean(item.href));
|
|
125
|
+
}
|
|
126
|
+
_readItemsAttribute() {
|
|
127
|
+
const raw = this.getAttribute('items');
|
|
128
|
+
if (!raw) {
|
|
129
|
+
this._items = [];
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
this._items = this._normalizeItems(JSON.parse(raw));
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.warn('Invalid hy-anchor items attribute.', error);
|
|
137
|
+
this._items = [];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
_flatten(items = this._items) {
|
|
141
|
+
return items.flatMap(item => [item, ...this._flatten([...(item.children ?? [])])]);
|
|
142
|
+
}
|
|
143
|
+
_render() {
|
|
144
|
+
if (!this._list)
|
|
145
|
+
return;
|
|
146
|
+
this._nav.setAttribute('aria-label', this.getAttribute('aria-label') ?? 'On this page');
|
|
147
|
+
this._list.replaceChildren();
|
|
148
|
+
const append = (items, depth) => {
|
|
149
|
+
for (const item of items) {
|
|
150
|
+
const wrap = document.createElement('div');
|
|
151
|
+
const link = document.createElement('a');
|
|
152
|
+
wrap.className = 'item';
|
|
153
|
+
wrap.part.add('item');
|
|
154
|
+
link.part.add('link');
|
|
155
|
+
link.href = item.href;
|
|
156
|
+
link.textContent = item.title;
|
|
157
|
+
link.dataset.href = item.href;
|
|
158
|
+
link.style.setProperty('--_depth', String(depth));
|
|
159
|
+
link.classList.toggle('active', item.href === this.activeHref);
|
|
160
|
+
link.classList.toggle('disabled', Boolean(item.disabled));
|
|
161
|
+
if (item.href === this.activeHref)
|
|
162
|
+
link.setAttribute('aria-current', 'location');
|
|
163
|
+
if (item.disabled) {
|
|
164
|
+
link.setAttribute('aria-disabled', 'true');
|
|
165
|
+
link.tabIndex = -1;
|
|
166
|
+
}
|
|
167
|
+
link.addEventListener('click', event => this._onClick(event, item));
|
|
168
|
+
wrap.append(link);
|
|
169
|
+
this._list.append(wrap);
|
|
170
|
+
append(item.children ?? [], depth + 1);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
append(this._items, 0);
|
|
174
|
+
}
|
|
175
|
+
_onClick(event, item) {
|
|
176
|
+
if (item.disabled) {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const custom = new CustomEvent('anchor-click', {
|
|
181
|
+
detail: { href: item.href, item, nativeEvent: event }, bubbles: true, composed: true, cancelable: true,
|
|
182
|
+
});
|
|
183
|
+
if (!this.dispatchEvent(custom)) {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (item.href.startsWith('#')) {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
if (this.scrollToAnchor(item.href))
|
|
190
|
+
history.replaceState(null, '', item.href);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
_resolveTarget(href) {
|
|
194
|
+
if (!href.startsWith('#'))
|
|
195
|
+
return null;
|
|
196
|
+
try {
|
|
197
|
+
return document.getElementById(decodeURIComponent(href.slice(1)));
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
_connect() {
|
|
204
|
+
this._disconnect();
|
|
205
|
+
const abort = new AbortController();
|
|
206
|
+
this._listeners = abort;
|
|
207
|
+
const target = this._scrollContainer ?? window;
|
|
208
|
+
target.addEventListener('scroll', () => {
|
|
209
|
+
if (this._programmaticHref)
|
|
210
|
+
this._scheduleScrollEnd();
|
|
211
|
+
this.refresh();
|
|
212
|
+
}, { passive: true, signal: abort.signal });
|
|
213
|
+
target.addEventListener('scrollend', () => this._finishProgrammaticScroll(), { passive: true, signal: abort.signal });
|
|
214
|
+
window.addEventListener('resize', () => this.refresh(), { passive: true, signal: abort.signal });
|
|
215
|
+
}
|
|
216
|
+
_disconnect() {
|
|
217
|
+
this._listeners?.abort();
|
|
218
|
+
this._listeners = null;
|
|
219
|
+
cancelAnimationFrame(this._frame);
|
|
220
|
+
this._frame = 0;
|
|
221
|
+
window.clearTimeout(this._scrollEndTimer);
|
|
222
|
+
this._scrollEndTimer = 0;
|
|
223
|
+
this._programmaticHref = null;
|
|
224
|
+
}
|
|
225
|
+
_measure() {
|
|
226
|
+
if (!this.isConnected)
|
|
227
|
+
return;
|
|
228
|
+
if (this._programmaticHref) {
|
|
229
|
+
this._setActive(this._programmaticHref, false);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const container = this._scrollContainer ?? window;
|
|
233
|
+
const threshold = (container instanceof HTMLElement ? container.getBoundingClientRect().top : 0) + this.offsetTop + this.bounds;
|
|
234
|
+
const candidates = this._flatten().filter(item => !item.disabled).map(item => ({ item, target: this._resolveTarget(item.href) })).filter((entry) => Boolean(entry.target));
|
|
235
|
+
if (!candidates.length)
|
|
236
|
+
return;
|
|
237
|
+
let active = candidates[0].item;
|
|
238
|
+
for (const entry of candidates) {
|
|
239
|
+
if (entry.target.getBoundingClientRect().top <= threshold)
|
|
240
|
+
active = entry.item;
|
|
241
|
+
else
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
this._setActive(active.href, true);
|
|
245
|
+
}
|
|
246
|
+
_scheduleScrollEnd() {
|
|
247
|
+
window.clearTimeout(this._scrollEndTimer);
|
|
248
|
+
this._scrollEndTimer = window.setTimeout(() => this._finishProgrammaticScroll(), 160);
|
|
249
|
+
}
|
|
250
|
+
_finishProgrammaticScroll() {
|
|
251
|
+
if (!this._programmaticHref)
|
|
252
|
+
return;
|
|
253
|
+
window.clearTimeout(this._scrollEndTimer);
|
|
254
|
+
this._scrollEndTimer = 0;
|
|
255
|
+
this._programmaticHref = null;
|
|
256
|
+
this.refresh();
|
|
257
|
+
}
|
|
258
|
+
_setActive(href, emit) {
|
|
259
|
+
if (!href || href === this.activeHref)
|
|
260
|
+
return;
|
|
261
|
+
this.setAttribute('active-href', href);
|
|
262
|
+
if (!emit)
|
|
263
|
+
return;
|
|
264
|
+
const item = this._flatten().find(candidate => candidate.href === href) ?? null;
|
|
265
|
+
this.dispatchEvent(new CustomEvent('anchor-change', {
|
|
266
|
+
detail: { href, item }, bubbles: true, composed: true,
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
export function defineAnchorComponents() {
|
|
271
|
+
if (!customElements.get('hy-anchor'))
|
|
272
|
+
customElements.define('hy-anchor', HYAnchor);
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface HYAutoCompleteOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface HYAutoCompleteChangeDetail {
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface HYAutoCompleteSelectDetail {
|
|
10
|
+
value: string;
|
|
11
|
+
option: HYAutoCompleteOption;
|
|
12
|
+
}
|
|
13
|
+
export type HYAutoCompleteFilter = (value: string, option: HYAutoCompleteOption) => boolean;
|
|
14
|
+
export declare class HYAutoComplete extends HTMLElement {
|
|
15
|
+
static readonly formAssociated = true;
|
|
16
|
+
private readonly _control;
|
|
17
|
+
private readonly _input;
|
|
18
|
+
private readonly _clear;
|
|
19
|
+
private readonly _panel;
|
|
20
|
+
private readonly _list;
|
|
21
|
+
private readonly _status;
|
|
22
|
+
private readonly _id;
|
|
23
|
+
private readonly _formControl;
|
|
24
|
+
private readonly _popup;
|
|
25
|
+
private _options;
|
|
26
|
+
private _items;
|
|
27
|
+
private _visible;
|
|
28
|
+
private _active;
|
|
29
|
+
private _filter;
|
|
30
|
+
private _listeners;
|
|
31
|
+
private _searchTimer;
|
|
32
|
+
private _composing;
|
|
33
|
+
private _lastSearch;
|
|
34
|
+
private _committing;
|
|
35
|
+
static get observedAttributes(): string[];
|
|
36
|
+
constructor();
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
39
|
+
attributeChangedCallback(name: string, previous: string | null, next: string | null): void;
|
|
40
|
+
get value(): string;
|
|
41
|
+
set value(value: string);
|
|
42
|
+
get options(): HYAutoCompleteOption[];
|
|
43
|
+
set options(value: HYAutoCompleteOption[]);
|
|
44
|
+
get filterOption(): HYAutoCompleteFilter | false | null;
|
|
45
|
+
set filterOption(value: HYAutoCompleteFilter | false | null);
|
|
46
|
+
get open(): boolean;
|
|
47
|
+
set open(value: boolean);
|
|
48
|
+
get disabled(): boolean;
|
|
49
|
+
set disabled(value: boolean);
|
|
50
|
+
get readOnly(): boolean;
|
|
51
|
+
set readOnly(value: boolean);
|
|
52
|
+
get loading(): boolean;
|
|
53
|
+
set loading(value: boolean);
|
|
54
|
+
get allowClear(): boolean;
|
|
55
|
+
set allowClear(value: boolean);
|
|
56
|
+
get placeholder(): string;
|
|
57
|
+
set placeholder(value: string);
|
|
58
|
+
get searchDelay(): number;
|
|
59
|
+
set searchDelay(value: number);
|
|
60
|
+
get form(): HTMLFormElement | null;
|
|
61
|
+
get validity(): ValidityState;
|
|
62
|
+
get validationMessage(): string;
|
|
63
|
+
checkValidity(): boolean;
|
|
64
|
+
reportValidity(): boolean;
|
|
65
|
+
setCustomValidity(message: string): void;
|
|
66
|
+
formDisabledCallback(disabled: boolean): void;
|
|
67
|
+
formResetCallback(): void;
|
|
68
|
+
formStateRestoreCallback(state: string | File | FormData | null): void;
|
|
69
|
+
focus(options?: FocusOptions): void;
|
|
70
|
+
blur(): void;
|
|
71
|
+
private _sync;
|
|
72
|
+
private _setOptions;
|
|
73
|
+
private _render;
|
|
74
|
+
private _syncActive;
|
|
75
|
+
private _setOpen;
|
|
76
|
+
private _emitChange;
|
|
77
|
+
private _onInput;
|
|
78
|
+
private _cancelSearch;
|
|
79
|
+
private _scheduleSearch;
|
|
80
|
+
private _select;
|
|
81
|
+
private _onKeydown;
|
|
82
|
+
}
|
|
83
|
+
export declare function defineAutoCompleteComponents(): void;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { HYFormControl } from './internal/form-control.js';
|
|
2
|
+
import { HYAnchoredPopup, HY_COMBOBOX_STYLES } from './internal/anchored-popup.js';
|
|
3
|
+
let autoCompleteId = 0;
|
|
4
|
+
export class HYAutoComplete extends HTMLElement {
|
|
5
|
+
static formAssociated = true;
|
|
6
|
+
_control = document.createElement('div');
|
|
7
|
+
_input = document.createElement('input');
|
|
8
|
+
_clear = document.createElement('button');
|
|
9
|
+
_panel = document.createElement('div');
|
|
10
|
+
_list = document.createElement('div');
|
|
11
|
+
_status = document.createElement('div');
|
|
12
|
+
_id = `hy-autocomplete-${++autoCompleteId}`;
|
|
13
|
+
_formControl = new HYFormControl(this, this._input);
|
|
14
|
+
_popup = new HYAnchoredPopup(this, this._control, this._panel, () => this._setOpen(false));
|
|
15
|
+
_options = [];
|
|
16
|
+
_items = [];
|
|
17
|
+
_visible = [];
|
|
18
|
+
_active = -1;
|
|
19
|
+
_filter = null;
|
|
20
|
+
_listeners = null;
|
|
21
|
+
_searchTimer = null;
|
|
22
|
+
_composing = false;
|
|
23
|
+
_lastSearch = null;
|
|
24
|
+
_committing = false;
|
|
25
|
+
static get observedAttributes() { return ['value', 'options', 'open', 'disabled', 'readonly', 'loading', 'allow-clear', 'required', 'name', 'placeholder', 'aria-label', 'maxlength', 'minlength', 'pattern', 'search-delay', 'not-found-content']; }
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
29
|
+
const style = document.createElement('style');
|
|
30
|
+
style.textContent = HY_COMBOBOX_STYLES;
|
|
31
|
+
this._control.className = 'control';
|
|
32
|
+
this._control.part.add('control');
|
|
33
|
+
this._input.type = 'text';
|
|
34
|
+
this._input.autocomplete = 'off';
|
|
35
|
+
this._input.part.add('input');
|
|
36
|
+
this._input.setAttribute('role', 'combobox');
|
|
37
|
+
this._input.setAttribute('aria-autocomplete', 'list');
|
|
38
|
+
this._input.setAttribute('aria-haspopup', 'listbox');
|
|
39
|
+
this._input.setAttribute('aria-controls', this._id);
|
|
40
|
+
this._clear.type = 'button';
|
|
41
|
+
this._clear.className = 'clear';
|
|
42
|
+
this._clear.part.add('clear');
|
|
43
|
+
this._clear.textContent = '×';
|
|
44
|
+
this._clear.setAttribute('aria-label', 'Clear value');
|
|
45
|
+
this._panel.className = 'panel';
|
|
46
|
+
this._panel.part.add('panel');
|
|
47
|
+
this._list.id = this._id;
|
|
48
|
+
this._list.setAttribute('role', 'listbox');
|
|
49
|
+
this._list.part.add('list');
|
|
50
|
+
this._status.className = 'status';
|
|
51
|
+
this._status.part.add('status');
|
|
52
|
+
this._status.setAttribute('role', 'status');
|
|
53
|
+
this._panel.append(this._list, this._status);
|
|
54
|
+
this._control.append(this._input, this._clear);
|
|
55
|
+
root.append(style, this._control, this._panel);
|
|
56
|
+
}
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
this._listeners?.abort();
|
|
59
|
+
this._listeners = new AbortController();
|
|
60
|
+
const { signal } = this._listeners;
|
|
61
|
+
this._input.addEventListener('input', this._onInput, { signal });
|
|
62
|
+
this._input.addEventListener('keydown', this._onKeydown, { signal });
|
|
63
|
+
this._input.addEventListener('focus', () => { if (!this._committing)
|
|
64
|
+
this._setOpen(true); }, { signal });
|
|
65
|
+
this._input.addEventListener('blur', () => this._setOpen(false), { signal });
|
|
66
|
+
this._input.addEventListener('compositionstart', () => { this._composing = true; this._cancelSearch(); this._setOpen(false); }, { signal });
|
|
67
|
+
this._input.addEventListener('compositionend', () => { this._composing = false; this._setOpen(true); this._scheduleSearch(); }, { signal });
|
|
68
|
+
this._panel.addEventListener('pointerdown', event => event.preventDefault(), { signal });
|
|
69
|
+
this._panel.addEventListener('click', event => { const item = event.target instanceof Element ? event.target.closest('[data-index]') : null; if (item)
|
|
70
|
+
this._select(Number(item.dataset.index)); }, { signal });
|
|
71
|
+
this._panel.addEventListener('pointermove', event => { const item = event.target instanceof Element ? event.target.closest('[data-index]') : null; const index = item ? Number(item.dataset.index) : -1; if (index >= 0 && !this._options[index]?.disabled) {
|
|
72
|
+
this._active = index;
|
|
73
|
+
this._syncActive();
|
|
74
|
+
} }, { signal });
|
|
75
|
+
this._clear.addEventListener('click', () => { if (this._input.disabled || this.readOnly)
|
|
76
|
+
return; this.value = ''; this._input.focus(); this._setOpen(false); this._committing = true; try {
|
|
77
|
+
this._input.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true, inputType: 'deleteContentBackward', data: null }));
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
this._committing = false;
|
|
81
|
+
} this._emitChange(); this._scheduleSearch(); this.dispatchEvent(new Event('clear', { bubbles: true, composed: true })); }, { signal });
|
|
82
|
+
this._popup.connect();
|
|
83
|
+
this._sync();
|
|
84
|
+
this._formControl.connect();
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() { this._listeners?.abort(); this._listeners = null; this._popup.dispose(); this._cancelSearch(); this._composing = false; }
|
|
87
|
+
attributeChangedCallback(name, previous, next) {
|
|
88
|
+
if (previous === next)
|
|
89
|
+
return;
|
|
90
|
+
if (name === 'options') {
|
|
91
|
+
let value = [];
|
|
92
|
+
try {
|
|
93
|
+
value = JSON.parse(next ?? '[]');
|
|
94
|
+
}
|
|
95
|
+
catch { /* Invalid data is empty. */ }
|
|
96
|
+
this._setOptions(value);
|
|
97
|
+
}
|
|
98
|
+
this._sync();
|
|
99
|
+
if (name === 'disabled' || name === 'readonly')
|
|
100
|
+
this._cancelSearch();
|
|
101
|
+
if (this.disabled || this.readOnly || this._formControl.disabled)
|
|
102
|
+
this._setOpen(false);
|
|
103
|
+
}
|
|
104
|
+
get value() { return this.getAttribute('value') ?? ''; }
|
|
105
|
+
set value(value) { this.setAttribute('value', String(value ?? '')); }
|
|
106
|
+
get options() { return this._options.map(option => ({ ...option })); }
|
|
107
|
+
set options(value) { this._setOptions(value); this._render(); }
|
|
108
|
+
get filterOption() { return this._filter; }
|
|
109
|
+
set filterOption(value) { this._filter = value; this._render(); }
|
|
110
|
+
get open() { return this.hasAttribute('open'); }
|
|
111
|
+
set open(value) { this._setOpen(Boolean(value)); }
|
|
112
|
+
get disabled() { return this.hasAttribute('disabled'); }
|
|
113
|
+
set disabled(value) { this.toggleAttribute('disabled', value); }
|
|
114
|
+
get readOnly() { return this.hasAttribute('readonly'); }
|
|
115
|
+
set readOnly(value) { this.toggleAttribute('readonly', value); }
|
|
116
|
+
get loading() { return this.hasAttribute('loading'); }
|
|
117
|
+
set loading(value) { this.toggleAttribute('loading', value); }
|
|
118
|
+
get allowClear() { return this.hasAttribute('allow-clear'); }
|
|
119
|
+
set allowClear(value) { this.toggleAttribute('allow-clear', value); }
|
|
120
|
+
get placeholder() { return this.getAttribute('placeholder') ?? ''; }
|
|
121
|
+
set placeholder(value) { this.setAttribute('placeholder', value); }
|
|
122
|
+
get searchDelay() { const value = Number(this.getAttribute('search-delay')); return Number.isFinite(value) ? Math.max(0, Math.min(60000, value)) : 0; }
|
|
123
|
+
set searchDelay(value) { this.setAttribute('search-delay', String(value)); }
|
|
124
|
+
get form() { return this._formControl.internals.form; }
|
|
125
|
+
get validity() { return this._formControl.internals.validity; }
|
|
126
|
+
get validationMessage() { return this._formControl.internals.validationMessage; }
|
|
127
|
+
checkValidity() { return this._formControl.internals.checkValidity(); }
|
|
128
|
+
reportValidity() { return this._formControl.internals.reportValidity(); }
|
|
129
|
+
setCustomValidity(message) { this._formControl.setCustomValidity(message); }
|
|
130
|
+
formDisabledCallback(disabled) { this._formControl.disabled = disabled; this._sync(); if (disabled) {
|
|
131
|
+
this._cancelSearch();
|
|
132
|
+
this._setOpen(false);
|
|
133
|
+
} }
|
|
134
|
+
formResetCallback() { this._formControl.reset(); this._cancelSearch(); this._setOpen(false); }
|
|
135
|
+
formStateRestoreCallback(state) { this._formControl.restore(state); }
|
|
136
|
+
focus(options) { this._input.focus(options); }
|
|
137
|
+
blur() { this._input.blur(); }
|
|
138
|
+
_sync() {
|
|
139
|
+
if (this._input.value !== this.value)
|
|
140
|
+
this._input.value = this.value;
|
|
141
|
+
const disabled = this.disabled || this._formControl.disabled;
|
|
142
|
+
if (this._input.disabled !== disabled)
|
|
143
|
+
this._input.disabled = disabled;
|
|
144
|
+
if (this._input.readOnly !== this.readOnly)
|
|
145
|
+
this._input.readOnly = this.readOnly;
|
|
146
|
+
if (this._input.required !== this.hasAttribute('required'))
|
|
147
|
+
this._input.required = this.hasAttribute('required');
|
|
148
|
+
for (const name of ['placeholder', 'aria-label', 'maxlength', 'minlength', 'pattern']) {
|
|
149
|
+
const value = this.getAttribute(name);
|
|
150
|
+
if (value === null) {
|
|
151
|
+
if (this._input.hasAttribute(name))
|
|
152
|
+
this._input.removeAttribute(name);
|
|
153
|
+
}
|
|
154
|
+
else if (this._input.getAttribute(name) !== value)
|
|
155
|
+
this._input.setAttribute(name, value);
|
|
156
|
+
}
|
|
157
|
+
this._control.classList.toggle('disabled', disabled);
|
|
158
|
+
this._clear.hidden = !this.allowClear || !this.value || this.readOnly;
|
|
159
|
+
this._clear.disabled = disabled;
|
|
160
|
+
this._formControl.sync();
|
|
161
|
+
this._render();
|
|
162
|
+
}
|
|
163
|
+
_setOptions(value) {
|
|
164
|
+
const options = Array.isArray(value) ? value.filter(item => item && typeof item.value === 'string').map(item => ({ value: item.value, ...(typeof item.label === 'string' ? { label: item.label } : {}), ...(item.disabled ? { disabled: true } : {}) })) : [];
|
|
165
|
+
if (JSON.stringify(options) === JSON.stringify(this._options))
|
|
166
|
+
return;
|
|
167
|
+
this._options = options;
|
|
168
|
+
this._items = options.map((option, index) => { const item = document.createElement('div'); item.className = 'option'; item.part.add('option'); item.id = `${this._id}-${index}`; item.dataset.index = String(index); item.setAttribute('role', 'option'); item.setAttribute('aria-disabled', String(Boolean(option.disabled))); item.textContent = option.label ?? option.value; return item; });
|
|
169
|
+
this._list.replaceChildren(...this._items);
|
|
170
|
+
this._active = -1;
|
|
171
|
+
}
|
|
172
|
+
_render() {
|
|
173
|
+
const previous = this._active;
|
|
174
|
+
this._visible = this.loading ? [] : this._options.flatMap((option, index) => this._filter === false || (this._filter ? this._filter(this.value, { ...option }) : `${option.label ?? ''}\n${option.value}`.toLocaleLowerCase().includes(this.value.toLocaleLowerCase())) ? [index] : []);
|
|
175
|
+
const visible = new Set(this._visible);
|
|
176
|
+
this._items.forEach((item, index) => { item.hidden = !visible.has(index); });
|
|
177
|
+
this._active = visible.has(previous) && !this._options[previous]?.disabled ? previous : this._visible.find(index => !this._options[index]?.disabled) ?? -1;
|
|
178
|
+
const message = this.loading ? 'Loading…' : this.getAttribute('not-found-content') ?? 'No results';
|
|
179
|
+
if (this._status.textContent !== message)
|
|
180
|
+
this._status.textContent = message;
|
|
181
|
+
this._status.hidden = this._visible.length > 0;
|
|
182
|
+
this._list.setAttribute('aria-busy', String(this.loading));
|
|
183
|
+
this._list.setAttribute('aria-label', this.getAttribute('aria-label') || 'Suggestions');
|
|
184
|
+
const shown = this.open && !this._input.disabled && !this.readOnly && !this._composing && this.isConnected;
|
|
185
|
+
this._input.setAttribute('aria-expanded', String(shown));
|
|
186
|
+
if (shown)
|
|
187
|
+
this._popup.show();
|
|
188
|
+
else
|
|
189
|
+
this._popup.hide();
|
|
190
|
+
this._syncActive();
|
|
191
|
+
}
|
|
192
|
+
_syncActive() { this._items.forEach((item, index) => { item.classList.toggle('active', index === this._active); item.setAttribute('aria-selected', String(index === this._active)); }); if (this.open && this._active >= 0)
|
|
193
|
+
this._input.setAttribute('aria-activedescendant', `${this._id}-${this._active}`);
|
|
194
|
+
else
|
|
195
|
+
this._input.removeAttribute('aria-activedescendant'); }
|
|
196
|
+
_setOpen(open) { if (open && (this.disabled || this._formControl.disabled || this.readOnly || this._composing))
|
|
197
|
+
return; if (this.open === open)
|
|
198
|
+
return; this.toggleAttribute('open', open); this.dispatchEvent(new CustomEvent('open-change', { detail: { open }, bubbles: true, composed: true })); }
|
|
199
|
+
_emitChange() { this.dispatchEvent(new CustomEvent('value-change', { detail: { value: this.value }, bubbles: true, composed: true })); }
|
|
200
|
+
_onInput = () => { if (!this._committing)
|
|
201
|
+
this._active = -1; this.value = this._input.value; if (!this._committing) {
|
|
202
|
+
this._emitChange();
|
|
203
|
+
if (!this._composing) {
|
|
204
|
+
this._setOpen(true);
|
|
205
|
+
this._scheduleSearch();
|
|
206
|
+
}
|
|
207
|
+
} };
|
|
208
|
+
_cancelSearch() { if (this._searchTimer !== null)
|
|
209
|
+
clearTimeout(this._searchTimer); this._searchTimer = null; }
|
|
210
|
+
_scheduleSearch() { this._cancelSearch(); const emit = () => { this._searchTimer = null; if (this.isConnected && !this._input.disabled && !this.readOnly && !this._composing && this._lastSearch !== this.value) {
|
|
211
|
+
this._lastSearch = this.value;
|
|
212
|
+
this.dispatchEvent(new CustomEvent('search', { detail: { value: this.value }, bubbles: true, composed: true }));
|
|
213
|
+
} }; if (this.searchDelay)
|
|
214
|
+
this._searchTimer = setTimeout(emit, this.searchDelay);
|
|
215
|
+
else
|
|
216
|
+
emit(); }
|
|
217
|
+
_select(index) {
|
|
218
|
+
const option = this._options[index];
|
|
219
|
+
if (!option || option.disabled || this._input.disabled || this.readOnly || this.loading || !this._visible.includes(index))
|
|
220
|
+
return;
|
|
221
|
+
this._cancelSearch();
|
|
222
|
+
this._committing = true;
|
|
223
|
+
try {
|
|
224
|
+
this.value = option.value;
|
|
225
|
+
this._setOpen(false);
|
|
226
|
+
this._input.focus();
|
|
227
|
+
this._input.setSelectionRange(this.value.length, this.value.length);
|
|
228
|
+
this._input.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true, inputType: 'insertReplacementText', data: this.value }));
|
|
229
|
+
this._emitChange();
|
|
230
|
+
this.dispatchEvent(new CustomEvent('option-select', { detail: { value: this.value, option: { ...option } }, bubbles: true, composed: true }));
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
this._committing = false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
_onKeydown = (event) => {
|
|
237
|
+
if (event.isComposing || this._composing || event.keyCode === 229 || this._input.disabled || this.readOnly)
|
|
238
|
+
return;
|
|
239
|
+
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
240
|
+
if (this.open && event.key === 'Escape') {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
event.stopPropagation();
|
|
243
|
+
}
|
|
244
|
+
this._setOpen(false);
|
|
245
|
+
}
|
|
246
|
+
else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
247
|
+
event.preventDefault();
|
|
248
|
+
const wasOpen = this.open;
|
|
249
|
+
this._setOpen(true);
|
|
250
|
+
const enabled = this._visible.filter(index => !this._options[index]?.disabled);
|
|
251
|
+
if (!enabled.length)
|
|
252
|
+
return;
|
|
253
|
+
const position = enabled.indexOf(this._active);
|
|
254
|
+
this._active = wasOpen ? enabled[(position + (event.key === 'ArrowDown' ? 1 : -1) + enabled.length) % enabled.length] : enabled[event.key === 'ArrowDown' ? 0 : enabled.length - 1];
|
|
255
|
+
this._syncActive();
|
|
256
|
+
this._items[this._active]?.scrollIntoView({ block: 'nearest' });
|
|
257
|
+
}
|
|
258
|
+
else if (event.key === 'Enter' && this.open && this._active >= 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
event.stopPropagation();
|
|
261
|
+
this._select(this._active);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
export function defineAutoCompleteComponents() { if (!customElements.get('hy-auto-complete'))
|
|
266
|
+
customElements.define('hy-auto-complete', HYAutoComplete); }
|
|
267
|
+
//# sourceMappingURL=auto-complete.js.map
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type HYAvatarShape = 'circle' | 'square';
|
|
2
|
+
export type HYAvatarSize = 'small' | 'default' | 'large' | number;
|
|
3
|
+
export type HYAvatarStatus = 'empty' | 'loading' | 'loaded' | 'error';
|
|
4
|
+
export type HYAvatarFit = 'cover' | 'contain' | 'fill';
|
|
5
|
+
export interface HYAvatarLoadDetail {
|
|
6
|
+
src: string;
|
|
7
|
+
naturalWidth: number;
|
|
8
|
+
naturalHeight: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HYAvatarErrorDetail {
|
|
11
|
+
src: string;
|
|
12
|
+
}
|
|
13
|
+
/** Image avatar with text or slotted fallback and stale-request protection. */
|
|
14
|
+
export declare class HYAvatar extends HTMLElement {
|
|
15
|
+
private readonly _frame;
|
|
16
|
+
private readonly _imageHost;
|
|
17
|
+
private readonly _fallback;
|
|
18
|
+
private readonly _text;
|
|
19
|
+
private readonly _icon;
|
|
20
|
+
private _image;
|
|
21
|
+
private _listeners;
|
|
22
|
+
private _key;
|
|
23
|
+
private _status;
|
|
24
|
+
static get observedAttributes(): string[];
|
|
25
|
+
constructor();
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
attributeChangedCallback(): void;
|
|
29
|
+
get src(): string;
|
|
30
|
+
set src(value: string);
|
|
31
|
+
get alt(): string;
|
|
32
|
+
set alt(value: string);
|
|
33
|
+
get text(): string;
|
|
34
|
+
set text(value: string);
|
|
35
|
+
get shape(): HYAvatarShape;
|
|
36
|
+
set shape(value: HYAvatarShape);
|
|
37
|
+
get size(): HYAvatarSize;
|
|
38
|
+
set size(value: HYAvatarSize);
|
|
39
|
+
get fit(): HYAvatarFit;
|
|
40
|
+
set fit(value: HYAvatarFit);
|
|
41
|
+
get status(): HYAvatarStatus;
|
|
42
|
+
private _syncSource;
|
|
43
|
+
private _render;
|
|
44
|
+
}
|
|
45
|
+
export declare function defineAvatarComponents(): void;
|