@symbo.ls/scratch 2.11.213 → 2.11.220
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/index.js +4 -0
- package/dist/cjs/defaultConfig/shadow.js +26 -0
- package/dist/cjs/factory.js +30 -26
- package/dist/cjs/index.js +155 -63
- package/dist/cjs/set.js +205 -45
- package/dist/cjs/system/color.js +37 -28
- package/dist/cjs/system/document.js +30 -26
- package/dist/cjs/system/font.js +30 -26
- package/dist/cjs/system/index.js +141 -43
- package/dist/cjs/system/reset.js +30 -26
- package/dist/cjs/system/shadow.js +1944 -0
- package/dist/cjs/system/spacing.js +30 -26
- package/dist/cjs/system/svg.js +30 -26
- package/dist/cjs/system/theme.js +30 -26
- package/dist/cjs/system/timing.js +30 -26
- package/dist/cjs/system/typography.js +30 -26
- package/dist/cjs/transforms/index.js +94 -56
- package/dist/cjs/utils/color.js +26 -26
- package/dist/cjs/utils/index.js +30 -26
- package/dist/cjs/utils/sequence.js +30 -26
- package/dist/cjs/utils/sprite.js +30 -26
- package/dist/cjs/utils/var.js +30 -26
- package/package.json +2 -2
- package/src/defaultConfig/color.js +1 -2
- package/src/defaultConfig/index.js +1 -0
- package/src/defaultConfig/shadow.js +8 -0
- package/src/set.js +3 -1
- package/src/system/color.js +7 -1
- package/src/system/index.js +1 -0
- package/src/system/shadow.js +99 -0
- package/src/transforms/index.js +6 -11
package/dist/cjs/utils/var.js
CHANGED
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../node_modules/@domql/utils/dist/cjs/key.js
|
|
34
34
|
var require_key = __commonJS({
|
|
35
|
-
"
|
|
35
|
+
"../../node_modules/@domql/utils/dist/cjs/key.js"(exports, module2) {
|
|
36
36
|
"use strict";
|
|
37
37
|
var __defProp2 = Object.defineProperty;
|
|
38
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -69,9 +69,9 @@ var require_key = __commonJS({
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// ../../node_modules/@domql/utils/dist/cjs/env.js
|
|
73
73
|
var require_env = __commonJS({
|
|
74
|
-
"
|
|
74
|
+
"../../node_modules/@domql/utils/dist/cjs/env.js"(exports, module2) {
|
|
75
75
|
"use strict";
|
|
76
76
|
var __defProp2 = Object.defineProperty;
|
|
77
77
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -107,9 +107,9 @@ var require_env = __commonJS({
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
//
|
|
110
|
+
// ../../node_modules/@domql/utils/dist/cjs/globals.js
|
|
111
111
|
var require_globals = __commonJS({
|
|
112
|
-
"
|
|
112
|
+
"../../node_modules/@domql/utils/dist/cjs/globals.js"(exports, module2) {
|
|
113
113
|
"use strict";
|
|
114
114
|
var __defProp2 = Object.defineProperty;
|
|
115
115
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -143,9 +143,9 @@ var require_globals = __commonJS({
|
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
//
|
|
146
|
+
// ../../node_modules/@domql/utils/dist/cjs/node.js
|
|
147
147
|
var require_node = __commonJS({
|
|
148
|
-
"
|
|
148
|
+
"../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
|
|
149
149
|
"use strict";
|
|
150
150
|
var __defProp2 = Object.defineProperty;
|
|
151
151
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -180,9 +180,9 @@ var require_node = __commonJS({
|
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
//
|
|
183
|
+
// ../../node_modules/@domql/utils/dist/cjs/types.js
|
|
184
184
|
var require_types = __commonJS({
|
|
185
|
-
"
|
|
185
|
+
"../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
|
|
186
186
|
"use strict";
|
|
187
187
|
var __defProp2 = Object.defineProperty;
|
|
188
188
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -267,9 +267,9 @@ var require_types = __commonJS({
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
-
//
|
|
270
|
+
// ../../node_modules/@domql/utils/dist/cjs/array.js
|
|
271
271
|
var require_array = __commonJS({
|
|
272
|
-
"
|
|
272
|
+
"../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
|
|
273
273
|
"use strict";
|
|
274
274
|
var __defProp2 = Object.defineProperty;
|
|
275
275
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -366,9 +366,9 @@ var require_array = __commonJS({
|
|
|
366
366
|
}
|
|
367
367
|
});
|
|
368
368
|
|
|
369
|
-
//
|
|
369
|
+
// ../../node_modules/@domql/utils/dist/cjs/string.js
|
|
370
370
|
var require_string = __commonJS({
|
|
371
|
-
"
|
|
371
|
+
"../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
|
|
372
372
|
"use strict";
|
|
373
373
|
var __defProp2 = Object.defineProperty;
|
|
374
374
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -426,9 +426,9 @@ var require_string = __commonJS({
|
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
|
|
429
|
-
//
|
|
429
|
+
// ../../node_modules/@domql/utils/dist/cjs/object.js
|
|
430
430
|
var require_object = __commonJS({
|
|
431
|
-
"
|
|
431
|
+
"../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
|
|
432
432
|
"use strict";
|
|
433
433
|
var __defProp2 = Object.defineProperty;
|
|
434
434
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -878,9 +878,9 @@ var require_object = __commonJS({
|
|
|
878
878
|
}
|
|
879
879
|
});
|
|
880
880
|
|
|
881
|
-
//
|
|
881
|
+
// ../../node_modules/@domql/utils/dist/cjs/function.js
|
|
882
882
|
var require_function = __commonJS({
|
|
883
|
-
"
|
|
883
|
+
"../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
|
|
884
884
|
"use strict";
|
|
885
885
|
var __defProp2 = Object.defineProperty;
|
|
886
886
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -953,9 +953,9 @@ var require_function = __commonJS({
|
|
|
953
953
|
}
|
|
954
954
|
});
|
|
955
955
|
|
|
956
|
-
//
|
|
956
|
+
// ../../node_modules/@domql/utils/dist/cjs/log.js
|
|
957
957
|
var require_log = __commonJS({
|
|
958
|
-
"
|
|
958
|
+
"../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
|
|
959
959
|
"use strict";
|
|
960
960
|
var __defProp2 = Object.defineProperty;
|
|
961
961
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -994,9 +994,9 @@ var require_log = __commonJS({
|
|
|
994
994
|
}
|
|
995
995
|
});
|
|
996
996
|
|
|
997
|
-
//
|
|
997
|
+
// ../../node_modules/@domql/utils/dist/cjs/cookie.js
|
|
998
998
|
var require_cookie = __commonJS({
|
|
999
|
-
"
|
|
999
|
+
"../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports, module2) {
|
|
1000
1000
|
"use strict";
|
|
1001
1001
|
var __defProp2 = Object.defineProperty;
|
|
1002
1002
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1050,9 +1050,9 @@ var require_cookie = __commonJS({
|
|
|
1050
1050
|
}
|
|
1051
1051
|
});
|
|
1052
1052
|
|
|
1053
|
-
//
|
|
1053
|
+
// ../../node_modules/@domql/utils/dist/cjs/tags.js
|
|
1054
1054
|
var require_tags = __commonJS({
|
|
1055
|
-
"
|
|
1055
|
+
"../../node_modules/@domql/utils/dist/cjs/tags.js"(exports, module2) {
|
|
1056
1056
|
"use strict";
|
|
1057
1057
|
var __defProp2 = Object.defineProperty;
|
|
1058
1058
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1215,9 +1215,9 @@ var require_tags = __commonJS({
|
|
|
1215
1215
|
}
|
|
1216
1216
|
});
|
|
1217
1217
|
|
|
1218
|
-
//
|
|
1218
|
+
// ../../node_modules/@domql/utils/dist/cjs/index.js
|
|
1219
1219
|
var require_cjs = __commonJS({
|
|
1220
|
-
"
|
|
1220
|
+
"../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
|
|
1221
1221
|
"use strict";
|
|
1222
1222
|
var __defProp2 = Object.defineProperty;
|
|
1223
1223
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1280,6 +1280,7 @@ __export(defaultConfig_exports, {
|
|
|
1280
1280
|
MEDIA: () => MEDIA,
|
|
1281
1281
|
RESET: () => RESET,
|
|
1282
1282
|
SEQUENCE: () => SEQUENCE,
|
|
1283
|
+
SHADOW: () => SHADOW,
|
|
1283
1284
|
SPACING: () => SPACING,
|
|
1284
1285
|
SVG: () => SVG,
|
|
1285
1286
|
SVG_DATA: () => SVG_DATA,
|
|
@@ -1402,6 +1403,9 @@ var GRADIENT = {};
|
|
|
1402
1403
|
// src/defaultConfig/theme.js
|
|
1403
1404
|
var THEME = {};
|
|
1404
1405
|
|
|
1406
|
+
// src/defaultConfig/shadow.js
|
|
1407
|
+
var SHADOW = {};
|
|
1408
|
+
|
|
1405
1409
|
// src/defaultConfig/icons.js
|
|
1406
1410
|
var ICONS = {};
|
|
1407
1411
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symbo.ls/scratch",
|
|
3
3
|
"description": "Φ / CSS framework and methodology.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "2.11.
|
|
5
|
+
"version": "2.11.220",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"@symbo.ls/utils": "latest",
|
|
30
30
|
"color-contrast-checker": "^1.5.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "557d47cf9535b98e5cfbe8bed505da0db847fc12"
|
|
33
33
|
}
|
package/src/set.js
CHANGED
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
applySpacingSequence,
|
|
14
14
|
applyReset,
|
|
15
15
|
applyTimingSequence,
|
|
16
|
-
applyDocument
|
|
16
|
+
applyDocument,
|
|
17
|
+
setShadow
|
|
17
18
|
} from './system'
|
|
18
19
|
|
|
19
20
|
import { isFunction } from '@domql/utils'
|
|
@@ -36,6 +37,7 @@ export const VALUE_TRANSFORMERS = {
|
|
|
36
37
|
svg_data: setSameValue,
|
|
37
38
|
typography: setSameValue,
|
|
38
39
|
cases: setCases,
|
|
40
|
+
shadow: setShadow,
|
|
39
41
|
spacing: setSameValue,
|
|
40
42
|
media: setSameValue,
|
|
41
43
|
timing: setSameValue,
|
package/src/system/color.js
CHANGED
|
@@ -98,7 +98,13 @@ export const setColor = (val, key, suffix) => {
|
|
|
98
98
|
|
|
99
99
|
if (isObject(val)) {
|
|
100
100
|
const obj = {}
|
|
101
|
-
for (const variant in val)
|
|
101
|
+
for (const variant in val) {
|
|
102
|
+
obj[variant] = setColor(
|
|
103
|
+
val[variant],
|
|
104
|
+
key,
|
|
105
|
+
variant.slice(0, 1) === '@' ? variant.slice(1) : variant
|
|
106
|
+
)
|
|
107
|
+
}
|
|
102
108
|
return obj
|
|
103
109
|
}
|
|
104
110
|
|
package/src/system/index.js
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { getActiveConfig } from '../factory.js'
|
|
4
|
+
import { getColor } from './color.js'
|
|
5
|
+
import { getSpacingByKey } from './spacing.js'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
isObject,
|
|
9
|
+
isString,
|
|
10
|
+
isArray
|
|
11
|
+
} from '@domql/utils'
|
|
12
|
+
|
|
13
|
+
export const setShadow = (value, key, suffix, prefers) => {
|
|
14
|
+
const CONFIG = getActiveConfig()
|
|
15
|
+
// const { CSS_VARS } = CONFIG
|
|
16
|
+
// const theme = { valueue: value }
|
|
17
|
+
|
|
18
|
+
if (isArray(value)) {
|
|
19
|
+
return {
|
|
20
|
+
'@light': setShadow(value[0], key, 'light'),
|
|
21
|
+
'@dark': setShadow(value[1], key, 'dark')
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (isObject(value)) {
|
|
26
|
+
const obj = {}
|
|
27
|
+
for (const variant in value) {
|
|
28
|
+
obj[variant] = setShadow(
|
|
29
|
+
value[variant],
|
|
30
|
+
key,
|
|
31
|
+
variant.startsWith('@') ? variant.slice(1) : variant
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return obj
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isString(value) && value.includes(',')) {
|
|
38
|
+
value = value.split(',').map(v => {
|
|
39
|
+
v = v.trim()
|
|
40
|
+
if (v.startsWith('--')) return `var(${v})`
|
|
41
|
+
if (getColor(v).length > 2) return getColor(v)
|
|
42
|
+
if (v.includes('px') || v.slice(-2) === 'em') return v
|
|
43
|
+
const arr = v.split(' ')
|
|
44
|
+
if (!arr.length) return v
|
|
45
|
+
return arr.map(v => getSpacingByKey(v, 'shadow').shadow).join(' ')
|
|
46
|
+
}).join(' ')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const CSSVar = `--shadow-${key}` + (suffix ? `-${suffix}` : '')
|
|
50
|
+
|
|
51
|
+
if (CONFIG.useVariable) { CONFIG.CSS_VARS[CSSVar] = value }
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
var: CSSVar,
|
|
55
|
+
value
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const getShadow = (value, globalTheme) => {
|
|
60
|
+
const CONFIG = getActiveConfig()
|
|
61
|
+
if (!globalTheme) globalTheme = CONFIG.globalTheme
|
|
62
|
+
if (!isString(value)) {
|
|
63
|
+
if (CONFIG.verbose) console.warn(value, '- type for color is not valid')
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (value.slice(0, 2) === '--') return `var(${value})`
|
|
68
|
+
|
|
69
|
+
const [name] = isArray(value) ? value : value.split(' ')
|
|
70
|
+
|
|
71
|
+
const { SHADOW } = CONFIG
|
|
72
|
+
const val = SHADOW[name]
|
|
73
|
+
const isObj = isObject(val)
|
|
74
|
+
|
|
75
|
+
if (!val) {
|
|
76
|
+
if (CONFIG.verbose) console.warn('Can\'t find color ', name)
|
|
77
|
+
return value
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (globalTheme) {
|
|
81
|
+
if (val[globalTheme]) return val[globalTheme].value
|
|
82
|
+
else if (CONFIG.verbose) console.warn(value, ' - does not have ', globalTheme)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isObj && val.value) return val.value
|
|
86
|
+
|
|
87
|
+
if (isObj) {
|
|
88
|
+
const obj = {}
|
|
89
|
+
for (const mediaName in val) {
|
|
90
|
+
const query = CONFIG.MEDIA[mediaName.slice(1)]
|
|
91
|
+
const media = `@media screen and ${query}`
|
|
92
|
+
obj[media] = val.value
|
|
93
|
+
}
|
|
94
|
+
return obj
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (CONFIG.verbose) console.warn('Can\'t find color', value)
|
|
98
|
+
return value
|
|
99
|
+
}
|
package/src/transforms/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getActiveConfig } from '../factory'
|
|
|
5
5
|
import {
|
|
6
6
|
getSpacingByKey,
|
|
7
7
|
getColor,
|
|
8
|
+
getShadow,
|
|
8
9
|
getMediaColor,
|
|
9
10
|
getTimingByKey,
|
|
10
11
|
getTimingFunction
|
|
@@ -45,17 +46,11 @@ export const transformTextStroke = stroke => {
|
|
|
45
46
|
}).join(' ')
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
export const transformShadow =
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (v.includes('px') || v.slice(-2) === 'em') return v
|
|
54
|
-
const arr = v.split(' ')
|
|
55
|
-
if (!arr.length) return v
|
|
56
|
-
return arr.map(v => getSpacingByKey(v, 'shadow').shadow).join(' ')
|
|
57
|
-
}).join(' ')
|
|
58
|
-
}).join(',')
|
|
49
|
+
export const transformShadow = (sh, globalTheme) => {
|
|
50
|
+
return sh.split(',').map(shadow => getShadow(shadow, globalTheme)).join(',')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const transformBoxShadow = (sh, globalTheme) => getShadow(sh, globalTheme)
|
|
59
54
|
|
|
60
55
|
export const transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
61
56
|
const CONFIG = getActiveConfig()
|