@1337exp/taoui 5.22.0 → 5.23.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 +24 -2
- package/README.md +10 -4
- package/README.ru.md +10 -4
- package/dist/index.d.ts +171 -8
- package/dist/index.js +1359 -1206
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/taoui/SKILL.md +3 -0
- package/skills/taoui/references/components.md +17 -3
- package/src/styles/contexts/frames.css +35 -0
- package/src/styles/index.css +2 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle,
|
|
1
|
+
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle, ref, inject, provide, shallowRef, unref, createElementVNode, toDisplayString, createCommentVNode, useSlots, useAttrs, createBlock, useId, mergeProps, watch, createVNode, toValue, onBeforeUnmount, Teleport, Transition, withCtx, nextTick, Fragment, renderList, createTextVNode, onMounted, createSlots, normalizeProps, guardReactiveProps, resolveDynamicComponent, withModifiers, onBeforeMount, resolveComponent, toRef, withDirectives, vShow, getCurrentInstance, reactive, withKeys, vModelText, TransitionGroup, onUpdated, createApp } from "vue";
|
|
2
2
|
function isDev() {
|
|
3
3
|
try {
|
|
4
4
|
return process.env.NODE_ENV !== "production";
|
|
@@ -95,8 +95,8 @@ function resolveTaoIcon(name) {
|
|
|
95
95
|
return name.startsWith(TAO_ICON_PREFIX) ? builtin[name.slice(TAO_ICON_PREFIX.length)] : registered[name];
|
|
96
96
|
}
|
|
97
97
|
const taoIconNames = Object.keys(builtin).map((name) => TAO_ICON_PREFIX + name);
|
|
98
|
-
const _hoisted_1$
|
|
99
|
-
const _hoisted_2$
|
|
98
|
+
const _hoisted_1$17 = { class: "tao-icon" };
|
|
99
|
+
const _hoisted_2$Z = ["viewBox", "width", "height", "innerHTML"];
|
|
100
100
|
const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
101
101
|
...{ name: "TaoIcon" },
|
|
102
102
|
__name: "TaoIcon",
|
|
@@ -117,7 +117,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
117
117
|
}
|
|
118
118
|
const box = computed(() => props.size ? `${props.size}px` : "1em");
|
|
119
119
|
return (_ctx, _cache) => {
|
|
120
|
-
return openBlock(), createElementBlock("span", _hoisted_1$
|
|
120
|
+
return openBlock(), createElementBlock("span", _hoisted_1$17, [
|
|
121
121
|
renderSlot(_ctx.$slots, "prefix", {}, void 0, true),
|
|
122
122
|
def.value ? (openBlock(), createElementBlock("svg", {
|
|
123
123
|
key: 0,
|
|
@@ -133,7 +133,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
133
133
|
"aria-hidden": "true",
|
|
134
134
|
focusable: "false",
|
|
135
135
|
innerHTML: def.value.body
|
|
136
|
-
}, null, 10, _hoisted_2$
|
|
136
|
+
}, null, 10, _hoisted_2$Z)) : (openBlock(), createElementBlock("i", {
|
|
137
137
|
key: 1,
|
|
138
138
|
class: normalizeClass(["tao-icon__value", [`icon-${props.name}`, { "tao-icon__value--invert": props.invert }]]),
|
|
139
139
|
style: normalizeStyle(props.size ? `font-size: ${props.size}px` : "")
|
|
@@ -151,301 +151,6 @@ const _export_sfc = (sfc, props) => {
|
|
|
151
151
|
return target;
|
|
152
152
|
};
|
|
153
153
|
const TaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__scopeId", "data-v-ef842331"]]);
|
|
154
|
-
const _hoisted_1$15 = ["type", "aria-pressed", "aria-keyshortcuts", "disabled"];
|
|
155
|
-
const _hoisted_2$X = {
|
|
156
|
-
key: 0,
|
|
157
|
-
class: "tao-button__loader"
|
|
158
|
-
};
|
|
159
|
-
const _hoisted_3$P = {
|
|
160
|
-
key: 2,
|
|
161
|
-
class: "tao-button__content"
|
|
162
|
-
};
|
|
163
|
-
const _hoisted_4$F = {
|
|
164
|
-
key: 4,
|
|
165
|
-
class: "tao-button__shortcut",
|
|
166
|
-
"aria-hidden": "true"
|
|
167
|
-
};
|
|
168
|
-
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
169
|
-
...{ name: "TaoButton" },
|
|
170
|
-
__name: "TaoButton",
|
|
171
|
-
props: {
|
|
172
|
-
type: { default: "button" },
|
|
173
|
-
size: {},
|
|
174
|
-
variant: { default: "primary" },
|
|
175
|
-
tone: { default: void 0 },
|
|
176
|
-
disabled: { type: Boolean, default: false },
|
|
177
|
-
loading: { type: Boolean, default: false },
|
|
178
|
-
block: { type: Boolean, default: false },
|
|
179
|
-
icon: { default: "" },
|
|
180
|
-
iconEnd: { default: "" },
|
|
181
|
-
minWidth: { default: void 0 },
|
|
182
|
-
pressed: { type: Boolean, default: void 0 },
|
|
183
|
-
shortcut: { default: void 0 }
|
|
184
|
-
},
|
|
185
|
-
emits: ["click", "update:pressed"],
|
|
186
|
-
setup(__props, { emit: __emit }) {
|
|
187
|
-
const props = __props;
|
|
188
|
-
const minWidthStyle = computed(
|
|
189
|
-
() => props.minWidth === void 0 ? void 0 : { "--tao-button-min-width": typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth }
|
|
190
|
-
);
|
|
191
|
-
const emit = __emit;
|
|
192
|
-
const slots = useSlots();
|
|
193
|
-
const attrs = useAttrs();
|
|
194
|
-
const iconOnly = computed(() => Boolean(props.icon || props.iconEnd) && !slots.default);
|
|
195
|
-
if (iconOnly.value && !attrs["aria-label"] && !attrs["aria-labelledby"] && !attrs.title) {
|
|
196
|
-
devWarning("button:icon-only", "TaoButton: a button with only an icon needs aria-label (or aria-labelledby / title).");
|
|
197
|
-
}
|
|
198
|
-
function handleClick(event) {
|
|
199
|
-
if (!props.disabled && !props.loading) {
|
|
200
|
-
emit("click", event);
|
|
201
|
-
if (props.pressed !== void 0) {
|
|
202
|
-
emit("update:pressed", !props.pressed);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return (_ctx, _cache) => {
|
|
207
|
-
return openBlock(), createElementBlock("button", {
|
|
208
|
-
class: normalizeClass(["tao-button", [
|
|
209
|
-
unref(sizeClass)(__props.size),
|
|
210
|
-
unref(toneClass)(__props.tone),
|
|
211
|
-
`tao-button--${__props.variant}`,
|
|
212
|
-
{
|
|
213
|
-
"tao-button--disabled": __props.disabled,
|
|
214
|
-
"tao-button--loading": __props.loading,
|
|
215
|
-
"tao-button--block": __props.block,
|
|
216
|
-
"tao-button--icon-only": iconOnly.value,
|
|
217
|
-
"tao-button--toned": !!__props.tone && __props.tone !== "accent",
|
|
218
|
-
"tao-button--pressed": __props.pressed === true
|
|
219
|
-
}
|
|
220
|
-
]]),
|
|
221
|
-
style: normalizeStyle(minWidthStyle.value),
|
|
222
|
-
type: __props.type,
|
|
223
|
-
"aria-pressed": __props.pressed === void 0 ? void 0 : __props.pressed,
|
|
224
|
-
"aria-keyshortcuts": __props.shortcut || void 0,
|
|
225
|
-
disabled: __props.disabled || __props.loading,
|
|
226
|
-
onClick: handleClick
|
|
227
|
-
}, [
|
|
228
|
-
__props.loading ? (openBlock(), createElementBlock("span", _hoisted_2$X)) : createCommentVNode("", true),
|
|
229
|
-
__props.icon ? (openBlock(), createBlock(TaoIcon, {
|
|
230
|
-
key: 1,
|
|
231
|
-
class: "tao-button__icon",
|
|
232
|
-
name: __props.icon
|
|
233
|
-
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
234
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$P, [
|
|
235
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
236
|
-
])) : createCommentVNode("", true),
|
|
237
|
-
__props.iconEnd ? (openBlock(), createBlock(TaoIcon, {
|
|
238
|
-
key: 3,
|
|
239
|
-
class: "tao-button__icon",
|
|
240
|
-
name: __props.iconEnd
|
|
241
|
-
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
242
|
-
__props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_4$F, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)
|
|
243
|
-
], 14, _hoisted_1$15);
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__scopeId", "data-v-4b8def1b"]]);
|
|
248
|
-
function toCssLength(value) {
|
|
249
|
-
if (value === void 0 || value === null || value === "") {
|
|
250
|
-
return void 0;
|
|
251
|
-
}
|
|
252
|
-
return typeof value === "number" ? `${value}px` : value;
|
|
253
|
-
}
|
|
254
|
-
function toCssBox(value) {
|
|
255
|
-
return Array.isArray(value) ? value.map((part) => toCssLength(part) ?? "0").join(" ") : toCssLength(value);
|
|
256
|
-
}
|
|
257
|
-
function stripeClasses(stripe, tone = "accent") {
|
|
258
|
-
if (!stripe) {
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
return [`tao-stripe-${stripe}`, tone === "gradient" ? "tao-stripe-gradient" : toneClass(tone)];
|
|
262
|
-
}
|
|
263
|
-
function surfaceClass(surface) {
|
|
264
|
-
return surface && surface !== "flat" ? `tao-surface-${surface}` : void 0;
|
|
265
|
-
}
|
|
266
|
-
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
267
|
-
...{ name: "TaoBlock" },
|
|
268
|
-
__name: "TaoBlock",
|
|
269
|
-
props: {
|
|
270
|
-
padding: { default: void 0 },
|
|
271
|
-
radius: { default: void 0 },
|
|
272
|
-
shadow: { type: Boolean, default: true },
|
|
273
|
-
hover: { type: Boolean, default: false },
|
|
274
|
-
surface: { default: "flat" },
|
|
275
|
-
stripe: { default: void 0 },
|
|
276
|
-
stripeTone: { default: "accent" }
|
|
277
|
-
},
|
|
278
|
-
setup(__props) {
|
|
279
|
-
const props = __props;
|
|
280
|
-
const panelStyle = computed(() => {
|
|
281
|
-
const pad = props.padding;
|
|
282
|
-
const first = Array.isArray(pad) ? pad[0] : pad;
|
|
283
|
-
return {
|
|
284
|
-
padding: pad === void 0 ? void 0 : toCssBox(pad),
|
|
285
|
-
"--tao-pad": first === void 0 ? void 0 : toCssLength(first),
|
|
286
|
-
"--tao-radius": toCssLength(props.radius)
|
|
287
|
-
};
|
|
288
|
-
});
|
|
289
|
-
return (_ctx, _cache) => {
|
|
290
|
-
return openBlock(), createElementBlock("div", {
|
|
291
|
-
class: normalizeClass(["tao-block tao-panel", [unref(surfaceClass)(__props.surface), unref(stripeClasses)(__props.stripe, __props.stripeTone), { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]]),
|
|
292
|
-
style: normalizeStyle(panelStyle.value)
|
|
293
|
-
}, [
|
|
294
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
295
|
-
], 6);
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__scopeId", "data-v-1fc66575"]]);
|
|
300
|
-
function useControlAttrs() {
|
|
301
|
-
const attrs = useAttrs();
|
|
302
|
-
return {
|
|
303
|
-
/** `class` and `style`, for the wrapper. / `class` и `style` — для обёртки. */
|
|
304
|
-
rootAttrs: () => ({ class: attrs.class, style: attrs.style }),
|
|
305
|
-
/** Everything else, for the control. / Всё остальное — для элемента управления. */
|
|
306
|
-
controlAttrs: () => {
|
|
307
|
-
const { class: _class, style: _style, ...rest } = attrs;
|
|
308
|
-
return rest;
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
const formFieldKey = Symbol("taoFormField");
|
|
313
|
-
function useField(props) {
|
|
314
|
-
const field = inject(formFieldKey, null);
|
|
315
|
-
const localId = useId();
|
|
316
|
-
const controlId = computed(() => props.id || field?.id || localId);
|
|
317
|
-
const invalid = computed(() => Boolean(props.error) || Boolean(field?.invalid.value));
|
|
318
|
-
const describedBy = computed(() => field?.describedBy.value);
|
|
319
|
-
return { field, controlId, invalid, describedBy, localId };
|
|
320
|
-
}
|
|
321
|
-
const _hoisted_1$14 = {
|
|
322
|
-
key: 0,
|
|
323
|
-
class: "tao-input__affix tao-input__affix--prefix"
|
|
324
|
-
};
|
|
325
|
-
const _hoisted_2$W = ["id", "type", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby"];
|
|
326
|
-
const _hoisted_3$O = {
|
|
327
|
-
key: 1,
|
|
328
|
-
class: "tao-input__affix tao-input__affix--suffix"
|
|
329
|
-
};
|
|
330
|
-
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
331
|
-
...{ name: "TaoInput", inheritAttrs: false },
|
|
332
|
-
__name: "TaoInput",
|
|
333
|
-
props: {
|
|
334
|
-
modelValue: { default: "" },
|
|
335
|
-
type: { default: "text" },
|
|
336
|
-
placeholder: { default: "" },
|
|
337
|
-
disabled: { type: Boolean, default: false },
|
|
338
|
-
size: {},
|
|
339
|
-
error: { type: Boolean, default: false },
|
|
340
|
-
variant: { default: "outline" },
|
|
341
|
-
id: {}
|
|
342
|
-
},
|
|
343
|
-
emits: ["update:modelValue", "blur", "focus"],
|
|
344
|
-
setup(__props, { emit: __emit }) {
|
|
345
|
-
const { rootAttrs, controlAttrs } = useControlAttrs();
|
|
346
|
-
const props = __props;
|
|
347
|
-
const { controlId, invalid, describedBy } = useField(props);
|
|
348
|
-
const focused = ref(false);
|
|
349
|
-
const emit = __emit;
|
|
350
|
-
function handleInput(event) {
|
|
351
|
-
const target = event.target;
|
|
352
|
-
emit("update:modelValue", target.value);
|
|
353
|
-
}
|
|
354
|
-
function handleBlur(event) {
|
|
355
|
-
focused.value = false;
|
|
356
|
-
emit("blur", event);
|
|
357
|
-
}
|
|
358
|
-
function handleFocus(event) {
|
|
359
|
-
focused.value = true;
|
|
360
|
-
emit("focus", event);
|
|
361
|
-
}
|
|
362
|
-
return (_ctx, _cache) => {
|
|
363
|
-
return openBlock(), createElementBlock("div", mergeProps(unref(rootAttrs)(), {
|
|
364
|
-
class: ["tao-input-wrapper", unref(sizeClass)(__props.size)]
|
|
365
|
-
}), [
|
|
366
|
-
createElementVNode("div", {
|
|
367
|
-
class: normalizeClass(["tao-input-shell", {
|
|
368
|
-
[`tao-input-shell--${__props.variant}`]: __props.variant !== "outline",
|
|
369
|
-
"tao-input-shell--focused": focused.value,
|
|
370
|
-
"tao-input-shell--invalid": unref(invalid),
|
|
371
|
-
"tao-input-shell--disabled": __props.disabled,
|
|
372
|
-
"tao-input-shell--prefix": _ctx.$slots.prefix,
|
|
373
|
-
"tao-input-shell--suffix": _ctx.$slots.suffix
|
|
374
|
-
}])
|
|
375
|
-
}, [
|
|
376
|
-
_ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_1$14, [
|
|
377
|
-
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
|
|
378
|
-
])) : createCommentVNode("", true),
|
|
379
|
-
createElementVNode("input", mergeProps(unref(controlAttrs)(), {
|
|
380
|
-
id: unref(controlId),
|
|
381
|
-
class: ["tao-input", { "tao-input--error": unref(invalid) }],
|
|
382
|
-
type: __props.type,
|
|
383
|
-
value: __props.modelValue,
|
|
384
|
-
placeholder: __props.placeholder,
|
|
385
|
-
disabled: __props.disabled,
|
|
386
|
-
"aria-invalid": unref(invalid) || void 0,
|
|
387
|
-
"aria-describedby": unref(describedBy),
|
|
388
|
-
onInput: handleInput,
|
|
389
|
-
onBlur: handleBlur,
|
|
390
|
-
onFocus: handleFocus
|
|
391
|
-
}), null, 16, _hoisted_2$W),
|
|
392
|
-
_ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_3$O, [
|
|
393
|
-
renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
|
|
394
|
-
])) : createCommentVNode("", true)
|
|
395
|
-
], 2)
|
|
396
|
-
], 16);
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
const TaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__scopeId", "data-v-5b617319"]]);
|
|
401
|
-
const _hoisted_1$13 = {
|
|
402
|
-
key: 0,
|
|
403
|
-
class: "tao-input-group__addon tao-input-group__addon--before"
|
|
404
|
-
};
|
|
405
|
-
const _hoisted_2$V = { class: "tao-input-group__field" };
|
|
406
|
-
const _hoisted_3$N = {
|
|
407
|
-
key: 1,
|
|
408
|
-
class: "tao-input-group__addon tao-input-group__addon--after"
|
|
409
|
-
};
|
|
410
|
-
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
411
|
-
...{ name: "TaoInputGroup" },
|
|
412
|
-
__name: "TaoInputGroup",
|
|
413
|
-
props: {
|
|
414
|
-
size: {}
|
|
415
|
-
},
|
|
416
|
-
setup(__props) {
|
|
417
|
-
const focused = ref(false);
|
|
418
|
-
function onFocusIn() {
|
|
419
|
-
focused.value = true;
|
|
420
|
-
}
|
|
421
|
-
function onFocusOut(event) {
|
|
422
|
-
const root = event.currentTarget;
|
|
423
|
-
const next = event.relatedTarget;
|
|
424
|
-
if (!next || !root.contains(next)) {
|
|
425
|
-
focused.value = false;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return (_ctx, _cache) => {
|
|
429
|
-
return openBlock(), createElementBlock("div", {
|
|
430
|
-
class: normalizeClass(["tao-input-group", [unref(sizeClass)(__props.size), { "tao-input-group--focused": focused.value }]]),
|
|
431
|
-
role: "group",
|
|
432
|
-
onFocusin: onFocusIn,
|
|
433
|
-
onFocusout: onFocusOut
|
|
434
|
-
}, [
|
|
435
|
-
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_1$13, [
|
|
436
|
-
renderSlot(_ctx.$slots, "before", {}, void 0, true)
|
|
437
|
-
])) : createCommentVNode("", true),
|
|
438
|
-
createElementVNode("div", _hoisted_2$V, [
|
|
439
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
440
|
-
]),
|
|
441
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_3$N, [
|
|
442
|
-
renderSlot(_ctx.$slots, "after", {}, void 0, true)
|
|
443
|
-
])) : createCommentVNode("", true)
|
|
444
|
-
], 34);
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
const TaoInputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__scopeId", "data-v-55b2d297"]]);
|
|
449
154
|
const localeEn = {
|
|
450
155
|
code: "en-US",
|
|
451
156
|
alert: { closeLabel: "Close", detailsLabel: "Details" },
|
|
@@ -480,6 +185,7 @@ const localeEn = {
|
|
|
480
185
|
},
|
|
481
186
|
confirm: { ok: "OK", cancel: "Cancel" },
|
|
482
187
|
copy: { copyLabel: "Copy", successText: "Copied!" },
|
|
188
|
+
loader: { label: "Loading" },
|
|
483
189
|
date: {
|
|
484
190
|
placeholder: "Date",
|
|
485
191
|
todayText: "Today",
|
|
@@ -708,6 +414,7 @@ const localeRu = {
|
|
|
708
414
|
},
|
|
709
415
|
confirm: { ok: "ОК", cancel: "Отмена" },
|
|
710
416
|
copy: { copyLabel: "Копировать", successText: "Скопировано!" },
|
|
417
|
+
loader: { label: "Загрузка" },
|
|
711
418
|
date: {
|
|
712
419
|
placeholder: "Дата",
|
|
713
420
|
todayText: "Сегодня",
|
|
@@ -788,46 +495,415 @@ function merge(base, overrides) {
|
|
|
788
495
|
if (!isPlainObject(base) || !isPlainObject(overrides)) {
|
|
789
496
|
return overrides === void 0 ? base : overrides;
|
|
790
497
|
}
|
|
791
|
-
const out = { ...base };
|
|
792
|
-
for (const [key, value] of Object.entries(overrides)) {
|
|
793
|
-
if (value !== void 0) {
|
|
794
|
-
out[key] = merge(base[key], value);
|
|
498
|
+
const out = { ...base };
|
|
499
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
500
|
+
if (value !== void 0) {
|
|
501
|
+
out[key] = merge(base[key], value);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return out;
|
|
505
|
+
}
|
|
506
|
+
function setTaoLocale(locale, base = localeEn) {
|
|
507
|
+
current.value = merge(base, locale);
|
|
508
|
+
configureToastDefaults({ closeLabel: current.value.toast.closeLabel });
|
|
509
|
+
configureConfirmDefaults({ ok: current.value.confirm.ok, cancel: current.value.confirm.cancel });
|
|
510
|
+
}
|
|
511
|
+
function createTaoLocale(locale, base = localeEn) {
|
|
512
|
+
return shallowRef(merge(base, locale));
|
|
513
|
+
}
|
|
514
|
+
function provideTaoLocale(locale, base = localeEn) {
|
|
515
|
+
provide(localeKey, createTaoLocale(locale, base));
|
|
516
|
+
}
|
|
517
|
+
function useTaoLocale() {
|
|
518
|
+
const provided = inject(localeKey, null);
|
|
519
|
+
return computed(() => (provided ?? current).value);
|
|
520
|
+
}
|
|
521
|
+
function useLocaleText(props, section) {
|
|
522
|
+
const locale = useTaoLocale();
|
|
523
|
+
return computed(() => {
|
|
524
|
+
const base = locale.value[section];
|
|
525
|
+
const own = props;
|
|
526
|
+
const out = { ...base };
|
|
527
|
+
for (const key of Object.keys(base)) {
|
|
528
|
+
if (own[key] !== void 0) {
|
|
529
|
+
out[key] = own[key];
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return out;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
function formatText(template, values) {
|
|
536
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => key in values ? String(values[key]) : match);
|
|
537
|
+
}
|
|
538
|
+
const _hoisted_1$16 = ["role", "aria-hidden"];
|
|
539
|
+
const _hoisted_2$Y = {
|
|
540
|
+
key: 0,
|
|
541
|
+
class: "tao-loader__ellipsis",
|
|
542
|
+
"aria-hidden": "true"
|
|
543
|
+
};
|
|
544
|
+
const _hoisted_3$Q = {
|
|
545
|
+
key: 1,
|
|
546
|
+
class: "tao-loader__ring",
|
|
547
|
+
"aria-hidden": "true"
|
|
548
|
+
};
|
|
549
|
+
const _hoisted_4$F = {
|
|
550
|
+
key: 2,
|
|
551
|
+
class: "tao-loader__pulse",
|
|
552
|
+
"aria-hidden": "true"
|
|
553
|
+
};
|
|
554
|
+
const _hoisted_5$v = {
|
|
555
|
+
key: 3,
|
|
556
|
+
class: "tao-sr-only"
|
|
557
|
+
};
|
|
558
|
+
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
559
|
+
...{ name: "TaoLoader" },
|
|
560
|
+
__name: "TaoLoader",
|
|
561
|
+
props: {
|
|
562
|
+
variant: { default: "dots" },
|
|
563
|
+
size: { default: void 0 },
|
|
564
|
+
tone: { default: void 0 },
|
|
565
|
+
color: { default: void 0 },
|
|
566
|
+
inline: { type: Boolean, default: false },
|
|
567
|
+
label: { default: void 0 },
|
|
568
|
+
decorative: { type: Boolean, default: false }
|
|
569
|
+
},
|
|
570
|
+
setup(__props) {
|
|
571
|
+
const props = __props;
|
|
572
|
+
const l10n = useLocaleText(props, "loader");
|
|
573
|
+
const NAMED = { small: 24, medium: 40, large: 64 };
|
|
574
|
+
const pixels = computed(() => {
|
|
575
|
+
const fallback = props.variant === "dots" ? 80 : 40;
|
|
576
|
+
const size = props.size;
|
|
577
|
+
if (typeof size === "number") {
|
|
578
|
+
return size > 0 ? size : fallback;
|
|
579
|
+
}
|
|
580
|
+
if (size === void 0 || size === "") {
|
|
581
|
+
return fallback;
|
|
582
|
+
}
|
|
583
|
+
return NAMED[size] ?? (parseInt(size, 10) || fallback);
|
|
584
|
+
});
|
|
585
|
+
const rootStyle = computed(() => ({
|
|
586
|
+
"--_s": `${pixels.value}px`,
|
|
587
|
+
...props.color ? { "--_color": props.color } : {}
|
|
588
|
+
}));
|
|
589
|
+
return (_ctx, _cache) => {
|
|
590
|
+
return openBlock(), createElementBlock("div", {
|
|
591
|
+
class: normalizeClass(["tao-loader", [unref(toneClass)(__props.tone), `tao-loader--${__props.variant}`, { "tao-loader--inline": __props.inline }]]),
|
|
592
|
+
style: normalizeStyle(rootStyle.value),
|
|
593
|
+
role: __props.decorative ? void 0 : "status",
|
|
594
|
+
"aria-hidden": __props.decorative ? "true" : void 0
|
|
595
|
+
}, [
|
|
596
|
+
__props.variant === "dots" ? (openBlock(), createElementBlock("div", _hoisted_2$Y, [..._cache[0] || (_cache[0] = [
|
|
597
|
+
createElementVNode("div", null, null, -1),
|
|
598
|
+
createElementVNode("div", null, null, -1),
|
|
599
|
+
createElementVNode("div", null, null, -1),
|
|
600
|
+
createElementVNode("div", null, null, -1)
|
|
601
|
+
])])) : __props.variant === "ring" ? (openBlock(), createElementBlock("span", _hoisted_3$Q)) : (openBlock(), createElementBlock("span", _hoisted_4$F)),
|
|
602
|
+
!__props.decorative ? (openBlock(), createElementBlock("span", _hoisted_5$v, toDisplayString(unref(l10n).label), 1)) : createCommentVNode("", true)
|
|
603
|
+
], 14, _hoisted_1$16);
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
const TaoLoader = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__scopeId", "data-v-77dd8549"]]);
|
|
608
|
+
const _hoisted_1$15 = ["type", "aria-pressed", "aria-keyshortcuts", "aria-busy", "disabled"];
|
|
609
|
+
const _hoisted_2$X = {
|
|
610
|
+
key: 2,
|
|
611
|
+
class: "tao-button__content"
|
|
612
|
+
};
|
|
613
|
+
const _hoisted_3$P = {
|
|
614
|
+
key: 4,
|
|
615
|
+
class: "tao-button__shortcut",
|
|
616
|
+
"aria-hidden": "true"
|
|
617
|
+
};
|
|
618
|
+
const _sfc_main$1g = /* @__PURE__ */ defineComponent({
|
|
619
|
+
...{ name: "TaoButton" },
|
|
620
|
+
__name: "TaoButton",
|
|
621
|
+
props: {
|
|
622
|
+
type: { default: "button" },
|
|
623
|
+
size: {},
|
|
624
|
+
variant: { default: "primary" },
|
|
625
|
+
tone: { default: void 0 },
|
|
626
|
+
disabled: { type: Boolean, default: false },
|
|
627
|
+
loading: { type: Boolean, default: false },
|
|
628
|
+
block: { type: Boolean, default: false },
|
|
629
|
+
icon: { default: "" },
|
|
630
|
+
iconEnd: { default: "" },
|
|
631
|
+
minWidth: { default: void 0 },
|
|
632
|
+
pressed: { type: Boolean, default: void 0 },
|
|
633
|
+
shortcut: { default: void 0 }
|
|
634
|
+
},
|
|
635
|
+
emits: ["click", "update:pressed"],
|
|
636
|
+
setup(__props, { emit: __emit }) {
|
|
637
|
+
const props = __props;
|
|
638
|
+
const minWidthStyle = computed(
|
|
639
|
+
() => props.minWidth === void 0 ? void 0 : { "--tao-button-min-width": typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth }
|
|
640
|
+
);
|
|
641
|
+
const emit = __emit;
|
|
642
|
+
const slots = useSlots();
|
|
643
|
+
const attrs = useAttrs();
|
|
644
|
+
const iconOnly = computed(() => Boolean(props.icon || props.iconEnd) && !slots.default);
|
|
645
|
+
if (iconOnly.value && !attrs["aria-label"] && !attrs["aria-labelledby"] && !attrs.title) {
|
|
646
|
+
devWarning("button:icon-only", "TaoButton: a button with only an icon needs aria-label (or aria-labelledby / title).");
|
|
647
|
+
}
|
|
648
|
+
function handleClick(event) {
|
|
649
|
+
if (!props.disabled && !props.loading) {
|
|
650
|
+
emit("click", event);
|
|
651
|
+
if (props.pressed !== void 0) {
|
|
652
|
+
emit("update:pressed", !props.pressed);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
795
655
|
}
|
|
656
|
+
return (_ctx, _cache) => {
|
|
657
|
+
return openBlock(), createElementBlock("button", {
|
|
658
|
+
class: normalizeClass(["tao-button", [
|
|
659
|
+
unref(sizeClass)(__props.size),
|
|
660
|
+
unref(toneClass)(__props.tone),
|
|
661
|
+
`tao-button--${__props.variant}`,
|
|
662
|
+
{
|
|
663
|
+
"tao-button--disabled": __props.disabled,
|
|
664
|
+
"tao-button--loading": __props.loading,
|
|
665
|
+
"tao-button--block": __props.block,
|
|
666
|
+
"tao-button--icon-only": iconOnly.value,
|
|
667
|
+
"tao-button--toned": !!__props.tone && __props.tone !== "accent",
|
|
668
|
+
"tao-button--pressed": __props.pressed === true
|
|
669
|
+
}
|
|
670
|
+
]]),
|
|
671
|
+
style: normalizeStyle(minWidthStyle.value),
|
|
672
|
+
type: __props.type,
|
|
673
|
+
"aria-pressed": __props.pressed === void 0 ? void 0 : __props.pressed,
|
|
674
|
+
"aria-keyshortcuts": __props.shortcut || void 0,
|
|
675
|
+
"aria-busy": __props.loading || void 0,
|
|
676
|
+
disabled: __props.disabled || __props.loading,
|
|
677
|
+
onClick: handleClick
|
|
678
|
+
}, [
|
|
679
|
+
__props.loading ? (openBlock(), createBlock(TaoLoader, {
|
|
680
|
+
key: 0,
|
|
681
|
+
class: "tao-button__loader",
|
|
682
|
+
variant: "ring",
|
|
683
|
+
size: 16,
|
|
684
|
+
color: "currentColor",
|
|
685
|
+
decorative: ""
|
|
686
|
+
})) : createCommentVNode("", true),
|
|
687
|
+
__props.icon ? (openBlock(), createBlock(TaoIcon, {
|
|
688
|
+
key: 1,
|
|
689
|
+
class: "tao-button__icon",
|
|
690
|
+
name: __props.icon
|
|
691
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
692
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2$X, [
|
|
693
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
694
|
+
])) : createCommentVNode("", true),
|
|
695
|
+
__props.iconEnd ? (openBlock(), createBlock(TaoIcon, {
|
|
696
|
+
key: 3,
|
|
697
|
+
class: "tao-button__icon",
|
|
698
|
+
name: __props.iconEnd
|
|
699
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
700
|
+
__props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_3$P, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)
|
|
701
|
+
], 14, _hoisted_1$15);
|
|
702
|
+
};
|
|
796
703
|
}
|
|
797
|
-
|
|
704
|
+
});
|
|
705
|
+
const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__scopeId", "data-v-278f587a"]]);
|
|
706
|
+
function toCssLength(value) {
|
|
707
|
+
if (value === void 0 || value === null || value === "") {
|
|
708
|
+
return void 0;
|
|
709
|
+
}
|
|
710
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
798
711
|
}
|
|
799
|
-
function
|
|
800
|
-
|
|
801
|
-
configureToastDefaults({ closeLabel: current.value.toast.closeLabel });
|
|
802
|
-
configureConfirmDefaults({ ok: current.value.confirm.ok, cancel: current.value.confirm.cancel });
|
|
712
|
+
function toCssBox(value) {
|
|
713
|
+
return Array.isArray(value) ? value.map((part) => toCssLength(part) ?? "0").join(" ") : toCssLength(value);
|
|
803
714
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
715
|
+
function stripeClasses(stripe, tone = "accent") {
|
|
716
|
+
if (!stripe) {
|
|
717
|
+
return [];
|
|
718
|
+
}
|
|
719
|
+
return [`tao-stripe-${stripe}`, tone === "gradient" ? "tao-stripe-gradient" : toneClass(tone)];
|
|
806
720
|
}
|
|
807
|
-
function
|
|
808
|
-
|
|
721
|
+
function surfaceClass(surface) {
|
|
722
|
+
return surface && surface !== "flat" ? `tao-surface-${surface}` : void 0;
|
|
809
723
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
724
|
+
const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
725
|
+
...{ name: "TaoBlock" },
|
|
726
|
+
__name: "TaoBlock",
|
|
727
|
+
props: {
|
|
728
|
+
padding: { default: void 0 },
|
|
729
|
+
radius: { default: void 0 },
|
|
730
|
+
shadow: { type: Boolean, default: true },
|
|
731
|
+
hover: { type: Boolean, default: false },
|
|
732
|
+
surface: { default: "flat" },
|
|
733
|
+
stripe: { default: void 0 },
|
|
734
|
+
stripeTone: { default: "accent" }
|
|
735
|
+
},
|
|
736
|
+
setup(__props) {
|
|
737
|
+
const props = __props;
|
|
738
|
+
const panelStyle = computed(() => {
|
|
739
|
+
const pad = props.padding;
|
|
740
|
+
const first = Array.isArray(pad) ? pad[0] : pad;
|
|
741
|
+
return {
|
|
742
|
+
padding: pad === void 0 ? void 0 : toCssBox(pad),
|
|
743
|
+
"--tao-pad": first === void 0 ? void 0 : toCssLength(first),
|
|
744
|
+
"--tao-radius": toCssLength(props.radius)
|
|
745
|
+
};
|
|
746
|
+
});
|
|
747
|
+
return (_ctx, _cache) => {
|
|
748
|
+
return openBlock(), createElementBlock("div", {
|
|
749
|
+
class: normalizeClass(["tao-block tao-panel", [unref(surfaceClass)(__props.surface), unref(stripeClasses)(__props.stripe, __props.stripeTone), { "tao-block--shadow": __props.shadow, "tao-block--hover": __props.hover }]]),
|
|
750
|
+
style: normalizeStyle(panelStyle.value)
|
|
751
|
+
}, [
|
|
752
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
753
|
+
], 6);
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__scopeId", "data-v-1fc66575"]]);
|
|
758
|
+
function useControlAttrs() {
|
|
759
|
+
const attrs = useAttrs();
|
|
760
|
+
return {
|
|
761
|
+
/** `class` and `style`, for the wrapper. / `class` и `style` — для обёртки. */
|
|
762
|
+
rootAttrs: () => ({ class: attrs.class, style: attrs.style }),
|
|
763
|
+
/** Everything else, for the control. / Всё остальное — для элемента управления. */
|
|
764
|
+
controlAttrs: () => {
|
|
765
|
+
const { class: _class, style: _style, ...rest } = attrs;
|
|
766
|
+
return rest;
|
|
767
|
+
}
|
|
768
|
+
};
|
|
813
769
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
770
|
+
const formFieldKey = Symbol("taoFormField");
|
|
771
|
+
function useField(props) {
|
|
772
|
+
const field = inject(formFieldKey, null);
|
|
773
|
+
const localId = useId();
|
|
774
|
+
const controlId = computed(() => props.id || field?.id || localId);
|
|
775
|
+
const invalid = computed(() => Boolean(props.error) || Boolean(field?.invalid.value));
|
|
776
|
+
const describedBy = computed(() => field?.describedBy.value);
|
|
777
|
+
return { field, controlId, invalid, describedBy, localId };
|
|
778
|
+
}
|
|
779
|
+
const _hoisted_1$14 = {
|
|
780
|
+
key: 0,
|
|
781
|
+
class: "tao-input__affix tao-input__affix--prefix"
|
|
782
|
+
};
|
|
783
|
+
const _hoisted_2$W = ["id", "type", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby"];
|
|
784
|
+
const _hoisted_3$O = {
|
|
785
|
+
key: 1,
|
|
786
|
+
class: "tao-input__affix tao-input__affix--suffix"
|
|
787
|
+
};
|
|
788
|
+
const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
789
|
+
...{ name: "TaoInput", inheritAttrs: false },
|
|
790
|
+
__name: "TaoInput",
|
|
791
|
+
props: {
|
|
792
|
+
modelValue: { default: "" },
|
|
793
|
+
type: { default: "text" },
|
|
794
|
+
placeholder: { default: "" },
|
|
795
|
+
disabled: { type: Boolean, default: false },
|
|
796
|
+
size: {},
|
|
797
|
+
error: { type: Boolean, default: false },
|
|
798
|
+
variant: { default: "outline" },
|
|
799
|
+
id: {}
|
|
800
|
+
},
|
|
801
|
+
emits: ["update:modelValue", "blur", "focus"],
|
|
802
|
+
setup(__props, { emit: __emit }) {
|
|
803
|
+
const { rootAttrs, controlAttrs } = useControlAttrs();
|
|
804
|
+
const props = __props;
|
|
805
|
+
const { controlId, invalid, describedBy } = useField(props);
|
|
806
|
+
const focused = ref(false);
|
|
807
|
+
const emit = __emit;
|
|
808
|
+
function handleInput(event) {
|
|
809
|
+
const target = event.target;
|
|
810
|
+
emit("update:modelValue", target.value);
|
|
811
|
+
}
|
|
812
|
+
function handleBlur(event) {
|
|
813
|
+
focused.value = false;
|
|
814
|
+
emit("blur", event);
|
|
815
|
+
}
|
|
816
|
+
function handleFocus(event) {
|
|
817
|
+
focused.value = true;
|
|
818
|
+
emit("focus", event);
|
|
819
|
+
}
|
|
820
|
+
return (_ctx, _cache) => {
|
|
821
|
+
return openBlock(), createElementBlock("div", mergeProps(unref(rootAttrs)(), {
|
|
822
|
+
class: ["tao-input-wrapper", unref(sizeClass)(__props.size)]
|
|
823
|
+
}), [
|
|
824
|
+
createElementVNode("div", {
|
|
825
|
+
class: normalizeClass(["tao-input-shell", {
|
|
826
|
+
[`tao-input-shell--${__props.variant}`]: __props.variant !== "outline",
|
|
827
|
+
"tao-input-shell--focused": focused.value,
|
|
828
|
+
"tao-input-shell--invalid": unref(invalid),
|
|
829
|
+
"tao-input-shell--disabled": __props.disabled,
|
|
830
|
+
"tao-input-shell--prefix": _ctx.$slots.prefix,
|
|
831
|
+
"tao-input-shell--suffix": _ctx.$slots.suffix
|
|
832
|
+
}])
|
|
833
|
+
}, [
|
|
834
|
+
_ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_1$14, [
|
|
835
|
+
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
|
|
836
|
+
])) : createCommentVNode("", true),
|
|
837
|
+
createElementVNode("input", mergeProps(unref(controlAttrs)(), {
|
|
838
|
+
id: unref(controlId),
|
|
839
|
+
class: ["tao-input", { "tao-input--error": unref(invalid) }],
|
|
840
|
+
type: __props.type,
|
|
841
|
+
value: __props.modelValue,
|
|
842
|
+
placeholder: __props.placeholder,
|
|
843
|
+
disabled: __props.disabled,
|
|
844
|
+
"aria-invalid": unref(invalid) || void 0,
|
|
845
|
+
"aria-describedby": unref(describedBy),
|
|
846
|
+
onInput: handleInput,
|
|
847
|
+
onBlur: handleBlur,
|
|
848
|
+
onFocus: handleFocus
|
|
849
|
+
}), null, 16, _hoisted_2$W),
|
|
850
|
+
_ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_3$O, [
|
|
851
|
+
renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
|
|
852
|
+
])) : createCommentVNode("", true)
|
|
853
|
+
], 2)
|
|
854
|
+
], 16);
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
const TaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__scopeId", "data-v-5b617319"]]);
|
|
859
|
+
const _hoisted_1$13 = {
|
|
860
|
+
key: 0,
|
|
861
|
+
class: "tao-input-group__addon tao-input-group__addon--before"
|
|
862
|
+
};
|
|
863
|
+
const _hoisted_2$V = { class: "tao-input-group__field" };
|
|
864
|
+
const _hoisted_3$N = {
|
|
865
|
+
key: 1,
|
|
866
|
+
class: "tao-input-group__addon tao-input-group__addon--after"
|
|
867
|
+
};
|
|
868
|
+
const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
869
|
+
...{ name: "TaoInputGroup" },
|
|
870
|
+
__name: "TaoInputGroup",
|
|
871
|
+
props: {
|
|
872
|
+
size: {}
|
|
873
|
+
},
|
|
874
|
+
setup(__props) {
|
|
875
|
+
const focused = ref(false);
|
|
876
|
+
function onFocusIn() {
|
|
877
|
+
focused.value = true;
|
|
878
|
+
}
|
|
879
|
+
function onFocusOut(event) {
|
|
880
|
+
const root = event.currentTarget;
|
|
881
|
+
const next = event.relatedTarget;
|
|
882
|
+
if (!next || !root.contains(next)) {
|
|
883
|
+
focused.value = false;
|
|
823
884
|
}
|
|
824
885
|
}
|
|
825
|
-
return
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
886
|
+
return (_ctx, _cache) => {
|
|
887
|
+
return openBlock(), createElementBlock("div", {
|
|
888
|
+
class: normalizeClass(["tao-input-group", [unref(sizeClass)(__props.size), { "tao-input-group--focused": focused.value }]]),
|
|
889
|
+
role: "group",
|
|
890
|
+
onFocusin: onFocusIn,
|
|
891
|
+
onFocusout: onFocusOut
|
|
892
|
+
}, [
|
|
893
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_1$13, [
|
|
894
|
+
renderSlot(_ctx.$slots, "before", {}, void 0, true)
|
|
895
|
+
])) : createCommentVNode("", true),
|
|
896
|
+
createElementVNode("div", _hoisted_2$V, [
|
|
897
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
898
|
+
]),
|
|
899
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_3$N, [
|
|
900
|
+
renderSlot(_ctx.$slots, "after", {}, void 0, true)
|
|
901
|
+
])) : createCommentVNode("", true)
|
|
902
|
+
], 34);
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
const TaoInputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-55b2d297"]]);
|
|
831
907
|
const _hoisted_1$12 = ["id", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
|
|
832
908
|
const _hoisted_2$U = {
|
|
833
909
|
key: 0,
|
|
@@ -835,9 +911,9 @@ const _hoisted_2$U = {
|
|
|
835
911
|
};
|
|
836
912
|
const _hoisted_3$M = ["aria-label", "disabled"];
|
|
837
913
|
const _hoisted_4$E = { "aria-hidden": "true" };
|
|
838
|
-
const _hoisted_5$
|
|
914
|
+
const _hoisted_5$u = ["aria-label", "disabled"];
|
|
839
915
|
const _hoisted_6$o = { "aria-hidden": "true" };
|
|
840
|
-
const _sfc_main$
|
|
916
|
+
const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
841
917
|
...{ name: "TaoInputNumber", inheritAttrs: false },
|
|
842
918
|
__name: "TaoInputNumber",
|
|
843
919
|
props: {
|
|
@@ -1025,19 +1101,19 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
1025
1101
|
createVNode(TaoIcon, { name: "tao-minus" })
|
|
1026
1102
|
], true)
|
|
1027
1103
|
])
|
|
1028
|
-
], 8, _hoisted_5$
|
|
1104
|
+
], 8, _hoisted_5$u)
|
|
1029
1105
|
])) : createCommentVNode("", true)
|
|
1030
1106
|
], 16);
|
|
1031
1107
|
};
|
|
1032
1108
|
}
|
|
1033
1109
|
});
|
|
1034
|
-
const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1110
|
+
const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__scopeId", "data-v-dc5bb759"]]);
|
|
1035
1111
|
const _hoisted_1$11 = ["aria-label", "disabled"];
|
|
1036
1112
|
const _hoisted_2$T = { "aria-hidden": "true" };
|
|
1037
1113
|
const _hoisted_3$L = ["id", "value", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
|
|
1038
1114
|
const _hoisted_4$D = ["aria-label", "disabled"];
|
|
1039
|
-
const _hoisted_5$
|
|
1040
|
-
const _sfc_main$
|
|
1115
|
+
const _hoisted_5$t = { "aria-hidden": "true" };
|
|
1116
|
+
const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
1041
1117
|
...{ name: "TaoQuantity", inheritAttrs: false },
|
|
1042
1118
|
__name: "TaoQuantity",
|
|
1043
1119
|
props: {
|
|
@@ -1210,7 +1286,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
1210
1286
|
disabled: plusDisabled.value,
|
|
1211
1287
|
onClick: onInc
|
|
1212
1288
|
}, [
|
|
1213
|
-
createElementVNode("span", _hoisted_5$
|
|
1289
|
+
createElementVNode("span", _hoisted_5$t, [
|
|
1214
1290
|
renderSlot(_ctx.$slots, "increment-icon", {}, () => [
|
|
1215
1291
|
createVNode(TaoIcon, { name: "tao-plus" })
|
|
1216
1292
|
], true)
|
|
@@ -1220,7 +1296,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
1220
1296
|
};
|
|
1221
1297
|
}
|
|
1222
1298
|
});
|
|
1223
|
-
const TaoQuantity = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1299
|
+
const TaoQuantity = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__scopeId", "data-v-6453479c"]]);
|
|
1224
1300
|
const _hoisted_1$10 = {
|
|
1225
1301
|
key: 0,
|
|
1226
1302
|
class: "tao-card__media"
|
|
@@ -1237,7 +1313,7 @@ const _hoisted_4$C = {
|
|
|
1237
1313
|
key: 0,
|
|
1238
1314
|
class: "tao-card__header"
|
|
1239
1315
|
};
|
|
1240
|
-
const _hoisted_5$
|
|
1316
|
+
const _hoisted_5$s = {
|
|
1241
1317
|
key: 1,
|
|
1242
1318
|
class: "tao-card__title-block"
|
|
1243
1319
|
};
|
|
@@ -1262,7 +1338,7 @@ const _hoisted_10$4 = {
|
|
|
1262
1338
|
class: "tao-card__corner"
|
|
1263
1339
|
};
|
|
1264
1340
|
const _hoisted_11$4 = ["aria-label"];
|
|
1265
|
-
const _sfc_main$
|
|
1341
|
+
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
1266
1342
|
...{ name: "TaoCard" },
|
|
1267
1343
|
__name: "TaoCard",
|
|
1268
1344
|
props: {
|
|
@@ -1331,7 +1407,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
1331
1407
|
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_4$C, [
|
|
1332
1408
|
renderSlot(_ctx.$slots, "header", {}, void 0, true)
|
|
1333
1409
|
])) : createCommentVNode("", true),
|
|
1334
|
-
_ctx.$slots.title || _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
1410
|
+
_ctx.$slots.title || _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_5$s, [
|
|
1335
1411
|
_ctx.$slots.title ? (openBlock(), createElementBlock("h2", _hoisted_6$n, [
|
|
1336
1412
|
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
1337
1413
|
])) : createCommentVNode("", true),
|
|
@@ -1365,7 +1441,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
|
|
|
1365
1441
|
};
|
|
1366
1442
|
}
|
|
1367
1443
|
});
|
|
1368
|
-
const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1444
|
+
const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-72c9a80f"]]);
|
|
1369
1445
|
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1370
1446
|
function getFocusable(root) {
|
|
1371
1447
|
return [...root.querySelectorAll(FOCUSABLE)].filter(
|
|
@@ -1494,14 +1570,14 @@ const _hoisted_2$R = {
|
|
|
1494
1570
|
};
|
|
1495
1571
|
const _hoisted_3$J = ["id"];
|
|
1496
1572
|
const _hoisted_4$B = { key: 1 };
|
|
1497
|
-
const _hoisted_5$
|
|
1573
|
+
const _hoisted_5$r = ["aria-label"];
|
|
1498
1574
|
const _hoisted_6$m = { "aria-hidden": "true" };
|
|
1499
1575
|
const _hoisted_7$h = { class: "tao-modal__content" };
|
|
1500
1576
|
const _hoisted_8$b = {
|
|
1501
1577
|
key: 1,
|
|
1502
1578
|
class: "tao-modal__footer"
|
|
1503
1579
|
};
|
|
1504
|
-
const _sfc_main$
|
|
1580
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
1505
1581
|
...{ name: "TaoModal", inheritAttrs: false },
|
|
1506
1582
|
__name: "TaoModal",
|
|
1507
1583
|
props: {
|
|
@@ -1603,7 +1679,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
1603
1679
|
createVNode(TaoIcon, { name: "tao-close" })
|
|
1604
1680
|
], true)
|
|
1605
1681
|
])
|
|
1606
|
-
], 8, _hoisted_5$
|
|
1682
|
+
], 8, _hoisted_5$r)) : createCommentVNode("", true)
|
|
1607
1683
|
])) : createCommentVNode("", true),
|
|
1608
1684
|
createElementVNode("div", _hoisted_7$h, [
|
|
1609
1685
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
@@ -1619,137 +1695,518 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
1619
1695
|
]);
|
|
1620
1696
|
};
|
|
1621
1697
|
}
|
|
1622
|
-
});
|
|
1623
|
-
const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1624
|
-
const _hoisted_1$_ = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
|
|
1625
|
-
const _hoisted_2$Q = ["id", "aria-labelledby"];
|
|
1626
|
-
const _sfc_main$
|
|
1627
|
-
...{ name: "TaoTabs" },
|
|
1628
|
-
__name: "TaoTabs",
|
|
1629
|
-
props: {
|
|
1630
|
-
items: { default: void 0 },
|
|
1631
|
-
modelValue: {},
|
|
1632
|
-
justify: { default: void 0 },
|
|
1633
|
-
size: {}
|
|
1634
|
-
},
|
|
1635
|
-
emits: ["update:modelValue", "change"],
|
|
1636
|
-
setup(__props, { emit: __emit }) {
|
|
1637
|
-
const props = __props;
|
|
1638
|
-
const emit = __emit;
|
|
1639
|
-
const uid = useId();
|
|
1640
|
-
const list = computed(() => props.items ?? []);
|
|
1641
|
-
const enabledTabs = computed(() => list.value.filter((tab) => !tab.disabled));
|
|
1642
|
-
function tabId(key) {
|
|
1643
|
-
return `${uid}-${key}`;
|
|
1698
|
+
});
|
|
1699
|
+
const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__scopeId", "data-v-ea0d125e"]]);
|
|
1700
|
+
const _hoisted_1$_ = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
|
|
1701
|
+
const _hoisted_2$Q = ["id", "aria-labelledby"];
|
|
1702
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
1703
|
+
...{ name: "TaoTabs" },
|
|
1704
|
+
__name: "TaoTabs",
|
|
1705
|
+
props: {
|
|
1706
|
+
items: { default: void 0 },
|
|
1707
|
+
modelValue: {},
|
|
1708
|
+
justify: { default: void 0 },
|
|
1709
|
+
size: {}
|
|
1710
|
+
},
|
|
1711
|
+
emits: ["update:modelValue", "change"],
|
|
1712
|
+
setup(__props, { emit: __emit }) {
|
|
1713
|
+
const props = __props;
|
|
1714
|
+
const emit = __emit;
|
|
1715
|
+
const uid = useId();
|
|
1716
|
+
const list = computed(() => props.items ?? []);
|
|
1717
|
+
const enabledTabs = computed(() => list.value.filter((tab) => !tab.disabled));
|
|
1718
|
+
function tabId(key) {
|
|
1719
|
+
return `${uid}-${key}`;
|
|
1720
|
+
}
|
|
1721
|
+
function panelId(key) {
|
|
1722
|
+
return `${uid}-panel-${key}`;
|
|
1723
|
+
}
|
|
1724
|
+
function selectTab(key, focus = false) {
|
|
1725
|
+
const tab = list.value.find((item) => item.value === key);
|
|
1726
|
+
if (tab && !tab.disabled) {
|
|
1727
|
+
emit("update:modelValue", key);
|
|
1728
|
+
if (key !== props.modelValue) {
|
|
1729
|
+
emit("change", key);
|
|
1730
|
+
}
|
|
1731
|
+
if (focus) {
|
|
1732
|
+
void nextTick(() => document.getElementById(tabId(key))?.focus());
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
function move(delta) {
|
|
1737
|
+
const enabled = enabledTabs.value;
|
|
1738
|
+
if (!enabled.length) {
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
const current2 = enabled.findIndex((tab) => tab.value === props.modelValue);
|
|
1742
|
+
const next = enabled[(current2 + delta + enabled.length) % enabled.length];
|
|
1743
|
+
selectTab(next.value, true);
|
|
1744
|
+
}
|
|
1745
|
+
function onKeydown2(event) {
|
|
1746
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
1747
|
+
event.preventDefault();
|
|
1748
|
+
move(1);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
1752
|
+
event.preventDefault();
|
|
1753
|
+
move(-1);
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
if (event.key === "Home") {
|
|
1757
|
+
event.preventDefault();
|
|
1758
|
+
const first = enabledTabs.value[0];
|
|
1759
|
+
selectTab(first ? first.value : props.modelValue, true);
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
if (event.key === "End") {
|
|
1763
|
+
event.preventDefault();
|
|
1764
|
+
const last = enabledTabs.value[enabledTabs.value.length - 1];
|
|
1765
|
+
selectTab(last ? last.value : props.modelValue, true);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return (_ctx, _cache) => {
|
|
1769
|
+
return openBlock(), createElementBlock("div", {
|
|
1770
|
+
class: normalizeClass(["tao-tabs", unref(sizeClass)(__props.size)])
|
|
1771
|
+
}, [
|
|
1772
|
+
createElementVNode("div", {
|
|
1773
|
+
class: "tao-tabs__list",
|
|
1774
|
+
style: normalizeStyle({ justifyContent: __props.justify }),
|
|
1775
|
+
role: "tablist",
|
|
1776
|
+
onKeydown: onKeydown2
|
|
1777
|
+
}, [
|
|
1778
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (tab) => {
|
|
1779
|
+
return openBlock(), createElementBlock("button", {
|
|
1780
|
+
key: tab.value,
|
|
1781
|
+
type: "button",
|
|
1782
|
+
class: "tao-tabs__tab",
|
|
1783
|
+
role: "tab",
|
|
1784
|
+
id: tabId(tab.value),
|
|
1785
|
+
"aria-selected": tab.value === __props.modelValue,
|
|
1786
|
+
"aria-controls": panelId(tab.value),
|
|
1787
|
+
tabindex: tab.value === __props.modelValue ? 0 : -1,
|
|
1788
|
+
disabled: tab.disabled,
|
|
1789
|
+
onClick: ($event) => selectTab(tab.value)
|
|
1790
|
+
}, [
|
|
1791
|
+
_ctx.$slots.label ? renderSlot(_ctx.$slots, "label", {
|
|
1792
|
+
text: tab.label,
|
|
1793
|
+
value: tab.value
|
|
1794
|
+
}, void 0, true, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1795
|
+
createTextVNode(toDisplayString(tab.label), 1)
|
|
1796
|
+
], 64))
|
|
1797
|
+
], 8, _hoisted_1$_);
|
|
1798
|
+
}), 128))
|
|
1799
|
+
], 36),
|
|
1800
|
+
createElementVNode("div", {
|
|
1801
|
+
class: "tao-tabs__content",
|
|
1802
|
+
role: "tabpanel",
|
|
1803
|
+
id: panelId(__props.modelValue),
|
|
1804
|
+
"aria-labelledby": tabId(__props.modelValue)
|
|
1805
|
+
}, [
|
|
1806
|
+
renderSlot(_ctx.$slots, "default", { activeTab: __props.modelValue }, void 0, true)
|
|
1807
|
+
], 8, _hoisted_2$Q)
|
|
1808
|
+
], 2);
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
const TaoTabs = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__scopeId", "data-v-70811078"]]);
|
|
1813
|
+
function listenFocusLoss(onLoss) {
|
|
1814
|
+
function onVisibilityChange() {
|
|
1815
|
+
if (document.hidden) {
|
|
1816
|
+
onLoss();
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
1820
|
+
window.addEventListener("blur", onLoss);
|
|
1821
|
+
window.addEventListener("pagehide", onLoss);
|
|
1822
|
+
return () => {
|
|
1823
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
1824
|
+
window.removeEventListener("blur", onLoss);
|
|
1825
|
+
window.removeEventListener("pagehide", onLoss);
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
const clamp$1 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
1829
|
+
const byte = (v) => Math.round(clamp$1(v, 0, 255));
|
|
1830
|
+
const hex2 = (v) => byte(v).toString(16).padStart(2, "0");
|
|
1831
|
+
function channel(text, scale) {
|
|
1832
|
+
const t = text.trim();
|
|
1833
|
+
return t.endsWith("%") ? parseFloat(t) / 100 * scale : parseFloat(t);
|
|
1834
|
+
}
|
|
1835
|
+
function parseColor(input) {
|
|
1836
|
+
const text = input.trim();
|
|
1837
|
+
const hex = /^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(text);
|
|
1838
|
+
if (hex) {
|
|
1839
|
+
let h = hex[1];
|
|
1840
|
+
if (h.length <= 4) h = [...h].map((c) => c + c).join("");
|
|
1841
|
+
const n = (i) => parseInt(h.slice(i, i + 2), 16);
|
|
1842
|
+
return { r: n(0), g: n(2), b: n(4), a: h.length === 8 ? n(6) / 255 : 1 };
|
|
1843
|
+
}
|
|
1844
|
+
const fn = /^(rgba?|hsla?)\(\s*([^)]+?)\s*\)$/i.exec(text);
|
|
1845
|
+
if (fn && fn[1].toLowerCase().startsWith("hsl")) {
|
|
1846
|
+
const [main, slash] = fn[2].split("/");
|
|
1847
|
+
const parts = main.trim().split(/[\s,]+/);
|
|
1848
|
+
const alphaText = slash !== void 0 ? slash : parts[3];
|
|
1849
|
+
if (parts.length < 3 || parts.length > (slash === void 0 ? 4 : 3)) return null;
|
|
1850
|
+
const h = parseFloat(parts[0]);
|
|
1851
|
+
const s = parseFloat(parts[1]) / 100;
|
|
1852
|
+
const l = parseFloat(parts[2]) / 100;
|
|
1853
|
+
const a = alphaText === void 0 ? 1 : channel(alphaText, 1);
|
|
1854
|
+
if ([h, s, l, a].some((v) => Number.isNaN(v))) return null;
|
|
1855
|
+
return { ...hslToRgb(h, s, l), a: clamp$1(a, 0, 1) };
|
|
1856
|
+
}
|
|
1857
|
+
if (fn) {
|
|
1858
|
+
const [main, slash] = fn[2].split("/");
|
|
1859
|
+
const parts = main.trim().split(/[\s,]+/);
|
|
1860
|
+
const alphaText = slash !== void 0 ? slash : parts[3];
|
|
1861
|
+
if (parts.length < 3 || parts.length > (slash === void 0 ? 4 : 3)) return null;
|
|
1862
|
+
const r = channel(parts[0], 255);
|
|
1863
|
+
const g = channel(parts[1], 255);
|
|
1864
|
+
const b = channel(parts[2], 255);
|
|
1865
|
+
const a = alphaText === void 0 ? 1 : channel(alphaText, 1);
|
|
1866
|
+
if ([r, g, b, a].some((v) => Number.isNaN(v))) return null;
|
|
1867
|
+
return { r: byte(r), g: byte(g), b: byte(b), a: clamp$1(a, 0, 1) };
|
|
1868
|
+
}
|
|
1869
|
+
return null;
|
|
1870
|
+
}
|
|
1871
|
+
function toHex(color, alpha = false) {
|
|
1872
|
+
const base = `#${hex2(color.r)}${hex2(color.g)}${hex2(color.b)}`;
|
|
1873
|
+
return alpha ? `${base}${hex2(clamp$1(color.a, 0, 1) * 255)}` : base;
|
|
1874
|
+
}
|
|
1875
|
+
function rgbToHsv(r, g, b) {
|
|
1876
|
+
const R = clamp$1(r, 0, 255) / 255;
|
|
1877
|
+
const G = clamp$1(g, 0, 255) / 255;
|
|
1878
|
+
const B = clamp$1(b, 0, 255) / 255;
|
|
1879
|
+
const max = Math.max(R, G, B);
|
|
1880
|
+
const d = max - Math.min(R, G, B);
|
|
1881
|
+
let h = 0;
|
|
1882
|
+
if (d > 0) {
|
|
1883
|
+
if (max === R) h = (G - B) / d % 6;
|
|
1884
|
+
else if (max === G) h = (B - R) / d + 2;
|
|
1885
|
+
else h = (R - G) / d + 4;
|
|
1886
|
+
h *= 60;
|
|
1887
|
+
if (h < 0) h += 360;
|
|
1888
|
+
}
|
|
1889
|
+
return { h, s: max === 0 ? 0 : d / max, v: max };
|
|
1890
|
+
}
|
|
1891
|
+
function hsvToRgb(h, s, v) {
|
|
1892
|
+
const H = (h % 360 + 360) % 360 / 60;
|
|
1893
|
+
const S = clamp$1(s, 0, 1);
|
|
1894
|
+
const V = clamp$1(v, 0, 1);
|
|
1895
|
+
const f = (n) => {
|
|
1896
|
+
const k = (n + H) % 6;
|
|
1897
|
+
return V - V * S * Math.max(0, Math.min(k, 4 - k, 1));
|
|
1898
|
+
};
|
|
1899
|
+
return { r: f(5) * 255, g: f(3) * 255, b: f(1) * 255 };
|
|
1900
|
+
}
|
|
1901
|
+
function rgbToHsl(r, g, b) {
|
|
1902
|
+
const { h, s: sv, v } = rgbToHsv(r, g, b);
|
|
1903
|
+
const l = v * (1 - sv / 2);
|
|
1904
|
+
return { h, s: l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l), l };
|
|
1905
|
+
}
|
|
1906
|
+
function hslToRgb(h, s, l) {
|
|
1907
|
+
const S = clamp$1(s, 0, 1);
|
|
1908
|
+
const L = clamp$1(l, 0, 1);
|
|
1909
|
+
const v = L + S * Math.min(L, 1 - L);
|
|
1910
|
+
const rgb = hsvToRgb(h, v === 0 ? 0 : 2 * (1 - L / v), v);
|
|
1911
|
+
return { r: byte(rgb.r), g: byte(rgb.g), b: byte(rgb.b) };
|
|
1912
|
+
}
|
|
1913
|
+
const rgbaToHsva = (c) => ({ ...rgbToHsv(c.r, c.g, c.b), a: c.a });
|
|
1914
|
+
const hsvaToRgba = (c) => ({ ...hsvToRgb(c.h, c.s, c.v), a: c.a });
|
|
1915
|
+
const linearToSrgb = (c) => {
|
|
1916
|
+
const x = clamp$1(c, 0, 1);
|
|
1917
|
+
return x <= 31308e-7 ? x * 12.92 : 1.055 * Math.pow(x, 1 / 2.4) - 0.055;
|
|
1918
|
+
};
|
|
1919
|
+
const srgbToLinear = (c) => {
|
|
1920
|
+
const x = clamp$1(c, 0, 1);
|
|
1921
|
+
return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
|
1922
|
+
};
|
|
1923
|
+
function normalizeHex(input, alpha = false) {
|
|
1924
|
+
const c = parseColor(input);
|
|
1925
|
+
return c ? toHex(c, alpha) : null;
|
|
1926
|
+
}
|
|
1927
|
+
const WHITE = "#ffffff";
|
|
1928
|
+
const BLACK = "#0d0d0d";
|
|
1929
|
+
const toLinear = (hex) => {
|
|
1930
|
+
const c = parseColor(hex);
|
|
1931
|
+
if (!c) {
|
|
1932
|
+
throw new Error(`[TaoUI] palette: "${hex}" is not a colour`);
|
|
1933
|
+
}
|
|
1934
|
+
return [srgbToLinear(c.r / 255), srgbToLinear(c.g / 255), srgbToLinear(c.b / 255)];
|
|
1935
|
+
};
|
|
1936
|
+
function hexToOklch(hex) {
|
|
1937
|
+
const [r, g, b] = toLinear(hex);
|
|
1938
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
1939
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
1940
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
1941
|
+
const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
|
|
1942
|
+
const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
|
|
1943
|
+
const bb = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
|
|
1944
|
+
return { L, C: Math.hypot(a, bb), H: (Math.atan2(bb, a) * 180 / Math.PI + 360) % 360 };
|
|
1945
|
+
}
|
|
1946
|
+
function oklchToLinear({ L, C, H }) {
|
|
1947
|
+
const a = C * Math.cos(H * Math.PI / 180);
|
|
1948
|
+
const b = C * Math.sin(H * Math.PI / 180);
|
|
1949
|
+
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
1950
|
+
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
1951
|
+
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
1952
|
+
return [
|
|
1953
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
1954
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
1955
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
1956
|
+
];
|
|
1957
|
+
}
|
|
1958
|
+
const inGamut = (rgb) => rgb.every((v) => v >= -5e-4 && v <= 1.0005);
|
|
1959
|
+
function oklchToHex(color) {
|
|
1960
|
+
let { C } = color;
|
|
1961
|
+
let rgb = oklchToLinear({ ...color, C });
|
|
1962
|
+
if (!inGamut(rgb)) {
|
|
1963
|
+
let lo = 0;
|
|
1964
|
+
let hi = C;
|
|
1965
|
+
for (let i = 0; i < 24; i += 1) {
|
|
1966
|
+
const mid = (lo + hi) / 2;
|
|
1967
|
+
if (inGamut(oklchToLinear({ ...color, C: mid }))) {
|
|
1968
|
+
lo = mid;
|
|
1969
|
+
} else {
|
|
1970
|
+
hi = mid;
|
|
1971
|
+
}
|
|
1644
1972
|
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1973
|
+
C = lo;
|
|
1974
|
+
rgb = oklchToLinear({ ...color, C });
|
|
1975
|
+
}
|
|
1976
|
+
const [r, g, b] = rgb.map((v) => linearToSrgb(Math.min(Math.max(v, 0), 1)) * 255);
|
|
1977
|
+
return toHex({ r, g, b, a: 1 });
|
|
1978
|
+
}
|
|
1979
|
+
function luminance(hex) {
|
|
1980
|
+
const [r, g, b] = toLinear(hex);
|
|
1981
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
1982
|
+
}
|
|
1983
|
+
function contrastRatio(a, b) {
|
|
1984
|
+
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
1985
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
1986
|
+
}
|
|
1987
|
+
function colourDistance(a, b) {
|
|
1988
|
+
const p = hexToOklch(a);
|
|
1989
|
+
const q = hexToOklch(b);
|
|
1990
|
+
const pa = p.C * Math.cos(p.H * Math.PI / 180);
|
|
1991
|
+
const pb = p.C * Math.sin(p.H * Math.PI / 180);
|
|
1992
|
+
const qa = q.C * Math.cos(q.H * Math.PI / 180);
|
|
1993
|
+
const qb = q.C * Math.sin(q.H * Math.PI / 180);
|
|
1994
|
+
return Math.hypot(p.L - q.L, pa - qa, pb - qb);
|
|
1995
|
+
}
|
|
1996
|
+
const withL = (hex, L) => oklchToHex({ ...hexToOklch(hex), L: Math.min(Math.max(L, 0), 1) });
|
|
1997
|
+
function shiftUntil(hex, direction, ok) {
|
|
1998
|
+
const start = hexToOklch(hex);
|
|
1999
|
+
for (let i = 0; i <= 100; i += 1) {
|
|
2000
|
+
const candidate = oklchToHex({ ...start, L: Math.min(Math.max(start.L + direction * i * 5e-3, 0), 1) });
|
|
2001
|
+
if (ok(candidate)) {
|
|
2002
|
+
return candidate;
|
|
1647
2003
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
void nextTick(() => document.getElementById(tabId(key))?.focus());
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
2004
|
+
}
|
|
2005
|
+
return withL(hex, direction === 1 ? 1 : 0);
|
|
2006
|
+
}
|
|
2007
|
+
function apcaContrast(text, background) {
|
|
2008
|
+
const y = (hex) => {
|
|
2009
|
+
const c = parseColor(hex);
|
|
2010
|
+
if (!c) {
|
|
2011
|
+
throw new Error(`[TaoUI] palette: "${hex}" is not a colour`);
|
|
1659
2012
|
}
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
2013
|
+
const v = 0.2126729 * (c.r / 255) ** 2.4 + 0.7151522 * (c.g / 255) ** 2.4 + 0.072175 * (c.b / 255) ** 2.4;
|
|
2014
|
+
return v < 0.022 ? v + (0.022 - v) ** 1.414 : v;
|
|
2015
|
+
};
|
|
2016
|
+
const t = y(text);
|
|
2017
|
+
const b = y(background);
|
|
2018
|
+
const sapc = b > t ? (b ** 0.56 - t ** 0.57) * 1.14 : (b ** 0.65 - t ** 0.62) * 1.14;
|
|
2019
|
+
if (Math.abs(sapc) < 0.1) {
|
|
2020
|
+
return 0;
|
|
2021
|
+
}
|
|
2022
|
+
return (sapc > 0 ? sapc - 0.027 : sapc + 0.027) * 100;
|
|
2023
|
+
}
|
|
2024
|
+
const bestOn = (fill, dark) => dark ? contrastRatio(fill, WHITE) >= contrastRatio(fill, BLACK) ? WHITE : BLACK : Math.abs(apcaContrast(WHITE, fill)) >= Math.abs(apcaContrast(BLACK, fill)) ? WHITE : BLACK;
|
|
2025
|
+
const STATUS = {
|
|
2026
|
+
danger: { range: [8, 40], dark: "#dc3545", light: "#dc3545" },
|
|
2027
|
+
warning: { range: [78, 102], dark: "#d4a017", light: "#b8860b" },
|
|
2028
|
+
success: { range: [135, 168], dark: "#2ea85c", light: "#2ea85c" },
|
|
2029
|
+
info: { range: [232, 272], dark: "#6b9cff", light: "#4c82f7" }
|
|
2030
|
+
};
|
|
2031
|
+
const TAO_STATUS_NAMES = Object.keys(STATUS);
|
|
2032
|
+
const MIN_STATUS_DISTANCE = 0.09;
|
|
2033
|
+
const atmosphere = (dark) => `radial-gradient(ellipse 70% 50% at 75% 0%, color-mix(in srgb, var(--tao-glow) ${dark ? 18 : 10}%, transparent), transparent 70%), radial-gradient(ellipse 60% 45% at 5% 100%, color-mix(in srgb, var(--tao-glow) ${dark ? 10 : 6}%, transparent), transparent 70%)`;
|
|
2034
|
+
function buildPaletteRoles(def, mode) {
|
|
2035
|
+
const dark = mode === "dark";
|
|
2036
|
+
const stops = def.stops.map((s) => hexToOklch(s));
|
|
2037
|
+
const target = dark ? 0.74 : 0.52;
|
|
2038
|
+
const chromatic = stops.map((s, i) => ({ s, i })).filter(({ s }) => s.C >= 0.07);
|
|
2039
|
+
const pool = chromatic.length ? chromatic : stops.map((s, i) => ({ s, i }));
|
|
2040
|
+
const picked = def.accent !== void 0 ? { s: stops[def.accent], i: def.accent } : pool.reduce((best, c) => {
|
|
2041
|
+
const d = Math.abs(c.s.L - target) - c.s.C * 0.15;
|
|
2042
|
+
const bd = Math.abs(best.s.L - target) - best.s.C * 0.15;
|
|
2043
|
+
return d < bd ? c : best;
|
|
2044
|
+
}, pool[0]);
|
|
2045
|
+
const stopHex = def.stops[picked.i];
|
|
2046
|
+
const darkest = stops.reduce((best, s) => s.L < best.L ? s : best, stops[0]);
|
|
2047
|
+
const tintHue = darkest.L < 0.36 && darkest.C >= 0.03 ? darkest.H : picked.s.H;
|
|
2048
|
+
const tint = dark ? { C: 0.028, H: tintHue } : { C: 0.01, H: tintHue };
|
|
2049
|
+
const surface = (L) => oklchToHex({ L, ...tint });
|
|
2050
|
+
const bg = surface(dark ? 0.175 : 0.995);
|
|
2051
|
+
const raised = surface(dark ? 0.225 : 0.965);
|
|
2052
|
+
const hover = surface(dark ? 0.275 : 0.915);
|
|
2053
|
+
const ink = (c) => Math.min(contrastRatio(c, bg), contrastRatio(c, raised));
|
|
2054
|
+
let accent = dark ? shiftUntil(stopHex, 1, (c) => ink(c) >= 3.2) : shiftUntil(stopHex, -1, (c) => ink(c) >= 3.2);
|
|
2055
|
+
let onAccent = bestOn(accent, dark);
|
|
2056
|
+
if (contrastRatio(accent, onAccent) < 4.5) {
|
|
2057
|
+
const toward = onAccent === WHITE ? -1 : 1;
|
|
2058
|
+
accent = shiftUntil(accent, toward, (c) => contrastRatio(c, onAccent) >= 4.5);
|
|
2059
|
+
}
|
|
2060
|
+
const accentText = dark ? shiftUntil(accent, 1, (c) => ink(c) >= 4.6) : shiftUntil(accent, -1, (c) => ink(c) >= 4.6);
|
|
2061
|
+
const away = onAccent === WHITE ? -1 : 1;
|
|
2062
|
+
const accentHover = shiftUntil(accent, away, (c) => hexToOklch(c).L * away >= hexToOklch(accent).L * away + 0.04);
|
|
2063
|
+
const accentActive = shiftUntil(accent, away, (c) => hexToOklch(c).L * away >= hexToOklch(accent).L * away + 0.08);
|
|
2064
|
+
const accentTextHover = shiftUntil(accentText, dark ? 1 : -1, (c) => Math.abs(hexToOklch(c).L - hexToOklch(accentText).L) >= 0.05);
|
|
2065
|
+
const accentOk = hexToOklch(accent);
|
|
2066
|
+
const others = chromatic.filter(({ i }) => i !== picked.i);
|
|
2067
|
+
const second = others.length ? others.reduce((best, c) => Math.abs(c.s.L - picked.s.L) > Math.abs(best.s.L - picked.s.L) ? best : c, others[0]) : picked;
|
|
2068
|
+
const accent2 = dark ? shiftUntil(def.stops[second.i], 1, (c) => ink(c) >= 3.2) : shiftUntil(def.stops[second.i], -1, (c) => ink(c) >= 3.2);
|
|
2069
|
+
const status = {};
|
|
2070
|
+
const statusRoles = {};
|
|
2071
|
+
for (const name of TAO_STATUS_NAMES) {
|
|
2072
|
+
const info = STATUS[name];
|
|
2073
|
+
const base = hexToOklch(dark ? info.dark : info.light);
|
|
2074
|
+
const [lo, hi] = info.range;
|
|
2075
|
+
const clampHue = (h) => Math.min(Math.max(h, lo), hi);
|
|
2076
|
+
const towards = (accentOk.H - base.H + 540) % 360 - 180;
|
|
2077
|
+
const own = def.status?.[name];
|
|
2078
|
+
const candidates = [];
|
|
2079
|
+
if (own) {
|
|
2080
|
+
candidates.push(hexToOklch(own));
|
|
2081
|
+
} else {
|
|
2082
|
+
const L0 = base.L * 0.65 + accentOk.L * 0.35;
|
|
2083
|
+
const C0 = Math.min(Math.max((base.C + accentOk.C) / 2, 0.1), 0.2);
|
|
2084
|
+
const nudged = clampHue(base.H + Math.min(Math.max(towards * 0.25, -8), 8));
|
|
2085
|
+
const hues = [nudged, lo, hi, (lo + hi) / 2, lo + (hi - lo) * 0.25, lo + (hi - lo) * 0.75];
|
|
2086
|
+
for (const dL of [0, 0.07, -0.07, 0.13, -0.13, 0.19, -0.19]) {
|
|
2087
|
+
for (const h of hues) {
|
|
2088
|
+
for (const k of [1, 1.25]) {
|
|
2089
|
+
candidates.push({ L: L0 + dL, C: C0 * k, H: h });
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
1664
2092
|
}
|
|
1665
|
-
const current2 = enabled.findIndex((tab) => tab.value === props.modelValue);
|
|
1666
|
-
const next = enabled[(current2 + delta + enabled.length) % enabled.length];
|
|
1667
|
-
selectTab(next.value, true);
|
|
1668
2093
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
event.preventDefault();
|
|
1677
|
-
move(-1);
|
|
1678
|
-
return;
|
|
2094
|
+
const fitted = (c) => {
|
|
2095
|
+
let fill2 = oklchToHex({ ...c, L: Math.min(Math.max(c.L, 0.3), 0.9) });
|
|
2096
|
+
fill2 = shiftUntil(fill2, dark ? 1 : -1, (x) => ink(x) >= 3.2);
|
|
2097
|
+
let on2 = bestOn(fill2, dark);
|
|
2098
|
+
if (contrastRatio(fill2, on2) < 4.5) {
|
|
2099
|
+
fill2 = shiftUntil(fill2, on2 === WHITE ? -1 : 1, (x) => contrastRatio(x, on2) >= 4.5);
|
|
2100
|
+
on2 = bestOn(fill2, dark);
|
|
1679
2101
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
2102
|
+
return { fill: fill2, on: on2, distance: colourDistance(fill2, accent) };
|
|
2103
|
+
};
|
|
2104
|
+
let best = null;
|
|
2105
|
+
for (const c of candidates) {
|
|
2106
|
+
const next = fitted(c);
|
|
2107
|
+
if (!best || next.distance > best.distance + 5e-3) {
|
|
2108
|
+
best = next;
|
|
1685
2109
|
}
|
|
1686
|
-
if (
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
selectTab(last ? last.value : props.modelValue, true);
|
|
2110
|
+
if (!own && next.distance >= MIN_STATUS_DISTANCE + 0.02) {
|
|
2111
|
+
best = next;
|
|
2112
|
+
break;
|
|
1690
2113
|
}
|
|
1691
2114
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
2115
|
+
const { fill, on } = best;
|
|
2116
|
+
const text = shiftUntil(fill, dark ? 1 : -1, (c) => ink(c) >= 4.6);
|
|
2117
|
+
const hoverStep = on === WHITE ? -1 : 1;
|
|
2118
|
+
const fillHover = shiftUntil(fill, hoverStep, (c) => Math.abs(hexToOklch(c).L - hexToOklch(fill).L) >= 0.04);
|
|
2119
|
+
status[name] = { fill, on, text, distance: colourDistance(fill, accent) };
|
|
2120
|
+
statusRoles[`--tao-color-${name}`] = fill;
|
|
2121
|
+
statusRoles[`--tao-color-${name}-hover`] = fillHover;
|
|
2122
|
+
statusRoles[`--tao-color-on-${name}`] = on;
|
|
2123
|
+
statusRoles[`--tao-color-${name}-text`] = text;
|
|
2124
|
+
statusRoles[`--tao-color-${name}-subtle`] = `color-mix(in srgb, var(--tao-color-${name}) ${dark ? 15 : name === "warning" || name === "info" ? 12 : 10}%, transparent)`;
|
|
2125
|
+
}
|
|
2126
|
+
const roles = {
|
|
2127
|
+
"--tao-color-accent": accent,
|
|
2128
|
+
"--tao-color-accent-hover": accentHover,
|
|
2129
|
+
"--tao-color-accent-active": accentActive,
|
|
2130
|
+
"--tao-color-accent-text": accentText,
|
|
2131
|
+
"--tao-color-accent-text-hover": accentTextHover,
|
|
2132
|
+
"--tao-color-on-accent": onAccent,
|
|
2133
|
+
"--tao-color-accent-2": accent2,
|
|
2134
|
+
"--tao-glow": accent,
|
|
2135
|
+
"--tao-gradient": `linear-gradient(90deg, ${def.stops.join(", ")})`,
|
|
2136
|
+
"--tao-color-bg": bg,
|
|
2137
|
+
"--tao-color-surface": bg,
|
|
2138
|
+
"--tao-color-surface-raised": raised,
|
|
2139
|
+
"--tao-color-surface-hover": hover,
|
|
2140
|
+
"--tao-color-link": dark ? accentText : "var(--tao-color-text-strong)",
|
|
2141
|
+
"--tao-color-link-hover": accentTextHover,
|
|
2142
|
+
// what is built from the roles above: written out, because a value declared on an ancestor is already
|
|
2143
|
+
// resolved when a nested element changes the palette
|
|
2144
|
+
"--tao-color-accent-subtle": `color-mix(in srgb, var(--tao-color-accent) ${dark ? 8 : 10}%, transparent)`,
|
|
2145
|
+
"--tao-color-accent-subtle-hover": `color-mix(in srgb, var(--tao-color-accent) ${dark ? 14 : 16}%, transparent)`,
|
|
2146
|
+
"--tao-color-selection": "var(--tao-color-accent)",
|
|
2147
|
+
"--tao-color-selection-text": "var(--tao-color-on-accent)",
|
|
2148
|
+
"--tao-color-link-shadow": dark ? "0 0 1px color-mix(in srgb, var(--tao-color-accent) 10%, transparent), 0 0 6px color-mix(in srgb, var(--tao-color-accent) 60%, transparent)" : "none",
|
|
2149
|
+
"--tao-glass-fill": dark ? "color-mix(in srgb, var(--tao-color-surface-raised) 55%, transparent)" : "color-mix(in srgb, var(--tao-color-surface) 60%, transparent)",
|
|
2150
|
+
"--tao-bg-atmosphere": atmosphere(dark),
|
|
2151
|
+
...statusRoles,
|
|
2152
|
+
// the series built on roles; violet and pink (chart-4, chart-6) are the theme's own, except that a palette
|
|
2153
|
+
// gives its second stop to chart-4: a violet accent would meet the fixed violet otherwise
|
|
2154
|
+
// серии на ролях; фиолетовый и розовый — свои у темы, только chart-4 палитра отдаёт второму стопу
|
|
2155
|
+
"--tao-color-chart-1": "var(--tao-color-accent)",
|
|
2156
|
+
"--tao-color-chart-2": "var(--tao-color-info)",
|
|
2157
|
+
"--tao-color-chart-3": "var(--tao-color-success)",
|
|
2158
|
+
"--tao-color-chart-4": "var(--tao-color-accent-2)",
|
|
2159
|
+
"--tao-color-chart-5": "var(--tao-color-warning)"
|
|
2160
|
+
};
|
|
2161
|
+
for (const name of TAO_STATUS_NAMES) {
|
|
2162
|
+
roles[`--tao-color-${name}-text-hover`] = `color-mix(in srgb, var(--tao-color-${name}-text) 85%, var(--tao-color-text-strong))`;
|
|
2163
|
+
}
|
|
2164
|
+
return { mode, roles, parts: { bg, raised, accent, accentText, onAccent, accentStop: picked.i, status } };
|
|
2165
|
+
}
|
|
2166
|
+
function paletteCss(def) {
|
|
2167
|
+
const block = (mode) => {
|
|
2168
|
+
const { roles } = buildPaletteRoles(def, mode);
|
|
2169
|
+
const selector = mode === "dark" ? `[data-tao-theme="${def.name}"]` : `[data-tao-theme="${def.name}"][data-tao-mode="light"]`;
|
|
2170
|
+
const lines = [
|
|
2171
|
+
` color-scheme: ${mode};`,
|
|
2172
|
+
...Object.entries(roles).map(([name, value]) => ` ${name}: ${value};`),
|
|
2173
|
+
` --tao-glass-border: ${glassBorder(mode)};`
|
|
2174
|
+
];
|
|
2175
|
+
return `${selector} {
|
|
2176
|
+
${lines.join("\n")}
|
|
2177
|
+
}
|
|
2178
|
+
`;
|
|
2179
|
+
};
|
|
2180
|
+
const header = [
|
|
2181
|
+
"/**",
|
|
2182
|
+
` * Tao UI palette: ${def.label} (${def.stops.join(" ")})`,
|
|
2183
|
+
" * Generated by `npm run palettes` from src/palettes.ts: edit the stops there, not this file.",
|
|
2184
|
+
" */"
|
|
2185
|
+
].join("\n");
|
|
2186
|
+
return `${header}
|
|
2187
|
+
${block("dark")}
|
|
2188
|
+
${block("light")}`;
|
|
2189
|
+
}
|
|
2190
|
+
const glassBorder = (mode) => mode === "dark" ? "rgb(255 255 255 / 0.08)" : "rgb(0 0 0 / 0.08)";
|
|
2191
|
+
function applyTaoPalette(def, mode, el) {
|
|
2192
|
+
const target = el ?? (typeof document === "undefined" ? void 0 : document.documentElement);
|
|
2193
|
+
if (!target) {
|
|
2194
|
+
return () => {
|
|
1733
2195
|
};
|
|
1734
2196
|
}
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
function onVisibilityChange() {
|
|
1739
|
-
if (document.hidden) {
|
|
1740
|
-
onLoss();
|
|
1741
|
-
}
|
|
2197
|
+
const all = { ...buildPaletteRoles(def, mode).roles, "--tao-glass-border": glassBorder(mode) };
|
|
2198
|
+
for (const [name, value] of Object.entries(all)) {
|
|
2199
|
+
target.style.setProperty(name, value);
|
|
1742
2200
|
}
|
|
1743
|
-
|
|
1744
|
-
window.addEventListener("blur", onLoss);
|
|
1745
|
-
window.addEventListener("pagehide", onLoss);
|
|
2201
|
+
target.style.colorScheme = mode;
|
|
1746
2202
|
return () => {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
2203
|
+
for (const name of Object.keys(all)) {
|
|
2204
|
+
target.style.removeProperty(name);
|
|
2205
|
+
}
|
|
2206
|
+
target.style.colorScheme = "";
|
|
1750
2207
|
};
|
|
1751
2208
|
}
|
|
1752
|
-
const clamp
|
|
2209
|
+
const clamp = (v, min, max) => Math.min(Math.max(v, min), max);
|
|
1753
2210
|
function decimalsOf(step) {
|
|
1754
2211
|
if (!Number.isFinite(step) || step <= 0) return 0;
|
|
1755
2212
|
const s = String(step);
|
|
@@ -1761,13 +2218,13 @@ const roundTo = (v, decimals) => {
|
|
|
1761
2218
|
return Math.round(v * k) / k + 0;
|
|
1762
2219
|
};
|
|
1763
2220
|
function ratioOf(value, min, max) {
|
|
1764
|
-
return max > min ? clamp
|
|
2221
|
+
return max > min ? clamp((value - min) / (max - min), 0, 1) : 0;
|
|
1765
2222
|
}
|
|
1766
2223
|
function valueAt(ratio, min, max, step) {
|
|
1767
|
-
const raw = min + clamp
|
|
1768
|
-
if (!(step > 0)) return clamp
|
|
2224
|
+
const raw = min + clamp(ratio, 0, 1) * (max - min);
|
|
2225
|
+
if (!(step > 0)) return clamp(raw, min, max);
|
|
1769
2226
|
const snapped = min + Math.round((raw - min) / step) * step;
|
|
1770
|
-
return clamp
|
|
2227
|
+
return clamp(roundTo(snapped, Math.max(decimalsOf(step), decimalsOf(min))), min, max);
|
|
1771
2228
|
}
|
|
1772
2229
|
function nearestMark(value, marks) {
|
|
1773
2230
|
let best = value;
|
|
@@ -1797,11 +2254,11 @@ function nearestThumb(values, target, last = 0) {
|
|
|
1797
2254
|
}
|
|
1798
2255
|
function moveThumb(values, index, next, min, max, gap = 0) {
|
|
1799
2256
|
const [a, b] = values;
|
|
1800
|
-
return index === 0 ? [clamp
|
|
2257
|
+
return index === 0 ? [clamp(next, min, Math.max(min, b - gap)), b] : [a, clamp(next, Math.min(max, a + gap), max)];
|
|
1801
2258
|
}
|
|
1802
2259
|
function normalizeValue(value, min, max) {
|
|
1803
2260
|
const list = Array.isArray(value) ? [value[0], value[1]] : [value];
|
|
1804
|
-
const clamped = list.map((v) => clamp
|
|
2261
|
+
const clamped = list.map((v) => clamp(Number.isFinite(v) ? v : min, min, max));
|
|
1805
2262
|
return clamped.length === 2 ? clamped.sort((x, y) => x - y) : clamped;
|
|
1806
2263
|
}
|
|
1807
2264
|
function niceStep(span, count) {
|
|
@@ -1827,22 +2284,60 @@ function normalizeMarks(marks, min, max, format = String) {
|
|
|
1827
2284
|
function isMarkActive(markValue, values) {
|
|
1828
2285
|
return values.length === 2 ? markValue >= values[0] && markValue <= values[1] : markValue <= (values[0] ?? 0);
|
|
1829
2286
|
}
|
|
2287
|
+
function zoneColor(zone) {
|
|
2288
|
+
if (zone.color) return zone.color;
|
|
2289
|
+
if (zone.tone === "neutral") return "var(--tao-color-text-muted)";
|
|
2290
|
+
return `var(--tao-color-${zone.tone ?? "accent"})`;
|
|
2291
|
+
}
|
|
2292
|
+
const INK = "#0d0d0d";
|
|
2293
|
+
const PAPER = "#ffffff";
|
|
2294
|
+
function zoneOn(zone) {
|
|
2295
|
+
if (zone.color) {
|
|
2296
|
+
const rgba = parseColor(zone.color);
|
|
2297
|
+
if (!rgba) return "";
|
|
2298
|
+
const hex = toHex(rgba);
|
|
2299
|
+
return contrastRatio(INK, hex) >= contrastRatio(PAPER, hex) ? INK : PAPER;
|
|
2300
|
+
}
|
|
2301
|
+
return zone.tone === "neutral" ? "var(--tao-color-bg)" : `var(--tao-color-on-${zone.tone ?? "accent"})`;
|
|
2302
|
+
}
|
|
2303
|
+
function normalizeZones(zones, min, max) {
|
|
2304
|
+
if (!zones?.length || !(max > min)) return [];
|
|
2305
|
+
const sorted = zones.filter((z) => Number.isFinite(z.to)).sort((a, b) => a.to - b.to);
|
|
2306
|
+
const out = [];
|
|
2307
|
+
let from = min;
|
|
2308
|
+
for (const zone of sorted) {
|
|
2309
|
+
const to = clamp(zone.to, min, max);
|
|
2310
|
+
if (to <= from) continue;
|
|
2311
|
+
out.push({ from, to, color: zoneColor(zone), on: zoneOn(zone), dot: !!zone.dot && to < max, reveal: !!zone.reveal });
|
|
2312
|
+
from = to;
|
|
2313
|
+
}
|
|
2314
|
+
const last = out[out.length - 1];
|
|
2315
|
+
if (last && last.to < max) out[out.length - 1] = { ...last, to: max };
|
|
2316
|
+
return out;
|
|
2317
|
+
}
|
|
2318
|
+
function zoneAt(value, zones) {
|
|
2319
|
+
return zones.find((z) => value <= z.to) ?? zones[zones.length - 1];
|
|
2320
|
+
}
|
|
2321
|
+
function zoneGradient(zones, min, max, vertical = false, dimmed = false) {
|
|
2322
|
+
const stops = zones.map((z) => `${dimmed && z.reveal ? "transparent" : z.color} ${ratioOf(z.from, min, max) * 100}% ${ratioOf(z.to, min, max) * 100}%`);
|
|
2323
|
+
return `linear-gradient(${vertical ? "to top" : "to right"}, ${stops.join(", ")})`;
|
|
2324
|
+
}
|
|
1830
2325
|
const _hoisted_1$Z = ["aria-disabled"];
|
|
1831
2326
|
const _hoisted_2$P = ["id", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "aria-orientation", "aria-disabled", "aria-invalid", "aria-describedby", "onKeydown"];
|
|
1832
2327
|
const _hoisted_3$I = {
|
|
1833
|
-
key:
|
|
2328
|
+
key: 2,
|
|
1834
2329
|
class: "tao-slider__value"
|
|
1835
2330
|
};
|
|
1836
2331
|
const _hoisted_4$A = {
|
|
1837
2332
|
key: 0,
|
|
1838
2333
|
class: "tao-slider__marks"
|
|
1839
2334
|
};
|
|
1840
|
-
const _hoisted_5$
|
|
2335
|
+
const _hoisted_5$q = ["disabled", "onClick"];
|
|
1841
2336
|
const _hoisted_6$l = {
|
|
1842
2337
|
key: 0,
|
|
1843
2338
|
class: "tao-slider__mark-label"
|
|
1844
2339
|
};
|
|
1845
|
-
const _sfc_main$
|
|
2340
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
1846
2341
|
...{ name: "TaoSliderBase" },
|
|
1847
2342
|
__name: "TaoSliderBase",
|
|
1848
2343
|
props: {
|
|
@@ -1856,6 +2351,8 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
1856
2351
|
discrete: { type: Boolean, default: false },
|
|
1857
2352
|
format: {},
|
|
1858
2353
|
flat: { type: Boolean, default: false },
|
|
2354
|
+
zones: {},
|
|
2355
|
+
bubble: { type: [Boolean, String], default: false },
|
|
1859
2356
|
vertical: { type: Boolean, default: false },
|
|
1860
2357
|
disabled: { type: Boolean, default: false },
|
|
1861
2358
|
error: { type: Boolean, default: false },
|
|
@@ -1884,6 +2381,34 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
1884
2381
|
const to = percent(values.value[isRange.value ? 1 : 0]);
|
|
1885
2382
|
return props.vertical ? { bottom: `${from}%`, height: `${to - from}%` } : { left: `${from}%`, width: `${to - from}%` };
|
|
1886
2383
|
});
|
|
2384
|
+
const zoneList = computed(() => normalizeZones(props.zones, props.min, props.max));
|
|
2385
|
+
const zoneDots = computed(() => zoneList.value.filter((z) => z.dot && (!z.reveal || isMarkActive(z.to, values.value))).map((z) => z.to));
|
|
2386
|
+
const zoneVars = computed(
|
|
2387
|
+
() => zoneList.value.length ? {
|
|
2388
|
+
"--_zones": zoneGradient(zoneList.value, props.min, props.max, props.vertical),
|
|
2389
|
+
"--_zones-dim": zoneGradient(zoneList.value, props.min, props.max, props.vertical, true)
|
|
2390
|
+
} : void 0
|
|
2391
|
+
);
|
|
2392
|
+
const zoneClip = computed(() => {
|
|
2393
|
+
const from = isRange.value ? percent(values.value[0]) : 0;
|
|
2394
|
+
const to = percent(values.value[isRange.value ? 1 : 0]);
|
|
2395
|
+
const radius = "round var(--_zone-radius)";
|
|
2396
|
+
return {
|
|
2397
|
+
clipPath: props.vertical ? `inset(${100 - to}% 0 ${from}% 0 ${radius})` : `inset(0 ${100 - to}% 0 ${from}% ${radius})`
|
|
2398
|
+
};
|
|
2399
|
+
});
|
|
2400
|
+
const bubbleStyle = (v) => {
|
|
2401
|
+
const zone = zoneAt(v, zoneList.value);
|
|
2402
|
+
return { ...place(v), "--_bg": zone?.color ?? "var(--tao-color-accent)", ...zone ? zone.on ? { "--_on": zone.on } : {} : { "--_on": "var(--tao-color-on-accent)" } };
|
|
2403
|
+
};
|
|
2404
|
+
const bubbleAuto = (v) => {
|
|
2405
|
+
const zone = zoneAt(v, zoneList.value);
|
|
2406
|
+
return !!zone && !zone.on;
|
|
2407
|
+
};
|
|
2408
|
+
const thumbStyle = (v) => {
|
|
2409
|
+
const zone = zoneAt(v, zoneList.value);
|
|
2410
|
+
return zone ? { ...place(v), "--tao-slider-thumb-bg": zone.color } : place(v);
|
|
2411
|
+
};
|
|
1887
2412
|
const barText = computed(() => values.value.map(text).join(" – "));
|
|
1888
2413
|
function write(next, final = false) {
|
|
1889
2414
|
const before = values.value;
|
|
@@ -2017,6 +2542,9 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
2017
2542
|
"tao-slider--flat": __props.flat,
|
|
2018
2543
|
"tao-slider--pointer-focus": pointerFocus.value,
|
|
2019
2544
|
"tao-slider--collapsed": isRange.value && values.value[0] === values.value[1],
|
|
2545
|
+
"tao-slider--zoned": zoneList.value.length > 0,
|
|
2546
|
+
"tao-slider--bubble": __props.bubble,
|
|
2547
|
+
"tao-slider--bubble-always": __props.bubble === "always",
|
|
2020
2548
|
"tao-slider--range": isRange.value,
|
|
2021
2549
|
"tao-slider--has-marks": markList.value.length > 0,
|
|
2022
2550
|
"tao-slider--marks-start": __props.marksSide === "start",
|
|
@@ -2041,30 +2569,62 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
2041
2569
|
onLostpointercapture: endDrag
|
|
2042
2570
|
}, [
|
|
2043
2571
|
_cache[1] || (_cache[1] = createElementVNode("div", { class: "tao-slider__track" }, null, -1)),
|
|
2044
|
-
|
|
2572
|
+
zoneList.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2573
|
+
createElementVNode("div", {
|
|
2574
|
+
class: "tao-slider__track tao-slider__zones tao-slider__zones--dim",
|
|
2575
|
+
style: normalizeStyle(zoneVars.value)
|
|
2576
|
+
}, null, 4),
|
|
2577
|
+
createElementVNode("div", {
|
|
2578
|
+
class: "tao-slider__track tao-slider__zones",
|
|
2579
|
+
style: normalizeStyle([zoneVars.value, zoneClip.value])
|
|
2580
|
+
}, null, 4),
|
|
2581
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(zoneDots.value, (at) => {
|
|
2582
|
+
return openBlock(), createElementBlock("span", {
|
|
2583
|
+
key: at,
|
|
2584
|
+
class: "tao-slider__dot",
|
|
2585
|
+
style: normalizeStyle(place(at)),
|
|
2586
|
+
"aria-hidden": "true"
|
|
2587
|
+
}, null, 4);
|
|
2588
|
+
}), 128))
|
|
2589
|
+
], 64)) : (openBlock(), createElementBlock("div", {
|
|
2590
|
+
key: 1,
|
|
2045
2591
|
class: "tao-slider__fill",
|
|
2046
2592
|
style: normalizeStyle(fillStyle.value)
|
|
2047
|
-
}, null, 4),
|
|
2593
|
+
}, null, 4)),
|
|
2048
2594
|
(openBlock(true), createElementBlock(Fragment, null, renderList(values.value, (v, i) => {
|
|
2049
|
-
return openBlock(), createElementBlock(
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2595
|
+
return openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
2596
|
+
createElementVNode("div", {
|
|
2597
|
+
id: i === 0 ? unref(controlId) : void 0,
|
|
2598
|
+
class: normalizeClass(["tao-slider__thumb", { "tao-slider__thumb--active": isDragging.value && activeThumb.value === i }]),
|
|
2599
|
+
style: normalizeStyle(thumbStyle(v)),
|
|
2600
|
+
role: "slider",
|
|
2601
|
+
tabindex: __props.disabled ? -1 : 0,
|
|
2602
|
+
"aria-valuemin": __props.min,
|
|
2603
|
+
"aria-valuemax": __props.max,
|
|
2604
|
+
"aria-valuenow": v,
|
|
2605
|
+
"aria-valuetext": text(v),
|
|
2606
|
+
"aria-label": __props.ariaLabel,
|
|
2607
|
+
"aria-orientation": __props.vertical ? "vertical" : "horizontal",
|
|
2608
|
+
"aria-disabled": __props.disabled || void 0,
|
|
2609
|
+
"aria-invalid": unref(invalid) || void 0,
|
|
2610
|
+
"aria-describedby": unref(describedBy),
|
|
2611
|
+
onKeydown: ($event) => onKeydown2($event, i),
|
|
2612
|
+
onBlur: _cache[0] || (_cache[0] = ($event) => pointerFocus.value = false)
|
|
2613
|
+
}, null, 46, _hoisted_2$P),
|
|
2614
|
+
__props.bubble ? (openBlock(), createElementBlock("div", {
|
|
2615
|
+
key: 0,
|
|
2616
|
+
class: normalizeClass(["tao-slider__bubble", { "tao-slider__bubble--auto": bubbleAuto(v) }]),
|
|
2617
|
+
style: normalizeStyle(bubbleStyle(v)),
|
|
2618
|
+
"aria-hidden": "true"
|
|
2619
|
+
}, [
|
|
2620
|
+
renderSlot(_ctx.$slots, "bubble", {
|
|
2621
|
+
value: v,
|
|
2622
|
+
zone: unref(zoneAt)(v, zoneList.value)
|
|
2623
|
+
}, () => [
|
|
2624
|
+
createTextVNode(toDisplayString(text(v)), 1)
|
|
2625
|
+
], true)
|
|
2626
|
+
], 6)) : createCommentVNode("", true)
|
|
2627
|
+
], 64);
|
|
2068
2628
|
}), 128)),
|
|
2069
2629
|
__props.showValue ? (openBlock(), createElementBlock("div", _hoisted_3$I, [
|
|
2070
2630
|
renderSlot(_ctx.$slots, "pre-value", {}, void 0, true),
|
|
@@ -2096,15 +2656,15 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
2096
2656
|
createTextVNode(toDisplayString(mark.label), 1)
|
|
2097
2657
|
], true)
|
|
2098
2658
|
])) : createCommentVNode("", true)
|
|
2099
|
-
], 14, _hoisted_5$
|
|
2659
|
+
], 14, _hoisted_5$q);
|
|
2100
2660
|
}), 128))
|
|
2101
2661
|
])) : createCommentVNode("", true)
|
|
2102
2662
|
], 42, _hoisted_1$Z);
|
|
2103
2663
|
};
|
|
2104
2664
|
}
|
|
2105
2665
|
});
|
|
2106
|
-
const TaoSliderBase = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2107
|
-
const _sfc_main$
|
|
2666
|
+
const TaoSliderBase = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__scopeId", "data-v-f2374981"]]);
|
|
2667
|
+
const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
2108
2668
|
...{ name: "TaoSlider" },
|
|
2109
2669
|
__name: "TaoSlider",
|
|
2110
2670
|
props: {
|
|
@@ -2118,6 +2678,8 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2118
2678
|
discrete: { type: Boolean },
|
|
2119
2679
|
format: { type: Function },
|
|
2120
2680
|
flat: { type: Boolean },
|
|
2681
|
+
zones: {},
|
|
2682
|
+
bubble: { type: [Boolean, String] },
|
|
2121
2683
|
vertical: { type: Boolean },
|
|
2122
2684
|
disabled: { type: Boolean },
|
|
2123
2685
|
error: { type: Boolean },
|
|
@@ -2143,19 +2705,26 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2143
2705
|
]),
|
|
2144
2706
|
key: "0"
|
|
2145
2707
|
} : void 0,
|
|
2708
|
+
_ctx.$slots.bubble ? {
|
|
2709
|
+
name: "bubble",
|
|
2710
|
+
fn: withCtx((slot) => [
|
|
2711
|
+
renderSlot(_ctx.$slots, "bubble", normalizeProps(guardReactiveProps(slot)))
|
|
2712
|
+
]),
|
|
2713
|
+
key: "1"
|
|
2714
|
+
} : void 0,
|
|
2146
2715
|
_ctx.$slots["pre-value"] ? {
|
|
2147
2716
|
name: "pre-value",
|
|
2148
2717
|
fn: withCtx(() => [
|
|
2149
2718
|
renderSlot(_ctx.$slots, "pre-value")
|
|
2150
2719
|
]),
|
|
2151
|
-
key: "
|
|
2720
|
+
key: "2"
|
|
2152
2721
|
} : void 0,
|
|
2153
2722
|
_ctx.$slots["post-value"] ? {
|
|
2154
2723
|
name: "post-value",
|
|
2155
2724
|
fn: withCtx(() => [
|
|
2156
2725
|
renderSlot(_ctx.$slots, "post-value")
|
|
2157
2726
|
]),
|
|
2158
|
-
key: "
|
|
2727
|
+
key: "3"
|
|
2159
2728
|
} : void 0
|
|
2160
2729
|
]), 1040);
|
|
2161
2730
|
};
|
|
@@ -2167,7 +2736,7 @@ const _hoisted_3$H = {
|
|
|
2167
2736
|
key: 0,
|
|
2168
2737
|
class: "tao-scrubber__time"
|
|
2169
2738
|
};
|
|
2170
|
-
const _sfc_main$
|
|
2739
|
+
const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
2171
2740
|
...{ name: "TaoScrubber" },
|
|
2172
2741
|
__name: "TaoScrubber",
|
|
2173
2742
|
props: {
|
|
@@ -2238,7 +2807,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
2238
2807
|
}, 8, ["disabled", "aria-label"])) : createCommentVNode("", true)
|
|
2239
2808
|
]),
|
|
2240
2809
|
createElementVNode("div", _hoisted_2$O, [
|
|
2241
|
-
createVNode(_sfc_main$
|
|
2810
|
+
createVNode(_sfc_main$16, {
|
|
2242
2811
|
"model-value": __props.modelValue,
|
|
2243
2812
|
min: 0,
|
|
2244
2813
|
max: __props.length,
|
|
@@ -2274,7 +2843,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
2274
2843
|
};
|
|
2275
2844
|
}
|
|
2276
2845
|
});
|
|
2277
|
-
const TaoScrubber = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2846
|
+
const TaoScrubber = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-517dc331"]]);
|
|
2278
2847
|
const opposite = { top: "bottom", bottom: "top", left: "right", right: "left" };
|
|
2279
2848
|
function computePosition(input) {
|
|
2280
2849
|
const { anchor, size, viewport, placement = "bottom-start", gap = 4, pad = 8, flip = true } = input;
|
|
@@ -2400,7 +2969,7 @@ function useFloating(anchor, panel, open, options = {}) {
|
|
|
2400
2969
|
});
|
|
2401
2970
|
return { style, side, anchorOffset, placed, update };
|
|
2402
2971
|
}
|
|
2403
|
-
const _sfc_main$
|
|
2972
|
+
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
2404
2973
|
...{ name: "TaoTooltip" },
|
|
2405
2974
|
__name: "TaoTooltip",
|
|
2406
2975
|
props: {
|
|
@@ -2478,7 +3047,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
2478
3047
|
};
|
|
2479
3048
|
}
|
|
2480
3049
|
});
|
|
2481
|
-
const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3050
|
+
const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-32ae3936"]]);
|
|
2482
3051
|
function useDismiss(open, inside, onDismiss) {
|
|
2483
3052
|
function onPointer(event) {
|
|
2484
3053
|
const target = event.target;
|
|
@@ -2508,7 +3077,7 @@ function useDismiss(open, inside, onDismiss) {
|
|
|
2508
3077
|
onBeforeUnmount(stop);
|
|
2509
3078
|
}
|
|
2510
3079
|
const _hoisted_1$X = { class: "tao-popover" };
|
|
2511
|
-
const _sfc_main$
|
|
3080
|
+
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
2512
3081
|
...{ name: "TaoPopover" },
|
|
2513
3082
|
__name: "TaoPopover",
|
|
2514
3083
|
props: {
|
|
@@ -2591,24 +3160,30 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
2591
3160
|
};
|
|
2592
3161
|
}
|
|
2593
3162
|
});
|
|
2594
|
-
const TaoPopover = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3163
|
+
const TaoPopover = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__scopeId", "data-v-6822af1e"]]);
|
|
2595
3164
|
const spoilerGroupKey = Symbol("taoSpoilerGroup");
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
3165
|
+
function frameStyle(bordered) {
|
|
3166
|
+
if (bordered === void 0 || bordered === null) {
|
|
3167
|
+
return void 0;
|
|
3168
|
+
}
|
|
3169
|
+
return bordered ? { "--tao-frame-alpha": "100%", "--tao-frame-tint": "0%", "--tao-frame-fill": "0%" } : { "--tao-frame-alpha": "0%", "--tao-frame-tint": "6%", "--tao-frame-fill": "100%" };
|
|
3170
|
+
}
|
|
3171
|
+
const _hoisted_1$W = ["aria-expanded", "aria-controls"];
|
|
3172
|
+
const _hoisted_2$N = {
|
|
2599
3173
|
key: 0,
|
|
2600
3174
|
class: "tao-spoiler__title"
|
|
2601
3175
|
};
|
|
2602
|
-
const
|
|
2603
|
-
const
|
|
2604
|
-
const _sfc_main$
|
|
3176
|
+
const _hoisted_3$G = ["id"];
|
|
3177
|
+
const _hoisted_4$z = { class: "tao-spoiler__content-inner" };
|
|
3178
|
+
const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
2605
3179
|
...{ name: "TaoSpoiler" },
|
|
2606
3180
|
__name: "TaoSpoiler",
|
|
2607
3181
|
props: {
|
|
2608
3182
|
title: { default: "" },
|
|
2609
3183
|
defaultOpen: { type: Boolean, default: false },
|
|
2610
3184
|
modelValue: { type: Boolean, default: void 0 },
|
|
2611
|
-
name: { default: void 0 }
|
|
3185
|
+
name: { default: void 0 },
|
|
3186
|
+
bordered: { type: Boolean, default: void 0 }
|
|
2612
3187
|
},
|
|
2613
3188
|
emits: ["update:modelValue", "change"],
|
|
2614
3189
|
setup(__props, { emit: __emit }) {
|
|
@@ -2657,7 +3232,10 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
2657
3232
|
});
|
|
2658
3233
|
}
|
|
2659
3234
|
return (_ctx, _cache) => {
|
|
2660
|
-
return openBlock(), createElementBlock("div",
|
|
3235
|
+
return openBlock(), createElementBlock("div", {
|
|
3236
|
+
class: "tao-spoiler",
|
|
3237
|
+
style: normalizeStyle(unref(frameStyle)(__props.bordered))
|
|
3238
|
+
}, [
|
|
2661
3239
|
createElementVNode("button", {
|
|
2662
3240
|
type: "button",
|
|
2663
3241
|
class: "tao-spoiler__header",
|
|
@@ -2669,12 +3247,12 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
2669
3247
|
class: normalizeClass(["tao-spoiler__icon", { "tao-spoiler__icon--open": isOpen.value }]),
|
|
2670
3248
|
name: "tao-chevron-right"
|
|
2671
3249
|
}, null, 8, ["class"]),
|
|
2672
|
-
__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span",
|
|
3250
|
+
__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_2$N, [
|
|
2673
3251
|
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
2674
3252
|
createTextVNode(toDisplayString(__props.title), 1)
|
|
2675
3253
|
], true)
|
|
2676
3254
|
])) : createCommentVNode("", true)
|
|
2677
|
-
], 8,
|
|
3255
|
+
], 8, _hoisted_1$W),
|
|
2678
3256
|
createVNode(Transition, {
|
|
2679
3257
|
name: "tao-spoiler-slide",
|
|
2680
3258
|
onBeforeEnter,
|
|
@@ -2688,20 +3266,20 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
2688
3266
|
id: unref(panelId),
|
|
2689
3267
|
class: "tao-spoiler__content"
|
|
2690
3268
|
}, [
|
|
2691
|
-
createElementVNode("div",
|
|
3269
|
+
createElementVNode("div", _hoisted_4$z, [
|
|
2692
3270
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
2693
3271
|
])
|
|
2694
|
-
], 8,
|
|
3272
|
+
], 8, _hoisted_3$G)) : createCommentVNode("", true)
|
|
2695
3273
|
]),
|
|
2696
3274
|
_: 3
|
|
2697
3275
|
})
|
|
2698
|
-
]);
|
|
3276
|
+
], 4);
|
|
2699
3277
|
};
|
|
2700
3278
|
}
|
|
2701
3279
|
});
|
|
2702
|
-
const TaoSpoiler = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3280
|
+
const TaoSpoiler = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-1e16d6d1"]]);
|
|
2703
3281
|
const _hoisted_1$V = { class: "tao-spoiler-group" };
|
|
2704
|
-
const _sfc_main$
|
|
3282
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
2705
3283
|
...{ name: "TaoSpoilerGroup" },
|
|
2706
3284
|
__name: "TaoSpoilerGroup",
|
|
2707
3285
|
props: {
|
|
@@ -2732,9 +3310,9 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
2732
3310
|
};
|
|
2733
3311
|
}
|
|
2734
3312
|
});
|
|
2735
|
-
const TaoSpoilerGroup = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3313
|
+
const TaoSpoilerGroup = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-7986fd2a"]]);
|
|
2736
3314
|
const _hoisted_1$U = ["aria-label"];
|
|
2737
|
-
const _sfc_main$
|
|
3315
|
+
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
2738
3316
|
...{ name: "TaoCopy" },
|
|
2739
3317
|
__name: "TaoCopy",
|
|
2740
3318
|
props: {
|
|
@@ -2821,8 +3399,8 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
2821
3399
|
};
|
|
2822
3400
|
}
|
|
2823
3401
|
});
|
|
2824
|
-
const TaoCopy = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2825
|
-
const _sfc_main
|
|
3402
|
+
const TaoCopy = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__scopeId", "data-v-1fb47e53"]]);
|
|
3403
|
+
const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
2826
3404
|
...{ name: "TaoContainer" },
|
|
2827
3405
|
__name: "TaoContainer",
|
|
2828
3406
|
props: {
|
|
@@ -2841,8 +3419,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
2841
3419
|
};
|
|
2842
3420
|
}
|
|
2843
3421
|
});
|
|
2844
|
-
const TaoContainer = /* @__PURE__ */ _export_sfc(_sfc_main
|
|
2845
|
-
const _sfc_main
|
|
3422
|
+
const TaoContainer = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__scopeId", "data-v-a5e36052"]]);
|
|
3423
|
+
const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
2846
3424
|
...{ name: "TaoFlex" },
|
|
2847
3425
|
__name: "TaoFlex",
|
|
2848
3426
|
props: {
|
|
@@ -2873,7 +3451,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
|
|
|
2873
3451
|
};
|
|
2874
3452
|
}
|
|
2875
3453
|
});
|
|
2876
|
-
const _sfc_main$
|
|
3454
|
+
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
2877
3455
|
...{ name: "TaoSpace" },
|
|
2878
3456
|
__name: "TaoSpace",
|
|
2879
3457
|
props: {
|
|
@@ -2894,7 +3472,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
2894
3472
|
};
|
|
2895
3473
|
}
|
|
2896
3474
|
});
|
|
2897
|
-
const TaoSpace = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3475
|
+
const TaoSpace = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-d6fec8bb"]]);
|
|
2898
3476
|
const FULL_SPAN = 999;
|
|
2899
3477
|
function perSize(value, fallback, compactPlain) {
|
|
2900
3478
|
if (value === void 0 || value === null) {
|
|
@@ -2911,7 +3489,7 @@ function perSize(value, fallback, compactPlain) {
|
|
|
2911
3489
|
}
|
|
2912
3490
|
const spanNumber = (span) => span === "full" ? FULL_SPAN : Math.max(1, Math.round(span));
|
|
2913
3491
|
const _hoisted_1$T = { class: "tao-grid__cells" };
|
|
2914
|
-
const _sfc_main$
|
|
3492
|
+
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
2915
3493
|
...{ name: "TaoGrid" },
|
|
2916
3494
|
__name: "TaoGrid",
|
|
2917
3495
|
props: {
|
|
@@ -2946,8 +3524,8 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
2946
3524
|
};
|
|
2947
3525
|
}
|
|
2948
3526
|
});
|
|
2949
|
-
const TaoGrid = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2950
|
-
const _sfc_main$
|
|
3527
|
+
const TaoGrid = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-e95541e2"]]);
|
|
3528
|
+
const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
2951
3529
|
...{ name: "TaoGridItem" },
|
|
2952
3530
|
__name: "TaoGridItem",
|
|
2953
3531
|
props: {
|
|
@@ -2983,7 +3561,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
2983
3561
|
};
|
|
2984
3562
|
}
|
|
2985
3563
|
});
|
|
2986
|
-
const TaoGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3564
|
+
const TaoGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-d42e5e67"]]);
|
|
2987
3565
|
const _hoisted_1$S = { class: "tao-split__pane tao-split__pane--start" };
|
|
2988
3566
|
const _hoisted_2$M = ["aria-orientation", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-disabled", "tabindex"];
|
|
2989
3567
|
const _hoisted_3$F = { class: "tao-split__pane tao-split__pane--end" };
|
|
@@ -2991,7 +3569,7 @@ const _hoisted_4$y = {
|
|
|
2991
3569
|
key: 0,
|
|
2992
3570
|
class: "tao-split__shield"
|
|
2993
3571
|
};
|
|
2994
|
-
const _sfc_main$
|
|
3572
|
+
const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
2995
3573
|
...{ name: "TaoSplit" },
|
|
2996
3574
|
__name: "TaoSplit",
|
|
2997
3575
|
props: {
|
|
@@ -3320,69 +3898,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
3320
3898
|
};
|
|
3321
3899
|
}
|
|
3322
3900
|
});
|
|
3323
|
-
const TaoSplit = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3324
|
-
const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
3325
|
-
...{ name: "TaoLoader" },
|
|
3326
|
-
__name: "TaoLoader",
|
|
3327
|
-
props: {
|
|
3328
|
-
color: { default: "var(--tao-color-accent)" },
|
|
3329
|
-
size: { default: 80 },
|
|
3330
|
-
inline: { type: Boolean, default: false }
|
|
3331
|
-
},
|
|
3332
|
-
setup(__props) {
|
|
3333
|
-
useCssVars((_ctx) => ({
|
|
3334
|
-
"b4bda044": positions.value.first,
|
|
3335
|
-
"b3343ad6": positions.value.third,
|
|
3336
|
-
"v0edab2ac": positions.value.fourth,
|
|
3337
|
-
"v116f4fc7": positions.value.animationDistance
|
|
3338
|
-
}));
|
|
3339
|
-
const props = __props;
|
|
3340
|
-
const normalizedSize = computed(() => {
|
|
3341
|
-
if (typeof props.size === "number") {
|
|
3342
|
-
return `${props.size}px`;
|
|
3343
|
-
}
|
|
3344
|
-
return props.size;
|
|
3345
|
-
});
|
|
3346
|
-
const dotSizeNumber = computed(() => {
|
|
3347
|
-
const baseSize = typeof props.size === "number" ? props.size : parseInt(props.size, 10) || 80;
|
|
3348
|
-
return baseSize * 0.1625;
|
|
3349
|
-
});
|
|
3350
|
-
const dotSize = computed(() => `${dotSizeNumber.value}px`);
|
|
3351
|
-
const positions = computed(() => {
|
|
3352
|
-
const baseSize = typeof props.size === "number" ? props.size : parseInt(props.size, 10) || 80;
|
|
3353
|
-
return {
|
|
3354
|
-
first: `${baseSize * 0.1}px`,
|
|
3355
|
-
third: `${baseSize * 0.4}px`,
|
|
3356
|
-
fourth: `${baseSize * 0.7}px`,
|
|
3357
|
-
animationDistance: `${baseSize * 0.3}px`
|
|
3358
|
-
};
|
|
3359
|
-
});
|
|
3360
|
-
return (_ctx, _cache) => {
|
|
3361
|
-
return openBlock(), createElementBlock("div", {
|
|
3362
|
-
class: normalizeClass(["tao-loader", { "tao-loader--inline": props.inline }])
|
|
3363
|
-
}, [
|
|
3364
|
-
createElementVNode("div", {
|
|
3365
|
-
class: "tao-loader__ellipsis",
|
|
3366
|
-
style: normalizeStyle({ width: normalizedSize.value, height: dotSize.value, marginLeft: `-${dotSizeNumber.value / 2}px` })
|
|
3367
|
-
}, [
|
|
3368
|
-
createElementVNode("div", {
|
|
3369
|
-
style: normalizeStyle({ background: props.color, width: dotSize.value, height: dotSize.value })
|
|
3370
|
-
}, null, 4),
|
|
3371
|
-
createElementVNode("div", {
|
|
3372
|
-
style: normalizeStyle({ background: props.color, width: dotSize.value, height: dotSize.value })
|
|
3373
|
-
}, null, 4),
|
|
3374
|
-
createElementVNode("div", {
|
|
3375
|
-
style: normalizeStyle({ background: props.color, width: dotSize.value, height: dotSize.value })
|
|
3376
|
-
}, null, 4),
|
|
3377
|
-
createElementVNode("div", {
|
|
3378
|
-
style: normalizeStyle({ background: props.color, width: dotSize.value, height: dotSize.value })
|
|
3379
|
-
}, null, 4)
|
|
3380
|
-
], 4)
|
|
3381
|
-
], 2);
|
|
3382
|
-
};
|
|
3383
|
-
}
|
|
3384
|
-
});
|
|
3385
|
-
const TaoLoader = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-49a9f1b2"]]);
|
|
3901
|
+
const TaoSplit = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-316b0d45"]]);
|
|
3386
3902
|
const _hoisted_1$R = { class: "tao-image" };
|
|
3387
3903
|
const _hoisted_2$L = ["src", "alt", "loading"];
|
|
3388
3904
|
const _hoisted_3$E = { class: "tao-image__placeholder" };
|
|
@@ -4003,7 +4519,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4003
4519
|
};
|
|
4004
4520
|
}
|
|
4005
4521
|
});
|
|
4006
|
-
const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-
|
|
4522
|
+
const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-69ee603c"]]);
|
|
4007
4523
|
const _hoisted_1$K = { class: "tao-progress" };
|
|
4008
4524
|
const _hoisted_2$E = {
|
|
4009
4525
|
key: 0,
|
|
@@ -4095,6 +4611,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4095
4611
|
discrete: { type: Boolean },
|
|
4096
4612
|
format: { type: Function },
|
|
4097
4613
|
flat: { type: Boolean },
|
|
4614
|
+
zones: {},
|
|
4615
|
+
bubble: { type: [Boolean, String] },
|
|
4098
4616
|
vertical: { type: Boolean },
|
|
4099
4617
|
disabled: { type: Boolean },
|
|
4100
4618
|
error: { type: Boolean },
|
|
@@ -4120,19 +4638,26 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4120
4638
|
]),
|
|
4121
4639
|
key: "0"
|
|
4122
4640
|
} : void 0,
|
|
4641
|
+
_ctx.$slots.bubble ? {
|
|
4642
|
+
name: "bubble",
|
|
4643
|
+
fn: withCtx((slot) => [
|
|
4644
|
+
renderSlot(_ctx.$slots, "bubble", normalizeProps(guardReactiveProps(slot)))
|
|
4645
|
+
]),
|
|
4646
|
+
key: "1"
|
|
4647
|
+
} : void 0,
|
|
4123
4648
|
_ctx.$slots["pre-value"] ? {
|
|
4124
4649
|
name: "pre-value",
|
|
4125
4650
|
fn: withCtx(() => [
|
|
4126
4651
|
renderSlot(_ctx.$slots, "pre-value")
|
|
4127
4652
|
]),
|
|
4128
|
-
key: "
|
|
4653
|
+
key: "2"
|
|
4129
4654
|
} : void 0,
|
|
4130
4655
|
_ctx.$slots["post-value"] ? {
|
|
4131
4656
|
name: "post-value",
|
|
4132
4657
|
fn: withCtx(() => [
|
|
4133
4658
|
renderSlot(_ctx.$slots, "post-value")
|
|
4134
4659
|
]),
|
|
4135
|
-
key: "
|
|
4660
|
+
key: "3"
|
|
4136
4661
|
} : void 0
|
|
4137
4662
|
]), 1040);
|
|
4138
4663
|
};
|
|
@@ -4885,7 +5410,8 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4885
5410
|
items: {},
|
|
4886
5411
|
size: { default: void 0 },
|
|
4887
5412
|
ariaLabel: { default: void 0 },
|
|
4888
|
-
closeOnScroll: { type: Boolean, default: false }
|
|
5413
|
+
closeOnScroll: { type: Boolean, default: false },
|
|
5414
|
+
bordered: { type: Boolean, default: void 0 }
|
|
4889
5415
|
},
|
|
4890
5416
|
emits: ["select"],
|
|
4891
5417
|
setup(__props, { emit: __emit }) {
|
|
@@ -4985,6 +5511,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4985
5511
|
return (_ctx, _cache) => {
|
|
4986
5512
|
return openBlock(), createElementBlock("div", {
|
|
4987
5513
|
class: normalizeClass(["tao-menubar", unref(sizeClass)(__props.size)]),
|
|
5514
|
+
style: normalizeStyle(unref(frameStyle)(__props.bordered)),
|
|
4988
5515
|
role: "menubar",
|
|
4989
5516
|
"aria-label": unref(l10n).ariaLabel
|
|
4990
5517
|
}, [
|
|
@@ -5029,11 +5556,11 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5029
5556
|
]), 1032, ["items", "open", "anchor", "label", "close-on-scroll"])) : createCommentVNode("", true)
|
|
5030
5557
|
], 64);
|
|
5031
5558
|
}), 128))
|
|
5032
|
-
],
|
|
5559
|
+
], 14, _hoisted_1$G);
|
|
5033
5560
|
};
|
|
5034
5561
|
}
|
|
5035
5562
|
});
|
|
5036
|
-
const TaoMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-
|
|
5563
|
+
const TaoMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-446c1c49"]]);
|
|
5037
5564
|
const toolbarKey = Symbol("tao-toolbar");
|
|
5038
5565
|
const ITEMS = 'button, a[href], input, select, textarea, [role="button"], [data-tao-toolbar-item]';
|
|
5039
5566
|
const TEXT_INPUT = /^(text|search|email|url|tel|password|number|date|time|datetime-local|month|week)$/;
|
|
@@ -5094,7 +5621,8 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5094
5621
|
label: { default: void 0 },
|
|
5095
5622
|
size: { default: void 0 },
|
|
5096
5623
|
orientation: { default: "horizontal" },
|
|
5097
|
-
variant: { default: "panel" }
|
|
5624
|
+
variant: { default: "panel" },
|
|
5625
|
+
bordered: { type: Boolean, default: void 0 }
|
|
5098
5626
|
},
|
|
5099
5627
|
setup(__props) {
|
|
5100
5628
|
const props = __props;
|
|
@@ -5173,15 +5701,16 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5173
5701
|
role: "toolbar",
|
|
5174
5702
|
"aria-label": __props.label,
|
|
5175
5703
|
"aria-orientation": __props.orientation,
|
|
5704
|
+
style: normalizeStyle(unref(frameStyle)(__props.bordered)),
|
|
5176
5705
|
onFocusin,
|
|
5177
5706
|
onKeydown: onKeydown2
|
|
5178
5707
|
}, [
|
|
5179
5708
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
5180
|
-
],
|
|
5709
|
+
], 46, _hoisted_1$F);
|
|
5181
5710
|
};
|
|
5182
5711
|
}
|
|
5183
5712
|
});
|
|
5184
|
-
const TaoToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-
|
|
5713
|
+
const TaoToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-ba64d699"]]);
|
|
5185
5714
|
const _hoisted_1$E = ["aria-label"];
|
|
5186
5715
|
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5187
5716
|
...{ name: "TaoToolbarGroup" },
|
|
@@ -7446,105 +7975,6 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7446
7975
|
}
|
|
7447
7976
|
});
|
|
7448
7977
|
const TaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-86083e38"]]);
|
|
7449
|
-
const clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
7450
|
-
const byte = (v) => Math.round(clamp(v, 0, 255));
|
|
7451
|
-
const hex2 = (v) => byte(v).toString(16).padStart(2, "0");
|
|
7452
|
-
function channel(text, scale) {
|
|
7453
|
-
const t = text.trim();
|
|
7454
|
-
return t.endsWith("%") ? parseFloat(t) / 100 * scale : parseFloat(t);
|
|
7455
|
-
}
|
|
7456
|
-
function parseColor(input) {
|
|
7457
|
-
const text = input.trim();
|
|
7458
|
-
const hex = /^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(text);
|
|
7459
|
-
if (hex) {
|
|
7460
|
-
let h = hex[1];
|
|
7461
|
-
if (h.length <= 4) h = [...h].map((c) => c + c).join("");
|
|
7462
|
-
const n = (i) => parseInt(h.slice(i, i + 2), 16);
|
|
7463
|
-
return { r: n(0), g: n(2), b: n(4), a: h.length === 8 ? n(6) / 255 : 1 };
|
|
7464
|
-
}
|
|
7465
|
-
const fn = /^(rgba?|hsla?)\(\s*([^)]+?)\s*\)$/i.exec(text);
|
|
7466
|
-
if (fn && fn[1].toLowerCase().startsWith("hsl")) {
|
|
7467
|
-
const [main, slash] = fn[2].split("/");
|
|
7468
|
-
const parts = main.trim().split(/[\s,]+/);
|
|
7469
|
-
const alphaText = slash !== void 0 ? slash : parts[3];
|
|
7470
|
-
if (parts.length < 3 || parts.length > (slash === void 0 ? 4 : 3)) return null;
|
|
7471
|
-
const h = parseFloat(parts[0]);
|
|
7472
|
-
const s = parseFloat(parts[1]) / 100;
|
|
7473
|
-
const l = parseFloat(parts[2]) / 100;
|
|
7474
|
-
const a = alphaText === void 0 ? 1 : channel(alphaText, 1);
|
|
7475
|
-
if ([h, s, l, a].some((v) => Number.isNaN(v))) return null;
|
|
7476
|
-
return { ...hslToRgb(h, s, l), a: clamp(a, 0, 1) };
|
|
7477
|
-
}
|
|
7478
|
-
if (fn) {
|
|
7479
|
-
const [main, slash] = fn[2].split("/");
|
|
7480
|
-
const parts = main.trim().split(/[\s,]+/);
|
|
7481
|
-
const alphaText = slash !== void 0 ? slash : parts[3];
|
|
7482
|
-
if (parts.length < 3 || parts.length > (slash === void 0 ? 4 : 3)) return null;
|
|
7483
|
-
const r = channel(parts[0], 255);
|
|
7484
|
-
const g = channel(parts[1], 255);
|
|
7485
|
-
const b = channel(parts[2], 255);
|
|
7486
|
-
const a = alphaText === void 0 ? 1 : channel(alphaText, 1);
|
|
7487
|
-
if ([r, g, b, a].some((v) => Number.isNaN(v))) return null;
|
|
7488
|
-
return { r: byte(r), g: byte(g), b: byte(b), a: clamp(a, 0, 1) };
|
|
7489
|
-
}
|
|
7490
|
-
return null;
|
|
7491
|
-
}
|
|
7492
|
-
function toHex(color, alpha = false) {
|
|
7493
|
-
const base = `#${hex2(color.r)}${hex2(color.g)}${hex2(color.b)}`;
|
|
7494
|
-
return alpha ? `${base}${hex2(clamp(color.a, 0, 1) * 255)}` : base;
|
|
7495
|
-
}
|
|
7496
|
-
function rgbToHsv(r, g, b) {
|
|
7497
|
-
const R = clamp(r, 0, 255) / 255;
|
|
7498
|
-
const G = clamp(g, 0, 255) / 255;
|
|
7499
|
-
const B = clamp(b, 0, 255) / 255;
|
|
7500
|
-
const max = Math.max(R, G, B);
|
|
7501
|
-
const d = max - Math.min(R, G, B);
|
|
7502
|
-
let h = 0;
|
|
7503
|
-
if (d > 0) {
|
|
7504
|
-
if (max === R) h = (G - B) / d % 6;
|
|
7505
|
-
else if (max === G) h = (B - R) / d + 2;
|
|
7506
|
-
else h = (R - G) / d + 4;
|
|
7507
|
-
h *= 60;
|
|
7508
|
-
if (h < 0) h += 360;
|
|
7509
|
-
}
|
|
7510
|
-
return { h, s: max === 0 ? 0 : d / max, v: max };
|
|
7511
|
-
}
|
|
7512
|
-
function hsvToRgb(h, s, v) {
|
|
7513
|
-
const H = (h % 360 + 360) % 360 / 60;
|
|
7514
|
-
const S = clamp(s, 0, 1);
|
|
7515
|
-
const V = clamp(v, 0, 1);
|
|
7516
|
-
const f = (n) => {
|
|
7517
|
-
const k = (n + H) % 6;
|
|
7518
|
-
return V - V * S * Math.max(0, Math.min(k, 4 - k, 1));
|
|
7519
|
-
};
|
|
7520
|
-
return { r: f(5) * 255, g: f(3) * 255, b: f(1) * 255 };
|
|
7521
|
-
}
|
|
7522
|
-
function rgbToHsl(r, g, b) {
|
|
7523
|
-
const { h, s: sv, v } = rgbToHsv(r, g, b);
|
|
7524
|
-
const l = v * (1 - sv / 2);
|
|
7525
|
-
return { h, s: l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l), l };
|
|
7526
|
-
}
|
|
7527
|
-
function hslToRgb(h, s, l) {
|
|
7528
|
-
const S = clamp(s, 0, 1);
|
|
7529
|
-
const L = clamp(l, 0, 1);
|
|
7530
|
-
const v = L + S * Math.min(L, 1 - L);
|
|
7531
|
-
const rgb = hsvToRgb(h, v === 0 ? 0 : 2 * (1 - L / v), v);
|
|
7532
|
-
return { r: byte(rgb.r), g: byte(rgb.g), b: byte(rgb.b) };
|
|
7533
|
-
}
|
|
7534
|
-
const rgbaToHsva = (c) => ({ ...rgbToHsv(c.r, c.g, c.b), a: c.a });
|
|
7535
|
-
const hsvaToRgba = (c) => ({ ...hsvToRgb(c.h, c.s, c.v), a: c.a });
|
|
7536
|
-
const linearToSrgb = (c) => {
|
|
7537
|
-
const x = clamp(c, 0, 1);
|
|
7538
|
-
return x <= 31308e-7 ? x * 12.92 : 1.055 * Math.pow(x, 1 / 2.4) - 0.055;
|
|
7539
|
-
};
|
|
7540
|
-
const srgbToLinear = (c) => {
|
|
7541
|
-
const x = clamp(c, 0, 1);
|
|
7542
|
-
return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
|
7543
|
-
};
|
|
7544
|
-
function normalizeHex(input, alpha = false) {
|
|
7545
|
-
const c = parseColor(input);
|
|
7546
|
-
return c ? toHex(c, alpha) : null;
|
|
7547
|
-
}
|
|
7548
7978
|
const segmentedKey = Symbol("taoSegmented");
|
|
7549
7979
|
const _hoisted_1$q = ["disabled", "aria-describedby", "aria-invalid", "aria-labelledby", "id"];
|
|
7550
7980
|
const _hoisted_2$o = {
|
|
@@ -8014,7 +8444,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
8014
8444
|
}, null, 4)
|
|
8015
8445
|
], 44, _hoisted_1$o),
|
|
8016
8446
|
createElementVNode("div", _hoisted_2$m, [
|
|
8017
|
-
createVNode(_sfc_main$
|
|
8447
|
+
createVNode(_sfc_main$16, {
|
|
8018
8448
|
modelValue: hueValue.value,
|
|
8019
8449
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => hueValue.value = $event),
|
|
8020
8450
|
class: "tao-color-picker__hue",
|
|
@@ -8026,7 +8456,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
8026
8456
|
"aria-label": unref(l10n).hueLabel,
|
|
8027
8457
|
onChange: _cache[1] || (_cache[1] = ($event) => emit("change", hex.value))
|
|
8028
8458
|
}, null, 8, ["modelValue", "disabled", "aria-label"]),
|
|
8029
|
-
__props.alpha ? (openBlock(), createBlock(_sfc_main$
|
|
8459
|
+
__props.alpha ? (openBlock(), createBlock(_sfc_main$16, {
|
|
8030
8460
|
key: 0,
|
|
8031
8461
|
modelValue: alphaValue.value,
|
|
8032
8462
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => alphaValue.value = $event),
|
|
@@ -9811,7 +10241,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
9811
10241
|
closeLabel: {},
|
|
9812
10242
|
collapsible: { type: Boolean, default: false },
|
|
9813
10243
|
collapsed: { type: Boolean, default: void 0 },
|
|
9814
|
-
detailsLabel: { default: void 0 }
|
|
10244
|
+
detailsLabel: { default: void 0 },
|
|
10245
|
+
bordered: { type: Boolean, default: void 0 }
|
|
9815
10246
|
},
|
|
9816
10247
|
emits: ["close", "update:collapsed"],
|
|
9817
10248
|
setup(__props, { emit: __emit }) {
|
|
@@ -9863,6 +10294,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
9863
10294
|
return (_ctx, _cache) => {
|
|
9864
10295
|
return openBlock(), createElementBlock("div", {
|
|
9865
10296
|
class: normalizeClass(["tao-alert", unref(toneClass)(__props.tone)]),
|
|
10297
|
+
style: normalizeStyle(unref(frameStyle)(__props.bordered)),
|
|
9866
10298
|
role: __props.tone === "danger" ? "alert" : "status",
|
|
9867
10299
|
"aria-live": isUrgent.value ? "assertive" : "polite"
|
|
9868
10300
|
}, [
|
|
@@ -9918,11 +10350,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
9918
10350
|
], true)
|
|
9919
10351
|
])
|
|
9920
10352
|
], 8, _hoisted_8$4)) : createCommentVNode("", true)
|
|
9921
|
-
],
|
|
10353
|
+
], 14, _hoisted_1$f);
|
|
9922
10354
|
};
|
|
9923
10355
|
}
|
|
9924
10356
|
});
|
|
9925
|
-
const TaoAlert = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-
|
|
10357
|
+
const TaoAlert = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-6fe7dc5f"]]);
|
|
9926
10358
|
const _hoisted_1$e = { key: 0 };
|
|
9927
10359
|
const _hoisted_2$c = ["aria-sort"];
|
|
9928
10360
|
const _hoisted_3$a = ["onClick"];
|
|
@@ -9953,7 +10385,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
9953
10385
|
maxHeight: { default: "" },
|
|
9954
10386
|
clickable: { type: Boolean, default: false },
|
|
9955
10387
|
sort: { default: null },
|
|
9956
|
-
caption: { default: "" }
|
|
10388
|
+
caption: { default: "" },
|
|
10389
|
+
bordered: { type: Boolean, default: void 0 }
|
|
9957
10390
|
},
|
|
9958
10391
|
emits: ["update:sort", "change", "row-click"],
|
|
9959
10392
|
setup(__props, { emit: __emit }) {
|
|
@@ -10020,7 +10453,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
10020
10453
|
"tao-table-wrap--loading": __props.loading
|
|
10021
10454
|
}
|
|
10022
10455
|
]]),
|
|
10023
|
-
style: normalizeStyle(__props.maxHeight ? { maxHeight: unref(toCssLength)(__props.maxHeight) } : void 0)
|
|
10456
|
+
style: normalizeStyle([unref(frameStyle)(__props.bordered), __props.maxHeight ? { maxHeight: unref(toCssLength)(__props.maxHeight) } : void 0])
|
|
10024
10457
|
}, [
|
|
10025
10458
|
createElementVNode("table", {
|
|
10026
10459
|
class: normalizeClass(["tao-table", {
|
|
@@ -10113,7 +10546,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
10113
10546
|
};
|
|
10114
10547
|
}
|
|
10115
10548
|
});
|
|
10116
|
-
const TaoTable = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
10549
|
+
const TaoTable = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e935338d"]]);
|
|
10117
10550
|
function buildPaginationItems(page, pageCount, siblingCount = 1) {
|
|
10118
10551
|
if (pageCount <= 0) {
|
|
10119
10552
|
return [];
|
|
@@ -10531,7 +10964,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
10531
10964
|
};
|
|
10532
10965
|
}
|
|
10533
10966
|
});
|
|
10534
|
-
const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-
|
|
10967
|
+
const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-00f9906e"]]);
|
|
10535
10968
|
const _hoisted_1$a = ["aria-current", "aria-disabled"];
|
|
10536
10969
|
const _hoisted_2$8 = {
|
|
10537
10970
|
key: 0,
|
|
@@ -10665,9 +11098,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
10665
11098
|
}
|
|
10666
11099
|
});
|
|
10667
11100
|
const TaoSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bcd8d820"]]);
|
|
10668
|
-
const SHEET_DISMISS_RATIO = 0.
|
|
10669
|
-
const SHEET_FLING_SPEED =
|
|
10670
|
-
const
|
|
11101
|
+
const SHEET_DISMISS_RATIO = 0.5;
|
|
11102
|
+
const SHEET_FLING_SPEED = 1.2;
|
|
11103
|
+
const SHEET_FLING_MIN_RATIO = 0.15;
|
|
10671
11104
|
function sheetOffset(delta) {
|
|
10672
11105
|
return Math.max(0, delta);
|
|
10673
11106
|
}
|
|
@@ -10680,11 +11113,12 @@ function releaseVelocity(samples, windowMs = 100) {
|
|
|
10680
11113
|
const dt = last.t - first.t;
|
|
10681
11114
|
return dt > 0 ? (last.y - first.y) / dt : 0;
|
|
10682
11115
|
}
|
|
10683
|
-
function shouldDismissSheet(offset, height, velocity) {
|
|
11116
|
+
function shouldDismissSheet(offset, height, velocity, threshold = SHEET_DISMISS_RATIO) {
|
|
10684
11117
|
if (offset <= 0 || height <= 0) {
|
|
10685
11118
|
return false;
|
|
10686
11119
|
}
|
|
10687
|
-
|
|
11120
|
+
const share = Number.isFinite(threshold) ? Math.min(Math.max(threshold, 0.05), 1) : SHEET_DISMISS_RATIO;
|
|
11121
|
+
return offset >= height * share || velocity >= SHEET_FLING_SPEED && offset >= height * Math.min(share, SHEET_FLING_MIN_RATIO);
|
|
10688
11122
|
}
|
|
10689
11123
|
const _hoisted_1$8 = ["aria-labelledby"];
|
|
10690
11124
|
const _hoisted_2$7 = {
|
|
@@ -10718,6 +11152,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10718
11152
|
closable: { type: Boolean, default: true },
|
|
10719
11153
|
showClose: { type: Boolean, default: true },
|
|
10720
11154
|
swipeToClose: { type: Boolean, default: true },
|
|
11155
|
+
swipeThreshold: { default: 0.5 },
|
|
10721
11156
|
closeLabel: {}
|
|
10722
11157
|
},
|
|
10723
11158
|
emits: ["update:modelValue", "close"],
|
|
@@ -10826,7 +11261,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10826
11261
|
return;
|
|
10827
11262
|
}
|
|
10828
11263
|
const height = panelRef.value?.offsetHeight ?? 0;
|
|
10829
|
-
if (released && shouldDismissSheet(current2.offset, height, releaseVelocity(current2.samples))) {
|
|
11264
|
+
if (released && shouldDismissSheet(current2.offset, height, releaseVelocity(current2.samples), props.swipeThreshold)) {
|
|
10830
11265
|
setSheet(height, true);
|
|
10831
11266
|
close();
|
|
10832
11267
|
await nextTick();
|
|
@@ -10940,7 +11375,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10940
11375
|
};
|
|
10941
11376
|
}
|
|
10942
11377
|
});
|
|
10943
|
-
const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
11378
|
+
const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-3b465e73"]]);
|
|
10944
11379
|
const _hoisted_1$7 = ["title"];
|
|
10945
11380
|
const _hoisted_2$6 = { class: "tao-avatar__face" };
|
|
10946
11381
|
const _hoisted_3$5 = ["src", "alt"];
|
|
@@ -11848,7 +12283,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
11848
12283
|
};
|
|
11849
12284
|
}
|
|
11850
12285
|
});
|
|
11851
|
-
const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
12286
|
+
const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-7d6c5a70"]]);
|
|
11852
12287
|
const _hoisted_1$3 = ["aria-label"];
|
|
11853
12288
|
const _hoisted_2$2 = ["aria-label"];
|
|
11854
12289
|
const _hoisted_3$2 = {
|
|
@@ -11932,7 +12367,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11932
12367
|
};
|
|
11933
12368
|
}
|
|
11934
12369
|
});
|
|
11935
|
-
const TaoStages = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
12370
|
+
const TaoStages = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-532420a5"]]);
|
|
11936
12371
|
const _hoisted_1$2 = ["role", "aria-busy"];
|
|
11937
12372
|
const _hoisted_2$1 = {
|
|
11938
12373
|
key: 0,
|
|
@@ -12459,514 +12894,232 @@ function createBuilder$1() {
|
|
|
12459
12894
|
loading() {
|
|
12460
12895
|
draft.type = "neutral";
|
|
12461
12896
|
draft.loading = true;
|
|
12462
|
-
draft.timeout = 0;
|
|
12463
|
-
return ctx;
|
|
12464
|
-
}
|
|
12465
|
-
};
|
|
12466
|
-
setTimeout(() => flushDraft(draft), 0);
|
|
12467
|
-
return ctx;
|
|
12468
|
-
}
|
|
12469
|
-
function shortcut(type, message, options) {
|
|
12470
|
-
const builder = createBuilder$1();
|
|
12471
|
-
if (type === "neutral") {
|
|
12472
|
-
builder.show();
|
|
12473
|
-
} else {
|
|
12474
|
-
builder[type]();
|
|
12475
|
-
}
|
|
12476
|
-
builder.message(message);
|
|
12477
|
-
if (options?.title) {
|
|
12478
|
-
builder.title(options.title);
|
|
12479
|
-
}
|
|
12480
|
-
if (options?.timeout !== void 0) {
|
|
12481
|
-
builder.timeout(options.timeout);
|
|
12482
|
-
}
|
|
12483
|
-
if (options?.position) {
|
|
12484
|
-
builder.position(options.position);
|
|
12485
|
-
}
|
|
12486
|
-
if (options?.icon) {
|
|
12487
|
-
builder.icon(options.icon);
|
|
12488
|
-
}
|
|
12489
|
-
if (options?.closable !== void 0) {
|
|
12490
|
-
builder.closable(options.closable);
|
|
12491
|
-
}
|
|
12492
|
-
if (options?.progress !== void 0) {
|
|
12493
|
-
builder.progress(options.progress);
|
|
12494
|
-
}
|
|
12495
|
-
if (options?.surface) {
|
|
12496
|
-
builder.surface(options.surface);
|
|
12497
|
-
}
|
|
12498
|
-
if (options?.id) {
|
|
12499
|
-
builder.id(options.id);
|
|
12500
|
-
}
|
|
12501
|
-
if (options?.once) {
|
|
12502
|
-
builder.once();
|
|
12503
|
-
}
|
|
12504
|
-
if (options?.replace) {
|
|
12505
|
-
builder.replace();
|
|
12506
|
-
}
|
|
12507
|
-
if (options?.actions) {
|
|
12508
|
-
options.actions.forEach((action) => builder.action(action.label, action.onClick));
|
|
12509
|
-
}
|
|
12510
|
-
if (options?.onClosed) {
|
|
12511
|
-
builder.onClosed(options.onClosed);
|
|
12512
|
-
}
|
|
12513
|
-
return builder;
|
|
12514
|
-
}
|
|
12515
|
-
const toast = Object.assign(createBuilder$1, {
|
|
12516
|
-
success(message, options) {
|
|
12517
|
-
return shortcut("success", message, options);
|
|
12518
|
-
},
|
|
12519
|
-
danger(message, options) {
|
|
12520
|
-
return shortcut("danger", message, options);
|
|
12521
|
-
},
|
|
12522
|
-
warning(message, options) {
|
|
12523
|
-
return shortcut("warning", message, options);
|
|
12524
|
-
},
|
|
12525
|
-
info(message, options) {
|
|
12526
|
-
return shortcut("info", message, options);
|
|
12527
|
-
},
|
|
12528
|
-
show(message, options) {
|
|
12529
|
-
return shortcut("neutral", message, options);
|
|
12530
|
-
},
|
|
12531
|
-
defaults(partial) {
|
|
12532
|
-
configureToastDefaults(partial);
|
|
12533
|
-
return toast;
|
|
12534
|
-
},
|
|
12535
|
-
byTopCenter() {
|
|
12536
|
-
configureToastDefaults({ position: "topCenter" });
|
|
12537
|
-
return toast;
|
|
12538
|
-
},
|
|
12539
|
-
byTopLeft() {
|
|
12540
|
-
configureToastDefaults({ position: "topLeft" });
|
|
12541
|
-
return toast;
|
|
12542
|
-
},
|
|
12543
|
-
byBottomLeft() {
|
|
12544
|
-
configureToastDefaults({ position: "bottomLeft" });
|
|
12545
|
-
return toast;
|
|
12546
|
-
},
|
|
12547
|
-
byBottomRight() {
|
|
12548
|
-
configureToastDefaults({ position: "bottomRight" });
|
|
12549
|
-
return toast;
|
|
12550
|
-
},
|
|
12551
|
-
dismiss(id) {
|
|
12552
|
-
dismissToasts(id);
|
|
12553
|
-
},
|
|
12554
|
-
promise(promise, texts, options) {
|
|
12555
|
-
const id = options?.id ?? nextToastId();
|
|
12556
|
-
const start = (builder) => {
|
|
12557
|
-
builder.id(id).replace();
|
|
12558
|
-
if (options?.title) builder.title(options.title);
|
|
12559
|
-
if (options?.position) builder.position(options.position);
|
|
12560
|
-
return builder;
|
|
12561
|
-
};
|
|
12562
|
-
start(createBuilder$1().loading()).message(texts.loading);
|
|
12563
|
-
promise.then(
|
|
12564
|
-
(value) => start(createBuilder$1().success()).message(typeof texts.success === "function" ? texts.success(value) : texts.success),
|
|
12565
|
-
(error) => start(createBuilder$1().danger()).message(typeof texts.error === "function" ? texts.error(error) : texts.error)
|
|
12566
|
-
);
|
|
12567
|
-
return promise;
|
|
12568
|
-
}
|
|
12569
|
-
});
|
|
12570
|
-
function isClient() {
|
|
12571
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
12572
|
-
}
|
|
12573
|
-
function nextConfirmId() {
|
|
12574
|
-
return `tao-confirm-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
12575
|
-
}
|
|
12576
|
-
let hostedApp = null;
|
|
12577
|
-
function ensureConfirmHost() {
|
|
12578
|
-
if (!isClient() || hasConfirmHost()) {
|
|
12579
|
-
return;
|
|
12580
|
-
}
|
|
12581
|
-
const host = document.createElement("div");
|
|
12582
|
-
host.setAttribute("data-tao-confirm-root", "");
|
|
12583
|
-
document.body.appendChild(host);
|
|
12584
|
-
hostedApp = createApp(TaoConfirmHost);
|
|
12585
|
-
hostedApp.mount(host);
|
|
12586
|
-
}
|
|
12587
|
-
function createDraft() {
|
|
12588
|
-
return {
|
|
12589
|
-
title: "",
|
|
12590
|
-
message: "",
|
|
12591
|
-
okLabel: confirmDefaults.ok,
|
|
12592
|
-
cancelLabel: confirmDefaults.cancel,
|
|
12593
|
-
danger: false,
|
|
12594
|
-
surface: confirmDefaults.surface
|
|
12595
|
-
};
|
|
12596
|
-
}
|
|
12597
|
-
function createBuilder() {
|
|
12598
|
-
const draft = createDraft();
|
|
12599
|
-
let settle = () => void 0;
|
|
12600
|
-
const promise = new Promise((resolve) => {
|
|
12601
|
-
settle = resolve;
|
|
12602
|
-
});
|
|
12603
|
-
const ctx = {
|
|
12604
|
-
title(value) {
|
|
12605
|
-
draft.title = value;
|
|
12606
|
-
return ctx;
|
|
12607
|
-
},
|
|
12608
|
-
message(value) {
|
|
12609
|
-
draft.message = String(value);
|
|
12610
|
-
return ctx;
|
|
12611
|
-
},
|
|
12612
|
-
ok(label) {
|
|
12613
|
-
draft.okLabel = label;
|
|
12614
|
-
return ctx;
|
|
12615
|
-
},
|
|
12616
|
-
cancel(label) {
|
|
12617
|
-
draft.cancelLabel = label;
|
|
12618
|
-
return ctx;
|
|
12619
|
-
},
|
|
12620
|
-
danger(value = true) {
|
|
12621
|
-
draft.danger = value;
|
|
12622
|
-
return ctx;
|
|
12623
|
-
},
|
|
12624
|
-
surface(value) {
|
|
12625
|
-
draft.surface = value;
|
|
12626
|
-
return ctx;
|
|
12627
|
-
},
|
|
12628
|
-
then(onFulfilled, onRejected) {
|
|
12629
|
-
return promise.then(onFulfilled, onRejected);
|
|
12897
|
+
draft.timeout = 0;
|
|
12898
|
+
return ctx;
|
|
12630
12899
|
}
|
|
12631
12900
|
};
|
|
12632
|
-
setTimeout(() =>
|
|
12633
|
-
if (!isClient() || !draft.title && !draft.message) {
|
|
12634
|
-
settle(false);
|
|
12635
|
-
return;
|
|
12636
|
-
}
|
|
12637
|
-
ensureConfirmHost();
|
|
12638
|
-
enqueueConfirm({
|
|
12639
|
-
id: nextConfirmId(),
|
|
12640
|
-
title: draft.title,
|
|
12641
|
-
message: draft.message,
|
|
12642
|
-
okLabel: draft.okLabel,
|
|
12643
|
-
cancelLabel: draft.cancelLabel,
|
|
12644
|
-
danger: draft.danger,
|
|
12645
|
-
surface: draft.surface,
|
|
12646
|
-
resolve: settle
|
|
12647
|
-
});
|
|
12648
|
-
}, 0);
|
|
12901
|
+
setTimeout(() => flushDraft(draft), 0);
|
|
12649
12902
|
return ctx;
|
|
12650
12903
|
}
|
|
12651
|
-
function
|
|
12652
|
-
|
|
12653
|
-
|
|
12904
|
+
function shortcut(type, message, options) {
|
|
12905
|
+
const builder = createBuilder$1();
|
|
12906
|
+
if (type === "neutral") {
|
|
12907
|
+
builder.show();
|
|
12908
|
+
} else {
|
|
12909
|
+
builder[type]();
|
|
12654
12910
|
}
|
|
12655
|
-
|
|
12656
|
-
|
|
12911
|
+
builder.message(message);
|
|
12912
|
+
if (options?.title) {
|
|
12913
|
+
builder.title(options.title);
|
|
12657
12914
|
}
|
|
12658
|
-
if (options
|
|
12659
|
-
builder.
|
|
12915
|
+
if (options?.timeout !== void 0) {
|
|
12916
|
+
builder.timeout(options.timeout);
|
|
12660
12917
|
}
|
|
12661
|
-
if (options
|
|
12662
|
-
builder.
|
|
12918
|
+
if (options?.position) {
|
|
12919
|
+
builder.position(options.position);
|
|
12663
12920
|
}
|
|
12664
|
-
if (options
|
|
12665
|
-
builder.
|
|
12921
|
+
if (options?.icon) {
|
|
12922
|
+
builder.icon(options.icon);
|
|
12666
12923
|
}
|
|
12667
|
-
if (options
|
|
12668
|
-
builder.
|
|
12924
|
+
if (options?.closable !== void 0) {
|
|
12925
|
+
builder.closable(options.closable);
|
|
12669
12926
|
}
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
function confirmFn(title, options) {
|
|
12673
|
-
const builder = createBuilder();
|
|
12674
|
-
if (title) {
|
|
12675
|
-
builder.title(title);
|
|
12927
|
+
if (options?.progress !== void 0) {
|
|
12928
|
+
builder.progress(options.progress);
|
|
12676
12929
|
}
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
const confirm = Object.assign(confirmFn, {
|
|
12680
|
-
defaults(partial) {
|
|
12681
|
-
configureConfirmDefaults(partial);
|
|
12682
|
-
return confirm;
|
|
12683
|
-
},
|
|
12684
|
-
dismiss() {
|
|
12685
|
-
resolveConfirm(false);
|
|
12930
|
+
if (options?.surface) {
|
|
12931
|
+
builder.surface(options.surface);
|
|
12686
12932
|
}
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
const BLACK = "#0d0d0d";
|
|
12690
|
-
const toLinear = (hex) => {
|
|
12691
|
-
const c = parseColor(hex);
|
|
12692
|
-
if (!c) {
|
|
12693
|
-
throw new Error(`[TaoUI] palette: "${hex}" is not a colour`);
|
|
12933
|
+
if (options?.id) {
|
|
12934
|
+
builder.id(options.id);
|
|
12694
12935
|
}
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
function hexToOklch(hex) {
|
|
12698
|
-
const [r, g, b] = toLinear(hex);
|
|
12699
|
-
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
12700
|
-
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
12701
|
-
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
12702
|
-
const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
|
|
12703
|
-
const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
|
|
12704
|
-
const bb = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
|
|
12705
|
-
return { L, C: Math.hypot(a, bb), H: (Math.atan2(bb, a) * 180 / Math.PI + 360) % 360 };
|
|
12706
|
-
}
|
|
12707
|
-
function oklchToLinear({ L, C, H }) {
|
|
12708
|
-
const a = C * Math.cos(H * Math.PI / 180);
|
|
12709
|
-
const b = C * Math.sin(H * Math.PI / 180);
|
|
12710
|
-
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
12711
|
-
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
12712
|
-
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
12713
|
-
return [
|
|
12714
|
-
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
12715
|
-
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
12716
|
-
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
12717
|
-
];
|
|
12718
|
-
}
|
|
12719
|
-
const inGamut = (rgb) => rgb.every((v) => v >= -5e-4 && v <= 1.0005);
|
|
12720
|
-
function oklchToHex(color) {
|
|
12721
|
-
let { C } = color;
|
|
12722
|
-
let rgb = oklchToLinear({ ...color, C });
|
|
12723
|
-
if (!inGamut(rgb)) {
|
|
12724
|
-
let lo = 0;
|
|
12725
|
-
let hi = C;
|
|
12726
|
-
for (let i = 0; i < 24; i += 1) {
|
|
12727
|
-
const mid = (lo + hi) / 2;
|
|
12728
|
-
if (inGamut(oklchToLinear({ ...color, C: mid }))) {
|
|
12729
|
-
lo = mid;
|
|
12730
|
-
} else {
|
|
12731
|
-
hi = mid;
|
|
12732
|
-
}
|
|
12733
|
-
}
|
|
12734
|
-
C = lo;
|
|
12735
|
-
rgb = oklchToLinear({ ...color, C });
|
|
12936
|
+
if (options?.once) {
|
|
12937
|
+
builder.once();
|
|
12736
12938
|
}
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
}
|
|
12740
|
-
function luminance(hex) {
|
|
12741
|
-
const [r, g, b] = toLinear(hex);
|
|
12742
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
12743
|
-
}
|
|
12744
|
-
function contrastRatio(a, b) {
|
|
12745
|
-
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
12746
|
-
return (hi + 0.05) / (lo + 0.05);
|
|
12747
|
-
}
|
|
12748
|
-
function colourDistance(a, b) {
|
|
12749
|
-
const p = hexToOklch(a);
|
|
12750
|
-
const q = hexToOklch(b);
|
|
12751
|
-
const pa = p.C * Math.cos(p.H * Math.PI / 180);
|
|
12752
|
-
const pb = p.C * Math.sin(p.H * Math.PI / 180);
|
|
12753
|
-
const qa = q.C * Math.cos(q.H * Math.PI / 180);
|
|
12754
|
-
const qb = q.C * Math.sin(q.H * Math.PI / 180);
|
|
12755
|
-
return Math.hypot(p.L - q.L, pa - qa, pb - qb);
|
|
12756
|
-
}
|
|
12757
|
-
const withL = (hex, L) => oklchToHex({ ...hexToOklch(hex), L: Math.min(Math.max(L, 0), 1) });
|
|
12758
|
-
function shiftUntil(hex, direction, ok) {
|
|
12759
|
-
const start = hexToOklch(hex);
|
|
12760
|
-
for (let i = 0; i <= 100; i += 1) {
|
|
12761
|
-
const candidate = oklchToHex({ ...start, L: Math.min(Math.max(start.L + direction * i * 5e-3, 0), 1) });
|
|
12762
|
-
if (ok(candidate)) {
|
|
12763
|
-
return candidate;
|
|
12764
|
-
}
|
|
12939
|
+
if (options?.replace) {
|
|
12940
|
+
builder.replace();
|
|
12765
12941
|
}
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
function apcaContrast(text, background) {
|
|
12769
|
-
const y = (hex) => {
|
|
12770
|
-
const c = parseColor(hex);
|
|
12771
|
-
if (!c) {
|
|
12772
|
-
throw new Error(`[TaoUI] palette: "${hex}" is not a colour`);
|
|
12773
|
-
}
|
|
12774
|
-
const v = 0.2126729 * (c.r / 255) ** 2.4 + 0.7151522 * (c.g / 255) ** 2.4 + 0.072175 * (c.b / 255) ** 2.4;
|
|
12775
|
-
return v < 0.022 ? v + (0.022 - v) ** 1.414 : v;
|
|
12776
|
-
};
|
|
12777
|
-
const t = y(text);
|
|
12778
|
-
const b = y(background);
|
|
12779
|
-
const sapc = b > t ? (b ** 0.56 - t ** 0.57) * 1.14 : (b ** 0.65 - t ** 0.62) * 1.14;
|
|
12780
|
-
if (Math.abs(sapc) < 0.1) {
|
|
12781
|
-
return 0;
|
|
12942
|
+
if (options?.actions) {
|
|
12943
|
+
options.actions.forEach((action) => builder.action(action.label, action.onClick));
|
|
12782
12944
|
}
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
const bestOn = (fill, dark) => dark ? contrastRatio(fill, WHITE) >= contrastRatio(fill, BLACK) ? WHITE : BLACK : Math.abs(apcaContrast(WHITE, fill)) >= Math.abs(apcaContrast(BLACK, fill)) ? WHITE : BLACK;
|
|
12786
|
-
const STATUS = {
|
|
12787
|
-
danger: { range: [8, 40], dark: "#dc3545", light: "#dc3545" },
|
|
12788
|
-
warning: { range: [78, 102], dark: "#d4a017", light: "#b8860b" },
|
|
12789
|
-
success: { range: [135, 168], dark: "#2ea85c", light: "#2ea85c" },
|
|
12790
|
-
info: { range: [232, 272], dark: "#6b9cff", light: "#4c82f7" }
|
|
12791
|
-
};
|
|
12792
|
-
const TAO_STATUS_NAMES = Object.keys(STATUS);
|
|
12793
|
-
const MIN_STATUS_DISTANCE = 0.09;
|
|
12794
|
-
const atmosphere = (dark) => `radial-gradient(ellipse 70% 50% at 75% 0%, color-mix(in srgb, var(--tao-glow) ${dark ? 18 : 10}%, transparent), transparent 70%), radial-gradient(ellipse 60% 45% at 5% 100%, color-mix(in srgb, var(--tao-glow) ${dark ? 10 : 6}%, transparent), transparent 70%)`;
|
|
12795
|
-
function buildPaletteRoles(def, mode) {
|
|
12796
|
-
const dark = mode === "dark";
|
|
12797
|
-
const stops = def.stops.map((s) => hexToOklch(s));
|
|
12798
|
-
const target = dark ? 0.74 : 0.52;
|
|
12799
|
-
const chromatic = stops.map((s, i) => ({ s, i })).filter(({ s }) => s.C >= 0.07);
|
|
12800
|
-
const pool = chromatic.length ? chromatic : stops.map((s, i) => ({ s, i }));
|
|
12801
|
-
const picked = def.accent !== void 0 ? { s: stops[def.accent], i: def.accent } : pool.reduce((best, c) => {
|
|
12802
|
-
const d = Math.abs(c.s.L - target) - c.s.C * 0.15;
|
|
12803
|
-
const bd = Math.abs(best.s.L - target) - best.s.C * 0.15;
|
|
12804
|
-
return d < bd ? c : best;
|
|
12805
|
-
}, pool[0]);
|
|
12806
|
-
const stopHex = def.stops[picked.i];
|
|
12807
|
-
const darkest = stops.reduce((best, s) => s.L < best.L ? s : best, stops[0]);
|
|
12808
|
-
const tintHue = darkest.L < 0.36 && darkest.C >= 0.03 ? darkest.H : picked.s.H;
|
|
12809
|
-
const tint = dark ? { C: 0.028, H: tintHue } : { C: 0.01, H: tintHue };
|
|
12810
|
-
const surface = (L) => oklchToHex({ L, ...tint });
|
|
12811
|
-
const bg = surface(dark ? 0.175 : 0.995);
|
|
12812
|
-
const raised = surface(dark ? 0.225 : 0.965);
|
|
12813
|
-
const hover = surface(dark ? 0.275 : 0.915);
|
|
12814
|
-
const ink = (c) => Math.min(contrastRatio(c, bg), contrastRatio(c, raised));
|
|
12815
|
-
let accent = dark ? shiftUntil(stopHex, 1, (c) => ink(c) >= 3.2) : shiftUntil(stopHex, -1, (c) => ink(c) >= 3.2);
|
|
12816
|
-
let onAccent = bestOn(accent, dark);
|
|
12817
|
-
if (contrastRatio(accent, onAccent) < 4.5) {
|
|
12818
|
-
const toward = onAccent === WHITE ? -1 : 1;
|
|
12819
|
-
accent = shiftUntil(accent, toward, (c) => contrastRatio(c, onAccent) >= 4.5);
|
|
12945
|
+
if (options?.onClosed) {
|
|
12946
|
+
builder.onClosed(options.onClosed);
|
|
12820
12947
|
}
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12948
|
+
return builder;
|
|
12949
|
+
}
|
|
12950
|
+
const toast = Object.assign(createBuilder$1, {
|
|
12951
|
+
success(message, options) {
|
|
12952
|
+
return shortcut("success", message, options);
|
|
12953
|
+
},
|
|
12954
|
+
danger(message, options) {
|
|
12955
|
+
return shortcut("danger", message, options);
|
|
12956
|
+
},
|
|
12957
|
+
warning(message, options) {
|
|
12958
|
+
return shortcut("warning", message, options);
|
|
12959
|
+
},
|
|
12960
|
+
info(message, options) {
|
|
12961
|
+
return shortcut("info", message, options);
|
|
12962
|
+
},
|
|
12963
|
+
show(message, options) {
|
|
12964
|
+
return shortcut("neutral", message, options);
|
|
12965
|
+
},
|
|
12966
|
+
defaults(partial) {
|
|
12967
|
+
configureToastDefaults(partial);
|
|
12968
|
+
return toast;
|
|
12969
|
+
},
|
|
12970
|
+
byTopCenter() {
|
|
12971
|
+
configureToastDefaults({ position: "topCenter" });
|
|
12972
|
+
return toast;
|
|
12973
|
+
},
|
|
12974
|
+
byTopLeft() {
|
|
12975
|
+
configureToastDefaults({ position: "topLeft" });
|
|
12976
|
+
return toast;
|
|
12977
|
+
},
|
|
12978
|
+
byBottomLeft() {
|
|
12979
|
+
configureToastDefaults({ position: "bottomLeft" });
|
|
12980
|
+
return toast;
|
|
12981
|
+
},
|
|
12982
|
+
byBottomRight() {
|
|
12983
|
+
configureToastDefaults({ position: "bottomRight" });
|
|
12984
|
+
return toast;
|
|
12985
|
+
},
|
|
12986
|
+
dismiss(id) {
|
|
12987
|
+
dismissToasts(id);
|
|
12988
|
+
},
|
|
12989
|
+
promise(promise, texts, options) {
|
|
12990
|
+
const id = options?.id ?? nextToastId();
|
|
12991
|
+
const start = (builder) => {
|
|
12992
|
+
builder.id(id).replace();
|
|
12993
|
+
if (options?.title) builder.title(options.title);
|
|
12994
|
+
if (options?.position) builder.position(options.position);
|
|
12995
|
+
return builder;
|
|
12864
12996
|
};
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
if (!own && next.distance >= MIN_STATUS_DISTANCE + 0.02) {
|
|
12872
|
-
best = next;
|
|
12873
|
-
break;
|
|
12874
|
-
}
|
|
12875
|
-
}
|
|
12876
|
-
const { fill, on } = best;
|
|
12877
|
-
const text = shiftUntil(fill, dark ? 1 : -1, (c) => ink(c) >= 4.6);
|
|
12878
|
-
const hoverStep = on === WHITE ? -1 : 1;
|
|
12879
|
-
const fillHover = shiftUntil(fill, hoverStep, (c) => Math.abs(hexToOklch(c).L - hexToOklch(fill).L) >= 0.04);
|
|
12880
|
-
status[name] = { fill, on, text, distance: colourDistance(fill, accent) };
|
|
12881
|
-
statusRoles[`--tao-color-${name}`] = fill;
|
|
12882
|
-
statusRoles[`--tao-color-${name}-hover`] = fillHover;
|
|
12883
|
-
statusRoles[`--tao-color-on-${name}`] = on;
|
|
12884
|
-
statusRoles[`--tao-color-${name}-text`] = text;
|
|
12885
|
-
statusRoles[`--tao-color-${name}-subtle`] = `color-mix(in srgb, var(--tao-color-${name}) ${dark ? 15 : name === "warning" || name === "info" ? 12 : 10}%, transparent)`;
|
|
12997
|
+
start(createBuilder$1().loading()).message(texts.loading);
|
|
12998
|
+
promise.then(
|
|
12999
|
+
(value) => start(createBuilder$1().success()).message(typeof texts.success === "function" ? texts.success(value) : texts.success),
|
|
13000
|
+
(error) => start(createBuilder$1().danger()).message(typeof texts.error === "function" ? texts.error(error) : texts.error)
|
|
13001
|
+
);
|
|
13002
|
+
return promise;
|
|
12886
13003
|
}
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
"--tao-color-surface": bg,
|
|
12899
|
-
"--tao-color-surface-raised": raised,
|
|
12900
|
-
"--tao-color-surface-hover": hover,
|
|
12901
|
-
"--tao-color-link": dark ? accentText : "var(--tao-color-text-strong)",
|
|
12902
|
-
"--tao-color-link-hover": accentTextHover,
|
|
12903
|
-
// what is built from the roles above: written out, because a value declared on an ancestor is already
|
|
12904
|
-
// resolved when a nested element changes the palette
|
|
12905
|
-
"--tao-color-accent-subtle": `color-mix(in srgb, var(--tao-color-accent) ${dark ? 8 : 10}%, transparent)`,
|
|
12906
|
-
"--tao-color-accent-subtle-hover": `color-mix(in srgb, var(--tao-color-accent) ${dark ? 14 : 16}%, transparent)`,
|
|
12907
|
-
"--tao-color-selection": "var(--tao-color-accent)",
|
|
12908
|
-
"--tao-color-selection-text": "var(--tao-color-on-accent)",
|
|
12909
|
-
"--tao-color-link-shadow": dark ? "0 0 1px color-mix(in srgb, var(--tao-color-accent) 10%, transparent), 0 0 6px color-mix(in srgb, var(--tao-color-accent) 60%, transparent)" : "none",
|
|
12910
|
-
"--tao-glass-fill": dark ? "color-mix(in srgb, var(--tao-color-surface-raised) 55%, transparent)" : "color-mix(in srgb, var(--tao-color-surface) 60%, transparent)",
|
|
12911
|
-
"--tao-bg-atmosphere": atmosphere(dark),
|
|
12912
|
-
...statusRoles,
|
|
12913
|
-
// the series built on roles; violet and pink (chart-4, chart-6) are the theme's own, except that a palette
|
|
12914
|
-
// gives its second stop to chart-4: a violet accent would meet the fixed violet otherwise
|
|
12915
|
-
// серии на ролях; фиолетовый и розовый — свои у темы, только chart-4 палитра отдаёт второму стопу
|
|
12916
|
-
"--tao-color-chart-1": "var(--tao-color-accent)",
|
|
12917
|
-
"--tao-color-chart-2": "var(--tao-color-info)",
|
|
12918
|
-
"--tao-color-chart-3": "var(--tao-color-success)",
|
|
12919
|
-
"--tao-color-chart-4": "var(--tao-color-accent-2)",
|
|
12920
|
-
"--tao-color-chart-5": "var(--tao-color-warning)"
|
|
12921
|
-
};
|
|
12922
|
-
for (const name of TAO_STATUS_NAMES) {
|
|
12923
|
-
roles[`--tao-color-${name}-text-hover`] = `color-mix(in srgb, var(--tao-color-${name}-text) 85%, var(--tao-color-text-strong))`;
|
|
13004
|
+
});
|
|
13005
|
+
function isClient() {
|
|
13006
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
13007
|
+
}
|
|
13008
|
+
function nextConfirmId() {
|
|
13009
|
+
return `tao-confirm-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
13010
|
+
}
|
|
13011
|
+
let hostedApp = null;
|
|
13012
|
+
function ensureConfirmHost() {
|
|
13013
|
+
if (!isClient() || hasConfirmHost()) {
|
|
13014
|
+
return;
|
|
12924
13015
|
}
|
|
12925
|
-
|
|
13016
|
+
const host = document.createElement("div");
|
|
13017
|
+
host.setAttribute("data-tao-confirm-root", "");
|
|
13018
|
+
document.body.appendChild(host);
|
|
13019
|
+
hostedApp = createApp(TaoConfirmHost);
|
|
13020
|
+
hostedApp.mount(host);
|
|
12926
13021
|
}
|
|
12927
|
-
function
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
return `${selector} {
|
|
12937
|
-
${lines.join("\n")}
|
|
13022
|
+
function createDraft() {
|
|
13023
|
+
return {
|
|
13024
|
+
title: "",
|
|
13025
|
+
message: "",
|
|
13026
|
+
okLabel: confirmDefaults.ok,
|
|
13027
|
+
cancelLabel: confirmDefaults.cancel,
|
|
13028
|
+
danger: false,
|
|
13029
|
+
surface: confirmDefaults.surface
|
|
13030
|
+
};
|
|
12938
13031
|
}
|
|
12939
|
-
|
|
13032
|
+
function createBuilder() {
|
|
13033
|
+
const draft = createDraft();
|
|
13034
|
+
let settle = () => void 0;
|
|
13035
|
+
const promise = new Promise((resolve) => {
|
|
13036
|
+
settle = resolve;
|
|
13037
|
+
});
|
|
13038
|
+
const ctx = {
|
|
13039
|
+
title(value) {
|
|
13040
|
+
draft.title = value;
|
|
13041
|
+
return ctx;
|
|
13042
|
+
},
|
|
13043
|
+
message(value) {
|
|
13044
|
+
draft.message = String(value);
|
|
13045
|
+
return ctx;
|
|
13046
|
+
},
|
|
13047
|
+
ok(label) {
|
|
13048
|
+
draft.okLabel = label;
|
|
13049
|
+
return ctx;
|
|
13050
|
+
},
|
|
13051
|
+
cancel(label) {
|
|
13052
|
+
draft.cancelLabel = label;
|
|
13053
|
+
return ctx;
|
|
13054
|
+
},
|
|
13055
|
+
danger(value = true) {
|
|
13056
|
+
draft.danger = value;
|
|
13057
|
+
return ctx;
|
|
13058
|
+
},
|
|
13059
|
+
surface(value) {
|
|
13060
|
+
draft.surface = value;
|
|
13061
|
+
return ctx;
|
|
13062
|
+
},
|
|
13063
|
+
then(onFulfilled, onRejected) {
|
|
13064
|
+
return promise.then(onFulfilled, onRejected);
|
|
13065
|
+
}
|
|
12940
13066
|
};
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
13067
|
+
setTimeout(() => {
|
|
13068
|
+
if (!isClient() || !draft.title && !draft.message) {
|
|
13069
|
+
settle(false);
|
|
13070
|
+
return;
|
|
13071
|
+
}
|
|
13072
|
+
ensureConfirmHost();
|
|
13073
|
+
enqueueConfirm({
|
|
13074
|
+
id: nextConfirmId(),
|
|
13075
|
+
title: draft.title,
|
|
13076
|
+
message: draft.message,
|
|
13077
|
+
okLabel: draft.okLabel,
|
|
13078
|
+
cancelLabel: draft.cancelLabel,
|
|
13079
|
+
danger: draft.danger,
|
|
13080
|
+
surface: draft.surface,
|
|
13081
|
+
resolve: settle
|
|
13082
|
+
});
|
|
13083
|
+
}, 0);
|
|
13084
|
+
return ctx;
|
|
12950
13085
|
}
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
if (!target) {
|
|
12955
|
-
return () => {
|
|
12956
|
-
};
|
|
13086
|
+
function applyOptions(builder, options) {
|
|
13087
|
+
if (!options) {
|
|
13088
|
+
return builder;
|
|
12957
13089
|
}
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
target.style.setProperty(name, value);
|
|
13090
|
+
if (options.message) {
|
|
13091
|
+
builder.message(options.message);
|
|
12961
13092
|
}
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
13093
|
+
if (options.ok) {
|
|
13094
|
+
builder.ok(options.ok);
|
|
13095
|
+
}
|
|
13096
|
+
if (options.cancel) {
|
|
13097
|
+
builder.cancel(options.cancel);
|
|
13098
|
+
}
|
|
13099
|
+
if (options.danger) {
|
|
13100
|
+
builder.danger(true);
|
|
13101
|
+
}
|
|
13102
|
+
if (options.surface) {
|
|
13103
|
+
builder.surface(options.surface);
|
|
13104
|
+
}
|
|
13105
|
+
return builder;
|
|
12969
13106
|
}
|
|
13107
|
+
function confirmFn(title, options) {
|
|
13108
|
+
const builder = createBuilder();
|
|
13109
|
+
if (title) {
|
|
13110
|
+
builder.title(title);
|
|
13111
|
+
}
|
|
13112
|
+
return applyOptions(builder, options);
|
|
13113
|
+
}
|
|
13114
|
+
const confirm = Object.assign(confirmFn, {
|
|
13115
|
+
defaults(partial) {
|
|
13116
|
+
configureConfirmDefaults(partial);
|
|
13117
|
+
return confirm;
|
|
13118
|
+
},
|
|
13119
|
+
dismiss() {
|
|
13120
|
+
resolveConfirm(false);
|
|
13121
|
+
}
|
|
13122
|
+
});
|
|
12970
13123
|
const taoPalettes = [
|
|
12971
13124
|
{ name: "sunset", label: "Sunset", stops: ["#EA6113", "#F88F22", "#FBB931", "#FFE3B3"] },
|
|
12972
13125
|
{ name: "marple", label: "Marple", stops: ["#CA2851", "#FF6766", "#FFB173", "#FFE3B3"] },
|
|
@@ -13037,7 +13190,7 @@ const components = [
|
|
|
13037
13190
|
TaoSpoilerGroup,
|
|
13038
13191
|
TaoCopy,
|
|
13039
13192
|
TaoContainer,
|
|
13040
|
-
_sfc_main
|
|
13193
|
+
_sfc_main$_,
|
|
13041
13194
|
TaoSpace,
|
|
13042
13195
|
TaoGrid,
|
|
13043
13196
|
TaoGridItem,
|
|
@@ -13053,7 +13206,7 @@ const components = [
|
|
|
13053
13206
|
TaoTextarea,
|
|
13054
13207
|
TaoScrollTop,
|
|
13055
13208
|
TaoProgress,
|
|
13056
|
-
_sfc_main$
|
|
13209
|
+
_sfc_main$16,
|
|
13057
13210
|
_sfc_main$M,
|
|
13058
13211
|
TaoFileDrop,
|
|
13059
13212
|
TaoDropdownMenu,
|
|
@@ -13147,7 +13300,7 @@ export {
|
|
|
13147
13300
|
TaoEmpty,
|
|
13148
13301
|
TaoFieldset,
|
|
13149
13302
|
TaoFileDrop,
|
|
13150
|
-
_sfc_main
|
|
13303
|
+
_sfc_main$_ as TaoFlex,
|
|
13151
13304
|
TaoFormField,
|
|
13152
13305
|
TaoGrid,
|
|
13153
13306
|
TaoGridItem,
|
|
@@ -13181,7 +13334,7 @@ export {
|
|
|
13181
13334
|
TaoSegmentedOption,
|
|
13182
13335
|
TaoSelect,
|
|
13183
13336
|
TaoSkeleton,
|
|
13184
|
-
_sfc_main$
|
|
13337
|
+
_sfc_main$16 as TaoSlider,
|
|
13185
13338
|
TaoSpace,
|
|
13186
13339
|
TaoSparkline,
|
|
13187
13340
|
TaoSplit,
|