@stillwind/plugin-iconify 0.7.0 → 0.9.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/CHANGELOG.md ADDED
@@ -0,0 +1,75 @@
1
+ # @stillwind/plugin-iconify
2
+
3
+ ## 0.9.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Each published npm package and the VS Code extension now include `CHANGELOG.md`, so you can read the release notes of the installed version in `node_modules` or on the extension page.
8
+
9
+ - Updated dependencies:
10
+ - @stillwind/config@0.9.0
11
+
12
+ ## 0.8.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies:
17
+ - @stillwind/config@0.8.0
18
+
19
+ ## 0.7.0
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies:
24
+ - @stillwind/config@0.7.0
25
+
26
+ ## 0.6.0
27
+
28
+ ### Patch Changes
29
+
30
+ - The packages now have npm keywords, so the npm search, the Astro integrations library, and other directories that read `keywords` can find them by the frameworks, build tools, and editors that they support. Each package description now states what the package does and which tools it supports.
31
+
32
+ - Updated dependencies:
33
+ - @stillwind/config@0.6.0
34
+
35
+ ## 0.5.0
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies:
40
+ - @stillwind/config@0.5.0
41
+
42
+ ## 0.4.1
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies:
47
+ - @stillwind/config@0.4.1
48
+
49
+ ## 0.4.0
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies:
54
+ - @stillwind/config@0.4.0
55
+
56
+ ## 0.3.0
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies:
61
+ - @stillwind/config@0.3.0
62
+
63
+ ## 0.2.0
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies:
68
+ - @stillwind/config@0.2.0
69
+
70
+ ## 0.1.0
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies:
75
+ - @stillwind/config@0.1.0
package/dist/index.js CHANGED
@@ -303,6 +303,7 @@ function iconify(options = {}) {
303
303
  const statements = /* @__PURE__ */ new WeakMap();
304
304
  /**
305
305
  * Returns the icon sets of one statement.
306
+ *
306
307
  * @param context - Statement context. The host keeps it for the lifetime of the loaded statement.
307
308
  * @returns The statement's icon set cache.
308
309
  */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/collections.ts","../src/license.ts","../src/icons.ts","../src/plugin.ts","../src/directory.ts"],"sourcesContent":["import type { IconifyJSON } from \"@iconify/types\";\nimport type { PluginContext } from \"@stillwind/config\";\n\n/**\n * A custom icon set: Iconify data, an absolute JSON file path, or a function that\n * returns Iconify data synchronously or asynchronously.\n */\nexport type CollectionSource =\n | IconifyJSON\n | string\n | ((context: CollectionLoadContext) => IconifyJSON | Promise<IconifyJSON>);\n\n/**\n * Set name and host operations that a function source receives. A function source watches\n * each file and directory that it reads, so that a change reloads the design system.\n */\nexport interface CollectionLoadContext extends Pick<\n PluginContext,\n \"root\" | \"watch\" | \"read\" | \"list\"\n> {\n /** Set name that selects the source in `collections`, such as `brand`. */\n readonly prefix: string;\n}\n\n/** Host operations that icon set lookup uses. */\nexport type CollectionContext = Pick<PluginContext, \"root\" | \"watch\" | \"resolve\" | \"read\" | \"list\">;\n\n/** Icon set data and the file that it comes from. */\ninterface LoadedCollection {\n /** Icon set data, or undefined when no source provides the set. */\n data?: IconifyJSON;\n /** Absolute path of the JSON file, or undefined for data that options supply. */\n file?: string;\n /** Metadata file of an individual icon package. */\n infoFile?: string;\n}\n\n/**\n * Parsed icon sets keyed by file path, with the text that they were parsed from. Statements of\n * later loads reuse the data while the text is unchanged, because large sets take long to parse.\n */\nconst parsed = new Map<\n string,\n {\n /** Text of the file when it was parsed. */\n text: string;\n /** Parsed icon set. */\n data: IconifyJSON;\n }\n>();\n\n/**\n * Finds and caches the icon sets of one loaded `@plugin` statement.\n *\n * A set comes from the first source that provides it: the configured sources, then the\n * `@iconify-json/<set>` package, then the `@iconify/json` package. Packages are resolved by the\n * host from the stylesheet that contains the statement. Each lookup registers the set's file with\n * the host, so a changed file reloads the design system, and the new statement context reads the\n * file again.\n */\nexport class Collections {\n readonly #sources: Readonly<Record<string, CollectionSource>>;\n readonly #context: CollectionContext;\n readonly #loaded = new Map<string, Promise<LoadedCollection>>();\n #bundled?: Promise<string[]>;\n\n /**\n * @param sources - Configured icon sets keyed by set prefix.\n * @param context - Project directory and host file operations.\n */\n constructor(sources: Readonly<Record<string, CollectionSource>>, context: CollectionContext) {\n this.#sources = sources;\n this.#context = context;\n }\n\n /**\n * Returns one icon set.\n *\n * @param prefix - Icon set prefix, such as `mdi`.\n * @returns The icon set data, or undefined when no source provides the set.\n * @throws If a configured source fails or a JSON file cannot be read or parsed.\n */\n async get(prefix: string): Promise<IconifyJSON | undefined> {\n let loaded = this.#loaded.get(prefix);\n if (!loaded) {\n loaded = this.#load(prefix);\n this.#loaded.set(prefix, loaded);\n }\n const { data, file, infoFile } = await loaded;\n if (infoFile) {\n this.#context.watch(infoFile);\n }\n if (file) {\n this.#context.watch(file);\n }\n return data;\n }\n\n /**\n * Lists the set prefixes whose icons editors always complete: the configured sets and the\n * `@iconify-json/*` packages in the dependencies of the project's `package.json`. The sets of the\n * `@iconify/json` package are omitted, because that package contains every Iconify set.\n *\n * @returns Set prefixes without duplicates.\n */\n async prefixes(): Promise<string[]> {\n const prefixes = new Set(Object.keys(this.#sources));\n const manifest = `${this.#context.root.replace(/[\\\\/]$/, \"\")}/package.json`;\n this.#context.watch(manifest);\n let json: Record<string, Record<string, string> | undefined>;\n try {\n json = JSON.parse(await this.#context.read(manifest));\n } catch {\n // A project without a readable manifest lists only the configured sets.\n return [...prefixes];\n }\n for (const field of [\"dependencies\", \"devDependencies\", \"optionalDependencies\"]) {\n for (const name of Object.keys(json[field] ?? {})) {\n if (name.startsWith(\"@iconify-json/\")) {\n prefixes.add(name.slice(\"@iconify-json/\".length));\n }\n }\n }\n return [...prefixes];\n }\n\n /**\n * Lists the set prefixes of the `@iconify/json` package from its `collections.json` file, and\n * registers that file with the host.\n *\n * @returns Set prefixes, or an empty array when the package is not installed or its file cannot\n * be read.\n */\n bundledPrefixes(): Promise<string[]> {\n this.#bundled ??= (async () => {\n const file = await this.#context.resolve(\"@iconify/json/collections.json\");\n if (!file) {\n return [];\n }\n this.#context.watch(file);\n try {\n return Object.keys(JSON.parse(await this.#context.read(file)) as Record<string, unknown>);\n } catch {\n // An unreadable list leaves completion with the sets from other sources.\n return [];\n }\n })();\n return this.#bundled;\n }\n\n /**\n * Loads one icon set from the first source that provides it.\n *\n * @param prefix - Icon set prefix.\n * @returns The icon set and its file, or an empty result when no source provides the set.\n * @throws If a configured source fails or a JSON file cannot be read or parsed.\n */\n async #load(prefix: string): Promise<LoadedCollection> {\n const source = Object.hasOwn(this.#sources, prefix) ? this.#sources[prefix] : undefined;\n if (typeof source === \"function\") {\n const context = this.#context;\n return {\n data: await source({\n prefix,\n root: context.root,\n watch: (path, kind) => context.watch(path, kind),\n read: (path) => context.read(path),\n list: (path) => context.list(path),\n }),\n };\n }\n if (typeof source === \"string\") {\n return {\n data: await this.#read(source),\n file: source,\n };\n }\n if (source) {\n return {\n data: source,\n };\n }\n\n if (/[/\\\\]|^\\.*$/.test(prefix)) {\n return {};\n }\n\n for (const request of [\n `@iconify-json/${prefix}/icons.json`,\n `@iconify/json/json/${prefix}.json`,\n ]) {\n const file = await this.#context.resolve(request);\n if (file) {\n const data = await this.#read(file);\n const infoFile = request.startsWith(\"@iconify-json/\")\n ? await this.#context.resolve(`@iconify-json/${prefix}/info.json`)\n : undefined;\n const info = infoFile ? JSON.parse(await this.#context.read(infoFile)) : data.info;\n return {\n data: info\n ? {\n ...data,\n info,\n }\n : data,\n file,\n infoFile,\n };\n }\n }\n\n return {};\n }\n\n /**\n * Reads and parses an icon set JSON file, reusing earlier data for unchanged text.\n *\n * @param file - Absolute file path.\n * @returns The parsed icon set.\n * @throws If reading or parsing fails.\n */\n async #read(file: string): Promise<IconifyJSON> {\n const text = await this.#context.read(file);\n const cached = parsed.get(file);\n if (cached?.text === text) {\n return cached.data;\n }\n const data = JSON.parse(text) as IconifyJSON;\n parsed.set(file, {\n text,\n data,\n });\n return data;\n }\n}\n","import type { IconifyInfo } from \"@iconify/types\";\n\n/**\n * Formats the supplied set information as a preserved CSS notice.\n *\n * @param info - Metadata of the same source that supplied the SVG, or undefined.\n * @returns A banner declaration, or an empty string when no information was provided.\n * @throws If supplied metadata lacks a set name, author, or license title.\n */\nexport function iconLicense(info: IconifyInfo | undefined): string {\n if (!info) {\n return \"\";\n }\n\n if (\n typeof info.name !== \"string\" ||\n !info.name.trim() ||\n typeof info.author?.name !== \"string\" ||\n !info.author.name.trim() ||\n typeof info.license?.title !== \"string\" ||\n !info.license.title.trim()\n ) {\n throw new Error(\"Iconify metadata requires a set name, author, and license title\");\n }\n\n const { author, license } = info;\n for (const value of [author.url, license.spdx, license.url]) {\n if (value !== undefined && typeof value !== \"string\") {\n throw new Error(\"Iconify author and license metadata must contain strings\");\n }\n }\n\n const parts = [\n info.name,\n author.name,\n author.url,\n license.title,\n license.spdx && license.spdx !== license.title ? license.spdx : undefined,\n license.url,\n ].filter((value): value is string => Boolean(value));\n const text = parts.join(\" | \").replaceAll(\"*/\", \"* /\");\n return ` @stillwind-banner { /*! ${text} */ }`;\n}\n","import type { IconifyJSON } from \"@iconify/types\";\nimport { getIconData } from \"@iconify/utils/lib/icon-set/get-icon\";\nimport { iconToSVG } from \"@iconify/utils/lib/svg/build\";\nimport { iconToHTML } from \"@iconify/utils/lib/svg/html\";\nimport { svgToURL } from \"@iconify/utils/lib/svg/url\";\nimport { optimize, type Config } from \"svgo/browser\";\n\nimport { iconLicense } from \"./license.ts\";\n\n/**\n * How an icon utility paints the icon. `mask` paints the element's text color through the icon's\n * shape, and `background` paints the icon's own colors. `auto` selects `mask` for icons whose SVG\n * uses `currentColor`, and `background` for the others.\n */\nexport type IconMode = \"auto\" | \"mask\" | \"background\";\n\n/**\n * Custom property that sets the height of an icon box. Size utilities set it, and icon\n * utilities fall back to {@link IconStyle[\"scale\"]} when it has no value.\n */\nexport const ICON_SIZE = \"--sw-icon-size\";\n\n/** SVGO configuration that minifies the SVG of each icon. */\nexport type SvgoConfig = Config;\n\n/** SVGO configuration that the `svgo` option selects when it is true or omitted. */\nexport const DEFAULT_SVGO: SvgoConfig = {\n multipass: true,\n};\n\n/** Settings that apply to every icon utility of a plugin instance. */\nexport interface IconStyle {\n /** Default icon height in `em`. The width keeps the icon's aspect ratio. */\n readonly scale: number;\n /** Paint method of the icons. */\n readonly mode: IconMode;\n /** Fixed base36 hash length, from 1 to 7 characters. */\n readonly hashLength: number;\n /** SVGO configuration that minifies each icon's SVG, or false to keep the SVG unchanged. */\n readonly svgo: SvgoConfig | false;\n}\n\n/**\n * Generates the Stillwind CSS of one icon utility.\n *\n * @param utility - Utility name, such as `icon-mdi--close` or `icon-[mdi--close]`.\n * @param collection - Icon set that contains the icon.\n * @param name - Icon name or alias in the set.\n * @param style - Size, paint method, and SVG minification.\n * @returns CSS for the icon and its resources, or undefined when the set has no such icon.\n * @throws If SVGO fails to optimize the icon's SVG.\n */\nexport function iconCss(\n utility: string,\n collection: IconifyJSON,\n name: string,\n style: IconStyle,\n): string | undefined {\n const data = getIconData(collection, name);\n if (!data) {\n return undefined;\n }\n\n const svg = iconToSVG(data, {\n height: \"auto\",\n });\n const [, , width, height] = svg.viewBox;\n const html = iconToHTML(svg.body, svg.attributes);\n const url = svgToURL(style.svgo ? optimize(html, style.svgo).data : html);\n const notice = iconLicense(collection.info);\n const asset = assetName(notice ? `${url}\\0${notice}` : url, style.hashLength);\n const mask =\n style.mode === \"mask\" || (style.mode === \"auto\" && svg.body.includes(\"currentColor\"));\n // Each mode resets the other mode's image, so a later icon utility on the same element\n // replaces the earlier icon even when their modes differ.\n const paint = mask\n ? [\n \"background-color: currentColor;\",\n \"background-image: none;\",\n `mask-image: var(${asset});`,\n \"mask-size: 100% 100%;\",\n \"mask-repeat: no-repeat;\",\n ]\n : [\n \"background-color: transparent;\",\n `background-image: var(${asset});`,\n \"background-size: 100% 100%;\",\n \"background-repeat: no-repeat;\",\n \"mask-image: none;\",\n ];\n return [\n `@theme default asset {`,\n ...(notice ? [notice] : []),\n ` ${asset}: ${url};`,\n `}`,\n `@utility ${utility} (implementation) {`,\n ` display: inline-block;`,\n // `max-content` derives the width from the height and the aspect ratio. Unlike `auto`,\n // it keeps a flex or grid container from stretching the box across its cross axis.\n ` width: max-content;`,\n ` height: var(${ICON_SIZE}, ${em(style.scale)});`,\n ` aspect-ratio: ${decimal(width)} / ${decimal(height)};`,\n ...paint.map((declaration) => ` ${declaration}`),\n `}`,\n ``,\n ].join(\"\\n\");\n}\n\nfunction assetName(content: string, length: number): string {\n let hash = 0x811c9dc5;\n for (let index = 0; index < content.length; index++) {\n hash = Math.imul(hash ^ content.charCodeAt(index), 0x01000193);\n }\n return `--sw-icon-svg-${(hash >>> 0).toString(36).padStart(length, \"0\").slice(-length)}`;\n}\n\n/**\n * Formats a length in `em` with at most four fractional digits.\n *\n * @param value - Finite length.\n * @returns CSS length text.\n */\nfunction em(value: number): string {\n return `${decimal(value)}em`;\n}\n\n/**\n * Formats a number with at most four fractional digits.\n *\n * @param value - Finite number.\n * @returns CSS number text.\n */\nfunction decimal(value: number): string {\n return `${Math.round(value * 10_000) / 10_000}`;\n}\n","import type { PluginContext, StillwindPlugin } from \"@stillwind/config\";\n\nimport { Collections, type CollectionSource } from \"./collections.ts\";\nimport {\n DEFAULT_SVGO,\n ICON_SIZE,\n iconCss,\n type IconMode,\n type IconStyle,\n type SvgoConfig,\n} from \"./icons.ts\";\n\n/**\n * Icon name formats. `named` accepts `icon-mdi--close`, `bracket` accepts\n * `icon-[mdi--close]`, and `both` accepts either format.\n */\nexport type IconSyntax = \"both\" | \"named\" | \"bracket\";\n\n/**\n * Options of {@link iconify}. The stylesheet's `@plugin` block overrides `prefix`,\n * `syntax`, `scale`, `mode`, and `hashLength` from these options.\n */\nexport interface IconifyOptions {\n /**\n * Utility prefix made of lowercase letters, digits, and single hyphens, starting\n * with a letter. Defaults to `icon`.\n */\n readonly prefix?: string;\n /** Spellings that select an icon. Defaults to `both`. */\n readonly syntax?: IconSyntax;\n /** Positive, finite icon height in `em` when no size utility applies. Defaults to `1`. */\n readonly scale?: number;\n /** Paint method of the icons. Defaults to `auto`. */\n readonly mode?: IconMode;\n /**\n * Base36 hash length in generated CSS variable names. Accepts integers from 1 to 7.\n * Defaults to `4`.\n * Set `hash-length` in the stylesheet's `@plugin` block.\n */\n readonly hashLength?: number;\n /**\n * Custom icon sets keyed by set prefix, such as `brand`. Accepts data, absolute JSON\n * file paths, or functions that return data, such as the result of `svgDirectory`. These\n * sets override installed packages.\n */\n readonly collections?: Readonly<Record<string, CollectionSource>>;\n /**\n * SVGO minification of each icon's SVG. `true` selects a multipass `preset-default`\n * configuration, an object replaces that configuration, and `false` keeps the SVG that\n * Iconify builds. Defaults to `true`.\n */\n readonly svgo?: boolean | SvgoConfig;\n}\n\n/** Settings of one `@plugin` statement. */\ninterface Settings extends IconStyle {\n /** Utility prefix without the trailing hyphen. */\n readonly prefix: string;\n /** Spellings that select an icon. */\n readonly syntax: IconSyntax;\n}\n\n/** Iconify set prefixes and icon names: lowercase words joined by single hyphens. */\nexport const ICONIFY_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/** Utility prefixes, which must start a CSS identifier and must not contain `--`. */\nconst PREFIX = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\nconst SYNTAXES: readonly IconSyntax[] = [\"both\", \"named\", \"bracket\"];\n\nconst MODES: readonly IconMode[] = [\"auto\", \"mask\", \"background\"];\n\n/**\n * CSS that every statement shares. The registration keeps an element's icon size from\n * reaching its descendants and its `::before` and `::after` boxes, so each icon box sets\n * its own size.\n */\nconst SIZE_CSS = [\n \"@stillwind-theme-namespace --icon-size-* [length] [percentage];\",\n `@stillwind-property ${ICON_SIZE} {`,\n \" activation: declared;\",\n \" value-for: height;\",\n ' syntax: \"*\";',\n \" inherits: false;\",\n \"}\",\n].join(\"\\n\");\n\n/**\n * Creates an Iconify plugin with custom defaults or icon sets.\n *\n * Enable it in your stylesheet with `@plugin \"@stillwind/plugin-iconify\";`.\n *\n * @param options - Default settings and configured icon sets.\n * @returns The plugin to add to your project's `plugins` list.\n * @throws If `prefix`, `syntax`, `scale`, `mode`, `hashLength`, or `svgo` is invalid.\n */\nexport function iconify(options: IconifyOptions = {}): StillwindPlugin {\n const defaults = settings(options);\n\n const statements = new WeakMap<PluginContext, Collections>();\n /**\n * Returns the icon sets of one statement.\n * @param context - Statement context. The host keeps it for the lifetime of the loaded statement.\n * @returns The statement's icon set cache.\n */\n const collections = (context: PluginContext) => {\n let found = statements.get(context);\n if (!found) {\n found = new Collections(options.collections ?? {}, context);\n statements.set(context, found);\n }\n return found;\n };\n\n return {\n name: \"@stillwind/plugin-iconify\",\n css(context) {\n const { prefix, syntax } = statementSettings(defaults, context);\n return [\n SIZE_CSS,\n `@utility ${prefix}-full {`,\n ` ${ICON_SIZE}: 100%;`,\n `}`,\n `@utility ${prefix}-* {`,\n ` ${ICON_SIZE}: --value(--icon-size-*, [length], [percentage]);`,\n `}`,\n ...(syntax !== \"bracket\" ? [`@stillwind-dynamic ${prefix}-*;`] : []),\n ...(syntax !== \"named\" ? [`@stillwind-dynamic ${prefix}-[*];`] : []),\n \"\",\n ].join(\"\\n\");\n },\n async resolve(candidates, context) {\n const current = statementSettings(defaults, context);\n const rules = await Promise.all(\n candidates.map(async (candidate) => {\n const icon = parseCandidate(candidate, current);\n const collection = icon && (await collections(context).get(icon.set));\n return collection ? iconCss(candidate, collection, icon.name, current) : undefined;\n }),\n );\n return rules.filter((rule) => rule !== undefined).join(\"\");\n },\n async catalog(context, input = \"\") {\n const { prefix, syntax } = statementSettings(defaults, context);\n const store = collections(context);\n const bracket =\n syntax === \"bracket\" || (syntax === \"both\" && input.startsWith(`${prefix}-[`));\n const spell = (set: string, name: string) =>\n bracket ? `${prefix}-[${set}--${name}]` : `${prefix}-${set}--${name}`;\n const listed = await store.prefixes();\n const sets = new Set(listed);\n // An input that names a set completes its icons from any source, including `@iconify/json`.\n const typed = typedSet(input, prefix);\n if (typed && !sets.has(typed) && (await store.get(typed))) {\n sets.add(typed);\n }\n const lists = await Promise.all(\n [...sets].map(async (set) => {\n const collection = await store.get(set);\n return collection\n ? [...Object.keys(collection.icons), ...Object.keys(collection.aliases ?? {})].map(\n (name) => spell(set, name),\n )\n : [];\n }),\n );\n // Before an input names a set, the `@iconify/json` sets complete as incomplete names that\n // end with `--`.\n const names = lists.flat();\n if (!typed && input && (`${prefix}-`.startsWith(input) || input.startsWith(`${prefix}-`))) {\n for (const set of await store.bundledPrefixes()) {\n if (!sets.has(set)) {\n names.push(bracket ? `${prefix}-[${set}--` : `${prefix}-${set}--`);\n }\n }\n }\n return names;\n },\n };\n}\n\n/**\n * Returns the icon set that an editor input names.\n *\n * @param input - Utility text before the cursor, such as `icon-mdi--cl` or `icon-[mdi--`.\n * @param prefix - Utility prefix without the trailing hyphen.\n * @returns The set prefix, or undefined when the input does not contain `<prefix>-<set>--`.\n */\nfunction typedSet(input: string, prefix: string): string | undefined {\n if (!input.startsWith(`${prefix}-`)) {\n return undefined;\n }\n let rest = input.slice(prefix.length + 1);\n if (rest.startsWith(\"[\")) {\n rest = rest.slice(1);\n }\n const separator = rest.indexOf(\"--\");\n const set = rest.slice(0, separator);\n return separator > 0 && ICONIFY_NAME.test(set) ? set : undefined;\n}\n\n/**\n * Splits a candidate into its icon set and icon name.\n *\n * @param candidate - Utility name, such as `icon-mdi--close` or `icon-[mdi--close]`.\n * @param settings - Prefix and the spellings that select an icon.\n * @returns The set and icon names, or undefined when the candidate does not name an icon in\n * an accepted spelling.\n */\nfunction parseCandidate(\n candidate: string,\n { prefix, syntax }: Settings,\n): { set: string; name: string } | undefined {\n if (!candidate.startsWith(`${prefix}-`)) {\n return undefined;\n }\n let rest = candidate.slice(prefix.length + 1);\n const bracket = rest.startsWith(\"[\") && rest.endsWith(\"]\");\n if (bracket ? syntax === \"named\" : syntax === \"bracket\") {\n return undefined;\n }\n if (bracket) {\n rest = rest.slice(1, -1);\n }\n const separator = rest.indexOf(\"--\");\n const set = rest.slice(0, separator);\n const name = rest.slice(separator + 2);\n return separator > 0 && ICONIFY_NAME.test(set) && ICONIFY_NAME.test(name)\n ? { set, name }\n : undefined;\n}\n\n/**\n * Applies a statement's options block to the plugin's defaults.\n *\n * @param defaults - Settings of the plugin instance.\n * @param context - Statement whose options replace the defaults.\n * @returns The settings of the statement.\n * @throws If an option value is invalid.\n */\nfunction statementSettings(defaults: Settings, context: PluginContext): Settings {\n const { prefix, syntax, scale, mode } = context.options;\n const hashLength = context.options[\"hash-length\"];\n return settings({\n prefix: prefix ?? defaults.prefix,\n syntax: (syntax ?? defaults.syntax) as IconSyntax,\n scale: scale === undefined ? defaults.scale : Number(scale),\n mode: (mode ?? defaults.mode) as IconMode,\n hashLength: hashLength === undefined ? defaults.hashLength : Number(hashLength),\n svgo: defaults.svgo,\n });\n}\n\n/**\n * Validates options and fills in defaults.\n *\n * @param options - Options that may omit settings.\n * @returns Complete settings.\n * @throws If the prefix is not a lowercase identifier, the syntax or mode is unknown, or the\n * scale is not a positive finite number, the hash length is not an integer from 1 to 7, or\n * `svgo` is neither a boolean nor an object.\n */\nfunction settings(options: IconifyOptions): Settings {\n const {\n prefix = \"icon\",\n syntax = \"both\",\n scale = 1,\n mode = \"auto\",\n hashLength = 4,\n svgo = true,\n } = options;\n\n if (!PREFIX.test(prefix)) {\n throw new Error(`Invalid Iconify utility prefix: ${prefix}`);\n }\n if (!SYNTAXES.includes(syntax)) {\n throw new Error(`Iconify syntax must be one of ${SYNTAXES.join(\", \")}: ${syntax}`);\n }\n if (!Number.isFinite(scale) || scale <= 0) {\n throw new Error(`Iconify scale must be a positive number: ${scale}`);\n }\n if (!MODES.includes(mode)) {\n throw new Error(`Iconify mode must be one of ${MODES.join(\", \")}: ${mode}`);\n }\n if (!Number.isInteger(hashLength) || hashLength < 1 || hashLength > 7) {\n throw new Error(`Iconify hash length must be an integer from 1 to 7: ${hashLength}`);\n }\n if (typeof svgo !== \"boolean\" && (typeof svgo !== \"object\" || svgo === null)) {\n throw new Error(`Iconify svgo must be a boolean or an SVGO configuration: ${String(svgo)}`);\n }\n\n return {\n prefix,\n syntax,\n scale,\n mode,\n hashLength,\n svgo: svgo === true ? DEFAULT_SVGO : svgo,\n };\n}\n\n/** The plugin with default options, which `@plugin \"@stillwind/plugin-iconify\";` loads. */\nconst defaultPlugin = iconify();\n\nexport default defaultPlugin;\n","import type { IconifyIcon, IconifyInfo, IconifyJSON } from \"@iconify/types\";\nimport { convertParsedSVG, parseSVGContent } from \"@iconify/utils/lib/svg/parse\";\n\nimport type { CollectionLoadContext, CollectionSource } from \"./collections.ts\";\nimport { ICONIFY_NAME } from \"./plugin.ts\";\n\n/**\n * Options of {@link svgDirectory}.\n */\nexport interface SvgDirectoryOptions {\n /** Set information used for the CSS attribution notice. */\n readonly info?: IconifyInfo;\n /**\n * Reads SVG files in subdirectories. The default icon name joins the path segments with `-`,\n * such as `arrows-left` for `arrows/left.svg`. Defaults to `false`.\n */\n readonly recursive?: boolean;\n /**\n * Maps a file to an icon name. The function receives the file path relative to the directory,\n * with `/` separators and without the `.svg` extension, such as `arrows/left`. Returning\n * undefined skips the file. By default, the path segments are joined with `-`.\n */\n readonly name?: (path: string) => string | undefined;\n /** Rewrites the SVG text of each file before the plugin parses it. */\n readonly transform?: (svg: string, name: string) => string | Promise<string>;\n}\n\n/**\n * Creates an icon set from the SVG files in a directory. Each file becomes one icon, and its\n * `viewBox` sets the icon's dimensions. The set watches the directory and its files, so adding,\n * removing, or editing an SVG file reloads the design system.\n *\n * @param directory - Absolute directory path, or a path relative to the project directory.\n * @param options - Settings for reading SVGs and describing the set.\n * @returns A source for the `collections` option of `iconify`.\n */\nexport function svgDirectory(\n directory: string,\n options: SvgDirectoryOptions = {},\n): CollectionSource {\n return async (context) => {\n const files = await svgFiles(context, absolute(context.root, directory), \"\", options);\n const icons: Record<string, IconifyIcon> = {};\n const owners = new Map<string, string>();\n for (const { file, path } of files) {\n const name = options.name ? options.name(path) : path.replaceAll(\"/\", \"-\");\n if (name === undefined) {\n continue;\n }\n if (!ICONIFY_NAME.test(name)) {\n throw new Error(\n `SVG icon ${file} has the invalid icon name \"${name}\". Icon names must consist of lowercase letters and digits separated by single hyphens. Use the name option to rename the file's icon.`,\n );\n }\n const owner = owners.get(name);\n if (owner !== undefined) {\n throw new Error(`SVG icons ${owner} and ${file} have the same icon name \"${name}\"`);\n }\n owners.set(name, file);\n context.watch(file);\n let svg = await context.read(file);\n if (options.transform) {\n svg = await options.transform(svg, name);\n }\n const parsed = parseSVGContent(svg);\n const icon = parsed && convertParsedSVG(parsed);\n if (!icon) {\n throw new Error(`SVG icon ${file} must be an <svg> element with a viewBox attribute`);\n }\n icons[name] = icon;\n }\n return {\n prefix: context.prefix,\n icons,\n ...(options.info\n ? {\n info: options.info,\n }\n : {}),\n } satisfies IconifyJSON;\n };\n}\n\n/**\n * Lists the SVG files of a directory and watches each directory that it lists.\n *\n * @param context - Host operations of the icon set.\n * @param directory - Absolute directory path.\n * @param prefix - Relative path of `directory` with a trailing `/`, or an empty string for the\n * top directory.\n * @param options - Whether subdirectories are read.\n * @returns Files in name order, with their relative paths without the `.svg` extension.\n * @throws If a directory cannot be listed.\n */\nasync function svgFiles(\n context: CollectionLoadContext,\n directory: string,\n prefix: string,\n options: SvgDirectoryOptions,\n): Promise<\n {\n file: string;\n path: string;\n }[]\n> {\n context.watch(directory, \"directory\");\n const entries = [...(await context.list(directory))].sort((a, b) =>\n a.name < b.name ? -1 : a.name > b.name ? 1 : 0,\n );\n const files: {\n file: string;\n path: string;\n }[] = [];\n for (const entry of entries) {\n const file = join(directory, entry.name);\n if (entry.directory) {\n if (options.recursive) {\n files.push(...(await svgFiles(context, file, `${prefix}${entry.name}/`, options)));\n }\n } else if (/\\.svg$/i.test(entry.name)) {\n files.push({\n file,\n path: prefix + entry.name.slice(0, -4),\n });\n }\n }\n return files;\n}\n\n/**\n * Resolves a directory against the project directory. The result keeps the separator style of\n * the project directory, because hosts compare watched paths with the paths that their file\n * watchers report.\n *\n * @param root - Absolute project directory.\n * @param directory - Absolute path, or a path relative to `root`.\n * @returns The absolute directory path.\n */\nfunction absolute(root: string, directory: string): string {\n if (/^(?:[A-Za-z]:)?[\\\\/]/.test(directory)) {\n return directory;\n }\n let path = root;\n for (const segment of directory.split(/[\\\\/]/)) {\n if (segment === \"..\") {\n path = path.replace(/[\\\\/][^\\\\/]*$/, \"\");\n } else if (segment && segment !== \".\") {\n path = join(path, segment);\n }\n }\n return path;\n}\n\n/**\n * Appends one entry name to a directory path with the directory's separator style.\n *\n * @param directory - Absolute directory path.\n * @param name - Entry name without separators.\n * @returns The entry path.\n */\nfunction join(directory: string, name: string): string {\n const separator = directory.includes(\"\\\\\") ? \"\\\\\" : \"/\";\n return directory.endsWith(separator) ? directory + name : directory + separator + name;\n}\n"],"mappings":";;;;;;;;;;;AAyCA,MAAM,yBAAS,IAAI,IAQjB;;;;;;;;;;AAWF,IAAa,cAAb,MAAyB;CACvB;CACA;CACA,0BAAmB,IAAI,IAAuC;CAC9D;;;;;CAMA,YAAY,SAAqD,SAA4B;EAC3F,KAAK,WAAW;EAChB,KAAK,WAAW;CAClB;;;;;;;;CASA,MAAM,IAAI,QAAkD;EAC1D,IAAI,SAAS,KAAK,QAAQ,IAAI,MAAM;EACpC,IAAI,CAAC,QAAQ;GACX,SAAS,KAAK,MAAM,MAAM;GAC1B,KAAK,QAAQ,IAAI,QAAQ,MAAM;EACjC;EACA,MAAM,EAAE,MAAM,MAAM,aAAa,MAAM;EACvC,IAAI,UACF,KAAK,SAAS,MAAM,QAAQ;EAE9B,IAAI,MACF,KAAK,SAAS,MAAM,IAAI;EAE1B,OAAO;CACT;;;;;;;;CASA,MAAM,WAA8B;EAClC,MAAM,WAAW,IAAI,IAAI,OAA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;AAaA,eAAe,SACb,SACA,WACA,QACA,SAMA;CACA,QAAQ,MAAM,WAAW,WAAW;CACpC,MAAM,UAAU,CAAC,GAAI,MAAM,QAAQ,KAAK,SAAS,CAAE,CAAC,CAAC,MAAM,GAAG,MAC5D,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,CAC/C;CACA,MAAM,QAGA,CAAC;CACP,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,OAAO,KAAK,WAAW,MAAM,IAAI;EACvC,IAAI,MAAM,WACJ;OAAA,QAAQ,WACV,MAAM,KAAK,GAAI,MAAM,SAAS,SAAS,MAAM,GAAG,SAAS,MAAM,KAAK,IAAI,OAAO,CAAE;EAAA,OAE9E,IAAI,UAAU,KAAK,MAAM,IAAI,GAClC,MAAM,KAAK;GACT;GACA,MAAM,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE;EACvC,CAAC;CAEL;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAS,SAAS,MAAc,WAA2B;CACzD,IAAI,uBAAuB,KAAK,SAAS,GACvC,OAAO;CAET,IAAI,OAAO;CACX,KAAK,MAAM,WAAW,UAAU,MAAM,OAAO,GAC3C,IAAI,YAAY,MACd,OAAO,KAAK,QAAQ,iBAAiB,EAAE;MAClC,IAAI,WAAW,YAAY,KAChC,OAAO,KAAK,MAAM,OAAO;CAG7B,OAAO;AACT;;;;;;;;AASA,SAAS,KAAK,WAAmB,MAAsB;CACrD,MAAM,YAAY,UAAU,SAAS,IAAI,IAAI,OAAO;CACpD,OAAO,UAAU,SAAS,SAAS,IAAI,YAAY,OAAO,YAAY,YAAY;AACpF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/collections.ts","../src/license.ts","../src/icons.ts","../src/plugin.ts","../src/directory.ts"],"sourcesContent":["import type { IconifyJSON } from \"@iconify/types\";\nimport type { PluginContext } from \"@stillwind/config\";\n\n/**\n * A custom icon set: Iconify data, an absolute JSON file path, or a function that\n * returns Iconify data synchronously or asynchronously.\n */\nexport type CollectionSource =\n | IconifyJSON\n | string\n | ((context: CollectionLoadContext) => IconifyJSON | Promise<IconifyJSON>);\n\n/**\n * Set name and host operations that a function source receives. A function source watches\n * each file and directory that it reads, so that a change reloads the design system.\n */\nexport interface CollectionLoadContext extends Pick<\n PluginContext,\n \"root\" | \"watch\" | \"read\" | \"list\"\n> {\n /** Set name that selects the source in `collections`, such as `brand`. */\n readonly prefix: string;\n}\n\n/** Host operations that icon set lookup uses. */\nexport type CollectionContext = Pick<PluginContext, \"root\" | \"watch\" | \"resolve\" | \"read\" | \"list\">;\n\n/** Icon set data and the file that it comes from. */\ninterface LoadedCollection {\n /** Icon set data, or undefined when no source provides the set. */\n data?: IconifyJSON;\n /** Absolute path of the JSON file, or undefined for data that options supply. */\n file?: string;\n /** Metadata file of an individual icon package. */\n infoFile?: string;\n}\n\n/**\n * Parsed icon sets keyed by file path, with the text that they were parsed from. Statements of\n * later loads reuse the data while the text is unchanged, because large sets take long to parse.\n */\nconst parsed = new Map<\n string,\n {\n /** Text of the file when it was parsed. */\n text: string;\n /** Parsed icon set. */\n data: IconifyJSON;\n }\n>();\n\n/**\n * Finds and caches the icon sets of one loaded `@plugin` statement.\n *\n * A set comes from the first source that provides it: the configured sources, then the\n * `@iconify-json/<set>` package, then the `@iconify/json` package. Packages are resolved by the\n * host from the stylesheet that contains the statement. Each lookup registers the set's file with\n * the host, so a changed file reloads the design system, and the new statement context reads the\n * file again.\n */\nexport class Collections {\n readonly #sources: Readonly<Record<string, CollectionSource>>;\n readonly #context: CollectionContext;\n readonly #loaded = new Map<string, Promise<LoadedCollection>>();\n #bundled?: Promise<string[]>;\n\n /**\n * @param sources - Configured icon sets keyed by set prefix.\n * @param context - Project directory and host file operations.\n */\n constructor(sources: Readonly<Record<string, CollectionSource>>, context: CollectionContext) {\n this.#sources = sources;\n this.#context = context;\n }\n\n /**\n * Returns one icon set.\n *\n * @param prefix - Icon set prefix, such as `mdi`.\n * @returns The icon set data, or undefined when no source provides the set.\n * @throws If a configured source fails or a JSON file cannot be read or parsed.\n */\n async get(prefix: string): Promise<IconifyJSON | undefined> {\n let loaded = this.#loaded.get(prefix);\n if (!loaded) {\n loaded = this.#load(prefix);\n this.#loaded.set(prefix, loaded);\n }\n const { data, file, infoFile } = await loaded;\n if (infoFile) {\n this.#context.watch(infoFile);\n }\n if (file) {\n this.#context.watch(file);\n }\n return data;\n }\n\n /**\n * Lists the set prefixes whose icons editors always complete: the configured sets and the\n * `@iconify-json/*` packages in the dependencies of the project's `package.json`. The sets of the\n * `@iconify/json` package are omitted, because that package contains every Iconify set.\n *\n * @returns Set prefixes without duplicates.\n */\n async prefixes(): Promise<string[]> {\n const prefixes = new Set(Object.keys(this.#sources));\n const manifest = `${this.#context.root.replace(/[\\\\/]$/, \"\")}/package.json`;\n this.#context.watch(manifest);\n let json: Record<string, Record<string, string> | undefined>;\n try {\n json = JSON.parse(await this.#context.read(manifest));\n } catch {\n // A project without a readable manifest lists only the configured sets.\n return [...prefixes];\n }\n for (const field of [\"dependencies\", \"devDependencies\", \"optionalDependencies\"]) {\n for (const name of Object.keys(json[field] ?? {})) {\n if (name.startsWith(\"@iconify-json/\")) {\n prefixes.add(name.slice(\"@iconify-json/\".length));\n }\n }\n }\n return [...prefixes];\n }\n\n /**\n * Lists the set prefixes of the `@iconify/json` package from its `collections.json` file, and\n * registers that file with the host.\n *\n * @returns Set prefixes, or an empty array when the package is not installed or its file cannot\n * be read.\n */\n bundledPrefixes(): Promise<string[]> {\n this.#bundled ??= (async () => {\n const file = await this.#context.resolve(\"@iconify/json/collections.json\");\n if (!file) {\n return [];\n }\n this.#context.watch(file);\n try {\n return Object.keys(JSON.parse(await this.#context.read(file)) as Record<string, unknown>);\n } catch {\n // An unreadable list leaves completion with the sets from other sources.\n return [];\n }\n })();\n return this.#bundled;\n }\n\n /**\n * Loads one icon set from the first source that provides it.\n *\n * @param prefix - Icon set prefix.\n * @returns The icon set and its file, or an empty result when no source provides the set.\n * @throws If a configured source fails or a JSON file cannot be read or parsed.\n */\n async #load(prefix: string): Promise<LoadedCollection> {\n const source = Object.hasOwn(this.#sources, prefix) ? this.#sources[prefix] : undefined;\n if (typeof source === \"function\") {\n const context = this.#context;\n return {\n data: await source({\n prefix,\n root: context.root,\n watch: (path, kind) => context.watch(path, kind),\n read: (path) => context.read(path),\n list: (path) => context.list(path),\n }),\n };\n }\n if (typeof source === \"string\") {\n return {\n data: await this.#read(source),\n file: source,\n };\n }\n if (source) {\n return {\n data: source,\n };\n }\n\n if (/[/\\\\]|^\\.*$/.test(prefix)) {\n return {};\n }\n\n for (const request of [\n `@iconify-json/${prefix}/icons.json`,\n `@iconify/json/json/${prefix}.json`,\n ]) {\n const file = await this.#context.resolve(request);\n if (file) {\n const data = await this.#read(file);\n const infoFile = request.startsWith(\"@iconify-json/\")\n ? await this.#context.resolve(`@iconify-json/${prefix}/info.json`)\n : undefined;\n const info = infoFile ? JSON.parse(await this.#context.read(infoFile)) : data.info;\n return {\n data: info\n ? {\n ...data,\n info,\n }\n : data,\n file,\n infoFile,\n };\n }\n }\n\n return {};\n }\n\n /**\n * Reads and parses an icon set JSON file, reusing earlier data for unchanged text.\n *\n * @param file - Absolute file path.\n * @returns The parsed icon set.\n * @throws If reading or parsing fails.\n */\n async #read(file: string): Promise<IconifyJSON> {\n const text = await this.#context.read(file);\n const cached = parsed.get(file);\n if (cached?.text === text) {\n return cached.data;\n }\n const data = JSON.parse(text) as IconifyJSON;\n parsed.set(file, {\n text,\n data,\n });\n return data;\n }\n}\n","import type { IconifyInfo } from \"@iconify/types\";\n\n/**\n * Formats the supplied set information as a preserved CSS notice.\n *\n * @param info - Metadata of the same source that supplied the SVG, or undefined.\n * @returns A banner declaration, or an empty string when no information was provided.\n * @throws If supplied metadata lacks a set name, author, or license title.\n */\nexport function iconLicense(info: IconifyInfo | undefined): string {\n if (!info) {\n return \"\";\n }\n\n if (\n typeof info.name !== \"string\" ||\n !info.name.trim() ||\n typeof info.author?.name !== \"string\" ||\n !info.author.name.trim() ||\n typeof info.license?.title !== \"string\" ||\n !info.license.title.trim()\n ) {\n throw new Error(\"Iconify metadata requires a set name, author, and license title\");\n }\n\n const { author, license } = info;\n for (const value of [author.url, license.spdx, license.url]) {\n if (value !== undefined && typeof value !== \"string\") {\n throw new Error(\"Iconify author and license metadata must contain strings\");\n }\n }\n\n const parts = [\n info.name,\n author.name,\n author.url,\n license.title,\n license.spdx && license.spdx !== license.title ? license.spdx : undefined,\n license.url,\n ].filter((value): value is string => Boolean(value));\n const text = parts.join(\" | \").replaceAll(\"*/\", \"* /\");\n return ` @stillwind-banner { /*! ${text} */ }`;\n}\n","import type { IconifyJSON } from \"@iconify/types\";\nimport { getIconData } from \"@iconify/utils/lib/icon-set/get-icon\";\nimport { iconToSVG } from \"@iconify/utils/lib/svg/build\";\nimport { iconToHTML } from \"@iconify/utils/lib/svg/html\";\nimport { svgToURL } from \"@iconify/utils/lib/svg/url\";\nimport { optimize, type Config } from \"svgo/browser\";\n\nimport { iconLicense } from \"./license.ts\";\n\n/**\n * How an icon utility paints the icon. `mask` paints the element's text color through the icon's\n * shape, and `background` paints the icon's own colors. `auto` selects `mask` for icons whose SVG\n * uses `currentColor`, and `background` for the others.\n */\nexport type IconMode = \"auto\" | \"mask\" | \"background\";\n\n/**\n * Custom property that sets the height of an icon box. Size utilities set it, and icon\n * utilities fall back to {@link IconStyle[\"scale\"]} when it has no value.\n */\nexport const ICON_SIZE = \"--sw-icon-size\";\n\n/** SVGO configuration that minifies the SVG of each icon. */\nexport type SvgoConfig = Config;\n\n/** SVGO configuration that the `svgo` option selects when it is true or omitted. */\nexport const DEFAULT_SVGO: SvgoConfig = {\n multipass: true,\n};\n\n/** Settings that apply to every icon utility of a plugin instance. */\nexport interface IconStyle {\n /** Default icon height in `em`. The width keeps the icon's aspect ratio. */\n readonly scale: number;\n /** Paint method of the icons. */\n readonly mode: IconMode;\n /** Fixed base36 hash length, from 1 to 7 characters. */\n readonly hashLength: number;\n /** SVGO configuration that minifies each icon's SVG, or false to keep the SVG unchanged. */\n readonly svgo: SvgoConfig | false;\n}\n\n/**\n * Generates the Stillwind CSS of one icon utility.\n *\n * @param utility - Utility name, such as `icon-mdi--close` or `icon-[mdi--close]`.\n * @param collection - Icon set that contains the icon.\n * @param name - Icon name or alias in the set.\n * @param style - Size, paint method, and SVG minification.\n * @returns CSS for the icon and its resources, or undefined when the set has no such icon.\n * @throws If SVGO fails to optimize the icon's SVG.\n */\nexport function iconCss(\n utility: string,\n collection: IconifyJSON,\n name: string,\n style: IconStyle,\n): string | undefined {\n const data = getIconData(collection, name);\n if (!data) {\n return undefined;\n }\n\n const svg = iconToSVG(data, {\n height: \"auto\",\n });\n const [, , width, height] = svg.viewBox;\n const html = iconToHTML(svg.body, svg.attributes);\n const url = svgToURL(style.svgo ? optimize(html, style.svgo).data : html);\n const notice = iconLicense(collection.info);\n const asset = assetName(notice ? `${url}\\0${notice}` : url, style.hashLength);\n const mask =\n style.mode === \"mask\" || (style.mode === \"auto\" && svg.body.includes(\"currentColor\"));\n // Each mode resets the other mode's image, so a later icon utility on the same element\n // replaces the earlier icon even when their modes differ.\n const paint = mask\n ? [\n \"background-color: currentColor;\",\n \"background-image: none;\",\n `mask-image: var(${asset});`,\n \"mask-size: 100% 100%;\",\n \"mask-repeat: no-repeat;\",\n ]\n : [\n \"background-color: transparent;\",\n `background-image: var(${asset});`,\n \"background-size: 100% 100%;\",\n \"background-repeat: no-repeat;\",\n \"mask-image: none;\",\n ];\n return [\n `@theme default asset {`,\n ...(notice ? [notice] : []),\n ` ${asset}: ${url};`,\n `}`,\n `@utility ${utility} (implementation) {`,\n ` display: inline-block;`,\n // `max-content` derives the width from the height and the aspect ratio. Unlike `auto`,\n // it keeps a flex or grid container from stretching the box across its cross axis.\n ` width: max-content;`,\n ` height: var(${ICON_SIZE}, ${em(style.scale)});`,\n ` aspect-ratio: ${decimal(width)} / ${decimal(height)};`,\n ...paint.map((declaration) => ` ${declaration}`),\n `}`,\n ``,\n ].join(\"\\n\");\n}\n\nfunction assetName(content: string, length: number): string {\n let hash = 0x811c9dc5;\n for (let index = 0; index < content.length; index++) {\n hash = Math.imul(hash ^ content.charCodeAt(index), 0x01000193);\n }\n return `--sw-icon-svg-${(hash >>> 0).toString(36).padStart(length, \"0\").slice(-length)}`;\n}\n\n/**\n * Formats a length in `em` with at most four fractional digits.\n *\n * @param value - Finite length.\n * @returns CSS length text.\n */\nfunction em(value: number): string {\n return `${decimal(value)}em`;\n}\n\n/**\n * Formats a number with at most four fractional digits.\n *\n * @param value - Finite number.\n * @returns CSS number text.\n */\nfunction decimal(value: number): string {\n return `${Math.round(value * 10_000) / 10_000}`;\n}\n","import type { PluginContext, StillwindPlugin } from \"@stillwind/config\";\n\nimport { Collections, type CollectionSource } from \"./collections.ts\";\nimport {\n DEFAULT_SVGO,\n ICON_SIZE,\n iconCss,\n type IconMode,\n type IconStyle,\n type SvgoConfig,\n} from \"./icons.ts\";\n\n/**\n * Icon name formats. `named` accepts `icon-mdi--close`, `bracket` accepts\n * `icon-[mdi--close]`, and `both` accepts either format.\n */\nexport type IconSyntax = \"both\" | \"named\" | \"bracket\";\n\n/**\n * Options of {@link iconify}. The stylesheet's `@plugin` block overrides `prefix`,\n * `syntax`, `scale`, `mode`, and `hashLength` from these options.\n */\nexport interface IconifyOptions {\n /**\n * Utility prefix made of lowercase letters, digits, and single hyphens, starting\n * with a letter. Defaults to `icon`.\n */\n readonly prefix?: string;\n /** Spellings that select an icon. Defaults to `both`. */\n readonly syntax?: IconSyntax;\n /** Positive, finite icon height in `em` when no size utility applies. Defaults to `1`. */\n readonly scale?: number;\n /** Paint method of the icons. Defaults to `auto`. */\n readonly mode?: IconMode;\n /**\n * Base36 hash length in generated CSS variable names. Accepts integers from 1 to 7.\n * Defaults to `4`.\n * Set `hash-length` in the stylesheet's `@plugin` block.\n */\n readonly hashLength?: number;\n /**\n * Custom icon sets keyed by set prefix, such as `brand`. Accepts data, absolute JSON\n * file paths, or functions that return data, such as the result of `svgDirectory`. These\n * sets override installed packages.\n */\n readonly collections?: Readonly<Record<string, CollectionSource>>;\n /**\n * SVGO minification of each icon's SVG. `true` selects a multipass `preset-default`\n * configuration, an object replaces that configuration, and `false` keeps the SVG that\n * Iconify builds. Defaults to `true`.\n */\n readonly svgo?: boolean | SvgoConfig;\n}\n\n/**\n * Settings of one `@plugin` statement.\n */\ninterface Settings extends IconStyle {\n /** Utility prefix without the trailing hyphen. */\n readonly prefix: string;\n /** Spellings that select an icon. */\n readonly syntax: IconSyntax;\n}\n\n/** Iconify set prefixes and icon names: lowercase words joined by single hyphens. */\nexport const ICONIFY_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/** Utility prefixes, which must start a CSS identifier and must not contain `--`. */\nconst PREFIX = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\nconst SYNTAXES: readonly IconSyntax[] = [\"both\", \"named\", \"bracket\"];\n\nconst MODES: readonly IconMode[] = [\"auto\", \"mask\", \"background\"];\n\n/**\n * CSS that every statement shares. The registration keeps an element's icon size from\n * reaching its descendants and its `::before` and `::after` boxes, so each icon box sets\n * its own size.\n */\nconst SIZE_CSS = [\n \"@stillwind-theme-namespace --icon-size-* [length] [percentage];\",\n `@stillwind-property ${ICON_SIZE} {`,\n \" activation: declared;\",\n \" value-for: height;\",\n ' syntax: \"*\";',\n \" inherits: false;\",\n \"}\",\n].join(\"\\n\");\n\n/**\n * Creates an Iconify plugin with custom defaults or icon sets.\n *\n * Enable it in your stylesheet with `@plugin \"@stillwind/plugin-iconify\";`.\n *\n * @param options - Default settings and configured icon sets.\n * @returns The plugin to add to your project's `plugins` list.\n * @throws If `prefix`, `syntax`, `scale`, `mode`, `hashLength`, or `svgo` is invalid.\n */\nexport function iconify(options: IconifyOptions = {}): StillwindPlugin {\n const defaults = settings(options);\n\n const statements = new WeakMap<PluginContext, Collections>();\n /**\n * Returns the icon sets of one statement.\n *\n * @param context - Statement context. The host keeps it for the lifetime of the loaded statement.\n * @returns The statement's icon set cache.\n */\n const collections = (context: PluginContext) => {\n let found = statements.get(context);\n if (!found) {\n found = new Collections(options.collections ?? {}, context);\n statements.set(context, found);\n }\n return found;\n };\n\n return {\n name: \"@stillwind/plugin-iconify\",\n css(context) {\n const { prefix, syntax } = statementSettings(defaults, context);\n return [\n SIZE_CSS,\n `@utility ${prefix}-full {`,\n ` ${ICON_SIZE}: 100%;`,\n `}`,\n `@utility ${prefix}-* {`,\n ` ${ICON_SIZE}: --value(--icon-size-*, [length], [percentage]);`,\n `}`,\n ...(syntax !== \"bracket\" ? [`@stillwind-dynamic ${prefix}-*;`] : []),\n ...(syntax !== \"named\" ? [`@stillwind-dynamic ${prefix}-[*];`] : []),\n \"\",\n ].join(\"\\n\");\n },\n async resolve(candidates, context) {\n const current = statementSettings(defaults, context);\n const rules = await Promise.all(\n candidates.map(async (candidate) => {\n const icon = parseCandidate(candidate, current);\n const collection = icon && (await collections(context).get(icon.set));\n return collection ? iconCss(candidate, collection, icon.name, current) : undefined;\n }),\n );\n return rules.filter((rule) => rule !== undefined).join(\"\");\n },\n async catalog(context, input = \"\") {\n const { prefix, syntax } = statementSettings(defaults, context);\n const store = collections(context);\n const bracket =\n syntax === \"bracket\" || (syntax === \"both\" && input.startsWith(`${prefix}-[`));\n const spell = (set: string, name: string) =>\n bracket ? `${prefix}-[${set}--${name}]` : `${prefix}-${set}--${name}`;\n const listed = await store.prefixes();\n const sets = new Set(listed);\n // An input that names a set completes its icons from any source, including `@iconify/json`.\n const typed = typedSet(input, prefix);\n if (typed && !sets.has(typed) && (await store.get(typed))) {\n sets.add(typed);\n }\n const lists = await Promise.all(\n [...sets].map(async (set) => {\n const collection = await store.get(set);\n return collection\n ? [...Object.keys(collection.icons), ...Object.keys(collection.aliases ?? {})].map(\n (name) => spell(set, name),\n )\n : [];\n }),\n );\n // Before an input names a set, the `@iconify/json` sets complete as incomplete names that\n // end with `--`.\n const names = lists.flat();\n if (!typed && input && (`${prefix}-`.startsWith(input) || input.startsWith(`${prefix}-`))) {\n for (const set of await store.bundledPrefixes()) {\n if (!sets.has(set)) {\n names.push(bracket ? `${prefix}-[${set}--` : `${prefix}-${set}--`);\n }\n }\n }\n return names;\n },\n };\n}\n\n/**\n * Returns the icon set that an editor input names.\n *\n * @param input - Utility text before the cursor, such as `icon-mdi--cl` or `icon-[mdi--`.\n * @param prefix - Utility prefix without the trailing hyphen.\n * @returns The set prefix, or undefined when the input does not contain `<prefix>-<set>--`.\n */\nfunction typedSet(input: string, prefix: string): string | undefined {\n if (!input.startsWith(`${prefix}-`)) {\n return undefined;\n }\n let rest = input.slice(prefix.length + 1);\n if (rest.startsWith(\"[\")) {\n rest = rest.slice(1);\n }\n const separator = rest.indexOf(\"--\");\n const set = rest.slice(0, separator);\n return separator > 0 && ICONIFY_NAME.test(set) ? set : undefined;\n}\n\n/**\n * Splits a candidate into its icon set and icon name.\n *\n * @param candidate - Utility name, such as `icon-mdi--close` or `icon-[mdi--close]`.\n * @param settings - Prefix and the spellings that select an icon.\n * @returns The set and icon names, or undefined when the candidate does not name an icon in\n * an accepted spelling.\n */\nfunction parseCandidate(\n candidate: string,\n { prefix, syntax }: Settings,\n): { set: string; name: string } | undefined {\n if (!candidate.startsWith(`${prefix}-`)) {\n return undefined;\n }\n let rest = candidate.slice(prefix.length + 1);\n const bracket = rest.startsWith(\"[\") && rest.endsWith(\"]\");\n if (bracket ? syntax === \"named\" : syntax === \"bracket\") {\n return undefined;\n }\n if (bracket) {\n rest = rest.slice(1, -1);\n }\n const separator = rest.indexOf(\"--\");\n const set = rest.slice(0, separator);\n const name = rest.slice(separator + 2);\n return separator > 0 && ICONIFY_NAME.test(set) && ICONIFY_NAME.test(name)\n ? { set, name }\n : undefined;\n}\n\n/**\n * Applies a statement's options block to the plugin's defaults.\n *\n * @param defaults - Settings of the plugin instance.\n * @param context - Statement whose options replace the defaults.\n * @returns The settings of the statement.\n * @throws If an option value is invalid.\n */\nfunction statementSettings(defaults: Settings, context: PluginContext): Settings {\n const { prefix, syntax, scale, mode } = context.options;\n const hashLength = context.options[\"hash-length\"];\n return settings({\n prefix: prefix ?? defaults.prefix,\n syntax: (syntax ?? defaults.syntax) as IconSyntax,\n scale: scale === undefined ? defaults.scale : Number(scale),\n mode: (mode ?? defaults.mode) as IconMode,\n hashLength: hashLength === undefined ? defaults.hashLength : Number(hashLength),\n svgo: defaults.svgo,\n });\n}\n\n/**\n * Validates options and fills in defaults.\n *\n * @param options - Options that may omit settings.\n * @returns Complete settings.\n * @throws If the prefix is not a lowercase identifier, the syntax or mode is unknown, or the\n * scale is not a positive finite number, the hash length is not an integer from 1 to 7, or\n * `svgo` is neither a boolean nor an object.\n */\nfunction settings(options: IconifyOptions): Settings {\n const {\n prefix = \"icon\",\n syntax = \"both\",\n scale = 1,\n mode = \"auto\",\n hashLength = 4,\n svgo = true,\n } = options;\n\n if (!PREFIX.test(prefix)) {\n throw new Error(`Invalid Iconify utility prefix: ${prefix}`);\n }\n if (!SYNTAXES.includes(syntax)) {\n throw new Error(`Iconify syntax must be one of ${SYNTAXES.join(\", \")}: ${syntax}`);\n }\n if (!Number.isFinite(scale) || scale <= 0) {\n throw new Error(`Iconify scale must be a positive number: ${scale}`);\n }\n if (!MODES.includes(mode)) {\n throw new Error(`Iconify mode must be one of ${MODES.join(\", \")}: ${mode}`);\n }\n if (!Number.isInteger(hashLength) || hashLength < 1 || hashLength > 7) {\n throw new Error(`Iconify hash length must be an integer from 1 to 7: ${hashLength}`);\n }\n if (typeof svgo !== \"boolean\" && (typeof svgo !== \"object\" || svgo === null)) {\n throw new Error(`Iconify svgo must be a boolean or an SVGO configuration: ${String(svgo)}`);\n }\n\n return {\n prefix,\n syntax,\n scale,\n mode,\n hashLength,\n svgo: svgo === true ? DEFAULT_SVGO : svgo,\n };\n}\n\n/** The plugin with default options, which `@plugin \"@stillwind/plugin-iconify\";` loads. */\nconst defaultPlugin = iconify();\n\nexport default defaultPlugin;\n","import type { IconifyIcon, IconifyInfo, IconifyJSON } from \"@iconify/types\";\nimport { convertParsedSVG, parseSVGContent } from \"@iconify/utils/lib/svg/parse\";\n\nimport type { CollectionLoadContext, CollectionSource } from \"./collections.ts\";\nimport { ICONIFY_NAME } from \"./plugin.ts\";\n\n/**\n * Options of {@link svgDirectory}.\n */\nexport interface SvgDirectoryOptions {\n /** Set information used for the CSS attribution notice. */\n readonly info?: IconifyInfo;\n /**\n * Reads SVG files in subdirectories. The default icon name joins the path segments with `-`,\n * such as `arrows-left` for `arrows/left.svg`. Defaults to `false`.\n */\n readonly recursive?: boolean;\n /**\n * Maps a file to an icon name. The function receives the file path relative to the directory,\n * with `/` separators and without the `.svg` extension, such as `arrows/left`. Returning\n * undefined skips the file. By default, the path segments are joined with `-`.\n */\n readonly name?: (path: string) => string | undefined;\n /** Rewrites the SVG text of each file before the plugin parses it. */\n readonly transform?: (svg: string, name: string) => string | Promise<string>;\n}\n\n/**\n * Creates an icon set from the SVG files in a directory. Each file becomes one icon, and its\n * `viewBox` sets the icon's dimensions. The set watches the directory and its files, so adding,\n * removing, or editing an SVG file reloads the design system.\n *\n * @param directory - Absolute directory path, or a path relative to the project directory.\n * @param options - Settings for reading SVGs and describing the set.\n * @returns A source for the `collections` option of `iconify`.\n */\nexport function svgDirectory(\n directory: string,\n options: SvgDirectoryOptions = {},\n): CollectionSource {\n return async (context) => {\n const files = await svgFiles(context, absolute(context.root, directory), \"\", options);\n const icons: Record<string, IconifyIcon> = {};\n const owners = new Map<string, string>();\n for (const { file, path } of files) {\n const name = options.name ? options.name(path) : path.replaceAll(\"/\", \"-\");\n if (name === undefined) {\n continue;\n }\n if (!ICONIFY_NAME.test(name)) {\n throw new Error(\n `SVG icon ${file} has the invalid icon name \"${name}\". Icon names must consist of lowercase letters and digits separated by single hyphens. Use the name option to rename the file's icon.`,\n );\n }\n const owner = owners.get(name);\n if (owner !== undefined) {\n throw new Error(`SVG icons ${owner} and ${file} have the same icon name \"${name}\"`);\n }\n owners.set(name, file);\n context.watch(file);\n let svg = await context.read(file);\n if (options.transform) {\n svg = await options.transform(svg, name);\n }\n const parsed = parseSVGContent(svg);\n const icon = parsed && convertParsedSVG(parsed);\n if (!icon) {\n throw new Error(`SVG icon ${file} must be an <svg> element with a viewBox attribute`);\n }\n icons[name] = icon;\n }\n return {\n prefix: context.prefix,\n icons,\n ...(options.info\n ? {\n info: options.info,\n }\n : {}),\n } satisfies IconifyJSON;\n };\n}\n\n/**\n * Lists the SVG files of a directory and watches each directory that it lists.\n *\n * @param context - Host operations of the icon set.\n * @param directory - Absolute directory path.\n * @param prefix - Relative path of `directory` with a trailing `/`, or an empty string for the\n * top directory.\n * @param options - Whether subdirectories are read.\n * @returns Files in name order, with their relative paths without the `.svg` extension.\n * @throws If a directory cannot be listed.\n */\nasync function svgFiles(\n context: CollectionLoadContext,\n directory: string,\n prefix: string,\n options: SvgDirectoryOptions,\n): Promise<\n {\n file: string;\n path: string;\n }[]\n> {\n context.watch(directory, \"directory\");\n const entries = [...(await context.list(directory))].sort((a, b) =>\n a.name < b.name ? -1 : a.name > b.name ? 1 : 0,\n );\n const files: {\n file: string;\n path: string;\n }[] = [];\n for (const entry of entries) {\n const file = join(directory, entry.name);\n if (entry.directory) {\n if (options.recursive) {\n files.push(...(await svgFiles(context, file, `${prefix}${entry.name}/`, options)));\n }\n } else if (/\\.svg$/i.test(entry.name)) {\n files.push({\n file,\n path: prefix + entry.name.slice(0, -4),\n });\n }\n }\n return files;\n}\n\n/**\n * Resolves a directory against the project directory. The result keeps the separator style of\n * the project directory, because hosts compare watched paths with the paths that their file\n * watchers report.\n *\n * @param root - Absolute project directory.\n * @param directory - Absolute path, or a path relative to `root`.\n * @returns The absolute directory path.\n */\nfunction absolute(root: string, directory: string): string {\n if (/^(?:[A-Za-z]:)?[\\\\/]/.test(directory)) {\n return directory;\n }\n let path = root;\n for (const segment of directory.split(/[\\\\/]/)) {\n if (segment === \"..\") {\n path = path.replace(/[\\\\/][^\\\\/]*$/, \"\");\n } else if (segment && segment !== \".\") {\n path = join(path, segment);\n }\n }\n return path;\n}\n\n/**\n * Appends one entry name to a directory path with the directory's separator style.\n *\n * @param directory - Absolute directory path.\n * @param name - Entry name without separators.\n * @returns The entry path.\n */\nfunction join(directory: string, name: string): string {\n const separator = directory.includes(\"\\\\\") ? \"\\\\\" : \"/\";\n return directory.endsWith(separator) ? directory + name : directory + separator + name;\n}\n"],"mappings":";;;;;;;;;;;AAyCA,MAAM,yBAAS,IAAI,IAQjB;;;;;;;;;;AAWF,IAAa,cAAb,MAAyB;CACvB;CACA;CACA,0BAAmB,IAAI,IAAuC;CAC9D;;;;;CAMA,YAAY,SAAqD,SAA4B;EAC3F,KAAK,WAAW;EAChB,KAAK,WAAW;CAClB;;;;;;;;CASA,MAAM,IAAI,QAAkD;EAC1D,IAAI,SAAS,KAAK,QAAQ,IAAI,MAAM;EACpC,IAAI,CAAC,QAAQ;GACX,SAAS,KAAK,MAAM,MAAM;GAC1B,KAAK,QAAQ,IAAI,QAAQ,MAAM;EACjC;EACA,MAAM,EAAE,MAAM,MAAM,aAAa,MAAM;EACvC,IAAI,UACF,KAAK,SAAS,MAAM,QAAQ;EAE9B,IAAI,MACF,KAAK,SAAS,MAAM,IAAI;EAE1B,OAAO;CACT;;;;;;;;CASA,MAAM,WAA8B;EAClC,MAAM,WAAW,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;EACnD,MAAM,WAAW,GAAG,KAAK,SAAS,KAAK,QAAQ,UAAU,EAAE,EAAE;EAC7D,KAAK,SAAS,MAAM,QAAQ;EAC5B,IAAI;EACJ,IAAI;GACF,OAAO,KAAK,MAAM,MAAM,KAAK,SAAS,KAAK,QAAQ,CAAC;EACtD,QAAQ;GAEN,OAAO,CAAC,GAAG,QAAQ;EACrB;EACA,KAAK,MAAM,SAAS;GAAC;GAAgB;GAAmB;EAAsB,GAC5E,KAAK,MAAM,QAAQ,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,GAC9C,IAAI,KAAK,WAAW,gBAAgB,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AAG,SAAS,MAAM,KAAK,IAAI,OAAO,CAAE;EAAA,OAE9E,IAAI,UAAU,KAAK,MAAM,IAAI,GAClC,MAAM,KAAK;GACT;GACA,MAAM,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE;EACvC,CAAC;CAEL;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAS,SAAS,MAAc,WAA2B;CACzD,IAAI,uBAAuB,KAAK,SAAS,GACvC,OAAO;CAET,IAAI,OAAO;CACX,KAAK,MAAM,WAAW,UAAU,MAAM,OAAO,GAC3C,IAAI,YAAY,MACd,OAAO,KAAK,QAAQ,iBAAiB,EAAE;MAClC,IAAI,WAAW,YAAY,KAChC,OAAO,KAAK,MAAM,OAAO;CAG7B,OAAO;AACT;;;;;;;;AASA,SAAS,KAAK,WAAmB,MAAsB;CACrD,MAAM,YAAY,UAAU,SAAS,IAAI,IAAI,OAAO;CACpD,OAAO,UAAU,SAAS,SAAS,IAAI,YAAY,OAAO,YAAY,YAAY;AACpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stillwind/plugin-iconify",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Iconify icons as Stillwind utilities, with only the icons you use in the CSS",
