@rzl-zone/utils-js 3.1.1-beta.0 → 3.1.1
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/README.md +56 -27
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-26XIKDJI.cjs +1 -0
- package/dist/chunk-2NWHDDM5.js +1 -0
- package/dist/chunk-2UIRWYE3.js +1 -0
- package/dist/chunk-4VCRMMAH.cjs +1 -0
- package/dist/chunk-5C2SMIGX.cjs +1 -0
- package/dist/chunk-5I2B5DOG.js +1 -0
- package/dist/chunk-5Y52H4VH.cjs +1 -0
- package/dist/chunk-7BXIZM57.cjs +1 -0
- package/dist/chunk-7H7IODCQ.cjs +1 -0
- package/dist/chunk-7KJBDGEP.js +1 -0
- package/dist/chunk-7PG6YKIY.cjs +1 -0
- package/dist/chunk-7YVINA3U.cjs +1 -0
- package/dist/chunk-AXWJJXJC.js +1 -0
- package/dist/chunk-CPLBRGST.js +1 -0
- package/dist/chunk-DQFU3KLE.cjs +1 -0
- package/dist/chunk-DUK2K4FB.js +1 -0
- package/dist/chunk-DVMHRLKP.cjs +1 -0
- package/dist/chunk-EBMHQW7X.cjs +1 -0
- package/dist/chunk-EXWCTDC3.cjs +1 -0
- package/dist/chunk-FIAAX3UE.js +1 -0
- package/dist/chunk-G2B35D5W.js +1 -0
- package/dist/chunk-GLUYWYOA.cjs +1 -0
- package/dist/chunk-GRSCNTOK.js +1 -0
- package/dist/chunk-I5X5IN4H.js +1 -0
- package/dist/chunk-I6NOFGAK.cjs +1 -0
- package/dist/chunk-INUFZJLX.cjs +1 -0
- package/dist/chunk-IRBPXCMR.js +1 -0
- package/dist/chunk-J2RGTPGK.cjs +1 -0
- package/dist/chunk-KHO2SBNA.cjs +1 -0
- package/dist/chunk-KXIXXSWX.cjs +1 -0
- package/dist/chunk-L73TOPX5.js +1 -0
- package/dist/chunk-MC3LXMCQ.js +1 -0
- package/dist/chunk-MHXVVDRQ.cjs +1 -0
- package/dist/chunk-MMSYCIJ2.cjs +1 -1
- package/dist/chunk-NHNBV5VS.cjs +1 -0
- package/dist/chunk-NXWPZDDX.js +1 -0
- package/dist/chunk-ODZQXH7E.cjs +1 -0
- package/dist/chunk-ONZFBJVW.js +1 -0
- package/dist/chunk-Q6NHYWVX.js +1 -0
- package/dist/chunk-QNKGP5DY.js +1 -0
- package/dist/chunk-QVRTHAM2.js +1 -0
- package/dist/chunk-RF34NETZ.js +1 -0
- package/dist/chunk-SAW7XS4K.js +1 -0
- package/dist/chunk-TSLYDPBJ.js +1 -0
- package/dist/chunk-UDA26MCU.cjs +1 -0
- package/dist/chunk-UET567YM.cjs +1 -0
- package/dist/chunk-URGK5UQT.js +1 -0
- package/dist/chunk-VEYMQ3UA.js +1 -0
- package/dist/chunk-W2W3L2M5.js +1 -0
- package/dist/chunk-WFPQO7KN.js +1 -0
- package/dist/chunk-WVSPXFTY.js +1 -0
- package/dist/chunk-WZE3XLKY.cjs +1 -0
- package/dist/chunk-X4PD3I5U.js +1 -0
- package/dist/chunk-XC2PYCT4.cjs +1 -0
- package/dist/chunk-XIXA5KDF.cjs +1 -0
- package/dist/chunk-XSFPU3YT.js +1 -0
- package/dist/chunk-XVHPXRUH.cjs +1 -0
- package/dist/chunk-Y44ZD3GG.js +1 -0
- package/dist/chunk-Y4O5KZF6.cjs +1 -0
- package/dist/chunk-YT3MSZKK.cjs +1 -0
- package/dist/chunk-YZR5OGJA.cjs +1 -0
- package/dist/chunk-ZR7GTJQX.cjs +1 -0
- package/dist/chunk-ZXIWDFEQ.js +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +175 -40
- package/dist/conversions/index.js +1 -1
- package/dist/env/index.cjs +1 -1
- package/dist/env/index.js +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/formatting/index.cjs +1 -1
- package/dist/formatting/index.js +1 -1
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.js +1 -1
- package/dist/{is-array--YjXV-Wx.d.ts → is-array-Cymwrsmm.d.ts} +2 -90
- package/dist/next/index.cjs +1 -8
- package/dist/next/index.js +1 -8
- package/dist/next/server/index.cjs +1 -2
- package/dist/next/server/index.js +1 -2
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.js +1 -1
- package/dist/or-DyZCRvaU.d.ts +89 -0
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +111 -17
- package/dist/predicates/index.js +1 -1
- package/dist/promise/index.cjs +1 -1
- package/dist/promise/index.js +1 -1
- package/dist/rzl-utils.global.js +1 -4
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/tailwind/index.cjs +1 -0
- package/dist/tailwind/index.d.ts +565 -0
- package/dist/tailwind/index.js +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.js +1 -1
- package/package.json +24 -23
- package/dist/chunk-26W3VZIK.cjs +0 -1
- package/dist/chunk-2KRCHXFG.cjs +0 -2
- package/dist/chunk-33ZLH266.js +0 -1
- package/dist/chunk-4L4EJTNZ.js +0 -1
- package/dist/chunk-56QBKKRE.js +0 -1
- package/dist/chunk-5Q37AP7P.js +0 -1
- package/dist/chunk-5SZUSNGZ.js +0 -1
- package/dist/chunk-7CHFAMS2.js +0 -1
- package/dist/chunk-7MMJZ6HS.js +0 -1
- package/dist/chunk-7TC6DE3J.cjs +0 -1
- package/dist/chunk-7VX33E3V.js +0 -1
- package/dist/chunk-7YWAQOA4.cjs +0 -1
- package/dist/chunk-BEZPD44N.cjs +0 -1
- package/dist/chunk-BI263OHW.js +0 -1
- package/dist/chunk-CII6WWLO.cjs +0 -1
- package/dist/chunk-D5TYPCWU.cjs +0 -1
- package/dist/chunk-EEQY5QUG.js +0 -1
- package/dist/chunk-ELDDNERR.js +0 -1
- package/dist/chunk-ESJYBIYH.js +0 -1
- package/dist/chunk-EWYPSKKM.js +0 -1
- package/dist/chunk-EXCOQLWX.cjs +0 -1
- package/dist/chunk-FIEZKTAZ.cjs +0 -1
- package/dist/chunk-FWQVTMYA.cjs +0 -1
- package/dist/chunk-G4EWCRKS.js +0 -1
- package/dist/chunk-G7R5XZRM.cjs +0 -1
- package/dist/chunk-GGEV7LXX.cjs +0 -1
- package/dist/chunk-HJOZOENU.cjs +0 -1
- package/dist/chunk-IRDZVLNZ.cjs +0 -1
- package/dist/chunk-IW73G523.cjs +0 -1
- package/dist/chunk-IY5OZAB3.cjs +0 -1
- package/dist/chunk-J4NCYYGS.js +0 -1
- package/dist/chunk-J7JAZAJD.js +0 -1
- package/dist/chunk-JYNSO7ZY.js +0 -1
- package/dist/chunk-K3UVKYEU.js +0 -1
- package/dist/chunk-LQ76EDZG.js +0 -1
- package/dist/chunk-MROH35V3.cjs +0 -1
- package/dist/chunk-NJSAV73S.js +0 -1
- package/dist/chunk-NNM7QCNB.js +0 -1
- package/dist/chunk-NR44SNYE.js +0 -1
- package/dist/chunk-NXMTWY77.js +0 -1
- package/dist/chunk-OZCQZO2V.cjs +0 -4
- package/dist/chunk-PUQXRLZH.cjs +0 -1
- package/dist/chunk-Q3NTKN5I.cjs +0 -1
- package/dist/chunk-QDNSC57Z.js +0 -4
- package/dist/chunk-QGXTL5ZH.js +0 -2
- package/dist/chunk-QSQDP7L2.cjs +0 -1
- package/dist/chunk-RV2VULM7.cjs +0 -1
- package/dist/chunk-S5M33A4O.js +0 -1
- package/dist/chunk-SGTHOQQ2.js +0 -1
- package/dist/chunk-SL3RQOWA.js +0 -1
- package/dist/chunk-SW6HYEW7.cjs +0 -1
- package/dist/chunk-SYJC7UAW.js +0 -1
- package/dist/chunk-SZPWZZYG.cjs +0 -1
- package/dist/chunk-UA4B7JBO.cjs +0 -1
- package/dist/chunk-UQDJF5RR.cjs +0 -1
- package/dist/chunk-UTQUYABU.cjs +0 -1
- package/dist/chunk-VPW3DRV5.js +0 -1
- package/dist/chunk-W32WALNU.js +0 -1
- package/dist/chunk-XGZ6K753.cjs +0 -1
- package/dist/chunk-YFTR64N5.cjs +0 -1
- package/dist/chunk-ZFDS7W6B.cjs +0 -1
- package/dist/chunk-ZQOLZE6Z.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/stylings/index.cjs +0 -1
- package/dist/stylings/index.d.ts +0 -41
- package/dist/stylings/index.js +0 -1
package/dist/strings/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";var e=require("../chunk-XIXA5KDF.cjs"),t=require("../chunk-XC2PYCT4.cjs");require("../chunk-EBMHQW7X.cjs");var r=require("../chunk-INUFZJLX.cjs");Object.defineProperty(exports,"getInitialsName",{enumerable:!0,get:function(){return e.getInitialsName}}),Object.defineProperty(exports,"replaceAt",{enumerable:!0,get:function(){return e.replaceAt}}),Object.defineProperty(exports,"normalizeSpaces",{enumerable:!0,get:function(){return t.normalizeSpaces}}),Object.defineProperty(exports,"normalizeString",{enumerable:!0,get:function(){return t.normalizeString}}),Object.defineProperty(exports,"removeSpaces",{enumerable:!0,get:function(){return t.removeSpaces}}),Object.defineProperty(exports,"stripHtmlTags",{enumerable:!0,get:function(){return t.stripHtmlTags}}),Object.defineProperty(exports,"capitalizeFirst",{enumerable:!0,get:function(){return r.capitalizeFirst}}),Object.defineProperty(exports,"capitalizeWords",{enumerable:!0,get:function(){return r.capitalizeWords}}),Object.defineProperty(exports,"slugify",{enumerable:!0,get:function(){return r.slugify}}),Object.defineProperty(exports,"toCamelCase",{enumerable:!0,get:function(){return r.toCamelCase}}),Object.defineProperty(exports,"toDotCase",{enumerable:!0,get:function(){return r.toDotCase}}),Object.defineProperty(exports,"toKebabCase",{enumerable:!0,get:function(){return r.toKebabCase}}),Object.defineProperty(exports,"toLowerCase",{enumerable:!0,get:function(){return r.toLowerCase}}),Object.defineProperty(exports,"toPascalCase",{enumerable:!0,get:function(){return r.toPascalCase}}),Object.defineProperty(exports,"toPascalCaseSpace",{enumerable:!0,get:function(){return r.toPascalCaseSpace}}),Object.defineProperty(exports,"toSnakeCase",{enumerable:!0,get:function(){return r.toSnakeCase}});
|
package/dist/strings/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{getInitialsName,replaceAt}from"../chunk-2NWHDDM5.js";export{normalizeSpaces,normalizeString,removeSpaces,stripHtmlTags}from"../chunk-Q6NHYWVX.js";import"../chunk-TSLYDPBJ.js";export{capitalizeFirst,capitalizeWords,slugify,toCamelCase,toDotCase,toKebabCase,toLowerCase,toPascalCase,toPascalCaseSpace,toSnakeCase}from"../chunk-2UIRWYE3.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../chunk-ODZQXH7E.cjs");require("../chunk-YT3MSZKK.cjs"),require("../chunk-INUFZJLX.cjs"),Object.defineProperty(exports,"cnV3",{enumerable:!0,get:function(){return e.cnV3}}),Object.defineProperty(exports,"cnV4",{enumerable:!0,get:function(){return e.cnV4}}),Object.defineProperty(exports,"customCnV3",{enumerable:!0,get:function(){return e.customCnV3}}),Object.defineProperty(exports,"customCnV4",{enumerable:!0,get:function(){return e.customCnV4}}),Object.defineProperty(exports,"shouldForwardProp",{enumerable:!0,get:function(){return e.shouldForwardProp}}),Object.defineProperty(exports,"twMergeDefaultV3",{enumerable:!0,get:function(){return e.twMergeDefaultV3}}),Object.defineProperty(exports,"twMergeDefaultV4",{enumerable:!0,get:function(){return e.twMergeDefaultV4}});
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import{ClassValue}from'clsx';import{Config}from'tailwindcss';import{ClassNameValue as ClassNameValue$1,ConfigExtension as ConfigExtension$1}from'tailwind-merge-v3';import{ClassNameValue,ConfigExtension}from'tailwind-merge-v4';type ClassesValue=ClassValue[];
|
|
2
|
+
/** -------------------------------------------------------------
|
|
3
|
+
* * ***Default `cnV3` utility (Tailwind v3).***
|
|
4
|
+
* -------------------------------------------------------------
|
|
5
|
+
* **Combines class-name values and then deduplicates/resolves
|
|
6
|
+
* conflicts using {@link twMergeDefaultV3 | `twMergeDefaultV3`}
|
|
7
|
+
* with **Tailwind v3 default config only**.**
|
|
8
|
+
* - ✅ **Use this when:**
|
|
9
|
+
* - Your project uses **Tailwind v3**.
|
|
10
|
+
* - You need a simple `cn` that works out of the box without a custom config.
|
|
11
|
+
* - ⚡ **Need custom rules?**
|
|
12
|
+
* - Create a project-wide helper using
|
|
13
|
+
* {@link twMergeDefaultV3 | `twMergeDefaultV3`} +
|
|
14
|
+
* {@link customCnV3 | `customCnV3`} (see Example 2).
|
|
15
|
+
* @param {ClassesValue} classes - Class values (string, array, object, etc).
|
|
16
|
+
* @returns {string} Merged Tailwind class string.
|
|
17
|
+
* @example
|
|
18
|
+
* #### Example 1: ✅ Default usage (Tailwind v3).
|
|
19
|
+
* ```ts
|
|
20
|
+
* cnV3("p-2", "p-4");
|
|
21
|
+
* // ➔ "p-4"
|
|
22
|
+
*
|
|
23
|
+
* cnV3("text-red-500", { "text-blue-500": true });
|
|
24
|
+
* // ➔ "text-blue-500"
|
|
25
|
+
*
|
|
26
|
+
* cnV3(["m-2", ["m-4"]], "m-8");
|
|
27
|
+
* // ➔ "m-8"
|
|
28
|
+
* ```
|
|
29
|
+
* #### Example 2: ⚡ Custom project-wide usage with Tailwind config.
|
|
30
|
+
* ```ts
|
|
31
|
+
* import tailwindConfig from "../tailwind.config";
|
|
32
|
+
* import { twMergeDefaultV3, customCnV3, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
33
|
+
*
|
|
34
|
+
* const cnApp = (...classes: ClassesValue) => {
|
|
35
|
+
* return customCnV3(
|
|
36
|
+
* twMergeDefaultV3({
|
|
37
|
+
* config: tailwindConfig,
|
|
38
|
+
* extend: {
|
|
39
|
+
* classGroups: {
|
|
40
|
+
* "text-shadow": [
|
|
41
|
+
* "text-shadow",
|
|
42
|
+
* "text-shadow-sm",
|
|
43
|
+
* "text-shadow-md",
|
|
44
|
+
* ],
|
|
45
|
+
* },
|
|
46
|
+
* },
|
|
47
|
+
* }),
|
|
48
|
+
* // ...other options classes,
|
|
49
|
+
* );
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* cnApp("p-2 p-4"); // ➔ "p-4"
|
|
53
|
+
* cnApp("shadow-sm shadow-md"); // ➔ "shadow-md"
|
|
54
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (resolved from config)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const cnV3:(...classes:ClassesValue)=>string;
|
|
58
|
+
/** -------------------------------------------------------------
|
|
59
|
+
* * ***Default `cnV4` utility (Tailwind v4).***
|
|
60
|
+
* -------------------------------------------------------------
|
|
61
|
+
* **Combines class-name values and then deduplicates/resolves
|
|
62
|
+
* conflicts using {@link twMergeDefaultV4 | `twMergeDefaultV4`}
|
|
63
|
+
* with **Tailwind v4 default config only**.**
|
|
64
|
+
* - ✅ **Use this when:**
|
|
65
|
+
* - Your project uses **Tailwind v4**.
|
|
66
|
+
* - You need a simple `cn` that works out of the box without a custom config.
|
|
67
|
+
* - ⚡ **Need custom rules?**
|
|
68
|
+
* - Create a project-wide helper using
|
|
69
|
+
* {@link twMergeDefaultV4 | `twMergeDefaultV4`} +
|
|
70
|
+
* {@link customCnV4 | `customCnV4`} (see Example 2).
|
|
71
|
+
* @param {ClassesValue} classes - Class values (string, array, object, etc).
|
|
72
|
+
* @returns {string} Merged Tailwind class string.
|
|
73
|
+
* @example
|
|
74
|
+
* #### Example 1: ✅ Default usage (Tailwind v4).
|
|
75
|
+
* ```ts
|
|
76
|
+
* cnV4("p-2", "p-4");
|
|
77
|
+
* // ➔ "p-4"
|
|
78
|
+
*
|
|
79
|
+
* cnV4("text-red-500", { "text-blue-500": true });
|
|
80
|
+
* // ➔ "text-blue-500"
|
|
81
|
+
*
|
|
82
|
+
* cnV4(["m-2", ["m-4"]], "m-8");
|
|
83
|
+
* // ➔ "m-8"
|
|
84
|
+
* ```
|
|
85
|
+
* #### Example 2: ⚡ Custom project-wide usage with Tailwind config.
|
|
86
|
+
* ```ts
|
|
87
|
+
* import tailwindConfig from "../tailwind.config";
|
|
88
|
+
* import { twMergeDefaultV4, customCnV4, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
89
|
+
*
|
|
90
|
+
* const cnApp = (...classes: ClassesValue) => {
|
|
91
|
+
* return customCnV4(
|
|
92
|
+
* twMergeDefaultV4({
|
|
93
|
+
* config: tailwindConfig,
|
|
94
|
+
* extend: {
|
|
95
|
+
* classGroups: {
|
|
96
|
+
* "text-shadow": [
|
|
97
|
+
* "text-shadow",
|
|
98
|
+
* "text-shadow-sm",
|
|
99
|
+
* "text-shadow-md",
|
|
100
|
+
* ],
|
|
101
|
+
* },
|
|
102
|
+
* },
|
|
103
|
+
* }),
|
|
104
|
+
* // ...other options classes,
|
|
105
|
+
* );
|
|
106
|
+
* };
|
|
107
|
+
*
|
|
108
|
+
* cnApp("p-2 p-4"); // ➔ "p-4"
|
|
109
|
+
* cnApp("shadow-sm shadow-md"); // ➔ "shadow-md"
|
|
110
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (resolved from config)
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare const cnV4:(...classes:ClassesValue)=>string;
|
|
114
|
+
/** Tailwind Merge config extension type */
|
|
115
|
+
type TwMergeConfigExt$1=ConfigExtension<string,string>;
|
|
116
|
+
/** * ***Extra options for customized Tailwind class merge.*** */
|
|
117
|
+
type OptionsConfigMergeTwCn$1={
|
|
118
|
+
/** ***Optional Tailwind CSS configuration object.***
|
|
119
|
+
*
|
|
120
|
+
* - **Pass your project’s `tailwind.config.ts` if you want to:**
|
|
121
|
+
* - Respect custom theme values (`colors`, `fontSize`, `spacing`, `etc`.)
|
|
122
|
+
* - Enable/disable `corePlugins`
|
|
123
|
+
* - Register `plugins`
|
|
124
|
+
* - Extend class groups (e.g., `text-shadow`)
|
|
125
|
+
* - **If omitted, the **default Tailwind config** is used.**
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import tailwindConfig from "../tailwind.config";
|
|
129
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
130
|
+
*
|
|
131
|
+
* const myCustomTwCls = twMergeDefaultV4({
|
|
132
|
+
* config: tailwindConfig,
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
* myCustomTwCls("text-primary text-secondary");
|
|
136
|
+
* // => "text-secondary" (resolved from your theme config)
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
config?:TailwindConfig;
|
|
140
|
+
/** ***Prefix added to Tailwind-generated classes.***
|
|
141
|
+
*
|
|
142
|
+
* - **Tailwind v3**:
|
|
143
|
+
* - Use {@link twMergeDefaultV3 | **`twMergeDefaultV3`**} instead.
|
|
144
|
+
* - Reference:
|
|
145
|
+
* [**`Tailwind v3 using prefix docs`**](https://v3.tailwindcss.com/docs/configuration#prefix).
|
|
146
|
+
*
|
|
147
|
+
* - **Tailwind v4**:
|
|
148
|
+
* - Configure in your CSS import, e.g. `@import "tailwindcss" prefix(tw);`
|
|
149
|
+
* - The prefix appears like a variant at the start of the class, e.g. `tw:flex`,
|
|
150
|
+
* `tw:bg-red-500`, `tw:hover:bg-red-600`.
|
|
151
|
+
* - Reference:
|
|
152
|
+
* [**`Tailwind v4 using prefix docs`**](https://tailwindcss.com/docs/upgrade-guide#using-a-prefix).
|
|
153
|
+
*
|
|
154
|
+
* - **ℹ️ Notes**:
|
|
155
|
+
* - Tailwind v3:
|
|
156
|
+
* - Use {@link twMergeDefaultV3 | **`twMergeDefaultV3`**} instead.
|
|
157
|
+
* - Tailwind v4: prefer identifier (e.g. `tw`) without `-`.
|
|
158
|
+
* - Fallback order:
|
|
159
|
+
* 1. `prefix` option
|
|
160
|
+
* 2. `config.prefix` (if defined)
|
|
161
|
+
* 3. `undefined`
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* - Tailwind version 4 (in CSS entry only):
|
|
165
|
+
* - CSS files:
|
|
166
|
+
* ```css
|
|
167
|
+
* `@import "tailwindcss" prefix(tw);`
|
|
168
|
+
* ```
|
|
169
|
+
* - Your custom TwMerge file:
|
|
170
|
+
* ```ts
|
|
171
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
172
|
+
*
|
|
173
|
+
* const twMergeV3 = twMergeDefaultV4({
|
|
174
|
+
* prefix: "tw",
|
|
175
|
+
* // ... other config
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
* - Tailwind version 4 (with `tailwind.config.{js,ts,mjs,...etc}`):
|
|
179
|
+
* - Reference:
|
|
180
|
+
* [**`Tailwind v4 using @config docs`**](https://tailwindcss.com/docs/functions-and-directives#config-directive).
|
|
181
|
+
* - CSS files:
|
|
182
|
+
* ```css
|
|
183
|
+
* `@import "tailwindcss";`
|
|
184
|
+
* `@config "./tailwind.config.ts";`
|
|
185
|
+
* ```
|
|
186
|
+
* - Config files:
|
|
187
|
+
* ```ts
|
|
188
|
+
* import type { Config } from "tailwindcss";
|
|
189
|
+
*
|
|
190
|
+
* const config: Config = {
|
|
191
|
+
* prefix: 'tw-',
|
|
192
|
+
* // ... other config
|
|
193
|
+
* };
|
|
194
|
+
*
|
|
195
|
+
* export default config;
|
|
196
|
+
* ```
|
|
197
|
+
* - Your custom TwMerge file:
|
|
198
|
+
* ```ts
|
|
199
|
+
* import config from "../tailwind.config";
|
|
200
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
201
|
+
*
|
|
202
|
+
* const twMergeV4 = twMergeDefaultV4({ config });
|
|
203
|
+
* // now without passing `prefix` options, will use automatic from config.
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
prefix?:string;};
|
|
207
|
+
/** * ***Options type for Tailwind Merge v4 wrapper.*** */
|
|
208
|
+
type OptionsMergeTwClsV4=Omit<TwMergeConfigExt$1,"prefix">& OptionsConfigMergeTwCn$1;
|
|
209
|
+
/** * ***Tailwind Merge function Version 4 signature (same as twMerge).*** */
|
|
210
|
+
type TwMergeDefaultFnV4=(...classLists:ClassNameValue[])=>string;type TailwindConfig=Config;
|
|
211
|
+
/** Tailwind Merge config extension type */
|
|
212
|
+
type TwMergeConfigExt=ConfigExtension$1<string,string>;
|
|
213
|
+
/** * ***Extra options for customized Tailwind class merge.*** */
|
|
214
|
+
type OptionsConfigMergeTwCn={
|
|
215
|
+
/** ***Optional Tailwind CSS configuration object.***
|
|
216
|
+
*
|
|
217
|
+
* - **Pass your project’s `tailwind.config.ts` if you want to:**
|
|
218
|
+
* - Respect custom theme values (`colors`, `fontSize`, `spacing`, `etc`.)
|
|
219
|
+
* - Enable/disable `corePlugins`
|
|
220
|
+
* - Register `plugins`
|
|
221
|
+
* - Extend class groups (e.g., `text-shadow`)
|
|
222
|
+
* - **If omitted, the **default Tailwind config** is used.**
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* import tailwindConfig from "../tailwind.config";
|
|
226
|
+
* import { twMergeDefaultV3 } from "@rzl-zone/utils-js/tailwind";
|
|
227
|
+
*
|
|
228
|
+
* const myCustomTwCls = twMergeDefaultV3({
|
|
229
|
+
* config: tailwindConfig,
|
|
230
|
+
* });
|
|
231
|
+
*
|
|
232
|
+
* myCustomTwCls("text-primary text-secondary");
|
|
233
|
+
* // => "text-secondary" (resolved from your theme config)
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
config?:TailwindConfig;
|
|
237
|
+
/** ***Prefix added to Tailwind-generated classes.***
|
|
238
|
+
*
|
|
239
|
+
* - **Tailwind v3**:
|
|
240
|
+
* - Configure in `tailwind.config.js`, e.g. `prefix: 'tw-'`.
|
|
241
|
+
* - Variants first; negative utilities: `-mt-8` → `-tw-mt-8`.
|
|
242
|
+
* - Reference:
|
|
243
|
+
* [**`Tailwind v3 using prefix docs`**](https://v3.tailwindcss.com/docs/configuration#prefix).
|
|
244
|
+
* - **Tailwind v4**:
|
|
245
|
+
* - Use {@link twMergeDefaultV4 | **`twMergeDefaultV4`**} instead.
|
|
246
|
+
* - Reference:
|
|
247
|
+
* [**`Tailwind v4 using prefix docs`**](https://tailwindcss.com/docs/upgrade-guide#using-a-prefix).
|
|
248
|
+
* - **ℹ️ Notes**:
|
|
249
|
+
* - Tailwind v3: use hyphenated prefix (`tw-`).
|
|
250
|
+
* - Fallback order:
|
|
251
|
+
* 1. `prefix` option
|
|
252
|
+
* 2. `config.prefix` (if defined)
|
|
253
|
+
* 3. `undefined`
|
|
254
|
+
* - Tailwind v4:
|
|
255
|
+
* - Use {@link twMergeDefaultV4 | **`twMergeDefaultV4`**} instead.
|
|
256
|
+
* @example
|
|
257
|
+
* - Tailwind version 3 (`tailwind.config.ts`):
|
|
258
|
+
* ```ts
|
|
259
|
+
* import type { Config } from "tailwindcss";
|
|
260
|
+
*
|
|
261
|
+
* const config: Config = {
|
|
262
|
+
* prefix: 'tw-',
|
|
263
|
+
* // ... other config
|
|
264
|
+
* };
|
|
265
|
+
*
|
|
266
|
+
* export default config;
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
prefix?:string;};
|
|
270
|
+
/** * ***Options type for Tailwind Merge v3 wrapper.*** */
|
|
271
|
+
type OptionsMergeTwClsV3=Omit<TwMergeConfigExt,"prefix">& OptionsConfigMergeTwCn;
|
|
272
|
+
/** * ***Tailwind Merge function Version 3 signature (same as twMerge).*** */
|
|
273
|
+
type TwMergeDefaultFnV3=(...classLists:ClassNameValue$1[])=>string;
|
|
274
|
+
/** -------------------------------------------------------------
|
|
275
|
+
* * ***Factory utility for building a custom `cn` helper (Tailwind `v3`).***
|
|
276
|
+
* -------------------------------------------------------------
|
|
277
|
+
* **Wraps internally function to combines class-name values and applies the provided
|
|
278
|
+
* Tailwind merge function (from {@link twMergeDefaultV3 | `twMergeDefaultV3`}).**
|
|
279
|
+
* - 🔑 **When to use it?**
|
|
280
|
+
* - Your project uses **Tailwind v3**.
|
|
281
|
+
* - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).
|
|
282
|
+
* - You need multiple `cn*` variants across apps/packages.
|
|
283
|
+
* @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeDefaultV3 | `twMergeDefaultV3`}.
|
|
284
|
+
* @param {ClassesValue} classes - Class values (`string`, `array`, `object`, `etc`).
|
|
285
|
+
* @returns {string} Merged Tailwind class string.
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* import tailwindConfig from "../tailwind.config";
|
|
289
|
+
* import { twMergeDefaultV3, customCnV3, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
290
|
+
*
|
|
291
|
+
* // 1. Create a custom merge function
|
|
292
|
+
* const myCustomTwMerge = twMergeDefaultV3({
|
|
293
|
+
* config: tailwindConfig,
|
|
294
|
+
* extend: {
|
|
295
|
+
* classGroups: {
|
|
296
|
+
* "text-shadow": ["text-shadow", "text-shadow-sm", "text-shadow-md"],
|
|
297
|
+
* },
|
|
298
|
+
* },
|
|
299
|
+
* });
|
|
300
|
+
*
|
|
301
|
+
* // 2. Build your helper using `customCnV3`
|
|
302
|
+
* export const cnApp = (...classes: ClassesValue) => {
|
|
303
|
+
* return customCnV3(myCustomTwMerge, ...classes);
|
|
304
|
+
* };
|
|
305
|
+
* // ✅ Usage
|
|
306
|
+
* cnApp("p-2", "p-4"); // ➔ "p-4"
|
|
307
|
+
* cnApp("shadow-sm shadow-md"); // ➔ "shadow-md"
|
|
308
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (resolved from config)
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
declare const customCnV3:(customTwMergeV3:TwMergeDefaultFnV3,...classes:ClassesValue)=>string;
|
|
312
|
+
/** -------------------------------------------------------------
|
|
313
|
+
* * ***Factory utility for building a custom `cn` helper (Tailwind `v4`).***
|
|
314
|
+
* -------------------------------------------------------------
|
|
315
|
+
* **Wraps internally function to combines class-name values and applies the provided
|
|
316
|
+
* Tailwind merge function (from {@link twMergeDefaultV4 | `twMergeDefaultV4`}).**
|
|
317
|
+
* - 🔑 **When to use it?**
|
|
318
|
+
* - Your project uses **Tailwind v4**.
|
|
319
|
+
* - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).
|
|
320
|
+
* - You need multiple `cn*` variants across apps/packages.
|
|
321
|
+
* @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeDefaultV4 | `twMergeDefaultV4`}.
|
|
322
|
+
* @param {ClassesValue} classes - Class values (`string`, `array`, `object`, `etc`).
|
|
323
|
+
* @returns {string} Merged Tailwind class string.
|
|
324
|
+
* @example
|
|
325
|
+
* ```ts
|
|
326
|
+
* import tailwindConfig from "../tailwind.config";
|
|
327
|
+
* import { twMergeDefaultV4, customCnV4, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
328
|
+
*
|
|
329
|
+
* // 1. Create a custom merge function
|
|
330
|
+
* const myCustomTwMerge = twMergeDefaultV4({
|
|
331
|
+
* config: tailwindConfig,
|
|
332
|
+
* extend: {
|
|
333
|
+
* classGroups: {
|
|
334
|
+
* "text-shadow": ["text-shadow", "text-shadow-sm", "text-shadow-md"],
|
|
335
|
+
* },
|
|
336
|
+
* },
|
|
337
|
+
* });
|
|
338
|
+
*
|
|
339
|
+
* // 2. Build your helper using `customCnV4`
|
|
340
|
+
* export const cnApp = (...classes: ClassesValue) => {
|
|
341
|
+
* return customCnV4(myCustomTwMerge, ...classes);
|
|
342
|
+
* };
|
|
343
|
+
*
|
|
344
|
+
* // ✅ Usage
|
|
345
|
+
* cnApp("p-2", "p-4"); // ➔ "p-4"
|
|
346
|
+
* cnApp("shadow-sm shadow-md"); // ➔ "shadow-md"
|
|
347
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (resolved from config)
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
declare const customCnV4:(customTwMergeV4:TwMergeDefaultFnV4,...classes:ClassesValue)=>string;
|
|
351
|
+
/** Converts a union type into an intersection type.
|
|
352
|
+
*
|
|
353
|
+
* @template U - The union type to be converted.
|
|
354
|
+
*/
|
|
355
|
+
type UnionToIntersectionStrict<U>=(U extends never?never:(arg:U)=>never)extends(arg:infer I)=>void?I:never;
|
|
356
|
+
/** Converts a union type into a tuple type.
|
|
357
|
+
*
|
|
358
|
+
* @template T - The union type to be converted.
|
|
359
|
+
*/
|
|
360
|
+
type UnionToTupleStrict<T>=UnionToIntersectionStrict<T extends never?never:(t:T)=>T>extends(_:never)=>infer W?[...UnionToTupleStrict<Exclude<T,W>>,W]:[];
|
|
361
|
+
/** ----------------------------------------------------------
|
|
362
|
+
* * ***Utility: `shouldForwardProp`.***
|
|
363
|
+
* ----------------------------------------------------------
|
|
364
|
+
* **Creates a helper for styled-components `shouldForwardProp`.**
|
|
365
|
+
* @description
|
|
366
|
+
* This utility returns a predicate function that determines whether a given prop
|
|
367
|
+
* should be forwarded to the DOM, useful for filtering out internal props (e.g.,
|
|
368
|
+
* `$size`, `$active`) so they don't end up as invalid HTML attributes.
|
|
369
|
+
* - **Behavior:**
|
|
370
|
+
* - Accepts a tuple (strict) of prop keys to exclude from forwarding.
|
|
371
|
+
* - Automatically coerces prop names to string for consistent checking.
|
|
372
|
+
* - Supports string, number, or symbol keys (via PropertyKey).
|
|
373
|
+
* - Will throw an error if the provided `props` argument is not an array.
|
|
374
|
+
* @template CustomProps - The type of the component's props.
|
|
375
|
+
* @param {UnionToTupleStrict<keyof CustomProps>} props
|
|
376
|
+
* The list of prop names (keys of `CustomProps`) to exclude from forwarding.
|
|
377
|
+
* @returns {(propName: PropertyKey) => boolean}
|
|
378
|
+
* A function that takes a prop name and returns `true` if it should be forwarded, `false` if it should be blocked.
|
|
379
|
+
* @throws {TypeError} If `props` is not an array.
|
|
380
|
+
* @example
|
|
381
|
+
* type Props = { $size: string; color: string; visible: boolean };
|
|
382
|
+
* const filter = shouldForwardProp<Props>(["$size"]);
|
|
383
|
+
* filter("$size"); // ➔ false (blocked)
|
|
384
|
+
* filter("color"); // ➔ true (forwarded)
|
|
385
|
+
* @example
|
|
386
|
+
* // Using with styled-components:
|
|
387
|
+
* styled.div.withConfig({
|
|
388
|
+
* shouldForwardProp: shouldForwardProp<CustomProps>(["$internal"])
|
|
389
|
+
* })
|
|
390
|
+
*/
|
|
391
|
+
declare const shouldForwardProp:<CustomProps>(props:Partial<UnionToTupleStrict<keyof CustomProps>>)=>((propName:keyof CustomProps)=>boolean);
|
|
392
|
+
/** -------------------------------------------------------------
|
|
393
|
+
* * ***Customized Tailwind class merger Version 3 with extended rules.***
|
|
394
|
+
* -------------------------------------------------------------
|
|
395
|
+
* **Wraps **{@link extendTailwindMerge| `extendTailwindMerge`}** with Tailwind’s default config
|
|
396
|
+
* ({@link getDefaultConfig | `getDefaultConfig()`}) to create a **project-ready `twMerge`**.**
|
|
397
|
+
* - 🔑 **When to use it?**
|
|
398
|
+
* - Your project uses **Tailwind v3**.
|
|
399
|
+
* - Extend **class groups** (e.g. add `text-shadow`).
|
|
400
|
+
* - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).
|
|
401
|
+
* - Override or fine-tune **merge behavior**.
|
|
402
|
+
* - Create a **project-wide `cn` helper** that replaces raw `twMerge`.
|
|
403
|
+
* @param {OptionsMergeTwClsV3} [options={}]
|
|
404
|
+
* Merge options:
|
|
405
|
+
* - `config` – Your Tailwind config (from `tailwind.config.ts`).
|
|
406
|
+
* - `prefix` - Utility prefix (e.g. `tw-` or `tw`).
|
|
407
|
+
* - `extend` – Extra merge rules (classGroups, theme, etc).
|
|
408
|
+
* - `override` – Fully replace rules.
|
|
409
|
+
* - `cacheSize` – Parsed class cache size.
|
|
410
|
+
* - `experimentalParseClassName` – Custom classname parser.
|
|
411
|
+
* @returns {TwMergeDefaultFnV3}
|
|
412
|
+
* Customized Tailwind class merge function version 3 (same signature as `twMerge`).
|
|
413
|
+
* @example
|
|
414
|
+
* #### Example 1: ***Default behavior (same as tailwind-merge).***
|
|
415
|
+
* ```ts
|
|
416
|
+
* import { twMergeDefaultV3 } from "@rzl-zone/utils-js/tailwind";
|
|
417
|
+
*
|
|
418
|
+
* const twMerge = twMergeDefaultV3();
|
|
419
|
+
* twMerge("p-2 p-4");
|
|
420
|
+
* // ➔ "p-4"
|
|
421
|
+
* ```
|
|
422
|
+
* #### Example 2: ***Extend class groups.***
|
|
423
|
+
* ```ts
|
|
424
|
+
* import { twMergeDefaultV3 } from "@rzl-zone/utils-js/tailwind";
|
|
425
|
+
*
|
|
426
|
+
* const twMerge2 = twMergeDefaultV3({
|
|
427
|
+
* extend: {
|
|
428
|
+
* classGroups: {
|
|
429
|
+
* shadow: ["shadow-soft", "shadow-hard"],
|
|
430
|
+
* },
|
|
431
|
+
* },
|
|
432
|
+
* });
|
|
433
|
+
* twMerge2("shadow-soft shadow-hard");
|
|
434
|
+
* // ➔ "shadow-hard"
|
|
435
|
+
* ```
|
|
436
|
+
* #### Example 3: ***Respect your Tailwind config.***
|
|
437
|
+
* ```ts
|
|
438
|
+
* import config from "../tailwind.config";
|
|
439
|
+
* import { twMergeDefaultV3 } from "@rzl-zone/utils-js/tailwind";
|
|
440
|
+
*
|
|
441
|
+
* const twMerge3 = twMergeDefaultV3({ config });
|
|
442
|
+
* twMerge3("text-base text-xxs");
|
|
443
|
+
* // ➔ "text-xxs" (resolved from config)
|
|
444
|
+
* ```
|
|
445
|
+
* #### Example 4: ***Project-wide helper (recommended).***
|
|
446
|
+
* ```ts
|
|
447
|
+
* import configTwCss from "../tailwind.config";
|
|
448
|
+
* import { customCnV3, twMergeDefaultV3, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
449
|
+
*
|
|
450
|
+
* const customTwMerge = twMergeDefaultV3({
|
|
451
|
+
* config: configTwCss,
|
|
452
|
+
* extend: {
|
|
453
|
+
* classGroups: { shadow: ["shadow-soft", "shadow-hard"] },
|
|
454
|
+
* },
|
|
455
|
+
* });
|
|
456
|
+
*
|
|
457
|
+
* export const cnApp = (...classes: ClassesValue) => {
|
|
458
|
+
* return customCnV3(customTwMerge, ...classes);
|
|
459
|
+
* };
|
|
460
|
+
*
|
|
461
|
+
* // ✅ Usage
|
|
462
|
+
* cnApp("p-2 p-4"); // ➔ "p-4"
|
|
463
|
+
* cnApp("shadow-soft shadow-hard"); // ➔ "shadow-hard"
|
|
464
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (uses config)
|
|
465
|
+
*
|
|
466
|
+
* // ⚡ Difference with package-level `cn`
|
|
467
|
+
* import { cnV3, cnV4 } from "@rzl-zone/utils-js/tailwind";
|
|
468
|
+
*
|
|
469
|
+
* cnV3("text-base text-xxs");
|
|
470
|
+
* // or
|
|
471
|
+
* cnV4("text-base text-xxs");
|
|
472
|
+
* // ➔ "text-base" (❌ doesn't know about your config)
|
|
473
|
+
*
|
|
474
|
+
* cnApp("text-base text-xxs");
|
|
475
|
+
* // ➔ "text-xxs" (✅ respects config)
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
declare const twMergeDefaultV3:(options?:OptionsMergeTwClsV3)=>TwMergeDefaultFnV3;
|
|
479
|
+
/** -------------------------------------------------------------
|
|
480
|
+
* * ***Customized Tailwind class merger Version 4 with extended rules.***
|
|
481
|
+
* -------------------------------------------------------------
|
|
482
|
+
* **Wraps **{@link extendTailwindMerge| `extendTailwindMerge`}** with Tailwind’s default config
|
|
483
|
+
* ({@link getDefaultConfig | `getDefaultConfig()`}) to create a **project-ready `twMerge`**.**
|
|
484
|
+
* - 🔑 **When to use it?**
|
|
485
|
+
* - Your project uses **Tailwind v4**.
|
|
486
|
+
* - Extend **class groups** (e.g. add `text-shadow`).
|
|
487
|
+
* - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).
|
|
488
|
+
* - Override or fine-tune **merge behavior**.
|
|
489
|
+
* - Create a **project-wide `cn` helper** that replaces raw `twMerge`.
|
|
490
|
+
* @param {OptionsMergeTwClsV4} [options={}]
|
|
491
|
+
* Merge options:
|
|
492
|
+
* - `config` – Your Tailwind config (from `tailwind.config.ts`).
|
|
493
|
+
* - `prefix` - Utility prefix (e.g. `tw-` or `tw`).
|
|
494
|
+
* - `extend` – Extra merge rules (classGroups, theme, etc).
|
|
495
|
+
* - `override` – Fully replace rules.
|
|
496
|
+
* - `cacheSize` – Parsed class cache size.
|
|
497
|
+
* - `experimentalParseClassName` – Custom classname parser.
|
|
498
|
+
* @returns {TwMergeDefaultFnV4}
|
|
499
|
+
* Customized Tailwind class merge function version 4 (same signature as `twMerge`).
|
|
500
|
+
* @example
|
|
501
|
+
* #### Example 1: ***Default behavior (same as tailwind-merge).***
|
|
502
|
+
* ```ts
|
|
503
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
504
|
+
*
|
|
505
|
+
* const twMerge = twMergeDefaultV4();
|
|
506
|
+
* twMerge("p-2 p-4");
|
|
507
|
+
* // ➔ "p-4"
|
|
508
|
+
* ```
|
|
509
|
+
* #### Example 2: ***Extend class groups.***
|
|
510
|
+
* ```ts
|
|
511
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
512
|
+
*
|
|
513
|
+
* const twMerge2 = twMergeDefaultV4({
|
|
514
|
+
* extend: {
|
|
515
|
+
* classGroups: {
|
|
516
|
+
* shadow: ["shadow-soft", "shadow-hard"],
|
|
517
|
+
* },
|
|
518
|
+
* },
|
|
519
|
+
* });
|
|
520
|
+
* twMerge2("shadow-soft shadow-hard");
|
|
521
|
+
* // ➔ "shadow-hard"
|
|
522
|
+
* ```
|
|
523
|
+
* #### Example 3: ***Respect your Tailwind config.***
|
|
524
|
+
* ```ts
|
|
525
|
+
* import config from "../tailwind.config";
|
|
526
|
+
* import { twMergeDefaultV4 } from "@rzl-zone/utils-js/tailwind";
|
|
527
|
+
*
|
|
528
|
+
* const twMerge3 = twMergeDefaultV4({ config });
|
|
529
|
+
* twMerge3("text-base text-xxs");
|
|
530
|
+
* // ➔ "text-xxs" (resolved from config)
|
|
531
|
+
* ```
|
|
532
|
+
* #### Example 4: ***Project-wide helper (recommended).***
|
|
533
|
+
* ```ts
|
|
534
|
+
* import configTwCss from "../tailwind.config";
|
|
535
|
+
* import { customCnV4, twMergeDefaultV4, type ClassesValue } from "@rzl-zone/utils-js/tailwind";
|
|
536
|
+
*
|
|
537
|
+
* const customTwMerge = twMergeDefaultV4({
|
|
538
|
+
* config: configTwCss,
|
|
539
|
+
* extend: {
|
|
540
|
+
* classGroups: { shadow: ["shadow-soft", "shadow-hard"] },
|
|
541
|
+
* },
|
|
542
|
+
* });
|
|
543
|
+
*
|
|
544
|
+
* export const cnApp = (...classes: ClassesValue) => {
|
|
545
|
+
* return customCnV4(customTwMerge, ...classes);
|
|
546
|
+
* };
|
|
547
|
+
*
|
|
548
|
+
* // ✅ Usage
|
|
549
|
+
* cnApp("p-2 p-4"); // ➔ "p-4"
|
|
550
|
+
* cnApp("shadow-soft shadow-hard"); // ➔ "shadow-hard"
|
|
551
|
+
* cnApp("text-base text-xxs"); // ➔ "text-xxs" (uses config)
|
|
552
|
+
*
|
|
553
|
+
* // ⚡ Difference with package-level `cn`
|
|
554
|
+
* import { cnV3, cnV4 } from "@rzl-zone/utils-js/tailwind";
|
|
555
|
+
*
|
|
556
|
+
* cnV3("text-base text-xxs");
|
|
557
|
+
* // or
|
|
558
|
+
* cnV4("text-base text-xxs");
|
|
559
|
+
* // ➔ "text-base" (❌ doesn't know about your config)
|
|
560
|
+
*
|
|
561
|
+
* cnApp("text-base text-xxs");
|
|
562
|
+
* // ➔ "text-xxs" (✅ respects config)
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
declare const twMergeDefaultV4:(options?:OptionsMergeTwClsV4)=>TwMergeDefaultFnV4;export{type ClassesValue,cnV3,cnV4,customCnV3,customCnV4,shouldForwardProp,twMergeDefaultV3,twMergeDefaultV4};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{cnV3,cnV4,customCnV3,customCnV4,shouldForwardProp,twMergeDefaultV3,twMergeDefaultV4}from"../chunk-CPLBRGST.js";import"../chunk-ZXIWDFEQ.js";import"../chunk-2UIRWYE3.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as And,I as IsStringLiteral,P as ParseNumber,a as IsNegative,N as Negate,
|
|
1
|
+
import{A as And,b as Or,O as OrArr,a as AndArr}from'../or-DyZCRvaU.js';import{I as IsStringLiteral,P as ParseNumber,a as IsNegative,N as Negate,A as Abs,b as IsFloat,c as IsUnknown,d as IsNegativeInteger,S as Split,e as IsInteger,R as Repeat,f as Push,g as IfNegative,h as IsPositive,i as IsEven,j as IsReadonlyArray,k as IfPositive}from'../is-array-Cymwrsmm.js';export{C as CharAt,E as Even,q as EvenDigit,F as Float,r as IfEven,s as IfFloat,t as IfInteger,u as IfNegativeFloat,v as IfNegativeInteger,w as IfOdd,x as IfPositiveFloat,y as IfPositiveInteger,Y as IfUnknown,z as Integer,l as IsArray,m as IsMutableArray,B as IsNegativeFloat,D as IsOdd,G as IsPositiveFloat,H as IsPositiveInteger,J as IsScientificNumber,M as Mutable,n as MutableExcept,o as MutableOnly,p as MutableOptions,K as Negative,L as NegativeFloat,O as NegativeInteger,Q as Odd,T as OddDigit,U as ParseScientificNumber,V as Positive,W as PositiveFloat,X as PositiveInteger,Z as UnknownifyProperties,_ as UnknownifyPropertiesOptions}from'../is-array-Cymwrsmm.js';import{a as IsEmptyString,b as IfEmptyString,T as Trim,A as AnyString}from'../string-XA-til3C.js';export{E as EmptyString,d as IfNonEmptyString,I as IfNot,e as IsNonEmptyString,N as NonEmptyString,f as TrimLeft,g as TrimRight,h as TrimsLower,i as TrimsUpper,W as Whitespace,c as WordSeparator}from'../string-XA-til3C.js';import{I as IsAny}from'../any-BmdI8UbK.js';export{A as AnifyProperties,a as AnifyPropertiesOptions,b as IfAny}from'../any-BmdI8UbK.js';import{A as AnyFunction,T as TypedArray}from'../type-data-DDs-u2kq.js';export{a as AnObjectNonArray,B as BoxedPrimitivesTypes,D as DataTypes,b as DeepReplaceType,I as IntlObjects,N as NonPlainObject,W as WebApiObjects}from'../type-data-DDs-u2kq.js';import{I as IfExtends,N as Not,a as NotExtends,b as IsEmptyArray,P as Pop,E as Extends,c as ExtendsArr,d as IfEmptyArray}from'../extends-Bk_SBGdT.js';export{A as Arrayable,e as EmptyArray,G as GetArrayElementType,f as IfNonEmptyArray,i as IfNotExtends,g as IsNonEmptyArray,M as MutableArray,h as NonEmptyArray,j as PopOptions}from'../extends-Bk_SBGdT.js';export{F as FixNeverArrayRecursive,N as NormalizeEmptyArraysRecursive,R as RemoveEmptyArrayElements}from'../arrays-normalize-recursive-CnjYJ9xg.js';import{I as If}from'../if-CvT4R7Kh.js';import{I as IsNever,a as IfNever}from'../never-BfayMBF9.js';export{N as NeverifyProperties,b as NeverifyPropertiesOptions}from'../never-BfayMBF9.js';import{P as Prettify,a as PrettifyOptions,D as DefaultPrettifyOptions}from'../prettify-C4xLcYOP.js';export{I as IsArrayOrTuple,b as IsConstructor,c as IsFunction,d as IsPrimitive,e as IsRealPrimitive,f as Primitive}from'../prettify-C4xLcYOP.js';import{N as NonUndefined}from'../nils-DMz3kU7M.js';export{K as KeepNil,a as KeepNull,b as KeepUndef,c as Nilable,d as NonNil,e as NonNull,g as NullToUndefined,f as Nullable,h as Nullish,U as Undefinedable}from'../nils-DMz3kU7M.js';export{N as NumberRangeUnion}from'../NumberRangeUnion-DC-C3_Kq.js';import{O as OmitStrict}from'../omit-VvmIsZmX.js';type _AreAnagrams<Str1 extends string,Str2 extends string>=IsEmptyString<Str1>extends true?IsEmptyString<Str2>extends true?true:false:Str1 extends`${infer First extends string}${infer Rest1 extends string}`?Str2 extends`${infer Prev extends string}${First}${infer Rest2 extends string}`?_AreAnagrams<Rest1,`${Prev}${Rest2}`>:false:never;
|
|
2
2
|
/** -------------------------------------------------------
|
|
3
3
|
* * ***AreAnagrams.***
|
|
4
4
|
* -------------------------------------------------------
|
package/dist/urls/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";var e=require("../chunk-NHNBV5VS.cjs");require("../chunk-KHO2SBNA.cjs"),require("../chunk-7PG6YKIY.cjs"),require("../chunk-EXWCTDC3.cjs"),require("../chunk-4VCRMMAH.cjs"),require("../chunk-YT3MSZKK.cjs"),require("../chunk-YZR5OGJA.cjs");var r=require("../chunk-WZE3XLKY.cjs");require("../chunk-XC2PYCT4.cjs"),require("../chunk-EBMHQW7X.cjs"),require("../chunk-DVMHRLKP.cjs"),require("../chunk-DQFU3KLE.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-INUFZJLX.cjs"),Object.defineProperty(exports,"constructURL",{enumerable:!0,get:function(){return e.constructURL}}),Object.defineProperty(exports,"extractURLs",{enumerable:!0,get:function(){return e.extractURLs}}),Object.defineProperty(exports,"formatEnvPort",{enumerable:!0,get:function(){return r.formatEnvPort}}),Object.defineProperty(exports,"getFirstPrefixPathname",{enumerable:!0,get:function(){return r.getFirstPrefixPathname}}),Object.defineProperty(exports,"getPrefixPathname",{enumerable:!0,get:function(){return r.getPrefixPathname}}),Object.defineProperty(exports,"normalizePathname",{enumerable:!0,get:function(){return r.normalizePathname}});
|
package/dist/urls/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{constructURL,extractURLs}from"../chunk-AXWJJXJC.js";import"../chunk-ONZFBJVW.js";import"../chunk-Y44ZD3GG.js";import"../chunk-X4PD3I5U.js";import"../chunk-GRSCNTOK.js";import"../chunk-ZXIWDFEQ.js";import"../chunk-DUK2K4FB.js";export{formatEnvPort,getFirstPrefixPathname,getPrefixPathname,normalizePathname}from"../chunk-SAW7XS4K.js";import"../chunk-Q6NHYWVX.js";import"../chunk-TSLYDPBJ.js";import"../chunk-WVSPXFTY.js";import"../chunk-L73TOPX5.js";import"../chunk-QNKGP5DY.js";import"../chunk-2UIRWYE3.js";
|