@squiz/dxp-page-content-types 1.5.3 → 1.6.1

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.
@@ -24,6 +24,15 @@ export declare const LayoutOptionValueType: {
24
24
  readonly text: "text";
25
25
  };
26
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];
27
36
  /**
28
37
  * Semi-resolved (referenced content items, not resolved Matrix references) formatted nodes union type.
29
38
  */
@@ -128,11 +137,11 @@ export type ContentItem<T extends ContentItemBody> = {
128
137
  export interface LayoutZone {
129
138
  description: string;
130
139
  displayName: string;
131
- maxNodes: number;
132
- minNodes: number;
140
+ key: string;
133
141
  }
142
+ export type LayoutZonesArray = Array<LayoutZone>;
134
143
  export interface LayoutZones {
135
- [zoneKey: string]: LayoutZone;
144
+ [zoneKey: string]: Omit<LayoutZone, 'key'>;
136
145
  }
137
146
  export interface LayoutOptionBase {
138
147
  description: string;
@@ -156,14 +165,35 @@ export type LayoutOption = LayoutOptionEnum | LayoutOptionBoolean | LayoutOption
156
165
  export interface LayoutOptions {
157
166
  [key: string]: LayoutOption;
158
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
+ oneOf?: Array<{
181
+ const: string;
182
+ title: string;
183
+ }>;
184
+ selectedValue?: string;
185
+ }
186
+ export type LayoutProperty = LayoutPropertyBoolean | LayoutPropertyString;
187
+ export type LayoutProperties = Record<string, LayoutProperty>;
188
+ export type LayoutPropertyValues = Record<string, Pick<LayoutProperty, 'selectedValue'>>;
159
189
  export interface LayoutData {
160
190
  name: string;
161
191
  description: string;
162
192
  displayName: string;
163
193
  version?: string;
164
194
  template?: string;
165
- zones?: LayoutZones;
166
- options?: LayoutOptions;
195
+ zones?: LayoutZonesArray;
196
+ properties?: LayoutProperties | LayoutPropertyValues;
167
197
  }
168
198
  export interface LayoutNode {
169
199
  type: 'layout';
@@ -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.LayoutOptionValueType = exports.LayoutOptionValueTypes = 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
  */
@@ -23,4 +23,12 @@ exports.LayoutOptionValueType = {
23
23
  boolean: 'boolean',
24
24
  text: 'text',
25
25
  };
26
+ /**
27
+ * Layout property types.
28
+ */
29
+ exports.LayoutPropertyTypes = ['boolean', 'string'];
30
+ exports.LayoutPropertyType = {
31
+ boolean: 'boolean',
32
+ string: 'string',
33
+ };
26
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;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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-page-content-types",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "repository": {