@symbo.ls/scratch 2.27.0 → 2.27.10

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.
@@ -25,6 +25,11 @@ __export(sprite_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(sprite_exports);
27
27
 
28
+ // ../../../domql/packages/utils/dist/esm/env.js
29
+ var NODE_ENV = "development";
30
+ var isProduction = (env = NODE_ENV) => env === "production";
31
+ var isNotProduction = (env = NODE_ENV) => !isProduction(env);
32
+
28
33
  // ../../../domql/packages/utils/dist/esm/globals.js
29
34
  var window2 = globalThis;
30
35
  var document2 = window2.document;
@@ -40,8 +45,7 @@ var isFunction = (arg) => typeof arg === "function";
40
45
  var isNull = (arg) => arg === null;
41
46
  var isArray = (arg) => Array.isArray(arg);
42
47
  var isObjectLike = (arg) => {
43
- if (arg === null)
44
- return false;
48
+ if (arg === null) return false;
45
49
  return typeof arg === "object";
46
50
  };
47
51
  var isUndefined = (arg) => {
@@ -109,8 +113,7 @@ var deepClone = (obj, options = {}) => {
109
113
  const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
110
114
  visited.set(obj, clone2);
111
115
  for (const key in obj) {
112
- if (!Object.prototype.hasOwnProperty.call(obj, key))
113
- continue;
116
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
114
117
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
115
118
  continue;
116
119
  const value = obj[key];
@@ -364,16 +367,13 @@ var getActiveConfig = (def) => {
364
367
  };
365
368
 
366
369
  // src/utils/sprite.js
367
- var ENV = "development";
368
- var isDev = ENV === "development" || ENV === "testing";
370
+ var isDev = isNotProduction();
369
371
  var generateSprite = (icons) => {
370
372
  const CONFIG2 = getActiveConfig();
371
373
  let sprite = "";
372
374
  for (const key in icons) {
373
- if (CONFIG2.__svg_cache[key])
374
- continue;
375
- else
376
- CONFIG2.__svg_cache[key] = true;
375
+ if (CONFIG2.__svg_cache[key]) continue;
376
+ else CONFIG2.__svg_cache[key] = true;
377
377
  sprite += icons[key];
378
378
  }
379
379
  return sprite;
@@ -381,8 +381,7 @@ var generateSprite = (icons) => {
381
381
  var parseRootAttributes = (htmlString) => {
382
382
  const val = htmlString.default || htmlString;
383
383
  if (!isString(val)) {
384
- if (isDev)
385
- console.warn("parseRootAttributes:", val, "is not a string");
384
+ if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
386
385
  return;
387
386
  }
388
387
  const match = val.match(/<svg\s+(.*?)>/);
@@ -390,7 +389,9 @@ var parseRootAttributes = (htmlString) => {
390
389
  return {};
391
390
  }
392
391
  const attrString = match[1];
393
- const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
392
+ const attrs = attrString.match(
393
+ /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
394
+ );
394
395
  return attrs.reduce((acc, attr) => {
395
396
  const [key, value] = attr.split("=");
396
397
  acc[key] = value.replace(/['"]/g, "");
@@ -425,3 +426,4 @@ var convertSvgToSymbol = (key, code) => {
425
426
  symbol = symbol.replace("</svg", "</symbol");
426
427
  return symbol;
427
428
  };
429
+ // @preserve-env
@@ -24,11 +24,8 @@ __export(theme_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(theme_exports);
26
26
  var returnSubThemeOrDefault = (orig, theme) => {
27
- if (!orig)
28
- return;
29
- if (orig.themes && orig.themes[theme])
30
- return orig.themes[theme];
31
- if (orig[theme])
32
- return [orig, orig[theme]];
27
+ if (!orig) return;
28
+ if (orig.themes && orig.themes[theme]) return orig.themes[theme];
29
+ if (orig[theme]) return [orig, orig[theme]];
33
30
  return orig;
34
31
  };
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
51
51
  return to;
52
52
  };
53
53
  var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
- var src_exports = {};
55
- __export2(src_exports, {
54
+ var index_exports = {};
55
+ __export2(index_exports, {
56
56
  arrayzeValue: () => arrayzeValue,
57
57
  copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
58
58
  copyStringToClipboard: () => copyStringToClipboard,
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
73
73
  toTitleCase: () => toTitleCase,
74
74
  toggleFullscreen: () => toggleFullscreen
75
75
  });
76
- module2.exports = __toCommonJS2(src_exports);
76
+ module2.exports = __toCommonJS2(index_exports);
77
77
  var window22 = globalThis;
78
78
  var document22 = window22.document;
79
79
  var isObject2 = (arg) => {
80
- if (arg === null)
81
- return false;
80
+ if (arg === null) return false;
82
81
  return typeof arg === "object" && arg.constructor === Object;
83
82
  };
84
83
  var isString2 = (arg) => typeof arg === "string";
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
103
102
  };
104
103
  var findClosestNumberInFactory = (val, factory) => {
105
104
  val = parseFloat(val);
106
- if (isObject2(factory))
107
- factory = Object.values(factory);
105
+ if (isObject2(factory)) factory = Object.values(factory);
108
106
  return findClosestNumber(val, factory);
109
107
  };
110
108
  var formatDate = (timestamp) => {
111
- if (!timestamp)
112
- return "";
109
+ if (!timestamp) return "";
113
110
  const d = new Date(timestamp);
114
111
  const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
115
112
  const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
176
173
  scriptEle.type = type;
177
174
  scriptEle.text = xhr.responseText;
178
175
  doc.body.appendChild(scriptEle);
179
- if (typeof fallback === "function")
180
- fallback();
176
+ if (typeof fallback === "function") fallback();
181
177
  } else {
182
178
  throw new Error(`Failed to load the script ${FILE_URL}`);
183
179
  }
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
245
241
  );
246
242
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
247
243
  var toDescriptionCase = (str = "") => {
248
- if (typeof str !== "string")
249
- return;
244
+ if (typeof str !== "string") return;
250
245
  const result = str.replace(/([A-Z])/g, " $1");
251
246
  return result.charAt(0).toUpperCase() + result.slice(1);
252
247
  };
253
248
  var arrayzeValue = (val) => {
254
- if (isArray2(val))
255
- return val;
256
- if (isString2(val))
257
- return val.split(" ");
258
- if (isObject2(val))
259
- return Object.values(val);
260
- if (isNumber2(val))
261
- return [val];
249
+ if (isArray2(val)) return val;
250
+ if (isString2(val)) return val.split(" ");
251
+ if (isObject2(val)) return Object.values(val);
252
+ if (isNumber2(val)) return [val];
262
253
  };
263
254
  }
264
255
  });
@@ -287,8 +278,7 @@ var isFunction = (arg) => typeof arg === "function";
287
278
  var isNull = (arg) => arg === null;
288
279
  var isArray = (arg) => Array.isArray(arg);
289
280
  var isObjectLike = (arg) => {
290
- if (arg === null)
291
- return false;
281
+ if (arg === null) return false;
292
282
  return typeof arg === "object";
293
283
  };
294
284
  var isUndefined = (arg) => {
@@ -356,8 +346,7 @@ var deepClone = (obj, options = {}) => {
356
346
  const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
357
347
  visited.set(obj, clone2);
358
348
  for (const key in obj) {
359
- if (!Object.prototype.hasOwnProperty.call(obj, key))
360
- continue;
349
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
361
350
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
362
351
  continue;
363
352
  const value = obj[key];
@@ -687,24 +676,21 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
687
676
  const { mediaRegenerate } = FACTORY2;
688
677
  const { sequence, scales } = FACTORY2[media];
689
678
  const query = MEDIA2[mediaName];
690
- if (!query && CONFIG2.verbose)
691
- console.warn("Can't find media query ", query);
679
+ if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
692
680
  if (!mediaRegenerate) {
693
681
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
694
- if (!underMediaQuery)
695
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
682
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
696
683
  applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
697
684
  return;
698
685
  }
699
686
  for (const key in sequence) {
700
687
  const item = sequence[key];
701
688
  const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
702
- if (!query && CONFIG2.verbose)
703
- console.warn("Can't find query ", query);
689
+ if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
704
690
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
705
- if (!underMediaQuery)
706
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
691
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
707
692
  underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
708
693
  CSS_VARS2[item.variable + "_" + mediaName] = value;
709
694
  }
710
695
  };
696
+ // @preserve-env
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "2.27.0",
5
+ "version": "2.27.10",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -18,16 +18,16 @@
18
18
  "publishConfig": {},
19
19
  "scripts": {
20
20
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
21
- "build:esm": "npx esbuild ./src/*.js ./src/**/*.js --target=es2017 --format=esm --outdir=dist/esm",
22
- "build:cjs": "npx esbuild ./src/*.js ./src/**/*.js --target=node16 --format=cjs --outdir=dist/cjs --bundle",
23
- "build:iife": "npx esbuild ./src/index.js --target=es2017 --format=iife --outdir=dist/iife --bundle --minify",
21
+ "build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/*.js ./src/**/*.js --target=es2017 --format=esm --outdir=dist/esm",
22
+ "build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/*.js ./src/**/*.js --target=node16 --format=cjs --outdir=dist/cjs --bundle",
23
+ "build:iife": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild ./src/index.js --target=es2017 --format=iife --outdir=dist/iife --bundle --minify",
24
24
  "build": "npm run build:cjs",
25
25
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
26
26
  },
27
27
  "dependencies": {
28
- "@domql/utils": "^2.27.0",
29
- "@symbo.ls/utils": "^2.27.0",
28
+ "@domql/utils": "^2.27.10",
29
+ "@symbo.ls/utils": "^2.27.10",
30
30
  "color-contrast-checker": "^1.5.0"
31
31
  },
32
- "gitHead": "40a924693178a7d7b9e94aac0282b9d31602eca7"
32
+ "gitHead": "668d24f518bdb163357897504c5912c085638d3e"
33
33
  }
@@ -23,15 +23,7 @@ export const runThroughMedia = FACTORY => {
23
23
  const { mediaRegenerate } = FACTORY
24
24
  const mediaName = prop.slice(1)
25
25
 
26
- const {
27
- type,
28
- base,
29
- ratio,
30
- range,
31
- subSequence,
32
- h1Matches,
33
- unit
34
- } = FACTORY
26
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY
35
27
 
36
28
  merge(mediaValue, {
37
29
  type,
@@ -44,7 +36,8 @@ export const runThroughMedia = FACTORY => {
44
36
  })
45
37
 
46
38
  const query = MEDIA[mediaName]
47
- const media = '@media ' + (query === 'print' ? `${query}` : `screen and ${query}`)
39
+ const media =
40
+ '@media ' + (query === 'print' ? `${query}` : `screen and ${query}`)
48
41
  TYPOGRAPHY.templates[media] = {
49
42
  fontSize: mediaValue.base / TYPOGRAPHY.browserDefault + unit
50
43
  }
@@ -67,7 +60,7 @@ export const runThroughMedia = FACTORY => {
67
60
  }
68
61
  }
69
62
 
70
- export const applyHeadings = (props) => {
63
+ export const applyHeadings = props => {
71
64
  const CONFIG = getActiveConfig()
72
65
  if (props.h1Matches) {
73
66
  const unit = props.unit
@@ -76,13 +69,16 @@ export const applyHeadings = (props) => {
76
69
  for (const k in HEADINGS) {
77
70
  const headerName = `h${parseInt(k) + 1}`
78
71
  const headerStyle = templates[headerName]
79
- if (!HEADINGS[k]) continue
80
72
  templates[headerName] = {
81
- fontSize: CONFIG.useVariable ? `var(${HEADINGS[k]?.variable})` : `${HEADINGS[k].scaling}${unit}`,
73
+ fontSize: CONFIG.useVariable
74
+ ? `var(${HEADINGS[k]?.variable})`
75
+ : `${HEADINGS[k]?.scaling}${unit}`,
82
76
  margin: headerStyle ? headerStyle.margin : 0,
83
77
  lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
84
- letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
85
- fontWeight: headerStyle ? headerStyle.fontWeight : 900 - (k * 100)
78
+ letterSpacing: headerStyle
79
+ ? headerStyle.letterSpacing
80
+ : props.letterSpacing,
81
+ fontWeight: headerStyle ? headerStyle.fontWeight : 900 - k * 100
86
82
  }
87
83
  }
88
84
  }
@@ -101,9 +97,5 @@ export const applyTypographySequence = () => {
101
97
  export const getFontSizeByKey = value => {
102
98
  const CONFIG = getActiveConfig()
103
99
  const { TYPOGRAPHY } = CONFIG
104
- return getSequenceValuePropertyPair(
105
- value,
106
- 'fontSize',
107
- TYPOGRAPHY
108
- )
100
+ return getSequenceValuePropertyPair(value, 'fontSize', TYPOGRAPHY)
109
101
  }
@@ -1,7 +1,12 @@
1
1
  'use strict'
2
2
 
3
- import { document, window, isString, isNumber } from '@domql/utils'
4
- const ENV = process.env.NODE_ENV
3
+ import {
4
+ document,
5
+ window,
6
+ isString,
7
+ isNumber,
8
+ isNotProduction
9
+ } from '@domql/utils'
5
10
 
6
11
  export const colorStringToRgbaArray = color => {
7
12
  if (color === '') return [0, 0, 0, 0]
@@ -10,11 +15,22 @@ export const colorStringToRgbaArray = color => {
10
15
  // convert #RGB and #RGBA to #RRGGBB and #RRGGBBAA
11
16
  if (color[0] === '#') {
12
17
  if (color.length < 7) {
13
- color = '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : '')
14
- } return [parseInt(color.substr(1, 2), 16),
18
+ color =
19
+ '#' +
20
+ color[1] +
21
+ color[1] +
22
+ color[2] +
23
+ color[2] +
24
+ color[3] +
25
+ color[3] +
26
+ (color.length > 4 ? color[4] + color[4] : '')
27
+ }
28
+ return [
29
+ parseInt(color.substr(1, 2), 16),
15
30
  parseInt(color.substr(3, 2), 16),
16
31
  parseInt(color.substr(5, 2), 16),
17
- color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1]
32
+ color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
33
+ ]
18
34
  }
19
35
 
20
36
  // convert named colors
@@ -81,11 +97,7 @@ export const hexToRgba = (hex, alpha = 1) => {
81
97
  export const mixTwoRgb = (colorA, colorB, range = 0.5) => {
82
98
  const arr = []
83
99
  for (let i = 0; i < 3; i++) {
84
- arr[i] = ~~(
85
- colorA[i] + (
86
- (colorB[i] - colorA[i]) * range
87
- )
88
- )
100
+ arr[i] = ~~(colorA[i] + (colorB[i] - colorA[i]) * range)
89
101
  }
90
102
  return `rgb(${arr})`
91
103
  }
@@ -93,25 +105,27 @@ export const mixTwoRgb = (colorA, colorB, range = 0.5) => {
93
105
  export const changeLightness = (delta, hsl) => {
94
106
  const [hue, saturation, lightness] = hsl
95
107
 
96
- const newLightness = Math.max(
97
- 0,
98
- Math.min(100, lightness + parseFloat(delta))
99
- )
108
+ const newLightness = Math.max(0, Math.min(100, lightness + parseFloat(delta)))
100
109
 
101
110
  return [hue, saturation, newLightness]
102
111
  }
103
112
 
104
113
  export const rgbToHSL = (r, g, b) => {
105
- const a = Math.max(r, g, b); const n = a - Math.min(r, g, b); const f = (1 - Math.abs(a + a - n - 1))
106
- const h = n && ((a == r) ? (g - b) / n : ((a == g) ? 2 + (b - r) / n : 4 + (r - g) / n)) //eslint-disable-line
114
+ const a = Math.max(r, g, b)
115
+ const n = a - Math.min(r, g, b)
116
+ const f = 1 - Math.abs(a + a - n - 1)
117
+ const h =
118
+ n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n) //eslint-disable-line
107
119
  return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2]
108
120
  }
109
121
 
110
- export const hslToRgb = (h, s, l,
122
+ export const hslToRgb = (
123
+ h,
124
+ s,
125
+ l,
111
126
  a = s * Math.min(l, 1 - l),
112
- f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
113
- Math.min(k - 3, 9 - k, 1), -1
114
- )
127
+ f = (n, k = (n + h / 30) % 12) =>
128
+ l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
115
129
  ) => [f(0), f(8), f(4)]
116
130
 
117
131
  export const getColorShade = (col, amt) => {
@@ -122,12 +136,12 @@ export const getColorShade = (col, amt) => {
122
136
  if (r > 255) r = 255
123
137
  else if (r < 0) r = 0
124
138
 
125
- let b = ((num >> 8) & 0x00FF) + amt
139
+ let b = ((num >> 8) & 0x00ff) + amt
126
140
 
127
141
  if (b > 255) b = 255
128
142
  else if (b < 0) b = 0
129
143
 
130
- let g = (num & 0x0000FF) + amt
144
+ let g = (num & 0x0000ff) + amt
131
145
 
132
146
  if (g > 255) g = 255
133
147
  else if (g < 0) g = 0
@@ -138,12 +152,8 @@ export const getColorShade = (col, amt) => {
138
152
  export const mixTwoRgba = (colorA, colorB, range = 0.5) => {
139
153
  const arr = []
140
154
  for (let i = 0; i < 4; i++) {
141
- const round = (i === 3) ? x => x : Math.round
142
- arr[i] = round(
143
- (colorA[i] + (
144
- (colorB[i] - colorA[i]) * range
145
- ))
146
- )
155
+ const round = i === 3 ? x => x : Math.round
156
+ arr[i] = round(colorA[i] + (colorB[i] - colorA[i]) * range)
147
157
  }
148
158
  return `rgba(${arr})`
149
159
  }
@@ -151,7 +161,7 @@ export const mixTwoRgba = (colorA, colorB, range = 0.5) => {
151
161
  export const opacify = (color, opacity) => {
152
162
  const arr = colorStringToRgbaArray(color)
153
163
  if (!arr) {
154
- if (ENV === 'testing' || ENV === 'development') console.warn(color + ' color is not rgba')
164
+ if (isNotProduction()) console.warn(color + ' color is not rgba')
155
165
  return
156
166
  }
157
167
  arr[3] = opacity
@@ -159,7 +169,8 @@ export const opacify = (color, opacity) => {
159
169
  }
160
170
 
161
171
  export const getRgbTone = (rgb, tone) => {
162
- if (isString(rgb) && rgb.includes('rgb')) rgb = colorStringToRgbaArray(rgb).join(', ')
172
+ if (isString(rgb) && rgb.includes('rgb'))
173
+ rgb = colorStringToRgbaArray(rgb).join(', ')
163
174
  if (isString(rgb)) rgb = rgb.split(',').map(v => parseFloat(v.trim()))
164
175
  if (isNumber(tone)) tone += ''
165
176
  const toHex = rgbArrayToHex(rgb)
@@ -172,7 +183,7 @@ export const getRgbTone = (rgb, tone) => {
172
183
  const [r, g, b] = rgb
173
184
  const hsl = rgbToHSL(r, g, b)
174
185
  const [h, s, l] = hsl // eslint-disable-line
175
- const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255)
186
+ const newRgb = hslToRgb(h, s, (parseFloat(tone) / 100) * 255)
176
187
  return newRgb
177
188
  }
178
189
  }
@@ -1,12 +1,11 @@
1
1
  'use strict'
2
2
 
3
- import { isArray, isString } from '@domql/utils'
3
+ import { isArray, isNotProduction, isString } from '@domql/utils'
4
4
  import { getActiveConfig } from '../factory'
5
5
 
6
- const ENV = process.env.NODE_ENV || 'development'
7
- const isDev = ENV === 'development' || ENV === 'testing'
6
+ const isDev = isNotProduction()
8
7
 
9
- export const generateSprite = (icons) => {
8
+ export const generateSprite = icons => {
10
9
  const CONFIG = getActiveConfig()
11
10
 
12
11
  let sprite = ''
@@ -20,7 +19,7 @@ export const generateSprite = (icons) => {
20
19
  return sprite
21
20
  }
22
21
 
23
- const parseRootAttributes = (htmlString) => {
22
+ const parseRootAttributes = htmlString => {
24
23
  const val = htmlString.default || htmlString
25
24
  if (!isString(val)) {
26
25
  if (isDev) console.warn('parseRootAttributes:', val, 'is not a string')
@@ -33,7 +32,9 @@ const parseRootAttributes = (htmlString) => {
33
32
  }
34
33
 
35
34
  const attrString = match[1]
36
- const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm)
35
+ const attrs = attrString.match(
36
+ /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
37
+ )
37
38
  return attrs.reduce((acc, attr) => {
38
39
  const [key, value] = attr.split('=')
39
40
  acc[key] = value.replace(/['"]/g, '')
@@ -49,7 +50,9 @@ const replaceIdsAndUrls = (code, key) => {
49
50
  if (isArray(matches)) {
50
51
  matches.forEach(() => {
51
52
  const randomKey = Math.floor(Math.random() * 100000)
52
- replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`)
53
+ replacedCode = code
54
+ .replace(idRegex, `id="${key}-${randomKey}"`)
55
+ .replace(urlRegex, `url(#${key}-${randomKey})`)
53
56
  })
54
57
  }
55
58
  return replacedCode
@@ -64,7 +67,8 @@ export const convertSvgToSymbol = (key, code) => {
64
67
 
65
68
  const replacedCode = replaceIdsAndUrls(code, key)
66
69
 
67
- let symbol = replacedCode.replace('<svg',
70
+ let symbol = replacedCode.replace(
71
+ '<svg',
68
72
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
69
73
  )
70
74