unocss-merge 0.4.4 → 0.5.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 CHANGED
@@ -47,7 +47,7 @@ function Component(props) {
47
47
  ```
48
48
 
49
49
  > [!TIP]
50
- > `useMemo` `deps array`.length should not change in runtime
50
+ > this is a simple wrapper of `React.useMemo`, so arguments.length should not change in runtime
51
51
 
52
52
  ## Why
53
53
 
@@ -83,7 +83,7 @@ function Component(props) {
83
83
 
84
84
  - complex features are not supported !!!
85
85
  - ❌ [Complex Variants](https://github.com/unocss/unocss/tree/main/packages-presets/preset-mini/src/_variants) are not recongized
86
- - ❌ [Variant Group](https://unocss.dev/transformers/variant-group)
86
+ - ❌ [Variant Group](https://unocss.dev/transformers/variant-group) U should setup [Variant group transformer](https://unocss.dev/transformers/variant-group)
87
87
  - ❌ [Shortcuts](https://unocss.dev/config/shortcuts) are not recongized
88
88
  - ❌ complex shorthand: I don't recall any example in my mind
89
89
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{getClassList as e,unoMerge as t}from"./src-CDJ86dLA.js";export{e as getClassList,t as unoMerge};
1
+ import{getClassList as e,unoMerge as t}from"./src-CvP1zLNH.js";export{e as getClassList,t as unoMerge};
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{unoMerge as e}from"./src-CDJ86dLA.js";import{useMemo as t}from"react";function n(...n){return t(()=>e(...n),[...n])}export{n as useUnoMerge};
1
+ import{unoMerge as e}from"./src-CvP1zLNH.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`],[r`^b(?:order)?-([tblrxyse])-${a}$`,(e,t)=>`border-${t?.[1]}-style`],[/^b(?:order)?-([tblrxyse])($|-\d+)/,(e,t)=>`border-${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?.[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=>[r`^${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`,m:[`mt`,`mb`,`ml`,`mr`],mx:[`ml`,`mr`],my:[`mt`,`mb`],p:[`pt`,`pb`,`pl`,`pr`],px:[`pl`,`pr`],py:[`pt`,`pb`]}));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 typeof t==`boolean`?[]:e((t||``).split(` `).map(e=>e.trim()).filter(Boolean))}function _(...t){let n=new Map,r=t.map(g).flat().filter(Boolean);return r.forEach(i),e(Array.from(n.values())).join(` `);function i(e){let t=e,r;function i(e){[e].flat().forEach(e=>{n.set(r?r+e:e,t)})}function a(){let t=l(e);if(t)return i(t),!0}function o(){let t=u(e);if(!t)return;let[n,r]=t,a=f(r);return i(a),!0}function s(){let t=e,n=/(\[[\w,()/-]+\])$/;n.test(e)&&(t=e.replace(n,function(e,t){return`*`.repeat(t.length)})),t.includes(`--`)&&(t=t.replaceAll(`--`,`-*`));let r=t.lastIndexOf(`-`);if(r===-1)return;let a=f(e.slice(0,r));return i(a),!0}function c(){return i(f(e))}function d(){let t=/^(?:[\w-]+:)+/,n=t.exec(e);n&&(r=n[0].split(/(?<=:)(?:\b|$)/).filter(Boolean).sort().join(``),e=e.slice(r.length))}let p=a()||o();p||(d(),a()||o()||s()||c())}}export{g as getClassList,_ as unoMerge};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unocss-merge",
3
- "version": "0.4.4",
4
- "packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184",
3
+ "version": "0.5.1",
4
+ "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
5
5
  "description": "simple utility to merge unocss class names",
6
6
  "type": "module",
7
7
  "keywords": [
@@ -57,17 +57,13 @@
57
57
  }
58
58
  },
59
59
  "devDependencies": {
60
- "@magicdawn/eslint-config": "^1.5.6",
60
+ "@magicdawn/eslint-config": "^1.5.7",
61
61
  "@magicdawn/prettier-config": "^0.1.0",
62
- "@swc/core": "^1.12.9",
63
- "@types/node": "^24.0.10",
62
+ "@types/node": "^24.0.13",
64
63
  "@types/react": "^19.1.8",
65
- "@typescript-eslint/eslint-plugin": "^8.35.1",
66
- "@typescript-eslint/parser": "^8.35.1",
67
64
  "@vitest/coverage-v8": "^3.2.4",
68
- "es-toolkit": "^1.39.6",
69
- "eslint": "^9.30.1",
70
- "eslint-config-prettier": "^10.1.5",
65
+ "es-toolkit": "^1.39.7",
66
+ "eslint": "^9.31.0",
71
67
  "husky": "^9.1.7",
72
68
  "lint-staged": "^16.1.2",
73
69
  "prettier": "^3.6.2",
@@ -1,6 +0,0 @@
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`],[r`^b(?:order)?-([tblrxyse])-${a}$`,(e,t)=>`border-${t==null?void 0:t[1]}-style`],[/^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`,m:[`mt`,`mb`,`ml`,`mr`],mx:[`ml`,`mr`],my:[`mt`,`mb`],p:[`pt`,`pb`,`pl`,`pr`],px:[`pl`,`pr`],py:[`pt`,`pb`]}));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 typeof t==`boolean`?[]:e((t||``).split(` `).map(e=>e.trim()).filter(Boolean))}function _(...t){let n=new Map,r=t.map(g).flat().filter(Boolean);return r.forEach(i),e(Array.from(n.values())).join(` `);function i(e){let t=e,r;function i(e){[e].flat().forEach(e=>{n.set(r?r+e:e,t)})}{let t=/^(?:[\w-]+:)+/g,n=t.exec(e);n&&(r=n[0].split(/(?<=:)(?:\b|$)/).filter(Boolean).sort().join(``),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};