@pixelium/web-vue 0.0.2 → 0.0.3-alpha
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 +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -672
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Nullish } from 'parsnip-kit';
|
|
2
|
+
import { type Ref, type UnwrapRef, type EmitsOptions } from 'vue';
|
|
3
|
+
type Provides<T extends string, K extends any> = ({
|
|
4
|
+
[key in T]: K | Ref<K>;
|
|
5
|
+
} | false | Nullish)[];
|
|
6
|
+
export declare const createProvideComputed: <T extends string, K extends any, const P extends Provides<T, K>, const V extends UnwrapRef<Exclude<P[number], false | Nullish>[T]> | undefined>(key: T, provides: (() => P) | P, mergeType?: "nullish" | "or" | ((pre: V, value: V, cur: P[number] & object) => V), feedback?: (arg: V) => V) => import("vue").ComputedRef<V>;
|
|
7
|
+
export declare function forwardEmits<E = EmitsOptions>(emit: (event: any, ...args: any[]) => void, events: E): any;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { D as S, F as m, R as tn } from "../../vendor.js";
|
|
2
|
+
import { computed, isRef } from "vue";
|
|
3
|
+
const createProvideComputed = (key, provides, mergeType = "nullish", feedback) => {
|
|
4
|
+
return computed(() => {
|
|
5
|
+
const res = (m(provides) ? provides() : provides).filter((provide$1) => !!provide$1).reduce((pre, cur) => {
|
|
6
|
+
const value = isRef(cur[key]) ? cur[key].value : cur[key];
|
|
7
|
+
if (mergeType === "nullish") return pre ?? value;
|
|
8
|
+
else if (mergeType === "or") return pre || value;
|
|
9
|
+
else return mergeType(pre, value, cur);
|
|
10
|
+
}, void 0);
|
|
11
|
+
if (feedback) return feedback(res);
|
|
12
|
+
else return res;
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
function forwardEmits(emit, events) {
|
|
16
|
+
return (S(events) ? events : tn(events) ? Object.keys(events) : []).reduce((acc, key) => {
|
|
17
|
+
acc[`on${key.charAt(0).toUpperCase() + key.slice(1)}`] = (...args) => {
|
|
18
|
+
emit(key, ...args);
|
|
19
|
+
};
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
}
|
|
23
|
+
export { forwardEmits as n, createProvideComputed as t };
|
package/es/share/util/render.js
CHANGED
|
@@ -1,55 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as S } from "../../vendor.js";
|
|
2
2
|
import { Text } from "vue";
|
|
3
|
+
let ShapeFlags = /* @__PURE__ */ function(ShapeFlags$1) {
|
|
4
|
+
ShapeFlags$1[ShapeFlags$1["ELEMENT"] = 1] = "ELEMENT";
|
|
5
|
+
ShapeFlags$1[ShapeFlags$1["FUNCTIONAL_COMPONENT"] = 2] = "FUNCTIONAL_COMPONENT";
|
|
6
|
+
ShapeFlags$1[ShapeFlags$1["STATEFUL_COMPONENT"] = 4] = "STATEFUL_COMPONENT";
|
|
7
|
+
ShapeFlags$1[ShapeFlags$1["COMPONENT"] = ShapeFlags$1.STATEFUL_COMPONENT | ShapeFlags$1.FUNCTIONAL_COMPONENT] = "COMPONENT";
|
|
8
|
+
ShapeFlags$1[ShapeFlags$1["TEXT_CHILDREN"] = 8] = "TEXT_CHILDREN";
|
|
9
|
+
ShapeFlags$1[ShapeFlags$1["ARRAY_CHILDREN"] = 16] = "ARRAY_CHILDREN";
|
|
10
|
+
ShapeFlags$1[ShapeFlags$1["SLOTS_CHILDREN"] = 32] = "SLOTS_CHILDREN";
|
|
11
|
+
ShapeFlags$1[ShapeFlags$1["TELEPORT"] = 64] = "TELEPORT";
|
|
12
|
+
ShapeFlags$1[ShapeFlags$1["SUSPENSE"] = 128] = "SUSPENSE";
|
|
13
|
+
ShapeFlags$1[ShapeFlags$1["COMPONENT_SHOULD_KEEP_ALIVE"] = 256] = "COMPONENT_SHOULD_KEEP_ALIVE";
|
|
14
|
+
ShapeFlags$1[ShapeFlags$1["COMPONENT_KEPT_ALIVE"] = 512] = "COMPONENT_KEPT_ALIVE";
|
|
15
|
+
return ShapeFlags$1;
|
|
16
|
+
}({});
|
|
3
17
|
const isHtmlElementVNode = (vn, _) => {
|
|
4
|
-
|
|
5
|
-
vn && vn.shapeFlag & 1
|
|
6
|
-
/* ELEMENT */
|
|
7
|
-
);
|
|
18
|
+
return Boolean(vn && vn.shapeFlag & ShapeFlags.ELEMENT);
|
|
8
19
|
};
|
|
9
20
|
const isComponentVNode = (vn, _) => {
|
|
10
|
-
|
|
11
|
-
vn && vn.shapeFlag & 6
|
|
12
|
-
/* COMPONENT */
|
|
13
|
-
);
|
|
21
|
+
return Boolean(vn && vn.shapeFlag & ShapeFlags.COMPONENT);
|
|
14
22
|
};
|
|
15
23
|
const hasTextChildren = (child, _) => {
|
|
16
|
-
|
|
17
|
-
child && child.shapeFlag & 8
|
|
18
|
-
/* TEXT_CHILDREN */
|
|
19
|
-
);
|
|
24
|
+
return Boolean(child && child.shapeFlag & ShapeFlags.TEXT_CHILDREN);
|
|
20
25
|
};
|
|
21
26
|
const hasArrayChildren = (vn, _) => {
|
|
22
|
-
|
|
23
|
-
vn && vn.shapeFlag & 16
|
|
24
|
-
/* ARRAY_CHILDREN */
|
|
25
|
-
);
|
|
27
|
+
return Boolean(vn && vn.shapeFlag & ShapeFlags.ARRAY_CHILDREN);
|
|
26
28
|
};
|
|
27
29
|
const hasSlotsChildren = (vn, _) => {
|
|
28
|
-
|
|
29
|
-
vn && vn.shapeFlag & 32
|
|
30
|
-
/* SLOTS_CHILDREN */
|
|
31
|
-
);
|
|
30
|
+
return Boolean(vn && vn.shapeFlag & ShapeFlags.SLOTS_CHILDREN);
|
|
32
31
|
};
|
|
33
32
|
const isTextVNode = (vn) => {
|
|
34
|
-
|
|
33
|
+
return Boolean(vn.type === Text);
|
|
35
34
|
};
|
|
36
35
|
const flattenVNodes = (children) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
results.push(...flattenVNodes(item));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return results;
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
flattenVNodes as f,
|
|
54
|
-
isTextVNode as i
|
|
55
|
-
};
|
|
36
|
+
const results = [];
|
|
37
|
+
for (const item of children ?? []) if (isHtmlElementVNode(item) || isComponentVNode(item) || hasTextChildren(item)) results.push(item);
|
|
38
|
+
else if (hasArrayChildren(item, item.children)) results.push(...flattenVNodes(item.children));
|
|
39
|
+
else if (hasSlotsChildren(item, item.children)) {
|
|
40
|
+
var _item$children$defaul, _item$children;
|
|
41
|
+
results.push(...flattenVNodes((_item$children$defaul = (_item$children = item.children).default) === null || _item$children$defaul === void 0 ? void 0 : _item$children$defaul.call(_item$children)));
|
|
42
|
+
} else if (S(item)) results.push(...flattenVNodes(item));
|
|
43
|
+
return results;
|
|
44
|
+
};
|
|
45
|
+
export { isTextVNode as n, flattenVNodes as t };
|
package/es/share/util/theme.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ export declare const setThemeColor: (theme: "primary" | "success" | "warning" |
|
|
|
2
2
|
light?: string[];
|
|
3
3
|
dark?: string[];
|
|
4
4
|
}) => void;
|
|
5
|
+
export declare const resetThemeColor: (theme: "primary" | "success" | "warning" | "danger" | "sakura" | "neutral") => void;
|
|
6
|
+
export declare const setPixelSize: (size: number) => void;
|
|
7
|
+
export declare const resetPixelSize: () => void;
|
package/es/share/util/theme.js
CHANGED
|
@@ -1,60 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { i as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { B as y } from "../../vendor.js";
|
|
2
|
+
import { t as inBrowser } from "./env.js";
|
|
3
|
+
import { a as MEDIUM_BASE_SIZE, i as LARGE_BASE_SIZE, n as INTERVAL, o as SMALL_BASE_SIZE, r as INTERVAL_MINI, t as DEFAULT_PIXEL_SIZE } from "../const/style.js";
|
|
4
|
+
import { a as rgbaColor2string, i as parseColor, t as generatePalette } from "./color.js";
|
|
5
|
+
import { t as EventBus } from "./event-bus.js";
|
|
6
|
+
import { n as GLOBAL_CSS_VAR_CHANGE } from "../const/event-bus-key.js";
|
|
7
|
+
import { r as throwError } from "./console.js";
|
|
7
8
|
const setThemeColor = (theme, color) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} else {
|
|
37
|
-
if (((_a = color.light) == null ? void 0 : _a.length) && color.light.length !== 10) {
|
|
38
|
-
return throwError(
|
|
39
|
-
`The length of color.light does not match the required number of CSS color palette (10).`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
if (((_b = color.dark) == null ? void 0 : _b.length) && color.dark.length !== 10) {
|
|
43
|
-
return throwError(
|
|
44
|
-
`The length of color.dark does not match the required number of CSS color palette (10).`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
colorList.light = color.light || [];
|
|
48
|
-
colorList.dark = color.dark || [];
|
|
49
|
-
}
|
|
50
|
-
colorList.light.forEach((item, index) => {
|
|
51
|
-
document.documentElement.style.setProperty(`--px-${theme}-light-custom-${index + 1}`, item);
|
|
52
|
-
});
|
|
53
|
-
colorList.dark.forEach((item, index) => {
|
|
54
|
-
document.documentElement.style.setProperty(`--px-${theme}-dark-custom-${index + 1}`, item);
|
|
55
|
-
});
|
|
56
|
-
EventBus.emit(GLOBAL_CSS_VAR_CHANGE);
|
|
9
|
+
if (!inBrowser()) return;
|
|
10
|
+
const colorList = {
|
|
11
|
+
light: [],
|
|
12
|
+
dark: []
|
|
13
|
+
};
|
|
14
|
+
if (y(color)) {
|
|
15
|
+
const rgbaColor = parseColor(color);
|
|
16
|
+
if (!rgbaColor) return;
|
|
17
|
+
colorList.light = generatePalette(rgbaColor.r, rgbaColor.g, rgbaColor.b, rgbaColor.a, false).map((color$1) => {
|
|
18
|
+
return rgbaColor2string(color$1);
|
|
19
|
+
});
|
|
20
|
+
colorList.dark = generatePalette(rgbaColor.r, rgbaColor.g, rgbaColor.b, rgbaColor.a, true).map((color$1) => {
|
|
21
|
+
return rgbaColor2string(color$1);
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
var _color$light, _color$dark;
|
|
25
|
+
if (((_color$light = color.light) === null || _color$light === void 0 ? void 0 : _color$light.length) && color.light.length !== 10) return throwError(`The length of color.light does not match the required number of CSS color palette (10).`);
|
|
26
|
+
if (((_color$dark = color.dark) === null || _color$dark === void 0 ? void 0 : _color$dark.length) && color.dark.length !== 10) return throwError(`The length of color.dark does not match the required number of CSS color palette (10).`);
|
|
27
|
+
colorList.light = color.light || [];
|
|
28
|
+
colorList.dark = color.dark || [];
|
|
29
|
+
}
|
|
30
|
+
colorList.light.forEach((item, index) => {
|
|
31
|
+
document.documentElement.style.setProperty(`--px-${theme}-light-custom-${index + 1}`, item);
|
|
32
|
+
});
|
|
33
|
+
colorList.dark.forEach((item, index) => {
|
|
34
|
+
document.documentElement.style.setProperty(`--px-${theme}-dark-custom-${index + 1}`, item);
|
|
35
|
+
});
|
|
36
|
+
EventBus.emit(GLOBAL_CSS_VAR_CHANGE);
|
|
57
37
|
};
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
const resetThemeColor = (theme) => {
|
|
39
|
+
if (!inBrowser()) return;
|
|
40
|
+
for (let i = 0; i < 10; i++) {
|
|
41
|
+
document.documentElement.style.setProperty(`--px-${theme}-light-custom-${i + 1}`, null);
|
|
42
|
+
document.documentElement.style.setProperty(`--px-${theme}-dark-custom-${i + 1}`, null);
|
|
43
|
+
}
|
|
44
|
+
EventBus.emit(GLOBAL_CSS_VAR_CHANGE);
|
|
60
45
|
};
|
|
46
|
+
var calcSizes = (pixelSize) => {
|
|
47
|
+
const mediumSize = 28 + pixelSize * 2;
|
|
48
|
+
const smallSize = 20 + pixelSize * 2;
|
|
49
|
+
const largeSubSize = mediumSize;
|
|
50
|
+
const mediumSubSize = mediumSize - 8 - 2;
|
|
51
|
+
const smallSubSize = smallSize - 8;
|
|
52
|
+
return {
|
|
53
|
+
"-px-large-size": 36 + pixelSize * 2,
|
|
54
|
+
"-px-medium-size": mediumSize,
|
|
55
|
+
"-px-small-size": smallSize,
|
|
56
|
+
"-px-large-sub-size": largeSubSize,
|
|
57
|
+
"-px-medium-sub-size": mediumSubSize,
|
|
58
|
+
"-px-small-sub-size": smallSubSize,
|
|
59
|
+
"-px-large-sub-base-size": largeSubSize - 2 * pixelSize,
|
|
60
|
+
"-px-medium-sub-base-size": mediumSubSize - 2 * pixelSize,
|
|
61
|
+
"-px-small-sub-base-size": smallSubSize - 2 * pixelSize,
|
|
62
|
+
"-px-large-compat-size": mediumSize - 4,
|
|
63
|
+
"-px-medium-compat-size": mediumSize - 8,
|
|
64
|
+
"-px-small-compat-size": smallSize - 4
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const setPixelSize = (size) => {
|
|
68
|
+
if (!inBrowser()) return;
|
|
69
|
+
document.documentElement.style.setProperty(`--px-bit`, size + "px");
|
|
70
|
+
const sizes = calcSizes(size);
|
|
71
|
+
Object.keys(sizes).forEach((key) => {
|
|
72
|
+
document.documentElement.style.setProperty(key, sizes[key] + "px");
|
|
73
|
+
});
|
|
74
|
+
EventBus.emit(GLOBAL_CSS_VAR_CHANGE);
|
|
75
|
+
};
|
|
76
|
+
const resetPixelSize = () => {
|
|
77
|
+
if (!inBrowser()) return;
|
|
78
|
+
setPixelSize(4);
|
|
79
|
+
};
|
|
80
|
+
export { setThemeColor as i, resetThemeColor as n, setPixelSize as r, resetPixelSize as t };
|
package/es/slider/css.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
import type { RgbaColor } from '../share/type';
|
|
3
|
+
import type { SliderProps } from './type';
|
|
4
|
+
import { type Nullish } from 'parsnip-kit';
|
|
5
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderColor: RgbaColor, pixelSize: number, paddingX?: number, paddingY?: number) => void;
|
|
6
|
+
export declare const drawRange: (ctx: CanvasRenderingContext2D, width: number, height: number, trackLeft: number, trackWidth: number, fillColor: RgbaColor, emptyColor: RgbaColor, pixelSize: number, direction: SliderProps["direction"], reverse: boolean) => void;
|
|
7
|
+
export declare const drawThumbBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, paddingX?: number, paddingY?: number) => void;
|
|
8
|
+
export declare const drawThumb: (thumbRef: ShallowRef<HTMLDivElement | null>, thumbCanvasRef: ShallowRef<HTMLCanvasElement | null>, thumbStartRef: ShallowRef<HTMLDivElement | null>, thumbStartCanvasRef: ShallowRef<HTMLCanvasElement | null>, thumbEndRef: ShallowRef<HTMLDivElement | null>, thumbEndCanvasRef: ShallowRef<HTMLCanvasElement | null>, range: boolean, rad: [number, number][], pixelSize: number, thumbColor: RgbaColor, borderColor: RgbaColor) => void;
|
|
9
|
+
export declare const getDotStyle: (offset: number, direction: SliderProps["direction"], reverse: boolean) => {
|
|
10
|
+
left: string | undefined;
|
|
11
|
+
right: string | undefined;
|
|
12
|
+
top: string | undefined;
|
|
13
|
+
bottom: number | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const getMarkStyle: (offset: number, direction: SliderProps["direction"], reverse: boolean) => {
|
|
16
|
+
left: string | undefined;
|
|
17
|
+
right: string | undefined;
|
|
18
|
+
top: string | undefined;
|
|
19
|
+
bottom: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const drawMark: (sliderRef: ShallowRef<HTMLDivElement | null>, dotCanvasRef: ShallowRef<HTMLCanvasElement | null>, rad: [number, number][], modelValue: number | [number, number] | Nullish, direction: SliderProps["direction"], reverse: boolean, disabled: boolean, markPoints: {
|
|
22
|
+
value: number;
|
|
23
|
+
left: number;
|
|
24
|
+
label?: string | undefined;
|
|
25
|
+
}[], pixelSize: number) => void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { D as S, g as A } from "../vendor.js";
|
|
2
|
+
import { a as drawCircle, i as canvasPreprocess, l as getBorderRadius, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
3
|
+
import { a as rgbaColor2string, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
4
|
+
const drawBorder = (ctx, width, height, center, borderColor, pixelSize, paddingX = 0, paddingY = 0) => {
|
|
5
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
6
|
+
if (center[1][0] + pixelSize > center[0][0]) ctx.fillRect(center[0][0] + paddingX, paddingY, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
7
|
+
if (center[2][1] + pixelSize > center[1][1]) ctx.fillRect(width - pixelSize + paddingX, center[1][1] + paddingY, pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
8
|
+
if (center[3][0] < center[2][0] + pixelSize) ctx.fillRect(center[3][0] + paddingX, height - pixelSize + paddingY, center[2][0] - center[3][0] + pixelSize, pixelSize);
|
|
9
|
+
if (center[3][1] + pixelSize > center[0][1]) ctx.fillRect(paddingX, center[0][1] + paddingY, pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
10
|
+
};
|
|
11
|
+
const drawRange = (ctx, width, height, trackLeft, trackWidth, fillColor, emptyColor, pixelSize, direction, reverse) => {
|
|
12
|
+
const fillAreaWidth = direction === "horizontal" ? width - pixelSize * 2 : height - pixelSize * 2;
|
|
13
|
+
const emptyLeftStart = pixelSize;
|
|
14
|
+
const emptyLeftEnd = trackLeft * fillAreaWidth + emptyLeftStart;
|
|
15
|
+
const fillStart = emptyLeftEnd === emptyLeftStart ? pixelSize : emptyLeftEnd;
|
|
16
|
+
const fillEnd = fillStart + trackWidth * fillAreaWidth - pixelSize;
|
|
17
|
+
const emptyRightStart = fillStart === fillEnd ? pixelSize : fillEnd;
|
|
18
|
+
const emptyRightEnd = direction === "horizontal" ? width - pixelSize : height - pixelSize;
|
|
19
|
+
if (emptyLeftEnd > emptyLeftStart) {
|
|
20
|
+
ctx.fillStyle = rgbaColor2string(emptyColor);
|
|
21
|
+
let x = emptyLeftStart;
|
|
22
|
+
if (reverse && direction === "horizontal" || !reverse && direction === "vertical") x = fillAreaWidth - emptyLeftEnd + pixelSize * 2;
|
|
23
|
+
if (direction === "horizontal") ctx.fillRect(x, pixelSize, emptyLeftEnd - emptyLeftStart, height - 2 * pixelSize);
|
|
24
|
+
else ctx.fillRect(pixelSize, x, width - 2 * pixelSize, emptyLeftEnd - emptyLeftStart);
|
|
25
|
+
}
|
|
26
|
+
if (fillEnd > fillStart) {
|
|
27
|
+
ctx.fillStyle = rgbaColor2string(fillColor);
|
|
28
|
+
let len = fillEnd - fillStart;
|
|
29
|
+
len = Math.min(len, fillAreaWidth - pixelSize);
|
|
30
|
+
let x = fillStart;
|
|
31
|
+
if (reverse && direction === "horizontal" || !reverse && direction === "vertical") x = fillAreaWidth - fillEnd + pixelSize * 2;
|
|
32
|
+
if (direction === "horizontal") ctx.fillRect(x, pixelSize, len, height - 2 * pixelSize);
|
|
33
|
+
else ctx.fillRect(pixelSize, x, width - 2 * pixelSize, len);
|
|
34
|
+
}
|
|
35
|
+
if (emptyRightEnd > emptyRightStart) {
|
|
36
|
+
ctx.fillStyle = rgbaColor2string(emptyColor);
|
|
37
|
+
const len = emptyRightEnd - emptyRightStart;
|
|
38
|
+
let x = emptyRightStart;
|
|
39
|
+
if (reverse && direction === "horizontal" || !reverse && direction === "vertical") x = fillAreaWidth - emptyRightEnd + pixelSize * 2;
|
|
40
|
+
if (direction === "horizontal") ctx.fillRect(x, pixelSize, len, height - 2 * pixelSize);
|
|
41
|
+
else ctx.fillRect(pixelSize, x, width - 2 * pixelSize, len);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const drawThumbBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, paddingX = 0, paddingY = 0) => {
|
|
45
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
46
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize) drawCircle(ctx, center[i][0] + paddingX, center[i][1] + paddingY, borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
47
|
+
if (center[1][0] + pixelSize > center[0][0]) ctx.fillRect(center[0][0] + paddingX, paddingY, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
48
|
+
if (center[2][1] + pixelSize > center[1][1]) ctx.fillRect(width - pixelSize + paddingX, center[1][1] + paddingY, pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
49
|
+
if (center[3][0] < center[2][0] + pixelSize) ctx.fillRect(center[3][0] + paddingX, height - pixelSize + paddingY, center[2][0] - center[3][0] + pixelSize, pixelSize);
|
|
50
|
+
if (center[3][1] + pixelSize > center[0][1]) ctx.fillRect(paddingX, center[0][1] + paddingY, pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
51
|
+
};
|
|
52
|
+
const drawThumb = (thumbRef, thumbCanvasRef, thumbStartRef, thumbStartCanvasRef, thumbEndRef, thumbEndCanvasRef, range, rad, pixelSize, thumbColor, borderColor) => {
|
|
53
|
+
if (range) {
|
|
54
|
+
const thumbStartPreprocessData = canvasPreprocess(thumbStartRef, thumbStartCanvasRef);
|
|
55
|
+
const thumbEndPreprocessData = canvasPreprocess(thumbEndRef, thumbEndCanvasRef);
|
|
56
|
+
if (thumbStartPreprocessData) {
|
|
57
|
+
const { ctx, width, height, canvas } = thumbStartPreprocessData;
|
|
58
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, "round", "medium", false, false, false);
|
|
59
|
+
drawThumbBorder(ctx, width, height, calcBorderCornerCenter(borderRadius, width, height, pixelSize), borderRadius, rad, borderColor, pixelSize);
|
|
60
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), thumbColor);
|
|
61
|
+
}
|
|
62
|
+
if (thumbEndPreprocessData) {
|
|
63
|
+
const { ctx, width, height, canvas } = thumbEndPreprocessData;
|
|
64
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, "round", "medium", false, false, false);
|
|
65
|
+
drawThumbBorder(ctx, width, height, calcBorderCornerCenter(borderRadius, width, height, pixelSize), borderRadius, rad, borderColor, pixelSize);
|
|
66
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), thumbColor);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
const thumbPreprocessData = canvasPreprocess(thumbRef, thumbCanvasRef);
|
|
70
|
+
if (thumbPreprocessData) {
|
|
71
|
+
const { ctx, width, height, canvas } = thumbPreprocessData;
|
|
72
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, "round", "medium", false, false, false);
|
|
73
|
+
drawThumbBorder(ctx, width, height, calcBorderCornerCenter(borderRadius, width, height, pixelSize), borderRadius, rad, borderColor, pixelSize);
|
|
74
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), thumbColor);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const getDotStyle = (offset, direction, reverse) => {
|
|
79
|
+
return {
|
|
80
|
+
left: direction === "horizontal" ? reverse ? void 0 : offset + "px" : void 0,
|
|
81
|
+
right: direction === "horizontal" ? reverse ? offset + "px" : void 0 : void 0,
|
|
82
|
+
top: direction === "horizontal" ? void 0 : reverse ? offset + "px" : void 0,
|
|
83
|
+
bottom: direction === "horizontal" ? void 0 : reverse ? void 0 : offset + NaN
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
const getMarkStyle = (offset, direction, reverse) => {
|
|
87
|
+
return {
|
|
88
|
+
left: direction === "horizontal" ? reverse ? void 0 : offset + "px" : void 0,
|
|
89
|
+
right: direction === "horizontal" ? reverse ? offset + "px" : void 0 : void 0,
|
|
90
|
+
top: direction === "horizontal" ? void 0 : reverse ? offset + "px" : void 0,
|
|
91
|
+
bottom: direction === "horizontal" ? void 0 : reverse ? void 0 : offset + "px"
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
const drawMark = (sliderRef, dotCanvasRef, rad, modelValue, direction, reverse, disabled, markPoints, pixelSize) => {
|
|
95
|
+
const preprocessData = canvasPreprocess(sliderRef, dotCanvasRef);
|
|
96
|
+
if (preprocessData) {
|
|
97
|
+
const { ctx, height, width, canvas } = preprocessData;
|
|
98
|
+
const dotSize = direction === "horizontal" ? height : width;
|
|
99
|
+
const areaWidth = direction !== "horizontal" ? height : width;
|
|
100
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, void 0, "round", "medium", false, false, false, direction);
|
|
101
|
+
for (const point of markPoints) {
|
|
102
|
+
const center = calcBorderCornerCenter(borderRadius, dotSize, dotSize, pixelSize);
|
|
103
|
+
const borderColor = getGlobalThemeColor("neutral", 10);
|
|
104
|
+
const dotColor = (S(modelValue) ? Math.min(...modelValue) <= point.value && Math.max(...modelValue) >= point.value : A(modelValue) ? modelValue >= point.value : false) ? disabled ? getGlobalThemeColor("primary", 2) : getGlobalThemeColor("primary", 6) : disabled ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
105
|
+
const markOffset = point.left;
|
|
106
|
+
const paddingX = direction === "horizontal" ? reverse ? areaWidth - dotSize - pixelSize - markOffset : markOffset + pixelSize : 0;
|
|
107
|
+
const paddingY = direction === "horizontal" ? 0 : reverse ? markOffset + pixelSize : areaWidth - markOffset - dotSize - pixelSize;
|
|
108
|
+
if (borderColor) drawThumbBorder(ctx, dotSize, dotSize, center, borderRadius, rad, borderColor, pixelSize, paddingX, paddingY);
|
|
109
|
+
if (dotColor) floodFill(ctx, Math.round(paddingX + dotSize / 2), Math.round(paddingY + dotSize / 2), dotColor);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
export { getDotStyle as a, drawThumb as i, drawMark as n, getMarkStyle as o, drawRange as r, drawBorder as t };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
.px-slider-canvas {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
z-index: -1;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
.px-slider {
|
|
10
|
+
--thumb-size: calc(var(--px-bit) * 4 + 12px);
|
|
11
|
+
--slider-size: calc(var(--px-bit) * 4 + 4px);
|
|
12
|
+
--dot-size: var(--slider-size);
|
|
13
|
+
z-index: 0;
|
|
14
|
+
border-style: solid;
|
|
15
|
+
border-color: transparent;
|
|
16
|
+
border-width: var(--px-bit);
|
|
17
|
+
height: var(--slider-size);
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
position: relative;
|
|
20
|
+
margin-top: calc((var(--thumb-size) - var(--slider-size)) / 2);
|
|
21
|
+
margin-bottom: calc((var(--thumb-size) - var(--slider-size)) / 2);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
transition: 0.25s;
|
|
24
|
+
}
|
|
25
|
+
.px-slider__horizontal.px-slider__reverse .px-slider-mark {
|
|
26
|
+
left: auto;
|
|
27
|
+
transform: translate(50%, -50%);
|
|
28
|
+
}
|
|
29
|
+
.px-slider__vertical {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
width: var(--slider-size);
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin-top: 0;
|
|
34
|
+
margin-bottom: 0;
|
|
35
|
+
margin-left: calc((var(--thumb-size) - var(--slider-size)) / 2);
|
|
36
|
+
margin-right: calc((var(--thumb-size) - var(--slider-size)) / 2);
|
|
37
|
+
}
|
|
38
|
+
.px-slider__vertical.px-slider__marks {
|
|
39
|
+
margin-right: calc((var(--thumb-size) - var(--slider-size)) / 2 + 28px);
|
|
40
|
+
margin-bottom: 0;
|
|
41
|
+
}
|
|
42
|
+
.px-slider__vertical .px-slider-thumb {
|
|
43
|
+
transform: translateX(-50%);
|
|
44
|
+
left: 50%;
|
|
45
|
+
top: auto;
|
|
46
|
+
}
|
|
47
|
+
.px-slider__vertical .px-slider-mark {
|
|
48
|
+
left: var(--thumb-size);
|
|
49
|
+
transform: translateY(50%);
|
|
50
|
+
top: auto;
|
|
51
|
+
}
|
|
52
|
+
.px-slider__vertical.px-slider__reverse .px-slider-mark {
|
|
53
|
+
bottom: auto;
|
|
54
|
+
transform: translateY(-50%);
|
|
55
|
+
}
|
|
56
|
+
.px-slider__disabled {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
.px-slider__disabled .px-slider-thumb {
|
|
60
|
+
cursor: not-allowed;
|
|
61
|
+
}
|
|
62
|
+
.px-slider__readonly {
|
|
63
|
+
cursor: auto;
|
|
64
|
+
}
|
|
65
|
+
.px-slider__readonly .px-slider-thumb {
|
|
66
|
+
cursor: auto;
|
|
67
|
+
}
|
|
68
|
+
.px-slider__marks {
|
|
69
|
+
margin-bottom: calc((var(--thumb-size) - var(--slider-size)) / 2 + 28px);
|
|
70
|
+
}
|
|
71
|
+
.px-slider-mark-wrapper {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
bottom: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
}
|
|
79
|
+
.px-slider-mark {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: var(--thumb-size);
|
|
84
|
+
transform: translate(-50%, -50%);
|
|
85
|
+
user-select: none;
|
|
86
|
+
pointer-events: all;
|
|
87
|
+
min-height: 28px;
|
|
88
|
+
}
|
|
89
|
+
.px-slider-dot {
|
|
90
|
+
width: var(--dot-size);
|
|
91
|
+
height: var(--dot-size);
|
|
92
|
+
position: absolute;
|
|
93
|
+
transform: translateY(-50%);
|
|
94
|
+
top: 50%;
|
|
95
|
+
pointer-events: all;
|
|
96
|
+
}
|
|
97
|
+
.px-slider-tooltip-content {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
min-width: 16px;
|
|
102
|
+
}
|
|
103
|
+
.px-slider-thumb {
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: 50%;
|
|
106
|
+
width: var(--thumb-size);
|
|
107
|
+
height: var(--thumb-size);
|
|
108
|
+
border: var(--px-bit) solid transparent;
|
|
109
|
+
transform: translateY(-50%);
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
z-index: 1;
|
|
112
|
+
border-style: solid;
|
|
113
|
+
border-color: transparent;
|
|
114
|
+
border-width: var(--px-bit);
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
display: flex;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
align-items: center;
|
|
119
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { SliderProps } from './type';
|
|
2
|
+
declare var __VLS_1: {
|
|
3
|
+
value: number;
|
|
4
|
+
label: string | undefined;
|
|
5
|
+
}, __VLS_7: {}, __VLS_10: {
|
|
6
|
+
value: number | null | undefined;
|
|
7
|
+
}, __VLS_12: {}, __VLS_18: {}, __VLS_21: {
|
|
8
|
+
value: number | null | undefined;
|
|
9
|
+
}, __VLS_23: {}, __VLS_29: {}, __VLS_32: {
|
|
10
|
+
value: number | null | undefined;
|
|
11
|
+
}, __VLS_34: {};
|
|
12
|
+
type __VLS_Slots = {} & {
|
|
13
|
+
mark?: (props: typeof __VLS_1) => any;
|
|
14
|
+
} & {
|
|
15
|
+
thumb?: (props: typeof __VLS_7) => any;
|
|
16
|
+
} & {
|
|
17
|
+
'tooltip-content'?: (props: typeof __VLS_10) => any;
|
|
18
|
+
} & {
|
|
19
|
+
thumb?: (props: typeof __VLS_12) => any;
|
|
20
|
+
} & {
|
|
21
|
+
'thumb-start'?: (props: typeof __VLS_18) => any;
|
|
22
|
+
} & {
|
|
23
|
+
'tooltip-content'?: (props: typeof __VLS_21) => any;
|
|
24
|
+
} & {
|
|
25
|
+
'thumb-start'?: (props: typeof __VLS_23) => any;
|
|
26
|
+
} & {
|
|
27
|
+
'thumb-end'?: (props: typeof __VLS_29) => any;
|
|
28
|
+
} & {
|
|
29
|
+
'tooltip-content'?: (props: typeof __VLS_32) => any;
|
|
30
|
+
} & {
|
|
31
|
+
'thumb-end'?: (props: typeof __VLS_34) => any;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_component: import("vue").DefineComponent<SliderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
change: (value: number | [number, number]) => any;
|
|
35
|
+
blur: (event: FocusEvent) => any;
|
|
36
|
+
focus: (event: FocusEvent) => any;
|
|
37
|
+
"update:modelValue": (value: number | [number, number]) => any;
|
|
38
|
+
dragStart: (event: MouseEvent | TouchEvent) => any;
|
|
39
|
+
dragEnd: (event: MouseEvent | TouchEvent) => any;
|
|
40
|
+
markSelect: (value: number, event: MouseEvent) => any;
|
|
41
|
+
}, string, import("vue").PublicProps, Readonly<SliderProps> & Readonly<{
|
|
42
|
+
onChange?: ((value: number | [number, number]) => any) | undefined;
|
|
43
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
44
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
45
|
+
"onUpdate:modelValue"?: ((value: number | [number, number]) => any) | undefined;
|
|
46
|
+
onDragStart?: ((event: MouseEvent | TouchEvent) => any) | undefined;
|
|
47
|
+
onDragEnd?: ((event: MouseEvent | TouchEvent) => any) | undefined;
|
|
48
|
+
onMarkSelect?: ((value: number, event: MouseEvent) => any) | undefined;
|
|
49
|
+
}>, {
|
|
50
|
+
reverse: boolean;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
direction: "horizontal" | "vertical";
|
|
53
|
+
range: boolean;
|
|
54
|
+
max: number;
|
|
55
|
+
min: number;
|
|
56
|
+
step: number | "mark";
|
|
57
|
+
precision: number | null;
|
|
58
|
+
tooltip: boolean;
|
|
59
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
61
|
+
export default _default;
|
|
62
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
63
|
+
new (): {
|
|
64
|
+
$slots: S;
|
|
65
|
+
};
|
|
66
|
+
};
|