@symbo.ls/scratch 2.11.389 → 2.11.396

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.
@@ -1142,20 +1142,21 @@ var require_cookie = __commonJS({
1142
1142
  });
1143
1143
  module2.exports = __toCommonJS2(cookie_exports);
1144
1144
  var import_types = require_types();
1145
+ var import_utils5 = require_cjs();
1145
1146
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1146
1147
  var setCookie = (cname, cvalue, exdays = 365) => {
1147
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1148
+ if ((0, import_types.isUndefined)(import_utils5.document) || (0, import_types.isUndefined)(import_utils5.document.cookie))
1148
1149
  return;
1149
1150
  const d = /* @__PURE__ */ new Date();
1150
1151
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1151
1152
  const expires = `expires=${d.toUTCString()}`;
1152
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
1153
+ import_utils5.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1153
1154
  };
1154
1155
  var getCookie = (cname) => {
1155
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1156
+ if ((0, import_types.isUndefined)(import_utils5.document) || (0, import_types.isUndefined)(import_utils5.document.cookie))
1156
1157
  return;
1157
1158
  const name = `${cname}=`;
1158
- const decodedCookie = decodeURIComponent(document.cookie);
1159
+ const decodedCookie = decodeURIComponent(import_utils5.document.cookie);
1159
1160
  const ca = decodedCookie.split(";");
1160
1161
  for (let i = 0; i < ca.length; i++) {
1161
1162
  let c = ca[i];
@@ -1372,9 +1373,9 @@ var require_cjs = __commonJS({
1372
1373
  }
1373
1374
  });
1374
1375
 
1375
- // ../utils/dist/cjs/index.js
1376
+ // ../../node_modules/@symbo.ls/utils/dist/cjs/index.js
1376
1377
  var require_cjs2 = __commonJS({
1377
- "../utils/dist/cjs/index.js"(exports, module2) {
1378
+ "../../node_modules/@symbo.ls/utils/dist/cjs/index.js"(exports, module2) {
1378
1379
  "use strict";
1379
1380
  var __create2 = Object.create;
1380
1381
  var __defProp2 = Object.defineProperty;
@@ -2497,20 +2498,21 @@ var require_cjs2 = __commonJS({
2497
2498
  });
2498
2499
  module22.exports = __toCommonJS22(cookie_exports);
2499
2500
  var import_types = require_types2();
2501
+ var import_utils32 = require_cjs3();
2500
2502
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
2501
2503
  var setCookie = (cname, cvalue, exdays = 365) => {
2502
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2504
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2503
2505
  return;
2504
2506
  const d = /* @__PURE__ */ new Date();
2505
2507
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
2506
2508
  const expires = `expires=${d.toUTCString()}`;
2507
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
2509
+ import_utils32.document.cookie = `${cname}=${cvalue};${expires};path=/`;
2508
2510
  };
2509
2511
  var getCookie = (cname) => {
2510
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2512
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2511
2513
  return;
2512
2514
  const name = `${cname}=`;
2513
- const decodedCookie = decodeURIComponent(document.cookie);
2515
+ const decodedCookie = decodeURIComponent(import_utils32.document.cookie);
2514
2516
  const ca = decodedCookie.split(";");
2515
2517
  for (let i = 0; i < ca.length; i++) {
2516
2518
  let c = ca[i];
@@ -2730,6 +2732,7 @@ var require_cjs2 = __commonJS({
2730
2732
  findClosestNumber: () => findClosestNumber,
2731
2733
  findClosestNumberInFactory: () => findClosestNumberInFactory,
2732
2734
  formatDate: () => formatDate,
2735
+ loadJavascript: () => loadJavascript,
2733
2736
  loadJavascriptFile: () => loadJavascriptFile,
2734
2737
  removeChars: () => removeChars,
2735
2738
  toCamelCase: () => toCamelCase,
@@ -2801,6 +2804,17 @@ var require_cjs2 = __commonJS({
2801
2804
  }
2802
2805
  });
2803
2806
  };
2807
+ var loadJavascript = (body, async = true, doc = document, type = "text/javascript") => {
2808
+ try {
2809
+ const scriptEle = doc.createElement("script");
2810
+ scriptEle.type = type;
2811
+ scriptEle.async = async;
2812
+ scriptEle.innerHTML = body;
2813
+ doc.body.appendChild(scriptEle);
2814
+ } catch (error) {
2815
+ console.warn(error);
2816
+ }
2817
+ };
2804
2818
  var copyStringToClipboard = (str) => {
2805
2819
  const el = document.createElement("textarea");
2806
2820
  el.value = str;
@@ -2827,6 +2841,8 @@ var require_cjs2 = __commonJS({
2827
2841
  );
2828
2842
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2829
2843
  var toDescriptionCase = (str = "") => {
2844
+ if (typeof str !== "string")
2845
+ return;
2830
2846
  const result = str.replace(/([A-Z])/g, " $1");
2831
2847
  return result.charAt(0).toUpperCase() + result.slice(1);
2832
2848
  };
@@ -3068,7 +3084,7 @@ var FACTORY = {
3068
3084
  0: CONFIG
3069
3085
  };
3070
3086
  var getActiveConfig = (def) => {
3071
- return FACTORY[def || FACTORY.active];
3087
+ return FACTORY[def || FACTORY.active] || CONFIG;
3072
3088
  };
3073
3089
 
3074
3090
  // src/utils/sequence.js
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.389",
5
+ "version": "2.11.396",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -30,5 +30,5 @@
30
30
  "@symbo.ls/utils": "latest",
31
31
  "color-contrast-checker": "^1.5.0"
32
32
  },
33
- "gitHead": "e260280a4a50ca08fd7df53104a884086dc3da88"
33
+ "gitHead": "d92037fb95cea38c0407931d0f4d2dac334760d3"
34
34
  }
package/src/factory.js CHANGED
@@ -30,7 +30,7 @@ export const activateConfig = (def) => {
30
30
  }
31
31
 
32
32
  export const getActiveConfig = (def) => {
33
- return FACTORY[def || FACTORY.active]
33
+ return FACTORY[def || FACTORY.active] || CONFIG
34
34
  }
35
35
 
36
36
  export const setActiveConfig = (newConfig) => {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { document, window } from '@domql/globals'
4
4
  import { isString, isNumber } from '@domql/utils'
5
- const ENV = process.env.NODE_ENV
5
+ const ENV = process?.env.NODE_ENV
6
6
 
7
7
  export const colorStringToRgbaArray = color => {
8
8
  if (color === '') return [0, 0, 0, 0]