@symbo.ls/scratch 2.11.523 → 3.0.2
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/factory.js +106 -51
- package/dist/cjs/index.js +366 -423
- package/dist/cjs/set.js +304 -321
- package/dist/cjs/system/color.js +231 -181
- package/dist/cjs/system/document.js +198 -121
- package/dist/cjs/system/font.js +199 -127
- package/dist/cjs/system/index.js +308 -325
- package/dist/cjs/system/reset.js +205 -135
- package/dist/cjs/system/shadow.js +247 -212
- package/dist/cjs/system/spacing.js +215 -153
- package/dist/cjs/system/svg.js +203 -132
- package/dist/cjs/system/theme.js +243 -206
- package/dist/cjs/system/timing.js +206 -138
- package/dist/cjs/system/typography.js +212 -148
- package/dist/cjs/transforms/index.js +285 -268
- package/dist/cjs/utils/color.js +93 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +236 -193
- package/dist/cjs/utils/sequence.js +206 -99
- package/dist/cjs/utils/sprite.js +106 -51
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +196 -83
- package/package.json +4 -4
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
- package/src/utils/sequence.js +1 -1
package/dist/cjs/utils/color.js
CHANGED
|
@@ -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,94 @@ __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/
|
|
41
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
92
42
|
var window2 = globalThis;
|
|
93
43
|
var document2 = window2.document;
|
|
94
44
|
|
|
95
|
-
// ../../node_modules/@domql/utils/
|
|
45
|
+
// ../../node_modules/@domql/utils/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/
|
|
49
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
50
|
+
var STATE_METHODS = [
|
|
51
|
+
"update",
|
|
52
|
+
"parse",
|
|
53
|
+
"clean",
|
|
54
|
+
"create",
|
|
55
|
+
"destroy",
|
|
56
|
+
"add",
|
|
57
|
+
"toggle",
|
|
58
|
+
"remove",
|
|
59
|
+
"apply",
|
|
60
|
+
"set",
|
|
61
|
+
"reset",
|
|
62
|
+
"replace",
|
|
63
|
+
"quietReplace",
|
|
64
|
+
"quietUpdate",
|
|
65
|
+
"applyReplace",
|
|
66
|
+
"applyFunction",
|
|
67
|
+
"keys",
|
|
68
|
+
"values",
|
|
69
|
+
"ref",
|
|
70
|
+
"rootUpdate",
|
|
71
|
+
"parentUpdate",
|
|
72
|
+
"parent",
|
|
73
|
+
"__element",
|
|
74
|
+
"__depends",
|
|
75
|
+
"__ref",
|
|
76
|
+
"__children",
|
|
77
|
+
"root",
|
|
78
|
+
"setByPath",
|
|
79
|
+
"setPathCollection",
|
|
80
|
+
"removeByPath",
|
|
81
|
+
"removePathCollection",
|
|
82
|
+
"getByPath"
|
|
83
|
+
];
|
|
84
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
85
|
+
var METHODS = [
|
|
86
|
+
"set",
|
|
87
|
+
"reset",
|
|
88
|
+
"update",
|
|
89
|
+
"remove",
|
|
90
|
+
"updateContent",
|
|
91
|
+
"removeContent",
|
|
92
|
+
"lookup",
|
|
93
|
+
"lookdown",
|
|
94
|
+
"lookdownAll",
|
|
95
|
+
"getRef",
|
|
96
|
+
"getPath",
|
|
97
|
+
"setNodeStyles",
|
|
98
|
+
"spotByPath",
|
|
99
|
+
"keys",
|
|
100
|
+
"parse",
|
|
101
|
+
"setProps",
|
|
102
|
+
"parseDeep",
|
|
103
|
+
"variables",
|
|
104
|
+
"if",
|
|
105
|
+
"log",
|
|
106
|
+
"verbose",
|
|
107
|
+
"warn",
|
|
108
|
+
"error",
|
|
109
|
+
"call",
|
|
110
|
+
"nextElement",
|
|
111
|
+
"previousElement"
|
|
112
|
+
];
|
|
113
|
+
var METHODS_EXL = [
|
|
114
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
115
|
+
...METHODS,
|
|
116
|
+
...STATE_METHODS,
|
|
117
|
+
...PROPS_METHODS
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
100
121
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
101
122
|
|
|
102
123
|
// src/utils/color.js
|
|
103
124
|
var ENV = "development";
|
|
104
125
|
var colorStringToRgbaArray = (color) => {
|
|
105
|
-
if (color === "")
|
|
106
|
-
|
|
107
|
-
if (color.toLowerCase() === "transparent")
|
|
108
|
-
return [0, 0, 0, 0];
|
|
126
|
+
if (color === "") return [0, 0, 0, 0];
|
|
127
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
109
128
|
if (color[0] === "#") {
|
|
110
129
|
if (color.length < 7) {
|
|
111
130
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -118,26 +137,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
118
137
|
];
|
|
119
138
|
}
|
|
120
139
|
if (color.indexOf("rgb") === -1) {
|
|
121
|
-
if (
|
|
122
|
-
const elem =
|
|
140
|
+
if (document2 && window2) {
|
|
141
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
123
142
|
const flag = "rgb(1, 2, 3)";
|
|
124
143
|
elem.style.color = flag;
|
|
125
144
|
if (elem.style.color !== flag) {
|
|
126
|
-
|
|
145
|
+
document2.body.removeChild(elem);
|
|
127
146
|
return;
|
|
128
147
|
}
|
|
129
148
|
elem.style.color = color;
|
|
130
149
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
131
|
-
|
|
150
|
+
document2.body.removeChild(elem);
|
|
132
151
|
return [0, 0, 0, 0];
|
|
133
152
|
}
|
|
134
|
-
color =
|
|
135
|
-
|
|
153
|
+
color = window2.getComputedStyle(elem).color;
|
|
154
|
+
document2.body.removeChild(elem);
|
|
136
155
|
}
|
|
137
156
|
}
|
|
138
157
|
if (color.indexOf("rgb") === 0) {
|
|
139
|
-
if (color.indexOf("rgba") === -1)
|
|
140
|
-
color = `${color}, 1`;
|
|
158
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
141
159
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
142
160
|
}
|
|
143
161
|
return [0, 0, 0, 0];
|
|
@@ -194,20 +212,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
194
212
|
var getColorShade = (col, amt) => {
|
|
195
213
|
const num = parseInt(col, 16);
|
|
196
214
|
let r = (num >> 16) + amt;
|
|
197
|
-
if (r > 255)
|
|
198
|
-
|
|
199
|
-
else if (r < 0)
|
|
200
|
-
r = 0;
|
|
215
|
+
if (r > 255) r = 255;
|
|
216
|
+
else if (r < 0) r = 0;
|
|
201
217
|
let b = (num >> 8 & 255) + amt;
|
|
202
|
-
if (b > 255)
|
|
203
|
-
|
|
204
|
-
else if (b < 0)
|
|
205
|
-
b = 0;
|
|
218
|
+
if (b > 255) b = 255;
|
|
219
|
+
else if (b < 0) b = 0;
|
|
206
220
|
let g = (num & 255) + amt;
|
|
207
|
-
if (g > 255)
|
|
208
|
-
|
|
209
|
-
else if (g < 0)
|
|
210
|
-
g = 0;
|
|
221
|
+
if (g > 255) g = 255;
|
|
222
|
+
else if (g < 0) g = 0;
|
|
211
223
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
212
224
|
};
|
|
213
225
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -223,20 +235,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
223
235
|
var opacify = (color, opacity) => {
|
|
224
236
|
const arr = colorStringToRgbaArray(color);
|
|
225
237
|
if (!arr) {
|
|
226
|
-
if (ENV === "test" || ENV === "development")
|
|
227
|
-
console.warn(color + " color is not rgba");
|
|
238
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
228
239
|
return;
|
|
229
240
|
}
|
|
230
241
|
arr[3] = opacity;
|
|
231
242
|
return `rgba(${arr})`;
|
|
232
243
|
};
|
|
233
244
|
var getRgbTone = (rgb, tone) => {
|
|
234
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
238
|
-
if (isNumber(tone))
|
|
239
|
-
tone += "";
|
|
245
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
246
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
247
|
+
if (isNumber(tone)) tone += "";
|
|
240
248
|
const toHex = rgbArrayToHex(rgb);
|
|
241
249
|
const abs = tone.slice(0, 1);
|
|
242
250
|
if (abs === "-" || abs === "+") {
|
package/dist/cjs/utils/font.js
CHANGED
|
@@ -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
|
-
|
|
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) => {
|