@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.
Files changed (143) hide show
  1. package/lib/classname/const.js +1 -2
  2. package/lib/classname/toggle.js +1 -3
  3. package/lib/components/export/dependencies.js +1 -2
  4. package/lib/components/export/exports.js +1 -2
  5. package/lib/components/export/file.js +1 -3
  6. package/lib/components/export/filename.js +1 -2
  7. package/lib/components/export/fs.js +1 -3
  8. package/lib/components/export/merge.js +1 -3
  9. package/lib/components/helpers/code/lines.js +1 -2
  10. package/lib/components/helpers/content/ratio.js +1 -2
  11. package/lib/components/helpers/content/size.js +1 -3
  12. package/lib/components/helpers/content/stringify.js +1 -3
  13. package/lib/components/helpers/css/generate.js +1 -3
  14. package/lib/components/helpers/filenames/asset.js +1 -2
  15. package/lib/components/helpers/filenames/css.js +1 -3
  16. package/lib/components/helpers/filenames/path.js +1 -2
  17. package/lib/components/helpers/filenames/types.js +1 -3
  18. package/lib/components/helpers/functions/custom.js +3 -5
  19. package/lib/components/helpers/functions/fallback.js +3 -5
  20. package/lib/components/helpers/functions/innerhtml.js +1 -3
  21. package/lib/components/helpers/functions/size.js +3 -5
  22. package/lib/components/helpers/imports/add.js +1 -2
  23. package/lib/components/helpers/imports/create.js +1 -2
  24. package/lib/components/helpers/imports/stringify.js +1 -2
  25. package/lib/components/helpers/imports/types.js +1 -1
  26. package/lib/components/helpers/props/object.js +1 -3
  27. package/lib/components/helpers/props/stringify.js +1 -2
  28. package/lib/components/helpers/props/ts.js +1 -2
  29. package/lib/components/helpers/props/types.js +1 -1
  30. package/lib/components/helpers/ts/jsx.js +4 -7
  31. package/lib/components/helpers/ts/solid.d.ts +9 -0
  32. package/lib/components/helpers/ts/solid.js +18 -0
  33. package/lib/components/helpers/ts/svelte.js +1 -3
  34. package/lib/components/helpers/ts/vue.js +1 -3
  35. package/lib/components/helpers/ts/wrapper.d.ts +5 -1
  36. package/lib/components/helpers/ts/wrapper.js +5 -3
  37. package/lib/components/jsx.d.ts +1 -1
  38. package/lib/components/jsx.js +3 -6
  39. package/lib/components/prepare/iconify.js +2 -4
  40. package/lib/components/prepare/options.js +1 -3
  41. package/lib/components/prepare/states.js +1 -3
  42. package/lib/components/raw.js +1 -3
  43. package/lib/components/solid.d.ts +11 -0
  44. package/lib/components/solid.js +168 -0
  45. package/lib/components/svelte.js +1 -3
  46. package/lib/components/types/component.js +1 -1
  47. package/lib/components/types/css.js +1 -1
  48. package/lib/components/types/data.js +1 -1
  49. package/lib/components/types/jsx.js +1 -1
  50. package/lib/components/types/options.js +1 -1
  51. package/lib/components/types/source.js +1 -1
  52. package/lib/components/vue-func.js +1 -3
  53. package/lib/components/vue.js +1 -3
  54. package/lib/css/find/animations.js +1 -3
  55. package/lib/css/find/classname.js +1 -3
  56. package/lib/css/find/prop.js +1 -2
  57. package/lib/css/hash.js +1 -3
  58. package/lib/css/minify.js +1 -2
  59. package/lib/css/rules.js +1 -2
  60. package/lib/css/stringify.js +1 -2
  61. package/lib/css/stylesheet.js +1 -3
  62. package/lib/css/types.js +1 -1
  63. package/lib/helpers/data/compact.js +1 -2
  64. package/lib/helpers/data/expand.js +1 -2
  65. package/lib/helpers/hash/context.js +1 -2
  66. package/lib/helpers/hash/hash.js +1 -2
  67. package/lib/helpers/hash/stringify.js +1 -2
  68. package/lib/helpers/hash/types.js +1 -1
  69. package/lib/helpers/hash/unique.js +1 -3
  70. package/lib/helpers/misc/clone.js +1 -2
  71. package/lib/helpers/misc/compare.js +1 -3
  72. package/lib/helpers/misc/keys.js +1 -3
  73. package/lib/helpers/misc/promises.js +1 -3
  74. package/lib/helpers/misc/sort-object.js +1 -2
  75. package/lib/helpers/misc/strings.js +1 -2
  76. package/lib/helpers/reduce-motion.js +1 -2
  77. package/lib/iconify/icon/{nornalise.js → normalise.js} +1 -3
  78. package/lib/iconify/icon/types.js +1 -1
  79. package/lib/iconify/icon-set/defaults.js +1 -2
  80. package/lib/iconify/icon-set/icon.js +1 -3
  81. package/lib/iconify/icon-set/parse.js +1 -3
  82. package/lib/iconify/icon-set/types.js +1 -1
  83. package/lib/index.js +1 -2
  84. package/lib/svg/content/defs.js +1 -2
  85. package/lib/svg/ids/change.js +1 -3
  86. package/lib/svg/ids/duplicate.js +1 -3
  87. package/lib/svg/ids/string.js +1 -2
  88. package/lib/svg/ids/types.js +1 -1
  89. package/lib/svg/ids/unique.js +1 -3
  90. package/lib/svg/ids/unused.js +1 -3
  91. package/lib/svg/props/size.js +1 -2
  92. package/lib/svg/props/stringify.js +1 -2
  93. package/lib/svg/viewbox/minify.js +1 -2
  94. package/lib/svg/viewbox/parse.js +1 -2
  95. package/lib/svg/viewbox/square.js +1 -2
  96. package/lib/svg/viewbox/types.js +1 -1
  97. package/lib/svg/viewbox/value.js +1 -2
  98. package/lib/svg-css/content.js +1 -3
  99. package/lib/svg-css/icon/css.js +1 -3
  100. package/lib/svg-css/icon/types.js +1 -1
  101. package/lib/svg-css/icon-set/add.js +1 -3
  102. package/lib/svg-css/icon-set/create.js +1 -2
  103. package/lib/svg-css/icon-set/get.js +1 -3
  104. package/lib/svg-css/icon-set/minify/expand.js +1 -3
  105. package/lib/svg-css/icon-set/minify/keys.js +1 -2
  106. package/lib/svg-css/icon-set/minify/minify.js +1 -3
  107. package/lib/svg-css/icon-set/types.js +1 -1
  108. package/lib/svg-css/props/prop.js +1 -2
  109. package/lib/svg-css/props/props.js +3 -5
  110. package/lib/svg-css/props/tags.js +2 -3
  111. package/lib/svg-css/props/types.js +1 -1
  112. package/lib/svg-css/root.js +1 -3
  113. package/lib/svg-css/states/cleanup-values.js +1 -3
  114. package/lib/svg-css/states/fallback/parse.js +1 -2
  115. package/lib/svg-css/states/fallback/stringify.js +1 -2
  116. package/lib/svg-css/states/fallback/test.js +1 -3
  117. package/lib/svg-css/states/fallback/types.js +1 -1
  118. package/lib/svg-css/states/focus.js +1 -2
  119. package/lib/svg-css/states/generator.js +1 -3
  120. package/lib/svg-css/states/key.js +1 -2
  121. package/lib/svg-css/states/object.js +1 -3
  122. package/lib/svg-css/states/selector/helpers/iterate.js +1 -2
  123. package/lib/svg-css/states/selector/merge.js +1 -3
  124. package/lib/svg-css/states/selector/parse.js +1 -3
  125. package/lib/svg-css/states/selector/part/merge.js +1 -3
  126. package/lib/svg-css/states/selector/part/split.js +1 -3
  127. package/lib/svg-css/states/selector/part/stringify.js +1 -3
  128. package/lib/svg-css/states/selector/split.js +1 -3
  129. package/lib/svg-css/states/selector/stringify.js +1 -3
  130. package/lib/svg-css/states/selector/sub/merge.js +1 -2
  131. package/lib/svg-css/states/selector/sub/split.js +1 -2
  132. package/lib/svg-css/states/selector/sub/stringify.js +1 -2
  133. package/lib/svg-css/states/selector/types.js +1 -1
  134. package/lib/svg-css/states/types.js +1 -1
  135. package/lib/svg-css/states/validate.js +1 -2
  136. package/lib/svg-css/states/value.js +1 -2
  137. package/lib/svg-css/types.js +1 -1
  138. package/lib/xml/iterate.js +1 -2
  139. package/lib/xml/parse.js +1 -2
  140. package/lib/xml/stringify.js +1 -2
  141. package/lib/xml/types.js +1 -1
  142. package/package.json +9 -9
  143. /package/lib/iconify/icon/{nornalise.d.ts → normalise.d.ts} +0 -0
