@gooddata/sdk-ui-theme-provider 11.52.0-alpha.4 → 11.52.0-alpha.5

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.
@@ -22,6 +22,22 @@ export interface IInvalidThemeColor {
22
22
  path: string;
23
23
  value: string;
24
24
  }
25
+ /**
26
+ * Returns the dot-separated paths of complementary palette shades a theme must define but omits.
27
+ *
28
+ * @remarks
29
+ * `c0` and `c9` are the endpoints of the complementary ramp and, unlike `c1`-`c8`, are never
30
+ * interpolated by `getComplementaryPalette` — keep this list in step with the shades it passes
31
+ * through untouched. Omitting one leaves its `--gd-palette-complementary-*` variable unset, so
32
+ * every element reading it falls back to a default chosen for the opposite background.
33
+ *
34
+ * Reported separately from {@link findInvalidThemeColors} because the theme still applies: the
35
+ * result is a degraded rendering rather than a theme that cannot be used at all. A shade that is
36
+ * present but unparseable counts as invalid rather than missing, matching that function.
37
+ *
38
+ * @internal
39
+ */
40
+ export declare const findMissingRequiredThemeColors: (theme: ITheme | undefined) => string[];
25
41
  /**
26
42
  * Walks the theme palette and returns the colors that cannot be parsed, each with its location.
27
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"colorValidation.d.ts","sourceRoot":"","sources":["../src/colorValidation.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,MAAM,EAId,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,6BAW7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AA6BD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,qDAelC,CAAC"}
1
+ {"version":3,"file":"colorValidation.d.ts","sourceRoot":"","sources":["../src/colorValidation.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,MAAM,EAId,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,6BAW7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAkCD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,yCAW1C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,qDAelC,CAAC"}
@@ -41,6 +41,35 @@ const collectInvalidComplementaryColors = (complementary) => {
41
41
  .filter((key) => complementary[key] !== undefined && !isValidThemeColor(complementary[key]))
42
42
  .map((key) => ({ path: `complementary.${key}`, value: complementary[key] }));
43
43
  };
44
+ const requiredComplementaryKeys = [
45
+ "c0",
46
+ "c9",
47
+ ];
48
+ /**
49
+ * Returns the dot-separated paths of complementary palette shades a theme must define but omits.
50
+ *
51
+ * @remarks
52
+ * `c0` and `c9` are the endpoints of the complementary ramp and, unlike `c1`-`c8`, are never
53
+ * interpolated by `getComplementaryPalette` — keep this list in step with the shades it passes
54
+ * through untouched. Omitting one leaves its `--gd-palette-complementary-*` variable unset, so
55
+ * every element reading it falls back to a default chosen for the opposite background.
56
+ *
57
+ * Reported separately from {@link findInvalidThemeColors} because the theme still applies: the
58
+ * result is a degraded rendering rather than a theme that cannot be used at all. A shade that is
59
+ * present but unparseable counts as invalid rather than missing, matching that function.
60
+ *
61
+ * @internal
62
+ */
63
+ export const findMissingRequiredThemeColors = (theme) => {
64
+ // Parsed from an API response, so the required shades may well be absent despite the type.
65
+ const complementary = theme?.palette?.complementary;
66
+ if (!complementary) {
67
+ return [];
68
+ }
69
+ return requiredComplementaryKeys
70
+ .filter((key) => complementary[key] === undefined)
71
+ .map((key) => `complementary.${key}`);
72
+ };
44
73
  /**
45
74
  * Walks the theme palette and returns the colors that cannot be parsed, each with its location.
46
75
  *
package/esm/index.d.ts CHANGED
@@ -14,5 +14,5 @@ export { ScopedThemeProvider, type IScopedThemeProviderProps } from "./ThemeProv
14
14
  export { ConditionalScopedThemeProvider } from "./ThemeProvider/ConditionalScopedThemeProvider.js";
15
15
  export { isDarkTheme } from "./ThemeProvider/isDarkTheme.js";
16
16
  export { withTheme, useTheme, useReferenceTheme, useThemeIsLoading, useIsScopeThemed, useThemeStatus, useIsDarkTheme, ThemeContextProvider, type IThemeContextProviderProps, type ThemeStatus, } from "./ThemeProvider/Context.js";
17
- export { isValidThemeColor, findInvalidThemeColors, type IInvalidThemeColor } from "./colorValidation.js";
17
+ export { isValidThemeColor, findInvalidThemeColors, findMissingRequiredThemeColors, type IInvalidThemeColor, } from "./colorValidation.js";
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EACH,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACH,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,KAAK,WAAW,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EACH,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACH,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,KAAK,WAAW,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,kBAAkB,GAC1B,MAAM,sBAAsB,CAAC"}
package/esm/index.js CHANGED
@@ -16,4 +16,4 @@ export { ScopedThemeProvider } from "./ThemeProvider/ScopedThemeProvider.js";
16
16
  export { ConditionalScopedThemeProvider } from "./ThemeProvider/ConditionalScopedThemeProvider.js";
17
17
  export { isDarkTheme } from "./ThemeProvider/isDarkTheme.js";
18
18
  export { withTheme, useTheme, useReferenceTheme, useThemeIsLoading, useIsScopeThemed, useThemeStatus, useIsDarkTheme, ThemeContextProvider, } from "./ThemeProvider/Context.js";
19
- export { isValidThemeColor, findInvalidThemeColors } from "./colorValidation.js";
19
+ export { isValidThemeColor, findInvalidThemeColors, findMissingRequiredThemeColors, } from "./colorValidation.js";
@@ -48,6 +48,23 @@ export declare const defaultHeaderTheme: IThemeHeader;
48
48
  */
