@cyberalien/svg-utils 1.1.2 → 1.1.4
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/css/stylesheet.js +7 -2
- package/package.json +1 -1
package/lib/css/stylesheet.js
CHANGED
|
@@ -36,9 +36,14 @@ function indent(depth) {
|
|
|
36
36
|
*/
|
|
37
37
|
function stringifySelectors(data, depth = 0) {
|
|
38
38
|
const lines = [];
|
|
39
|
-
|
|
39
|
+
const selectors = Object.keys(data);
|
|
40
|
+
selectors.sort((a, b) => a.startsWith("@") ? b.startsWith("@") ? a.localeCompare(b) : 1 : b.startsWith("@") ? -1 : a.localeCompare(b));
|
|
41
|
+
for (const selector of selectors) {
|
|
40
42
|
const item = data[selector];
|
|
41
|
-
if (item.rules)
|
|
43
|
+
if (item.rules) {
|
|
44
|
+
const value = stringifyCSSSelector(selector, item.rules, depth);
|
|
45
|
+
if (value.length) lines.push(value);
|
|
46
|
+
}
|
|
42
47
|
if (item.nested) {
|
|
43
48
|
const nestedContent = stringifySelectors(item.nested, depth + 1);
|
|
44
49
|
if (nestedContent.length) lines.push(`${indent(depth)}${selector} {\n${nestedContent}${indent(depth)}}\n`);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Common functions for working with SVG used by various packages.",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.4",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/cyberalien/svg-utils/issues",
|
|
9
9
|
"homepage": "https://cyberalien.dev/",
|