@@ -1,4 +1,3 @@
1
1
  const defaultClassProp = "class";
2
2
  const classProps = [defaultClassProp];
3
-
4
- export { classProps, defaultClassProp };
3
+ export { classProps, defaultClassProp };
@@ -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 };
@@ -14,5 +14,4 @@ function createDependenciesForPackage(dependencies, customVersions) {
14
14
  return result;
15
15
  }
16
16
  }
17
-
18
- export { addComponentDependencies, createDependenciesForPackage };
17
+ export { addComponentDependencies, createDependenciesForPackage };
@@ -14,5 +14,4 @@ function createExportsForMainFiles(data, options = {}) {
14
14
  }
15
15
  return result;
16
16
  }
17
-
18
- export { createExportsForMainFiles };
17
+ export { createExportsForMainFiles };
@@ -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 };
@@ -5,5 +5,4 @@ function stringifyFactoryIconCodeLines(lines, padding = 0) {
5
5
  const pad = " ".repeat(padding);
6
6
  return lines.map((line) => pad + line).join("\n");
7
7
  }
8
-
9
- export { stringifyFactoryIconCodeLines };
8
+ export { stringifyFactoryIconCodeLines };
@@ -5,5 +5,4 @@ function getViewBoxRatio(viewBox) {
5
5
  const ratio = viewBox.width / viewBox.height;
6
6
  return (Math.ceil(ratio * 100) / 100).toFixed(2).replace(/\.?0+$/, "");
7
7
  }
