@squiz/dxp-page-content-types 1.0.1 → 1.2.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/lib/Nodes/Nodes.d.ts
CHANGED
|
@@ -6,11 +6,21 @@ import { FORMATTED_TEXT_MODELS } from '@squiz/dx-json-schema-lib';
|
|
|
6
6
|
import { Conditions } from '../PageContent/PageContent';
|
|
7
7
|
/**
|
|
8
8
|
* Semi-resolved (referenced content items, not resolved Matrix references) formatted nodes union type.
|
|
9
|
-
* TODO: new layout node
|
|
10
9
|
*/
|
|
11
10
|
export type LayoutContentNodes = (Exclude<FORMATTED_TEXT_MODELS.v1.FormattedNodes, {
|
|
12
|
-
type: 'component';
|
|
13
|
-
}> | ComponentNode | VariationNode) & {
|
|
11
|
+
type: 'component' | 'fragment' | 'layout';
|
|
12
|
+
}> | FormattedTextFragmentNode | ComponentNode | VariationNode | LayoutNode) & {
|
|
13
|
+
nodeId?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Formatted text fragment node with i18n support.
|
|
17
|
+
*/
|
|
18
|
+
export type FormattedTextFragmentNode = Extract<FORMATTED_TEXT_MODELS.v1.FormattedNodes, {
|
|
19
|
+
type: 'fragment';
|
|
20
|
+
}> & {
|
|
21
|
+
i18n?: Record<string, {
|
|
22
|
+
children?: FORMATTED_TEXT_MODELS.v1.FormattedTextFragment['children'];
|
|
23
|
+
}>;
|
|
14
24
|
nodeId?: string;
|
|
15
25
|
};
|
|
16
26
|
/**
|
|
@@ -37,6 +47,10 @@ export type ComponentNode<T extends ContentItemBody = ContentItemBody> = {
|
|
|
37
47
|
* Content item referenced by the component node. Will be undefined if component does not have a content item.
|
|
38
48
|
*/
|
|
39
49
|
contentItem?: ContentItem<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Translated content item for each language
|
|
52
|
+
*/
|
|
53
|
+
i18n?: Record<string, ContentItem<T>>;
|
|
40
54
|
};
|
|
41
55
|
/**
|
|
42
56
|
* Variation node variant.
|
|
@@ -89,3 +103,35 @@ export type ContentItem<T extends ContentItemBody> = {
|
|
|
89
103
|
*/
|
|
90
104
|
content?: T;
|
|
91
105
|
};
|
|
106
|
+
export interface LayoutZone {
|
|
107
|
+
description: string;
|
|
108
|
+
displayName: string;
|
|
109
|
+
maxNodes: number;
|
|
110
|
+
minNodes: number;
|
|
111
|
+
}
|
|
112
|
+
export interface LayoutZones {
|
|
113
|
+
[zoneKey: string]: LayoutZone;
|
|
114
|
+
}
|
|
115
|
+
interface LayoutOption {
|
|
116
|
+
description: string;
|
|
117
|
+
displayName: string;
|
|
118
|
+
values: Array<string>;
|
|
119
|
+
}
|
|
120
|
+
interface LayoutOptions {
|
|
121
|
+
[key: string]: LayoutOption;
|
|
122
|
+
}
|
|
123
|
+
export interface LayoutData {
|
|
124
|
+
name: string;
|
|
125
|
+
description: string;
|
|
126
|
+
displayName: string;
|
|
127
|
+
version?: string;
|
|
128
|
+
template?: string;
|
|
129
|
+
zones?: LayoutZones;
|
|
130
|
+
options?: LayoutOptions;
|
|
131
|
+
}
|
|
132
|
+
export interface LayoutNode {
|
|
133
|
+
type: 'layout';
|
|
134
|
+
layout: LayoutData;
|
|
135
|
+
content: Record<string, LayoutContentNodes[]>;
|
|
136
|
+
}
|
|
137
|
+
export {};
|
package/lib/Zones/Zones.d.ts
CHANGED
package/lib/Zones/Zones.js
CHANGED
package/lib/Zones/Zones.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Zones.js","sourceRoot":"","sources":["../../src/Zones/Zones.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,iBAAiB;IACpC,mBAAmB,EAAE,mBAAmB;CAChC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Zones.js","sourceRoot":"","sources":["../../src/Zones/Zones.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,iBAAiB;IACpC,mBAAmB,EAAE,mBAAmB;CAChC,CAAC"}
|