@squiz/dxp-page-content-types 1.5.2 → 1.6.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.
@@ -14,6 +14,25 @@ export declare const NODE_TYPE: {
14
14
  variation: "variation";
15
15
  };
16
16
  export type NODE_TYPE = (typeof NODE_TYPE)[keyof typeof NODE_TYPE];
17
+ /**
18
+ * Layout option value types.
19
+ */
20
+ export declare const LayoutOptionValueTypes: readonly ["string-enum", "boolean", "text"];
21
+ export declare const LayoutOptionValueType: {
22
+ readonly stringEnum: "string-enum";
23
+ readonly boolean: "boolean";
24
+ readonly text: "text";
25
+ };
26
+ export type LayoutOptionValueType = (typeof LayoutOptionValueType)[keyof typeof LayoutOptionValueType];
27
+ /**
28
+ * Layout property types.
29
+ */
30
+ export declare const LayoutPropertyTypes: readonly ["boolean", "string"];
31
+ export declare const LayoutPropertyType: {
32
+ readonly boolean: "boolean";
33
+ readonly string: "string";
34
+ };
35
+ export type LayoutPropertyType = (typeof LayoutPropertyType)[keyof typeof LayoutPropertyType];
17
36
  /**
18
37
  * Semi-resolved (referenced content items, not resolved Matrix references) formatted nodes union type.
19
38
  */
@@ -118,29 +137,59 @@ export type ContentItem<T extends ContentItemBody> = {
118
137
  export interface LayoutZone {
119
138
  description: string;
120
139
  displayName: string;
121
- maxNodes: number;
122
- minNodes: number;
140
+ key: string;
123
141
  }
142
+ export type LayoutZonesArray = Array<LayoutZone>;
124
143
  export interface LayoutZones {
125
- [zoneKey: string]: LayoutZone;
144
+ [zoneKey: string]: Omit<LayoutZone, 'key'>;
126
145
  }
127
- interface LayoutOption {
146
+ export interface LayoutOptionBase {
128
147
  description: string;
129
148
  displayName: string;
149
+ valueType?: LayoutOptionValueType;
150
+ }
151
+ export interface LayoutOptionEnum extends LayoutOptionBase {
152
+ valueType?: 'string-enum';
130
153
  selectedValue?: string;
131
154
  values: Array<string>;
132
155
  }
133
- interface LayoutOptions {
156
+ export interface LayoutOptionBoolean extends LayoutOptionBase {
157
+ valueType: 'boolean';
158
+ selectedValue?: boolean;
159
+ }
160
+ export interface LayoutOptionText extends LayoutOptionBase {
161
+ valueType: 'text';
162
+ selectedValue?: string;
163
+ }
164
+ export type LayoutOption = LayoutOptionEnum | LayoutOptionBoolean | LayoutOptionText;
165
+ export interface LayoutOptions {
134
166
  [key: string]: LayoutOption;
135
167
  }
168
+ export interface LayoutPropertyBase {
169
+ title: string;
170
+ description: string;
171
+ type: LayoutPropertyType;
172
+ }
173
+ export interface LayoutPropertyBoolean extends LayoutPropertyBase {
174
+ type: 'boolean';
175
+ selectedValue?: boolean;
176
+ }
177
+ export interface LayoutPropertyString extends LayoutPropertyBase {
178
+ type: 'string';
179
+ enum?: Array<string>;
180
+ selectedValue?: string;
181
+ }
182
+ export type LayoutProperty = LayoutPropertyBoolean | LayoutPropertyString;
183
+ export type LayoutProperties = Record<string, LayoutProperty>;
184
+ export type LayoutPropertyValues = Record<string, Pick<LayoutProperty, 'selectedValue'>>;
136
185
  export interface LayoutData {
137
186
  name: string;
138
187
  description: string;
139
188
  displayName: string;
140
189
  version?: string;
141
190
  template?: string;
142
- zones?: LayoutZones;
143
- options?: LayoutOptions;
191
+ zones?: LayoutZonesArray;
192
+ properties?: LayoutProperties | LayoutPropertyValues;
144
193
  }
145
194
  export interface LayoutNode {
146
195
  type: 'layout';
@@ -148,4 +197,3 @@ export interface LayoutNode {
148
197
  content: Record<string, LayoutContentNodes[]>;
149
198
  nodeId?: string;
150
199
  }
151
- export {};
@@ -4,7 +4,7 @@
4
4
  * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.NODE_TYPE = void 0;
7
+ exports.LayoutPropertyType = exports.LayoutPropertyTypes = exports.LayoutOptionValueType = exports.LayoutOptionValueTypes = exports.NODE_TYPE = void 0;
8
8
  /**
9
9
  * Content node helper constants.
10
10
  */
@@ -14,4 +14,21 @@ exports.NODE_TYPE = {
14
14
  layout: 'layout',
15
15
  variation: 'variation',
16
16
  };
17
+ /**
18
+ * Layout option value types.
19
+ */
20
+ exports.LayoutOptionValueTypes = ['string-enum', 'boolean', 'text'];
21
+ exports.LayoutOptionValueType = {
22
+ stringEnum: 'string-enum',
23
+ boolean: 'boolean',
24
+ text: 'text',
25
+ };
26
+ /**
27
+ * Layout property types.
28
+ */
29
+ exports.LayoutPropertyTypes = ['boolean', 'string'];
30
+ exports.LayoutPropertyType = {
31
+ boolean: 'boolean',
32
+ string: 'string',
33
+ };
17
34
  //# sourceMappingURL=Nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Nodes.js","sourceRoot":"","sources":["../../src/Nodes/Nodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;GAEG;AAEU,QAAA,SAAS,GAAG;IACvB,SAAS,EAAE,WAAoB;IAC/B,QAAQ,EAAE,UAAmB;IAC7B,MAAM,EAAE,QAAiB;IACzB,SAAS,EAAE,WAAoB;CAChC,CAAC"}
1
+ {"version":3,"file":"Nodes.js","sourceRoot":"","sources":["../../src/Nodes/Nodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;GAEG;AAEU,QAAA,SAAS,GAAG;IACvB,SAAS,EAAE,WAAoB;IAC/B,QAAQ,EAAE,UAAmB;IAC7B,MAAM,EAAE,QAAiB;IACzB,SAAS,EAAE,WAAoB;CAChC,CAAC;AAGF;;GAEG;AAEU,QAAA,sBAAsB,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAErE,QAAA,qBAAqB,GAAG;IACnC,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CAC8D,CAAC;AAI7E;;GAEG;AACU,QAAA,mBAAmB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC;AACrD,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACuD,CAAC"}
@@ -88,12 +88,6 @@ export interface VersionChangeSummaryMessage {
88
88
  * @memberof VersionChangeSummaryMessage
89
89
  */
90
90
  section?: string;
91
- /**
92
- * The node id of the change.
93
- * @type {string}
94
- * @memberof VersionChangeSummaryMessage
95
- */
96
- nodeId?: string;
97
91
  };
98
92
  }
99
93
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-page-content-types",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "repository": {