fern-api 0.17.0-rc2 → 0.17.1
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/bundle.cjs +34 -21
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -735189,7 +735189,7 @@ var AccessTokenPosthogManager = class {
|
|
|
735189
735189
|
properties: {
|
|
735190
735190
|
...event,
|
|
735191
735191
|
...event.properties,
|
|
735192
|
-
version: "0.17.
|
|
735192
|
+
version: "0.17.1",
|
|
735193
735193
|
usingAccessToken: true
|
|
735194
735194
|
}
|
|
735195
735195
|
});
|
|
@@ -735251,7 +735251,7 @@ var UserPosthogManager = class {
|
|
|
735251
735251
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
735252
735252
|
event: "CLI",
|
|
735253
735253
|
properties: {
|
|
735254
|
-
version: "0.17.
|
|
735254
|
+
version: "0.17.1",
|
|
735255
735255
|
...event,
|
|
735256
735256
|
...event.properties
|
|
735257
735257
|
}
|
|
@@ -752533,7 +752533,7 @@ async function loadOpenAPI({ absolutePathToOpenAPI, absolutePathToOpenAPIOverrid
|
|
|
752533
752533
|
} catch (err) {
|
|
752534
752534
|
return context.failAndThrow(`Failed to read OpenAPI overrides from file ${overridesFilepath}`);
|
|
752535
752535
|
}
|
|
752536
|
-
const merged = mergeWith_default({}, parsed, parsedOverrides, (obj, src) => Array.isArray(obj) && Array.isArray(src) ? [...src] : void 0);
|
|
752536
|
+
const merged = mergeWith_default({}, parsed, parsedOverrides, (obj, src) => Array.isArray(obj) && Array.isArray(src) ? src.every((element2) => typeof element2 === "object") && obj.every((element2) => typeof element2 === "object") ? void 0 : [...src] : void 0);
|
|
752537
752537
|
return merged;
|
|
752538
752538
|
}
|
|
752539
752539
|
return parsed;
|
|
@@ -760945,10 +760945,10 @@ var CliContext = class {
|
|
|
760945
760945
|
return "fern-api";
|
|
760946
760946
|
}
|
|
760947
760947
|
getPackageVersion() {
|
|
760948
|
-
if ("0.17.
|
|
760948
|
+
if ("0.17.1" == null) {
|
|
760949
760949
|
this.logger.error("CLI_VERSION is not defined");
|
|
760950
760950
|
}
|
|
760951
|
-
return "0.17.
|
|
760951
|
+
return "0.17.1";
|
|
760952
760952
|
}
|
|
760953
760953
|
getCliName() {
|
|
760954
760954
|
if ("fern" == null) {
|
|
@@ -777187,13 +777187,20 @@ function getColorType({ background, accentPrimary }) {
|
|
|
777187
777187
|
function convertThemedColorConfig(rawConfig, context, theme) {
|
|
777188
777188
|
let accentPrimaryColor = getColorInstanceFromRawConfig(rawConfig.accentPrimary, context, "accentPrimary", theme);
|
|
777189
777189
|
let backgroundColor = getColorInstanceFromRawConfig(rawConfig.background, context, "background", theme);
|
|
777190
|
-
|
|
777191
|
-
|
|
777192
|
-
|
|
777193
|
-
|
|
777194
|
-
|
|
777195
|
-
|
|
777196
|
-
|
|
777190
|
+
if (backgroundColor != null) {
|
|
777191
|
+
const newBackgroundColor = enforceBackgroundTheme(tinycolor(backgroundColor.toString()), theme);
|
|
777192
|
+
if (newBackgroundColor.toHexString() !== backgroundColor.toHexString()) {
|
|
777193
|
+
context.logger.warn(`The chosen shade, 'backgroundColor' in ${theme} mode, fails to meet minimum contrast requirements. The brightness is ${backgroundColor.getBrightness()}. To enhance accessibility and ensure content readability, Fern will adjust from ${backgroundColor.toHexString()} to a more contrast-rich ${newBackgroundColor.toHexString()}.`);
|
|
777194
|
+
backgroundColor = newBackgroundColor;
|
|
777195
|
+
}
|
|
777196
|
+
}
|
|
777197
|
+
if (accentPrimaryColor != null) {
|
|
777198
|
+
const backgroundColorWithFallback = backgroundColor ?? tinycolor(theme === "dark" ? "#000" : "#FFF");
|
|
777199
|
+
const newAccentPrimaryColor = increaseForegroundContrast(tinycolor(accentPrimaryColor.toString()), backgroundColorWithFallback);
|
|
777200
|
+
if (newAccentPrimaryColor.toHexString() !== accentPrimaryColor.toHexString()) {
|
|
777201
|
+
const ratio = tinycolor.readability(accentPrimaryColor, backgroundColorWithFallback);
|
|
777202
|
+
context.logger.warn(`The chosen shade, 'accentColor' in ${theme} mode, fails to meet minimum contrast requirements. The contrast ratio is ${ratio}, which is below WCAG AA requirements (4.5:1). To enhance accessibility and ensure content readability, Fern will adjust from ${accentPrimaryColor.toHexString()} to a more contrast-rich ${newAccentPrimaryColor.toHexString()}.`);
|
|
777203
|
+
accentPrimaryColor = newAccentPrimaryColor;
|
|
777197
777204
|
}
|
|
777198
777205
|
}
|
|
777199
777206
|
return {
|
|
@@ -777201,25 +777208,31 @@ function convertThemedColorConfig(rawConfig, context, theme) {
|
|
|
777201
777208
|
background: toRgb2(backgroundColor)
|
|
777202
777209
|
};
|
|
777203
777210
|
}
|
|
777204
|
-
function
|
|
777205
|
-
|
|
777206
|
-
|
|
777211
|
+
function increaseForegroundContrast(foregroundColor, backgroundColor) {
|
|
777212
|
+
let newForgroundColor = foregroundColor;
|
|
777213
|
+
const dark = backgroundColor.isDark();
|
|
777214
|
+
while (!tinycolor.isReadable(newForgroundColor, backgroundColor)) {
|
|
777215
|
+
if (dark ? newForgroundColor.getBrightness() === 255 : newForgroundColor.getBrightness() === 0) {
|
|
777216
|
+
break;
|
|
777217
|
+
}
|
|
777218
|
+
newForgroundColor = dark ? newForgroundColor.lighten(1) : newForgroundColor.darken(1);
|
|
777207
777219
|
}
|
|
777220
|
+
return newForgroundColor;
|
|
777221
|
+
}
|
|
777222
|
+
function enforceBackgroundTheme(color3, theme) {
|
|
777208
777223
|
if (theme === "dark" && color3.isDark()) {
|
|
777209
777224
|
return color3;
|
|
777210
777225
|
} else if (theme === "light" && color3.isLight()) {
|
|
777211
777226
|
return color3;
|
|
777212
777227
|
}
|
|
777213
|
-
|
|
777214
|
-
context.logger.warn(`The ${key2} color should be ${theme}. We've adjusted the color to ${newColor.toHexString()} to match the theme by flipping its luminance.`);
|
|
777215
|
-
return newColor;
|
|
777228
|
+
return getOppositeBrightness(color3);
|
|
777216
777229
|
}
|
|
777217
|
-
function
|
|
777230
|
+
function getOppositeBrightness(color3) {
|
|
777218
777231
|
if (color3 == null) {
|
|
777219
777232
|
return void 0;
|
|
777220
777233
|
}
|
|
777221
|
-
const { h: h3, s: s2,
|
|
777222
|
-
return tinycolor({ h: h3, s: s2,
|
|
777234
|
+
const { h: h3, s: s2, v: v2 } = color3.toHsv();
|
|
777235
|
+
return tinycolor({ h: h3, s: s2, v: 1 - v2 });
|
|
777223
777236
|
}
|
|
777224
777237
|
function toRgb2(color3) {
|
|
777225
777238
|
if (color3 == null) {
|