@teacss/preset-icons 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/LICENSE +22 -0
- package/README.md +97 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +1 -0
- package/dist/cdn-BAAzT6MS.js +1 -0
- package/dist/core-By2NcOr9.js +1 -0
- package/dist/core-CmBaHpDm.d.ts +129 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.js +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +1 -0
- package/dist/merge.d.ts +8 -0
- package/dist/merge.js +1 -0
- package/dist/syntax-DmIPw0tH.js +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
|
+
Copyright (c) 2026-PRESENT Billgo <hi@billgo.me>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @teacss/preset-icons
|
|
2
|
+
|
|
3
|
+
**Pure-CSS icon utilities for TeaCSS.**
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
`@teacss/preset-icons` is the official opt-in icon preset for application
|
|
8
|
+
authors who want Iconify assets compiled from
|
|
9
|
+
`icon:<collection>-<icon-name>` classes. It loads installed, custom, or CDN
|
|
10
|
+
collection data, emits icons as CSS masks or backgrounds, and exposes
|
|
11
|
+
icon-specific merge metadata for custom runtime mergers. The generated icons
|
|
12
|
+
require no client-side runtime script.
|
|
13
|
+
|
|
14
|
+
This package owns only the icon vocabulary and its loading behavior:
|
|
15
|
+
`@teacss/core` owns parsing and CSS generation,
|
|
16
|
+
`@teacss/preset-standard` supplies general utilities, themes, conditions, and
|
|
17
|
+
preflights, and `@teacss/preset-articles` supplies long-form content styling.
|
|
18
|
+
None of those other preset vocabularies are bundled here.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```css
|
|
23
|
+
@preset "standard";
|
|
24
|
+
@preset "icons";
|
|
25
|
+
@teacss;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The `icons` short name works with either the application-facing `teacss`
|
|
29
|
+
package or a direct `@teacss/preset-icons` installation.
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<span class="icon:carbon-sun"></span>
|
|
33
|
+
<span class="icon:carbon-moon@dark"></span>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The only utility grammar is `icon:<collection>-<icon-name>`. The value must
|
|
37
|
+
include its Iconify collection. When collection names overlap, the longest
|
|
38
|
+
known collection prefix determines the split and TeaCSS loads that collection
|
|
39
|
+
only; missing icons do not fall back to a shorter collection name.
|
|
40
|
+
Collection-prefix matching uses the preset's packaged, offline Iconify catalog
|
|
41
|
+
(including `griddy-icons`) plus configured custom names; it does not perform
|
|
42
|
+
runtime catalog discovery.
|
|
43
|
+
|
|
44
|
+
`mode: "auto"` chooses a mask for `currentColor` icons and a background image
|
|
45
|
+
for multicolor icons. Override one icon with `?mask`, `?bg`, or `?auto`, for
|
|
46
|
+
example `icon:carbon-sun?mask`.
|
|
47
|
+
|
|
48
|
+
Install the Iconify collections you use, such as `@iconify-json/carbon`. CSS
|
|
49
|
+
integrations also resolve the raw qualified name through `icon(...)`:
|
|
50
|
+
|
|
51
|
+
```css
|
|
52
|
+
.logo {
|
|
53
|
+
background-image: icon("carbon-sun");
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
When configuring `presetIcons()` with `cdn`, `customFetch` can replace the
|
|
58
|
+
default CDN loader. It receives the complete collection URL and must resolve
|
|
59
|
+
to parsed `IconifyJSON` collection data, not a raw `Response` object.
|
|
60
|
+
|
|
61
|
+
Programmatic integrations should use the preset's `api.resolveIcon(name)` so
|
|
62
|
+
they share its configured loader and cache. For lower-level composition,
|
|
63
|
+
`parseIconWithLoader()` resolves a qualified name with one loader,
|
|
64
|
+
`createCDNFetchLoader()` creates the CDN step, and `combineLoaders()` composes
|
|
65
|
+
multiple sources.
|
|
66
|
+
|
|
67
|
+
For runtime class merging, the `/merge` entry exports both a lazy icon-only
|
|
68
|
+
`cn` and the self-contained plugin:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
bun add @teacss/classes
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { createMerger } from "@teacss/classes";
|
|
76
|
+
import {
|
|
77
|
+
cn as iconCn,
|
|
78
|
+
pluginIcon,
|
|
79
|
+
} from "@teacss/preset-icons/merge";
|
|
80
|
+
|
|
81
|
+
const cn = createMerger({ plugins: [pluginIcon] });
|
|
82
|
+
|
|
83
|
+
iconCn("icon:carbon-sun", "icon:not-real-name"); // "icon:not-real-name"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The application `cn` from `teacss` already composes this plugin with the
|
|
87
|
+
standard vocabulary. The zero-config `cn` from
|
|
88
|
+
`@teacss/preset-standard/merge` remains standard-only. Runtime merging checks
|
|
89
|
+
only the canonical lexical grammar, not whether a collection or icon is
|
|
90
|
+
installed. Canonical nonexistent resources
|
|
91
|
+
merge normally; non-canonical `icon:*` declarations are opaque, so different
|
|
92
|
+
raw strings survive and exact duplicates keep their last position. The bare
|
|
93
|
+
keyword `icon` has no canonical value and is opaque as well.
|
|
94
|
+
|
|
95
|
+
## Status
|
|
96
|
+
|
|
97
|
+
Pre-1.0. Icon output follows the installed Iconify collection data.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { a as parseIconWithLoader, c as ParsedIcon, i as createPresetIcons, n as combineLoaders, o as _default, r as createCDNFetchLoader, s as IconsOptions, t as IconsAPI } from "./core-CmBaHpDm.js";
|
|
2
|
+
//#region src/browser.d.ts
|
|
3
|
+
declare const presetIcons: import("@teacss/core").PresetFactory<object, IconsOptions>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { IconsAPI, type IconsOptions, type ParsedIcon, combineLoaders, createCDNFetchLoader, createPresetIcons, presetIcons as default, presetIcons, _default as icons, parseIconWithLoader };
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./core-By2NcOr9.js";import{t as a}from"./cdn-BAAzT6MS.js";import{loadIcon as o}from"@iconify/utils";const s=r(async e=>{let t=[o],r=e?.customFetch,s=e?.cdn;return r&&s?t.push(n(r,s)):s&&t.push(await a(s)),i(t)});export{i as combineLoaders,n as createCDNFetchLoader,r as createPresetIcons,s as default,s as presetIcons,e as icons,t as parseIconWithLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./core-By2NcOr9.js";async function t(t){let{$fetch:n}=await import(`ofetch`);return e(e=>n(e),t)}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
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=await D(n,a);if(!s){l&&!S.isESLint&&i(`failed to load icon "${t}"`);return}let u,d=`url("data:image/svg+xml;utf8,${o(s.svg)}")`;return r===`auto`&&(r=/currentcolor/i.test(s.svg)?`mask`:`bg`),u=r===`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`,...a}:{display:`inline-block`,"-webkit-mask":`none`,mask:`none`,background:`${d} no-repeat`,"background-size":`100% 100%`,"background-color":`transparent`,...a},await x?.(u,{...s,icon:s.name,mode:r}),u},{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};
|
|
@@ -0,0 +1,129 @@
|
|
|
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.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as parseIconWithLoader, c as ParsedIcon, i as createPresetIcons, n as combineLoaders, o as _default, r as createCDNFetchLoader, s as IconsOptions, t as IconsAPI } from "./core-CmBaHpDm.js";
|
|
2
|
+
export { IconsAPI, type IconsOptions, type ParsedIcon, combineLoaders, createCDNFetchLoader, createPresetIcons, _default as icons, parseIconWithLoader };
|
package/dist/core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./core-By2NcOr9.js";export{i as combineLoaders,n as createCDNFetchLoader,r as createPresetIcons,e as icons,t as parseIconWithLoader};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as parseIconWithLoader, c as ParsedIcon, i as createPresetIcons, n as combineLoaders, o as _default, r as createCDNFetchLoader, s as IconsOptions, t as IconsAPI } from "./core-CmBaHpDm.js";
|
|
2
|
+
//#region src/index.d.ts
|
|
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 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./core-By2NcOr9.js";import{t as a}from"./cdn-BAAzT6MS.js";import{loadIcon as o}from"@iconify/utils";import{getEnvFlags as s}from"@teacss/core";const c=r(async e=>{let{cdn:t,customFetch:r}=e,c=[],u=!1,{isNode:d,isVSCode:f,isESLint:p}=s();if(d&&!f&&!p){let e=await l();e!==void 0&&(c.push(e),u=!0)}return u||c.push(o),t&&c.push(r?n(r,t):await a(t)),i(c)});async function l(){try{return await import(`@iconify/utils/lib/loader/node-loader`).then(e=>e?.loadNodeIcon)}catch{}}export{i as combineLoaders,n as createCDNFetchLoader,r as createPresetIcons,c as default,c as presetIcons,e as icons,t as parseIconWithLoader};
|
package/dist/merge.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Merger, MergerPlugin } from "@teacss/classes";
|
|
2
|
+
//#region src/merge.d.ts
|
|
3
|
+
/** Merger metadata for the canonical `icon:<collection>-<name>` vocabulary. */
|
|
4
|
+
declare const pluginIcon: MergerPlugin;
|
|
5
|
+
/** Lazily initialized merger bound only to the canonical icon vocabulary. */
|
|
6
|
+
declare const cn: Merger;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { cn, pluginIcon };
|
package/dist/merge.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./syntax-DmIPw0tH.js";import{MERGE_OPAQUE as t,createMerger as n}from"@teacss/classes";const r={name:`@teacss/preset-icons/merge`,conflicts:{keywords:{},overlaps:{icon:`@teacss/preset-icons:icon`}},group(n){return n.prefix===`icon`?!n.keyword&&e(n.value)?null:t:null}};let i;const a=((...e)=>(i??=n({plugins:[r]}))(...e));export{a as cn,r as pluginIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=String.raw`[\w]+(?:-[\w]+)+`,t=RegExp(`^icon:(${e})(?:\\?(mask|bg|auto))?$`),n=RegExp(`^${e}(?:\\?(?:mask|bg|auto))?$`);function r(e){return e!=null&&n.test(e)}export{r as n,t};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teacss/preset-icons",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Pure-CSS Iconify icon utilities for TeaCSS — one class per icon, no runtime.",
|
|
5
|
+
"homepage": "https://css.teasim.com",
|
|
6
|
+
"funding": "https://github.com/sponsors/billgo",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Billgo <hi@billgo.me>",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"browser": "./dist/browser.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./browser": "./dist/browser.js",
|
|
17
|
+
"./core": "./dist/core.js",
|
|
18
|
+
"./merge": "./dist/merge.js",
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "bunx rimraf dist && bunx tsdown --config tsdown.config.mts",
|
|
28
|
+
"dev": "tsdown --config-loader unrun --watch"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@iconify/types": "^2.0.0",
|
|
32
|
+
"@iconify/utils": "^3.1.4",
|
|
33
|
+
"@teacss/classes": "0.3.0",
|
|
34
|
+
"@teacss/core": "0.3.0",
|
|
35
|
+
"ofetch": "^1.5.1"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.12.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|