@cyberalien/svg-utils 1.0.10 → 1.1.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/lib/classname/{toggle.js → toggle.mjs} +1 -1
- package/lib/components/export/{exports.d.ts → exports.d.mts} +1 -1
- package/lib/components/export/{file.d.ts → file.d.mts} +3 -3
- package/lib/components/export/{file.js → file.mjs} +1 -1
- package/lib/components/export/{filename.d.ts → filename.d.mts} +2 -2
- package/lib/components/export/{fs.d.ts → fs.d.mts} +1 -1
- package/lib/components/export/{merge.d.ts → merge.d.mts} +1 -1
- package/lib/components/helpers/content/{ratio.d.ts → ratio.d.mts} +1 -1
- package/lib/components/helpers/content/{size.d.ts → size.d.mts} +2 -2
- package/lib/components/helpers/content/{size.js → size.mjs} +1 -1
- package/lib/components/helpers/content/{stringify.d.ts → stringify.d.mts} +2 -2
- package/lib/components/helpers/content/{stringify.js → stringify.mjs} +1 -1
- package/lib/components/helpers/css/{generate.d.ts → generate.d.mts} +4 -4
- package/lib/components/helpers/css/{generate.js → generate.mjs} +13 -13
- package/lib/components/helpers/css/{name.js → name.mjs} +1 -1
- package/lib/components/helpers/filenames/{asset.d.ts → asset.d.mts} +1 -1
- package/lib/components/helpers/filenames/{css.d.ts → css.d.mts} +1 -1
- package/lib/components/helpers/filenames/{css.js → css.mjs} +1 -1
- package/lib/components/helpers/filenames/{path.d.ts → path.d.mts} +1 -1
- package/lib/components/helpers/filenames/types.d.mts +9 -0
- package/lib/components/helpers/filenames/{types.js → types.mjs} +4 -3
- package/lib/components/helpers/functions/{size.d.ts → size.d.mts} +3 -3
- package/lib/components/helpers/functions/{size.js → size.mjs} +1 -1
- package/lib/components/helpers/imports/{add.d.ts → add.d.mts} +1 -1
- package/lib/components/helpers/imports/{create.d.ts → create.d.mts} +1 -1
- package/lib/components/helpers/imports/{stringify.d.ts → stringify.d.mts} +1 -1
- package/lib/components/helpers/props/{object.d.ts → object.d.mts} +1 -1
- package/lib/components/helpers/props/{object.js → object.mjs} +1 -1
- package/lib/components/helpers/props/{stringify.d.ts → stringify.d.mts} +1 -1
- package/lib/components/helpers/props/{ts.d.ts → ts.d.mts} +1 -1
- package/lib/components/helpers/ts/jsx.d.mts +13 -0
- package/lib/components/helpers/ts/{jsx.js → jsx.mjs} +1 -1
- package/lib/components/helpers/ts/svelte.d.mts +9 -0
- package/lib/components/helpers/ts/{svelte.js → svelte.mjs} +1 -1
- package/lib/components/helpers/ts/vue.d.mts +9 -0
- package/lib/components/helpers/ts/{vue.js → vue.mjs} +1 -1
- package/lib/components/helpers/ts/wrapper.d.mts +9 -0
- package/lib/components/helpers/ts/{wrapper.js → wrapper.mjs} +2 -2
- package/lib/components/{jsx.d.ts → jsx.d.mts} +4 -4
- package/lib/components/{jsx.js → jsx.mjs} +14 -14
- package/lib/components/prepare/{iconify.d.ts → iconify.d.mts} +5 -5
- package/lib/components/prepare/{iconify.js → iconify.mjs} +3 -3
- package/lib/components/prepare/{options.d.ts → options.d.mts} +1 -1
- package/lib/components/prepare/{options.js → options.mjs} +2 -2
- package/lib/components/raw.d.mts +8 -0
- package/lib/components/{raw.js → raw.mjs} +8 -8
- package/lib/components/{svelte.d.ts → svelte.d.mts} +3 -3
- package/lib/components/{svelte.js → svelte.mjs} +14 -14
- package/lib/components/types/{data.d.ts → data.d.mts} +2 -2
- package/lib/components/types/{options.d.ts → options.d.mts} +3 -2
- package/lib/components/types/{source.d.ts → source.d.mts} +2 -2
- package/lib/components/vue-func.d.mts +8 -0
- package/lib/components/{vue-func.js → vue-func.mjs} +14 -14
- package/lib/components/{vue.d.ts → vue.d.mts} +3 -3
- package/lib/components/{vue.js → vue.mjs} +14 -14
- package/lib/css/hash.d.mts +6 -0
- package/lib/css/hash.mjs +15 -0
- package/lib/css/{stringify.d.ts → stringify.d.mts} +1 -1
- package/lib/css/{types.d.ts → types.d.mts} +2 -2
- package/lib/helpers/hash/context.d.mts +6 -0
- package/lib/helpers/hash/context.mjs +8 -0
- package/lib/helpers/hash/types.d.mts +28 -0
- package/lib/helpers/hash/{unique.d.ts → unique.d.mts} +1 -1
- package/lib/helpers/hash/{unique.js → unique.mjs} +6 -7
- package/lib/helpers/misc/{compare.js → compare.mjs} +1 -1
- package/lib/helpers/misc/{keys.js → keys.mjs} +1 -1
- package/lib/helpers/misc/{promises.d.ts → promises.d.mts} +1 -1
- package/lib/helpers/misc/{promises.js → promises.mjs} +1 -1
- package/lib/iconify/icon/{nornalise.d.ts → nornalise.d.mts} +1 -1
- package/lib/iconify/icon/{nornalise.js → nornalise.mjs} +1 -1
- package/lib/iconify/icon/types.d.mts +6 -0
- package/lib/iconify/icon-set/{icon.js → icon.mjs} +1 -1
- package/lib/iconify/icon-set/{parse.d.ts → parse.d.mts} +1 -1
- package/lib/iconify/icon-set/{parse.js → parse.mjs} +1 -1
- package/lib/index.d.mts +28 -0
- package/lib/index.mjs +25 -0
- package/lib/svg/ids/{change.d.ts → change.d.mts} +2 -2
- package/lib/svg/ids/{change.js → change.mjs} +5 -5
- package/lib/svg/ids/{duplicate.d.ts → duplicate.d.mts} +2 -2
- package/lib/svg/ids/{duplicate.js → duplicate.mjs} +1 -1
- package/lib/svg/ids/types.d.mts +8 -0
- package/lib/svg/ids/unique.d.mts +7 -0
- package/lib/svg/ids/unique.mjs +16 -0
- package/lib/svg/ids/{unused.d.ts → unused.d.mts} +2 -2
- package/lib/svg/ids/{unused.js → unused.mjs} +1 -1
- package/lib/svg/viewbox/{minify.d.ts → minify.d.mts} +1 -1
- package/lib/svg/viewbox/{parse.d.ts → parse.d.mts} +1 -1
- package/lib/svg/viewbox/{square.d.ts → square.d.mts} +1 -1
- package/lib/svg/viewbox/{value.d.ts → value.d.mts} +1 -1
- package/lib/svg-css/{content.d.ts → content.d.mts} +2 -2
- package/lib/svg-css/{content.js → content.mjs} +3 -3
- package/lib/svg-css/props/prop.d.mts +14 -0
- package/lib/svg-css/props/{prop.js → prop.mjs} +6 -4
- package/lib/svg-css/props/{props.d.ts → props.d.mts} +2 -2
- package/lib/svg-css/props/{props.js → props.mjs} +10 -6
- package/lib/svg-css/{animations/tags.d.ts → props/tags.d.mts} +1 -9
- package/lib/svg-css/{animations/tags.js → props/tags.mjs} +3 -14
- package/lib/svg-css/props/{types.d.ts → types.d.mts} +1 -1
- package/lib/svg-css/root.d.mts +10 -0
- package/lib/svg-css/root.mjs +26 -0
- package/lib/svg-css/{types.d.ts → types.d.mts} +3 -5
- package/lib/xml/{iterate.d.ts → iterate.d.mts} +1 -1
- package/lib/xml/{parse.d.ts → parse.d.mts} +1 -1
- package/lib/xml/{parse.js → parse.mjs} +9 -9
- package/lib/xml/stringify.d.mts +6 -0
- package/lib/xml/{stringify.js → stringify.mjs} +5 -1
- package/package.json +11 -11
- package/lib/components/helpers/filenames/types.d.ts +0 -7
- package/lib/components/helpers/ts/jsx.d.ts +0 -13
- package/lib/components/helpers/ts/svelte.d.ts +0 -9
- package/lib/components/helpers/ts/vue.d.ts +0 -9
- package/lib/components/helpers/ts/wrapper.d.ts +0 -9
- package/lib/components/raw.d.ts +0 -8
- package/lib/components/vue-func.d.ts +0 -8
- package/lib/css/hash.d.ts +0 -6
- package/lib/css/hash.js +0 -17
- package/lib/helpers/hash/types.d.ts +0 -8
- package/lib/iconify/icon/types.d.ts +0 -6
- package/lib/index.d.ts +0 -27
- package/lib/index.js +0 -24
- package/lib/svg/ids/types.d.ts +0 -6
- package/lib/svg/ids/unique.d.ts +0 -6
- package/lib/svg/ids/unique.js +0 -18
- package/lib/svg-css/props/prop.d.ts +0 -5
- package/lib/svg-css/root.d.ts +0 -10
- package/lib/svg-css/root.js +0 -28
- package/lib/xml/stringify.d.ts +0 -6
- /package/lib/classname/{const.d.ts → const.d.mts} +0 -0
- /package/lib/classname/{const.js → const.mjs} +0 -0
- /package/lib/classname/{toggle.d.ts → toggle.d.mts} +0 -0
- /package/lib/components/export/{exports.js → exports.mjs} +0 -0
- /package/lib/components/export/{filename.js → filename.mjs} +0 -0
- /package/lib/components/export/{fs.js → fs.mjs} +0 -0
- /package/lib/components/export/{merge.js → merge.mjs} +0 -0
- /package/lib/components/helpers/code/{lines.d.ts → lines.d.mts} +0 -0
- /package/lib/components/helpers/code/{lines.js → lines.mjs} +0 -0
- /package/lib/components/helpers/content/{ratio.js → ratio.mjs} +0 -0
- /package/lib/components/helpers/css/{name.d.ts → name.d.mts} +0 -0
- /package/lib/components/helpers/filenames/{asset.js → asset.mjs} +0 -0
- /package/lib/components/helpers/filenames/{path.js → path.mjs} +0 -0
- /package/lib/components/helpers/imports/{add.js → add.mjs} +0 -0
- /package/lib/components/helpers/imports/{create.js → create.mjs} +0 -0
- /package/lib/components/helpers/imports/{stringify.js → stringify.mjs} +0 -0
- /package/lib/components/helpers/imports/{types.d.ts → types.d.mts} +0 -0
- /package/lib/components/helpers/imports/{types.js → types.mjs} +0 -0
- /package/lib/components/helpers/props/{stringify.js → stringify.mjs} +0 -0
- /package/lib/components/helpers/props/{ts.js → ts.mjs} +0 -0
- /package/lib/components/helpers/props/{types.d.ts → types.d.mts} +0 -0
- /package/lib/components/helpers/props/{types.js → types.mjs} +0 -0
- /package/lib/components/types/{component.d.ts → component.d.mts} +0 -0
- /package/lib/components/types/{component.js → component.mjs} +0 -0
- /package/lib/components/types/{css.d.ts → css.d.mts} +0 -0
- /package/lib/components/types/{css.js → css.mjs} +0 -0
- /package/lib/components/types/{data.js → data.mjs} +0 -0
- /package/lib/components/types/{jsx.d.ts → jsx.d.mts} +0 -0
- /package/lib/components/types/{jsx.js → jsx.mjs} +0 -0
- /package/lib/components/types/{options.js → options.mjs} +0 -0
- /package/lib/components/types/{source.js → source.mjs} +0 -0
- /package/lib/css/{stringify.js → stringify.mjs} +0 -0
- /package/lib/css/{types.js → types.mjs} +0 -0
- /package/lib/helpers/hash/{hash.d.ts → hash.d.mts} +0 -0
- /package/lib/helpers/hash/{hash.js → hash.mjs} +0 -0
- /package/lib/helpers/hash/{stringify.d.ts → stringify.d.mts} +0 -0
- /package/lib/helpers/hash/{stringify.js → stringify.mjs} +0 -0
- /package/lib/helpers/hash/{types.js → types.mjs} +0 -0
- /package/lib/helpers/misc/{clone.d.ts → clone.d.mts} +0 -0
- /package/lib/helpers/misc/{clone.js → clone.mjs} +0 -0
- /package/lib/helpers/misc/{compare.d.ts → compare.d.mts} +0 -0
- /package/lib/helpers/misc/{keys.d.ts → keys.d.mts} +0 -0
- /package/lib/helpers/misc/{sort-object.d.ts → sort-object.d.mts} +0 -0
- /package/lib/helpers/misc/{sort-object.js → sort-object.mjs} +0 -0
- /package/lib/helpers/misc/{strings.d.ts → strings.d.mts} +0 -0
- /package/lib/helpers/misc/{strings.js → strings.mjs} +0 -0
- /package/lib/iconify/icon/{types.js → types.mjs} +0 -0
- /package/lib/iconify/icon-set/{defaults.d.ts → defaults.d.mts} +0 -0
- /package/lib/iconify/icon-set/{defaults.js → defaults.mjs} +0 -0
- /package/lib/iconify/icon-set/{icon.d.ts → icon.d.mts} +0 -0
- /package/lib/iconify/icon-set/{types.d.ts → types.d.mts} +0 -0
- /package/lib/iconify/icon-set/{types.js → types.mjs} +0 -0
- /package/lib/svg/content/{defs.d.ts → defs.d.mts} +0 -0
- /package/lib/svg/content/{defs.js → defs.mjs} +0 -0
- /package/lib/svg/ids/{string.d.ts → string.d.mts} +0 -0
- /package/lib/svg/ids/{string.js → string.mjs} +0 -0
- /package/lib/svg/ids/{types.js → types.mjs} +0 -0
- /package/lib/svg/props/{size.d.ts → size.d.mts} +0 -0
- /package/lib/svg/props/{size.js → size.mjs} +0 -0
- /package/lib/svg/props/{stringify.d.ts → stringify.d.mts} +0 -0
- /package/lib/svg/props/{stringify.js → stringify.mjs} +0 -0
- /package/lib/svg/viewbox/{minify.js → minify.mjs} +0 -0
- /package/lib/svg/viewbox/{parse.js → parse.mjs} +0 -0
- /package/lib/svg/viewbox/{square.js → square.mjs} +0 -0
- /package/lib/svg/viewbox/{types.d.ts → types.d.mts} +0 -0
- /package/lib/svg/viewbox/{types.js → types.mjs} +0 -0
- /package/lib/svg/viewbox/{value.js → value.mjs} +0 -0
- /package/lib/svg-css/props/{types.js → types.mjs} +0 -0
- /package/lib/svg-css/{types.js → types.mjs} +0 -0
- /package/lib/xml/{iterate.js → iterate.mjs} +0 -0
- /package/lib/xml/{types.d.ts → types.d.mts} +0 -0
- /package/lib/xml/{types.js → types.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FactoryComponent, FactoryGeneratedComponent } from "../types/component.
|
|
2
|
-
import { FactoryIconData } from "../types/data.
|
|
3
|
-
import { ComponentFactoryFileSystemOptions } from "../types/options.
|
|
1
|
+
import { FactoryComponent, FactoryGeneratedComponent } from "../types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryFileSystemOptions } from "../types/options.mjs";
|
|
4
4
|
interface Options extends Pick<ComponentFactoryFileSystemOptions, 'doubleDirsForComponents' | 'prefixDirsForComponents'> {
|
|
5
5
|
includePrefix?: boolean;
|
|
6
6
|
extension: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FactoryIconData } from "../types/data.
|
|
2
|
-
import { ComponentFactoryFileSystemOptions } from "../types/options.
|
|
1
|
+
import { FactoryIconData } from "../types/data.mjs";
|
|
2
|
+
import { ComponentFactoryFileSystemOptions } from "../types/options.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Generate component filename based on options
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconViewBox } from "../../../svg/viewbox/types.
|
|
2
|
-
import { ComponentFactoryRenderingOptions } from "../../types/options.
|
|
1
|
+
import { IconViewBox } from "../../../svg/viewbox/types.mjs";
|
|
2
|
+
import { ComponentFactoryRenderingOptions } from "../../types/options.mjs";
|
|
3
3
|
interface SizeResult {
|
|
4
4
|
width: string;
|
|
5
5
|
height: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentFactorySource } from "../../types/source.
|
|
2
|
-
import { ComponentFactoryRenderingOptions } from "../../types/options.
|
|
1
|
+
import { ComponentFactorySource } from "../../types/source.mjs";
|
|
2
|
+
import { ComponentFactoryRenderingOptions } from "../../types/options.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Convert icon content to a string literal
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GeneratedAssetFile } from "../../types/component.
|
|
2
|
-
import { ComponentFactorySource } from "../../types/source.
|
|
3
|
-
import { ComponentFactoryOptions } from "../../types/options.
|
|
4
|
-
import { FactoryComponentImports } from "../imports/types.
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { ComponentFactorySource } from "../../types/source.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
4
|
+
import { FactoryComponentImports } from "../imports/types.mjs";
|
|
5
5
|
interface Options extends Pick<ComponentFactoryOptions, 'cssMode' | 'cssPath' | 'doubleDirsForCSS' | 'mergeCSS'> {
|
|
6
6
|
componentType?: 'svelte';
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { stringifyCSSKeyframes, stringifyCSSSelector } from "../../../css/stringify.
|
|
2
|
-
import { generateCSSDefaultImportName } from "./name.
|
|
3
|
-
import { getGeneratedCSSFilename } from "../filenames/css.
|
|
1
|
+
import { stringifyCSSKeyframes, stringifyCSSSelector } from "../../../css/stringify.mjs";
|
|
2
|
+
import { generateCSSDefaultImportName } from "./name.mjs";
|
|
3
|
+
import { getGeneratedCSSFilename } from "../filenames/css.mjs";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generate CSS files for component
|
|
@@ -21,51 +21,51 @@ function generateCSSFilesForComponent(content, imports, assets, options) {
|
|
|
21
21
|
const mergedContent = [];
|
|
22
22
|
for (const className in classes) {
|
|
23
23
|
const baseContent = stringifyCSSSelector(`${classNamePrefix}.${className}`, classes[className]);
|
|
24
|
-
let content
|
|
24
|
+
let content = baseContent;
|
|
25
25
|
if (embedAnimations && keyframes) {
|
|
26
26
|
for (const animationName in keyframes) if (baseContent.includes(animationName)) {
|
|
27
27
|
const value = keyframes[animationName];
|
|
28
|
-
content
|
|
28
|
+
content += "\n" + (typeof value === "string" ? value : stringifyCSSKeyframes(keyframesPrefix + animationName, value));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (mergeCSS) {
|
|
32
|
-
mergedContent.push(content
|
|
32
|
+
mergedContent.push(content);
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
const filename = getGeneratedCSSFilename(className, options);
|
|
36
36
|
assets.push({
|
|
37
37
|
...filename,
|
|
38
|
-
content
|
|
38
|
+
content
|
|
39
39
|
});
|
|
40
40
|
if (isModule) imports.modules[filename.import] = generateCSSDefaultImportName(className);
|
|
41
41
|
else imports.css.add(filename.import);
|
|
42
42
|
}
|
|
43
43
|
if (!embedAnimations && keyframes) for (const animationName in keyframes) {
|
|
44
44
|
const value = keyframes[animationName];
|
|
45
|
-
const content
|
|
45
|
+
const content = typeof value === "string" ? value : stringifyCSSKeyframes(keyframesPrefix + animationName, value);
|
|
46
46
|
if (mergeCSS) {
|
|
47
|
-
mergedContent.push(content
|
|
47
|
+
mergedContent.push(content);
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
50
|
const filename = getGeneratedCSSFilename(animationName, options);
|
|
51
51
|
assets.push({
|
|
52
52
|
...filename,
|
|
53
|
-
content
|
|
53
|
+
content
|
|
54
54
|
});
|
|
55
55
|
if (isModule) imports.modules[filename.import] = generateCSSDefaultImportName(animationName);
|
|
56
56
|
else imports.css.add(filename.import);
|
|
57
57
|
}
|
|
58
58
|
if (mergeCSS && mergedContent.length) {
|
|
59
|
-
const content
|
|
59
|
+
const content = mergedContent.join("\n");
|
|
60
60
|
if (typeof mergeCSS == "object") {
|
|
61
61
|
assets.push({
|
|
62
62
|
...mergeCSS,
|
|
63
|
-
content
|
|
63
|
+
content
|
|
64
64
|
});
|
|
65
65
|
if (isModule) imports.modules[mergeCSS.import] = "css";
|
|
66
66
|
else if (!returnCSS) imports.css.add(mergeCSS.import);
|
|
67
67
|
}
|
|
68
|
-
return returnCSS ? content
|
|
68
|
+
return returnCSS ? content : void 0;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UniqueHashPartialOptions } from "../../../helpers/hash/types.mjs";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryFileSystemOptions, GeneratedAssetPath } from "../../types/options.mjs";
|
|
4
|
+
interface Options extends Pick<UniqueHashPartialOptions, 'context'>, Pick<ComponentFactoryFileSystemOptions, 'rootPath' | 'doubleDirsForComponents' | 'prefixDirsForComponents' | 'sharedTypes'> {}
|
|
5
|
+
/**
|
|
6
|
+
* Generate component types filename based on options
|
|
7
|
+
*/
|
|
8
|
+
declare function getGeneratedComponentTypesFilename(icon: Pick<FactoryIconData, 'name' | 'prefix'>, content: string, options: Options): GeneratedAssetPath;
|
|
9
|
+
export { getGeneratedComponentTypesFilename };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { getUniqueHash } from "../../../helpers/hash/unique.
|
|
2
|
-
import { getGeneratedAssetFilename } from "./asset.
|
|
3
|
-
import { getGeneratedComponentFilename } from "../../export/filename.
|
|
1
|
+
import { getUniqueHash } from "../../../helpers/hash/unique.mjs";
|
|
2
|
+
import { getGeneratedAssetFilename } from "./asset.mjs";
|
|
3
|
+
import { getGeneratedComponentFilename } from "../../export/filename.mjs";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generate component types filename based on options
|
|
7
7
|
*/
|
|
8
8
|
function getGeneratedComponentTypesFilename(icon, content, options) {
|
|
9
9
|
if (options.sharedTypes) return getGeneratedAssetFilename(`types/${getUniqueHash(content, {
|
|
10
|
+
context: options.context,
|
|
10
11
|
css: true,
|
|
11
12
|
length: 8
|
|
12
13
|
})}.d.ts`, options.rootPath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GeneratedAssetFile } from "../../types/component.
|
|
2
|
-
import { ComponentFactoryOptions } from "../../types/options.
|
|
3
|
-
import { FactoryComponentImports } from "../imports/types.
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
3
|
+
import { FactoryComponentImports } from "../imports/types.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Adds getSizeProps() function to assets
|
|
6
6
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
4
|
+
import { FactoryComponentProps } from "../props/types.mjs";
|
|
5
|
+
import { JSXMode } from "../../types/jsx.mjs";
|
|
6
|
+
interface Options extends ComponentFactoryOptions {
|
|
7
|
+
jsx: JSXMode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Add JSX component types
|
|
11
|
+
*/
|
|
12
|
+
declare function addJSXComponentTypes(data: FactoryIconData, options: Options, assets: GeneratedAssetFile[], props: FactoryComponentProps): string;
|
|
13
|
+
export { addJSXComponentTypes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
4
|
+
import { FactoryComponentProps } from "../props/types.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Add Svelte component types
|
|
7
|
+
*/
|
|
8
|
+
declare const addSvelteComponentTypes: (data: FactoryIconData, options: ComponentFactoryOptions, assets: GeneratedAssetFile[], props: FactoryComponentProps) => string;
|
|
9
|
+
export { addSvelteComponentTypes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
4
|
+
import { FactoryComponentProps } from "../props/types.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Add Vue component types
|
|
7
|
+
*/
|
|
8
|
+
declare const addVueComponentTypes: (data: FactoryIconData, options: ComponentFactoryOptions, assets: GeneratedAssetFile[], props: FactoryComponentProps) => string;
|
|
9
|
+
export { addVueComponentTypes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GeneratedAssetFile } from "../../types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "../../types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "../../types/options.mjs";
|
|
4
|
+
import { FactoryComponentProps } from "../props/types.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Add component types
|
|
7
|
+
*/
|
|
8
|
+
declare function addComponentTypes(template: string, data: FactoryIconData, options: ComponentFactoryOptions, assets: GeneratedAssetFile[], props: FactoryComponentProps): string;
|
|
9
|
+
export { addComponentTypes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringifyFactoryPropTypes } from "../props/ts.
|
|
2
|
-
import { getGeneratedComponentTypesFilename } from "../filenames/types.
|
|
1
|
+
import { stringifyFactoryPropTypes } from "../props/ts.mjs";
|
|
2
|
+
import { getGeneratedComponentTypesFilename } from "../filenames/types.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Add component types
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FactoryGeneratedComponent } from "./types/component.
|
|
2
|
-
import { FactoryIconData } from "./types/data.
|
|
3
|
-
import { ComponentFactoryOptions } from "./types/options.
|
|
4
|
-
import { JSXMode } from "./types/jsx.
|
|
1
|
+
import { FactoryGeneratedComponent } from "./types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "./types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "./types/options.mjs";
|
|
4
|
+
import { JSXMode } from "./types/jsx.mjs";
|
|
5
5
|
interface Options extends ComponentFactoryOptions {
|
|
6
6
|
jsx: JSXMode;
|
|
7
7
|
fallbackPackage?: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getComponentSizeValues } from "./helpers/content/size.
|
|
2
|
-
import { stringifyFactoryIconContent } from "./helpers/content/stringify.
|
|
3
|
-
import { stringifyIconViewBox } from "../svg/viewbox/value.
|
|
4
|
-
import { createFactoryImports } from "./helpers/imports/create.
|
|
5
|
-
import { generateCSSFilesForComponent } from "./helpers/css/generate.
|
|
6
|
-
import { addSizeFunctionAsset } from "./helpers/functions/size.
|
|
7
|
-
import { stringifyFactoryPropsAsJSON } from "./helpers/props/object.
|
|
8
|
-
import { stringifyFactoryImports } from "./helpers/imports/stringify.
|
|
9
|
-
import { makeSquareViewBox } from "../svg/viewbox/square.
|
|
10
|
-
import { getUsedFactoryProps, stringifyFactoryPropTypes } from "./helpers/props/ts.
|
|
11
|
-
import { minifyViewBox } from "../svg/viewbox/minify.
|
|
12
|
-
import { getViewBoxRatio } from "./helpers/content/ratio.
|
|
13
|
-
import { addJSXComponentTypes } from "./helpers/ts/jsx.
|
|
1
|
+
import { getComponentSizeValues } from "./helpers/content/size.mjs";
|
|
2
|
+
import { stringifyFactoryIconContent } from "./helpers/content/stringify.mjs";
|
|
3
|
+
import { stringifyIconViewBox } from "../svg/viewbox/value.mjs";
|
|
4
|
+
import { createFactoryImports } from "./helpers/imports/create.mjs";
|
|
5
|
+
import { generateCSSFilesForComponent } from "./helpers/css/generate.mjs";
|
|
6
|
+
import { addSizeFunctionAsset } from "./helpers/functions/size.mjs";
|
|
7
|
+
import { stringifyFactoryPropsAsJSON } from "./helpers/props/object.mjs";
|
|
8
|
+
import { stringifyFactoryImports } from "./helpers/imports/stringify.mjs";
|
|
9
|
+
import { makeSquareViewBox } from "../svg/viewbox/square.mjs";
|
|
10
|
+
import { getUsedFactoryProps, stringifyFactoryPropTypes } from "./helpers/props/ts.mjs";
|
|
11
|
+
import { minifyViewBox } from "../svg/viewbox/minify.mjs";
|
|
12
|
+
import { getViewBoxRatio } from "./helpers/content/ratio.mjs";
|
|
13
|
+
import { addJSXComponentTypes } from "./helpers/ts/jsx.mjs";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Create functional Vue component code
|
|
@@ -52,7 +52,7 @@ function createJSXComponent(data, options) {
|
|
|
52
52
|
value: "props",
|
|
53
53
|
template: "...props,"
|
|
54
54
|
};
|
|
55
|
-
const getViewBox = (viewBox
|
|
55
|
+
const getViewBox = (viewBox) => isStringViewBox ? `'${stringifyIconViewBox(viewBox)}'` : JSON.stringify(minifyViewBox(viewBox));
|
|
56
56
|
if (hasComputedViewbox) {
|
|
57
57
|
componentExternalCode.push(`const baseViewBox = ${getViewBox(viewBox)};`, `const squareViewBox = ${getViewBox(makeSquareViewBox(viewBox))};`);
|
|
58
58
|
componentInternalCode.push(`const viewBox = useMemo(() => square ? squareViewBox : baseViewBox, [square]);`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GeneratedAssetFile } from "../types/component.
|
|
2
|
-
import { ConvertSVGContentOptions } from "../../svg-css/types.
|
|
3
|
-
import { FactoryIconData } from "../types/data.
|
|
4
|
-
import { GeneratedAssetPath } from "../types/options.
|
|
1
|
+
import { GeneratedAssetFile } from "../types/component.mjs";
|
|
2
|
+
import { ConvertSVGContentOptions } from "../../svg-css/types.mjs";
|
|
3
|
+
import { FactoryIconData } from "../types/data.mjs";
|
|
4
|
+
import { GeneratedAssetPath } from "../types/options.mjs";
|
|
5
5
|
import { IconifyIcon, IconifyJSON } from "@iconify/types";
|
|
6
6
|
interface Options extends ConvertSVGContentOptions {
|
|
7
7
|
fallback?: string | boolean;
|
|
@@ -9,7 +9,7 @@ interface Options extends ConvertSVGContentOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Convert IconifyIcon data to FactoryIconData
|
|
11
11
|
*/
|
|
12
|
-
declare function convertIconifyIconToFactoryContent(icon: IconifyIcon, prefix: string, name: string, options
|
|
12
|
+
declare function convertIconifyIconToFactoryContent(icon: IconifyIcon, prefix: string, name: string, options: Options): FactoryIconData;
|
|
13
13
|
/**
|
|
14
14
|
* Create metadata assets for an icon set
|
|
15
15
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { convertSVGContentToCSSRules } from "../../svg-css/content.
|
|
2
|
-
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.
|
|
3
|
-
import { normaliseIconifyIcon } from "../../iconify/icon/nornalise.
|
|
1
|
+
import { convertSVGContentToCSSRules } from "../../svg-css/content.mjs";
|
|
2
|
+
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.mjs";
|
|
3
|
+
import { normaliseIconifyIcon } from "../../iconify/icon/nornalise.mjs";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Convert IconifyIcon data to FactoryIconData
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.
|
|
2
|
-
import { getFactoryRelativeRootPath } from "../helpers/filenames/path.
|
|
1
|
+
import { getGeneratedAssetFilename } from "../helpers/filenames/asset.mjs";
|
|
2
|
+
import { getFactoryRelativeRootPath } from "../helpers/filenames/path.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate file system options
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FactoryGeneratedComponent } from "./types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "./types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "./types/options.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Create raw component code
|
|
6
|
+
*/
|
|
7
|
+
declare function createRawComponent(data: FactoryIconData, options: ComponentFactoryOptions): FactoryGeneratedComponent;
|
|
8
|
+
export { createRawComponent };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getComponentSizeValues } from "./helpers/content/size.
|
|
2
|
-
import { stringifyFactoryIconContent } from "./helpers/content/stringify.
|
|
3
|
-
import { stringifyIconViewBox } from "../svg/viewbox/value.
|
|
4
|
-
import { createFactoryImports } from "./helpers/imports/create.
|
|
5
|
-
import { generateCSSFilesForComponent } from "./helpers/css/generate.
|
|
6
|
-
import { factoryPropTemplate, stringifyFactoryProps } from "./helpers/props/stringify.
|
|
7
|
-
import { stringifyFactoryImports } from "./helpers/imports/stringify.
|
|
8
|
-
import { getGeneratedComponentTypesFilename } from "./helpers/filenames/types.
|
|
1
|
+
import { getComponentSizeValues } from "./helpers/content/size.mjs";
|
|
2
|
+
import { stringifyFactoryIconContent } from "./helpers/content/stringify.mjs";
|
|
3
|
+
import { stringifyIconViewBox } from "../svg/viewbox/value.mjs";
|
|
4
|
+
import { createFactoryImports } from "./helpers/imports/create.mjs";
|
|
5
|
+
import { generateCSSFilesForComponent } from "./helpers/css/generate.mjs";
|
|
6
|
+
import { factoryPropTemplate, stringifyFactoryProps } from "./helpers/props/stringify.mjs";
|
|
7
|
+
import { stringifyFactoryImports } from "./helpers/imports/stringify.mjs";
|
|
8
|
+
import { getGeneratedComponentTypesFilename } from "./helpers/filenames/types.mjs";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Create raw component code
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FactoryGeneratedComponent } from "./types/component.
|
|
2
|
-
import { FactoryIconData } from "./types/data.
|
|
3
|
-
import { ComponentFactoryOptions } from "./types/options.
|
|
1
|
+
import { FactoryGeneratedComponent } from "./types/component.mjs";
|
|
2
|
+
import { FactoryIconData } from "./types/data.mjs";
|
|
3
|
+
import { ComponentFactoryOptions } from "./types/options.mjs";
|
|
4
4
|
interface SvelteOptions extends ComponentFactoryOptions {
|
|
5
5
|
ts?: boolean;
|
|
6
6
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getComponentSizeValues } from "./helpers/content/size.
|
|
2
|
-
import { stringifyFactoryIconContent } from "./helpers/content/stringify.
|
|
3
|
-
import { stringifyIconViewBox } from "../svg/viewbox/value.
|
|
4
|
-
import { createFactoryImports } from "./helpers/imports/create.
|
|
5
|
-
import { generateCSSFilesForComponent } from "./helpers/css/generate.
|
|
6
|
-
import { addSizeFunctionAsset } from "./helpers/functions/size.
|
|
7
|
-
import { stringifyFactoryProps } from "./helpers/props/stringify.
|
|
8
|
-
import { stringifyFactoryImports } from "./helpers/imports/stringify.
|
|
9
|
-
import { makeSquareViewBox } from "../svg/viewbox/square.
|
|
10
|
-
import { getUsedFactoryProps, stringifyFactoryPropTypes } from "./helpers/props/ts.
|
|
11
|
-
import { minifyViewBox } from "../svg/viewbox/minify.
|
|
12
|
-
import { getViewBoxRatio } from "./helpers/content/ratio.
|
|
13
|
-
import { addSvelteComponentTypes } from "./helpers/ts/svelte.
|
|
1
|
+
import { getComponentSizeValues } from "./helpers/content/size.mjs";
|
|
2
|
+
import { stringifyFactoryIconContent } from "./helpers/content/stringify.mjs";
|
|
3
|
+
import { stringifyIconViewBox } from "../svg/viewbox/value.mjs";
|
|
4
|
+
import { createFactoryImports } from "./helpers/imports/create.mjs";
|
|
5
|
+
import { generateCSSFilesForComponent } from "./helpers/css/generate.mjs";
|
|
6
|
+
import { addSizeFunctionAsset } from "./helpers/functions/size.mjs";
|
|
7
|
+
import { stringifyFactoryProps } from "./helpers/props/stringify.mjs";
|
|
8
|
+
import { stringifyFactoryImports } from "./helpers/imports/stringify.mjs";
|
|
9
|
+
import { makeSquareViewBox } from "../svg/viewbox/square.mjs";
|
|
10
|
+
import { getUsedFactoryProps, stringifyFactoryPropTypes } from "./helpers/props/ts.mjs";
|
|
11
|
+
import { minifyViewBox } from "../svg/viewbox/minify.mjs";
|
|
12
|
+
import { getViewBoxRatio } from "./helpers/content/ratio.mjs";
|
|
13
|
+
import { addSvelteComponentTypes } from "./helpers/ts/svelte.mjs";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Create Svelte component code
|
|
@@ -39,7 +39,7 @@ function createSvelteComponent(data, options) {
|
|
|
39
39
|
const props = {};
|
|
40
40
|
if (!hasFallback) props.xmlns = "http://www.w3.org/2000/svg";
|
|
41
41
|
const viewBoxPropValue = `viewBox${hasComputedViewbox ? "Computed" : ""}`;
|
|
42
|
-
const getViewBox = (viewBox
|
|
42
|
+
const getViewBox = (viewBox) => isStringViewBox ? `'${stringifyIconViewBox(viewBox)}'` : JSON.stringify(minifyViewBox(viewBox));
|
|
43
43
|
if (hasComputedViewbox) componentCode.push(`const baseViewBox = ${getViewBox(viewBox)};`, `const squareViewBox = ${getViewBox(makeSquareViewBox(viewBox))};`, `let ${viewBoxPropValue} = $derived(square ? squareViewBox : baseViewBox);`);
|
|
44
44
|
else componentCode.push(`const ${viewBoxPropValue} = ${getViewBox(viewBox)};`);
|
|
45
45
|
const ratioValue = getViewBoxRatio(viewBox);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UniqueHashPartialOptions } from "../../helpers/hash/types.mjs";
|
|
2
|
+
import { CSSExportMode } from "./css.mjs";
|
|
2
3
|
/**
|
|
3
4
|
* Asset path, generated from configuration
|
|
4
5
|
*/
|
|
@@ -31,5 +32,5 @@ interface ComponentFactoryRenderingOptions {
|
|
|
31
32
|
/**
|
|
32
33
|
* Options for component factory
|
|
33
34
|
*/
|
|
34
|
-
interface ComponentFactoryOptions extends ComponentFactoryFileSystemOptions, ComponentFactoryRenderingOptions {}
|
|
35
|
+
interface ComponentFactoryOptions extends ComponentFactoryFileSystemOptions, ComponentFactoryRenderingOptions, Pick<UniqueHashPartialOptions, 'context'> {}
|
|
35
36
|
export { ComponentFactoryFileSystemOptions, ComponentFactoryOptions, ComponentFactoryRenderingOptions, GeneratedAssetPath };
|