@symbo.ls/scratch 2.11.523 → 3.0.1

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.
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
6
  var __export = (target, all) => {
12
7
  for (var name in all)
13
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,52 +15,8 @@ var __copyProps = (to, from, except, desc) => {
20
15
  }
21
16
  return to;
22
17
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
19
 
33
- // ../../node_modules/@domql/globals/dist/cjs/index.js
34
- var require_cjs = __commonJS({
35
- "../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
36
- "use strict";
37
- var __defProp2 = Object.defineProperty;
38
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
- var __export2 = (target, all) => {
42
- for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
44
- };
45
- var __copyProps2 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") {
47
- for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp2.call(to, key) && key !== except)
49
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
- }
51
- return to;
52
- };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
- var globals_exports = {};
55
- __export2(globals_exports, {
56
- document: () => document4,
57
- global: () => global,
58
- self: () => self,
59
- window: () => window4
60
- });
61
- module2.exports = __toCommonJS2(globals_exports);
62
- var global = globalThis;
63
- var self = globalThis;
64
- var window4 = globalThis;
65
- var document4 = window4.document;
66
- }
67
- });
68
-
69
20
  // src/utils/color.js
70
21
  var color_exports = {};
71
22
  __export(color_exports, {
@@ -86,26 +37,23 @@ __export(color_exports, {
86
37
  rgbToHex: () => rgbToHex
87
38
  });
88
39
  module.exports = __toCommonJS(color_exports);
89
- var import_globals4 = __toESM(require_cjs(), 1);
90
40
 
91
- // ../../node_modules/@domql/utils/dist/esm/globals.js
41
+ // node_modules/@domql/utils/dist/esm/globals.js
92
42
  var window2 = globalThis;
93
43
  var document2 = window2.document;
94
44
 
95
- // ../../node_modules/@domql/utils/dist/esm/types.js
45
+ // node_modules/@domql/utils/dist/esm/types.js
96
46
  var isString = (arg) => typeof arg === "string";
97
47
  var isNumber = (arg) => typeof arg === "number";
98
48
 
99
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
49
+ // node_modules/@domql/utils/dist/esm/cookie.js
100
50
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
101
51
 
102
52
  // src/utils/color.js
103
53
  var ENV = "development";
104
54
  var colorStringToRgbaArray = (color) => {
105
- if (color === "")
106
- return [0, 0, 0, 0];
107
- if (color.toLowerCase() === "transparent")
108
- return [0, 0, 0, 0];
55
+ if (color === "") return [0, 0, 0, 0];
56
+ if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
109
57
  if (color[0] === "#") {
110
58
  if (color.length < 7) {
111
59
  color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
@@ -118,26 +66,25 @@ var colorStringToRgbaArray = (color) => {
118
66
  ];
119
67
  }
120
68
  if (color.indexOf("rgb") === -1) {
121
- if (import_globals4.document && import_globals4.window) {
122
- const elem = import_globals4.document.body.appendChild(import_globals4.document.createElement("fictum"));
69
+ if (document2 && window2) {
70
+ const elem = document2.body.appendChild(document2.createElement("fictum"));
123
71
  const flag = "rgb(1, 2, 3)";
124
72
  elem.style.color = flag;
125
73
  if (elem.style.color !== flag) {
126
- import_globals4.document.body.removeChild(elem);
74
+ document2.body.removeChild(elem);
127
75
  return;
128
76
  }
129
77
  elem.style.color = color;
130
78
  if (elem.style.color === flag || elem.style.color === "") {
131
- import_globals4.document.body.removeChild(elem);
79
+ document2.body.removeChild(elem);
132
80
  return [0, 0, 0, 0];
133
81
  }
134
- color = import_globals4.window.getComputedStyle(elem).color;
135
- import_globals4.document.body.removeChild(elem);
82
+ color = window2.getComputedStyle(elem).color;
83
+ document2.body.removeChild(elem);
136
84
  }
137
85
  }
138
86
  if (color.indexOf("rgb") === 0) {
139
- if (color.indexOf("rgba") === -1)
140
- color = `${color}, 1`;
87
+ if (color.indexOf("rgba") === -1) color = `${color}, 1`;
141
88
  return color.match(/[\.\d]+/g).map((a) => +a);
142
89
  }
143
90
  return [0, 0, 0, 0];
@@ -194,20 +141,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
194
141
  var getColorShade = (col, amt) => {
195
142
  const num = parseInt(col, 16);
196
143
  let r = (num >> 16) + amt;
197
- if (r > 255)
198
- r = 255;
199
- else if (r < 0)
200
- r = 0;
144
+ if (r > 255) r = 255;
145
+ else if (r < 0) r = 0;
201
146
  let b = (num >> 8 & 255) + amt;
202
- if (b > 255)
203
- b = 255;
204
- else if (b < 0)
205
- b = 0;
147
+ if (b > 255) b = 255;
148
+ else if (b < 0) b = 0;
206
149
  let g = (num & 255) + amt;
207
- if (g > 255)
208
- g = 255;
209
- else if (g < 0)
210
- g = 0;
150
+ if (g > 255) g = 255;
151
+ else if (g < 0) g = 0;
211
152
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
212
153
  };
213
154
  var mixTwoRgba = (colorA, colorB, range = 0.5) => {
@@ -223,20 +164,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
223
164
  var opacify = (color, opacity) => {
224
165
  const arr = colorStringToRgbaArray(color);
225
166
  if (!arr) {
226
- if (ENV === "test" || ENV === "development")
227
- console.warn(color + " color is not rgba");
167
+ if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
228
168
  return;
229
169
  }
230
170
  arr[3] = opacity;
231
171
  return `rgba(${arr})`;
232
172
  };
233
173
  var getRgbTone = (rgb, tone) => {
234
- if (isString(rgb) && rgb.includes("rgb"))
235
- rgb = colorStringToRgbaArray(rgb).join(", ");
236
- if (isString(rgb))
237
- rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
238
- if (isNumber(tone))
239
- tone += "";
174
+ if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
175
+ if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
176
+ if (isNumber(tone)) tone += "";
240
177
  const toHex = rgbArrayToHex(rgb);
241
178
  const abs = tone.slice(0, 1);
242
179
  if (abs === "-" || abs === "+") {
@@ -32,10 +32,8 @@ __export(font_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(font_exports);
34
34
  var getDefaultOrFirstKey = (LIBRARY, key) => {
35
- if (LIBRARY[key])
36
- return LIBRARY[key].value;
37
- if (LIBRARY.default)
38
- return LIBRARY[LIBRARY.default].value;
35
+ if (LIBRARY[key]) return LIBRARY[key].value;
36
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
39
37
  const hasValue = Object.keys(LIBRARY)[0];
40
38
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
41
39
  };
@@ -62,8 +60,7 @@ var getFontFace = (LIBRARY) => {
62
60
  };
63
61
  var getFontFaceEachString = (name, weights) => {
64
62
  const isArr = weights[0];
65
- if (isArr)
66
- return getFontFaceEach(name, weights).map(setInCustomFontMedia);
63
+ if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
67
64
  return setCustomFontMedia(name, weights.url);
68
65
  };
69
66
  var getFontFaceString = (LIBRARY) => {