@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
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { getComponentSizeValues } from "./helpers/content/size.js";
|
|
2
|
+
import { stringifyFactoryIconContent } from "./helpers/content/stringify.js";
|
|
3
|
+
import { stringifyIconViewBox } from "../svg/viewbox/value.js";
|
|
4
|
+
import { createFactoryImports } from "./helpers/imports/create.js";
|
|
5
|
+
import { generateCSSFilesForComponent } from "./helpers/css/generate.js";
|
|
6
|
+
import { addSizeFunctionAsset } from "./helpers/functions/size.js";
|
|
7
|
+
import { stringifyFactoryProps } from "./helpers/props/stringify.js";
|
|
8
|
+
import { stringifyFactoryImports } from "./helpers/imports/stringify.js";
|
|
9
|
+
import { makeSquareViewBox } from "../svg/viewbox/square.js";
|
|
10
|
+
import { getUsedFactoryProps, stringifyFactoryPropTypes } from "./helpers/props/ts.js";
|
|
11
|
+
import { minifyViewBox } from "../svg/viewbox/minify.js";
|
|
12
|
+
import { getViewBoxRatio } from "./helpers/content/ratio.js";
|
|
13
|
+
import { addCustomFunctionAsset } from "./helpers/functions/custom.js";
|
|
14
|
+
import { addFallbackFunctionAsset } from "./helpers/functions/fallback.js";
|
|
15
|
+
import { addSolidComponentTypes } from "./helpers/ts/solid.js";
|
|
16
|
+
/**
|
|
17
|
+
* Create Solid component code
|
|
18
|
+
*/
|
|
19
|
+
function createSolidComponent(data, options) {
|
|
20
|
+
const icon = data.icon;
|
|
21
|
+
const viewBox = icon.viewBox;
|
|
22
|
+
const fallback = icon.defaultFallback;
|
|
23
|
+
const statefulData = icon.statefulData;
|
|
24
|
+
const useTS = options.ts ?? false;
|
|
25
|
+
const assets = [];
|
|
26
|
+
const imports = createFactoryImports();
|
|
27
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
28
|
+
if (fallback) {
|
|
29
|
+
imports.named["@iconify/css-solid"] = new Set(["Icon"]);
|
|
30
|
+
dependencies.add("@iconify/css-solid");
|
|
31
|
+
}
|
|
32
|
+
const solidNamedImports = /* @__PURE__ */ new Set([]);
|
|
33
|
+
imports.named["solid-js"] = solidNamedImports;
|
|
34
|
+
const style = generateCSSFilesForComponent(icon, imports, assets, options);
|
|
35
|
+
const isEmbeddedCSS = options.cssMode === "embed";
|
|
36
|
+
let hasFixedSize = !!options.width && !!options.height;
|
|
37
|
+
const hasComputedViewbox = options.square && !hasFixedSize && viewBox.width !== viewBox.height;
|
|
38
|
+
const isStringViewBox = !fallback;
|
|
39
|
+
const hasComputedRatio = hasComputedViewbox && isStringViewBox;
|
|
40
|
+
if (!hasComputedViewbox && (options.width || options.height)) hasFixedSize = true;
|
|
41
|
+
const componentExternalCode = [];
|
|
42
|
+
const componentInternalCode = [];
|
|
43
|
+
const props = {};
|
|
44
|
+
if (!fallback) props.xmlns = "http://www.w3.org/2000/svg";
|
|
45
|
+
let computedFallback = false;
|
|
46
|
+
if (statefulData) {
|
|
47
|
+
const { supportedStates, allStates } = statefulData;
|
|
48
|
+
if (supportedStates.size) {
|
|
49
|
+
const computedStates = [];
|
|
50
|
+
let addedStateFunc = false;
|
|
51
|
+
for (const state of allStates) if (typeof state === "string") {
|
|
52
|
+
if (supportedStates.has(state)) {
|
|
53
|
+
props[state] = {
|
|
54
|
+
type: "boolean",
|
|
55
|
+
value: state,
|
|
56
|
+
template: ""
|
|
57
|
+
};
|
|
58
|
+
computedStates.push(`'${state}': local['${state}']`);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
const stateName = state[0];
|
|
62
|
+
if (supportedStates.has(stateName)) {
|
|
63
|
+
const stateValues = state[1];
|
|
64
|
+
const defaultStateValue = state[2] ?? stateValues[0];
|
|
65
|
+
props[stateName] = {
|
|
66
|
+
type: stateValues.map((value) => `'${value}'`).join(" | "),
|
|
67
|
+
value: stateName,
|
|
68
|
+
template: ""
|
|
69
|
+
};
|
|
70
|
+
computedStates.push(`'${stateName}': namedStateValue(local['${stateName}'], '${defaultStateValue}')`);
|
|
71
|
+
if (!addedStateFunc) {
|
|
72
|
+
addedStateFunc = true;
|
|
73
|
+
addCustomFunctionAsset(imports, assets, options, {
|
|
74
|
+
functionName: "namedStateValue",
|
|
75
|
+
content: `export function namedStateValue(value, defaultValue) {
|
|
76
|
+
return value && value !== defaultValue ? value : undefined;
|
|
77
|
+
}`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (computedStates.length) {
|
|
83
|
+
componentInternalCode.push(`const states = createMemo(() => ({ ${computedStates.join(", ")} }));`);
|
|
84
|
+
if (fallback && statefulData.fallback) {
|
|
85
|
+
computedFallback = true;
|
|
86
|
+
const func = addFallbackFunctionAsset(imports, assets, options, statefulData.defaultStateValues);
|
|
87
|
+
componentInternalCode.push(`const fallback = createMemo(() => ${func}(${JSON.stringify(statefulData.fallback)},states()));`);
|
|
88
|
+
}
|
|
89
|
+
componentInternalCode.push(`const className = createMemo(() => Object.entries(states()).map(([key, value]) => value ? \`state-\${value === true ? key : value}\` : '').join(' ').trim() || undefined);`);
|
|
90
|
+
props.class = {
|
|
91
|
+
value: "className",
|
|
92
|
+
template: "class={className()}"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const getViewBox = (viewBox) => isStringViewBox ? `'${stringifyIconViewBox(viewBox)}'` : JSON.stringify(minifyViewBox(viewBox));
|
|
98
|
+
if (hasComputedViewbox) {
|
|
99
|
+
componentExternalCode.push(`const baseViewBox = ${getViewBox(viewBox)};`, `const squareViewBox = ${getViewBox(makeSquareViewBox(viewBox))};`);
|
|
100
|
+
componentInternalCode.push(`const viewBox = createMemo(() => local.square ? squareViewBox : baseViewBox);`);
|
|
101
|
+
} else componentExternalCode.push(`const viewBox = ${getViewBox(viewBox)};`);
|
|
102
|
+
const ratioValue = getViewBoxRatio(viewBox);
|
|
103
|
+
if (hasComputedRatio) componentInternalCode.push(`const ratio = createMemo(() => local.square ? 1 : ${ratioValue});`);
|
|
104
|
+
if (hasFixedSize) {
|
|
105
|
+
const sizeProps = getComponentSizeValues(options, viewBox);
|
|
106
|
+
if (!sizeProps) throw new Error("Fixed size expected, but could not be determined");
|
|
107
|
+
props.width = sizeProps.width;
|
|
108
|
+
props.height = sizeProps.height;
|
|
109
|
+
} else if (fallback) {
|
|
110
|
+
props.width = {
|
|
111
|
+
type: "string",
|
|
112
|
+
value: "width",
|
|
113
|
+
template: "width={local.width}"
|
|
114
|
+
};
|
|
115
|
+
props.height = {
|
|
116
|
+
type: "string",
|
|
117
|
+
value: "height",
|
|
118
|
+
template: "height={local.height}"
|
|
119
|
+
};
|
|
120
|
+
} else {
|
|
121
|
+
const getSizeProps = addSizeFunctionAsset(imports, assets, options);
|
|
122
|
+
componentInternalCode.push(`const size = createMemo(() => ${getSizeProps}(local.width, local.height, ${hasComputedRatio ? "ratio()" : ratioValue}));`);
|
|
123
|
+
props.width = {
|
|
124
|
+
type: "string",
|
|
125
|
+
value: "width",
|
|
126
|
+
template: "{...size()}"
|
|
127
|
+
};
|
|
128
|
+
props.height = {
|
|
129
|
+
type: "string",
|
|
130
|
+
value: "height",
|
|
131
|
+
template: ""
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (componentInternalCode.some((line) => line.includes("createMemo"))) solidNamedImports.add("createMemo");
|
|
135
|
+
if (options.square) props.square = { type: "boolean" };
|
|
136
|
+
props.viewBox = {
|
|
137
|
+
value: "viewBox",
|
|
138
|
+
template: `viewBox={viewBox${hasComputedViewbox ? "()" : ""}}`
|
|
139
|
+
};
|
|
140
|
+
componentExternalCode.push(`const content = ${stringifyFactoryIconContent(icon, isEmbeddedCSS ? style : void 0)};`);
|
|
141
|
+
props.content = {
|
|
142
|
+
value: "content",
|
|
143
|
+
template: fallback ? `content={content} fallback={${computedFallback ? "fallback()" : `"${fallback}"`}}` : "innerHTML={content}"
|
|
144
|
+
};
|
|
145
|
+
const usedProps = getUsedFactoryProps(props);
|
|
146
|
+
if (usedProps.length) {
|
|
147
|
+
componentInternalCode.unshift(`const [local, others] = splitProps(props, ${JSON.stringify(usedProps)});\n`);
|
|
148
|
+
solidNamedImports.add("splitProps");
|
|
149
|
+
}
|
|
150
|
+
const template = `<${fallback ? "Icon" : "svg"} ${stringifyFactoryProps(props, "{prop}={{value}}")} {...${usedProps.length ? "others" : "props"}} />`;
|
|
151
|
+
componentInternalCode.push(`return (${template});`);
|
|
152
|
+
const beforeFunction = componentExternalCode.length ? componentExternalCode.join("\n") + "\n\n" : "";
|
|
153
|
+
const propTypes = stringifyFactoryPropTypes(props);
|
|
154
|
+
const componentFunction = `${useTS ? `interface Props {\n${propTypes}\n};\n\n` : propTypes ? `/** @param props {{${propTypes.replace(/\s*\n\s*/g, " ").trim()}}} */\n` : ""}function Component(props${useTS ? `: Props` : ""}) {
|
|
155
|
+
\t${componentInternalCode.join("\n ")}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
const content = `${stringifyFactoryImports(imports)}\n${beforeFunction}${componentFunction}\nexport default Component;\n`;
|
|
159
|
+
const types = addSolidComponentTypes(data, options, assets, props);
|
|
160
|
+
return {
|
|
161
|
+
assets,
|
|
162
|
+
content,
|
|
163
|
+
style: isEmbeddedCSS ? void 0 : style,
|
|
164
|
+
types,
|
|
165
|
+
dependencies: dependencies.size ? dependencies : void 0
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
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
|
*/
|
|
@@ -167,5 +166,4 @@ ${template}
|
|
|
167
166
|
dependencies: dependencies.size ? dependencies : void 0
|
|
168
167
|
};
|
|
169
168
|
}
|
|
170
|
-
|
|
171
|
-
export { createSvelteComponent };
|
|
169
|
+
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 {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -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 { addVueComponentTypes } from "./helpers/ts/vue.js";
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Create functional Vue component code
|
|
19
18
|
*/
|
|
@@ -161,5 +160,4 @@ function createVueFunctionalComponent(data, options) {
|
|
|
161
160
|
dependencies: dependencies.size ? dependencies : void 0
|
|
162
161
|
};
|
|
163
162
|
}
|
|
164
|
-
|
|
165
|
-
export { createVueFunctionalComponent };
|
|
163
|
+
export { createVueFunctionalComponent };
|
package/lib/components/vue.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 { addVueComponentTypes } from "./helpers/ts/vue.js";
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Create Vue component code
|
|
20
19
|
*/
|
|
@@ -163,5 +162,4 @@ ${template}
|
|
|
163
162
|
dependencies: dependencies.size ? dependencies : void 0
|
|
164
163
|
};
|
|
165
164
|
}
|
|
166
|
-
|
|
167
|
-
export { createVueComponent };
|
|
165
|
+
export { createVueComponent };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { findCSSPropertyValues } from "./prop.js";
|
|
2
|
-
|
|
3
2
|
const reservedAnimationNames = new Set([
|
|
4
3
|
"none",
|
|
5
4
|
"inherit",
|
|
@@ -31,5 +30,4 @@ function findUsedKeyframes(content) {
|
|
|
31
30
|
});
|
|
32
31
|
return Array.from(keyframes);
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
export { findUsedKeyframes };
|
|
33
|
+
export { findUsedKeyframes };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { splitClassName } from "../../classname/toggle.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Find class names in content
|
|
5
4
|
*/
|
|
@@ -10,5 +9,4 @@ function findUsedClassNames(content) {
|
|
|
10
9
|
});
|
|
11
10
|
return Array.from(classNames);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
export { findUsedClassNames };
|
|
12
|
+
export { findUsedClassNames };
|
package/lib/css/find/prop.js
CHANGED
package/lib/css/hash.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { sortObject } from "../helpers/misc/sort-object.js";
|
|
2
2
|
import { getUniqueHash } from "../helpers/hash/unique.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Get class name for CSS rules
|
|
6
5
|
*/
|
|
@@ -11,5 +10,4 @@ function createCSSClassName(rules, options) {
|
|
|
11
10
|
...options
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
export { createCSSClassName };
|
|
13
|
+
export { createCSSClassName };
|
package/lib/css/minify.js
CHANGED
package/lib/css/rules.js
CHANGED
package/lib/css/stringify.js
CHANGED
|
@@ -50,5 +50,4 @@ function stringifyCSSKeyframes(animationName, keyframes, depth = 0) {
|
|
|
50
50
|
if (content.includes("@keyframes")) return content;
|
|
51
51
|
return `${indent(depth)}@keyframes ${animationName} {\n${indent(depth + 1)}${content}\n}\n`;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
export { stringifyCSSAnimationFrames, stringifyCSSKeyframes, stringifyCSSRules, stringifyCSSSelector };
|
|
53
|
+
export { stringifyCSSAnimationFrames, stringifyCSSKeyframes, stringifyCSSRules, stringifyCSSSelector };
|
package/lib/css/stylesheet.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { stringifyCSSKeyframes, stringifyCSSSelector } from "./stringify.js";
|
|
2
2
|
import { mergeCSSRules } from "./rules.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Create empty stylesheet
|
|
6
5
|
*/
|
|
@@ -65,5 +64,4 @@ function stringifyStylesheet(stylesheet) {
|
|
|
65
64
|
}
|
|
66
65
|
return lines.join("\n");
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
export { addGeneratedSelector, createEmptyStylesheet, stringifyStylesheet };
|
|
67
|
+
export { addGeneratedSelector, createEmptyStylesheet, stringifyStylesheet };
|
package/lib/css/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/lib/helpers/hash/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { sortObject } from "../misc/sort-object.js";
|
|
2
2
|
import { hashToString } from "./stringify.js";
|
|
3
3
|
import { hashString } from "./hash.js";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Hash an object, make sure hash is unique
|
|
7
6
|
*
|
|
@@ -35,5 +34,4 @@ function getUniqueHash(data, options) {
|
|
|
35
34
|
}
|
|
36
35
|
return result;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
export { getUniqueHash };
|
|
37
|
+
export { getUniqueHash };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { sortObject } from "./sort-object.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Compare sets, returns true if identical
|
|
5
4
|
*/
|
|
@@ -15,5 +14,4 @@ function compareSets(set1, set2) {
|
|
|
15
14
|
function compareValues(value1, value2) {
|
|
16
15
|
return value1 === value2 || JSON.stringify(sortObject(value1)) === JSON.stringify(sortObject(value2));
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
export { compareSets, compareValues };
|
|
17
|
+
export { compareSets, compareValues };
|
package/lib/helpers/misc/keys.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { sortObject } from "./sort-object.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Compare keys, return true on match
|
|
5
4
|
*/
|
|
@@ -8,5 +7,4 @@ function compareKeys(key1, key2) {
|
|
|
8
7
|
if (typeof key1 !== "object" || typeof key2 !== "object" || !key1 || !key2) return false;
|
|
9
8
|
return JSON.stringify(sortObject(key1)) === JSON.stringify(sortObject(key2));
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
export { compareKeys };
|
|
10
|
+
export { compareKeys };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { compareKeys } from "./keys.js";
|
|
2
|
-
|
|
3
2
|
let cache = [];
|
|
4
3
|
/**
|
|
5
4
|
* Make sure multiple instances of Promise or callback are not ran at the same time
|
|
@@ -46,5 +45,4 @@ function uniquePromise(key, callback) {
|
|
|
46
45
|
else done(true, cb);
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
export { uniquePromise };
|
|
48
|
+
export { uniquePromise };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { wrapSVGContent } from "../../svg/content/defs.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Normalise icon: apply transformations
|
|
5
4
|
*/
|
|
@@ -59,5 +58,4 @@ function normaliseIconifyIcon(data) {
|
|
|
59
58
|
viewBox
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
export { normaliseIconifyIcon };
|
|
61
|
+
export { normaliseIconifyIcon };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getIconifyIconSetDefaults } from "./defaults.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Get icon data from Iconify icon set
|
|
5
4
|
*/
|
|
@@ -20,5 +19,4 @@ function getIconifyIconSetIcon(data, name) {
|
|
|
20
19
|
} : null;
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
export { getIconifyIconSetIcon };
|
|
22
|
+
export { getIconifyIconSetIcon };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getIconifyIconSetDefaults } from "./defaults.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Parse Iconify icon set and call callback for each icon
|
|
5
4
|
*/
|
|
@@ -27,5 +26,4 @@ function parseIconifyIconSet(data, callback) {
|
|
|
27
26
|
}
|
|
28
27
|
if (data.not_found) for (const name of data.not_found) callback(name, null);
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
export { parseIconifyIconSet };
|
|
29
|
+
export { parseIconifyIconSet };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/lib/index.js
CHANGED
|
@@ -31,5 +31,4 @@ import { getObjectFromStates } from "./svg-css/states/object.js";
|
|
|
31
31
|
import { getSVGCSSIconFromIconSet } from "./svg-css/icon-set/get.js";
|
|
32
32
|
import { addIconToSVGCSSIconSet } from "./svg-css/icon-set/add.js";
|
|
33
33
|
import { createEmptySVGCSSIconSet } from "./svg-css/icon-set/create.js";
|
|
34
|
-
|
|
35
|
-
export { addGeneratedSelector, addIconToSVGCSSIconSet, changeIDInString, changeSVGIDs, classProps, cloneObject, compareKeys, compareSets, compareValues, convertSVGContentToCSSRules, convertSVGRootToCSS, createCSSClassName, createEmptySVGCSSIconSet, createEmptyStylesheet, createUniqueHashContext, createUniqueIDs, defaultClassProp, getAdvancedStateDefaultValue, getIconFallback, getObjectFromStates, getSVGCSSIconFromIconSet, getStateValue, getStatesFromKey, getUniqueHash, hashString, hashToString, iterateXMLContent, mergeCSSRules, minifyCSS, parseXMLContent, removeDuplicateIDs, removeUnusedIDs, sortObject, splitCSSRules, splitClassName, stringifyCSSAnimationFrames, stringifyCSSKeyframes, stringifyCSSRules, stringifyCSSSelector, stringifyStylesheet, stringifyXMLContent, toggleClassName, uniquePromise };
|
|
34
|
+
export { addGeneratedSelector, addIconToSVGCSSIconSet, changeIDInString, changeSVGIDs, classProps, cloneObject, compareKeys, compareSets, compareValues, convertSVGContentToCSSRules, convertSVGRootToCSS, createCSSClassName, createEmptySVGCSSIconSet, createEmptyStylesheet, createUniqueHashContext, createUniqueIDs, defaultClassProp, getAdvancedStateDefaultValue, getIconFallback, getObjectFromStates, getSVGCSSIconFromIconSet, getStateValue, getStatesFromKey, getUniqueHash, hashString, hashToString, iterateXMLContent, mergeCSSRules, minifyCSS, parseXMLContent, removeDuplicateIDs, removeUnusedIDs, sortObject, splitCSSRules, splitClassName, stringifyCSSAnimationFrames, stringifyCSSKeyframes, stringifyCSSRules, stringifyCSSSelector, stringifyStylesheet, stringifyXMLContent, toggleClassName, uniquePromise };
|
package/lib/svg/content/defs.js
CHANGED
|
@@ -40,5 +40,4 @@ function wrapSVGContent(body, start, end) {
|
|
|
40
40
|
const split = splitSVGDefs(body);
|
|
41
41
|
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
export { mergeDefsAndContent, splitSVGDefs, wrapSVGContent };
|
|
43
|
+
export { mergeDefsAndContent, splitSVGDefs, wrapSVGContent };
|
package/lib/svg/ids/change.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { iterateXMLContent } from "../../xml/iterate.js";
|
|
2
2
|
import { stringifyXMLContent } from "../../xml/stringify.js";
|
|
3
3
|
import { changeIDInString } from "./string.js";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Change IDs in SVG using a callback function
|
|
7
6
|
*/
|
|
@@ -113,5 +112,4 @@ function changeSVGIDs(root, callback) {
|
|
|
113
112
|
}
|
|
114
113
|
return results;
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
export { changeSVGIDs };
|
|
115
|
+
export { changeSVGIDs };
|
package/lib/svg/ids/duplicate.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { iterateXMLContent } from "../../xml/iterate.js";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Remove duplicate IDs from SVG
|
|
5
4
|
*/
|
|
@@ -18,5 +17,4 @@ function removeDuplicateIDs(root, data) {
|
|
|
18
17
|
}
|
|
19
18
|
return root;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
export { removeDuplicateIDs };
|
|
20
|
+
export { removeDuplicateIDs };
|
package/lib/svg/ids/string.js
CHANGED
|
@@ -5,5 +5,4 @@ function changeIDInString(value, oldID, newID) {
|
|
|
5
5
|
const escapedID = oldID.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
6
6
|
return value.replace(new RegExp("([#;\"])(" + escapedID + ")([\")]|\\.[a-z])", "g"), "$1" + newID + "$3");
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
export { changeIDInString };
|
|
8
|
+
export { changeIDInString };
|
package/lib/svg/ids/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/lib/svg/ids/unique.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getUniqueHash } from "../../helpers/hash/unique.js";
|
|
2
2
|
import { changeSVGIDs } from "./change.js";
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Create unique IDs for SVG elements
|
|
6
5
|
*/
|
|
@@ -12,5 +11,4 @@ function createUniqueIDs(root, options) {
|
|
|
12
11
|
...options
|
|
13
12
|
}));
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
export { createUniqueIDs };
|
|
14
|
+
export { createUniqueIDs };
|
package/lib/svg/ids/unused.js
CHANGED
package/lib/svg/props/size.js
CHANGED
package/lib/svg/viewbox/parse.js
CHANGED