@opentinyvue/vue-color-select-panel 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 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
@@ -0,0 +1,2 @@
1
+ import ColorSelectPanel from './src/index';
2
+ export default ColorSelectPanel;
package/lib/index.js ADDED
@@ -0,0 +1,76 @@
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
+ var template = function template2(mode) {
13
+ var _process$env;
14
+ typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
15
+ return PcTemplate;
16
+ };
17
+ var $constants = {};
18
+ var ColorSelectPanel = defineComponent({
19
+ name: $prefix + "ColorSelectPanel",
20
+ props: _extends({}, $props, {
21
+ _constants: {
22
+ type: Object,
23
+ default: function _default() {
24
+ return $constants;
25
+ }
26
+ },
27
+ modelValue: String,
28
+ visible: Boolean,
29
+ alpha: Boolean,
30
+ history: Array,
31
+ predefine: Array,
32
+ enableHistory: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ enablePredefineColor: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ format: {
41
+ type: Array,
42
+ default: function _default2() {
43
+ return [];
44
+ },
45
+ validator: function validator(formats) {
46
+ formats.forEach(function(formatValue) {
47
+ if (formatValue[formatValue.length - 1] === "a") {
48
+ console.warn("If you want enable alpha, You should set `alpha` prop to true");
49
+ }
50
+ });
51
+ return formats.every(function(formatValue) {
52
+ return ["hsv", "hsl", "rgb", "hex"].includes(formatValue);
53
+ });
54
+ }
55
+ }
56
+ }),
57
+ setup: function setup(props, context) {
58
+ return $setup({
59
+ props,
60
+ context,
61
+ template
62
+ });
63
+ }
64
+ });
65
+ var version = "2.21.0";
66
+ ColorSelectPanel.model = {
67
+ prop: "modelValue",
68
+ event: "update:modelValue"
69
+ };
70
+ ColorSelectPanel.install = function(Vue) {
71
+ Vue.component(ColorSelectPanel.name, ColorSelectPanel);
72
+ };
73
+ ColorSelectPanel.version = version;
74
+ export {
75
+ ColorSelectPanel as default
76
+ };
package/lib/pc.js ADDED
@@ -0,0 +1,368 @@
1
+ import Button from '@opentinyvue/vue-button';
2
+ import Input from '@opentinyvue/vue-input';
3
+ import { renderless as renderless$3, api as api$3 } from '@opentinyvue/vue-renderless/color-select-panel/vue';
4
+ import { defineComponent, setup, props, directive } from '@opentinyvue/vue-common';
5
+ import { renderless as renderless$1, api as api$1 } from '@opentinyvue/vue-renderless/color-select-panel/hue-select/vue';
6
+ import { api, renderless } from '@opentinyvue/vue-renderless/color-select-panel/sv-select/vue';
7
+ import { renderless as renderless$2, api as api$2 } from '@opentinyvue/vue-renderless/color-select-panel/alpha-select/vue';
8
+ import '@opentinyvue/vue-theme/color-select-panel/index.css';
9
+ import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
10
+ import Collapse from '@opentinyvue/vue-collapse';
11
+ import CollapseItem from '@opentinyvue/vue-collapse-item';
12
+ import Select from '@opentinyvue/vue-select';
13
+ import Option from '@opentinyvue/vue-option';
14
+
15
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
16
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
17
+ if (render) {
18
+ options.render = render;
19
+ options.staticRenderFns = staticRenderFns;
20
+ options._compiled = true;
21
+ }
22
+ var hook;
23
+ if (injectStyles) {
24
+ hook = injectStyles;
25
+ }
26
+ if (hook) {
27
+ if (options.functional) {
28
+ options._injectStyles = hook;
29
+ var originalRender = options.render;
30
+ options.render = function renderWithStyleInjection(h, context) {
31
+ hook.call(context);
32
+ return originalRender(h, context);
33
+ };
34
+ } else {
35
+ var existing = options.beforeCreate;
36
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
37
+ }
38
+ }
39
+ return {
40
+ exports: scriptExports,
41
+ options
42
+ };
43
+ }
44
+
45
+ var render$3 = function render$32() {
46
+ var _vm = this;
47
+ var _h = _vm.$createElement;
48
+ var _c = _vm._self._c || _h;
49
+ return _c("div", {
50
+ ref: "wrapper",
51
+ staticClass: "tiny-color-select-panel__inner__color-select",
52
+ style: {
53
+ background: _vm.state.bg
54
+ }
55
+ }, [_c("div", {
56
+ staticClass: "white"
57
+ }), _c("div", {
58
+ staticClass: "black"
59
+ }), _c("div", {
60
+ ref: "cursor",
61
+ staticClass: "cursor",
62
+ style: {
63
+ top: _vm.state.cursorTop + "px",
64
+ left: _vm.state.cursorLeft + "px",
65
+ transform: "translate(-50%, -50%)"
66
+ }
67
+ })]);
68
+ };
69
+ var staticRenderFns$3 = [];
70
+ var __vue2_script$3 = defineComponent({
71
+ emit: ["ready", "svUpdate"],
72
+ props: {
73
+ color: {
74
+ type: Object
75
+ }
76
+ },
77
+ setup: function setup$1(props2, context) {
78
+ return setup({
79
+ props: props2,
80
+ api,
81
+ renderless,
82
+ context,
83
+ mono: true
84
+ });
85
+ }
86
+ });
87
+ var __cssModules$3 = {};
88
+ var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3);
89
+ function __vue2_injectStyles$3(context) {
90
+ for (var o in __cssModules$3) {
91
+ this[o] = __cssModules$3[o];
92
+ }
93
+ }
94
+ var SvSelect = /* @__PURE__ */ function() {
95
+ return __component__$3.exports;
96
+ }();
97
+ var render$2 = function render$22() {
98
+ var _vm = this;
99
+ var _h = _vm.$createElement;
100
+ var _c = _vm._self._c || _h;
101
+ return _c("div", {
102
+ staticClass: "tiny-color-select-panel__inner"
103
+ }, [_c("sv-select", {
104
+ attrs: {
105
+ "color": _vm.color
106
+ },
107
+ on: {
108
+ "ready": _vm.onSvReady
109
+ }
110
+ }), _c("div", {
111
+ ref: "bar",
112
+ staticClass: "tiny-color-select-panel__inner__hue-select"
113
+ }, [_c("div", {
114
+ ref: "thumb",
115
+ style: {
116
+ top: _vm.state.thumbTop + "px",
117
+ transform: "translateY(-50%)"
118
+ }
119
+ })])], 1);
120
+ };
121
+ var staticRenderFns$2 = [];
122
+ var __vue2_script$2 = defineComponent({
123
+ emits: ["hueUpdate", "svReady", "hueReady"],
124
+ props: {
125
+ color: {
126
+ type: Object
127
+ },
128
+ alpha: {
129
+ type: Boolean
130
+ }
131
+ },
132
+ components: {
133
+ SvSelect
134
+ },
135
+ setup: function setup2(props2, context) {
136
+ return setup({
137
+ props: props2,
138
+ context,
139
+ renderless: renderless$1,
140
+ api: api$1,
141
+ mono: true
142
+ });
143
+ }
144
+ });
145
+ var __cssModules$2 = {};
146
+ var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2);
147
+ function __vue2_injectStyles$2(context) {
148
+ for (var o in __cssModules$2) {
149
+ this[o] = __cssModules$2[o];
150
+ }
151
+ }
152
+ var HueSelect = /* @__PURE__ */ function() {
153
+ return __component__$2.exports;
154
+ }();
155
+ var render$1 = function render$12() {
156
+ var _vm = this;
157
+ var _h = _vm.$createElement;
158
+ var _c = _vm._self._c || _h;
159
+ return _c("div", {
160
+ ref: "alphaWrapper",
161
+ staticClass: "tiny-color-select-panel__alpha",
162
+ on: {
163
+ "click": _vm.onClick
164
+ }
165
+ }, [_c("div", {
166
+ ref: "slider",
167
+ staticClass: "tiny-color-select-panel__alpha__slider",
168
+ style: {
169
+ background: _vm.state.background
170
+ }
171
+ }), _c("div", {
172
+ ref: "alphaThumb",
173
+ staticClass: "tiny-color-select-panel__alpha__thumb",
174
+ style: {
175
+ top: 0,
176
+ left: _vm.state.left + "px",
177
+ transform: "translateX(-50%)"
178
+ }
179
+ })]);
180
+ };
181
+ var staticRenderFns$1 = [];
182
+ var __vue2_script$1 = defineComponent({
183
+ emits: ["ready"],
184
+ props: {
185
+ color: {
186
+ type: Object
187
+ }
188
+ },
189
+ setup: function setup3(props2, context) {
190
+ return setup({
191
+ props: props2,
192
+ context,
193
+ renderless: renderless$2,
194
+ api: api$2,
195
+ mono: true
196
+ });
197
+ }
198
+ });
199
+ var __cssModules$1 = {};
200
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
201
+ function __vue2_injectStyles$1(context) {
202
+ for (var o in __cssModules$1) {
203
+ this[o] = __cssModules$1[o];
204
+ }
205
+ }
206
+ var AlphaSelect = /* @__PURE__ */ function() {
207
+ return __component__$1.exports;
208
+ }();
209
+ var render = function render2() {
210
+ var _vm = this;
211
+ var _h = _vm.$createElement;
212
+ var _c = _vm._self._c || _h;
213
+ return _vm.state.showPicker ? _c("div", {
214
+ directives: [{
215
+ name: "clickoutside",
216
+ rawName: "v-clickoutside",
217
+ value: _vm.onClickOutside,
218
+ expression: "onClickOutside"
219
+ }],
220
+ staticClass: "tiny-color-select-panel",
221
+ on: {
222
+ "click": function click($event) {
223
+ $event.stopPropagation();
224
+ }
225
+ }
226
+ }, [_c("hue-select", {
227
+ attrs: {
228
+ "color": _vm.state.color
229
+ },
230
+ on: {
231
+ "hue-ready": _vm.onHueReady,
232
+ "sv-ready": _vm.onSvReady
233
+ }
234
+ }), _vm.alpha ? _c("alpha-select", {
235
+ attrs: {
236
+ "color": _vm.state.color
237
+ },
238
+ on: {
239
+ "ready": _vm.onAlphaReady
240
+ }
241
+ }) : _vm._e(), _c("div", {
242
+ staticClass: "tiny-color-select-panel__tools"
243
+ }, [_vm.state.formats.length ? _c("div", {
244
+ staticClass: "tiny-color-select-panel__tools__format-select"
245
+ }, [_c("tiny-select", {
246
+ model: {
247
+ value: _vm.state.currentFormat,
248
+ callback: function callback($$v) {
249
+ _vm.$set(_vm.state, "currentFormat", $$v);
250
+ },
251
+ expression: "state.currentFormat"
252
+ }
253
+ }, _vm._l(_vm.state.formats, function(formatValue) {
254
+ return _c("tiny-option", {
255
+ key: formatValue,
256
+ attrs: {
257
+ "value": formatValue,
258
+ "label": formatValue
259
+ }
260
+ });
261
+ }), 1)], 1) : _vm._e(), _c("tiny-input", {
262
+ attrs: {
263
+ "size": "small"
264
+ },
265
+ model: {
266
+ value: _vm.state.input,
267
+ callback: function callback($$v) {
268
+ _vm.$set(_vm.state, "input", $$v);
269
+ },
270
+ expression: "state.input"
271
+ }
272
+ }), _c("div", {
273
+ staticClass: "tiny-color-select-panel__tools-btns"
274
+ }, [_c("tiny-button", {
275
+ attrs: {
276
+ "size": "small"
277
+ },
278
+ on: {
279
+ "click": _vm.onCancel
280
+ }
281
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.cancel")) + " ")]), _c("tiny-button", {
282
+ attrs: {
283
+ "type": "primary",
284
+ "size": "small"
285
+ },
286
+ on: {
287
+ "click": _vm.onConfirm
288
+ }
289
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.confirm")) + " ")])], 1)], 1), _c("tiny-collapse", [_vm.state.enableHistory ? _c("tiny-collapse-item", {
290
+ attrs: {
291
+ "title": _vm.t("ui.colorSelectPanel.history"),
292
+ "name": "history"
293
+ }
294
+ }, [_vm.state.stack.length ? _c("div", {
295
+ staticClass: "tiny-color-select-panel__history"
296
+ }, _vm._l(_vm.state.stack, function(color, key) {
297
+ return _c("div", {
298
+ key,
299
+ staticClass: "tiny-color-select-panel__history__color-block",
300
+ style: {
301
+ background: color
302
+ },
303
+ on: {
304
+ "click": function click() {
305
+ return _vm.onHistoryClick(color);
306
+ }
307
+ }
308
+ });
309
+ }), 0) : _vm._e(), !_vm.state.stack.length ? _c("div", [_vm._v(_vm._s(_vm.t("ui.colorSelectPanel.empty")))]) : _vm._e()]) : _vm._e(), _vm.state.enablePredefineColor ? _c("tiny-collapse-item", {
310
+ attrs: {
311
+ "title": _vm.t("ui.colorSelectPanel.predefine"),
312
+ "name": "predefine"
313
+ }
314
+ }, [_vm.state.predefineStack.length ? _c("div", {
315
+ staticClass: "tiny-color-select-panel__predefine"
316
+ }, _vm._l(_vm.state.predefineStack, function(color, key) {
317
+ return _c("div", {
318
+ key,
319
+ staticClass: "tiny-color-select-panel__predefine__color-block",
320
+ style: {
321
+ background: color
322
+ },
323
+ on: {
324
+ "click": function click() {
325
+ return _vm.onPredefineColorClick(color);
326
+ }
327
+ }
328
+ });
329
+ }), 0) : _vm._e(), !_vm.state.predefineStack.length ? _c("div", [_vm._v(_vm._s(_vm.t("ui.colorSelectPanel.empty")))]) : _vm._e()]) : _vm._e()], 1)], 1) : _vm._e();
330
+ };
331
+ var staticRenderFns = [];
332
+ var __vue2_script = defineComponent({
333
+ emits: ["update:modelValue", "cancel", "confirm", "color-update"],
334
+ props: [].concat(props, ["modelValue", "visible", "alpha", "history", "predefine", "format", "enableHistory", "enablePredefineColor"]),
335
+ components: {
336
+ HueSelect,
337
+ AlphaSelect,
338
+ TinyButton: Button,
339
+ TinyInput: Input,
340
+ TinyCollapse: Collapse,
341
+ TinyCollapseItem: CollapseItem,
342
+ TinySelect: Select,
343
+ TinyOption: Option
344
+ },
345
+ directives: directive({
346
+ Clickoutside
347
+ }),
348
+ setup: function setup4(props2, context) {
349
+ return setup({
350
+ props: props2,
351
+ context,
352
+ renderless: renderless$3,
353
+ api: api$3
354
+ });
355
+ }
356
+ });
357
+ var __cssModules = {};
358
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
359
+ function __vue2_injectStyles(context) {
360
+ for (var o in __cssModules) {
361
+ this[o] = __cssModules[o];
362
+ }
363
+ }
364
+ var pc = /* @__PURE__ */ function() {
365
+ return __component__.exports;
366
+ }();
367
+
368
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@opentinyvue/vue-color-select-panel",
3
+ "version": "2.21.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "dependencies": {
10
+ "@opentinyvue/vue-button": "~2.21.0",
11
+ "@opentinyvue/vue-collapse": "~2.21.0",
12
+ "@opentinyvue/vue-collapse-item": "~2.21.0",
13
+ "@opentinyvue/vue-common": "~2.21.0",
14
+ "@opentinyvue/vue-input": "~2.21.0",
15
+ "@opentinyvue/vue-option": "~2.21.0",
16
+ "@opentinyvue/vue-renderless": "~3.21.0",
17
+ "@opentinyvue/vue-select": "~2.21.0",
18
+ "@opentinyvue/vue-theme": "~3.21.0"
19
+ },
20
+ "license": "MIT",
21
+ "types": "index.d.ts"
22
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;