@opentinyvue/vue-color-picker 2.21.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/LICENSE +22 -0
- package/index.d.ts +2 -0
- package/lib/index.js +90 -0
- package/lib/mobile.js +64 -0
- package/lib/pc.js +114 -0
- package/package.json +17 -0
- package/src/index.d.ts +2 -0
- package/src/mobile.vue.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -0
- package/src/utils/use-drag.d.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
4
|
+
var t = arguments[e];
|
|
5
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6
|
+
}
|
|
7
|
+
return n;
|
|
8
|
+
}, _extends.apply(null, arguments);
|
|
9
|
+
}
|
|
10
|
+
import { defineComponent, $prefix, $props, $setup } from "@opentinyvue/vue-common";
|
|
11
|
+
import PcTemplate from "./pc.js";
|
|
12
|
+
import MobileTemplate from "./mobile.js";
|
|
13
|
+
import "@opentinyvue/vue-theme/color-picker/index.css";
|
|
14
|
+
var template = function template2(mode) {
|
|
15
|
+
var _process$env;
|
|
16
|
+
var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
17
|
+
if ("pc" === (tinyMode || mode)) {
|
|
18
|
+
return PcTemplate;
|
|
19
|
+
}
|
|
20
|
+
if ("mobile" === (tinyMode || mode)) {
|
|
21
|
+
return MobileTemplate;
|
|
22
|
+
}
|
|
23
|
+
return PcTemplate;
|
|
24
|
+
};
|
|
25
|
+
var $constants = {};
|
|
26
|
+
var ColorPicker = defineComponent({
|
|
27
|
+
name: $prefix + "ColorPicker",
|
|
28
|
+
props: _extends({}, $props, {
|
|
29
|
+
_constants: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: function _default() {
|
|
32
|
+
return $constants;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
modelValue: String,
|
|
36
|
+
visible: Boolean,
|
|
37
|
+
alpha: Boolean,
|
|
38
|
+
predefine: Array,
|
|
39
|
+
history: Array,
|
|
40
|
+
size: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "",
|
|
43
|
+
validator: function validator(val) {
|
|
44
|
+
return [" large", "medium", "small", "mini", ""].includes(val);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
format: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default: function _default2() {
|
|
50
|
+
return [];
|
|
51
|
+
},
|
|
52
|
+
validator: function validator2(val) {
|
|
53
|
+
if (!val.length) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (val[val.length - 1] === "a") {
|
|
57
|
+
console.warn("If you want enable alpha, You should set `alpha` prop to true");
|
|
58
|
+
}
|
|
59
|
+
return ["hsv", "hsl", "rgb", "hex"].includes(val);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
enableHistory: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
enablePredefineColor: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
setup: function setup(props, context) {
|
|
72
|
+
return $setup({
|
|
73
|
+
props,
|
|
74
|
+
context,
|
|
75
|
+
template
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
var version = "2.21.0";
|
|
80
|
+
ColorPicker.model = {
|
|
81
|
+
prop: "modelValue",
|
|
82
|
+
event: "update:modelValue"
|
|
83
|
+
};
|
|
84
|
+
ColorPicker.install = function(Vue) {
|
|
85
|
+
Vue.component(ColorPicker.name, ColorPicker);
|
|
86
|
+
};
|
|
87
|
+
ColorPicker.version = version;
|
|
88
|
+
export {
|
|
89
|
+
ColorPicker as default
|
|
90
|
+
};
|
package/lib/mobile.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/color-picker/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
|
|
4
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
5
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
6
|
+
if (render) {
|
|
7
|
+
options.render = render;
|
|
8
|
+
options.staticRenderFns = staticRenderFns;
|
|
9
|
+
options._compiled = true;
|
|
10
|
+
}
|
|
11
|
+
var hook;
|
|
12
|
+
if (injectStyles) {
|
|
13
|
+
hook = injectStyles;
|
|
14
|
+
}
|
|
15
|
+
if (hook) {
|
|
16
|
+
if (options.functional) {
|
|
17
|
+
options._injectStyles = hook;
|
|
18
|
+
var originalRender = options.render;
|
|
19
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
20
|
+
hook.call(context);
|
|
21
|
+
return originalRender(h, context);
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
var existing = options.beforeCreate;
|
|
25
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
exports: scriptExports,
|
|
30
|
+
options
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var render = function render2() {
|
|
35
|
+
var _vm = this;
|
|
36
|
+
var _h = _vm.$createElement;
|
|
37
|
+
var _c = _vm._self._c || _h;
|
|
38
|
+
return _c("div");
|
|
39
|
+
};
|
|
40
|
+
var staticRenderFns = [];
|
|
41
|
+
var __vue2_script = defineComponent({
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
props: [].concat(props, ["modelValue"]),
|
|
44
|
+
setup: function setup$1(props2, context) {
|
|
45
|
+
return setup({
|
|
46
|
+
props: props2,
|
|
47
|
+
context,
|
|
48
|
+
renderless,
|
|
49
|
+
api
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var __cssModules = {};
|
|
54
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
55
|
+
function __vue2_injectStyles(context) {
|
|
56
|
+
for (var o in __cssModules) {
|
|
57
|
+
this[o] = __cssModules[o];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var mobile = /* @__PURE__ */ function() {
|
|
61
|
+
return __component__.exports;
|
|
62
|
+
}();
|
|
63
|
+
|
|
64
|
+
export { mobile as default };
|
package/lib/pc.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/color-picker/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { IconChevronDown } from '@opentinyvue/vue-icon';
|
|
4
|
+
import ColorSelectPanel from '@opentinyvue/vue-color-select-panel';
|
|
5
|
+
import '@opentinyvue/vue-theme/color-picker/index.css';
|
|
6
|
+
|
|
7
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
8
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
9
|
+
if (render) {
|
|
10
|
+
options.render = render;
|
|
11
|
+
options.staticRenderFns = staticRenderFns;
|
|
12
|
+
options._compiled = true;
|
|
13
|
+
}
|
|
14
|
+
var hook;
|
|
15
|
+
if (injectStyles) {
|
|
16
|
+
hook = injectStyles;
|
|
17
|
+
}
|
|
18
|
+
if (hook) {
|
|
19
|
+
if (options.functional) {
|
|
20
|
+
options._injectStyles = hook;
|
|
21
|
+
var originalRender = options.render;
|
|
22
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
23
|
+
hook.call(context);
|
|
24
|
+
return originalRender(h, context);
|
|
25
|
+
};
|
|
26
|
+
} else {
|
|
27
|
+
var existing = options.beforeCreate;
|
|
28
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
exports: scriptExports,
|
|
33
|
+
options
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var render = function render2() {
|
|
38
|
+
var _vm$state$hex;
|
|
39
|
+
var _vm = this;
|
|
40
|
+
var _h = _vm.$createElement;
|
|
41
|
+
var _c = _vm._self._c || _h;
|
|
42
|
+
return _c("div", {
|
|
43
|
+
class: [{
|
|
44
|
+
"tiny-color-picker": true
|
|
45
|
+
}, _vm.state.size ? "tiny-color-picker--" + _vm.state.size : ""],
|
|
46
|
+
on: {
|
|
47
|
+
"click": function click() {
|
|
48
|
+
return _vm.changeVisible(!_vm.state.isShow);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [_c("div", {
|
|
52
|
+
staticClass: "tiny-color-picker__inner",
|
|
53
|
+
style: {
|
|
54
|
+
background: (_vm$state$hex = _vm.state.hex) !== null && _vm$state$hex !== void 0 ? _vm$state$hex : ""
|
|
55
|
+
}
|
|
56
|
+
}, [_c("IconChevronDown")], 1), _c("Transition", {
|
|
57
|
+
attrs: {
|
|
58
|
+
"name": "tiny-zoom-in-top"
|
|
59
|
+
}
|
|
60
|
+
}, [_c("color-select", {
|
|
61
|
+
style: {
|
|
62
|
+
"min-width": "420px"
|
|
63
|
+
},
|
|
64
|
+
attrs: {
|
|
65
|
+
"visible": _vm.state.isShow,
|
|
66
|
+
"alpha": _vm.alpha,
|
|
67
|
+
"predefine": _vm.state.predefineStack,
|
|
68
|
+
"history": _vm.state.stack,
|
|
69
|
+
"format": _vm.format,
|
|
70
|
+
"enable-history": _vm.state.enableHistory,
|
|
71
|
+
"enable-predefine-color": _vm.state.enablePredefineColor
|
|
72
|
+
},
|
|
73
|
+
on: {
|
|
74
|
+
"confirm": _vm.onConfirm,
|
|
75
|
+
"cancel": _vm.onCancel
|
|
76
|
+
},
|
|
77
|
+
model: {
|
|
78
|
+
value: _vm.state.hex,
|
|
79
|
+
callback: function callback($$v) {
|
|
80
|
+
_vm.$set(_vm.state, "hex", $$v);
|
|
81
|
+
},
|
|
82
|
+
expression: "state.hex"
|
|
83
|
+
}
|
|
84
|
+
})], 1)], 1);
|
|
85
|
+
};
|
|
86
|
+
var staticRenderFns = [];
|
|
87
|
+
var __vue2_script = defineComponent({
|
|
88
|
+
emits: ["update:modelValue", "confirm", "cancel"],
|
|
89
|
+
props: [].concat(props, ["modelValue", "visible", "alpha", "predefine", "history", "size", "format", "enableHistory", "enablePredefineColor"]),
|
|
90
|
+
components: {
|
|
91
|
+
IconChevronDown: IconChevronDown(),
|
|
92
|
+
ColorSelect: ColorSelectPanel
|
|
93
|
+
},
|
|
94
|
+
setup: function setup$1(props2, context) {
|
|
95
|
+
return setup({
|
|
96
|
+
props: props2,
|
|
97
|
+
context,
|
|
98
|
+
renderless,
|
|
99
|
+
api
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
var __cssModules = {};
|
|
104
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
105
|
+
function __vue2_injectStyles(context) {
|
|
106
|
+
for (var o in __cssModules) {
|
|
107
|
+
this[o] = __cssModules[o];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var pc = /* @__PURE__ */ function() {
|
|
111
|
+
return __component__.exports;
|
|
112
|
+
}();
|
|
113
|
+
|
|
114
|
+
export { pc as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-color-picker",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@opentinyvue/vue-color-select-panel": "~2.21.0",
|
|
10
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
13
|
+
"@opentinyvue/vue-theme": "~3.21.0"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"types": "index.d.ts"
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
package/src/pc.vue.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DraggableOptions {
|
|
2
|
+
drag?: (event: MouseEvent | TouchEvent) => void;
|
|
3
|
+
start?: (event: MouseEvent | TouchEvent) => void;
|
|
4
|
+
end?: (event: MouseEvent | TouchEvent) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function draggable(element: HTMLElement, options: DraggableOptions): void;
|