5
5
  "keywords": [
6
6
  "css-icons",
@@ -22,7 +22,9 @@
22
22
  "directory": "plugins/iconify"
23
23
  },
24
24
  "files": [
25
- "dist"
25
+ "dist",
26
+ "README.md",
27
+ "CHANGELOG.md"
26
28
  ],
27
29
  "type": "module",
28
30
  "exports": {
@@ -38,16 +40,16 @@
38
40
  "dependencies": {
39
41
  "@iconify/types": "^2.0.0",
40
42
  "@iconify/utils": "^3.1.7",
41
- "@stillwind/config": "0.7.0",
43
+ "@stillwind/config": "0.9.0",
42
44
  "svgo": "^4.1.0"
43
45
  },
44
46
  "devDependencies": {
45
47
  "@stillwind-internal/tools-workspace": "0.0.0",
46
- "@stillwind/host": "0.7.0",
47
- "@stillwind/native": "0.7.0",
48
+ "@stillwind/host": "0.9.0",
49
+ "@stillwind/native": "0.9.0",
48
50
  "@types/node": "^26.6.6",
49
- "stillwind": "0.7.0",
51
+ "stillwind": "0.9.0",
50
52
  "typescript": "^6.0.3",
51
- "vite-plus": "1.4.0"
53
+ "vite-plus": "1.5.1"
52
54
  }
53
55
  }