@gooddata/sdk-model 11.57.0-alpha.5 → 11.57.0-alpha.7

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.
@@ -1,25 +1,42 @@
1
1
  // (C) 2026 GoodData Corporation
2
2
  import { isEmpty } from "lodash-es";
3
+ import { DefaultReportHeadingType, DefaultReportParagraphType, ReportHeadingTypes, ReportParagraphTypes, isReportHeadingType, isReportParagraphType, } from "./styling.js";
3
4
  /**
4
5
  * List of built-in report slot type names.
5
6
  *
6
7
  * @alpha
7
8
  */
8
- export const BuiltInReportSlotTypes = ["visualization", "text", "image"];
9
+ export const BuiltInReportSlotTypes = ["visualization", "heading", "paragraph", "image"];
9
10
  /**
10
- * All semantic kinds a text slot can carry.
11
+ * All sizes a text slot can be rendered at, headings first.
11
12
  *
12
13
  * @alpha
13
14
  */
14
- export const BuiltInReportTextSlotKinds = [
15
- "title",
16
- "subtitle",
17
- "sectionTitle",
18
- "description",
19
- "summary",
20
- "body",
21
- "custom",
22
- ];
15
+ export const ReportTextTypes = [...ReportHeadingTypes, ...ReportParagraphTypes];
16
+ /**
17
+ * Sizes the slot can be rendered at, which is what its own type decides.
18
+ *
19
+ * @alpha
20
+ */
21
+ export function reportTextSlotTypes(slot) {
22
+ return slot.type === "heading" ? ReportHeadingTypes : ReportParagraphTypes;
23
+ }
24
+ /**
25
+ * Size the slot is rendered at.
26
+ *
27
+ * @remarks
28
+ * A slot states its size, and content is an open format: a size the slot cannot carry, and a size
29
+ * from a newer version, both fall back to the default of the slot's own type.
30
+ *
31
+ * @alpha
32
+ */
33
+ export function reportTextSlotType(slot) {
34
+ const stated = slot.style?.type;
35
+ if (slot.type === "heading") {
36
+ return isReportHeadingType(stated) ? stated : DefaultReportHeadingType;
37
+ }
38
+ return isReportParagraphType(stated) ? stated : DefaultReportParagraphType;
39
+ }
23
40
  /**
24
41
  * Type-guard testing whether the provided object is an instance of {@link IReportVisualizationSlot}.
25
42
  *
@@ -28,13 +45,29 @@ export const BuiltInReportTextSlotKinds = [
28
45
  export function isReportVisualizationSlot(obj) {
29
46
  return !isEmpty(obj) && obj.type === "visualization";
30
47
  }
48
+ /**
49
+ * Type-guard testing whether the provided object is an instance of {@link IReportHeadingSlot}.
50
+ *
51
+ * @alpha
52
+ */
53
+ export function isReportHeadingSlot(obj) {
54
+ return !isEmpty(obj) && obj.type === "heading";
55
+ }
56
+ /**
57
+ * Type-guard testing whether the provided object is an instance of {@link IReportParagraphSlot}.
58
+ *
59
+ * @alpha
60
+ */
61
+ export function isReportParagraphSlot(obj) {
62
+ return !isEmpty(obj) && obj.type === "paragraph";
63
+ }
31
64
  /**
32
65
  * Type-guard testing whether the provided object is an instance of {@link IReportTextSlot}.
33
66
  *
34
67
  * @alpha
35
68
  */
36
69
  export function isReportTextSlot(obj) {
37
- return !isEmpty(obj) && obj.type === "text";
70
+ return isReportHeadingSlot(obj) || isReportParagraphSlot(obj);
38
71
  }
39
72
  /**
40
73
  * Type-guard testing whether the provided object is an instance of {@link IReportImageSlot}.
@@ -60,11 +60,63 @@ export interface IReportBoxStyle {
60
60
  padding?: number;
61
61
  }
62
62
  /**
63
- * Styling of a text slot: the paint of its box, plus the ink and placement of the text it owns.
63
+ * Size a heading is rendered at. Each size is styled by the matching theme text level
64
+ * (`reports.textStyle.heading.h1` ...).
65
+ *
66
+ * @alpha
67
+ */
68
+ export type ReportHeadingType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
69
+ /**
70
+ * Size a paragraph is rendered at. Each size is styled by the matching theme text level
71
+ * (`reports.textStyle.paragraph.largeText` ...).
72
+ *
73
+ * @alpha
74
+ */
75
+ export type ReportParagraphType = "largeText" | "normalText" | "smallText";
76
+ /**
77
+ * Size any report text is rendered at.
78
+ *
79
+ * @alpha
80
+ */
81
+ export type ReportTextType = ReportHeadingType | ReportParagraphType;
82
+ /**
83
+ * All heading sizes, largest first.
64
84
  *
65
- * @remarks
66
- * Overrides the ink and placement of the slot's {@link ReportTextSlotKind} defaults; the kind
67
- * keeps owning semantic typography (size and weight).
85
+ * @alpha
86
+ */
87
+ export declare const ReportHeadingTypes: ReportHeadingType[];
88
+ /**
89
+ * All paragraph sizes, largest first.
90
+ *
91
+ * @alpha
92
+ */
93
+ export declare const ReportParagraphTypes: ReportParagraphType[];
94
+ /**
95
+ * Size a heading slot that states none is rendered at.
96
+ *
97
+ * @alpha
98
+ */
99
+ export declare const DefaultReportHeadingType: ReportHeadingType;
100
+ /**
101
+ * Size a paragraph slot that states none is rendered at.
102
+ *
103
+ * @alpha
104
+ */
105
+ export declare const DefaultReportParagraphType: ReportParagraphType;
106
+ /**
107
+ * Type-guard testing whether the value is a {@link ReportHeadingType}.
108
+ *
109
+ * @alpha
110
+ */
111
+ export declare function isReportHeadingType(value: unknown): value is ReportHeadingType;
112
+ /**
113
+ * Type-guard testing whether the value is a {@link ReportParagraphType}.
114
+ *
115
+ * @alpha
116
+ */
117
+ export declare function isReportParagraphType(value: unknown): value is ReportParagraphType;
118
+ /**
119
+ * Styling of a text slot: the paint of its box, plus the ink and placement of the text it owns.
68
120
  *
69
121
  * @alpha
70
122
  */
