@symbo.ls/scratch 3.1.2 → 3.2.7

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.
Files changed (67) hide show
  1. package/dist/cjs/factory.js +23 -475
  2. package/dist/cjs/index.js +11 -2684
  3. package/dist/cjs/set.js +66 -1992
  4. package/dist/esm/factory.js +43 -0
  5. package/dist/esm/index.js +12 -0
  6. package/dist/esm/set.js +148 -0
  7. package/dist/iife/index.js +2580 -0
  8. package/package.json +26 -16
  9. package/src/set.js +22 -7
  10. package/src/system/color.js +48 -11
  11. package/src/system/font.js +19 -5
  12. package/src/system/reset.js +12 -3
  13. package/src/system/shadow.js +20 -13
  14. package/src/system/spacing.js +63 -56
  15. package/src/system/theme.js +4 -3
  16. package/src/system/timing.js +1 -1
  17. package/src/system/typography.js +12 -20
  18. package/src/transforms/index.js +212 -95
  19. package/src/utils/color.js +121 -31
  20. package/src/utils/font.js +54 -14
  21. package/src/utils/sequence.js +94 -39
  22. package/src/utils/sprite.js +10 -6
  23. package/src/utils/unit.js +69 -2
  24. package/src/utils/var.js +1 -2
  25. package/dist/cjs/defaultConfig/animation.js +0 -26
  26. package/dist/cjs/defaultConfig/cases.js +0 -26
  27. package/dist/cjs/defaultConfig/class.js +0 -27
  28. package/dist/cjs/defaultConfig/color.js +0 -28
  29. package/dist/cjs/defaultConfig/document.js +0 -26
  30. package/dist/cjs/defaultConfig/font-family.js +0 -34
  31. package/dist/cjs/defaultConfig/font.js +0 -26
  32. package/dist/cjs/defaultConfig/grid.js +0 -27
  33. package/dist/cjs/defaultConfig/icons.js +0 -28
  34. package/dist/cjs/defaultConfig/index.js +0 -222
  35. package/dist/cjs/defaultConfig/media.js +0 -31
  36. package/dist/cjs/defaultConfig/responsive.js +0 -52
  37. package/dist/cjs/defaultConfig/sequence.js +0 -51
  38. package/dist/cjs/defaultConfig/shadow.js +0 -26
  39. package/dist/cjs/defaultConfig/spacing.js +0 -87
  40. package/dist/cjs/defaultConfig/svg.js +0 -28
  41. package/dist/cjs/defaultConfig/templates.js +0 -26
  42. package/dist/cjs/defaultConfig/theme.js +0 -26
  43. package/dist/cjs/defaultConfig/timing.js +0 -68
  44. package/dist/cjs/defaultConfig/typography.js +0 -72
  45. package/dist/cjs/defaultConfig/unit.js +0 -28
  46. package/dist/cjs/package.json +0 -4
  47. package/dist/cjs/system/color.js +0 -1096
  48. package/dist/cjs/system/document.js +0 -906
  49. package/dist/cjs/system/font.js +0 -928
  50. package/dist/cjs/system/index.js +0 -2163
  51. package/dist/cjs/system/reset.js +0 -1018
  52. package/dist/cjs/system/shadow.js +0 -1305
  53. package/dist/cjs/system/spacing.js +0 -1257
  54. package/dist/cjs/system/svg.js +0 -1007
  55. package/dist/cjs/system/theme.js +0 -1197
  56. package/dist/cjs/system/timing.js +0 -1132
  57. package/dist/cjs/system/typography.js +0 -1243
  58. package/dist/cjs/tests/index.js +0 -30
  59. package/dist/cjs/transforms/index.js +0 -1534
  60. package/dist/cjs/utils/color.js +0 -336
  61. package/dist/cjs/utils/font.js +0 -69
  62. package/dist/cjs/utils/index.js +0 -1477
  63. package/dist/cjs/utils/sequence.js +0 -1125
  64. package/dist/cjs/utils/sprite.js +0 -554
  65. package/dist/cjs/utils/theme.js +0 -31
  66. package/dist/cjs/utils/unit.js +0 -28
  67. package/dist/cjs/utils/var.js +0 -967
