@teacss/preset-icons 0.3.8 → 0.4.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 +72 -33
- package/dist/browser.d.ts +3 -5
- package/dist/browser.js +1 -1
- package/dist/core-DY_Ipkg0.d.ts +100 -0
- package/dist/core-F9QNG0sW.js +1 -0
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/index.d.ts +2 -17
- package/dist/index.js +1 -1
- package/package.json +7 -4
- package/dist/cdn-Djb5cZUy.js +0 -1
- package/dist/core-CmBaHpDm.d.ts +0 -129
- package/dist/core-VCcn6g1F.js +0 -1
package/README.md
CHANGED
|
@@ -5,11 +5,21 @@
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
7
|
`@teacss/preset-icons` is the official opt-in icon preset for application
|
|
8
|
-
authors who want
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require no client-side runtime
|
|
8
|
+
authors who want icons compiled from `icon:<collection>-<icon-name>` classes.
|
|
9
|
+
It bundles the Lucide (UI icons), Carbon (IBM's design-system icons), Flagpack
|
|
10
|
+
(country flags), and Cryptocurrency Color (coins and tokens, as `crypto`)
|
|
11
|
+
datasets, emits icons as CSS masks or backgrounds, and exposes
|
|
12
|
+
icon-specific merge metadata for custom runtime mergers. The generated icons require no client-side runtime
|
|
13
|
+
script.
|
|
14
|
+
|
|
15
|
+
Icon data comes from the `@iconify-json/lucide`, `@iconify-json/flagpack`, and
|
|
16
|
+
`@iconify-json/cryptocurrency-color`, and `@iconify-json/carbon` packages this preset depends on, so it installs with the preset and resolves as
|
|
17
|
+
an ordinary module import. Each dataset is imported only when one of its icons
|
|
18
|
+
is used, so a build that never writes `icon:flagpack-*` does not load the flag
|
|
19
|
+
data.
|
|
20
|
+
**Generation never reaches the network**: there is no CDN fetch, no registry
|
|
21
|
+
install, and no filesystem probing for collection packages. A build works
|
|
22
|
+
fully offline.
|
|
13
23
|
|
|
14
24
|
This package owns only the icon vocabulary and its loading behavior:
|
|
15
25
|
`@teacss/core` owns parsing and CSS generation,
|
|
@@ -26,43 +36,70 @@ None of those other preset vocabularies are bundled here.
|
|
|
26
36
|
```
|
|
27
37
|
|
|
28
38
|
The `icons` short name works with either the application-facing `teacss`
|
|
29
|
-
package or a direct `@teacss/preset-icons` installation.
|
|
39
|
+
package or a direct `@teacss/preset-icons` installation. Nothing else to
|
|
40
|
+
install or configure — the bundled data resolves immediately.
|
|
30
41
|
|
|
31
42
|
```html
|
|
43
|
+
<span class="icon:lucide-sun"></span>
|
|
44
|
+
<span class="icon:lucide-moon@dark"></span>
|
|
45
|
+
<span class="icon:flagpack-nl"></span>
|
|
46
|
+
<span class="icon:crypto-btc"></span>
|
|
32
47
|
<span class="icon:carbon-sun"></span>
|
|
33
|
-
<span class="icon:carbon-moon@dark"></span>
|
|
34
48
|
```
|
|
35
49
|
|
|
36
50
|
The only utility grammar is `icon:<collection>-<icon-name>`. The value must
|
|
37
|
-
include its
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
include its collection, so bundled icons are written `icon:lucide-*`,
|
|
52
|
+
`icon:carbon-*`, `icon:flagpack-*`, or `icon:crypto-*`. Flagpack ids are lowercase ISO country
|
|
53
|
+
codes (`icon:flagpack-jp`); coin ids are tickers, some of which start with a
|
|
54
|
+
digit (`icon:crypto-0xbtc`). `crypto` is this preset's name for Iconify's
|
|
55
|
+
Cryptocurrency Color set — Iconify's own `cryptocurrency` is the monochrome
|
|
56
|
+
variant, which is not bundled. When collection names overlap, the longest known
|
|
57
|
+
collection prefix determines the split and TeaCSS loads that collection only;
|
|
58
|
+
missing icons do not fall back to a shorter collection name.
|
|
59
|
+
|
|
60
|
+
`<icon-name>` is the collection's own kebab-case id. Its camelCase spelling
|
|
61
|
+
resolves to the same icon for every bundled id — `icon:carbon-db2Database`,
|
|
62
|
+
`icon:lucide-barChart3`, `icon:lucide-arrowDown01` — and both spellings are
|
|
63
|
+
case-insensitive. Nothing else resolves: a partial or arbitrary re-hyphenation
|
|
64
|
+
such as `icon:lucide-bar-chart3` or `icon:carbon-add--alt` emits no CSS. The
|
|
65
|
+
kebab id stays canonical.
|
|
43
66
|
|
|
44
67
|
`mode: "auto"` chooses a mask for `currentColor` icons and a background image
|
|
45
|
-
for multicolor icons.
|
|
46
|
-
|
|
68
|
+
for multicolor icons. Lucide and Carbon use `currentColor`, so their icons
|
|
69
|
+
resolve to masks and take their color from the surrounding text; Flagpack flags and `crypto`
|
|
70
|
+
coins carry their own colors, so they resolve to
|
|
71
|
+
background images and ignore text color.
|
|
72
|
+
Override one icon with `?mask`, `?bg`, or `?auto`, for example
|
|
73
|
+
`icon:lucide-sun?bg`.
|
|
47
74
|
|
|
48
|
-
|
|
49
|
-
integrations also resolve the raw qualified name through `icon(...)`:
|
|
75
|
+
CSS integrations also resolve the raw qualified name through `icon(...)`:
|
|
50
76
|
|
|
51
77
|
```css
|
|
52
78
|
.logo {
|
|
53
|
-
background-image: icon("
|
|
79
|
+
background-image: icon("lucide-sun");
|
|
54
80
|
}
|
|
55
81
|
```
|
|
56
82
|
|
|
57
|
-
|
|
58
|
-
default CDN loader. It receives the complete collection URL and must resolve
|
|
59
|
-
to parsed `IconifyJSON` collection data, not a raw `Response` object.
|
|
83
|
+
### Other collections
|
|
60
84
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
`lucide`, `carbon`, `flagpack`, and `crypto` are the collections with bundled
|
|
86
|
+
data. Add another one
|
|
87
|
+
by handing the preset data it can read locally through `collections` — an
|
|
88
|
+
inline map, a loader function, or a helper such as `FileSystemIconLoader` from
|
|
89
|
+
`@iconify/utils/lib/loader/fs`:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { icons as tabler } from "@iconify-json/tabler";
|
|
93
|
+
|
|
94
|
+
presetIcons({ collections: { tabler: () => tabler } });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
A collection with neither bundled data nor a `collections` entry emits
|
|
98
|
+
nothing. Set `warn: true` to report those tokens during generation.
|
|
99
|
+
|
|
100
|
+
Programmatic integrations should use the preset's `api.resolveIcon(name)`, which
|
|
101
|
+
resolves a qualified name against the bundled data and the configured
|
|
102
|
+
`collections`.
|
|
66
103
|
|
|
67
104
|
For runtime class merging, the `/merge` entry exports both a lazy icon-only
|
|
68
105
|
`cn` and the self-contained plugin:
|
|
@@ -80,18 +117,20 @@ import {
|
|
|
80
117
|
|
|
81
118
|
const cn = createMerger({ plugins: [pluginIcon] });
|
|
82
119
|
|
|
83
|
-
iconCn("icon:
|
|
120
|
+
iconCn("icon:lucide-sun", "icon:not-real-name"); // "icon:not-real-name"
|
|
84
121
|
```
|
|
85
122
|
|
|
86
123
|
The application `cn` from `teacss` already composes this plugin with the
|
|
87
124
|
standard vocabulary. The zero-config `cn` from
|
|
88
125
|
`@teacss/preset-standard/merge` remains standard-only. Runtime merging checks
|
|
89
|
-
only the canonical lexical grammar, not whether a collection or icon
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
126
|
+
only the canonical lexical grammar, not whether a collection or icon exists.
|
|
127
|
+
Canonical nonexistent resources merge normally; non-canonical `icon:*`
|
|
128
|
+
declarations are opaque, so different raw strings survive and exact duplicates
|
|
129
|
+
keep their last position. The bare keyword `icon` has no canonical value and
|
|
130
|
+
is opaque as well.
|
|
94
131
|
|
|
95
132
|
## Status
|
|
96
133
|
|
|
97
|
-
Pre-1.0. Icon output follows the
|
|
134
|
+
Pre-1.0. Icon output follows the bundled `@iconify-json/lucide`,
|
|
135
|
+
`@iconify-json/flagpack`, `@iconify-json/cryptocurrency-color`, and
|
|
136
|
+
`@iconify-json/carbon` data.
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#endregion
|
|
5
|
-
export { IconsAPI, type IconsOptions, type ParsedIcon, combineLoaders, createCDNFetchLoader, createPresetIcons, presetIcons as default, presetIcons, _default as icons, parseIconWithLoader };
|
|
1
|
+
import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-DY_Ipkg0.js";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, presetIcons as default, presetIcons, icons };
|
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"./core-F9QNG0sW.js";import r from"./index.js";export{t as BUNDLED_COLLECTIONS,r as default,n as icons,e as presetIcons};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CustomIconLoader, IconCustomizations, InlineCollection } from "@iconify/utils";
|
|
2
|
+
import { encodeSvgForCss } from "@iconify/utils/lib/svg/encode-svg-for-css";
|
|
3
|
+
import { Awaitable, CSSObject } from "@teacss/core";
|
|
4
|
+
import { IconifyJSON } from "@iconify/types";
|
|
5
|
+
//#region src/bundled.d.ts
|
|
6
|
+
/** Collection prefixes that resolve from bundled data. */
|
|
7
|
+
declare const BUNDLED_COLLECTIONS: string[];
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/types.d.ts
|
|
10
|
+
interface ParsedIcon {
|
|
11
|
+
collection: string;
|
|
12
|
+
name: string;
|
|
13
|
+
svg: string;
|
|
14
|
+
}
|
|
15
|
+
interface IconMeta extends ParsedIcon {
|
|
16
|
+
mode?: IconsOptions["mode"];
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated renamed to `name`
|
|
19
|
+
*/
|
|
20
|
+
icon: string;
|
|
21
|
+
}
|
|
22
|
+
interface IconsOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Scale related to the current font size (1em).
|
|
25
|
+
*
|
|
26
|
+
* @default 1
|
|
27
|
+
*/
|
|
28
|
+
scale?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Mode of generated CSS icons.
|
|
31
|
+
*
|
|
32
|
+
* - `mask` - use background color and the `mask` property for monochrome icons
|
|
33
|
+
* - `bg` - use background image for the icons, colors are static
|
|
34
|
+
* - `auto` - smartly decide mode between `mask` and `bg` per icon based on its style
|
|
35
|
+
*
|
|
36
|
+
* @default 'auto'
|
|
37
|
+
* @see https://antfu.me/posts/icons-in-pure-css
|
|
38
|
+
*/
|
|
39
|
+
mode?: "mask" | "bg" | "auto";
|
|
40
|
+
/**
|
|
41
|
+
* Extra CSS properties applied to the generated CSS
|
|
42
|
+
*
|
|
43
|
+
* @default {}
|
|
44
|
+
*/
|
|
45
|
+
extraProperties?: Record<string, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Emit warning when missing icons are matched
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
warn?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Extra collections resolved from data the caller supplies.
|
|
54
|
+
*
|
|
55
|
+
* The preset bundles the `lucide` dataset and loads nothing else on its own —
|
|
56
|
+
* no filesystem lookup, no registry install, no CDN — so this is the way to
|
|
57
|
+
* add another collection. Supply the data inline or through a loader that
|
|
58
|
+
* reads it locally, for example `FileSystemIconLoader` from
|
|
59
|
+
* `@iconify/utils/lib/loader/fs`.
|
|
60
|
+
*/
|
|
61
|
+
collections?: Record<string, (() => Awaitable<IconifyJSON>) | undefined | CustomIconLoader | InlineCollection>;
|
|
62
|
+
/**
|
|
63
|
+
* Rule layer
|
|
64
|
+
*
|
|
65
|
+
* @default 'icons'
|
|
66
|
+
*/
|
|
67
|
+
layer?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Custom icon customizations.
|
|
70
|
+
*/
|
|
71
|
+
customizations?: Omit<IconCustomizations, "additionalProps" | "trimCustomSvg">;
|
|
72
|
+
/**
|
|
73
|
+
* Custom icon unit.
|
|
74
|
+
*
|
|
75
|
+
* @default `em`
|
|
76
|
+
*/
|
|
77
|
+
unit?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Processor for the CSS object before stringify
|
|
80
|
+
*/
|
|
81
|
+
processor?: (cssObject: CSSObject, meta: Required<IconMeta>) => Awaitable<void>;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/core.d.ts
|
|
85
|
+
/**
|
|
86
|
+
* Collection prefixes the preset recognizes on its own — the ones with bundled
|
|
87
|
+
* data. Any other prefix has to be supplied through the `collections` option,
|
|
88
|
+
* whose keys join this set per instance.
|
|
89
|
+
*/
|
|
90
|
+
declare const icons: string[];
|
|
91
|
+
/**
|
|
92
|
+
* API for preset-icons
|
|
93
|
+
*/
|
|
94
|
+
interface IconsAPI {
|
|
95
|
+
encodeSvgForCss: typeof encodeSvgForCss;
|
|
96
|
+
resolveIcon: (name: string) => Promise<ParsedIcon | undefined>;
|
|
97
|
+
}
|
|
98
|
+
declare const presetIcons: import("@teacss/core").PresetFactory<object, IconsOptions>;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { ParsedIcon as a, IconsOptions as i, icons as n, BUNDLED_COLLECTIONS as o, presetIcons as r, IconsAPI as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./syntax-DmIPw0tH.js";import{loadIcon as t}from"@iconify/utils";import{encodeSvgForCss as n}from"@iconify/utils/lib/svg/encode-svg-for-css";import{definePreset as r,getEnvFlags as i,warnOnce as a}from"@teacss/core";import{searchForIcon as o}from"@iconify/utils/lib/loader/modern";const s=new Map([[`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)]]),c=[...s.keys()];function l(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}const u=new WeakMap;function d(e){let t=0;for(let n of e)n===`-`&&t++;return t}function f(e,t,n){let r=d(e)-d(t);if(r!==0)return r<0;let i=Number(n(t))-Number(n(e));return i===0?e<t:i<0}function p(e){let t=u.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=l(t).toLowerCase(),i=n.get(e);(i===void 0||f(t,i,r))&&n.set(e,t)}return u.set(e,n),n}async function m(e,t,n){let r=s.get(e);if(!r)return;let i=await r(),a=t.toLowerCase(),c=p(i).get(a);return await o(i,e,[...new Set([t,a,...c==null?[]:[c]])],n)}const h=c;async function g(e,n,r){return await m(e,n,r)??await t(e,n,r)}const _=r((t={})=>{let{scale:r=1,mode:o=`auto`,warn:s=!1,collections:c,extraProperties:l={},customizations:u={},layer:d=`icons`,unit:f,processor:p}=t,m=i(),_={addXmlNs:!0,scale:r,customCollections:c,warn:void 0,customizations:{...u,additionalProps:{...l},trimCustomSvg:!0,async iconCustomizer(e,t,n){await u.iconCustomizer?.(e,t,n),f&&(n.width||=`${r}${f}`,n.height||=`${r}${f}`)}}},y=new Set([...h,...Object.keys(c||{})]),b=async(e,t)=>{let n=v(e,y);if(!n)return;let r=await g(n.collection,n.name,t?{..._,usedProps:t}:_);return r?{...n,svg:r}:void 0};return{name:`@teacss/preset-icons`,enforce:`pre`,options:t,layers:{[d]:-30},api:{encodeSvgForCss:n,resolveIcon:e=>b(e)},rules:[[e,async e=>{let[t,r,i=o]=e,c={},l;try{l=await b(r,c)}catch(e){s&&!m.isESLint&&a(`failed to load icon "${t}": ${e instanceof Error?e.message:String(e)}`);return}if(!l){s&&!m.isESLint&&a(`failed to load icon "${t}"`);return}let u,d=`url("data:image/svg+xml;utf8,${n(l.svg)}")`;return i===`auto`&&(i=/currentcolor/i.test(l.svg)?`mask`:`bg`),u=i===`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 p?.(u,{...l,icon:l.name,mode:i}),u},{layer:d}]]}});function v(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{_ as n,c as r,h as t};
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { IconsAPI, type IconsOptions, type ParsedIcon,
|
|
1
|
+
import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-DY_Ipkg0.js";
|
|
2
|
+
export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, icons, presetIcons };
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"./core-F9QNG0sW.js";export{t as BUNDLED_COLLECTIONS,n as icons,e as presetIcons};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Use any icon with Pure CSS for TeaCSS.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```html
|
|
9
|
-
* <div class="icon:mdi-alarm"></div>
|
|
10
|
-
* <div class="icon:logos-vue font-size:3x"></div>
|
|
11
|
-
* <button class="icon:carbon-sun icon:carbon-moon@dark"></button>
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
declare const presetIcons: import("@teacss/core").PresetFactory<object, IconsOptions>;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { IconsAPI, type IconsOptions, type ParsedIcon, combineLoaders, createCDNFetchLoader, createPresetIcons, presetIcons as default, presetIcons, _default as icons, parseIconWithLoader };
|
|
1
|
+
import { a as ParsedIcon, i as IconsOptions, n as icons, o as BUNDLED_COLLECTIONS, r as presetIcons, t as IconsAPI } from "./core-DY_Ipkg0.js";
|
|
2
|
+
export { BUNDLED_COLLECTIONS, IconsAPI, type IconsOptions, type ParsedIcon, presetIcons as default, presetIcons, icons };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"./core-F9QNG0sW.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.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -28,11 +28,14 @@
|
|
|
28
28
|
"dev": "tsdown --config-loader unrun --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@iconify-json/carbon": "^1.2.25",
|
|
32
|
+
"@iconify-json/cryptocurrency-color": "^1.2.4",
|
|
33
|
+
"@iconify-json/flagpack": "^1.2.8",
|
|
34
|
+
"@iconify-json/lucide": "^1.2.123",
|
|
31
35
|
"@iconify/types": "^2.0.0",
|
|
32
36
|
"@iconify/utils": "^3.1.4",
|
|
33
|
-
"@teacss/classes": "0.
|
|
34
|
-
"@teacss/core": "0.
|
|
35
|
-
"ofetch": "^1.5.1"
|
|
37
|
+
"@teacss/classes": "0.4.0",
|
|
38
|
+
"@teacss/core": "0.4.0"
|
|
36
39
|
},
|
|
37
40
|
"engines": {
|
|
38
41
|
"node": ">=22.12.0"
|
package/dist/cdn-Djb5cZUy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./core-VCcn6g1F.js";async function t(t){let{$fetch:n}=await import(`ofetch`);return e(e=>n(e),t)}export{t};
|
package/dist/core-CmBaHpDm.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { CustomIconLoader, IconCustomizations, IconifyLoaderOptions, InlineCollection, UniversalIconLoader } from "@iconify/utils";
|
|
2
|
-
import { Awaitable, CSSObject } from "@teacss/core";
|
|
3
|
-
import { encodeSvgForCss } from "@iconify/utils/lib/svg/encode-svg-for-css";
|
|
4
|
-
import { IconifyJSON } from "@iconify/types";
|
|
5
|
-
//#region src/types.d.ts
|
|
6
|
-
interface ParsedIcon {
|
|
7
|
-
collection: string;
|
|
8
|
-
name: string;
|
|
9
|
-
svg: string;
|
|
10
|
-
}
|
|
11
|
-
interface IconMeta extends ParsedIcon {
|
|
12
|
-
mode?: IconsOptions["mode"];
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated renamed to `name`
|
|
15
|
-
*/
|
|
16
|
-
icon: string;
|
|
17
|
-
}
|
|
18
|
-
interface IconsOptions {
|
|
19
|
-
/**
|
|
20
|
-
* Scale related to the current font size (1em).
|
|
21
|
-
*
|
|
22
|
-
* @default 1
|
|
23
|
-
*/
|
|
24
|
-
scale?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Mode of generated CSS icons.
|
|
27
|
-
*
|
|
28
|
-
* - `mask` - use background color and the `mask` property for monochrome icons
|
|
29
|
-
* - `bg` - use background image for the icons, colors are static
|
|
30
|
-
* - `auto` - smartly decide mode between `mask` and `bg` per icon based on its style
|
|
31
|
-
*
|
|
32
|
-
* @default 'auto'
|
|
33
|
-
* @see https://antfu.me/posts/icons-in-pure-css
|
|
34
|
-
*/
|
|
35
|
-
mode?: "mask" | "bg" | "auto";
|
|
36
|
-
/**
|
|
37
|
-
* Extra CSS properties applied to the generated CSS
|
|
38
|
-
*
|
|
39
|
-
* @default {}
|
|
40
|
-
*/
|
|
41
|
-
extraProperties?: Record<string, string>;
|
|
42
|
-
/**
|
|
43
|
-
* Emit warning when missing icons are matched
|
|
44
|
-
*
|
|
45
|
-
* @default false
|
|
46
|
-
*/
|
|
47
|
-
warn?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* `@iconify-json` collections to use (will be also auto installed when missing and `autoInstall` enabled).
|
|
50
|
-
*
|
|
51
|
-
* This option should be used only when there are new `@iconify-json` collections not listed in the default icons preset collection names.
|
|
52
|
-
*
|
|
53
|
-
* Adding external collections will not work, you should use `FileSystemIconLoader` from
|
|
54
|
-
* `@iconify/utils/lib/loader/fs` or `createExternalPackageIconLoader` from
|
|
55
|
-
* `@iconify/utils/lib/loader/external-pkg` instead.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
iconifyCollectionsNames?: string[];
|
|
59
|
-
/**
|
|
60
|
-
* In Node.js environment, the preset will search for the installed iconify dataset automatically.
|
|
61
|
-
* When using in the browser, this options is provided to provide dataset with custom loading mechanism.
|
|
62
|
-
*/
|
|
63
|
-
collections?: Record<string, (() => Awaitable<IconifyJSON>) | undefined | CustomIconLoader | InlineCollection>;
|
|
64
|
-
/**
|
|
65
|
-
* Rule layer
|
|
66
|
-
*
|
|
67
|
-
* @default 'icons'
|
|
68
|
-
*/
|
|
69
|
-
layer?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Custom icon customizations.
|
|
72
|
-
*/
|
|
73
|
-
customizations?: Omit<IconCustomizations, "additionalProps" | "trimCustomSvg">;
|
|
74
|
-
/**
|
|
75
|
-
* Auto install icon sources package when the usages is detected
|
|
76
|
-
*
|
|
77
|
-
* Only effective in Node.js environment.
|
|
78
|
-
*
|
|
79
|
-
* @default false
|
|
80
|
-
*/
|
|
81
|
-
autoInstall?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Path to resolve the iconify collections in Node.js environment.
|
|
84
|
-
*
|
|
85
|
-
* @default process.cwd()
|
|
86
|
-
*/
|
|
87
|
-
collectionsNodeResolvePath?: string | string[];
|
|
88
|
-
/**
|
|
89
|
-
* Custom icon unit.
|
|
90
|
-
*
|
|
91
|
-
* @default `em`
|
|
92
|
-
*/
|
|
93
|
-
unit?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Load icons from CDN. Should starts with `https://` and ends with `/`
|
|
96
|
-
*
|
|
97
|
-
* Recommends:
|
|
98
|
-
* - https://esm.sh/
|
|
99
|
-
* - https://cdn.skypack.dev/
|
|
100
|
-
*/
|
|
101
|
-
cdn?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Custom fetch function used with `cdn` to return parsed Iconify collection data.
|
|
104
|
-
*/
|
|
105
|
-
customFetch?: (url: string) => Promise<IconifyJSON>;
|
|
106
|
-
/**
|
|
107
|
-
* Processor for the CSS object before stringify
|
|
108
|
-
*/
|
|
109
|
-
processor?: (cssObject: CSSObject, meta: Required<IconMeta>) => Awaitable<void>;
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/collections.d.ts
|
|
113
|
-
declare const _default: string[];
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/core.d.ts
|
|
116
|
-
/**
|
|
117
|
-
* API for preset-icons
|
|
118
|
-
*/
|
|
119
|
-
interface IconsAPI {
|
|
120
|
-
encodeSvgForCss: typeof encodeSvgForCss;
|
|
121
|
-
parseIconWithLoader: typeof parseIconWithLoader;
|
|
122
|
-
resolveIcon: (name: string) => Promise<ParsedIcon | undefined>;
|
|
123
|
-
}
|
|
124
|
-
declare function createPresetIcons(lookupIconLoader: (options: IconsOptions) => Promise<UniversalIconLoader>): import("@teacss/core").PresetFactory<object, IconsOptions>;
|
|
125
|
-
declare function combineLoaders(loaders: UniversalIconLoader[]): UniversalIconLoader;
|
|
126
|
-
declare function createCDNFetchLoader(fetcher: (url: string) => Promise<IconifyJSON>, cdnBase: string, cacheMap?: Map<string, IconifyJSON | Promise<IconifyJSON>>): UniversalIconLoader;
|
|
127
|
-
declare function parseIconWithLoader(body: string, loader: UniversalIconLoader, options?: IconifyLoaderOptions, safeCollectionsNames?: string[]): Promise<ParsedIcon | undefined>;
|
|
128
|
-
//#endregion
|
|
129
|
-
export { parseIconWithLoader as a, ParsedIcon as c, createPresetIcons as i, combineLoaders as n, _default as o, createCDNFetchLoader as r, IconsOptions as s, IconsAPI as t };
|
package/dist/core-VCcn6g1F.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./syntax-DmIPw0tH.js";import{quicklyValidateIconSet as t}from"@iconify/utils";import{definePreset as n,getEnvFlags as r,warnOnce as i}from"@teacss/core";import{searchForIcon as a}from"@iconify/utils/lib/loader/modern";import{encodeSvgForCss as o}from"@iconify/utils/lib/svg/encode-svg-for-css";var s=`academicons.akar-icons.ant-design.arcticons.at-icons.basil.bi.bitcoin-icons.boxicons.bpmn.brandico.bubbles.bx.bxl.bxs.bytesize.carbon.catppuccin.cbi.charm.ci.cib.cif.cil.circle-flags.circum.clarity.codex.codicon.covid.cryptocurrency-color.cryptocurrency.cuida.dashicons.devicon-line.devicon-original.devicon-plain.devicon.dinkie-icons.duo-icons.ei.el.emblemicons.emojione-monotone.emojione-v1.emojione.entypo-social.entypo.eos-icons.ep.et.eva.f7.fa-brands.fa-regular.fa-solid.fa.fa6-brands.fa6-regular.fa6-solid.fa7-brands.fa7-regular.fa7-solid.fad.famicons.fe.feather.file-icons.flag.flagpack.flat-color-icons.flat-ui.flowbite.fluent-color.fluent-emoji-flat.fluent-emoji-high-contrast.fluent-emoji.fluent-mdl2.fluent.fontelico.fontisto.formkit.foundation.fxemoji.gala.game-icons.garden.gcp.geo.gg.ginetex.gis.glyphs-poly.glyphs.gravity-ui.griddy-icons.gridicons.grommet-icons.guidance.healthicons.heroicons-outline.heroicons-solid.heroicons.hugeicons.humbleicons.ic.icomoon-free.icon-park-outline.icon-park-solid.icon-park-twotone.icon-park.iconamoon.iconoir.icons8.il.ion.iwwa.ix.jam.la.lets-icons.line-md.lineicons.logos.ls.lsicon.lucide-lab.lucide.mage.majesticons.maki.map.marketeq.material-icon-theme.material-symbols-light.material-symbols.mdi-light.mdi.medical-icon.memory.meteocons.meteor-icons.mi.mingcute.mono-icons.mynaui.nimbus.nonicons.noto-v1.noto.nrk.octicon.oi.ooui.openmoji.osmic.oui.pajamas.pepicons-pencil.pepicons-pop.pepicons-print.pepicons.ph.picon.pinhead.pixel.pixelarticons.prime.proicons.ps.qlementine-icons.quill.radix-icons.raphael.ri.rivet-icons.roentgen.selfhst.si-glyph.si.sidekickicons.simple-icons.simple-line-icons.skill-icons.solar.stash.streamline-block.streamline-color.streamline-cyber-color.streamline-cyber.streamline-emojis.streamline-flex-color.streamline-flex.streamline-freehand-color.streamline-freehand.streamline-guidance.streamline-kameleon-color.streamline-logos.streamline-pixel.streamline-plump-color.streamline-plump.streamline-sharp-color.streamline-sharp.streamline-stickies-color.streamline-ultimate-color.streamline-ultimate.streamline.subway.svg-spinners.system-uicons.tabler.tdesign.teenyicons.temaki.token-branded.token.topcoat.twemoji.typcn.uil.uim.uis.uit.uiw.unjs.vaadin.vs.vscode-icons.websymbol.weui.whh.wi.wordpress.wpf.zmdi.zondicons`.split(`.`);function c(t){return n((n={})=>{let{scale:a=1,mode:c=`auto`,warn:l=!1,iconifyCollectionsNames:u,collections:m,extraProperties:h={},customizations:g={},autoInstall:_=!1,collectionsNodeResolvePath:v,layer:y=`icons`,unit:b,processor:x}=n,S=r(),C={addXmlNs:!0,scale:a,customCollections:m,autoInstall:_,cwd:v,warn:void 0,customizations:{...g,additionalProps:{...h},trimCustomSvg:!0,async iconCustomizer(e,t,n){await g.iconCustomizer?.(e,t,n),b&&(n.width||=`${a}${b}`,n.height||=`${a}${b}`)}}},w=new Set([...s,...u||[],...Object.keys(m||{})]),T,E=()=>{if(!T){let e=Promise.resolve().then(()=>t(n));T=e,e.catch(()=>{T===e&&(T=void 0)})}return T},D=async(e,t)=>{let n=f(e,w);if(n)return p(n,await E(),t?{...C,usedProps:t}:C)};return{name:`@teacss/preset-icons`,enforce:`pre`,options:n,layers:{[y]:-30},api:{encodeSvgForCss:o,parseIconWithLoader:d,resolveIcon:e=>D(e)},rules:[[e,async e=>{let[t,n,r=c]=e,a={},s=f(n,w),u=s?await E():void 0,d;try{d=s&&u?await p(s,u,{...C,usedProps:a}):void 0}catch(e){l&&!S.isESLint&&i(`failed to load icon "${t}": ${e instanceof Error?e.message:String(e)}`);return}if(!d){l&&!S.isESLint&&i(`failed to load icon "${t}"`);return}let m,h=`url("data:image/svg+xml;utf8,${o(d.svg)}")`;return r===`auto`&&(r=/currentcolor/i.test(d.svg)?`mask`:`bg`),m=r===`mask`?{"--tea-icon":h,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`,...a}:{display:`inline-block`,"-webkit-mask":`none`,mask:`none`,background:`${h} no-repeat`,"background-size":`100% 100%`,"background-color":`transparent`,...a},await x?.(m,{...d,icon:d.name,mode:r}),m},{layer:y}]]}})}function l(e){return(async(...t)=>{for(let n of e){if(!n)continue;let e=await n(...t);if(e)return e}})}function u(e,n,r=new Map){function i(i){if(!r.has(i)){let a=Promise.resolve().then(()=>e(`${n}@iconify-json/${i}/icons.json`)).then(e=>{let n=t(e);if(!n||n.prefix!==i)throw TypeError(`Invalid Iconify collection data for "${i}"`);return n});r.set(i,a),a.catch(()=>{r.get(i)===a&&r.delete(i)})}return r.get(i)}return async(e,t,n)=>{let r=await i(e);if(r)return await a(r,e,[t,t.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase(),t.replace(/([a-z])(\d+)/g,`$1-$2`)],n)}}async function d(e,t,n={},r=[]){let i=f(e,new Set([...s,...r,...Object.keys(n.customCollections||{})]));if(i)return p(i,t,n)}function f(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(`-`)}}}async function p(e,t,n){let r=await t(e.collection,e.name,n);if(r)return{...e,svg:r}}export{s as a,d as i,u as n,c as r,l as t};
|