@salla.sa/twilight-components 2.14.346 → 2.14.349

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.
Files changed (170) hide show
  1. package/dist/cjs/{filepond-D3JT19b9.js → filepond-DFhbfTkt.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-vIqpi5Jb.js → filepond-plugin-file-poster-Dj4Zm459.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-CGka-OOR.js → filepond-plugin-file-validate-size-DsH6GzKJ.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-D5Xexu4N.js → filepond-plugin-file-validate-type-DfaEudMs.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CIxcoEFX.js → filepond-plugin-image-edit-gz-CV83v.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-yRezDeUb.js → filepond-plugin-image-exif-orientation-DfkLjcpx.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CPE8T2_S.js → filepond-plugin-image-preview-BxaEwNCI.js} +1 -1
  8. package/dist/cjs/{index-B_jylE1-.js → index-C9ymZIiv.js} +1 -1
  9. package/dist/cjs/{index-CBbHmJY_.js → index-DcTksD2K.js} +2 -2
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion_62.cjs.entry.js +10395 -1320
  12. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -11
  30. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  46. package/dist/cjs/twilight.cjs.js +2 -2
  47. package/dist/cjs/vanilla-picker-BYDLZw1n.js +1045 -0
  48. package/dist/collection/components/salla-color-picker/salla-color-picker.js +67 -37
  49. package/dist/collection/components/salla-count-down/salla-count-down.js +125 -1
  50. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -5
  51. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +1 -1
  52. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +0 -10
  53. package/dist/collection/components/salla-products-slider/salla-products-slider.js +3 -0
  54. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +68 -55
  55. package/dist/collection/components/salla-slider/salla-slider.css +691 -238
  56. package/dist/collection/components/salla-slider/salla-slider.js +96 -58
  57. package/dist/components/index.js +2 -2
  58. package/dist/components/salla-color-picker2.js +69 -1056
  59. package/dist/components/salla-count-down2.js +24 -2
  60. package/dist/components/salla-multiple-bundle-product-options-modal2.js +4 -5
  61. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
  62. package/dist/components/salla-order-details-multiple-bundle-product2.js +0 -10
  63. package/dist/components/salla-products-slider2.js +3 -0
  64. package/dist/components/salla-quick-buy2.js +367 -139
  65. package/dist/components/salla-slider2.js +9881 -61
  66. package/dist/components/vanilla-picker.js +1043 -0
  67. package/dist/esm/{filepond-ESI025KA.js → filepond-DQR2YBu7.js} +1 -1
  68. package/dist/esm/{filepond-plugin-file-poster-CWHjkl55.js → filepond-plugin-file-poster-XvYa1rlk.js} +1 -1
  69. package/dist/esm/{filepond-plugin-file-validate-size-B7W5i7Mk.js → filepond-plugin-file-validate-size-BRBnctOE.js} +1 -1
  70. package/dist/esm/{filepond-plugin-file-validate-type-B1Ny76Ep.js → filepond-plugin-file-validate-type-BuD6F1gi.js} +1 -1
  71. package/dist/esm/{filepond-plugin-image-edit-DfqS6NSZ.js → filepond-plugin-image-edit-BJ8YnBRL.js} +1 -1
  72. package/dist/esm/{filepond-plugin-image-exif-orientation-3kpdQNdB.js → filepond-plugin-image-exif-orientation-BGad_AoX.js} +1 -1
  73. package/dist/esm/{filepond-plugin-image-preview-Ck91BQiY.js → filepond-plugin-image-preview-Cb6UzPfa.js} +1 -1
  74. package/dist/esm/{index-gdKTeC4S.js → index-Bhszo8cU.js} +2 -2
  75. package/dist/esm/{index-5xSCOnsp.js → index-DIfeuyTs.js} +1 -1
  76. package/dist/esm/loader.js +3 -3
  77. package/dist/esm/salla-accordion_62.entry.js +10395 -1320
  78. package/dist/esm/salla-advertisement.entry.js +1 -1
  79. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  80. package/dist/esm/salla-apps-icons.entry.js +1 -1
  81. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  82. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  83. package/dist/esm/salla-contacts.entry.js +1 -1
  84. package/dist/esm/salla-custom-fields.entry.js +1 -1
  85. package/dist/esm/salla-filters-widget.entry.js +1 -1
  86. package/dist/esm/salla-filters.entry.js +1 -1
  87. package/dist/esm/salla-hook.entry.js +1 -1
  88. package/dist/esm/salla-installment.entry.js +1 -1
  89. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  90. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  91. package/dist/esm/salla-metadata.entry.js +1 -1
  92. package/dist/esm/salla-notification-item.entry.js +1 -1
  93. package/dist/esm/salla-notifications.entry.js +1 -1
  94. package/dist/esm/salla-offer.entry.js +1 -1
  95. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -11
  96. package/dist/esm/salla-order-details-options.entry.js +1 -1
  97. package/dist/esm/salla-order-details.entry.js +1 -1
  98. package/dist/esm/salla-order-summary.entry.js +1 -1
  99. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  100. package/dist/esm/salla-orders.entry.js +1 -1
  101. package/dist/esm/salla-payments.entry.js +1 -1
  102. package/dist/esm/salla-price-range.entry.js +1 -1
  103. package/dist/esm/salla-review-card.entry.js +1 -1
  104. package/dist/esm/salla-reviews-page.entry.js +1 -1
  105. package/dist/esm/salla-reviews.entry.js +1 -1
  106. package/dist/esm/salla-social.entry.js +1 -1
  107. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  108. package/dist/esm/salla-tooltip.entry.js +1 -1
  109. package/dist/esm/salla-trust-badges.entry.js +1 -1
  110. package/dist/esm/salla-verify.entry.js +1 -1
  111. package/dist/esm/salla-wallet.entry.js +1 -1
  112. package/dist/esm/twilight.js +3 -3
  113. package/dist/esm/vanilla-picker-C4Kwbr5L.js +1043 -0
  114. package/dist/twilight/{p-936a76d1.entry.js → p-004be2ff.entry.js} +1 -1
  115. package/dist/twilight/{p-0a4b04a4.entry.js → p-0daa34c4.entry.js} +1 -1
  116. package/dist/twilight/{p-6bd166a7.entry.js → p-112e9574.entry.js} +1 -1
  117. package/dist/twilight/{p-369ada5a.entry.js → p-129e02c2.entry.js} +1 -1
  118. package/dist/twilight/{p-d5da6f45.entry.js → p-1bfef164.entry.js} +1 -1
  119. package/dist/twilight/{p-36a95a0f.entry.js → p-25f64b3e.entry.js} +1 -1
  120. package/dist/twilight/{p-8563e747.entry.js → p-307b5fa0.entry.js} +1 -1
  121. package/dist/twilight/{p-a7a488d5.entry.js → p-46fb77ce.entry.js} +1 -1
  122. package/dist/twilight/{p-b0e7c134.entry.js → p-48617181.entry.js} +1 -1
  123. package/dist/twilight/{p-4e98e961.entry.js → p-48df4495.entry.js} +1 -1
  124. package/dist/twilight/p-4fc33cee.entry.js +4 -0
  125. package/dist/twilight/{p-aefe5639.entry.js → p-55c9e7fe.entry.js} +1 -1
  126. package/dist/twilight/{p-5570cae4.entry.js → p-574bd55f.entry.js} +1 -1
  127. package/dist/twilight/{p-ef0fa205.entry.js → p-5bb9ace5.entry.js} +1 -1
  128. package/dist/twilight/{p-eab13555.entry.js → p-60747f3b.entry.js} +1 -1
  129. package/dist/twilight/{p-3e410acd.entry.js → p-6222b0fa.entry.js} +1 -1
  130. package/dist/twilight/{p-b8f7b4eb.entry.js → p-64c18854.entry.js} +1 -1
  131. package/dist/twilight/{p-e465a952.entry.js → p-66c5dcd3.entry.js} +1 -1
  132. package/dist/twilight/{p-343c8271.entry.js → p-7a706d50.entry.js} +1 -1
  133. package/dist/twilight/{p-ad2b2919.entry.js → p-911bbc7d.entry.js} +1 -1
  134. package/dist/twilight/{p-7b5906b8.entry.js → p-9f541d63.entry.js} +1 -1
  135. package/dist/twilight/{p-DId3Z42j.js → p-B-MyfVCv.js} +1 -1
  136. package/dist/twilight/{p-D3JRC8L6.js → p-BVmy-j16.js} +1 -1
  137. package/dist/twilight/{p-gdKTeC4S.js → p-Bhszo8cU.js} +1 -1
  138. package/dist/twilight/{p-CUtvZOiz.js → p-BvldZUSR.js} +1 -1
  139. package/dist/twilight/{p-CMYBgZIX.js → p-ByJhdNbq.js} +1 -1
  140. package/dist/twilight/{p-DH5ljldi.js → p-CmuTtBET.js} +1 -1
  141. package/dist/twilight/{p-EnsROQgl.js → p-CuNS5C_o.js} +2 -2
  142. package/dist/twilight/{p-DpJnHcvE.js → p-Cy9bcLMa.js} +1 -1
  143. package/dist/twilight/{p-rYLDeLaL.js → p-DAM1DKLB.js} +1 -1
  144. package/dist/twilight/p-NTgp-Syt.js +11 -0
  145. package/dist/twilight/{p-5099bc51.entry.js → p-a25fe3c1.entry.js} +1 -1
  146. package/dist/twilight/{p-49638a91.entry.js → p-a5df8334.entry.js} +1 -1
  147. package/dist/twilight/{p-46b242d9.entry.js → p-a6f250b8.entry.js} +1 -1
  148. package/dist/twilight/{p-ebd8dbf8.entry.js → p-ae93ed50.entry.js} +1 -1
  149. package/dist/twilight/{p-f64cd638.entry.js → p-af8daa75.entry.js} +1 -1
  150. package/dist/twilight/{p-8100a941.entry.js → p-b0abcc89.entry.js} +1 -1
  151. package/dist/twilight/{p-360a28b9.entry.js → p-b8a203c1.entry.js} +1 -1
  152. package/dist/twilight/p-cadbe7b6.entry.js +4 -0
  153. package/dist/twilight/{p-1037bca4.entry.js → p-cc43a1bd.entry.js} +1 -1
  154. package/dist/twilight/{p-db68f32e.entry.js → p-cc6238be.entry.js} +1 -1
  155. package/dist/twilight/{p-158398ff.entry.js → p-de290cc2.entry.js} +1 -1
  156. package/dist/twilight/{p-8a1aa61c.entry.js → p-ed0f40e2.entry.js} +1 -1
  157. package/dist/twilight/{p-003a77fe.entry.js → p-f3d3e11e.entry.js} +1 -1
  158. package/dist/twilight/{p-8418b725.entry.js → p-f4bf39fb.entry.js} +1 -1
  159. package/dist/twilight/twilight.esm.js +1 -1
  160. package/dist/types/components/salla-color-picker/interfaces.d.ts +9 -0
  161. package/dist/types/components/salla-color-picker/salla-color-picker.d.ts +4 -1
  162. package/dist/types/components/salla-count-down/salla-count-down.d.ts +22 -0
  163. package/dist/types/components/salla-order-details/salla-order-details-multiple-bundle-product.d.ts +0 -1
  164. package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +1 -0
  165. package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +2 -0
  166. package/dist/types/components/salla-slider/salla-slider.d.ts +12 -3
  167. package/dist/types/components.d.ts +48 -0
  168. package/package.json +6 -6
  169. package/dist/twilight/p-04e81b46.entry.js +0 -11
  170. package/dist/twilight/p-1445c077.entry.js +0 -4
