@opentinyvue/vue-color-select-panel 2.25.0 → 2.27.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/lib/pc.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import Button from '@opentinyvue/vue-button';
2
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';
3
+ import Numeric from '@opentinyvue/vue-numeric';
4
+ import { renderless as renderless$4, api as api$4 } from '@opentinyvue/vue-renderless/color-select-panel/vue';
4
5
  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 { renderless as renderless$2, api as api$2 } from '@opentinyvue/vue-renderless/color-select-panel/hue-select/vue';
6
7
  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 { renderless as renderless$1, api as api$1 } from '@opentinyvue/vue-renderless/color-select-panel/linear-gradient/vue';
9
+ import { renderless as renderless$3, api as api$3 } from '@opentinyvue/vue-renderless/color-select-panel/alpha-select/vue';
8
10
  import '@opentinyvue/vue-theme/color-select-panel/index.css';
9
11
  import { Clickoutside } from '@opentinyvue/vue-directive';
10
- import Collapse from '@opentinyvue/vue-collapse';
11
- import CollapseItem from '@opentinyvue/vue-collapse-item';
12
12
  import Select from '@opentinyvue/vue-select';
13
13
  import Option from '@opentinyvue/vue-option';
14
14
 
@@ -42,7 +42,7 @@ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTe
42
42
  };
43
43
  }
44
44
 
45
- var render$3 = function render$32() {
45
+ var render$4 = function render$42() {
46
46
  var _vm = this;
47
47
  var _h = _vm.$createElement;
48
48
  var _c = _vm._self._c || _h;
@@ -66,8 +66,8 @@ var render$3 = function render$32() {
66
66
  }
67
67
  })]);
68
68
  };
69
- var staticRenderFns$3 = [];
70
- var __vue2_script$3 = defineComponent({
69
+ var staticRenderFns$4 = [];
70
+ var __vue2_script$4 = defineComponent({
71
71
  emit: ["ready", "svUpdate"],
72
72
  props: {
73
73
  color: {
@@ -84,6 +84,68 @@ var __vue2_script$3 = defineComponent({
84
84
  });
85
85
  }
86
86
  });
87
+ var __cssModules$4 = {};
88
+ var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4);
89
+ function __vue2_injectStyles$4(context) {
90
+ for (var o in __cssModules$4) {
91
+ this[o] = __cssModules$4[o];
92
+ }
93
+ }
94
+ var SvSelect = /* @__PURE__ */ (function() {
95
+ return __component__$4.exports;
96
+ })();
97
+ var render$3 = function render$32() {
98
+ var _vm = this;
99
+ var _h = _vm.$createElement;
100
+ var _c = _vm._self._c || _h;
101
+ return _c("div", {
102
+ ref: "linearGradientBar",
103
+ staticClass: "tiny-color-select-panel__linear-gradient",
104
+ style: {
105
+ background: _vm.state.linearGradientBarBackground
106
+ },
107
+ on: {
108
+ "click": _vm.onClickBar
109
+ }
110
+ }, _vm._l(_vm.context.colorPoints, function(point, idx) {
111
+ return _c("div", {
112
+ key: idx,
113
+ ref: "thumb",
114
+ refInFor: true,
115
+ staticClass: "tiny-color-select-panel__linear-gradient__thumb",
116
+ style: {
117
+ left: point.cursorLeft + "px",
118
+ transform: "translateX(-50%)"
119
+ },
120
+ on: {
121
+ "click": function click($event) {
122
+ $event.stopPropagation();
123
+ },
124
+ "mousedown": function mousedown(event) {
125
+ return _vm.onThumbMouseDown(event, point);
126
+ }
127
+ }
128
+ }, [_c("div", {
129
+ staticClass: "tiny-color-select-panel__linear-gradient__thumb-heart",
130
+ style: {
131
+ background: point.color.value
132
+ }
133
+ })]);
134
+ }), 0);
135
+ };
136
+ var staticRenderFns$3 = [];
137
+ var __vue2_script$3 = defineComponent({
138
+ props: {},
139
+ setup: function setup2(props2, context) {
140
+ return setup({
141
+ props: props2,
142
+ context,
143
+ renderless: renderless$1,
144
+ api: api$1,
145
+ mono: true
146
+ });
147
+ }
148
+ });
87
149
  var __cssModules$3 = {};
88
150
  var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3);
89
151
  function __vue2_injectStyles$3(context) {
@@ -91,9 +153,9 @@ function __vue2_injectStyles$3(context) {
91
153
  this[o] = __cssModules$3[o];
92
154
  }
93
155
  }
94
- var SvSelect = /* @__PURE__ */ function() {
156
+ var linearGradient = /* @__PURE__ */ (function() {
95
157
  return __component__$3.exports;
96
- }();
158
+ })();
97
159
  var render$2 = function render$22() {
98
160
  var _vm = this;
99
161
  var _h = _vm.$createElement;
@@ -112,11 +174,17 @@ var render$2 = function render$22() {
112
174
  staticClass: "tiny-color-select-panel__inner__hue-select"
113
175
  }, [_c("div", {
114
176
  ref: "thumb",
177
+ staticClass: "tiny-color-select-panel__inner__hue-select-thumb",
178
+ style: {
179
+ left: _vm.state.thumbLeft + "px",
180
+ transform: "translateX(-50%)"
181
+ }
182
+ }, [_c("div", {
183
+ staticClass: "tiny-color-select-panel__inner__hue-select-thumb-heart",
115
184
  style: {
116
- top: _vm.state.thumbTop + "px",
117
- transform: "translateY(-50%)"
185
+ background: _vm.state.ctx.activeColor.color.value
118
186
  }
119
- })])], 1);
187
+ })])]), _vm.state.ctx.colorMode === "linear-gradient" ? _c("linear-gradient") : _vm._e()], 1);
120
188
  };
