@ppg_pl/tinting 0.0.5 → 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.
Files changed (79) hide show
  1. package/dist/cjs/{index-0a139db0.js → index-b6962659.js} +51 -4
  2. package/dist/cjs/index-b6962659.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/modal-header_9.cjs.entry.js +165 -41
  5. package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
  6. package/dist/cjs/tinting.cjs.js +2 -2
  7. package/dist/collection/components/colorbox/index.js +18 -1
  8. package/dist/collection/components/colorbox/index.js.map +1 -1
  9. package/dist/collection/components/colorinfo/index.js +128 -1
  10. package/dist/collection/components/colorinfo/index.js.map +1 -1
  11. package/dist/collection/components/component/index.js +64 -1
  12. package/dist/collection/components/component/index.js.map +1 -1
  13. package/dist/collection/components/modal/index.css +176 -1
  14. package/dist/collection/components/modal/index.js +50 -2
  15. package/dist/collection/components/modal/index.js.map +1 -1
  16. package/dist/collection/components/slider/index.css +24 -6
  17. package/dist/collection/components/slider/index.js +32 -21
  18. package/dist/collection/components/slider/index.js.map +1 -1
  19. package/dist/collection/types.js.map +1 -1
  20. package/dist/collection/utils/index.js +17 -0
  21. package/dist/collection/utils/index.js.map +1 -1
  22. package/dist/components/index10.js +4934 -3598
  23. package/dist/components/index10.js.map +1 -1
  24. package/dist/components/index11.js +3989 -0
  25. package/dist/components/index11.js.map +1 -0
  26. package/dist/components/index4.js +2 -13
  27. package/dist/components/index4.js.map +1 -1
  28. package/dist/components/index6.js +28 -27
  29. package/dist/components/index6.js.map +1 -1
  30. package/dist/components/index7.js +9 -53
  31. package/dist/components/index7.js.map +1 -1
  32. package/dist/components/index8.js +57 -52
  33. package/dist/components/index8.js.map +1 -1
  34. package/dist/components/index9.js +124 -5272
  35. package/dist/components/index9.js.map +1 -1
  36. package/dist/components/my-backdrop.js +1 -1
  37. package/dist/components/my-colorbox.js +1 -1
  38. package/dist/components/my-colorinfo.js +1 -1
  39. package/dist/components/my-component.js +18 -7
  40. package/dist/components/my-component.js.map +1 -1
  41. package/dist/components/my-modal.js +1 -1
  42. package/dist/components/my-slider.js +1 -1
  43. package/dist/esm/{index-f3be6531.js → index-cb79645d.js} +51 -4
  44. package/dist/esm/index-cb79645d.js.map +1 -0
  45. package/dist/esm/loader.js +3 -3
  46. package/dist/esm/modal-header_9.entry.js +165 -41
  47. package/dist/esm/modal-header_9.entry.js.map +1 -1
  48. package/dist/esm/tinting.js +3 -3
  49. package/dist/tinting/p-2730a042.entry.js +15 -0
  50. package/dist/tinting/p-2730a042.entry.js.map +1 -0
  51. package/dist/tinting/p-5b9dc044.js +3 -0
  52. package/dist/tinting/p-5b9dc044.js.map +1 -0
  53. package/dist/tinting/tinting.esm.js +1 -1
  54. package/dist/tinting/tinting.esm.js.map +1 -1
  55. package/dist/types/components/colorbox/index.d.ts +3 -0
  56. package/dist/types/components/colorinfo/index.d.ts +17 -1
  57. package/dist/types/components/component/index.d.ts +8 -0
  58. package/dist/types/components/modal/index.d.ts +6 -1
  59. package/dist/types/components.d.ts +16 -2
  60. package/dist/types/types.d.ts +4 -0
  61. package/dist/types/utils/index.d.ts +6 -0
  62. package/package.json +3 -2
  63. package/www/build/p-2730a042.entry.js +15 -0
  64. package/www/build/p-2730a042.entry.js.map +1 -0
  65. package/www/build/p-5b9dc044.js +3 -0
  66. package/www/build/p-5b9dc044.js.map +1 -0
  67. package/www/build/tinting.esm.js +1 -1
  68. package/www/build/tinting.esm.js.map +1 -1
  69. package/www/index.html +76 -12
  70. package/dist/cjs/index-0a139db0.js.map +0 -1
  71. package/dist/esm/index-f3be6531.js.map +0 -1
  72. package/dist/tinting/p-398633de.entry.js +0 -15
  73. package/dist/tinting/p-398633de.entry.js.map +0 -1
  74. package/dist/tinting/p-b135c76f.js +0 -3
  75. package/dist/tinting/p-b135c76f.js.map +0 -1
  76. package/www/build/p-398633de.entry.js +0 -15
  77. package/www/build/p-398633de.entry.js.map +0 -1
  78. package/www/build/p-b135c76f.js +0 -3
  79. package/www/build/p-b135c76f.js.map +0 -1
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Returns true when a hex color is so light it is hard to distinguish from a
3
+ * white background (e.g. NCS S 0300-N ≈ #fafaf8). Uses perceived luminance.
4
+ * Accepts values with or without a leading '#', in 3- or 6-digit form.
5
+ */
6
+ export function isVeryLightColor(hex) {
7
+ var _a;
8
+ const cleaned = (_a = hex === null || hex === void 0 ? void 0 : hex.replace('#', '')) !== null && _a !== void 0 ? _a : '';
9
+ if (cleaned.length !== 6 && cleaned.length !== 3)
10
+ return false;
11
+ const short = cleaned.length === 3;
12
+ const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;
13
+ const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;
14
+ const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;
15
+ const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
16
+ return luminance > 0.96;
17
+ }
1
18
  export function debounce(func, wait) {
2
19
  let timeout;
3
20
  return function executedFunction(...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,IAA8B,EAAE,IAAY;EACnE,IAAI,OAAsC,CAAC;EAE3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,EAAE;MACjB,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;EACpC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["export function debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAA8B;;EAC7D,MAAM,OAAO,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,mCAAI,EAAE,CAAC;EAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,KAAK,CAAC;EAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;EACnC,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;EACpD,OAAO,SAAS,GAAG,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAA8B,EAAE,IAAY;EACnE,IAAI,OAAsC,CAAC;EAE3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,EAAE;MACjB,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;EACpC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Returns true when a hex color is so light it is hard to distinguish from a\n * white background (e.g. NCS S 0300-N ≈ #fafaf8). Uses perceived luminance.\n * Accepts values with or without a leading '#', in 3- or 6-digit form.\n */\nexport function isVeryLightColor(hex: string | null | undefined): boolean {\n const cleaned = hex?.replace('#', '') ?? '';\n if (cleaned.length !== 6 && cleaned.length !== 3) return false;\n const short = cleaned.length === 3;\n const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;\n const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;\n const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;\n const luminance = 0.299 * r + 0.587 * g + 0.114 * b;\n return luminance > 0.96;\n}\n\nexport function debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n"]}