@symbo.ls/scratch 3.14.0 → 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/README.md +1 -1
- package/package.json +2 -2
- package/src/utils/sprite.js +29 -12
- package/dist/cjs/defaultConfig/animation.js +0 -24
- package/dist/cjs/defaultConfig/cases.js +0 -24
- package/dist/cjs/defaultConfig/class.js +0 -24
- package/dist/cjs/defaultConfig/color.js +0 -31
- package/dist/cjs/defaultConfig/document.js +0 -24
- package/dist/cjs/defaultConfig/font-family.js +0 -38
- package/dist/cjs/defaultConfig/font.js +0 -33
- package/dist/cjs/defaultConfig/grid.js +0 -25
- package/dist/cjs/defaultConfig/icons.js +0 -26
- package/dist/cjs/defaultConfig/index.js +0 -46
- package/dist/cjs/defaultConfig/media.js +0 -29
- package/dist/cjs/defaultConfig/responsive.js +0 -50
- package/dist/cjs/defaultConfig/sequence.js +0 -49
- package/dist/cjs/defaultConfig/shadow.js +0 -24
- package/dist/cjs/defaultConfig/spacing.js +0 -38
- package/dist/cjs/defaultConfig/svg.js +0 -26
- package/dist/cjs/defaultConfig/templates.js +0 -24
- package/dist/cjs/defaultConfig/theme.js +0 -36
- package/dist/cjs/defaultConfig/timing.js +0 -37
- package/dist/cjs/defaultConfig/typography.js +0 -41
- package/dist/cjs/defaultConfig/unit.js +0 -26
- package/dist/cjs/factory.js +0 -145
- package/dist/cjs/index.js +0 -45
- package/dist/cjs/set.js +0 -286
- package/dist/cjs/system/color.js +0 -268
- package/dist/cjs/system/document.js +0 -36
- package/dist/cjs/system/font.js +0 -71
- package/dist/cjs/system/index.js +0 -27
- package/dist/cjs/system/reset.js +0 -114
- package/dist/cjs/system/shadow.js +0 -108
- package/dist/cjs/system/spacing.js +0 -134
- package/dist/cjs/system/svg.js +0 -133
- package/dist/cjs/system/theme.js +0 -496
- package/dist/cjs/system/timing.js +0 -48
- package/dist/cjs/system/typography.js +0 -108
- package/dist/cjs/tests/index.js +0 -28
- package/dist/cjs/transforms/index.js +0 -219
- package/dist/cjs/utils/color.js +0 -206
- package/dist/cjs/utils/font.js +0 -114
- package/dist/cjs/utils/index.js +0 -24
- package/dist/cjs/utils/sequence.js +0 -342
- package/dist/cjs/utils/sprite.js +0 -92
- package/dist/cjs/utils/theme.js +0 -29
- package/dist/cjs/utils/unit.js +0 -79
- package/dist/cjs/utils/var.js +0 -116
- package/dist/esm/defaultConfig/animation.js +0 -4
- package/dist/esm/defaultConfig/cases.js +0 -4
- package/dist/esm/defaultConfig/class.js +0 -4
- package/dist/esm/defaultConfig/color.js +0 -11
- package/dist/esm/defaultConfig/document.js +0 -4
- package/dist/esm/defaultConfig/font-family.js +0 -18
- package/dist/esm/defaultConfig/font.js +0 -13
- package/dist/esm/defaultConfig/grid.js +0 -5
- package/dist/esm/defaultConfig/icons.js +0 -6
- package/dist/esm/defaultConfig/index.js +0 -25
- package/dist/esm/defaultConfig/media.js +0 -9
- package/dist/esm/defaultConfig/responsive.js +0 -30
- package/dist/esm/defaultConfig/sequence.js +0 -29
- package/dist/esm/defaultConfig/shadow.js +0 -4
- package/dist/esm/defaultConfig/spacing.js +0 -18
- package/dist/esm/defaultConfig/svg.js +0 -6
- package/dist/esm/defaultConfig/templates.js +0 -4
- package/dist/esm/defaultConfig/theme.js +0 -16
- package/dist/esm/defaultConfig/timing.js +0 -17
- package/dist/esm/defaultConfig/typography.js +0 -21
- package/dist/esm/defaultConfig/unit.js +0 -6
- package/dist/esm/factory.js +0 -120
- package/dist/esm/index.js +0 -14
- package/dist/esm/set.js +0 -280
- package/dist/esm/system/color.js +0 -253
- package/dist/esm/system/document.js +0 -16
- package/dist/esm/system/font.js +0 -58
- package/dist/esm/system/index.js +0 -10
- package/dist/esm/system/reset.js +0 -94
- package/dist/esm/system/shadow.js +0 -92
- package/dist/esm/system/spacing.js +0 -121
- package/dist/esm/system/svg.js +0 -113
- package/dist/esm/system/theme.js +0 -481
- package/dist/esm/system/timing.js +0 -32
- package/dist/esm/system/typography.js +0 -94
- package/dist/esm/tests/index.js +0 -8
- package/dist/esm/transforms/index.js +0 -216
- package/dist/esm/utils/color.js +0 -192
- package/dist/esm/utils/font.js +0 -94
- package/dist/esm/utils/index.js +0 -7
- package/dist/esm/utils/sequence.js +0 -322
- package/dist/esm/utils/sprite.js +0 -72
- package/dist/esm/utils/theme.js +0 -9
- package/dist/esm/utils/unit.js +0 -59
- package/dist/esm/utils/var.js +0 -96
- package/dist/iife/index.js +0 -3630
package/dist/cjs/system/color.js
DELETED
|
@@ -1,268 +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
|
-
var color_exports = {};
|
|
20
|
-
__export(color_exports, {
|
|
21
|
-
getColor: () => getColor,
|
|
22
|
-
getMediaColor: () => getMediaColor,
|
|
23
|
-
setColor: () => setColor,
|
|
24
|
-
setGradient: () => setGradient
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(color_exports);
|
|
27
|
-
var import_utils = require("@symbo.ls/utils");
|
|
28
|
-
var import_factory = require("../factory.js");
|
|
29
|
-
var import_utils2 = require("../utils/index.js");
|
|
30
|
-
const getColor = (value, key, config) => {
|
|
31
|
-
const CONFIG = config || (0, import_factory.getActiveConfig)();
|
|
32
|
-
if (!(0, import_utils.isString)(value)) {
|
|
33
|
-
if (CONFIG.verbose) console.warn(value, "- type for color is not valid");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if ((0, import_utils2.isCSSVar)(value)) return `var(${value})`;
|
|
37
|
-
if (key && value[key]) value = value[key];
|
|
38
|
-
let name, alpha, tone;
|
|
39
|
-
if ((0, import_utils.isArray)(value)) {
|
|
40
|
-
[name, alpha, tone] = value;
|
|
41
|
-
} else {
|
|
42
|
-
const parsed = (0, import_utils2.parseColorToken)(value);
|
|
43
|
-
if (!parsed) {
|
|
44
|
-
const { color: COLOR2, gradient: GRADIENT2 } = CONFIG;
|
|
45
|
-
const directVal = GRADIENT2[value] || COLOR2[value];
|
|
46
|
-
if (directVal) return CONFIG.useVariable ? `var(${directVal.var})` : directVal.value;
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
if (parsed.passthrough) return parsed.passthrough;
|
|
50
|
-
if (parsed.cssVar) return `var(${parsed.cssVar})`;
|
|
51
|
-
name = parsed.name;
|
|
52
|
-
alpha = parsed.alpha;
|
|
53
|
-
tone = parsed.tone;
|
|
54
|
-
}
|
|
55
|
-
const { color: COLOR, gradient: GRADIENT } = CONFIG;
|
|
56
|
-
let val = COLOR[name] || GRADIENT[name];
|
|
57
|
-
if (!val) {
|
|
58
|
-
if (CONFIG.verbose) console.warn("Can't find color ", name);
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
if (key) {
|
|
62
|
-
if (val[key]) val = val[key];
|
|
63
|
-
else if (CONFIG.verbose) console.warn(value, " - does not have ", key);
|
|
64
|
-
}
|
|
65
|
-
let rgb = val.rgb;
|
|
66
|
-
if (!rgb) {
|
|
67
|
-
return CONFIG.useVariable ? `var(${val.var})` : val.value;
|
|
68
|
-
}
|
|
69
|
-
if (tone && !val[tone]) {
|
|
70
|
-
rgb = (0, import_utils2.getRgbTone)(rgb, tone);
|
|
71
|
-
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
72
|
-
}
|
|
73
|
-
if (val[tone]) rgb = val[tone].rgb;
|
|
74
|
-
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
75
|
-
if (tone) return `rgba(${rgb}, 1)`;
|
|
76
|
-
return CONFIG.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
77
|
-
};
|
|
78
|
-
const getMediaColor = (value, globalTheme, config) => {
|
|
79
|
-
const CONFIG = config || (0, import_factory.getActiveConfig)();
|
|
80
|
-
if (!globalTheme) globalTheme = CONFIG.globalTheme === "auto" ? null : CONFIG.globalTheme;
|
|
81
|
-
if (!(0, import_utils.isString)(value)) {
|
|
82
|
-
if (CONFIG.verbose) console.warn(value, "- type for color is not valid");
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if ((0, import_utils2.isCSSVar)(value)) return `var(${value})`;
|
|
86
|
-
let name;
|
|
87
|
-
if ((0, import_utils.isArray)(value)) {
|
|
88
|
-
name = value[0];
|
|
89
|
-
} else {
|
|
90
|
-
const parsed = (0, import_utils2.parseColorToken)(value);
|
|
91
|
-
if (!parsed) return value;
|
|
92
|
-
if (parsed.passthrough) return parsed.passthrough;
|
|
93
|
-
if (parsed.cssVar) return `var(${parsed.cssVar})`;
|
|
94
|
-
name = parsed.name;
|
|
95
|
-
}
|
|
96
|
-
const { color: COLOR, gradient: GRADIENT } = CONFIG;
|
|
97
|
-
const val = COLOR[name] || GRADIENT[name];
|
|
98
|
-
const isObj = (0, import_utils.isObject)(val);
|
|
99
|
-
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
100
|
-
else if (isObj) {
|
|
101
|
-
if (CONFIG.useVariable && val.var) return `var(${val.var})`;
|
|
102
|
-
if (globalTheme) return getColor(value, `@${globalTheme}`, config);
|
|
103
|
-
else {
|
|
104
|
-
const obj = {};
|
|
105
|
-
for (const mediaName in val) {
|
|
106
|
-
if (mediaName.charCodeAt(0) !== 64) continue;
|
|
107
|
-
const query = CONFIG.media[mediaName.slice(1)];
|
|
108
|
-
if (!query) continue;
|
|
109
|
-
const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
|
|
110
|
-
obj[media] = getColor(value, mediaName, config);
|
|
111
|
-
}
|
|
112
|
-
return obj;
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
if (CONFIG.verbose) console.warn("Can't find color", value);
|
|
116
|
-
return value;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const setColor = (val, key, suffix) => {
|
|
120
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
121
|
-
if ((0, import_utils.isString)(val) && (0, import_utils2.isCSSVar)(val)) {
|
|
122
|
-
const rawRef = val.slice(2);
|
|
123
|
-
val = getColor(rawRef);
|
|
124
|
-
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
125
|
-
const parts = rawRef.split(" ");
|
|
126
|
-
let refColor = CONFIG.color[parts[0]];
|
|
127
|
-
if (refColor && !refColor.value && !refColor.rgb && ((0, import_utils.isString)(refColor) || (0, import_utils.isArray)(refColor) || (0, import_utils.isObject)(refColor))) {
|
|
128
|
-
CONFIG.color[parts[0]] = setColor(refColor, parts[0]);
|
|
129
|
-
refColor = CONFIG.color[parts[0]];
|
|
130
|
-
}
|
|
131
|
-
if (refColor && refColor.value) {
|
|
132
|
-
let rgb2 = refColor.rgb;
|
|
133
|
-
const alpha2 = parts[1] !== void 0 ? parts[1] : "1";
|
|
134
|
-
const tone = parts[2];
|
|
135
|
-
if (tone) {
|
|
136
|
-
rgb2 = (0, import_utils2.getRgbTone)(rgb2, tone);
|
|
137
|
-
}
|
|
138
|
-
val = `rgba(${rgb2}, ${alpha2})`;
|
|
139
|
-
} else {
|
|
140
|
-
const tone = parts[2];
|
|
141
|
-
const alpha2 = parts[1] !== void 0 ? parts[1] : "1";
|
|
142
|
-
if (tone) {
|
|
143
|
-
try {
|
|
144
|
-
const rgb2 = (0, import_utils2.colorStringToRgbaArray)(parts[0]);
|
|
145
|
-
if (rgb2 && rgb2.length >= 3) {
|
|
146
|
-
const tonedRgb = (0, import_utils2.getRgbTone)(rgb2.slice(0, 3).join(", "), tone);
|
|
147
|
-
val = `rgba(${tonedRgb}, ${alpha2})`;
|
|
148
|
-
} else {
|
|
149
|
-
val = parts[0];
|
|
150
|
-
}
|
|
151
|
-
} catch (e) {
|
|
152
|
-
val = parts[0];
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
val = parts[0];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if ((0, import_utils.isArray)(val)) {
|
|
161
|
-
val = { "@light": val[0], "@dark": val[1] };
|
|
162
|
-
}
|
|
163
|
-
if ((0, import_utils.isObject)(val)) {
|
|
164
|
-
const obj = {};
|
|
165
|
-
for (const variant in val) {
|
|
166
|
-
obj[variant] = setColor(
|
|
167
|
-
val[variant],
|
|
168
|
-
key,
|
|
169
|
-
variant.slice(0, 1) === "@" ? variant.slice(1) : variant
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
if (CONFIG.useVariable) {
|
|
173
|
-
const vp2 = CONFIG.varPrefix ? CONFIG.varPrefix + "-" : "";
|
|
174
|
-
const adaptiveVar = `--${vp2}color-${key}`;
|
|
175
|
-
let fallbackValue;
|
|
176
|
-
const schemeValues = {};
|
|
177
|
-
for (const variant in obj) {
|
|
178
|
-
if (variant.charCodeAt(0) !== 64) continue;
|
|
179
|
-
const scheme = variant.slice(1);
|
|
180
|
-
const entry = obj[variant];
|
|
181
|
-
const value2 = entry && (entry.value || entry);
|
|
182
|
-
if (!value2 || typeof value2 !== "string") continue;
|
|
183
|
-
schemeValues[scheme] = value2;
|
|
184
|
-
if (scheme === "light" || fallbackValue === void 0) fallbackValue = value2;
|
|
185
|
-
}
|
|
186
|
-
if (fallbackValue !== void 0) {
|
|
187
|
-
CONFIG.cssVars[adaptiveVar] = fallbackValue;
|
|
188
|
-
if (!CONFIG.cssMediaVars) CONFIG.cssMediaVars = {};
|
|
189
|
-
for (const scheme in schemeValues) {
|
|
190
|
-
const sel = `[data-theme="${scheme}"]`;
|
|
191
|
-
if (!CONFIG.cssMediaVars[sel]) CONFIG.cssMediaVars[sel] = {};
|
|
192
|
-
CONFIG.cssMediaVars[sel][adaptiveVar] = schemeValues[scheme];
|
|
193
|
-
if (scheme === "light" || scheme === "dark") {
|
|
194
|
-
const mq = `@media (prefers-color-scheme: ${scheme})`;
|
|
195
|
-
if (!CONFIG.cssMediaVars[mq]) CONFIG.cssMediaVars[mq] = {};
|
|
196
|
-
CONFIG.cssMediaVars[mq][adaptiveVar] = schemeValues[scheme];
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
obj.var = adaptiveVar;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return obj;
|
|
203
|
-
}
|
|
204
|
-
const vp = CONFIG.varPrefix ? CONFIG.varPrefix + "-" : "";
|
|
205
|
-
const CSSVar = `--${vp}color-${key}` + (suffix ? `-${suffix}` : "");
|
|
206
|
-
let resolvedVal = val.value || val;
|
|
207
|
-
if ((0, import_utils.isString)(resolvedVal) && resolvedVal.includes(".") && !resolvedVal.includes("(")) {
|
|
208
|
-
const [colorRef, alphaStr] = resolvedVal.split(".");
|
|
209
|
-
const refColor = CONFIG.color[colorRef];
|
|
210
|
-
if (refColor && refColor.rgb) {
|
|
211
|
-
resolvedVal = `rgba(${refColor.rgb}, ${parseFloat("0." + alphaStr) || 1})`;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
if ((0, import_utils.isString)(resolvedVal) && !resolvedVal.includes("(") && !resolvedVal.startsWith("#")) {
|
|
215
|
-
const parsed = (0, import_utils2.parseColorToken)(resolvedVal);
|
|
216
|
-
if (parsed && parsed.name && !parsed.passthrough && !parsed.cssVar) {
|
|
217
|
-
const refColor = CONFIG.color[parsed.name];
|
|
218
|
-
if (refColor && !refColor.value && !refColor.rgb && ((0, import_utils.isString)(refColor) || (0, import_utils.isArray)(refColor) || (0, import_utils.isObject)(refColor))) {
|
|
219
|
-
CONFIG.color[parsed.name] = setColor(refColor, parsed.name);
|
|
220
|
-
}
|
|
221
|
-
const baseColor = CONFIG.color[parsed.name];
|
|
222
|
-
if (baseColor && baseColor.rgb) {
|
|
223
|
-
let rgb2 = baseColor.rgb;
|
|
224
|
-
if (parsed.tone) rgb2 = (0, import_utils2.getRgbTone)(rgb2, parsed.tone);
|
|
225
|
-
const alphaVal = parsed.alpha ? parseFloat(parsed.alpha) : 1;
|
|
226
|
-
resolvedVal = `rgba(${rgb2}, ${alphaVal})`;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const colorArr = (0, import_utils2.colorStringToRgbaArray)(resolvedVal);
|
|
231
|
-
const [r, g, b, a = 1] = colorArr;
|
|
232
|
-
const alpha = parseFloat(a.toFixed(2));
|
|
233
|
-
const rgb = `${r}, ${g}, ${b}`;
|
|
234
|
-
const value = `rgba(${rgb}, ${alpha})`;
|
|
235
|
-
if (CONFIG.useVariable) {
|
|
236
|
-
CONFIG.cssVars[CSSVar] = value;
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
var: CSSVar,
|
|
240
|
-
rgb,
|
|
241
|
-
alpha,
|
|
242
|
-
value
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
const setGradient = (val, key, suffix) => {
|
|
246
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
247
|
-
if ((0, import_utils.isString)(val) && (0, import_utils2.isCSSVar)(val)) val = getColor(val.slice(2));
|
|
248
|
-
if ((0, import_utils.isArray)(val)) {
|
|
249
|
-
return {
|
|
250
|
-
"@light": setGradient(val[0], key, "light"),
|
|
251
|
-
"@dark": setGradient(val[0], key, "dark")
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
if ((0, import_utils.isObject)(val)) {
|
|
255
|
-
const obj = {};
|
|
256
|
-
for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
257
|
-
return obj;
|
|
258
|
-
}
|
|
259
|
-
const vp = CONFIG.varPrefix ? CONFIG.varPrefix + "-" : "";
|
|
260
|
-
const CSSVar = `--${vp}gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
261
|
-
if (CONFIG.useVariable) {
|
|
262
|
-
CONFIG.cssVars[CSSVar] = val.value || val;
|
|
263
|
-
}
|
|
264
|
-
return {
|
|
265
|
-
var: CSSVar,
|
|
266
|
-
value: val.value || val
|
|
267
|
-
};
|
|
268
|
-
};
|
|
@@ -1,36 +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
|
-
var document_exports = {};
|
|
20
|
-
__export(document_exports, {
|
|
21
|
-
applyDocument: () => applyDocument
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(document_exports);
|
|
24
|
-
var import_utils = require("@symbo.ls/utils");
|
|
25
|
-
var import_factory = require("../factory.js");
|
|
26
|
-
var import_utils2 = require("../utils/index.js");
|
|
27
|
-
const applyDocument = () => {
|
|
28
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
29
|
-
const { document: DOCUMENT, fontFamily: FONT_FAMILY, theme: THEME, typography: TYPOGRAPHY } = CONFIG;
|
|
30
|
-
return (0, import_utils.merge)(DOCUMENT, {
|
|
31
|
-
theme: THEME.document,
|
|
32
|
-
fontFamily: (0, import_utils2.getDefaultOrFirstKey)(FONT_FAMILY),
|
|
33
|
-
fontSize: TYPOGRAPHY.base,
|
|
34
|
-
lineHeight: TYPOGRAPHY.lineHeight
|
|
35
|
-
});
|
|
36
|
-
};
|
package/dist/cjs/system/font.js
DELETED
|
@@ -1,71 +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
|
-
var font_exports = {};
|
|
20
|
-
__export(font_exports, {
|
|
21
|
-
getFontFamily: () => getFontFamily,
|
|
22
|
-
setFont: () => setFont,
|
|
23
|
-
setFontFamily: () => setFontFamily
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(font_exports);
|
|
26
|
-
var import_utils = require("@symbo.ls/utils");
|
|
27
|
-
var import_utils2 = require("@symbo.ls/utils");
|
|
28
|
-
var import_factory = require("../factory.js");
|
|
29
|
-
var import_utils3 = require("../utils/index.js");
|
|
30
|
-
const setFont = (val, key) => {
|
|
31
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
32
|
-
const CSSvar = `--font-${key}`;
|
|
33
|
-
if (!val || (0, import_utils.isArray)(val) && !val[0]) return;
|
|
34
|
-
let fontFace;
|
|
35
|
-
if (val.isVariable) {
|
|
36
|
-
const url = (0, import_utils3.resolveFileUrl)(val.url, CONFIG.files) || val.url;
|
|
37
|
-
if ((0, import_utils3.isGoogleFontsUrl)(url)) {
|
|
38
|
-
fontFace = (0, import_utils3.setFontImport)(url);
|
|
39
|
-
} else {
|
|
40
|
-
fontFace = (0, import_utils3.setCustomFontMedia)(key, url, val.fontWeight, {
|
|
41
|
-
fontStretch: val.fontStretch,
|
|
42
|
-
fontDisplay: val.fontDisplay || "swap"
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
} else if (val[0]) {
|
|
46
|
-
fontFace = (0, import_utils3.getFontFaceEach)(key, val, CONFIG.files);
|
|
47
|
-
} else {
|
|
48
|
-
const url = Array.isArray(val.url) ? val.url.map((u) => (0, import_utils3.resolveFileUrl)(u, CONFIG.files) || u) : (0, import_utils3.resolveFileUrl)(val.url, CONFIG.files) || val.url;
|
|
49
|
-
fontFace = (0, import_utils3.setCustomFontMedia)(key, url, val.fontWeight, {
|
|
50
|
-
fontStyle: val.fontStyle,
|
|
51
|
-
fontDisplay: val.fontDisplay,
|
|
52
|
-
fontStretch: val.fontStretch
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return { var: CSSvar, value: val, fontFace };
|
|
56
|
-
};
|
|
57
|
-
const getFontFamily = (key, factory) => {
|
|
58
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
59
|
-
const { fontFamily: FONT_FAMILY } = CONFIG;
|
|
60
|
-
return (0, import_utils3.getDefaultOrFirstKey)(factory || FONT_FAMILY, key);
|
|
61
|
-
};
|
|
62
|
-
const setFontFamily = (val, key) => {
|
|
63
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
64
|
-
const { fontFamily: FONT_FAMILY, fontFamilyTypes: FONT_FAMILY_TYPES } = CONFIG;
|
|
65
|
-
let { value, type } = val;
|
|
66
|
-
if (val.isDefault) FONT_FAMILY.default = key;
|
|
67
|
-
if ((0, import_utils.isObject)(value)) value = (0, import_utils2.arrayzeValue)(value);
|
|
68
|
-
const CSSvar = `--font-family-${key}`;
|
|
69
|
-
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES[type]}`;
|
|
70
|
-
return { var: CSSvar, value: str, arr: value, type };
|
|
71
|
-
};
|
package/dist/cjs/system/index.js
DELETED
|
@@ -1,27 +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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var system_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(system_exports);
|
|
18
|
-
__reExport(system_exports, require("./color.js"), module.exports);
|
|
19
|
-
__reExport(system_exports, require("./theme.js"), module.exports);
|
|
20
|
-
__reExport(system_exports, require("./font.js"), module.exports);
|
|
21
|
-
__reExport(system_exports, require("./typography.js"), module.exports);
|
|
22
|
-
__reExport(system_exports, require("./spacing.js"), module.exports);
|
|
23
|
-
__reExport(system_exports, require("./shadow.js"), module.exports);
|
|
24
|
-
__reExport(system_exports, require("./timing.js"), module.exports);
|
|
25
|
-
__reExport(system_exports, require("./document.js"), module.exports);
|
|
26
|
-
__reExport(system_exports, require("./svg.js"), module.exports);
|
|
27
|
-
__reExport(system_exports, require("./reset.js"), module.exports);
|
package/dist/cjs/system/reset.js
DELETED
|
@@ -1,114 +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
|
-
var reset_exports = {};
|
|
20
|
-
__export(reset_exports, {
|
|
21
|
-
applyReset: () => applyReset
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(reset_exports);
|
|
24
|
-
var import_utils = require("@symbo.ls/utils");
|
|
25
|
-
var import_factory = require("../factory.js");
|
|
26
|
-
var import_theme = require("./theme.js");
|
|
27
|
-
const applyReset = (reset = {}) => {
|
|
28
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
29
|
-
const { reset: RESET, typography: TYPOGRAPHY, document: DOCUMENT } = CONFIG;
|
|
30
|
-
if (RESET) {
|
|
31
|
-
if (RESET[":root"]) {
|
|
32
|
-
const configReset = RESET;
|
|
33
|
-
const configTemplates = TYPOGRAPHY.templates;
|
|
34
|
-
configReset.body = {
|
|
35
|
-
...CONFIG.useDocumentTheme ? (0, import_theme.getMediaTheme)("document") : {},
|
|
36
|
-
...configTemplates.body
|
|
37
|
-
};
|
|
38
|
-
configReset.h1 = configTemplates.h1;
|
|
39
|
-
configReset.h2 = configTemplates.h2;
|
|
40
|
-
configReset.h3 = configTemplates.h3;
|
|
41
|
-
configReset.h4 = configTemplates.h4;
|
|
42
|
-
configReset.h5 = configTemplates.h5;
|
|
43
|
-
configReset.h6 = configTemplates.h6;
|
|
44
|
-
}
|
|
45
|
-
const { body, ...templates } = TYPOGRAPHY.templates;
|
|
46
|
-
const globalTheme = CONFIG.useDocumentTheme ? (0, import_theme.getMediaTheme)("document") : {};
|
|
47
|
-
if (RESET.html) (0, import_utils.overwriteDeep)(RESET.html, globalTheme);
|
|
48
|
-
if (TYPOGRAPHY.unit) {
|
|
49
|
-
const { media: MEDIA } = CONFIG;
|
|
50
|
-
for (const key in TYPOGRAPHY) {
|
|
51
|
-
if (key.charAt(0) !== "@") continue;
|
|
52
|
-
const mediaTypo = TYPOGRAPHY[key];
|
|
53
|
-
if (!mediaTypo) continue;
|
|
54
|
-
if (mediaTypo.unit === TYPOGRAPHY.unit || !mediaTypo.unit) continue;
|
|
55
|
-
const mediaUnit = mediaTypo.unit;
|
|
56
|
-
const mediaBase = mediaTypo.base || TYPOGRAPHY.base;
|
|
57
|
-
const mediaBrowserDefault = mediaTypo.browserDefault || TYPOGRAPHY.browserDefault;
|
|
58
|
-
const mediaName = key.slice(1);
|
|
59
|
-
const query = MEDIA[mediaName];
|
|
60
|
-
if (!query) continue;
|
|
61
|
-
const mediaKey = "@media " + (query === "print" ? query : "screen and " + query);
|
|
62
|
-
if (!RESET[mediaKey]) RESET[mediaKey] = {};
|
|
63
|
-
if (!RESET[mediaKey].html) RESET[mediaKey].html = {};
|
|
64
|
-
RESET[mediaKey].html.fontSize = mediaBase / mediaBrowserDefault + mediaUnit;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return (0, import_utils.deepMerge)((0, import_utils.merge)(RESET, reset), {
|
|
68
|
-
html: {
|
|
69
|
-
position: "absolute",
|
|
70
|
-
width: "100%",
|
|
71
|
-
height: "100%",
|
|
72
|
-
top: "0",
|
|
73
|
-
left: "0",
|
|
74
|
-
margin: "0",
|
|
75
|
-
WebkitFontSmoothing: "subpixel-antialiased",
|
|
76
|
-
scrollBehavior: "smooth",
|
|
77
|
-
...globalTheme,
|
|
78
|
-
fontSize: TYPOGRAPHY.unit ? TYPOGRAPHY.base / TYPOGRAPHY.browserDefault + TYPOGRAPHY.unit : TYPOGRAPHY.browserDefault + "px",
|
|
79
|
-
fontFamily: DOCUMENT.fontFamily,
|
|
80
|
-
lineHeight: DOCUMENT.lineHeight
|
|
81
|
-
},
|
|
82
|
-
body: {
|
|
83
|
-
boxSizing: "border-box",
|
|
84
|
-
height: "100%",
|
|
85
|
-
margin: 0,
|
|
86
|
-
fontFamily: DOCUMENT.fontFamily,
|
|
87
|
-
fontSize: TYPOGRAPHY.base / TYPOGRAPHY.browserDefault + CONFIG.unit.default,
|
|
88
|
-
...templates,
|
|
89
|
-
...body
|
|
90
|
-
},
|
|
91
|
-
a: {
|
|
92
|
-
color: "currentColor"
|
|
93
|
-
},
|
|
94
|
-
button: {
|
|
95
|
-
color: "inherit",
|
|
96
|
-
font: "inherit",
|
|
97
|
-
background: "transparent",
|
|
98
|
-
border: "none",
|
|
99
|
-
cursor: "pointer",
|
|
100
|
-
appearance: "none",
|
|
101
|
-
WebkitAppearance: "none"
|
|
102
|
-
},
|
|
103
|
-
"input, select, textarea": {
|
|
104
|
-
color: "inherit",
|
|
105
|
-
font: "inherit"
|
|
106
|
-
},
|
|
107
|
-
fieldset: {
|
|
108
|
-
border: 0,
|
|
109
|
-
padding: 0,
|
|
110
|
-
margin: 0
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
@@ -1,108 +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
|
-
var shadow_exports = {};
|
|
20
|
-
__export(shadow_exports, {
|
|
21
|
-
getShadow: () => getShadow,
|
|
22
|
-
setShadow: () => setShadow
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(shadow_exports);
|
|
25
|
-
var import_factory = require("../factory.js");
|
|
26
|
-
var import_color = require("./color.js");
|
|
27
|
-
var import_spacing = require("./spacing.js");
|
|
28
|
-
var import_color2 = require("../utils/color.js");
|
|
29
|
-
var import_utils = require("@symbo.ls/utils");
|
|
30
|
-
const setShadow = (value, key, suffix, prefers) => {
|
|
31
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
32
|
-
if ((0, import_utils.isArray)(value)) {
|
|
33
|
-
return {
|
|
34
|
-
"@light": setShadow(value[0], key, "light"),
|
|
35
|
-
"@dark": setShadow(value[1], key, "dark")
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
if ((0, import_utils.isObject)(value)) {
|
|
39
|
-
const obj = {};
|
|
40
|
-
for (const variant in value) {
|
|
41
|
-
obj[variant] = setShadow(
|
|
42
|
-
value[variant],
|
|
43
|
-
key,
|
|
44
|
-
variant.startsWith("@") ? variant.slice(1) : variant
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return obj;
|
|
48
|
-
}
|
|
49
|
-
if ((0, import_utils.isString)(value) && !import_color2.CSS_NATIVE_COLOR_REGEX.test(value)) {
|
|
50
|
-
value = (0, import_color2.splitTopLevelCommas)(value).map((shadow) => {
|
|
51
|
-
shadow = shadow.trim();
|
|
52
|
-
return shadow.split(/\s+/).map((v) => {
|
|
53
|
-
v = v.trim();
|
|
54
|
-
if (!v) return "";
|
|
55
|
-
if (v.startsWith("--")) return `var(${v})`;
|
|
56
|
-
const color = (0, import_color.getColor)(v);
|
|
57
|
-
if ((0, import_color2.isResolvedColor)(color)) return color;
|
|
58
|
-
if (/^\d/.test(v) || v === "0" || v.includes("px") || v.slice(-2) === "em") return v;
|
|
59
|
-
if (v === "inset" || v === "none") return v;
|
|
60
|
-
const spacing = (0, import_spacing.getSpacingByKey)(v, "shadow");
|
|
61
|
-
if (spacing && spacing.shadow) return spacing.shadow;
|
|
62
|
-
return v;
|
|
63
|
-
}).join(" ");
|
|
64
|
-
}).join(", ");
|
|
65
|
-
}
|
|
66
|
-
const vp = CONFIG.varPrefix ? CONFIG.varPrefix + "-" : "";
|
|
67
|
-
const CSSVar = `--${vp}shadow-${key}` + (suffix ? `-${suffix}` : "");
|
|
68
|
-
if (CONFIG.useVariable) {
|
|
69
|
-
CONFIG.cssVars[CSSVar] = value;
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
var: CSSVar,
|
|
73
|
-
value
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
const getShadow = (value, globalTheme) => {
|
|
77
|
-
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
78
|
-
if (!globalTheme) globalTheme = CONFIG.globalTheme;
|
|
79
|
-
if (!(0, import_utils.isString)(value)) {
|
|
80
|
-
if (CONFIG.verbose) console.warn(value, "- type for color is not valid");
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if ((0, import_color2.isCSSVar)(value)) return `var(${value})`;
|
|
84
|
-
const [name] = (0, import_utils.isArray)(value) ? value : value.split(" ");
|
|
85
|
-
const SHADOW = CONFIG.shadow;
|
|
86
|
-
const val = SHADOW[name];
|
|
87
|
-
const isObj = (0, import_utils.isObject)(val);
|
|
88
|
-
if (!val) {
|
|
89
|
-
if (CONFIG.verbose) console.warn("Can't find color ", name);
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
if (globalTheme) {
|
|
93
|
-
if (val[globalTheme]) return val[globalTheme].value;
|
|
94
|
-
else if (CONFIG.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
95
|
-
}
|
|
96
|
-
if (isObj && val.value) return val.value;
|
|
97
|
-
if (isObj) {
|
|
98
|
-
const obj = {};
|
|
99
|
-
for (const mediaName in val) {
|
|
100
|
-
const query = CONFIG.media[mediaName.slice(1)];
|
|
101
|
-
const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
|
|
102
|
-
obj[media] = val.value;
|
|
103
|
-
}
|
|
104
|
-
return obj;
|
|
105
|
-
}
|
|
106
|
-
if (CONFIG.verbose) console.warn("Can't find color", value);
|
|
107
|
-
return value;
|
|
108
|
-
};
|