@@ -1,336 +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/globals.js
42
- var window2 = globalThis;
43
- var document2 = window2.document;
44
-
45
- // ../../../domql/packages/utils/types.js
46
- var isString = (arg) => typeof arg === "string";
47
- var isNumber = (arg) => typeof arg === "number";
48
-
49
- // ../../../domql/packages/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
- // ../../../domql/packages/utils/cookie.js
121
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
122
-
123
- // ../../../domql/packages/event/dist/esm/keys.js
124
- var STATE_METHODS2 = [
125
- "update",
126
- "parse",
127
- "clean",
128
- "create",
129
- "destroy",
130
- "add",
131
- "toggle",
132
- "remove",
133
- "apply",
134
- "set",
135
- "reset",
136
- "replace",
137
- "quietReplace",
138
- "quietUpdate",
139
- "applyReplace",
140
- "applyFunction",
141
- "keys",
142
- "values",
143
- "ref",
144
- "rootUpdate",
145
- "parentUpdate",
146
- "parent",
147
- "__element",
148
- "__depends",
149
- "__ref",
150
- "__children",
151
- "root",
152
- "setByPath",
153
- "setPathCollection",
154
- "removeByPath",
155
- "removePathCollection",
156
- "getByPath"
157
- ];
158
- var PROPS_METHODS2 = ["update", "__element"];
159
- var METHODS2 = [
160
- "set",
161
- "reset",
162
- "update",
163
- "remove",
164
- "updateContent",
165
- "removeContent",
166
- "lookup",
167
- "lookdown",
168
- "lookdownAll",
169
- "getRef",
170
- "getPath",
171
- "setNodeStyles",
172
- "spotByPath",
173
- "keys",
174
- "parse",
175
- "setProps",
176
- "parseDeep",
177
- "variables",
178
- "if",
179
- "log",
180
- "verbose",
181
- "warn",
182
- "error",
183
- "call",
184
- "nextElement",
185
- "previousElement"
186
- ];
187
- var METHODS_EXL2 = [
188
- ...["node", "context", "extends", "__element", "__ref"],
189
- ...METHODS2,
190
- ...STATE_METHODS2,
191
- ...PROPS_METHODS2
192
- ];
193
-
194
- // ../../../domql/packages/event/dist/esm/globals.js
195
- var window3 = globalThis;
196
- var document3 = window3.document;
197
-
198
- // src/utils/color.js
199
- var ENV = "development";
200
- var colorStringToRgbaArray = (color) => {
201
- if (color === "") return [0, 0, 0, 0];
202
- if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
203
- if (color[0] === "#") {
204
- if (color.length < 7) {
205
- color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
206
- }
207
- return [
208
- parseInt(color.substr(1, 2), 16),
209
- parseInt(color.substr(3, 2), 16),
210
- parseInt(color.substr(5, 2), 16),
211
- color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
212
- ];
213
- }
214
- if (color.indexOf("rgb") === -1) {
215
- if (document2 && window2) {
216
- const elem = document2.body.appendChild(document2.createElement("fictum"));
217
- const flag = "rgb(1, 2, 3)";
218
- elem.style.color = flag;
219
- if (elem.style.color !== flag) {
220
- document2.body.removeChild(elem);
221
- return;
222
- }
223
- elem.style.color = color;
224
- if (elem.style.color === flag || elem.style.color === "") {
225
- document2.body.removeChild(elem);
226
- return [0, 0, 0, 0];
227
- }
228
- color = window2.getComputedStyle(elem).color;
229
- document2.body.removeChild(elem);
230
- }
231
- }
232
- if (color.indexOf("rgb") === 0) {
233
- if (color.indexOf("rgba") === -1) color = `${color}, 1`;
234
- return color.match(/[\.\d]+/g).map((a) => +a);
235
- }
236
- return [0, 0, 0, 0];
237
- };
238
- var mixTwoColors = (colorA, colorB, range = 0.5) => {
239
- colorA = colorStringToRgbaArray(colorA);
240
- colorB = colorStringToRgbaArray(colorB);
241
- return mixTwoRgba(colorA, colorB, range);
242
- };
243
- var hexToRgb = (hex, alpha = 1) => {
244
- const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
245
- return `rgb(${r},${g},${b})`;
246
- };
247
- var hexToRgbArray = (hex, alpha = 1) => {
248
- const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
249
- return [r, g, b];
250
- };
251
- var rgbToHex = (r, g, b) => {
252
- return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
253
- };
254
- var rgbArrayToHex = ([r, g, b]) => {
255
- return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
256
- };
257
- var hexToRgba = (hex, alpha = 1) => {
258
- const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
259
- return `rgba(${r},${g},${b},${alpha})`;
260
- };
261
- var mixTwoRgb = (colorA, colorB, range = 0.5) => {
262
- const arr = [];
263
- for (let i = 0; i < 3; i++) {
264
- arr[i] = ~~(colorA[i] + (colorB[i] - colorA[i]) * range);
265
- }
266
- return `rgb(${arr})`;
267
- };
268
- var changeLightness = (delta, hsl) => {
269
- const [hue, saturation, lightness] = hsl;
270
- const newLightness = Math.max(
271
- 0,
272
- Math.min(100, lightness + parseFloat(delta))
273
- );
274
- return [hue, saturation, newLightness];
275
- };
276
- var rgbToHSL = (r, g, b) => {
277
- const a = Math.max(r, g, b);
278
- const n = a - Math.min(r, g, b);
279
- const f = 1 - Math.abs(a + a - n - 1);
280
- const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
281
- return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
282
- };
283
- var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
284
- Math.min(k - 3, 9 - k, 1),
285
- -1
286
- )) => [f(0), f(8), f(4)];
287
- var getColorShade = (col, amt) => {
288
- const num = parseInt(col, 16);
289
- let r = (num >> 16) + amt;
290
- if (r > 255) r = 255;
291
- else if (r < 0) r = 0;
292
- let b = (num >> 8 & 255) + amt;
293
- if (b > 255) b = 255;
294
- else if (b < 0) b = 0;
295
- let g = (num & 255) + amt;
296
- if (g > 255) g = 255;
297
- else if (g < 0) g = 0;
298
- return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
299
- };
300
- var mixTwoRgba = (colorA, colorB, range = 0.5) => {
301
- const arr = [];
302
- for (let i = 0; i < 4; i++) {
303
- const round = i === 3 ? (x) => x : Math.round;
304
- arr[i] = round(
305
- colorA[i] + (colorB[i] - colorA[i]) * range
306
- );
307
- }
308
- return `rgba(${arr})`;
309
- };
310
- var opacify = (color, opacity) => {
311
- const arr = colorStringToRgbaArray(color);
312
- if (!arr) {
313
- if (ENV === "testing" || ENV === "development") console.warn(color + " color is not rgba");
314
- return;
315
- }
316
- arr[3] = opacity;
317
- return `rgba(${arr})`;
318
- };
319
- var getRgbTone = (rgb, tone) => {
320
- if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
321
- if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
322
- if (isNumber(tone)) tone += "";
323
- const toHex = rgbArrayToHex(rgb);
324
- const abs = tone.slice(0, 1);
325
- if (abs === "-" || abs === "+") {
326
- const colorShade = getColorShade(toHex, parseFloat(tone));
327
- return hexToRgbArray(colorShade).join(", ");
328
- } else {
329
- const [r, g, b] = rgb;
330
- const hsl = rgbToHSL(r, g, b);
331
- const [h, s, l] = hsl;
332
- const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
333
- return newRgb;
334
- }
335
- };
336
- // @preserve-env
@@ -1,69 +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
- setCustomFont: () => setCustomFont,
30
- setCustomFontMedia: () => setCustomFontMedia,
31
- setInCustomFontMedia: () => setInCustomFontMedia
32
- });
33
- module.exports = __toCommonJS(font_exports);
34
- var getDefaultOrFirstKey = (LIBRARY, key) => {
35
- if (LIBRARY[key]) return LIBRARY[key].value;
36
- if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
37
- const hasValue = Object.keys(LIBRARY)[0];
38
- return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
39
- };
40
- var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
41
- var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
42
- var setCustomFont = (name, url, weight) => `
43
- font-family: '${name}';
44
- font-style: normal;
45
- ${weight && `font-weight: ${weight};`}
46
- src: url('${url}') format('${getFontFormat(url)}');`;
47
- var setCustomFontMedia = (name, url, weight) => `@font-face {
48
- ${setCustomFont(name, url, weight)}
49
- }`;
50
- var getFontFaceEach = (name, weights) => {
51
- const keys = Object.keys(weights);
52
- return keys.map((key) => {
53
- const { url, fontWeight } = weights[key];
54
- return setCustomFont(name, url, fontWeight);
55
- });
56
- };
57
- var getFontFace = (LIBRARY) => {
58
- const keys = Object.keys(LIBRARY);
59
- return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
60
- };
61
- var getFontFaceEachString = (name, weights) => {
62
- const isArr = weights[0];
63
- if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
64
- return setCustomFontMedia(name, weights.url);
65
- };
66
- var getFontFaceString = (LIBRARY) => {
67
- const keys = Object.keys(LIBRARY);
68
- return keys.map((key) => getFontFaceEachString(key, LIBRARY[key].value));
69
- };