@cyberalien/svg-utils 1.2.5 → 1.2.7
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.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 +4 -7
- package/lib/components/helpers/ts/solid.d.ts +9 -0
- package/lib/components/helpers/ts/solid.js +18 -0
- package/lib/components/helpers/ts/svelte.js +1 -3
- package/lib/components/helpers/ts/vue.js +1 -3
- package/lib/components/helpers/ts/wrapper.d.ts +5 -1
- package/lib/components/helpers/ts/wrapper.js +5 -3
- package/lib/components/jsx.d.ts +1 -1
- package/lib/components/jsx.js +3 -6
- package/lib/components/prepare/iconify.js +2 -4
- package/lib/components/prepare/options.js +1 -3
- package/lib/components/prepare/states.js +1 -3
- package/lib/components/raw.js +1 -3
- package/lib/components/solid.d.ts +11 -0
- package/lib/components/solid.js +168 -0
- package/lib/components/svelte.js +1 -3
- 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.js +1 -1
- package/lib/components/types/source.js +1 -1
- package/lib/components/vue-func.js +1 -3
- package/lib/components/vue.js +1 -3
- 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 +1 -3
- 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/focus.js +1 -2
- 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.js +1 -3
- 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.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 +9 -9
- /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 };
|
|
@@ -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,11 +1,9 @@
|
|
|
1
|
-
import { addComponentTypes } from "./wrapper.js";
|
|
2
|
-
|
|
1
|
+
import { addComponentTypes, omitComponentSVGProps } from "./wrapper.js";
|
|
3
2
|
const iconPropsTemplate = `interface IconProps {
|
|
4
3
|
/* PROPS */
|
|
5
4
|
}`;
|
|
6
5
|
const exportTemplate = `export { type IconProps };
|
|
7
6
|
export default Component;`;
|
|
8
|
-
const omitProps = `'viewBox' | 'width' | 'height' | 'xmlns'`;
|
|
9
7
|
/**
|
|
10
8
|
* Add JSX component types
|
|
11
9
|
*/
|
|
@@ -18,7 +16,7 @@ function addJSXComponentTypes(data, options, assets, props) {
|
|
|
18
16
|
${iconPropsTemplate}
|
|
19
17
|
|
|
20
18
|
const Component: ForwardRefExoticComponent<
|
|
21
|
-
Omit<SVGProps<SVGSVGElement>, ${
|
|
19
|
+
Omit<SVGProps<SVGSVGElement>, ${omitComponentSVGProps}> & IconProps
|
|
22
20
|
>;
|
|
23
21
|
|
|
24
22
|
${exportTemplate}
|
|
@@ -28,12 +26,11 @@ ${exportTemplate}
|
|
|
28
26
|
|
|
29
27
|
${iconPropsTemplate}
|
|
30
28
|
|
|
31
|
-
const Component: (props: Omit<JSX.SVGAttributes<SVGSVGElement>, ${
|
|
29
|
+
const Component: (props: Omit<JSX.SVGAttributes<SVGSVGElement>, ${omitComponentSVGProps}> & IconProps) => JSX.Element;
|
|
32
30
|
|
|
33
31
|
${exportTemplate}
|
|
34
32
|
`;
|
|
35
33
|
}
|
|
36
34
|
return addComponentTypes(template, data, options, assets, props);
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
export { addJSXComponentTypes };
|
|
36
|
+
export { addJSXComponentTypes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.js";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.js";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.js";
|
|
4
|
+
import { FactoryComponentProps } from "../props/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Add Solid component types
|
|
7
|
+
*/
|
|
8
|
+
declare const addSolidComponentTypes: (data: FactoryIconData, options: ComponentFactoryOptions, assets: GeneratedAssetFile[], props: FactoryComponentProps) => string;
|
|
9
|
+
export { addSolidComponentTypes };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { addComponentTypes, omitComponentSVGProps } from "./wrapper.js";
|
|
2
|
+
/**
|
|
3
|
+
* Add Solid component types
|
|
4
|
+
*/
|
|
5
|
+
const addSolidComponentTypes = addComponentTypes.bind(null, `import { JSX } from 'solid-js';
|
|
6
|
+
|
|
7
|
+
interface IconProps {
|
|
8
|
+
/* PROPS */
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const Component: (
|
|
12
|
+
props: Omit<JSX.SvgSVGAttributes<SVGSVGElement>, ${omitComponentSVGProps}> & IconProps
|
|
13
|
+
) => JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { type IconProps };
|
|
16
|
+
export default Component;
|
|
17
|
+
`);
|
|
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 };
|
|
@@ -2,8 +2,12 @@ import { GeneratedAssetFile } from "../../types/component.js";
|
|
|
2
2
|
import { FactoryIconData } from "../../types/data.js";
|
|
3
3
|
import { ComponentFactoryOptions } from "../../types/options.js";
|
|
4
4
|
import { FactoryComponentProps } from "../props/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Properties to omit
|
|
7
|
+
*/
|
|
8
|
+
declare const omitComponentSVGProps = "'viewBox' | 'width' | 'height' | 'xmlns'";
|
|
5
9
|
/**
|
|
6
10
|
* Add component types
|
|
7
11
|
*/
|
|
8
12
|
declare function addComponentTypes(template: string, data: FactoryIconData, options: ComponentFactoryOptions, assets: GeneratedAssetFile[], props: FactoryComponentProps): string;
|
|
9
|
-
export { addComponentTypes };
|
|
13
|
+
export { addComponentTypes, omitComponentSVGProps };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { stringifyFactoryPropTypes } from "../props/ts.js";
|
|
2
2
|
import { getGeneratedComponentTypesFilename } from "../filenames/types.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Properties to omit
|
|
5
|
+
*/
|
|
6
|
+
const omitComponentSVGProps = `'viewBox' | 'width' | 'height' | 'xmlns'`;
|
|
4
7
|
/**
|
|
5
8
|
* Add component types
|
|
6
9
|
*/
|
|
@@ -14,5 +17,4 @@ function addComponentTypes(template, data, options, assets, props) {
|
|
|
14
17
|
});
|
|
15
18
|
return filename.filename;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
export { addComponentTypes };
|
|
20
|
+
export { addComponentTypes, omitComponentSVGProps };
|
package/lib/components/jsx.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface Options extends ComponentFactoryOptions {
|
|
|
8
8
|
ts?: boolean;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Create
|
|
11
|
+
* Create React component code
|
|
12
12
|
*/
|
|
13
13
|
declare function createJSXComponent(data: FactoryIconData, options: Options): FactoryGeneratedComponent;
|
|
14
14
|
export { createJSXComponent };
|
package/lib/components/jsx.js
CHANGED
|
@@ -14,9 +14,8 @@ 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
|
-
* Create
|
|
18
|
+
* Create React component code
|
|
20
19
|
*/
|
|
21
20
|
function createJSXComponent(data, options) {
|
|
22
21
|
const icon = data.icon;
|
|
@@ -178,8 +177,7 @@ function createJSXComponent(data, options) {
|
|
|
178
177
|
const propTypes = stringifyFactoryPropTypes(props);
|
|
179
178
|
const typesCode = useTS ? `interface Props {\n${propTypes}\n};\n\n` : propTypes ? `/** @type {{${propTypes.replace(/\s*\n\s*/g, " ").trim()}}} */\n` : "";
|
|
180
179
|
const usedProps = getUsedFactoryProps(props);
|
|
181
|
-
const
|
|
182
|
-
const componentFunction = `${typesCode}function Component${useTS ? `<Props>` : ""}(${propsDestricturing}) {
|
|
180
|
+
const componentFunction = `${typesCode}function Component(${usedProps.length ? `{${[...usedProps, "...props"].join(", ")}}` : "props"}${useTS ? `: Props` : ""}) {
|
|
183
181
|
\t${componentInternalCode.join("\n ")}
|
|
184
182
|
}
|
|
185
183
|
`;
|
|
@@ -193,5 +191,4 @@ function createJSXComponent(data, options) {
|
|
|
193
191
|
dependencies: dependencies.size ? dependencies : void 0
|
|
194
192
|
};
|
|
195
193
|
}
|
|
196
|
-
|
|
197
|
-
export { createJSXComponent };
|
|
194
|
+
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
|
*/
|
|
@@ -69,5 +68,4 @@ function prepareComponentFactoryStatefulIcon(icon, options) {
|
|
|
69
68
|
statefulData
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
export { prepareComponentFactoryStatefulIcon };
|
|
71
|
+
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FactoryGeneratedComponent } from "./types/component.js";
|
|
2
|
+
import { FactoryIconData } from "./types/data.js";
|
|
3
|
+
import { ComponentFactoryOptions } from "./types/options.js";
|
|
4
|
+
interface Options extends ComponentFactoryOptions {
|
|
5
|
+
ts?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create Solid component code
|
|
9
|
+
*/
|
|
10
|
+
declare function createSolidComponent(data: FactoryIconData, options: Options): FactoryGeneratedComponent;
|
|
11
|
+
export { createSolidComponent };
|