@symbo.ls/scratch 2.11.226 → 2.11.228
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 +3 -0
- package/dist/cjs/defaultConfig/spacing.js +2 -0
- package/dist/cjs/defaultConfig/timing.js +1 -0
- package/dist/cjs/defaultConfig/typography.js +1 -0
- package/dist/cjs/factory.js +3 -0
- package/dist/cjs/index.js +196 -83
- package/dist/cjs/set.js +183 -82
- package/dist/cjs/system/color.js +3 -0
- package/dist/cjs/system/document.js +3 -0
- package/dist/cjs/system/font.js +3 -0
- package/dist/cjs/system/index.js +184 -83
- package/dist/cjs/system/reset.js +3 -0
- package/dist/cjs/system/shadow.js +47 -13
- package/dist/cjs/system/spacing.js +143 -58
- package/dist/cjs/system/svg.js +3 -0
- package/dist/cjs/system/theme.js +3 -0
- package/dist/cjs/system/timing.js +82 -35
- package/dist/cjs/system/typography.js +153 -60
- package/dist/cjs/transforms/index.js +47 -13
- package/dist/cjs/utils/index.js +118 -35
- package/dist/cjs/utils/sequence.js +55 -14
- package/dist/cjs/utils/sprite.js +3 -0
- package/dist/cjs/utils/var.js +101 -34
- package/package.json +2 -2
- package/src/defaultConfig/spacing.js +1 -0
- package/src/defaultConfig/timing.js +1 -0
- package/src/defaultConfig/typography.js +1 -0
- package/src/system/spacing.js +36 -26
- package/src/system/typography.js +49 -29
- package/src/utils/sequence.js +54 -14
- package/src/utils/var.js +84 -21
|
@@ -1316,7 +1316,11 @@ __export(sequence_exports, {
|
|
|
1316
1316
|
generateSubSequence: () => generateSubSequence,
|
|
1317
1317
|
getSequenceValue: () => getSequenceValue,
|
|
1318
1318
|
getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
|
|
1319
|
-
|
|
1319
|
+
getSubratio: () => getSubratio,
|
|
1320
|
+
getSubratioDifference: () => getSubratioDifference,
|
|
1321
|
+
numToLetterMap: () => numToLetterMap,
|
|
1322
|
+
setScalingVar: () => setScalingVar,
|
|
1323
|
+
setSubScalingVar: () => setSubScalingVar
|
|
1320
1324
|
});
|
|
1321
1325
|
module.exports = __toCommonJS(sequence_exports);
|
|
1322
1326
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
@@ -1405,6 +1409,7 @@ var defaultProps = {
|
|
|
1405
1409
|
h1Matches: 6,
|
|
1406
1410
|
lineHeight: 1.5,
|
|
1407
1411
|
subSequence: true,
|
|
1412
|
+
mediaRegenerate: false,
|
|
1408
1413
|
unit: "em",
|
|
1409
1414
|
templates: {},
|
|
1410
1415
|
sequence: {},
|
|
@@ -1460,6 +1465,7 @@ var defaultProps2 = {
|
|
|
1460
1465
|
ratio: SEQUENCE.phi,
|
|
1461
1466
|
range: [-5, 15],
|
|
1462
1467
|
subSequence: true,
|
|
1468
|
+
mediaRegenerate: false,
|
|
1463
1469
|
unit: "em",
|
|
1464
1470
|
sequence: {},
|
|
1465
1471
|
scales: {},
|
|
@@ -1487,6 +1493,7 @@ var defaultProps3 = {
|
|
|
1487
1493
|
type: "timing",
|
|
1488
1494
|
ratio: SEQUENCE["perfect-fourth"],
|
|
1489
1495
|
range: [-3, 12],
|
|
1496
|
+
mediaRegenerate: false,
|
|
1490
1497
|
unit: "ms",
|
|
1491
1498
|
sequence: {},
|
|
1492
1499
|
scales: {},
|
|
@@ -1587,45 +1594,77 @@ var numToLetterMap = {
|
|
|
1587
1594
|
19: "T"
|
|
1588
1595
|
};
|
|
1589
1596
|
var setSequenceValue = (props, sequenceProps) => {
|
|
1590
|
-
const { key, variable, value, scaling, index } = props;
|
|
1597
|
+
const { key, variable, value, scaling, index, scalingVariable } = props;
|
|
1591
1598
|
sequenceProps.sequence[key] = {
|
|
1592
1599
|
key,
|
|
1593
1600
|
decimal: ~~(value * 100) / 100,
|
|
1594
1601
|
val: ~~value,
|
|
1595
1602
|
scaling,
|
|
1596
1603
|
index,
|
|
1604
|
+
scalingVariable,
|
|
1597
1605
|
variable
|
|
1598
1606
|
};
|
|
1599
1607
|
sequenceProps.scales[key] = scaling;
|
|
1600
1608
|
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
1601
1609
|
};
|
|
1610
|
+
var setScalingVar = (key, sequenceProps) => {
|
|
1611
|
+
const { type } = sequenceProps;
|
|
1612
|
+
if (key === 0)
|
|
1613
|
+
return "1em";
|
|
1614
|
+
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1615
|
+
const ratioVar = `${prefix}-ratio`;
|
|
1616
|
+
if (key > 0) {
|
|
1617
|
+
const prevLetterKey = numToLetterMap[key - 1];
|
|
1618
|
+
return `calc(var(${prefix}-${prevLetterKey}) * var(${ratioVar}))`;
|
|
1619
|
+
}
|
|
1620
|
+
if (key < 0) {
|
|
1621
|
+
const nextLetterKey = numToLetterMap[key + 1];
|
|
1622
|
+
return `calc(var(${prefix}-${nextLetterKey}) / var(${ratioVar}))`;
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
var setSubScalingVar = (index, arr, variable, sequenceProps) => {
|
|
1626
|
+
const { type } = sequenceProps;
|
|
1627
|
+
const skipMiddle = index === 2 && arr.length === 2;
|
|
1628
|
+
const indexMapWithLength = skipMiddle ? index + 1 : index;
|
|
1629
|
+
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1630
|
+
const subRatioVarPrefix = `${prefix}-sub-ratio-`;
|
|
1631
|
+
return `calc(var(${variable}) * var(${subRatioVarPrefix + indexMapWithLength}))`;
|
|
1632
|
+
};
|
|
1633
|
+
var getSubratioDifference = (base, ratio) => {
|
|
1634
|
+
const diff = base * ratio - base;
|
|
1635
|
+
const subRatio = diff / 1.618;
|
|
1636
|
+
const first = base * ratio - subRatio;
|
|
1637
|
+
const second = base + subRatio;
|
|
1638
|
+
const middle = (first + second) / 2;
|
|
1639
|
+
return [first, middle, second];
|
|
1640
|
+
};
|
|
1641
|
+
var getSubratio = (base, ratio) => {
|
|
1642
|
+
return getSubratioDifference(base, ratio).map((v) => v / base);
|
|
1643
|
+
};
|
|
1602
1644
|
var generateSubSequence = (props, sequenceProps) => {
|
|
1603
1645
|
const { key, base, value, ratio, variable, index } = props;
|
|
1604
1646
|
const next = value * ratio;
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
const
|
|
1608
|
-
const nextRounded = ~~next;
|
|
1609
|
-
const diffRounded = nextRounded - valueRounded;
|
|
1610
|
-
let arr = [];
|
|
1611
|
-
const first = next - smallscale;
|
|
1612
|
-
const second = value + smallscale;
|
|
1613
|
-
const middle = (first + second) / 2;
|
|
1647
|
+
const diffRounded = ~~next - ~~value;
|
|
1648
|
+
let arr;
|
|
1649
|
+
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
1614
1650
|
if (diffRounded > 16)
|
|
1615
1651
|
arr = [first, middle, second];
|
|
1616
1652
|
else
|
|
1617
1653
|
arr = [first, second];
|
|
1618
|
-
arr.
|
|
1654
|
+
arr.forEach((v, k) => {
|
|
1619
1655
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1620
1656
|
const newVar = variable + (k + 1);
|
|
1657
|
+
const newIndex = index + (k + 1) / 10;
|
|
1658
|
+
const scalingVariable = setSubScalingVar(k + 1, arr, variable, sequenceProps);
|
|
1621
1659
|
const props2 = {
|
|
1622
1660
|
key: key + (k + 1),
|
|
1623
1661
|
variable: newVar,
|
|
1624
1662
|
value: v,
|
|
1625
1663
|
scaling,
|
|
1626
|
-
|
|
1664
|
+
scalingVariable,
|
|
1665
|
+
index: newIndex
|
|
1627
1666
|
};
|
|
1628
|
-
|
|
1667
|
+
setSequenceValue(props2, sequenceProps);
|
|
1629
1668
|
});
|
|
1630
1669
|
};
|
|
1631
1670
|
var switchSequenceOnNegative = (key, base, ratio) => {
|
|
@@ -1641,12 +1680,14 @@ var generateSequence = (sequenceProps) => {
|
|
|
1641
1680
|
const value = switchSequenceOnNegative(key, base, ratio);
|
|
1642
1681
|
const scaling = ~~(value / base * 100) / 100;
|
|
1643
1682
|
const variable = prefix + letterKey;
|
|
1683
|
+
const scalingVariable = setScalingVar(key, sequenceProps);
|
|
1644
1684
|
const props = {
|
|
1645
1685
|
key: letterKey,
|
|
1646
1686
|
variable,
|
|
1647
1687
|
value,
|
|
1648
1688
|
base,
|
|
1649
1689
|
scaling,
|
|
1690
|
+
scalingVariable,
|
|
1650
1691
|
ratio,
|
|
1651
1692
|
index: key
|
|
1652
1693
|
};
|
package/dist/cjs/utils/sprite.js
CHANGED
|
@@ -1391,6 +1391,7 @@ var defaultProps = {
|
|
|
1391
1391
|
h1Matches: 6,
|
|
1392
1392
|
lineHeight: 1.5,
|
|
1393
1393
|
subSequence: true,
|
|
1394
|
+
mediaRegenerate: false,
|
|
1394
1395
|
unit: "em",
|
|
1395
1396
|
templates: {},
|
|
1396
1397
|
sequence: {},
|
|
@@ -1446,6 +1447,7 @@ var defaultProps2 = {
|
|
|
1446
1447
|
ratio: SEQUENCE.phi,
|
|
1447
1448
|
range: [-5, 15],
|
|
1448
1449
|
subSequence: true,
|
|
1450
|
+
mediaRegenerate: false,
|
|
1449
1451
|
unit: "em",
|
|
1450
1452
|
sequence: {},
|
|
1451
1453
|
scales: {},
|
|
@@ -1473,6 +1475,7 @@ var defaultProps3 = {
|
|
|
1473
1475
|
type: "timing",
|
|
1474
1476
|
ratio: SEQUENCE["perfect-fourth"],
|
|
1475
1477
|
range: [-3, 12],
|
|
1478
|
+
mediaRegenerate: false,
|
|
1476
1479
|
unit: "ms",
|
|
1477
1480
|
sequence: {},
|
|
1478
1481
|
scales: {},
|
package/dist/cjs/utils/var.js
CHANGED
|
@@ -205,7 +205,7 @@ var require_types = __commonJS({
|
|
|
205
205
|
__export2(types_exports, {
|
|
206
206
|
TYPES: () => TYPES,
|
|
207
207
|
is: () => is,
|
|
208
|
-
isArray: () =>
|
|
208
|
+
isArray: () => isArray3,
|
|
209
209
|
isBoolean: () => isBoolean,
|
|
210
210
|
isDate: () => isDate,
|
|
211
211
|
isDefined: () => isDefined2,
|
|
@@ -213,24 +213,24 @@ var require_types = __commonJS({
|
|
|
213
213
|
isNot: () => isNot,
|
|
214
214
|
isNull: () => isNull,
|
|
215
215
|
isNumber: () => isNumber,
|
|
216
|
-
isObject: () =>
|
|
216
|
+
isObject: () => isObject4,
|
|
217
217
|
isObjectLike: () => isObjectLike2,
|
|
218
|
-
isString: () =>
|
|
218
|
+
isString: () => isString3,
|
|
219
219
|
isUndefined: () => isUndefined
|
|
220
220
|
});
|
|
221
221
|
module2.exports = __toCommonJS2(types_exports);
|
|
222
222
|
var import_node = require_node();
|
|
223
|
-
var
|
|
223
|
+
var isObject4 = (arg) => {
|
|
224
224
|
if (arg === null)
|
|
225
225
|
return false;
|
|
226
226
|
return typeof arg === "object" && arg.constructor === Object;
|
|
227
227
|
};
|
|
228
|
-
var
|
|
228
|
+
var isString3 = (arg) => typeof arg === "string";
|
|
229
229
|
var isNumber = (arg) => typeof arg === "number";
|
|
230
230
|
var isFunction = (arg) => typeof arg === "function";
|
|
231
231
|
var isBoolean = (arg) => arg === true || arg === false;
|
|
232
232
|
var isNull = (arg) => arg === null;
|
|
233
|
-
var
|
|
233
|
+
var isArray3 = (arg) => Array.isArray(arg);
|
|
234
234
|
var isDate = (d) => d instanceof Date;
|
|
235
235
|
var isObjectLike2 = (arg) => {
|
|
236
236
|
if (arg === null)
|
|
@@ -238,16 +238,16 @@ var require_types = __commonJS({
|
|
|
238
238
|
return typeof arg === "object";
|
|
239
239
|
};
|
|
240
240
|
var isDefined2 = (arg) => {
|
|
241
|
-
return
|
|
241
|
+
return isObject4(arg) || isObjectLike2(arg) || isString3(arg) || isNumber(arg) || isFunction(arg) || isArray3(arg) || isObjectLike2(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
|
|
242
242
|
};
|
|
243
243
|
var isUndefined = (arg) => {
|
|
244
244
|
return arg === void 0;
|
|
245
245
|
};
|
|
246
246
|
var TYPES = {
|
|
247
247
|
boolean: isBoolean,
|
|
248
|
-
array:
|
|
249
|
-
object:
|
|
250
|
-
string:
|
|
248
|
+
array: isArray3,
|
|
249
|
+
object: isObject4,
|
|
250
|
+
string: isString3,
|
|
251
251
|
date: isDate,
|
|
252
252
|
number: isNumber,
|
|
253
253
|
null: isNull,
|
|
@@ -1310,11 +1310,13 @@ var require_cjs = __commonJS({
|
|
|
1310
1310
|
// src/utils/var.js
|
|
1311
1311
|
var var_exports = {};
|
|
1312
1312
|
__export(var_exports, {
|
|
1313
|
+
applyGlobalVars: () => applyGlobalVars,
|
|
1314
|
+
applyMediaSequenceVars: () => applyMediaSequenceVars,
|
|
1313
1315
|
applySequenceVars: () => applySequenceVars,
|
|
1314
1316
|
setVariables: () => setVariables
|
|
1315
1317
|
});
|
|
1316
1318
|
module.exports = __toCommonJS(var_exports);
|
|
1317
|
-
var
|
|
1319
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
1318
1320
|
|
|
1319
1321
|
// src/factory.js
|
|
1320
1322
|
var import_utils = __toESM(require_cjs(), 1);
|
|
@@ -1391,6 +1393,7 @@ var defaultProps = {
|
|
|
1391
1393
|
h1Matches: 6,
|
|
1392
1394
|
lineHeight: 1.5,
|
|
1393
1395
|
subSequence: true,
|
|
1396
|
+
mediaRegenerate: false,
|
|
1394
1397
|
unit: "em",
|
|
1395
1398
|
templates: {},
|
|
1396
1399
|
sequence: {},
|
|
@@ -1446,6 +1449,7 @@ var defaultProps2 = {
|
|
|
1446
1449
|
ratio: SEQUENCE.phi,
|
|
1447
1450
|
range: [-5, 15],
|
|
1448
1451
|
subSequence: true,
|
|
1452
|
+
mediaRegenerate: false,
|
|
1449
1453
|
unit: "em",
|
|
1450
1454
|
sequence: {},
|
|
1451
1455
|
scales: {},
|
|
@@ -1473,6 +1477,7 @@ var defaultProps3 = {
|
|
|
1473
1477
|
type: "timing",
|
|
1474
1478
|
ratio: SEQUENCE["perfect-fourth"],
|
|
1475
1479
|
range: [-3, 12],
|
|
1480
|
+
mediaRegenerate: false,
|
|
1476
1481
|
unit: "ms",
|
|
1477
1482
|
sequence: {},
|
|
1478
1483
|
scales: {},
|
|
@@ -1543,41 +1548,103 @@ var getActiveConfig = (def) => {
|
|
|
1543
1548
|
return FACTORY[def || FACTORY.active];
|
|
1544
1549
|
};
|
|
1545
1550
|
|
|
1551
|
+
// src/utils/sequence.js
|
|
1552
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
1553
|
+
|
|
1554
|
+
// ../utils/src/index.js
|
|
1555
|
+
var import_utils3 = __toESM(require_cjs());
|
|
1556
|
+
|
|
1557
|
+
// ../utils/src/scaling.js
|
|
1558
|
+
var import_utils2 = __toESM(require_cjs());
|
|
1559
|
+
|
|
1560
|
+
// src/utils/sequence.js
|
|
1561
|
+
var getSubratioDifference = (base, ratio) => {
|
|
1562
|
+
const diff = base * ratio - base;
|
|
1563
|
+
const subRatio = diff / 1.618;
|
|
1564
|
+
const first = base * ratio - subRatio;
|
|
1565
|
+
const second = base + subRatio;
|
|
1566
|
+
const middle = (first + second) / 2;
|
|
1567
|
+
return [first, middle, second];
|
|
1568
|
+
};
|
|
1569
|
+
var getSubratio = (base, ratio) => {
|
|
1570
|
+
return getSubratioDifference(base, ratio).map((v) => v / base);
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1546
1573
|
// src/utils/var.js
|
|
1547
1574
|
var setVariables = (result, key) => {
|
|
1548
1575
|
const CONFIG2 = getActiveConfig();
|
|
1549
1576
|
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1550
|
-
if ((0,
|
|
1577
|
+
if ((0, import_utils6.isObjectLike)(result.value)) {
|
|
1551
1578
|
} else {
|
|
1552
1579
|
CSS_VARS2[result.var] = result.value;
|
|
1553
1580
|
}
|
|
1554
1581
|
};
|
|
1555
|
-
var
|
|
1582
|
+
var applyGlobalVars = (vars, obj, options) => {
|
|
1556
1583
|
const CONFIG2 = getActiveConfig();
|
|
1557
|
-
const { UNIT: UNIT2
|
|
1558
|
-
const unit =
|
|
1559
|
-
const {
|
|
1584
|
+
const { UNIT: UNIT2 } = CONFIG2;
|
|
1585
|
+
const unit = obj.unit || UNIT2.default;
|
|
1586
|
+
const { base, ratio, type } = obj;
|
|
1587
|
+
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1588
|
+
vars[`${prefix}-base`] = base;
|
|
1589
|
+
vars[`${prefix}-unit`] = unit;
|
|
1590
|
+
const ratioVar = `${prefix}-ratio`;
|
|
1591
|
+
vars[ratioVar] = ratio;
|
|
1592
|
+
const [first, middle, second] = getSubratio(base, ratio);
|
|
1593
|
+
vars[`${prefix}-sub-ratio-1`] = first;
|
|
1594
|
+
vars[`${prefix}-sub-ratio-2`] = middle;
|
|
1595
|
+
vars[`${prefix}-sub-ratio-3`] = second;
|
|
1596
|
+
};
|
|
1597
|
+
var applySequenceVars = (FACTORY2, options = {}) => {
|
|
1598
|
+
const CONFIG2 = getActiveConfig();
|
|
1599
|
+
const { UNIT: UNIT2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1600
|
+
const unit = FACTORY2.unit || UNIT2.default;
|
|
1601
|
+
const { mediaRegenerate, sequence, scales } = FACTORY2;
|
|
1602
|
+
if (!mediaRegenerate) {
|
|
1603
|
+
applyGlobalVars(CSS_VARS2, FACTORY2, options);
|
|
1604
|
+
}
|
|
1560
1605
|
for (const key in sequence) {
|
|
1561
1606
|
const item = sequence[key];
|
|
1562
|
-
const value = (
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
if (!underMediaQuery)
|
|
1571
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1572
|
-
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1573
|
-
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1607
|
+
const value = (FACTORY2.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
|
|
1608
|
+
if (!mediaRegenerate) {
|
|
1609
|
+
CSS_VARS2[item.variable + "_default"] = value;
|
|
1610
|
+
CSS_VARS2[item.variable] = item.scalingVariable;
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
if (options.useDefault === false) {
|
|
1614
|
+
CSS_VARS2[item.variable] = value;
|
|
1574
1615
|
} else {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
} else {
|
|
1578
|
-
CSS_VARS2[item.variable + "_default"] = value;
|
|
1579
|
-
CSS_VARS2[item.variable] = `var(${item.variable + "_default"})`;
|
|
1580
|
-
}
|
|
1616
|
+
CSS_VARS2[item.variable + "_default"] = value;
|
|
1617
|
+
CSS_VARS2[item.variable] = `var(${item.variable + "_default"})`;
|
|
1581
1618
|
}
|
|
1582
1619
|
}
|
|
1583
1620
|
};
|
|
1621
|
+
var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
1622
|
+
const CONFIG2 = getActiveConfig();
|
|
1623
|
+
const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1624
|
+
const mediaName = media.slice(1);
|
|
1625
|
+
const unit = FACTORY2.unit || UNIT2.default;
|
|
1626
|
+
const { mediaRegenerate } = FACTORY2;
|
|
1627
|
+
const { sequence, scales } = FACTORY2[media];
|
|
1628
|
+
const query = MEDIA2[mediaName];
|
|
1629
|
+
if (!query && CONFIG2.verbose)
|
|
1630
|
+
console.warn("Can't find media query ", query);
|
|
1631
|
+
if (!mediaRegenerate) {
|
|
1632
|
+
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1633
|
+
if (!underMediaQuery)
|
|
1634
|
+
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1635
|
+
applyGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
for (const key in sequence) {
|
|
1639
|
+
const item = sequence[key];
|
|
1640
|
+
const value = (FACTORY2.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
|
|
1641
|
+
if (!query && CONFIG2.verbose)
|
|
1642
|
+
console.warn("Can't find query ", query);
|
|
1643
|
+
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1644
|
+
if (!underMediaQuery)
|
|
1645
|
+
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1646
|
+
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1647
|
+
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1648
|
+
}
|
|
1649
|
+
console.log(CSS_VARS2);
|
|
1650
|
+
};
|
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.228",
|
|
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": "56d2e29e73842899b56b329d61abf5f75e27cc7c"
|
|
33
33
|
}
|
package/src/system/spacing.js
CHANGED
|
@@ -5,36 +5,45 @@ import { isString, merge } from '@domql/utils'
|
|
|
5
5
|
|
|
6
6
|
import { getActiveConfig } from '../factory.js'
|
|
7
7
|
import {
|
|
8
|
+
applyMediaSequenceVars,
|
|
8
9
|
applySequenceVars,
|
|
9
10
|
generateSequence,
|
|
10
11
|
getSequenceValuePropertyPair
|
|
11
12
|
} from '../utils'
|
|
12
13
|
|
|
13
|
-
const runThroughMedia =
|
|
14
|
-
for (const prop in
|
|
15
|
-
const mediaProps =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
const runThroughMedia = FACTORY => {
|
|
15
|
+
for (const prop in FACTORY) {
|
|
16
|
+
const mediaProps = FACTORY[prop]
|
|
17
|
+
|
|
18
|
+
const isMediaName = prop.slice(0, 1) === '@'
|
|
19
|
+
if (!isMediaName) continue
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
type,
|
|
23
|
+
base,
|
|
24
|
+
ratio,
|
|
25
|
+
range,
|
|
26
|
+
subSequence,
|
|
27
|
+
h1Matches,
|
|
28
|
+
unit
|
|
29
|
+
} = FACTORY
|
|
30
|
+
|
|
31
|
+
merge(mediaProps, {
|
|
32
|
+
type,
|
|
33
|
+
base,
|
|
34
|
+
ratio,
|
|
35
|
+
range,
|
|
36
|
+
subSequence,
|
|
37
|
+
h1Matches,
|
|
38
|
+
unit,
|
|
39
|
+
sequence: {},
|
|
40
|
+
scales: {},
|
|
41
|
+
templates: {},
|
|
42
|
+
vars: {}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
generateSequence(mediaProps)
|
|
46
|
+
applyMediaSequenceVars(FACTORY, prop)
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -127,9 +136,10 @@ export const getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
|
127
136
|
})
|
|
128
137
|
}
|
|
129
138
|
|
|
130
|
-
applySequenceVars(sequenceProps,
|
|
139
|
+
applySequenceVars(sequenceProps, { useDefault: false })
|
|
131
140
|
|
|
132
141
|
return getSpacingByKey(value, propertyName, sequenceProps)
|
|
133
142
|
}
|
|
143
|
+
|
|
134
144
|
return getSpacingByKey(value, propertyName)
|
|
135
145
|
}
|
package/src/system/typography.js
CHANGED
|
@@ -4,45 +4,65 @@ import { merge } from '@domql/utils'
|
|
|
4
4
|
import { getActiveConfig } from '../factory.js'
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
applyMediaSequenceVars,
|
|
7
8
|
applySequenceVars,
|
|
8
9
|
findHeadings,
|
|
9
10
|
generateSequence,
|
|
10
11
|
getSequenceValuePropertyPair
|
|
11
12
|
} from '../utils'
|
|
12
13
|
|
|
13
|
-
export const runThroughMedia =
|
|
14
|
+
export const runThroughMedia = FACTORY => {
|
|
14
15
|
const CONFIG = getActiveConfig()
|
|
15
16
|
const { TYPOGRAPHY, MEDIA } = CONFIG
|
|
16
17
|
|
|
17
|
-
for (const prop in
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
for (const prop in FACTORY) {
|
|
19
|
+
const isPropMedia = prop.slice(0, 1) === '@'
|
|
20
|
+
const mediaValue = FACTORY[prop]
|
|
21
|
+
if (!isPropMedia) continue
|
|
22
|
+
|
|
23
|
+
const { mediaRegenerate } = FACTORY
|
|
24
|
+
const mediaName = prop.slice(1)
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
type,
|
|
28
|
+
base,
|
|
29
|
+
ratio,
|
|
30
|
+
range,
|
|
31
|
+
subSequence,
|
|
32
|
+
h1Matches,
|
|
33
|
+
unit
|
|
34
|
+
} = FACTORY
|
|
35
|
+
|
|
36
|
+
merge(mediaValue, {
|
|
37
|
+
type,
|
|
38
|
+
base,
|
|
39
|
+
ratio,
|
|
40
|
+
range,
|
|
41
|
+
subSequence,
|
|
42
|
+
h1Matches,
|
|
43
|
+
unit
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const query = MEDIA[mediaName]
|
|
47
|
+
TYPOGRAPHY.templates[`@media screen and ${query}`] = {
|
|
48
|
+
fontSize: mediaValue.base / TYPOGRAPHY.browserDefault + unit
|
|
45
49
|
}
|
|
50
|
+
|
|
51
|
+
if (!mediaRegenerate) {
|
|
52
|
+
applyMediaSequenceVars(FACTORY, prop)
|
|
53
|
+
continue
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
merge(mediaValue, {
|
|
57
|
+
sequence: {},
|
|
58
|
+
scales: {},
|
|
59
|
+
templates: {},
|
|
60
|
+
vars: {}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
generateSequence(mediaValue)
|
|
64
|
+
|
|
65
|
+
applyMediaSequenceVars(FACTORY, prop)
|
|
46
66
|
}
|
|
47
67
|
}
|
|
48
68
|
|