@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/upload.js
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
let uploadFileId = 0;
|
|
2
|
+
export class HYUpload extends HTMLElement {
|
|
3
|
+
static formAssociated = true;
|
|
4
|
+
_internals = this.attachInternals();
|
|
5
|
+
_input = document.createElement('input');
|
|
6
|
+
_zone = document.createElement('div');
|
|
7
|
+
_button = document.createElement('button');
|
|
8
|
+
_slot = document.createElement('slot');
|
|
9
|
+
_list = document.createElement('ul');
|
|
10
|
+
_message = document.createElement('div');
|
|
11
|
+
_files = [];
|
|
12
|
+
_initialFiles = null;
|
|
13
|
+
_request = null;
|
|
14
|
+
_beforeUpload = null;
|
|
15
|
+
_requests = new Map();
|
|
16
|
+
_rows = new Map();
|
|
17
|
+
_listeners = null;
|
|
18
|
+
_formDisabled = false;
|
|
19
|
+
_selection = 0;
|
|
20
|
+
_dragDepth = 0;
|
|
21
|
+
static get observedAttributes() { return ['name', 'accept', 'multiple', 'disabled', 'drag', 'required', 'max-count', 'max-size', 'auto-upload', 'label', 'aria-label', 'show-file-list']; }
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
25
|
+
const style = document.createElement('style');
|
|
26
|
+
style.textContent = `
|
|
27
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #d8e2f2); font: var(--hy-font-size-sm, 12px)/1.5 var(--hy-font-family, system-ui, sans-serif); }
|
|
28
|
+
input { display: none; } .zone { display: flex; align-items: center; gap: var(--hy-space-4, 8px); }
|
|
29
|
+
:host([drag]) .zone { flex-direction: column; padding: var(--hy-space-12, 24px); border: 1px dashed var(--hy-border-color, #303746); border-radius: var(--hy-radius-md, 6px); background: var(--hy-surface-color, #121822); }
|
|
30
|
+
:host([drag]) .zone.dragover { border-color: var(--hy-accent-color, #8177f2); background: var(--hy-hover-bg-color, #273241); }
|
|
31
|
+
button { min-height: var(--hy-control-height-sm, 28px); padding: 0 var(--hy-space-5, 10px); border: 1px solid var(--hy-border-color, #303746); border-radius: var(--hy-radius-sm, 4px); color: inherit; background: var(--hy-surface-elevated-color, #202733); font: inherit; cursor: pointer; }
|
|
32
|
+
button:hover:not(:disabled) { background: var(--hy-hover-bg-color, #273241); } button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 2px; }
|
|
33
|
+
button:disabled { opacity: .55; cursor: not-allowed; } ul { list-style: none; margin: var(--hy-space-4, 8px) 0 0; padding: 0; }
|
|
34
|
+
li { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; align-items: center; gap: var(--hy-space-3, 6px); padding: var(--hy-space-3, 6px) 0; border-bottom: 1px solid var(--hy-border-color, #303746); }
|
|
35
|
+
.name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .status { color: var(--hy-muted-text-color, #8290a3); } li.error .status { color: var(--hy-error-color, #d95d72); }
|
|
36
|
+
progress { grid-column: 1 / -1; width: 100%; height: 5px; accent-color: var(--hy-accent-color, #8177f2); }
|
|
37
|
+
.message { margin-top: var(--hy-space-3, 6px); color: var(--hy-error-color, #d95d72); } [hidden] { display: none !important; }
|
|
38
|
+
`;
|
|
39
|
+
this._input.type = 'file';
|
|
40
|
+
this._input.tabIndex = -1;
|
|
41
|
+
this._input.part.add('input');
|
|
42
|
+
this._zone.className = 'zone';
|
|
43
|
+
this._zone.part.add('dropzone');
|
|
44
|
+
this._button.type = 'button';
|
|
45
|
+
this._button.part.add('trigger');
|
|
46
|
+
this._list.part.add('list');
|
|
47
|
+
this._list.setAttribute('aria-label', 'Selected files');
|
|
48
|
+
this._message.className = 'message';
|
|
49
|
+
this._message.part.add('message');
|
|
50
|
+
this._message.setAttribute('role', 'status');
|
|
51
|
+
this._zone.append(this._button, this._slot);
|
|
52
|
+
root.append(style, this._input, this._zone, this._list, this._message);
|
|
53
|
+
}
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
this._initialFiles ??= this.fileList;
|
|
56
|
+
this._listeners?.abort();
|
|
57
|
+
this._listeners = new AbortController();
|
|
58
|
+
const { signal } = this._listeners;
|
|
59
|
+
this._button.addEventListener('click', () => this.openFileDialog(), { signal });
|
|
60
|
+
this._input.addEventListener('change', () => { const files = [...(this._input.files ?? [])]; this._input.value = ''; void this.selectFiles(files); }, { signal });
|
|
61
|
+
this._zone.addEventListener('dragenter', this._onDragEnter, { signal });
|
|
62
|
+
this._zone.addEventListener('dragleave', this._onDragLeave, { signal });
|
|
63
|
+
this._zone.addEventListener('dragover', this._onDragOver, { signal });
|
|
64
|
+
this._zone.addEventListener('drop', this._onDrop, { signal });
|
|
65
|
+
this._list.addEventListener('click', this._onListClick, { signal });
|
|
66
|
+
this._sync();
|
|
67
|
+
}
|
|
68
|
+
disconnectedCallback() { this._listeners?.abort(); this._listeners = null; this._selection++; this.abort(); this._dragDepth = 0; this._zone.classList.remove('dragover'); }
|
|
69
|
+
attributeChangedCallback(name, previous, next) {
|
|
70
|
+
if (previous === next)
|
|
71
|
+
return;
|
|
72
|
+
if (name === 'disabled' && this.disabled) {
|
|
73
|
+
this._selection++;
|
|
74
|
+
this.abort();
|
|
75
|
+
}
|
|
76
|
+
this._sync();
|
|
77
|
+
}
|
|
78
|
+
get fileList() { return this._files.map(file => ({ ...file })); }
|
|
79
|
+
set fileList(value) {
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const files = (Array.isArray(value) ? value : []).filter(file => file && typeof file.uid === 'string' && file.uid && typeof file.name === 'string' && !seen.has(file.uid) && Boolean(seen.add(file.uid)))
|
|
82
|
+
.map(file => ({ ...file, status: file.status === 'uploading' || file.status === 'done' || file.status === 'error' ? file.status : 'ready' }));
|
|
83
|
+
this.abort();
|
|
84
|
+
this._selection++;
|
|
85
|
+
this._files = files;
|
|
86
|
+
this._sync();
|
|
87
|
+
}
|
|
88
|
+
get files() { return this._files.flatMap(file => file.file ? [file.file] : []); }
|
|
89
|
+
get request() { return this._request; }
|
|
90
|
+
set request(value) { this.abort(); this._request = typeof value === 'function' ? value : null; }
|
|
91
|
+
get beforeUpload() { return this._beforeUpload; }
|
|
92
|
+
set beforeUpload(value) { this._selection++; this._beforeUpload = typeof value === 'function' ? value : null; }
|
|
93
|
+
get name() { return this.getAttribute('name') ?? ''; }
|
|
94
|
+
set name(value) { this.setAttribute('name', value); }
|
|
95
|
+
get accept() { return this.getAttribute('accept') ?? ''; }
|
|
96
|
+
set accept(value) { this.setAttribute('accept', value); }
|
|
97
|
+
get multiple() { return this.hasAttribute('multiple'); }
|
|
98
|
+
set multiple(value) { this.toggleAttribute('multiple', value); }
|
|
99
|
+
get disabled() { return this.hasAttribute('disabled'); }
|
|
100
|
+
set disabled(value) { this.toggleAttribute('disabled', value); }
|
|
101
|
+
get drag() { return this.hasAttribute('drag'); }
|
|
102
|
+
set drag(value) { this.toggleAttribute('drag', value); }
|
|
103
|
+
get maxCount() { return nonnegative(this.getAttribute('max-count')); }
|
|
104
|
+
set maxCount(value) { this.setAttribute('max-count', String(value)); }
|
|
105
|
+
get maxSize() { return nonnegative(this.getAttribute('max-size')); }
|
|
106
|
+
set maxSize(value) { this.setAttribute('max-size', String(value)); }
|
|
107
|
+
get autoUpload() { return this.getAttribute('auto-upload') !== 'false'; }
|
|
108
|
+
set autoUpload(value) { this.setAttribute('auto-upload', String(value)); }
|
|
109
|
+
get showFileList() { return this.getAttribute('show-file-list') !== 'false'; }
|
|
110
|
+
set showFileList(value) { this.setAttribute('show-file-list', String(value)); }
|
|
111
|
+
get form() { return this._internals.form; }
|
|
112
|
+
get validity() { return this._internals.validity; }
|
|
113
|
+
get validationMessage() { return this._internals.validationMessage; }
|
|
114
|
+
checkValidity() { return this._internals.checkValidity(); }
|
|
115
|
+
reportValidity() { return this._internals.reportValidity(); }
|
|
116
|
+
formDisabledCallback(disabled) { this._formDisabled = disabled; if (disabled) {
|
|
117
|
+
this._selection++;
|
|
118
|
+
this.abort();
|
|
119
|
+
} this._sync(); }
|
|
120
|
+
formResetCallback() { this.fileList = this._initialFiles ?? []; this._message.textContent = ''; }
|
|
121
|
+
focus(options) { this._button.focus(options); }
|
|
122
|
+
openFileDialog() { if (!this.disabled && !this._formDisabled)
|
|
123
|
+
this._input.click(); }
|
|
124
|
+
async selectFiles(value) {
|
|
125
|
+
if (this.disabled || this._formDisabled || !this.isConnected)
|
|
126
|
+
return;
|
|
127
|
+
const selection = ++this._selection;
|
|
128
|
+
const files = [...value].filter(file => file instanceof File);
|
|
129
|
+
const accepted = [];
|
|
130
|
+
this._message.textContent = '';
|
|
131
|
+
for (const file of files) {
|
|
132
|
+
if (this.maxSize && file.size > this.maxSize) {
|
|
133
|
+
this._reject(file, 'size', 'File exceeds the size limit');
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (!matchesAccept(file, this.accept)) {
|
|
137
|
+
this._reject(file, 'type', 'File type is not accepted');
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const limit = this.multiple ? this.maxCount : 1;
|
|
141
|
+
if (limit && (this.multiple ? this._files.length : 0) + accepted.length >= limit) {
|
|
142
|
+
this._reject(file, 'count', 'Too many files');
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
if (this._beforeUpload && !await this._beforeUpload(file, files)) {
|
|
147
|
+
if (selection !== this._selection)
|
|
148
|
+
return;
|
|
149
|
+
this._reject(file, 'before-upload', 'File was rejected');
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (cause) {
|
|
154
|
+
if (selection !== this._selection)
|
|
155
|
+
return;
|
|
156
|
+
this._reject(file, 'error', cause instanceof Error ? cause.message : 'File validation failed');
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (selection !== this._selection || !this.isConnected || this.disabled || this._formDisabled)
|
|
160
|
+
return;
|
|
161
|
+
accepted.push({ uid: `hy-upload-${++uploadFileId}`, name: file.name, size: file.size, type: file.type, file, status: 'ready', percent: 0 });
|
|
162
|
+
}
|
|
163
|
+
if (selection !== this._selection || !this.isConnected || !accepted.length)
|
|
164
|
+
return;
|
|
165
|
+
if (!this.multiple) {
|
|
166
|
+
this.abort();
|
|
167
|
+
this._files = [];
|
|
168
|
+
}
|
|
169
|
+
this._files.push(...accepted);
|
|
170
|
+
this._sync();
|
|
171
|
+
for (const file of accepted)
|
|
172
|
+
this._emit(file, 'select');
|
|
173
|
+
if (this.autoUpload && this._request)
|
|
174
|
+
await Promise.all(accepted.map(file => this._upload(file.uid)));
|
|
175
|
+
}
|
|
176
|
+
async upload(uid) {
|
|
177
|
+
if (!this._request || this.disabled || this._formDisabled || !this.isConnected)
|
|
178
|
+
return;
|
|
179
|
+
await Promise.all(this._files.filter(file => (!uid || file.uid === uid) && file.status !== 'done').map(file => this._upload(file.uid)));
|
|
180
|
+
}
|
|
181
|
+
abort(uid) {
|
|
182
|
+
for (const [id, controller] of this._requests) {
|
|
183
|
+
if (uid && id !== uid)
|
|
184
|
+
continue;
|
|
185
|
+
controller.abort();
|
|
186
|
+
this._requests.delete(id);
|
|
187
|
+
const file = this._files.find(file => file.uid === id);
|
|
188
|
+
if (file) {
|
|
189
|
+
file.status = 'ready';
|
|
190
|
+
file.percent = 0;
|
|
191
|
+
this._emit(file, 'abort');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
this._sync();
|
|
195
|
+
}
|
|
196
|
+
removeFile(uid) {
|
|
197
|
+
if (this.disabled || this._formDisabled)
|
|
198
|
+
return false;
|
|
199
|
+
const file = this._files.find(file => file.uid === uid);
|
|
200
|
+
if (!file)
|
|
201
|
+
return false;
|
|
202
|
+
if (!this.dispatchEvent(new CustomEvent('file-remove', { detail: { file: { ...file } }, bubbles: true, composed: true, cancelable: true })))
|
|
203
|
+
return false;
|
|
204
|
+
this.abort(uid);
|
|
205
|
+
this._files = this._files.filter(file => file.uid !== uid);
|
|
206
|
+
this._sync();
|
|
207
|
+
this._emit(file, 'remove');
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
async _upload(uid) {
|
|
211
|
+
const request = this._request;
|
|
212
|
+
const file = this._files.find(file => file.uid === uid);
|
|
213
|
+
if (!request || !file?.file || this._requests.has(uid) || !this.isConnected || this.disabled || this._formDisabled)
|
|
214
|
+
return;
|
|
215
|
+
const controller = new AbortController();
|
|
216
|
+
this._requests.set(uid, controller);
|
|
217
|
+
file.status = 'uploading';
|
|
218
|
+
file.percent = 0;
|
|
219
|
+
delete file.error;
|
|
220
|
+
this._sync();
|
|
221
|
+
this._emit(file, 'start');
|
|
222
|
+
if (controller.signal.aborted)
|
|
223
|
+
return;
|
|
224
|
+
try {
|
|
225
|
+
const response = await request({ file: file.file, signal: controller.signal, onProgress: percent => {
|
|
226
|
+
if (!controller.signal.aborted && this._requests.get(uid) === controller && Number.isFinite(percent)) {
|
|
227
|
+
file.percent = Math.max(0, Math.min(100, percent));
|
|
228
|
+
this._sync();
|
|
229
|
+
this._emit(file, 'progress');
|
|
230
|
+
}
|
|
231
|
+
} });
|
|
232
|
+
if (controller.signal.aborted || this._requests.get(uid) !== controller)
|
|
233
|
+
return;
|
|
234
|
+
file.status = 'done';
|
|
235
|
+
file.percent = 100;
|
|
236
|
+
file.response = response;
|
|
237
|
+
this._sync();
|
|
238
|
+
this._emit(file, 'success');
|
|
239
|
+
}
|
|
240
|
+
catch (cause) {
|
|
241
|
+
if (controller.signal.aborted || this._requests.get(uid) !== controller)
|
|
242
|
+
return;
|
|
243
|
+
file.status = 'error';
|
|
244
|
+
file.error = cause instanceof Error ? cause.message : 'Upload failed';
|
|
245
|
+
this._sync();
|
|
246
|
+
this._emit(file, 'error');
|
|
247
|
+
}
|
|
248
|
+
finally {
|
|
249
|
+
if (this._requests.get(uid) === controller)
|
|
250
|
+
this._requests.delete(uid);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
_emit(file, reason) { this.dispatchEvent(new CustomEvent('upload-change', { detail: { file: { ...file }, fileList: this.fileList, reason }, bubbles: true, composed: true })); }
|
|
254
|
+
_reject(file, reason, message) { this._message.textContent = `${file.name}: ${message}`; this.dispatchEvent(new CustomEvent('file-reject', { detail: { file, reason, message }, bubbles: true, composed: true })); }
|
|
255
|
+
_sync() {
|
|
256
|
+
const disabled = this.disabled || this._formDisabled;
|
|
257
|
+
this._input.disabled = this._button.disabled = disabled;
|
|
258
|
+
this._input.accept = this.accept;
|
|
259
|
+
this._input.multiple = this.multiple;
|
|
260
|
+
this._button.textContent = this.getAttribute('label') || 'Choose files';
|
|
261
|
+
this._button.setAttribute('aria-label', this.getAttribute('aria-label') || this.getAttribute('label') || 'Choose files');
|
|
262
|
+
this._zone.setAttribute('aria-disabled', String(disabled));
|
|
263
|
+
this._list.hidden = !this.showFileList || !this._files.length;
|
|
264
|
+
for (const [uid, row] of this._rows)
|
|
265
|
+
if (!this._files.some(file => file.uid === uid)) {
|
|
266
|
+
row.row.remove();
|
|
267
|
+
this._rows.delete(uid);
|
|
268
|
+
}
|
|
269
|
+
this._files.forEach((file, index) => {
|
|
270
|
+
let record = this._rows.get(file.uid);
|
|
271
|
+
if (!record) {
|
|
272
|
+
const row = document.createElement('li');
|
|
273
|
+
row.part.add('file');
|
|
274
|
+
const name = document.createElement('span');
|
|
275
|
+
name.className = 'name';
|
|
276
|
+
name.part.add('file-name');
|
|
277
|
+
const status = document.createElement('span');
|
|
278
|
+
status.className = 'status';
|
|
279
|
+
status.part.add('file-status');
|
|
280
|
+
const progress = document.createElement('progress');
|
|
281
|
+
progress.max = 100;
|
|
282
|
+
progress.part.add('progress');
|
|
283
|
+
const remove = document.createElement('button');
|
|
284
|
+
remove.type = 'button';
|
|
285
|
+
remove.dataset.remove = file.uid;
|
|
286
|
+
remove.textContent = '×';
|
|
287
|
+
remove.part.add('remove');
|
|
288
|
+
const retry = document.createElement('button');
|
|
289
|
+
retry.type = 'button';
|
|
290
|
+
retry.dataset.retry = file.uid;
|
|
291
|
+
retry.textContent = 'Retry';
|
|
292
|
+
retry.part.add('retry');
|
|
293
|
+
row.append(name, status, retry, remove, progress);
|
|
294
|
+
record = { row, name, status, progress, remove, retry };
|
|
295
|
+
this._rows.set(file.uid, record);
|
|
296
|
+
}
|
|
297
|
+
record.row.className = file.status;
|
|
298
|
+
if (record.name.textContent !== file.name)
|
|
299
|
+
record.name.textContent = file.name;
|
|
300
|
+
record.name.title = file.name;
|
|
301
|
+
record.status.textContent = file.status === 'uploading' ? `${Math.round(file.percent ?? 0)}%` : file.error || file.status;
|
|
302
|
+
record.progress.hidden = file.status !== 'uploading';
|
|
303
|
+
record.progress.value = file.percent ?? 0;
|
|
304
|
+
record.progress.setAttribute('aria-label', `Upload ${file.name}`);
|
|
305
|
+
record.remove.disabled = disabled;
|
|
306
|
+
record.remove.setAttribute('aria-label', `Remove ${file.name}`);
|
|
307
|
+
record.retry.hidden = file.status !== 'error' || !this._request;
|
|
308
|
+
record.retry.disabled = disabled;
|
|
309
|
+
record.retry.setAttribute('aria-label', `Retry ${file.name}`);
|
|
310
|
+
if (this._list.children[index] !== record.row)
|
|
311
|
+
this._list.insertBefore(record.row, this._list.children[index] ?? null);
|
|
312
|
+
});
|
|
313
|
+
const data = new FormData();
|
|
314
|
+
for (const file of this.files)
|
|
315
|
+
data.append(this.name, file);
|
|
316
|
+
this._internals.setFormValue(disabled || !this.name ? null : data);
|
|
317
|
+
const missing = !disabled && this.hasAttribute('required') && !this._files.length;
|
|
318
|
+
this._internals.setValidity(missing ? { valueMissing: true } : {}, missing ? 'Choose a file' : '', this._button);
|
|
319
|
+
}
|
|
320
|
+
_onListClick = (event) => {
|
|
321
|
+
const button = event.target instanceof Element ? event.target.closest('button') : null;
|
|
322
|
+
if (button?.dataset.remove)
|
|
323
|
+
this.removeFile(button.dataset.remove);
|
|
324
|
+
else if (button?.dataset.retry)
|
|
325
|
+
void this.upload(button.dataset.retry);
|
|
326
|
+
};
|
|
327
|
+
_onDragEnter = (event) => { if (!this.drag)
|
|
328
|
+
return; event.preventDefault(); if (!this.disabled && !this._formDisabled) {
|
|
329
|
+
this._dragDepth++;
|
|
330
|
+
this._zone.classList.add('dragover');
|
|
331
|
+
} };
|
|
332
|
+
_onDragLeave = (event) => { if (!this.drag)
|
|
333
|
+
return; event.preventDefault(); if (--this._dragDepth <= 0) {
|
|
334
|
+
this._dragDepth = 0;
|
|
335
|
+
this._zone.classList.remove('dragover');
|
|
336
|
+
} };
|
|
337
|
+
_onDragOver = (event) => { if (this.drag) {
|
|
338
|
+
event.preventDefault();
|
|
339
|
+
if (event.dataTransfer)
|
|
340
|
+
event.dataTransfer.dropEffect = this.disabled || this._formDisabled ? 'none' : 'copy';
|
|
341
|
+
} };
|
|
342
|
+
_onDrop = (event) => { if (!this.drag)
|
|
343
|
+
return; event.preventDefault(); this._dragDepth = 0; this._zone.classList.remove('dragover'); if (event.dataTransfer)
|
|
344
|
+
void this.selectFiles(event.dataTransfer.files); };
|
|
345
|
+
}
|
|
346
|
+
function nonnegative(value) { const number = Number(value); return Number.isFinite(number) ? Math.max(0, number) : 0; }
|
|
347
|
+
function matchesAccept(file, accept) {
|
|
348
|
+
const tokens = accept.toLowerCase().split(',').map(token => token.trim()).filter(Boolean);
|
|
349
|
+
return !tokens.length || tokens.some(token => token === '*' || token === '*/*' || (token.startsWith('.') ? file.name.toLowerCase().endsWith(token) : token.endsWith('/*') ? file.type.toLowerCase().startsWith(token.slice(0, -1)) : file.type.toLowerCase() === token));
|
|
350
|
+
}
|
|
351
|
+
export function defineUploadComponents() { if (!customElements.get('hy-upload'))
|
|
352
|
+
customElements.define('hy-upload', HYUpload); }
|
|
353
|
+
//# sourceMappingURL=upload.js.map
|
package/dist/virtual-keyboard.js
CHANGED
|
@@ -70,16 +70,16 @@ export class HYVirtualKeyboard extends HTMLElement {
|
|
|
70
70
|
const root = this.attachShadow({ mode: 'open' });
|
|
71
71
|
const style = document.createElement('style');
|
|
72
72
|
style.textContent = `
|
|
73
|
-
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: 12px/1 system-ui, sans-serif; }
|
|
74
|
-
.keyboard { display: grid; gap: var(--hy-virtual-keyboard-row-gap,
|
|
75
|
-
.row { display: flex; gap: var(--hy-virtual-keyboard-key-gap, 6px); min-width: 0; }
|
|
76
|
-
.key { position: relative; min-width: 0; height: var(--hy-virtual-keyboard-key-height,
|
|
73
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif); }
|
|
74
|
+
.keyboard { display: grid; gap: var(--hy-virtual-keyboard-row-gap, calc(var(--hy-space-3, 6px) + 1px)); box-sizing: border-box; padding: var(--hy-virtual-keyboard-padding, var(--hy-space-6, 12px)); border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-virtual-keyboard-radius, calc(var(--hy-radius-xl, 12px) - 1px)); background: var(--hy-virtual-keyboard-bg, var(--hy-surface-color, #111722)); box-shadow: var(--hy-virtual-keyboard-shadow, 0 16px 40px var(--hy-shadow-color, rgba(0, 0, 0, .22))); user-select: none; touch-action: manipulation; }
|
|
75
|
+
.row { display: flex; gap: var(--hy-virtual-keyboard-key-gap, var(--hy-space-3, 6px)); min-width: 0; }
|
|
76
|
+
.key { position: relative; min-width: 0; height: var(--hy-virtual-keyboard-key-height, calc(var(--hy-control-height-lg, 44px) - 2px)); flex: var(--_key-width, 1) 1 0; overflow: hidden; padding: 0 calc(var(--hy-space-2, 4px) + 1px); border: 1px solid var(--hy-virtual-keyboard-key-border, var(--hy-border-color, #3d4654)); border-radius: var(--hy-virtual-keyboard-key-radius, calc(var(--hy-radius-md, 6px) + 1px)); color: var(--hy-virtual-keyboard-key-color, var(--hy-text-color, #eef3ff)); background: var(--hy-virtual-keyboard-key-bg, var(--hy-surface-elevated-color, #171d27)); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--hy-border-color, #3d4654) 65%, transparent); cursor: pointer; font: inherit; text-overflow: ellipsis; white-space: nowrap; transition: translate 70ms ease, background-color 70ms ease, box-shadow 70ms ease; }
|
|
77
77
|
.key:hover:not(:disabled) { border-color: var(--hy-hover-border-color, #596779); background: var(--hy-hover-bg-color, #273241); }
|
|
78
78
|
.key:focus-visible { z-index: 1; outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
|
79
79
|
.key.pressed, .key[aria-pressed="true"] { translate: 0 1px; border-color: var(--hy-selected-bg-color, #554cc6); background: var(--hy-virtual-keyboard-active-bg, color-mix(in srgb, var(--hy-selected-bg-color, #554cc6) 50%, var(--hy-surface-elevated-color, #171d27))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hy-focus-border-color, #79a8ff) 24%, transparent); }
|
|
80
80
|
.key:disabled { opacity: .42; cursor: not-allowed; }
|
|
81
81
|
:host([disabled]) .keyboard { opacity: .62; }
|
|
82
|
-
@media (max-width: 620px) { .keyboard { --hy-virtual-keyboard-padding:
|
|
82
|
+
@media (max-width: 620px) { .keyboard { --hy-virtual-keyboard-padding: calc(var(--hy-space-3, 6px) + 1px); --hy-virtual-keyboard-row-gap: calc(var(--hy-space-2, 4px) + 1px); --hy-virtual-keyboard-key-gap: calc(var(--hy-space-1, 2px) + 1px); --hy-virtual-keyboard-key-height: calc(var(--hy-control-height-md, 34px) + 2px); font-size: calc(var(--hy-font-size-xs, 10px) - 1px); } }
|
|
83
83
|
@media (prefers-reduced-motion: reduce) { .key { transition: none; } }
|
|
84
84
|
`;
|
|
85
85
|
this._keyboard.className = 'keyboard';
|
package/dist/virtual-list.js
CHANGED
|
@@ -51,7 +51,7 @@ export class HYVirtualList extends HTMLElement {
|
|
|
51
51
|
display: block;
|
|
52
52
|
min-width: 0;
|
|
53
53
|
color: var(--hy-text-color, #eef3ff);
|
|
54
|
-
font:
|
|
54
|
+
font: calc(var(--hy-font-size-sm, 12px) + 1px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif);
|
|
55
55
|
}
|
|
56
56
|
.viewport {
|
|
57
57
|
position: relative;
|
|
@@ -60,7 +60,7 @@ export class HYVirtualList extends HTMLElement {
|
|
|
60
60
|
overflow-y: auto;
|
|
61
61
|
overscroll-behavior: contain;
|
|
62
62
|
border: 1px solid var(--hy-border-color, #3d4654);
|
|
63
|
-
border-radius: var(--hy-virtual-list-border-radius, 6px);
|
|
63
|
+
border-radius: var(--hy-virtual-list-border-radius, var(--hy-radius-md, 6px));
|
|
64
64
|
outline: none;
|
|
65
65
|
background: var(--hy-surface-color, #171d27);
|
|
66
66
|
scrollbar-color: var(--hy-border-strong-color, #596779) var(--hy-input-bg-color, #111722);
|
|
@@ -75,7 +75,7 @@ export class HYVirtualList extends HTMLElement {
|
|
|
75
75
|
.viewport::-webkit-scrollbar-thumb {
|
|
76
76
|
min-height: 28px;
|
|
77
77
|
border: 2px solid var(--hy-input-bg-color, #111722);
|
|
78
|
-
border-radius: 999px;
|
|
78
|
+
border-radius: var(--hy-radius-full, 999px);
|
|
79
79
|
background: var(--hy-border-strong-color, #596779);
|
|
80
80
|
}
|
|
81
81
|
.viewport::-webkit-scrollbar-thumb:hover { background: var(--hy-accent-color, #79a8ff); }
|
|
@@ -95,7 +95,7 @@ export class HYVirtualList extends HTMLElement {
|
|
|
95
95
|
display: grid;
|
|
96
96
|
height: 100%;
|
|
97
97
|
place-items: center;
|
|
98
|
-
padding: 24px;
|
|
98
|
+
padding: var(--hy-space-12, 24px);
|
|
99
99
|
color: var(--hy-secondary-text-color, #9aa8ba);
|
|
100
100
|
box-sizing: border-box;
|
|
101
101
|
}
|
package/dist/virtual-mouse.js
CHANGED
|
@@ -72,17 +72,17 @@ export class HYVirtualMouse extends HTMLElement {
|
|
|
72
72
|
box-sizing: border-box;
|
|
73
73
|
border: var(--hy-virtual-mouse-border-width, 1.5px) solid var(--hy-virtual-mouse-border-color, #f5fbff);
|
|
74
74
|
clip-path: polygon(5% 0, 88% 70%, 55% 74%, 72% 100%, 51% 100%, 36% 76%, 10% 96%);
|
|
75
|
-
background: var(--hy-virtual-mouse-idle-background, linear-gradient(145deg, #78d7ff, #5265e8));
|
|
75
|
+
background: var(--hy-virtual-mouse-idle-background, linear-gradient(145deg, var(--hy-accent-color, #78d7ff), var(--hy-accent-strong-color, #5265e8)));
|
|
76
76
|
filter: drop-shadow(var(--hy-virtual-mouse-shadow, 0 3px 5px rgba(4, 9, 28, 0.5)));
|
|
77
77
|
}
|
|
78
78
|
:host([data-state="left-down"]) .shape {
|
|
79
|
-
background: var(--hy-virtual-mouse-left-down-background, linear-gradient(145deg, #b5f1ff, #6d74ff));
|
|
79
|
+
background: var(--hy-virtual-mouse-left-down-background, linear-gradient(145deg, var(--hy-focus-border-color, #b5f1ff), var(--hy-accent-color, #6d74ff)));
|
|
80
80
|
}
|
|
81
81
|
:host([data-state="middle-down"]) .shape {
|
|
82
|
-
background: var(--hy-virtual-mouse-middle-down-background, linear-gradient(145deg, #d6c4ff, #7654e8));
|
|
82
|
+
background: var(--hy-virtual-mouse-middle-down-background, linear-gradient(145deg, var(--hy-theme-highlight-color, #d6c4ff), #7654e8));
|
|
83
83
|
}
|
|
84
84
|
:host([data-state="right-down"]) .shape {
|
|
85
|
-
background: var(--hy-virtual-mouse-right-down-background, linear-gradient(145deg, #f4c8ff, #9156dc));
|
|
85
|
+
background: var(--hy-virtual-mouse-right-down-background, linear-gradient(145deg, #f4c8ff, var(--hy-accent-strong-color, #9156dc)));
|
|
86
86
|
}
|
|
87
87
|
.image {
|
|
88
88
|
position: absolute;
|
|
@@ -103,7 +103,7 @@ export class HYVirtualMouse extends HTMLElement {
|
|
|
103
103
|
left: var(--hy-virtual-mouse-hotspot-x, 2px);
|
|
104
104
|
width: var(--hy-virtual-mouse-click-size, 28px);
|
|
105
105
|
height: var(--hy-virtual-mouse-click-size, 28px);
|
|
106
|
-
border: 2px solid var(--hy-virtual-mouse-click-color, #83dcff);
|
|
106
|
+
border: 2px solid var(--hy-virtual-mouse-click-color, var(--hy-accent-color, #83dcff));
|
|
107
107
|
border-radius: 50%;
|
|
108
108
|
opacity: 0;
|
|
109
109
|
translate: -50% -50%;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haiyue/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Dependency-free Web Components for HaiyueStudio tools and products.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,10 +21,22 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"import": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./alert": {
|
|
25
|
+
"types": "./dist/alert.d.ts",
|
|
26
|
+
"import": "./dist/alert.js"
|
|
27
|
+
},
|
|
28
|
+
"./anchor": {
|
|
29
|
+
"types": "./dist/anchor.d.ts",
|
|
30
|
+
"import": "./dist/anchor.js"
|
|
31
|
+
},
|
|
24
32
|
"./badge": {
|
|
25
33
|
"types": "./dist/badge.d.ts",
|
|
26
34
|
"import": "./dist/badge.js"
|
|
27
35
|
},
|
|
36
|
+
"./ribbon": {
|
|
37
|
+
"types": "./dist/ribbon.d.ts",
|
|
38
|
+
"import": "./dist/ribbon.js"
|
|
39
|
+
},
|
|
28
40
|
"./tag": {
|
|
29
41
|
"types": "./dist/tag.d.ts",
|
|
30
42
|
"import": "./dist/tag.js"
|
|
@@ -57,6 +69,10 @@
|
|
|
57
69
|
"types": "./dist/collapse.d.ts",
|
|
58
70
|
"import": "./dist/collapse.js"
|
|
59
71
|
},
|
|
72
|
+
"./carousel": {
|
|
73
|
+
"types": "./dist/carousel.d.ts",
|
|
74
|
+
"import": "./dist/carousel.js"
|
|
75
|
+
},
|
|
60
76
|
"./cascader": {
|
|
61
77
|
"types": "./dist/cascader.d.ts",
|
|
62
78
|
"import": "./dist/cascader.js"
|
|
@@ -93,6 +109,66 @@
|
|
|
93
109
|
"types": "./dist/input.d.ts",
|
|
94
110
|
"import": "./dist/input.js"
|
|
95
111
|
},
|
|
112
|
+
"./mentions": {
|
|
113
|
+
"types": "./dist/mentions.d.ts",
|
|
114
|
+
"import": "./dist/mentions.js"
|
|
115
|
+
},
|
|
116
|
+
"./switch": {
|
|
117
|
+
"types": "./dist/switch.d.ts",
|
|
118
|
+
"import": "./dist/switch.js"
|
|
119
|
+
},
|
|
120
|
+
"./progress": {
|
|
121
|
+
"types": "./dist/progress.d.ts",
|
|
122
|
+
"import": "./dist/progress.js"
|
|
123
|
+
},
|
|
124
|
+
"./spin": {
|
|
125
|
+
"types": "./dist/spin.d.ts",
|
|
126
|
+
"import": "./dist/spin.js"
|
|
127
|
+
},
|
|
128
|
+
"./popover": {
|
|
129
|
+
"types": "./dist/popover.d.ts",
|
|
130
|
+
"import": "./dist/popover.js"
|
|
131
|
+
},
|
|
132
|
+
"./popconfirm": {
|
|
133
|
+
"types": "./dist/popconfirm.d.ts",
|
|
134
|
+
"import": "./dist/popconfirm.js"
|
|
135
|
+
},
|
|
136
|
+
"./form": {
|
|
137
|
+
"types": "./dist/form.d.ts",
|
|
138
|
+
"import": "./dist/form.js"
|
|
139
|
+
},
|
|
140
|
+
"./form-item": {
|
|
141
|
+
"types": "./dist/form-item.d.ts",
|
|
142
|
+
"import": "./dist/form-item.js"
|
|
143
|
+
},
|
|
144
|
+
"./upload": {
|
|
145
|
+
"types": "./dist/upload.d.ts",
|
|
146
|
+
"import": "./dist/upload.js"
|
|
147
|
+
},
|
|
148
|
+
"./auto-complete": {
|
|
149
|
+
"types": "./dist/auto-complete.d.ts",
|
|
150
|
+
"import": "./dist/auto-complete.js"
|
|
151
|
+
},
|
|
152
|
+
"./menu": {
|
|
153
|
+
"types": "./dist/menu.d.ts",
|
|
154
|
+
"import": "./dist/menu.js"
|
|
155
|
+
},
|
|
156
|
+
"./pagination": {
|
|
157
|
+
"types": "./dist/pagination.d.ts",
|
|
158
|
+
"import": "./dist/pagination.js"
|
|
159
|
+
},
|
|
160
|
+
"./tree-select": {
|
|
161
|
+
"types": "./dist/tree-select.d.ts",
|
|
162
|
+
"import": "./dist/tree-select.js"
|
|
163
|
+
},
|
|
164
|
+
"./image": {
|
|
165
|
+
"types": "./dist/image.d.ts",
|
|
166
|
+
"import": "./dist/image.js"
|
|
167
|
+
},
|
|
168
|
+
"./image-preview": {
|
|
169
|
+
"types": "./dist/image-preview.d.ts",
|
|
170
|
+
"import": "./dist/image-preview.js"
|
|
171
|
+
},
|
|
96
172
|
"./notification": {
|
|
97
173
|
"types": "./dist/notification.d.ts",
|
|
98
174
|
"import": "./dist/notification.js"
|
|
@@ -125,6 +201,10 @@
|
|
|
125
201
|
"types": "./dist/table.d.ts",
|
|
126
202
|
"import": "./dist/table.js"
|
|
127
203
|
},
|
|
204
|
+
"./qr-code": {
|
|
205
|
+
"types": "./dist/qr-code.d.ts",
|
|
206
|
+
"import": "./dist/qr-code.js"
|
|
207
|
+
},
|
|
128
208
|
"./radio": {
|
|
129
209
|
"types": "./dist/radio.d.ts",
|
|
130
210
|
"import": "./dist/radio.js"
|
|
@@ -145,10 +225,22 @@
|
|
|
145
225
|
"types": "./dist/select.d.ts",
|
|
146
226
|
"import": "./dist/select.js"
|
|
147
227
|
},
|
|
228
|
+
"./segmented": {
|
|
229
|
+
"types": "./dist/segmented.d.ts",
|
|
230
|
+
"import": "./dist/segmented.js"
|
|
231
|
+
},
|
|
148
232
|
"./skeleton": {
|
|
149
233
|
"types": "./dist/skeleton.d.ts",
|
|
150
234
|
"import": "./dist/skeleton.js"
|
|
151
235
|
},
|
|
236
|
+
"./modal": {
|
|
237
|
+
"types": "./dist/modal.d.ts",
|
|
238
|
+
"import": "./dist/modal.js"
|
|
239
|
+
},
|
|
240
|
+
"./masonry": {
|
|
241
|
+
"types": "./dist/masonry.d.ts",
|
|
242
|
+
"import": "./dist/masonry.js"
|
|
243
|
+
},
|
|
152
244
|
"./split": {
|
|
153
245
|
"types": "./dist/split.d.ts",
|
|
154
246
|
"import": "./dist/split.js"
|
|
@@ -181,6 +273,11 @@
|
|
|
181
273
|
"types": "./dist/tree.d.ts",
|
|
182
274
|
"import": "./dist/tree.js"
|
|
183
275
|
},
|
|
276
|
+
"./empty": { "types": "./dist/empty.d.ts", "import": "./dist/empty.js" },
|
|
277
|
+
"./result": { "types": "./dist/result.d.ts", "import": "./dist/result.js" },
|
|
278
|
+
"./avatar": { "types": "./dist/avatar.d.ts", "import": "./dist/avatar.js" },
|
|
279
|
+
"./card": { "types": "./dist/card.d.ts", "import": "./dist/card.js" },
|
|
280
|
+
"./descriptions": { "types": "./dist/descriptions.d.ts", "import": "./dist/descriptions.js" },
|
|
184
281
|
"./themes/light.css": "./themes/haiyue-light.css",
|
|
185
282
|
"./themes/dark.css": "./themes/haiyue-dark.css",
|
|
186
283
|
"./package.json": "./package.json",
|
|
@@ -244,6 +341,7 @@
|
|
|
244
341
|
"@playwright/test": "^1.63.0",
|
|
245
342
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
246
343
|
"codemirror": "^6.0.2",
|
|
344
|
+
"jsqr": "1.4.0",
|
|
247
345
|
"rollup": "^4.63.4",
|
|
248
346
|
"typescript": "^5.2.0"
|
|
249
347
|
}
|
package/themes/haiyue-dark.css
CHANGED
|
@@ -43,4 +43,55 @@
|
|
|
43
43
|
--hy-drop-target-bg-color: #29265b;
|
|
44
44
|
--hy-theme-glow-color: #5149b9;
|
|
45
45
|
--hy-theme-highlight-color: #e1b952;
|
|
46
|
+
--hy-info-color: #79bce8;
|
|
47
|
+
--hy-success-color: #63d7a1;
|
|
48
|
+
--hy-warning-color: #e1b952;
|
|
49
|
+
--hy-error-color: #fa8299;
|
|
50
|
+
--hy-on-status-color: #10132f;
|
|
51
|
+
--hy-on-accent-color: #10132f;
|
|
52
|
+
--hy-shadow-color: rgba(1, 2, 15, 0.42);
|
|
53
|
+
|
|
54
|
+
/* Spacing uses a 2px step. */
|
|
55
|
+
--hy-space-1: 2px;
|
|
56
|
+
--hy-space-2: 4px;
|
|
57
|
+
--hy-space-3: 6px;
|
|
58
|
+
--hy-space-4: 8px;
|
|
59
|
+
--hy-space-5: 10px;
|
|
60
|
+
--hy-space-6: 12px;
|
|
61
|
+
--hy-space-7: 14px;
|
|
62
|
+
--hy-space-8: 16px;
|
|
63
|
+
--hy-space-10: 20px;
|
|
64
|
+
--hy-space-12: 24px;
|
|
65
|
+
--hy-space-16: 32px;
|
|
66
|
+
--hy-space-32: 64px;
|
|
67
|
+
|
|
68
|
+
--hy-font-family: system-ui, sans-serif;
|
|
69
|
+
--hy-font-family-mono: ui-monospace, monospace;
|
|
70
|
+
--hy-font-size-xs: 10px;
|
|
71
|
+
--hy-font-size-sm: 12px;
|
|
72
|
+
--hy-font-size-md: 14px;
|
|
73
|
+
--hy-font-size-lg: 16px;
|
|
74
|
+
--hy-font-size-xl: 20px;
|
|
75
|
+
--hy-font-size-2xl: 24px;
|
|
76
|
+
--hy-line-height-tight: 1;
|
|
77
|
+
--hy-line-height-compact: 1.2;
|
|
78
|
+
--hy-line-height-snug: 1.4;
|
|
79
|
+
--hy-line-height-relaxed: 1.5;
|
|
80
|
+
--hy-line-height-loose: 1.6;
|
|
81
|
+
--hy-font-weight-normal: 400;
|
|
82
|
+
--hy-font-weight-semibold: 600;
|
|
83
|
+
--hy-font-weight-bold: 700;
|
|
84
|
+
--hy-font-weight-heavy: 800;
|
|
85
|
+
|
|
86
|
+
--hy-radius-xs: 2px;
|
|
87
|
+
--hy-radius-sm: 4px;
|
|
88
|
+
--hy-radius-md: 6px;
|
|
89
|
+
--hy-radius-lg: 8px;
|
|
90
|
+
--hy-radius-xl: 12px;
|
|
91
|
+
--hy-radius-full: 999px;
|
|
92
|
+
|
|
93
|
+
--hy-control-height-xs: 24px;
|
|
94
|
+
--hy-control-height-sm: 28px;
|
|
95
|
+
--hy-control-height-md: 34px;
|
|
96
|
+
--hy-control-height-lg: 44px;
|
|
46
97
|
}
|