@luzmo/dashboard-contents-types 1.0.25 → 1.0.26
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/lib/heat-map/heat-map-options.config.cjs +1 -1
- package/src/lib/heat-map/heat-map-options.config.cjs.map +1 -1
- package/src/lib/heat-map/heat-map-options.config.js +1 -1
- package/src/lib/shared/utils/color/extrapolate-color.cjs +1 -1
- package/src/lib/shared/utils/color/extrapolate-color.cjs.map +1 -1
- package/src/lib/shared/utils/color/extrapolate-color.js +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const p=require("
|
|
1
|
+
"use strict";const p=require("colorjs.io"),t=require("../shared/utils/color/color-palettes.cjs"),u=require("../shared/utils/map-tile-providers.cjs"),s=()=>structuredClone(t.getColorMaps().Spectrum.colors5),y=e=>{if(!e||e.length===0)return[];const o=/^rgb(a)?\s*\(/i.test(e.at(-1)?.trim()??"");return e.map(r=>new p(r).toString({format:o?"hex":"rgb"}))},a=e=>{const o=e?.length||0;return o===0?{type:"heat",colorClass:"Spectrum",colors:s()}:t.getColorMapKeys().map(l=>({type:t.getColorMaps()[l]?.type,colorClass:l,colors:t.getColorMaps()[l]?.[`colors${o}`]})).find(l=>Array.isArray(l.colors)&&Array.isArray(e)&&l.colors.length===e.length&&l.colors.every((c,i)=>c===e[i]))??{type:"manual",colorClass:"manual",colors:e}},d=[{key:"general",type:"group",open:!0,children:[{key:"display.title",control:{type:"switch",label:"Title",default:!0}},{key:"enabled.zoom",control:{type:"switch",label:"Zoom",default:!0}},{key:"enabled.pan",control:{type:"switch",label:"Pan",default:!0}},{key:"enabled.pitchBearing",control:{type:"switch",label:"Pitch & Rotate",default:!1}},{type:"divider"},{key:"vectorTileProvider",control:{type:"picker",label:"Map style",default:"Basic",enum:["Basic","Bright","Dark","Fiord","Liberty","Pastel","Positron","Streets","Toner","Topographique","Voyager","No Tiles"],parseValue:e=>e?.name||"Basic",toValue:e=>u.mapVectorTileProviders[e]??{}}}]},{key:"heat",type:"group",open:!0,children:[{key:"enabled.adaptOnZoom",control:{type:"switch",label:"Adapt on zoom",tooltip:"If turned off, density is calculated based on map surface",default:!0}},{key:"screenRadius",control:{type:"slider",label:"Radius",default:20,min:1,max:50,step:1}},{key:"intensity",control:{type:"slider",label:"Intensity",tooltip:"Multiplier for the density, multiplies by 1 on minimum (default)",default:1,min:1,max:100,step:1}}]},{key:"heatColors",type:"group",open:!0,children:[{key:"transparency",control:{type:"slider",label:"Opacity",default:.8,min:0,max:1,step:.01}},{key:"colorsClassType",control:{type:"picker",label:"Colors type",default:"sequential",enum:["heat","sequential","manual"],calculateValue:({options:e})=>a(e?.colors).type,toOptions:({options:e,value:o})=>{const r=a(e?.colors),n={...e};return r.type!==o&&(n.colors=o==="manual"?y(r.colors??s()):t.getColorMaps()[t.getColorMapKeys(o)?.[0]]?.colors5??s()),n}}},{key:"colorsClass",control:{type:"color-palette-picker",label:"Color palette",hideLabel:!0,default:"Spectrum",enum:({options:e})=>{const o=a(e?.colors).type;return t.getColorMapKeys(["heat","sequential"].includes(o)?o:"heat")},calculateValue:({options:e})=>{const o=a(e?.colors);return o?.colorClass&&o.colorClass!=="manual"?o.colorClass:"Spectrum"},toOptions:({options:e,value:o})=>({...e,colors:t.getColorMaps()[o]?.colors5??s()})},visibleIf:({options:e})=>a(e?.colors).type!=="manual"},{key:"colors",control:{type:"color-range",editRangeSize:!1,noValues:!0,minimumRangeSize:4,noAlphaChannel:!0,hideLabel:!0,label:"Manual color ranges",default:s(),parseValue:e=>e?.map(o=>({color:o})),toValue:e=>e?.map(o=>o?.color)??[]},visibleIf:({options:e})=>a(e?.colors).type==="manual"}]}];module.exports=d;
|
|
2
2
|
//# sourceMappingURL=heat-map-options.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heat-map-options.config.cjs","sources":["../../../../../../libs/dashboard-contents-types/src/lib/heat-map/heat-map-options.config.ts"],"sourcesContent":["import Color from 'colorjs.io';\nimport { ColorsClassKey, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport { mapVectorTileProviders } from '../shared/utils/map-tile-providers';\n\nconst defaultColors = () => structuredClone(getColorMaps().Spectrum.colors5);\nconst adaptedColors = (colors: string[]) => {\n if (!colors || colors.length === 0) {\n return [];\n }\n\n const lastColorInRgb = /^rgb(a)?\\s*\\(/i.test(colors.at(-1)?.trim() ?? '');\n\n return colors.map((color) => {\n const colorObj = new Color(color);\n\n return colorObj.toString({ format: lastColorInRgb ? 'hex' : 'rgb' });\n });\n};\n\nconst getTypeAndColorsClassByColors = (colors: string[]) => {\n const numberOfColors = colors?.length || 0;\n\n if (numberOfColors === 0) {\n return {\n type: 'heat',\n colorClass: 'Spectrum',\n colors: defaultColors()\n };\n }\n\n const colorMapKeys = getColorMapKeys();\n const colorsInfo = colorMapKeys.map((colorMapKey) => ({\n type: (getColorMaps()[colorMapKey as ColorsClassKey] as any)?.type,\n colorClass: colorMapKey,\n colors: (getColorMaps()[colorMapKey as ColorsClassKey] as any)?.[`colors${numberOfColors}`]\n }));\n const found = colorsInfo.find(\n (colorInfo) =>\n Array.isArray(colorInfo.colors)\n && Array.isArray(colors)\n && colorInfo.colors.length === colors.length\n && colorInfo.colors.every((color: string, idx: number) => color === colors[idx])\n );\n\n return (\n found ?? {\n type: 'manual',\n colorClass: 'manual',\n colors\n }\n );\n};\n\nexport default [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'enabled.zoom',\n control: {\n type: 'switch',\n label: 'Zoom',\n default: true\n }\n },\n {\n key: 'enabled.pan',\n control: {\n type: 'switch',\n label: 'Pan',\n default: true\n }\n },\n {\n key: 'enabled.pitchBearing',\n control: {\n type: 'switch',\n label: 'Pitch & Rotate',\n default: false\n }\n },\n {\n type: 'divider'\n },\n {\n key: 'vectorTileProvider',\n control: {\n type: 'picker',\n label: 'Map style',\n default: 'Basic',\n enum: [\n 'Basic',\n 'Bright',\n 'Dark',\n 'Fiord',\n 'Liberty',\n 'Pastel',\n 'Positron',\n 'Streets',\n 'Toner',\n 'Topographique',\n 'Voyager',\n 'No Tiles'\n ],\n parseValue: (value: any) => value?.name || 'Basic',\n toValue: (value: string) => mapVectorTileProviders[value as keyof typeof mapVectorTileProviders] ?? {}\n }\n }\n ]\n },\n {\n key: 'heat',\n type: 'group',\n open: true,\n children: [\n {\n key: 'enabled.adaptOnZoom',\n control: {\n type: 'switch',\n label: 'Adapt on zoom',\n tooltip: 'If turned off, density is calculated based on map surface',\n default: true\n }\n },\n // TODO: check with heatRadius\n {\n key: 'screenRadius',\n control: {\n type: 'slider',\n label: 'Radius',\n default: 20,\n min: 1,\n max: 50,\n step: 1\n }\n },\n {\n key: 'intensity',\n control: {\n type: 'slider',\n label: 'Intensity',\n tooltip: 'Multiplier for the density, multiplies by 1 on minimum (default)',\n default: 1,\n min: 1,\n max: 100,\n step: 1\n }\n }\n ]\n },\n {\n key: 'heatColors',\n type: 'group',\n open: true,\n children: [\n {\n // TODO: rename to opacity\n key: 'transparency',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.8,\n min: 0,\n max: 1,\n step: 0.01\n }\n },\n {\n key: 'colorsClassType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'sequential',\n enum: ['heat', 'sequential', 'manual'],\n calculateValue: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type,\n toOptions: ({ options, value }: any) => {\n const previousColorInfo = getTypeAndColorsClassByColors(options?.colors);\n const newOptions = { ...options };\n\n if (previousColorInfo.type !== value) {\n // we adapt the format of the new colors so that they are not identified as sequential or heat as that would turn the type & colorClass option to non-manual\n newOptions.colors\n = value === 'manual'\n ? adaptedColors(previousColorInfo.colors ?? defaultColors())\n : (getColorMaps()[getColorMapKeys(value)?.[0] as ColorsClassKey]?.colors5 ?? defaultColors());\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: 'Spectrum',\n enum: ({ options }: any) => {\n const colorClassType = getTypeAndColorsClassByColors(options?.colors).type;\n\n return getColorMapKeys(['heat', 'sequential'].includes(colorClassType) ? colorClassType : 'heat');\n },\n calculateValue: ({ options }: any) => {\n const colorInfo = getTypeAndColorsClassByColors(options?.colors);\n\n return colorInfo?.colorClass && colorInfo.colorClass !== 'manual' ? colorInfo.colorClass : 'Spectrum';\n },\n toOptions: ({ options, value }: any) => {\n const newOptions = {\n ...options,\n colors: getColorMaps()[value as ColorsClassKey]?.colors5 ?? defaultColors()\n };\n\n return newOptions;\n }\n },\n visibleIf: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type !== 'manual'\n },\n {\n key: 'colors',\n control: {\n type: 'color-range',\n editRangeSize: false,\n noValues: true,\n minimumRangeSize: 4,\n noAlphaChannel: true,\n hideLabel: true,\n label: 'Manual color ranges',\n default: defaultColors(),\n parseValue: (value: any) => value?.map((color: string) => ({ color })),\n toValue: (value: any) => value?.map((v: any) => v?.color) ?? []\n },\n visibleIf: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type === 'manual'\n }\n ]\n }\n];\n"],"names":["defaultColors","getColorMaps","adaptedColors","colors","lastColorInRgb","color","Color","getTypeAndColorsClassByColors","numberOfColors","getColorMapKeys","colorMapKey","colorInfo","idx","heatMapOptions_config","value","mapVectorTileProviders","options","previousColorInfo","newOptions","colorClassType","v"],"mappings":"0LAIMA,EAAgB,IAAM,gBAAgBC,EAAAA,aAAA,EAAe,SAAS,OAAO,EACrEC,EAAiBC,GAAqB,CAC1C,GAAI,CAACA,GAAUA,EAAO,SAAW,EAC/B,MAAO,CAAA,EAGT,MAAMC,EAAiB,iBAAiB,KAAKD,EAAO,GAAG,EAAE,GAAG,KAAA,GAAU,EAAE,EA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,OAAOP,EAAAA,gBAAgB,CAAC,OAAQ,YAAY,EAAE,SAASU,CAAc,EAAIA,EAAiB,MAAM,CAClG,EACA,eAAgB,CAAC,CAAE,QAAAH,KAAmB,CACpC,MAAML,EAAYJ,EAA8BS,GAAS,MAAM,EAE/D,OAAOL,GAAW,YAAcA,EAAU,aAAe,SAAWA,EAAU,WAAa,UAC7F,EACA,UAAW,CAAC,CAAE,QAAAK,EAAS,MAAAF,MACF,CACjB,GAAGE,EACH,OAAQf,EAAAA,aAAA,EAAea,CAAuB,GAAG,SAAWd,EAAA,CAAc,EAI9E,EAEF,UAAW,CAAC,CAAE,QAAAgB,CAAA,IAAmBT,EAA8BS,GAAS,MAAM,EAAE,OAAS,QAAA,EAE3F,CACE,IAAK,SACL,QAAS,CACP,KAAM,cACN,cAAe,GACf,SAAU,GACV,iBAAkB,EAClB,eAAgB,GAChB,UAAW,GACX,MAAO,sBACP,QAAShB,EAAA,EACT,WAAac,GAAeA,GAAO,IAAKT,IAAmB,CAAE,MAAAA,CAAA,EAAQ,EACrE,QAAUS,GAAeA,GAAO,IAAKM,GAAWA,GAAG,KAAK,GAAK,CAAA,CAAC,EAEhE,UAAW,CAAC,CAAE,QAAAJ,CAAA,IAAmBT,EAA8BS,GAAS,MAAM,EAAE,OAAS,QAAA,CAC3F,CACF,CAEJ,EAAA,OAAA,QAAAH"}
|
|
1
|
+
{"version":3,"file":"heat-map-options.config.cjs","sources":["../../../../../../libs/dashboard-contents-types/src/lib/heat-map/heat-map-options.config.ts"],"sourcesContent":["import Color from 'colorjs.io';\nimport { ColorsClassKey, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport { mapVectorTileProviders } from '../shared/utils/map-tile-providers';\n\nconst defaultColors = () => structuredClone(getColorMaps().Spectrum.colors5);\nconst adaptedColors = (colors: string[]) => {\n if (!colors || colors.length === 0) {\n return [];\n }\n\n const lastColorInRgb = /^rgb(a)?\\s*\\(/i.test(colors.at(-1)?.trim() ?? '');\n\n return colors.map((color) => {\n const colorObj = new Color(color);\n\n return colorObj.toString({ format: lastColorInRgb ? 'hex' : 'rgb' });\n });\n};\n\nconst getTypeAndColorsClassByColors = (colors: string[]) => {\n const numberOfColors = colors?.length || 0;\n\n if (numberOfColors === 0) {\n return {\n type: 'heat',\n colorClass: 'Spectrum',\n colors: defaultColors()\n };\n }\n\n const colorMapKeys = getColorMapKeys();\n const colorsInfo = colorMapKeys.map((colorMapKey) => ({\n type: (getColorMaps()[colorMapKey as ColorsClassKey] as any)?.type,\n colorClass: colorMapKey,\n colors: (getColorMaps()[colorMapKey as ColorsClassKey] as any)?.[`colors${numberOfColors}`]\n }));\n const found = colorsInfo.find(\n (colorInfo) =>\n Array.isArray(colorInfo.colors)\n && Array.isArray(colors)\n && colorInfo.colors.length === colors.length\n && colorInfo.colors.every((color: string, idx: number) => color === colors[idx])\n );\n\n return (\n found ?? {\n type: 'manual',\n colorClass: 'manual',\n colors\n }\n );\n};\n\nexport default [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'enabled.zoom',\n control: {\n type: 'switch',\n label: 'Zoom',\n default: true\n }\n },\n {\n key: 'enabled.pan',\n control: {\n type: 'switch',\n label: 'Pan',\n default: true\n }\n },\n {\n key: 'enabled.pitchBearing',\n control: {\n type: 'switch',\n label: 'Pitch & Rotate',\n default: false\n }\n },\n {\n type: 'divider'\n },\n {\n key: 'vectorTileProvider',\n control: {\n type: 'picker',\n label: 'Map style',\n default: 'Basic',\n enum: [\n 'Basic',\n 'Bright',\n 'Dark',\n 'Fiord',\n 'Liberty',\n 'Pastel',\n 'Positron',\n 'Streets',\n 'Toner',\n 'Topographique',\n 'Voyager',\n 'No Tiles'\n ],\n parseValue: (value: any) => value?.name || 'Basic',\n toValue: (value: string) => mapVectorTileProviders[value as keyof typeof mapVectorTileProviders] ?? {}\n }\n }\n ]\n },\n {\n key: 'heat',\n type: 'group',\n open: true,\n children: [\n {\n key: 'enabled.adaptOnZoom',\n control: {\n type: 'switch',\n label: 'Adapt on zoom',\n tooltip: 'If turned off, density is calculated based on map surface',\n default: true\n }\n },\n // TODO: check with heatRadius\n {\n key: 'screenRadius',\n control: {\n type: 'slider',\n label: 'Radius',\n default: 20,\n min: 1,\n max: 50,\n step: 1\n }\n },\n {\n key: 'intensity',\n control: {\n type: 'slider',\n label: 'Intensity',\n tooltip: 'Multiplier for the density, multiplies by 1 on minimum (default)',\n default: 1,\n min: 1,\n max: 100,\n step: 1\n }\n }\n ]\n },\n {\n key: 'heatColors',\n type: 'group',\n open: true,\n children: [\n {\n // TODO: rename to opacity\n key: 'transparency',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.8,\n min: 0,\n max: 1,\n step: 0.01\n }\n },\n {\n key: 'colorsClassType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'sequential',\n enum: ['heat', 'sequential', 'manual'],\n calculateValue: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type,\n toOptions: ({ options, value }: any) => {\n const previousColorInfo = getTypeAndColorsClassByColors(options?.colors);\n const newOptions = { ...options };\n\n if (previousColorInfo.type !== value) {\n // we adapt the format of the new colors so that they are not identified as sequential or heat as that would turn the type & colorClass option to non-manual\n newOptions.colors\n = value === 'manual'\n ? adaptedColors(previousColorInfo.colors ?? defaultColors())\n : (getColorMaps()[getColorMapKeys(value)?.[0] as ColorsClassKey]?.colors5 ?? defaultColors());\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: 'Spectrum',\n enum: ({ options }: any) => {\n const colorClassType = getTypeAndColorsClassByColors(options?.colors).type;\n\n return getColorMapKeys(['heat', 'sequential'].includes(colorClassType) ? colorClassType : 'heat');\n },\n calculateValue: ({ options }: any) => {\n const colorInfo = getTypeAndColorsClassByColors(options?.colors);\n\n return colorInfo?.colorClass && colorInfo.colorClass !== 'manual' ? colorInfo.colorClass : 'Spectrum';\n },\n toOptions: ({ options, value }: any) => {\n const newOptions = {\n ...options,\n colors: getColorMaps()[value as ColorsClassKey]?.colors5 ?? defaultColors()\n };\n\n return newOptions;\n }\n },\n visibleIf: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type !== 'manual'\n },\n {\n key: 'colors',\n control: {\n type: 'color-range',\n editRangeSize: false,\n noValues: true,\n minimumRangeSize: 4,\n noAlphaChannel: true,\n hideLabel: true,\n label: 'Manual color ranges',\n default: defaultColors(),\n parseValue: (value: any) => value?.map((color: string) => ({ color })),\n toValue: (value: any) => value?.map((v: any) => v?.color) ?? []\n },\n visibleIf: ({ options }: any) => getTypeAndColorsClassByColors(options?.colors).type === 'manual'\n }\n ]\n }\n];\n"],"names":["defaultColors","getColorMaps","adaptedColors","colors","lastColorInRgb","color","Color","getTypeAndColorsClassByColors","numberOfColors","getColorMapKeys","colorMapKey","colorInfo","idx","heatMapOptions_config","value","mapVectorTileProviders","options","previousColorInfo","newOptions","colorClassType","v"],"mappings":"qJAIMA,EAAgB,IAAM,gBAAgBC,EAAAA,aAAA,EAAe,SAAS,OAAO,EACrEC,EAAiBC,GAAqB,CAC1C,GAAI,CAACA,GAAUA,EAAO,SAAW,EAC/B,MAAO,CAAA,EAGT,MAAMC,EAAiB,iBAAiB,KAAKD,EAAO,GAAG,EAAE,GAAG,KAAA,GAAU,EAAE,EAExE,OAAOA,EAAO,IAAKE,GACA,IAAIC,EAAMD,CAAK,EAEhB,SAAS,CAAE,OAAQD,EAAiB,MAAQ,MAAO,CACpE,CACH,EAEMG,EAAiCJ,GAAqB,CAC1D,MAAMK,EAAiBL,GAAQ,QAAU,EAEzC,OAAIK,IAAmB,EACd,CACL,KAAM,OACN,WAAY,WACZ,OAAQR,EAAA,CAAc,EAILS,EAAAA,gBAAA,EACW,IAAKC,IAAiB,CACpD,KAAOT,EAAAA,aAAA,EAAeS,CAA6B,GAAW,KAC9D,WAAYA,EACZ,OAA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,CAAc,EAI9E,EAEF,UAAW,CAAC,CAAE,QAAAgB,CAAA,IAAmBT,EAA8BS,GAAS,MAAM,EAAE,OAAS,QAAA,EAE3F,CACE,IAAK,SACL,QAAS,CACP,KAAM,cACN,cAAe,GACf,SAAU,GACV,iBAAkB,EAClB,eAAgB,GAChB,UAAW,GACX,MAAO,sBACP,QAAShB,EAAA,EACT,WAAac,GAAeA,GAAO,IAAKT,IAAmB,CAAE,MAAAA,CAAA,EAAQ,EACrE,QAAUS,GAAeA,GAAO,IAAKM,GAAWA,GAAG,KAAK,GAAK,CAAA,CAAC,EAEhE,UAAW,CAAC,CAAE,QAAAJ,CAAA,IAAmBT,EAA8BS,GAAS,MAAM,EAAE,OAAS,QAAA,CAC3F,CACF,CAEJ,EAAA,OAAA,QAAAH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import u from "
|
|
1
|
+
import u from "colorjs.io";
|
|
2
2
|
import { getColorMaps as s, getColorMapKeys as c } from "../shared/utils/color/color-palettes.js";
|
|
3
3
|
import { mapVectorTileProviders as y } from "../shared/utils/map-tile-providers.js";
|
|
4
4
|
const a = () => structuredClone(s().Spectrum.colors5), d = (e) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("
|
|
1
|
+
"use strict";const e=require("colorjs.io"),i=(o,r=.1)=>{if(o.length<2)return"#AAAAAA";const n=o.length,a=new e(o[n-2]).to("oklab"),t=new e(o[n-1]).to("oklab"),c=a.coords[0],s=t.coords[0],l=s>c?1:-1,h=Math.min(1,Math.max(0,s+l*r));return new e("oklab",[h,t.coords[1],t.coords[2]],t.alpha).to("srgb").toString({format:"hex",precision:0})};exports.extrapolateNewColor=i;
|
|
2
2
|
//# sourceMappingURL=extrapolate-color.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extrapolate-color.cjs","sources":["../../../../../../../../libs/dashboard-contents-types/src/lib/shared/utils/color/extrapolate-color.ts"],"sourcesContent":["import Color from 'colorjs.io';\n\nexport const extrapolateNewColor = (colorStrings: string[], percent: number = 0.1): string => {\n if (colorStrings.length < 2) {\n return '#AAAAAA';\n }\n\n const n = colorStrings.length;\n\n const prev = new Color(colorStrings[n - 2]).to('oklab');\n const last = new Color(colorStrings[n - 1]).to('oklab');\n\n const lightnessPrev = prev.coords[0];\n const lightnessLast = last.coords[0];\n\n // Determine direction: lighten or darken\n const direction = lightnessLast > lightnessPrev ? 1 : -1;\n\n // Modify lightness\n const newL = Math.min(1, Math.max(0, lightnessLast + direction * percent));\n\n const newColor = new Color('oklab', [newL, last.coords[1], last.coords[2]], last.alpha);\n\n return newColor.to('srgb').toString({ format: 'hex', precision: 0 });\n};\n"],"names":["extrapolateNewColor","colorStrings","percent","prev","Color","last","lightnessPrev","lightnessLast","direction","newL"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extrapolate-color.cjs","sources":["../../../../../../../../libs/dashboard-contents-types/src/lib/shared/utils/color/extrapolate-color.ts"],"sourcesContent":["import Color from 'colorjs.io';\n\nexport const extrapolateNewColor = (colorStrings: string[], percent: number = 0.1): string => {\n if (colorStrings.length < 2) {\n return '#AAAAAA';\n }\n\n const n = colorStrings.length;\n\n const prev = new Color(colorStrings[n - 2]).to('oklab');\n const last = new Color(colorStrings[n - 1]).to('oklab');\n\n const lightnessPrev = prev.coords[0];\n const lightnessLast = last.coords[0];\n\n // Determine direction: lighten or darken\n const direction = lightnessLast > lightnessPrev ? 1 : -1;\n\n // Modify lightness\n const newL = Math.min(1, Math.max(0, lightnessLast + direction * percent));\n\n const newColor = new Color('oklab', [newL, last.coords[1], last.coords[2]], last.alpha);\n\n return newColor.to('srgb').toString({ format: 'hex', precision: 0 });\n};\n"],"names":["extrapolateNewColor","colorStrings","percent","prev","Color","last","lightnessPrev","lightnessLast","direction","newL"],"mappings":"2CAEaA,EAAsB,CAACC,EAAwBC,EAAkB,KAAgB,CAC5F,GAAID,EAAa,OAAS,EACxB,MAAO,UAGT,MAAM,EAAIA,EAAa,OAEjBE,EAAO,IAAIC,EAAMH,EAAa,EAAI,CAAC,CAAC,EAAE,GAAG,OAAO,EAChDI,EAAO,IAAID,EAAMH,EAAa,EAAI,CAAC,CAAC,EAAE,GAAG,OAAO,EAEhDK,EAAgBH,EAAK,OAAO,CAAC,EAC7BI,EAAgBF,EAAK,OAAO,CAAC,EAG7BG,EAAYD,EAAgBD,EAAgB,EAAI,GAGhDG,EAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAGF,EAAgBC,EAAYN,CAAO,CAAC,EAIzE,OAFiB,IAAIE,EAAM,QAAS,CAACK,EAAMJ,EAAK,OAAO,CAAC,EAAGA,EAAK,OAAO,CAAC,CAAC,EAAGA,EAAK,KAAK,EAEtE,GAAG,MAAM,EAAE,SAAS,CAAE,OAAQ,MAAO,UAAW,EAAG,CACrE,EAAA,QAAA,oBAAAL"}
|