@gooddata/sdk-ui-theme-provider 11.57.0-alpha.4 → 11.57.0-alpha.6

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.
@@ -6,8 +6,19 @@ export declare function handleUnits(value: string): string;
6
6
  */
7
7
  export type ParserFunction = {
8
8
  key: string;
9
- fn: (value: any, isScoped?: boolean, scopeTo?: HTMLElement, scopeId?: string) => string;
9
+ /**
10
+ * Returns the CSS value, an empty string to emit nothing, or an object to keep descending into.
11
+ */
12
+ fn: (value: any, isScoped?: boolean, scopeTo?: HTMLElement, scopeId?: string) => string | object;
10
13
  };
14
+ /**
15
+ * @internal
16
+ */
17
+ export declare function handleReportLength(value: unknown): string;
18
+ /**
19
+ * @internal
20
+ */
21
+ export declare function handleReportLineHeight(value: unknown): string;
11
22
  /**
12
23
  * @internal
13
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cssProperties.d.ts","sourceRoot":"","sources":["../src/cssProperties.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,MAAM,EAGX,KAAK,aAAa,EAErB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAsEpE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3F,CAAC;AA+EF;;GAEG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,MAAM,EACd,eAAe,GAAE,cAAc,EAAO,EACtC,UAAU,SAAS,EACnB,QAAQ,CAAC,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,WA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Q,CAAC,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,MAAM,GACjB,WAAW,EAAE,CA2Bf;AAeD,eAAO,MAAM,mBAAmB,YAAa,aAAa,eAAe,OAAO,KAAG,WAAW,EAa7F,CAAC;AAEF,eAAO,MAAM,kBAAkB,cAAe,OAAO,YAAY,WAAW,YAAY,MAAM,KAAG,IAyBhG,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,OAAO,EACpB,QAAQ,GAAE,OAAe,EACzB,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,MAAM,GACjB,IAAI,CA0DN"}
@@ -58,6 +58,55 @@ export function handleUnits(value) {
58
58
  }
59
59
  return value;
60
60
  }
61
+ // A report page scales with its width, so its lengths are read against that width: a bare number is
62
+ // cqw. The units are the ones that follow it — `cqh` and `cqb` are left out although they parse,
63
+ // because a page contains its inline axis only and a block unit silently resolves against the
64
+ // viewport instead; `px` and `rem` are left out because they hold their size while the page changes.
65
+ const REPORT_LENGTH = /^\d+(\.\d+)?(cqw|cqi|em|%)$/;
66
+ function reportLength(value, bare) {
67
+ if (typeof value === "number") {
68
+ return Number.isFinite(value) && value >= 0 ? bare(value) : "";
69
+ }
70
+ if (typeof value !== "string") {
71
+ return "";
72
+ }
73
+ const trimmed = value.trim();
74
+ if (trimmed !== "" && parseFloat(trimmed).toString() === trimmed && parseFloat(trimmed) >= 0) {
75
+ return bare(parseFloat(trimmed));
76
+ }
77
+ return REPORT_LENGTH.test(trimmed) ? trimmed : "";
78
+ }
79
+ /**
80
+ * @internal
81
+ */
82
+ export function handleReportLength(value) {
83
+ return reportLength(value, (n) => `${n}cqw`);
84
+ }
85
+ /**
86
+ * @internal
87
+ */
88
+ export function handleReportLineHeight(value) {
89
+ // CSS reads a bare line height as a multiple of the font size, which is what anyone writing
90
+ // `1.5` means; reading it as a share of the page width the way a size is read would set a
91
+ // heading's lines closer together than its letters are tall.
92
+ return reportLength(value, (n) => `${n}`);
93
+ }
94
+ const REPORT_TEXT_LEVELS = [
95
+ ...["h1", "h2", "h3", "h4", "h5", "h6"].map((level) => `heading-${level}`),
96
+ ...["p1", "p2", "p3"].map((level) => `paragraph-${level}`),
97
+ ];
98
+ const reportLengthParserFunctions = [
99
+ ...REPORT_TEXT_LEVELS.map((level) => ({
100
+ key: `--gd-reports-textStyle-${level}-fontSize`,
101
+ fn: handleReportLength,
102
+ })),
103
+ ...[
104
+ "--gd-reports-textStyle-lineHeight",
105
+ "--gd-reports-textStyle-heading-lineHeight",
106
+ "--gd-reports-textStyle-paragraph-lineHeight",
107
+ ...REPORT_TEXT_LEVELS.map((level) => `--gd-reports-textStyle-${level}-lineHeight`),
108
+ ].map((key) => ({ key, fn: handleReportLineHeight })),
109
+ ];
61
110
  const customParserFunctions = [
62
111
  {
63
112
  key: "--gd-typography-font",
@@ -123,6 +172,14 @@ const customParserFunctions = [
123
172
  fn: (value) => (value ? DEFAULT_WIDGET_SHADOW : "none"),
124
173
  },
125
174
  { key: "--gd-palette-complementary", fn: () => "" },
175
+ // Not CSS: the content version, the image assets and the font files are read by the reports
176
+ // application from the theme object itself.
177
+ { key: "--gd-version", fn: () => "" },
178
+ { key: "--gd-assets", fn: () => "" },
179
+ { key: "--gd-reports-textStyle-typography-fonts", fn: () => "" },
180
+ // Inline colors become indexed variables; a palette reference is resolved by the application.
181
+ { key: "--gd-reports-visualizationPalette", fn: (value) => (Array.isArray(value) ? value : "") },
182
+ ...reportLengthParserFunctions,
126
183
  ];
127
184
  /**
128
185
  * @internal
@@ -137,12 +194,8 @@ export function parseThemeToCssProperties(object, parserFunctions = [], currentK
137
194
  if (newValue !== null && typeof newValue === "object") {
138
195
  cssProperties.push(...parseThemeToCssProperties(newValue, parserFunctions, newKey, isScoped, scopeTo, scopeId));
139
196
  }
140
- else {
141
- const parse = parserFunctions.find((exception) => exception.key === newKey);
142
- const newValue = parse ? parse.fn(value, isScoped, scopeTo, scopeId) : value;
143
- if (newValue !== undefined) {
144
- cssProperties.push({ key: newKey, value: newValue });
145
- }
197
+ else if (newValue !== "") {
198
+ cssProperties.push({ key: newKey, value: newValue });
146
199
  }
147
200
  }
148
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-theme-provider",
3
- "version": "11.57.0-alpha.4",
3
+ "version": "11.57.0-alpha.6",
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-model": "11.57.0-alpha.4",
36
- "@gooddata/sdk-ui": "11.57.0-alpha.4",
37
- "@gooddata/util": "11.57.0-alpha.4",
38
- "@gooddata/sdk-backend-spi": "11.57.0-alpha.4"
35
+ "@gooddata/sdk-backend-spi": "11.57.0-alpha.6",
36
+ "@gooddata/sdk-model": "11.57.0-alpha.6",
37
+ "@gooddata/sdk-ui": "11.57.0-alpha.6",
38
+ "@gooddata/util": "11.57.0-alpha.6"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@microsoft/api-documenter": "7.30.10",
@@ -60,19 +60,19 @@
60
60
  "eslint-plugin-sonarjs": "3.0.6",
61
61
  "happy-dom": "20.12.0",
62
62
  "npm-run-all": "4.1.5",
63
- "oxfmt": "0.66.0",
64
- "oxlint": "1.82.0",
63
+ "oxfmt": "0.68.0",
64
+ "oxlint": "1.83.0",
65
65
  "oxlint-plugin-eslint": "1.82.0",
66
- "oxlint-tsgolint": "0.22.1",
66
+ "oxlint-tsgolint": "7.0.2001",
67
67
  "raf": "3.4.1",
68
68
  "react": "19.1.1",
69
69
  "react-dom": "19.1.1",
70
70
  "typescript": "7.0.2",
71
71
  "vitest": "4.1.8",
72
- "@gooddata/eslint-config": "11.57.0-alpha.4",
73
- "@gooddata/sdk-backend-mockingbird": "11.57.0-alpha.4",
74
- "@gooddata/oxlint-config": "11.57.0-alpha.4",
75
- "@gooddata/reference-workspace": "11.57.0-alpha.4"
72
+ "@gooddata/eslint-config": "11.57.0-alpha.6",
73
+ "@gooddata/oxlint-config": "11.57.0-alpha.6",
74
+ "@gooddata/reference-workspace": "11.57.0-alpha.6",
75
+ "@gooddata/sdk-backend-mockingbird": "11.57.0-alpha.6"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": "^18.0.0 || ^19.0.0",