@squiz/dx-page-contents-lib 1.50.1-alpha.2 → 1.50.1-alpha.3

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.
@@ -0,0 +1,697 @@
1
+ import { z } from 'zod';
2
+ import { LayoutContentNodes } from '../layout-content';
3
+ import { PageLayout } from '../layouts';
4
+ import { ContentNodeTypes } from './PageContentsMocks';
5
+ declare const PageContentsResolved: z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ layouts: z.ZodArray<z.ZodDiscriminatedUnion<"name", [z.ZodObject<{
9
+ name: z.ZodLiteral<"single-column">;
10
+ content: z.ZodObject<{
11
+ main: z.ZodArray<z.ZodType<LayoutContentNodes, z.ZodTypeDef, {
12
+ value: string;
13
+ type: "text";
14
+ } | {
15
+ type: "tag";
16
+ tag: string;
17
+ attributes?: Record<string, string> | undefined;
18
+ font?: {
19
+ bold?: boolean | undefined;
20
+ italics?: boolean | undefined;
21
+ underline?: boolean | undefined;
22
+ color?: string | undefined;
23
+ size?: string | undefined;
24
+ fontFamily?: string | undefined;
25
+ } | undefined;
26
+ formattingOptions?: {
27
+ alignment: "left" | "center" | "right" | "justify";
28
+ } | undefined;
29
+ } | {
30
+ type: "link-to-matrix-asset";
31
+ matrixDomain: string;
32
+ matrixAssetId: string;
33
+ target: "_blank" | "_self" | "_parent" | "_top";
34
+ matrixIdentifier?: string | undefined;
35
+ formattingOptions?: {
36
+ alignment: "left" | "center" | "right" | "justify";
37
+ } | undefined;
38
+ } | {
39
+ type: "matrix-image";
40
+ matrixDomain: string;
41
+ matrixAssetId: string;
42
+ matrixIdentifier?: string | undefined;
43
+ formattingOptions?: {
44
+ alignment: "left" | "center" | "right" | "justify";
45
+ } | undefined;
46
+ } | {
47
+ type: "component";
48
+ componentId: string;
49
+ componentSet: string;
50
+ contentItem?: {
51
+ id: string;
52
+ } | {
53
+ content: Record<string, unknown>;
54
+ schemaName: string;
55
+ } | undefined;
56
+ } | {
57
+ type: "variation";
58
+ default: {};
59
+ }>, "many">;
60
+ }, "strip", z.ZodTypeAny, {
61
+ main: LayoutContentNodes[];
62
+ }, {
63
+ main: ({
64
+ value: string;
65
+ type: "text";
66
+ } | {
67
+ type: "tag";
68
+ tag: string;
69
+ attributes?: Record<string, string> | undefined;
70
+ font?: {
71
+ bold?: boolean | undefined;
72
+ italics?: boolean | undefined;
73
+ underline?: boolean | undefined;
74
+ color?: string | undefined;
75
+ size?: string | undefined;
76
+ fontFamily?: string | undefined;
77
+ } | undefined;
78
+ formattingOptions?: {
79
+ alignment: "left" | "center" | "right" | "justify";
80
+ } | undefined;
81
+ } | {
82
+ type: "link-to-matrix-asset";
83
+ matrixDomain: string;
84
+ matrixAssetId: string;
85
+ target: "_blank" | "_self" | "_parent" | "_top";
86
+ matrixIdentifier?: string | undefined;
87
+ formattingOptions?: {
88
+ alignment: "left" | "center" | "right" | "justify";
89
+ } | undefined;
90
+ } | {
91
+ type: "matrix-image";
92
+ matrixDomain: string;
93
+ matrixAssetId: string;
94
+ matrixIdentifier?: string | undefined;
95
+ formattingOptions?: {
96
+ alignment: "left" | "center" | "right" | "justify";
97
+ } | undefined;
98
+ } | {
99
+ type: "component";
100
+ componentId: string;
101
+ componentSet: string;
102
+ contentItem?: {
103
+ id: string;
104
+ } | {
105
+ content: Record<string, unknown>;
106
+ schemaName: string;
107
+ } | undefined;
108
+ } | {
109
+ type: "variation";
110
+ default: {};
111
+ })[];
112
+ }>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ content: {
115
+ main: LayoutContentNodes[];
116
+ };
117
+ name: "single-column";
118
+ }, {
119
+ content: {
120
+ main: ({
121
+ value: string;
122
+ type: "text";
123
+ } | {
124
+ type: "tag";
125
+ tag: string;
126
+ attributes?: Record<string, string> | undefined;
127
+ font?: {
128
+ bold?: boolean | undefined;
129
+ italics?: boolean | undefined;
130
+ underline?: boolean | undefined;
131
+ color?: string | undefined;
132
+ size?: string | undefined;
133
+ fontFamily?: string | undefined;
134
+ } | undefined;
135
+ formattingOptions?: {
136
+ alignment: "left" | "center" | "right" | "justify";
137
+ } | undefined;
138
+ } | {
139
+ type: "link-to-matrix-asset";
140
+ matrixDomain: string;
141
+ matrixAssetId: string;
142
+ target: "_blank" | "_self" | "_parent" | "_top";
143
+ matrixIdentifier?: string | undefined;
144
+ formattingOptions?: {
145
+ alignment: "left" | "center" | "right" | "justify";
146
+ } | undefined;
147
+ } | {
148
+ type: "matrix-image";
149
+ matrixDomain: string;
150
+ matrixAssetId: string;
151
+ matrixIdentifier?: string | undefined;
152
+ formattingOptions?: {
153
+ alignment: "left" | "center" | "right" | "justify";
154
+ } | undefined;
155
+ } | {
156
+ type: "component";
157
+ componentId: string;
158
+ componentSet: string;
159
+ contentItem?: {
160
+ id: string;
161
+ } | {
162
+ content: Record<string, unknown>;
163
+ schemaName: string;
164
+ } | undefined;
165
+ } | {
166
+ type: "variation";
167
+ default: {};
168
+ })[];
169
+ };
170
+ name: "single-column";
171
+ }>, z.ZodObject<{
172
+ name: z.ZodLiteral<"two-column">;
173
+ content: z.ZodObject<{
174
+ left: z.ZodArray<z.ZodType<LayoutContentNodes, z.ZodTypeDef, {
175
+ value: string;
176
+ type: "text";
177
+ } | {
178
+ type: "tag";
179
+ tag: string;
180
+ attributes?: Record<string, string> | undefined;
181
+ font?: {
182
+ bold?: boolean | undefined;
183
+ italics?: boolean | undefined;
184
+ underline?: boolean | undefined;
185
+ color?: string | undefined;
186
+ size?: string | undefined;
187
+ fontFamily?: string | undefined;
188
+ } | undefined;
189
+ formattingOptions?: {
190
+ alignment: "left" | "center" | "right" | "justify";
191
+ } | undefined;
192
+ } | {
193
+ type: "link-to-matrix-asset";
194
+ matrixDomain: string;
195
+ matrixAssetId: string;
196
+ target: "_blank" | "_self" | "_parent" | "_top";
197
+ matrixIdentifier?: string | undefined;
198
+ formattingOptions?: {
199
+ alignment: "left" | "center" | "right" | "justify";
200
+ } | undefined;
201
+ } | {
202
+ type: "matrix-image";
203
+ matrixDomain: string;
204
+ matrixAssetId: string;
205
+ matrixIdentifier?: string | undefined;
206
+ formattingOptions?: {
207
+ alignment: "left" | "center" | "right" | "justify";
208
+ } | undefined;
209
+ } | {
210
+ type: "component";
211
+ componentId: string;
212
+ componentSet: string;
213
+ contentItem?: {
214
+ id: string;
215
+ } | {
216
+ content: Record<string, unknown>;
217
+ schemaName: string;
218
+ } | undefined;
219
+ } | {
220
+ type: "variation";
221
+ default: {};
222
+ }>, "many">;
223
+ right: z.ZodArray<z.ZodType<LayoutContentNodes, z.ZodTypeDef, {
224
+ value: string;
225
+ type: "text";
226
+ } | {
227
+ type: "tag";
228
+ tag: string;
229
+ attributes?: Record<string, string> | undefined;
230
+ font?: {
231
+ bold?: boolean | undefined;
232
+ italics?: boolean | undefined;
233
+ underline?: boolean | undefined;
234
+ color?: string | undefined;
235
+ size?: string | undefined;
236
+ fontFamily?: string | undefined;
237
+ } | undefined;
238
+ formattingOptions?: {
239
+ alignment: "left" | "center" | "right" | "justify";
240
+ } | undefined;
241
+ } | {
242
+ type: "link-to-matrix-asset";
243
+ matrixDomain: string;
244
+ matrixAssetId: string;
245
+ target: "_blank" | "_self" | "_parent" | "_top";
246
+ matrixIdentifier?: string | undefined;
247
+ formattingOptions?: {
248
+ alignment: "left" | "center" | "right" | "justify";
249
+ } | undefined;
250
+ } | {
251
+ type: "matrix-image";
252
+ matrixDomain: string;
253
+ matrixAssetId: string;
254
+ matrixIdentifier?: string | undefined;
255
+ formattingOptions?: {
256
+ alignment: "left" | "center" | "right" | "justify";
257
+ } | undefined;
258
+ } | {
259
+ type: "component";
260
+ componentId: string;
261
+ componentSet: string;
262
+ contentItem?: {
263
+ id: string;
264
+ } | {
265
+ content: Record<string, unknown>;
266
+ schemaName: string;
267
+ } | undefined;
268
+ } | {
269
+ type: "variation";
270
+ default: {};
271
+ }>, "many">;
272
+ }, "strip", z.ZodTypeAny, {
273
+ left: LayoutContentNodes[];
274
+ right: LayoutContentNodes[];
275
+ }, {
276
+ left: ({
277
+ value: string;
278
+ type: "text";
279
+ } | {
280
+ type: "tag";
281
+ tag: string;
282
+ attributes?: Record<string, string> | undefined;
283
+ font?: {
284
+ bold?: boolean | undefined;
285
+ italics?: boolean | undefined;
286
+ underline?: boolean | undefined;
287
+ color?: string | undefined;
288
+ size?: string | undefined;
289
+ fontFamily?: string | undefined;
290
+ } | undefined;
291
+ formattingOptions?: {
292
+ alignment: "left" | "center" | "right" | "justify";
293
+ } | undefined;
294
+ } | {
295
+ type: "link-to-matrix-asset";
296
+ matrixDomain: string;
297
+ matrixAssetId: string;
298
+ target: "_blank" | "_self" | "_parent" | "_top";
299
+ matrixIdentifier?: string | undefined;
300
+ formattingOptions?: {
301
+ alignment: "left" | "center" | "right" | "justify";
302
+ } | undefined;
303
+ } | {
304
+ type: "matrix-image";
305
+ matrixDomain: string;
306
+ matrixAssetId: string;
307
+ matrixIdentifier?: string | undefined;
308
+ formattingOptions?: {
309
+ alignment: "left" | "center" | "right" | "justify";
310
+ } | undefined;
311
+ } | {
312
+ type: "component";
313
+ componentId: string;
314
+ componentSet: string;
315
+ contentItem?: {
316
+ id: string;
317
+ } | {
318
+ content: Record<string, unknown>;
319
+ schemaName: string;
320
+ } | undefined;
321
+ } | {
322
+ type: "variation";
323
+ default: {};
324
+ })[];
325
+ right: ({
326
+ value: string;
327
+ type: "text";
328
+ } | {
329
+ type: "tag";
330
+ tag: string;
331
+ attributes?: Record<string, string> | undefined;
332
+ font?: {
333
+ bold?: boolean | undefined;
334
+ italics?: boolean | undefined;
335
+ underline?: boolean | undefined;
336
+ color?: string | undefined;
337
+ size?: string | undefined;
338
+ fontFamily?: string | undefined;
339
+ } | undefined;
340
+ formattingOptions?: {
341
+ alignment: "left" | "center" | "right" | "justify";
342
+ } | undefined;
343
+ } | {
344
+ type: "link-to-matrix-asset";
345
+ matrixDomain: string;
346
+ matrixAssetId: string;
347
+ target: "_blank" | "_self" | "_parent" | "_top";
348
+ matrixIdentifier?: string | undefined;
349
+ formattingOptions?: {
350
+ alignment: "left" | "center" | "right" | "justify";
351
+ } | undefined;
352
+ } | {
353
+ type: "matrix-image";
354
+ matrixDomain: string;
355
+ matrixAssetId: string;
356
+ matrixIdentifier?: string | undefined;
357
+ formattingOptions?: {
358
+ alignment: "left" | "center" | "right" | "justify";
359
+ } | undefined;
360
+ } | {
361
+ type: "component";
362
+ componentId: string;
363
+ componentSet: string;
364
+ contentItem?: {
365
+ id: string;
366
+ } | {
367
+ content: Record<string, unknown>;
368
+ schemaName: string;
369
+ } | undefined;
370
+ } | {
371
+ type: "variation";
372
+ default: {};
373
+ })[];
374
+ }>;
375
+ }, "strip", z.ZodTypeAny, {
376
+ content: {
377
+ left: LayoutContentNodes[];
378
+ right: LayoutContentNodes[];
379
+ };
380
+ name: "two-column";
381
+ }, {
382
+ content: {
383
+ left: ({
384
+ value: string;
385
+ type: "text";
386
+ } | {
387
+ type: "tag";
388
+ tag: string;
389
+ attributes?: Record<string, string> | undefined;
390
+ font?: {
391
+ bold?: boolean | undefined;
392
+ italics?: boolean | undefined;
393
+ underline?: boolean | undefined;
394
+ color?: string | undefined;
395
+ size?: string | undefined;
396
+ fontFamily?: string | undefined;
397
+ } | undefined;
398
+ formattingOptions?: {
399
+ alignment: "left" | "center" | "right" | "justify";
400
+ } | undefined;
401
+ } | {
402
+ type: "link-to-matrix-asset";
403
+ matrixDomain: string;
404
+ matrixAssetId: string;
405
+ target: "_blank" | "_self" | "_parent" | "_top";
406
+ matrixIdentifier?: string | undefined;
407
+ formattingOptions?: {
408
+ alignment: "left" | "center" | "right" | "justify";
409
+ } | undefined;
410
+ } | {
411
+ type: "matrix-image";
412
+ matrixDomain: string;
413
+ matrixAssetId: string;
414
+ matrixIdentifier?: string | undefined;
415
+ formattingOptions?: {
416
+ alignment: "left" | "center" | "right" | "justify";
417
+ } | undefined;
418
+ } | {
419
+ type: "component";
420
+ componentId: string;
421
+ componentSet: string;
422
+ contentItem?: {
423
+ id: string;
424
+ } | {
425
+ content: Record<string, unknown>;
426
+ schemaName: string;
427
+ } | undefined;
428
+ } | {
429
+ type: "variation";
430
+ default: {};
431
+ })[];
432
+ right: ({
433
+ value: string;
434
+ type: "text";
435
+ } | {
436
+ type: "tag";
437
+ tag: string;
438
+ attributes?: Record<string, string> | undefined;
439
+ font?: {
440
+ bold?: boolean | undefined;
441
+ italics?: boolean | undefined;
442
+ underline?: boolean | undefined;
443
+ color?: string | undefined;
444
+ size?: string | undefined;
445
+ fontFamily?: string | undefined;
446
+ } | undefined;
447
+ formattingOptions?: {
448
+ alignment: "left" | "center" | "right" | "justify";
449
+ } | undefined;
450
+ } | {
451
+ type: "link-to-matrix-asset";
452
+ matrixDomain: string;
453
+ matrixAssetId: string;
454
+ target: "_blank" | "_self" | "_parent" | "_top";
455
+ matrixIdentifier?: string | undefined;
456
+ formattingOptions?: {
457
+ alignment: "left" | "center" | "right" | "justify";
458
+ } | undefined;
459
+ } | {
460
+ type: "matrix-image";
461
+ matrixDomain: string;
462
+ matrixAssetId: string;
463
+ matrixIdentifier?: string | undefined;
464
+ formattingOptions?: {
465
+ alignment: "left" | "center" | "right" | "justify";
466
+ } | undefined;
467
+ } | {
468
+ type: "component";
469
+ componentId: string;
470
+ componentSet: string;
471
+ contentItem?: {
472
+ id: string;
473
+ } | {
474
+ content: Record<string, unknown>;
475
+ schemaName: string;
476
+ } | undefined;
477
+ } | {
478
+ type: "variation";
479
+ default: {};
480
+ })[];
481
+ };
482
+ name: "two-column";
483
+ }>]>, "many">;
484
+ }, "strip", z.ZodTypeAny, {
485
+ id: string;
486
+ name: string;
487
+ layouts: ({
488
+ content: {
489
+ main: LayoutContentNodes[];
490
+ };
491
+ name: "single-column";
492
+ } | {
493
+ content: {
494
+ left: LayoutContentNodes[];
495
+ right: LayoutContentNodes[];
496
+ };
497
+ name: "two-column";
498
+ })[];
499
+ }, {
500
+ id: string;
501
+ name: string;
502
+ layouts: ({
503
+ content: {
504
+ main: ({
505
+ value: string;
506
+ type: "text";
507
+ } | {
508
+ type: "tag";
509
+ tag: string;
510
+ attributes?: Record<string, string> | undefined;
511
+ font?: {
512
+ bold?: boolean | undefined;
513
+ italics?: boolean | undefined;
514
+ underline?: boolean | undefined;
515
+ color?: string | undefined;
516
+ size?: string | undefined;
517
+ fontFamily?: string | undefined;
518
+ } | undefined;
519
+ formattingOptions?: {
520
+ alignment: "left" | "center" | "right" | "justify";
521
+ } | undefined;
522
+ } | {
523
+ type: "link-to-matrix-asset";
524
+ matrixDomain: string;
525
+ matrixAssetId: string;
526
+ target: "_blank" | "_self" | "_parent" | "_top";
527
+ matrixIdentifier?: string | undefined;
528
+ formattingOptions?: {
529
+ alignment: "left" | "center" | "right" | "justify";
530
+ } | undefined;
531
+ } | {
532
+ type: "matrix-image";
533
+ matrixDomain: string;
534
+ matrixAssetId: string;
535
+ matrixIdentifier?: string | undefined;
536
+ formattingOptions?: {
537
+ alignment: "left" | "center" | "right" | "justify";
538
+ } | undefined;
539
+ } | {
540
+ type: "component";
541
+ componentId: string;
542
+ componentSet: string;
543
+ contentItem?: {
544
+ id: string;
545
+ } | {
546
+ content: Record<string, unknown>;
547
+ schemaName: string;
548
+ } | undefined;
549
+ } | {
550
+ type: "variation";
551
+ default: {};
552
+ })[];
553
+ };
554
+ name: "single-column";
555
+ } | {
556
+ content: {
557
+ left: ({
558
+ value: string;
559
+ type: "text";
560
+ } | {
561
+ type: "tag";
562
+ tag: string;
563
+ attributes?: Record<string, string> | undefined;
564
+ font?: {
565
+ bold?: boolean | undefined;
566
+ italics?: boolean | undefined;
567
+ underline?: boolean | undefined;
568
+ color?: string | undefined;
569
+ size?: string | undefined;
570
+ fontFamily?: string | undefined;
571
+ } | undefined;
572
+ formattingOptions?: {
573
+ alignment: "left" | "center" | "right" | "justify";
574
+ } | undefined;
575
+ } | {
576
+ type: "link-to-matrix-asset";
577
+ matrixDomain: string;
578
+ matrixAssetId: string;
579
+ target: "_blank" | "_self" | "_parent" | "_top";
580
+ matrixIdentifier?: string | undefined;
581
+ formattingOptions?: {
582
+ alignment: "left" | "center" | "right" | "justify";
583
+ } | undefined;
584
+ } | {
585
+ type: "matrix-image";
586
+ matrixDomain: string;
587
+ matrixAssetId: string;
588
+ matrixIdentifier?: string | undefined;
589
+ formattingOptions?: {
590
+ alignment: "left" | "center" | "right" | "justify";
591
+ } | undefined;
592
+ } | {
593
+ type: "component";
594
+ componentId: string;
595
+ componentSet: string;
596
+ contentItem?: {
597
+ id: string;
598
+ } | {
599
+ content: Record<string, unknown>;
600
+ schemaName: string;
601
+ } | undefined;
602
+ } | {
603
+ type: "variation";
604
+ default: {};
605
+ })[];
606
+ right: ({
607
+ value: string;
608
+ type: "text";
609
+ } | {
610
+ type: "tag";
611
+ tag: string;
612
+ attributes?: Record<string, string> | undefined;
613
+ font?: {
614
+ bold?: boolean | undefined;
615
+ italics?: boolean | undefined;
616
+ underline?: boolean | undefined;
617
+ color?: string | undefined;
618
+ size?: string | undefined;
619
+ fontFamily?: string | undefined;
620
+ } | undefined;
621
+ formattingOptions?: {
622
+ alignment: "left" | "center" | "right" | "justify";
623
+ } | undefined;
624
+ } | {
625
+ type: "link-to-matrix-asset";
626
+ matrixDomain: string;
627
+ matrixAssetId: string;
628
+ target: "_blank" | "_self" | "_parent" | "_top";
629
+ matrixIdentifier?: string | undefined;
630
+ formattingOptions?: {
631
+ alignment: "left" | "center" | "right" | "justify";
632
+ } | undefined;
633
+ } | {
634
+ type: "matrix-image";
635
+ matrixDomain: string;
636
+ matrixAssetId: string;
637
+ matrixIdentifier?: string | undefined;
638
+ formattingOptions?: {
639
+ alignment: "left" | "center" | "right" | "justify";
640
+ } | undefined;
641
+ } | {
642
+ type: "component";
643
+ componentId: string;
644
+ componentSet: string;
645
+ contentItem?: {
646
+ id: string;
647
+ } | {
648
+ content: Record<string, unknown>;
649
+ schemaName: string;
650
+ } | undefined;
651
+ } | {
652
+ type: "variation";
653
+ default: {};
654
+ })[];
655
+ };
656
+ name: "two-column";
657
+ })[];
658
+ }>;
659
+ type MockPageContentsResolved = z.infer<typeof PageContentsResolved>;
660
+ /**
661
+ * Use this builder for creating mock single column layouts for tests.
662
+ * @export
663
+ * @class PageSingleColumLayoutBuilder
664
+ */
665
+ export declare class PageSingleColumLayoutBuilder {
666
+ private layout;
667
+ addNode(node: LayoutContentNodes): PageSingleColumLayoutBuilder;
668
+ reset(): PageSingleColumLayoutBuilder;
669
+ build(): PageLayout;
670
+ }
671
+ /**
672
+ * Use this builder for creating mock resolved page contents for tests.
673
+ * @export
674
+ * @class PageContentResolvedMockBuilder
675
+ */
676
+ export declare class PageContentResolvedMockBuilder {
677
+ private pageContentsResolved;
678
+ private mockNodeFactory;
679
+ constructor();
680
+ setId(id: string): this;
681
+ setName(name: string): PageContentResolvedMockBuilder;
682
+ setLayouts(layouts: PageLayout[]): PageContentResolvedMockBuilder;
683
+ createLayout(): PageSingleColumLayoutBuilder;
684
+ addLayout(layout: PageLayout): PageContentResolvedMockBuilder;
685
+ nodeFactory(): MockNodeFactory;
686
+ reset(): PageContentResolvedMockBuilder;
687
+ build(): MockPageContentsResolved;
688
+ }
689
+ /**
690
+ * Use this factory for constant VALID_CONTENT_NODES.
691
+ * @export
692
+ * @class PageContentResolvedMockBuilder
693
+ */
694
+ export declare class MockNodeFactory {
695
+ createNode(nodeType: ContentNodeTypes): LayoutContentNodes;
696
+ }
697
+ export {};