@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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$9 } from './index2.js';
|
|
3
|
-
import { d as defineCustomElement$8 } from './
|
|
4
|
-
import { d as defineCustomElement$7 } from './
|
|
5
|
-
import { d as defineCustomElement$6 } from './
|
|
6
|
-
import { d as defineCustomElement$5 } from './
|
|
3
|
+
import { d as defineCustomElement$8 } from './index7.js';
|
|
4
|
+
import { d as defineCustomElement$7 } from './index8.js';
|
|
5
|
+
import { d as defineCustomElement$6 } from './index9.js';
|
|
6
|
+
import { d as defineCustomElement$5 } from './index11.js';
|
|
7
7
|
import { d as defineCustomElement$4 } from './index3.js';
|
|
8
8
|
import { d as defineCustomElement$3 } from './index4.js';
|
|
9
|
-
import { d as defineCustomElement$2 } from './
|
|
9
|
+
import { d as defineCustomElement$2 } from './index10.js';
|
|
10
10
|
|
|
11
11
|
const isObject = (val) => !Array.isArray(val) && val !== null && typeof val === 'object';
|
|
12
12
|
const hasAttributes = ({ vattrs }, requiredAttrs = []) => isObject(vattrs) && requiredAttrs.every(vattrs.hasOwnProperty.bind(vattrs));
|
|
@@ -2733,6 +2733,35 @@ const setDataLayer = (obj) => {
|
|
|
2733
2733
|
return window.dataLayer.push(obj);
|
|
2734
2734
|
};
|
|
2735
2735
|
|
|
2736
|
+
/**
|
|
2737
|
+
* Returns true when a hex color is so light it is hard to distinguish from a
|
|
2738
|
+
* white background (e.g. NCS S 0300-N ≈ #fafaf8). Uses perceived luminance.
|
|
2739
|
+
* Accepts values with or without a leading '#', in 3- or 6-digit form.
|
|
2740
|
+
*/
|
|
2741
|
+
function isVeryLightColor(hex) {
|
|
2742
|
+
var _a;
|
|
2743
|
+
const cleaned = (_a = hex === null || hex === void 0 ? void 0 : hex.replace('#', '')) !== null && _a !== void 0 ? _a : '';
|
|
2744
|
+
if (cleaned.length !== 6 && cleaned.length !== 3)
|
|
2745
|
+
return false;
|
|
2746
|
+
const short = cleaned.length === 3;
|
|
2747
|
+
const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;
|
|
2748
|
+
const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;
|
|
2749
|
+
const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;
|
|
2750
|
+
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2751
|
+
return luminance > 0.96;
|
|
2752
|
+
}
|
|
2753
|
+
function debounce$1(func, wait) {
|
|
2754
|
+
let timeout;
|
|
2755
|
+
return function executedFunction(...args) {
|
|
2756
|
+
const later = () => {
|
|
2757
|
+
clearTimeout(timeout);
|
|
2758
|
+
func(...args);
|
|
2759
|
+
};
|
|
2760
|
+
clearTimeout(timeout);
|
|
2761
|
+
timeout = setTimeout(later, wait);
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2736
2765
|
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}";
|
|
2737
2766
|
|
|
2738
2767
|
const MyColorBox = class {
|
|
@@ -2759,6 +2788,21 @@ const MyColorBox = class {
|
|
|
2759
2788
|
const blue = parseInt(color[5] + color[6], 16) - 20;
|
|
2760
2789
|
return `rgb(${red},${green},${blue})`;
|
|
2761
2790
|
};
|
|
2791
|
+
this.isLightSwatch = () => { var _a; return !((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) && isVeryLightColor(this.color); };
|
|
2792
|
+
// Active category keeps its 5px solid border (all active swatches share it, so
|
|
2793
|
+
// alignment is consistent). In the normal grid we use an inset box-shadow
|
|
2794
|
+
// instead of a border so light swatches gain a visible edge without changing
|
|
2795
|
+
// their box size and skewing the grid.
|
|
2796
|
+
this.getBorder = () => {
|
|
2797
|
+
if (!this.isCategoryActive)
|
|
2798
|
+
return '';
|
|
2799
|
+
return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;
|
|
2800
|
+
};
|
|
2801
|
+
this.getBoxShadow = () => {
|
|
2802
|
+
if (this.isCategoryActive)
|
|
2803
|
+
return '';
|
|
2804
|
+
return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';
|
|
2805
|
+
};
|
|
2762
2806
|
this.color = undefined;
|
|
2763
2807
|
this.name = undefined;
|
|
2764
2808
|
this.shop = undefined;
|
|
@@ -2773,7 +2817,8 @@ const MyColorBox = class {
|
|
|
2773
2817
|
backgroundSize: ((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) ? 'cover' : '',
|
|
2774
2818
|
backgroundImage: ((_b = this.isImageInsteadHex) === null || _b === void 0 ? void 0 : _b.isImageInsteadHex) ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',
|
|
2775
2819
|
background: ((_c = this.isImageInsteadHex) === null || _c === void 0 ? void 0 : _c.isImageInsteadHex) ? this.isImageInsteadHex.bigImage : this.color,
|
|
2776
|
-
border: this.
|
|
2820
|
+
border: this.getBorder(),
|
|
2821
|
+
boxShadow: this.getBoxShadow(),
|
|
2777
2822
|
} }, h("div", { class: "color-name" }, this.name)));
|
|
2778
2823
|
}
|
|
2779
2824
|
};
|
|
@@ -2822,17 +2867,9 @@ const MyColorInfo = class {
|
|
|
2822
2867
|
return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();
|
|
2823
2868
|
};
|
|
2824
2869
|
this.isVeryLightBackground = () => {
|
|
2825
|
-
var _a, _b;
|
|
2826
2870
|
if (this.currentColor.imageInsteadHex)
|
|
2827
2871
|
return true;
|
|
2828
|
-
|
|
2829
|
-
if (hex.length !== 6 && hex.length !== 3)
|
|
2830
|
-
return false;
|
|
2831
|
-
const r = parseInt(hex.length === 3 ? hex[0] + hex[0] : hex.slice(0, 2), 16) / 255;
|
|
2832
|
-
const g = parseInt(hex.length === 3 ? hex[1] + hex[1] : hex.slice(2, 4), 16) / 255;
|
|
2833
|
-
const b = parseInt(hex.length === 3 ? hex[2] + hex[2] : hex.slice(4, 6), 16) / 255;
|
|
2834
|
-
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2835
|
-
return luminance > 0.96;
|
|
2872
|
+
return isVeryLightColor(this.currentColor.hex);
|
|
2836
2873
|
};
|
|
2837
2874
|
this.getButtonClass = () => {
|
|
2838
2875
|
if (this.currentColor.imageInsteadHex)
|
|
@@ -3083,18 +3120,6 @@ const MyModalBundle = class {
|
|
|
3083
3120
|
};
|
|
3084
3121
|
MyModalBundle.style = indexCss$4;
|
|
3085
3122
|
|
|
3086
|
-
function debounce$1(func, wait) {
|
|
3087
|
-
let timeout;
|
|
3088
|
-
return function executedFunction(...args) {
|
|
3089
|
-
const later = () => {
|
|
3090
|
-
clearTimeout(timeout);
|
|
3091
|
-
func(...args);
|
|
3092
|
-
};
|
|
3093
|
-
clearTimeout(timeout);
|
|
3094
|
-
timeout = setTimeout(later, wait);
|
|
3095
|
-
};
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
3123
|
const { min: min$4, max: max$4 } = Math;
|
|
3099
3124
|
|
|
3100
3125
|
const limit = (x, low = 0, high = 1) => {
|