49
49
  export declare const findInvalidThemeColors: (theme: ITheme | undefined) => IInvalidThemeColor[];
50
50
 
51
+ /**
52
+ * Returns the dot-separated paths of complementary palette shades a theme must define but omits.
53
+ *
54
+ * @remarks
55
+ * `c0` and `c9` are the endpoints of the complementary ramp and, unlike `c1`-`c8`, are never
56
+ * interpolated by `getComplementaryPalette` — keep this list in step with the shades it passes
57
+ * through untouched. Omitting one leaves its `--gd-palette-complementary-*` variable unset, so
58
+ * every element reading it falls back to a default chosen for the opposite background.
59
+ *
60
+ * Reported separately from {@link findInvalidThemeColors} because the theme still applies: the
61
+ * result is a degraded rendering rather than a theme that cannot be used at all. A shade that is
62
+ * present but unparseable counts as invalid rather than missing, matching that function.
63
+ *
64
+ * @internal
65
+ */
66
+ export declare const findMissingRequiredThemeColors: (theme: ITheme | undefined) => string[];
67
+
51
68
  /**
52
69
  * A palette color that cannot be parsed, together with its dot-separated location in the palette
53
70
  * (e.g. `complementary.c9` or `primary.base`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-theme-provider",
3
- "version": "11.52.0-alpha.4",
3
+ "version": "11.52.0-alpha.5",
4
4
  "description": "GoodData SDK - Theme provider",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -32,10 +32,10 @@
32
32
  "postcss-value-parser": "^4.2.0",
33
33
  "ts-invariant": "0.10.3",
34
34
  "tslib": "2.8.1",
35
- "@gooddata/sdk-backend-spi": "11.52.0-alpha.4",
36
- "@gooddata/sdk-model": "11.52.0-alpha.4",
37
- "@gooddata/util": "11.52.0-alpha.4",
38
- "@gooddata/sdk-ui": "11.52.0-alpha.4"
35
+ "@gooddata/sdk-backend-spi": "11.52.0-alpha.5",
36
+ "@gooddata/sdk-model": "11.52.0-alpha.5",
37
+ "@gooddata/sdk-ui": "11.52.0-alpha.5",
38
+ "@gooddata/util": "11.52.0-alpha.5"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@microsoft/api-documenter": "^7.17.0",
@@ -73,10 +73,10 @@
73
73
  "react-dom": "19.1.1",
74
74
  "typescript": "5.9.3",
75
75
  "vitest": "4.1.8",
76
- "@gooddata/eslint-config": "11.52.0-alpha.4",
77
- "@gooddata/reference-workspace": "11.52.0-alpha.4",
78
- "@gooddata/oxlint-config": "11.52.0-alpha.4",
79
- "@gooddata/sdk-backend-mockingbird": "11.52.0-alpha.4"
76
+ "@gooddata/eslint-config": "11.52.0-alpha.5",
77
+ "@gooddata/oxlint-config": "11.52.0-alpha.5",
78
+ "@gooddata/reference-workspace": "11.52.0-alpha.5",
79
+ "@gooddata/sdk-backend-mockingbird": "11.52.0-alpha.5"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": "^18.0.0 || ^19.0.0",