121
189
  var staticRenderFns$2 = [];
122
190
  var __vue2_script$2 = defineComponent({
@@ -130,14 +198,15 @@ var __vue2_script$2 = defineComponent({
130
198
  }
131
199
  },
132
200
  components: {
133
- SvSelect
201
+ SvSelect,
202
+ LinearGradient: linearGradient
134
203
  },
135
- setup: function setup2(props2, context) {
204
+ setup: function setup3(props2, context) {
136
205
  return setup({
137
206
  props: props2,
138
207
  context,
139
- renderless: renderless$1,
140
- api: api$1,
208
+ renderless: renderless$2,
209
+ api: api$2,
141
210
  mono: true
142
211
  });
143
212
  }
@@ -149,9 +218,9 @@ function __vue2_injectStyles$2(context) {
149
218
  this[o] = __cssModules$2[o];
150
219
  }
151
220
  }
152
- var HueSelect = /* @__PURE__ */ function() {
221
+ var HueSelect = /* @__PURE__ */ (function() {
153
222
  return __component__$2.exports;
154
- }();
223
+ })();
155
224
  var render$1 = function render$12() {
156
225
  var _vm = this;
157
226
  var _h = _vm.$createElement;
@@ -172,11 +241,16 @@ var render$1 = function render$12() {
172
241
  ref: "alphaThumb",
173
242
  staticClass: "tiny-color-select-panel__alpha__thumb",
174
243
  style: {
175
- top: 0,
244
+ top: "-2px",
176
245
  left: _vm.state.left + "px",
177
246
  transform: "translateX(-50%)"
178
247
  }
179
- })]);
248
+ }, [_c("div", {
249
+ staticClass: "tiny-color-select-panel__inner__hue-select-thumb-heart",
250
+ style: {
251
+ background: _vm.state.activeColor.color.value
252
+ }
253
+ })])]);
180
254
  };
181
255
  var staticRenderFns$1 = [];
