@gooddata/sdk-model 11.62.0-alpha.0 → 11.62.0-alpha.2
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/esm/genAI/chat.d.ts +9 -9
- package/esm/genAI/chat.d.ts.map +1 -1
- package/esm/index.d.ts +12 -12
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +10 -10
- package/esm/publisher/builtinPageLayouts.d.ts +45 -0
- package/esm/publisher/builtinPageLayouts.d.ts.map +1 -0
- package/esm/{reports → publisher}/builtinPageLayouts.js +19 -19
- package/esm/{reports → publisher}/content.d.ts +20 -20
- package/esm/publisher/content.d.ts.map +1 -0
- package/esm/{reports → publisher}/content.js +2 -2
- package/esm/{reports/report.d.ts → publisher/document.d.ts} +28 -28
- package/esm/publisher/document.d.ts.map +1 -0
- package/esm/{reports/report.js → publisher/document.js} +10 -10
- package/esm/publisher/factory.d.ts +65 -0
- package/esm/publisher/factory.d.ts.map +1 -0
- package/esm/{reports → publisher}/factory.js +22 -22
- package/esm/{reports → publisher}/layout.d.ts +15 -15
- package/esm/publisher/layout.d.ts.map +1 -0
- package/esm/{reports → publisher}/layout.js +4 -4
- package/esm/publisher/pageFormat.d.ts +38 -0
- package/esm/publisher/pageFormat.d.ts.map +1 -0
- package/esm/publisher/pageFormat.js +33 -0
- package/esm/{reports → publisher}/pageLayout.d.ts +28 -28
- package/esm/publisher/pageLayout.d.ts.map +1 -0
- package/esm/{reports → publisher}/pageLayout.js +18 -18
- package/esm/{reports → publisher}/slot.d.ts +48 -48
- package/esm/publisher/slot.d.ts.map +1 -0
- package/esm/publisher/slot.js +87 -0
- package/esm/{reports → publisher}/styling.d.ts +39 -39
- package/esm/publisher/styling.d.ts.map +1 -0
- package/esm/publisher/styling.js +58 -0
- package/esm/publisher/variables.d.ts +72 -0
- package/esm/publisher/variables.d.ts.map +1 -0
- package/esm/{reports → publisher}/variables.js +7 -7
- package/esm/sdk-model.d.ts +889 -858
- package/esm/settings/settings.d.ts +13 -0
- package/esm/settings/settings.d.ts.map +1 -1
- package/esm/theme/index.d.ts +68 -51
- package/esm/theme/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/esm/reports/builtinPageLayouts.d.ts +0 -45
- package/esm/reports/builtinPageLayouts.d.ts.map +0 -1
- package/esm/reports/content.d.ts.map +0 -1
- package/esm/reports/factory.d.ts +0 -65
- package/esm/reports/factory.d.ts.map +0 -1
- package/esm/reports/layout.d.ts.map +0 -1
- package/esm/reports/pageFormat.d.ts +0 -38
- package/esm/reports/pageFormat.d.ts.map +0 -1
- package/esm/reports/pageFormat.js +0 -33
- package/esm/reports/pageLayout.d.ts.map +0 -1
- package/esm/reports/report.d.ts.map +0 -1
- package/esm/reports/slot.d.ts.map +0 -1
- package/esm/reports/slot.js +0 -87
- package/esm/reports/styling.d.ts.map +0 -1
- package/esm/reports/styling.js +0 -58
- package/esm/reports/variables.d.ts +0 -72
- package/esm/reports/variables.d.ts.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type IAuditableDates, type IAuditableUsers } from "../base/metadata.js";
|
|
2
2
|
import { type FilterContextItem } from "../dashboard/filterContext.js";
|
|
3
3
|
import { type ObjRef } from "../objRef/index.js";
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
4
|
+
import { type PublisherPageLayoutNode } from "./layout.js";
|
|
5
|
+
import { type PublisherPageFormat } from "./pageFormat.js";
|
|
6
|
+
import { type PublisherSlot } from "./slot.js";
|
|
7
|
+
import { type IPublisherBoxStyle } from "./styling.js";
|
|
8
8
|
/**
|
|
9
|
-
* Body of a
|
|
9
|
+
* Body of a document page: geometry (flex split tree) plus the slots it places.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
|
-
* This is both the content of the standalone {@link
|
|
13
|
-
* embedded in template/
|
|
12
|
+
* This is both the content of the standalone {@link IPublisherPageLayout} object and the shape
|
|
13
|
+
* embedded in template/document content ({@link IPublisherDocumentPage}).
|
|
14
14
|
*
|
|
15
15
|
* There is no header/footer chrome: page title, description, footer, page numbers and
|
|
16
16
|
* logos are ordinary slots in the layout tree (text slots with `{currentPageNumber}`/`{totalPages}`,
|
|
@@ -18,7 +18,7 @@ import { type IReportBoxStyle } from "./styling.js";
|
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface IPublisherPageBody {
|
|
22
22
|
/**
|
|
23
23
|
* Editor hint only (template galleries, default styling, AI context).
|
|
24
24
|
* Renderers must not branch layout logic on it — geometry always comes from `layout`.
|
|
@@ -26,21 +26,21 @@ export interface IReportPageBody {
|
|
|
26
26
|
kind?: "cover" | "section" | "content";
|
|
27
27
|
/**
|
|
28
28
|
* Page proportions the layout was authored for. Defaults to
|
|
29
|
-
* {@link
|
|
29
|
+
* {@link DefaultPublisherPageFormat}.
|
|
30
30
|
*/
|
|
31
|
-
format?:
|
|
31
|
+
format?: PublisherPageFormat;
|
|
32
32
|
/**
|
|
33
33
|
* Paint of the page itself, behind everything the layout places.
|
|
34
34
|
*/
|
|
35
|
-
style?:
|
|
35
|
+
style?: IPublisherBoxStyle;
|
|
36
36
|
/**
|
|
37
37
|
* Root of the page layout tree.
|
|
38
38
|
*/
|
|
39
|
-
layout:
|
|
39
|
+
layout: PublisherPageLayoutNode;
|
|
40
40
|
/**
|
|
41
41
|
* All slots referenced by the layout, flat, keyed by localIdentifier.
|
|
42
42
|
*/
|
|
43
|
-
slots:
|
|
43
|
+
slots: PublisherSlot[];
|
|
44
44
|
/**
|
|
45
45
|
* Page-level filters: merged over content-level filters (a filter targeting the
|
|
46
46
|
* same object replaces the inherited one); slot filters apply on top.
|
|
@@ -52,18 +52,18 @@ export interface IReportPageBody {
|
|
|
52
52
|
*
|
|
53
53
|
* @alpha
|
|
54
54
|
*/
|
|
55
|
-
export interface
|
|
55
|
+
export interface IPublisherPageLayoutContent extends IPublisherPageBody {
|
|
56
56
|
/**
|
|
57
57
|
* Content model version, for stored-content evolution.
|
|
58
58
|
*/
|
|
59
59
|
version: "1";
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Payload for creating or updating a
|
|
62
|
+
* Payload for creating or updating a page layout.
|
|
63
63
|
*
|
|
64
64
|
* @alpha
|
|
65
65
|
*/
|
|
66
|
-
export interface
|
|
66
|
+
export interface IPublisherPageLayoutDefinition {
|
|
67
67
|
type: "reportPageLayout";
|
|
68
68
|
/**
|
|
69
69
|
* Present when updating an existing page.
|
|
@@ -72,14 +72,14 @@ export interface IReportPageLayoutDefinition {
|
|
|
72
72
|
title: string;
|
|
73
73
|
description?: string;
|
|
74
74
|
tags?: string[];
|
|
75
|
-
content:
|
|
75
|
+
content: IPublisherPageLayoutContent;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Reusable
|
|
78
|
+
* Reusable page layout metadata object.
|
|
79
79
|
*
|
|
80
80
|
* @alpha
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
82
|
+
export interface IPublisherPageLayout extends IPublisherPageLayoutDefinition, IAuditableDates, IAuditableUsers {
|
|
83
83
|
ref: ObjRef;
|
|
84
84
|
/**
|
|
85
85
|
* When true, the object comes from a parent workspace and is not editable
|
|
@@ -93,29 +93,29 @@ export interface IReportPageLayout extends IReportPageLayoutDefinition, IAuditab
|
|
|
93
93
|
isBuiltIn?: boolean;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
96
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutDefinition}.
|
|
97
97
|
*
|
|
98
98
|
* @alpha
|
|
99
99
|
*/
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function isPublisherPageLayoutDefinition(obj: unknown): obj is IPublisherPageLayoutDefinition;
|
|
101
101
|
/**
|
|
102
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
102
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayout}.
|
|
103
103
|
*
|
|
104
104
|
* @alpha
|
|
105
105
|
*/
|
|
106
|
-
export declare function
|
|
106
|
+
export declare function isPublisherPageLayout(obj: unknown): obj is IPublisherPageLayout;
|
|
107
107
|
/**
|
|
108
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
108
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutContent}.
|
|
109
109
|
*
|
|
110
110
|
* @alpha
|
|
111
111
|
*/
|
|
112
|
-
export declare function
|
|
112
|
+
export declare function isPublisherPageLayoutContentV1(obj: unknown): obj is IPublisherPageLayoutContent;
|
|
113
113
|
/**
|
|
114
|
-
* Validation issue found in a
|
|
114
|
+
* Validation issue found in a page body.
|
|
115
115
|
*
|
|
116
116
|
* @alpha
|
|
117
117
|
*/
|
|
118
|
-
export interface
|
|
118
|
+
export interface IPublisherPageBodyValidationIssue {
|
|
119
119
|
severity: "error" | "warning";
|
|
120
120
|
message: string;
|
|
121
121
|
}
|
|
@@ -129,5 +129,5 @@ export interface IReportPageBodyValidationIssue {
|
|
|
129
129
|
*
|
|
130
130
|
* @alpha
|
|
131
131
|
*/
|
|
132
|
-
export declare function
|
|
132
|
+
export declare function validatePublisherPageBody(body: IPublisherPageBody): IPublisherPageBodyValidationIssue[];
|
|
133
133
|
//# sourceMappingURL=pageLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageLayout.d.ts","sourceRoot":"","sources":["../../src/publisher/pageLayout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EACH,KAAK,uBAAuB,EAG/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,mB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AIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,2BAA2B,CAO/F;AAED;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAC9C,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iCAAiC,EAAE,CA+FvG"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
3
|
import { isObjRef } from "../objRef/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { isPublisherLayoutSection, isPublisherLayoutSlotRef, } from "./layout.js";
|
|
5
|
+
import { isPublisherPageFormat } from "./pageFormat.js";
|
|
6
|
+
import { isPublisherImageSlot, isPublisherTextSlot } from "./slot.js";
|
|
7
|
+
import { isPublisherImageBackground } from "./styling.js";
|
|
8
8
|
/**
|
|
9
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
9
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutDefinition}.
|
|
10
10
|
*
|
|
11
11
|
* @alpha
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function isPublisherPageLayoutDefinition(obj) {
|
|
14
14
|
return !isEmpty(obj) && obj.type === "reportPageLayout";
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
17
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayout}.
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
22
|
-
return
|
|
21
|
+
export function isPublisherPageLayout(obj) {
|
|
22
|
+
return isPublisherPageLayoutDefinition(obj) && isObjRef(obj.ref);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
25
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutContent}.
|
|
26
26
|
*
|
|
27
27
|
* @alpha
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
29
|
+
export function isPublisherPageLayoutContentV1(obj) {
|
|
30
30
|
return (!isEmpty(obj) &&
|
|
31
31
|
obj.version === "1" &&
|
|
32
32
|
!isEmpty(obj.layout) &&
|
|
@@ -42,9 +42,9 @@ export function isReportPageLayoutContentV1(obj) {
|
|
|
42
42
|
*
|
|
43
43
|
* @alpha
|
|
44
44
|
*/
|
|
45
|
-
export function
|
|
45
|
+
export function validatePublisherPageBody(body) {
|
|
46
46
|
const issues = [];
|
|
47
|
-
if (body.format !== undefined && !
|
|
47
|
+
if (body.format !== undefined && !isPublisherPageFormat(body.format)) {
|
|
48
48
|
issues.push({ severity: "error", message: `Unknown page format "${body.format}".` });
|
|
49
49
|
}
|
|
50
50
|
const checkLength = (name, value) => {
|
|
@@ -70,7 +70,7 @@ export function validateReportPageBody(body) {
|
|
|
70
70
|
const checkBoxStyle = (style, isDrawn) => {
|
|
71
71
|
checkLength("Border radius", style?.borderRadius);
|
|
72
72
|
checkLength("Padding", style?.padding);
|
|
73
|
-
if (!style?.background || !
|
|
73
|
+
if (!style?.background || !isPublisherImageBackground(style.background)) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const { slotId } = style.background;
|
|
@@ -82,7 +82,7 @@ export function validateReportPageBody(body) {
|
|
|
82
82
|
});
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (!
|
|
85
|
+
if (!isPublisherImageSlot(slot)) {
|
|
86
86
|
issues.push({
|
|
87
87
|
severity: "error",
|
|
88
88
|
message: `Background references slot "${slotId}" which is not an image slot.`,
|
|
@@ -102,7 +102,7 @@ export function validateReportPageBody(body) {
|
|
|
102
102
|
message: `Layout node weight must be positive, got ${node.weight}.`,
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
if (
|
|
105
|
+
if (isPublisherLayoutSlotRef(node)) {
|
|
106
106
|
referencedIds.add(node.slotId);
|
|
107
107
|
if (!slotIds.has(node.slotId)) {
|
|
108
108
|
issues.push({
|
|
@@ -111,14 +111,14 @@ export function validateReportPageBody(body) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
else if (
|
|
114
|
+
else if (isPublisherLayoutSection(node)) {
|
|
115
115
|
checkBoxStyle(node.style, true);
|
|
116
116
|
node.children.forEach(visit);
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
visit(body.layout);
|
|
120
120
|
// After the layout, so a slot the layout never places cannot vouch for the image it names.
|
|
121
|
-
for (const slot of body.slots.filter(
|
|
121
|
+
for (const slot of body.slots.filter(isPublisherTextSlot)) {
|
|
122
122
|
checkBoxStyle(slot.style, referencedIds.has(slot.localIdentifier));
|
|
123
123
|
}
|
|
124
124
|
for (const slotId of slotIds) {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type FilterContextItem, type IDashboardFilterReference } from "../dashboard/filterContext.js";
|
|
2
2
|
import { type VisualizationProperties } from "../insight/index.js";
|
|
3
3
|
import { type ObjRef } from "../objRef/index.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type IPublisherHeadingStyle, type IPublisherImageStyle, type IPublisherParagraphStyle, type PublisherTextType } from "./styling.js";
|
|
5
5
|
/**
|
|
6
|
-
* Metadata of a slot that is intentionally left unfilled in a
|
|
6
|
+
* Metadata of a slot that is intentionally left unfilled in a page layout or template.
|
|
7
7
|
*
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface IPublisherSlotPlaceholder {
|
|
11
11
|
/**
|
|
12
12
|
* Authoring hint shown in the empty slot.
|
|
13
13
|
*/
|
|
14
14
|
hint?: string;
|
|
15
15
|
/**
|
|
16
|
-
* When true, a
|
|
16
|
+
* When true, a document is not considered complete until this slot is filled.
|
|
17
17
|
*/
|
|
18
18
|
required?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Structural base of every
|
|
21
|
+
* Structural base of every document slot.
|
|
22
22
|
*
|
|
23
23
|
* @remarks
|
|
24
24
|
* Parsers written against this base can skip slot types introduced by a newer
|
|
@@ -26,25 +26,25 @@ export interface IReportSlotPlaceholder {
|
|
|
26
26
|
*
|
|
27
27
|
* @alpha
|
|
28
28
|
*/
|
|
29
|
-
export interface
|
|
29
|
+
export interface IPublisherSlotBase {
|
|
30
30
|
type: string;
|
|
31
31
|
/**
|
|
32
32
|
* Identifier unique within the page body. The layout tree references it, and it is
|
|
33
|
-
* the join key when a
|
|
33
|
+
* the join key when a document fills a template's slots. Regenerated when a page is
|
|
34
34
|
* cloned into template content so repeated use of one page stays unique.
|
|
35
35
|
*/
|
|
36
36
|
localIdentifier: string;
|
|
37
37
|
/**
|
|
38
38
|
* Present when the slot is an unfilled placeholder.
|
|
39
39
|
*/
|
|
40
|
-
placeholder?:
|
|
40
|
+
placeholder?: IPublisherSlotPlaceholder;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Slot rendering an insight, with its own filter context.
|
|
44
44
|
*
|
|
45
45
|
* @alpha
|
|
46
46
|
*/
|
|
47
|
-
export interface
|
|
47
|
+
export interface IPublisherVisualizationSlot extends IPublisherSlotBase {
|
|
48
48
|
type: "visualization";
|
|
49
49
|
/**
|
|
50
50
|
* Insight to render. Undefined = declared-but-empty slot; renderers show a placeholder.
|
|
@@ -69,13 +69,13 @@ export interface IReportVisualizationSlot extends IReportSlotBase {
|
|
|
69
69
|
*/
|
|
70
70
|
ignoredFilters?: IDashboardFilterReference[];
|
|
71
71
|
/**
|
|
72
|
-
* Date dataset the
|
|
72
|
+
* Date dataset the document's period (periodStart/periodEnd) is applied to as an
|
|
73
73
|
* absolute date filter at execution time. Undefined = backend date-dataset
|
|
74
74
|
* auto-resolution applies.
|
|
75
75
|
*/
|
|
76
76
|
dateDataSet?: ObjRef;
|
|
77
77
|
/**
|
|
78
|
-
* When true, the implicit date filter derived from the
|
|
78
|
+
* When true, the implicit date filter derived from the document's period is not
|
|
79
79
|
* applied to this slot.
|
|
80
80
|
*/
|
|
81
81
|
ignoreReportPeriod?: boolean;
|
|
@@ -85,7 +85,7 @@ export interface IReportVisualizationSlot extends IReportSlotBase {
|
|
|
85
85
|
*
|
|
86
86
|
* @alpha
|
|
87
87
|
*/
|
|
88
|
-
export interface
|
|
88
|
+
export interface IPublisherStaticTextSource {
|
|
89
89
|
type: "static";
|
|
90
90
|
/**
|
|
91
91
|
* Markdown content with `{variable}` placeholders. Stored raw — placeholders are
|
|
@@ -94,18 +94,18 @@ export interface IReportStaticTextSource {
|
|
|
94
94
|
content: string;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Text generated by AI at
|
|
97
|
+
* Text generated by AI at document-build time.
|
|
98
98
|
*
|
|
99
99
|
* @alpha
|
|
100
100
|
*/
|
|
101
|
-
export interface
|
|
101
|
+
export interface IPublisherAiTextSource {
|
|
102
102
|
type: "ai";
|
|
103
103
|
/**
|
|
104
104
|
* Instruction for the generator. Supports `{variables}`.
|
|
105
105
|
*/
|
|
106
106
|
prompt: string;
|
|
107
107
|
/**
|
|
108
|
-
* Materialized generation result (markdown), stored so the
|
|
108
|
+
* Materialized generation result (markdown), stored so the document renders
|
|
109
109
|
* deterministically without re-invoking AI. Absent until first generation.
|
|
110
110
|
*/
|
|
111
111
|
content?: string;
|
|
@@ -119,7 +119,7 @@ export interface IReportAiTextSource {
|
|
|
119
119
|
*
|
|
120
120
|
* @alpha
|
|
121
121
|
*/
|
|
122
|
-
export type
|
|
122
|
+
export type PublisherTextSource = IPublisherStaticTextSource | IPublisherAiTextSource;
|
|
123
123
|
/**
|
|
124
124
|
* Slot rendering a heading.
|
|
125
125
|
*
|
|
@@ -129,39 +129,39 @@ export type ReportTextSource = IReportStaticTextSource | IReportAiTextSource;
|
|
|
129
129
|
*
|
|
130
130
|
* @alpha
|
|
131
131
|
*/
|
|
132
|
-
export interface
|
|
132
|
+
export interface IPublisherHeadingSlot extends IPublisherSlotBase {
|
|
133
133
|
type: "heading";
|
|
134
|
-
style?:
|
|
134
|
+
style?: IPublisherHeadingStyle;
|
|
135
135
|
/**
|
|
136
136
|
* Undefined = declared-but-empty slot.
|
|
137
137
|
*/
|
|
138
|
-
source?:
|
|
138
|
+
source?: PublisherTextSource;
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Slot rendering prose, written as markdown.
|
|
142
142
|
*
|
|
143
143
|
* @alpha
|
|
144
144
|
*/
|
|
145
|
-
export interface
|
|
145
|
+
export interface IPublisherParagraphSlot extends IPublisherSlotBase {
|
|
146
146
|
type: "paragraph";
|
|
147
|
-
style?:
|
|
147
|
+
style?: IPublisherParagraphStyle;
|
|
148
148
|
/**
|
|
149
149
|
* Undefined = declared-but-empty slot.
|
|
150
150
|
*/
|
|
151
|
-
source?:
|
|
151
|
+
source?: PublisherTextSource;
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Slot rendering text of either kind.
|
|
155
155
|
*
|
|
156
156
|
* @alpha
|
|
157
157
|
*/
|
|
158
|
-
export type
|
|
158
|
+
export type IPublisherTextSlot = IPublisherHeadingSlot | IPublisherParagraphSlot;
|
|
159
159
|
/**
|
|
160
160
|
* What an image slot displays.
|
|
161
161
|
*
|
|
162
162
|
* @alpha
|
|
163
163
|
*/
|
|
164
|
-
export type
|
|
164
|
+
export type PublisherImageSource = {
|
|
165
165
|
type: "url";
|
|
166
166
|
/**
|
|
167
167
|
* Image URL. Supports `{variables}` — a logo slot uses `{logo}`.
|
|
@@ -180,52 +180,52 @@ export type ReportImageSource = {
|
|
|
180
180
|
*
|
|
181
181
|
* @alpha
|
|
182
182
|
*/
|
|
183
|
-
export type
|
|
183
|
+
export type PublisherImageFit = "contain" | "cover" | "fill";
|
|
184
184
|
/**
|
|
185
185
|
* Slot rendering an image.
|
|
186
186
|
*
|
|
187
187
|
* @alpha
|
|
188
188
|
*/
|
|
189
|
-
export interface
|
|
189
|
+
export interface IPublisherImageSlot extends IPublisherSlotBase {
|
|
190
190
|
type: "image";
|
|
191
191
|
/**
|
|
192
192
|
* Undefined = declared-but-empty slot.
|
|
193
193
|
*/
|
|
194
|
-
source?:
|
|
194
|
+
source?: PublisherImageSource;
|
|
195
195
|
altText?: string;
|
|
196
196
|
/**
|
|
197
197
|
* How the image fills the slot area. Defaults to "contain".
|
|
198
198
|
*/
|
|
199
|
-
fit?:
|
|
199
|
+
fit?: PublisherImageFit;
|
|
200
200
|
/**
|
|
201
201
|
* Placement overrides for the drawn image; centered on both axes by default.
|
|
202
202
|
*/
|
|
203
|
-
style?:
|
|
203
|
+
style?: IPublisherImageStyle;
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
|
-
* All slot types of
|
|
206
|
+
* All slot types of document content version 1.
|
|
207
207
|
*
|
|
208
208
|
* @alpha
|
|
209
209
|
*/
|
|
210
|
-
export type
|
|
210
|
+
export type PublisherSlot = IPublisherVisualizationSlot | IPublisherTextSlot | IPublisherImageSlot;
|
|
211
211
|
/**
|
|
212
|
-
* List of built-in
|
|
212
|
+
* List of built-in document slot type names.
|
|
213
213
|
*
|
|
214
214
|
* @alpha
|
|
215
215
|
*/
|
|
216
|
-
export declare const
|
|
216
|
+
export declare const BuiltInPublisherSlotTypes: string[];
|
|
217
217
|
/**
|
|
218
218
|
* All sizes a text slot can be rendered at, headings first.
|
|
219
219
|
*
|
|
220
220
|
* @alpha
|
|
221
221
|
*/
|
|
222
|
-
export declare const
|
|
222
|
+
export declare const PublisherTextTypes: PublisherTextType[];
|
|
223
223
|
/**
|
|
224
224
|
* Sizes the slot can be rendered at, which is what its own type decides.
|
|
225
225
|
*
|
|
226
226
|
* @alpha
|
|
227
227
|
*/
|
|
228
|
-
export declare function
|
|
228
|
+
export declare function publisherTextSlotTypes(slot: IPublisherTextSlot): PublisherTextType[];
|
|
229
229
|
/**
|
|
230
230
|
* Size the slot is rendered at.
|
|
231
231
|
*
|
|
@@ -235,41 +235,41 @@ export declare function reportTextSlotTypes(slot: IReportTextSlot): ReportTextTy
|
|
|
235
235
|
*
|
|
236
236
|
* @alpha
|
|
237
237
|
*/
|
|
238
|
-
export declare function
|
|
238
|
+
export declare function publisherTextSlotType(slot: IPublisherTextSlot): PublisherTextType;
|
|
239
239
|
/**
|
|
240
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
240
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherVisualizationSlot}.
|
|
241
241
|
*
|
|
242
242
|
* @alpha
|
|
243
243
|
*/
|
|
244
|
-
export declare function
|
|
244
|
+
export declare function isPublisherVisualizationSlot(obj: unknown): obj is IPublisherVisualizationSlot;
|
|
245
245
|
/**
|
|
246
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
246
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherHeadingSlot}.
|
|
247
247
|
*
|
|
248
248
|
* @alpha
|
|
249
249
|
*/
|
|
250
|
-
export declare function
|
|
250
|
+
export declare function isPublisherHeadingSlot(obj: unknown): obj is IPublisherHeadingSlot;
|
|
251
251
|
/**
|
|
252
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
252
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherParagraphSlot}.
|
|
253
253
|
*
|
|
254
254
|
* @alpha
|
|
255
255
|
*/
|
|
256
|
-
export declare function
|
|
256
|
+
export declare function isPublisherParagraphSlot(obj: unknown): obj is IPublisherParagraphSlot;
|
|
257
257
|
/**
|
|
258
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
258
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherTextSlot}.
|
|
259
259
|
*
|
|
260
260
|
* @alpha
|
|
261
261
|
*/
|
|
262
|
-
export declare function
|
|
262
|
+
export declare function isPublisherTextSlot(obj: unknown): obj is IPublisherTextSlot;
|
|
263
263
|
/**
|
|
264
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
264
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherImageSlot}.
|
|
265
265
|
*
|
|
266
266
|
* @alpha
|
|
267
267
|
*/
|
|
268
|
-
export declare function
|
|
268
|
+
export declare function isPublisherImageSlot(obj: unknown): obj is IPublisherImageSlot;
|
|
269
269
|
/**
|
|
270
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
270
|
+
* Type-guard testing whether the provided object is an instance of {@link PublisherSlot}.
|
|
271
271
|
*
|
|
272
272
|
* @alpha
|
|
273
273
|
*/
|
|
274
|
-
export declare function
|
|
274
|
+
export declare function isPublisherSlot(obj: unknown): obj is PublisherSlot;
|
|
275
275
|
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/publisher/slot.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAGH,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAG7B,KAAK,iBAAiB,EAGzB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAA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ACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,2BAA2B,CAE7F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB,CAErF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,kBAAkB,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,mBAAmB,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,aAAa,CAIlE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
import { DefaultPublisherHeadingType, DefaultPublisherParagraphType, PublisherHeadingTypes, PublisherParagraphTypes, isPublisherHeadingType, isPublisherParagraphType, } from "./styling.js";
|
|
4
|
+
/**
|
|
5
|
+
* List of built-in document slot type names.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export const BuiltInPublisherSlotTypes = ["visualization", "heading", "paragraph", "image"];
|
|
10
|
+
/**
|
|
11
|
+
* All sizes a text slot can be rendered at, headings first.
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export const PublisherTextTypes = [...PublisherHeadingTypes, ...PublisherParagraphTypes];
|
|
16
|
+
/**
|
|
17
|
+
* Sizes the slot can be rendered at, which is what its own type decides.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export function publisherTextSlotTypes(slot) {
|
|
22
|
+
return slot.type === "heading" ? PublisherHeadingTypes : PublisherParagraphTypes;
|
|
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 publisherTextSlotType(slot) {
|
|
34
|
+
const stated = slot.style?.type;
|
|
35
|
+
if (slot.type === "heading") {
|
|
36
|
+
return isPublisherHeadingType(stated) ? stated : DefaultPublisherHeadingType;
|
|
37
|
+
}
|
|
38
|
+
return isPublisherParagraphType(stated) ? stated : DefaultPublisherParagraphType;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherVisualizationSlot}.
|
|
42
|
+
*
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export function isPublisherVisualizationSlot(obj) {
|
|
46
|
+
return !isEmpty(obj) && obj.type === "visualization";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherHeadingSlot}.
|
|
50
|
+
*
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export function isPublisherHeadingSlot(obj) {
|
|
54
|
+
return !isEmpty(obj) && obj.type === "heading";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherParagraphSlot}.
|
|
58
|
+
*
|
|
59
|
+
* @alpha
|
|
60
|
+
*/
|
|
61
|
+
export function isPublisherParagraphSlot(obj) {
|
|
62
|
+
return !isEmpty(obj) && obj.type === "paragraph";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherTextSlot}.
|
|
66
|
+
*
|
|
67
|
+
* @alpha
|
|
68
|
+
*/
|
|
69
|
+
export function isPublisherTextSlot(obj) {
|
|
70
|
+
return isPublisherHeadingSlot(obj) || isPublisherParagraphSlot(obj);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherImageSlot}.
|
|
74
|
+
*
|
|
75
|
+
* @alpha
|
|
76
|
+
*/
|
|
77
|
+
export function isPublisherImageSlot(obj) {
|
|
78
|
+
return !isEmpty(obj) && obj.type === "image";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Type-guard testing whether the provided object is an instance of {@link PublisherSlot}.
|
|
82
|
+
*
|
|
83
|
+
* @alpha
|
|
84
|
+
*/
|
|
85
|
+
export function isPublisherSlot(obj) {
|
|
86
|
+
return [isPublisherVisualizationSlot, isPublisherTextSlot, isPublisherImageSlot].some((guard) => guard(obj));
|
|
87
|
+
}
|