@fuf-stack/pixel-utils 0.4.1 → 0.4.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixel-utils/dist/index.cjs","../src/cn.ts","../src/theme.ts","../src/tv.ts"],"names":["classNames"],"mappings":"AAAA;ACGA,gGAAuB;AACvB,+CAAwB;AAiBjB,IAAM,GAAA,EAAK,CAAA,GAAI,OAAA,EAAA,GAAmC;AAGvD,EAAA,OAAO,oCAAA,kCAAQ,GAAc,OAAO,CAAC,CAAA;AACvC,CAAA;ADnBA;AACA;AENA,0CAAuB;AFQvB;AACA;AGPA,qDAAuC;AAmChC,IAAM,GAAA,EAAK,oBAAA;AA4CX,IAAM,qBAAA,EAAuB,CAClC,QAAA,EACA,SAAA,EACA,QAAA,EAAA,GAC4B;AAC5B,EAAA,MAAMA,YAAAA,EACJ,OAAO,UAAA,IAAc,SAAA,GAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,SAAS,EAAA,EAAI,UAAA,EAAY,CAAC,CAAA;AAE5E,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,MAAA;AAAA,IAC9B,CAAC,GAAA,EAAK,CAAC,IAAA,EAAM,SAAS,CAAA,EAAA,GAAM;AAC1B,MAAA,MAAM,QAAA,EAAU,IAAA;AAChB,MAAA,MAAM,cAAA,EACJ,OAAO,UAAA,IAAc,SAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,SAAS,EAAA,EACpD,UAAA,EACAA,WAAAA,CAAW,IAAI,CAAA;AAGrB,MAAA,GAAA,CAAI,OAAO,EAAA,EAAI,SAAA,CAAU;AAAA,QACvB,SAAA,EACE,SAAA,GAAY,KAAA,IAAS,SAAA,EAAW,cAAA,EAAgBA,WAAAA,CAAW,IAAI;AAAA,MACnE,CAAC,CAAA;AAED,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA,CAAC;AAAA,EACH,CAAA;AACF,CAAA;AHjFA;AACE;AACA;AACA;AACA;AACF,sHAAC","file":"/home/runner/work/pixels/pixels/packages/pixel-utils/dist/index.cjs","sourcesContent":[null,"/* eslint-disable import/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function that combines `classnames` and `tailwind-merge`.\n *\n * It takes multiple class values (strings, arrays, or objects), merges them,\n * and ensures Tailwind CSS classes are handled properly by resolving conflicts.\n *\n * @param classes - A list of class names that can be strings, objects, or arrays.\n * @returns A string of combined class names with Tailwind CSS conflict resolution.\n *\n * Example usage:\n * ```\n * cn('p-4', 'text-center', { 'bg-red-500': true, 'p-2': false });\n * // Output: 'text-center bg-red-500 p-4'\n * ```\n */\nexport const cn = (...classes: ArgumentArray): string => {\n // First, `classnames` merges the input class names (conditionally if needed).\n // Then, `twMerge` is used to resolve any Tailwind CSS conflicts.\n return twMerge(classNames(...classes));\n};\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\nimport type { ClassProp } from 'tailwind-variants';\n\nimport { tv as tailwindVariants } from 'tailwind-variants';\n\n/**\n * Represents a class value which can be either a string or an array of strings\n * Used for handling both single class names and multiple class names\n */\ntype ClassValue = string | string[];\n\n/**\n * Props accepted by tailwind-variants slot functions\n * Combines a dynamic record of string/number values with the ClassProp from tailwind-variants\n */\ntype TVSlotProps = {\n [x: string]: string | number | undefined;\n [x: number]: string | number | undefined;\n} & ClassProp<ClassValue>;\n\n/**\n * Represents a tailwind-variants slot function\n * Takes optional TVSlotProps and returns a string of class names\n */\ntype TVFunction = {\n (slotProps?: TVSlotProps | undefined): string;\n};\n\n/**\n * A record of slot names to their corresponding tailwind-variants functions\n * Used to type the variants parameter in variantsToClassNames\n */\ntype TVRecord = Record<string, TVFunction>;\n\n/**\n * Re-export of tailwind-variants tv function\n * Used to create variant definitions with slots and variants\n */\nexport const tv = tailwindVariants;\n\n/**\n * Extracts variant props from a tailwind-variants component\n * Used for typing component props that use variants\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n/**\n * Extracts className type from a tailwind-variants component\n * Can be either a partial record of slot names to class values, or a single class value\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, ClassValue>>\n | ClassValue;\n\n/**\n * Converts tailwind-variants slots instance to actual classnames object\n *\n * @param variants - Object containing slot variant functions from tailwind-variants\n * @param className - Optional class names to merge with variant classes. Can be string, array, or record\n * @param baseSlot - Optional slot name to apply global className to\n * @returns Record mapping slot names to their final class name strings\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: 'bg-white', content: 'p-4' } });\n * const classes = variantsToClassNames(variants(), 'shadow-lg', 'base');\n * // Result: { base: 'bg-white shadow-lg', content: 'p-4' }\n * ```\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: '', content: '' } });\n * const classes = variantsToClassNames(variants(), {\n * base: 'bg-white',\n * content: ['p-4', 'text-gray-700']\n * });\n * // Result: { base: 'bg-white', content: 'p-4 text-gray-700' }\n * ```\n */\nexport const variantsToClassNames = <T extends TVRecord>(\n variants: T,\n className?: ClassValue | Record<string, ClassValue>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNames =\n typeof className === 'object' && !Array.isArray(className) ? className : {};\n\n return Object.entries(variants).reduce(\n (acc, [slot, variantFn]) => {\n const slotKey = slot as keyof T;\n const slotClassName =\n typeof className === 'string' || Array.isArray(className)\n ? className\n : classNames[slot];\n\n // @ts-expect-error not sure here\n acc[slotKey] = variantFn({\n className:\n baseSlot && slot === baseSlot ? slotClassName : classNames[slot],\n });\n\n return acc;\n },\n {} as Record<keyof T, string>,\n );\n};\n"]}
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixel-utils/dist/index.cjs","../src/cn.ts","../src/theme.ts","../src/tv.ts"],"names":["classNames"],"mappings":"AAAA;ACGA,gGAAuB;AACvB,+CAAwB;AAiBjB,IAAM,GAAA,EAAK,CAAA,GAAI,OAAA,EAAA,GAA2B;AAG/C,EAAA,OAAO,oCAAA,kCAAQ,GAAc,OAAO,CAAC,CAAA;AACvC,CAAA;ADnBA;AACA;AENA,0CAAuB;AFQvB;AACA;AGPA,qDAAuC;AAmChC,IAAM,GAAA,EAAS,oBAAA;AA4Cf,IAAM,qBAAA,EAAuB,CAClC,QAAA,EACA,SAAA,EACA,QAAA,EAAA,GAC4B;AAC5B,EAAA,MAAMA,YAAAA,EACJ,OAAO,UAAA,IAAc,SAAA,GAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,SAAS,EAAA,EAAI,UAAA,EAAY,CAAC,CAAA;AAE5E,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,MAAA;AAAA,IAC9B,CAAC,GAAA,EAAK,CAAC,IAAA,EAAM,SAAS,CAAA,EAAA,GAAM;AAC1B,MAAA,MAAM,QAAA,EAAU,IAAA;AAChB,MAAA,MAAM,cAAA,EACJ,OAAO,UAAA,IAAc,SAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,SAAS,EAAA,EACpD,UAAA,EACAA,WAAAA,CAAW,IAAI,CAAA;AAGrB,MAAA,GAAA,CAAI,OAAO,EAAA,EAAI,SAAA,CAAU;AAAA,QACvB,SAAA,EACE,SAAA,GAAY,KAAA,IAAS,SAAA,EAAW,cAAA,EAAgBA,WAAAA,CAAW,IAAI;AAAA,MACnE,CAAC,CAAA;AAED,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA,CAAC;AAAA,EACH,CAAA;AACF,CAAA;AHjFA;AACE;AACA;AACA;AACA;AACF,sHAAC","file":"/home/runner/work/pixels/pixels/packages/pixel-utils/dist/index.cjs","sourcesContent":[null,"/* eslint-disable import/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function that combines `classnames` and `tailwind-merge`.\n *\n * It takes multiple class values (strings, arrays, or objects), merges them,\n * and ensures Tailwind CSS classes are handled properly by resolving conflicts.\n *\n * @param classes - A list of class names that can be strings, objects, or arrays.\n * @returns A string of combined class names with Tailwind CSS conflict resolution.\n *\n * Example usage:\n * ```\n * cn('p-4', 'text-center', { 'bg-red-500': true, 'p-2': false });\n * // Output: 'text-center bg-red-500 p-4'\n * ```\n */\nexport const cn = (...classes: ArgumentArray) => {\n // First, `classnames` merges the input class names (conditionally if needed).\n // Then, `twMerge` is used to resolve any Tailwind CSS conflicts.\n return twMerge(classNames(...classes)) as unknown as string;\n};\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\nimport type { ClassProp, TV } from 'tailwind-variants';\n\nimport { tv as tailwindVariants } from 'tailwind-variants';\n\n/**\n * Represents a class value which can be either a string or an array of strings\n * Used for handling both single class names and multiple class names\n */\nexport type ClassValue = string | string[];\n\n/**\n * Props accepted by tailwind-variants slot functions\n * Combines a dynamic record of string/number values with the ClassProp from tailwind-variants\n */\ntype TVSlotProps = {\n [x: string]: string | number | undefined;\n [x: number]: string | number | undefined;\n} & ClassProp<ClassValue>;\n\n/**\n * Represents a tailwind-variants slot function\n * Takes optional TVSlotProps and returns a string of class names\n */\ntype TVFunction = {\n (slotProps?: TVSlotProps | undefined): string;\n};\n\n/**\n * A record of slot names to their corresponding tailwind-variants functions\n * Used to type the variants parameter in variantsToClassNames\n */\ntype TVRecord = Record<string, TVFunction>;\n\n/**\n * Re-export of tailwind-variants tv function\n * Used to create variant definitions with slots and variants\n */\nexport const tv: TV = tailwindVariants;\n\n/**\n * Extracts variant props from a tailwind-variants component\n * Used for typing component props that use variants\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n/**\n * Extracts className type from a tailwind-variants component\n * Can be either a partial record of slot names to class values, or a single class value\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, ClassValue>>\n | ClassValue;\n\n/**\n * Converts tailwind-variants slots instance to actual classnames object\n *\n * @param variants - Object containing slot variant functions from tailwind-variants\n * @param className - Optional class names to merge with variant classes. Can be string, array, or record\n * @param baseSlot - Optional slot name to apply global className to\n * @returns Record mapping slot names to their final class name strings\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: 'bg-white', content: 'p-4' } });\n * const classes = variantsToClassNames(variants(), 'shadow-lg', 'base');\n * // Result: { base: 'bg-white shadow-lg', content: 'p-4' }\n * ```\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: '', content: '' } });\n * const classes = variantsToClassNames(variants(), {\n * base: 'bg-white',\n * content: ['p-4', 'text-gray-700']\n * });\n * // Result: { base: 'bg-white', content: 'p-4 text-gray-700' }\n * ```\n */\nexport const variantsToClassNames = <T extends TVRecord>(\n variants: T,\n className?: ClassValue | Record<string, ClassValue>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNames =\n typeof className === 'object' && !Array.isArray(className) ? className : {};\n\n return Object.entries(variants).reduce(\n (acc, [slot, variantFn]) => {\n const slotKey = slot as keyof T;\n const slotClassName =\n typeof className === 'string' || Array.isArray(className)\n ? className\n : classNames[slot];\n\n // @ts-expect-error not sure here\n acc[slotKey] = variantFn({\n className:\n baseSlot && slot === baseSlot ? slotClassName : classNames[slot],\n });\n\n return acc;\n },\n {} as Record<keyof T, string>,\n );\n};\n"]}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { ArgumentArray } from 'classnames';
2
2
  import { VariantProps } from '@nextui-org/theme';
3
3
  export { nextui } from '@nextui-org/theme';
4
- import * as tailwind_variants from 'tailwind-variants';
5
- import { ClassProp } from 'tailwind-variants';
4
+ import { TV, ClassProp } from 'tailwind-variants';
6
5
 
7
6
  /**
8
7
  * A utility function that combines `classnames` and `tailwind-merge`.
@@ -50,7 +49,7 @@ type TVRecord = Record<string, TVFunction>;
50
49
  * Re-export of tailwind-variants tv function
51
50
  * Used to create variant definitions with slots and variants
52
51
  */
53
- declare const tv: tailwind_variants.TV;
52
+ declare const tv: TV;
54
53
  /**
55
54
  * Extracts variant props from a tailwind-variants component
56
55
  * Used for typing component props that use variants
@@ -88,4 +87,4 @@ type TVClassName<Component extends (...args: any) => any> = Partial<Record<keyof
88
87
  */
89
88
  declare const variantsToClassNames: <T extends TVRecord>(variants: T, className?: ClassValue | Record<string, ClassValue>, baseSlot?: keyof T) => Record<keyof T, string>;
90
89
 
91
- export { type TVClassName, type TVProps, cn, tv, variantsToClassNames };
90
+ export { type ClassValue, type TVClassName, type TVProps, cn, tv, variantsToClassNames };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { ArgumentArray } from 'classnames';
2
2
  import { VariantProps } from '@nextui-org/theme';
3
3
  export { nextui } from '@nextui-org/theme';
4
- import * as tailwind_variants from 'tailwind-variants';
5
- import { ClassProp } from 'tailwind-variants';
4
+ import { TV, ClassProp } from 'tailwind-variants';
6
5
 
7
6
  /**
8
7
  * A utility function that combines `classnames` and `tailwind-merge`.
@@ -50,7 +49,7 @@ type TVRecord = Record<string, TVFunction>;
50
49
  * Re-export of tailwind-variants tv function
51
50
  * Used to create variant definitions with slots and variants
52
51
  */
53
- declare const tv: tailwind_variants.TV;
52
+ declare const tv: TV;
54
53
  /**
55
54
  * Extracts variant props from a tailwind-variants component
56
55
  * Used for typing component props that use variants
@@ -88,4 +87,4 @@ type TVClassName<Component extends (...args: any) => any> = Partial<Record<keyof
88
87
  */
89
88
  declare const variantsToClassNames: <T extends TVRecord>(variants: T, className?: ClassValue | Record<string, ClassValue>, baseSlot?: keyof T) => Record<keyof T, string>;
90
89
 
91
- export { type TVClassName, type TVProps, cn, tv, variantsToClassNames };
90
+ export { type ClassValue, type TVClassName, type TVProps, cn, tv, variantsToClassNames };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cn.ts","../src/theme.ts","../src/tv.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function that combines `classnames` and `tailwind-merge`.\n *\n * It takes multiple class values (strings, arrays, or objects), merges them,\n * and ensures Tailwind CSS classes are handled properly by resolving conflicts.\n *\n * @param classes - A list of class names that can be strings, objects, or arrays.\n * @returns A string of combined class names with Tailwind CSS conflict resolution.\n *\n * Example usage:\n * ```\n * cn('p-4', 'text-center', { 'bg-red-500': true, 'p-2': false });\n * // Output: 'text-center bg-red-500 p-4'\n * ```\n */\nexport const cn = (...classes: ArgumentArray): string => {\n // First, `classnames` merges the input class names (conditionally if needed).\n // Then, `twMerge` is used to resolve any Tailwind CSS conflicts.\n return twMerge(classNames(...classes));\n};\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\nimport type { ClassProp } from 'tailwind-variants';\n\nimport { tv as tailwindVariants } from 'tailwind-variants';\n\n/**\n * Represents a class value which can be either a string or an array of strings\n * Used for handling both single class names and multiple class names\n */\ntype ClassValue = string | string[];\n\n/**\n * Props accepted by tailwind-variants slot functions\n * Combines a dynamic record of string/number values with the ClassProp from tailwind-variants\n */\ntype TVSlotProps = {\n [x: string]: string | number | undefined;\n [x: number]: string | number | undefined;\n} & ClassProp<ClassValue>;\n\n/**\n * Represents a tailwind-variants slot function\n * Takes optional TVSlotProps and returns a string of class names\n */\ntype TVFunction = {\n (slotProps?: TVSlotProps | undefined): string;\n};\n\n/**\n * A record of slot names to their corresponding tailwind-variants functions\n * Used to type the variants parameter in variantsToClassNames\n */\ntype TVRecord = Record<string, TVFunction>;\n\n/**\n * Re-export of tailwind-variants tv function\n * Used to create variant definitions with slots and variants\n */\nexport const tv = tailwindVariants;\n\n/**\n * Extracts variant props from a tailwind-variants component\n * Used for typing component props that use variants\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n/**\n * Extracts className type from a tailwind-variants component\n * Can be either a partial record of slot names to class values, or a single class value\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, ClassValue>>\n | ClassValue;\n\n/**\n * Converts tailwind-variants slots instance to actual classnames object\n *\n * @param variants - Object containing slot variant functions from tailwind-variants\n * @param className - Optional class names to merge with variant classes. Can be string, array, or record\n * @param baseSlot - Optional slot name to apply global className to\n * @returns Record mapping slot names to their final class name strings\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: 'bg-white', content: 'p-4' } });\n * const classes = variantsToClassNames(variants(), 'shadow-lg', 'base');\n * // Result: { base: 'bg-white shadow-lg', content: 'p-4' }\n * ```\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: '', content: '' } });\n * const classes = variantsToClassNames(variants(), {\n * base: 'bg-white',\n * content: ['p-4', 'text-gray-700']\n * });\n * // Result: { base: 'bg-white', content: 'p-4 text-gray-700' }\n * ```\n */\nexport const variantsToClassNames = <T extends TVRecord>(\n variants: T,\n className?: ClassValue | Record<string, ClassValue>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNames =\n typeof className === 'object' && !Array.isArray(className) ? className : {};\n\n return Object.entries(variants).reduce(\n (acc, [slot, variantFn]) => {\n const slotKey = slot as keyof T;\n const slotClassName =\n typeof className === 'string' || Array.isArray(className)\n ? className\n : classNames[slot];\n\n // @ts-expect-error not sure here\n acc[slotKey] = variantFn({\n className:\n baseSlot && slot === baseSlot ? slotClassName : classNames[slot],\n });\n\n return acc;\n },\n {} as Record<keyof T, string>,\n );\n};\n"],"mappings":";AAGA,OAAO,gBAAgB;AACvB,SAAS,eAAe;AAiBjB,IAAM,KAAK,IAAI,YAAmC;AAGvD,SAAO,QAAQ,WAAW,GAAG,OAAO,CAAC;AACvC;;;ACxBA,SAAS,cAAc;;;ACEvB,SAAS,MAAM,wBAAwB;AAmChC,IAAM,KAAK;AA4CX,IAAM,uBAAuB,CAClC,UACA,WACA,aAC4B;AAC5B,QAAMA,cACJ,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IAAI,YAAY,CAAC;AAE5E,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,MAAM,SAAS,MAAM;AAC1B,YAAM,UAAU;AAChB,YAAM,gBACJ,OAAO,cAAc,YAAY,MAAM,QAAQ,SAAS,IACpD,YACAA,YAAW,IAAI;AAGrB,UAAI,OAAO,IAAI,UAAU;AAAA,QACvB,WACE,YAAY,SAAS,WAAW,gBAAgBA,YAAW,IAAI;AAAA,MACnE,CAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["classNames"]}
1
+ {"version":3,"sources":["../src/cn.ts","../src/theme.ts","../src/tv.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function that combines `classnames` and `tailwind-merge`.\n *\n * It takes multiple class values (strings, arrays, or objects), merges them,\n * and ensures Tailwind CSS classes are handled properly by resolving conflicts.\n *\n * @param classes - A list of class names that can be strings, objects, or arrays.\n * @returns A string of combined class names with Tailwind CSS conflict resolution.\n *\n * Example usage:\n * ```\n * cn('p-4', 'text-center', { 'bg-red-500': true, 'p-2': false });\n * // Output: 'text-center bg-red-500 p-4'\n * ```\n */\nexport const cn = (...classes: ArgumentArray) => {\n // First, `classnames` merges the input class names (conditionally if needed).\n // Then, `twMerge` is used to resolve any Tailwind CSS conflicts.\n return twMerge(classNames(...classes)) as unknown as string;\n};\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\nimport type { ClassProp, TV } from 'tailwind-variants';\n\nimport { tv as tailwindVariants } from 'tailwind-variants';\n\n/**\n * Represents a class value which can be either a string or an array of strings\n * Used for handling both single class names and multiple class names\n */\nexport type ClassValue = string | string[];\n\n/**\n * Props accepted by tailwind-variants slot functions\n * Combines a dynamic record of string/number values with the ClassProp from tailwind-variants\n */\ntype TVSlotProps = {\n [x: string]: string | number | undefined;\n [x: number]: string | number | undefined;\n} & ClassProp<ClassValue>;\n\n/**\n * Represents a tailwind-variants slot function\n * Takes optional TVSlotProps and returns a string of class names\n */\ntype TVFunction = {\n (slotProps?: TVSlotProps | undefined): string;\n};\n\n/**\n * A record of slot names to their corresponding tailwind-variants functions\n * Used to type the variants parameter in variantsToClassNames\n */\ntype TVRecord = Record<string, TVFunction>;\n\n/**\n * Re-export of tailwind-variants tv function\n * Used to create variant definitions with slots and variants\n */\nexport const tv: TV = tailwindVariants;\n\n/**\n * Extracts variant props from a tailwind-variants component\n * Used for typing component props that use variants\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n/**\n * Extracts className type from a tailwind-variants component\n * Can be either a partial record of slot names to class values, or a single class value\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, ClassValue>>\n | ClassValue;\n\n/**\n * Converts tailwind-variants slots instance to actual classnames object\n *\n * @param variants - Object containing slot variant functions from tailwind-variants\n * @param className - Optional class names to merge with variant classes. Can be string, array, or record\n * @param baseSlot - Optional slot name to apply global className to\n * @returns Record mapping slot names to their final class name strings\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: 'bg-white', content: 'p-4' } });\n * const classes = variantsToClassNames(variants(), 'shadow-lg', 'base');\n * // Result: { base: 'bg-white shadow-lg', content: 'p-4' }\n * ```\n *\n * @example\n * ```tsx\n * const variants = tv({ slots: { base: '', content: '' } });\n * const classes = variantsToClassNames(variants(), {\n * base: 'bg-white',\n * content: ['p-4', 'text-gray-700']\n * });\n * // Result: { base: 'bg-white', content: 'p-4 text-gray-700' }\n * ```\n */\nexport const variantsToClassNames = <T extends TVRecord>(\n variants: T,\n className?: ClassValue | Record<string, ClassValue>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNames =\n typeof className === 'object' && !Array.isArray(className) ? className : {};\n\n return Object.entries(variants).reduce(\n (acc, [slot, variantFn]) => {\n const slotKey = slot as keyof T;\n const slotClassName =\n typeof className === 'string' || Array.isArray(className)\n ? className\n : classNames[slot];\n\n // @ts-expect-error not sure here\n acc[slotKey] = variantFn({\n className:\n baseSlot && slot === baseSlot ? slotClassName : classNames[slot],\n });\n\n return acc;\n },\n {} as Record<keyof T, string>,\n );\n};\n"],"mappings":";AAGA,OAAO,gBAAgB;AACvB,SAAS,eAAe;AAiBjB,IAAM,KAAK,IAAI,YAA2B;AAG/C,SAAO,QAAQ,WAAW,GAAG,OAAO,CAAC;AACvC;;;ACxBA,SAAS,cAAc;;;ACEvB,SAAS,MAAM,wBAAwB;AAmChC,IAAM,KAAS;AA4Cf,IAAM,uBAAuB,CAClC,UACA,WACA,aAC4B;AAC5B,QAAMA,cACJ,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IAAI,YAAY,CAAC;AAE5E,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,MAAM,SAAS,MAAM;AAC1B,YAAM,UAAU;AAChB,YAAM,gBACJ,OAAO,cAAc,YAAY,MAAM,QAAQ,SAAS,IACpD,YACAA,YAAW,IAAI;AAGrB,UAAI,OAAO,IAAI,UAAU;AAAA,QACvB,WACE,YAAY,SAAS,WAAW,gBAAgBA,YAAW,IAAI;AAAA,MACnE,CAAC;AAED,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["classNames"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fuf-stack/pixel-utils",
3
3
  "description": "fuf pixels helper utils",
4
4
  "author": "Hannes Tiede",
5
- "version": "0.4.1",
5
+ "version": "0.4.3",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
@@ -37,9 +37,9 @@
37
37
  "url": "https://github.com/fuf-stack/pixels/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@nextui-org/theme": "2.2.11",
40
+ "@nextui-org/theme": "2.4.4",
41
41
  "classnames": "2.5.1",
42
- "tailwind-merge": "2.5.5",
42
+ "tailwind-merge": "2.6.0",
43
43
  "tailwind-variants": "0.3.0"
44
44
  },
45
45
  "devDependencies": {