@symbo.ls/scratch 2.11.18 → 2.11.28

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/dist/cjs/index.js CHANGED
@@ -2494,6 +2494,8 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2494
2494
  appendSVG(lib, options);
2495
2495
  };
2496
2496
  var createSVGSpriteElement = (options = { isRoot: true }) => {
2497
+ if (!import_globals2.document || !import_globals2.document.createElementNS)
2498
+ return;
2497
2499
  const svgElem = import_globals2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
2498
2500
  if (options.isRoot) {
2499
2501
  svgElem.setAttribute("aria-hidden", "true");
@@ -2507,7 +2509,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
2507
2509
  var appendSVG = (lib, options = DEF_OPTIONS) => {
2508
2510
  const CONFIG2 = getActiveConfig();
2509
2511
  const doc = options.document || import_globals2.document;
2510
- if (!doc) {
2512
+ if (!doc || !doc.documentElement) {
2511
2513
  if (CONFIG2.verbose) {
2512
2514
  console.warn("To append SVG sprites it should be run in browser environment");
2513
2515
  }
@@ -2521,8 +2523,10 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
2521
2523
  exists.append(...tempSVG.children);
2522
2524
  } else {
2523
2525
  const svgSpriteDOM = createSVGSpriteElement();
2524
- svgSpriteDOM.innerHTML = SVGsprite;
2525
- doc.body.prepend(svgSpriteDOM);
2526
+ if (svgSpriteDOM && svgSpriteDOM.nodeType) {
2527
+ svgSpriteDOM.innerHTML = SVGsprite;
2528
+ doc.body.prepend(svgSpriteDOM);
2529
+ }
2526
2530
  }
2527
2531
  };
2528
2532
 
@@ -2248,6 +2248,8 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2248
2248
  appendSVG(lib, options);
2249
2249
  };
2250
2250
  var createSVGSpriteElement = (options = { isRoot: true }) => {
2251
+ if (!import_globals2.document || !import_globals2.document.createElementNS)
2252
+ return;
2251
2253
  const svgElem = import_globals2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
2252
2254
  if (options.isRoot) {
2253
2255
  svgElem.setAttribute("aria-hidden", "true");
@@ -2261,7 +2263,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
2261
2263
  var appendSVG = (lib, options = DEF_OPTIONS) => {
2262
2264
  const CONFIG2 = getActiveConfig();
2263
2265
  const doc = options.document || import_globals2.document;
2264
- if (!doc) {
2266
+ if (!doc || !doc.documentElement) {
2265
2267
  if (CONFIG2.verbose) {
2266
2268
  console.warn("To append SVG sprites it should be run in browser environment");
2267
2269
  }
@@ -2275,8 +2277,10 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
2275
2277
  exists.append(...tempSVG.children);
2276
2278
  } else {
2277
2279
  const svgSpriteDOM = createSVGSpriteElement();
2278
- svgSpriteDOM.innerHTML = SVGsprite;
2279
- doc.body.prepend(svgSpriteDOM);
2280
+ if (svgSpriteDOM && svgSpriteDOM.nodeType) {
2281
+ svgSpriteDOM.innerHTML = SVGsprite;
2282
+ doc.body.prepend(svgSpriteDOM);
2283
+ }
2280
2284
  }
2281
2285
  };
2282
2286
 
@@ -1316,6 +1316,8 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
1316
1316
  appendSVG(lib, options);
1317
1317
  };
1318
1318
  var createSVGSpriteElement = (options = { isRoot: true }) => {
1319
+ if (!import_globals2.document || !import_globals2.document.createElementNS)
1320
+ return;
1319
1321
  const svgElem = import_globals2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
1320
1322
  if (options.isRoot) {
1321
1323
  svgElem.setAttribute("aria-hidden", "true");
@@ -1329,7 +1331,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
1329
1331
  var appendSVG = (lib, options = DEF_OPTIONS) => {
1330
1332
  const CONFIG2 = getActiveConfig();
1331
1333
  const doc = options.document || import_globals2.document;
1332
- if (!doc) {
1334
+ if (!doc || !doc.documentElement) {
1333
1335
  if (CONFIG2.verbose) {
1334
1336
  console.warn("To append SVG sprites it should be run in browser environment");
1335
1337
  }
@@ -1343,7 +1345,9 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
1343
1345
  exists.append(...tempSVG.children);
1344
1346
  } else {
1345
1347
  const svgSpriteDOM = createSVGSpriteElement();
1346
- svgSpriteDOM.innerHTML = SVGsprite;
1347
- doc.body.prepend(svgSpriteDOM);
1348
+ if (svgSpriteDOM && svgSpriteDOM.nodeType) {
1349
+ svgSpriteDOM.innerHTML = SVGsprite;
1350
+ doc.body.prepend(svgSpriteDOM);
1351
+ }
1348
1352
  }
1349
1353
  };
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.11.18",
5
+ "version": "2.11.28",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -32,5 +32,5 @@
32
32
  "peerDependencies": {
33
33
  "@emotion/css": "^11.5.0"
34
34
  },
35
- "gitHead": "09944e5ba459ced66abf1b396c5cdc95e5c3feb9"
35
+ "gitHead": "013c9c3462fc6d6d2cdb158fc6857426a4a9ab5e"
36
36
  }
package/src/system/svg.js CHANGED
@@ -45,6 +45,7 @@ export const appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
45
45
  }
46
46
 
47
47
  const createSVGSpriteElement = (options = { isRoot: true }) => {
48
+ if (!document || !document.createElementNS) return
48
49
  const svgElem = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
49
50
  if (options.isRoot) {
50
51
  svgElem.setAttribute('aria-hidden', 'true')
@@ -60,7 +61,7 @@ const appendSVG = (lib, options = DEF_OPTIONS) => {
60
61
  const CONFIG = getActiveConfig()
61
62
  const doc = options.document || document
62
63
 
63
- if (!doc) {
64
+ if (!doc || !doc.documentElement) {
64
65
  if (CONFIG.verbose) {
65
66
  console.warn('To append SVG sprites it should be run in browser environment')
66
67
  }
@@ -77,7 +78,9 @@ const appendSVG = (lib, options = DEF_OPTIONS) => {
77
78
  exists.append(...tempSVG.children)
78
79
  } else {
79
80
  const svgSpriteDOM = createSVGSpriteElement()
80
- svgSpriteDOM.innerHTML = SVGsprite
81
- doc.body.prepend(svgSpriteDOM)
81
+ if (svgSpriteDOM && svgSpriteDOM.nodeType) {
82
+ svgSpriteDOM.innerHTML = SVGsprite
83
+ doc.body.prepend(svgSpriteDOM)
84
+ }
82
85
  }
83
86
  }