8
-
9
- export { getViewBoxRatio };
8
+ export { getViewBoxRatio };
@@ -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 };
@@ -13,5 +13,4 @@ function getGeneratedAssetFilename(filename, rootPath) {
13
13
  filename: `${basePath ? basePath + "/" : ""}${filename}`
14
14
  };
15
15
  }
16
-
17
- export { defaultHelpersDirectory, getGeneratedAssetFilename };
16
+ export { defaultHelpersDirectory, getGeneratedAssetFilename };
@@ -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 };
@@ -13,5 +13,4 @@ function getFactoryRelativeRootPath(options, pathPrefix) {
13
13
  filename: pathPrefix ?? ""
14
14
  };
15
15
  }
16
-
17
- export { getFactoryRelativeRootPath };
16
+ export { getFactoryRelativeRootPath };
@@ -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 { defaultHelpersDirectory, getGeneratedAssetFilename } from "../filenames/asset.js";
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 ?? defaultHelpersDirectory}/${data.jsName ?? camelToKebab(functionName)}.js`, options.rootPath);
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 { defaultHelpersDirectory, getGeneratedAssetFilename } from "../filenames/asset.js";
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 ?? defaultHelpersDirectory;
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 { defaultHelpersDirectory, getGeneratedAssetFilename } from "../filenames/asset.js";
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 ?? defaultHelpersDirectory}/size.js`, options.rootPath);
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 };
@@ -14,5 +14,4 @@ function addNamedImport(data, source, names) {
14
14
  function addTypeImport(data, source, types) {
15
15
  addToSet(data.types[source] ??= /* @__PURE__ */ new Set(), types);
16
16
  }
17
-
18
- export { addNamedImport, addTypeImport };
17
+ export { addNamedImport, addTypeImport };
@@ -10,5 +10,4 @@ function createFactoryImports() {
10
10
  css: /* @__PURE__ */ new Set()
11
11
  };
12
12
  }
13
-
14
- export { createFactoryImports };
13
+ export { createFactoryImports };
@@ -41,5 +41,4 @@ function stringifyFactoryImports(imports, includeTypes = true) {
41
41
  if (lines.length) lines.push("");
42
42
  return lines.join("\n");
43
43
  }
44
-
45
- export { stringifyFactoryImports };
44
+ export { stringifyFactoryImports };
@@ -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 };
@@ -17,5 +17,4 @@ function stringifyFactoryProps(props, dynamicTemplate, staticTemplate = factoryP
17
17
  }
18
18
  return result.join(separator);
19
19
  }
20
-
21
- export { factoryPropTemplate, stringifyFactoryProps };
20
+ export { factoryPropTemplate, stringifyFactoryProps };
@@ -23,5 +23,4 @@ function stringifyFactoryPropTypes(props) {
23
23
  function getUsedFactoryProps(props) {
24
24
  return parse(props, (key) => key);
25
25
  }
26
-
27
- export { getUsedFactoryProps, stringifyFactoryPropTypes };
26
+ export { getUsedFactoryProps, stringifyFactoryPropTypes };
@@ -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>, ${omitProps}> & IconProps
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>, ${omitProps}> & IconProps) => JSX.Element;
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 };
@@ -8,7 +8,7 @@ interface Options extends ComponentFactoryOptions {
8
8
  ts?: boolean;
9
9
  }
10
10
  /**
11
- * Create functional Vue component code
11
+ * Create React component code
12
12
  */
13
13
  declare function createJSXComponent(data: FactoryIconData, options: Options): FactoryGeneratedComponent;
14
14
  export { createJSXComponent };
@@ -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 functional Vue component code
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 propsDestricturing = usedProps.length ? `{${[...usedProps, "...props"].join(", ")}}` : "props";
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/nornalise.js";
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 };
@@ -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 };