@yahoo/uds-mobile 2.4.1 → 2.4.3
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/bin/generateTheme.mjs +14 -39
- package/fonts/uds-icons.ttf +0 -0
- package/package.json +1 -1
|
@@ -123,25 +123,12 @@ function generateElevationBorderColors(config, colorMode) {
|
|
|
123
123
|
*/
|
|
124
124
|
function generateElevationBackgroundColors(config, colorMode) {
|
|
125
125
|
const result = {};
|
|
126
|
-
const palette = config.colorMode[colorMode].palette;
|
|
127
|
-
const spectrum = config.colorMode[colorMode].spectrum;
|
|
128
126
|
for (const level of Object.keys(config.elevation)) {
|
|
129
|
-
const
|
|
127
|
+
const fbv = config.elevation[level][colorMode].finalBackgroundValue;
|
|
130
128
|
let color = "transparent";
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const rgbValue = spectrum[colorDef.hue]?.[colorDef.step];
|
|
135
|
-
if (rgbValue) {
|
|
136
|
-
const parts = extractRgb(rgbValue).trim().split(/\s+/);
|
|
137
|
-
color = colorDef.opacity !== void 0 ? `rgba(${parts.join(", ")}, ${parseInt(colorDef.opacity, 10) / 100})` : `rgb(${parts.join(", ")})`;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
} else if (backgroundFill.type === "always") color = newAlwaysPalette[backgroundFill.value] ?? "transparent";
|
|
141
|
-
else if (backgroundFill.type === "spectrum") {
|
|
142
|
-
const spectrumValue = backgroundFill.value;
|
|
143
|
-
const rgbValue = spectrum[spectrumValue.hue]?.[spectrumValue.step];
|
|
144
|
-
if (rgbValue) color = `rgb(${extractRgb(rgbValue).trim().split(/\s+/).join(", ")})`;
|
|
129
|
+
if (fbv) {
|
|
130
|
+
const alpha = parseInt(String(fbv.a), 10) / 100;
|
|
131
|
+
color = alpha < 1 ? `rgba(${fbv.r}, ${fbv.g}, ${fbv.b}, ${alpha})` : `rgb(${fbv.r}, ${fbv.g}, ${fbv.b})`;
|
|
145
132
|
}
|
|
146
133
|
result[`elevation-${level}`] = color;
|
|
147
134
|
}
|
|
@@ -277,7 +264,7 @@ function isElevationCustomShadows(value) {
|
|
|
277
264
|
function generateBoxShadows(config, colorMode) {
|
|
278
265
|
const colorsConfig = config.colorMode[colorMode];
|
|
279
266
|
const spectrum = colorsConfig.spectrum;
|
|
280
|
-
const palette = colorsConfig.palette.
|
|
267
|
+
const palette = colorsConfig.palette.shadow;
|
|
281
268
|
const drop = {};
|
|
282
269
|
const inset = {};
|
|
283
270
|
for (const [variant, presets] of Object.entries(config.shadow.drop)) {
|
|
@@ -388,7 +375,7 @@ function resolveValue(variable, config, colorMode, propName) {
|
|
|
388
375
|
const shadowVariant = value;
|
|
389
376
|
if (shadowVariant === "none") return [];
|
|
390
377
|
const shadowPresets = config.shadow.drop[shadowVariant];
|
|
391
|
-
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.
|
|
378
|
+
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.shadow);
|
|
392
379
|
return [];
|
|
393
380
|
}
|
|
394
381
|
if (type === "shadowVariantsWithInvert") {
|
|
@@ -396,9 +383,9 @@ function resolveValue(variable, config, colorMode, propName) {
|
|
|
396
383
|
if (shadowVariant === "none") return [];
|
|
397
384
|
const baseVariant = shadowVariant.endsWith("-invert") ? shadowVariant.replace("-invert", "") : shadowVariant;
|
|
398
385
|
const shadowPresets = config.shadow.inset[shadowVariant];
|
|
399
|
-
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.
|
|
386
|
+
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.shadow, true);
|
|
400
387
|
const dropPresets = config.shadow.drop[baseVariant];
|
|
401
|
-
if (dropPresets && dropPresets.length > 0) return convertShadowToBoxShadow(dropPresets, spectrum, palette.
|
|
388
|
+
if (dropPresets && dropPresets.length > 0) return convertShadowToBoxShadow(dropPresets, spectrum, palette.shadow, true);
|
|
402
389
|
return [];
|
|
403
390
|
}
|
|
404
391
|
if (type === "elevationAliases") {
|
|
@@ -407,22 +394,10 @@ function resolveValue(variable, config, colorMode, propName) {
|
|
|
407
394
|
if (!elevationPreset) return;
|
|
408
395
|
const preset = elevationPreset[colorMode];
|
|
409
396
|
if (propName === "backgroundColor") {
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const rgbValue = spectrum[colorDef.hue]?.[colorDef.step];
|
|
415
|
-
if (rgbValue) {
|
|
416
|
-
const parts = extractRgb(rgbValue).trim().split(/\s+/);
|
|
417
|
-
if (colorDef.opacity !== void 0) return `rgba(${parts.join(", ")}, ${parseInt(colorDef.opacity, 10) / 100})`;
|
|
418
|
-
return `rgb(${parts.join(", ")})`;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
} else if (backgroundFill.type === "always") return newAlwaysPalette[backgroundFill.value] ?? "transparent";
|
|
422
|
-
else if (backgroundFill.type === "spectrum") {
|
|
423
|
-
const spectrumValue = backgroundFill.value;
|
|
424
|
-
const rgbValue = spectrum[spectrumValue.hue]?.[spectrumValue.step];
|
|
425
|
-
if (rgbValue) return `rgb(${extractRgb(rgbValue).trim().split(/\s+/).join(", ")})`;
|
|
397
|
+
const fbv = preset.finalBackgroundValue;
|
|
398
|
+
if (fbv) {
|
|
399
|
+
const alpha = parseInt(String(fbv.a), 10) / 100;
|
|
400
|
+
return alpha < 1 ? `rgba(${fbv.r}, ${fbv.g}, ${fbv.b}, ${alpha})` : `rgb(${fbv.r}, ${fbv.g}, ${fbv.b})`;
|
|
426
401
|
}
|
|
427
402
|
return "transparent";
|
|
428
403
|
}
|
|
@@ -457,10 +432,10 @@ function resolveValue(variable, config, colorMode, propName) {
|
|
|
457
432
|
if (!preset.dropShadow || preset.dropShadow === "none") return [];
|
|
458
433
|
if (isElevationCustomShadows(preset.dropShadow)) {
|
|
459
434
|
const allPresets = [...preset.dropShadow];
|
|
460
|
-
return allPresets.length > 0 ? convertShadowToBoxShadow(allPresets, spectrum, palette.
|
|
435
|
+
return allPresets.length > 0 ? convertShadowToBoxShadow(allPresets, spectrum, palette.shadow) : [];
|
|
461
436
|
}
|
|
462
437
|
const refPresets = config.shadow.drop[preset.dropShadow];
|
|
463
|
-
return refPresets && refPresets.length > 0 ? convertShadowToBoxShadow(refPresets, spectrum, palette.
|
|
438
|
+
return refPresets && refPresets.length > 0 ? convertShadowToBoxShadow(refPresets, spectrum, palette.shadow) : [];
|
|
464
439
|
}
|
|
465
440
|
return;
|
|
466
441
|
}
|
package/fonts/uds-icons.ttf
CHANGED
|
Binary file
|