@cyberalien/svg-utils 1.2.4 → 1.2.5

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.
@@ -29,7 +29,7 @@ function prepareComponentFactoryStatefulIcon(icon, options) {
29
29
  defaultStateValues[stateName] = defaultValue;
30
30
  if (customConfig?.[stateName]) config[stateName] = customConfig[stateName];
31
31
  else {
32
- if (state === "focus") config[stateName] = ".svg-focus-anchor:focus-within, .svg-hover-anchor:hover, &.state-focus";
32
+ if (state === "focus") config[stateName] = `input:not(:disabled):focus-visible, input:not(:disabled):hover, button:not(:disabled):focus-visible, button:not(:disabled):hover, &.state-${stateName}`;
33
33
  else config[stateName] = `&.state-{state}`;
34
34
  supportedStates.add(stateName);
35
35
  supportedStateValues[stateName] = defaultValue;
@@ -16,28 +16,21 @@ function splitSelectorToSubParts(selector) {
16
16
  result.combinator = firstChar;
17
17
  selector = selector.slice(1).trim();
18
18
  }
19
- const pseudoSelectors = selector.split(":");
20
- while (pseudoSelectors.length > 1) {
19
+ const pseudoMatches = selector.matchAll(/:[a-z-]+(\(:[a-z-]+\))*/g);
20
+ for (const match of pseudoMatches) {
21
+ const value = match[0];
22
+ selector = selector.replace(value, "");
21
23
  const list = result.pseudo || /* @__PURE__ */ new Set();
22
24
  if (!result.pseudo) result.pseudo = list;
23
- list.add(":" + pseudoSelectors.pop());
25
+ list.add(value);
24
26
  }
25
- selector = pseudoSelectors[0];
26
- let attrStart = selector.indexOf("[");
27
- while (attrStart !== -1) {
28
- const attrEnd = selector.indexOf("]", attrStart);
29
- let attrValue;
30
- if (attrEnd === -1) {
31
- attrValue = selector.slice(attrStart);
32
- selector = selector.slice(0, attrStart);
33
- } else {
34
- attrValue = selector.slice(attrStart, attrEnd + 1);
35
- selector = selector.slice(0, attrStart) + selector.slice(attrEnd + 1);
36
- }
27
+ const attrMatches = selector.matchAll(/\[[^\]]+\]/g);
28
+ for (const match of attrMatches) {
29
+ const value = match[0];
30
+ selector = selector.replace(value, "");
37
31
  const list = result.attr || /* @__PURE__ */ new Set();
38
32
  if (!result.attr) result.attr = list;
39
- list.add(attrValue);
40
- attrStart = selector.indexOf("[");
33
+ list.add(value);
41
34
  }
42
35
  const tagMatch = selector.match(/^[a-zA-Z][a-zA-Z0-9-]*/);
43
36
  if (tagMatch) {
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.2.4",
6
+ "version": "1.2.5",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/cyberalien/svg-utils/issues",
9
9
  "homepage": "https://cyberalien.dev/",