@symbo.ls/scratch 3.14.1 → 3.14.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/package.json +2 -2
- package/dist/cjs/defaultConfig/animation.js +0 -26
- package/dist/cjs/defaultConfig/cases.js +0 -26
- package/dist/cjs/defaultConfig/class.js +0 -27
- package/dist/cjs/defaultConfig/color.js +0 -28
- package/dist/cjs/defaultConfig/document.js +0 -26
- package/dist/cjs/defaultConfig/font-family.js +0 -34
- package/dist/cjs/defaultConfig/font.js +0 -26
- package/dist/cjs/defaultConfig/grid.js +0 -27
- package/dist/cjs/defaultConfig/icons.js +0 -28
- package/dist/cjs/defaultConfig/index.js +0 -222
- package/dist/cjs/defaultConfig/media.js +0 -31
- package/dist/cjs/defaultConfig/responsive.js +0 -52
- package/dist/cjs/defaultConfig/sequence.js +0 -51
- package/dist/cjs/defaultConfig/shadow.js +0 -26
- package/dist/cjs/defaultConfig/spacing.js +0 -87
- package/dist/cjs/defaultConfig/svg.js +0 -28
- package/dist/cjs/defaultConfig/templates.js +0 -26
- package/dist/cjs/defaultConfig/theme.js +0 -26
- package/dist/cjs/defaultConfig/timing.js +0 -68
- package/dist/cjs/defaultConfig/typography.js +0 -72
- package/dist/cjs/defaultConfig/unit.js +0 -28
- package/dist/cjs/factory.js +0 -386
- package/dist/cjs/index.js +0 -6365
- package/dist/cjs/package.json +0 -4
- package/dist/cjs/set.js +0 -5681
- package/dist/cjs/system/color.js +0 -4585
- package/dist/cjs/system/document.js +0 -4396
- package/dist/cjs/system/font.js +0 -4444
- package/dist/cjs/system/index.js +0 -5764
- package/dist/cjs/system/reset.js +0 -4511
- package/dist/cjs/system/shadow.js +0 -4898
- package/dist/cjs/system/spacing.js +0 -4847
- package/dist/cjs/system/svg.js +0 -4496
- package/dist/cjs/system/theme.js +0 -4686
- package/dist/cjs/system/timing.js +0 -4724
- package/dist/cjs/system/typography.js +0 -4821
- package/dist/cjs/tests/index.js +0 -30
- package/dist/cjs/transforms/index.js +0 -5104
- package/dist/cjs/utils/color.js +0 -187
- package/dist/cjs/utils/font.js +0 -91
- package/dist/cjs/utils/index.js +0 -5084
- package/dist/cjs/utils/sequence.js +0 -4711
- package/dist/cjs/utils/sprite.js +0 -426
- package/dist/cjs/utils/theme.js +0 -31
- package/dist/cjs/utils/unit.js +0 -81
- package/dist/cjs/utils/var.js +0 -4450
package/dist/cjs/utils/color.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/utils/color.js
|
|
21
|
-
var color_exports = {};
|
|
22
|
-
__export(color_exports, {
|
|
23
|
-
changeLightness: () => changeLightness,
|
|
24
|
-
colorStringToRgbaArray: () => colorStringToRgbaArray,
|
|
25
|
-
getColorShade: () => getColorShade,
|
|
26
|
-
getRgbTone: () => getRgbTone,
|
|
27
|
-
hexToRgb: () => hexToRgb,
|
|
28
|
-
hexToRgbArray: () => hexToRgbArray,
|
|
29
|
-
hexToRgba: () => hexToRgba,
|
|
30
|
-
hslToRgb: () => hslToRgb,
|
|
31
|
-
mixTwoColors: () => mixTwoColors,
|
|
32
|
-
mixTwoRgb: () => mixTwoRgb,
|
|
33
|
-
mixTwoRgba: () => mixTwoRgba,
|
|
34
|
-
opacify: () => opacify,
|
|
35
|
-
rgbArrayToHex: () => rgbArrayToHex,
|
|
36
|
-
rgbToHSL: () => rgbToHSL,
|
|
37
|
-
rgbToHex: () => rgbToHex
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(color_exports);
|
|
40
|
-
|
|
41
|
-
// ../../../domql/packages/utils/env.js
|
|
42
|
-
var NODE_ENV = "development";
|
|
43
|
-
var isProduction = (env = NODE_ENV) => env === "production";
|
|
44
|
-
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
45
|
-
|
|
46
|
-
// ../../../domql/packages/utils/globals.js
|
|
47
|
-
var window2 = globalThis;
|
|
48
|
-
var document2 = window2.document;
|
|
49
|
-
|
|
50
|
-
// ../../../domql/packages/utils/types.js
|
|
51
|
-
var isString = (arg) => typeof arg === "string";
|
|
52
|
-
var isNumber = (arg) => typeof arg === "number";
|
|
53
|
-
|
|
54
|
-
// ../../../domql/packages/utils/cookie.js
|
|
55
|
-
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
56
|
-
|
|
57
|
-
// src/utils/color.js
|
|
58
|
-
var colorStringToRgbaArray = (color) => {
|
|
59
|
-
if (color === "") return [0, 0, 0, 0];
|
|
60
|
-
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
61
|
-
if (color[0] === "#") {
|
|
62
|
-
if (color.length < 7) {
|
|
63
|
-
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
64
|
-
}
|
|
65
|
-
return [
|
|
66
|
-
parseInt(color.substr(1, 2), 16),
|
|
67
|
-
parseInt(color.substr(3, 2), 16),
|
|
68
|
-
parseInt(color.substr(5, 2), 16),
|
|
69
|
-
color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
if (color.indexOf("rgb") === -1) {
|
|
73
|
-
if (document2 && window2) {
|
|
74
|
-
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
75
|
-
const flag = "rgb(1, 2, 3)";
|
|
76
|
-
elem.style.color = flag;
|
|
77
|
-
if (elem.style.color !== flag) {
|
|
78
|
-
document2.body.removeChild(elem);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
elem.style.color = color;
|
|
82
|
-
if (elem.style.color === flag || elem.style.color === "") {
|
|
83
|
-
document2.body.removeChild(elem);
|
|
84
|
-
return [0, 0, 0, 0];
|
|
85
|
-
}
|
|
86
|
-
color = window2.getComputedStyle(elem).color;
|
|
87
|
-
document2.body.removeChild(elem);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (color.indexOf("rgb") === 0) {
|
|
91
|
-
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
92
|
-
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
93
|
-
}
|
|
94
|
-
return [0, 0, 0, 0];
|
|
95
|
-
};
|
|
96
|
-
var mixTwoColors = (colorA, colorB, range = 0.5) => {
|
|
97
|
-
colorA = colorStringToRgbaArray(colorA);
|
|
98
|
-
colorB = colorStringToRgbaArray(colorB);
|
|
99
|
-
return mixTwoRgba(colorA, colorB, range);
|
|
100
|
-
};
|
|
101
|
-
var hexToRgb = (hex, alpha = 1) => {
|
|
102
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
103
|
-
return `rgb(${r},${g},${b})`;
|
|
104
|
-
};
|
|
105
|
-
var hexToRgbArray = (hex, alpha = 1) => {
|
|
106
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
107
|
-
return [r, g, b];
|
|
108
|
-
};
|
|
109
|
-
var rgbToHex = (r, g, b) => {
|
|
110
|
-
return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
|
|
111
|
-
};
|
|
112
|
-
var rgbArrayToHex = ([r, g, b]) => {
|
|
113
|
-
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
114
|
-
};
|
|
115
|
-
var hexToRgba = (hex, alpha = 1) => {
|
|
116
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
117
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
118
|
-
};
|
|
119
|
-
var mixTwoRgb = (colorA, colorB, range = 0.5) => {
|
|
120
|
-
const arr = [];
|
|
121
|
-
for (let i = 0; i < 3; i++) {
|
|
122
|
-
arr[i] = ~~(colorA[i] + (colorB[i] - colorA[i]) * range);
|
|
123
|
-
}
|
|
124
|
-
return `rgb(${arr})`;
|
|
125
|
-
};
|
|
126
|
-
var changeLightness = (delta, hsl) => {
|
|
127
|
-
const [hue, saturation, lightness] = hsl;
|
|
128
|
-
const newLightness = Math.max(0, Math.min(100, lightness + parseFloat(delta)));
|
|
129
|
-
return [hue, saturation, newLightness];
|
|
130
|
-
};
|
|
131
|
-
var rgbToHSL = (r, g, b) => {
|
|
132
|
-
const a = Math.max(r, g, b);
|
|
133
|
-
const n = a - Math.min(r, g, b);
|
|
134
|
-
const f = 1 - Math.abs(a + a - n - 1);
|
|
135
|
-
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
136
|
-
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
137
|
-
};
|
|
138
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
|
|
139
|
-
var getColorShade = (col, amt) => {
|
|
140
|
-
const num = parseInt(col, 16);
|
|
141
|
-
let r = (num >> 16) + amt;
|
|
142
|
-
if (r > 255) r = 255;
|
|
143
|
-
else if (r < 0) r = 0;
|
|
144
|
-
let b = (num >> 8 & 255) + amt;
|
|
145
|
-
if (b > 255) b = 255;
|
|
146
|
-
else if (b < 0) b = 0;
|
|
147
|
-
let g = (num & 255) + amt;
|
|
148
|
-
if (g > 255) g = 255;
|
|
149
|
-
else if (g < 0) g = 0;
|
|
150
|
-
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
151
|
-
};
|
|
152
|
-
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
153
|
-
const arr = [];
|
|
154
|
-
for (let i = 0; i < 4; i++) {
|
|
155
|
-
const round = i === 3 ? (x) => x : Math.round;
|
|
156
|
-
arr[i] = round(colorA[i] + (colorB[i] - colorA[i]) * range);
|
|
157
|
-
}
|
|
158
|
-
return `rgba(${arr})`;
|
|
159
|
-
};
|
|
160
|
-
var opacify = (color, opacity) => {
|
|
161
|
-
const arr = colorStringToRgbaArray(color);
|
|
162
|
-
if (!arr) {
|
|
163
|
-
if (isNotProduction()) console.warn(color + " color is not rgba");
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
arr[3] = opacity;
|
|
167
|
-
return `rgba(${arr})`;
|
|
168
|
-
};
|
|
169
|
-
var getRgbTone = (rgb, tone) => {
|
|
170
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
171
|
-
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
172
|
-
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
173
|
-
if (isNumber(tone)) tone += "";
|
|
174
|
-
const toHex = rgbArrayToHex(rgb);
|
|
175
|
-
const abs = tone.slice(0, 1);
|
|
176
|
-
if (abs === "-" || abs === "+") {
|
|
177
|
-
const colorShade = getColorShade(toHex, parseFloat(tone));
|
|
178
|
-
return hexToRgbArray(colorShade).join(", ");
|
|
179
|
-
} else {
|
|
180
|
-
const [r, g, b] = rgb;
|
|
181
|
-
const hsl = rgbToHSL(r, g, b);
|
|
182
|
-
const [h, s, l] = hsl;
|
|
183
|
-
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
184
|
-
return newRgb;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
// @preserve-env
|
package/dist/cjs/utils/font.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/utils/font.js
|
|
21
|
-
var font_exports = {};
|
|
22
|
-
__export(font_exports, {
|
|
23
|
-
getDefaultOrFirstKey: () => getDefaultOrFirstKey,
|
|
24
|
-
getFontFace: () => getFontFace,
|
|
25
|
-
getFontFaceEach: () => getFontFaceEach,
|
|
26
|
-
getFontFaceEachString: () => getFontFaceEachString,
|
|
27
|
-
getFontFaceString: () => getFontFaceString,
|
|
28
|
-
getFontFormat: () => getFontFormat,
|
|
29
|
-
isGoogleFontsUrl: () => isGoogleFontsUrl,
|
|
30
|
-
setCustomFont: () => setCustomFont,
|
|
31
|
-
setCustomFontMedia: () => setCustomFontMedia,
|
|
32
|
-
setFontImport: () => setFontImport,
|
|
33
|
-
setInCustomFontMedia: () => setInCustomFontMedia
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(font_exports);
|
|
36
|
-
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
37
|
-
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
38
|
-
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
39
|
-
const hasValue = Object.keys(LIBRARY)[0];
|
|
40
|
-
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
41
|
-
};
|
|
42
|
-
var getFontFormat = (url) => {
|
|
43
|
-
const ext = url.split(/[#?]/)[0].split(".").pop().trim();
|
|
44
|
-
if (["woff2", "woff", "ttf", "otf", "eot"].includes(ext)) return ext;
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
var isGoogleFontsUrl = (url) => url && (url.includes("fonts.googleapis.com") || url.includes("fonts.gstatic.com"));
|
|
48
|
-
var setFontImport = (url) => `@import url('${url}');`;
|
|
49
|
-
var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
|
|
50
|
-
var setCustomFont = (name, url, weight, options = {}) => {
|
|
51
|
-
const format = getFontFormat(url);
|
|
52
|
-
const formatStr = format ? ` format('${format}')` : "";
|
|
53
|
-
return `
|
|
54
|
-
font-family: '${name}';
|
|
55
|
-
font-style: normal;${weight ? `
|
|
56
|
-
font-weight: ${weight};` : ""}${options.fontStretch ? `
|
|
57
|
-
font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
|
|
58
|
-
font-display: ${options.fontDisplay};` : ""}
|
|
59
|
-
src: url('${url}')${formatStr};`;
|
|
60
|
-
};
|
|
61
|
-
var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
|
|
62
|
-
}`;
|
|
63
|
-
var getFontFaceEach = (name, weights) => {
|
|
64
|
-
const keys = Object.keys(weights);
|
|
65
|
-
return keys.map((key) => {
|
|
66
|
-
const { url, fontWeight } = weights[key];
|
|
67
|
-
return setCustomFont(name, url, fontWeight);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
var getFontFace = (LIBRARY) => {
|
|
71
|
-
const keys = Object.keys(LIBRARY);
|
|
72
|
-
return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
|
|
73
|
-
};
|
|
74
|
-
var getFontFaceEachString = (name, weights) => {
|
|
75
|
-
if (weights && weights.isVariable) {
|
|
76
|
-
if (isGoogleFontsUrl(weights.url)) {
|
|
77
|
-
return setFontImport(weights.url);
|
|
78
|
-
}
|
|
79
|
-
return setCustomFontMedia(name, weights.url, weights.fontWeight, {
|
|
80
|
-
fontStretch: weights.fontStretch,
|
|
81
|
-
fontDisplay: weights.fontDisplay || "swap"
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const isArr = weights[0];
|
|
85
|
-
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
86
|
-
return setCustomFontMedia(name, weights.url);
|
|
87
|
-
};
|
|
88
|
-
var getFontFaceString = (LIBRARY) => {
|
|
89
|
-
const keys = Object.keys(LIBRARY);
|
|
90
|
-
return keys.map((key) => getFontFaceEachString(key, LIBRARY[key].value));
|
|
91
|
-
};
|