@symbo.ls/scratch 2.11.522 → 2.11.524
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/index.js +8 -4
- package/dist/cjs/utils/index.js +8 -4
- package/dist/cjs/utils/sequence.js +8 -4
- package/package.json +2 -2
- package/src/utils/sequence.js +10 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1226,8 +1226,12 @@ var generateSequence = (sequenceProps) => {
|
|
|
1226
1226
|
return sequenceProps;
|
|
1227
1227
|
};
|
|
1228
1228
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
1229
|
+
var _a;
|
|
1229
1230
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
1230
|
-
const letterKey = (
|
|
1231
|
+
const letterKey = isString(position) ? position : numToLetterMap[position];
|
|
1232
|
+
const index = isString(position) ? (_a = Object.entries(numToLetterMap).find(
|
|
1233
|
+
([, value2]) => value2 === position
|
|
1234
|
+
)) == null ? void 0 : _a[0] : position;
|
|
1231
1235
|
if (!letterKey) {
|
|
1232
1236
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
1233
1237
|
return null;
|
|
@@ -1238,11 +1242,11 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
1238
1242
|
vars: {},
|
|
1239
1243
|
...sequenceProps
|
|
1240
1244
|
};
|
|
1241
|
-
const value = base * Math.pow(ratio,
|
|
1245
|
+
const value = base * Math.pow(ratio, index);
|
|
1242
1246
|
const scaling = ~~(value / base * 100) / 100;
|
|
1243
1247
|
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
1244
1248
|
const variable = prefix + letterKey;
|
|
1245
|
-
const scalingVariable = setScalingVar(
|
|
1249
|
+
const scalingVariable = setScalingVar(index, sequenceProps);
|
|
1246
1250
|
const props = {
|
|
1247
1251
|
key: letterKey,
|
|
1248
1252
|
variable,
|
|
@@ -1251,7 +1255,7 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
1251
1255
|
scaling,
|
|
1252
1256
|
scalingVariable,
|
|
1253
1257
|
ratio,
|
|
1254
|
-
index
|
|
1258
|
+
index
|
|
1255
1259
|
};
|
|
1256
1260
|
setSequenceValue(props, result);
|
|
1257
1261
|
if (subSequence) {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1035,8 +1035,12 @@ var generateSequence = (sequenceProps) => {
|
|
|
1035
1035
|
return sequenceProps;
|
|
1036
1036
|
};
|
|
1037
1037
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
1038
|
+
var _a;
|
|
1038
1039
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
1039
|
-
const letterKey = (
|
|
1040
|
+
const letterKey = isString(position) ? position : numToLetterMap[position];
|
|
1041
|
+
const index = isString(position) ? (_a = Object.entries(numToLetterMap).find(
|
|
1042
|
+
([, value2]) => value2 === position
|
|
1043
|
+
)) == null ? void 0 : _a[0] : position;
|
|
1040
1044
|
if (!letterKey) {
|
|
1041
1045
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
1042
1046
|
return null;
|
|
@@ -1047,11 +1051,11 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
1047
1051
|
vars: {},
|
|
1048
1052
|
...sequenceProps
|
|
1049
1053
|
};
|
|
1050
|
-
const value = base * Math.pow(ratio,
|
|
1054
|
+
const value = base * Math.pow(ratio, index);
|
|
1051
1055
|
const scaling = ~~(value / base * 100) / 100;
|
|
1052
1056
|
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
1053
1057
|
const variable = prefix + letterKey;
|
|
1054
|
-
const scalingVariable = setScalingVar(
|
|
1058
|
+
const scalingVariable = setScalingVar(index, sequenceProps);
|
|
1055
1059
|
const props = {
|
|
1056
1060
|
key: letterKey,
|
|
1057
1061
|
variable,
|
|
@@ -1060,7 +1064,7 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
1060
1064
|
scaling,
|
|
1061
1065
|
scalingVariable,
|
|
1062
1066
|
ratio,
|
|
1063
|
-
index
|
|
1067
|
+
index
|
|
1064
1068
|
};
|
|
1065
1069
|
setSequenceValue(props, result);
|
|
1066
1070
|
if (subSequence) {
|
|
@@ -759,8 +759,12 @@ var generateSequence = (sequenceProps) => {
|
|
|
759
759
|
return sequenceProps;
|
|
760
760
|
};
|
|
761
761
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
762
|
+
var _a;
|
|
762
763
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
763
|
-
const letterKey = (
|
|
764
|
+
const letterKey = isString(position) ? position : numToLetterMap[position];
|
|
765
|
+
const index = isString(position) ? (_a = Object.entries(numToLetterMap).find(
|
|
766
|
+
([, value2]) => value2 === position
|
|
767
|
+
)) == null ? void 0 : _a[0] : position;
|
|
764
768
|
if (!letterKey) {
|
|
765
769
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
766
770
|
return null;
|
|
@@ -771,11 +775,11 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
771
775
|
vars: {},
|
|
772
776
|
...sequenceProps
|
|
773
777
|
};
|
|
774
|
-
const value = base * Math.pow(ratio,
|
|
778
|
+
const value = base * Math.pow(ratio, index);
|
|
775
779
|
const scaling = ~~(value / base * 100) / 100;
|
|
776
780
|
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
777
781
|
const variable = prefix + letterKey;
|
|
778
|
-
const scalingVariable = setScalingVar(
|
|
782
|
+
const scalingVariable = setScalingVar(index, sequenceProps);
|
|
779
783
|
const props = {
|
|
780
784
|
key: letterKey,
|
|
781
785
|
variable,
|
|
@@ -784,7 +788,7 @@ var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
784
788
|
scaling,
|
|
785
789
|
scalingVariable,
|
|
786
790
|
ratio,
|
|
787
|
-
index
|
|
791
|
+
index
|
|
788
792
|
};
|
|
789
793
|
setSequenceValue(props, result);
|
|
790
794
|
if (subSequence) {
|
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.524",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@symbo.ls/utils": "^2.11.512",
|
|
31
31
|
"color-contrast-checker": "^1.5.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "11ddc293abaa696dce80d4fb0356a27f0a0f476c"
|
|
34
34
|
}
|
package/src/utils/sequence.js
CHANGED
|
@@ -170,8 +170,13 @@ export const generateSequence = (sequenceProps) => {
|
|
|
170
170
|
|
|
171
171
|
export const generateSequencePosition = (sequenceProps, position = 0) => {
|
|
172
172
|
const { type, base, ratio, subSequence } = sequenceProps
|
|
173
|
-
const letterKey =
|
|
174
|
-
|
|
173
|
+
const letterKey = isString(position) ? position : numToLetterMap[position]
|
|
174
|
+
const index = isString(position)
|
|
175
|
+
? Object.entries(numToLetterMap).find(
|
|
176
|
+
([, value]) => value === position
|
|
177
|
+
)?.[0]
|
|
178
|
+
: position
|
|
179
|
+
|
|
175
180
|
if (!letterKey) {
|
|
176
181
|
console.warn(`Position ${position} is out of range in numToLetterMap`)
|
|
177
182
|
return null
|
|
@@ -184,11 +189,11 @@ export const generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
184
189
|
...sequenceProps
|
|
185
190
|
}
|
|
186
191
|
|
|
187
|
-
const value = base * Math.pow(ratio,
|
|
192
|
+
const value = base * Math.pow(ratio, index)
|
|
188
193
|
const scaling = ~~((value / base) * 100) / 100
|
|
189
194
|
const prefix = '--' + (type && type.replace('.', '-')) + '-'
|
|
190
195
|
const variable = prefix + letterKey
|
|
191
|
-
const scalingVariable = setScalingVar(
|
|
196
|
+
const scalingVariable = setScalingVar(index, sequenceProps)
|
|
192
197
|
|
|
193
198
|
const props = {
|
|
194
199
|
key: letterKey,
|
|
@@ -198,7 +203,7 @@ export const generateSequencePosition = (sequenceProps, position = 0) => {
|
|
|
198
203
|
scaling,
|
|
199
204
|
scalingVariable,
|
|
200
205
|
ratio,
|
|
201
|
-
index
|
|
206
|
+
index
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
setSequenceValue(props, result)
|