@jakubmazanec/ui 0.5.3 → 0.5.4-next.375ca628
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/build/development/internals/createDistributionValues.js.map +1 -1
- package/build/theme/internals/createComponentTheme.js +1 -5
- package/build/theme/internals/createComponentTheme.js.map +2 -2
- package/build/theme/internals/createUseComponentThemeReturn.js.map +2 -2
- package/package.json +4 -4
- package/source/development/internals/createDistributionValues.ts +1 -1
- package/source/theme/internals/createComponentTheme.ts +2 -10
- package/source/theme/internals/createUseComponentThemeReturn.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/development/internals/createDistributionValues.ts"],
|
|
4
|
-
"sourcesContent": ["import {DEFAULT_STOP, DEFAULT_STOPS} from './constants.js';\n\nconst MIN = 0;\nconst MAX = 100;\n\nexport function createDistributionValues(lightness: number, stop: number = DEFAULT_STOP) {\n let stops: number[] = [...DEFAULT_STOPS].sort()
|
|
4
|
+
"sourcesContent": ["import {DEFAULT_STOP, DEFAULT_STOPS} from './constants.js';\n\nconst MIN = 0;\nconst MAX = 100;\n\nexport function createDistributionValues(lightness: number, stop: number = DEFAULT_STOP) {\n let stops: number[] = [...DEFAULT_STOPS].sort();\n let newValues = [\n {stop: 0, value: MAX},\n {stop, value: lightness},\n {stop: 1000, value: MIN},\n ];\n let stopIndex = stops.indexOf(stop);\n let firstHalf = stops.slice(0, stopIndex + 1);\n let secondHalf = stops.slice(stopIndex);\n\n for (let stopValue of firstHalf) {\n if (stopValue !== 0 && stopValue !== stop) {\n let percentage = (stopValue - 0) / (stop - 0);\n let value = MAX - percentage * (MAX - lightness);\n\n newValues.push({stop: stopValue, value: Math.round(value)});\n }\n }\n\n for (let stopValue of secondHalf) {\n if (stopValue !== 1000 && stopValue !== stop) {\n let percentage = (stopValue - stop) / (1000 - stop);\n let value = lightness - percentage * (lightness - MIN);\n\n newValues.push({stop: stopValue, value: Math.round(value)});\n }\n }\n\n newValues.sort((a, b) => a.stop - b.stop);\n\n return newValues;\n}\n"],
|
|
5
5
|
"mappings": ";AAAA,SAAQ,cAAc,qBAAoB;AAE1C,MAAM,MAAM;AACZ,MAAM,MAAM;AAEL,gBAAS,yBAAyB,WAAmB,OAAe,cAAc;AACvF,MAAI,QAAkB,CAAC,GAAG,aAAa,EAAE,KAAK;AAC9C,MAAI,YAAY;AAAA,IACd,EAAC,MAAM,GAAG,OAAO,IAAG;AAAA,IACpB,EAAC,MAAM,OAAO,UAAS;AAAA,IACvB,EAAC,MAAM,KAAM,OAAO,IAAG;AAAA,EACzB;AACA,MAAI,YAAY,MAAM,QAAQ,IAAI;AAClC,MAAI,YAAY,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5C,MAAI,aAAa,MAAM,MAAM,SAAS;AAEtC,WAAS,aAAa,WAAW;AAC/B,QAAI,cAAc,KAAK,cAAc,MAAM;AACzC,UAAI,cAAc,YAAY,MAAM,OAAO;AAC3C,UAAI,QAAQ,MAAM,cAAc,MAAM;AAEtC,gBAAU,KAAK,EAAC,MAAM,WAAW,OAAO,KAAK,MAAM,KAAK,EAAC,CAAC;AAAA,IAC5D;AAAA,EACF;AAEA,WAAS,aAAa,YAAY;AAChC,QAAI,cAAc,OAAQ,cAAc,MAAM;AAC5C,UAAI,cAAc,YAAY,SAAS,MAAO;AAC9C,UAAI,QAAQ,YAAY,cAAc,YAAY;AAElD,gBAAU,KAAK,EAAC,MAAM,WAAW,OAAO,KAAK,MAAM,KAAK,EAAC,CAAC;AAAA,IAC5D;AAAA,EACF;AAEA,YAAU,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;AAExC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,11 +15,7 @@ export function createComponentTheme(themeName, themeDefinition) {
|
|
|
15
15
|
}
|
|
16
16
|
let hasElements = Boolean(themeDefinition?.elements);
|
|
17
17
|
if (!hasElements) {
|
|
18
|
-
return createUseComponentThemeReturn(
|
|
19
|
-
componentTheme,
|
|
20
|
-
cx,
|
|
21
|
-
themeProps
|
|
22
|
-
);
|
|
18
|
+
return createUseComponentThemeReturn(componentTheme, cx, themeProps);
|
|
23
19
|
}
|
|
24
20
|
let getClassNames = {};
|
|
25
21
|
for (let element of themeDefinition?.elements ?? []) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/theme/internals/createComponentTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import {useContext} from 'react';\n\nimport {type Theme} from '../Theme.js';\nimport {type ClassName} from './ClassName.js';\nimport {type ComponentTheme} from './ComponentTheme.js';\nimport {type ComponentThemeDefinition} from './ComponentThemeDefinition.js';\nimport {type ComponentThemeDefinitionElements} from './ComponentThemeDefinitionElements.js';\nimport {type ComponentThemeDefinitionVariants} from './ComponentThemeDefinitionVariants.js';\nimport {type ComponentThemeProps} from './ComponentThemeProps.js';\nimport {createUseComponentThemeReturn} from './createUseComponentThemeReturn.js';\nimport {themeContext} from './themeContext.js';\nimport {type UseComponentTheme} from './UseComponentTheme.js';\n\nexport function createComponentTheme<\n const N extends string,\n const D extends ComponentThemeDefinition | undefined = undefined,\n>(themeName: N, themeDefinition?: NonNullable<D>): UseComponentTheme<N, D> {\n let useComponentTheme = (themeProps?: ComponentThemeProps<D>) => {\n let theme = useContext(themeContext);\n\n if (!theme) {\n throw new Error('No theme was found!');\n }\n\n let cx = theme.merge;\n let componentTheme = theme[themeName as keyof Theme] as unknown as\n | ComponentTheme<{\n variants: ComponentThemeDefinitionVariants;\n elements: ComponentThemeDefinitionElements;\n }>\n | ComponentTheme<{variants: ComponentThemeDefinitionVariants}>\n | undefined;\n\n if (!componentTheme) {\n throw new Error(`Theme for component \"${themeName}\" wasn't found!`);\n }\n\n let hasElements = Boolean(themeDefinition?.elements);\n\n if (!hasElements) {\n return createUseComponentThemeReturn(
|
|
5
|
-
"mappings": ";AAAA,SAAQ,kBAAiB;AASzB,SAAQ,qCAAoC;AAC5C,SAAQ,oBAAmB;AAGpB,gBAAS,qBAGd,WAAc,iBAA2D;AACzE,MAAI,oBAAoB,CAAC,eAAwC;AAC/D,QAAI,QAAQ,WAAW,YAAY;AAEnC,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAEA,QAAI,KAAK,MAAM;AACf,QAAI,iBAAiB,MAAM,SAAwB;AAQnD,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,wBAAwB,SAAS,iBAAiB;AAAA,IACpE;AAEA,QAAI,cAAc,QAAQ,iBAAiB,QAAQ;AAEnD,QAAI,CAAC,aAAa;AAChB,aAAO
|
|
4
|
+
"sourcesContent": ["import {useContext} from 'react';\n\nimport {type Theme} from '../Theme.js';\nimport {type ClassName} from './ClassName.js';\nimport {type ComponentTheme} from './ComponentTheme.js';\nimport {type ComponentThemeDefinition} from './ComponentThemeDefinition.js';\nimport {type ComponentThemeDefinitionElements} from './ComponentThemeDefinitionElements.js';\nimport {type ComponentThemeDefinitionVariants} from './ComponentThemeDefinitionVariants.js';\nimport {type ComponentThemeProps} from './ComponentThemeProps.js';\nimport {createUseComponentThemeReturn} from './createUseComponentThemeReturn.js';\nimport {themeContext} from './themeContext.js';\nimport {type UseComponentTheme} from './UseComponentTheme.js';\n\nexport function createComponentTheme<\n const N extends string,\n const D extends ComponentThemeDefinition | undefined = undefined,\n>(themeName: N, themeDefinition?: NonNullable<D>): UseComponentTheme<N, D> {\n let useComponentTheme = (themeProps?: ComponentThemeProps<D>) => {\n let theme = useContext(themeContext);\n\n if (!theme) {\n throw new Error('No theme was found!');\n }\n\n let cx = theme.merge;\n let componentTheme = theme[themeName as keyof Theme] as unknown as\n | ComponentTheme<{\n variants: ComponentThemeDefinitionVariants;\n elements: ComponentThemeDefinitionElements;\n }>\n | ComponentTheme<{variants: ComponentThemeDefinitionVariants}>\n | undefined;\n\n if (!componentTheme) {\n throw new Error(`Theme for component \"${themeName}\" wasn't found!`);\n }\n\n let hasElements = Boolean(themeDefinition?.elements);\n\n if (!hasElements) {\n return createUseComponentThemeReturn(componentTheme, cx, themeProps);\n }\n\n let getClassNames: Record<string, (...args: ClassName[]) => string> = {};\n\n for (let element of themeDefinition?.elements ?? []) {\n getClassNames[element] = createUseComponentThemeReturn(\n componentTheme,\n cx,\n themeProps,\n element,\n );\n }\n\n return getClassNames;\n };\n\n (useComponentTheme as UseComponentTheme<N, D>).themeDefinition = themeDefinition;\n (useComponentTheme as UseComponentTheme<N, D>).componentThemeName = themeName;\n\n return useComponentTheme as UseComponentTheme<N, D>;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAQ,kBAAiB;AASzB,SAAQ,qCAAoC;AAC5C,SAAQ,oBAAmB;AAGpB,gBAAS,qBAGd,WAAc,iBAA2D;AACzE,MAAI,oBAAoB,CAAC,eAAwC;AAC/D,QAAI,QAAQ,WAAW,YAAY;AAEnC,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAEA,QAAI,KAAK,MAAM;AACf,QAAI,iBAAiB,MAAM,SAAwB;AAQnD,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,wBAAwB,SAAS,iBAAiB;AAAA,IACpE;AAEA,QAAI,cAAc,QAAQ,iBAAiB,QAAQ;AAEnD,QAAI,CAAC,aAAa;AAChB,aAAO,8BAA8B,gBAAgB,IAAI,UAAU;AAAA,IACrE;AAEA,QAAI,gBAAkE,CAAC;AAEvE,aAAS,WAAW,iBAAiB,YAAY,CAAC,GAAG;AACnD,oBAAc,OAAO,IAAI;AAAA,QACvB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,EAAC,kBAA8C,kBAAkB;AACjE,EAAC,kBAA8C,qBAAqB;AAEpE,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../source/theme/internals/createUseComponentThemeReturn.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable unicorn/consistent-destructuring -- destructuring leads to messy code because of complicated types */\nimport {booleanToString} from './booleanToString.js';\nimport {type ClassName} from './ClassName.js';\nimport {type ComponentTheme} from './ComponentTheme.js';\nimport {type ComponentThemeDefinitionElements} from './ComponentThemeDefinitionElements.js';\nimport {type ComponentThemeDefinitionVariants} from './ComponentThemeDefinitionVariants.js';\nimport {type ComponentThemeProps} from './ComponentThemeProps.js';\nimport {pickPropertyIfExists} from './pickPropertyIfExists.js';\n\nexport function createUseComponentThemeReturn(\n componentTheme:\n | ComponentTheme<{elements: ComponentThemeDefinitionElements}>\n | ComponentTheme<{\n variants: ComponentThemeDefinitionVariants;\n elements: ComponentThemeDefinitionElements;\n }>\n | ComponentTheme<{variants: ComponentThemeDefinitionVariants}>\n | ComponentTheme<undefined>,\n cx: (...inputs: ClassName[]) => string,\n themeProps?:\n | ComponentThemeProps<{variants: ComponentThemeDefinitionVariants}>\n | ComponentThemeProps<undefined>,\n elementName?: string,\n) {\n if (!themeProps || !('variants' in componentTheme)) {\n return (baseClassName: ClassName, overrideClassName: ClassName) =>\n cx(\n baseClassName,\n 'classNames' in componentTheme ?\n pickPropertyIfExists(componentTheme.classNames, elementName)\n : 'className' in componentTheme ? componentTheme.className\n : undefined,\n overrideClassName,\n );\n }\n\n let {variants, compoundVariants} = componentTheme;\n let getVariantClassNames = Object.keys(variants).map((variant) => {\n let variantProp = themeProps[variant as keyof typeof themeProps] as boolean | string;\n let variantKey = booleanToString(variantProp);\n\n return pickPropertyIfExists(variants[variant]?.[variantKey as 'false' | 'true'], elementName);\n });\n let getCompoundVariantClassNames: ClassName[] = [];\n\n if (compoundVariants) {\n for (let compoundVariant of compoundVariants) {\n let {className, classNames, ...rest} = compoundVariant;\n let matchesAllSelectors = true;\n\n for (let [cvKey, cvSelector] of Object.entries(rest)) {\n let selector = themeProps[cvKey as keyof typeof themeProps];\n\n if (Array.isArray(cvSelector)) {\n if (!cvSelector.includes(selector
|
|
5
|
-
"mappings": ";AACA,SAAQ,uBAAsB;AAM9B,SAAQ,4BAA2B;AAE5B,gBAAS,8BACd,gBAQA,IACA,YAGA,aACA;AACA,MAAI,CAAC,cAAc,EAAE,cAAc,iBAAiB;AAClD,WAAO,CAAC,eAA0B,sBAChC;AAAA,MACE;AAAA,MACA,gBAAgB,iBACd,qBAAqB,eAAe,YAAY,WAAW,IAC3D,eAAe,iBAAiB,eAAe,YAC/C;AAAA,MACF;AAAA,IACF;AAAA,EACJ;AAEA,MAAI,EAAC,UAAU,iBAAgB,IAAI;AACnC,MAAI,uBAAuB,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,YAAY;AAChE,QAAI,cAAc,WAAW,OAAkC;AAC/D,QAAI,aAAa,gBAAgB,WAAW;AAE5C,WAAO,qBAAqB,SAAS,OAAO,IAAI,UAA8B,GAAG,WAAW;AAAA,EAC9F,CAAC;AACD,MAAI,+BAA4C,CAAC;AAEjD,MAAI,kBAAkB;AACpB,aAAS,mBAAmB,kBAAkB;AAC5C,UAAI,EAAC,WAAW,YAAY,GAAG,KAAI,IAAI;AACvC,UAAI,sBAAsB;AAE1B,eAAS,CAAC,OAAO,UAAU,KAAK,OAAO,QAAQ,IAAI,GAAG;AACpD,YAAI,WAAW,WAAW,KAAgC;AAE1D,YAAI,MAAM,QAAQ,UAAU,GAAG;AAC7B,cAAI,CAAC,WAAW,SAAS,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable unicorn/consistent-destructuring -- destructuring leads to messy code because of complicated types */\nimport {booleanToString} from './booleanToString.js';\nimport {type ClassName} from './ClassName.js';\nimport {type ComponentTheme} from './ComponentTheme.js';\nimport {type ComponentThemeDefinitionElements} from './ComponentThemeDefinitionElements.js';\nimport {type ComponentThemeDefinitionVariants} from './ComponentThemeDefinitionVariants.js';\nimport {type ComponentThemeProps} from './ComponentThemeProps.js';\nimport {pickPropertyIfExists} from './pickPropertyIfExists.js';\n\nexport function createUseComponentThemeReturn(\n componentTheme:\n | ComponentTheme<{elements: ComponentThemeDefinitionElements}>\n | ComponentTheme<{\n variants: ComponentThemeDefinitionVariants;\n elements: ComponentThemeDefinitionElements;\n }>\n | ComponentTheme<{variants: ComponentThemeDefinitionVariants}>\n | ComponentTheme<undefined>,\n cx: (...inputs: ClassName[]) => string,\n themeProps?:\n | ComponentThemeProps<{variants: ComponentThemeDefinitionVariants}>\n | ComponentThemeProps<undefined>,\n elementName?: string,\n) {\n if (!themeProps || !('variants' in componentTheme)) {\n return (baseClassName: ClassName, overrideClassName: ClassName) =>\n cx(\n baseClassName,\n 'classNames' in componentTheme ?\n pickPropertyIfExists(componentTheme.classNames, elementName)\n : 'className' in componentTheme ? componentTheme.className\n : undefined,\n overrideClassName,\n );\n }\n\n let {variants, compoundVariants} = componentTheme;\n let getVariantClassNames = Object.keys(variants).map((variant) => {\n let variantProp = themeProps[variant as keyof typeof themeProps] as boolean | string;\n let variantKey = booleanToString(variantProp);\n\n return pickPropertyIfExists(variants[variant]?.[variantKey as 'false' | 'true'], elementName);\n });\n let getCompoundVariantClassNames: ClassName[] = [];\n\n if (compoundVariants) {\n for (let compoundVariant of compoundVariants) {\n let {className, classNames, ...rest} = compoundVariant;\n let matchesAllSelectors = true;\n\n for (let [cvKey, cvSelector] of Object.entries(rest)) {\n let selector = themeProps[cvKey as keyof typeof themeProps];\n\n if (Array.isArray(cvSelector)) {\n if (!cvSelector.includes(selector)) {\n matchesAllSelectors = false;\n\n break;\n }\n } else if (selector !== cvSelector) {\n matchesAllSelectors = false;\n\n break;\n }\n }\n\n if (matchesAllSelectors) {\n getCompoundVariantClassNames.push(\n ('classNames' in compoundVariant ?\n pickPropertyIfExists(classNames as Record<string, ClassName>, elementName)\n : className) as ClassName,\n );\n }\n }\n }\n\n return (baseClassName: ClassName, overrideClassName: ClassName) =>\n cx(\n baseClassName,\n 'classNames' in componentTheme ? pickPropertyIfExists(componentTheme.classNames, elementName)\n : 'className' in componentTheme ? componentTheme.className\n : undefined,\n getVariantClassNames,\n getCompoundVariantClassNames,\n overrideClassName,\n );\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAQ,uBAAsB;AAM9B,SAAQ,4BAA2B;AAE5B,gBAAS,8BACd,gBAQA,IACA,YAGA,aACA;AACA,MAAI,CAAC,cAAc,EAAE,cAAc,iBAAiB;AAClD,WAAO,CAAC,eAA0B,sBAChC;AAAA,MACE;AAAA,MACA,gBAAgB,iBACd,qBAAqB,eAAe,YAAY,WAAW,IAC3D,eAAe,iBAAiB,eAAe,YAC/C;AAAA,MACF;AAAA,IACF;AAAA,EACJ;AAEA,MAAI,EAAC,UAAU,iBAAgB,IAAI;AACnC,MAAI,uBAAuB,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,YAAY;AAChE,QAAI,cAAc,WAAW,OAAkC;AAC/D,QAAI,aAAa,gBAAgB,WAAW;AAE5C,WAAO,qBAAqB,SAAS,OAAO,IAAI,UAA8B,GAAG,WAAW;AAAA,EAC9F,CAAC;AACD,MAAI,+BAA4C,CAAC;AAEjD,MAAI,kBAAkB;AACpB,aAAS,mBAAmB,kBAAkB;AAC5C,UAAI,EAAC,WAAW,YAAY,GAAG,KAAI,IAAI;AACvC,UAAI,sBAAsB;AAE1B,eAAS,CAAC,OAAO,UAAU,KAAK,OAAO,QAAQ,IAAI,GAAG;AACpD,YAAI,WAAW,WAAW,KAAgC;AAE1D,YAAI,MAAM,QAAQ,UAAU,GAAG;AAC7B,cAAI,CAAC,WAAW,SAAS,QAAQ,GAAG;AAClC,kCAAsB;AAEtB;AAAA,UACF;AAAA,QACF,WAAW,aAAa,YAAY;AAClC,gCAAsB;AAEtB;AAAA,QACF;AAAA,MACF;AAEA,UAAI,qBAAqB;AACvB,qCAA6B;AAAA,UAC1B,gBAAgB,kBACf,qBAAqB,YAAyC,WAAW,IACzE;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,CAAC,eAA0B,sBAChC;AAAA,IACE;AAAA,IACA,gBAAgB,iBAAiB,qBAAqB,eAAe,YAAY,WAAW,IAC1F,eAAe,iBAAiB,eAAe,YAC/C;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakubmazanec/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4-next.375ca628",
|
|
4
4
|
"description": "React component library.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@dnd-kit/utilities": "^3.2.2",
|
|
42
42
|
"@headlessui/react": "^2.2.9",
|
|
43
43
|
"@heroicons/react": "^2.2.0",
|
|
44
|
-
"@jakubmazanec/ts-utils": "
|
|
44
|
+
"@jakubmazanec/ts-utils": "3.0.19-next.375ca628",
|
|
45
45
|
"@tanstack/match-sorter-utils": "^8.19.4",
|
|
46
46
|
"@tanstack/react-table": "^8.21.3",
|
|
47
47
|
"culori": "^4.0.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@chromatic-com/storybook": "^4.1.3",
|
|
54
|
-
"@jakubmazanec/eslint-config": "
|
|
54
|
+
"@jakubmazanec/eslint-config": "5.0.0-next.375ca628",
|
|
55
55
|
"@storybook/addon-docs": "^10.1.1",
|
|
56
56
|
"@storybook/addon-links": "^10.1.1",
|
|
57
57
|
"@storybook/react-vite": "^10.1.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"concurrently": "^9.2.1",
|
|
69
69
|
"del-cli": "^7.0.0",
|
|
70
70
|
"esbuild": "^0.27.0",
|
|
71
|
-
"eslint": "^9.
|
|
71
|
+
"eslint": "^9.39.4",
|
|
72
72
|
"happy-dom": "^20.0.11",
|
|
73
73
|
"prettier": "^3.7.3",
|
|
74
74
|
"prettier-plugin-packagejson": "^2.5.20",
|
|
@@ -4,7 +4,7 @@ const MIN = 0;
|
|
|
4
4
|
const MAX = 100;
|
|
5
5
|
|
|
6
6
|
export function createDistributionValues(lightness: number, stop: number = DEFAULT_STOP) {
|
|
7
|
-
let stops: number[] = [...DEFAULT_STOPS].sort()
|
|
7
|
+
let stops: number[] = [...DEFAULT_STOPS].sort();
|
|
8
8
|
let newValues = [
|
|
9
9
|
{stop: 0, value: MAX},
|
|
10
10
|
{stop, value: lightness},
|
|
@@ -38,22 +38,14 @@ export function createComponentTheme<
|
|
|
38
38
|
let hasElements = Boolean(themeDefinition?.elements);
|
|
39
39
|
|
|
40
40
|
if (!hasElements) {
|
|
41
|
-
return createUseComponentThemeReturn(
|
|
42
|
-
componentTheme as
|
|
43
|
-
| ComponentTheme<{variants: ComponentThemeDefinitionVariants}>
|
|
44
|
-
| ComponentTheme<undefined>,
|
|
45
|
-
cx,
|
|
46
|
-
themeProps,
|
|
47
|
-
);
|
|
41
|
+
return createUseComponentThemeReturn(componentTheme, cx, themeProps);
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
let getClassNames: Record<string, (...args: ClassName[]) => string> = {};
|
|
51
45
|
|
|
52
46
|
for (let element of themeDefinition?.elements ?? []) {
|
|
53
47
|
getClassNames[element] = createUseComponentThemeReturn(
|
|
54
|
-
componentTheme
|
|
55
|
-
| ComponentTheme<{variants: ComponentThemeDefinitionVariants}>
|
|
56
|
-
| ComponentTheme<undefined>,
|
|
48
|
+
componentTheme,
|
|
57
49
|
cx,
|
|
58
50
|
themeProps,
|
|
59
51
|
element,
|
|
@@ -52,7 +52,7 @@ export function createUseComponentThemeReturn(
|
|
|
52
52
|
let selector = themeProps[cvKey as keyof typeof themeProps];
|
|
53
53
|
|
|
54
54
|
if (Array.isArray(cvSelector)) {
|
|
55
|
-
if (!cvSelector.includes(selector
|
|
55
|
+
if (!cvSelector.includes(selector)) {
|
|
56
56
|
matchesAllSelectors = false;
|
|
57
57
|
|
|
58
58
|
break;
|