@foxford/ui 2.76.0-beta-7e5a1c1-20250711 → 2.76.1-beta-3d975b5-20250715
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/dts/index.d.ts
CHANGED
|
@@ -955,9 +955,9 @@ interface PlaygroundToolbar<T = Record<string, unknown>> {
|
|
|
955
955
|
* @export
|
|
956
956
|
* @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)
|
|
957
957
|
* @param {Number} alpha channel which specifies the opacity of the color
|
|
958
|
-
* @returns {
|
|
958
|
+
* @returns {RGB | RGBA} RGB(A) string
|
|
959
959
|
*/
|
|
960
|
-
declare function hexToRgbA(hex: string, alpha?: number):
|
|
960
|
+
declare function hexToRgbA(hex: string, alpha?: number): RGB | RGBA;
|
|
961
961
|
/**
|
|
962
962
|
* Checks if value is HEX color
|
|
963
963
|
*
|
|
@@ -4405,7 +4405,7 @@ interface Theme {
|
|
|
4405
4405
|
defaultInputControlsWidth: number | keyof typeof SizeInput | 'auto';
|
|
4406
4406
|
utils?: {
|
|
4407
4407
|
relBuilder?: (_link?: string, _target?: string) => undefined | string;
|
|
4408
|
-
hexToRgbA?: (hex: string, alpha?: number) =>
|
|
4408
|
+
hexToRgbA?: (hex: string, alpha?: number) => RGB | RGBA;
|
|
4409
4409
|
};
|
|
4410
4410
|
mixins: {
|
|
4411
4411
|
focus: (props: ThemeProps<DefaultTheme>) => string;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"colors.js","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd"],"mappings":"aAEA,MAAMA,qBAAuB,8CAWtB,CAAmBC,EAAaC,KACrC,IAAKF,qBAAqBG,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,gBASsBZ,GACbD,qBAAqBG,KAAKF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.mjs","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"colors.mjs","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hexToRgbA","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd","isHex"],"mappings":"AAEA,MAAMA,qBAAuB,4BAWtB,SAASC,UAAUC,EAAaC,GACrC,IAAKH,qBAAqBI,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,CASO,SAASM,MAAMlB,GACpB,OAAOF,qBAAqBI,KAAKF,EACnC"}
|