unocss-merge 0.2.0 → 0.3.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/README.md +55 -0
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1 -1
- package/dist/react.d.ts +2 -3
- package/dist/react.js +1 -1
- package/dist/src-KQw-83RL.js +6 -0
- package/package.json +47 -45
- package/dist/src-DkzuEjkD.js +0 -6
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@ $ pnpm add unocss-merge
|
|
|
16
16
|
|
|
17
17
|
## API
|
|
18
18
|
|
|
19
|
+
### `unoMerge`
|
|
20
|
+
|
|
19
21
|
```ts
|
|
20
22
|
import { unoMerge } from 'unocss-merge'
|
|
21
23
|
|
|
@@ -30,6 +32,59 @@ expect(unoMerge('mr-1', 'mr--4px')).toBe('mr--4px')
|
|
|
30
32
|
expect(unoMerge('cursor-pointer', 'cursor-not-allowed')).toBe('cursor-not-allowed')
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
> [!TIP]
|
|
36
|
+
> This function does not provide any cache mechanism, wrap with your own cache if needed. [memoize](https://github.com/sindresorhus/memoize#install) or others.
|
|
37
|
+
|
|
38
|
+
### `useUnoMerge`
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useUnoMerge } from 'unocss-merge/react'
|
|
42
|
+
|
|
43
|
+
function Component(props) {
|
|
44
|
+
const className = useUnoMerge('cursor-pointer', props.className)
|
|
45
|
+
return <div className={className} />
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> [!TIP]
|
|
50
|
+
> `useMemo` `deps array`.length should not change in runtime
|
|
51
|
+
|
|
52
|
+
## Why
|
|
53
|
+
|
|
54
|
+
- `twMerge` don't support [arbitrary value without brackets](https://github.com/dcastil/tailwind-merge/blob/v3.2.0/src/lib/validators.ts#L1)
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { twMerge } from 'tailwind-merge' // "tailwind-merge": "^3.2.0",
|
|
58
|
+
|
|
59
|
+
// size-16px ml-4px cursor-not-allowed size-18px ml-10px
|
|
60
|
+
console.log(twMerge('cursor-pointer size-16px ml-4px', 'cursor-not-allowed size-18px ml-10px'))
|
|
61
|
+
console.log(twMerge('cursor-pointer', 'cursor-not-allowed')) // `cursor-not-allowed` ✅
|
|
62
|
+
|
|
63
|
+
console.log(twMerge('size-[16px]', 'size-[18px]')) // `size-[18px]` ✅
|
|
64
|
+
console.log(twMerge('ml-[4px]', 'ml-[10px]')) // `ml-[10px]` ✅
|
|
65
|
+
|
|
66
|
+
// twMerge don't support arbitrary value without brackets
|
|
67
|
+
console.log(twMerge('size-16px', 'size-18px')) // `size-16px size-18px` ❌
|
|
68
|
+
console.log(twMerge('ml-4px', 'ml-10px')) // `ml-4px ml-10px` ❌
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Status
|
|
72
|
+
|
|
73
|
+
### ✅ What is **KNOWN** Supported
|
|
74
|
+
|
|
75
|
+
- ✅ simple class name `mr-4px` `mr-4`
|
|
76
|
+
- ✅ arbitrary value `mr-[4px]` `mr-[4]`
|
|
77
|
+
- ✅ negative value `mr--4px`
|
|
78
|
+
- ✅ simple colon separated variants `hover:mr-4px` `dark:ml-4px` `hover:dark:ml-4px`
|
|
79
|
+
|
|
80
|
+
### ❌ What is **NOT** Supported
|
|
81
|
+
|
|
82
|
+
- complex features are not supported !!!
|
|
83
|
+
- ❌ [Complex Variants](https://github.com/unocss/unocss/tree/main/packages-presets/preset-mini/src/_variants) are not recongized
|
|
84
|
+
- ❌ [Variant Group](https://unocss.dev/transformers/variant-group)
|
|
85
|
+
- ❌ [Shortcuts](https://unocss.dev/config/shortcuts) are not recongized
|
|
86
|
+
- ❌ shorthand: for example merge `mx` with `ml / mr` are not supported
|
|
87
|
+
|
|
33
88
|
## Changelog
|
|
34
89
|
|
|
35
90
|
See https://github.com/magicdawn/unocss-merge/releases
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/index.d.ts
|
|
2
2
|
declare function getClassList(className: string | null | undefined): string[];
|
|
3
3
|
/**
|
|
4
|
-
* Match steps
|
|
5
|
-
* 1. `getMergeMapKeyValue`: exact-string + regex match
|
|
6
|
-
* 2. `findInKnownPrefixHasDashValue`: prefix match; may replace alias via `PREFIX_ALIAS`
|
|
7
|
-
* 3. `lastIndexOf('-')` based split; may replace alias via `PREFIX_ALIAS`
|
|
8
|
-
*/
|
|
4
|
+
* Match steps
|
|
5
|
+
* 1. `getMergeMapKeyValue`: exact-string + regex match
|
|
6
|
+
* 2. `findInKnownPrefixHasDashValue`: prefix match; may replace alias via `PREFIX_ALIAS`
|
|
7
|
+
* 3. `lastIndexOf('-')` based split; may replace alias via `PREFIX_ALIAS`
|
|
8
|
+
*/
|
|
9
9
|
declare function unoMerge(...classNames: Array<string | undefined | null>): string;
|
|
10
|
-
|
|
11
10
|
//#endregion
|
|
12
11
|
export { getClassList, unoMerge };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassList as e,unoMerge as t}from"./src-
|
|
1
|
+
import{getClassList as e,unoMerge as t}from"./src-KQw-83RL.js";export{e as getClassList,t as unoMerge};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/react.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* @note `useMemo` `deps array`.length should not change in runtime
|
|
4
|
-
*/
|
|
3
|
+
* @note `useMemo` `deps array`.length should not change in runtime
|
|
4
|
+
*/
|
|
5
5
|
declare function useUnoMerge(...classNames: Array<string | undefined>): string;
|
|
6
|
-
|
|
7
6
|
//#endregion
|
|
8
7
|
export { useUnoMerge };
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unoMerge as e}from"./src-
|
|
1
|
+
import{unoMerge as e}from"./src-KQw-83RL.js";import{useMemo as t}from"react";function n(...n){return t(()=>e(...n),[...n])}export{n as useUnoMerge};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function e(e){return Array.from(new Set(e))}function t(e,t){if(!e)throw typeof t==`string`?Error(t):t}const n=String.raw,r=(e,...t)=>new RegExp(n(e,...t)),i=n`(\d+(\.\d+)?)?(xs|sm|md|lg|xl)`,a=`(solid|dashed|dotted|double|none|hidden)`,o=[[m(`
|
|
2
|
+
block,inline-block,inline,flex,inline-flex,flow-root,grid,inline-grid,contents,list-item,hidden
|
|
3
|
+
table,inline-table,table-caption,table-cell,table-column,table-row,
|
|
4
|
+
table-column-group,table-footer-group,table-header-group,table-row-group
|
|
5
|
+
`),`display`],[[`isolate`,`isolation-auto`],`isolation`],[[`static`,`fixed`,`absolute`,`relative`,`sticky`],`position`],[[`visible`,`invisible`,`collapse`],`visibility`],[h(`flex-`,[`row`,`row-reverse`,`col`,`col-reverse`]),`flex-direction`],[h(`flex-`,[`wrap`,`wrap-reverse`,`nowrap`]),`flex-wrap`],[h(`object-`,[`contain`,`cover`,`fill`,`none`,`scale-down`]),`object-fit`],[h(`object-`,[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`]),`object-position`],[[`antialiased`,`subpixel-antialiased`],`font-smoothing`],[[`italic`,`not-italic`],`font-style`],[h(`font-`,[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),`font-weight`],[[`normal-nums`,`ordinal`,`slashed-zero`,`lining-nums`,`oldstyle-nums`,`proportional-nums`,`tabular-nums`,`diagonal-fractions`,`stacked-fractions`],`font-variant-numeric`],[r`^(text|text-size|font-size)-(\d+|${i}$)`,`font-size`],[h(`list-`,[`inside`,`outside`]),`list-style-position`],[h(`list-`,[`none`,`disc`,`decimal`]),`list-style-type`],[h(`text-`,[`left`,`center`,`right`,`justify`,`start`,`end`]),`text-align`],[[`underline`,`overline`,`line-through`,`no-underline`],`text-decoration-line`],[h(`decoration-`,[`solid`,`double`,`dotted`,`dashed`,`wavy`]),`text-decoration-style`],[/^decoration-(\d+|(auto|from-font)$)/,`text-decoration-thickness`],[[`truncate`,`text-ellipsis`,`text-clip`],`text-overflow`],[h(`text-`,[`wrap`,`nowrap`,`balance`,`pretty`]),`text-wrap`],[h(`bg-`,[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`]),`background-position`],[/^bg(-no)?-repeat($|-)/,`background-repeat`],[h(`bg-`,[`auto`,`cover`,`contain`]),`background-size`],[[`bg-none`,/^bg-gradient-to-/],`background-image`],[/^(?:border-|b-)?(?:rounded|rd)(?:-(.+))?$/,`rounded`],[r`^b(?:order)?-${a}$`,`border-style`],[/^b(?:order)?($|-\d+)/,`border-width`],[/^b(?:order)?-([tblrxyse])($|-\d+)/,(e,t)=>`border-${t==null?void 0:t[1]}-width`],[/^outline-\d+/,`outline-width`],[[`outline`,r`^outline-${a}$`],`outline-style`],[r`^divide-${a}$`,`divide-style`],[/^divide-(x|y)($|-\d+)/,(e,t)=>`divide-${t==null?void 0:t[1]}-width`],[[`ring`,/^ring-\d+/],`ring-width`],[[/^ring-offset-\d+/],`ring-offset-width`],[[`shadow`,...h(`shadow-`,[`inner`,`none`]),r`^shadow-${i}$`],`box-shadow`],[h(`border-`,[`collapse`,`separate`]),`border-collapse`],[h(`table-`,[`auto`,`fixed`]),`table-layout`],[h(`caption-`,[`top`,`bottom`]),`caption-side`],[h(`scroll-`,[`auto`,`smooth`]),`scroll-behavior`],[h(`snap-`,[`start`,`end`,`center`,`align-none`]),`scroll-snap-align`],[h(`snap-`,[`normal`,`always`]),`scroll-snap-stop`],[h(`snap-`,[`none`,`x`,`y`,`both`,`mandatory`,`proximity`]),`scroll-snap-type`],[/^stroke-\d+/,`stroke-width`],[[`sr-only`,`not-sr-only`],`Screen-Readers`],[/^(flex-)?grow($|-\d+$)/,`flex-grow`],[/^(flex-)?shrink($|-\d+$)/,`flex-shrink`],...[`ring-inset`,`divide-x-reverse`,`divide-y-reverse`].map(e=>[e,e]),...[`resize`,`blur`,`drop-shadow`,`grayscale`,`invert`,`sepia`,`backdrop-blur`,`backdrop-grayscale`,`backdrop-invert`,`backdrop-sepia`].map(e=>[e,e])],s=new Map,c=new Map;for(let[e,t]of o){let n=[e].flat(),r=n.filter(e=>typeof e==`string`),i=n.filter(e=>typeof e==`object`&&e instanceof RegExp);r.forEach(e=>{let n=typeof t==`string`?t:t(e);s.set(e,n)}),i.forEach(e=>{c.set(e,t)})}function l(e){if(s.has(e))return s.get(e);for(let[t,n]of c.entries())if(t.test(e)){let r=t.exec(e),i=typeof n==`string`?n:n(e,r);return i}}function u(e){return d.map(e=>typeof e==`string`?[e,e]:e).find(([t,n])=>e.startsWith(`${t}-`))}const d=[`break-after`,`break-before`,`break-inside`,`grid-flow`,`align`,`whitespace`,`mix-blend`,`bg-blend`,`ease`,`origin`,`cursor`,`touch`,[`text`,`color`],`color`,[`bg`,`background-color`],[`b`,`border-color`],[`border`,`border-color`],[`decoration`,`text-decoration-color`],[`from`,`gradient-color-stops`],[`divide`,`divide-color`],[`outline`,`outline-color`],[`ring`,`ring-color`],[`ring-offset`,`ring-offset-color`],[`shadow`,`box-shadow-color`],[`accent`,`accent-color`],[`caret`,`caret-color`],`fill`,`stroke`];function f(e){return p.has(e)?p.get(e):e}const p=new Map(Object.entries({leading:`line-height`,col:`grid-column`,"col-span":`grid-column`,"col-start":`grid-column-start`,"col-end":`grid-column-end`,row:`grid-row`,"row-span":`grid-row`,"row-start":`grid-row-start`,"row-end":`grid-row-end`}));function m(e){return e.split(`
|
|
6
|
+
`).map(e=>e.trim()).filter(Boolean).map(e=>e.split(`,`).map(e=>e.trim()).filter(Boolean)).flat()}function h(e,n){return t(e.endsWith(`-`),"prefix must end with `-`"),n.map(t=>e+t)}function g(t){return e((t||``).split(` `).map(e=>e.trim()).filter(Boolean))}function _(...e){let t=new Map,n=e.map(g).flat().filter(Boolean);return n.forEach(r),Array.from(t.values()).join(` `);function r(e){let n=e,r;function i(e){t.set(r?r+e:e,n)}{let t=/^(?:[\w-]+:)+/g,n=t.exec(e);n&&(r=n[0],e=e.slice(r.length))}{let t=l(e);if(t)return i(t)}let a=u(e);if(a){let[e,t]=a,n=f(t);return i(n)}let o=e,s=/(\[[\w,-]+\])$/;s.test(e)&&(o=e.replace(s,function(e,t){return`*`.repeat(t.length)})),o.includes(`--`)&&(o=o.replaceAll(`--`,`-*`));let c=o.lastIndexOf(`-`);if(c===-1)return i(f(e));let d=f(e.slice(0,c));i(d)}}export{g as getClassList,_ as unoMerge};
|
package/package.json
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unocss-merge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184",
|
|
4
5
|
"description": "simple utility to merge unocss class names",
|
|
5
6
|
"type": "module",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"unocss",
|
|
9
|
+
"merge",
|
|
10
|
+
"tw-merge"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/magicdawn/unocss-merge#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/magicdawn/unocss-merge/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+ssh://git@github.com/magicdawn/unocss-merge.git"
|
|
20
|
+
},
|
|
21
|
+
"author": "magicdawn",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/"
|
|
24
|
+
],
|
|
6
25
|
"exports": {
|
|
7
26
|
"./package.json": "./package.json",
|
|
8
27
|
"./react": {
|
|
@@ -14,9 +33,9 @@
|
|
|
14
33
|
"default": "./dist/index.js"
|
|
15
34
|
}
|
|
16
35
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"registry": "https://registry.npmjs.org/"
|
|
38
|
+
},
|
|
20
39
|
"scripts": {
|
|
21
40
|
"prepare": "husky",
|
|
22
41
|
"dev": "tsdown --watch",
|
|
@@ -27,52 +46,35 @@
|
|
|
27
46
|
"test-cover": "vitest run --coverage",
|
|
28
47
|
"prepublishOnly": "pnpm typecheck && pnpm test-cover && pnpm build"
|
|
29
48
|
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@magicdawn/prettier-config": "^0.0.4",
|
|
32
|
-
"@swc/core": "^1.11.22",
|
|
33
|
-
"@types/node": "^22.15.2",
|
|
34
|
-
"@types/react": "^19.1.2",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
|
36
|
-
"@typescript-eslint/parser": "^8.31.0",
|
|
37
|
-
"@vitest/coverage-v8": "^3.1.2",
|
|
38
|
-
"es-toolkit": "^1.36.0",
|
|
39
|
-
"eslint": "^9.25.1",
|
|
40
|
-
"eslint-config-prettier": "^10.1.2",
|
|
41
|
-
"husky": "^9.1.7",
|
|
42
|
-
"lint-staged": "^15.5.1",
|
|
43
|
-
"prettier": "^3.5.3",
|
|
44
|
-
"tsdown": "^0.9.8",
|
|
45
|
-
"typescript": "^5.8.3",
|
|
46
|
-
"vitest": "^3.1.2"
|
|
47
|
-
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"react": ">=18"
|
|
50
51
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@magicdawn/eslint-config": "^1.5.6",
|
|
54
|
+
"@magicdawn/prettier-config": "^0.1.0",
|
|
55
|
+
"@swc/core": "^1.12.9",
|
|
56
|
+
"@types/node": "^24.0.10",
|
|
57
|
+
"@types/react": "^19.1.8",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
|
59
|
+
"@typescript-eslint/parser": "^8.35.1",
|
|
60
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
61
|
+
"es-toolkit": "^1.39.5",
|
|
62
|
+
"eslint": "^9.30.1",
|
|
63
|
+
"eslint-config-prettier": "^10.1.5",
|
|
64
|
+
"husky": "^9.1.7",
|
|
65
|
+
"lint-staged": "^16.1.2",
|
|
66
|
+
"prettier": "^3.6.2",
|
|
67
|
+
"tsdown": "^0.12.9",
|
|
68
|
+
"typescript": "^5.8.3",
|
|
69
|
+
"vitest": "^3.2.4"
|
|
68
70
|
},
|
|
69
71
|
"lint-staged": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
],
|
|
73
|
-
"*.{js,jsx,ts,tsx,less,md}": [
|
|
72
|
+
"*.{?(c|m)(j|t)s?(x),json,y?(a)ml}": [
|
|
73
|
+
"eslint --fix",
|
|
74
74
|
"prettier --write"
|
|
75
|
+
],
|
|
76
|
+
"!*.{?(c|m)(j|t)s?(x),json,y?(a)ml}": [
|
|
77
|
+
"prettier --write --ignore-unknown"
|
|
75
78
|
]
|
|
76
|
-
}
|
|
77
|
-
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f"
|
|
79
|
+
}
|
|
78
80
|
}
|
package/dist/src-DkzuEjkD.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function e(e){return Array.from(new Set(e))}function t(e,t){if(!e)throw Error(t)}const n=[[u(`
|
|
2
|
-
block,inline-block,inline,flex,inline-flex,flow-root,grid,inline-grid,contents,list-item,hidden
|
|
3
|
-
table,inline-table,table-caption,table-cell,table-column,table-row,
|
|
4
|
-
table-column-group,table-footer-group,table-header-group,table-row-group
|
|
5
|
-
`),`display`],[[`isolate`,`isolation-auto`],`isolation`],[[`static`,`fixed`,`absolute`,`relative`,`sticky`],`position`],[[`visible`,`invisible`,`collapse`],`visibility`],[[`flex-row`,`flex-row-reverse`,`flex-col`,`flex-col-reverse`],`flex-direction`],[[`flex-wrap`,`flex-wrap-reverse`,`flex-nowrap`],`flex-wrap`],[d(`object-`,[`contain`,`cover`,`fill`,`none`,`scale-down`]),`object-fit`],[d(`object-`,[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`]),`object-position`],[[`antialiased`,`subpixel-antialiased`],`font-smoothing`],[[`italic`,`not-italic`],`font-style`],[d(`font-`,[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),`font-weight`],[[`normal-nums`,`ordinal`,`slashed-zero`,`lining-nums`,`oldstyle-nums`,`proportional-nums`,`tabular-nums`,`diagonal-fractions`,`stacked-fractions`],`font-variant-numeric`],[[`text-xs`,`text-sm`,`text-base`,`text-lg`,`text-xl`,/^text-(size-)?\d+xl/,/^text-(size-)?\d+/,/^font-size-\d+/],`font-size`],[[`list-inside`,`list-outside`],`list-style-position`],[[`list-none`,`list-disc`,`list-decimal`],`list-style-type`],[d(`text-`,[`left`,`center`,`right`,`justify`,`start`,`end`]),`text-align`],[[`underline`,`overline`,`line-through`,`no-underline`],`text-decoration-line`],[d(`decoration-`,[`solid`,`double`,`dotted`,`dashed`,`wavy`]),`text-decoration-style`],[[`decoration-auto`,`decoration-from-font`,/^decoration-\d+/],`text-decoration-thickness`],[[`truncate`,`text-ellipsis`,`text-clip`],`text-overflow`],[[`text-wrap`,`text-nowrap`,`text-balance`,`text-pretty`],`text-wrap`],[d(`bg-`,[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`]),`background-position`],[[`bg-repeat`,`bg-no-repeat`,/^bg-repeat-/],`background-repeat`],[[`bg-auto`,`bg-cover`,`bg-contain`],`background-size`],[[`bg-none`,/^bg-gradient-to-/],`background-image`],[[/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/],`rounded`],[/^b(?:order)?-(solid|dashed|dotted|double|hidden|none)$/,`border-style`],[/^b(?:order)?($|-\d+)/,`border-width`],[/^b(?:order)?-(t|b|l|r|x|y|s|e)($|-\d+)/,(e,t)=>`border-${t?.[1]}-width`],[/^outline-\d+/,`outline-width`],[[`outline`,/^outline-(solid|dashed|dotted|double|none)$/],`outline-style`],[/^divide-(solid|dashed|dotted|double|none)$/,`divide-style`],[/^divide-(x|y)($|-\d+)/,(e,t)=>`divide-${t?.[1]}-width`],[[`ring`,/^ring-\d+/],`ring-width`],[[/^ring-offset-\d+/],`ring-offset-width`],[[`shadow`,...d(`shadow-`,[`sm`,`md`,`lg`,`xl`,`2xl`,`inner`,`none`])],`box-shadow`],[[`border-collapse`,`border-separate`],`border-collapse`],[[`table-auto`,`table-fixed`],`table-layout`],[[`caption-top`,`caption-bottom`],`caption-side`],[[`scroll-auto`,`scroll-smooth`],`scroll-behavior`],[[`snap-start`,`snap-end`,`snap-center`,`snap-align-none`],`scroll-snap-align`],[[`snap-normal`,`snap-always`],`scroll-snap-stop`],[[`snap-none`,`snap-x`,`snap-y`,`snap-both`,`snap-mandatory`,`snap-proximity`],`scroll-snap-type`],[/^stroke-\d+/,`stroke-width`],[[`sr-only`,`not-sr-only`],`Screen-Readers`],[/^(flex-)?grow($|-\d+$)/,`flex-grow`],[/^(flex-)?shrink($|-\d+$)/,`flex-shrink`],...[`ring-inset`,`divide-x-reverse`,`divide-y-reverse`].map(e=>[e,e]),...[`resize`,`blur`,`drop-shadow`,`grayscale`,`invert`,`sepia`,`backdrop-blur`,`backdrop-grayscale`,`backdrop-invert`,`backdrop-sepia`].map(e=>[e,e])],r=new Map,i=new Map;for(let[e,t]of n){let n=[e].flat(),a=n.filter(e=>typeof e==`string`),o=n.filter(e=>typeof e==`object`&&e instanceof RegExp);a.forEach(e=>{let n=typeof t==`string`?t:t(e);r.set(e,n)}),o.forEach(e=>{i.set(e,t)})}function a(e){if(r.has(e))return r.get(e);for(let[t,n]of i.entries())if(t.test(e)){let r=t.exec(e),i=typeof n==`string`?n:n(e,r);return i}}function o(e){return s.map(e=>typeof e==`string`?[e,e]:e).find(([t,n])=>e.startsWith(t+`-`))}const s=[`break-after`,`break-before`,`break-inside`,`grid-flow`,`align`,`whitespace`,`mix-blend`,`bg-blend`,`ease`,`origin`,`cursor`,`touch`,[`text`,`color`],`color`,[`bg`,`background-color`],[`b`,`border-color`],[`border`,`border-color`],[`decoration`,`text-decoration-color`],[`from`,`gradient-color-stops`],[`divide`,`divide-color`],[`outline`,`outline-color`],[`ring`,`ring-color`],[`ring-offset`,`ring-offset-color`],[`shadow`,`box-shadow-color`],[`accent`,`accent-color`],[`caret`,`caret-color`],`fill`,`stroke`];function c(e){return l.has(e)?l.get(e):e}const l=new Map(Object.entries({leading:`line-height`,col:`grid-column`,"col-span":`grid-column`,"col-start":`grid-column-start`,"col-end":`grid-column-end`,row:`grid-row`,"row-span":`grid-row`,"row-start":`grid-row-start`,"row-end":`grid-row-end`}));function u(e){return e.split(`
|
|
6
|
-
`).map(e=>e.trim()).filter(Boolean).map(e=>e.split(`,`).map(e=>e.trim()).filter(Boolean)).flat()}function d(e,n){return t(e.endsWith(`-`),"prefix must end with `-`"),n.map(t=>e+t)}function f(t){return e((t||``).split(` `).map(e=>e.trim()).filter(Boolean))}function p(...e){let t=e.map(f).flat().filter(Boolean),n=new Map;for(let e of t){{let t=a(e);if(t){n.set(t,e);continue}}let t=o(e);if(t){let[r,i]=t,a=c(i);n.set(a,e);continue}let r=e,i=/(\[[\w_,-]+\])$/;i.test(e)&&(r=e.replace(i,function(e,t){return`*`.repeat(t.length)})),r.includes(`--`)&&(r=r.replace(/--/g,`-*`));let s=r.lastIndexOf(`-`);if(s===-1){n.set(c(e),e);continue}let l=c(e.slice(0,s));n.set(l,e)}return Array.from(n.values()).join(` `)}export{f as getClassList,p as unoMerge};
|