unocss-merge 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  //#region src/index.d.ts
2
- declare function getClassList(className: string | null | undefined): string[];
2
+ declare function getClassList(className: string | null | undefined | boolean): string[];
3
3
  /**
4
4
  * Match steps
5
5
  * 1. `getMergeMapKeyValue`: exact-string + regex match
6
6
  * 2. `findInKnownPrefixHasDashValue`: prefix match; may replace alias via `PREFIX_ALIAS`
7
7
  * 3. `lastIndexOf('-')` based split; may replace alias via `PREFIX_ALIAS`
8
8
  */
9
- declare function unoMerge(...classNames: Array<string | undefined | null>): string;
9
+ declare function unoMerge(...classNames: Array<string | undefined | null | boolean>): string;
10
10
  //#endregion
11
11
  export { getClassList, unoMerge };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{getClassList as e,unoMerge as t}from"./src-BMqvPBIT.js";export{e as getClassList,t as unoMerge};
1
+ import{getClassList as e,unoMerge as t}from"./src-LPkpOQvf.js";export{e as getClassList,t as unoMerge};
package/dist/react.d.ts CHANGED
@@ -2,6 +2,6 @@
2
2
  /**
3
3
  * @note `useMemo` `deps array`.length should not change in runtime
4
4
  */
5
- declare function useUnoMerge(...classNames: Array<string | undefined>): string;
5
+ declare function useUnoMerge(...classNames: Array<string | undefined | null | boolean>): string;
6
6
  //#endregion
7
7
  export { useUnoMerge };
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{unoMerge as e}from"./src-BMqvPBIT.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-LPkpOQvf.js";import{useMemo as t}from"react";function n(...n){return t(()=>e(...n),[...n])}export{n as useUnoMerge};
@@ -3,4 +3,4 @@ function e(e){return Array.from(new Set(e))}function t(e,t){if(!e)throw typeof t
3
3
  table,inline-table,table-caption,table-cell,table-column,table-row,
4
4
  table-column-group,table-footer-group,table-header-group,table-row-group
5
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`,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 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};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unocss-merge",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184",
5
5
  "description": "simple utility to merge unocss class names",
6
6
  "type": "module",