@symbo.ls/scratch 2.10.149 → 2.10.156
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/defaultConfig/animation.js +24 -0
- package/dist/cjs/defaultConfig/cases.js +24 -0
- package/dist/cjs/defaultConfig/color.js +32 -0
- package/dist/cjs/defaultConfig/document.js +24 -0
- package/dist/cjs/defaultConfig/font-family.js +39 -0
- package/dist/cjs/defaultConfig/font.js +33 -0
- package/dist/cjs/defaultConfig/icons.js +24 -0
- package/dist/cjs/defaultConfig/index.js +41 -0
- package/dist/cjs/defaultConfig/media.js +39 -0
- package/dist/cjs/defaultConfig/responsive.js +48 -0
- package/dist/cjs/defaultConfig/sequence.js +49 -0
- package/dist/cjs/defaultConfig/spacing.js +36 -0
- package/dist/cjs/defaultConfig/svg.js +26 -0
- package/dist/cjs/defaultConfig/theme.js +36 -0
- package/dist/cjs/defaultConfig/timing.js +36 -0
- package/dist/cjs/defaultConfig/typography.js +39 -0
- package/dist/cjs/defaultConfig/unit.js +26 -0
- package/dist/cjs/factory.js +69 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/set.js +121 -0
- package/dist/cjs/system/color.js +169 -0
- package/dist/cjs/system/document.js +35 -0
- package/dist/cjs/system/font.js +50 -0
- package/dist/cjs/system/index.js +26 -0
- package/dist/cjs/system/reset.js +83 -0
- package/dist/cjs/system/spacing.js +129 -0
- package/dist/cjs/system/svg.js +81 -0
- package/dist/cjs/system/theme.js +255 -0
- package/dist/cjs/system/timing.js +48 -0
- package/dist/cjs/system/typography.js +94 -0
- package/dist/cjs/tests/index.js +28 -0
- package/dist/cjs/utils/color.js +163 -0
- package/dist/cjs/utils/font.js +70 -0
- package/dist/cjs/utils/index.js +23 -0
- package/dist/cjs/utils/object.js +73 -0
- package/dist/cjs/utils/sequence.js +199 -0
- package/dist/cjs/utils/sprite.js +63 -0
- package/dist/cjs/utils/theme.js +32 -0
- package/dist/cjs/utils/var.js +64 -0
- package/dist/esm/defaultConfig/animation.js +4 -0
- package/dist/esm/defaultConfig/cases.js +4 -0
- package/dist/esm/defaultConfig/color.js +12 -0
- package/dist/esm/defaultConfig/document.js +4 -0
- package/dist/esm/defaultConfig/font-family.js +19 -0
- package/dist/esm/defaultConfig/font.js +13 -0
- package/dist/esm/defaultConfig/icons.js +4 -0
- package/dist/esm/defaultConfig/index.js +20 -0
- package/dist/esm/defaultConfig/media.js +19 -0
- package/dist/esm/defaultConfig/responsive.js +28 -0
- package/dist/esm/defaultConfig/sequence.js +29 -0
- package/dist/esm/defaultConfig/spacing.js +16 -0
- package/dist/esm/defaultConfig/svg.js +6 -0
- package/dist/esm/defaultConfig/theme.js +16 -0
- package/dist/esm/defaultConfig/timing.js +16 -0
- package/dist/esm/defaultConfig/typography.js +19 -0
- package/dist/esm/defaultConfig/unit.js +6 -0
- package/dist/esm/factory.js +39 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/set.js +113 -0
- package/dist/esm/system/color.js +156 -0
- package/dist/esm/system/document.js +15 -0
- package/dist/esm/system/font.js +35 -0
- package/dist/esm/system/index.js +9 -0
- package/dist/esm/system/reset.js +63 -0
- package/dist/esm/system/spacing.js +115 -0
- package/dist/esm/system/svg.js +61 -0
- package/dist/esm/system/theme.js +240 -0
- package/dist/esm/system/timing.js +32 -0
- package/dist/esm/system/typography.js +80 -0
- package/dist/esm/tests/index.js +8 -0
- package/dist/esm/utils/color.js +143 -0
- package/dist/esm/utils/font.js +50 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/object.js +53 -0
- package/dist/esm/utils/sequence.js +179 -0
- package/dist/esm/utils/sprite.js +43 -0
- package/dist/esm/utils/theme.js +12 -0
- package/dist/esm/utils/var.js +44 -0
- package/package.json +15 -15
- package/dist/index.cjs.js +0 -2389
- package/dist/index.cjs.js.map +0 -7
|
@@ -0,0 +1,21 @@
|
|
|
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 src_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
|
18
|
+
__reExport(src_exports, require("./factory.js"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./utils"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./set.js"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./defaultConfig"), module.exports);
|
package/dist/cjs/set.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var set_exports = {};
|
|
21
|
+
__export(set_exports, {
|
|
22
|
+
VALUE_TRANSFORMERS: () => VALUE_TRANSFORMERS,
|
|
23
|
+
set: () => set,
|
|
24
|
+
setEach: () => setEach,
|
|
25
|
+
setValue: () => setValue
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(set_exports);
|
|
28
|
+
var import_factory = require("./factory.js");
|
|
29
|
+
var import_system = require("./system");
|
|
30
|
+
var import_utils = require("./utils");
|
|
31
|
+
__reExport(set_exports, require("./system"), module.exports);
|
|
32
|
+
const ENV = "development";
|
|
33
|
+
const setCases = (val, key) => {
|
|
34
|
+
if ((0, import_utils.isFunction)(val))
|
|
35
|
+
return val();
|
|
36
|
+
return val;
|
|
37
|
+
};
|
|
38
|
+
const setSameValue = (val, key) => val;
|
|
39
|
+
const VALUE_TRANSFORMERS = {
|
|
40
|
+
color: import_system.setColor,
|
|
41
|
+
gradient: import_system.setGradient,
|
|
42
|
+
font: import_system.setFont,
|
|
43
|
+
font_family: import_system.setFontFamily,
|
|
44
|
+
theme: import_system.setTheme,
|
|
45
|
+
icons: import_system.setIcon,
|
|
46
|
+
svg: import_system.setSVG,
|
|
47
|
+
svg_data: setSameValue,
|
|
48
|
+
typography: setSameValue,
|
|
49
|
+
cases: setCases,
|
|
50
|
+
spacing: setSameValue,
|
|
51
|
+
media: setSameValue,
|
|
52
|
+
timing: setSameValue,
|
|
53
|
+
reset: setSameValue,
|
|
54
|
+
unit: setSameValue,
|
|
55
|
+
animation: setSameValue
|
|
56
|
+
};
|
|
57
|
+
const setValue = (FACTORY_NAME, value, key) => {
|
|
58
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
59
|
+
const factoryName = FACTORY_NAME.toLowerCase();
|
|
60
|
+
const FACTORY2 = CONFIG[FACTORY_NAME];
|
|
61
|
+
if (VALUE_TRANSFORMERS[factoryName]) {
|
|
62
|
+
const result = VALUE_TRANSFORMERS[factoryName](value, key);
|
|
63
|
+
FACTORY2[key] = result;
|
|
64
|
+
return FACTORY2;
|
|
65
|
+
}
|
|
66
|
+
if (CONFIG.verbose)
|
|
67
|
+
console.warn("Can not find", factoryName, "method in scratch");
|
|
68
|
+
};
|
|
69
|
+
const setEach = (factoryName, props) => {
|
|
70
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
71
|
+
const FACTORY_NAME = factoryName.toUpperCase();
|
|
72
|
+
const keys = Object.keys(props);
|
|
73
|
+
keys.map((key) => setValue(FACTORY_NAME, props[key], key));
|
|
74
|
+
return CONFIG[FACTORY_NAME];
|
|
75
|
+
};
|
|
76
|
+
const SET_OPTIONS = {};
|
|
77
|
+
const set = (recivedConfig, options = SET_OPTIONS) => {
|
|
78
|
+
let CONFIG = (0, import_factory.getActiveConfig)();
|
|
79
|
+
const {
|
|
80
|
+
version,
|
|
81
|
+
verbose,
|
|
82
|
+
useVariable,
|
|
83
|
+
useReset,
|
|
84
|
+
useSvgSprite,
|
|
85
|
+
useFontImport,
|
|
86
|
+
useIconSprite,
|
|
87
|
+
globalTheme,
|
|
88
|
+
useDocumentTheme,
|
|
89
|
+
...config
|
|
90
|
+
} = recivedConfig;
|
|
91
|
+
if (options.newConfig) {
|
|
92
|
+
import_factory.FACTORY["active"] = options.newConfig;
|
|
93
|
+
CONFIG = (0, import_factory.getActiveConfig)(options.newConfig);
|
|
94
|
+
}
|
|
95
|
+
if (verbose !== void 0)
|
|
96
|
+
CONFIG.verbose = verbose;
|
|
97
|
+
if (useVariable !== void 0)
|
|
98
|
+
CONFIG.useVariable = useVariable;
|
|
99
|
+
if (useReset !== void 0)
|
|
100
|
+
CONFIG.useReset = useReset;
|
|
101
|
+
if (useFontImport !== void 0)
|
|
102
|
+
CONFIG.useFontImport = useFontImport;
|
|
103
|
+
if (useSvgSprite !== void 0)
|
|
104
|
+
CONFIG.useSvgSprite = useSvgSprite;
|
|
105
|
+
if (useIconSprite !== void 0)
|
|
106
|
+
CONFIG.useIconSprite = useIconSprite;
|
|
107
|
+
if (useDocumentTheme !== void 0)
|
|
108
|
+
CONFIG.useDocumentTheme = useDocumentTheme;
|
|
109
|
+
if (globalTheme !== void 0)
|
|
110
|
+
CONFIG.globalTheme = globalTheme;
|
|
111
|
+
if (CONFIG.verbose)
|
|
112
|
+
console.log(CONFIG);
|
|
113
|
+
const keys = Object.keys(config);
|
|
114
|
+
keys.map((key) => setEach(key, config[key]));
|
|
115
|
+
(0, import_system.applyTypographySequence)();
|
|
116
|
+
(0, import_system.applySpacingSequence)();
|
|
117
|
+
(0, import_system.applyTimingSequence)();
|
|
118
|
+
(0, import_system.applyDocument)();
|
|
119
|
+
(0, import_system.applyReset)();
|
|
120
|
+
return CONFIG;
|
|
121
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
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_factory = require("../factory.js");
|
|
28
|
+
var import_utils = require("@domql/utils");
|
|
29
|
+
var import_utils2 = require("../utils");
|
|
30
|
+
const getColor = (value, key) => {
|
|
31
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
32
|
+
if (!(0, import_utils.isString)(value)) {
|
|
33
|
+
if (CONFIG.verbose)
|
|
34
|
+
console.warn(value, "- type for color is not valid");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (value.slice(0, 2) === "--")
|
|
38
|
+
return `var(${value})`;
|
|
39
|
+
if (key && value[key])
|
|
40
|
+
value = value[key];
|
|
41
|
+
const [name, alpha, tone] = (0, import_utils.isArray)(value) ? value : value.split(" ");
|
|
42
|
+
const { COLOR, GRADIENT } = CONFIG;
|
|
43
|
+
let val = COLOR[name] || GRADIENT[name];
|
|
44
|
+
if (!val) {
|
|
45
|
+
if (CONFIG.verbose)
|
|
46
|
+
console.warn("Can't find color ", name);
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
if (key) {
|
|
50
|
+
if (val[key])
|
|
51
|
+
val = val[key];
|
|
52
|
+
else if (CONFIG.verbose)
|
|
53
|
+
console.warn(value, " - does not have ", key);
|
|
54
|
+
}
|
|
55
|
+
let rgb = val.rgb;
|
|
56
|
+
if (rgb) {
|
|
57
|
+
if (tone) {
|
|
58
|
+
if (!val[tone]) {
|
|
59
|
+
const toHex = (0, import_utils2.rgbArrayToHex)(rgb.split(", ").map((v) => parseFloat(v)));
|
|
60
|
+
if (tone.slice(0, 1) === "-" || tone.slice(0, 1) === "+") {
|
|
61
|
+
rgb = (0, import_utils2.hexToRgbArray)((0, import_utils2.getColorShade)(toHex, parseFloat(tone))).join(", ");
|
|
62
|
+
} else {
|
|
63
|
+
const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
|
|
64
|
+
const hsl = (0, import_utils2.rgbToHSL)(r, g, b);
|
|
65
|
+
const [h, s, l] = hsl;
|
|
66
|
+
const newRgb = (0, import_utils2.hslToRgb)(h, s, parseFloat(tone) / 100 * 255);
|
|
67
|
+
rgb = newRgb;
|
|
68
|
+
}
|
|
69
|
+
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
70
|
+
} else
|
|
71
|
+
rgb = val[tone].rgb;
|
|
72
|
+
}
|
|
73
|
+
if (alpha)
|
|
74
|
+
return `rgba(${rgb}, ${alpha})`;
|
|
75
|
+
return CONFIG.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
76
|
+
} else
|
|
77
|
+
return CONFIG.useVariable ? `var(${val.var})` : val.value;
|
|
78
|
+
};
|
|
79
|
+
const getMediaColor = (value, property, globalTheme) => {
|
|
80
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
81
|
+
if (!globalTheme)
|
|
82
|
+
globalTheme = CONFIG.globalTheme;
|
|
83
|
+
if (!(0, import_utils.isString)(value)) {
|
|
84
|
+
if (CONFIG.verbose)
|
|
85
|
+
console.warn(value, "- type for color is not valid");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (value.slice(0, 2) === "--")
|
|
89
|
+
return { [property]: `var(${value})` };
|
|
90
|
+
const [name] = (0, import_utils.isArray)(value) ? value : value.split(" ");
|
|
91
|
+
const { COLOR, GRADIENT } = CONFIG;
|
|
92
|
+
const val = COLOR[name] || GRADIENT[name];
|
|
93
|
+
const isObj = (0, import_utils.isObject)(val);
|
|
94
|
+
if (isObj && val.value)
|
|
95
|
+
return { [property]: getColor(value, globalTheme) };
|
|
96
|
+
else if (isObj) {
|
|
97
|
+
if (globalTheme)
|
|
98
|
+
return { [property]: getColor(value, `@${globalTheme}`) };
|
|
99
|
+
else {
|
|
100
|
+
const obj = {};
|
|
101
|
+
for (const mediaName in val) {
|
|
102
|
+
const query = CONFIG.MEDIA[mediaName.slice(1)];
|
|
103
|
+
const media = `@media screen and ${query}`;
|
|
104
|
+
obj[media] = { [property]: getColor(value, mediaName) };
|
|
105
|
+
}
|
|
106
|
+
return obj;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
if (CONFIG.verbose)
|
|
110
|
+
console.warn("Can't find color", value);
|
|
111
|
+
return { [property]: value };
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const setColor = (val, key, suffix) => {
|
|
115
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
116
|
+
if ((0, import_utils.isString)(val) && val.slice(0, 2) === "--")
|
|
117
|
+
val = getColor(val.slice(2));
|
|
118
|
+
if ((0, import_utils.isArray)(val)) {
|
|
119
|
+
return {
|
|
120
|
+
"@light": setColor(val[0], key, "light"),
|
|
121
|
+
"@dark": setColor(val[1], key, "dark")
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if ((0, import_utils.isObject)(val)) {
|
|
125
|
+
const obj = {};
|
|
126
|
+
for (const variant in val)
|
|
127
|
+
obj[variant] = setColor(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
128
|
+
return obj;
|
|
129
|
+
}
|
|
130
|
+
const CSSVar = `--color-${key}` + (suffix ? `-${suffix}` : "");
|
|
131
|
+
const [r, g, b, a = 1] = (0, import_utils2.colorStringToRgbaArray)(val.value || val);
|
|
132
|
+
const alpha = parseFloat(a.toFixed(2));
|
|
133
|
+
const rgb = `${r}, ${g}, ${b}`;
|
|
134
|
+
const value = `rgba(${rgb}, ${alpha})`;
|
|
135
|
+
if (CONFIG.useVariable) {
|
|
136
|
+
CONFIG.CSS_VARS[CSSVar] = value;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
var: CSSVar,
|
|
140
|
+
rgb,
|
|
141
|
+
alpha,
|
|
142
|
+
value
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const setGradient = (val, key, suffix) => {
|
|
146
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
147
|
+
if ((0, import_utils.isString)(val) && val.slice(0, 2) === "--")
|
|
148
|
+
val = getColor(val.slice(2));
|
|
149
|
+
if ((0, import_utils.isArray)(val)) {
|
|
150
|
+
return {
|
|
151
|
+
"@light": setGradient(val[0], key, "light"),
|
|
152
|
+
"@dark": setGradient(val[0], key, "dark")
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if ((0, import_utils.isObject)(val)) {
|
|
156
|
+
const obj = {};
|
|
157
|
+
for (const variant in val)
|
|
158
|
+
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
159
|
+
return obj;
|
|
160
|
+
}
|
|
161
|
+
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
162
|
+
if (CONFIG.useVariable) {
|
|
163
|
+
CONFIG.CSS_VARS[CSSVar] = val.value || val;
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
var: CSSVar,
|
|
167
|
+
value: val.value || val
|
|
168
|
+
};
|
|
169
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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_factory = require("../factory.js");
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
const applyDocument = () => {
|
|
27
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
28
|
+
const { DOCUMENT, FONT_FAMILY, THEME, TYPOGRAPHY } = CONFIG;
|
|
29
|
+
return (0, import_utils.merge)(DOCUMENT, {
|
|
30
|
+
theme: THEME.document,
|
|
31
|
+
fontFamily: (0, import_utils.getDefaultOrFirstKey)(FONT_FAMILY),
|
|
32
|
+
fontSize: TYPOGRAPHY.base,
|
|
33
|
+
lineHeight: TYPOGRAPHY.lineHeight
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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("@domql/utils");
|
|
27
|
+
var import_factory = require("../factory.js");
|
|
28
|
+
var import_utils2 = require("../utils");
|
|
29
|
+
const setFont = (val, key) => {
|
|
30
|
+
const CSSvar = `--font-${key}`;
|
|
31
|
+
const fontFace = val[0] ? (0, import_utils2.getFontFaceEach)(key, val) : (0, import_utils2.setCustomFontMedia)(key, val.url);
|
|
32
|
+
return { var: CSSvar, value: val, fontFace };
|
|
33
|
+
};
|
|
34
|
+
const getFontFamily = (key, factory) => {
|
|
35
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
36
|
+
const { FONT_FAMILY } = CONFIG;
|
|
37
|
+
return (0, import_utils2.getDefaultOrFirstKey)(factory || FONT_FAMILY, key);
|
|
38
|
+
};
|
|
39
|
+
const setFontFamily = (val, key) => {
|
|
40
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
41
|
+
const { FONT_FAMILY, FONT_FAMILY_TYPES } = CONFIG;
|
|
42
|
+
let { value, type } = val;
|
|
43
|
+
if (val.isDefault)
|
|
44
|
+
FONT_FAMILY.default = key;
|
|
45
|
+
if ((0, import_utils.isObject)(value))
|
|
46
|
+
value = (0, import_utils2.arrayze)(value);
|
|
47
|
+
const CSSvar = `--font-family-${key}`;
|
|
48
|
+
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES[type]}`;
|
|
49
|
+
return { var: CSSvar, value: str, arr: value, type };
|
|
50
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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("./timing.js"), module.exports);
|
|
24
|
+
__reExport(system_exports, require("./document.js"), module.exports);
|
|
25
|
+
__reExport(system_exports, require("./svg.js"), module.exports);
|
|
26
|
+
__reExport(system_exports, require("./reset.js"), module.exports);
|
|
@@ -0,0 +1,83 @@
|
|
|
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_factory = require("../factory.js");
|
|
25
|
+
var import__ = require(".");
|
|
26
|
+
var import_utils = require("@domql/utils");
|
|
27
|
+
const applyReset = (reset = {}) => {
|
|
28
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
29
|
+
const { CSS_VARS, RESET, TYPOGRAPHY, DOCUMENT } = CONFIG;
|
|
30
|
+
if (RESET) {
|
|
31
|
+
if (RESET[":root"]) {
|
|
32
|
+
const configReset = RESET;
|
|
33
|
+
const configTemplates = TYPOGRAPHY.templates;
|
|
34
|
+
configReset.body = {
|
|
35
|
+
...(0, import__.getMediaTheme)("document", `@${CONFIG.globalTheme}`),
|
|
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
|
+
return (0, import_utils.deepMerge)((0, import_utils.merge)(RESET, reset), {
|
|
47
|
+
html: {
|
|
48
|
+
position: "absolute",
|
|
49
|
+
overflow: "hidden",
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%",
|
|
52
|
+
top: "0",
|
|
53
|
+
left: "0",
|
|
54
|
+
margin: "0",
|
|
55
|
+
WebkitFontSmoothing: "antialiased",
|
|
56
|
+
transform: "translate3d(0, 0, 1px)",
|
|
57
|
+
scrollBehavior: "smooth",
|
|
58
|
+
fontSize: TYPOGRAPHY.browserDefault + "px",
|
|
59
|
+
fontFamily: DOCUMENT.fontFamily,
|
|
60
|
+
lineHeight: DOCUMENT.lineHeight
|
|
61
|
+
},
|
|
62
|
+
body: {
|
|
63
|
+
boxSizing: "border-box",
|
|
64
|
+
height: "100%",
|
|
65
|
+
margin: 0,
|
|
66
|
+
fontFamily: DOCUMENT.fontFamily,
|
|
67
|
+
fontSize: TYPOGRAPHY.base / TYPOGRAPHY.browserDefault + CONFIG.UNIT.default,
|
|
68
|
+
...CONFIG.useDocumentTheme ? (0, import__.getMediaTheme)("document", `@${CONFIG.globalTheme}`) : {},
|
|
69
|
+
...templates,
|
|
70
|
+
...body
|
|
71
|
+
},
|
|
72
|
+
// form elements
|
|
73
|
+
fieldset: {
|
|
74
|
+
border: 0,
|
|
75
|
+
padding: 0,
|
|
76
|
+
margin: 0
|
|
77
|
+
},
|
|
78
|
+
"select, input": {
|
|
79
|
+
fontFamily: DOCUMENT.fontFamily
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
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 spacing_exports = {};
|
|
20
|
+
__export(spacing_exports, {
|
|
21
|
+
applySpacingSequence: () => applySpacingSequence,
|
|
22
|
+
getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
|
|
23
|
+
getSpacingByKey: () => getSpacingByKey
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(spacing_exports);
|
|
26
|
+
var import_factory = require("../factory.js");
|
|
27
|
+
var import_utils = require("@domql/utils");
|
|
28
|
+
var import_utils2 = require("../utils");
|
|
29
|
+
const runThroughMedia = (sequenceProps) => {
|
|
30
|
+
for (const prop in sequenceProps) {
|
|
31
|
+
const mediaProps = sequenceProps[prop];
|
|
32
|
+
if (prop.slice(0, 1) === "@") {
|
|
33
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
|
|
34
|
+
(0, import_utils2.merge)(mediaProps, {
|
|
35
|
+
type,
|
|
36
|
+
base,
|
|
37
|
+
ratio,
|
|
38
|
+
range,
|
|
39
|
+
subSequence,
|
|
40
|
+
h1Matches,
|
|
41
|
+
unit,
|
|
42
|
+
sequence: {},
|
|
43
|
+
scales: {},
|
|
44
|
+
templates: {},
|
|
45
|
+
vars: {}
|
|
46
|
+
});
|
|
47
|
+
(0, import_utils2.generateSequence)(mediaProps);
|
|
48
|
+
const mediaName = prop.slice(1);
|
|
49
|
+
(0, import_utils2.applySequenceVars)(mediaProps, mediaName);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const applySpacingSequence = () => {
|
|
54
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
55
|
+
const { SPACING } = CONFIG;
|
|
56
|
+
(0, import_utils2.generateSequence)(SPACING);
|
|
57
|
+
(0, import_utils2.applySequenceVars)(SPACING);
|
|
58
|
+
runThroughMedia(SPACING);
|
|
59
|
+
};
|
|
60
|
+
const getSequence = (sequenceProps) => {
|
|
61
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
62
|
+
const { SPACING } = CONFIG;
|
|
63
|
+
if (!sequenceProps)
|
|
64
|
+
return SPACING;
|
|
65
|
+
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
66
|
+
return hasGenerated ? sequenceProps : (0, import_utils2.generateSequence)(sequenceProps);
|
|
67
|
+
};
|
|
68
|
+
const getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
69
|
+
const sequence = getSequence(sequenceProps);
|
|
70
|
+
const stack = (0, import_utils2.arrayze)(value);
|
|
71
|
+
if (!stack)
|
|
72
|
+
return;
|
|
73
|
+
if ((0, import_utils.isString)(value) && value.includes("calc")) {
|
|
74
|
+
return { [propertyName]: value };
|
|
75
|
+
}
|
|
76
|
+
if (stack.length > 1) {
|
|
77
|
+
let suffix = "";
|
|
78
|
+
if (propertyName === "borderWidth") {
|
|
79
|
+
propertyName = "border";
|
|
80
|
+
suffix = "Width";
|
|
81
|
+
}
|
|
82
|
+
const directions = {
|
|
83
|
+
2: ["Block", "Inline"],
|
|
84
|
+
3: ["BlockStart", "Inline", "BlockEnd"],
|
|
85
|
+
4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
|
|
86
|
+
};
|
|
87
|
+
const wrapSequenceValueByDirection = (direction, i) => (0, import_utils2.getSequenceValuePropertyPair)(
|
|
88
|
+
stack[i],
|
|
89
|
+
propertyName + direction + suffix,
|
|
90
|
+
sequence
|
|
91
|
+
);
|
|
92
|
+
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
|
|
93
|
+
}
|
|
94
|
+
return (0, import_utils2.getSequenceValuePropertyPair)(
|
|
95
|
+
value,
|
|
96
|
+
propertyName,
|
|
97
|
+
sequence
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
const getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
101
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
102
|
+
const { SPACING } = CONFIG;
|
|
103
|
+
const { spacingRatio, unit } = props;
|
|
104
|
+
const value = val || props[propertyName];
|
|
105
|
+
if (spacingRatio) {
|
|
106
|
+
let sequenceProps = SPACING[spacingRatio];
|
|
107
|
+
if (!sequenceProps) {
|
|
108
|
+
const { type, base, range, subSequence } = SPACING;
|
|
109
|
+
sequenceProps = SPACING[spacingRatio] = (0, import_utils2.merge)({
|
|
110
|
+
ratio: spacingRatio,
|
|
111
|
+
type: type + "-" + spacingRatio,
|
|
112
|
+
unit,
|
|
113
|
+
sequence: {},
|
|
114
|
+
scales: {},
|
|
115
|
+
templates: {},
|
|
116
|
+
vars: {}
|
|
117
|
+
}, {
|
|
118
|
+
base,
|
|
119
|
+
range,
|
|
120
|
+
subSequence,
|
|
121
|
+
ratio: SPACING.ratio,
|
|
122
|
+
unit: SPACING.unit
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
(0, import_utils2.applySequenceVars)(sequenceProps, null, { useDefault: false });
|
|
126
|
+
return getSpacingByKey(value, propertyName, sequenceProps);
|
|
127
|
+
}
|
|
128
|
+
return getSpacingByKey(value, propertyName);
|
|
129
|
+
};
|