@aotearoan/neon 10.0.4 → 10.1.1
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/common/utils/NeonColorUtils.cjs.js +2 -0
- package/dist/common/utils/NeonColorUtils.cjs.js.map +1 -0
- package/dist/common/utils/NeonColorUtils.es.js +245 -0
- package/dist/common/utils/NeonColorUtils.es.js.map +1 -0
- package/dist/common/utils/NeonDateUtils.cjs.js +1 -1
- package/dist/common/utils/NeonDateUtils.cjs.js.map +1 -1
- package/dist/common/utils/NeonDateUtils.es.js +0 -3
- package/dist/common/utils/NeonDateUtils.es.js.map +1 -1
- package/dist/common/utils/NeonJazziconUtils.cjs.js +2 -0
- package/dist/common/utils/NeonJazziconUtils.cjs.js.map +1 -0
- package/dist/common/utils/NeonJazziconUtils.es.js +160 -0
- package/dist/common/utils/NeonJazziconUtils.es.js.map +1 -0
- package/dist/common/utils/NeonModeUtils.cjs.js +1 -1
- package/dist/common/utils/NeonModeUtils.cjs.js.map +1 -1
- package/dist/common/utils/NeonModeUtils.es.js +5 -2
- package/dist/common/utils/NeonModeUtils.es.js.map +1 -1
- package/dist/common/utils/NeonRandomUtils.cjs.js +2 -0
- package/dist/common/utils/NeonRandomUtils.cjs.js.map +1 -0
- package/dist/common/utils/NeonRandomUtils.es.js +33 -0
- package/dist/common/utils/NeonRandomUtils.es.js.map +1 -0
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.ts_vue_type_script_src_6187a2a6_lang.cjs.js.map +1 -1
- package/dist/components/navigation/dropdown-menu/NeonDropdownMenu.ts_vue_type_script_src_6187a2a6_lang.es.js.map +1 -1
- package/dist/components/navigation/tree-menu/NeonTreeMenu.ts_vue_type_script_src_179b5200_lang.cjs.js +1 -1
- package/dist/components/navigation/tree-menu/NeonTreeMenu.ts_vue_type_script_src_179b5200_lang.cjs.js.map +1 -1
- package/dist/components/navigation/tree-menu/NeonTreeMenu.ts_vue_type_script_src_179b5200_lang.es.js +1 -1
- package/dist/components/navigation/tree-menu/NeonTreeMenu.ts_vue_type_script_src_179b5200_lang.es.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.cjs.js +1 -1
- package/dist/components/presentation/badge/NeonBadge.es.js +13 -8
- package/dist/components/presentation/badge/NeonBadge.es.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_720ca9b0_lang.cjs.js +2 -0
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_720ca9b0_lang.cjs.js.map +1 -0
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_720ca9b0_lang.es.js +55 -0
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_720ca9b0_lang.es.js.map +1 -0
- package/dist/components/user-input/search/NeonSearch.cjs.js +1 -1
- package/dist/components/user-input/search/NeonSearch.es.js +3 -2
- package/dist/components/user-input/search/NeonSearch.es.js.map +1 -1
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_0925a332_lang.cjs.js +2 -0
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_0925a332_lang.cjs.js.map +1 -0
- package/dist/components/user-input/search/{NeonSearch.ts_vue_type_script_src_2630bb0d_lang.es.js → NeonSearch.ts_vue_type_script_src_0925a332_lang.es.js} +5 -3
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_0925a332_lang.es.js.map +1 -0
- package/dist/components/user-input/select/NeonSelect.ts_vue_type_script_src_1f492752_lang.cjs.js +1 -1
- package/dist/components/user-input/select/NeonSelect.ts_vue_type_script_src_1f492752_lang.cjs.js.map +1 -1
- package/dist/components/user-input/select/NeonSelect.ts_vue_type_script_src_1f492752_lang.es.js +9 -3
- package/dist/components/user-input/select/NeonSelect.ts_vue_type_script_src_1f492752_lang.es.js.map +1 -1
- package/dist/neon.cjs.js +1 -1
- package/dist/neon.es.js +2 -0
- package/dist/neon.es.js.map +1 -1
- package/dist/src/common/utils/NeonJazziconUtils.d.ts +19 -0
- package/dist/src/common/utils/NeonModeUtils.d.ts +4 -3
- package/dist/src/common/utils/NeonRandomUtils.d.ts +5 -0
- package/dist/src/components/presentation/badge/NeonBadge.d.ts +18 -1
- package/dist/src/components/user-input/search/NeonSearch.d.ts +16 -0
- package/dist/src/components/user-input/select/NeonSelect.d.ts +15 -0
- package/dist/src/neon.d.ts +2 -0
- package/package.json +1 -1
- package/src/sass/components/_badge.scss +2 -0
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_3224431b_lang.cjs.js +0 -2
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_3224431b_lang.cjs.js.map +0 -1
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_3224431b_lang.es.js +0 -23
- package/dist/components/presentation/badge/NeonBadge.ts_vue_type_script_src_3224431b_lang.es.js.map +0 -1
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_2630bb0d_lang.cjs.js +0 -2
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_2630bb0d_lang.cjs.js.map +0 -1
- package/dist/components/user-input/search/NeonSearch.ts_vue_type_script_src_2630bb0d_lang.es.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var y=Object.defineProperty;var z=(R,e,a)=>e in R?y(R,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):R[e]=a;var u=(R,e,a)=>(z(R,typeof e!="symbol"?e+"":e,a),a);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=class{static luminance([e,a,r]){const n=[e,a,r].map(o=>(o/=255,o<=.03928?o/12.92:Math.pow((o+.055)/1.055,t.gamma)));return n[0]*t.red+n[1]*t.green+n[2]*t.blue}static toRgb(e){return[Number.parseInt(e.substring(1,3),16),Number.parseInt(e.substring(3,5),16),Number.parseInt(e.substring(5,7),16)]}static rgbToXyz(e){const[a,r,n]=e,o=t.rgbValueToXyz(a),b=t.rgbValueToXyz(r),c=t.rgbValueToXyz(n),i=t.xyzToLab((.4124564*o+.3575761*b+.1804375*c)/t.labXn),h=t.xyzToLab((.2126729*o+.7151522*b+.072175*c)/t.labYn),s=t.xyzToLab((.0193339*o+.119192*b+.9503041*c)/t.labZn);return[i,h,s]}static rgbToLab(e){const[a,r,n]=t.rgbToXyz(e),o=116*r-16;return[Math.max(o,0),500*(a-r),200*(r-n)]}static rgbToHcl(e){const a=t.rgbToLab(e);return t.labToHcl(a)}static isAccessible(e,a){const r=t.contrast(t.toRgb(e),t.toRgb(a)),n={largeAA:!1,largeAAA:!1,normalAA:!1,normalAAA:!1,ratio:Math.round(100*r)/100};return r>=3&&(n.largeAA=!0,r>=4.5&&(n.normalAA=!0,n.largeAAA=!0,r>=7&&(n.normalAAA=!0))),n}static contrast(e,a){const r=t.luminance(e),n=t.luminance(a),o=Math.max(r,n),b=Math.min(r,n);return(o+.05)/(b+.05)}static rgbToHex(e){const[a,r,n]=e,o=a.toString(16),b=r.toString(16),c=n.toString(16);return`#${o.length===1?`0${o}`:o}${b.length===1?`0${b}`:b}${c.length===1?`0${c}`:c}`}static generatePalette(e,a,r){const n=t.toRgb(e),[o,b,c]=n,i=t.toRgb(a),h=t.toRgb(r),[s,x]=t.rgbToHcl(n),[H,M,d]=t.lightReferenceColor(n,i),[A,f,m]=t.darkReferenceColor(n,h),l=t.generateChromaCurve(M),g=t.generateLuminanceCurve(d,m);return c>2*b&&c>2*o?{l5:t.rgbToHex(t.hclToRgb(s-30,l[0],g[0])),l4:t.rgbToHex(t.hclToRgb(s-25,l[1],g[1])),l3:t.rgbToHex(t.hclToRgb(s-20,l[2],g[2])),l2:t.rgbToHex(t.hclToRgb(s-15,l[3],g[3])),l1:t.rgbToHex(t.hclToRgb(s-10,l[4],g[4])),d1:t.rgbToHex(t.hclToRgb(s-10,l[5],g[5])),d2:t.rgbToHex(t.hclToRgb(s-10,l[6],g[6])),d3:t.rgbToHex(t.hclToRgb(s-10,l[7],g[7])),d4:t.rgbToHex(t.hclToRgb(s-10,l[8],g[8])),d5:t.rgbToHex(t.hclToRgb(s-10,l[9],g[9]))}:{l5:t.rgbToHex(t.hclToRgb(s,l[0],g[0])),l4:t.rgbToHex(t.hclToRgb(s,l[1],g[1])),l3:t.rgbToHex(t.hclToRgb(s,l[2],g[2])),l2:t.rgbToHex(t.hclToRgb(s,l[3],g[3])),l1:t.rgbToHex(t.hclToRgb(s,l[4],g[4])),d1:t.rgbToHex(t.hclToRgb(s,l[5],g[5])),d2:t.rgbToHex(t.hclToRgb(s,l[6],g[6])),d3:t.rgbToHex(t.hclToRgb(s,l[7],g[7])),d4:t.rgbToHex(t.hclToRgb(s,l[8],g[8])),d5:t.rgbToHex(t.hclToRgb(s,l[9],g[9]))}}static generateChromaCurve(e){const a=.25*Math.abs(e-10),r=.25*Math.abs(e-10);return[e-4*a,e-3*a+4,e-2*a+6,e-a+4,e,e,e-r+4,e-2*r+6,e-3*r+4,e-4*r]}static generateLuminanceCurve(e,a){const r=.25*(96-e),n=.25*(a-10);return[e+4*r,e+3*r,e+2*r,e+r,e,a,a-n+2,a-2*n+1,a-3*n-1,a-4*n]}static xyzToLab(e){return e>t.labT3?Math.pow(e,1/3):e/t.labT2+t.labT0}static rgbValueToXyz(e){const a=e/255;return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}static labToHcl(e){const[a,r,n]=e,o=Math.sqrt(r*r+n*n),b=(Math.atan2(n,r)*t.radiansToDegrees+360)%360;return[Math.round(b),o,a]}static luminanceByChannel(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}static relativeLuminance(e){const[a,r,n]=e,o=t.luminanceByChannel(a/255),b=t.luminanceByChannel(r/255),c=t.luminanceByChannel(n/255);return .2126*o+.7152*b+.0722*c}static contrastRatio(e,a){const r=t.relativeLuminance(e),n=t.relativeLuminance(a),o=Math.max(r,n),b=Math.min(r,n),c=(o+.05)/(b+.05);return Math.floor(c*100)/100}static labToXyz(e){return e>t.labT1?e*e*e:t.labT2*(e-t.labT0)}static xyzToRgb(e){return e<=.00304?255*12.92*e:255*(1.055*Math.pow(e,1/2.4)-.055)}static labToRgb(e,a,r){const n=(e+16)/116,o=n+a/500,b=n-r/200,c=t.labXn*t.labToXyz(o),i=t.labYn*t.labToXyz(n),h=t.labZn*t.labToXyz(b),s=Math.round(Math.min(255,Math.max(0,t.xyzToRgb(3.2404542*c-1.5371385*i-.4985314*h)))),x=Math.round(Math.min(255,Math.max(0,t.xyzToRgb(-.969266*c+1.8760108*i+.041556*h)))),H=Math.round(Math.min(255,Math.max(0,t.xyzToRgb(.0556434*c-.2040259*i+1.0572252*h))));return[s,x,H]}static hclToLab(e,a,r){const n=e*t.degreesToRadians;return[r,Math.cos(n)*a,Math.sin(n)*a]}static hclToRgb(e,a,r){const[n,o,b]=t.hclToLab(e,a,r);return t.labToRgb(n,o,b)}static lightReferenceColor(e,a){let r=e;const[n,o,b]=t.rgbToHcl(r);let c=b;for(;t.contrastRatio(r,a)<4.5;)c=c+1,r=t.hclToRgb(n,o,c);return[n,o,c]}static darkReferenceColor(e,a){let r=e;const[n,o,b]=t.rgbToHcl(r);let c=b;for(;t.contrastRatio(r,a)<4.5;)c=c-1,r=t.hclToRgb(n,o,c);return[n,o,c]}};let T=t;u(T,"red",.2126),u(T,"green",.7152),u(T,"blue",.0722),u(T,"labXn",.95047),u(T,"labYn",1),u(T,"labZn",1.08883),u(T,"labT0",.137931034),u(T,"labT1",.206896552),u(T,"labT2",.12841855),u(T,"labT3",.008856452),u(T,"degreesToRadians",Math.PI/180),u(T,"radiansToDegrees",180/Math.PI),u(T,"gamma",2.4);exports.NeonColorUtils=T;
|
|
2
|
+
//# sourceMappingURL=NeonColorUtils.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeonColorUtils.cjs.js","sources":["../../../src/common/utils/NeonColorUtils.ts"],"sourcesContent":["import type { NeonContrastAccessibility } from '@/common/models/NeonContrastAccessibility';\n\n/**\n * Utility class with helpers for calculating relative contrast & determining accessibility.\n */\nexport class NeonColorUtils {\n private static red = 0.2126;\n private static green = 0.7152;\n private static blue = 0.0722;\n private static labXn = 0.95047;\n private static labYn = 1;\n private static labZn = 1.08883;\n private static labT0 = 0.137931034; // 4 / 29\n private static labT1 = 0.206896552; // 6 / 29\n private static labT2 = 0.12841855; // 3 * t1 * t1\n private static labT3 = 0.008856452; // t1 * t1 * t1\n private static degreesToRadians = Math.PI / 180;\n private static radiansToDegrees = 180 / Math.PI;\n\n private static gamma = 2.4;\n\n public static luminance([r, g, b]: Array<number>) {\n const a = [r, g, b].map((v) => {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, NeonColorUtils.gamma);\n });\n return a[0] * NeonColorUtils.red + a[1] * NeonColorUtils.green + a[2] * NeonColorUtils.blue;\n }\n\n public static toRgb(hexString: string): Array<number> {\n return [\n Number.parseInt(hexString.substring(1, 3), 16),\n Number.parseInt(hexString.substring(3, 5), 16),\n Number.parseInt(hexString.substring(5, 7), 16),\n ];\n }\n\n public static rgbToXyz(rgb: Array<number>): Array<number> {\n const [r, g, b] = rgb;\n const r1 = NeonColorUtils.rgbValueToXyz(r);\n const g1 = NeonColorUtils.rgbValueToXyz(g);\n const b1 = NeonColorUtils.rgbValueToXyz(b);\n\n const x = NeonColorUtils.xyzToLab((0.4124564 * r1 + 0.3575761 * g1 + 0.1804375 * b1) / NeonColorUtils.labXn);\n const y = NeonColorUtils.xyzToLab((0.2126729 * r1 + 0.7151522 * g1 + 0.072175 * b1) / NeonColorUtils.labYn);\n const z = NeonColorUtils.xyzToLab((0.0193339 * r1 + 0.119192 * g1 + 0.9503041 * b1) / NeonColorUtils.labZn);\n\n return [x, y, z];\n }\n\n public static rgbToLab(rgb: Array<number>): Array<number> {\n const [x, y, z] = NeonColorUtils.rgbToXyz(rgb);\n const l = 116 * y - 16;\n return [Math.max(l, 0), 500 * (x - y), 200 * (y - z)];\n }\n\n public static rgbToHcl(rgb: Array<number>): Array<number> {\n const lab = NeonColorUtils.rgbToLab(rgb);\n return NeonColorUtils.labToHcl(lab);\n }\n\n public static isAccessible(rgb1: string, rgb2: string): NeonContrastAccessibility {\n const ratio = NeonColorUtils.contrast(NeonColorUtils.toRgb(rgb1), NeonColorUtils.toRgb(rgb2));\n\n const result = {\n largeAA: false,\n largeAAA: false,\n normalAA: false,\n normalAAA: false,\n ratio: Math.round(100 * ratio) / 100,\n };\n\n if (ratio >= 3) {\n result.largeAA = true;\n\n if (ratio >= 4.5) {\n result.normalAA = true;\n result.largeAAA = true;\n\n if (ratio >= 7) {\n result.normalAAA = true;\n }\n }\n }\n\n return result;\n }\n\n public static contrast(rgb1: Array<number>, rgb2: Array<number>) {\n const lum1 = NeonColorUtils.luminance(rgb1);\n const lum2 = NeonColorUtils.luminance(rgb2);\n const brightest = Math.max(lum1, lum2);\n const darkest = Math.min(lum1, lum2);\n return (brightest + 0.05) / (darkest + 0.05);\n }\n\n public static rgbToHex(rgb: Array<number>): string {\n const [r, g, b] = rgb;\n const rHex = r.toString(16);\n const gHex = g.toString(16);\n const bHex = b.toString(16);\n return `#${rHex.length === 1 ? `0${rHex}` : rHex}${gHex.length === 1 ? `0${gHex}` : gHex}${\n bHex.length === 1 ? `0${bHex}` : bHex\n }`;\n }\n\n public static generatePalette(\n referenceColor: string,\n darkTextHex: string,\n lightTextHex: string,\n ): Record<string, string> {\n const referenceRgb = NeonColorUtils.toRgb(referenceColor);\n const [r, g, b] = referenceRgb;\n const darkTextRgb = NeonColorUtils.toRgb(darkTextHex);\n const lightTextRgb = NeonColorUtils.toRgb(lightTextHex);\n\n const [hue, _rest] = NeonColorUtils.rgbToHcl(referenceRgb);\n\n const [_l1Hue, l1Chroma, l1Luminance] = NeonColorUtils.lightReferenceColor(referenceRgb, darkTextRgb);\n const [_d1Hue, _d1Chroma, d1Luminance] = NeonColorUtils.darkReferenceColor(referenceRgb, lightTextRgb);\n\n const chromaCurve = NeonColorUtils.generateChromaCurve(l1Chroma);\n const luminanceCurve = NeonColorUtils.generateLuminanceCurve(l1Luminance, d1Luminance);\n\n // if blue is the dominant channel then adjust hue so it's not too purple\n // TODO: rework for some blue colors as they are still too purple\n if (b > 2 * g && b > 2 * r) {\n return {\n l5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 30, chromaCurve[0], luminanceCurve[0])),\n l4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 25, chromaCurve[1], luminanceCurve[1])),\n l3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 20, chromaCurve[2], luminanceCurve[2])),\n l2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 15, chromaCurve[3], luminanceCurve[3])),\n l1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[4], luminanceCurve[4])),\n d1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[5], luminanceCurve[5])),\n d2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[6], luminanceCurve[6])),\n d3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[7], luminanceCurve[7])),\n d4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[8], luminanceCurve[8])),\n d5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[9], luminanceCurve[9])),\n };\n } else {\n return {\n l5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[0], luminanceCurve[0])),\n l4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[1], luminanceCurve[1])),\n l3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[2], luminanceCurve[2])),\n l2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[3], luminanceCurve[3])),\n l1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[4], luminanceCurve[4])),\n d1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[5], luminanceCurve[5])),\n d2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[6], luminanceCurve[6])),\n d3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[7], luminanceCurve[7])),\n d4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[8], luminanceCurve[8])),\n d5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[9], luminanceCurve[9])),\n };\n }\n }\n\n private static generateChromaCurve(chroma: number) {\n const lStep = 0.25 * Math.abs(chroma - 10);\n const dStep = 0.25 * Math.abs(chroma - 10);\n\n return [\n chroma - 4 * lStep,\n chroma - 3 * lStep + 4,\n chroma - 2 * lStep + 6,\n chroma - lStep + 4,\n chroma,\n chroma,\n chroma - dStep + 4,\n chroma - 2 * dStep + 6,\n chroma - 3 * dStep + 4,\n chroma - 4 * dStep,\n ];\n }\n\n private static generateLuminanceCurve(lightLuminance: number, darkLuminance: number) {\n const lStep = 0.25 * (96 - lightLuminance);\n const dStep = 0.25 * (darkLuminance - 10);\n\n return [\n lightLuminance + 4 * lStep,\n lightLuminance + 3 * lStep,\n lightLuminance + 2 * lStep,\n lightLuminance + lStep,\n lightLuminance,\n darkLuminance,\n darkLuminance - dStep + 2,\n darkLuminance - 2 * dStep + 1,\n darkLuminance - 3 * dStep - 1,\n darkLuminance - 4 * dStep,\n ];\n }\n\n private static xyzToLab(t: number) {\n return t > NeonColorUtils.labT3 ? Math.pow(t, 1 / 3) : t / NeonColorUtils.labT2 + NeonColorUtils.labT0;\n }\n\n private static rgbValueToXyz(value: number) {\n const v1 = value / 255;\n return v1 <= 0.04045 ? v1 / 12.92 : Math.pow((v1 + 0.055) / 1.055, 2.4);\n }\n\n private static labToHcl(lab: Array<number>) {\n const [l, a, b] = lab;\n const c = Math.sqrt(a * a + b * b);\n const h = (Math.atan2(b, a) * NeonColorUtils.radiansToDegrees + 360) % 360;\n return [Math.round(h), c, l];\n }\n\n private static luminanceByChannel(channel: number) {\n return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);\n }\n\n private static relativeLuminance(rgb: Array<number>) {\n const [r, g, b] = rgb;\n const r1 = NeonColorUtils.luminanceByChannel(r / 255);\n const g1 = NeonColorUtils.luminanceByChannel(g / 255);\n const b1 = NeonColorUtils.luminanceByChannel(b / 255);\n return 0.2126 * r1 + 0.7152 * g1 + 0.0722 * b1;\n }\n\n private static contrastRatio(backgroundColor: Array<number>, textColor: Array<number>) {\n const lum1 = NeonColorUtils.relativeLuminance(backgroundColor);\n const lum2 = NeonColorUtils.relativeLuminance(textColor);\n\n const lightest = Math.max(lum1, lum2);\n const darkest = Math.min(lum1, lum2);\n\n const contrast = (lightest + 0.05) / (darkest + 0.05);\n\n return Math.floor(contrast * 100) / 100;\n }\n\n private static labToXyz(t: number) {\n return t > NeonColorUtils.labT1 ? t * t * t : NeonColorUtils.labT2 * (t - NeonColorUtils.labT0);\n }\n\n private static xyzToRgb(r: number) {\n return r <= 0.00304 ? 255 * 12.92 * r : 255 * (1.055 * Math.pow(r, 1 / 2.4) - 0.055);\n }\n\n private static labToRgb(l: number, a: number, b: number): Array<number> {\n const y0 = (l + 16) / 116;\n const x0 = y0 + a / 500;\n const z0 = y0 - b / 200;\n\n const x1 = NeonColorUtils.labXn * NeonColorUtils.labToXyz(x0);\n const y1 = NeonColorUtils.labYn * NeonColorUtils.labToXyz(y0);\n const z1 = NeonColorUtils.labZn * NeonColorUtils.labToXyz(z0);\n const r = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(3.2404542 * x1 - 1.5371385 * y1 - 0.4985314 * z1))),\n ); // D65 -> sRGB\n const g = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(-0.969266 * x1 + 1.8760108 * y1 + 0.041556 * z1))),\n );\n const b_ = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(0.0556434 * x1 - 0.2040259 * y1 + 1.0572252 * z1))),\n );\n\n return [r, g, b_];\n }\n\n private static hclToLab(h: number, c: number, l: number) {\n const hue = h * NeonColorUtils.degreesToRadians;\n return [l, Math.cos(hue) * c, Math.sin(hue) * c];\n }\n\n private static hclToRgb(h: number, c: number, l: number): Array<number> {\n const [l_, a, b] = NeonColorUtils.hclToLab(h, c, l);\n return NeonColorUtils.labToRgb(l_, a, b);\n }\n\n private static lightReferenceColor(backgroundRgb: Array<number>, textRgb: Array<number>) {\n let referenceRgb = backgroundRgb;\n const [hue, chroma, l] = NeonColorUtils.rgbToHcl(referenceRgb);\n let luminance = l;\n // check contrast and adjust lightness up if contrast ratio too low\n while (NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {\n luminance = luminance + 1;\n referenceRgb = NeonColorUtils.hclToRgb(hue, chroma, luminance);\n }\n\n return [hue, chroma, luminance];\n }\n\n private static darkReferenceColor(backgroundRgb: Array<number>, textRgb: Array<number>) {\n let referenceRgb = backgroundRgb;\n const [hue, chroma, l] = NeonColorUtils.rgbToHcl(referenceRgb);\n let luminance = l;\n // check contrast and adjust lightness down if contrast ratio too low\n while (NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {\n luminance = luminance - 1;\n referenceRgb = NeonColorUtils.hclToRgb(hue, chroma, luminance);\n }\n\n return [hue, chroma, luminance];\n }\n}\n"],"names":["_NeonColorUtils","r","g","b","a","v","hexString","rgb","r1","g1","b1","x","y","z","l","lab","rgb1","rgb2","ratio","result","lum1","lum2","brightest","darkest","rHex","gHex","bHex","referenceColor","darkTextHex","lightTextHex","referenceRgb","darkTextRgb","lightTextRgb","hue","_rest","_l1Hue","l1Chroma","l1Luminance","_d1Hue","_d1Chroma","d1Luminance","chromaCurve","luminanceCurve","chroma","lStep","dStep","lightLuminance","darkLuminance","t","value","v1","c","h","channel","backgroundColor","textColor","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C,EATWD,EASI,QAAQ,WACvBC,EAVWD,EAUI,QAAQ,YACvBC,EAXWD,EAWI,mBAAmB,KAAK,GAAK,KAC5CC,EAZWD,EAYI,mBAAmB,IAAM,KAAK,IAE7CC,EAdWD,EAcI,QAAQ"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
const _NeonColorUtils = class {
|
|
8
|
+
static luminance([r, g, b]) {
|
|
9
|
+
const a = [r, g, b].map((v) => {
|
|
10
|
+
v /= 255;
|
|
11
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, _NeonColorUtils.gamma);
|
|
12
|
+
});
|
|
13
|
+
return a[0] * _NeonColorUtils.red + a[1] * _NeonColorUtils.green + a[2] * _NeonColorUtils.blue;
|
|
14
|
+
}
|
|
15
|
+
static toRgb(hexString) {
|
|
16
|
+
return [
|
|
17
|
+
Number.parseInt(hexString.substring(1, 3), 16),
|
|
18
|
+
Number.parseInt(hexString.substring(3, 5), 16),
|
|
19
|
+
Number.parseInt(hexString.substring(5, 7), 16)
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
static rgbToXyz(rgb) {
|
|
23
|
+
const [r, g, b] = rgb;
|
|
24
|
+
const r1 = _NeonColorUtils.rgbValueToXyz(r);
|
|
25
|
+
const g1 = _NeonColorUtils.rgbValueToXyz(g);
|
|
26
|
+
const b1 = _NeonColorUtils.rgbValueToXyz(b);
|
|
27
|
+
const x = _NeonColorUtils.xyzToLab((0.4124564 * r1 + 0.3575761 * g1 + 0.1804375 * b1) / _NeonColorUtils.labXn);
|
|
28
|
+
const y = _NeonColorUtils.xyzToLab((0.2126729 * r1 + 0.7151522 * g1 + 0.072175 * b1) / _NeonColorUtils.labYn);
|
|
29
|
+
const z = _NeonColorUtils.xyzToLab((0.0193339 * r1 + 0.119192 * g1 + 0.9503041 * b1) / _NeonColorUtils.labZn);
|
|
30
|
+
return [x, y, z];
|
|
31
|
+
}
|
|
32
|
+
static rgbToLab(rgb) {
|
|
33
|
+
const [x, y, z] = _NeonColorUtils.rgbToXyz(rgb);
|
|
34
|
+
const l = 116 * y - 16;
|
|
35
|
+
return [Math.max(l, 0), 500 * (x - y), 200 * (y - z)];
|
|
36
|
+
}
|
|
37
|
+
static rgbToHcl(rgb) {
|
|
38
|
+
const lab = _NeonColorUtils.rgbToLab(rgb);
|
|
39
|
+
return _NeonColorUtils.labToHcl(lab);
|
|
40
|
+
}
|
|
41
|
+
static isAccessible(rgb1, rgb2) {
|
|
42
|
+
const ratio = _NeonColorUtils.contrast(_NeonColorUtils.toRgb(rgb1), _NeonColorUtils.toRgb(rgb2));
|
|
43
|
+
const result = {
|
|
44
|
+
largeAA: false,
|
|
45
|
+
largeAAA: false,
|
|
46
|
+
normalAA: false,
|
|
47
|
+
normalAAA: false,
|
|
48
|
+
ratio: Math.round(100 * ratio) / 100
|
|
49
|
+
};
|
|
50
|
+
if (ratio >= 3) {
|
|
51
|
+
result.largeAA = true;
|
|
52
|
+
if (ratio >= 4.5) {
|
|
53
|
+
result.normalAA = true;
|
|
54
|
+
result.largeAAA = true;
|
|
55
|
+
if (ratio >= 7) {
|
|
56
|
+
result.normalAAA = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
static contrast(rgb1, rgb2) {
|
|
63
|
+
const lum1 = _NeonColorUtils.luminance(rgb1);
|
|
64
|
+
const lum2 = _NeonColorUtils.luminance(rgb2);
|
|
65
|
+
const brightest = Math.max(lum1, lum2);
|
|
66
|
+
const darkest = Math.min(lum1, lum2);
|
|
67
|
+
return (brightest + 0.05) / (darkest + 0.05);
|
|
68
|
+
}
|
|
69
|
+
static rgbToHex(rgb) {
|
|
70
|
+
const [r, g, b] = rgb;
|
|
71
|
+
const rHex = r.toString(16);
|
|
72
|
+
const gHex = g.toString(16);
|
|
73
|
+
const bHex = b.toString(16);
|
|
74
|
+
return `#${rHex.length === 1 ? `0${rHex}` : rHex}${gHex.length === 1 ? `0${gHex}` : gHex}${bHex.length === 1 ? `0${bHex}` : bHex}`;
|
|
75
|
+
}
|
|
76
|
+
static generatePalette(referenceColor, darkTextHex, lightTextHex) {
|
|
77
|
+
const referenceRgb = _NeonColorUtils.toRgb(referenceColor);
|
|
78
|
+
const [r, g, b] = referenceRgb;
|
|
79
|
+
const darkTextRgb = _NeonColorUtils.toRgb(darkTextHex);
|
|
80
|
+
const lightTextRgb = _NeonColorUtils.toRgb(lightTextHex);
|
|
81
|
+
const [hue, _rest] = _NeonColorUtils.rgbToHcl(referenceRgb);
|
|
82
|
+
const [_l1Hue, l1Chroma, l1Luminance] = _NeonColorUtils.lightReferenceColor(referenceRgb, darkTextRgb);
|
|
83
|
+
const [_d1Hue, _d1Chroma, d1Luminance] = _NeonColorUtils.darkReferenceColor(referenceRgb, lightTextRgb);
|
|
84
|
+
const chromaCurve = _NeonColorUtils.generateChromaCurve(l1Chroma);
|
|
85
|
+
const luminanceCurve = _NeonColorUtils.generateLuminanceCurve(l1Luminance, d1Luminance);
|
|
86
|
+
if (b > 2 * g && b > 2 * r) {
|
|
87
|
+
return {
|
|
88
|
+
l5: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 30, chromaCurve[0], luminanceCurve[0])),
|
|
89
|
+
l4: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 25, chromaCurve[1], luminanceCurve[1])),
|
|
90
|
+
l3: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 20, chromaCurve[2], luminanceCurve[2])),
|
|
91
|
+
l2: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 15, chromaCurve[3], luminanceCurve[3])),
|
|
92
|
+
l1: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[4], luminanceCurve[4])),
|
|
93
|
+
d1: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[5], luminanceCurve[5])),
|
|
94
|
+
d2: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[6], luminanceCurve[6])),
|
|
95
|
+
d3: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[7], luminanceCurve[7])),
|
|
96
|
+
d4: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[8], luminanceCurve[8])),
|
|
97
|
+
d5: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue - 10, chromaCurve[9], luminanceCurve[9]))
|
|
98
|
+
};
|
|
99
|
+
} else {
|
|
100
|
+
return {
|
|
101
|
+
l5: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[0], luminanceCurve[0])),
|
|
102
|
+
l4: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[1], luminanceCurve[1])),
|
|
103
|
+
l3: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[2], luminanceCurve[2])),
|
|
104
|
+
l2: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[3], luminanceCurve[3])),
|
|
105
|
+
l1: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[4], luminanceCurve[4])),
|
|
106
|
+
d1: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[5], luminanceCurve[5])),
|
|
107
|
+
d2: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[6], luminanceCurve[6])),
|
|
108
|
+
d3: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[7], luminanceCurve[7])),
|
|
109
|
+
d4: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[8], luminanceCurve[8])),
|
|
110
|
+
d5: _NeonColorUtils.rgbToHex(_NeonColorUtils.hclToRgb(hue, chromaCurve[9], luminanceCurve[9]))
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
static generateChromaCurve(chroma) {
|
|
115
|
+
const lStep = 0.25 * Math.abs(chroma - 10);
|
|
116
|
+
const dStep = 0.25 * Math.abs(chroma - 10);
|
|
117
|
+
return [
|
|
118
|
+
chroma - 4 * lStep,
|
|
119
|
+
chroma - 3 * lStep + 4,
|
|
120
|
+
chroma - 2 * lStep + 6,
|
|
121
|
+
chroma - lStep + 4,
|
|
122
|
+
chroma,
|
|
123
|
+
chroma,
|
|
124
|
+
chroma - dStep + 4,
|
|
125
|
+
chroma - 2 * dStep + 6,
|
|
126
|
+
chroma - 3 * dStep + 4,
|
|
127
|
+
chroma - 4 * dStep
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
static generateLuminanceCurve(lightLuminance, darkLuminance) {
|
|
131
|
+
const lStep = 0.25 * (96 - lightLuminance);
|
|
132
|
+
const dStep = 0.25 * (darkLuminance - 10);
|
|
133
|
+
return [
|
|
134
|
+
lightLuminance + 4 * lStep,
|
|
135
|
+
lightLuminance + 3 * lStep,
|
|
136
|
+
lightLuminance + 2 * lStep,
|
|
137
|
+
lightLuminance + lStep,
|
|
138
|
+
lightLuminance,
|
|
139
|
+
darkLuminance,
|
|
140
|
+
darkLuminance - dStep + 2,
|
|
141
|
+
darkLuminance - 2 * dStep + 1,
|
|
142
|
+
darkLuminance - 3 * dStep - 1,
|
|
143
|
+
darkLuminance - 4 * dStep
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
static xyzToLab(t) {
|
|
147
|
+
return t > _NeonColorUtils.labT3 ? Math.pow(t, 1 / 3) : t / _NeonColorUtils.labT2 + _NeonColorUtils.labT0;
|
|
148
|
+
}
|
|
149
|
+
static rgbValueToXyz(value) {
|
|
150
|
+
const v1 = value / 255;
|
|
151
|
+
return v1 <= 0.04045 ? v1 / 12.92 : Math.pow((v1 + 0.055) / 1.055, 2.4);
|
|
152
|
+
}
|
|
153
|
+
static labToHcl(lab) {
|
|
154
|
+
const [l, a, b] = lab;
|
|
155
|
+
const c = Math.sqrt(a * a + b * b);
|
|
156
|
+
const h = (Math.atan2(b, a) * _NeonColorUtils.radiansToDegrees + 360) % 360;
|
|
157
|
+
return [Math.round(h), c, l];
|
|
158
|
+
}
|
|
159
|
+
static luminanceByChannel(channel) {
|
|
160
|
+
return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
|
|
161
|
+
}
|
|
162
|
+
static relativeLuminance(rgb) {
|
|
163
|
+
const [r, g, b] = rgb;
|
|
164
|
+
const r1 = _NeonColorUtils.luminanceByChannel(r / 255);
|
|
165
|
+
const g1 = _NeonColorUtils.luminanceByChannel(g / 255);
|
|
166
|
+
const b1 = _NeonColorUtils.luminanceByChannel(b / 255);
|
|
167
|
+
return 0.2126 * r1 + 0.7152 * g1 + 0.0722 * b1;
|
|
168
|
+
}
|
|
169
|
+
static contrastRatio(backgroundColor, textColor) {
|
|
170
|
+
const lum1 = _NeonColorUtils.relativeLuminance(backgroundColor);
|
|
171
|
+
const lum2 = _NeonColorUtils.relativeLuminance(textColor);
|
|
172
|
+
const lightest = Math.max(lum1, lum2);
|
|
173
|
+
const darkest = Math.min(lum1, lum2);
|
|
174
|
+
const contrast = (lightest + 0.05) / (darkest + 0.05);
|
|
175
|
+
return Math.floor(contrast * 100) / 100;
|
|
176
|
+
}
|
|
177
|
+
static labToXyz(t) {
|
|
178
|
+
return t > _NeonColorUtils.labT1 ? t * t * t : _NeonColorUtils.labT2 * (t - _NeonColorUtils.labT0);
|
|
179
|
+
}
|
|
180
|
+
static xyzToRgb(r) {
|
|
181
|
+
return r <= 304e-5 ? 255 * 12.92 * r : 255 * (1.055 * Math.pow(r, 1 / 2.4) - 0.055);
|
|
182
|
+
}
|
|
183
|
+
static labToRgb(l, a, b) {
|
|
184
|
+
const y0 = (l + 16) / 116;
|
|
185
|
+
const x0 = y0 + a / 500;
|
|
186
|
+
const z0 = y0 - b / 200;
|
|
187
|
+
const x1 = _NeonColorUtils.labXn * _NeonColorUtils.labToXyz(x0);
|
|
188
|
+
const y1 = _NeonColorUtils.labYn * _NeonColorUtils.labToXyz(y0);
|
|
189
|
+
const z1 = _NeonColorUtils.labZn * _NeonColorUtils.labToXyz(z0);
|
|
190
|
+
const r = Math.round(
|
|
191
|
+
Math.min(255, Math.max(0, _NeonColorUtils.xyzToRgb(3.2404542 * x1 - 1.5371385 * y1 - 0.4985314 * z1)))
|
|
192
|
+
);
|
|
193
|
+
const g = Math.round(
|
|
194
|
+
Math.min(255, Math.max(0, _NeonColorUtils.xyzToRgb(-0.969266 * x1 + 1.8760108 * y1 + 0.041556 * z1)))
|
|
195
|
+
);
|
|
196
|
+
const b_ = Math.round(
|
|
197
|
+
Math.min(255, Math.max(0, _NeonColorUtils.xyzToRgb(0.0556434 * x1 - 0.2040259 * y1 + 1.0572252 * z1)))
|
|
198
|
+
);
|
|
199
|
+
return [r, g, b_];
|
|
200
|
+
}
|
|
201
|
+
static hclToLab(h, c, l) {
|
|
202
|
+
const hue = h * _NeonColorUtils.degreesToRadians;
|
|
203
|
+
return [l, Math.cos(hue) * c, Math.sin(hue) * c];
|
|
204
|
+
}
|
|
205
|
+
static hclToRgb(h, c, l) {
|
|
206
|
+
const [l_, a, b] = _NeonColorUtils.hclToLab(h, c, l);
|
|
207
|
+
return _NeonColorUtils.labToRgb(l_, a, b);
|
|
208
|
+
}
|
|
209
|
+
static lightReferenceColor(backgroundRgb, textRgb) {
|
|
210
|
+
let referenceRgb = backgroundRgb;
|
|
211
|
+
const [hue, chroma, l] = _NeonColorUtils.rgbToHcl(referenceRgb);
|
|
212
|
+
let luminance = l;
|
|
213
|
+
while (_NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {
|
|
214
|
+
luminance = luminance + 1;
|
|
215
|
+
referenceRgb = _NeonColorUtils.hclToRgb(hue, chroma, luminance);
|
|
216
|
+
}
|
|
217
|
+
return [hue, chroma, luminance];
|
|
218
|
+
}
|
|
219
|
+
static darkReferenceColor(backgroundRgb, textRgb) {
|
|
220
|
+
let referenceRgb = backgroundRgb;
|
|
221
|
+
const [hue, chroma, l] = _NeonColorUtils.rgbToHcl(referenceRgb);
|
|
222
|
+
let luminance = l;
|
|
223
|
+
while (_NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {
|
|
224
|
+
luminance = luminance - 1;
|
|
225
|
+
referenceRgb = _NeonColorUtils.hclToRgb(hue, chroma, luminance);
|
|
226
|
+
}
|
|
227
|
+
return [hue, chroma, luminance];
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
let NeonColorUtils = _NeonColorUtils;
|
|
231
|
+
__publicField(NeonColorUtils, "red", 0.2126);
|
|
232
|
+
__publicField(NeonColorUtils, "green", 0.7152);
|
|
233
|
+
__publicField(NeonColorUtils, "blue", 0.0722);
|
|
234
|
+
__publicField(NeonColorUtils, "labXn", 0.95047);
|
|
235
|
+
__publicField(NeonColorUtils, "labYn", 1);
|
|
236
|
+
__publicField(NeonColorUtils, "labZn", 1.08883);
|
|
237
|
+
__publicField(NeonColorUtils, "labT0", 0.137931034);
|
|
238
|
+
__publicField(NeonColorUtils, "labT1", 0.206896552);
|
|
239
|
+
__publicField(NeonColorUtils, "labT2", 0.12841855);
|
|
240
|
+
__publicField(NeonColorUtils, "labT3", 8856452e-9);
|
|
241
|
+
__publicField(NeonColorUtils, "degreesToRadians", Math.PI / 180);
|
|
242
|
+
__publicField(NeonColorUtils, "radiansToDegrees", 180 / Math.PI);
|
|
243
|
+
__publicField(NeonColorUtils, "gamma", 2.4);
|
|
244
|
+
export { NeonColorUtils };
|
|
245
|
+
//# sourceMappingURL=NeonColorUtils.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeonColorUtils.es.js","sources":["../../../src/common/utils/NeonColorUtils.ts"],"sourcesContent":["import type { NeonContrastAccessibility } from '@/common/models/NeonContrastAccessibility';\n\n/**\n * Utility class with helpers for calculating relative contrast & determining accessibility.\n */\nexport class NeonColorUtils {\n private static red = 0.2126;\n private static green = 0.7152;\n private static blue = 0.0722;\n private static labXn = 0.95047;\n private static labYn = 1;\n private static labZn = 1.08883;\n private static labT0 = 0.137931034; // 4 / 29\n private static labT1 = 0.206896552; // 6 / 29\n private static labT2 = 0.12841855; // 3 * t1 * t1\n private static labT3 = 0.008856452; // t1 * t1 * t1\n private static degreesToRadians = Math.PI / 180;\n private static radiansToDegrees = 180 / Math.PI;\n\n private static gamma = 2.4;\n\n public static luminance([r, g, b]: Array<number>) {\n const a = [r, g, b].map((v) => {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, NeonColorUtils.gamma);\n });\n return a[0] * NeonColorUtils.red + a[1] * NeonColorUtils.green + a[2] * NeonColorUtils.blue;\n }\n\n public static toRgb(hexString: string): Array<number> {\n return [\n Number.parseInt(hexString.substring(1, 3), 16),\n Number.parseInt(hexString.substring(3, 5), 16),\n Number.parseInt(hexString.substring(5, 7), 16),\n ];\n }\n\n public static rgbToXyz(rgb: Array<number>): Array<number> {\n const [r, g, b] = rgb;\n const r1 = NeonColorUtils.rgbValueToXyz(r);\n const g1 = NeonColorUtils.rgbValueToXyz(g);\n const b1 = NeonColorUtils.rgbValueToXyz(b);\n\n const x = NeonColorUtils.xyzToLab((0.4124564 * r1 + 0.3575761 * g1 + 0.1804375 * b1) / NeonColorUtils.labXn);\n const y = NeonColorUtils.xyzToLab((0.2126729 * r1 + 0.7151522 * g1 + 0.072175 * b1) / NeonColorUtils.labYn);\n const z = NeonColorUtils.xyzToLab((0.0193339 * r1 + 0.119192 * g1 + 0.9503041 * b1) / NeonColorUtils.labZn);\n\n return [x, y, z];\n }\n\n public static rgbToLab(rgb: Array<number>): Array<number> {\n const [x, y, z] = NeonColorUtils.rgbToXyz(rgb);\n const l = 116 * y - 16;\n return [Math.max(l, 0), 500 * (x - y), 200 * (y - z)];\n }\n\n public static rgbToHcl(rgb: Array<number>): Array<number> {\n const lab = NeonColorUtils.rgbToLab(rgb);\n return NeonColorUtils.labToHcl(lab);\n }\n\n public static isAccessible(rgb1: string, rgb2: string): NeonContrastAccessibility {\n const ratio = NeonColorUtils.contrast(NeonColorUtils.toRgb(rgb1), NeonColorUtils.toRgb(rgb2));\n\n const result = {\n largeAA: false,\n largeAAA: false,\n normalAA: false,\n normalAAA: false,\n ratio: Math.round(100 * ratio) / 100,\n };\n\n if (ratio >= 3) {\n result.largeAA = true;\n\n if (ratio >= 4.5) {\n result.normalAA = true;\n result.largeAAA = true;\n\n if (ratio >= 7) {\n result.normalAAA = true;\n }\n }\n }\n\n return result;\n }\n\n public static contrast(rgb1: Array<number>, rgb2: Array<number>) {\n const lum1 = NeonColorUtils.luminance(rgb1);\n const lum2 = NeonColorUtils.luminance(rgb2);\n const brightest = Math.max(lum1, lum2);\n const darkest = Math.min(lum1, lum2);\n return (brightest + 0.05) / (darkest + 0.05);\n }\n\n public static rgbToHex(rgb: Array<number>): string {\n const [r, g, b] = rgb;\n const rHex = r.toString(16);\n const gHex = g.toString(16);\n const bHex = b.toString(16);\n return `#${rHex.length === 1 ? `0${rHex}` : rHex}${gHex.length === 1 ? `0${gHex}` : gHex}${\n bHex.length === 1 ? `0${bHex}` : bHex\n }`;\n }\n\n public static generatePalette(\n referenceColor: string,\n darkTextHex: string,\n lightTextHex: string,\n ): Record<string, string> {\n const referenceRgb = NeonColorUtils.toRgb(referenceColor);\n const [r, g, b] = referenceRgb;\n const darkTextRgb = NeonColorUtils.toRgb(darkTextHex);\n const lightTextRgb = NeonColorUtils.toRgb(lightTextHex);\n\n const [hue, _rest] = NeonColorUtils.rgbToHcl(referenceRgb);\n\n const [_l1Hue, l1Chroma, l1Luminance] = NeonColorUtils.lightReferenceColor(referenceRgb, darkTextRgb);\n const [_d1Hue, _d1Chroma, d1Luminance] = NeonColorUtils.darkReferenceColor(referenceRgb, lightTextRgb);\n\n const chromaCurve = NeonColorUtils.generateChromaCurve(l1Chroma);\n const luminanceCurve = NeonColorUtils.generateLuminanceCurve(l1Luminance, d1Luminance);\n\n // if blue is the dominant channel then adjust hue so it's not too purple\n // TODO: rework for some blue colors as they are still too purple\n if (b > 2 * g && b > 2 * r) {\n return {\n l5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 30, chromaCurve[0], luminanceCurve[0])),\n l4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 25, chromaCurve[1], luminanceCurve[1])),\n l3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 20, chromaCurve[2], luminanceCurve[2])),\n l2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 15, chromaCurve[3], luminanceCurve[3])),\n l1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[4], luminanceCurve[4])),\n d1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[5], luminanceCurve[5])),\n d2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[6], luminanceCurve[6])),\n d3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[7], luminanceCurve[7])),\n d4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[8], luminanceCurve[8])),\n d5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue - 10, chromaCurve[9], luminanceCurve[9])),\n };\n } else {\n return {\n l5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[0], luminanceCurve[0])),\n l4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[1], luminanceCurve[1])),\n l3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[2], luminanceCurve[2])),\n l2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[3], luminanceCurve[3])),\n l1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[4], luminanceCurve[4])),\n d1: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[5], luminanceCurve[5])),\n d2: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[6], luminanceCurve[6])),\n d3: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[7], luminanceCurve[7])),\n d4: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[8], luminanceCurve[8])),\n d5: NeonColorUtils.rgbToHex(NeonColorUtils.hclToRgb(hue, chromaCurve[9], luminanceCurve[9])),\n };\n }\n }\n\n private static generateChromaCurve(chroma: number) {\n const lStep = 0.25 * Math.abs(chroma - 10);\n const dStep = 0.25 * Math.abs(chroma - 10);\n\n return [\n chroma - 4 * lStep,\n chroma - 3 * lStep + 4,\n chroma - 2 * lStep + 6,\n chroma - lStep + 4,\n chroma,\n chroma,\n chroma - dStep + 4,\n chroma - 2 * dStep + 6,\n chroma - 3 * dStep + 4,\n chroma - 4 * dStep,\n ];\n }\n\n private static generateLuminanceCurve(lightLuminance: number, darkLuminance: number) {\n const lStep = 0.25 * (96 - lightLuminance);\n const dStep = 0.25 * (darkLuminance - 10);\n\n return [\n lightLuminance + 4 * lStep,\n lightLuminance + 3 * lStep,\n lightLuminance + 2 * lStep,\n lightLuminance + lStep,\n lightLuminance,\n darkLuminance,\n darkLuminance - dStep + 2,\n darkLuminance - 2 * dStep + 1,\n darkLuminance - 3 * dStep - 1,\n darkLuminance - 4 * dStep,\n ];\n }\n\n private static xyzToLab(t: number) {\n return t > NeonColorUtils.labT3 ? Math.pow(t, 1 / 3) : t / NeonColorUtils.labT2 + NeonColorUtils.labT0;\n }\n\n private static rgbValueToXyz(value: number) {\n const v1 = value / 255;\n return v1 <= 0.04045 ? v1 / 12.92 : Math.pow((v1 + 0.055) / 1.055, 2.4);\n }\n\n private static labToHcl(lab: Array<number>) {\n const [l, a, b] = lab;\n const c = Math.sqrt(a * a + b * b);\n const h = (Math.atan2(b, a) * NeonColorUtils.radiansToDegrees + 360) % 360;\n return [Math.round(h), c, l];\n }\n\n private static luminanceByChannel(channel: number) {\n return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);\n }\n\n private static relativeLuminance(rgb: Array<number>) {\n const [r, g, b] = rgb;\n const r1 = NeonColorUtils.luminanceByChannel(r / 255);\n const g1 = NeonColorUtils.luminanceByChannel(g / 255);\n const b1 = NeonColorUtils.luminanceByChannel(b / 255);\n return 0.2126 * r1 + 0.7152 * g1 + 0.0722 * b1;\n }\n\n private static contrastRatio(backgroundColor: Array<number>, textColor: Array<number>) {\n const lum1 = NeonColorUtils.relativeLuminance(backgroundColor);\n const lum2 = NeonColorUtils.relativeLuminance(textColor);\n\n const lightest = Math.max(lum1, lum2);\n const darkest = Math.min(lum1, lum2);\n\n const contrast = (lightest + 0.05) / (darkest + 0.05);\n\n return Math.floor(contrast * 100) / 100;\n }\n\n private static labToXyz(t: number) {\n return t > NeonColorUtils.labT1 ? t * t * t : NeonColorUtils.labT2 * (t - NeonColorUtils.labT0);\n }\n\n private static xyzToRgb(r: number) {\n return r <= 0.00304 ? 255 * 12.92 * r : 255 * (1.055 * Math.pow(r, 1 / 2.4) - 0.055);\n }\n\n private static labToRgb(l: number, a: number, b: number): Array<number> {\n const y0 = (l + 16) / 116;\n const x0 = y0 + a / 500;\n const z0 = y0 - b / 200;\n\n const x1 = NeonColorUtils.labXn * NeonColorUtils.labToXyz(x0);\n const y1 = NeonColorUtils.labYn * NeonColorUtils.labToXyz(y0);\n const z1 = NeonColorUtils.labZn * NeonColorUtils.labToXyz(z0);\n const r = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(3.2404542 * x1 - 1.5371385 * y1 - 0.4985314 * z1))),\n ); // D65 -> sRGB\n const g = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(-0.969266 * x1 + 1.8760108 * y1 + 0.041556 * z1))),\n );\n const b_ = Math.round(\n Math.min(255, Math.max(0, NeonColorUtils.xyzToRgb(0.0556434 * x1 - 0.2040259 * y1 + 1.0572252 * z1))),\n );\n\n return [r, g, b_];\n }\n\n private static hclToLab(h: number, c: number, l: number) {\n const hue = h * NeonColorUtils.degreesToRadians;\n return [l, Math.cos(hue) * c, Math.sin(hue) * c];\n }\n\n private static hclToRgb(h: number, c: number, l: number): Array<number> {\n const [l_, a, b] = NeonColorUtils.hclToLab(h, c, l);\n return NeonColorUtils.labToRgb(l_, a, b);\n }\n\n private static lightReferenceColor(backgroundRgb: Array<number>, textRgb: Array<number>) {\n let referenceRgb = backgroundRgb;\n const [hue, chroma, l] = NeonColorUtils.rgbToHcl(referenceRgb);\n let luminance = l;\n // check contrast and adjust lightness up if contrast ratio too low\n while (NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {\n luminance = luminance + 1;\n referenceRgb = NeonColorUtils.hclToRgb(hue, chroma, luminance);\n }\n\n return [hue, chroma, luminance];\n }\n\n private static darkReferenceColor(backgroundRgb: Array<number>, textRgb: Array<number>) {\n let referenceRgb = backgroundRgb;\n const [hue, chroma, l] = NeonColorUtils.rgbToHcl(referenceRgb);\n let luminance = l;\n // check contrast and adjust lightness down if contrast ratio too low\n while (NeonColorUtils.contrastRatio(referenceRgb, textRgb) < 4.5) {\n luminance = luminance - 1;\n referenceRgb = NeonColorUtils.hclToRgb(hue, chroma, luminance);\n }\n\n return [hue, chroma, luminance];\n }\n}\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,kBAAN,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Ac,cAAc,OAAO,IAAI,KAAK;AAChE,kBAAY,YAAY;AACxB,qBAAe,gBAAe,SAAS,KAAK,QAAQ,SAAS;AAAA,IAC/D;AAEO,WAAA,CAAC,KAAK,QAAQ,SAAS;AAAA,EAChC;AACF;AAlSO,IAAM,iBAAN;AACL,cADW,gBACI,OAAM;AACrB,cAFW,gBAEI,SAAQ;AACvB,cAHW,gBAGI,QAAO;AACtB,cAJW,gBAII,SAAQ;AACvB,cALW,gBAKI,SAAQ;AACvB,cANW,gBAMI,SAAQ;AACvB,cAPW,gBAOI,SAAQ;AACvB,cARW,gBAQI,SAAQ;AACvB,cATW,gBASI,SAAQ;AACvB,cAVW,gBAUI,SAAQ;AACvB,cAXW,gBAWI,oBAAmB,KAAK,KAAK;AAC5C,cAZW,gBAYI,oBAAmB,MAAM,KAAK;AAE7C,cAdW,gBAcI,SAAQ;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class i{static stringToNeonDate(t,o,e=!1){const a=o||navigator.language,g=new Date,n=new Date(!e&&t.length===10?`${t}T${g.toISOString().split("T")[1]}`:t);let r;t.length>10&&(r=n.toLocaleString(a,t.length<=16?{hour12:!1,hour:"2-digit",minute:"2-digit"}:{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}));const u={year:+n.toLocaleString("en-US",{year:"numeric"}),yearFormatted:n.toLocaleString(a,{year:"numeric"}),month:+n.toLocaleString("en-US",{month:"numeric"}),monthShortName:n.toLocaleString(a,{month:"short"}),monthLongName:n.toLocaleString(a,{month:"long"}),day:+n.toLocaleString("en-US",{day:"numeric"}),dayFormatted:n.toLocaleString(a,{day:"2-digit"})};return r&&(u.time=r),u}static dateToIso(t,o=!1){const e=t.toISOString();return o?e:e.split("T")[0]}static dmyToIso(t,o,e){return`${e}-${o<10?"0"+o:o}-${t<10?"0"+t:t}`}static dowNames(t){const o=t||navigator.language,e=new Date,a=[];for(;!a[e.getDay()];)a[e.getDay()]=e.toLocaleString(o,{weekday:"short"}),e.setDate(e.getDate()+1);const g=a.shift();return g&&a.push(g),a}static monthNames(t){const o=t||navigator.language;return Array.from(Array(12).keys()).map(e=>new Date(2023,e,15).toLocaleString(o,{month:"short"}))}static toCalendarConfiguration(t,o,e,a,g){const n=g||navigator.language,r=i.stringToNeonDate(i.dateToIso(new Date),n),u=t?i.stringToNeonDate(t,n,!0):void 0,h=o||r.month,S=o&&e?new Date(e,o-1,15):null,L=(S==null?void 0:S.toLocaleString(n,{month:"long"}))||r.monthLongName,d=e||r.year,T=a||Math.floor(d/10)*10,c=new Date(d,(h+11)%12,1),f=new Date(d,(h+11)%12,1);f.setDate(f.getDate()-1);const m=[];let y=1,w=!1;for(let s=0;s<6;s++){m[s]=[];for(let l=0;l<7;l++)if(s===0&&l<f.getDay())m[s][l]=null;else if(m[s][l]=c.getDate(),y=c.getDate(),c.setDate(c.getDate()+1),c.getDate()===1){for(let D=l+1;D<7;D++)m[s][D]=null;w=!0;break}if(w)break}return{today:r,selected:u,pageMonth:h,pageMonthName:L,pageYear:d,pageDecadeStart:T,dowNames:i.dowNames(n),dates:m,lastDayOfMonth:y,months:i.monthNames(n)}}}exports.NeonDateUtils=i;
|
|
2
2
|
//# sourceMappingURL=NeonDateUtils.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecade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O,GAEX,QAASC,EAAM,EAAGA,EAAM,EAAGA,IAAO,CAChCH,EAAMG,GAAO,GAEb,QAASC,EAAM,EAAGA,EAAM,EAAGA,IACzB,GAAID,IAAQ,GAAKC,EAAML,EAAW,SAChCC,EAAMG,GAAKC,GAAO,aAEZJ,EAAAG,GAAKC,GAAO/B,EAAK,QAAQ,EAC/B4B,EAAiB5B,EAAK,UACtBA,EAAK,QAAQA,EAAK,QAAQ,EAAI,CAAC,EAE3BA,EAAK,QAAQ,IAAM,EAAG,CACxB,QAASgC,EAAID,EAAM,EAAGC,EAAI,EAAGA,IAC3BL,EAAMG,GAAKE,GAAK,KAEXH,EAAA,GACP,KACF,CAIJ,GAAIA,EACF,KAEJ,CAEO,MAAA,CACL,MAAAV,EACA,SAAAC,EACA,UAAAC,EACA,cAAAE,EACA,SAAAC,EACA,gBAAAC,EACA,SAAU1B,EAAc,SAASI,CAAG,EACpC,MAAAwB,EACA,eAAAC,EACA,OAAQ7B,EAAc,WAAWI,CAAG,CAAA,CAExC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":[],"mappings":"AAGO,MAAM,cAAc;AAAA,EAOzB,OAAc,iBAAiB,MAAc,QAAiB,SAAS,OAAiB;AAChF,UAAA,MAAM,UAAU,UAAU;AAC1B,UAAA,MAAM,IAAI;AAChB,UAAM,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,WAAW,KAAK,GAAG,QAAQ,IAAI,YAAY,EAAE,MAAM,GAAG,EAAE,OAAO,IAAI;AACxG,QAAA;AACA,QAAA,KAAK,SAAS,IAAI;AACpB,aAAO,QAAQ;AAAA,QACb;AAAA,QACA,KAAK,UAAU,KACX,EAAE,QAAQ,OAAO,MAAM,WAAW,QAAQ,UAC1C,IAAA,EA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K,QAAQ;AAC/B,2BAAiB,KAAK;AACtB,eAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAE3B,cAAA,KAAK,QAAQ,MAAM,GAAG;AACxB,qBAAS,IAAI,MAAM,GAAG,IAAI,GAAG,KAAK;AAChC,oBAAM,KAAK,KAAK;AAAA,YAClB;AACO,mBAAA;AACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,UAAI,MAAM;AACR;AAAA,MACF;AAAA,IACF;AAEO,WAAA;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,cAAc,SAAS,GAAG;AAAA,MACpC;AAAA,MACA;AAAA,MACA,QAAQ,cAAc,WAAW,GAAG;AAAA,IAAA;AAAA,EAExC;AACF;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var A=Object.defineProperty;var C=(S,e,t)=>e in S?A(S,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):S[e]=t;var M=(S,e,t)=>(C(S,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var w=require("./NeonRandomUtils.cjs.js");const i=class{static genSvg(e,t,n){return i.generateIdenticon(e,n,w.NeonRandomUtils.rand(t)).outerHTML}static generateIdenticon(e,t,n){const o=i.hueShift(e.slice(),n),l=document.createElementNS(i.svgns,"svg");l.setAttribute("xmlns",i.svgns),l.setAttributeNS(null,"x","0"),l.setAttributeNS(null,"y","0"),l.setAttributeNS(null,"width",`${t}`),l.setAttributeNS(null,"height",`${t}`),i.genShape([i.genColor(o,n)],t,0,i.shapeCount-1,l,()=>0);for(let r=0;r<i.shapeCount-1;r++)i.genShape(o,t,r,i.shapeCount-1,l,n);return l}static genShape(e,t,n,o,l,r){const u=t/2,s=document.createElementNS(i.svgns,"rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",`${t}`),s.setAttributeNS(null,"height",`${t}`);const a=r(),c=Math.PI*2*a,h=t/o*r()+n*t/o,b=Math.cos(c)*h,f=Math.sin(c)*h,p=`translate(${b} ${f})`,d=r(),x=a*360+d*180,m="rotate("+x.toFixed(1)+" "+u+" "+u+")",v=p+" "+m;s.setAttributeNS(null,"transform",v);const N=i.genColor(e,r);s.setAttributeNS(null,"fill",N),l.appendChild(s)}static genColor(e,t){const n=Math.floor(e.length*t());return e.splice(n,1)[0]}static hueShift(e,t){const n=t()*30-i.wobble/2,o=l=>i.colorRotate(l,n);return e.map(o)}static colorRotate(e,t){const n=i.hexToHSL(e);let o=n.h;return o=(o+t)%360,o=o<0?360+o:o,n.h=o,i.hslToHex(n)}static hexToHSL(e){let t=+("0x"+e[1]+e[2]),n=+("0x"+e[3]+e[4]),o=+("0x"+e[5]+e[6]);t/=255,n/=255,o/=255;const l=Math.min(t,n,o),r=Math.max(t,n,o),u=r-l;let s=0,a=0,c=0;return u===0?s=0:r===t?s=(n-o)/u%6:r===n?s=(o-t)/u+2:s=(t-n)/u+4,s=Math.round(s*60),s<0&&(s+=360),c=(r+l)/2,a=u===0?0:u/(1-Math.abs(2*c-1)),a=+(a*100).toFixed(1),c=+(c*100).toFixed(1),{h:s,s:a,l:c}}static hslToHex(e){const t=e.h;let{s:n,l:o}=e;n/=100,o/=100;const l=(1-Math.abs(2*o-1))*n,r=l*(1-Math.abs(t/60%2-1)),u=o-l/2;let s=0,a=0,c=0;t>=0&&t<60?(s=l,a=r,c=0):t>=60&&t<120?(s=r,a=l,c=0):t>=120&&t<180?(s=0,a=l,c=r):t>=180&&t<240?(s=0,a=r,c=l):t>=240&&t<300?(s=r,a=0,c=l):t>=300&&t<360&&(s=l,a=0,c=r);let h=Math.round((s+u)*255).toString(16),b=Math.round((a+u)*255).toString(16),f=Math.round((c+u)*255).toString(16);return h.length===1&&(h="0"+s),b.length===1&&(b="0"+a),f.length===1&&(f="0"+c),"#"+h+b+f}};let g=i;M(g,"shapeCount",4),M(g,"svgns","http://www.w3.org/2000/svg"),M(g,"wobble",30);exports.NeonJazziconUtils=g;
|
|
2
|
+
//# sourceMappingURL=NeonJazziconUtils.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeonJazziconUtils.cjs.js","sources":["../../../src/common/utils/NeonJazziconUtils.ts"],"sourcesContent":["import { NeonRandomUtils } from './NeonRandomUtils';\n\nexport class NeonJazziconUtils {\n private static readonly shapeCount = 4;\n private static readonly svgns = 'http://www.w3.org/2000/svg';\n private static readonly wobble = 30;\n\n /**\n * Returns base-64 encoded data URI\n * @param palette the color palettes to use when generating the Jazzicon\n * @param name used for random seed\n * @param size size in pixels to generate\n */\n public static genSvg(palette: Array<string>, name: string, size: number): string {\n return NeonJazziconUtils.generateIdenticon(palette, size, NeonRandomUtils.rand(name)).outerHTML;\n }\n\n private static generateIdenticon(palette: Array<string>, diameter: number, rand: () => number): SVGElement {\n const remainingColors = NeonJazziconUtils.hueShift(palette.slice(), rand);\n\n const svg = document.createElementNS(NeonJazziconUtils.svgns, 'svg');\n svg.setAttribute('xmlns', NeonJazziconUtils.svgns);\n svg.setAttributeNS(null, 'x', '0');\n svg.setAttributeNS(null, 'y', '0');\n svg.setAttributeNS(null, 'width', `${diameter}`);\n svg.setAttributeNS(null, 'height', `${diameter}`);\n\n NeonJazziconUtils.genShape(\n [NeonJazziconUtils.genColor(remainingColors, rand)],\n diameter,\n 0,\n NeonJazziconUtils.shapeCount - 1,\n svg,\n () => 0,\n );\n\n for (let i = 0; i < NeonJazziconUtils.shapeCount - 1; i++) {\n NeonJazziconUtils.genShape(remainingColors, diameter, i, NeonJazziconUtils.shapeCount - 1, svg, rand);\n }\n\n return svg;\n }\n\n private static genShape(\n remainingColors: string[],\n diameter: number,\n i: number,\n total: number,\n svg: SVGElement,\n rand: () => number,\n ) {\n const center = diameter / 2;\n\n const shape = document.createElementNS(NeonJazziconUtils.svgns, 'rect');\n shape.setAttributeNS(null, 'x', '0');\n shape.setAttributeNS(null, 'y', '0');\n shape.setAttributeNS(null, 'width', `${diameter}`);\n shape.setAttributeNS(null, 'height', `${diameter}`);\n\n const firstRot = rand();\n const angle = Math.PI * 2 * firstRot;\n const velocity = (diameter / total) * rand() + (i * diameter) / total;\n\n const tx = Math.cos(angle) * velocity;\n const ty = Math.sin(angle) * velocity;\n\n const translate = `translate(${tx} ${ty})`;\n\n // Third random is a shape rotation on top of all of that.\n const secondRot = rand();\n const rot = firstRot * 360 + secondRot * 180;\n const rotate = 'rotate(' + rot.toFixed(1) + ' ' + center + ' ' + center + ')';\n const transform = translate + ' ' + rotate;\n shape.setAttributeNS(null, 'transform', transform);\n const fill = NeonJazziconUtils.genColor(remainingColors, rand);\n shape.setAttributeNS(null, 'fill', fill);\n\n svg.appendChild(shape);\n }\n\n private static genColor(colors: string[], rand: () => number) {\n const idx = Math.floor(colors.length * rand());\n return colors.splice(idx, 1)[0];\n }\n\n private static hueShift(colors: Array<string>, rand: () => number) {\n const amount = rand() * 30 - NeonJazziconUtils.wobble / 2;\n const rotate = (hex: string) => NeonJazziconUtils.colorRotate(hex, amount);\n return colors.map(rotate);\n }\n\n private static colorRotate(hex: string, degrees: number) {\n const hsl = NeonJazziconUtils.hexToHSL(hex);\n let hue = hsl.h;\n hue = (hue + degrees) % 360;\n hue = hue < 0 ? 360 + hue : hue;\n hsl.h = hue;\n return NeonJazziconUtils.hslToHex(hsl);\n }\n\n private static hexToHSL(hex: string) {\n // Convert hex to RGB first\n let r = +('0x' + hex[1] + hex[2]);\n let g = +('0x' + hex[3] + hex[4]);\n let b = +('0x' + hex[5] + hex[6]);\n // Then to HSL\n r /= 255;\n g /= 255;\n b /= 255;\n const cmin = Math.min(r, g, b);\n const cmax = Math.max(r, g, b);\n const delta = cmax - cmin;\n let h = 0;\n let s = 0;\n let l = 0;\n\n if (delta === 0) {\n h = 0;\n } else if (cmax === r) {\n h = ((g - b) / delta) % 6;\n } else if (cmax === g) {\n h = (b - r) / delta + 2;\n } else {\n h = (r - g) / delta + 4;\n }\n\n h = Math.round(h * 60);\n\n if (h < 0) {\n h += 360;\n }\n\n l = (cmax + cmin) / 2;\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n\n return { h, s, l };\n }\n\n private static hslToHex(hsl: Record<string, any>) {\n const h = hsl.h;\n let { s, l } = hsl;\n s /= 100;\n l /= 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n let r = 0;\n let g = 0;\n let b = 0;\n\n if (h >= 0 && h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (h >= 60 && h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (h >= 120 && h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (h >= 180 && h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (h >= 240 && h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (h >= 300 && h < 360) {\n r = c;\n g = 0;\n b = x;\n }\n // Having obtained RGB, convert channels to hex\n let rStr = Math.round((r + m) * 255).toString(16);\n let gStr = Math.round((g + m) * 255).toString(16);\n let bStr = Math.round((b + m) * 255).toString(16);\n\n // Prepend 0s, if necessary\n if (rStr.length === 1) {\n rStr = '0' + r;\n }\n\n if (gStr.length === 1) {\n gStr = '0' + g;\n }\n\n if (bStr.length === 1) {\n bStr = '0' + b;\n }\n\n return '#' + rStr + gStr + bStr;\n }\n}\n"],"names":["_NeonJazziconUtils","palette","name","size","NeonRandomUtils","diameter","rand","remainingColors","svg","i","total","center","shape","firstRot","angle","velocity","tx","ty","translate","secondRot","rot","rotate","transform","fill","colors","idx","amount","hex","degrees","hsl","hue","r","g","b","cmin","cmax","delta","h","s","l","c","x","m","rStr","gStr","bStr","NeonJazziconUtils","__publicField"],"mappings":"8TAEO,MAAMA,EAAN,KAAwB,CAW7B,OAAc,OAAOC,EAAwBC,EAAcC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