182
256
  var __vue2_script$1 = defineComponent({
@@ -186,12 +260,12 @@ var __vue2_script$1 = defineComponent({
186
260
  type: Object
187
261
  }
188
262
  },
189
- setup: function setup3(props2, context) {
263
+ setup: function setup4(props2, context) {
190
264
  return setup({
191
265
  props: props2,
192
266
  context,
193
- renderless: renderless$2,
194
- api: api$2,
267
+ renderless: renderless$3,
268
+ api: api$3,
195
269
  mono: true
196
270
  });
197
271
  }
@@ -203,9 +277,512 @@ function __vue2_injectStyles$1(context) {
203
277
  this[o] = __cssModules$1[o];
204
278
  }
205
279
  }
206
- var AlphaSelect = /* @__PURE__ */ function() {
280
+ var AlphaSelect = /* @__PURE__ */ (function() {
207
281
  return __component__$1.exports;
208
- }();
282
+ })();
283
+ var node = {};
284
+ var hasRequiredNode;
285
+ function requireNode() {
286
+ if (hasRequiredNode) return node;
287
+ hasRequiredNode = 1;
288
+ var GradientParser = GradientParser || {};
289
+ GradientParser.stringify = /* @__PURE__ */ (function() {
290
+ var visitor = {
291
+ "visit_linear-gradient": function visit_linearGradient(node2) {
292
+ return visitor.visit_gradient(node2);
293
+ },
294
+ "visit_repeating-linear-gradient": function visit_repeatingLinearGradient(node2) {
295
+ return visitor.visit_gradient(node2);
296
+ },
297
+ "visit_radial-gradient": function visit_radialGradient(node2) {
298
+ return visitor.visit_gradient(node2);
299
+ },
300
+ "visit_repeating-radial-gradient": function visit_repeatingRadialGradient(node2) {
301
+ return visitor.visit_gradient(node2);
302
+ },
303
+ "visit_gradient": function visit_gradient(node2) {
304
+ var orientation = visitor.visit(node2.orientation);
305
+ if (orientation) {
306
+ orientation += ", ";
307
+ }
308
+ return node2.type + "(" + orientation + visitor.visit(node2.colorStops) + ")";
309
+ },
310
+ "visit_shape": function visit_shape(node2) {
311
+ var result = node2.value, at = visitor.visit(node2.at), style = visitor.visit(node2.style);
312
+ if (style) {
313
+ result += " " + style;
314
+ }
315
+ if (at) {
316
+ result += " at " + at;
317
+ }
318
+ return result;
319
+ },
320
+ "visit_default-radial": function visit_defaultRadial(node2) {
321
+ var result = "", at = visitor.visit(node2.at);
322
+ if (at) {
323
+ result += at;
324
+ }
325
+ return result;
326
+ },
327
+ "visit_extent-keyword": function visit_extentKeyword(node2) {
328
+ var result = node2.value, at = visitor.visit(node2.at);
329
+ if (at) {
330
+ result += " at " + at;
331
+ }
332
+ return result;
333
+ },
334
+ "visit_position-keyword": function visit_positionKeyword(node2) {
335
+ return node2.value;
336
+ },
337
+ "visit_position": function visit_position(node2) {
338
+ return visitor.visit(node2.value.x) + " " + visitor.visit(node2.value.y);
339
+ },
340
+ "visit_%": function visit_(node2) {
341
+ return node2.value + "%";
342
+ },
343
+ "visit_em": function visit_em(node2) {
344
+ return node2.value + "em";
345
+ },
346
+ "visit_px": function visit_px(node2) {
347
+ return node2.value + "px";
348
+ },
349
+ "visit_calc": function visit_calc(node2) {
350
+ return "calc(" + node2.value + ")";
351
+ },
352
+ "visit_literal": function visit_literal(node2) {
353
+ return visitor.visit_color(node2.value, node2);
354
+ },
355
+ "visit_hex": function visit_hex(node2) {
356
+ return visitor.visit_color("#" + node2.value, node2);
357
+ },
358
+ "visit_rgb": function visit_rgb(node2) {
359
+ return visitor.visit_color("rgb(" + node2.value.join(", ") + ")", node2);
360
+ },
361
+ "visit_rgba": function visit_rgba(node2) {
362
+ return visitor.visit_color("rgba(" + node2.value.join(", ") + ")", node2);
363
+ },
364
+ "visit_hsl": function visit_hsl(node2) {
365
+ return visitor.visit_color("hsl(" + node2.value[0] + ", " + node2.value[1] + "%, " + node2.value[2] + "%)", node2);
366
+ },
367
+ "visit_hsla": function visit_hsla(node2) {
368
+ return visitor.visit_color("hsla(" + node2.value[0] + ", " + node2.value[1] + "%, " + node2.value[2] + "%, " + node2.value[3] + ")", node2);
369
+ },
370
+ "visit_var": function visit_var(node2) {
371
+ return visitor.visit_color("var(" + node2.value + ")", node2);
372
+ },
373
+ "visit_color": function visit_color(resultColor, node2) {
374
+ var result = resultColor, length = visitor.visit(node2.length);
375
+ if (length) {
376
+ result += " " + length;
377
+ }
378
+ return result;
379
+ },
380
+ "visit_angular": function visit_angular(node2) {
381
+ return node2.value + "deg";
382
+ },
383
+ "visit_directional": function visit_directional(node2) {
384
+ return "to " + node2.value;
385
+ },
386
+ "visit_array": function visit_array(elements) {
387
+ var result = "", size = elements.length;
388
+ elements.forEach(function(element, i) {
389
+ result += visitor.visit(element);
390
+ if (i < size - 1) {
391
+ result += ", ";
392
+ }
393
+ });
394
+ return result;
395
+ },
396
+ "visit_object": function visit_object(obj) {
397
+ if (obj.width && obj.height) {
398
+ return visitor.visit(obj.width) + " " + visitor.visit(obj.height);
399
+ }
400
+ return "";
401
+ },
402
+ "visit": function visit(element) {
403
+ if (!element) {
404
+ return "";
405
+ }
406
+ if (element instanceof Array) {
407
+ return visitor.visit_array(element);
408
+ } else if (typeof element === "object" && !element.type) {
409
+ return visitor.visit_object(element);
410
+ } else if (element.type) {
411
+ var nodeVisitor = visitor["visit_" + element.type];
412
+ if (nodeVisitor) {
413
+ return nodeVisitor(element);
414
+ } else {
415
+ throw Error("Missing visitor visit_" + element.type);
416
+ }
417
+ } else {
418
+ throw Error("Invalid node.");
419
+ }
420
+ }
421
+ };
422
+ return function(root) {
423
+ return visitor.visit(root);
424
+ };
425
+ })();
426
+ var GradientParser = GradientParser || {};
427
+ GradientParser.parse = /* @__PURE__ */ (function() {
428
+ var tokens = {
429
+ linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
430
+ repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
431
+ radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
432
+ repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
433
+ sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
434
+ extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
435
+ positionKeywords: /^(left|center|right|top|bottom)/i,
436
+ pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
437
+ percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
438
+ emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
439
+ angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
440
+ radianValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,
441
+ startCall: /^\(/,
442
+ endCall: /^\)/,
443
+ comma: /^,/,
444
+ hexColor: /^\#([0-9a-fA-F]+)/,
445
+ literalColor: /^([a-zA-Z]+)/,
446
+ rgbColor: /^rgb/i,
447
+ rgbaColor: /^rgba/i,
448
+ varColor: /^var/i,
449
+ calcValue: /^calc/i,
450
+ variableName: /^(--[a-zA-Z0-9-,\s\#]+)/,
451
+ number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,
452
+ hslColor: /^hsl/i,
453
+ hslaColor: /^hsla/i
454
+ };
455
+ var input = "";
456
+ function error(msg) {
457
+ var err = new Error(input + ": " + msg);
458
+ err.source = input;
459
+ throw err;
460
+ }
461
+ function getAST() {
462
+ var ast = matchListDefinitions();
463
+ if (input.length > 0) {
464
+ error("Invalid input not EOF");
465
+ }
466
+ return ast;
467
+ }
468
+ function matchListDefinitions() {
469
+ return matchListing(matchDefinition);
470
+ }
471
+ function matchDefinition() {
472
+ return matchGradient("linear-gradient", tokens.linearGradient, matchLinearOrientation) || matchGradient("repeating-linear-gradient", tokens.repeatingLinearGradient, matchLinearOrientation) || matchGradient("radial-gradient", tokens.radialGradient, matchListRadialOrientations) || matchGradient("repeating-radial-gradient", tokens.repeatingRadialGradient, matchListRadialOrientations);
473
+ }
474
+ function matchGradient(gradientType, pattern, orientationMatcher) {
475
+ return matchCall(pattern, function(captures) {
476
+ var orientation = orientationMatcher();
477
+ if (orientation) {
478
+ if (!scan(tokens.comma)) {
479
+ error("Missing comma before color stops");
480
+ }
481
+ }
482
+ return {
483
+ type: gradientType,
484
+ orientation,
485
+ colorStops: matchListing(matchColorStop)
486
+ };
487
+ });
488
+ }
489
+ function matchCall(pattern, callback) {
490
+ var captures = scan(pattern);
491
+ if (captures) {
492
+ if (!scan(tokens.startCall)) {
493
+ error("Missing (");
494
+ }
495
+ var result = callback(captures);
496
+ if (!scan(tokens.endCall)) {
497
+ error("Missing )");
498
+ }
499
+ return result;
500
+ }
501
+ }
502
+ function matchLinearOrientation() {
503
+ var sideOrCorner = matchSideOrCorner();
504
+ if (sideOrCorner) {
505
+ return sideOrCorner;
506
+ }
507
+ var legacyDirection = match("position-keyword", tokens.positionKeywords, 1);
508
+ if (legacyDirection) {
509
+ return {
510
+ type: "directional",
511
+ value: legacyDirection.value
512
+ };
513
+ }
514
+ return matchAngle();
515
+ }
516
+ function matchSideOrCorner() {
517
+ return match("directional", tokens.sideOrCorner, 1);
518
+ }
519
+ function matchAngle() {
520
+ return match("angular", tokens.angleValue, 1) || match("angular", tokens.radianValue, 1);
521
+ }
522
+ function matchListRadialOrientations() {
523
+ var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache;
524
+ if (radialOrientation) {
525
+ radialOrientations = [];
526
+ radialOrientations.push(radialOrientation);
527
+ lookaheadCache = input;
528
+ if (scan(tokens.comma)) {
529
+ radialOrientation = matchRadialOrientation();
530
+ if (radialOrientation) {
531
+ radialOrientations.push(radialOrientation);
532
+ } else {
533
+ input = lookaheadCache;
534
+ }
535
+ }
536
+ }
537
+ return radialOrientations;
538
+ }
539
+ function matchRadialOrientation() {
540
+ var radialType = matchCircle() || matchEllipse();
541
+ if (radialType) {
542
+ radialType.at = matchAtPosition();
543
+ } else {
544
+ var extent = matchExtentKeyword();
545
+ if (extent) {
546
+ radialType = extent;
547
+ var positionAt = matchAtPosition();
548
+ if (positionAt) {
549
+ radialType.at = positionAt;
550
+ }
551
+ } else {
552
+ var atPosition = matchAtPosition();
553
+ if (atPosition) {
554
+ radialType = {
555
+ type: "default-radial",
556
+ at: atPosition
557
+ };
558
+ } else {
559
+ var defaultPosition = matchPositioning();
560
+ if (defaultPosition) {
561
+ radialType = {
562
+ type: "default-radial",
563
+ at: defaultPosition
564
+ };
565
+ }
566
+ }
567
+ }
568
+ }
569
+ return radialType;
570
+ }
571
+ function matchCircle() {
572
+ var circle = match("shape", /^(circle)/i, 0);
573
+ if (circle) {
574
+ circle.style = matchLength() || matchExtentKeyword();
575
+ }
576
+ return circle;
577
+ }
578
+ function matchEllipse() {
579
+ var ellipse = match("shape", /^(ellipse)/i, 0);
580
+ if (ellipse) {
581
+ ellipse.style = matchPositioning() || matchDistance() || matchExtentKeyword();
582
+ }
583
+ return ellipse;
584
+ }
585
+ function matchExtentKeyword() {
586
+ return match("extent-keyword", tokens.extentKeywords, 1);
587
+ }
588
+ function matchAtPosition() {
589
+ if (match("position", /^at/, 0)) {
590
+ var positioning = matchPositioning();
591
+ if (!positioning) {
592
+ error("Missing positioning value");
593
+ }
594
+ return positioning;
595
+ }
596
+ }
597
+ function matchPositioning() {
598
+ var location = matchCoordinates();
599
+ if (location.x || location.y) {
600
+ return {
601
+ type: "position",
602
+ value: location
603
+ };
604
+ }
605
+ }
606
+ function matchCoordinates() {
607
+ return {
608
+ x: matchDistance(),
609
+ y: matchDistance()
610
+ };
611
+ }
612
+ function matchListing(matcher) {
613
+ var captures = matcher(), result = [];
614
+ if (captures) {
615
+ result.push(captures);
616
+ while (scan(tokens.comma)) {
617
+ captures = matcher();
618
+ if (captures) {
619
+ result.push(captures);
620
+ } else {
621
+ error("One extra comma");
622
+ }
623
+ }
624
+ }
625
+ return result;
626
+ }
627
+ function matchColorStop() {
628
+ var color = matchColor();
629
+ if (!color) {
630
+ error("Expected color definition");
631
+ }
632
+ color.length = matchDistance();
633
+ return color;
634
+ }
635
+ function matchColor() {
636
+ return matchHexColor() || matchHSLAColor() || matchHSLColor() || matchRGBAColor() || matchRGBColor() || matchVarColor() || matchLiteralColor();
637
+ }
638
+ function matchLiteralColor() {
639
+ return match("literal", tokens.literalColor, 0);
640
+ }
641
+ function matchHexColor() {
642
+ return match("hex", tokens.hexColor, 1);
643
+ }
644
+ function matchRGBColor() {
645
+ return matchCall(tokens.rgbColor, function() {
646
+ return {
647
+ type: "rgb",
648
+ value: matchListing(matchNumber)
649
+ };
650
+ });
651
+ }
652
+ function matchRGBAColor() {
653
+ return matchCall(tokens.rgbaColor, function() {
654
+ return {
655
+ type: "rgba",
656
+ value: matchListing(matchNumber)
657
+ };
658
+ });
659
+ }
660
+ function matchVarColor() {
661
+ return matchCall(tokens.varColor, function() {
662
+ return {
663
+ type: "var",
664
+ value: matchVariableName()
665
+ };
666
+ });
667
+ }
668
+ function matchHSLColor() {
669
+ return matchCall(tokens.hslColor, function() {
670
+ var lookahead = scan(tokens.percentageValue);
671
+ if (lookahead) {
672
+ error("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");
673
+ }
674
+ var hue = matchNumber();
675
+ scan(tokens.comma);
676
+ var captures = scan(tokens.percentageValue);
677
+ var sat = captures ? captures[1] : null;
678
+ scan(tokens.comma);
679
+ captures = scan(tokens.percentageValue);
680
+ var light = captures ? captures[1] : null;
681
+ if (!sat || !light) {
682
+ error("Expected percentage value for saturation and lightness in HSL");
683
+ }
684
+ return {
685
+ type: "hsl",
686
+ value: [hue, sat, light]
687
+ };
688
+ });
689
+ }
690
+ function matchHSLAColor() {
691
+ return matchCall(tokens.hslaColor, function() {
692
+ var hue = matchNumber();
693
+ scan(tokens.comma);
694
+ var captures = scan(tokens.percentageValue);
695
+ var sat = captures ? captures[1] : null;
696
+ scan(tokens.comma);
697
+ captures = scan(tokens.percentageValue);
698
+ var light = captures ? captures[1] : null;
699
+ scan(tokens.comma);
700
+ var alpha = matchNumber();
701
+ if (!sat || !light) {
702
+ error("Expected percentage value for saturation and lightness in HSLA");
703
+ }
704
+ return {
705
+ type: "hsla",
706
+ value: [hue, sat, light, alpha]
707
+ };
708
+ });
709
+ }
710
+ function matchVariableName() {
711
+ return scan(tokens.variableName)[1];
712
+ }
713
+ function matchNumber() {
714
+ return scan(tokens.number)[1];
715
+ }
716
+ function matchDistance() {
717
+ return match("%", tokens.percentageValue, 1) || matchPositionKeyword() || matchCalc() || matchLength();
718
+ }
719
+ function matchPositionKeyword() {
720
+ return match("position-keyword", tokens.positionKeywords, 1);
721
+ }
722
+ function matchCalc() {
723
+ return matchCall(tokens.calcValue, function() {
724
+ var openParenCount = 1;
725
+ var i = 0;
726
+ while (openParenCount > 0 && i < input.length) {
727
+ var char = input.charAt(i);
728
+ if (char === "(") {
729
+ openParenCount++;
730
+ } else if (char === ")") {
731
+ openParenCount--;
732
+ }
733
+ i++;
734
+ }
735
+ if (openParenCount > 0) {
736
+ error("Missing closing parenthesis in calc() expression");
737
+ }
738
+ var calcContent = input.substring(0, i - 1);
739
+ consume(i - 1);
740
+ return {
741
+ type: "calc",
742
+ value: calcContent
743
+ };
744
+ });
745
+ }
746
+ function matchLength() {
747
+ return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
748
+ }
749
+ function match(type, pattern, captureIndex) {
750
+ var captures = scan(pattern);
751
+ if (captures) {
752
+ return {
753
+ type,
754
+ value: captures[captureIndex]
755
+ };
756
+ }
757
+ }
758
+ function scan(regexp) {
759
+ var captures, blankCaptures;
760
+ blankCaptures = /^[\n\r\t\s]+/.exec(input);
761
+ if (blankCaptures) {
762
+ consume(blankCaptures[0].length);
763
+ }
764
+ captures = regexp.exec(input);
765
+ if (captures) {
766
+ consume(captures[0].length);
767
+ }
768
+ return captures;
769
+ }
770
+ function consume(size) {
771
+ input = input.substr(size);
772
+ }
773
+ return function(code) {
774
+ input = code.toString().trim();
775
+ if (input.endsWith(";")) {
776
+ input = input.slice(0, -1);
777
+ }
778
+ return getAST();
779
+ };
780
+ })();
781
+ node.parse = GradientParser.parse;
782
+ node.stringify = GradientParser.stringify;
783
+ return node;
784
+ }
785
+ var nodeExports = requireNode();
209
786
  var render = function render2() {
210
787
  var _vm = this;
211
788
  var _h = _vm.$createElement;
@@ -238,7 +815,14 @@ var render = function render2() {
238
815
  on: {
239
816
  "ready": _vm.onAlphaReady
240
817
  }
818
+ }) : _vm._e(), !_vm.alpha ? _c("div", {
819
+ staticClass: "tiny-color-select-panel__no-alpha"
241
820
  }) : _vm._e(), _c("div", {
821
+ staticClass: "tiny-color-select-panel__display",
822
+ style: {
823
+ background: _vm.state.isLinearGradient ? _vm.state.linearGradient : _vm.state.color.value
824
+ }
825
+ }), _c("div", {
242
826
  staticClass: "tiny-color-select-panel__tools"
243
827
  }, [_vm.state.formats.length ? _c("div", {
244
828
  staticClass: "tiny-color-select-panel__tools__format-select"
@@ -261,10 +845,12 @@ var render = function render2() {
261
845
  "label": formatValue
262
846
  }
263
847
  });
264
- }), 1)], 1) : _vm._e(), _c("tiny-input", {
265
- attrs: {
266
- "size": "small"
267
- },
848
+ }), 1)], 1) : _vm._e(), _c("div", {
849
+ staticClass: "tiny-color-select-panel__tools-style"
850
+ }, [_vm.state.currentFormat === "hex" || _vm.state.currentFormat === "css" || !_vm.state.currentFormat ? _c("div", {
851
+ staticClass: "tiny-color-select-panel__tools-hex"
852
+ }, [_c("tiny-input", {
853
+ staticClass: "tiny-color-select-panel__tools-hex1",
268
854
  model: {
269
855
  value: _vm.state.input,
270
856
  callback: function callback($$v) {
@@ -272,29 +858,59 @@ var render = function render2() {
272
858
  },
273
859
  expression: "state.input"
274
860
  }
275
- }), _c("div", {
276
- staticClass: "tiny-color-select-panel__tools-btns"
277
- }, [_c("tiny-button", {
861
+ }), _vm.state.isLinearGradient ? _c("div", {
862
+ staticClass: "tiny-color-select-panel__tools-deg"
863
+ }, [_c("tiny-numeric", {
278
864
  attrs: {
279
- "size": "small"
865
+ "unit": "deg",
866
+ "mouse-wheel": ""
280
867
  },
281
- on: {
282
- "click": _vm.onCancel
868
+ model: {
869
+ value: _vm.state.ctx.deg,
870
+ callback: function callback($$v) {
871
+ _vm.$set(_vm.state.ctx, "deg", $$v);
872
+ },
873
+ expression: "state.ctx.deg"
283
874
  }
284
- }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.cancel")) + " ")]), _c("tiny-button", {
285
- attrs: {
286
- "type": "primary",
287
- "size": "small"
288
- },
289
- on: {
290
- "click": _vm.onConfirm
875
+ })], 1) : _vm._e()], 1) : _c("div", {
876
+ staticClass: "tiny-color-select-panel__tools-hex"
877
+ }, [_c("tiny-input", {
878
+ staticClass: "tiny-color-select-panel__tools-hex4",
879
+ model: {
880
+ value: _vm.state.hexInput4,
881
+ callback: function callback($$v) {
882
+ _vm.$set(_vm.state, "hexInput4", $$v);
883
+ },
884
+ expression: "state.hexInput4"
291
885
  }
292
- }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.confirm")) + " ")])], 1)], 1), _c("tiny-collapse", [_vm.state.enableHistory ? _c("tiny-collapse-item", {
293
- attrs: {
294
- "title": _vm.t("ui.colorSelectPanel.history"),
295
- "name": "history"
886
+ }), _c("tiny-input", {
887
+ staticClass: "tiny-color-select-panel__tools-hex5",
888
+ model: {
889
+ value: _vm.state.hexInput5,
890
+ callback: function callback($$v) {
891
+ _vm.$set(_vm.state, "hexInput5", $$v);
892
+ },
893
+ expression: "state.hexInput5"
296
894
  }
297
- }, [_vm.state.stack.length ? _c("div", {
895
+ }), _c("tiny-input", {
896
+ staticClass: "tiny-color-select-panel__tools-hex6",
897
+ model: {
898
+ value: _vm.state.hexInput6,
899
+ callback: function callback($$v) {
900
+ _vm.$set(_vm.state, "hexInput6", $$v);
901
+ },
902
+ expression: "state.hexInput6"
903
+ }
904
+ }), _c("tiny-input", {
905
+ staticClass: "tiny-color-select-panel__tools-hex7",
906
+ model: {
907
+ value: _vm.state.hexInput7,
908
+ callback: function callback($$v) {
909
+ _vm.$set(_vm.state, "hexInput7", $$v);
910
+ },
911
+ expression: "state.hexInput7"
912
+ }
913
+ })], 1)])]), _vm.state.enableHistory ? _c("div", [_vm.state.enableHistory && _vm.state.stack.length ? _c("div", {
298
914
  staticClass: "tiny-color-select-panel__history"
299
915
  }, _vm._l(_vm.state.stack, function(color, key) {
300
916
  return _c("div", {
@@ -309,12 +925,9 @@ var render = function render2() {
309
925
  }
310
926
  }
311
927
  });
312
- }), 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", {
313
- attrs: {
314
- "title": _vm.t("ui.colorSelectPanel.predefine"),
315
- "name": "predefine"
316
- }
317
- }, [_vm.state.predefineStack.length ? _c("div", {
928
+ }), 0) : _vm._e()]) : _vm._e(), _vm.state.enablePredefineColor ? _c("div", {
929
+ staticClass: "tiny-color-select-panel__predefine-title"
930
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.predefine")) + " ")]) : _vm._e(), _vm.state.enablePredefineColor && _vm.state.predefineStack.length ? _c("div", {
318
931
  staticClass: "tiny-color-select-panel__predefine"
319
932
  }, _vm._l(_vm.state.predefineStack, function(color, key) {
320
933
  return _c("div", {
@@ -329,31 +942,52 @@ var render = function render2() {
329
942
  }
330
943
  }
331
944
  });
332
- }), 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();
945
+ }), 0) : _vm._e(), _c("div", {
946
+ staticClass: "tiny-color-select-panel__tools-btns"
947
+ }, [_c("tiny-button", {
948
+ attrs: {
949
+ "size": "small",
950
+ "type": "primary"
951
+ },
952
+ on: {
953
+ "click": _vm.onConfirm
954
+ }
955
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.colorSelectPanel.confirm")) + " ")]), _c("tiny-button", {
956
+ attrs: {
957
+ "type": "text",
958
+ "text": _vm.t("ui.colorSelectPanel.cancel"),
959
+ "size": "small"
960
+ },
961
+ on: {
962
+ "click": _vm.onCancel
963
+ }
964
+ })], 1)], 1) : _vm._e();
333
965
  };
