@teacss/preset-icons 0.6.2 → 0.6.4

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/browser.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-CWgrTiKr.js";
1
+ import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-Bag9sYi0.js";
2
2
  import "./index.js";
3
3
  export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, presetIcons as default, presetIcons, icons };
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./core-Bam0Bjvx.js";import r from"./index.js";export{t as BUNDLED_COLLECTIONS,r as default,n as icons,e as presetIcons};
1
+ import{n as e,r as t,t as n}from"./core-Dv3jK5ea.js";import r from"./index.js";export{t as BUNDLED_COLLECTIONS,r as default,n as icons,e as presetIcons};
@@ -14,10 +14,6 @@ interface ParsedIcon {
14
14
  }
15
15
  interface IconMeta extends ParsedIcon {
16
16
  mode?: IconsOptions["mode"];
17
- /**
18
- * @deprecated renamed to `name`
19
- */
20
- icon: string;
21
17
  }
22
18
  interface IconsOptions {
23
19
  /**
@@ -1 +1 @@
1
- import{loadIcon as e}from"@iconify/utils";import{encodeSvgForCss as t}from"@iconify/utils/lib/svg/encode-svg-for-css";import{definePreset as n,getEnvFlags as r,warnOnce as i}from"@teacss/core";import{searchForIcon as a}from"@iconify/utils/lib/loader/modern";const o=new Map([[`brands`,()=>import(`@iconify-json/bxl`).then(e=>e.icons)],[`carbon`,()=>import(`@iconify-json/carbon`).then(e=>e.icons)],[`crypto`,()=>import(`@iconify-json/cryptocurrency-color`).then(e=>e.icons)],[`flagpack`,()=>import(`@iconify-json/flagpack`).then(e=>e.icons)],[`lucide`,()=>import(`@iconify-json/lucide`).then(e=>e.icons)]]),s=[...o.keys()];function c(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}const l=new WeakMap;function u(e){let t=0;for(let n of e)n===`-`&&t++;return t}function d(e,t,n){let r=u(e)-u(t);if(r!==0)return r<0;let i=Number(n(t))-Number(n(e));return i===0?e<t:i<0}function f(e){let t=l.get(e);if(t)return t;let n=new Map,r=t=>Object.hasOwn(e.icons,t);for(let t of[...Object.keys(e.icons),...Object.keys(e.aliases??{})]){let e=c(t).toLowerCase(),i=n.get(e);(i===void 0||d(t,i,r))&&n.set(e,t)}return l.set(e,n),n}async function p(e,t,n){let r=o.get(e);if(!r)return;let i=await r(),s=t.toLowerCase(),c=f(i).get(s),l=[...new Set([t,s,...c==null?[]:[c]])];return await a(i,e,l,n)}const m=String.raw`[\w]+(?:-[\w]+)+`,h=RegExp(`^icon:(${m})(?:\\?(mask|bg|auto))?$`),g=s;async function _(t,n,r){return await p(t,n,r)??await e(t,n,r)}function v(e,t){return`${e}\0${t}`}function y(e,t,n){let r=(t,r)=>{n.set(v(e,t),r instanceof Error?r.message:String(r))};return typeof t==`function`?(async e=>{try{return await t(e)}catch(t){r(e,t);return}}):t&&Object.fromEntries(Object.entries(t).map(([e,t])=>[e,typeof t==`function`?async()=>{try{return await t()}catch(t){r(e,t);return}}:t]))}const b=n((e={})=>{let{scale:n=1,mode:a=`auto`,warn:o=!1,collections:s,extraProperties:c={},customizations:l={},layer:u=`icons`,unit:d,processor:f}=e,p=r(),m=new Map,b={addXmlNs:!0,scale:n,customCollections:s?Object.fromEntries(Object.entries(s).map(([e,t])=>[e,y(e,t,m)])):void 0,warn:void 0,customizations:{...l,additionalProps:{...c},trimCustomSvg:!0,async iconCustomizer(e,t,r){await l.iconCustomizer?.(e,t,r),d&&(r.width||=`${n}${d}`,r.height||=`${n}${d}`)}}},S=new Set([...g,...Object.keys(s||{})]),C=async(e,t)=>{let n=x(e,S);if(!n)return;let r=await _(n.collection,n.name,t?{...b,usedProps:t}:b);if(r)return{...n,svg:r};let i=v(n.collection,n.name),a=m.get(i);if(a!==void 0)throw m.delete(i),Error(a)};return{name:`@teacss/preset-icons`,enforce:`pre`,options:e,layers:{[u]:-30},api:{encodeSvgForCss:t,resolveIcon:e=>C(e)},rules:[[h,async e=>{let[n,r,s=a]=e,c={},l;try{l=await C(r,c)}catch(e){o&&!p.isESLint&&i(`failed to load icon "${n}": ${e instanceof Error?e.message:String(e)}`);return}if(!l){o&&!p.isESLint&&i(`failed to load icon "${n}"`);return}let u,d=`url("data:image/svg+xml;utf8,${t(l.svg)}")`;return s===`auto`&&(s=/currentcolor/i.test(l.svg)?`mask`:`bg`),u=s===`mask`?{"--tea-icon":d,display:`inline-block`,"-webkit-mask":`var(--tea-icon) no-repeat`,mask:`var(--tea-icon) no-repeat`,"-webkit-mask-size":`100% 100%`,"mask-size":`100% 100%`,"background-color":`currentColor`,"background-image":`none`,color:`inherit`,...c}:{display:`inline-block`,"-webkit-mask":`none`,mask:`none`,background:`${d} no-repeat`,"background-size":`100% 100%`,"background-color":`transparent`,...c},await f?.(u,{...l,icon:l.name,mode:s}),u},{layer:u}]]}});function x(e,t){let n=e.split(`-`);if(!(n.length<2||n.some(e=>e.length===0)))for(let e=n.length-1;e>=1;e--){let r=n.slice(0,e).join(`-`);if(t.has(r))return{collection:r,name:n.slice(e).join(`-`)}}}export{b as n,s as r,g as t};
1
+ import{loadIcon as e}from"@iconify/utils";import{encodeSvgForCss as t}from"@iconify/utils/lib/svg/encode-svg-for-css";import{definePreset as n,getEnvFlags as r,warnOnce as i}from"@teacss/core";import{searchForIcon as a}from"@iconify/utils/lib/loader/modern";const o=new Map([[`brands`,()=>import(`@iconify-json/bxl`).then(e=>e.icons)],[`carbon`,()=>import(`@iconify-json/carbon`).then(e=>e.icons)],[`crypto`,()=>import(`@iconify-json/cryptocurrency-color`).then(e=>e.icons)],[`flagpack`,()=>import(`@iconify-json/flagpack`).then(e=>e.icons)],[`lucide`,()=>import(`@iconify-json/lucide`).then(e=>e.icons)]]),s=[...o.keys()];function c(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}const l=new WeakMap;function u(e){let t=0;for(let n of e)n===`-`&&t++;return t}function d(e,t,n){let r=u(e)-u(t);if(r!==0)return r<0;let i=Number(n(t))-Number(n(e));return i===0?e<t:i<0}function f(e){let t=l.get(e);if(t)return t;let n=new Map,r=t=>Object.hasOwn(e.icons,t);for(let t of[...Object.keys(e.icons),...Object.keys(e.aliases??{})]){let e=c(t).toLowerCase(),i=n.get(e);(i===void 0||d(t,i,r))&&n.set(e,t)}return l.set(e,n),n}async function p(e,t,n){let r=o.get(e);if(!r)return;let i=await r(),s=t.toLowerCase(),c=f(i).get(s),l=[...new Set([t,s,...c==null?[]:[c]])];return await a(i,e,l,n)}const m=String.raw`[\w]+(?:-[\w]+)+`,h=RegExp(`^icon:(${m})(?:\\?(mask|bg|auto))?$`),g=s;async function _(t,n,r){return await p(t,n,r)??await e(t,n,r)}function v(e,t){return`${e}\0${t}`}function y(e,t,n){let r=(t,r)=>{n.set(v(e,t),r instanceof Error?r.message:String(r))};return typeof t==`function`?(async e=>{try{return await t(e)}catch(t){r(e,t);return}}):t&&Object.fromEntries(Object.entries(t).map(([e,t])=>[e,typeof t==`function`?async()=>{try{return await t()}catch(t){r(e,t);return}}:t]))}const b=n((e={})=>{let{scale:n=1,mode:a=`auto`,warn:o=!1,collections:s,extraProperties:c={},customizations:l={},layer:u=`icons`,unit:d,processor:f}=e,p=r(),m=new Map,b={addXmlNs:!0,scale:n,customCollections:s?Object.fromEntries(Object.entries(s).map(([e,t])=>[e,y(e,t,m)])):void 0,warn:void 0,customizations:{...l,additionalProps:{...c},trimCustomSvg:!0,async iconCustomizer(e,t,r){await l.iconCustomizer?.(e,t,r),d&&(r.width||=`${n}${d}`,r.height||=`${n}${d}`)}}},S=new Set([...g,...Object.keys(s||{})]),C=async(e,t)=>{let n=x(e,S);if(!n)return;let r=await _(n.collection,n.name,t?{...b,usedProps:t}:b);if(r)return{...n,svg:r};let i=v(n.collection,n.name),a=m.get(i);if(a!==void 0)throw m.delete(i),Error(a)};return{name:`@teacss/preset-icons`,enforce:`pre`,options:e,layers:{[u]:-30},api:{encodeSvgForCss:t,resolveIcon:e=>C(e)},rules:[[h,async e=>{let[n,r,s=a]=e,c={},l;try{l=await C(r,c)}catch(e){o&&!p.isESLint&&i(`failed to load icon "${n}": ${e instanceof Error?e.message:String(e)}`);return}if(!l){o&&!p.isESLint&&i(`failed to load icon "${n}"`);return}let u,d=`url("data:image/svg+xml;utf8,${t(l.svg)}")`;return s===`auto`&&(s=/currentcolor/i.test(l.svg)?`mask`:`bg`),u=s===`mask`?{"--tea-icon":d,display:`inline-block`,"-webkit-mask":`var(--tea-icon) no-repeat`,mask:`var(--tea-icon) no-repeat`,"-webkit-mask-size":`100% 100%`,"mask-size":`100% 100%`,"background-color":`currentColor`,"background-image":`none`,color:`inherit`,...c}:{display:`inline-block`,"-webkit-mask":`none`,mask:`none`,background:`${d} no-repeat`,"background-size":`100% 100%`,"background-color":`transparent`,...c},await f?.(u,{...l,mode:s}),u},{layer:u}]]}});function x(e,t){let n=e.split(`-`);if(!(n.length<2||n.some(e=>e.length===0)))for(let e=n.length-1;e>=1;e--){let r=n.slice(0,e).join(`-`);if(t.has(r))return{collection:r,name:n.slice(e).join(`-`)}}}export{b as n,s as r,g as t};
package/dist/core.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-CWgrTiKr.js";
1
+ import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-Bag9sYi0.js";
2
2
  export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, icons, presetIcons };
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./core-Bam0Bjvx.js";export{t as BUNDLED_COLLECTIONS,n as icons,e as presetIcons};
1
+ import{n as e,r as t,t as n}from"./core-Dv3jK5ea.js";export{t as BUNDLED_COLLECTIONS,n as icons,e as presetIcons};
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-CWgrTiKr.js";
1
+ import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-Bag9sYi0.js";
2
2
  export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, presetIcons as default, presetIcons, icons };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./core-Bam0Bjvx.js";var r=e;export{t as BUNDLED_COLLECTIONS,r as default,n as icons,e as presetIcons};
1
+ import{n as e,r as t,t as n}from"./core-Dv3jK5ea.js";var r=e;export{t as BUNDLED_COLLECTIONS,r as default,n as icons,e as presetIcons};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/preset-icons",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Pure-CSS Iconify icon utilities for TeaCSS — one class per icon, no runtime.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
@@ -34,10 +34,10 @@
34
34
  "@iconify-json/lucide": "^1.2.129",
35
35
  "@iconify/types": "^2.0.0",
36
36
  "@iconify/utils": "^3.1.5",
37
- "@teacss/core": "0.6.2"
37
+ "@teacss/core": "0.6.4"
38
38
  },
39
39
  "devDependencies": {
40
- "@teacss/classes": "0.6.2"
40
+ "@teacss/classes": "0.6.4"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=22.12.0"