@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,70 @@
|
|
|
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
|
+
getDefaultOrFirstKey: () => getDefaultOrFirstKey,
|
|
22
|
+
getFontFace: () => getFontFace,
|
|
23
|
+
getFontFaceEach: () => getFontFaceEach,
|
|
24
|
+
getFontFaceEachString: () => getFontFaceEachString,
|
|
25
|
+
getFontFaceString: () => getFontFaceString,
|
|
26
|
+
getFontFormat: () => getFontFormat,
|
|
27
|
+
setCustomFont: () => setCustomFont,
|
|
28
|
+
setCustomFontMedia: () => setCustomFontMedia,
|
|
29
|
+
setInCustomFontMedia: () => setInCustomFontMedia
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(font_exports);
|
|
32
|
+
const getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
33
|
+
if (LIBRARY[key])
|
|
34
|
+
return LIBRARY[key].value;
|
|
35
|
+
if (LIBRARY.default)
|
|
36
|
+
return LIBRARY[LIBRARY.default].value;
|
|
37
|
+
const hasValue = Object.keys(LIBRARY)[0];
|
|
38
|
+
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
39
|
+
};
|
|
40
|
+
const getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
|
|
41
|
+
const setInCustomFontMedia = (str) => `@font-face { ${str} }`;
|
|
42
|
+
const 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
|
+
const setCustomFontMedia = (name, url, weight) => `@font-face {
|
|
48
|
+
${setCustomFont(name, url, weight)}
|
|
49
|
+
}`;
|
|
50
|
+
const 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
|
+
const getFontFace = (LIBRARY) => {
|
|
58
|
+
const keys = Object.keys(LIBRARY);
|
|
59
|
+
return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
|
|
60
|
+
};
|
|
61
|
+
const getFontFaceEachString = (name, weights) => {
|
|
62
|
+
const isArr = weights[0];
|
|
63
|
+
if (isArr)
|
|
64
|
+
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
65
|
+
return setCustomFontMedia(name, weights.url);
|
|
66
|
+
};
|
|
67
|
+
const getFontFaceString = (LIBRARY) => {
|
|
68
|
+
const keys = Object.keys(LIBRARY);
|
|
69
|
+
return keys.map((key) => getFontFaceEachString(key, LIBRARY[key].value));
|
|
70
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./object.js"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./color.js"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./font.js"), module.exports);
|
|
21
|
+
__reExport(utils_exports, require("./sequence.js"), module.exports);
|
|
22
|
+
__reExport(utils_exports, require("./var.js"), module.exports);
|
|
23
|
+
__reExport(utils_exports, require("./sprite.js"), module.exports);
|
|
@@ -0,0 +1,73 @@
|
|
|
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 object_exports = {};
|
|
20
|
+
__export(object_exports, {
|
|
21
|
+
arrayze: () => arrayze,
|
|
22
|
+
deepMerge: () => deepMerge,
|
|
23
|
+
isArray: () => isArray,
|
|
24
|
+
isFunction: () => isFunction,
|
|
25
|
+
isObject: () => isObject,
|
|
26
|
+
isObjectLike: () => isObjectLike,
|
|
27
|
+
isString: () => isString,
|
|
28
|
+
merge: () => merge
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(object_exports);
|
|
31
|
+
const isString = (arg) => typeof arg === "string";
|
|
32
|
+
const isArray = (arg) => Array.isArray(arg);
|
|
33
|
+
const isObject = (arg) => {
|
|
34
|
+
if (arg === null)
|
|
35
|
+
return false;
|
|
36
|
+
return typeof arg === "object" && arg.constructor === Object;
|
|
37
|
+
};
|
|
38
|
+
const isObjectLike = (arg) => {
|
|
39
|
+
if (arg === null)
|
|
40
|
+
return false;
|
|
41
|
+
return typeof arg === "object";
|
|
42
|
+
};
|
|
43
|
+
const merge = (obj, original) => {
|
|
44
|
+
for (const e in original) {
|
|
45
|
+
const objProp = obj[e];
|
|
46
|
+
const originalProp = original[e];
|
|
47
|
+
if (objProp === void 0) {
|
|
48
|
+
obj[e] = originalProp;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return obj;
|
|
52
|
+
};
|
|
53
|
+
const deepMerge = (obj, obj2) => {
|
|
54
|
+
for (const e in obj2) {
|
|
55
|
+
const objProp = obj[e];
|
|
56
|
+
const obj2Prop = obj2[e];
|
|
57
|
+
if (objProp === void 0) {
|
|
58
|
+
obj[e] = obj2Prop;
|
|
59
|
+
} else if (isObjectLike(objProp) && isObject(obj2Prop)) {
|
|
60
|
+
deepMerge(objProp, obj2Prop);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return obj;
|
|
64
|
+
};
|
|
65
|
+
const arrayze = (val) => {
|
|
66
|
+
if (isString(val))
|
|
67
|
+
return val.split(" ");
|
|
68
|
+
if (isObject(val))
|
|
69
|
+
return Object.keys(val).map((v) => val[v]);
|
|
70
|
+
if (isArray(val))
|
|
71
|
+
return val;
|
|
72
|
+
};
|
|
73
|
+
const isFunction = (arg) => typeof arg === "function";
|
|
@@ -0,0 +1,199 @@
|
|
|
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 sequence_exports = {};
|
|
20
|
+
__export(sequence_exports, {
|
|
21
|
+
findHeadingLetter: () => findHeadingLetter,
|
|
22
|
+
findHeadings: () => findHeadings,
|
|
23
|
+
generateSequence: () => generateSequence,
|
|
24
|
+
generateSubSequence: () => generateSubSequence,
|
|
25
|
+
getSequenceValue: () => getSequenceValue,
|
|
26
|
+
getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
|
|
27
|
+
numToLetterMap: () => numToLetterMap
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(sequence_exports);
|
|
30
|
+
var import_utils = require("@domql/utils");
|
|
31
|
+
var import_utils2 = require("@symbo.ls/utils");
|
|
32
|
+
var import_factory = require("../factory.js");
|
|
33
|
+
const numToLetterMap = {
|
|
34
|
+
"-6": "U",
|
|
35
|
+
"-5": "V",
|
|
36
|
+
"-4": "W",
|
|
37
|
+
"-3": "X",
|
|
38
|
+
"-2": "Y",
|
|
39
|
+
"-1": "Z",
|
|
40
|
+
0: "A",
|
|
41
|
+
1: "B",
|
|
42
|
+
2: "C",
|
|
43
|
+
3: "D",
|
|
44
|
+
4: "E",
|
|
45
|
+
5: "F",
|
|
46
|
+
6: "G",
|
|
47
|
+
7: "H",
|
|
48
|
+
8: "I",
|
|
49
|
+
9: "J",
|
|
50
|
+
10: "K",
|
|
51
|
+
11: "L",
|
|
52
|
+
12: "M",
|
|
53
|
+
13: "N",
|
|
54
|
+
14: "O",
|
|
55
|
+
15: "P",
|
|
56
|
+
16: "Q",
|
|
57
|
+
17: "R",
|
|
58
|
+
18: "S",
|
|
59
|
+
19: "T"
|
|
60
|
+
};
|
|
61
|
+
const setSequenceValue = (props, sequenceProps) => {
|
|
62
|
+
const { key, variable, value, scaling, index } = props;
|
|
63
|
+
sequenceProps.sequence[key] = {
|
|
64
|
+
key,
|
|
65
|
+
decimal: ~~(value * 100) / 100,
|
|
66
|
+
val: ~~value,
|
|
67
|
+
scaling,
|
|
68
|
+
index,
|
|
69
|
+
variable
|
|
70
|
+
};
|
|
71
|
+
sequenceProps.scales[key] = scaling;
|
|
72
|
+
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
73
|
+
};
|
|
74
|
+
const generateSubSequence = (props, sequenceProps) => {
|
|
75
|
+
const { key, base, value, ratio, variable, index } = props;
|
|
76
|
+
const next = value * ratio;
|
|
77
|
+
const diff = next - value;
|
|
78
|
+
const smallscale = diff / 1.618;
|
|
79
|
+
const valueRounded = ~~value;
|
|
80
|
+
const nextRounded = ~~next;
|
|
81
|
+
const diffRounded = nextRounded - valueRounded;
|
|
82
|
+
let arr = [];
|
|
83
|
+
const first = next - smallscale;
|
|
84
|
+
const second = value + smallscale;
|
|
85
|
+
const middle = (first + second) / 2;
|
|
86
|
+
if (diffRounded > 16)
|
|
87
|
+
arr = [first, middle, second];
|
|
88
|
+
else
|
|
89
|
+
arr = [first, second];
|
|
90
|
+
arr.map((v, k) => {
|
|
91
|
+
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
92
|
+
const newVar = variable + (k + 1);
|
|
93
|
+
const props2 = {
|
|
94
|
+
key: key + (k + 1),
|
|
95
|
+
variable: newVar,
|
|
96
|
+
value: v,
|
|
97
|
+
scaling,
|
|
98
|
+
index: index + (k + 1) / 10
|
|
99
|
+
};
|
|
100
|
+
return setSequenceValue(props2, sequenceProps);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
const switchSequenceOnNegative = (key, base, ratio) => {
|
|
104
|
+
return base * Math.pow(ratio, key);
|
|
105
|
+
};
|
|
106
|
+
const generateSequence = (sequenceProps) => {
|
|
107
|
+
const { type, base, ratio, range, subSequence } = sequenceProps;
|
|
108
|
+
const n = Math.abs(range[0]) + Math.abs(range[1]);
|
|
109
|
+
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
110
|
+
for (let i = 0; i <= n; i++) {
|
|
111
|
+
const key = range[1] - i;
|
|
112
|
+
const letterKey = numToLetterMap[key];
|
|
113
|
+
const value = switchSequenceOnNegative(key, base, ratio);
|
|
114
|
+
const scaling = ~~(value / base * 100) / 100;
|
|
115
|
+
const variable = prefix + letterKey;
|
|
116
|
+
const props = {
|
|
117
|
+
key: letterKey,
|
|
118
|
+
variable,
|
|
119
|
+
value,
|
|
120
|
+
base,
|
|
121
|
+
scaling,
|
|
122
|
+
ratio,
|
|
123
|
+
index: key
|
|
124
|
+
};
|
|
125
|
+
setSequenceValue(props, sequenceProps);
|
|
126
|
+
if (subSequence)
|
|
127
|
+
generateSubSequence(props, sequenceProps);
|
|
128
|
+
}
|
|
129
|
+
return sequenceProps;
|
|
130
|
+
};
|
|
131
|
+
const getSequenceValue = (value = "A", sequenceProps) => {
|
|
132
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
133
|
+
const { UNIT } = CONFIG;
|
|
134
|
+
const {
|
|
135
|
+
sequence,
|
|
136
|
+
unit = UNIT.default,
|
|
137
|
+
useVariable
|
|
138
|
+
} = sequenceProps;
|
|
139
|
+
if ((0, import_utils.isString)(value) && value.slice(0, 2) === "--")
|
|
140
|
+
return `var(${value})`;
|
|
141
|
+
const prefix = `--${(0, import_utils2.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
142
|
+
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
143
|
+
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
144
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
|
|
145
|
+
return value;
|
|
146
|
+
const letterVal = value.toUpperCase();
|
|
147
|
+
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
148
|
+
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
149
|
+
let mediaName = "";
|
|
150
|
+
if (absValue.includes("-")) {
|
|
151
|
+
mediaName = "-" + absValue.split("-")[1].toLowerCase();
|
|
152
|
+
absValue = absValue.split("-")[0];
|
|
153
|
+
}
|
|
154
|
+
const varValue = (v) => `var(${prefix}${v}${mediaName})`;
|
|
155
|
+
if (absValue.includes("+")) {
|
|
156
|
+
const args = absValue.split("+");
|
|
157
|
+
const [first, second] = args;
|
|
158
|
+
const joint = `${varValue(first)} + ${varValue(second)}`;
|
|
159
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
160
|
+
} else if (absValue.includes("-")) {
|
|
161
|
+
const args = absValue.split("-");
|
|
162
|
+
const [first, second] = args;
|
|
163
|
+
const joint = `${varValue(first)} - ${varValue(second)}`;
|
|
164
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
165
|
+
}
|
|
166
|
+
if (!sequence[absValue] && absValue.length === 2) {
|
|
167
|
+
if (CONFIG.verbose)
|
|
168
|
+
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
169
|
+
absValue = absValue.slice(0, 1);
|
|
170
|
+
}
|
|
171
|
+
if (useVariable || CONFIG.useVariable) {
|
|
172
|
+
const varValue2 = `var(${prefix}${absValue}${mediaName})`;
|
|
173
|
+
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
174
|
+
}
|
|
175
|
+
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
176
|
+
if (!sequenceItem)
|
|
177
|
+
return console.warn("can't find", sequence, absValue);
|
|
178
|
+
if (unit === "ms" || unit === "s") {
|
|
179
|
+
return isNegative + sequenceItem.val + unit;
|
|
180
|
+
}
|
|
181
|
+
return isNegative + sequenceItem.scaling + unit;
|
|
182
|
+
};
|
|
183
|
+
const getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
184
|
+
if (typeof value !== "string") {
|
|
185
|
+
console.warn(propertyName, value, "is not a string");
|
|
186
|
+
return {};
|
|
187
|
+
}
|
|
188
|
+
if (value === "-" || value === "")
|
|
189
|
+
return {};
|
|
190
|
+
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
191
|
+
};
|
|
192
|
+
const findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
193
|
+
const findHeadings = (propertyNames) => {
|
|
194
|
+
const { h1Matches, sequence } = propertyNames;
|
|
195
|
+
return new Array(6).fill(null).map((_, i) => {
|
|
196
|
+
const findLetter = findHeadingLetter(h1Matches, i);
|
|
197
|
+
return sequence[findLetter];
|
|
198
|
+
});
|
|
199
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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 sprite_exports = {};
|
|
20
|
+
__export(sprite_exports, {
|
|
21
|
+
convertSvgToSymbol: () => convertSvgToSymbol,
|
|
22
|
+
generateSprite: () => generateSprite
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(sprite_exports);
|
|
25
|
+
var import_utils = require("@domql/utils");
|
|
26
|
+
const generateSprite = (icons) => {
|
|
27
|
+
let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
|
|
28
|
+
for (let key in icons) {
|
|
29
|
+
sprite += icons[key];
|
|
30
|
+
}
|
|
31
|
+
sprite += "</svg>";
|
|
32
|
+
return sprite;
|
|
33
|
+
};
|
|
34
|
+
const parseRootAttributes = (htmlString) => {
|
|
35
|
+
if (!(0, import_utils.isString)(htmlString)) {
|
|
36
|
+
return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
|
|
37
|
+
}
|
|
38
|
+
let match = htmlString.match(/<svg\s+(.*?)>/);
|
|
39
|
+
if (!match || !match[1]) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
let attrString = match[1];
|
|
43
|
+
let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
|
|
44
|
+
return attrs.reduce((acc, attr) => {
|
|
45
|
+
let [key, value] = attr.split("=");
|
|
46
|
+
acc[key] = value.replace(/['"]/g, "");
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
};
|
|
50
|
+
const convertSvgToSymbol = (key, code) => {
|
|
51
|
+
const extractAttrs = parseRootAttributes(code);
|
|
52
|
+
const { width, height } = extractAttrs;
|
|
53
|
+
const viewBox = extractAttrs.viewBox || `0 0 ${width || 24} ${height || 24}`;
|
|
54
|
+
const xmlns = "http://www.w3.org/2000/svg";
|
|
55
|
+
let symbol = code.replace(
|
|
56
|
+
"<svg",
|
|
57
|
+
`<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
|
|
58
|
+
);
|
|
59
|
+
symbol = symbol.replace(/width="[^\"]*/, "");
|
|
60
|
+
symbol = symbol.replace(/height="[^\"]*/, "");
|
|
61
|
+
symbol = symbol.replace("</svg", "</symbol");
|
|
62
|
+
return symbol;
|
|
63
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 theme_exports = {};
|
|
20
|
+
__export(theme_exports, {
|
|
21
|
+
returnSubThemeOrDefault: () => returnSubThemeOrDefault
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(theme_exports);
|
|
24
|
+
const returnSubThemeOrDefault = (orig, theme) => {
|
|
25
|
+
if (!orig)
|
|
26
|
+
return;
|
|
27
|
+
if (orig.themes && orig.themes[theme])
|
|
28
|
+
return orig.themes[theme];
|
|
29
|
+
if (orig[theme])
|
|
30
|
+
return [orig, orig[theme]];
|
|
31
|
+
return orig;
|
|
32
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
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 var_exports = {};
|
|
20
|
+
__export(var_exports, {
|
|
21
|
+
applySequenceVars: () => applySequenceVars,
|
|
22
|
+
setVariables: () => setVariables
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(var_exports);
|
|
25
|
+
var import_factory = require("../factory.js");
|
|
26
|
+
var import_utils = require("@domql/utils");
|
|
27
|
+
const ENV = "development";
|
|
28
|
+
const setVariables = (result, key) => {
|
|
29
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
30
|
+
const { CSS_VARS } = CONFIG;
|
|
31
|
+
if ((0, import_utils.isObjectLike)(result.value)) {
|
|
32
|
+
} else {
|
|
33
|
+
CSS_VARS[result.var] = result.value;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const applySequenceVars = (props, mediaName, options = {}) => {
|
|
37
|
+
const CONFIG = (0, import_factory.getActiveConfig)();
|
|
38
|
+
const { UNIT, MEDIA, TIMING, CSS_VARS } = CONFIG;
|
|
39
|
+
const unit = props.unit || UNIT.default;
|
|
40
|
+
const { sequence, scales } = props;
|
|
41
|
+
for (const key in sequence) {
|
|
42
|
+
const item = sequence[key];
|
|
43
|
+
const value = (props.type === TIMING.type ? sequence[key].val : scales[key]) + unit;
|
|
44
|
+
if (mediaName) {
|
|
45
|
+
const query = MEDIA[mediaName];
|
|
46
|
+
if (!query) {
|
|
47
|
+
if (CONFIG.verbose)
|
|
48
|
+
console.warn("Can't find query ", query);
|
|
49
|
+
}
|
|
50
|
+
let underMediaQuery = CSS_VARS[`@media ${query}`];
|
|
51
|
+
if (!underMediaQuery)
|
|
52
|
+
underMediaQuery = CSS_VARS[`@media ${query}`] = {};
|
|
53
|
+
underMediaQuery[item.variable] = `var(${item.variable + "-" + mediaName})`;
|
|
54
|
+
CSS_VARS[item.variable + "-" + mediaName] = value;
|
|
55
|
+
} else {
|
|
56
|
+
if (options.useDefault === false) {
|
|
57
|
+
CSS_VARS[item.variable] = value;
|
|
58
|
+
} else {
|
|
59
|
+
CSS_VARS[item.variable + "-default"] = value;
|
|
60
|
+
CSS_VARS[item.variable] = `var(${item.variable + "-default"})`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getFontFace } from "../utils";
|
|
2
|
+
var defaultFont = {
|
|
3
|
+
// eslint-disable-line
|
|
4
|
+
name: "",
|
|
5
|
+
family: "",
|
|
6
|
+
type: ""
|
|
7
|
+
};
|
|
8
|
+
const FONT_FAMILY = {};
|
|
9
|
+
const FONT_FAMILY_TYPES = {
|
|
10
|
+
"sans-serif": "Helvetica, Arial, sans-serif, --system-default",
|
|
11
|
+
serif: "Times New Roman, Georgia, serif, --system-default",
|
|
12
|
+
monospace: "Courier New, monospace, --system-default"
|
|
13
|
+
};
|
|
14
|
+
const FONT_FACE = getFontFace(FONT_FAMILY);
|
|
15
|
+
export {
|
|
16
|
+
FONT_FACE,
|
|
17
|
+
FONT_FAMILY,
|
|
18
|
+
FONT_FAMILY_TYPES
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from "./sequence.js";
|
|
2
|
+
export * from "./unit.js";
|
|
3
|
+
export * from "./typography.js";
|
|
4
|
+
export * from "./font.js";
|
|
5
|
+
export * from "./font-family.js";
|
|
6
|
+
export * from "./media.js";
|
|
7
|
+
export * from "./spacing.js";
|
|
8
|
+
export * from "./color.js";
|
|
9
|
+
export * from "./theme.js";
|
|
10
|
+
export * from "./icons.js";
|
|
11
|
+
export * from "./timing.js";
|
|
12
|
+
export * from "./document.js";
|
|
13
|
+
export * from "./responsive.js";
|
|
14
|
+
export * from "./cases.js";
|
|
15
|
+
export * from "./animation.js";
|
|
16
|
+
export * from "./svg.js";
|
|
17
|
+
const RESET = {};
|
|
18
|
+
export {
|
|
19
|
+
RESET
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const MEDIA = {
|
|
2
|
+
tv: "(min-width: 2780px)",
|
|
3
|
+
screenL: "(max-width: 1920px)",
|
|
4
|
+
screenM: "(max-width: 1680px)",
|
|
5
|
+
screenS: "(max-width: 1440px)",
|
|
6
|
+
tabletL: "(max-width: 1366px)",
|
|
7
|
+
tabletM: "(max-width: 1280px)",
|
|
8
|
+
tabletS: "(max-width: 1024px)",
|
|
9
|
+
mobileL: "(max-width: 768px)",
|
|
10
|
+
mobileM: "(max-width: 560px)",
|
|
11
|
+
mobileS: "(max-width: 480px)",
|
|
12
|
+
mobileXS: "(max-width: 375px)",
|
|
13
|
+
light: "(prefers-color-scheme: light)",
|
|
14
|
+
dark: "(prefers-color-scheme: dark)",
|
|
15
|
+
print: "print"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
MEDIA
|
|
19
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const BREAKPOINTS = {
|
|
2
|
+
screenL: 1920,
|
|
3
|
+
screenM: 1680,
|
|
4
|
+
screenS: 1440,
|
|
5
|
+
tabletL: 1366,
|
|
6
|
+
tabletM: 1280,
|
|
7
|
+
tabletS: 1024,
|
|
8
|
+
mobileL: 768,
|
|
9
|
+
mobileM: 560,
|
|
10
|
+
mobileS: 480,
|
|
11
|
+
mobileXS: 375
|
|
12
|
+
};
|
|
13
|
+
const DEVICES = {
|
|
14
|
+
screenL: [1920, 1024],
|
|
15
|
+
screenM: [1680, 1024],
|
|
16
|
+
screenS: [1440, 978],
|
|
17
|
+
tabletL: [1366, 926],
|
|
18
|
+
tabletM: [1280, 768],
|
|
19
|
+
tabletS: [1024, 768],
|
|
20
|
+
mobileL: [768, 375],
|
|
21
|
+
mobileM: [560, 768],
|
|
22
|
+
mobileS: [480, 768],
|
|
23
|
+
mobileXS: [375, 768]
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
BREAKPOINTS,
|
|
27
|
+
DEVICES
|
|
28
|
+
};
|