334
966
  var staticRenderFns = [];
335
967
  var __vue2_script = defineComponent({
336
968
  emits: ["update:modelValue", "cancel", "confirm", "color-update"],
337
- props: [].concat(props, ["modelValue", "visible", "alpha", "history", "predefine", "format", "enableHistory", "enablePredefineColor"]),
969
+ props: [].concat(props, ["modelValue", "visible", "alpha", "history", "predefine", "format", "enableHistory", "enablePredefineColor", "colorMode"]),
338
970
  components: {
339
971
  HueSelect,
340
972
  AlphaSelect,
341
973
  TinyButton: Button,
342
974
  TinyInput: Input,
343
- TinyCollapse: Collapse,
344
- TinyCollapseItem: CollapseItem,
345
975
  TinySelect: Select,
346
- TinyOption: Option
976
+ TinyOption: Option,
977
+ TinyNumeric: Numeric
347
978
  },
348
979
  directives: directive({
349
980
  Clickoutside
350
981
  }),
351
- setup: function setup4(props2, context) {
982
+ setup: function setup5(props2, context) {
352
983
  return setup({
353
984
  props: props2,
354
985
  context,
355
- renderless: renderless$3,
356
- api: api$3
986
+ renderless: renderless$4,
987
+ api: api$4,
988
+ extendOptions: {
989
+ parse: nodeExports.parse
990
+ }
357
991
  });
358
992
  }
359
993
  });
@@ -364,8 +998,8 @@ function __vue2_injectStyles(context) {
364
998
  this[o] = __cssModules[o];
365
999
  }
366
1000
  }
