fern-api 0.19.1 → 0.19.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/bundle.cjs +128 -61
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -797931,7 +797931,7 @@ var AccessTokenPosthogManager = class {
|
|
|
797931
797931
|
properties: {
|
|
797932
797932
|
...event,
|
|
797933
797933
|
...event.properties,
|
|
797934
|
-
version: "0.19.
|
|
797934
|
+
version: "0.19.3",
|
|
797935
797935
|
usingAccessToken: true
|
|
797936
797936
|
}
|
|
797937
797937
|
});
|
|
@@ -797993,7 +797993,7 @@ var UserPosthogManager = class {
|
|
|
797993
797993
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
797994
797994
|
event: "CLI",
|
|
797995
797995
|
properties: {
|
|
797996
|
-
version: "0.19.
|
|
797996
|
+
version: "0.19.3",
|
|
797997
797997
|
...event,
|
|
797998
797998
|
...event.properties
|
|
797999
797999
|
}
|
|
@@ -814403,6 +814403,9 @@ function getFernAvailability(operationObject) {
|
|
|
814403
814403
|
} else if (availability === "deprecated") {
|
|
814404
814404
|
return EndpointAvailability.Deprecated;
|
|
814405
814405
|
}
|
|
814406
|
+
if (operationObject.deprecated) {
|
|
814407
|
+
return EndpointAvailability.Deprecated;
|
|
814408
|
+
}
|
|
814406
814409
|
return void 0;
|
|
814407
814410
|
}
|
|
814408
814411
|
|
|
@@ -824768,10 +824771,10 @@ var CliContext = class {
|
|
|
824768
824771
|
return "fern-api";
|
|
824769
824772
|
}
|
|
824770
824773
|
getPackageVersion() {
|
|
824771
|
-
if ("0.19.
|
|
824774
|
+
if ("0.19.3" == null) {
|
|
824772
824775
|
this.logger.error("CLI_VERSION is not defined");
|
|
824773
824776
|
}
|
|
824774
|
-
return "0.19.
|
|
824777
|
+
return "0.19.3";
|
|
824775
824778
|
}
|
|
824776
824779
|
getCliName() {
|
|
824777
824780
|
if ("fern" == null) {
|
|
@@ -841000,10 +841003,6 @@ async function runRemoteGenerationForAPIWorkspace({ organization, workspace, con
|
|
|
841000
841003
|
};
|
|
841001
841004
|
}
|
|
841002
841005
|
|
|
841003
|
-
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/parseDocsConfiguration.js
|
|
841004
|
-
var import_fdr_sdk3 = __toESM(require_dist());
|
|
841005
|
-
var import_promises40 = require("fs/promises");
|
|
841006
|
-
|
|
841007
841006
|
// pnp:/home/circleci/project/.yarn/cache/tinycolor2-npm-1.6.0-8df41252c6-6df4d07fce.zip/node_modules/tinycolor2/esm/tinycolor.js
|
|
841008
841007
|
function _typeof2(obj) {
|
|
841009
841008
|
"@babel/helpers - typeof";
|
|
@@ -841983,6 +841982,7 @@ function validateWCAG2Parms(parms) {
|
|
|
841983
841982
|
|
|
841984
841983
|
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/convertColorsConfiguration.js
|
|
841985
841984
|
function convertColorsConfiguration(rawConfig, context) {
|
|
841985
|
+
rawConfig.accentPrimary = rawConfig.accentPrimary ?? rawConfig.accentPrimaryDeprecated;
|
|
841986
841986
|
const colorType = getColorType(rawConfig);
|
|
841987
841987
|
switch (colorType) {
|
|
841988
841988
|
case "dark":
|
|
@@ -842038,74 +842038,46 @@ function getColorType({ background, accentPrimary, accentPrimaryDeprecated }) {
|
|
|
842038
842038
|
}
|
|
842039
842039
|
function convertThemedColorConfig(rawConfig, context, theme) {
|
|
842040
842040
|
var _a2, _b2, _c2, _d;
|
|
842041
|
-
|
|
842042
|
-
|
|
842043
|
-
if (backgroundColor != null) {
|
|
842044
|
-
const newBackgroundColor = enforceBackgroundTheme(tinycolor(backgroundColor.toString()), theme);
|
|
842045
|
-
if (newBackgroundColor.toHexString() !== backgroundColor.toHexString()) {
|
|
842046
|
-
context.logger.warn(`The chosen shade, 'colors.background' 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()}.`);
|
|
842047
|
-
backgroundColor = newBackgroundColor;
|
|
842048
|
-
}
|
|
842049
|
-
}
|
|
842050
|
-
if (accentPrimaryColor != null) {
|
|
842051
|
-
const backgroundColorWithFallback = backgroundColor ?? tinycolor(theme === "dark" ? "#000" : "#FFF");
|
|
842052
|
-
const newAccentPrimaryColor = increaseForegroundContrast(tinycolor(accentPrimaryColor.toString()), backgroundColorWithFallback);
|
|
842053
|
-
if (newAccentPrimaryColor.toHexString() !== accentPrimaryColor.toHexString()) {
|
|
842054
|
-
const ratio = tinycolor.readability(accentPrimaryColor, backgroundColorWithFallback);
|
|
842055
|
-
context.logger.warn(`The chosen shade, 'colors.accent-primary' 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()}.`);
|
|
842056
|
-
accentPrimaryColor = newAccentPrimaryColor;
|
|
842057
|
-
}
|
|
842058
|
-
}
|
|
842041
|
+
const accentPrimaryColor = getColorInstanceFromRawConfigOrThrow(rawConfig.accentPrimary ?? rawConfig.accentPrimaryDeprecated, context, "accent-primary", theme) ?? tinycolor.random();
|
|
842042
|
+
const backgroundColor = getColorInstanceFromRawConfigOrThrow(rawConfig.background, context, "background", theme);
|
|
842059
842043
|
return {
|
|
842060
842044
|
accentPrimary: accentPrimaryColor.toRgb(),
|
|
842061
842045
|
background: backgroundColor == null ? void 0 : backgroundColor.toRgb(),
|
|
842062
|
-
border: (_a2 =
|
|
842063
|
-
sidebarBackground: (_b2 =
|
|
842064
|
-
headerBackground: (_c2 =
|
|
842065
|
-
cardBackground: (_d =
|
|
842046
|
+
border: (_a2 = getColorInstanceFromRawConfigOrThrow(rawConfig.border, context, "border", theme)) == null ? void 0 : _a2.toRgb(),
|
|
842047
|
+
sidebarBackground: (_b2 = getColorInstanceFromRawConfigOrThrow(rawConfig.sidebarBackground, context, "sidebar-background", theme)) == null ? void 0 : _b2.toRgb(),
|
|
842048
|
+
headerBackground: (_c2 = getColorInstanceFromRawConfigOrThrow(rawConfig.headerBackground, context, "header-background", theme)) == null ? void 0 : _c2.toRgb(),
|
|
842049
|
+
cardBackground: (_d = getColorInstanceFromRawConfigOrThrow(rawConfig.cardBackground, context, "card-background", theme)) == null ? void 0 : _d.toRgb()
|
|
842066
842050
|
};
|
|
842067
842051
|
}
|
|
842068
|
-
function
|
|
842069
|
-
|
|
842070
|
-
|
|
842071
|
-
while (!tinycolor.isReadable(newForgroundColor, backgroundColor)) {
|
|
842072
|
-
if (dark ? newForgroundColor.getBrightness() === 255 : newForgroundColor.getBrightness() === 0) {
|
|
842073
|
-
break;
|
|
842074
|
-
}
|
|
842075
|
-
newForgroundColor = dark ? newForgroundColor.lighten(1) : newForgroundColor.darken(1);
|
|
842052
|
+
function getColorFromRawConfig(raw, key2, theme) {
|
|
842053
|
+
if (raw == null) {
|
|
842054
|
+
return void 0;
|
|
842076
842055
|
}
|
|
842077
|
-
|
|
842078
|
-
|
|
842079
|
-
|
|
842080
|
-
if (theme === "dark" && color3.isDark()) {
|
|
842081
|
-
return color3;
|
|
842082
|
-
} else if (theme === "light" && color3.isLight()) {
|
|
842083
|
-
return color3;
|
|
842056
|
+
let rawColor = typeof raw === "string" ? raw : raw[theme];
|
|
842057
|
+
if (rawColor == null && key2 === "accent-primary" && typeof raw !== "string") {
|
|
842058
|
+
rawColor = raw[theme === "dark" ? "light" : "dark"];
|
|
842084
842059
|
}
|
|
842085
|
-
|
|
842086
|
-
}
|
|
842087
|
-
function getOppositeBrightness(color3) {
|
|
842088
|
-
if (color3 == null) {
|
|
842060
|
+
if (rawColor == null) {
|
|
842089
842061
|
return void 0;
|
|
842090
842062
|
}
|
|
842091
|
-
|
|
842092
|
-
return tinycolor({ h: h3, s: s2, v: 1 - v2 });
|
|
842063
|
+
return rawColor;
|
|
842093
842064
|
}
|
|
842094
|
-
function
|
|
842095
|
-
|
|
842096
|
-
|
|
842097
|
-
}
|
|
842098
|
-
const rawColor = typeof raw === "string" ? raw : raw[theme];
|
|
842099
|
-
if (rawColor == null) {
|
|
842065
|
+
function getColorInstanceFromRawConfigOrThrow(raw, context, key2, theme) {
|
|
842066
|
+
const color3 = getColorFromRawConfig(raw, key2, theme);
|
|
842067
|
+
if (color3 == null) {
|
|
842100
842068
|
return void 0;
|
|
842101
842069
|
}
|
|
842102
|
-
const
|
|
842103
|
-
if (!
|
|
842070
|
+
const instance = tinycolor(color3);
|
|
842071
|
+
if (!instance.isValid()) {
|
|
842104
842072
|
context.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF`);
|
|
842105
842073
|
}
|
|
842106
|
-
return
|
|
842074
|
+
return instance;
|
|
842107
842075
|
}
|
|
842108
842076
|
|
|
842077
|
+
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/parseDocsConfiguration.js
|
|
842078
|
+
var import_fdr_sdk3 = __toESM(require_dist());
|
|
842079
|
+
var import_promises40 = require("fs/promises");
|
|
842080
|
+
|
|
842109
842081
|
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/getAllPages.js
|
|
842110
842082
|
var import_promises39 = require("fs/promises");
|
|
842111
842083
|
async function getAllPages({ navigation, absolutePathToFernFolder }) {
|
|
@@ -843438,6 +843410,95 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
843438
843410
|
};
|
|
843439
843411
|
}
|
|
843440
843412
|
|
|
843413
|
+
// pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/rules/accent-color-contrast/index.js
|
|
843414
|
+
var AccentColorContrastRule = {
|
|
843415
|
+
name: "accent-color-contrast",
|
|
843416
|
+
create: () => {
|
|
843417
|
+
return {
|
|
843418
|
+
file: async ({ config }) => {
|
|
843419
|
+
if (config.colors == null) {
|
|
843420
|
+
return [];
|
|
843421
|
+
}
|
|
843422
|
+
const colorType = getColorType(config.colors);
|
|
843423
|
+
if (colorType === "dark") {
|
|
843424
|
+
return validateTheme(config.colors, "dark");
|
|
843425
|
+
} else if (colorType === "light") {
|
|
843426
|
+
return validateTheme(config.colors, "light");
|
|
843427
|
+
} else if (colorType === "darkAndLight") {
|
|
843428
|
+
return [...validateTheme(config.colors, "dark"), ...validateTheme(config.colors, "light")];
|
|
843429
|
+
}
|
|
843430
|
+
return [];
|
|
843431
|
+
}
|
|
843432
|
+
};
|
|
843433
|
+
}
|
|
843434
|
+
};
|
|
843435
|
+
function validateTheme(colors, theme) {
|
|
843436
|
+
const accentPrimaryColor = getColorFromRawConfig(colors.accentPrimary ?? colors.accentPrimaryDeprecated, "accent-primary", theme);
|
|
843437
|
+
let backgroundColor = getColorFromRawConfig(colors.background, "background", theme) ?? (theme === "dark" ? "#000" : "#FFF");
|
|
843438
|
+
const ruleViolations = [];
|
|
843439
|
+
if (!tinycolor(backgroundColor).isValid()) {
|
|
843440
|
+
ruleViolations.push({
|
|
843441
|
+
severity: "error",
|
|
843442
|
+
message: `Invalid background color provided for colors.background.${theme}: ${backgroundColor}.`
|
|
843443
|
+
});
|
|
843444
|
+
} else {
|
|
843445
|
+
const newBackground = enforceBackgroundTheme(tinycolor(backgroundColor), theme);
|
|
843446
|
+
if (tinycolor(backgroundColor).toHexString() !== newBackground.toHexString()) {
|
|
843447
|
+
ruleViolations.push({
|
|
843448
|
+
severity: "warning",
|
|
843449
|
+
message: `The provided background color for ${theme} mode is not ${theme} enough. It will be adjusted to ${newBackground.toHexString()}.`
|
|
843450
|
+
});
|
|
843451
|
+
}
|
|
843452
|
+
backgroundColor = newBackground.toHexString();
|
|
843453
|
+
}
|
|
843454
|
+
if (accentPrimaryColor == null) {
|
|
843455
|
+
ruleViolations.push({
|
|
843456
|
+
severity: "warning",
|
|
843457
|
+
message: `No accent-color provided for ${theme} mode. A random color will be used.`
|
|
843458
|
+
});
|
|
843459
|
+
} else if (!tinycolor(accentPrimaryColor).isValid()) {
|
|
843460
|
+
ruleViolations.push({
|
|
843461
|
+
severity: "error",
|
|
843462
|
+
message: `Invalid accent-color provided for colors.accent-primary.${theme}: ${accentPrimaryColor}.`
|
|
843463
|
+
});
|
|
843464
|
+
} else {
|
|
843465
|
+
const ratio = tinycolor.readability(accentPrimaryColor, backgroundColor);
|
|
843466
|
+
const readableRatio = `${ratio.toFixed(2)}:1`;
|
|
843467
|
+
if (ratio < 3) {
|
|
843468
|
+
ruleViolations.push({
|
|
843469
|
+
severity: "warning",
|
|
843470
|
+
message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. It should be at least 3:1.`
|
|
843471
|
+
});
|
|
843472
|
+
} else if (ratio < 4.5) {
|
|
843473
|
+
ruleViolations.push({
|
|
843474
|
+
severity: "warning",
|
|
843475
|
+
message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. Fern will adjust the color to meet the minimum contrast ratio of 4.5:1 for WCAG AA and 7:1 for WCAG AAA.`
|
|
843476
|
+
});
|
|
843477
|
+
} else if (ratio < 7) {
|
|
843478
|
+
ruleViolations.push({
|
|
843479
|
+
severity: "warning",
|
|
843480
|
+
message: `The contrast ratio between the accent color and the background color for ${theme} mode is ${readableRatio}. Fern will adjust the color to meet the minimum contrast ratio of 7:1 for WCAG AAA.`
|
|
843481
|
+
});
|
|
843482
|
+
}
|
|
843483
|
+
}
|
|
843484
|
+
return ruleViolations;
|
|
843485
|
+
}
|
|
843486
|
+
function enforceBackgroundTheme(color3, theme) {
|
|
843487
|
+
if (theme === "dark" && color3.isDark()) {
|
|
843488
|
+
return color3;
|
|
843489
|
+
} else if (theme === "light" && color3.isLight()) {
|
|
843490
|
+
return color3;
|
|
843491
|
+
}
|
|
843492
|
+
return getOppositeBrightness(color3);
|
|
843493
|
+
}
|
|
843494
|
+
function getOppositeBrightness(color3) {
|
|
843495
|
+
if (color3 == null) {
|
|
843496
|
+
return void 0;
|
|
843497
|
+
}
|
|
843498
|
+
const { h: h3, s: s2, v: v2 } = color3.toHsv();
|
|
843499
|
+
return tinycolor({ h: h3, s: s2, v: 1 - v2 });
|
|
843500
|
+
}
|
|
843501
|
+
|
|
843441
843502
|
// pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/rules/filepaths-exist/filepaths-exist.js
|
|
843442
843503
|
var FilepathsExistRule = {
|
|
843443
843504
|
name: "filepaths-exist",
|
|
@@ -868865,7 +868926,13 @@ var ValidateVersionFileRule = {
|
|
|
868865
868926
|
|
|
868866
868927
|
// pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/getAllRules.js
|
|
868867
868928
|
function getAllRules2() {
|
|
868868
|
-
return [
|
|
868929
|
+
return [
|
|
868930
|
+
FilepathsExistRule,
|
|
868931
|
+
ValidMarkdownRule,
|
|
868932
|
+
OnlyVersionedNavigation,
|
|
868933
|
+
ValidateVersionFileRule,
|
|
868934
|
+
AccentColorContrastRule
|
|
868935
|
+
];
|
|
868869
868936
|
}
|
|
868870
868937
|
|
|
868871
868938
|
// pnp:/home/circleci/project/packages/cli/yaml/docs-validator/lib/validateDocsWorkspace.js
|