@fuf-stack/pixel-utils 1.4.1 → 1.5.0
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/index.d.mts +0 -30
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ArgumentArray } from "classnames";
|
|
2
2
|
import { Options } from "slug";
|
|
3
|
-
//#region src/cn.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A utility function that combines `classnames` and `tailwind-merge`.
|
|
6
5
|
*
|
|
@@ -17,8 +16,6 @@ import { Options } from "slug";
|
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
18
|
export declare const cn: (...classes: ArgumentArray) => string;
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/isTestEnvironment.d.ts
|
|
22
19
|
/**
|
|
23
20
|
* Checks if the code is running in a test environment.
|
|
24
21
|
*
|
|
@@ -42,8 +39,6 @@ export declare const cn: (...classes: ArgumentArray) => string;
|
|
|
42
39
|
* ```
|
|
43
40
|
*/
|
|
44
41
|
export declare const isTestEnvironment: () => boolean;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region ../../node_modules/.pnpm/tailwind-merge@3.7.0/node_modules/tailwind-merge/dist/types.d.ts
|
|
47
42
|
/**
|
|
48
43
|
* The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
|
|
49
44
|
*
|
|
@@ -250,8 +245,6 @@ type AnyThemeGroupIds = string;
|
|
|
250
245
|
type AnyConfig = Config$1<AnyClassGroupIds, AnyThemeGroupIds>;
|
|
251
246
|
type CreateConfigSubsequent = (config: AnyConfig) => AnyConfig;
|
|
252
247
|
declare const extendTailwindMerge: <AdditionalClassGroupIds extends string = never, AdditionalThemeGroupIds extends string = never>(configExtension: ConfigExtension<DefaultClassGroupIds | AdditionalClassGroupIds, DefaultThemeGroupIds | AdditionalThemeGroupIds> | CreateConfigSubsequent, ...createConfig: CreateConfigSubsequent[]) => (...classLists: ClassNameValue[]) => string;
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region src/proseTwMerge.d.ts
|
|
255
248
|
type ProseClassGroupIds = 'prose-size' | 'prose-color';
|
|
256
249
|
export declare const proseTwMergeClassGroups: NonNullable<NonNullable<ConfigExtension<ProseClassGroupIds, never>['extend']>['classGroups']>;
|
|
257
250
|
/**
|
|
@@ -260,15 +253,11 @@ export declare const proseTwMergeClassGroups: NonNullable<NonNullable<ConfigExte
|
|
|
260
253
|
* that need prose-aware class merging outside of `cn`.
|
|
261
254
|
*/
|
|
262
255
|
export declare const proseTwMerge: (...classLists: ClassNameValue[]) => string;
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/slugify.d.ts
|
|
265
256
|
interface SlugifyOptions extends Options {
|
|
266
257
|
/** When true, dots are also replaced (default is false) */
|
|
267
258
|
replaceDots?: boolean;
|
|
268
259
|
}
|
|
269
260
|
export declare const slugify: (string: string, options?: SlugifyOptions) => string;
|
|
270
|
-
//#endregion
|
|
271
|
-
//#region ../../node_modules/.pnpm/tailwind-variants@3.2.2_tailwind-merge@3.7.0_tailwindcss@4.3.3/node_modules/tailwind-variants/dist/config.d.ts
|
|
272
261
|
type MergeConfig = Parameters<typeof extendTailwindMerge>[0];
|
|
273
262
|
type LegacyMergeConfig = Extract<MergeConfig, {
|
|
274
263
|
extend?: unknown;
|
|
@@ -289,8 +278,6 @@ type TWMConfig = {
|
|
|
289
278
|
twMergeConfig?: TWMergeConfig;
|
|
290
279
|
};
|
|
291
280
|
type TVConfig = TWMConfig;
|
|
292
|
-
//#endregion
|
|
293
|
-
//#region ../../node_modules/.pnpm/tailwind-variants@3.2.2_tailwind-merge@3.7.0_tailwindcss@4.3.3/node_modules/tailwind-variants/dist/types.d.ts
|
|
294
281
|
type ClassProp<V extends unknown = ClassNameValue> = {
|
|
295
282
|
class?: V;
|
|
296
283
|
className?: never;
|
|
@@ -396,8 +383,6 @@ type TV = {
|
|
|
396
383
|
config?: TVConfig): TVReturnType<V, S, B, EV, ES, E>;
|
|
397
384
|
};
|
|
398
385
|
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
|
|
399
|
-
//#endregion
|
|
400
|
-
//#region ../../node_modules/.pnpm/@heroui+theme@2.4.26_tailwindcss@4.3.3/node_modules/@heroui/theme/dist/colors/types.d.ts
|
|
401
386
|
type ColorScale = Partial<{
|
|
402
387
|
50: string;
|
|
403
388
|
100: string;
|
|
@@ -431,8 +416,6 @@ type ThemeColors = BaseColors & {
|
|
|
431
416
|
warning: ColorScale;
|
|
432
417
|
danger: ColorScale;
|
|
433
418
|
};
|
|
434
|
-
//#endregion
|
|
435
|
-
//#region ../../node_modules/.pnpm/@heroui+theme@2.4.26_tailwindcss@4.3.3/node_modules/@heroui/theme/dist/types.d.ts
|
|
436
419
|
type DefaultThemeType = "light" | "dark";
|
|
437
420
|
type BaseThemeUnit = {
|
|
438
421
|
small?: string;
|
|
@@ -567,8 +550,6 @@ type HeroUIPluginConfig = {
|
|
|
567
550
|
*/
|
|
568
551
|
defaultExtendTheme?: DefaultThemeType;
|
|
569
552
|
};
|
|
570
|
-
//#endregion
|
|
571
|
-
//#region ../../node_modules/.pnpm/tailwindcss@4.3.3/node_modules/tailwindcss/dist/colors.d.mts
|
|
572
553
|
declare const _default: {
|
|
573
554
|
inherit: string;
|
|
574
555
|
current: string;
|
|
@@ -914,8 +895,6 @@ declare const _default: {
|
|
|
914
895
|
'950': string;
|
|
915
896
|
};
|
|
916
897
|
};
|
|
917
|
-
//#endregion
|
|
918
|
-
//#region ../../node_modules/.pnpm/tailwindcss@4.3.3/node_modules/tailwindcss/dist/resolve-config-QUZ9b-Gn.d.mts
|
|
919
898
|
type NamedUtilityValue = {
|
|
920
899
|
kind: 'named';
|
|
921
900
|
/**
|
|
@@ -940,8 +919,6 @@ type PluginUtils = {
|
|
|
940
919
|
theme: (keypath: string, defaultValue?: any) => any;
|
|
941
920
|
colors: typeof _default;
|
|
942
921
|
};
|
|
943
|
-
//#endregion
|
|
944
|
-
//#region ../../node_modules/.pnpm/tailwindcss@4.3.3/node_modules/tailwindcss/dist/types-DWdTiksJ.d.mts
|
|
945
922
|
/**
|
|
946
923
|
* The source code for one or more nodes in the AST
|
|
947
924
|
*
|
|
@@ -1064,21 +1041,15 @@ interface UserConfig {
|
|
|
1064
1041
|
interface UserConfig {
|
|
1065
1042
|
experimental?: 'all' | Record<string, boolean>;
|
|
1066
1043
|
}
|
|
1067
|
-
//#endregion
|
|
1068
|
-
//#region ../../node_modules/.pnpm/tailwindcss@4.3.3/node_modules/tailwindcss/dist/plugin.d.mts
|
|
1069
1044
|
declare function createPlugin(handler: PluginFn, config?: Partial<Config>): PluginWithConfig;
|
|
1070
1045
|
declare namespace createPlugin {
|
|
1071
1046
|
var withOptions: <T>(pluginFunction: (options?: T) => PluginFn, configFunction?: (options?: T) => Partial<Config>) => PluginWithOptions<T>;
|
|
1072
1047
|
}
|
|
1073
|
-
//#endregion
|
|
1074
|
-
//#region ../../node_modules/.pnpm/@heroui+theme@2.4.26_tailwindcss@4.3.3/node_modules/@heroui/theme/dist/plugin.d.ts
|
|
1075
1048
|
/**
|
|
1076
1049
|
* Based on tw-colors by L-Blondy
|
|
1077
1050
|
* @see https://github.com/L-Blondy/tw-colors
|
|
1078
1051
|
*/
|
|
1079
1052
|
declare const heroui: (config?: HeroUIPluginConfig) => ReturnType<typeof createPlugin>;
|
|
1080
|
-
//#endregion
|
|
1081
|
-
//#region src/tv.d.ts
|
|
1082
1053
|
/**
|
|
1083
1054
|
* Represents a class value which can be either a string or an array of strings
|
|
1084
1055
|
* Used for handling both single class names and multiple class names
|
|
@@ -1143,6 +1114,5 @@ export type TVClassName<Component extends (...args: any) => any> = Partial<Recor
|
|
|
1143
1114
|
* ```
|
|
1144
1115
|
*/
|
|
1145
1116
|
export declare const variantsToClassNames: <T extends TVRecord>(variants: T, className?: ClassValue | Record<string, ClassValue>, baseSlot?: keyof T) => Record<keyof T, string>;
|
|
1146
|
-
//#endregion
|
|
1147
1117
|
export { heroui };
|
|
1148
1118
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/cn.ts","../src/isTestEnvironment.ts","../../../node_modules/.pnpm/tailwind-merge@3.7.0/node_modules/tailwind-merge/dist/types.d.ts","../src/proseTwMerge.ts","../src/slugify.ts","../../../node_modules/.pnpm/tailwind-variants@3.2.2_tailwind-merge@3.7.0_tailwindcss@4.3.
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Config","_$tailwind_merge0.ClassNameValue","SlugOptions","ClassValue","TVProps","plugin"],"sources":["../src/cn.ts","../src/isTestEnvironment.ts","../../../node_modules/.pnpm/tailwind-merge@3.7.0/node_modules/tailwind-merge/dist/types.d.ts","../src/proseTwMerge.ts","../src/slugify.ts","../../../node_modules/.pnpm/tailwind-variants@3.2.2_tailwind-merge@3.7.0_tailwindcss@4.3.4/node_modules/tailwind-variants/dist/config.d.ts","../../../node_modules/.pnpm/tailwind-variants@3.2.2_tailwind-merge@3.7.0_tailwindcss@4.3.4/node_modules/tailwind-variants/dist/types.d.ts","../../../node_modules/.pnpm/@heroui+theme@2.4.26_tailwindcss@4.3.4/node_modules/@heroui/theme/dist/colors/types.d.ts","../../../node_modules/.pnpm/@heroui+theme@2.4.26_tailwindcss@4.3.4/node_modules/@heroui/theme/dist/types.d.ts","../../../node_modules/.pnpm/tailwindcss@4.3.4/node_modules/tailwindcss/dist/colors.d.mts","../../../node_modules/.pnpm/tailwindcss@4.3.4/node_modules/tailwindcss/dist/resolve-config-QUZ9b-Gn.d.mts","../../../node_modules/.pnpm/tailwindcss@4.3.4/node_modules/tailwindcss/dist/types-DWdTiksJ.d.mts","../../../node_modules/.pnpm/tailw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ACA;EACD;EACA;EACA;;KAEC,gBAAgB;EACjB;;UAEM;;;;;;;;;;;;;EAaN,WAAW;;;;;;;;;;;;;EAaX,aAAa;;;;;;;;;;;;EAYb,SAAS;;;;;;;;EAQT;;;;;;;;EAQA;;;;;;;EAOA;;;;;;;;;;;EAWA,cAAc;;;;;;;;;;;EAWd,YAAY;;KAEX;EACD;EACA,SAAS;EACT,SAAS,QAAQ;;KAEhB,eAAe,eAAe;;;;;KAK9B;;;;;EAKD;;;;;EAKA;;;;EAIA,SAAS;;;;EAIT,SAAS;;;;;EAKT,eAAe;;;;;EAKf,qBAAqB;;cCtIX;EACV;EACA;EACA;EACA;EACA;EACA;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEJ;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;;KC1TH;EACD;;;;;;;;;;EAUA;;;;;;;EAOA;;KA0IC;EACD,QAAQ,iBAAiB;EACzB,eAAe;;;;;;;UCnLT;;;;;;EAMN;;;;EAIA;;;;;;;;;KASC,kBAAkB,QAAQ,QAAQ,eAAe;KAEjD,SAAS;KACT,YAAY,KAAK;KACjB;EACD,SAAS;EACT,SAAS;;EAET;EACA,MAAM;;KAEL,kBAAkB;GAClB,UAAU,IAAI;EACf;;KAEC,SAAS,WAAW,mBAAmB;KACvC;EACD,QAAQ,MAAM;EACd,WAAW,cAAc,6BAA6B;EACtD,aAAa,YAAY,cAAc,KAAK,OAAO,YAAY;IAC3D;2BACqB;IACrB,SAAS,eAAe;IACxB,MAAM;MACF,OAAO;MACP;OACD;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AChB,aAAa"}
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { extendTailwindMerge, validators } from "tailwind-merge";
|
|
|
3
3
|
import slug from "slug";
|
|
4
4
|
import { heroui } from "@heroui/theme";
|
|
5
5
|
import { tv as tv$1 } from "tailwind-variants";
|
|
6
|
-
|
|
6
|
+
// src/proseTwMerge.ts
|
|
7
7
|
/**
|
|
8
8
|
* Typography plugin size classes are standalone tokens like `prose-sm`
|
|
9
9
|
* instead of regular utilities, so we register them as a custom merge group.
|
|
@@ -28,8 +28,7 @@ const proseTwMergeClassGroups = {
|
|
|
28
28
|
* that need prose-aware class merging outside of `cn`.
|
|
29
29
|
*/
|
|
30
30
|
const proseTwMerge = extendTailwindMerge({ extend: { classGroups: proseTwMergeClassGroups } });
|
|
31
|
-
|
|
32
|
-
//#region src/cn.ts
|
|
31
|
+
// src/cn.ts
|
|
33
32
|
/**
|
|
34
33
|
* A utility function that combines `classnames` and `tailwind-merge`.
|
|
35
34
|
*
|
|
@@ -48,8 +47,7 @@ const proseTwMerge = extendTailwindMerge({ extend: { classGroups: proseTwMergeCl
|
|
|
48
47
|
const cn = (...classes) => {
|
|
49
48
|
return proseTwMerge(classNames(...classes));
|
|
50
49
|
};
|
|
51
|
-
|
|
52
|
-
//#region src/isTestEnvironment.ts
|
|
50
|
+
// src/isTestEnvironment.ts
|
|
53
51
|
/**
|
|
54
52
|
* Checks if the code is running in a test environment.
|
|
55
53
|
*
|
|
@@ -75,8 +73,7 @@ const cn = (...classes) => {
|
|
|
75
73
|
const isTestEnvironment = () => {
|
|
76
74
|
return typeof process !== "undefined" && (process.env.NODE_ENV === "test" || process.env.VITEST === "true");
|
|
77
75
|
};
|
|
78
|
-
|
|
79
|
-
//#region src/slugify.ts
|
|
76
|
+
// src/slugify.ts
|
|
80
77
|
const slugify = (string, options) => {
|
|
81
78
|
const replacement = options?.replacement ?? "_";
|
|
82
79
|
const replaceDots = options?.replaceDots ?? false;
|
|
@@ -91,8 +88,7 @@ const slugify = (string, options) => {
|
|
|
91
88
|
...options ?? {}
|
|
92
89
|
});
|
|
93
90
|
};
|
|
94
|
-
|
|
95
|
-
//#region src/tv.ts
|
|
91
|
+
// src/tv.ts
|
|
96
92
|
/**
|
|
97
93
|
* Re-export of tailwind-variants tv function
|
|
98
94
|
* Used to create variant definitions with slots and variants
|
|
@@ -132,7 +128,6 @@ const variantsToClassNames = (variants, className, baseSlot) => {
|
|
|
132
128
|
return acc;
|
|
133
129
|
}, {});
|
|
134
130
|
};
|
|
135
|
-
//#endregion
|
|
136
131
|
export { cn, heroui, isTestEnvironment, proseTwMerge, proseTwMergeClassGroups, slugify, tv, variantsToClassNames };
|
|
137
132
|
|
|
138
133
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["tailwindVariants"],"sources":["../src/proseTwMerge.ts","../src/cn.ts","../src/isTestEnvironment.ts","../src/slugify.ts","../src/tv.ts"],"sourcesContent":["import type { ConfigExtension } from 'tailwind-merge';\n\nimport { extendTailwindMerge, validators } from 'tailwind-merge';\n\ntype ProseClassGroupIds = 'prose-size' | 'prose-color';\n\n/**\n * Typography plugin size classes are standalone tokens like `prose-sm`\n * instead of regular utilities, so we register them as a custom merge group.\n */\nconst isProseSize = (value: string): boolean => {\n return value === 'base' || validators.isTshirtSize(value);\n};\n\n/**\n * Typography plugin color themes are also standalone `prose-*` classes.\n * Keep `prose-invert` out of this group so it can coexist with a color class.\n */\nconst isProseColor = (value: string): boolean => {\n return (\n value !== 'invert' &&\n !isProseSize(value) &&\n (validators.isAnyNonArbitrary(value) || validators.isArbitraryValue(value))\n );\n};\n\nexport const proseTwMergeClassGroups: NonNullable<\n NonNullable<\n ConfigExtension<ProseClassGroupIds, never>['extend']\n >['classGroups']\n> = {\n // Typography plugin sizes are mutually exclusive standalone classes.\n 'prose-size': [{ prose: [isProseSize] }],\n // Typography plugin color themes are also mutually exclusive standalone classes.\n 'prose-color': [{ prose: [isProseColor] }],\n};\n\n/**\n * Prose-aware `tailwind-merge` instance that deduplicates `prose-*` classes.\n * Used by `cn(...)` internally. Also exported for direct use in components\n * that need prose-aware class merging outside of `cn`.\n */\nexport const proseTwMerge = extendTailwindMerge<ProseClassGroupIds>({\n extend: {\n classGroups: proseTwMergeClassGroups,\n },\n});\n","/* eslint-disable import-x/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\n\nimport { proseTwMerge } from './proseTwMerge';\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, the shared prose-aware `tailwind-merge` instance resolves conflicts.\n return proseTwMerge(classNames(...classes));\n};\n","/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Checks if the code is running in a test environment.\n *\n * This helper safely detects test environments by checking:\n * - Node.js: `process.env.NODE_ENV === 'test'` or `process.env.VITEST === 'true'`\n * - Browser: Always returns `false` (production code)\n *\n * The check is safe for both Node.js and browser environments by verifying\n * that `process` exists before accessing its properties.\n *\n * @returns `true` if running in a test environment, `false` otherwise\n *\n * @example\n * ```ts\n * if (isTestEnvironment()) {\n * // Skip debouncing in tests for immediate snapshots\n * return value;\n * }\n * // Normal production behavior with debouncing\n * return debouncedValue;\n * ```\n */\nexport const isTestEnvironment = (): boolean => {\n // Safe check: only access process if it exists (Node.js environment)\n // In browsers, process is undefined, so this returns false\n return (\n typeof process !== 'undefined' &&\n (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true')\n );\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { Options as SlugOptions } from 'slug';\n\nimport slug from 'slug';\n\ninterface SlugifyOptions extends SlugOptions {\n /** When true, dots are also replaced (default is false) */\n replaceDots?: boolean;\n}\n\nexport const slugify = (string: string, options?: SlugifyOptions) => {\n const replacement = options?.replacement ?? '_';\n const replaceDots = options?.replaceDots ?? false;\n\n return slug(string, {\n ...slug.defaults.modes.rfc3986,\n charmap: {\n ...slug.defaults.modes.rfc3986.charmap,\n // do not replace dots when replaceDots is false\n ...(!replaceDots ? { '.': '.' } : { '.': replacement }),\n // convert hyphens to underscores (when replacement is not hyphen)\n ...(replacement !== '-' ? { '-': '_' } : {}),\n },\n replacement,\n ...(options ?? {}),\n });\n};\n","import type { VariantProps } from '@heroui/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 = (slotProps?: TVSlotProps) => string;\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":";;;;;;;;;;AAUA,MAAM,eAAe,UAA2B;CAC9C,OAAO,UAAU,UAAU,WAAW,aAAa,KAAK;AAC1D;;;;;AAMA,MAAM,gBAAgB,UAA2B;CAC/C,OACE,UAAU,YACV,CAAC,YAAY,KAAK,MACjB,WAAW,kBAAkB,KAAK,KAAK,WAAW,iBAAiB,KAAK;AAE7E;AAEA,MAAa,0BAIT;CAEF,cAAc,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;CAEvC,eAAe,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;AAC3C;;;;;;AAOA,MAAa,eAAe,oBAAwC,EAClE,QAAQ,EACN,aAAa,wBACf,EACF,CAAC
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["tailwindVariants"],"sources":["../src/proseTwMerge.ts","../src/cn.ts","../src/isTestEnvironment.ts","../src/slugify.ts","../src/tv.ts"],"sourcesContent":["import type { ConfigExtension } from 'tailwind-merge';\n\nimport { extendTailwindMerge, validators } from 'tailwind-merge';\n\ntype ProseClassGroupIds = 'prose-size' | 'prose-color';\n\n/**\n * Typography plugin size classes are standalone tokens like `prose-sm`\n * instead of regular utilities, so we register them as a custom merge group.\n */\nconst isProseSize = (value: string): boolean => {\n return value === 'base' || validators.isTshirtSize(value);\n};\n\n/**\n * Typography plugin color themes are also standalone `prose-*` classes.\n * Keep `prose-invert` out of this group so it can coexist with a color class.\n */\nconst isProseColor = (value: string): boolean => {\n return (\n value !== 'invert' &&\n !isProseSize(value) &&\n (validators.isAnyNonArbitrary(value) || validators.isArbitraryValue(value))\n );\n};\n\nexport const proseTwMergeClassGroups: NonNullable<\n NonNullable<\n ConfigExtension<ProseClassGroupIds, never>['extend']\n >['classGroups']\n> = {\n // Typography plugin sizes are mutually exclusive standalone classes.\n 'prose-size': [{ prose: [isProseSize] }],\n // Typography plugin color themes are also mutually exclusive standalone classes.\n 'prose-color': [{ prose: [isProseColor] }],\n};\n\n/**\n * Prose-aware `tailwind-merge` instance that deduplicates `prose-*` classes.\n * Used by `cn(...)` internally. Also exported for direct use in components\n * that need prose-aware class merging outside of `cn`.\n */\nexport const proseTwMerge = extendTailwindMerge<ProseClassGroupIds>({\n extend: {\n classGroups: proseTwMergeClassGroups,\n },\n});\n","/* eslint-disable import-x/prefer-default-export */\nimport type { ArgumentArray } from 'classnames';\n\nimport classNames from 'classnames';\n\nimport { proseTwMerge } from './proseTwMerge';\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, the shared prose-aware `tailwind-merge` instance resolves conflicts.\n return proseTwMerge(classNames(...classes));\n};\n","/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Checks if the code is running in a test environment.\n *\n * This helper safely detects test environments by checking:\n * - Node.js: `process.env.NODE_ENV === 'test'` or `process.env.VITEST === 'true'`\n * - Browser: Always returns `false` (production code)\n *\n * The check is safe for both Node.js and browser environments by verifying\n * that `process` exists before accessing its properties.\n *\n * @returns `true` if running in a test environment, `false` otherwise\n *\n * @example\n * ```ts\n * if (isTestEnvironment()) {\n * // Skip debouncing in tests for immediate snapshots\n * return value;\n * }\n * // Normal production behavior with debouncing\n * return debouncedValue;\n * ```\n */\nexport const isTestEnvironment = (): boolean => {\n // Safe check: only access process if it exists (Node.js environment)\n // In browsers, process is undefined, so this returns false\n return (\n typeof process !== 'undefined' &&\n (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true')\n );\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { Options as SlugOptions } from 'slug';\n\nimport slug from 'slug';\n\ninterface SlugifyOptions extends SlugOptions {\n /** When true, dots are also replaced (default is false) */\n replaceDots?: boolean;\n}\n\nexport const slugify = (string: string, options?: SlugifyOptions) => {\n const replacement = options?.replacement ?? '_';\n const replaceDots = options?.replaceDots ?? false;\n\n return slug(string, {\n ...slug.defaults.modes.rfc3986,\n charmap: {\n ...slug.defaults.modes.rfc3986.charmap,\n // do not replace dots when replaceDots is false\n ...(!replaceDots ? { '.': '.' } : { '.': replacement }),\n // convert hyphens to underscores (when replacement is not hyphen)\n ...(replacement !== '-' ? { '-': '_' } : {}),\n },\n replacement,\n ...(options ?? {}),\n });\n};\n","import type { VariantProps } from '@heroui/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 = (slotProps?: TVSlotProps) => string;\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":";;;;;;;;;;AAUA,MAAM,eAAe,UAA2B;CAC9C,OAAO,UAAU,UAAU,WAAW,aAAa,KAAK;AAC1D;;;;;AAMA,MAAM,gBAAgB,UAA2B;CAC/C,OACE,UAAU,YACV,CAAC,YAAY,KAAK,MACjB,WAAW,kBAAkB,KAAK,KAAK,WAAW,iBAAiB,KAAK;AAE7E;AAEA,MAAa,0BAIT;CAEF,cAAc,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;CAEvC,eAAe,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;AAC3C;;;;;;AAOA,MAAa,eAAe,oBAAwC,EAClE,QAAQ,EACN,aAAa,wBACf,EACF,CAAC;;;;;;;;;;;;;;;;;ACxBD,MAAa,MAAM,GAAG,YAA2B;CAG/C,OAAO,aAAa,WAAW,GAAG,OAAO,CAAC;AAC5C;;;;;;;;;;;;;;;;;;;;;;;;ACFA,MAAa,0BAAmC;CAG9C,OACE,OAAO,YAAY,gBAClB,QAAQ,IAAI,aAAa,UAAU,QAAQ,IAAI,WAAW;AAE/D;;ACpBA,MAAa,WAAW,QAAgB,YAA6B;CACnE,MAAM,cAAc,SAAS,eAAe;CAC5C,MAAM,cAAc,SAAS,eAAe;CAE5C,OAAO,KAAK,QAAQ;EAClB,GAAG,KAAK,SAAS,MAAM;EACvB,SAAS;GACP,GAAG,KAAK,SAAS,MAAM,QAAQ;GAE/B,GAAI,CAAC,cAAc,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,YAAY;GAErD,GAAI,gBAAgB,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;EAC5C;EACA;EACA,GAAI,WAAW,CAAC;CAClB,CAAC;AACH;;;;;;ACSA,MAAa,KAASA;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CtB,MAAa,wBACX,UACA,WACA,aAC4B;CAC5B,MAAM,aACJ,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IAAI,YAAY,CAAC;CAE5E,OAAO,OAAO,QAAQ,QAAQ,CAAC,CAAC,QAC7B,KAAK,CAAC,MAAM,eAAe;EAC1B,MAAM,UAAU;EAChB,MAAM,gBACJ,OAAO,cAAc,YAAY,MAAM,QAAQ,SAAS,IACpD,YACA,WAAW;EAGjB,IAAI,WAAW,UAAU,EACvB,WACE,YAAY,SAAS,WAAW,gBAAgB,WAAW,MAC/D,CAAC;EAED,OAAO;CACT,GACA,CAAC,CACH;AACF"}
|
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": "Fröhlich ∧ Frei",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.5.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@heroui/theme": "2.4.26",
|
|
50
50
|
"tailwind-merge": "3.7.0",
|
|
51
51
|
"tailwind-variants": "3.2.2",
|
|
52
|
-
"tailwindcss": "4.3.
|
|
52
|
+
"tailwindcss": "4.3.4"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3ef1bcc4f979ce9eb7dafc68ef2e3670a225015f"
|
|
55
55
|
}
|