367
- var pc = /* @__PURE__ */ function() {
1001
+ var pc = /* @__PURE__ */ (function() {
368
1002
  return __component__.exports;
369
- }();
1003
+ })();
370
1004
 
371
1005
  export { pc as default };
package/package.json CHANGED
@@ -1,23 +1,25 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-color-select-panel",
3
3
  "type": "module",
4
- "version": "2.25.0",
4
+ "version": "2.27.0",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
8
8
  "main": "./lib/index.js",
9
9
  "module": "./lib/index.js",
10
10
  "dependencies": {
11
- "@opentinyvue/vue-button": "~2.25.0",
12
- "@opentinyvue/vue-collapse": "~2.25.0",
13
- "@opentinyvue/vue-collapse-item": "~2.25.0",
14
- "@opentinyvue/vue-common": "~2.25.0",
15
- "@opentinyvue/vue-directive": "~2.25.0",
16
- "@opentinyvue/vue-input": "~2.25.0",
17
- "@opentinyvue/vue-option": "~2.25.0",
18
- "@opentinyvue/vue-renderless": "~3.25.0",
19
- "@opentinyvue/vue-select": "~2.25.0",
20
- "@opentinyvue/vue-theme": "~3.25.0"
11
+ "@opentinyvue/vue-button": "~2.27.0",
12
+ "@opentinyvue/vue-collapse": "~2.27.0",
13
+ "@opentinyvue/vue-collapse-item": "~2.27.0",
14
+ "@opentinyvue/vue-common": "~2.27.0",
15
+ "@opentinyvue/vue-directive": "~2.27.0",
16
+ "@opentinyvue/vue-input": "~2.27.0",
17
+ "@opentinyvue/vue-numeric": "~2.27.0",
18
+ "@opentinyvue/vue-option": "~2.27.0",
19
+ "@opentinyvue/vue-renderless": "~3.27.0",
20
+ "@opentinyvue/vue-select": "~2.27.0",
21
+ "@opentinyvue/vue-theme": "~3.27.0",
22
+ "gradient-parser": "^1.1.1"
21
23
  },
22
24
  "types": "index.d.ts"
23
25
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;