@gooddata/sdk-model 11.62.0-alpha.3 → 11.62.0
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 +3 -2
- package/esm/genAI/chat.d.ts.map +1 -1
- package/esm/index.d.ts +21 -10
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +20 -10
- package/esm/publisher/aliases.d.ts +580 -0
- package/esm/publisher/aliases.d.ts.map +1 -0
- package/esm/publisher/aliases.js +304 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts +45 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts.map +1 -0
- package/esm/publisher/{builtinPageLayouts.js → v1/builtinPageLayouts.js} +14 -14
- package/esm/publisher/{content.d.ts → v1/content.d.ts} +14 -14
- package/esm/publisher/v1/content.d.ts.map +1 -0
- package/esm/publisher/{content.js → v1/content.js} +1 -1
- package/esm/publisher/{document.d.ts → v1/document.d.ts} +21 -21
- package/esm/publisher/v1/document.d.ts.map +1 -0
- package/esm/publisher/v1/document.js +35 -0
- package/esm/publisher/v1/factory.d.ts +65 -0
- package/esm/publisher/v1/factory.d.ts.map +1 -0
- package/esm/publisher/{factory.js → v1/factory.js} +12 -12
- package/esm/publisher/{layout.d.ts → v1/layout.d.ts} +13 -13
- package/esm/publisher/v1/layout.d.ts.map +1 -0
- package/esm/publisher/{layout.js → v1/layout.js} +4 -4
- package/esm/publisher/{pageFormat.d.ts → v1/pageFormat.d.ts} +6 -6
- package/esm/publisher/v1/pageFormat.d.ts.map +1 -0
- package/esm/publisher/{pageFormat.js → v1/pageFormat.js} +6 -6
- package/esm/publisher/{pageLayout.d.ts → v1/pageLayout.d.ts} +27 -27
- package/esm/publisher/v1/pageLayout.d.ts.map +1 -0
- package/esm/publisher/{pageLayout.js → v1/pageLayout.js} +18 -18
- package/esm/publisher/{slot.d.ts → v1/slot.d.ts} +41 -41
- package/esm/publisher/v1/slot.d.ts.map +1 -0
- package/esm/publisher/v1/slot.js +90 -0
- package/esm/publisher/{styling.d.ts → v1/styling.d.ts} +36 -36
- package/esm/publisher/v1/styling.d.ts.map +1 -0
- package/esm/publisher/{styling.js → v1/styling.js} +14 -14
- package/esm/publisher/{variables.d.ts → v1/variables.d.ts} +10 -10
- package/esm/publisher/v1/variables.d.ts.map +1 -0
- package/esm/publisher/{variables.js → v1/variables.js} +4 -4
- package/esm/publisher/v2/checks.d.ts +58 -0
- package/esm/publisher/v2/checks.d.ts.map +1 -0
- package/esm/publisher/v2/checks.js +100 -0
- package/esm/publisher/v2/content.d.ts +154 -0
- package/esm/publisher/v2/content.d.ts.map +1 -0
- package/esm/publisher/v2/content.js +34 -0
- package/esm/publisher/v2/document.d.ts +116 -0
- package/esm/publisher/v2/document.d.ts.map +1 -0
- package/esm/publisher/v2/document.js +47 -0
- package/esm/publisher/v2/factory.d.ts +69 -0
- package/esm/publisher/v2/factory.d.ts.map +1 -0
- package/esm/publisher/v2/factory.js +80 -0
- package/esm/publisher/v2/layout.d.ts +48 -0
- package/esm/publisher/v2/layout.d.ts.map +1 -0
- package/esm/publisher/v2/layout.js +20 -0
- package/esm/publisher/v2/page.d.ts +67 -0
- package/esm/publisher/v2/page.d.ts.map +1 -0
- package/esm/publisher/v2/page.js +34 -0
- package/esm/publisher/v2/sections.d.ts +34 -0
- package/esm/publisher/v2/sections.d.ts.map +1 -0
- package/esm/publisher/v2/sections.js +40 -0
- package/esm/publisher/v2/structure.d.ts +5 -0
- package/esm/publisher/v2/structure.d.ts.map +1 -0
- package/esm/publisher/v2/structure.js +533 -0
- package/esm/publisher/v2/style.d.ts +323 -0
- package/esm/publisher/v2/style.d.ts.map +1 -0
- package/esm/publisher/v2/style.js +22 -0
- package/esm/publisher/v2/validation.d.ts +26 -0
- package/esm/publisher/v2/validation.d.ts.map +1 -0
- package/esm/publisher/v2/validation.js +157 -0
- package/esm/publisher/v2/widget.d.ts +295 -0
- package/esm/publisher/v2/widget.d.ts.map +1 -0
- package/esm/publisher/v2/widget.js +79 -0
- package/esm/sdk-model.d.ts +2364 -462
- package/esm/settings/settings.d.ts +11 -1
- package/esm/settings/settings.d.ts.map +1 -1
- package/package.json +3 -3
- package/esm/publisher/builtinPageLayouts.d.ts +0 -45
- package/esm/publisher/builtinPageLayouts.d.ts.map +0 -1
- package/esm/publisher/content.d.ts.map +0 -1
- package/esm/publisher/document.d.ts.map +0 -1
- package/esm/publisher/document.js +0 -35
- package/esm/publisher/factory.d.ts +0 -65
- package/esm/publisher/factory.d.ts.map +0 -1
- package/esm/publisher/layout.d.ts.map +0 -1
- package/esm/publisher/pageFormat.d.ts.map +0 -1
- package/esm/publisher/pageLayout.d.ts.map +0 -1
- package/esm/publisher/slot.d.ts.map +0 -1
- package/esm/publisher/slot.js +0 -87
- package/esm/publisher/styling.d.ts.map +0 -1
- package/esm/publisher/variables.d.ts.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ObjRef } from "../../objRef/index.js";
|
|
2
|
+
import { type IPublisherDocumentPageV2, type IPublisherPageBodyV2 } from "./page.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generates an id such as `widget_7f3a91c4`.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* For a valid id, the prefix uses only `[A-Za-z0-9_.-]`, has at most 55 characters and does not
|
|
8
|
+
* start with `default.`.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export declare function newPublisherIdV2(prefix: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a page id such as `page_7f3a91c4`.
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export declare function newPublisherPageIdV2(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a section id such as `section_7f3a91c4`.
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare function newPublisherSectionIdV2(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generates a widget id such as `widget_7f3a91c4`.
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function newPublisherWidgetIdV2(): string;
|
|
31
|
+
/**
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export interface INewPublisherDocumentFilterIdOptionsV2 {
|
|
35
|
+
/**
|
|
36
|
+
* The label of an attribute filter or the dataset of a date filter, as an identifier ref.
|
|
37
|
+
*/
|
|
38
|
+
target: ObjRef;
|
|
39
|
+
/**
|
|
40
|
+
* Local identifiers of the document's `content.filters`.
|
|
41
|
+
*/
|
|
42
|
+
usedIds: ReadonlySet<string>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Generates a document filter id such as `document_filter_region_name`.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Every character of the target's identifier outside `[A-Za-z0-9_]` becomes `_`, and the id is cut to
|
|
49
|
+
* 64 characters. When the document already uses the id, `_2`, `_3` and so on is appended, with the
|
|
50
|
+
* base shortened so the id stays within 64 characters.
|
|
51
|
+
*
|
|
52
|
+
* Throws when the target is not an identifier ref.
|
|
53
|
+
*
|
|
54
|
+
* @alpha
|
|
55
|
+
*/
|
|
56
|
+
export declare function newPublisherDocumentFilterIdV2({ target, usedIds, }: INewPublisherDocumentFilterIdOptionsV2): string;
|
|
57
|
+
/**
|
|
58
|
+
* Copies a page template's content into a new document page.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* The page is a deep copy with its own page id. Widget ids stay as written, so pages made from
|
|
62
|
+
* one template share widget ids; a widget is addressed by page id plus widget id.
|
|
63
|
+
*
|
|
64
|
+
* A document page can be passed as the template: its `id` is replaced and its `visible` is dropped.
|
|
65
|
+
*
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export declare function newPublisherDocumentPageFromTemplateV2(body: IPublisherPageBodyV2 & Partial<Pick<IPublisherDocumentPageV2, "id" | "visible">>, id?: string): IPublisherDocumentPageV2;
|
|
69
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAErF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACnD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,EAC3C,MAAM,EACN,OAAO,GACV,EAAE,sCAAsC,GAAG,MAAM,CAUjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sCAAsC,CAClD,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,EACtF,EAAE,GAAE,MAA+B,GACpC,wBAAwB,CAG1B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { invariant } from "ts-invariant";
|
|
3
|
+
import { isIdentifierRef } from "../../objRef/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generates an id such as `widget_7f3a91c4`.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* For a valid id, the prefix uses only `[A-Za-z0-9_.-]`, has at most 55 characters and does not
|
|
9
|
+
* start with `default.`.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export function newPublisherIdV2(prefix) {
|
|
14
|
+
const bytes = crypto.getRandomValues(new Uint8Array(4));
|
|
15
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
16
|
+
return `${prefix}_${hex}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates a page id such as `page_7f3a91c4`.
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export function newPublisherPageIdV2() {
|
|
24
|
+
return newPublisherIdV2("page");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generates a section id such as `section_7f3a91c4`.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export function newPublisherSectionIdV2() {
|
|
32
|
+
return newPublisherIdV2("section");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generates a widget id such as `widget_7f3a91c4`.
|
|
36
|
+
*
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export function newPublisherWidgetIdV2() {
|
|
40
|
+
return newPublisherIdV2("widget");
|
|
41
|
+
}
|
|
42
|
+
const maxIdLength = 64;
|
|
43
|
+
/**
|
|
44
|
+
* Generates a document filter id such as `document_filter_region_name`.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Every character of the target's identifier outside `[A-Za-z0-9_]` becomes `_`, and the id is cut to
|
|
48
|
+
* 64 characters. When the document already uses the id, `_2`, `_3` and so on is appended, with the
|
|
49
|
+
* base shortened so the id stays within 64 characters.
|
|
50
|
+
*
|
|
51
|
+
* Throws when the target is not an identifier ref.
|
|
52
|
+
*
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
export function newPublisherDocumentFilterIdV2({ target, usedIds, }) {
|
|
56
|
+
invariant(isIdentifierRef(target), "A document filter id needs an identifier ref as its target.");
|
|
57
|
+
const base = `document_filter_${target.identifier.replace(/[^A-Za-z0-9_]/g, "_")}`;
|
|
58
|
+
for (let attempt = 1;; attempt++) {
|
|
59
|
+
const suffix = attempt === 1 ? "" : `_${attempt}`;
|
|
60
|
+
const id = base.slice(0, maxIdLength - suffix.length) + suffix;
|
|
61
|
+
if (!usedIds.has(id)) {
|
|
62
|
+
return id;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Copies a page template's content into a new document page.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* The page is a deep copy with its own page id. Widget ids stay as written, so pages made from
|
|
71
|
+
* one template share widget ids; a widget is addressed by page id plus widget id.
|
|
72
|
+
*
|
|
73
|
+
* A document page can be passed as the template: its `id` is replaced and its `visible` is dropped.
|
|
74
|
+
*
|
|
75
|
+
* @alpha
|
|
76
|
+
*/
|
|
77
|
+
export function newPublisherDocumentPageFromTemplateV2(body, id = newPublisherPageIdV2()) {
|
|
78
|
+
const { id: _id, visible: _visible, ...content } = structuredClone(body);
|
|
79
|
+
return { ...content, id };
|
|
80
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type IPublisherContainerStyleV2 } from "./style.js";
|
|
2
|
+
import { type PublisherWidgetV2 } from "./widget.js";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export type PublisherLayoutNodeV2 = IPublisherContainerV2 | PublisherWidgetV2;
|
|
7
|
+
/**
|
|
8
|
+
* Row or column of layout nodes.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface IPublisherContainerV2 {
|
|
13
|
+
type: "row" | "column";
|
|
14
|
+
/**
|
|
15
|
+
* Matches `[A-Za-z0-9_.-]{1,64}`.
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* In reading order. An empty list renders as a spacer.
|
|
20
|
+
*/
|
|
21
|
+
children: PublisherLayoutNodeV2[];
|
|
22
|
+
/**
|
|
23
|
+
* Share of the parent's main axis, greater than 0. Defaults to 1.
|
|
24
|
+
*/
|
|
25
|
+
proportion?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Enforced by the editor, never checked on write.
|
|
28
|
+
*/
|
|
29
|
+
locked?: boolean;
|
|
30
|
+
style?: IPublisherContainerStyleV2;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function isPublisherContainerV2(obj: unknown): obj is IPublisherContainerV2;
|
|
36
|
+
/**
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export declare function isPublisherRowV2(obj: unknown): obj is IPublisherContainerV2 & {
|
|
40
|
+
type: "row";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export declare function isPublisherColumnV2(obj: unknown): obj is IPublisherContainerV2 & {
|
|
46
|
+
type: "column";
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAE9E;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,0BAA0B,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB,CAEjF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAE7F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAEnG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export function isPublisherContainerV2(obj) {
|
|
7
|
+
return isPublisherRowV2(obj) || isPublisherColumnV2(obj);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export function isPublisherRowV2(obj) {
|
|
13
|
+
return !isEmpty(obj) && obj.type === "row";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function isPublisherColumnV2(obj) {
|
|
19
|
+
return !isEmpty(obj) && obj.type === "column";
|
|
20
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type FilterContextItem } from "../../dashboard/filterContext.js";
|
|
2
|
+
import { type PublisherLayoutNodeV2 } from "./layout.js";
|
|
3
|
+
import { type IPublisherPageStyleV2 } from "./style.js";
|
|
4
|
+
/**
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export declare const PublisherPageSizesV2: readonly ["widescreen"];
|
|
8
|
+
/**
|
|
9
|
+
* Page size. The widescreen design canvas is 1920 × 1080 px.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export type PublisherPageSizeV2 = (typeof PublisherPageSizesV2)[number];
|
|
14
|
+
/**
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare const DefaultPublisherPageSizeV2: PublisherPageSizeV2;
|
|
18
|
+
/**
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function isPublisherPageSizeV2(value: unknown): value is PublisherPageSizeV2;
|
|
22
|
+
/**
|
|
23
|
+
* Editor hint; it does not change how the page renders.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export type PublisherPageKindV2 = "cover" | "section" | "content";
|
|
28
|
+
/**
|
|
29
|
+
* Content of one page, as a page template stores it.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export interface IPublisherPageBodyV2 {
|
|
34
|
+
kind?: PublisherPageKindV2;
|
|
35
|
+
pageSize?: PublisherPageSizeV2;
|
|
36
|
+
/**
|
|
37
|
+
* Markdown speaker notes, never drawn on the page.
|
|
38
|
+
*/
|
|
39
|
+
notes?: string;
|
|
40
|
+
style?: IPublisherPageStyleV2;
|
|
41
|
+
layout: PublisherLayoutNodeV2;
|
|
42
|
+
filters?: FilterContextItem[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Page inside a document.
|
|
46
|
+
*
|
|
47
|
+
* @alpha
|
|
48
|
+
*/
|
|
49
|
+
export interface IPublisherDocumentPageV2 extends IPublisherPageBodyV2 {
|
|
50
|
+
/**
|
|
51
|
+
* Unique in the document. Matches `[A-Za-z0-9_.-]{1,64}`.
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
/**
|
|
55
|
+
* Defaults to `true`. A hidden page is left out of the viewer, exports and page numbers.
|
|
56
|
+
*/
|
|
57
|
+
visible?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @alpha
|
|
61
|
+
*/
|
|
62
|
+
export declare function isPublisherPageBodyV2(obj: unknown): obj is IPublisherPageBodyV2;
|
|
63
|
+
/**
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
export declare function isPublisherDocumentPageV2(obj: unknown): obj is IPublisherDocumentPageV2;
|
|
67
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/page.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,KAAK,qBAAqB,EAA0B,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD;;GAEG;AACH,eAAO,MAAM,oBAAoB,YAAI,YAAY,CAAU,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,mBAAkC,CAAC;AAE5E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IAClE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB,CAM/E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAEvF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
import { isPublisherContainerV2 } from "./layout.js";
|
|
4
|
+
import { isPublisherWidgetV2 } from "./widget.js";
|
|
5
|
+
/**
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export const PublisherPageSizesV2 = ["widescreen"];
|
|
9
|
+
/**
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export const DefaultPublisherPageSizeV2 = "widescreen";
|
|
13
|
+
/**
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export function isPublisherPageSizeV2(value) {
|
|
17
|
+
return PublisherPageSizesV2.some((size) => size === value);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @alpha
|
|
21
|
+
*/
|
|
22
|
+
export function isPublisherPageBodyV2(obj) {
|
|
23
|
+
if (isEmpty(obj)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const { layout } = obj;
|
|
27
|
+
return isPublisherContainerV2(layout) || isPublisherWidgetV2(layout);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @alpha
|
|
31
|
+
*/
|
|
32
|
+
export function isPublisherDocumentPageV2(obj) {
|
|
33
|
+
return isPublisherPageBodyV2(obj) && typeof obj.id === "string";
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type IPublisherSectionV2, type PublisherDocumentContentV2 } from "./content.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the sections of document content. Content stored as `pages` becomes one untitled section
|
|
4
|
+
* with a generated id.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* For content stored as `pages`, each call returns a new section id. Read once and keep the result
|
|
8
|
+
* for as long as the section must stay the same one.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export declare function publisherDocumentContentSectionsV2(content: PublisherDocumentContentV2): IPublisherSectionV2[];
|
|
13
|
+
/**
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export interface IPublisherDocumentContentSetSectionsOptionsV2 {
|
|
17
|
+
/**
|
|
18
|
+
* Content the sections were read from. Its other keys are kept.
|
|
19
|
+
*/
|
|
20
|
+
content: PublisherDocumentContentV2;
|
|
21
|
+
sections: IPublisherSectionV2[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Writes sections back into document content, in the shape the content was read in.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The result holds `sections` when the content held `sections`, when there is more than one section,
|
|
28
|
+
* or when the only section has a title or description. Otherwise it holds `pages`, and the section's
|
|
29
|
+
* id is dropped.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare function publisherDocumentContentSetSectionsV2({ content, sections, }: IPublisherDocumentContentSetSectionsOptionsV2): PublisherDocumentContentV2;
|
|
34
|
+
//# sourceMappingURL=sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/sections.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAElC,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAC9C,OAAO,EAAE,0BAA0B,GACpC,mBAAmB,EAAE,CAKvB;AAED;;GAEG;AACH,MAAM,WAAW,6CAA6C;IAC1D;;OAEG;IACH,OAAO,EAAE,0BAA0B,CAAC;IACpC,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qCAAqC,CAAC,EAClD,OAAO,EACP,QAAQ,GACX,EAAE,6CAA6C,GAAG,0BAA0B,CAM5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isPublisherDocumentSectionsContentV2, } from "./content.js";
|
|
3
|
+
import { newPublisherSectionIdV2 } from "./factory.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the sections of document content. Content stored as `pages` becomes one untitled section
|
|
6
|
+
* with a generated id.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* For content stored as `pages`, each call returns a new section id. Read once and keep the result
|
|
10
|
+
* for as long as the section must stay the same one.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export function publisherDocumentContentSectionsV2(content) {
|
|
15
|
+
if (isPublisherDocumentSectionsContentV2(content)) {
|
|
16
|
+
return content.sections;
|
|
17
|
+
}
|
|
18
|
+
return [{ id: newPublisherSectionIdV2(), pages: content.pages }];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Writes sections back into document content, in the shape the content was read in.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* The result holds `sections` when the content held `sections`, when there is more than one section,
|
|
25
|
+
* or when the only section has a title or description. Otherwise it holds `pages`, and the section's
|
|
26
|
+
* id is dropped.
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export function publisherDocumentContentSetSectionsV2({ content, sections, }) {
|
|
31
|
+
const { pages: _pages, sections: _sections, ...rest } = content;
|
|
32
|
+
if (isPublisherDocumentSectionsContentV2(content) || needsSections(sections)) {
|
|
33
|
+
return { ...rest, sections };
|
|
34
|
+
}
|
|
35
|
+
return { ...rest, pages: sections.flatMap((section) => section.pages) };
|
|
36
|
+
}
|
|
37
|
+
function needsSections(sections) {
|
|
38
|
+
return (sections.length > 1 ||
|
|
39
|
+
sections.some(({ title, description }) => title !== undefined || description !== undefined));
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Check, type Issues } from "./checks.js";
|
|
2
|
+
export declare const checkPageBody: Check;
|
|
3
|
+
export declare const checkDocumentContent: Check;
|
|
4
|
+
export declare function checkEntity(value: unknown, path: string, issues: Issues): void;
|
|
5
|
+
//# sourceMappingURL=structure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/structure.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,KAAK,KAAK,EACV,KAAK,MAAM,EAuBd,MAAM,aAAa,CAAC;AAgjBrB,eAAO,MAAM,aAAa,OAAiD,CAAC;AAqE5E,eAAO,MAAM,oBAAoB,OAW/B,CAAC;AAyCH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAU9E"}
|