@mekari/pixel3-color-picker 0.0.1-dev.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/dist/chunk-36OXI4E3.mjs +347 -0
- package/dist/chunk-5FWKSVUW.mjs +89 -0
- package/dist/chunk-AEUPCATZ.mjs +156 -0
- package/dist/chunk-DVRBDVR4.mjs +63 -0
- package/dist/chunk-L5BRB7ES.mjs +64 -0
- package/dist/chunk-PULVLME3.mjs +196 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-YLUI3RMF.mjs +116 -0
- package/dist/color-picker.d.mts +129 -0
- package/dist/color-picker.d.ts +129 -0
- package/dist/color-picker.js +1006 -0
- package/dist/color-picker.mjs +13 -0
- package/dist/hue.d.mts +27 -0
- package/dist/hue.d.ts +27 -0
- package/dist/hue.js +217 -0
- package/dist/hue.mjs +7 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1008 -0
- package/dist/index.mjs +13 -0
- package/dist/input.d.mts +41 -0
- package/dist/input.d.ts +41 -0
- package/dist/input.js +110 -0
- package/dist/input.mjs +7 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/color-picker.hooks.d.mts +206 -0
- package/dist/modules/color-picker.hooks.d.ts +206 -0
- package/dist/modules/color-picker.hooks.js +378 -0
- package/dist/modules/color-picker.hooks.mjs +7 -0
- package/dist/modules/color-picker.props.d.mts +62 -0
- package/dist/modules/color-picker.props.d.ts +62 -0
- package/dist/modules/color-picker.props.js +89 -0
- package/dist/modules/color-picker.props.mjs +9 -0
- package/dist/preset.d.mts +26 -0
- package/dist/preset.d.ts +26 -0
- package/dist/preset.js +94 -0
- package/dist/preset.mjs +7 -0
- package/dist/saturation.d.mts +16 -0
- package/dist/saturation.d.ts +16 -0
- package/dist/saturation.js +187 -0
- package/dist/saturation.mjs +7 -0
- package/package.json +53 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/modules/color-picker.props.ts
|
|
21
|
+
var color_picker_props_exports = {};
|
|
22
|
+
__export(color_picker_props_exports, {
|
|
23
|
+
colorPickerEmit: () => colorPickerEmit,
|
|
24
|
+
colorPickerProps: () => colorPickerProps
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(color_picker_props_exports);
|
|
27
|
+
var PRESET_DEFAULT = ["#3B82F6", "#14B8A6", "#8B5CF6", "#F59E0B", "#EF4444", "#71717A", "#84CC16", "#EC4899", "#232933", "#60A5FA", "#2DD4BF", "#A78BFA", "#FBBF24", "#F87171", "#A1A1AA", "#A3E635", "#F472B6", "#FFFFFF"];
|
|
28
|
+
var colorPickerProps = {
|
|
29
|
+
id: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "Pick a color"
|
|
36
|
+
},
|
|
37
|
+
value: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "#3B82F6"
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "3B82F6"
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "advance"
|
|
48
|
+
},
|
|
49
|
+
placement: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "bottom"
|
|
52
|
+
},
|
|
53
|
+
preset: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default() {
|
|
56
|
+
return PRESET_DEFAULT;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
isShowPopover: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
isShowSaturation: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
isShowHue: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
isShowInput: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true
|
|
74
|
+
},
|
|
75
|
+
isShowPreset: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
isInvalid: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var colorPickerEmit = ["change"];
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
colorPickerEmit,
|
|
88
|
+
colorPickerProps
|
|
89
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpColorPreset: vue.DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
isActive: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
13
|
+
value: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
isActive: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
}>> & {
|
|
21
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
}, {}>;
|
|
25
|
+
|
|
26
|
+
export { MpColorPreset };
|
package/dist/preset.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpColorPreset: vue.DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
isActive: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
13
|
+
value: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
isActive: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
}>> & {
|
|
21
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
}, {}>;
|
|
25
|
+
|
|
26
|
+
export { MpColorPreset };
|
package/dist/preset.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/preset.tsx
|
|
32
|
+
var preset_exports = {};
|
|
33
|
+
__export(preset_exports, {
|
|
34
|
+
MpColorPreset: () => MpColorPreset
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(preset_exports);
|
|
37
|
+
var import_vue = require("vue");
|
|
38
|
+
var import_vue2 = require("vue");
|
|
39
|
+
var import_tinycolor2 = __toESM(require("tinycolor2"));
|
|
40
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
41
|
+
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
42
|
+
var MpColorPreset = (0, import_vue2.defineComponent)({
|
|
43
|
+
name: "MpColorPreset",
|
|
44
|
+
props: {
|
|
45
|
+
value: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
isActive: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: ["click"],
|
|
54
|
+
setup(props, {
|
|
55
|
+
emit
|
|
56
|
+
}) {
|
|
57
|
+
function handleClick() {
|
|
58
|
+
emit("click", props.value);
|
|
59
|
+
}
|
|
60
|
+
__name(handleClick, "handleClick");
|
|
61
|
+
return () => {
|
|
62
|
+
return (0, import_vue.createVNode)("div", {
|
|
63
|
+
"data-pixel-component": "MpColorPickerPreset",
|
|
64
|
+
"class": (0, import_css.css)({
|
|
65
|
+
display: "flex",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
position: "relative",
|
|
69
|
+
width: "6",
|
|
70
|
+
height: "6",
|
|
71
|
+
borderWidth: "1px",
|
|
72
|
+
borderColor: "gray.50",
|
|
73
|
+
borderRadius: "sm",
|
|
74
|
+
cursor: "pointer"
|
|
75
|
+
}),
|
|
76
|
+
"style": {
|
|
77
|
+
background: props.value
|
|
78
|
+
},
|
|
79
|
+
"onClick": handleClick
|
|
80
|
+
}, [props.isActive && (0, import_vue.createVNode)(import_pixel3_icon.MpIcon, {
|
|
81
|
+
"name": "check",
|
|
82
|
+
"size": "sm",
|
|
83
|
+
"color": (0, import_tinycolor2.default)(props.value).isDark() ? "white" : "dark",
|
|
84
|
+
"style": {
|
|
85
|
+
position: "absolute"
|
|
86
|
+
}
|
|
87
|
+
}, null)]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
MpColorPreset
|
|
94
|
+
});
|
package/dist/preset.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpColorSaturation: vue.DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: ObjectConstructor;
|
|
7
|
+
};
|
|
8
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "change"[], "change", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
9
|
+
value: {
|
|
10
|
+
type: ObjectConstructor;
|
|
11
|
+
};
|
|
12
|
+
}>> & {
|
|
13
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
|
|
16
|
+
export { MpColorSaturation };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare const MpColorSaturation: vue.DefineComponent<{
|
|
5
|
+
value: {
|
|
6
|
+
type: ObjectConstructor;
|
|
7
|
+
};
|
|
8
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "change"[], "change", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
9
|
+
value: {
|
|
10
|
+
type: ObjectConstructor;
|
|
11
|
+
};
|
|
12
|
+
}>> & {
|
|
13
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
|
|
16
|
+
export { MpColorSaturation };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/saturation.tsx
|
|
32
|
+
var saturation_exports = {};
|
|
33
|
+
__export(saturation_exports, {
|
|
34
|
+
MpColorSaturation: () => MpColorSaturation
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(saturation_exports);
|
|
37
|
+
var import_vue = require("vue");
|
|
38
|
+
var import_vue2 = require("vue");
|
|
39
|
+
var import_clamp = __toESM(require("clamp"));
|
|
40
|
+
var import_lodash = __toESM(require("lodash.throttle"));
|
|
41
|
+
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
42
|
+
var MpColorSaturation = (0, import_vue2.defineComponent)({
|
|
43
|
+
name: "MpColorSaturation",
|
|
44
|
+
props: {
|
|
45
|
+
value: {
|
|
46
|
+
type: Object
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
emits: ["change"],
|
|
50
|
+
setup(props, {
|
|
51
|
+
emit
|
|
52
|
+
}) {
|
|
53
|
+
const containerNode = (0, import_vue2.ref)();
|
|
54
|
+
const colors = (0, import_vue2.computed)(() => {
|
|
55
|
+
return props.value;
|
|
56
|
+
});
|
|
57
|
+
const bgColor = (0, import_vue2.computed)(() => {
|
|
58
|
+
var _a;
|
|
59
|
+
return `hsl(${(_a = colors.value) == null ? void 0 : _a.hsv.h}, 100%, 50%)`;
|
|
60
|
+
});
|
|
61
|
+
const pointerTop = (0, import_vue2.computed)(() => {
|
|
62
|
+
var _a;
|
|
63
|
+
return -(((_a = colors.value) == null ? void 0 : _a.hsv.v) * 100) + 1 + 100 + "%";
|
|
64
|
+
});
|
|
65
|
+
const pointerLeft = (0, import_vue2.computed)(() => {
|
|
66
|
+
var _a;
|
|
67
|
+
return ((_a = colors.value) == null ? void 0 : _a.hsv.s) * 100 + "%";
|
|
68
|
+
});
|
|
69
|
+
const handleThrottle = (0, import_lodash.default)((fn, data) => {
|
|
70
|
+
fn(data);
|
|
71
|
+
}, 20, {
|
|
72
|
+
leading: true,
|
|
73
|
+
trailing: false
|
|
74
|
+
});
|
|
75
|
+
function handleChange(e, skip) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
!skip && e.preventDefault();
|
|
78
|
+
const container = containerNode.value;
|
|
79
|
+
if (!container) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const containerWidth = container.clientWidth;
|
|
83
|
+
const containerHeight = container.clientHeight;
|
|
84
|
+
const xOffset = container.getBoundingClientRect().left + window.scrollX;
|
|
85
|
+
const yOffset = container.getBoundingClientRect().top + window.scrollY;
|
|
86
|
+
const pageX = e.pageX || (e.touches ? e.touches[0].pageX : 0);
|
|
87
|
+
const pageY = e.pageY || (e.touches ? e.touches[0].pageY : 0);
|
|
88
|
+
const left = (0, import_clamp.default)(pageX - xOffset, 0, containerWidth);
|
|
89
|
+
const top = (0, import_clamp.default)(pageY - yOffset, 0, containerHeight);
|
|
90
|
+
const saturation = left / containerWidth;
|
|
91
|
+
const bright = (0, import_clamp.default)(-(top / containerHeight) + 1, 0, 1);
|
|
92
|
+
handleThrottle(onChange, {
|
|
93
|
+
h: (_a = colors.value) == null ? void 0 : _a.hsv.h,
|
|
94
|
+
s: saturation,
|
|
95
|
+
v: bright,
|
|
96
|
+
a: (_b = colors.value) == null ? void 0 : _b.hsv.a,
|
|
97
|
+
source: "hsva"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
__name(handleChange, "handleChange");
|
|
101
|
+
function onChange(param) {
|
|
102
|
+
emit("change", param);
|
|
103
|
+
}
|
|
104
|
+
__name(onChange, "onChange");
|
|
105
|
+
function handleMouseDown() {
|
|
106
|
+
window.addEventListener("mousemove", handleChange);
|
|
107
|
+
window.addEventListener("mouseup", handleChange);
|
|
108
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
109
|
+
}
|
|
110
|
+
__name(handleMouseDown, "handleMouseDown");
|
|
111
|
+
function handleMouseUp() {
|
|
112
|
+
unbindEventListeners();
|
|
113
|
+
}
|
|
114
|
+
__name(handleMouseUp, "handleMouseUp");
|
|
115
|
+
function unbindEventListeners() {
|
|
116
|
+
window.removeEventListener("mousemove", handleChange);
|
|
117
|
+
window.removeEventListener("mouseup", handleChange);
|
|
118
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
119
|
+
}
|
|
120
|
+
__name(unbindEventListeners, "unbindEventListeners");
|
|
121
|
+
return () => {
|
|
122
|
+
return (0, import_vue.createVNode)("div", {
|
|
123
|
+
"ref": containerNode,
|
|
124
|
+
"data-pixel-component": "MpColorPickerSaturation",
|
|
125
|
+
"id": "saturation-container",
|
|
126
|
+
"class": (0, import_css.css)({
|
|
127
|
+
cursor: "pointer",
|
|
128
|
+
position: "absolute",
|
|
129
|
+
top: "0",
|
|
130
|
+
right: "0",
|
|
131
|
+
bottom: "0",
|
|
132
|
+
left: "0"
|
|
133
|
+
}),
|
|
134
|
+
"style": {
|
|
135
|
+
background: bgColor.value
|
|
136
|
+
},
|
|
137
|
+
"onMousedown": handleMouseDown,
|
|
138
|
+
"onTouchmove": handleChange,
|
|
139
|
+
"onTouchstart": handleChange
|
|
140
|
+
}, [(0, import_vue.createVNode)("div", {
|
|
141
|
+
"id": "saturation-white",
|
|
142
|
+
"class": (0, import_css.css)({
|
|
143
|
+
position: "absolute",
|
|
144
|
+
top: "0",
|
|
145
|
+
right: "0",
|
|
146
|
+
bottom: "0",
|
|
147
|
+
left: "0",
|
|
148
|
+
background: "linear-gradient(to right, #fff, rgba(255,255,255,0))"
|
|
149
|
+
})
|
|
150
|
+
}, null), (0, import_vue.createVNode)("div", {
|
|
151
|
+
"id": "saturation-black",
|
|
152
|
+
"class": (0, import_css.css)({
|
|
153
|
+
position: "absolute",
|
|
154
|
+
top: "0",
|
|
155
|
+
right: "0",
|
|
156
|
+
bottom: "0",
|
|
157
|
+
left: "0",
|
|
158
|
+
background: "linear-gradient(to top, #000, rgba(0,0,0,0))"
|
|
159
|
+
})
|
|
160
|
+
}, null), (0, import_vue.createVNode)("div", {
|
|
161
|
+
"id": "saturation-pointer",
|
|
162
|
+
"class": (0, import_css.css)({
|
|
163
|
+
cursor: "pointer",
|
|
164
|
+
position: "absolute"
|
|
165
|
+
}),
|
|
166
|
+
"style": {
|
|
167
|
+
top: pointerTop.value,
|
|
168
|
+
left: pointerLeft.value
|
|
169
|
+
}
|
|
170
|
+
}, [(0, import_vue.createVNode)("div", {
|
|
171
|
+
"id": "saturation-circle",
|
|
172
|
+
"class": (0, import_css.css)({
|
|
173
|
+
cursor: "pointer",
|
|
174
|
+
width: "6px",
|
|
175
|
+
height: "6px",
|
|
176
|
+
boxShadow: "0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3), 0 0 1px 2px rgba(0,0,0,.4)",
|
|
177
|
+
borderRadius: "50%",
|
|
178
|
+
transform: "translate(-2px, -2px)"
|
|
179
|
+
})
|
|
180
|
+
}, null)])]);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
185
|
+
0 && (module.exports = {
|
|
186
|
+
MpColorSaturation
|
|
187
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mekari/pixel3-color-picker",
|
|
3
|
+
"description": "Color picker component for mekari pixel 3",
|
|
4
|
+
"version": "0.0.1-dev.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"clamp": "^1.0.1",
|
|
12
|
+
"lodash.throttle": "^4.0.0",
|
|
13
|
+
"tinycolor2": "^1.1.2",
|
|
14
|
+
"@mekari/pixel3-button": "0.0.12-dev.2",
|
|
15
|
+
"@mekari/pixel3-divider": "0.0.12-dev.1",
|
|
16
|
+
"@mekari/pixel3-icon": "0.0.12-dev.2",
|
|
17
|
+
"@mekari/pixel3-input": "0.0.12-dev.2",
|
|
18
|
+
"@mekari/pixel3-popover": "0.0.12-dev.2",
|
|
19
|
+
"@mekari/pixel3-styled-system": "0.0.10-dev.1",
|
|
20
|
+
"@mekari/pixel3-text": "0.0.12-dev.1",
|
|
21
|
+
"@mekari/pixel3-utils": "0.0.6"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"vue": "^3.4.9"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/tinycolor2": "^1.4.6",
|
|
28
|
+
"@types/lodash.throttle": "^4.1.9",
|
|
29
|
+
"@types/clamp": "^1.0.3",
|
|
30
|
+
"vue": "^3.4.9"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"module": "dist/index.mjs",
|
|
36
|
+
"types": "dist/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"require": "./dist/index.js",
|
|
41
|
+
"default": "./dist/index.mjs"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"clean": "rimraf dist .turbo",
|
|
46
|
+
"build": "tsup && pnpm build:types",
|
|
47
|
+
"build:fast": "tsup",
|
|
48
|
+
"build:types": "tsup src --dts-only",
|
|
49
|
+
"types:check": "tsc --noEmit",
|
|
50
|
+
"replace-config": "clean-package",
|
|
51
|
+
"restore-config": "clean-package restore"
|
|
52
|
+
}
|
|
53
|
+
}
|