@@ -0,0 +1,1043 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { d as getDefaultExportFromCjs } from './index-Bhszo8cU.js';
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var vanillaPicker$3 = {exports: {}};
22
+
23
+ /*!
24
+ * vanilla-picker v2.12.3
25
+ * https://vanilla-picker.js.org
26
+ *
27
+ * Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
28
+ * Released under the ISC license.
29
+ */
30
+ var vanillaPicker$2 = vanillaPicker$3.exports;
31
+
32
+ var hasRequiredVanillaPicker;
33
+
34
+ function requireVanillaPicker () {
35
+ if (hasRequiredVanillaPicker) return vanillaPicker$3.exports;
36
+ hasRequiredVanillaPicker = 1;
37
+ (function (module, exports) {
38
+ (function (global, factory) {
39
+ module.exports = factory() ;
40
+ })(vanillaPicker$2, (function () {
41
+ var classCallCheck = function (instance, Constructor) {
42
+ if (!(instance instanceof Constructor)) {
43
+ throw new TypeError("Cannot call a class as a function");
44
+ }
45
+ };
46
+
47
+ var createClass = function () {
48
+ function defineProperties(target, props) {
49
+ for (var i = 0; i < props.length; i++) {
50
+ var descriptor = props[i];
51
+ descriptor.enumerable = descriptor.enumerable || false;
52
+ descriptor.configurable = true;
53
+ if ("value" in descriptor) descriptor.writable = true;
54
+ Object.defineProperty(target, descriptor.key, descriptor);
55
+ }
56
+ }
57
+
58
+ return function (Constructor, protoProps, staticProps) {
59
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
60
+ if (staticProps) defineProperties(Constructor, staticProps);
61
+ return Constructor;
62
+ };
63
+ }();
64
+
65
+ var slicedToArray = function () {
66
+ function sliceIterator(arr, i) {
67
+ var _arr = [];
68
+ var _n = true;
69
+ var _d = false;
70
+ var _e = undefined;
71
+
72
+ try {
73
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
74
+ _arr.push(_s.value);
75
+
76
+ if (i && _arr.length === i) break;
77
+ }
78
+ } catch (err) {
79
+ _d = true;
80
+ _e = err;
81
+ } finally {
82
+ try {
83
+ if (!_n && _i["return"]) _i["return"]();
84
+ } finally {
85
+ if (_d) throw _e;
86
+ }
87
+ }
88
+
89
+ return _arr;
90
+ }
91
+
92
+ return function (arr, i) {
93
+ if (Array.isArray(arr)) {
94
+ return arr;
95
+ } else if (Symbol.iterator in Object(arr)) {
96
+ return sliceIterator(arr, i);
97
+ } else {
98
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
99
+ }
100
+ };
101
+ }();
102
+
103
+ String.prototype.startsWith = String.prototype.startsWith || function (needle) {
104
+ return this.indexOf(needle) === 0;
105
+ };
106
+ String.prototype.padStart = String.prototype.padStart || function (len, pad) {
107
+ var str = this;while (str.length < len) {
108
+ str = pad + str;
109
+ }return str;
110
+ };
111
+
112
+ var colorNames = { cb: '0f8ff', tqw: 'aebd7', q: '-ffff', qmrn: '7fffd4', zr: '0ffff', bg: '5f5dc', bsq: 'e4c4', bck: '---', nch: 'ebcd', b: '--ff', bvt: '8a2be2', brwn: 'a52a2a', brw: 'deb887', ctb: '5f9ea0', hrt: '7fff-', chcT: 'd2691e', cr: '7f50', rnw: '6495ed', crns: '8dc', crms: 'dc143c', cn: '-ffff', Db: '--8b', Dcn: '-8b8b', Dgnr: 'b8860b', Dgr: 'a9a9a9', Dgrn: '-64-', Dkhk: 'bdb76b', Dmgn: '8b-8b', Dvgr: '556b2f', Drng: '8c-', Drch: '9932cc', Dr: '8b--', Dsmn: 'e9967a', Dsgr: '8fbc8f', DsTb: '483d8b', DsTg: '2f4f4f', Dtrq: '-ced1', Dvt: '94-d3', ppnk: '1493', pskb: '-bfff', mgr: '696969', grb: '1e90ff', rbrc: 'b22222', rwht: 'af0', stg: '228b22', chs: '-ff', gnsb: 'dcdcdc', st: '8f8ff', g: 'd7-', gnr: 'daa520', gr: '808080', grn: '-8-0', grnw: 'adff2f', hnw: '0fff0', htpn: '69b4', nnr: 'cd5c5c', ng: '4b-82', vr: '0', khk: '0e68c', vnr: 'e6e6fa', nrb: '0f5', wngr: '7cfc-', mnch: 'acd', Lb: 'add8e6', Lcr: '08080', Lcn: 'e0ffff', Lgnr: 'afad2', Lgr: 'd3d3d3', Lgrn: '90ee90', Lpnk: 'b6c1', Lsmn: 'a07a', Lsgr: '20b2aa', Lskb: '87cefa', LsTg: '778899', Lstb: 'b0c4de', Lw: 'e0', m: '-ff-', mgrn: '32cd32', nn: 'af0e6', mgnt: '-ff', mrn: '8--0', mqm: '66cdaa', mmb: '--cd', mmrc: 'ba55d3', mmpr: '9370db', msg: '3cb371', mmsT: '7b68ee', '': '-fa9a', mtr: '48d1cc', mmvt: 'c71585', mnLb: '191970', ntc: '5fffa', mstr: 'e4e1', mccs: 'e4b5', vjw: 'dead', nv: '--80', c: 'df5e6', v: '808-0', vrb: '6b8e23', rng: 'a5-', rngr: '45-', rch: 'da70d6', pgnr: 'eee8aa', pgrn: '98fb98', ptrq: 'afeeee', pvtr: 'db7093', ppwh: 'efd5', pchp: 'dab9', pr: 'cd853f', pnk: 'c0cb', pm: 'dda0dd', pwrb: 'b0e0e6', prp: '8-080', cc: '663399', r: '--', sbr: 'bc8f8f', rb: '4169e1', sbrw: '8b4513', smn: 'a8072', nbr: '4a460', sgrn: '2e8b57', ssh: '5ee', snn: 'a0522d', svr: 'c0c0c0', skb: '87ceeb', sTb: '6a5acd', sTgr: '708090', snw: 'afa', n: '-ff7f', stb: '4682b4', tn: 'd2b48c', t: '-8080', thst: 'd8bfd8', tmT: '6347', trqs: '40e0d0', vt: 'ee82ee', whT: '5deb3', wht: '', hts: '5f5f5', w: '-', wgrn: '9acd32' };
113
+
114
+ function printNum(num) {
115
+ var decs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
116
+
117
+ var str = decs > 0 ? num.toFixed(decs).replace(/0+$/, '').replace(/\.$/, '') : num.toString();
118
+ return str || '0';
119
+ }
120
+
121
+ var Color = function () {
122
+ function Color(r, g, b, a) {
123
+ classCallCheck(this, Color);
124
+
125
+
126
+ var that = this;
127
+ function parseString(input) {
128
+
129
+ if (input.startsWith('hsl')) {
130
+ var _input$match$map = input.match(/([\-\d\.e]+)/g).map(Number),
131
+ _input$match$map2 = slicedToArray(_input$match$map, 4),
132
+ h = _input$match$map2[0],
133
+ s = _input$match$map2[1],
134
+ l = _input$match$map2[2],
135
+ _a = _input$match$map2[3];
136
+
137
+ if (_a === undefined) {
138
+ _a = 1;
139
+ }
140
+
141
+ h /= 360;
142
+ s /= 100;
143
+ l /= 100;
144
+ that.hsla = [h, s, l, _a];
145
+ } else if (input.startsWith('rgb')) {
146
+ var _input$match$map3 = input.match(/([\-\d\.e]+)/g).map(Number),
147
+ _input$match$map4 = slicedToArray(_input$match$map3, 4),
148
+ _r = _input$match$map4[0],
149
+ _g = _input$match$map4[1],
150
+ _b = _input$match$map4[2],
151
+ _a2 = _input$match$map4[3];
152
+
153
+ if (_a2 === undefined) {
154
+ _a2 = 1;
155
+ }
156
+
157
+ that.rgba = [_r, _g, _b, _a2];
158
+ } else {
159
+ if (input.startsWith('#')) {
160
+ that.rgba = Color.hexToRgb(input);
161
+ } else {
162
+ that.rgba = Color.nameToRgb(input) || Color.hexToRgb(input);
163
+ }
164
+ }
165
+ }
166
+
167
+ if (r === undefined) ; else if (Array.isArray(r)) {
168
+ this.rgba = r;
169
+ } else if (b === undefined) {
170
+ var color = r && '' + r;
171
+ if (color) {
172
+ parseString(color.toLowerCase());
173
+ }
174
+ } else {
175
+ this.rgba = [r, g, b, a === undefined ? 1 : a];
176
+ }
177
+ }
178
+
179
+ createClass(Color, [{
180
+ key: 'printRGB',
181
+ value: function printRGB(alpha) {
182
+ var rgb = alpha ? this.rgba : this.rgba.slice(0, 3),
183
+ vals = rgb.map(function (x, i) {
184
+ return printNum(x, i === 3 ? 3 : 0);
185
+ });
186
+
187
+ return alpha ? 'rgba(' + vals + ')' : 'rgb(' + vals + ')';
188
+ }
189
+ }, {
190
+ key: 'printHSL',
191
+ value: function printHSL(alpha) {
192
+ var mults = [360, 100, 100, 1],
193
+ suff = ['', '%', '%', ''];
194
+
195
+ var hsl = alpha ? this.hsla : this.hsla.slice(0, 3),
196
+ vals = hsl.map(function (x, i) {
197
+ return printNum(x * mults[i], i === 3 ? 3 : 1) + suff[i];
198
+ });
199
+
200
+ return alpha ? 'hsla(' + vals + ')' : 'hsl(' + vals + ')';
201
+ }
202
+ }, {
203
+ key: 'printHex',
204
+ value: function printHex(alpha) {
205
+ var hex = this.hex;
206
+ return alpha ? hex : hex.substring(0, 7);
207
+ }
208
+ }, {
209
+ key: 'rgba',
210
+ get: function get() {
211
+ if (this._rgba) {
212
+ return this._rgba;
213
+ }
214
+ if (!this._hsla) {
215
+ throw new Error('No color is set');
216
+ }
217
+
218
+ return this._rgba = Color.hslToRgb(this._hsla);
219
+ },
220
+ set: function set(rgb) {
221
+ if (rgb.length === 3) {
222
+ rgb[3] = 1;
223
+ }
224
+
225
+ this._rgba = rgb;
226
+ this._hsla = null;
227
+ }
228
+ }, {
229
+ key: 'rgbString',
230
+ get: function get() {
231
+ return this.printRGB();
232
+ }
233
+ }, {
234
+ key: 'rgbaString',
235
+ get: function get() {
236
+ return this.printRGB(true);
237
+ }
238
+ }, {
239
+ key: 'hsla',
240
+ get: function get() {
241
+ if (this._hsla) {
242
+ return this._hsla;
243
+ }
244
+ if (!this._rgba) {
245
+ throw new Error('No color is set');
246
+ }
247
+
248
+ return this._hsla = Color.rgbToHsl(this._rgba);
249
+ },
250
+ set: function set(hsl) {
251
+ if (hsl.length === 3) {
252
+ hsl[3] = 1;
253
+ }
254
+
255
+ this._hsla = hsl;
256
+ this._rgba = null;
257
+ }
258
+ }, {
259
+ key: 'hslString',
260
+ get: function get() {
261
+ return this.printHSL();
262
+ }
263
+ }, {
264
+ key: 'hslaString',
265
+ get: function get() {
266
+ return this.printHSL(true);
267
+ }
268
+ }, {
269
+ key: 'hex',
270
+ get: function get() {
271
+ var rgb = this.rgba,
272
+ hex = rgb.map(function (x, i) {
273
+ return i < 3 ? x.toString(16) : Math.round(x * 255).toString(16);
274
+ });
275
+
276
+ return '#' + hex.map(function (x) {
277
+ return x.padStart(2, '0');
278
+ }).join('');
279
+ },
280
+ set: function set(hex) {
281
+ this.rgba = Color.hexToRgb(hex);
282
+ }
283
+ }], [{
284
+ key: 'hexToRgb',
285
+ value: function hexToRgb(input) {
286
+
287
+ var hex = (input.startsWith('#') ? input.slice(1) : input).replace(/^(\w{3})$/, '$1F').replace(/^(\w)(\w)(\w)(\w)$/, '$1$1$2$2$3$3$4$4').replace(/^(\w{6})$/, '$1FF');
288
+
289
+ if (!hex.match(/^([0-9a-fA-F]{8})$/)) {
290
+ throw new Error('Unknown hex color; ' + input);
291
+ }
292
+
293
+ var rgba = hex.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function (x) {
294
+ return parseInt(x, 16);
295
+ });
296
+
297
+ rgba[3] = rgba[3] / 255;
298
+ return rgba;
299
+ }
300
+ }, {
301
+ key: 'nameToRgb',
302
+ value: function nameToRgb(input) {
303
+
304
+ var hash = input.toLowerCase().replace('at', 'T').replace(/[aeiouyldf]/g, '').replace('ght', 'L').replace('rk', 'D').slice(-5, 4),
305
+ hex = colorNames[hash];
306
+ return hex === undefined ? hex : Color.hexToRgb(hex.replace(/\-/g, '00').padStart(6, 'f'));
307
+ }
308
+ }, {
309
+ key: 'rgbToHsl',
310
+ value: function rgbToHsl(_ref) {
311
+ var _ref2 = slicedToArray(_ref, 4),
312
+ r = _ref2[0],
313
+ g = _ref2[1],
314
+ b = _ref2[2],
315
+ a = _ref2[3];
316
+
317
+ r /= 255;
318
+ g /= 255;
319
+ b /= 255;
320
+
321
+ var max = Math.max(r, g, b),
322
+ min = Math.min(r, g, b);
323
+ var h = void 0,
324
+ s = void 0,
325
+ l = (max + min) / 2;
326
+
327
+ if (max === min) {
328
+ h = s = 0;
329
+ } else {
330
+ var d = max - min;
331
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
332
+ switch (max) {
333
+ case r:
334
+ h = (g - b) / d + (g < b ? 6 : 0);break;
335
+ case g:
336
+ h = (b - r) / d + 2;break;
337
+ case b:
338
+ h = (r - g) / d + 4;break;
339
+ }
340
+
341
+ h /= 6;
342
+ }
343
+
344
+ return [h, s, l, a];
345
+ }
346
+ }, {
347
+ key: 'hslToRgb',
348
+ value: function hslToRgb(_ref3) {
349
+ var _ref4 = slicedToArray(_ref3, 4),
350
+ h = _ref4[0],
351
+ s = _ref4[1],
352
+ l = _ref4[2],
353
+ a = _ref4[3];
354
+
355
+ var r = void 0,
356
+ g = void 0,
357
+ b = void 0;
358
+
359
+ if (s === 0) {
360
+ r = g = b = l;
361
+ } else {
362
+ var hue2rgb = function hue2rgb(p, q, t) {
363
+ if (t < 0) t += 1;
364
+ if (t > 1) t -= 1;
365
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
366
+ if (t < 1 / 2) return q;
367
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
368
+ return p;
369
+ };
370
+
371
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s,
372
+ p = 2 * l - q;
373
+
374
+ r = hue2rgb(p, q, h + 1 / 3);
375
+ g = hue2rgb(p, q, h);
376
+ b = hue2rgb(p, q, h - 1 / 3);
377
+ }
378
+
379
+ var rgba = [r * 255, g * 255, b * 255].map(Math.round);
380
+ rgba[3] = a;
381
+
382
+ return rgba;
383
+ }
384
+ }]);
385
+ return Color;
386
+ }();
387
+
388
+ var EventBucket = function () {
389
+ function EventBucket() {
390
+ classCallCheck(this, EventBucket);
391
+
392
+ this._events = [];
393
+ }
394
+
395
+ createClass(EventBucket, [{
396
+ key: 'add',
397
+ value: function add(target, type, handler) {
398
+ target.addEventListener(type, handler, false);
399
+ this._events.push({
400
+ target: target,
401
+ type: type,
402
+ handler: handler
403
+ });
404
+ }
405
+ }, {
406
+ key: 'remove',
407
+ value: function remove(target, type, handler) {
408
+ this._events = this._events.filter(function (e) {
409
+ var isMatch = true;
410
+ if (target && target !== e.target) {
411
+ isMatch = false;
412
+ }
413
+ if (type && type !== e.type) {
414
+ isMatch = false;
415
+ }
416
+ if (handler && handler !== e.handler) {
417
+ isMatch = false;
418
+ }
419
+
420
+ if (isMatch) {
421
+ EventBucket._doRemove(e.target, e.type, e.handler);
422
+ }
423
+ return !isMatch;
424
+ });
425
+ }
426
+ }, {
427
+ key: 'destroy',
428
+ value: function destroy() {
429
+ this._events.forEach(function (e) {
430
+ return EventBucket._doRemove(e.target, e.type, e.handler);
431
+ });
432
+ this._events = [];
433
+ }
434
+ }], [{
435
+ key: '_doRemove',
436
+ value: function _doRemove(target, type, handler) {
437
+ target.removeEventListener(type, handler, false);
438
+ }
439
+ }]);
440
+ return EventBucket;
441
+ }();
442
+
443
+ function parseHTML(htmlString) {
444
+
445
+ var div = document.createElement('div');
446
+ div.innerHTML = htmlString;
447
+ return div.firstElementChild;
448
+ }
449
+
450
+ function dragTrack(eventBucket, area, callback) {
451
+ var dragging = false;
452
+
453
+ function clamp(val, min, max) {
454
+ return Math.max(min, Math.min(val, max));
455
+ }
456
+
457
+ function onMove(e, info, starting) {
458
+ if (starting) {
459
+ dragging = true;
460
+ }
461
+ if (!dragging) {
462
+ return;
463
+ }
464
+
465
+ e.preventDefault();
466
+
467
+ var bounds = area.getBoundingClientRect(),
468
+ w = bounds.width,
469
+ h = bounds.height,
470
+ x = info.clientX,
471
+ y = info.clientY;
472
+
473
+ var relX = clamp(x - bounds.left, 0, w),
474
+ relY = clamp(y - bounds.top, 0, h);
475
+
476
+ callback(relX / w, relY / h);
477
+ }
478
+
479
+ function onMouse(e, starting) {
480
+ var button = e.buttons === undefined ? e.which : e.buttons;
481
+ if (button === 1) {
482
+ onMove(e, e, starting);
483
+ } else {
484
+ dragging = false;
485
+ }
486
+ }
487
+
488
+ function onTouch(e, starting) {
489
+ if (e.touches.length === 1) {
490
+ onMove(e, e.touches[0], starting);
491
+ } else {
492
+ dragging = false;
493
+ }
494
+ }
495
+
496
+ eventBucket.add(area, 'mousedown', function (e) {
497
+ onMouse(e, true);
498
+ });
499
+ eventBucket.add(area, 'touchstart', function (e) {
500
+ onTouch(e, true);
501
+ });
502
+ eventBucket.add(window, 'mousemove', onMouse);
503
+ eventBucket.add(area, 'touchmove', onTouch);
504
+ eventBucket.add(window, 'mouseup', function (e) {
505
+ dragging = false;
506
+ });
507
+ eventBucket.add(area, 'touchend', function (e) {
508
+ dragging = false;
509
+ });
510
+ eventBucket.add(area, 'touchcancel', function (e) {
511
+ dragging = false;
512
+ });
513
+ }
514
+
515
+ var BG_TRANSP = 'linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em';
516
+ var HUES = 360;
517
+
518
+ var EVENT_KEY = 'keydown',
519
+ EVENT_CLICK_OUTSIDE = 'mousedown',
520
+ EVENT_TAB_MOVE = 'focusin';
521
+
522
+ function $(selector, context) {
523
+ return (context || document).querySelector(selector);
524
+ }
525
+
526
+ function stopEvent(e) {
527
+
528
+ e.preventDefault();
529
+ e.stopPropagation();
530
+ }
531
+ function onKey(bucket, target, keys, handler, stop) {
532
+ bucket.add(target, EVENT_KEY, function (e) {
533
+ if (keys.indexOf(e.key) >= 0) {
534
+ handler(e);
535
+ }
536
+ });
537
+ }
538
+
539
+ var Picker = function () {
540
+ function Picker(options) {
541
+ classCallCheck(this, Picker);
542
+
543
+
544
+ this.settings = {
545
+
546
+ popup: 'right',
547
+ layout: 'default',
548
+ alpha: true,
549
+ editor: true,
550
+ editorFormat: 'hex',
551
+ cancelButton: false,
552
+ defaultColor: '#0cf'
553
+ };
554
+
555
+ this._events = new EventBucket();
556
+
557
+ this.onChange = null;
558
+
559
+ this.onDone = null;
560
+
561
+ this.onOpen = null;
562
+
563
+ this.onClose = null;
564
+
565
+ this.setOptions(options);
566
+ }
567
+
568
+ createClass(Picker, [{
569
+ key: 'setOptions',
570
+ value: function setOptions(options) {
571
+ var _this = this;
572
+
573
+ if (!options) {
574
+ return;
575
+ }
576
+ var settings = this.settings;
577
+
578
+ function transfer(source, target, skipKeys) {
579
+ for (var key in source) {
580
+
581
+ target[key] = source[key];
582
+ }
583
+ }
584
+
585
+ if (options instanceof HTMLElement) {
586
+ settings.parent = options;
587
+ } else {
588
+
589
+ if (settings.parent && options.parent && settings.parent !== options.parent) {
590
+ this._events.remove(settings.parent);
591
+ this._popupInited = false;
592
+ }
593
+
594
+ transfer(options, settings);
595
+
596
+ if (options.onChange) {
597
+ this.onChange = options.onChange;
598
+ }
599
+ if (options.onDone) {
600
+ this.onDone = options.onDone;
601
+ }
602
+ if (options.onOpen) {
603
+ this.onOpen = options.onOpen;
604
+ }
605
+ if (options.onClose) {
606
+ this.onClose = options.onClose;
607
+ }
608
+
609
+ var col = options.color || options.colour;
610
+ if (col) {
611
+ this._setColor(col);
612
+ }
613
+ }
614
+
615
+ var parent = settings.parent;
616
+ if (parent && settings.popup && !this._popupInited) {
617
+
618
+ var openProxy = function openProxy(e) {
619
+ return _this.openHandler(e);
620
+ };
621
+
622
+ this._events.add(parent, 'click', openProxy);
623
+
624
+ onKey(this._events, parent, [' ', 'Spacebar', 'Enter'], openProxy);
625
+
626
+ this._popupInited = true;
627
+ } else if (options.parent && !settings.popup) {
628
+ this.show();
629
+ }
630
+ }
631
+ }, {
632
+ key: 'openHandler',
633
+ value: function openHandler(e) {
634
+ if (this.show()) {
635
+
636
+ e && e.preventDefault();
637
+
638
+ this.settings.parent.style.pointerEvents = 'none';
639
+
640
+ var toFocus = e && e.type === EVENT_KEY ? this._domEdit : this.domElement;
641
+ setTimeout(function () {
642
+ return toFocus.focus();
643
+ }, 100);
644
+
645
+ if (this.onOpen) {
646
+ this.onOpen(this.colour);
647
+ }
648
+ }
649
+ }
650
+ }, {
651
+ key: 'closeHandler',
652
+ value: function closeHandler(e) {
653
+ var event = e && e.type;
654
+ var doHide = false;
655
+
656
+ if (!e) {
657
+ doHide = true;
658
+ } else if (event === EVENT_CLICK_OUTSIDE || event === EVENT_TAB_MOVE) {
659
+
660
+ var knownTime = (this.__containedEvent || 0) + 100;
661
+ if (e.timeStamp > knownTime) {
662
+ doHide = true;
663
+ }
664
+ } else {
665
+
666
+ stopEvent(e);
667
+
668
+ doHide = true;
669
+ }
670
+
671
+ if (doHide && this.hide()) {
672
+ this.settings.parent.style.pointerEvents = '';
673
+
674
+ if (event !== EVENT_CLICK_OUTSIDE) {
675
+ this.settings.parent.focus();
676
+ }
677
+
678
+ if (this.onClose) {
679
+ this.onClose(this.colour);
680
+ }
681
+ }
682
+ }
683
+ }, {
684
+ key: 'movePopup',
685
+ value: function movePopup(options, open) {
686
+
687
+ this.closeHandler();
688
+
689
+ this.setOptions(options);
690
+ if (open) {
691
+ this.openHandler();
692
+ }
693
+ }
694
+ }, {
695
+ key: 'setColor',
696
+ value: function setColor(color, silent) {
697
+ this._setColor(color, { silent: silent });
698
+ }
699
+ }, {
700
+ key: '_setColor',
701
+ value: function _setColor(color, flags) {
702
+ if (typeof color === 'string') {
703
+ color = color.trim();
704
+ }
705
+ if (!color) {
706
+ return;
707
+ }
708
+
709
+ flags = flags || {};
710
+ var c = void 0;
711
+ try {
712
+
713
+ c = new Color(color);
714
+ } catch (ex) {
715
+ if (flags.failSilently) {
716
+ return;
717
+ }
718
+ throw ex;
719
+ }
720
+
721
+ if (!this.settings.alpha) {
722
+ var hsla = c.hsla;
723
+ hsla[3] = 1;
724
+ c.hsla = hsla;
725
+ }
726
+ this.colour = this.color = c;
727
+ this._setHSLA(null, null, null, null, flags);
728
+ }
729
+ }, {
730
+ key: 'setColour',
731
+ value: function setColour(colour, silent) {
732
+ this.setColor(colour, silent);
733
+ }
734
+ }, {
735
+ key: 'show',
736
+ value: function show() {
737
+ var parent = this.settings.parent;
738
+ if (!parent) {
739
+ return false;
740
+ }
741
+
742
+ if (this.domElement) {
743
+ var toggled = this._toggleDOM(true);
744
+
745
+ this._setPosition();
746
+
747
+ return toggled;
748
+ }
749
+
750
+ var html = this.settings.template || '<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>';
751
+ var wrapper = parseHTML(html);
752
+
753
+ this.domElement = wrapper;
754
+ this._domH = $('.picker_hue', wrapper);
755
+ this._domSL = $('.picker_sl', wrapper);
756
+ this._domA = $('.picker_alpha', wrapper);
757
+ this._domEdit = $('.picker_editor input', wrapper);
758
+ this._domSample = $('.picker_sample', wrapper);
759
+ this._domOkay = $('.picker_done button', wrapper);
760
+ this._domCancel = $('.picker_cancel button', wrapper);
761
+
762
+ wrapper.classList.add('layout_' + this.settings.layout);
763
+ if (!this.settings.alpha) {
764
+ wrapper.classList.add('no_alpha');
765
+ }
766
+ if (!this.settings.editor) {
767
+ wrapper.classList.add('no_editor');
768
+ }
769
+ if (!this.settings.cancelButton) {
770
+ wrapper.classList.add('no_cancel');
771
+ }
772
+ this._ifPopup(function () {
773
+ return wrapper.classList.add('popup');
774
+ });
775
+
776
+ this._setPosition();
777
+
778
+ if (this.colour) {
779
+ this._updateUI();
780
+ } else {
781
+ this._setColor(this.settings.defaultColor);
782
+ }
783
+ this._bindEvents();
784
+
785
+ return true;
786
+ }
787
+ }, {
788
+ key: 'hide',
789
+ value: function hide() {
790
+ return this._toggleDOM(false);
791
+ }
792
+ }, {
793
+ key: 'destroy',
794
+ value: function destroy() {
795
+ this._events.destroy();
796
+ if (this.domElement) {
797
+ this.settings.parent.removeChild(this.domElement);
798
+ }
799
+ }
800
+ }, {
801
+ key: '_bindEvents',
802
+ value: function _bindEvents() {
803
+ var _this2 = this;
804
+
805
+ var that = this,
806
+ dom = this.domElement,
807
+ events = this._events;
808
+
809
+ function addEvent(target, type, handler) {
810
+ events.add(target, type, handler);
811
+ }
812
+
813
+ addEvent(dom, 'click', function (e) {
814
+ return e.preventDefault();
815
+ });
816
+
817
+ dragTrack(events, this._domH, function (x, y) {
818
+ return that._setHSLA(x);
819
+ });
820
+
821
+ dragTrack(events, this._domSL, function (x, y) {
822
+ return that._setHSLA(null, x, 1 - y);
823
+ });
824
+
825
+ if (this.settings.alpha) {
826
+ dragTrack(events, this._domA, function (x, y) {
827
+ return that._setHSLA(null, null, null, 1 - y);
828
+ });
829
+ }
830
+
831
+ var editInput = this._domEdit;
832
+ {
833
+ addEvent(editInput, 'input', function (e) {
834
+ that._setColor(this.value, { fromEditor: true, failSilently: true });
835
+ });
836
+
837
+ addEvent(editInput, 'focus', function (e) {
838
+ var input = this;
839
+
840
+ if (input.selectionStart === input.selectionEnd) {
841
+ input.select();
842
+ }
843
+ });
844
+ }
845
+
846
+ this._ifPopup(function () {
847
+
848
+ var popupCloseProxy = function popupCloseProxy(e) {
849
+ return _this2.closeHandler(e);
850
+ };
851
+
852
+ addEvent(window, EVENT_CLICK_OUTSIDE, popupCloseProxy);
853
+ addEvent(window, EVENT_TAB_MOVE, popupCloseProxy);
854
+ onKey(events, dom, ['Esc', 'Escape'], popupCloseProxy);
855
+
856
+ var timeKeeper = function timeKeeper(e) {
857
+ _this2.__containedEvent = e.timeStamp;
858
+ };
859
+ addEvent(dom, EVENT_CLICK_OUTSIDE, timeKeeper);
860
+
861
+ addEvent(dom, EVENT_TAB_MOVE, timeKeeper);
862
+
863
+ addEvent(_this2._domCancel, 'click', popupCloseProxy);
864
+ });
865
+
866
+ var onDoneProxy = function onDoneProxy(e) {
867
+ _this2._ifPopup(function () {
868
+ return _this2.closeHandler(e);
869
+ });
870
+ if (_this2.onDone) {
871
+ _this2.onDone(_this2.colour);
872
+ }
873
+ };
874
+ addEvent(this._domOkay, 'click', onDoneProxy);
875
+ onKey(events, dom, ['Enter'], onDoneProxy);
876
+ }
877
+ }, {
878
+ key: '_setPosition',
879
+ value: function _setPosition() {
880
+ var parent = this.settings.parent,
881
+ elm = this.domElement;
882
+
883
+ if (parent !== elm.parentNode) {
884
+ parent.appendChild(elm);
885
+ }
886
+
887
+ this._ifPopup(function (popup) {
888
+
889
+ if (getComputedStyle(parent).position === 'static') {
890
+ parent.style.position = 'relative';
891
+ }
892
+
893
+ var cssClass = popup === true ? 'popup_right' : 'popup_' + popup;
894
+
895
+ ['popup_top', 'popup_bottom', 'popup_left', 'popup_right'].forEach(function (c) {
896
+
897
+ if (c === cssClass) {
898
+ elm.classList.add(c);
899
+ } else {
900
+ elm.classList.remove(c);
901
+ }
902
+ });
903
+
904
+ elm.classList.add(cssClass);
905
+ });
906
+ }
907
+ }, {
908
+ key: '_setHSLA',
909
+ value: function _setHSLA(h, s, l, a, flags) {
910
+ flags = flags || {};
911
+
912
+ var col = this.colour,
913
+ hsla = col.hsla;
914
+
915
+ [h, s, l, a].forEach(function (x, i) {
916
+ if (x || x === 0) {
917
+ hsla[i] = x;
918
+ }
919
+ });
920
+ col.hsla = hsla;
921
+
922
+ this._updateUI(flags);
923
+
924
+ if (this.onChange && !flags.silent) {
925
+ this.onChange(col);
926
+ }
927
+ }
928
+ }, {
929
+ key: '_updateUI',
930
+ value: function _updateUI(flags) {
931
+ if (!this.domElement) {
932
+ return;
933
+ }
934
+ flags = flags || {};
935
+
936
+ var col = this.colour,
937
+ hsl = col.hsla,
938
+ cssHue = 'hsl(' + hsl[0] * HUES + ', 100%, 50%)',
939
+ cssHSL = col.hslString,
940
+ cssHSLA = col.hslaString;
941
+
942
+ var uiH = this._domH,
943
+ uiSL = this._domSL,
944
+ uiA = this._domA,
945
+ thumbH = $('.picker_selector', uiH),
946
+ thumbSL = $('.picker_selector', uiSL),
947
+ thumbA = $('.picker_selector', uiA);
948
+
949
+ function posX(parent, child, relX) {
950
+ child.style.left = relX * 100 + '%';
951
+ }
952
+ function posY(parent, child, relY) {
953
+ child.style.top = relY * 100 + '%';
954
+ }
955
+
956
+ posX(uiH, thumbH, hsl[0]);
957
+
958
+ this._domSL.style.backgroundColor = this._domH.style.color = cssHue;
959
+
960
+ posX(uiSL, thumbSL, hsl[1]);
961
+ posY(uiSL, thumbSL, 1 - hsl[2]);
962
+
963
+ uiSL.style.color = cssHSL;
964
+
965
+ posY(uiA, thumbA, 1 - hsl[3]);
966
+
967
+ var opaque = cssHSL,
968
+ transp = opaque.replace('hsl', 'hsla').replace(')', ', 0)'),
969
+ bg = 'linear-gradient(' + [opaque, transp] + ')';
970
+
971
+ this._domA.style.background = bg + ', ' + BG_TRANSP;
972
+
973
+ if (!flags.fromEditor) {
974
+ var format = this.settings.editorFormat,
975
+ alpha = this.settings.alpha;
976
+
977
+ var value = void 0;
978
+ switch (format) {
979
+ case 'rgb':
980
+ value = col.printRGB(alpha);break;
981
+ case 'hsl':
982
+ value = col.printHSL(alpha);break;
983
+ default:
984
+ value = col.printHex(alpha);
985
+ }
986
+ this._domEdit.value = value;
987
+ }
988
+
989
+ this._domSample.style.color = cssHSLA;
990
+ }
991
+ }, {
992
+ key: '_ifPopup',
993
+ value: function _ifPopup(actionIf, actionElse) {
994
+ if (this.settings.parent && this.settings.popup) {
995
+ actionIf && actionIf(this.settings.popup);
996
+ } else {
997
+ actionElse && actionElse();
998
+ }
999
+ }
1000
+ }, {
1001
+ key: '_toggleDOM',
1002
+ value: function _toggleDOM(toVisible) {
1003
+ var dom = this.domElement;
1004
+ if (!dom) {
1005
+ return false;
1006
+ }
1007
+
1008
+ var displayStyle = toVisible ? '' : 'none',
1009
+ toggle = dom.style.display !== displayStyle;
1010
+
1011
+ if (toggle) {
1012
+ dom.style.display = displayStyle;
1013
+ }
1014
+ return toggle;
1015
+ }
1016
+ }]);
1017
+ return Picker;
1018
+ }();
1019
+
1020
+ {
1021
+ var style = document.createElement('style');
1022
+ style.textContent = '.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}';
1023
+ document.documentElement.firstElementChild.appendChild(style);
1024
+
1025
+ Picker.StyleElement = style;
1026
+ }
1027
+
1028
+ return Picker;
1029
+
1030
+ }));
1031
+ } (vanillaPicker$3));
1032
+ return vanillaPicker$3.exports;
1033
+ }
1034
+
1035
+ var vanillaPickerExports = requireVanillaPicker();
1036
+ var vanillaPicker = /*@__PURE__*/getDefaultExportFromCjs(vanillaPickerExports);
1037
+
1038
+ var vanillaPicker$1 = /*#__PURE__*/_mergeNamespaces({
1039
+ __proto__: null,
1040
+ default: vanillaPicker
1041
+ }, [vanillaPickerExports]);
1042
+
1043
+ export { vanillaPicker$1 as v };