@moubing/bing-ui 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +300 -171
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/bing-ui.css +1 -1
- package/dist/components/BingAnimatedText/BingAnimatedText.js +7 -0
- package/dist/components/BingAnimatedText/BingAnimatedText.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.js +7 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.js +7 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.vue.d.ts +4 -4
- package/dist/components/BingAutocomplete/BingAutocomplete.vue_vue_type_script_setup_true_lang.js +560 -0
- package/dist/components/BingButton/BingButton.js +7 -0
- package/dist/components/BingButton/BingButton.vue.d.ts +2 -2
- package/dist/components/BingButton/BingButton.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BingCard/BingCard.js +7 -0
- package/dist/components/BingCard/BingCard.vue_vue_type_script_setup_true_lang.js +481 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.js +7 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/BingCheckbox/BingCheckbox.js +7 -0
- package/dist/components/BingCheckbox/BingCheckbox.vue.d.ts +4 -4
- package/dist/components/BingCheckbox/BingCheckbox.vue_vue_type_script_setup_true_lang.js +233 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.context.js +4 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.js +7 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.highlight.js +78 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.js +7 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.vue_vue_type_script_setup_true_lang.js +347 -0
- package/dist/components/BingColorPicker/BingColorPicker.js +7 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.d.ts +70 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.js +265 -0
- package/dist/components/BingColorPicker/BingColorPicker.vue.d.ts +7 -7
- package/dist/components/BingColorPicker/BingColorPicker.vue_vue_type_script_setup_true_lang.js +540 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue.d.ts +27 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue.d.ts +26 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.js +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.types.d.ts +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue.d.ts +18 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/components/BingConfigProvider/index.d.ts +3 -0
- package/dist/components/BingCursor/BingCursor.controller.js +240 -0
- package/dist/components/BingCursor/BingCursor.js +7 -0
- package/dist/components/BingCursor/BingCursor.native.js +20 -0
- package/dist/components/BingCursor/BingCursor.presets.js +60 -0
- package/dist/components/BingCursor/BingCursor.shapes.js +83 -0
- package/dist/components/BingCursor/BingCursor.styleSource.js +83 -0
- package/dist/components/BingCursor/BingCursor.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/BingDatePicker/BingDatePicker.js +7 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.js +137 -0
- package/dist/components/BingDatePicker/BingDatePicker.vue.d.ts +14 -14
- package/dist/components/BingDatePicker/BingDatePicker.vue_vue_type_script_setup_true_lang.js +804 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue.d.ts +37 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue_vue_type_script_setup_true_lang.js +248 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.js +7 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/BingDialog/BingDialog.js +7 -0
- package/dist/components/BingDialog/BingDialog.vue.d.ts +4 -5
- package/dist/components/BingDialog/BingDialog.vue_vue_type_script_setup_true_lang.js +558 -0
- package/dist/components/BingDropDown/BingDropDown.context.js +4 -0
- package/dist/components/BingDropDown/BingDropDown.js +7 -0
- package/dist/components/BingDropDown/BingDropDown.vue.d.ts +1 -2
- package/dist/components/BingDropDown/BingDropDown.vue_vue_type_script_setup_true_lang.js +649 -0
- package/dist/components/BingDropDown/BingDropDownItem.js +7 -0
- package/dist/components/BingDropDown/BingDropDownItem.vue.d.ts +1 -1
- package/dist/components/BingDropDown/BingDropDownItem.vue_vue_type_script_setup_true_lang.js +308 -0
- package/dist/components/BingFilePreview/BingFilePreview.js +7 -0
- package/dist/components/BingFilePreview/BingFilePreview.vue.d.ts +4 -5
- package/dist/components/BingFilePreview/BingFilePreview.vue_vue_type_script_setup_true_lang.js +589 -0
- package/dist/components/BingForm/BingForm.context.js +7 -0
- package/dist/components/BingForm/BingForm.js +7 -0
- package/dist/components/BingForm/BingForm.vue.d.ts +0 -1
- package/dist/components/BingForm/BingForm.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/components/BingForm/formFocus.js +13 -0
- package/dist/components/BingForm/formTabOrder.js +27 -0
- package/dist/components/BingForm/useFormControl.d.ts +1 -1
- package/dist/components/BingForm/useFormControl.js +24 -0
- package/dist/components/BingForm/useFormNextHint.js +135 -0
- package/dist/components/BingFormItem/BingFormItem.js +7 -0
- package/dist/components/BingFormItem/BingFormItem.vue.d.ts +1 -1
- package/dist/components/BingFormItem/BingFormItem.vue_vue_type_script_setup_true_lang.js +252 -0
- package/dist/components/BingIcon/BingIcon.js +7 -0
- package/dist/components/BingIcon/BingIcon.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/BingImage/BingImage.js +7 -0
- package/dist/components/BingImage/BingImage.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingImagePreview/BingImagePreview.js +7 -0
- package/dist/components/BingImagePreview/BingImagePreview.vue.d.ts +4 -5
- package/dist/components/BingImagePreview/BingImagePreview.vue_vue_type_script_setup_true_lang.js +699 -0
- package/dist/components/BingInput/BingInput.js +7 -0
- package/dist/components/BingInput/BingInput.vue.d.ts +6 -6
- package/dist/components/BingInput/BingInput.vue_vue_type_script_setup_true_lang.js +311 -0
- package/dist/components/BingRadio/BingRadio.js +7 -0
- package/dist/components/BingRadio/BingRadio.vue.d.ts +4 -4
- package/dist/components/BingRadio/BingRadio.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.context.js +4 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.js +7 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.vue.d.ts +4 -4
- package/dist/components/BingRadioGroup/BingRadioGroup.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/BingResizable/BingResizable.js +7 -0
- package/dist/components/BingResizable/BingResizable.vue.d.ts +1 -1
- package/dist/components/BingResizable/BingResizable.vue_vue_type_script_setup_true_lang.js +555 -0
- package/dist/components/BingScrollbar/BingScrollbar.js +7 -0
- package/dist/components/BingScrollbar/BingScrollbar.vue.d.ts +2 -2
- package/dist/components/BingScrollbar/BingScrollbar.vue_vue_type_script_setup_true_lang.js +398 -0
- package/dist/components/BingSelect/BingSelect.js +7 -0
- package/dist/components/BingSelect/BingSelect.vue.d.ts +7 -7
- package/dist/components/BingSelect/BingSelect.vue_vue_type_script_setup_true_lang.js +1066 -0
- package/dist/components/BingSlider/BingSlider.js +7 -0
- package/dist/components/BingSlider/BingSlider.vue.d.ts +6 -6
- package/dist/components/BingSlider/BingSlider.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/components/BingSortableList/BingSortableList.js +7 -0
- package/dist/components/BingSortableList/BingSortableList.vue_vue_type_script_setup_true_lang.js +334 -0
- package/dist/components/BingSortableList/BingSortableListItem.js +7 -0
- package/dist/components/BingSortableList/BingSortableListItem.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/components/BingSplitPane/BingSplitPane.js +7 -0
- package/dist/components/BingSplitPane/BingSplitPane.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/BingTable/BingTable.js +7 -0
- package/dist/components/BingTable/BingTable.measurements.js +72 -0
- package/dist/components/BingTable/BingTable.vue.d.ts +1 -2
- package/dist/components/BingTable/BingTable.vue_vue_type_script_setup_true_lang.js +1416 -0
- package/dist/components/BingTable/BingTableCellValue.js +7 -0
- package/dist/components/BingTable/BingTableCellValue.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/BingTable/BingTableHeaderCell.js +5 -0
- package/dist/components/BingTable/BingTableHeaderCell.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/BingTable/BingTableHeaderContent.js +7 -0
- package/dist/components/BingTable/BingTableHeaderContent.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/components/BingTable/useTableColumns.js +126 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.js +7 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue.d.ts +1 -1
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/BingTabs/BingTabs.js +7 -0
- package/dist/components/BingTabs/BingTabs.vue.d.ts +2 -3
- package/dist/components/BingTabs/BingTabs.vue_vue_type_script_setup_true_lang.js +320 -0
- package/dist/components/BingTag/BingTag.js +7 -0
- package/dist/components/BingTag/BingTag.vue.d.ts +0 -1
- package/dist/components/BingTag/BingTag.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BingTextarea/BingTextarea.js +7 -0
- package/dist/components/BingTextarea/BingTextarea.vue.d.ts +6 -6
- package/dist/components/BingTextarea/BingTextarea.vue_vue_type_script_setup_true_lang.js +243 -0
- package/dist/components/BingToast/BingToast.js +7 -0
- package/dist/components/BingToast/BingToast.service.js +132 -0
- package/dist/components/BingToast/BingToast.types.d.ts +1 -1
- package/dist/components/BingToast/BingToast.types.js +19 -0
- package/dist/components/BingToast/BingToast.vue.d.ts +0 -1
- package/dist/components/BingToast/BingToast.vue_vue_type_script_setup_true_lang.js +307 -0
- package/dist/components/BingTooltip/BingTooltip.js +7 -0
- package/dist/components/BingTooltip/BingTooltip.shared.js +14 -0
- package/dist/components/BingTooltip/BingTooltip.vue.d.ts +4 -5
- package/dist/components/BingTooltip/BingTooltip.vue_vue_type_script_setup_true_lang.js +572 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.js +7 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.vue.d.ts +7 -7
- package/dist/components/BingTreeSelect/BingTreeSelect.vue_vue_type_script_setup_true_lang.js +1274 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/icons/LICENSE-lucide.txt +39 -0
- package/dist/icons/createIcon.d.ts +8 -0
- package/dist/icons/createIcon.js +36 -0
- package/dist/icons/icons.d.ts +51 -0
- package/dist/icons/icons.js +252 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/index.js +48 -0
- package/dist/motion/clickParticles.d.ts +1 -1
- package/dist/motion/clickParticles2.js +66 -0
- package/dist/motion/index.d.ts +1 -1
- package/dist/motion/index.js +17 -0
- package/dist/motion/liquidHover.js +36 -0
- package/dist/motion/optionDetailMotion.d.ts +7 -1
- package/dist/motion/optionDetailMotion.js +74 -0
- package/dist/motion/panelMotion.js +19 -0
- package/dist/motion/reducedMotion.d.ts +16 -0
- package/dist/motion/reducedMotion.js +28 -0
- package/dist/motion/selectPanelMotion.js +115 -0
- package/dist/motion/smoothScroll.d.ts +2 -0
- package/dist/motion/smoothScroll.js +276 -0
- package/dist/motion/useClickFeedback.js +47 -0
- package/dist/motion/useTextControlCaret.js +136 -0
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/clipboard.js +16 -0
- package/dist/utils/config.d.ts +42 -0
- package/dist/utils/config.js +37 -0
- package/dist/utils/controlAttrs.js +37 -0
- package/dist/utils/floating.d.ts +86 -0
- package/dist/utils/floating.js +99 -0
- package/dist/utils/glass.js +25 -0
- package/dist/utils/overlay.js +94 -0
- package/dist/utils/scrollLock.js +44 -0
- package/dist/utils/search.d.ts +16 -0
- package/dist/utils/search.js +23 -0
- package/dist/utils/useClientReady.js +10 -0
- package/dist/utils/useDeferredBlurValidation.d.ts +18 -0
- package/dist/utils/useDeferredBlurValidation.js +34 -0
- package/dist/utils/useKeyboardScrollSync.d.ts +11 -0
- package/dist/utils/useKeyboardScrollSync.js +28 -0
- package/dist/utils/useOptionDetailPanel.d.ts +50 -0
- package/dist/utils/useOptionDetailPanel.js +180 -0
- package/dist/utils/useOutsidePointerDown.d.ts +8 -0
- package/dist/utils/useOutsidePointerDown.js +17 -0
- package/dist/utils/useSearchShortcutFocus.d.ts +18 -0
- package/dist/utils/useSearchShortcutFocus.js +47 -0
- package/dist/utils/useVirtualList.d.ts +42 -0
- package/dist/utils/useVirtualList.js +74 -0
- package/package.json +15 -9
- package/dist/bing-ui.es.js +0 -31278
- package/dist/bing-ui.umd.js +0 -229
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import e from "../BingButton/BingButton.js";
|
|
2
|
+
import { Check as t, Copy as n } from "../../icons/icons.js";
|
|
3
|
+
import r from "../BingIcon/BingIcon.js";
|
|
4
|
+
import i from "../BingSelect/BingSelect.js";
|
|
5
|
+
import { getColorFormatValue as a, getFormatLabel as o, parseColorInput as s } from "./BingColorPicker.utils.js";
|
|
6
|
+
import { computed as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, mergeModels as p, normalizeClass as m, openBlock as h, ref as g, unref as _, useModel as v, watch as y, withCtx as b } from "vue";
|
|
7
|
+
//#region src/components/BingColorPicker/BingColorPickerFormatEditor.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var x = ["for"], S = [
|
|
9
|
+
"id",
|
|
10
|
+
"value",
|
|
11
|
+
"aria-invalid",
|
|
12
|
+
"disabled"
|
|
13
|
+
], C = /* @__PURE__ */ f({
|
|
14
|
+
__name: "BingColorPickerFormatEditor",
|
|
15
|
+
props: /* @__PURE__ */ p({
|
|
16
|
+
idPrefix: {},
|
|
17
|
+
color: {},
|
|
18
|
+
disabled: { type: Boolean },
|
|
19
|
+
copied: { type: Boolean },
|
|
20
|
+
copyLabel: {},
|
|
21
|
+
copiedLabel: {}
|
|
22
|
+
}, {
|
|
23
|
+
format: { required: !0 },
|
|
24
|
+
formatModifiers: {}
|
|
25
|
+
}),
|
|
26
|
+
emits: /* @__PURE__ */ p([
|
|
27
|
+
"commit",
|
|
28
|
+
"blur",
|
|
29
|
+
"copy"
|
|
30
|
+
], ["update:format"]),
|
|
31
|
+
setup(f, { emit: p }) {
|
|
32
|
+
let C = [
|
|
33
|
+
{
|
|
34
|
+
label: "HEX",
|
|
35
|
+
value: "hex"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "RGBA",
|
|
39
|
+
value: "rgba"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "HSL",
|
|
43
|
+
value: "hsl"
|
|
44
|
+
}
|
|
45
|
+
], w = v(f, "format"), T = f, E = p, D = c(() => `${T.idPrefix}-format`), O = c(() => `${T.idPrefix}-format-input`), k = g(""), A = g(!1), j = g(!1), M = c(() => ({
|
|
46
|
+
format: w.value,
|
|
47
|
+
label: o(w.value),
|
|
48
|
+
value: a(T.color, w.value)
|
|
49
|
+
})), N = c(() => `${T.copied ? T.copiedLabel : T.copyLabel} ${M.value.label}`);
|
|
50
|
+
y(M, (e) => {
|
|
51
|
+
A.value || (k.value = e.value, j.value = !1);
|
|
52
|
+
}, { immediate: !0 });
|
|
53
|
+
function P() {
|
|
54
|
+
k.value = M.value.value, j.value = !1;
|
|
55
|
+
}
|
|
56
|
+
function F(e = !1) {
|
|
57
|
+
let t = s(k.value);
|
|
58
|
+
return t ? (j.value = !1, E("commit", t, e), e && P(), !0) : (j.value = k.value.trim().length > 0, !1);
|
|
59
|
+
}
|
|
60
|
+
function I() {
|
|
61
|
+
A.value = !0;
|
|
62
|
+
}
|
|
63
|
+
function L(e) {
|
|
64
|
+
let t = e.target;
|
|
65
|
+
t instanceof HTMLInputElement && (k.value = t.value, F());
|
|
66
|
+
}
|
|
67
|
+
function R() {
|
|
68
|
+
A.value = !1, F(!0) || P(), E("blur");
|
|
69
|
+
}
|
|
70
|
+
function z(e) {
|
|
71
|
+
if (e.key === "Enter") {
|
|
72
|
+
e.preventDefault(), A.value = !1, F(!0), e.currentTarget?.blur();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
e.key === "Escape" && (e.preventDefault(), A.value = !1, P(), e.currentTarget?.blur());
|
|
76
|
+
}
|
|
77
|
+
return (a, o) => (h(), l("div", { class: m(["bing-color-picker__format-editor", { "is-invalid": j.value }]) }, [
|
|
78
|
+
d(i, {
|
|
79
|
+
id: D.value,
|
|
80
|
+
modelValue: w.value,
|
|
81
|
+
"onUpdate:modelValue": o[0] ||= (e) => w.value = e,
|
|
82
|
+
class: "bing-color-picker__format-select",
|
|
83
|
+
options: C,
|
|
84
|
+
size: "sm",
|
|
85
|
+
width: "86px",
|
|
86
|
+
"min-width": 86,
|
|
87
|
+
clearable: !1,
|
|
88
|
+
searchable: !1,
|
|
89
|
+
"show-select-all": !1,
|
|
90
|
+
virtual: !1,
|
|
91
|
+
"panel-placement": "left",
|
|
92
|
+
"panel-align": "middle",
|
|
93
|
+
"panel-gap": 18,
|
|
94
|
+
"panel-max-height": 180,
|
|
95
|
+
"aria-label": "颜色格式",
|
|
96
|
+
disabled: f.disabled
|
|
97
|
+
}, null, 8, [
|
|
98
|
+
"id",
|
|
99
|
+
"modelValue",
|
|
100
|
+
"disabled"
|
|
101
|
+
]),
|
|
102
|
+
u("label", {
|
|
103
|
+
class: "bing-color-picker__sr-only",
|
|
104
|
+
for: O.value
|
|
105
|
+
}, " 颜色值 ", 8, x),
|
|
106
|
+
u("input", {
|
|
107
|
+
id: O.value,
|
|
108
|
+
class: "bing-color-picker__format-input",
|
|
109
|
+
type: "text",
|
|
110
|
+
value: k.value,
|
|
111
|
+
"aria-invalid": j.value || void 0,
|
|
112
|
+
disabled: f.disabled,
|
|
113
|
+
autocomplete: "off",
|
|
114
|
+
autocapitalize: "off",
|
|
115
|
+
spellcheck: "false",
|
|
116
|
+
onFocus: I,
|
|
117
|
+
onInput: L,
|
|
118
|
+
onBlur: R,
|
|
119
|
+
onKeydown: z
|
|
120
|
+
}, null, 40, S),
|
|
121
|
+
d(e, {
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
size: "xs",
|
|
124
|
+
rounded: "sm",
|
|
125
|
+
throttle: !1,
|
|
126
|
+
class: "bing-color-picker__copy",
|
|
127
|
+
"aria-label": N.value,
|
|
128
|
+
disabled: f.disabled,
|
|
129
|
+
onClick: o[1] ||= (e) => E("copy", M.value.format, M.value.value)
|
|
130
|
+
}, {
|
|
131
|
+
prefix: b(() => [d(r, {
|
|
132
|
+
icon: f.copied ? _(t) : _(n),
|
|
133
|
+
size: "xs",
|
|
134
|
+
"stroke-width": 1.75
|
|
135
|
+
}, null, 8, ["icon"])]),
|
|
136
|
+
_: 1
|
|
137
|
+
}, 8, ["aria-label", "disabled"])
|
|
138
|
+
], 2));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
//#endregion
|
|
142
|
+
export { C as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/BingColorPicker/BingColorPickerSpectrum.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-13451544"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BingColorPickerChangeSource } from './BingColorPicker.types';
|
|
2
|
+
import { ColorValue } from './BingColorPicker.utils';
|
|
3
|
+
type SpectrumSource = Extract<BingColorPickerChangeSource, 'field' | 'slider'>;
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
idPrefix: string;
|
|
6
|
+
hue: number;
|
|
7
|
+
saturation: number;
|
|
8
|
+
value: number;
|
|
9
|
+
color: ColorValue;
|
|
10
|
+
alpha: number;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function cancelDrag(): void;
|
|
14
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {
|
|
15
|
+
cancelDrag: typeof cancelDrag;
|
|
16
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
17
|
+
commit: (source: "alpha" | SpectrumSource) => any;
|
|
18
|
+
"hsv-change": (hue: number, saturation: number, value: number, source: SpectrumSource) => any;
|
|
19
|
+
"alpha-change": (alpha: number) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onCommit?: ((source: "alpha" | SpectrumSource) => any) | undefined;
|
|
22
|
+
"onHsv-change"?: ((hue: number, saturation: number, value: number, source: SpectrumSource) => any) | undefined;
|
|
23
|
+
"onAlpha-change"?: ((alpha: number) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { clamp as e } from "./BingColorPicker.utils.js";
|
|
2
|
+
import { computed as t, createElementBlock as n, createElementVNode as r, defineComponent as i, normalizeStyle as a, onBeforeUnmount as o, openBlock as s, ref as c, toDisplayString as l } from "vue";
|
|
3
|
+
//#region src/components/BingColorPicker/BingColorPickerSpectrum.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var u = { class: "bing-color-picker__spectrum" }, d = ["aria-valuetext", "aria-disabled"], f = { class: "bing-color-picker__spectrum-controls" }, p = { class: "bing-color-picker__spectrum-row" }, m = ["for"], h = [
|
|
5
|
+
"id",
|
|
6
|
+
"value",
|
|
7
|
+
"disabled"
|
|
8
|
+
], g = { class: "bing-color-picker__spectrum-value" }, _ = { class: "bing-color-picker__spectrum-row" }, v = ["for"], y = [
|
|
9
|
+
"id",
|
|
10
|
+
"value",
|
|
11
|
+
"disabled"
|
|
12
|
+
], b = { class: "bing-color-picker__spectrum-value" }, x = 84, S = 93, C = /* @__PURE__ */ i({
|
|
13
|
+
__name: "BingColorPickerSpectrum",
|
|
14
|
+
props: {
|
|
15
|
+
idPrefix: {},
|
|
16
|
+
hue: {},
|
|
17
|
+
saturation: {},
|
|
18
|
+
value: {},
|
|
19
|
+
color: {},
|
|
20
|
+
alpha: {},
|
|
21
|
+
disabled: { type: Boolean }
|
|
22
|
+
},
|
|
23
|
+
emits: [
|
|
24
|
+
"hsv-change",
|
|
25
|
+
"alpha-change",
|
|
26
|
+
"commit"
|
|
27
|
+
],
|
|
28
|
+
setup(i, { expose: C, emit: w }) {
|
|
29
|
+
let T = i, E = w, D = t(() => `${T.idPrefix}-hue`), O = t(() => `${T.idPrefix}-alpha`), k = c(null), A = !1, j = !1, M = t(() => Math.round(T.alpha * 100)), N = t(() => ({ "--bing-color-picker-selected-color": T.color.rgba })), P = t(() => ({ "--bing-color-picker-field-hue": `hsl(${T.hue}, 100%, 50%)` })), F = t(() => ({
|
|
30
|
+
...N.value,
|
|
31
|
+
left: `${T.saturation}%`,
|
|
32
|
+
top: `${100 - T.value}%`
|
|
33
|
+
})), I = t(() => `饱和度 ${Math.round(T.saturation)}%,亮度 ${Math.round(T.value)}%`), L = t(() => ({ "--bing-color-picker-thumb-color": T.color.hex })), R = t(() => ({
|
|
34
|
+
"--bing-color-picker-alpha-rgb": `${T.color.rgb.r}, ${T.color.rgb.g}, ${T.color.rgb.b}`,
|
|
35
|
+
"--bing-color-picker-thumb-color": T.color.rgba
|
|
36
|
+
}));
|
|
37
|
+
o(Z);
|
|
38
|
+
function z() {
|
|
39
|
+
return typeof window < "u" && typeof document < "u";
|
|
40
|
+
}
|
|
41
|
+
function B(t, n) {
|
|
42
|
+
let r = k.value;
|
|
43
|
+
if (!r) return;
|
|
44
|
+
let i = r.getBoundingClientRect(), a = i.width || 1, o = i.height || 1, s = e((t - i.left) / a, 0, 1), c = e((n - i.top) / o, 0, 1);
|
|
45
|
+
return {
|
|
46
|
+
saturation: Math.round(s * 100),
|
|
47
|
+
value: Math.round((1 - c) * 100)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function V(e, t) {
|
|
51
|
+
let n = B(e, t);
|
|
52
|
+
n && E("hsv-change", T.hue, n.saturation, n.value, "field");
|
|
53
|
+
}
|
|
54
|
+
function H(e) {
|
|
55
|
+
T.disabled || (e.preventDefault(), k.value?.focus(), j = !0, V(e.clientX, e.clientY), X());
|
|
56
|
+
}
|
|
57
|
+
function U(e) {
|
|
58
|
+
j && (e.preventDefault(), V(e.clientX, e.clientY));
|
|
59
|
+
}
|
|
60
|
+
function W(e) {
|
|
61
|
+
j && (e.preventDefault(), V(e.clientX, e.clientY), j = !1, Z(), E("commit", "field"));
|
|
62
|
+
}
|
|
63
|
+
function G(e) {
|
|
64
|
+
if (T.disabled) return;
|
|
65
|
+
let t = e.shiftKey ? 10 : 2, n = T.saturation, r = T.value;
|
|
66
|
+
if (e.key === "ArrowLeft") n -= t;
|
|
67
|
+
else if (e.key === "ArrowRight") n += t;
|
|
68
|
+
else if (e.key === "ArrowDown") r -= t;
|
|
69
|
+
else if (e.key === "ArrowUp") r += t;
|
|
70
|
+
else return;
|
|
71
|
+
e.preventDefault(), E("hsv-change", T.hue, n, r, "field");
|
|
72
|
+
}
|
|
73
|
+
function K(e) {
|
|
74
|
+
let t = e.target;
|
|
75
|
+
if (!(t instanceof HTMLInputElement)) return;
|
|
76
|
+
let n = Number.parseFloat(t.value);
|
|
77
|
+
E("hsv-change", Number.isFinite(n) ? n : 0, T.saturation <= 1 && T.value >= 99 ? x : T.saturation, T.value <= 1 ? S : T.value, "slider");
|
|
78
|
+
}
|
|
79
|
+
function q() {
|
|
80
|
+
E("commit", "slider");
|
|
81
|
+
}
|
|
82
|
+
function J(e) {
|
|
83
|
+
let t = e.target;
|
|
84
|
+
if (!(t instanceof HTMLInputElement)) return;
|
|
85
|
+
let n = Number.parseFloat(t.value);
|
|
86
|
+
E("alpha-change", Number.isFinite(n) ? n / 100 : 1);
|
|
87
|
+
}
|
|
88
|
+
function Y() {
|
|
89
|
+
E("commit", "alpha");
|
|
90
|
+
}
|
|
91
|
+
function X() {
|
|
92
|
+
!z() || A || (window.addEventListener("pointermove", U), window.addEventListener("pointerup", W), window.addEventListener("pointercancel", W), A = !0);
|
|
93
|
+
}
|
|
94
|
+
function Z() {
|
|
95
|
+
!z() || !A || (window.removeEventListener("pointermove", U), window.removeEventListener("pointerup", W), window.removeEventListener("pointercancel", W), A = !1);
|
|
96
|
+
}
|
|
97
|
+
function Q() {
|
|
98
|
+
j = !1, Z();
|
|
99
|
+
}
|
|
100
|
+
return C({ cancelDrag: Q }), (e, t) => (s(), n("section", u, [r("div", {
|
|
101
|
+
ref_key: "colorFieldRef",
|
|
102
|
+
ref: k,
|
|
103
|
+
class: "bing-color-picker__field",
|
|
104
|
+
style: a(P.value),
|
|
105
|
+
role: "slider",
|
|
106
|
+
tabindex: "0",
|
|
107
|
+
"aria-label": "颜色饱和度与亮度",
|
|
108
|
+
"aria-valuetext": I.value,
|
|
109
|
+
"aria-disabled": i.disabled || void 0,
|
|
110
|
+
onPointerdown: H,
|
|
111
|
+
onKeydown: G
|
|
112
|
+
}, [r("span", {
|
|
113
|
+
class: "bing-color-picker__field-marker",
|
|
114
|
+
style: a(F.value),
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
}, null, 4)], 44, d), r("div", f, [r("div", p, [
|
|
117
|
+
r("span", {
|
|
118
|
+
class: "bing-color-picker__preview",
|
|
119
|
+
style: a(N.value),
|
|
120
|
+
"aria-hidden": "true"
|
|
121
|
+
}, null, 4),
|
|
122
|
+
r("label", {
|
|
123
|
+
class: "bing-color-picker__sr-only",
|
|
124
|
+
for: D.value
|
|
125
|
+
}, " 色相 ", 8, m),
|
|
126
|
+
r("input", {
|
|
127
|
+
id: D.value,
|
|
128
|
+
class: "bing-color-picker__range bing-color-picker__range--hue",
|
|
129
|
+
type: "range",
|
|
130
|
+
min: "0",
|
|
131
|
+
max: "359",
|
|
132
|
+
step: "1",
|
|
133
|
+
value: i.hue,
|
|
134
|
+
style: a(L.value),
|
|
135
|
+
disabled: i.disabled,
|
|
136
|
+
onInput: K,
|
|
137
|
+
onChange: q
|
|
138
|
+
}, null, 44, h),
|
|
139
|
+
r("span", g, l(i.hue) + "°", 1)
|
|
140
|
+
]), r("div", _, [
|
|
141
|
+
r("span", {
|
|
142
|
+
class: "bing-color-picker__alpha-preview",
|
|
143
|
+
style: a(N.value),
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
}, null, 4),
|
|
146
|
+
r("label", {
|
|
147
|
+
class: "bing-color-picker__sr-only",
|
|
148
|
+
for: O.value
|
|
149
|
+
}, " 不透明度 ", 8, v),
|
|
150
|
+
r("input", {
|
|
151
|
+
id: O.value,
|
|
152
|
+
class: "bing-color-picker__range bing-color-picker__range--alpha",
|
|
153
|
+
type: "range",
|
|
154
|
+
min: "0",
|
|
155
|
+
max: "100",
|
|
156
|
+
step: "1",
|
|
157
|
+
value: M.value,
|
|
158
|
+
style: a(R.value),
|
|
159
|
+
disabled: i.disabled,
|
|
160
|
+
onInput: J,
|
|
161
|
+
onChange: Y
|
|
162
|
+
}, null, 44, y),
|
|
163
|
+
r("span", b, l(M.value) + "%", 1)
|
|
164
|
+
])])]));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
export { C as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BingConfigProviderProps } from './BingConfigProvider.types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<BingConfigProviderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BingConfigProviderProps> & Readonly<{}>, {
|
|
7
|
+
zIndex: number;
|
|
8
|
+
reducedMotion: import('./BingConfigProvider.types').BingReducedMotion;
|
|
9
|
+
size: import('./BingConfigProvider.types').BingConfigSize;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { provideBingConfig as e } from "../../utils/config.js";
|
|
2
|
+
import { defineComponent as t, renderSlot as n } from "vue";
|
|
3
|
+
//#region src/components/BingConfigProvider/BingConfigProvider.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var r = /* @__PURE__ */ t({
|
|
5
|
+
name: "BingConfigProvider",
|
|
6
|
+
__name: "BingConfigProvider",
|
|
7
|
+
props: {
|
|
8
|
+
size: { default: void 0 },
|
|
9
|
+
zIndex: { default: void 0 },
|
|
10
|
+
reducedMotion: { default: void 0 }
|
|
11
|
+
},
|
|
12
|
+
setup(t) {
|
|
13
|
+
let r = t;
|
|
14
|
+
return e(() => r), (e, t) => n(e.$slots, "default");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as default };
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { cursorHotspots as e, resolveCursorType as t } from "./BingCursor.presets.js";
|
|
2
|
+
import { createCursorStyleSource as n } from "./BingCursor.styleSource.js";
|
|
3
|
+
//#region src/components/BingCursor/BingCursor.controller.ts
|
|
4
|
+
var r = /* @__PURE__ */ new WeakMap(), i = "data-bing-cursor-native", a = "[contenteditable=\"true\"], [contenteditable=\"\"], [contenteditable=\"plaintext-only\"]", o = 100;
|
|
5
|
+
function s(e) {
|
|
6
|
+
let t = e.closest(a);
|
|
7
|
+
if (t) return t;
|
|
8
|
+
let n = e.closest("[contenteditable]");
|
|
9
|
+
for (let e = n?.parentElement?.closest("[contenteditable]"); e; e = e.parentElement?.closest("[contenteditable]")) n = e;
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function c(c) {
|
|
13
|
+
let l = c.defaultView, u = /* @__PURE__ */ new Set(), d = [], f = l.matchMedia?.("(any-pointer: fine)"), p = l.matchMedia?.("(any-hover: hover)"), m = l.matchMedia?.("(forced-colors: active)"), h, g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), y = 0, b = null, x = null, S = null, C = 0, w = 0, T = 0, E = !1, D = !1, O = !1, k = 0, A = !0, j = -Infinity, M = -Infinity, N, P = !1, F = c.createElement("style");
|
|
14
|
+
F.dataset.bingCursorStyle = "", c.head.append(F);
|
|
15
|
+
let I = n(c), L = () => [...u].some((e) => !e.options().disabled && e.root.isConnected);
|
|
16
|
+
function R() {
|
|
17
|
+
let t = [..._.values()].flatMap((e) => [...e.values()].map(({ value: e, token: t }) => {
|
|
18
|
+
let n = `[${i}="${t}"]`, r = `${n}[contenteditable] :hover`;
|
|
19
|
+
return `${n}, ${n}::before, ${n}::after, ${r}, ${r}::before, ${r}::after { cursor: ${e} !important; }`;
|
|
20
|
+
}));
|
|
21
|
+
for (let [n, r] of v) {
|
|
22
|
+
let o = _.get(n), s = `[${i}="${r.token}"]`, c = (e) => o.get(e).value, l = `${s}, ${s} :hover`, u = `var(${r.disabled}, var(${r.declared}, var(${r.property}, var(${r.auto}))))`;
|
|
23
|
+
t.push(`${s} { ${r.auto}: ${c("default")}; }`, `${s}:is(${a}) { ${r.auto}: ${c("text")}; }`, `${s} :where([contenteditable="false"]) { ${r.auto}: ${c("default")}; }`, `${s} :where(a[href], button, summary, [role="button"], [role="link"], [role="tab"]) { ${r.auto}: ${c("pointer")}; }`, `${s} :where(textarea, input, ${a}) { ${r.auto}: ${c("text")}; }`, `${s}:where(:disabled, [aria-disabled="true"], [inert]), ${s} :where(:disabled, [aria-disabled="true"], [inert]) { ${r.disabled}: ${c("not-allowed")}; }`, `${l} { cursor: ${u} !important; }`, `${l.split(", ").map((e) => `${e}::before, ${e}::after`).join(", ")} { cursor: ${u} !important; }`);
|
|
24
|
+
for (let n of Object.keys(e)) t.push(`${s}:where([data-bing-cursor="${n}"]), ${s} :where([data-bing-cursor="${n}"]) { ${r.declared}: ${c(n)}; }`);
|
|
25
|
+
}
|
|
26
|
+
F.textContent = t.join("\n");
|
|
27
|
+
}
|
|
28
|
+
function z(n, r) {
|
|
29
|
+
let i = n.nativeCursor(r);
|
|
30
|
+
if (!i) return;
|
|
31
|
+
let a = _.get(n)?.get(r);
|
|
32
|
+
if (a?.value === i) return a.token;
|
|
33
|
+
let o = /* @__PURE__ */ new Map(), s = ++y;
|
|
34
|
+
for (let t of Object.keys(e)) {
|
|
35
|
+
let e = t === r ? i : n.nativeCursor(t);
|
|
36
|
+
e && o.set(t, {
|
|
37
|
+
value: e,
|
|
38
|
+
token: `${s}-${t}`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
_.set(n, o), v.get(n)?.dispose();
|
|
42
|
+
let l = `--bing-cursor-rendered-${s}`;
|
|
43
|
+
return v.set(n, {
|
|
44
|
+
token: `${s}-editable`,
|
|
45
|
+
property: l,
|
|
46
|
+
auto: `--bing-cursor-auto-${s}`,
|
|
47
|
+
declared: `--bing-cursor-declared-${s}`,
|
|
48
|
+
disabled: `--bing-cursor-disabled-${s}`,
|
|
49
|
+
dispose: I.palette(l, (e) => {
|
|
50
|
+
if (e === "auto") return "initial";
|
|
51
|
+
let n = t(c.documentElement, e);
|
|
52
|
+
return n ? o.get(n)?.value ?? e : e;
|
|
53
|
+
})
|
|
54
|
+
}), R(), o.get(r)?.token;
|
|
55
|
+
}
|
|
56
|
+
function B(e, t) {
|
|
57
|
+
t === null ? e.removeAttribute(i) : e.setAttribute(i, t);
|
|
58
|
+
}
|
|
59
|
+
function V() {
|
|
60
|
+
for (let [e, t] of g) B(e, t);
|
|
61
|
+
g.clear();
|
|
62
|
+
}
|
|
63
|
+
function H() {
|
|
64
|
+
V(), h?.hide(), h = void 0;
|
|
65
|
+
}
|
|
66
|
+
function U(e, t, n) {
|
|
67
|
+
let r = new Set(e.map((e) => s(e) ?? e));
|
|
68
|
+
for (let e of r) {
|
|
69
|
+
g.has(e) || g.set(e, e.getAttribute(i));
|
|
70
|
+
let r = n && e.hasAttribute("contenteditable") ? n : t;
|
|
71
|
+
e.getAttribute(i) !== r && e.setAttribute(i, r);
|
|
72
|
+
}
|
|
73
|
+
for (let [e, t] of g) r.has(e) || (B(e, t), g.delete(e));
|
|
74
|
+
}
|
|
75
|
+
function W() {
|
|
76
|
+
S = null, D = !1, E = !1, x = null, N = void 0, A = !0, k && l.cancelAnimationFrame(k), k = 0, H();
|
|
77
|
+
}
|
|
78
|
+
function G(e) {
|
|
79
|
+
if (w >= c.documentElement.clientWidth || T >= c.documentElement.clientHeight) return !0;
|
|
80
|
+
let t = l.getComputedStyle(e), n = ["auto", "scroll"].includes(t.overflowY) && e.scrollHeight > e.clientHeight, r = ["auto", "scroll"].includes(t.overflowX) && e.scrollWidth > e.clientWidth;
|
|
81
|
+
if (N = void 0, !n && !r) return !1;
|
|
82
|
+
let i = e.getBoundingClientRect(), a = i.left + e.clientLeft, o = i.top + e.clientTop;
|
|
83
|
+
return N = {
|
|
84
|
+
left: a,
|
|
85
|
+
right: a + e.clientWidth,
|
|
86
|
+
top: o,
|
|
87
|
+
bottom: o + e.clientHeight,
|
|
88
|
+
vertical: n,
|
|
89
|
+
horizontal: r
|
|
90
|
+
}, K();
|
|
91
|
+
}
|
|
92
|
+
function K() {
|
|
93
|
+
return !!(N && (N.vertical && (w < N.left || w >= N.right) || N.horizontal && (T < N.top || T >= N.bottom)));
|
|
94
|
+
}
|
|
95
|
+
function q() {
|
|
96
|
+
let e = S;
|
|
97
|
+
S = null;
|
|
98
|
+
let n = l.performance.now();
|
|
99
|
+
if (j = n, !L() || !D || O || c.hidden || m?.matches || !f?.matches || !p?.matches) {
|
|
100
|
+
H();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let r = e?.isConnected && !e.hasPointerCapture?.(C) ? e : c.elementFromPoint(w, T);
|
|
104
|
+
if (P = !!(r && G(r)), !r || r.getRootNode() !== c || r.shadowRoot || P) {
|
|
105
|
+
H();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
b = E && x?.hasPointerCapture?.(C) ? x : r;
|
|
109
|
+
let i;
|
|
110
|
+
for (let e of u) {
|
|
111
|
+
let t = e.options();
|
|
112
|
+
t.disabled || !e.root.isConnected || !t.global && !e.root.contains(b) || (!i || !t.global && (i.options().global || i.root.contains(e.root)) || t.global && i.options().global) && (i = e);
|
|
113
|
+
}
|
|
114
|
+
if (!i) {
|
|
115
|
+
H();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let a = A || n - M >= o, d = s(b), g = !1;
|
|
119
|
+
for (let e = b; d && e; e = e.parentElement) if ("style" in e && e.style.cursor) {
|
|
120
|
+
g = !0;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
g && V();
|
|
124
|
+
let _ = I.read(b, a, d), y = g ? l.getComputedStyle(b).cursor : _;
|
|
125
|
+
a && (A = !1, M = n);
|
|
126
|
+
let k = t(b, y, i.options().type, E);
|
|
127
|
+
if (!k) {
|
|
128
|
+
H();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
let N = z(i, k);
|
|
132
|
+
if (!N) {
|
|
133
|
+
H();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
h !== i && h?.hide(), h = i;
|
|
137
|
+
let F = v.get(i), R = d && F ? l.getComputedStyle(b).getPropertyValue(F.property).trim() : "", B = !E && !g && i.options().type === "auto" && (!R || R.startsWith("url("));
|
|
138
|
+
U([r, b], N, B ? F?.token : void 0), i.show(k);
|
|
139
|
+
}
|
|
140
|
+
function J() {
|
|
141
|
+
if (!L()) {
|
|
142
|
+
k && l.cancelAnimationFrame(k), k = 0, H();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
!k && D && (k = l.requestAnimationFrame(() => {
|
|
146
|
+
k = 0, q();
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
function Y() {
|
|
150
|
+
S = null, J();
|
|
151
|
+
}
|
|
152
|
+
function X(e) {
|
|
153
|
+
if (e.pointerType !== "mouse") {
|
|
154
|
+
W();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
let t = e.target instanceof Element ? e.target : null, n = (e.buttons & 1) == 1, r = !D || x !== t || E !== n || !!(n && t?.hasPointerCapture?.(e.pointerId)) || l.performance.now() - j >= o;
|
|
158
|
+
D = !0, w = e.clientX, T = e.clientY, E = n, C = e.pointerId, x = t, E || (O = !1), S = x, (r || K() !== P) && J();
|
|
159
|
+
}
|
|
160
|
+
function Z(e, t, n) {
|
|
161
|
+
e.addEventListener(t, n, {
|
|
162
|
+
capture: !0,
|
|
163
|
+
passive: !0
|
|
164
|
+
}), d.push(() => e.removeEventListener(t, n, !0));
|
|
165
|
+
}
|
|
166
|
+
for (let e of [
|
|
167
|
+
"pointermove",
|
|
168
|
+
"pointerover",
|
|
169
|
+
"pointerdown",
|
|
170
|
+
"pointerup"
|
|
171
|
+
]) Z(c, e, X);
|
|
172
|
+
Z(c, "pointerout", ((e) => {
|
|
173
|
+
e.relatedTarget || W();
|
|
174
|
+
})), Z(c, "pointercancel", W), Z(c, "gotpointercapture", Y), Z(c, "lostpointercapture", Y), Z(l, "blur", (e) => {
|
|
175
|
+
e.target === l && W();
|
|
176
|
+
}), Z(l, "resize", W), Z(c, "visibilitychange", () => {
|
|
177
|
+
c.hidden && W();
|
|
178
|
+
}), Z(c, "keydown", ((e) => {
|
|
179
|
+
(e.key === "Tab" || e.key === "Escape") && W();
|
|
180
|
+
})), Z(c, "scroll", Y), Z(c, "load", (e) => {
|
|
181
|
+
e.target?.matches?.("link[rel=\"stylesheet\"]") && (A = !0, Y());
|
|
182
|
+
}), Z(c, "dragstart", () => {
|
|
183
|
+
O = !0, W();
|
|
184
|
+
}), Z(c, "dragend", () => {
|
|
185
|
+
O = !1, W();
|
|
186
|
+
});
|
|
187
|
+
for (let e of [
|
|
188
|
+
f,
|
|
189
|
+
p,
|
|
190
|
+
m
|
|
191
|
+
]) e?.addEventListener?.("change", Y), d.push(() => e?.removeEventListener?.("change", Y));
|
|
192
|
+
let Q = new MutationObserver((e) => {
|
|
193
|
+
if (!L()) {
|
|
194
|
+
A = !0;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!D) return;
|
|
198
|
+
let t = !1;
|
|
199
|
+
for (let n of e) {
|
|
200
|
+
let e = n.target.nodeType === 1 ? n.target : n.target.parentElement;
|
|
201
|
+
if (e?.closest("[data-bing-cursor-palette], [data-bing-cursor-style], [data-bing-cursor-source]")) continue;
|
|
202
|
+
let r = e?.matches("style, link") || [...n.addedNodes, ...n.removedNodes].some((e) => e.nodeType === 1 && (e.matches("style, link") || e.querySelector("style, link")));
|
|
203
|
+
r && (A = !0), (r || n.type === "childList" || b && e?.contains(b)) && (t = !0);
|
|
204
|
+
}
|
|
205
|
+
t && Y();
|
|
206
|
+
});
|
|
207
|
+
return Q.observe(c.documentElement, {
|
|
208
|
+
subtree: !0,
|
|
209
|
+
childList: !0,
|
|
210
|
+
characterData: !0,
|
|
211
|
+
attributes: !0,
|
|
212
|
+
attributeFilter: [
|
|
213
|
+
"class",
|
|
214
|
+
"style",
|
|
215
|
+
"disabled",
|
|
216
|
+
"aria-disabled",
|
|
217
|
+
"inert",
|
|
218
|
+
"contenteditable",
|
|
219
|
+
"type",
|
|
220
|
+
"href",
|
|
221
|
+
"media",
|
|
222
|
+
"data-bing-cursor"
|
|
223
|
+
]
|
|
224
|
+
}), { add(e) {
|
|
225
|
+
return u.add(e), Y(), {
|
|
226
|
+
refresh() {
|
|
227
|
+
A = !0, Y();
|
|
228
|
+
},
|
|
229
|
+
destroy() {
|
|
230
|
+
h === e && H(), u.delete(e), _.delete(e), v.get(e)?.dispose(), v.delete(e), u.size ? (R(), Y()) : (W(), Q.disconnect(), d.forEach((e) => e()), I.destroy(), F.remove(), r.delete(c));
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
} };
|
|
234
|
+
}
|
|
235
|
+
function l(e) {
|
|
236
|
+
let t = e.root.ownerDocument, n = r.get(t);
|
|
237
|
+
return n || (n = c(t), r.set(t, n)), n.add(e);
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
export { l as registerCursor };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./BingCursor.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/BingCursor/BingCursor.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-615525a1"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cursorHotspots as e } from "./BingCursor.presets.js";
|
|
2
|
+
import { cursorShapes as t } from "./BingCursor.shapes.js";
|
|
3
|
+
//#region src/components/BingCursor/BingCursor.native.ts
|
|
4
|
+
var n = /* @__PURE__ */ new Map(), r = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
5
|
+
function i(i, a, o, s, c) {
|
|
6
|
+
let l = Math.round(Math.max(8, Math.min(128, Number.isFinite(a) ? a : 28))), u = JSON.stringify([
|
|
7
|
+
i,
|
|
8
|
+
l,
|
|
9
|
+
o,
|
|
10
|
+
s
|
|
11
|
+
]), d = n.get(u);
|
|
12
|
+
if (!d) {
|
|
13
|
+
let e = t[i].map((e) => `<path d="${e.d}" fill="${r(e.ink ? o : s)}" stroke="${r(e.outline ? o : s)}" stroke-width="${e.strokeWidth}" stroke-linejoin="round" paint-order="stroke fill"/>`).join("");
|
|
14
|
+
d = `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="0 0 32 32">${e}</svg>`)}`, n.size >= 128 && n.delete(n.keys().next().value), n.set(u, d);
|
|
15
|
+
}
|
|
16
|
+
let [f, p] = (c ?? e[i].map((e) => e * l / 32)).map((e) => Math.max(0, Math.min(l - 1, Math.round(Number.isFinite(e) ? e : 0))));
|
|
17
|
+
return `url("${d}") ${f} ${p}, ${i}`;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { i as createNativeCursor };
|