@cyberalien/svg-utils 1.2.6 → 1.2.8
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/lib/classname/const.js +1 -2
- package/lib/classname/toggle.js +1 -3
- package/lib/components/export/dependencies.js +1 -2
- package/lib/components/export/exports.js +1 -2
- package/lib/components/export/file.js +1 -3
- package/lib/components/export/filename.js +1 -2
- package/lib/components/export/fs.js +1 -3
- package/lib/components/export/merge.js +1 -3
- package/lib/components/helpers/code/lines.js +1 -2
- package/lib/components/helpers/content/ratio.js +1 -2
- package/lib/components/helpers/content/size.js +1 -3
- package/lib/components/helpers/content/stringify.js +1 -3
- package/lib/components/helpers/css/generate.d.ts +1 -1
- package/lib/components/helpers/css/generate.js +1 -3
- package/lib/components/helpers/filenames/asset.js +1 -2
- package/lib/components/helpers/filenames/css.js +1 -3
- package/lib/components/helpers/filenames/path.js +1 -2
- package/lib/components/helpers/filenames/types.js +1 -3
- package/lib/components/helpers/functions/custom.js +3 -5
- package/lib/components/helpers/functions/fallback.js +3 -5
- package/lib/components/helpers/functions/innerhtml.js +1 -3
- package/lib/components/helpers/functions/size.js +3 -5
- package/lib/components/helpers/imports/add.js +1 -2
- package/lib/components/helpers/imports/create.js +1 -2
- package/lib/components/helpers/imports/stringify.js +1 -2
- package/lib/components/helpers/imports/types.js +1 -1
- package/lib/components/helpers/props/object.js +1 -3
- package/lib/components/helpers/props/stringify.js +1 -2
- package/lib/components/helpers/props/ts.js +1 -2
- package/lib/components/helpers/props/types.js +1 -1
- package/lib/components/helpers/ts/jsx.js +1 -3
- package/lib/components/helpers/ts/solid.js +1 -3
- package/lib/components/helpers/ts/svelte.js +1 -3
- package/lib/components/helpers/ts/vue.js +1 -3
- package/lib/components/helpers/ts/wrapper.js +1 -3
- package/lib/components/jsx.js +13 -5
- package/lib/components/prepare/iconify.js +2 -4
- package/lib/components/prepare/options.js +1 -3
- package/lib/components/prepare/states.js +4 -4
- package/lib/components/raw.js +1 -3
- package/lib/components/solid.js +12 -5
- package/lib/components/svelte.js +12 -5
- package/lib/components/types/component.js +1 -1
- package/lib/components/types/css.js +1 -1
- package/lib/components/types/data.js +1 -1
- package/lib/components/types/jsx.js +1 -1
- package/lib/components/types/options.d.ts +1 -0
- package/lib/components/types/options.js +1 -1
- package/lib/components/types/source.d.ts +1 -0
- package/lib/components/types/source.js +1 -1
- package/lib/components/vue-func.js +12 -5
- package/lib/components/vue.js +12 -5
- package/lib/css/find/animations.js +1 -3
- package/lib/css/find/classname.js +1 -3
- package/lib/css/find/prop.js +1 -2
- package/lib/css/hash.js +1 -3
- package/lib/css/minify.js +1 -2
- package/lib/css/rules.js +1 -2
- package/lib/css/stringify.js +1 -2
- package/lib/css/stylesheet.js +1 -3
- package/lib/css/types.js +1 -1
- package/lib/helpers/data/compact.js +1 -2
- package/lib/helpers/data/expand.js +1 -2
- package/lib/helpers/hash/context.js +1 -2
- package/lib/helpers/hash/hash.js +1 -2
- package/lib/helpers/hash/stringify.js +1 -2
- package/lib/helpers/hash/types.js +1 -1
- package/lib/helpers/hash/unique.js +1 -3
- package/lib/helpers/misc/clone.js +1 -2
- package/lib/helpers/misc/compare.js +1 -3
- package/lib/helpers/misc/keys.js +1 -3
- package/lib/helpers/misc/promises.js +1 -3
- package/lib/helpers/misc/sort-object.js +1 -2
- package/lib/helpers/misc/strings.js +1 -2
- package/lib/helpers/reduce-motion.js +1 -2
- package/lib/iconify/icon/{nornalise.js → normalise.js} +1 -3
- package/lib/iconify/icon/types.js +1 -1
- package/lib/iconify/icon-set/defaults.js +1 -2
- package/lib/iconify/icon-set/icon.js +1 -3
- package/lib/iconify/icon-set/parse.js +1 -3
- package/lib/iconify/icon-set/types.js +1 -1
- package/lib/index.js +1 -2
- package/lib/svg/content/defs.js +1 -2
- package/lib/svg/ids/change.js +1 -3
- package/lib/svg/ids/duplicate.js +1 -3
- package/lib/svg/ids/string.js +1 -2
- package/lib/svg/ids/types.js +1 -1
- package/lib/svg/ids/unique.js +1 -3
- package/lib/svg/ids/unused.js +1 -3
- package/lib/svg/props/size.js +1 -2
- package/lib/svg/props/stringify.js +1 -2
- package/lib/svg/viewbox/minify.js +1 -2
- package/lib/svg/viewbox/parse.js +1 -2
- package/lib/svg/viewbox/square.js +1 -2
- package/lib/svg/viewbox/types.js +1 -1
- package/lib/svg/viewbox/value.js +1 -2
- package/lib/svg-css/content.js +1 -3
- package/lib/svg-css/icon/css.js +6 -4
- package/lib/svg-css/icon/types.js +1 -1
- package/lib/svg-css/icon-set/add.js +1 -3
- package/lib/svg-css/icon-set/create.js +1 -2
- package/lib/svg-css/icon-set/get.js +1 -3
- package/lib/svg-css/icon-set/minify/expand.js +1 -3
- package/lib/svg-css/icon-set/minify/keys.js +1 -2
- package/lib/svg-css/icon-set/minify/minify.js +1 -3
- package/lib/svg-css/icon-set/types.js +1 -1
- package/lib/svg-css/props/prop.js +1 -2
- package/lib/svg-css/props/props.js +3 -5
- package/lib/svg-css/props/tags.js +2 -3
- package/lib/svg-css/props/types.js +1 -1
- package/lib/svg-css/root.js +1 -3
- package/lib/svg-css/states/cleanup-values.js +1 -3
- package/lib/svg-css/states/fallback/parse.js +1 -2
- package/lib/svg-css/states/fallback/stringify.js +1 -2
- package/lib/svg-css/states/fallback/test.js +1 -3
- package/lib/svg-css/states/fallback/types.js +1 -1
- package/lib/svg-css/states/generator.js +1 -3
- package/lib/svg-css/states/key.js +1 -2
- package/lib/svg-css/states/object.js +1 -3
- package/lib/svg-css/states/selector/helpers/iterate.js +1 -2
- package/lib/svg-css/states/selector/merge.js +1 -3
- package/lib/svg-css/states/selector/parse.d.ts +1 -1
- package/lib/svg-css/states/selector/parse.js +3 -4
- package/lib/svg-css/states/selector/part/merge.js +1 -3
- package/lib/svg-css/states/selector/part/split.js +1 -3
- package/lib/svg-css/states/selector/part/stringify.js +1 -3
- package/lib/svg-css/states/selector/split.js +1 -3
- package/lib/svg-css/states/selector/stringify.js +1 -3
- package/lib/svg-css/states/selector/sub/merge.js +1 -2
- package/lib/svg-css/states/selector/sub/split.js +1 -2
- package/lib/svg-css/states/selector/sub/stringify.js +1 -2
- package/lib/svg-css/states/selector/types.d.ts +1 -0
- package/lib/svg-css/states/selector/types.js +1 -1
- package/lib/svg-css/states/types.js +1 -1
- package/lib/svg-css/states/validate.js +1 -2
- package/lib/svg-css/states/value.js +1 -2
- package/lib/svg-css/types.js +1 -1
- package/lib/xml/iterate.js +1 -2
- package/lib/xml/parse.js +1 -2
- package/lib/xml/stringify.js +1 -2
- package/lib/xml/types.js +1 -1
- package/package.json +6 -11
- package/lib/svg-css/states/focus.d.ts +0 -10
- package/lib/svg-css/states/focus.js +0 -14
- /package/lib/iconify/icon/{nornalise.d.ts → normalise.d.ts} +0 -0
package/lib/classname/const.js
CHANGED
package/lib/classname/toggle.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defaultClassProp } from "./const.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Split class name by spaces
|
|
5
4
|
*/
|
|
@@ -25,5 +24,4 @@ function toggleClassName(attribs, className, add, prop = defaultClassProp) {
|
|
|
25
24
|
}
|
|
26
25
|
attribs[prop] = Array.from(list).sort().join(" ");
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
export { splitClassName, toggleClassName };
|
|
27
|
+
export { splitClassName, toggleClassName };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getGeneratedComponentFilename } from "./filename.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Add icon and filename to generated component
|
|
5
4
|
*/
|
|
@@ -13,5 +12,4 @@ function convertGeneratedComponentToFile(icon, item, options) {
|
|
|
13
12
|
...item
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
export { convertGeneratedComponentToFile };
|
|
15
|
+
export { convertGeneratedComponentToFile };
|
|
@@ -11,5 +11,4 @@ function getGeneratedComponentFilename(icon, componentExtension, options) {
|
|
|
11
11
|
const { prefixDirsForComponents } = options;
|
|
12
12
|
return (prefixDirsForComponents ? `${typeof prefixDirsForComponents === "string" ? prefixDirsForComponents : prefix}/` : "") + (options.doubleDirsForComponents ? `${name.slice(0, 1).toLowerCase()}/` : "") + name + componentExtension;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
export { getGeneratedComponentFilename };
|
|
14
|
+
export { getGeneratedComponentFilename };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Save exported files to filesystem
|
|
5
4
|
*/
|
|
@@ -16,5 +15,4 @@ async function saveExportedFilesToFS(files, dir) {
|
|
|
16
15
|
}
|
|
17
16
|
return saved;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
export { saveExportedFilesToFS };
|
|
18
|
+
export { saveExportedFilesToFS };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { stringifyStylesheet } from "../../css/stylesheet.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Merge exported component files into single array
|
|
5
4
|
*/
|
|
@@ -25,5 +24,4 @@ function mergeExportedComponentFiles(items, files) {
|
|
|
25
24
|
}
|
|
26
25
|
return files;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
export { mergeExportedComponentFiles };
|
|
27
|
+
export { mergeExportedComponentFiles };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { calculateSize } from "../../../svg/props/size.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Get size values for component
|
|
5
4
|
*/
|
|
@@ -18,5 +17,4 @@ function getComponentSizeValues(options, viewBox) {
|
|
|
18
17
|
height: square ? width : calculateSize(width, viewBox.height / viewBox.width)
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
export { getComponentSizeValues };
|
|
20
|
+
export { getComponentSizeValues };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { stringifyStylesheet } from "../../../css/stylesheet.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Convert icon content to a string literal
|
|
5
4
|
*/
|
|
@@ -7,5 +6,4 @@ function stringifyFactoryIconContent(icon, embedCSS) {
|
|
|
7
6
|
const style = embedCSS ? stringifyStylesheet(embedCSS) : "";
|
|
8
7
|
return "`" + (style ? `<style>${style}</style>${icon.content}` : icon.content).replace(/`/g, "\\`") + "`";
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
export { stringifyFactoryIconContent };
|
|
9
|
+
export { stringifyFactoryIconContent };
|
|
@@ -3,7 +3,7 @@ import { GeneratedAssetFile } from "../../types/component.js";
|
|
|
3
3
|
import { ComponentFactorySource } from "../../types/source.js";
|
|
4
4
|
import { ComponentFactoryOptions } from "../../types/options.js";
|
|
5
5
|
import { FactoryComponentImports } from "../imports/types.js";
|
|
6
|
-
interface Options extends Pick<ComponentFactoryOptions, 'cssMode' | 'cssPath' | 'doubleDirsForCSS' | 'mergeCSS'> {
|
|
6
|
+
interface Options extends Pick<ComponentFactoryOptions, 'cssMode' | 'cssPath' | 'doubleDirsForCSS' | 'mergeCSS' | 'staticState'> {
|
|
7
7
|
componentType?: 'svelte';
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createEmptyStylesheet, stringifyStylesheet } from "../../../css/stylesheet.js";
|
|
2
2
|
import { getGeneratedCSSFilename } from "../filenames/css.js";
|
|
3
3
|
import { renderStatefulSVGCSSIconStyle } from "../../../svg-css/icon/css.js";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Generate CSS files for component
|
|
7
6
|
*
|
|
@@ -65,5 +64,4 @@ function generateCSSFilesForComponent(content, imports, assets, options) {
|
|
|
65
64
|
}
|
|
66
65
|
return returnCSS ? commonStylesheet : void 0;
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
export { generateCSSFilesForComponent };
|
|
67
|
+
export { generateCSSFilesForComponent };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getGeneratedAssetFilename } from "./asset.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Generate CSS filename based on options
|
|
5
4
|
*/
|
|
@@ -7,5 +6,4 @@ function getGeneratedCSSFilename(name, options) {
|
|
|
7
6
|
const { cssPath, doubleDirsForCSS } = options;
|
|
8
7
|
return getGeneratedAssetFilename(`${doubleDirsForCSS ? `${name.slice(0, 1).toLowerCase()}/${name}` : name}.css`, cssPath);
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
export { getGeneratedCSSFilename };
|
|
9
|
+
export { getGeneratedCSSFilename };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getUniqueHash } from "../../../helpers/hash/unique.js";
|
|
2
2
|
import { getGeneratedAssetFilename } from "./asset.js";
|
|
3
3
|
import { getGeneratedComponentFilename } from "../../export/filename.js";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Generate component types filename based on options
|
|
7
6
|
*/
|
|
@@ -18,5 +17,4 @@ function getGeneratedComponentTypesFilename(icon, content, options) {
|
|
|
18
17
|
import: `./${filename.split("/").pop()}`
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
export { getGeneratedComponentTypesFilename };
|
|
20
|
+
export { getGeneratedComponentTypesFilename };
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGeneratedAssetFilename } from "../filenames/asset.js";
|
|
2
2
|
import { camelToKebab } from "../../../helpers/misc/strings.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Adds a custom function to assets
|
|
6
5
|
*/
|
|
7
6
|
function addCustomFunctionAsset(imports, assets, options, data) {
|
|
8
7
|
const { functionName, content, exportNames } = data;
|
|
9
|
-
const filename = getGeneratedAssetFilename(`${options.helpersDirectory ??
|
|
8
|
+
const filename = getGeneratedAssetFilename(`${options.helpersDirectory ?? "helpers"}/${data.jsName ?? camelToKebab(functionName)}.js`, options.rootPath);
|
|
10
9
|
assets.push({
|
|
11
10
|
...filename,
|
|
12
11
|
content
|
|
13
12
|
});
|
|
14
13
|
imports.named[filename.import] = exportNames ?? new Set([functionName]);
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
export { addCustomFunctionAsset };
|
|
15
|
+
export { addCustomFunctionAsset };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createUniqueHashContext } from "../../../helpers/hash/context.js";
|
|
2
2
|
import { getUniqueHash } from "../../../helpers/hash/unique.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { getGeneratedAssetFilename } from "../filenames/asset.js";
|
|
5
4
|
const sharedFunctionName = "getIconFallback";
|
|
6
5
|
const hashedFunctionName = "getFallback";
|
|
7
6
|
const functionContent = `
|
|
@@ -32,7 +31,7 @@ function addFallbackFunctionAsset(imports, assets, options, defaultValues) {
|
|
|
32
31
|
css: true,
|
|
33
32
|
length: 10
|
|
34
33
|
});
|
|
35
|
-
const assetDirectory = options.helpersDirectory ??
|
|
34
|
+
const assetDirectory = options.helpersDirectory ?? "helpers";
|
|
36
35
|
const sharedFilename = getGeneratedAssetFilename(`${assetDirectory}/fallback.js`, options.rootPath);
|
|
37
36
|
assets.push({
|
|
38
37
|
...sharedFilename,
|
|
@@ -49,5 +48,4 @@ export const ${hashedFunctionName} = ${sharedFunctionName}.bind(null, ${JSON.str
|
|
|
49
48
|
imports.named[hashedFilename.import] = new Set([hashedFunctionName]);
|
|
50
49
|
return hashedFunctionName;
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
export { addFallbackFunctionAsset };
|
|
51
|
+
export { addFallbackFunctionAsset };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addCustomFunctionAsset } from "./custom.js";
|
|
2
|
-
|
|
3
2
|
const functionName = "cleanupHTML";
|
|
4
3
|
/**
|
|
5
4
|
* Adds cleanUpInnerHTML() function to assets
|
|
@@ -31,5 +30,4 @@ export function ${functionName}(html) {
|
|
|
31
30
|
});
|
|
32
31
|
return functionName;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
export { addInnerHTMLFunctionAsset };
|
|
33
|
+
export { addInnerHTMLFunctionAsset };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getGeneratedAssetFilename } from "../filenames/asset.js";
|
|
3
2
|
const functionName = "getSizeProps";
|
|
4
3
|
const functionContent = `
|
|
5
4
|
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
@@ -67,7 +66,7 @@ export { ${functionName} };
|
|
|
67
66
|
* Adds getSizeProps() function to assets
|
|
68
67
|
*/
|
|
69
68
|
function addSizeFunctionAsset(imports, assets, options) {
|
|
70
|
-
const filename = getGeneratedAssetFilename(`${options.helpersDirectory ??
|
|
69
|
+
const filename = getGeneratedAssetFilename(`${options.helpersDirectory ?? "helpers"}/size.js`, options.rootPath);
|
|
71
70
|
assets.push({
|
|
72
71
|
...filename,
|
|
73
72
|
content: functionContent
|
|
@@ -75,5 +74,4 @@ function addSizeFunctionAsset(imports, assets, options) {
|
|
|
75
74
|
imports.named[filename.import] = new Set([functionName]);
|
|
76
75
|
return functionName;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
export { addSizeFunctionAsset };
|
|
77
|
+
export { addSizeFunctionAsset };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { stringifyFactoryProps } from "./stringify.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Stringify properties for component as JS object
|
|
5
4
|
*/
|
|
6
5
|
function stringifyFactoryPropsAsJSON(props, separator = "\n ") {
|
|
7
6
|
return stringifyFactoryProps(props, "\"{prop}\": {value},", "\"{prop}\": \"{value}\",", separator);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
export { stringifyFactoryPropsAsJSON };
|
|
8
|
+
export { stringifyFactoryPropsAsJSON };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addComponentTypes, omitComponentSVGProps } from "./wrapper.js";
|
|
2
|
-
|
|
3
2
|
const iconPropsTemplate = `interface IconProps {
|
|
4
3
|
/* PROPS */
|
|
5
4
|
}`;
|
|
@@ -34,5 +33,4 @@ ${exportTemplate}
|
|
|
34
33
|
}
|
|
35
34
|
return addComponentTypes(template, data, options, assets, props);
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
export { addJSXComponentTypes };
|
|
36
|
+
export { addJSXComponentTypes };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addComponentTypes, omitComponentSVGProps } from "./wrapper.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Add Solid component types
|
|
5
4
|
*/
|
|
@@ -16,5 +15,4 @@ declare const Component: (
|
|
|
16
15
|
export { type IconProps };
|
|
17
16
|
export default Component;
|
|
18
17
|
`);
|
|
19
|
-
|
|
20
|
-
export { addSolidComponentTypes };
|
|
18
|
+
export { addSolidComponentTypes };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addComponentTypes } from "./wrapper.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Add Svelte component types
|
|
5
4
|
*/
|
|
@@ -15,5 +14,4 @@ declare class Component extends SvelteComponent<Omit<SvelteHTMLElements['svg'],
|
|
|
15
14
|
export { type IconProps };
|
|
16
15
|
export default Component;
|
|
17
16
|
`);
|
|
18
|
-
|
|
19
|
-
export { addSvelteComponentTypes };
|
|
17
|
+
export { addSvelteComponentTypes };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addComponentTypes } from "./wrapper.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Add Vue component types
|
|
5
4
|
*/
|
|
@@ -14,5 +13,4 @@ declare const Component: DefineSetupFnComponent<IconProps, {}, {}, IconProps & {
|
|
|
14
13
|
export { type IconProps };
|
|
15
14
|
export default Component;
|
|
16
15
|
`);
|
|
17
|
-
|
|
18
|
-
export { addVueComponentTypes };
|
|
16
|
+
export { addVueComponentTypes };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { stringifyFactoryPropTypes } from "../props/ts.js";
|
|
2
2
|
import { getGeneratedComponentTypesFilename } from "../filenames/types.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Properties to omit
|
|
6
5
|
*/
|
|
@@ -18,5 +17,4 @@ function addComponentTypes(template, data, options, assets, props) {
|
|
|
18
17
|
});
|
|
19
18
|
return filename.filename;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
export { addComponentTypes, omitComponentSVGProps };
|
|
20
|
+
export { addComponentTypes, omitComponentSVGProps };
|
package/lib/components/jsx.js
CHANGED
|
@@ -14,7 +14,6 @@ import { addJSXComponentTypes } from "./helpers/ts/jsx.js";
|
|
|
14
14
|
import { addCustomFunctionAsset } from "./helpers/functions/custom.js";
|
|
15
15
|
import { addFallbackFunctionAsset } from "./helpers/functions/fallback.js";
|
|
16
16
|
import { addInnerHTMLFunctionAsset } from "./helpers/functions/innerhtml.js";
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Create React component code
|
|
20
19
|
*/
|
|
@@ -60,8 +59,8 @@ function createJSXComponent(data, options) {
|
|
|
60
59
|
};
|
|
61
60
|
let computedFallback = false;
|
|
62
61
|
if (statefulData) {
|
|
63
|
-
const { supportedStates, allStates } = statefulData;
|
|
64
|
-
if (supportedStates.size) {
|
|
62
|
+
const { supportedStates, allStates, staticClassname } = statefulData;
|
|
63
|
+
if (supportedStates.size || staticClassname) {
|
|
65
64
|
const computedStates = [];
|
|
66
65
|
const computedStateNames = [];
|
|
67
66
|
let addedStateFunc = false;
|
|
@@ -98,6 +97,16 @@ function createJSXComponent(data, options) {
|
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
}
|
|
100
|
+
if (staticClassname) {
|
|
101
|
+
const state = "static";
|
|
102
|
+
props[state] = {
|
|
103
|
+
type: "boolean",
|
|
104
|
+
value: state,
|
|
105
|
+
template: ""
|
|
106
|
+
};
|
|
107
|
+
computedStates.push(`'${state}': ${state}`);
|
|
108
|
+
computedStateNames.push(state);
|
|
109
|
+
}
|
|
101
110
|
if (computedStates.length) {
|
|
102
111
|
componentInternalCode.push(`const states = useMemo(() => ({ ${computedStates.join(", ")} }), [${computedStateNames.join(", ")}]);`);
|
|
103
112
|
if (hasFallback && statefulData.fallback) {
|
|
@@ -192,5 +201,4 @@ function createJSXComponent(data, options) {
|
|
|
192
201
|
dependencies: dependencies.size ? dependencies : void 0
|
|
193
202
|
};
|
|
194
203
|
}
|
|
195
|
-
|
|
196
|
-
export { createJSXComponent };
|
|
204
|
+
export { createJSXComponent };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { convertSVGContentToCSSRules } from "../../svg-css/content.js";
|
|
2
2
|
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.js";
|
|
3
|
-
import { normaliseIconifyIcon } from "../../iconify/icon/
|
|
4
|
-
|
|
3
|
+
import { normaliseIconifyIcon } from "../../iconify/icon/normalise.js";
|
|
5
4
|
/**
|
|
6
5
|
* Convert IconifyIcon data to FactoryIconData
|
|
7
6
|
*/
|
|
@@ -36,5 +35,4 @@ function getIconifyIconsetMetadataAsset(iconSet, rootPath) {
|
|
|
36
35
|
});
|
|
37
36
|
return assets;
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
export { convertIconifyIconToFactoryContent, getIconifyIconsetMetadataAsset };
|
|
38
|
+
export { convertIconifyIconToFactoryContent, getIconifyIconsetMetadataAsset };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.js";
|
|
2
2
|
import { getFactoryRelativeRootPath } from "../helpers/filenames/path.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Generate file system options
|
|
6
5
|
*/
|
|
@@ -21,5 +20,4 @@ function componentFactoryFileSystemOptions(base, pathPrefix) {
|
|
|
21
20
|
sharedTypes: base.sharedTypes ?? false
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
export { componentFactoryFileSystemOptions };
|
|
23
|
+
export { componentFactoryFileSystemOptions };
|
|
@@ -2,7 +2,6 @@ import { getStateValue } from "../../svg-css/states/value.js";
|
|
|
2
2
|
import { createStatefulIconSelectorsContext } from "../../svg-css/states/selector/parse.js";
|
|
3
3
|
import { parseIconFallbackTemplate } from "../../svg-css/states/fallback/parse.js";
|
|
4
4
|
import { parseViewBox } from "../../svg/viewbox/parse.js";
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Check states for stateful icon
|
|
8
7
|
*/
|
|
@@ -35,12 +34,14 @@ function prepareComponentFactoryStatefulIcon(icon, options) {
|
|
|
35
34
|
supportedStateValues[stateName] = defaultValue;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
37
|
+
const staticClassname = Object.keys(icon.animations ?? {}).length > 0 && options?.staticState !== false ? "state-static" : void 0;
|
|
38
38
|
const statefulData = {
|
|
39
39
|
allStates,
|
|
40
40
|
supportedStates,
|
|
41
41
|
defaultStateValues,
|
|
42
42
|
supportedStateValues,
|
|
43
|
-
|
|
43
|
+
staticClassname,
|
|
44
|
+
context: createStatefulIconSelectorsContext(config, allStates, staticClassname)
|
|
44
45
|
};
|
|
45
46
|
if (isStatefulFallback) {
|
|
46
47
|
let fallbackTemplate = parseIconFallbackTemplate(fallback, allStates);
|
|
@@ -69,5 +70,4 @@ function prepareComponentFactoryStatefulIcon(icon, options) {
|
|
|
69
70
|
statefulData
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
export { prepareComponentFactoryStatefulIcon };
|
|
73
|
+
export { prepareComponentFactoryStatefulIcon };
|
package/lib/components/raw.js
CHANGED
|
@@ -7,7 +7,6 @@ import { generateCSSFilesForComponent } from "./helpers/css/generate.js";
|
|
|
7
7
|
import { factoryPropTemplate, stringifyFactoryProps } from "./helpers/props/stringify.js";
|
|
8
8
|
import { stringifyFactoryImports } from "./helpers/imports/stringify.js";
|
|
9
9
|
import { getGeneratedComponentTypesFilename } from "./helpers/filenames/types.js";
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Create raw component code
|
|
13
12
|
*/
|
|
@@ -43,5 +42,4 @@ function createRawComponent(data, options) {
|
|
|
43
42
|
style: isEmbeddedCSS ? void 0 : style
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
export { createRawComponent };
|
|
45
|
+
export { createRawComponent };
|
package/lib/components/solid.js
CHANGED
|
@@ -13,7 +13,6 @@ import { getViewBoxRatio } from "./helpers/content/ratio.js";
|
|
|
13
13
|
import { addCustomFunctionAsset } from "./helpers/functions/custom.js";
|
|
14
14
|
import { addFallbackFunctionAsset } from "./helpers/functions/fallback.js";
|
|
15
15
|
import { addSolidComponentTypes } from "./helpers/ts/solid.js";
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Create Solid component code
|
|
19
18
|
*/
|
|
@@ -45,8 +44,8 @@ function createSolidComponent(data, options) {
|
|
|
45
44
|
if (!fallback) props.xmlns = "http://www.w3.org/2000/svg";
|
|
46
45
|
let computedFallback = false;
|
|
47
46
|
if (statefulData) {
|
|
48
|
-
const { supportedStates, allStates } = statefulData;
|
|
49
|
-
if (supportedStates.size) {
|
|
47
|
+
const { supportedStates, allStates, staticClassname } = statefulData;
|
|
48
|
+
if (supportedStates.size || staticClassname) {
|
|
50
49
|
const computedStates = [];
|
|
51
50
|
let addedStateFunc = false;
|
|
52
51
|
for (const state of allStates) if (typeof state === "string") {
|
|
@@ -80,6 +79,15 @@ function createSolidComponent(data, options) {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
82
|
+
if (staticClassname) {
|
|
83
|
+
const state = "static";
|
|
84
|
+
props[state] = {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
value: state,
|
|
87
|
+
template: ""
|
|
88
|
+
};
|
|
89
|
+
computedStates.push(`'${state}': local['${state}']`);
|
|
90
|
+
}
|
|
83
91
|
if (computedStates.length) {
|
|
84
92
|
componentInternalCode.push(`const states = createMemo(() => ({ ${computedStates.join(", ")} }));`);
|
|
85
93
|
if (fallback && statefulData.fallback) {
|
|
@@ -166,5 +174,4 @@ function createSolidComponent(data, options) {
|
|
|
166
174
|
dependencies: dependencies.size ? dependencies : void 0
|
|
167
175
|
};
|
|
168
176
|
}
|
|
169
|
-
|
|
170
|
-
export { createSolidComponent };
|
|
177
|
+
export { createSolidComponent };
|
package/lib/components/svelte.js
CHANGED
|
@@ -14,7 +14,6 @@ import { getViewBoxRatio } from "./helpers/content/ratio.js";
|
|
|
14
14
|
import { addCustomFunctionAsset } from "./helpers/functions/custom.js";
|
|
15
15
|
import { addFallbackFunctionAsset } from "./helpers/functions/fallback.js";
|
|
16
16
|
import { addSvelteComponentTypes } from "./helpers/ts/svelte.js";
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Create Svelte component code
|
|
20
19
|
*/
|
|
@@ -45,8 +44,8 @@ function createSvelteComponent(data, options) {
|
|
|
45
44
|
if (!fallback) props.xmlns = "http://www.w3.org/2000/svg";
|
|
46
45
|
let computedFallback = false;
|
|
47
46
|
if (statefulData) {
|
|
48
|
-
const { supportedStates, allStates } = statefulData;
|
|
49
|
-
if (supportedStates.size) {
|
|
47
|
+
const { supportedStates, allStates, staticClassname } = statefulData;
|
|
48
|
+
if (supportedStates.size || staticClassname) {
|
|
50
49
|
const computedStates = [];
|
|
51
50
|
let addedStateFunc = false;
|
|
52
51
|
for (const state of allStates) if (typeof state === "string") {
|
|
@@ -80,6 +79,15 @@ function createSvelteComponent(data, options) {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
82
|
+
if (staticClassname) {
|
|
83
|
+
const state = "static";
|
|
84
|
+
props[state] = {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
value: state,
|
|
87
|
+
template: ""
|
|
88
|
+
};
|
|
89
|
+
computedStates.push(`'${state}': ${state}`);
|
|
90
|
+
}
|
|
83
91
|
if (computedStates.length) {
|
|
84
92
|
componentCode.push(`let states = $derived(({ ${computedStates.join(", ")} }));`);
|
|
85
93
|
if (fallback && statefulData.fallback) {
|
|
@@ -167,5 +175,4 @@ ${template}
|
|
|
167
175
|
dependencies: dependencies.size ? dependencies : void 0
|
|
168
176
|
};
|
|
169
177
|
}
|
|
170
|
-
|
|
171
|
-
export { createSvelteComponent };
|
|
178
|
+
export { createSvelteComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|