@ppg_pl/tinting 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/modal-header_9.cjs.entry.js +47 -22
- package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
- package/dist/collection/components/colorbox/index.js +18 -1
- package/dist/collection/components/colorbox/index.js.map +1 -1
- package/dist/collection/components/colorinfo/index.js +2 -9
- package/dist/collection/components/colorinfo/index.js.map +1 -1
- package/dist/collection/utils/index.js +17 -0
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/components/index10.js +4934 -3605
- package/dist/components/index10.js.map +1 -1
- package/dist/components/index11.js +3989 -0
- package/dist/components/index11.js.map +1 -0
- package/dist/components/index4.js +2 -13
- package/dist/components/index4.js.map +1 -1
- package/dist/components/index6.js +28 -27
- package/dist/components/index6.js.map +1 -1
- package/dist/components/index7.js +9 -53
- package/dist/components/index7.js.map +1 -1
- package/dist/components/index8.js +56 -129
- package/dist/components/index8.js.map +1 -1
- package/dist/components/index9.js +124 -5283
- package/dist/components/index9.js.map +1 -1
- package/dist/components/my-backdrop.js +1 -1
- package/dist/components/my-colorbox.js +1 -1
- package/dist/components/my-colorinfo.js +1 -1
- package/dist/components/my-component.js +5 -5
- package/dist/components/my-modal.js +1 -1
- package/dist/components/my-slider.js +1 -1
- package/dist/esm/modal-header_9.entry.js +47 -22
- package/dist/esm/modal-header_9.entry.js.map +1 -1
- package/dist/tinting/{p-4ec5261b.entry.js → p-2730a042.entry.js} +3 -3
- package/dist/tinting/p-2730a042.entry.js.map +1 -0
- package/dist/tinting/tinting.esm.js +1 -1
- package/dist/types/components/colorbox/index.d.ts +3 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/package.json +1 -1
- package/www/build/{p-4ec5261b.entry.js → p-2730a042.entry.js} +3 -3
- package/www/build/p-2730a042.entry.js.map +1 -0
- package/www/build/tinting.esm.js +1 -1
- package/dist/tinting/p-4ec5261b.entry.js.map +0 -1
- package/www/build/p-4ec5261b.entry.js.map +0 -1
|
@@ -2737,6 +2737,35 @@ const setDataLayer = (obj) => {
|
|
|
2737
2737
|
return window.dataLayer.push(obj);
|
|
2738
2738
|
};
|
|
2739
2739
|
|
|
2740
|
+
/**
|
|
2741
|
+
* Returns true when a hex color is so light it is hard to distinguish from a
|
|
2742
|
+
* white background (e.g. NCS S 0300-N ≈ #fafaf8). Uses perceived luminance.
|
|
2743
|
+
* Accepts values with or without a leading '#', in 3- or 6-digit form.
|
|
2744
|
+
*/
|
|
2745
|
+
function isVeryLightColor(hex) {
|
|
2746
|
+
var _a;
|
|
2747
|
+
const cleaned = (_a = hex === null || hex === void 0 ? void 0 : hex.replace('#', '')) !== null && _a !== void 0 ? _a : '';
|
|
2748
|
+
if (cleaned.length !== 6 && cleaned.length !== 3)
|
|
2749
|
+
return false;
|
|
2750
|
+
const short = cleaned.length === 3;
|
|
2751
|
+
const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;
|
|
2752
|
+
const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;
|
|
2753
|
+
const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;
|
|
2754
|
+
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2755
|
+
return luminance > 0.96;
|
|
2756
|
+
}
|
|
2757
|
+
function debounce$1(func, wait) {
|
|
2758
|
+
let timeout;
|
|
2759
|
+
return function executedFunction(...args) {
|
|
2760
|
+
const later = () => {
|
|
2761
|
+
clearTimeout(timeout);
|
|
2762
|
+
func(...args);
|
|
2763
|
+
};
|
|
2764
|
+
clearTimeout(timeout);
|
|
2765
|
+
timeout = setTimeout(later, wait);
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2740
2769
|
const indexCss$5 = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap\"); .tinting-wrapper *{font-family:\"Poppins\", sans-serif}.my-color-box{width:125px;height:125px;display:block;margin-bottom:5px;cursor:pointer;display:flex;flex-direction:column;justify-content:flex-end;position:relative}@media (max-width: 1024px){.my-color-box{width:65px;height:65px}}.my-color-box .color-name{width:100%;background-color:#fff;padding:15px 0px 10px;border-top-left-radius:15px;border-top-right-radius:15px;opacity:0;transition:0.3s opacity ease-in-out;font-size:10px;color:#232323;text-transform:lowercase}.my-color-box.active .color-name{opacity:1}.my-color-box.categoryactive{width:120px;height:115px}.my-color-box.categoryactive .color-name{opacity:1}@media (max-width: 1024px){.my-color-box.categoryactive{width:72px;height:72px}}.my-color-box:hover .color-name{opacity:1}";
|
|
2741
2770
|
|
|
2742
2771
|
const MyColorBox = class {
|
|
@@ -2763,6 +2792,21 @@ const MyColorBox = class {
|
|
|
2763
2792
|
const blue = parseInt(color[5] + color[6], 16) - 20;
|
|
2764
2793
|
return `rgb(${red},${green},${blue})`;
|
|
2765
2794
|
};
|
|
2795
|
+
this.isLightSwatch = () => { var _a; return !((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) && isVeryLightColor(this.color); };
|
|
2796
|
+
// Active category keeps its 5px solid border (all active swatches share it, so
|
|
2797
|
+
// alignment is consistent). In the normal grid we use an inset box-shadow
|
|
2798
|
+
// instead of a border so light swatches gain a visible edge without changing
|
|
2799
|
+
// their box size and skewing the grid.
|
|
2800
|
+
this.getBorder = () => {
|
|
2801
|
+
if (!this.isCategoryActive)
|
|
2802
|
+
return '';
|
|
2803
|
+
return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;
|
|
2804
|
+
};
|
|
2805
|
+
this.getBoxShadow = () => {
|
|
2806
|
+
if (this.isCategoryActive)
|
|
2807
|
+
return '';
|
|
2808
|
+
return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';
|
|
2809
|
+
};
|
|
2766
2810
|
this.color = undefined;
|
|
2767
2811
|
this.name = undefined;
|
|
2768
2812
|
this.shop = undefined;
|
|
@@ -2777,7 +2821,8 @@ const MyColorBox = class {
|
|
|
2777
2821
|
backgroundSize: ((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) ? 'cover' : '',
|
|
2778
2822
|
backgroundImage: ((_b = this.isImageInsteadHex) === null || _b === void 0 ? void 0 : _b.isImageInsteadHex) ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',
|
|
2779
2823
|
background: ((_c = this.isImageInsteadHex) === null || _c === void 0 ? void 0 : _c.isImageInsteadHex) ? this.isImageInsteadHex.bigImage : this.color,
|
|
2780
|
-
border: this.
|
|
2824
|
+
border: this.getBorder(),
|
|
2825
|
+
boxShadow: this.getBoxShadow(),
|
|
2781
2826
|
} }, index$2.h("div", { class: "color-name" }, this.name)));
|
|
2782
2827
|
}
|
|
2783
2828
|
};
|
|
@@ -2826,17 +2871,9 @@ const MyColorInfo = class {
|
|
|
2826
2871
|
return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();
|
|
2827
2872
|
};
|
|
2828
2873
|
this.isVeryLightBackground = () => {
|
|
2829
|
-
var _a, _b;
|
|
2830
2874
|
if (this.currentColor.imageInsteadHex)
|
|
2831
2875
|
return true;
|
|
2832
|
-
|
|
2833
|
-
if (hex.length !== 6 && hex.length !== 3)
|
|
2834
|
-
return false;
|
|
2835
|
-
const r = parseInt(hex.length === 3 ? hex[0] + hex[0] : hex.slice(0, 2), 16) / 255;
|
|
2836
|
-
const g = parseInt(hex.length === 3 ? hex[1] + hex[1] : hex.slice(2, 4), 16) / 255;
|
|
2837
|
-
const b = parseInt(hex.length === 3 ? hex[2] + hex[2] : hex.slice(4, 6), 16) / 255;
|
|
2838
|
-
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2839
|
-
return luminance > 0.96;
|
|
2876
|
+
return isVeryLightColor(this.currentColor.hex);
|
|
2840
2877
|
};
|
|
2841
2878
|
this.getButtonClass = () => {
|
|
2842
2879
|
if (this.currentColor.imageInsteadHex)
|
|
@@ -3087,18 +3124,6 @@ const MyModalBundle = class {
|
|
|
3087
3124
|
};
|
|
3088
3125
|
MyModalBundle.style = indexCss$4;
|
|
3089
3126
|
|
|
3090
|
-
function debounce$1(func, wait) {
|
|
3091
|
-
let timeout;
|
|
3092
|
-
return function executedFunction(...args) {
|
|
3093
|
-
const later = () => {
|
|
3094
|
-
clearTimeout(timeout);
|
|
3095
|
-
func(...args);
|
|
3096
|
-
};
|
|
3097
|
-
clearTimeout(timeout);
|
|
3098
|
-
timeout = setTimeout(later, wait);
|
|
3099
|
-
};
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
3127
|
const { min: min$4, max: max$4 } = Math;
|
|
3103
3128
|
|
|
3104
3129
|
const limit = (x, low = 0, high = 1) => {
|