fern-api 0.16.44-rc0 → 0.16.44-rc1
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 +117 -66
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -731147,7 +731147,7 @@ var AccessTokenPosthogManager = class {
|
|
|
731147
731147
|
properties: {
|
|
731148
731148
|
...event,
|
|
731149
731149
|
...event.properties,
|
|
731150
|
-
version: "0.16.44-
|
|
731150
|
+
version: "0.16.44-rc1",
|
|
731151
731151
|
usingAccessToken: true
|
|
731152
731152
|
}
|
|
731153
731153
|
});
|
|
@@ -731209,7 +731209,7 @@ var UserPosthogManager = class {
|
|
|
731209
731209
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
731210
731210
|
event: "CLI",
|
|
731211
731211
|
properties: {
|
|
731212
|
-
version: "0.16.44-
|
|
731212
|
+
version: "0.16.44-rc1",
|
|
731213
731213
|
...event,
|
|
731214
731214
|
...event.properties
|
|
731215
731215
|
}
|
|
@@ -756891,10 +756891,10 @@ var CliContext = class {
|
|
|
756891
756891
|
return "fern-api";
|
|
756892
756892
|
}
|
|
756893
756893
|
getPackageVersion() {
|
|
756894
|
-
if ("0.16.44-
|
|
756894
|
+
if ("0.16.44-rc1" == null) {
|
|
756895
756895
|
this.logger.error("CLI_VERSION is not defined");
|
|
756896
756896
|
}
|
|
756897
|
-
return "0.16.44-
|
|
756897
|
+
return "0.16.44-rc1";
|
|
756898
756898
|
}
|
|
756899
756899
|
getCliName() {
|
|
756900
756900
|
if ("fern" == null) {
|
|
@@ -772800,6 +772800,119 @@ function validateWCAG2Parms(parms) {
|
|
|
772800
772800
|
};
|
|
772801
772801
|
}
|
|
772802
772802
|
|
|
772803
|
+
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/convertColorsConfiguration.js
|
|
772804
|
+
function convertColorsConfiguration(rawConfig, context) {
|
|
772805
|
+
const colorType = getColorType(rawConfig);
|
|
772806
|
+
switch (colorType) {
|
|
772807
|
+
case "dark":
|
|
772808
|
+
return {
|
|
772809
|
+
type: "dark",
|
|
772810
|
+
...convertThemedColorConfig(rawConfig, context, "dark")
|
|
772811
|
+
};
|
|
772812
|
+
case "light":
|
|
772813
|
+
return {
|
|
772814
|
+
type: "light",
|
|
772815
|
+
...convertThemedColorConfig(rawConfig, context, "light")
|
|
772816
|
+
};
|
|
772817
|
+
case "darkAndLight":
|
|
772818
|
+
return {
|
|
772819
|
+
type: "darkAndLight",
|
|
772820
|
+
dark: convertThemedColorConfig(rawConfig, context, "dark"),
|
|
772821
|
+
light: convertThemedColorConfig(rawConfig, context, "light")
|
|
772822
|
+
};
|
|
772823
|
+
default:
|
|
772824
|
+
assertNever(colorType);
|
|
772825
|
+
}
|
|
772826
|
+
}
|
|
772827
|
+
function getColorType({ background, accentPrimary }) {
|
|
772828
|
+
if (typeof background === "string" && typeof accentPrimary === "string") {
|
|
772829
|
+
return tinycolor(background).isDark() ? "dark" : "light";
|
|
772830
|
+
}
|
|
772831
|
+
if (background != null) {
|
|
772832
|
+
if (typeof background === "string") {
|
|
772833
|
+
return tinycolor(background).isDark() ? "dark" : "light";
|
|
772834
|
+
}
|
|
772835
|
+
if (background.dark != null && background.light != null) {
|
|
772836
|
+
return "darkAndLight";
|
|
772837
|
+
}
|
|
772838
|
+
}
|
|
772839
|
+
if (accentPrimary != null) {
|
|
772840
|
+
if (typeof accentPrimary === "string") {
|
|
772841
|
+
return tinycolor(accentPrimary).isLight() ? "dark" : "light";
|
|
772842
|
+
}
|
|
772843
|
+
if (accentPrimary.dark != null && accentPrimary.light != null) {
|
|
772844
|
+
return "darkAndLight";
|
|
772845
|
+
}
|
|
772846
|
+
}
|
|
772847
|
+
if (accentPrimary != null && background != null) {
|
|
772848
|
+
if (background.dark != null && accentPrimary.dark != null) {
|
|
772849
|
+
return "dark";
|
|
772850
|
+
}
|
|
772851
|
+
if (background.light != null && accentPrimary.light != null) {
|
|
772852
|
+
return "light";
|
|
772853
|
+
}
|
|
772854
|
+
}
|
|
772855
|
+
return "darkAndLight";
|
|
772856
|
+
}
|
|
772857
|
+
function convertThemedColorConfig(rawConfig, context, theme) {
|
|
772858
|
+
let accentPrimaryColor = getColorInstanceFromRawConfig(rawConfig.accentPrimary, context, "accentPrimary", theme);
|
|
772859
|
+
let backgroundColor = getColorInstanceFromRawConfig(rawConfig.background, context, "background", theme);
|
|
772860
|
+
backgroundColor = enforceTheme(backgroundColor, context, "background", theme);
|
|
772861
|
+
accentPrimaryColor = enforceTheme(accentPrimaryColor, context, "accentPrimary", theme === "dark" ? "light" : "dark");
|
|
772862
|
+
if (accentPrimaryColor != null && backgroundColor != null) {
|
|
772863
|
+
if (!tinycolor.isReadable(accentPrimaryColor, backgroundColor)) {
|
|
772864
|
+
const ratio = tinycolor.readability(accentPrimaryColor, backgroundColor);
|
|
772865
|
+
accentPrimaryColor = tinycolor.mostReadable(backgroundColor, accentPrimaryColor.monochromatic(3));
|
|
772866
|
+
context.logger.warn(`The accent color is not readable on the background color in ${theme} mode. The contrast ratio is ${ratio}. We've adjusted the accent color to ${accentPrimaryColor.toHexString()} to improve readability.`);
|
|
772867
|
+
}
|
|
772868
|
+
}
|
|
772869
|
+
return {
|
|
772870
|
+
accentPrimary: toRgb2(accentPrimaryColor),
|
|
772871
|
+
background: toRgb2(backgroundColor)
|
|
772872
|
+
};
|
|
772873
|
+
}
|
|
772874
|
+
function enforceTheme(color3, context, key2, theme) {
|
|
772875
|
+
if (color3 == null) {
|
|
772876
|
+
return void 0;
|
|
772877
|
+
}
|
|
772878
|
+
if (theme === "dark" && color3.isDark()) {
|
|
772879
|
+
return color3;
|
|
772880
|
+
} else if (theme === "light" && color3.isLight()) {
|
|
772881
|
+
return color3;
|
|
772882
|
+
}
|
|
772883
|
+
const newColor = getOppositeLuminance(color3);
|
|
772884
|
+
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.`);
|
|
772885
|
+
return newColor;
|
|
772886
|
+
}
|
|
772887
|
+
function getOppositeLuminance(color3) {
|
|
772888
|
+
if (color3 == null) {
|
|
772889
|
+
return void 0;
|
|
772890
|
+
}
|
|
772891
|
+
const { h: h3, s: s2, l: l2 } = color3.toHsl();
|
|
772892
|
+
return tinycolor({ h: h3, s: s2, l: 1 - l2 });
|
|
772893
|
+
}
|
|
772894
|
+
function toRgb2(color3) {
|
|
772895
|
+
if (color3 == null) {
|
|
772896
|
+
return void 0;
|
|
772897
|
+
}
|
|
772898
|
+
const { r: r2, g: g2, b: b2 } = color3.toRgb();
|
|
772899
|
+
return { r: r2, g: g2, b: b2 };
|
|
772900
|
+
}
|
|
772901
|
+
function getColorInstanceFromRawConfig(raw, context, key2, theme) {
|
|
772902
|
+
if (raw == null) {
|
|
772903
|
+
return void 0;
|
|
772904
|
+
}
|
|
772905
|
+
const rawColor = typeof raw === "string" ? raw : raw[theme] ?? raw.dark ?? raw.light;
|
|
772906
|
+
if (rawColor == null) {
|
|
772907
|
+
return void 0;
|
|
772908
|
+
}
|
|
772909
|
+
const color3 = tinycolor(rawColor);
|
|
772910
|
+
if (!color3.isValid()) {
|
|
772911
|
+
context.failAndThrow(`'${typeof raw === "string" ? key2 : `${key2}.${theme}`}' should be a hex color of the format #FFFFFF`);
|
|
772912
|
+
}
|
|
772913
|
+
return color3;
|
|
772914
|
+
}
|
|
772915
|
+
|
|
772803
772916
|
// pnp:/home/circleci/project/packages/cli/config-management/docs-configuration/lib/getAllPages.js
|
|
772804
772917
|
var import_promises39 = require("fs/promises");
|
|
772805
772918
|
async function getAllPages({ navigation, absolutePathToFernFolder }) {
|
|
@@ -773112,68 +773225,6 @@ async function convertImageReference({ rawImageReference, absoluteFilepathToDocs
|
|
|
773112
773225
|
})
|
|
773113
773226
|
};
|
|
773114
773227
|
}
|
|
773115
|
-
function getColorType(colorConfig) {
|
|
773116
|
-
if (colorConfig == null) {
|
|
773117
|
-
return "dark";
|
|
773118
|
-
}
|
|
773119
|
-
if (typeof colorConfig === "string") {
|
|
773120
|
-
if (tinycolor(colorConfig).isValid()) {
|
|
773121
|
-
return tinycolor(colorConfig).isDark() ? "dark" : "light";
|
|
773122
|
-
} else {
|
|
773123
|
-
return "dark";
|
|
773124
|
-
}
|
|
773125
|
-
}
|
|
773126
|
-
if (colorConfig.dark != null && colorConfig.light != null) {
|
|
773127
|
-
return "darkAndLight";
|
|
773128
|
-
}
|
|
773129
|
-
if (colorConfig.dark != null) {
|
|
773130
|
-
return "dark";
|
|
773131
|
-
}
|
|
773132
|
-
if (colorConfig.light != null) {
|
|
773133
|
-
return "light";
|
|
773134
|
-
}
|
|
773135
|
-
return "dark";
|
|
773136
|
-
}
|
|
773137
|
-
function convertColorsConfiguration(rawConfig, context) {
|
|
773138
|
-
const colorType = getColorType(rawConfig.background ?? rawConfig.accentPrimary);
|
|
773139
|
-
switch (colorType) {
|
|
773140
|
-
case "dark":
|
|
773141
|
-
return {
|
|
773142
|
-
type: "dark",
|
|
773143
|
-
accentPrimary: rawConfig.accentPrimary != null ? convertColorConfiguration(rawConfig.accentPrimary, context, "accentPrimary", "dark") : void 0,
|
|
773144
|
-
background: rawConfig.background != null ? convertColorConfiguration(rawConfig.background, context, "background", "dark") : void 0
|
|
773145
|
-
};
|
|
773146
|
-
case "light":
|
|
773147
|
-
return {
|
|
773148
|
-
type: "light",
|
|
773149
|
-
accentPrimary: rawConfig.accentPrimary != null ? convertColorConfiguration(rawConfig.accentPrimary, context, "accentPrimary", "light") : void 0,
|
|
773150
|
-
background: rawConfig.background != null ? convertColorConfiguration(rawConfig.background, context, "background", "light") : void 0
|
|
773151
|
-
};
|
|
773152
|
-
case "darkAndLight":
|
|
773153
|
-
return {
|
|
773154
|
-
type: "darkAndLight",
|
|
773155
|
-
dark: {
|
|
773156
|
-
accentPrimary: rawConfig.accentPrimary != null ? convertColorConfiguration(rawConfig.accentPrimary, context, "accentPrimary", "dark") : void 0,
|
|
773157
|
-
background: rawConfig.background != null ? convertColorConfiguration(rawConfig.background, context, "background", "dark") : void 0
|
|
773158
|
-
},
|
|
773159
|
-
light: {
|
|
773160
|
-
accentPrimary: rawConfig.accentPrimary != null ? convertColorConfiguration(rawConfig.accentPrimary, context, "accentPrimary", "light") : void 0,
|
|
773161
|
-
background: rawConfig.background != null ? convertColorConfiguration(rawConfig.background, context, "background", "light") : void 0
|
|
773162
|
-
}
|
|
773163
|
-
};
|
|
773164
|
-
default:
|
|
773165
|
-
assertNever(colorType);
|
|
773166
|
-
}
|
|
773167
|
-
}
|
|
773168
|
-
function convertColorConfiguration(raw, context, key2, theme) {
|
|
773169
|
-
const rawColor = typeof raw === "string" ? raw : raw[theme] ?? raw.dark ?? raw.light;
|
|
773170
|
-
const color3 = tinycolor(rawColor);
|
|
773171
|
-
if (!color3.isValid()) {
|
|
773172
|
-
context.failAndThrow(`'${typeof raw === "string" ? key2 : `${key2}.${theme}`}' should be a hex color of the format #FFFFFF`);
|
|
773173
|
-
}
|
|
773174
|
-
const rgb = color3.toRgb();
|
|
773175
|
-
return { r: rgb.r, g: rgb.g, b: rgb.b };
|
|
773176
|
-
}
|
|
773177
773228
|
function convertNavbarLinks(rawConfig) {
|
|
773178
773229
|
return rawConfig.map((rawNavbarLink) => {
|
|
773179
773230
|
switch (rawNavbarLink.type) {
|