@@ -76,6 +128,29 @@ export interface IReportTextStyle extends IReportBoxStyle {
76
128
  horizontalAlign?: ReportContentAlignment;
77
129
  verticalAlign?: ReportContentAlignment;
78
130
  }
131
+ /**
132
+ * Styling of a heading slot.
133
+ *
134
+ * @alpha
135
+ */
136
+ export interface IReportHeadingStyle extends IReportTextStyle {
137
+ /**
138
+ * Defaults to {@link DefaultReportHeadingType}. The size owns the semantic typography that goes
139
+ * with it; the rest of the style overrides ink and placement on top of it.
140
+ */
141
+ type?: ReportHeadingType;
142
+ }
143
+ /**
144
+ * Styling of a paragraph slot.
145
+ *
146
+ * @alpha
147
+ */
148
+ export interface IReportParagraphStyle extends IReportTextStyle {
149
+ /**
150
+ * Defaults to {@link DefaultReportParagraphType}.
151
+ */
152
+ type?: ReportParagraphType;
153
+ }
79
154
  /**
80
155
  * Where the drawn image sits when it does not fill its box, and which part of it is kept when it
81
156
  * is cropped to fill one.
@@ -1 +1 @@
1
- {"version":3,"file":"styling.d.ts","sourceRoot":"","sources":["../../src/reports/styling.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,sBAAsB,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF"}
1
+ {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AAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D;;OAEG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF"}
@@ -1,5 +1,45 @@
1
1
  // (C) 2026 GoodData Corporation
2
2
  import { isEmpty } from "lodash-es";
3
+ /**
4
+ * All heading sizes, largest first.
5
+ *
6
+ * @alpha
7
+ */
8
+ export const ReportHeadingTypes = ["h1", "h2", "h3", "h4", "h5", "h6"];
9
+ /**
10
+ * All paragraph sizes, largest first.
11
+ *
12
+ * @alpha
13
+ */
14
+ export const ReportParagraphTypes = ["largeText", "normalText", "smallText"];
15
+ /**
16
+ * Size a heading slot that states none is rendered at.
17
+ *
18
+ * @alpha
19
+ */
20
+ export const DefaultReportHeadingType = "h1";
21
+ /**
22
+ * Size a paragraph slot that states none is rendered at.
23
+ *
24
+ * @alpha
25
+ */
26
+ export const DefaultReportParagraphType = "normalText";
27
+ /**
28
+ * Type-guard testing whether the value is a {@link ReportHeadingType}.
29
+ *
30
+ * @alpha
31
+ */
32
+ export function isReportHeadingType(value) {
33
+ return ReportHeadingTypes.includes(value);
34
+ }
35
+ /**
36
+ * Type-guard testing whether the value is a {@link ReportParagraphType}.
37
+ *
38
+ * @alpha
39
+ */
40
+ export function isReportParagraphType(value) {
41
+ return ReportParagraphTypes.includes(value);
42
+ }
3
43
  /**
4
44
  * Type-guard testing whether the provided object is an instance of {@link IReportColorBackground}.
5
45
  *
@@ -13,7 +13,7 @@ export type ReportDateString = string;
13
13
  *
14
14
  * @alpha
15
15
  */
16
- export type ReportBuiltInVariable = "reportName" | "reportDescription" | "periodStart" | "periodEnd" | "reportDateRange" | "reportAttributeFilters" | "exportedAt" | "exportedBy" | "lastModifiedAt" | "lastModifiedBy" | "workspaceName" | "workspaceId" | "totalPages" | "currentPageNumber" | "logo" | "logoInverse";
16
+ export type ReportBuiltInVariable = "reportName" | "reportDescription" | "periodStart" | "periodEnd" | "reportDateRange" | "reportAttributeFilters" | "exportedAt" | "exportedBy" | "lastModifiedAt" | "lastModifiedBy" | "workspaceName" | "workspaceId" | "totalPages" | "currentPageNumber" | "logo";
17
17
  /**
18
18
  * All built-in report variable names.
19
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/reports/variables.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAC3B,YAAY,GACZ,mBAAmB,GACnB,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,wBAAwB,GACxB,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,eAAe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C,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAShE;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIlG"}
@@ -20,7 +20,6 @@ export const ReportBuiltInVariables = [
20
20
  "totalPages",
21
21
  "currentPageNumber",
22
22
  "logo",
23
- "logoInverse",
24
23
  ];
25
24
  const placeholderRegex = /\{([a-zA-Z][a-zA-Z0-9_]*)\}/g;
26
25
  /**